]> granicus.if.org Git - re2c/commitdiff
Prefixed all tokens with 'TOKEN_'.
authorUlya Trofimovich <skvadrik@gmail.com>
Tue, 1 Dec 2015 12:59:54 +0000 (12:59 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Tue, 1 Dec 2015 12:59:54 +0000 (12:59 +0000)
Inspired by commit commit c172f266b4b611cb69bde3b46e4be350819cde73.

re2c/bootstrap/src/parse/lex.cc
re2c/bootstrap/src/parse/parser.cc
re2c/bootstrap/src/parse/y.tab.h
re2c/src/parse/lex.re
re2c/src/parse/parser.ypp

index a9e5b785881b1e49d73a6b7be826d587c3e7c954..d0207760d764c72a545f09e5366d83a99b94f252 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.15.2 on Sat Nov 28 18:04:39 2015*/
+/* Generated by re2c 0.15.2 on Tue Dec  1 12:58:01 2015 */
 #line 1 "../src/parse/lex.re"
 #include <stdlib.h>
 #include <string.h>
@@ -746,7 +746,7 @@ yy118:
 yy119:
        ++YYCURSOR;
 #line 257 "../src/parse/lex.re"
-       { yylval.regexp = lex_str('"',  opts->bCaseInsensitive ||  opts->bCaseInverted); return REGEXP; }
+       { yylval.regexp = lex_str('"',  opts->bCaseInsensitive ||  opts->bCaseInverted); return TOKEN_REGEXP; }
 #line 751 "src/parse/lex.cc"
 yy121:
        yych = (YYCTYPE)*++YYCURSOR;
@@ -755,7 +755,7 @@ yy121:
 yy122:
        ++YYCURSOR;
 #line 256 "../src/parse/lex.re"
-       { yylval.regexp = lex_str('\'', opts->bCaseInsensitive || !opts->bCaseInverted); return REGEXP; }
+       { yylval.regexp = lex_str('\'', opts->bCaseInsensitive || !opts->bCaseInverted); return TOKEN_REGEXP; }
 #line 760 "src/parse/lex.cc"
 yy124:
        ++YYCURSOR;
@@ -771,7 +771,7 @@ yy126:
 #line 271 "../src/parse/lex.re"
        {
                                        yylval.op = *tok;
-                                       return STAR;
+                                       return TOKEN_STAR;
                                }
 #line 777 "src/parse/lex.cc"
 yy128:
@@ -779,7 +779,7 @@ yy128:
 #line 275 "../src/parse/lex.re"
        {
                                        yylval.op = *tok;
-                                       return CLOSE;
+                                       return TOKEN_CLOSE;
                                }
 #line 785 "src/parse/lex.cc"
 yy130:
@@ -787,7 +787,7 @@ yy130:
 #line 359 "../src/parse/lex.re"
        {
                                        yylval.regexp = mkDot();
-                                       return REGEXP;
+                                       return TOKEN_REGEXP;
                                }
 #line 793 "src/parse/lex.cc"
 yy132:
@@ -814,7 +814,7 @@ yy136:
        ++YYCURSOR;
        if ((yych = (YYCTYPE)*YYCURSOR) == '^') goto yy176;
 #line 258 "../src/parse/lex.re"
-       { yylval.regexp = lex_cls(false); return REGEXP; }
+       { yylval.regexp = lex_cls(false); return TOKEN_REGEXP; }
 #line 819 "src/parse/lex.cc"
 yy138:
        yych = (YYCTYPE)*++YYCURSOR;
@@ -906,7 +906,7 @@ yy148:
                                                fatal("curly braces for names only allowed with -F switch");
                                        }
                                        yylval.str = new std::string (tok + 1, tok_len () - 2); // -2 to omit braces
-                                       return ID;
+                                       return TOKEN_ID;
                                }
 #line 912 "src/parse/lex.cc"
 yy150:
@@ -918,7 +918,7 @@ yy150:
                                                fatal ("repetition count overflow");
                                        }
                                        yylval.extop.max = yylval.extop.min;
-                                       return CLOSESIZE;
+                                       return TOKEN_CLOSESIZE;
                                }
 #line 924 "src/parse/lex.cc"
 yy152:
@@ -935,7 +935,7 @@ yy152:
                                                fatal ("repetition lower bound overflow");
                                        }
                                        yylval.extop.max = std::numeric_limits<uint32_t>::max();
-                                       return CLOSESIZE;
+                                       return TOKEN_CLOSESIZE;
                                }
 #line 941 "src/parse/lex.cc"
 yy155:
@@ -957,7 +957,7 @@ yy155:
                                        {
                                                fatal ("repetition upper bound overflow");
                                        }
-                                       return CLOSESIZE;
+                                       return TOKEN_CLOSESIZE;
                                }
 #line 963 "src/parse/lex.cc"
 yy159:
@@ -967,7 +967,7 @@ yy159:
        {
                                        if (!opts->FFlag) {
                                                yylval.str = new std::string (tok, tok_len());
-                                               return ID;
+                                               return TOKEN_ID;
                                        } else {
                                                RegExp *r = NULL;
                                                const bool casing = opts->bCaseInsensitive || opts->bCaseInverted;
@@ -976,7 +976,7 @@ yy159:
                                                        r = doCat(r, casing ? ichr(c) : schr(c));
                                                }
                                                yylval.regexp = r ? r : new NullOp;
-                                               return REGEXP;
+                                               return TOKEN_REGEXP;
                                        }
                                }
 #line 983 "src/parse/lex.cc"
@@ -990,7 +990,7 @@ yy163:
 #line 338 "../src/parse/lex.re"
        {
                                        yylval.str = new std::string (tok, tok_len ());
-                                       return ID;
+                                       return TOKEN_ID;
                                }
 #line 996 "src/parse/lex.cc"
 yy164:
@@ -1038,7 +1038,7 @@ yy166:
        if (yych != ':') goto yy165;
        ++YYCURSOR;
 #line 323 "../src/parse/lex.re"
-       { lex_conf (); return CONF; }
+       { lex_conf (); return TOKEN_CONF; }
 #line 1043 "src/parse/lex.cc"
 yy171:
        ++YYCURSOR;
@@ -1049,11 +1049,11 @@ yy171:
                                        if (opts->FFlag)
                                        {
                                                lexer_state = LEX_FLEX_NAME;
-                                               return FID;
+                                               return TOKEN_FID;
                                        }
                                        else
                                        {
-                                               return ID;
+                                               return TOKEN_ID;
                                        }
                                }
 #line 1060 "src/parse/lex.cc"
@@ -1074,13 +1074,13 @@ yy175:
 yy176:
        ++YYCURSOR;
 #line 259 "../src/parse/lex.re"
-       { yylval.regexp = lex_cls(true);  return REGEXP; }
+       { yylval.regexp = lex_cls(true);  return TOKEN_REGEXP; }
 #line 1079 "src/parse/lex.cc"
 yy178:
        ++YYCURSOR;
 #line 264 "../src/parse/lex.re"
        {
-                                       return SETUP;
+                                       return TOKEN_SETUP;
                                }
 #line 1086 "src/parse/lex.cc"
 yy180:
@@ -1114,7 +1114,7 @@ yy183:
        YYCURSOR = YYCTXMARKER;
 #line 261 "../src/parse/lex.re"
        {
-                                       return NOCOND;
+                                       return TOKEN_NOCOND;
                                }
 #line 1120 "src/parse/lex.cc"
 yy185:
@@ -1323,7 +1323,7 @@ yy226:
        {
                YYCURSOR = tok;
                lexer_state = LEX_NORMAL;
-               return FID_END;
+               return TOKEN_FID_END;
        }
 #line 1329 "src/parse/lex.cc"
 yy227:
