1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

parse.y: unexpected tINTEGER message

* parse.y (parser_number_literal_suffix): keep token after numeric
  suffix to show the value in an error message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-08-17 12:33:41 +00:00
parent e60c38cb9f
commit e169fa9419
2 changed files with 6 additions and 3 deletions

View file

@ -6563,7 +6563,6 @@ parser_number_literal_suffix(struct parser_params *parser, int mask)
} }
break; break;
} }
literal_flush(lex_p);
return result; return result;
} }
@ -7935,6 +7934,9 @@ parser_yylex(struct parser_params *parser)
parser->token_seen = TRUE; parser->token_seen = TRUE;
retry: retry:
last_state = lex_state; last_state = lex_state;
#ifndef RIPPER
token_flush(parser);
#endif
switch (c = nextc()) { switch (c = nextc()) {
case '\0': /* NUL */ case '\0': /* NUL */
case '\004': /* ^D */ case '\004': /* ^D */
@ -7959,8 +7961,6 @@ parser_yylex(struct parser_params *parser)
outofloop: outofloop:
pushback(c); pushback(c);
dispatch_scan_event(tSP); dispatch_scan_event(tSP);
#else
token_flush(parser);
#endif #endif
goto retry; goto retry;

View file

@ -987,6 +987,9 @@ x = __ENCODING__
begin; begin;
assert_syntax_error("def f r:def d; def f 0end", /unexpected/) assert_syntax_error("def f r:def d; def f 0end", /unexpected/)
end; end;
assert_syntax_error("def\nf(000)end", /^ \^~~/)
assert_syntax_error("def\nf(&)end", /^ \^/)
end end
def test_method_location_in_rescue def test_method_location_in_rescue