summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-24 11:43:11 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-24 11:43:11 +0000
commit7e68efbc9599550eadf5aa9a50bdc9a36796db49 (patch)
treeeb1ae7ba3950cac932fb817482e80e252cba082e /parse.y
parentc6fb7c1f33e128618bcd7799a2de52874c7ebdd8 (diff)
parse.y: remove an extra error message
* parse.y (parse_string): bail out when word-list meets end of input not to show an extra "unexpected" error message after the preceding error. $ ruby -e "%w[" -e:1: unterminated string meets end of file -e:1: syntax error, unexpected terminator, expecting ' ' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y6
1 files changed, 6 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index 1f7cf2f53f..6c7ca60b46 100644
--- a/parse.y
+++ b/parse.y
@@ -6009,6 +6009,12 @@ parse_string(struct parser_params *p, rb_strterm_literal_t *quote)
# define unterminated_literal(mesg) compile_error(p, mesg)
#endif
literal_flush(p, p->lex.pcur);
+ if (func & STR_FUNC_QWORDS) {
+ /* no content to add, bailing out here */
+ unterminated_literal("unterminated list meets end of file");
+ p->lex.strterm = 0;
+ return tSTRING_END;
+ }
if (func & STR_FUNC_REGEXP) {
unterminated_literal("unterminated regexp meets end of file");
}