index 0f1a5b9bf2c6d2dbbfc21fb5a09e44d1e0a5af64..8b3d286dcdbc076b0a4549a58c99e11c129455ee 100644 (file)
@@ -241,17 +241,17 @@ void default_rule(CondList *clist, const Code * code)
    /* Put the tokens into the symbol table, so that GDB and other debuggers
       know about them.  */
    enum yytokentype {
-     CLOSE = 258,
-     CLOSESIZE = 259,
+     TOKEN_CLOSE = 258,
+     TOKEN_CLOSESIZE = 259,
      TOKEN_CODE = 260,
-     CONF = 261,
-     ID = 262,
-     FID = 263,
-     FID_END = 264,
-     NOCOND = 265,
-     REGEXP = 266,
-     SETUP = 267,
-     STAR = 268
+     TOKEN_CONF = 261,
+     TOKEN_ID = 262,
+     TOKEN_FID = 263,
+     TOKEN_FID_END = 264,
+     TOKEN_NOCOND = 265,
+     TOKEN_REGEXP = 266,
+     TOKEN_SETUP = 267,
+     TOKEN_STAR = 268
    };
 #endif
 
@@ -597,11 +597,12 @@ static const yytype_uint16 yyrline[] =
    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
 static const char *const yytname[] =
 {
-  "$end", "error", "$undefined", "CLOSE", "CLOSESIZE", "TOKEN_CODE",
-  "CONF", "ID", "FID", "FID_END", "NOCOND", "REGEXP", "SETUP", "STAR",
-  "'='", "';'", "'/'", "'<'", "'>'", "':'", "','", "'|'", "'\\\\'", "'('",
-  "')'", "$accept", "spec", "decl", "rule", "cond", "clist", "newcond",
-  "look", "expr", "diff", "term", "factor", "close", "primary", 0
+  "$end", "error", "$undefined", "TOKEN_CLOSE", "TOKEN_CLOSESIZE",
+  "TOKEN_CODE", "TOKEN_CONF", "TOKEN_ID", "TOKEN_FID", "TOKEN_FID_END",
+  "TOKEN_NOCOND", "TOKEN_REGEXP", "TOKEN_SETUP", "TOKEN_STAR", "'='",
+  "';'", "'/'", "'<'", "'>'", "':'", "','", "'|'", "'\\\\'", "'('", "')'",
+  "$accept", "spec", "decl", "rule", "cond", "clist", "newcond", "look",
+  "expr", "diff", "term", "factor", "close", "primary", 0
 };
 #endif
 
index d484c429f5f14bab546d9e88529683efea49e948..5a876216cd646594af39ef7b132b354753df85fd 100644 (file)
    /* Put the tokens into the symbol table, so that GDB and other debuggers
       know about them.  */
    enum yytokentype {
-     CLOSE = 258,
-     CLOSESIZE = 259,
+     TOKEN_CLOSE = 258,
+     TOKEN_CLOSESIZE = 259,
      TOKEN_CODE = 260,
-     CONF = 261,
-     ID = 262,
-     FID = 263,
-     FID_END = 264,
-     NOCOND = 265,
-     REGEXP = 266,
-     SETUP = 267,
-     STAR = 268
+     TOKEN_CONF = 261,
+     TOKEN_ID = 262,
+     TOKEN_FID = 263,
+     TOKEN_FID_END = 264,
+     TOKEN_NOCOND = 265,
+     TOKEN_REGEXP = 266,
+     TOKEN_SETUP = 267,
+     TOKEN_STAR = 268
    };
 #endif
 
index 9e4f0f5b3d0d4dd2fa39c72b3a60c4c0826e4784..16c1ce0cfeb0964c9e8243df8be57d1a18b3e565 100644 (file)
@@ -253,16 +253,16 @@ start:
                                        return 0;
                                }
 
