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

View file

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