Fix the reduce/reduce conflicts in the grammar#599
Conversation
|
Sorry for introducing the conflicts in the first place. As a review data point, I have arrived independently to the same patch in https://github.com/Octachron/ocaml/tree/fix_parser_conflicts. |
parsing/parser.mly
Outdated
| | mod_longident DOT simple_delimited_pattern | ||
| { mkpat @@ Ppat_open(mkrhs $1 1, $3) } | ||
| | mod_longident DOT LBRACKET RBRACKET | ||
| { mkpat @@ Ppat_construct ( mkrhs (Lident "[]") 1, None) } |
There was a problem hiding this comment.
That's a new syntax, right ? M.[] is not valid in patterns in 4.03.
There was a problem hiding this comment.
Also, it should probably Ppat_open the longident.
There was a problem hiding this comment.
You are right M.[] should be the pattern open symmetric of M.[] ⇔ let open M in [] on the expression side. So, this is one difference between the two patch sets.
There was a problem hiding this comment.
That's right, you should wrap a Ppat_open around the Ppat_construct.
@Drup the syntax was introduced in trunk some time ago.
There was a problem hiding this comment.
Thanks for the comments. I intentionally kept the behaviour the same as trunk, where M is ignored in the pattern M.[]. But I agree that using M to resolve [] is better, so I've added Ppat_open in 1c4ee3a.
Fix the reduce/reduce conflicts in the grammar
Co-authored-by: Cuihtlauac ALVARADO <cuihtmlauac@tarides.com>
This pull request fixes the conflicts in the grammar in the current trunk. The present status of
parsing/parser.mlyis as follows:Happily, the conflicts all have straightforward resolutions. The changes are as follows:
The following productions are removed:
These productions are redundant because the RHSs can be generated via different routes:
(etc.)
The following duplication is removed:
The following redundancy
is replaced by removing the first production and adding a new production for qualified
[]patterns: