Skip to content
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

Lookahead rules always showed as not matched in debug mode #95

Open
vprat opened this issue Aug 1, 2022 · 1 comment
Open

Lookahead rules always showed as not matched in debug mode #95

vprat opened this issue Aug 1, 2022 · 1 comment
Labels

Comments

@vprat
Copy link

vprat commented Aug 1, 2022

And and Not rules are never showed as matched in debug mode because no input is consumed.
This is misleading.

>>> from arpeggio import *
>>> def expr(): return And("a"), "a"           
... 
>>> p = ParserPython(expr)
>>> p.debug = True
>>> p.parse("a")
>> Matching rule expr=Sequence at position 0 => *a
   >> Matching rule And in expr at position 0 => *a
      ?? Try match rule StrMatch(a) in expr at position 0 => *a
      ++ Match 'a' at 0 => '*a*'
   <<- Not matched rule And in expr at position 0 => *a
   ?? Try match rule StrMatch(a) in expr at position 0 => *a
   ++ Match 'a' at 0 => '*a*'
<<+ Matched rule expr=Sequence in expr at position 1 => a*
[  'a' [0] ]
@igordejanovic
Copy link
Member

Thanks for the report. It is indeed misleading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants