Arpeggio icon indicating copy to clipboard operation
Arpeggio copied to clipboard

Lookahead rules always showed as not matched in debug mode

Open vprat opened this issue 3 years ago • 1 comments

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] ]

vprat avatar Aug 01 '22 09:08 vprat

Thanks for the report. It is indeed misleading.

igordejanovic avatar Aug 02 '22 08:08 igordejanovic