diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/IceStorm/Scanner.cpp | 92 | ||||
-rw-r--r-- | cpp/src/IceStorm/Scanner.l | 10 |
2 files changed, 57 insertions, 45 deletions
diff --git a/cpp/src/IceStorm/Scanner.cpp b/cpp/src/IceStorm/Scanner.cpp index 4d5ee833556..836088760d3 100644 --- a/cpp/src/IceStorm/Scanner.cpp +++ b/cpp/src/IceStorm/Scanner.cpp @@ -1,11 +1,12 @@ -#line 1 "src/IceStorm/Scanner.cpp" // // Copyright (c) ZeroC, Inc. All rights reserved. // #include <IceUtil/ScannerConfig.h> -#line 8 "src/IceStorm/Scanner.cpp" +#line 1 "Scanner.cpp" + +#line 3 "Scanner.cpp" #define YY_INT_ALIGNED short int @@ -454,14 +455,32 @@ int yy_flex_debug = 0; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "src/IceStorm/Scanner.l" - -#line 11 "src/IceStorm/Scanner.l" +#line 1 "Scanner.l" +#line 2 "Scanner.l" #include <Ice/Ice.h> #include <IceStorm/Parser.h> #include <IceStorm/Grammar.h> +#if defined(_MSC_VER) +// '<' : signed/unsigned mismatch +# pragma warning(disable:4018) +// 'initializing' : conversion from '__int64' to 'int', possible loss of data +# pragma warning(disable:4244) + +# if defined(ICE_64) +// +// '=' : conversion from 'size_t' to 'int', possible loss of data +// The result of fread() is a size_t and gets inserted into an int +// +# pragma warning(disable:4267) +# endif +#endif + +#if defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wsign-compare" +#endif + using namespace std; using namespace Ice; using namespace IceStorm; @@ -471,6 +490,7 @@ using namespace IceStorm; # undef yywrap # define yywrap() 1 # endif +# define YY_NO_UNISTD_H #endif #define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) @@ -478,15 +498,16 @@ using namespace IceStorm; namespace IceStorm { -static std::map<std::string, int> keywordMap; +typedef std::map<std::string, int> StringTokenMap; +static StringTokenMap keywordMap; void initScanner(); } #define YY_USER_INIT initScanner(); -#line 495 "src/IceStorm/Scanner.cpp" -#line 496 "src/IceStorm/Scanner.cpp" +#line 517 "Scanner.cpp" +#line 518 "Scanner.cpp" #define INITIAL 0 @@ -703,9 +724,10 @@ YY_DECL } { -#line 55 "src/IceStorm/Scanner.l" +#line 74 "Scanner.l" -#line 716 "src/IceStorm/Scanner.cpp" + +#line 738 "Scanner.cpp" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -764,7 +786,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 57 "src/IceStorm/Scanner.l" +#line 76 "Scanner.l" { // C++-style comment int c; @@ -777,7 +799,7 @@ YY_RULE_SETUP YY_BREAK case 2: YY_RULE_SETUP -#line 67 "src/IceStorm/Scanner.l" +#line 86 "Scanner.l" { // C-style comment while(true) @@ -806,7 +828,7 @@ YY_RULE_SETUP case 3: /* rule 3 can match eol */ YY_RULE_SETUP -#line 92 "src/IceStorm/Scanner.l" +#line 111 "Scanner.l" { size_t len = strlen(yytext); for(size_t i = 0; i < len; ++i) @@ -821,14 +843,14 @@ YY_RULE_SETUP case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 103 "src/IceStorm/Scanner.l" +#line 122 "Scanner.l" { return ';'; } YY_BREAK case 5: YY_RULE_SETUP -#line 107 "src/IceStorm/Scanner.l" +#line 126 "Scanner.l" { // "..."-type strings string s; @@ -875,7 +897,7 @@ YY_RULE_SETUP YY_BREAK case 6: YY_RULE_SETUP -#line 151 "src/IceStorm/Scanner.l" +#line 170 "Scanner.l" { // '...'-type strings string s; @@ -903,7 +925,7 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 176 "src/IceStorm/Scanner.l" +#line 195 "Scanner.l" { // Simple strings string s; @@ -927,16 +949,16 @@ YY_RULE_SETUP yylvalp->clear(); yylvalp->push_back(s); - const auto pos = keywordMap.find(s); + StringTokenMap::const_iterator pos = keywordMap.find(s); return pos != keywordMap.end() ? pos->second : ICE_STORM_STRING; } YY_BREAK case 8: YY_RULE_SETUP -#line 203 "src/IceStorm/Scanner.l" +#line 222 "Scanner.l" ECHO; YY_BREAK -#line 947 "src/IceStorm/Scanner.cpp" +#line 969 "Scanner.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1941,7 +1963,8 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 203 "src/IceStorm/Scanner.l" +#line 222 "Scanner.l" + namespace IceStorm { @@ -1952,20 +1975,19 @@ namespace IceStorm { void initScanner() { - keywordMap = { - {"help", ICE_STORM_HELP}, - {"quit", ICE_STORM_EXIT}, - {"exit", ICE_STORM_EXIT}, - {"current", ICE_STORM_CURRENT}, - {"create", ICE_STORM_CREATE}, - {"destroy", ICE_STORM_DESTROY}, - {"link", ICE_STORM_LINK}, - {"unlink", ICE_STORM_UNLINK}, - {"links", ICE_STORM_LINKS}, - {"topics", ICE_STORM_TOPICS}, - {"replica", ICE_STORM_REPLICA}, - {"subscribers", ICE_STORM_SUBSCRIBERS}, - }; + keywordMap["help"] = ICE_STORM_HELP; + keywordMap["quit"] = ICE_STORM_EXIT; + keywordMap["exit"] = ICE_STORM_EXIT; + keywordMap["current"] = ICE_STORM_CURRENT; + keywordMap["create"] = ICE_STORM_CREATE; + keywordMap["destroy"] = ICE_STORM_DESTROY; + keywordMap["link"] = ICE_STORM_LINK; + keywordMap["unlink"] = ICE_STORM_UNLINK; + keywordMap["links"] = ICE_STORM_LINKS; + keywordMap["topics"] = ICE_STORM_TOPICS; + keywordMap["replica"] = ICE_STORM_REPLICA; + keywordMap["subscribers"] = ICE_STORM_SUBSCRIBERS; } } + diff --git a/cpp/src/IceStorm/Scanner.l b/cpp/src/IceStorm/Scanner.l index 3789e14f62f..0e28d3eb981 100644 --- a/cpp/src/IceStorm/Scanner.l +++ b/cpp/src/IceStorm/Scanner.l @@ -39,16 +39,6 @@ using namespace IceStorm; # define YY_NO_UNISTD_H #endif -#ifdef __SUNPRO_CC -# ifdef yywrap -# undef yywrap -# define yywrap() 1 -# endif -# ifdef ICE_64 -# pragma error_messages(off,truncwarn) -# endif -#endif - #define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) namespace IceStorm |