-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple ws rules #96
Comments
It might end up looking ugly, but I'd go for tokens only and call the right ws* implementation directly. |
Another option that I've used (I believe in a TOML parser) is to create the class with the inner-level white space inside the outer grammar declaration, the rules of which can be called with |
On Thu, Jul 16, 2015 at 03:07:36PM -0700, Stéphane Payrard wrote:
Note that S05 allows :sigspace to have an argument specifying a rule I don't know if Rakudo implements the argument form of :sigspace yet. Pm |
sigspace is a great Perl 6 feature but sometimes is too limited.
When designing a grammar one may want a sigpace for
certain rules and another for other rules.
My motivation is a grammar for parsing a .git/config file.
Some rules match things within a line while other possibly match
with sigspaces that span multiple lines.
I tried different approaches, to no avail. Two of them
make me thinks of possible changes to S05.
The first approach was to split the grammar in two with each one
having its own ws rules, and one derived from the other.
But due to virtual method dispatching
the more derived is always pickage. Is virtual method dispatching
really appropriate for rules? I have not yet thought it out knowing that
a grammar can contain regular method as well.
I then thought I could use lexical ws methods but their call
being implicit, I cannot use <&ws> in rules to get to then.
Maybe it should be possible to declare a lexical rule with
a trait that indicates that it should be (conceptually) tried
before regular method dispatch.
Short of explicit spacing, is there good alternatives I have missed for
problems that need multiple sigspaces.
I realise that, in this case, the comments don't have to be matches
within a sigspace.
The text was updated successfully, but these errors were encountered: