summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-27 19:58:15 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-27 23:08:48 +0900
commitb4365e75fd70618b79b3a71c1c13f202acd71368 (patch)
treedbf6691f7730470437611039eec793e4d53314c0 /parse.y
parentc40003da25543b0f828911af56108ee16af35236 (diff)
Do not make an incomplete escape a valid char
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y8
1 files changed, 4 insertions, 4 deletions
diff --git a/parse.y b/parse.y
index 24fa3d36ff..580b3c72da 100644
--- a/parse.y
+++ b/parse.y
@@ -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: