Setting recoveryEnabled to false on an instance of the Lexer class will prevent chevrotain from
trying to consume more characters when it cannot match a token at the current scanning offset
fix #1838
Useful when a token does not match but may match on the next character. For instance I match 'account names' which can optionally be surrounded by parentheses, but can also contain parentheses if not fully surrounded. ex:
Due to the interspersed brackets, it isn't easy to take care of the () in the parser as separate tokens, as I'd have to concatenate the internal parentheses and text segments. In some places I want to ONLY accept a 'real' account, but when the lexer steps forward one char (losing the opening bracket), it will now match. ex:
Assets:Chequing <- valid token
(Assets:Chequing) <- invalid token in this lexing mode, BUT:
Assets:Chequing) <- will be matched when it tries to skip the opening parentheses
Setting recoveryEnabled to false on an instance of the Lexer class will prevent chevrotain from trying to consume more characters when it cannot match a token at the current scanning offset
fix #1838
Useful when a token does not match but may match on the next character. For instance I match 'account names' which can optionally be surrounded by parentheses, but can also contain parentheses if not fully surrounded. ex:
'Real' accounts
'Virtual' accounts
Due to the interspersed brackets, it isn't easy to take care of the () in the parser as separate tokens, as I'd have to concatenate the internal parentheses and text segments. In some places I want to ONLY accept a 'real' account, but when the lexer steps forward one char (losing the opening bracket), it will now match. ex: