TokenMatcher._uncached_match has different behavior than Literal._uncached_match regarding overread.
Literal's one returns None on overread thanks to its use of startswith.
TokenMatcher's one generates an IndexError: list index out of range.
To reproduce the exception the example below uses a OneOrMore expr that calls TokenMatcher._uncached_match with pos >= len(token_list):
TokenMatcher._uncached_match has different behavior than Literal._uncached_match regarding overread. Literal's one returns None on overread thanks to its use of startswith. TokenMatcher's one generates an
IndexError: list index out of range
.To reproduce the exception the example below uses a OneOrMore expr that calls TokenMatcher._uncached_match with pos >= len(token_list):
Simple fix is to check pos < len(token_list):