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

parse.y: fix fluent interface identifier

* parse.y (parser_yylex): dispatch newline and space at fluent
  interface, so that the following identifier does not include the
  space.  [ruby-dev:48684] [Bug #10411]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-10-24 13:49:44 +00:00
parent fe4ed311d1
commit 5940b1f6fc
3 changed files with 16 additions and 0 deletions

View file

@ -1,3 +1,9 @@
Fri Oct 24 22:49:42 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (parser_yylex): dispatch newline and space at fluent
interface, so that the following identifier does not include the
space. [ruby-dev:48684] [Bug #10411]
Fri Oct 24 20:41:36 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com> Fri Oct 24 20:41:36 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
* signal.c (check_reserved_signal_): fix write count since r47991. * signal.c (check_reserved_signal_): fix write count since r47991.

View file

@ -7763,9 +7763,15 @@ parser_yylex(struct parser_params *parser)
space_seen = 1; space_seen = 1;
break; break;
case '.': { case '.': {
#ifdef RIPPER
ripper_dispatch_delayed_token(parser, tIGNORED_NL);
#endif
if ((c = nextc()) != '.') { if ((c = nextc()) != '.') {
pushback(c); pushback(c);
pushback('.'); pushback('.');
#ifdef RIPPER
ripper_dispatch_scan_event(parser, tSP);
#endif
goto retry; goto retry;
} }
} }

View file

@ -38,6 +38,10 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
Ripper.tokenize("print( <<""EOS)\nheredoc\nEOS\n") Ripper.tokenize("print( <<""EOS)\nheredoc\nEOS\n")
assert_equal ["\#\n", "\n", "\#\n", "\n", "nil", "\n"], assert_equal ["\#\n", "\n", "\#\n", "\n", "nil", "\n"],
Ripper.tokenize("\#\n\n\#\n\nnil\n") Ripper.tokenize("\#\n\n\#\n\nnil\n")
assert_equal ["1", " ", ".", "foo", "\n"],
Ripper.tokenize("1 .foo\n")
assert_equal ["1", "\n", " ", ".", "foo", "\n"],
Ripper.tokenize("1\n .foo\n")
end end
def test_lex def test_lex