xsawyerx / guacamole

Guacamole is a parser toolkit for Standard Perl. It provides fully static BNF-based parsing capability to a reasonable subset of Perl.
https://metacpan.org/pod/Guacamole
20 stars 8 forks source link

Ambiguity with sort #57

Closed vickenty closed 4 years ago

vickenty commented 4 years ago
sort $a + $b

parses as both:

# via OpKeywordSort VarScalar OpListKeywordArg
(sort (varscalar $a) (oplistkeywordarg (exprunary + $b)))

 # via OpKeywordSort OpListKeywordArgNonBrace
(sort (oplistkeywordargnonbrace (expradd '+' (varscalar $a) (varscalar $b)))

perl disambiguates to the latter.

This can be fixed with a new expression variant that does not start with an unary operator, similar to NonBraceExpr variants, but I'm don't like the idea of duplicating the whole table again.

xsawyerx commented 4 years ago

Resolved by #81.