Skip to content

Commit

Permalink
Allow newlines and comments between method calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Jun 17, 2019
1 parent 4124047 commit 4296c77
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mrbgems/mruby-compiler/core/parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -4757,6 +4757,14 @@ parser_yylex(parser_state *p)
case '\13': /* '\v' */
space_seen = 1;
break;
case '#': /* comment as a whitespace */
pushback(p, '#');
goto retry;
case '\n': /* consecutive newlines */
p->lineno++;
p->column = 0;
pushback(p, '\n');
goto retry;
case '.':
if (!peek(p, '.')) {
pushback(p, '.');
Expand Down

3 comments on commit 4296c77

@shuujii
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this feature, but it doesn't seem to introduce to CRuby. Is this intentional?

@matz
Copy link
Member Author

@matz matz commented on 4296c77 Jun 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be implemented also in CRuby soon.

@shuujii
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your reply. That's good news for me 😄

BTW, #4513 seems to be due to this change.

Please sign in to comment.