diff options
author | Nobuyoshi Nakada <[email protected]> | 2019-05-27 19:58:15 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2019-05-27 23:08:48 +0900 |
commit | b4365e75fd70618b79b3a71c1c13f202acd71368 (patch) | |
tree | dbf6691f7730470437611039eec793e4d53314c0 /parse.y | |
parent | c40003da25543b0f828911af56108ee16af35236 (diff) |
Do not make an incomplete escape a valid char
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -6211,7 +6211,7 @@ tokadd_utf8(struct parser_params *p, rb_encoding **encp, if (c != close_brace) { unterminated: - literal_flush(p, p->lex.pcur); + token_flush(p); yyerror0("unterminated Unicode escape"); return; } @@ -6221,11 +6221,10 @@ tokadd_utf8(struct parser_params *p, rb_encoding **encp, } else { /* handle \uxxxx form */ if (!tokadd_codepoint(p, encp, regexp_literal, FALSE)) { + token_flush(p); return; } } - - return; } #define ESCAPE_CONTROL 1 @@ -6312,7 +6311,7 @@ read_escape(struct parser_params *p, int flags, rb_encoding **encp) eof: case -1: yyerror0("Invalid escape character syntax"); - pushback(p, c); + token_flush(p); return '\0'; default: @@ -6391,6 +6390,7 @@ tokadd_escape(struct parser_params *p, rb_encoding **encp) eof: case -1: yyerror0("Invalid escape character syntax"); + token_flush(p); return -1; default: |