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 ());
}
{
opts.yychConversion = (yyvsp[(2) - (3)].num) == 0
? ""
- : "(" + mapCodeName["YYCTYPE"] + ")";
+ : "(" + opts.mapCodeName["YYCTYPE"] + ")";
;}
break;
-/* 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>
{
if (opts.rFlag)
{
- mapCodeName.clear();
+ opts.mapCodeName.clear();
}
else
{
{
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;
#include "src/codegen/code_names.h"
-#include "src/globals.h"
namespace re2c
{
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)
if (save_yyaccept)
{
- o << indent (ind) << mapCodeName["yyaccept"] << " = " << save << ";\n";
+ o << indent (ind) << opts.mapCodeName["yyaccept"] << " = " << save << ";\n";
}
if (s->link)
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);
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))
}
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";
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";
}
}
if (opts.fFlag)
{
- o << mapCodeName["yyFillLabel"] << fillIndex << ":\n";
+ o << opts.mapCodeName["yyFillLabel"] << fillIndex << ":\n";
}
if (n > 0)
{
if (opts.bUseYYFillParam)
{
- o << mapCodeName["YYFILL"];
+ o << opts.mapCodeName["YYFILL"];
if (!opts.bUseYYFillNaked)
{
o << "(" << need << ");";
}
else
{
- o << replaceParam(mapCodeName["YYFILL"], opts.yyFillLength, need);
+ o << replaceParam(opts.mapCodeName["YYFILL"], opts.yyFillLength, need);
if (!opts.bUseYYFillNaked)
{
o << ";";
{
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";
}
}
{
if (opts.bUseYYGetConditionNaked)
{
- return mapCodeName["YYGETCONDITION"];
+ return opts.mapCodeName["YYGETCONDITION"];
}
else
{
- return mapCodeName["YYGETCONDITION"] + "()";
+ return opts.mapCodeName["YYGETCONDITION"] + "()";
}
}
}
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)
{
{
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);
}
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";
}
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)
{
}
else
{
- return mapCodeName["yych"];
+ return opts.mapCodeName["yych"];
}
}
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
{
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);
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)
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";
}
switch (type)
{
case DEFAULT:
- s = "*" + mapCodeName["YYCURSOR"];
+ s = "*" + opts.mapCodeName["YYCURSOR"];
break;
case CUSTOM:
- s = mapCodeName["YYPEEK"] + " ()";
+ s = opts.mapCodeName["YYPEEK"] + " ()";
break;
}
return s;
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)
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";
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";
{
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";
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";
{
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;
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);
}
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 ();
}
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";
}
}
{
if (used_yyaccept)
{
- o << indent (ind) << "unsigned int " << mapCodeName["yyaccept"] << " = 0;\n";
+ o << indent (ind) << "unsigned int " << opts.mapCodeName["yyaccept"] << " = 0;\n";
}
}
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";
{
if (opts.bUseYYGetStateNaked)
{
- return mapCodeName["YYGETSTATE"];
+ return opts.mapCodeName["YYGETSTATE"];
}
else
{
- return mapCodeName["YYGETSTATE"] + "()";
+ return opts.mapCodeName["YYGETSTATE"] + "()";
}
}
#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"
std::string yySetConditionParam;
std::string yySetStateParam;
std::string yySetupRule;
+ CodeNames mapCodeName;
Enc encoding;
InputAPI input_api;
empty_class_policy_t empty_class_policy;
, yySetConditionParam ("@@")
, yySetStateParam ("@@")
, yySetupRule ("")
+ , mapCodeName ()
, encoding ()
, input_api ()
, empty_class_policy (EMPTY_CLASS_MATCH_EMPTY)
#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;
}
| 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 ());
}
{
opts.yychConversion = $2 == 0
? ""
- : "(" + mapCodeName["YYCTYPE"] + ")";
+ : "(" + opts.mapCodeName["YYCTYPE"] + ")";
}
| CONF_YYCH_EMIT NUM ';'
{
last_fill_index = 0;
bWroteGetState = false;
bWroteCondCheck = false;
- mapCodeName.clear();
+ opts.mapCodeName.clear();
}
void Scanner::restore_state(const ScannerState& state)
"/*!rules:re2c" {
if (opts.rFlag)
{
- mapCodeName.clear();
+ opts.mapCodeName.clear();
}
else
{