]> granicus.if.org Git - re2c/commitdiff
Keep name table together with other options.
authorUlya Trofimovich <skvadrik@gmail.com>
Mon, 21 Sep 2015 21:14:45 +0000 (22:14 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Mon, 21 Sep 2015 21:14:45 +0000 (22:14 +0100)
14 files changed:
re2c/bootstrap/src/parse/parser.cc
re2c/bootstrap/src/parse/scanner_lex.cc
re2c/src/codegen/bitmap.cc
re2c/src/codegen/code_names.cc
re2c/src/codegen/emit_action.cc
re2c/src/codegen/emit_dfa.cc
re2c/src/codegen/go_emit.cc
re2c/src/codegen/input_api.cc
re2c/src/codegen/output.cc
re2c/src/conf/opt.h
re2c/src/globals.h
re2c/src/parse/parser.ypp
re2c/src/parse/scanner.cc
re2c/src/parse/scanner_lex.re

index 2ddd964059e120eddd5789ae480da0f2d49190ae..c71a808dee42201411cb4072ffdd8b7b87685aaa 100644 (file)
@@ -1759,7 +1759,7 @@ yyreduce:
   case 9:
 
     {
-               if (!mapCodeName.insert (std::make_pair (*(yyvsp[(1) - (3)].str), *(yyvsp[(2) - (3)].str))).second)
+               if (!opts.mapCodeName.insert (std::make_pair (*(yyvsp[(1) - (3)].str), *(yyvsp[(2) - (3)].str))).second)
                {
                        in->fatalf ("configuration '%s' is already set and cannot be changed", (yyvsp[(1) - (3)].str)->c_str ());
                }
@@ -1966,7 +1966,7 @@ yyreduce:
     {
                opts.yychConversion = (yyvsp[(2) - (3)].num) == 0
                        ? ""
-                       : "(" + mapCodeName["YYCTYPE"] + ")";
+                       : "(" + opts.mapCodeName["YYCTYPE"] + ")";
        ;}
     break;
 
index 1a3b8b97474947b82a58e3b8a4be3e0b595b9ea0..9c7f09bd2a58575d9baa2d2be66bd8daa156246e 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.14.3 on Mon Sep 21 21:09:54 2015 */
+/* Generated by re2c 0.14.3 on Mon Sep 21 22:04:43 2015 */
 #line 1 "../src/parse/scanner_lex.re"
 #include <stdlib.h>
 #include <string.h>
@@ -238,7 +238,7 @@ yy21:
        {
                                        if (opts.rFlag)
                                        {
-                                               mapCodeName.clear();
+                                               opts.mapCodeName.clear();
                                        }
                                        else
                                        {
index ebd968a447ecb5373624b016eb429db3691753a1..4d5ccda686fc363b88a7c52f7e87de0767afeb8a 100644 (file)
@@ -74,7 +74,7 @@ void BitMap::gen(OutputFile & o, uint32_t ind, uint32_t lb, uint32_t ub)
 {
        if (first && bUsedYYBitmap)
        {
-               o << indent(ind) << "static const unsigned char " << mapCodeName["yybm"] << "[] = {";
+               o << indent(ind) << "static const unsigned char " << opts.mapCodeName["yybm"] << "[] = {";
 
                uint32_t c = 1, n = ub - lb;
                const BitMap *cb = first;
index 3398d8b83a1ac854e8509956f73e08547ae9a8f8..2be7f28158d0f0b254b94c36c1a6895cd7a67a3a 100644 (file)
@@ -1,5 +1,4 @@
 #include "src/codegen/code_names.h"
-#include "src/globals.h"
 
 namespace re2c
 {
index 00e15061dd1f1559c6296839f2aa92669ac69d57..ec1a7d2aefab526d2cc738bfa742723a7002e509 100644 (file)
@@ -110,7 +110,7 @@ void emit_initial (OutputFile & o, uint32_t ind, bool & readCh, const State * co
 
        if (opts.dFlag)
        {
-               o << indent(ind) << mapCodeName["YYDEBUG"] << "(" << initial.label << ", *" << mapCodeName["YYCURSOR"] << ");" << "\n";
+               o << indent(ind) << opts.mapCodeName["YYDEBUG"] << "(" << initial.label << ", *" << opts.mapCodeName["YYCURSOR"] << ");" << "\n";
        }
 
        if (s->link)
@@ -136,7 +136,7 @@ void emit_save (OutputFile & o, uint32_t ind, bool & readCh, const State * const
 
        if (save_yyaccept)
        {
-               o << indent (ind) << mapCodeName["yyaccept"] << " = " << save << ";\n";
+               o << indent (ind) << opts.mapCodeName["yyaccept"] << " = " << save << ";\n";
        }
 
        if (s->link)
@@ -156,7 +156,7 @@ void emit_accept_binary (OutputFile & o, uint32_t ind, bool & readCh, const Stat
        if (l < r)
        {
                const uint32_t m = (l + r) >> 1;
-               o << indent(ind) << "if (" << mapCodeName["yyaccept"] << (r == l+1 ? " == " : " <= ") << m << ") {\n";
+               o << indent(ind) << "if (" << opts.mapCodeName["yyaccept"] << (r == l+1 ? " == " : " <= ") << m << ") {\n";
                emit_accept_binary (o, ++ind, readCh, s, accepts, l, m);
                o << indent(--ind) << "} else {\n";
                emit_accept_binary (o, ++ind, readCh, s, accepts, m + 1, r);
@@ -189,13 +189,13 @@ void emit_accept (OutputFile & o, uint32_t ind, bool & readCh, const State * con
                        if (opts.gFlag && accepts_size >= opts.cGotoThreshold)
                        {
                                o << indent(ind++) << "{\n";
-                               o << indent(ind++) << "static void *" << mapCodeName["yytarget"] << "[" << accepts_size << "] = {\n";
+                               o << indent(ind++) << "static void *" << opts.mapCodeName["yytarget"] << "[" << accepts_size << "] = {\n";
                                for (uint32_t i = 0; i < accepts_size; ++i)
                                {
                                        o << indent(ind) << "&&" << opts.labelPrefix << accepts[i]->label << ",\n";
                                }
                                o << indent(--ind) << "};\n";
-                               o << indent(ind) << "goto *" << mapCodeName["yytarget"] << "[" << mapCodeName["yyaccept"] << "];\n";
+                               o << indent(ind) << "goto *" << opts.mapCodeName["yytarget"] << "[" << opts.mapCodeName["yyaccept"] << "];\n";
                                o << indent(--ind) << "}\n";
                        }
                        else if (opts.sFlag || (accepts_size == 2 && !opts.DFlag))
@@ -212,7 +212,7 @@ void emit_accept (OutputFile & o, uint32_t ind, bool & readCh, const State * con
                        }
                        else
                        {
-                               o << indent(ind) << "switch (" << mapCodeName["yyaccept"] << ") {\n";
+                               o << indent(ind) << "switch (" << opts.mapCodeName["yyaccept"] << ") {\n";
                                for (uint32_t i = 0; i < accepts_size - 1; ++i)
                                {
                                        o << indent(ind) << "case " << i << ": \t";
@@ -292,11 +292,11 @@ void need (OutputFile & o, uint32_t ind, bool & readCh, uint32_t n, bool bSetMar
                last_fill_index++;
                if (opts.bUseYYSetStateParam)
                {
-                       o << indent(ind) << mapCodeName["YYSETSTATE"] << "(" << fillIndex << ");\n";
+                       o << indent(ind) << opts.mapCodeName["YYSETSTATE"] << "(" << fillIndex << ");\n";
                }
                else
                {
-                       o << indent(ind) << replaceParam(mapCodeName["YYSETSTATE"], opts.yySetStateParam, fillIndex) << "\n";
+                       o << indent(ind) << replaceParam(opts.mapCodeName["YYSETSTATE"], opts.yySetStateParam, fillIndex) << "\n";
                }
        }
 
@@ -323,7 +323,7 @@ void need (OutputFile & o, uint32_t ind, bool & readCh, uint32_t n, bool bSetMar
 
        if (opts.fFlag)
        {
-               o << mapCodeName["yyFillLabel"] << fillIndex << ":\n";
+               o << opts.mapCodeName["yyFillLabel"] << fillIndex << ":\n";
        }
 
        if (n > 0)
@@ -344,7 +344,7 @@ void genYYFill(OutputFile & o, uint32_t need)
 {
        if (opts.bUseYYFillParam)
        {
-               o << mapCodeName["YYFILL"];
+               o << opts.mapCodeName["YYFILL"];
                if (!opts.bUseYYFillNaked)
                {
                        o << "(" << need << ");";
@@ -353,7 +353,7 @@ void genYYFill(OutputFile & o, uint32_t need)
        }
        else
        {
-               o << replaceParam(mapCodeName["YYFILL"], opts.yyFillLength, need);
+               o << replaceParam(opts.mapCodeName["YYFILL"], opts.yyFillLength, need);
                if (!opts.bUseYYFillNaked)
                {
                        o << ";";
@@ -366,11 +366,11 @@ void genSetCondition(OutputFile & o, uint32_t ind, const std::string& newcond)
 {
        if (opts.bUseYYSetConditionParam)
        {
-               o << indent(ind) << mapCodeName["YYSETCONDITION"] << "(" << opts.condEnumPrefix << newcond << ");\n";
+               o << indent(ind) << opts.mapCodeName["YYSETCONDITION"] << "(" << opts.condEnumPrefix << newcond << ");\n";
        }
        else
        {
-               o << indent(ind) << replaceParam(mapCodeName["YYSETCONDITION"], opts.yySetConditionParam, opts.condEnumPrefix + newcond) << "\n";
+               o << indent(ind) << replaceParam(opts.mapCodeName["YYSETCONDITION"], opts.yySetConditionParam, opts.condEnumPrefix + newcond) << "\n";
        }
 }
 
index fee6330013287e855e037bfa87d3102cb7592f0c..383e6638b9bc691574ad8f3146a8a87b72c43dbb 100644 (file)
@@ -20,11 +20,11 @@ std::string genGetCondition()
 {
        if (opts.bUseYYGetConditionNaked)
        {
-               return mapCodeName["YYGETCONDITION"];
+               return opts.mapCodeName["YYGETCONDITION"];
        }
        else
        {
-               return mapCodeName["YYGETCONDITION"] + "()";
+               return opts.mapCodeName["YYGETCONDITION"] + "()";
        }
 }
 
@@ -55,7 +55,7 @@ void emit_state (OutputFile & o, uint32_t ind, const State * s, bool used_label)
                }
                if (opts.dFlag && (s->action.type != Action::INITIAL))
                {
-                       o << indent(ind) << mapCodeName["YYDEBUG"] << "(" << s->label << ", " << opts.input_api.expr_peek () << ");\n";
+                       o << indent(ind) << opts.mapCodeName["YYDEBUG"] << "(" << s->label << ", " << opts.input_api.expr_peek () << ");\n";
                }
                if (s->isPreCtxt)
                {
@@ -166,7 +166,7 @@ void DFA::emit(Output & output, uint32_t& ind, bool isLastCond, bool& bPrologBra
                        {
                                if (opts.bEmitYYCh)
                                {
-                                       o << indent(ind) << mapCodeName["YYCTYPE"] << " " << mapCodeName["yych"] << ";\n";
+                                       o << indent(ind) << opts.mapCodeName["YYCTYPE"] << " " << opts.mapCodeName["yych"] << ";\n";
                                }
                                o.insert_yyaccept_init (ind);
                        }
@@ -250,7 +250,7 @@ void DFA::emit(Output & output, uint32_t& ind, bool isLastCond, bool& bPrologBra
 void genCondTable(OutputFile & o, uint32_t ind, const std::vector<std::string> & condnames)
 {
        const size_t conds = condnames.size ();
-       o << indent(ind++) << "static void *" << mapCodeName["yyctable"] << "[" << conds << "] = {\n";
+       o << indent(ind++) << "static void *" << opts.mapCodeName["yyctable"] << "[" << conds << "] = {\n";
        for (size_t i = 0; i < conds; ++i)
        {
                o << indent(ind) << "&&" << opts.condPrefix << condnames[i] << ",\n";
@@ -313,7 +313,7 @@ void genCondGoto(OutputFile & o, uint32_t ind, const std::vector<std::string> &
        }
        else if (opts.gFlag)
        {
-               o << indent(ind) << "goto *" << mapCodeName["yyctable"] << "[" << genGetCondition() << "];\n";
+               o << indent(ind) << "goto *" << opts.mapCodeName["yyctable"] << "[" << genGetCondition() << "];\n";
        }
        else if (opts.sFlag)
        {
index 64f240b77c6b2c3a16307e9829c3ceffcad83e06..6e2fa3dc308190b9445ba7d65841c689848cd535 100644 (file)
@@ -21,7 +21,7 @@ std::string output_yych (bool & readCh)
        }
        else
        {
-               return mapCodeName["yych"];
+               return opts.mapCodeName["yych"];
        }
 }
 
@@ -50,7 +50,7 @@ std::string output_hgo (OutputFile & o, uint32_t ind, bool & readCh, SwitchIf *
                o << indent (ind) << "if (" << yych <<" & ~0xFF) {\n";
                hgo->emit (o, ind + 1, readCh);
                o << indent (ind) << "} else ";
-               yych = mapCodeName["yych"];
+               yych = opts.mapCodeName["yych"];
        }
        else
        {
@@ -154,7 +154,7 @@ void SwitchIf::emit (OutputFile & o, uint32_t ind, bool & readCh)
 void GoBitmap::emit (OutputFile & o, uint32_t ind, bool & readCh)
 {
        std::string yych = output_hgo (o, ind, readCh, hgo);
-       o << "if (" << mapCodeName["yybm"] << "[" << bitmap->i << "+" << yych << "] & ";
+       o << "if (" << opts.mapCodeName["yybm"] << "[" << bitmap->i << "+" << yych << "] & ";
        if (opts.yybmHexTable)
        {
                o.write_hex (bitmap->m);
@@ -187,7 +187,7 @@ label_t CpgotoTable::max_label () const
 
 void CpgotoTable::emit (OutputFile & o, uint32_t ind)
 {
-       o << indent (ind) << "static void *" << mapCodeName["yytarget"] << "[256] = {\n";
+       o << indent (ind) << "static void *" << opts.mapCodeName["yytarget"] << "[256] = {\n";
        o << indent (++ind);
        const uint32_t max_digits = max_label ().width ();
        for (uint32_t i = 0; i < TABLE_SIZE; ++i)
@@ -215,7 +215,7 @@ void Cpgoto::emit (OutputFile & o, uint32_t ind, bool & readCh)
        std::string yych = output_hgo (o, ind, readCh, hgo);
        o << "{\n";
        table->emit (o, ++ind);
-       o << indent(ind) << "goto *" << mapCodeName["yytarget"] << "[" << yych << "];\n";
+       o << indent(ind) << "goto *" << opts.mapCodeName["yytarget"] << "[" << yych << "];\n";
        o << indent(--ind) << "}\n";
 }
 
index 2ecc7ce573b44b2c4cb110757a518a720c2c760a..297b2cc1ee2ea9005a752932f5efc082a9c63658 100644 (file)
@@ -18,10 +18,10 @@ std::string InputAPI::expr_peek ()
        switch (type)
        {
                case DEFAULT:
-                       s = "*" + mapCodeName["YYCURSOR"];
+                       s = "*" + opts.mapCodeName["YYCURSOR"];
                        break;
                case CUSTOM:
-                       s = mapCodeName["YYPEEK"] + " ()";
+                       s = opts.mapCodeName["YYPEEK"] + " ()";
                        break;
        }
        return s;
@@ -29,7 +29,7 @@ std::string InputAPI::expr_peek ()
 
 std::string InputAPI::expr_peek_save ()
 {
-       return mapCodeName["yych"] + " = " + opts.yychConversion + expr_peek ();
+       return opts.mapCodeName["yych"] + " = " + opts.yychConversion + expr_peek ();
 }
 
 std::string InputAPI::stmt_peek (uint32_t ind)
@@ -43,10 +43,10 @@ std::string InputAPI::stmt_skip (uint32_t ind)
        switch (type)
        {
                case DEFAULT:
-                       s = "++" + mapCodeName["YYCURSOR"];
+                       s = "++" + opts.mapCodeName["YYCURSOR"];
                        break;
                case CUSTOM:
-                       s = mapCodeName["YYSKIP"] + " ()";
+                       s = opts.mapCodeName["YYSKIP"] + " ()";
                        break;
        }
        return indent (ind) + s + ";\n";
@@ -58,10 +58,10 @@ std::string InputAPI::stmt_backup (uint32_t ind)
        switch (type)
        {
                case DEFAULT:
-                       s = mapCodeName["YYMARKER"] + " = " + mapCodeName["YYCURSOR"];
+                       s = opts.mapCodeName["YYMARKER"] + " = " + opts.mapCodeName["YYCURSOR"];
                        break;
                case CUSTOM:
-                       s = mapCodeName["YYBACKUP"] + " ()";
+                       s = opts.mapCodeName["YYBACKUP"] + " ()";
                        break;
        }
        return indent (ind) + s + ";\n";
@@ -74,10 +74,10 @@ std::string InputAPI::stmt_backupctx (uint32_t ind)
        {
                case DEFAULT:
                        // backward compatibility: '+1' here instead of '++YYCURSOR;' in stmt_restorectx
-                       s = mapCodeName["YYCTXMARKER"] + " = " + mapCodeName["YYCURSOR"] + " + 1";
+                       s = opts.mapCodeName["YYCTXMARKER"] + " = " + opts.mapCodeName["YYCURSOR"] + " + 1";
                        break;
                case CUSTOM:
-                       s = mapCodeName["YYBACKUPCTX"] + " ()";
+                       s = opts.mapCodeName["YYBACKUPCTX"] + " ()";
                        break;
        }
        return indent (ind) + s + ";\n";
@@ -89,10 +89,10 @@ std::string InputAPI::stmt_restore (uint32_t ind)
        switch (type)
        {
                case DEFAULT:
-                       s = mapCodeName["YYCURSOR"] + " = " + mapCodeName["YYMARKER"];
+                       s = opts.mapCodeName["YYCURSOR"] + " = " + opts.mapCodeName["YYMARKER"];
                        break;
                case CUSTOM:
-                       s = mapCodeName["YYRESTORE"] + " ()";
+                       s = opts.mapCodeName["YYRESTORE"] + " ()";
                        break;
        }
        return indent (ind) + s + ";\n";
@@ -105,10 +105,10 @@ std::string InputAPI::stmt_restorectx (uint32_t ind)
        {
                case DEFAULT:
                        // backward compatibility: 'no ++YYCURSOR;' here; instead '+1' in stmt_backupctx
-                       s = indent (ind) + mapCodeName["YYCURSOR"] + " = " + mapCodeName["YYCTXMARKER"] + ";\n";
+                       s = indent (ind) + opts.mapCodeName["YYCURSOR"] + " = " + opts.mapCodeName["YYCTXMARKER"] + ";\n";
                        break;
                case CUSTOM:
-                       s = indent (ind) + mapCodeName["YYRESTORECTX"] + " ();\n" + stmt_skip (ind);
+                       s = indent (ind) + opts.mapCodeName["YYRESTORECTX"] + " ();\n" + stmt_skip (ind);
                        break;
        }
        return s;
@@ -117,35 +117,35 @@ std::string InputAPI::stmt_restorectx (uint32_t ind)
 std::string InputAPI::stmt_skip_peek (uint32_t ind)
 {
        return type == DEFAULT
-               ? indent (ind) + mapCodeName["yych"] + " = " + opts.yychConversion + "*++" + mapCodeName["YYCURSOR"] + ";\n"
+               ? indent (ind) + opts.mapCodeName["yych"] + " = " + opts.yychConversion + "*++" + opts.mapCodeName["YYCURSOR"] + ";\n"
                : stmt_skip (ind) + stmt_peek (ind);
 }
 
 std::string InputAPI::stmt_skip_backup (uint32_t ind)
 {
        return type == DEFAULT
-               ? indent (ind) + mapCodeName["YYMARKER"] + " = ++" + mapCodeName["YYCURSOR"] + ";\n"
+               ? indent (ind) + opts.mapCodeName["YYMARKER"] + " = ++" + opts.mapCodeName["YYCURSOR"] + ";\n"
                : stmt_skip (ind) + stmt_backup (ind);
 }
 
 std::string InputAPI::stmt_backup_peek (uint32_t ind)
 {
        return type == DEFAULT
-               ? indent (ind) + mapCodeName["yych"] + " = " + opts.yychConversion + "*(" + mapCodeName["YYMARKER"] + " = " + mapCodeName["YYCURSOR"] + ");\n"
+               ? indent (ind) + opts.mapCodeName["yych"] + " = " + opts.yychConversion + "*(" + opts.mapCodeName["YYMARKER"] + " = " + opts.mapCodeName["YYCURSOR"] + ");\n"
                : stmt_backup (ind) + stmt_peek (ind);
 }
 
 std::string InputAPI::stmt_skip_backup_peek (uint32_t ind)
 {
        return type == DEFAULT
-               ? indent (ind) + mapCodeName["yych"] + " = " + opts.yychConversion + "*(" + mapCodeName["YYMARKER"] + " = ++" + mapCodeName["YYCURSOR"] + ");\n"
+               ? indent (ind) + opts.mapCodeName["yych"] + " = " + opts.yychConversion + "*(" + opts.mapCodeName["YYMARKER"] + " = ++" + opts.mapCodeName["YYCURSOR"] + ");\n"
                : stmt_skip (ind) + stmt_backup (ind) + stmt_peek (ind);
 }
 
 std::string InputAPI::expr_lessthan_one ()
 {
        return type == DEFAULT
-               ? mapCodeName["YYLIMIT"] + " <= " + mapCodeName["YYCURSOR"]
+               ? opts.mapCodeName["YYLIMIT"] + " <= " + opts.mapCodeName["YYCURSOR"]
                : expr_lessthan (1);
 }
 
@@ -155,10 +155,10 @@ std::string InputAPI::expr_lessthan (uint32_t n)
        switch (type)
        {
                case DEFAULT:
-                       s << "(" << mapCodeName["YYLIMIT"] << " - " << mapCodeName["YYCURSOR"] << ") < " << n;
+                       s << "(" << opts.mapCodeName["YYLIMIT"] << " - " << opts.mapCodeName["YYCURSOR"] << ") < " << n;
                        break;
                case CUSTOM:
-                       s << mapCodeName["YYLESSTHAN"] << " (" << n << ")";
+                       s << opts.mapCodeName["YYLESSTHAN"] << " (" << n << ")";
                        break;
        }
        return s.str ();
index 7fa43575cbf8a9cf7c8d2b3b828aabb5565b74c2..a9acf2d54d315c52daf9cba530f8de8fcfb4fdfd 100644 (file)
@@ -374,12 +374,12 @@ void output_state_goto (std::ostream & o, uint32_t ind, uint32_t start_label)
        }
        for (uint32_t i = 0; i < last_fill_index; ++i)
        {
-               o << indent(ind) << "case " << i << ": goto " << mapCodeName["yyFillLabel"] << i << ";\n";
+               o << indent(ind) << "case " << i << ": goto " << opts.mapCodeName["yyFillLabel"] << i << ";\n";
        }
        o << indent(ind) << "}\n";
        if (opts.bUseStateNext)
        {
-               o << mapCodeName["yyNext"] << ":\n";
+               o << opts.mapCodeName["yyNext"] << ":\n";
        }
 }
 
@@ -387,7 +387,7 @@ void output_yyaccept_init (std::ostream & o, uint32_t ind, bool used_yyaccept)
 {
        if (used_yyaccept)
        {
-               o << indent (ind) << "unsigned int " << mapCodeName["yyaccept"] << " = 0;\n";
+               o << indent (ind) << "unsigned int " << opts.mapCodeName["yyaccept"] << " = 0;\n";
        }
 }
 
@@ -406,7 +406,7 @@ void output_line_info (std::ostream & o, uint32_t line_number, const char * file
 
 void output_types (std::ostream & o, uint32_t ind, const std::vector<std::string> & types)
 {
-       o << indent (ind++) << "enum " << mapCodeName["YYCONDTYPE"] << " {\n";
+       o << indent (ind++) << "enum " << opts.mapCodeName["YYCONDTYPE"] << " {\n";
        for (unsigned int i = 0; i < types.size (); ++i)
        {
                o << indent (ind) << opts.condEnumPrefix << types[i] << ",\n";
@@ -430,11 +430,11 @@ std::string output_get_state ()
 {
        if (opts.bUseYYGetStateNaked)
        {
-               return mapCodeName["YYGETSTATE"];
+               return opts.mapCodeName["YYGETSTATE"];
        }
        else
        {
-               return mapCodeName["YYGETSTATE"] + "()";
+               return opts.mapCodeName["YYGETSTATE"] + "()";
        }
 }
 
index 7966178860bda93be3e80f2f03b4ec67fa2cd52b..161014b277e6c3ed9a0b81b06ded4bc5b6aaafdb 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <string>
 
+#include "src/codegen/code_names.h"
 #include "src/codegen/input_api.h"
 #include "src/ir/regexp/encoding/enc.h"
 #include "src/ir/regexp/empty_class_policy.h"
@@ -59,6 +60,7 @@ struct Opt
        std::string yySetConditionParam;
        std::string yySetStateParam;
        std::string yySetupRule;
+       CodeNames mapCodeName;
        Enc encoding;
        InputAPI input_api;
        empty_class_policy_t empty_class_policy;
@@ -110,6 +112,7 @@ struct Opt
                , yySetConditionParam ("@@")
                , yySetStateParam ("@@")
                , yySetupRule ("")
+               , mapCodeName ()
                , encoding ()
                , input_api ()
                , empty_class_policy (EMPTY_CLASS_MATCH_EMPTY)
index be4bfce6eafaaf4729434df4a2d7d53e2fd590ae..d653651913462324ed1af1ed37b4cb6efbde0e72 100644 (file)
@@ -1,28 +1,17 @@
 #ifndef _RE2C_GLOBALS_
 #define _RE2C_GLOBALS_
 
-#include <string>
-
-#include "src/codegen/code_names.h"
-#include "src/codegen/input_api.h"
 #include "src/conf/opt.h"
 #include "src/conf/warn.h"
-#include "src/ir/regexp/encoding/enc.h"
-#include "src/ir/regexp/empty_class_policy.h"
 #include "src/util/c99_stdint.h"
 
 namespace re2c
 {
 
-extern const uint32_t asc2asc[256];
-extern const uint32_t asc2ebc[256];
-extern const uint32_t ebc2asc[256];
-
 extern bool bUsedYYBitmap;
 extern bool bWroteGetState;
 extern bool bWroteCondCheck;
 extern uint32_t last_fill_index;
-extern CodeNames mapCodeName;
 
 extern Opt opts;
 extern Warn warn;
index f4e7f02229a462ee55ca0204dbb45da091b0c3fd..581a75fb351705c364a07981474cb4cd11a340b1 100644 (file)
@@ -277,7 +277,7 @@ decl:
                }
        | CONF STRING ';'
        {
-               if (!mapCodeName.insert (std::make_pair (*$1, *$2)).second)
+               if (!opts.mapCodeName.insert (std::make_pair (*$1, *$2)).second)
                {
                        in->fatalf ("configuration '%s' is already set and cannot be changed", $1->c_str ());
                }
@@ -412,7 +412,7 @@ decl:
        {
                opts.yychConversion = $2 == 0
                        ? ""
-                       : "(" + mapCodeName["YYCTYPE"] + ")";
+                       : "(" + opts.mapCodeName["YYCTYPE"] + ")";
        }
        | CONF_YYCH_EMIT NUM ';'
        {
index 862a122bacb683e4bf1a8b74d24b820fae3d6503..f8f1725dd679143a5f2bd8279fc87ab7bbaf0aae 100644 (file)
@@ -178,7 +178,7 @@ void Scanner::reuse()
        last_fill_index = 0;
        bWroteGetState = false;
        bWroteCondCheck = false;
-       mapCodeName.clear();
+       opts.mapCodeName.clear();
 }
 
 void Scanner::restore_state(const ScannerState& state)
index 4f342b7f44f4f7e6b1dbfdb26dbac94401485bf5..d785284ff7029244df8b05c230022db907c6f224 100644 (file)
@@ -87,7 +87,7 @@ echo:
        "/*!rules:re2c" {
                                        if (opts.rFlag)
                                        {
-                                               mapCodeName.clear();
+                                               opts.mapCodeName.clear();
                                        }
                                        else
                                        {