Skip to content

Commit

Permalink
Fix parser error with semicolon + newline in parenthezied `Expression…
Browse files Browse the repository at this point in the history
…s` (#11769)

Co-authored-by: Skurhse Rage 🌆🌃🌌 <[email protected]>
  • Loading branch information
straight-shoota and Skurhse Rage 🌆🌃🌌 authored Jan 29, 2022
1 parent aa8bbd7 commit 8d3155e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions spec/compiler/parser/parser_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ module Crystal
it_parses "(foo bar do\nend)", Expressions.new([Call.new(nil, "foo", ["bar".call] of ASTNode, Block.new)] of ASTNode)
it_parses "(baz; bar do\nend)", Expressions.new(["baz".call, Call.new(nil, "bar", [] of ASTNode, Block.new)] of ASTNode)
it_parses "(bar {})", Expressions.new([Call.new(nil, "bar", [] of ASTNode, Block.new)] of ASTNode)
it_parses "(a;\nb)", Expressions.new([Call.new(nil, "a"), Call.new(nil, "b")] of ASTNode)
it_parses "1.x; foo do\nend", [Call.new(1.int32, "x"), Call.new(nil, "foo", block: Block.new)] of ASTNode
it_parses "x = 1; foo.bar x do\nend", [Assign.new("x".var, 1.int32), Call.new("foo".call, "bar", ["x".var] of ASTNode, Block.new)]

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/syntax/parser.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@ module Crystal
next_token_skip_space
break
when :NEWLINE, :";"
next_token_skip_space
next_token_skip_statement_end
if @token.type == :")"
@wants_regex = false
next_token_skip_space
Expand Down

0 comments on commit 8d3155e

Please sign in to comment.