Don't try recognition if at end of the input.
@@ -284,6 +284,7 @@ class Parser(object):
ntok = EOF_token
else:
tokens = []
+ if position < in_len:
for idx, symbol in enumerate(actions):
tok = symbol.recognizer(input_str, position)
if tok:
