Skip to content

Commit

Permalink
Handle edge case where the _ in \x._ should be parsed as a wildca…
Browse files Browse the repository at this point in the history
…rd, not an identifier
  • Loading branch information
MartyO256 committed Mar 7, 2024
1 parent 2122ea1 commit a3e6919
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/parser/common_parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,17 @@ module Make
let dot =
let dot_identifier_and_insert_ident =
span dot_identifier >>= fun (location, identifier) ->
let ident_token =
Located_token.make ~location
~token:(Token.IDENT (Identifier.name identifier))
in
insert_token ident_token
if Identifier.show identifier = "_" then
let wildcard_token =
Located_token.make ~location ~token:Token.UNDERSCORE
in
insert_token wildcard_token
else
let ident_token =
Located_token.make ~location
~token:(Token.IDENT (Identifier.name identifier))
in
insert_token ident_token
and dot_integer_and_insert_intlit =
span dot_integer >>= fun (location, integer) ->
let intlit_token =
Expand Down

0 comments on commit a3e6919

Please sign in to comment.