New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser doesn't handle expressions vs statements properly. #137

Closed
tef opened this Issue Oct 20, 2012 · 3 comments

Comments

Projects
None yet
2 participants
@tef

tef commented Oct 20, 2012

In ruby, meth (args).meth2 {block} parses differently to meth(args).meth2 {block}. The whitespace is significant.

For example, in opal, this prints [1], [1], rather than [2], [1] as expected

def p x
  puts x
  x
end

p ([1]).map {|x| x+1} # this should print [2]
p([1]).map {|x| x+1} # this should print [1]
@adambeynon

This comment has been minimized.

Show comment
Hide comment
@adambeynon

adambeynon Oct 22, 2012

Contributor

Yeap, looks like a lexing issue. Will make a priority to fix.

Contributor

adambeynon commented Oct 22, 2012

Yeap, looks like a lexing issue. Will make a priority to fix.

@tef

This comment has been minimized.

Show comment
Hide comment
@tef

tef Oct 23, 2012

iirc, in parse.y this is handled by the use of LPAREN/LPAREN_ARG, which is controlled by the lexer state hack EXPR_*

https://github.com/ruby/ruby/blob/trunk/parse.y#L7607

tef commented Oct 23, 2012

iirc, in parse.y this is handled by the use of LPAREN/LPAREN_ARG, which is controlled by the lexer state hack EXPR_*

https://github.com/ruby/ruby/blob/trunk/parse.y#L7607

@ghost ghost assigned adambeynon Oct 23, 2012

@adambeynon

This comment has been minimized.

Show comment
Hide comment
@adambeynon

adambeynon Oct 27, 2012

Contributor

This should now be fixed on master, by 13ed3c5.

Contributor

adambeynon commented Oct 27, 2012

This should now be fixed on master, by 13ed3c5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment