Permalink
Browse files

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

bugfix escape charactor for Regexp class
  • Loading branch information...
matz committed Mar 21, 2013
2 parents 605035b + f00e9b2 commit f6646f44c2a33147b7f491d1551243c96f72ab25
Showing with 4 additions and 11 deletions.
  1. +4 −11 src/parse.y
View
@@ -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;

0 comments on commit f6646f4

Please sign in to comment.