Implementing backtracking for entire tokens instead of single characters