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

Support the rest of QLike ops, incuding all regular expression functions #39

Closed xsawyerx closed 4 years ago

xsawyerx commented 4 years ago

This supports the following:

However, because of how I implemented this, we don't support stuff like:

s {foo}   # Replace foo
  {bar};  # with bar.

If we want to support this, we'll need to do this across all QLike operators: s///, y///, tr///, m//, qw//, etc.

I don't think we should support that, to be honest, despite the convenience of putting regexes there.

xsawyerx commented 4 years ago

@vickenty I realized phase statements in sub definition (sub BEGIN {...}, etc.) were broken (identified as both a PhaseStatement and a SubStatement) and had to be supported in the same crazy hack.

Please review this horrible commit: https://github.com/xsawyerx/reimagined-guacamole/pull/39/commits/65633b222e07500ff5ffa4cff01c371b16616922.

Alternatively, we can avoid identifying sub BEGIN {...} as a PhaseStatement, but then people would get different results between BEGIN {...} and sub BEGIN {...}.