Skip to content

Commit

Permalink
Fixed #4155: parser bug with / after call with parentheses
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite committed Mar 23, 2017
1 parent 874eb8b commit 83f9aec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions spec/compiler/parser/parser_spec.cr
Expand Up @@ -836,6 +836,9 @@ describe "Parser" do
it_parses "begin\n/ /\nend", Expressions.new([regex(" ")] of ASTNode)
it_parses "/\\//", regex("/")
it_parses "%r(/)", regex("/")
it_parses "a()/3", Call.new("a".call, "/", 3.int32)
it_parses "a() /3", Call.new("a".call, "/", 3.int32)
it_parses "a.b() /3", Call.new(Call.new("a".call, "b"), "/", 3.int32)

it_parses "1 =~ 2", Call.new(1.int32, "=~", 2.int32)
it_parses "1.=~(2)", Call.new(1.int32, "=~", 2.int32)
Expand Down
1 change: 1 addition & 0 deletions src/compiler/crystal/syntax/parser.cr
Expand Up @@ -3892,6 +3892,7 @@ module Crystal
end
end
end_location = token_end_location
@wants_regex = false
next_token_skip_space
end

Expand Down

0 comments on commit 83f9aec

Please sign in to comment.