]> granicus.if.org Git - re2c/commitdiff
Eradicated occasional copy-paste.
authorUlya Trofimovich <skvadrik@gmail.com>
Mon, 14 Mar 2016 22:52:53 +0000 (22:52 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Mon, 14 Mar 2016 22:52:53 +0000 (22:52 +0000)
Used function 'make_rule_copy' introduced by commit
f781c3a3a07cde0243c894da640070d6c62ef4bc.

re2c/bootstrap/src/parse/lex.cc
re2c/bootstrap/src/parse/parser.cc
re2c/src/parse/parser.ypp

index 13fd0cccda05dbec69f551b8a0c08b39e39767d5..8c5b6235e36072e90b1266cb4cb63c85209c640b 100644 (file)
@@ -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 <stddef.h>
index 4a458d6db07116fc4ea6b7769ed7afc9d18db0df..9f7e54ee788eae4df0e43525781e0d22cc2bd1f1 100644 (file)
@@ -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)
                                        {
index f31d61fd17c732c53951b5d6d82c401619f969e5..7f46af1b7afcd25d1da363a7c490a3793c4e07ab 100644 (file)
@@ -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)
                                        {