aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 01:06:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 01:06:25 +0000
commit342e9ae38a0411df3fff5d1f1cbd77ea66af81e2 (patch)
treec419207b92c725f09a2a0c439157924d166edefb /parse.y
parent1d80b1926caa7b80e185c32265157bff1f9f0558 (diff)
downloadruby-342e9ae38a0411df3fff5d1f1cbd77ea66af81e2.tar.gz
moved node generation for dregex_once to parse.y
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y10
1 files changed, 4 insertions, 6 deletions
diff --git a/parse.y b/parse.y
index 310a1dc59b..7aef9630a9 100644
--- a/parse.y
+++ b/parse.y
@@ -9267,12 +9267,7 @@ new_regexp_gen(struct parser_params *parser, NODE *node, int options, int column
node = NEW_NODE(NODE_DSTR, STR_NEW0(), 1, new_list(node, column));
nd_set_column(node, column);
case NODE_DSTR:
- if (options & RE_OPTION_ONCE) {
- nd_set_type(node, NODE_DREGX_ONCE);
- }
- else {
- nd_set_type(node, NODE_DREGX);
- }
+ nd_set_type(node, NODE_DREGX);
node->nd_cflag = options & RE_OPTION_MASK;
if (!NIL_P(node->nd_lit)) reg_fragment_check(node->nd_lit, options);
for (list = (prev = node)->nd_next; list; list = list->nd_next) {
@@ -9303,6 +9298,9 @@ new_regexp_gen(struct parser_params *parser, NODE *node, int options, int column
nd_set_type(node, NODE_LIT);
node->nd_lit = reg_compile(src, options);
}
+ if (options & RE_OPTION_ONCE) {
+ node = NEW_NODE(NODE_SCOPE, 0, node, 0);
+ }
break;
}
return node;