diff options
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -7878,6 +7878,16 @@ tokadd_codepoint(struct parser_params *p, rb_encoding **encp, static int tokadd_mbchar(struct parser_params *p, int c); +static int +tokskip_mbchar(struct parser_params *p) +{ + int len = parser_precise_mbclen(p, p->lex.pcur-1); + if (len > 0) { + p->lex.pcur += len - 1; + } + return len; +} + /* return value is for ?\u3042 */ static void tokadd_utf8(struct parser_params *p, rb_encoding **encp, @@ -8065,7 +8075,11 @@ read_escape(struct parser_params *p, int flags) } else if (c == '?') return 0177; - else if (c == -1 || !ISASCII(c)) goto eof; + else if (c == -1) goto eof; + else if (!ISASCII(c)) { + tokskip_mbchar(p); + goto eof; + } else { int c2 = escaped_control_code(c); if (c2) { @@ -8093,7 +8107,7 @@ read_escape(struct parser_params *p, int flags) eof: case -1: yyerror0("Invalid escape character syntax"); - token_flush(p); + dispatch_scan_event(p, tSTRING_CONTENT); return '\0'; default: |