-       "'"  { yylval.regexp = lex_str('\'', opts->bCaseInsensitive || !opts->bCaseInverted); return REGEXP; }
-       "\"" { yylval.regexp = lex_str('"',  opts->bCaseInsensitive ||  opts->bCaseInverted); return REGEXP; }
-       "["  { yylval.regexp = lex_cls(false); return REGEXP; }
-       "[^" { yylval.regexp = lex_cls(true);  return REGEXP; }
+       "'"  { yylval.regexp = lex_str('\'', opts->bCaseInsensitive || !opts->bCaseInverted); return TOKEN_REGEXP; }
+       "\"" { yylval.regexp = lex_str('"',  opts->bCaseInsensitive ||  opts->bCaseInverted); return TOKEN_REGEXP; }
+       "["  { yylval.regexp = lex_cls(false); return TOKEN_REGEXP; }
+       "[^" { yylval.regexp = lex_cls(true);  return TOKEN_REGEXP; }
 
        "<>" / (space* ("{" | "=>" | ":=")) {
-                                       return NOCOND;
+                                       return TOKEN_NOCOND;
                                }
        "<!"            {
-                                       return SETUP;
+                                       return TOKEN_SETUP;
                                }
        [<>,()|=;/\\]   {
                                        return *tok;
@@ -270,11 +270,11 @@ start:
 
        "*"                     {
                                        yylval.op = *tok;
-                                       return STAR;
+                                       return TOKEN_STAR;
                                }
        [+?]            {
                                        yylval.op = *tok;
-                                       return CLOSE;
+                                       return TOKEN_CLOSE;
                                }
 
        "{" [0-9]+ "}"  {
@@ -283,7 +283,7 @@ start:
                                                fatal ("repetition count overflow");
                                        }
                                        yylval.extop.max = yylval.extop.min;
-                                       return CLOSESIZE;
+                                       return TOKEN_CLOSESIZE;
                                }
 
        "{" [0-9]+ "," [0-9]+ "}"       {
@@ -296,7 +296,7 @@ start:
                                        {
                                                fatal ("repetition upper bound overflow");
                                        }
-                                       return CLOSESIZE;
+                                       return TOKEN_CLOSESIZE;
                                }
 
        "{" [0-9]+ ",}"         {
@@ -305,7 +305,7 @@ start:
                                                fatal ("repetition lower bound overflow");
                                        }
                                        yylval.extop.max = std::numeric_limits<uint32_t>::max();
-                                       return CLOSESIZE;
+                                       return TOKEN_CLOSESIZE;
                                }
 
        "{" [0-9]* ","          {
@@ -317,33 +317,33 @@ start:
                                                fatal("curly braces for names only allowed with -F switch");
                                        }
                                        yylval.str = new std::string (tok + 1, tok_len () - 2); // -2 to omit braces
-                                       return ID;
+                                       return TOKEN_ID;
                                }
 
