in reply to Forcing parse to fail in Parse::RecDescent
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Forcing parse to fail in PArse::RecDescent
by suaveant (Parson) on Sep 14, 2007 at 17:31 UTC | |
When I pass the following to it I get the error from the abstraction rule... When I pass My match fails, but I don't get the error from abstraction... maybe I am being bitten by leftop somehow... Here follows the whole grammar.
| [reply] [d/l] [select] |
by ikegami (Patriarch) on Sep 16, 2007 at 23:09 UTC | |
<leftop> backtracks and successfully matches 4. Since the production matches, pending errors are canceled. The parsing error happens later, when * {201({2}} attempts to match /^\Z/. This problem would be solved by committing after matching the *. Since <leftop> doesn't provide a means for us to do that, we'll have to roll out an alternative to <leftop>. The code in section 3.c.ii of Operator Associativity and Eliminating Left-Recursion in Parse::RecDescent suits your needs perfectly.
We can even add some extra diagnostics:
Using the test program found below generated the following output:
Read more... (2 kB)
| [reply] [d/l] [select] |
by suaveant (Parson) on Sep 17, 2007 at 15:09 UTC | |
I was actually thinking I might need a commit after the operator but wasn't sure how to get it in there. Interesting. Thank you. | [reply] |