From 5034e81fe791a6a18959a5fb21d574a25d63deb0 Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Mon, 21 Sep 2015 22:14:45 +0100 Subject: [PATCH] Keep name table together with other options. --- re2c/bootstrap/src/parse/parser.cc | 4 +-- re2c/bootstrap/src/parse/scanner_lex.cc | 4 +-- re2c/src/codegen/bitmap.cc | 2 +- re2c/src/codegen/code_names.cc | 1 - re2c/src/codegen/emit_action.cc | 26 ++++++++-------- re2c/src/codegen/emit_dfa.cc | 12 ++++---- re2c/src/codegen/go_emit.cc | 10 +++---- re2c/src/codegen/input_api.cc | 40 ++++++++++++------------- re2c/src/codegen/output.cc | 12 ++++---- re2c/src/conf/opt.h | 3 ++ re2c/src/globals.h | 11 ------- re2c/src/parse/parser.ypp | 4 +-- re2c/src/parse/scanner.cc | 2 +- re2c/src/parse/scanner_lex.re | 2 +- 14 files changed, 62 insertions(+), 71 deletions(-) diff --git a/re2c/bootstrap/src/parse/parser.cc b/re2c/bootstrap/src/parse/parser.cc index 2ddd9640..c71a808d 100644 --- a/re2c/bootstrap/src/parse/parser.cc +++ b/re2c/bootstrap/src/parse/parser.cc @@ -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; diff --git a/re2c/bootstrap/src/parse/scanner_lex.cc b/re2c/bootstrap/src/parse/scanner_lex.cc index 1a3b8b97..9c7f09bd 100644 --- a/re2c/bootstrap/src/parse/scanner_lex.cc +++ b/re2c/bootstrap/src/parse/scanner_lex.cc @@ -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 #include @@ -238,7 +238,7 @@ yy21: { if (opts.rFlag) { - mapCodeName.clear(); + opts.mapCodeName.clear(); } else { diff --git a/re2c/src/codegen/bitmap.cc b/re2c/src/codegen/bitmap.cc index ebd968a4..4d5ccda6 100644 --- a/re2c/src/codegen/bitmap.cc +++ b/re2c/src/codegen/bitmap.cc @@ -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; diff --git a/re2c/src/codegen/code_names.cc b/re2c/src/codegen/code_names.cc index 3398d8b8..2be7f281 100644 --- a/re2c/src/codegen/code_names.cc +++ b/re2c/src/codegen/code_names.cc @@ -1,5 +1,4 @@ #include "src/codegen/code_names.h" -#include "src/globals.h" namespace re2c { diff --git a/re2c/src/codegen/emit_action.cc b/re2c/src/codegen/emit_action.cc index 00e15061..ec1a7d2a 100644 --- a/re2c/src/codegen/emit_action.cc +++ b/re2c/src/codegen/emit_action.cc @@ -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"; } } diff --git a/re2c/src/codegen/emit_dfa.cc b/re2c/src/codegen/emit_dfa.cc index fee63300..383e6638 100644 --- a/re2c/src/codegen/emit_dfa.cc +++ b/re2c/src/codegen/emit_dfa.cc @@ -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 & 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 & } 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) { diff --git a/re2c/src/codegen/go_emit.cc b/re2c/src/codegen/go_emit.cc index 64f240b7..6e2fa3dc 100644 --- a/re2c/src/codegen/go_emit.cc +++ b/re2c/src/codegen/go_emit.cc @@ -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"; } diff --git a/re2c/src/codegen/input_api.cc b/re2c/src/codegen/input_api.cc index 2ecc7ce5..297b2cc1 100644 --- a/re2c/src/codegen/input_api.cc +++ b/re2c/src/codegen/input_api.cc @@ -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 (); diff --git a/re2c/src/codegen/output.cc b/re2c/src/codegen/output.cc index 7fa43575..a9acf2d5 100644 --- a/re2c/src/codegen/output.cc +++ b/re2c/src/codegen/output.cc @@ -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 & 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"] + "()"; } } diff --git a/re2c/src/conf/opt.h b/re2c/src/conf/opt.h index 79661788..161014b2 100644 --- a/re2c/src/conf/opt.h +++ b/re2c/src/conf/opt.h @@ -3,6 +3,7 @@ #include +#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) diff --git a/re2c/src/globals.h b/re2c/src/globals.h index be4bfce6..d6536519 100644 --- a/re2c/src/globals.h +++ b/re2c/src/globals.h @@ -1,28 +1,17 @@ #ifndef _RE2C_GLOBALS_ #define _RE2C_GLOBALS_ -#include - -#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; diff --git a/re2c/src/parse/parser.ypp b/re2c/src/parse/parser.ypp index f4e7f022..581a75fb 100644 --- a/re2c/src/parse/parser.ypp +++ b/re2c/src/parse/parser.ypp @@ -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 ';' { diff --git a/re2c/src/parse/scanner.cc b/re2c/src/parse/scanner.cc index 862a122b..f8f1725d 100644 --- a/re2c/src/parse/scanner.cc +++ b/re2c/src/parse/scanner.cc @@ -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) diff --git a/re2c/src/parse/scanner_lex.re b/re2c/src/parse/scanner_lex.re index 4f342b7f..d785284f 100644 --- a/re2c/src/parse/scanner_lex.re +++ b/re2c/src/parse/scanner_lex.re @@ -87,7 +87,7 @@ echo: "/*!rules:re2c" { if (opts.rFlag) { - mapCodeName.clear(); + opts.mapCodeName.clear(); } else { -- 2.40.0