This is a very common issue with learning pyparsing. Pyparsing does not do any right-to-left backtracking like regex'es do. It is purely left-to-right. So make sure your repetition does not accidentally include the terminating sentinel value.
See embedded comments below:
Code:
from pyparsing import * # define these up front
Leave a comment: