-
Notifications
You must be signed in to change notification settings - Fork 12
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
or clause get ignored when the first clause is complicated #11
Comments
The (esrap:trace-rule 'real-or-symbol :recursive t) Trying the failing input with the traced rules reveals the problem: (esrap:parse 'real-or-symbol "aaa")
1: REAL-OR-SYMBOL 0[aaa]?
2: REAL 0[aaa]?
2: REAL 0-0 -> ("")
1: REAL-OR-SYMBOL 0-0 -> ("") The The parser.common-rules library has rules for various numeric literals. Maybe you can find inspiration there or even use the library. As a final note, please don't use symbols in the |
Got it! Thanks for the detailed analysis and both trace-rule and common-rules libs are indeed helpful!
Good to know that |
Hi @scymtym ! Inspired by parser.common-rules, I get it work by adding real-decimals and real-scientific. rename to my-real to avoid potential confliction with
Also parser.common-rules isn't mentioned in readme or homepage, I think it would be really helpful to mention it as solid examples and reference. And there's a minor bug, i think, exist in float-literal/rational and my-real:
Expected result is reject Answer myself: trying a few different cases, this works (need to re-organize it to abstract common parts)
|
Thank you for the report. The issue should now be fixed in the master branch of the parser.common-rules library. I also extended the unit test significantly, so hopefully i got it right this time. |
A short snippet to reproduce:
Then try:
Why it was not continue try symbol when it's not a real? Thanks!
The text was updated successfully, but these errors were encountered: