From: Ulya Trofimovich Date: Thu, 24 Sep 2015 14:21:45 +0000 (+0100) Subject: Reduced redundant global flags. X-Git-Tag: 0.15~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=10f3fd13ba7f3702bb3bd8b6d87fd3aab2e20892;p=re2c Reduced redundant global flags. --- diff --git a/re2c/src/codegen/emit_action.cc b/re2c/src/codegen/emit_action.cc index 12038090..19f14b29 100644 --- a/re2c/src/codegen/emit_action.cc +++ b/re2c/src/codegen/emit_action.cc @@ -290,14 +290,7 @@ void need (OutputFile & o, uint32_t ind, bool & readCh, uint32_t n, bool bSetMar if (opts->fFlag) { last_fill_index++; - if (opts->bUseYYSetStateParam) - { - o << indent(ind) << opts->yysetstate << "(" << fillIndex << ");\n"; - } - else - { - o << indent(ind) << replaceParam(opts->yysetstate, opts->yySetStateParam, fillIndex) << "\n"; - } + o << indent(ind) << replaceParam(opts->yysetstate, opts->yySetStateParam, fillIndex) << "\n"; } if (opts->bUseYYFill && n > 0) @@ -364,14 +357,7 @@ void genYYFill(OutputFile & o, uint32_t need) void genSetCondition(OutputFile & o, uint32_t ind, const std::string& newcond) { - if (opts->bUseYYSetConditionParam) - { - o << indent(ind) << opts->yysetcondition << "(" << opts->condEnumPrefix << newcond << ");\n"; - } - else - { - o << indent(ind) << replaceParam(opts->yysetcondition, opts->yySetConditionParam, opts->condEnumPrefix + newcond) << "\n"; - } + o << indent(ind) << replaceParam(opts->yysetcondition, opts->yySetConditionParam, opts->condEnumPrefix + newcond) << "\n"; } } // namespace re2c diff --git a/re2c/src/conf/opt.cc b/re2c/src/conf/opt.cc index df087f32..dd9da66e 100644 --- a/re2c/src/conf/opt.cc +++ b/re2c/src/conf/opt.cc @@ -17,11 +17,10 @@ opt_t::opt_t () , tFlag (false) , header_file (NULL) , yycondtype ("YYCONDTYPE") - , yysetcondition ("YYSETCONDITION") + , yysetcondition ("YYSETCONDITION(@@);") , yygetcondition ("YYGETCONDITION") , yyctable ("yyctable") , yySetConditionParam ("@@") - , bUseYYSetConditionParam (true) , bUseYYGetConditionNaked (false) , condPrefix ("yyc_") , condEnumPrefix ("yyc") @@ -30,13 +29,12 @@ opt_t::opt_t () , condGoto ("goto @@;") , condGotoParam ("@@") , fFlag (false) - , yysetstate ("YYSETSTATE") + , yysetstate ("YYSETSTATE(@@);") , yygetstate ("YYGETSTATE") , yyfilllabel ("yyFillLabel") , yynext ("yyNext") , yyaccept ("yyaccept") , yySetStateParam ("@@") - , bUseYYSetStateParam (true) , bUseYYSetStateNaked (false) , bUseYYGetStateNaked (false) , bUseStateAbort (false) @@ -95,7 +93,6 @@ opt_t::opt_t (const opt_t & opt) , yygetcondition (opt.yygetcondition) , yyctable (opt.yyctable) , yySetConditionParam (opt.yySetConditionParam) - , bUseYYSetConditionParam (opt.bUseYYSetConditionParam) , bUseYYGetConditionNaked (opt.bUseYYGetConditionNaked) , condPrefix (opt.condPrefix) , condEnumPrefix (opt.condEnumPrefix) @@ -110,7 +107,6 @@ opt_t::opt_t (const opt_t & opt) , yynext (opt.yynext) , yyaccept (opt.yyaccept) , yySetStateParam (opt.yySetStateParam) - , bUseYYSetStateParam (opt.bUseYYSetStateParam) , bUseYYSetStateNaked (opt.bUseYYSetStateNaked) , bUseYYGetStateNaked (opt.bUseYYGetStateNaked) , bUseStateAbort (opt.bUseStateAbort) @@ -191,7 +187,6 @@ void opt_t::fix () yygetcondition = Opt::baseopt.yygetcondition; yyctable = Opt::baseopt.yyctable; yySetConditionParam = Opt::baseopt.yySetConditionParam; - bUseYYSetConditionParam = Opt::baseopt.bUseYYSetConditionParam; bUseYYGetConditionNaked = Opt::baseopt.bUseYYGetConditionNaked; condPrefix = Opt::baseopt.condPrefix; condEnumPrefix = Opt::baseopt.condEnumPrefix; @@ -204,7 +199,6 @@ void opt_t::fix () yynext = Opt::baseopt.yynext; yyaccept = Opt::baseopt.yyaccept; yySetStateParam = Opt::baseopt.yySetStateParam; - bUseYYSetStateParam = Opt::baseopt.bUseYYSetStateParam; bUseYYSetStateNaked = Opt::baseopt.bUseYYSetStateNaked; bUseYYGetStateNaked = Opt::baseopt.bUseYYGetStateNaked; bUseStateAbort = Opt::baseopt.bUseStateAbort; @@ -256,7 +250,6 @@ void opt_t::fix () yygetcondition = Opt::baseopt.yygetcondition; yyctable = Opt::baseopt.yyctable; yySetConditionParam = Opt::baseopt.yySetConditionParam; - bUseYYSetConditionParam = Opt::baseopt.bUseYYSetConditionParam; bUseYYGetConditionNaked = Opt::baseopt.bUseYYGetConditionNaked; condPrefix = Opt::baseopt.condPrefix; condEnumPrefix = Opt::baseopt.condEnumPrefix; @@ -273,7 +266,6 @@ void opt_t::fix () yynext = Opt::baseopt.yynext; yyaccept = Opt::baseopt.yyaccept; yySetStateParam = Opt::baseopt.yySetStateParam; - bUseYYSetStateParam = Opt::baseopt.bUseYYSetStateParam; bUseYYSetStateNaked = Opt::baseopt.bUseYYSetStateNaked; bUseYYGetStateNaked = Opt::baseopt.bUseYYGetStateNaked; bUseStateAbort = Opt::baseopt.bUseStateAbort; diff --git a/re2c/src/conf/opt.h b/re2c/src/conf/opt.h index 578ad346..df5b487c 100644 --- a/re2c/src/conf/opt.h +++ b/re2c/src/conf/opt.h @@ -38,7 +38,6 @@ struct opt_t std::string yygetcondition; std::string yyctable; std::string yySetConditionParam; - bool bUseYYSetConditionParam; bool bUseYYGetConditionNaked; std::string condPrefix; std::string condEnumPrefix; @@ -55,7 +54,6 @@ struct opt_t std::string yynext; std::string yyaccept; std::string yySetStateParam; - bool bUseYYSetStateParam; bool bUseYYSetStateNaked; bool bUseYYGetStateNaked; bool bUseStateAbort; @@ -192,11 +190,7 @@ public: void set_yysetcondition (const std::string & s) { useropt->yysetcondition = s; } void set_yygetcondition (const std::string & s) { useropt->yygetcondition = s; } void set_yyctable (const std::string & s) { useropt->yyctable = s; } - void set_yySetConditionParam (const std::string & s) - { - useropt->yySetConditionParam = s; - useropt->bUseYYSetConditionParam = false; - } + void set_yySetConditionParam (const std::string & s) { useropt->yySetConditionParam = s; } void set_bUseYYGetConditionNaked (bool b) { useropt->bUseYYGetConditionNaked = b; } void set_condPrefix (const std::string & s) { useropt->condPrefix = s; } void set_condEnumPrefix (const std::string & s) { useropt->condEnumPrefix = s; } @@ -210,11 +204,7 @@ public: void set_yyfilllabel (const std::string & s) { useropt->yyfilllabel = s; } void set_yynext (const std::string & s) { useropt->yynext = s; } void set_yyaccept (const std::string & s) { useropt->yyaccept = s; } - void set_yySetStateParam (const std::string & s) - { - useropt->yySetStateParam = s; - useropt->bUseYYSetStateParam = false; - } + void set_yySetStateParam (const std::string & s) { useropt->yySetStateParam = s; } void set_bUseYYSetStateNaked (bool b) { useropt->bUseYYSetStateNaked = b; } void set_bUseYYGetStateNaked (bool b) { useropt->bUseYYGetStateNaked = b; } void set_bUseStateAbort (bool b) { useropt->bUseStateAbort = b; }