-       "re2c:" { lex_conf (); return CONF; }
+       "re2c:" { lex_conf (); return TOKEN_CONF; }
 
        name / (space+ [^=>,])  {
                                        yylval.str = new std::string (tok, tok_len ());
                                        if (opts->FFlag)
                                        {
                                                lexer_state = LEX_FLEX_NAME;
-                                               return FID;
+                                               return TOKEN_FID;
                                        }
                                        else
                                        {
-                                               return ID;
+                                               return TOKEN_ID;
                                        }
                                }
 
        name / (space* [=>,])   {
                                        yylval.str = new std::string (tok, tok_len ());
-                                       return ID;
+                                       return TOKEN_ID;
                                }
 
        name / [^]      {
                                        if (!opts->FFlag) {
                                                yylval.str = new std::string (tok, tok_len());
-                                               return ID;
+                                               return TOKEN_ID;
                                        } else {
                                                RegExp *r = NULL;
                                                const bool casing = opts->bCaseInsensitive || opts->bCaseInverted;
@@ -352,13 +352,13 @@ start:
                                                        r = doCat(r, casing ? ichr(c) : schr(c));
                                                }
                                                yylval.regexp = r ? r : new NullOp;
-                                               return REGEXP;
+                                               return TOKEN_REGEXP;
                                        }
                                }
 
        "."                     {
                                        yylval.regexp = mkDot();
-                                       return REGEXP;
+                                       return TOKEN_REGEXP;
                                }
 
        space+          {
@@ -389,7 +389,7 @@ flex_name:
        {
                YYCURSOR = tok;
                lexer_state = LEX_NORMAL;
-               return FID_END;
+               return TOKEN_FID_END;
        }
        *
        {
index 20e9ce99583f6619a3302c79cd5fdef887551708..6f5eb331f972ca686966ce317268631d109a1a47 100644 (file)
@@ -158,23 +158,23 @@ void default_rule(CondList *clist, const Code * code)
        re2c::CondList * clist;
 };
 
-%token CLOSE
-%token CLOSESIZE
+%token TOKEN_CLOSE
+%token TOKEN_CLOSESIZE
 %token TOKEN_CODE
-%token CONF
-%token ID
-%token FID
-%token FID_END
-%token NOCOND
-%token REGEXP
-%token SETUP
-%token STAR
-
-%type <op>      CLOSE STAR SETUP close
-%type <extop>   CLOSESIZE
+%token TOKEN_CONF
+%token TOKEN_ID
+%token TOKEN_FID
+%token TOKEN_FID_END
+%token TOKEN_NOCOND
+%token TOKEN_REGEXP
+%token TOKEN_SETUP
+%token TOKEN_STAR
+
+%type <op>      TOKEN_CLOSE TOKEN_STAR TOKEN_SETUP close
+%type <extop>   TOKEN_CLOSESIZE
 %type <code>    TOKEN_CODE
-%type <regexp>  REGEXP rule look expr diff term factor primary
-%type <str>     ID FID newcond
+%type <regexp>  TOKEN_REGEXP rule look expr diff term factor primary
+%type <str>     TOKEN_ID TOKEN_FID newcond
 %type <clist>   cond clist
 
 %%
@@ -191,7 +191,7 @@ spec:
 ;
 
 decl:
-               ID '=' expr ';'
+               TOKEN_ID '=' expr ';'
                {
                        if (!symbol_table.insert (std::make_pair (* $1, $3)).second)
                        {
@@ -200,7 +200,7 @@ decl:
                        delete $1;
                        $3->ins_access = RegExp::PRIVATE;
                }
-       |       FID expr FID_END
+       |       TOKEN_FID expr TOKEN_FID_END
                {
                        if (!symbol_table.insert (std::make_pair (* $1, $2)).second)
                        {
@@ -209,15 +209,15 @@ decl:
                        delete $1;
                        $2->ins_access = RegExp::PRIVATE;
                }
-       |       ID '=' expr '/'
+       |       TOKEN_ID '=' expr '/'
                {
                        in->fatal("trailing contexts are not allowed in named definitions");
                }
-       |       FID expr '/'
+       |       TOKEN_FID expr '/'
                {
                        in->fatal("trailing contexts are not allowed in named definitions");
                }
-       |       CONF {}
+       |       TOKEN_CONF {}
 ;
 
 rule:
@@ -238,7 +238,7 @@ rule:
                                );
                        spec.add (rule);
                }
-       |       STAR TOKEN_CODE /* default rule */
+       |       TOKEN_STAR TOKEN_CODE /* default rule */
                {
                        if (opts->cFlag)
                                in->fatal("condition or '<*>' required when using -c switch");
@@ -277,11 +277,11 @@ rule:
                        context_none($2);
                        delete $6;
                }
-       |       '<' cond '>' STAR TOKEN_CODE /* default rule for conditions */
+       |       '<' cond '>' TOKEN_STAR TOKEN_CODE /* default rule for conditions */
                {
                        default_rule($2, $5);
                }
-       |       '<' STAR '>' expr look newcond TOKEN_CODE
+       |       '<' TOKEN_STAR '>' expr look newcond TOKEN_CODE
                {
                        context_check(NULL);
                        RuleOp * rule = new RuleOp
@@ -296,7 +296,7 @@ rule:
                        specStar.push_back (rule);
                        delete $6;
                }
-       |       '<' STAR '>' expr look ':' newcond
+       |       '<' TOKEN_STAR '>' expr look ':' newcond
                {
                        assert($7);
                        context_check(NULL);
@@ -313,18 +313,18 @@ rule:
                        specStar.push_back (rule);
                        delete $7;
                }
-       |       '<' STAR '>' look newcond TOKEN_CODE
+       |       '<' TOKEN_STAR '>' look newcond TOKEN_CODE
                {
                        context_none(NULL);
                        delete $5;
                }
-       |       '<' STAR '>' look ':' newcond
+       |       '<' TOKEN_STAR '>' look ':' newcond
                {
                        assert($6);
                        context_none(NULL);
                        delete $6;
                }
-       |       '<' STAR '>' STAR TOKEN_CODE /* default rule for all conditions */
+       |       '<' TOKEN_STAR '>' TOKEN_STAR TOKEN_CODE /* default rule for all conditions */
                {
                        if (star_default)
                        {
@@ -340,7 +340,7 @@ rule:
                                , NULL
                                );
                }
-       |       NOCOND newcond TOKEN_CODE
+       |       TOKEN_NOCOND newcond TOKEN_CODE
                {
                        context_check(NULL);
                        if (specNone)
@@ -358,7 +358,7 @@ rule:
                                );
                        delete $2;
                }
