Skip to content

Commit

Permalink
Parse slash after open-paren as regex delimiter (#5453)
Browse files Browse the repository at this point in the history
Fixed #5411
  • Loading branch information
makenowjust authored and bcardiff committed Apr 10, 2018
1 parent e4f637c commit 27697cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions spec/compiler/parser/parser_spec.cr
Expand Up @@ -857,6 +857,7 @@ describe "Parser" do
it_parses "/ /; / /", [regex(" "), regex(" ")] of ASTNode
it_parses "/ /\n/ /", [regex(" "), regex(" ")] of ASTNode
it_parses "a = / /", Assign.new("a".var, regex(" "))
it_parses "(/ /)", Expressions.new([regex(" ")] of ASTNode)
it_parses "a = /=/", Assign.new("a".var, regex("="))
it_parses "a; if / /; / /; elsif / /; / /; end", ["a".call, If.new(regex(" "), regex(" "), If.new(regex(" "), regex(" ")))]
it_parses "a; if / /\n/ /\nelsif / /\n/ /\nend", ["a".call, If.new(regex(" "), regex(" "), If.new(regex(" "), regex(" ")))]
Expand Down
1 change: 1 addition & 0 deletions src/compiler/crystal/syntax/parser.cr
Expand Up @@ -1597,6 +1597,7 @@ module Crystal

def parse_parenthesized_expression
location = @token.location
slash_is_regex!
next_token_skip_space_or_newline

if @token.type == :")"
Expand Down

0 comments on commit 27697cf

Please sign in to comment.