mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix ripper fatal
* parse.y (parser_yylex): return END_OF_INPUT at unterminated here document instead of an error. [Bug #15962]
This commit is contained in:
parent
2a56702eee
commit
097554855c
2 changed files with 4 additions and 1 deletions
2
parse.y
2
parse.y
|
@ -8828,7 +8828,7 @@ parser_yylex(struct parser_params *p)
|
|||
!IS_END() &&
|
||||
(!IS_ARG() || IS_lex_state(EXPR_LABELED) || space_seen)) {
|
||||
int token = heredoc_identifier(p);
|
||||
if (token) return token;
|
||||
if (token) return token < 0 ? 0 : token;
|
||||
}
|
||||
if (IS_AFTER_OPERATOR()) {
|
||||
SET_LEX_STATE(EXPR_ARG);
|
||||
|
|
|
@ -489,6 +489,9 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
|
|||
assert_match("can't find string \"a\" anywhere before EOF", compile_error("<<a"))
|
||||
assert_match("can't find string \"a\" anywhere before EOF", compile_error('<<"a"'))
|
||||
assert_match("can't find string \"a\" anywhere before EOF", compile_error("<<'a'"))
|
||||
msg = nil
|
||||
parse('<<"', :on_parse_error) {|_, e| msg = e}
|
||||
assert_equal("unterminated here document identifier", msg)
|
||||
end
|
||||
|
||||
def test_massign
|
||||
|
|
Loading…
Add table
Reference in a new issue