Arpeggio
Arpeggio copied to clipboard
Lookahead rules always showed as not matched in debug mode
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] ]
Thanks for the report. It is indeed misleading.