Skip to content

Commit

Permalink
Comment lines can be placed between fluent dot now
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Sep 15, 2019
1 parent 751d4ab commit 3a3f48f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ sufficient information, see the ChangeLog file or Redmine

* The flip-flop syntax deprecation is reverted. [Feature #5400]

* Comment lines can be placed between fluent dot now.

foo
# .bar
.baz # => foo.baz

=== Core classes updates (outstanding ones only)

Complex::
Expand Down
4 changes: 4 additions & 0 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -8737,6 +8737,10 @@ parser_yylex(struct parser_params *p)
case '\13': /* '\v' */
space_seen = 1;
break;
case '#':
pushback(p, c);
if (space_seen) dispatch_scan_event(p, tSP);
goto retry;
case '&':
case '.': {
dispatch_delayed_token(p, tIGNORED_NL);
Expand Down
3 changes: 3 additions & 0 deletions test/ruby/test_syntax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,9 @@ def test_fluent_dot
assert_valid_syntax("a\n.foo")
assert_valid_syntax("a\n&.foo")
assert_valid_syntax("a\n.:foo")
assert_valid_syntax("a #\n#\n.foo\n")
assert_valid_syntax("a #\n#\n&.foo\n")
assert_valid_syntax("a #\n#\n.:foo\n")
end

def test_safe_call_in_massign_lhs
Expand Down

0 comments on commit 3a3f48f

Please sign in to comment.