mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
parse.y: check single regexp only
* parse.y (regexp_contents): check in ripper only if the whole content is a single regexp without interpolation. [ruby-dev:48714] [Bug #10437] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
012c558127
commit
1549a6b78d
2 changed files with 9 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Tue Dec 2 06:31:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* parse.y (regexp_contents): check in ripper only if the whole
|
||||||
|
content is a single regexp without interpolation.
|
||||||
|
[ruby-dev:48714] [Bug #10437]
|
||||||
|
|
||||||
Tue Dec 2 06:30:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Dec 2 06:30:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* re.c (rb_reg_region_copy): new function to try with GC if copy
|
* re.c (rb_reg_region_copy): new function to try with GC if copy
|
||||||
|
|
7
parse.y
7
parse.y
|
@ -4259,7 +4259,7 @@ regexp_contents: /* none */
|
||||||
$$ = list_append(head, tail);
|
$$ = list_append(head, tail);
|
||||||
}
|
}
|
||||||
/*%
|
/*%
|
||||||
VALUE s1 = 0, s2 = 0, n1 = $1, n2 = $2;
|
VALUE s1 = 1, s2 = 0, n1 = $1, n2 = $2;
|
||||||
if (ripper_is_node_yylval(n1)) {
|
if (ripper_is_node_yylval(n1)) {
|
||||||
s1 = RNODE(n1)->nd_cval;
|
s1 = RNODE(n1)->nd_cval;
|
||||||
n1 = RNODE(n1)->nd_rval;
|
n1 = RNODE(n1)->nd_rval;
|
||||||
|
@ -4269,9 +4269,8 @@ regexp_contents: /* none */
|
||||||
n2 = RNODE(n2)->nd_rval;
|
n2 = RNODE(n2)->nd_rval;
|
||||||
}
|
}
|
||||||
$$ = dispatch2(regexp_add, n1, n2);
|
$$ = dispatch2(regexp_add, n1, n2);
|
||||||
if (s1 || s2) {
|
if (!s1 && s2) {
|
||||||
VALUE s = !s1 ? s2 : !s2 ? s1 : rb_str_plus(s1, s2);
|
$$ = ripper_new_yylval(0, $$, s2);
|
||||||
$$ = ripper_new_yylval(0, $$, s);
|
|
||||||
}
|
}
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue