diff options
| author | Kouki Ooyatsu <[email protected]> | 2013-03-21 17:07:29 +0900 |
|---|---|---|
| committer | Kouki Ooyatsu <[email protected]> | 2013-03-21 17:12:09 +0900 |
| commit | f00e9b24108c03158613a2fad2366abdafeb2f77 (patch) | |
| tree | 2547f62653a9a20638bdee35863b2dad4ac7193f | |
| parent | 605035bc4261f25063ecf77765b9f844b6e98357 (diff) | |
| download | mruby-f00e9b24108c03158613a2fad2366abdafeb2f77.tar.gz mruby-f00e9b24108c03158613a2fad2366abdafeb2f77.zip | |
bugfix escape charactor for Regexp class
| -rw-r--r-- | src/parse.y | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/parse.y b/src/parse.y index ee95cfb73..8f1241d33 100644 --- a/src/parse.y +++ b/src/parse.y @@ -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; |
