From: Ulya Trofimovich Date: Mon, 14 Mar 2016 22:52:53 +0000 (+0000) Subject: Eradicated occasional copy-paste. X-Git-Tag: 1.0~39^2~358 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9cfb1b1383e4ddc3d9a34af43ab6dc43f5629ce;p=re2c Eradicated occasional copy-paste. Used function 'make_rule_copy' introduced by commit f781c3a3a07cde0243c894da640070d6c62ef4bc. --- diff --git a/re2c/bootstrap/src/parse/lex.cc b/re2c/bootstrap/src/parse/lex.cc index 13fd0ccc..8c5b6235 100644 --- a/re2c/bootstrap/src/parse/lex.cc +++ b/re2c/bootstrap/src/parse/lex.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.16 on Mon Feb 22 15:20:41 2016 */ +/* Generated by re2c 0.16 on Mon Mar 14 22:45:09 2016 */ #line 1 "../src/parse/lex.re" #include "src/util/c99_stdint.h" #include diff --git a/re2c/bootstrap/src/parse/parser.cc b/re2c/bootstrap/src/parse/parser.cc index 4a458d6d..9f7e54ee 100644 --- a/re2c/bootstrap/src/parse/parser.cc +++ b/re2c/bootstrap/src/parse/parser.cc @@ -2337,18 +2337,7 @@ void parse(Scanner& i, Output & o) { for (RuleList::const_iterator itOp = specStar.begin(); itOp != specStar.end(); ++itOp) { - // Different condition share rule regexps (regexps are immutable anyway), - // but must have an individual copy of rule info (rule reachability - // and shadow set are not the same for different conditions). - // Also must update rule rank to guarantee lowest priority. - const RegExp *re = *itOp; - const RuleInfo *info = re->pld.rule.info; - const RegExp *re_copy = RegExp::rule( - re->pld.rule.re, - re->pld.rule.ctx, - new RuleInfo(info->loc, rank_counter.next(), info->code, - &info->newcond, info->ctx_len, info->nullable)); - it->second.add(re_copy); + it->second.add(make_rule_copy(*itOp, rank_counter.next())); } if (star_default) { diff --git a/re2c/src/parse/parser.ypp b/re2c/src/parse/parser.ypp index f31d61fd..7f46af1b 100644 --- a/re2c/src/parse/parser.ypp +++ b/re2c/src/parse/parser.ypp @@ -649,18 +649,7 @@ void parse(Scanner& i, Output & o) { for (RuleList::const_iterator itOp = specStar.begin(); itOp != specStar.end(); ++itOp) { - // Different condition share rule regexps (regexps are immutable anyway), - // but must have an individual copy of rule info (rule reachability - // and shadow set are not the same for different conditions). - // Also must update rule rank to guarantee lowest priority. - const RegExp *re = *itOp; - const RuleInfo *info = re->pld.rule.info; - const RegExp *re_copy = RegExp::rule( - re->pld.rule.re, - re->pld.rule.ctx, - new RuleInfo(info->loc, rank_counter.next(), info->code, - &info->newcond, info->ctx_len, info->nullable)); - it->second.add(re_copy); + it->second.add(make_rule_copy(*itOp, rank_counter.next())); } if (star_default) {