Merge pull request #1038 from kouki-o-iij/pr-regexp-escape

bugfix escape charactor for Regexp class
This commit is contained in:
Yukihiro "Matz" Matsumoto
2013-03-21 04:37:04 -07:00
+4 -11
View File
@@ -3459,17 +3459,9 @@ read_escape(parser_state *p)
return c;
case 'b': /* backspace */
if (is_strterm_type(p, STR_FUNC_REGEXP)) {
tokadd(p, '\\');
return 'b';
}
return '\010';
case 's': /* space */
if (is_strterm_type(p, STR_FUNC_REGEXP)) {
tokadd(p, '\\');
return 's';
}
return ' ';
case 'M':
@@ -3507,9 +3499,6 @@ read_escape(parser_state *p)
return '\0';
default:
if (is_strterm_type(p, STR_FUNC_REGEXP)) {
tokadd(p, '\\');
}
return c;
}
}
@@ -3583,6 +3572,10 @@ parse_string(parser_state *p)
}
else {
pushback(p, c);
if(type & STR_FUNC_REGEXP)
tokadd(p, '\\');
tokadd(p, read_escape(p));
if (hinf)
hinf->line_head = FALSE;