state_parsing_eval() returns the longest match

The previous implementation of state_parsing_eval() returned passing immediately if the state was terminating. Now, the state's transitions are checked first to make sure that there is no possible longer match.