-       |       NOCOND ':' newcond
+       |       TOKEN_NOCOND ':' newcond
                {
                        assert($3);
                        context_check(NULL);
@@ -378,13 +378,13 @@ rule:
                                );
                        delete $3;
                }
-       |       SETUP STAR '>' TOKEN_CODE
+       |       TOKEN_SETUP TOKEN_STAR '>' TOKEN_CODE
                {
                        CondList *clist = new CondList();
                        clist->insert("*");
                        setup_rule(clist, $4);
                }
-       |       SETUP cond '>' TOKEN_CODE
+       |       TOKEN_SETUP cond '>' TOKEN_CODE
                {
                        setup_rule($2, $4);
                }
@@ -402,13 +402,13 @@ cond:
        ;
 
 clist:
-               ID
+               TOKEN_ID
                {
                        $$ = new CondList();
                        $$->insert(* $1);
                        delete $1;
                }
-       |       clist ',' ID
+       |       clist ',' TOKEN_ID
                {
                        $1->insert(* $3);
                        delete $3;
@@ -421,7 +421,7 @@ newcond:
                {
                        $$ = NULL;
                }
-       |       '=' '>' ID
+       |       '=' '>' TOKEN_ID
                {
                        $$ = $3;
                }
@@ -491,7 +491,7 @@ factor:
                                break;
                        }
                }
-       |       primary CLOSESIZE
+       |       primary TOKEN_CLOSESIZE
                {
                        $1->ins_access = RegExp::PRIVATE;
                        if ($2.max == std::numeric_limits<uint32_t>::max())
@@ -511,26 +511,26 @@ factor:
 ;
 
 close:
-               CLOSE
+               TOKEN_CLOSE
                {
                        $$ = $1;
                }
-       |       STAR
+       |       TOKEN_STAR
                {
                        $$ = $1;
                }
-       |       close CLOSE
+       |       close TOKEN_CLOSE
                {
                        $$ = ($1 == $2) ? $1 : '*';
                }
-       |       close STAR
+       |       close TOKEN_STAR
                {
                        $$ = ($1 == $2) ? $1 : '*';
                }
 ;
 
 primary:
-               ID
+               TOKEN_ID
                {
                        symbol_table_t::iterator i = symbol_table.find (* $1);
                        delete $1;
@@ -540,7 +540,7 @@ primary:
                        }
                        $$ = i->second;
                }
-       |       REGEXP
+       |       TOKEN_REGEXP
                {
                        $$ = $1;
                }