Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [Perl] Change the token matcher to accept tokens and return errors at the same time The current implemnetation of the parser calls the token matcher multiple times to identify the same input line (e.g. in a 'lookahead' or as part of the state machine ('match_token_at_*'). When an invocation causes an error (e.g. because there are tags with embedded spaces, or the selected language isn't available), the parser always stashes the error in the list of errors. Since the matcher may be invoked multiple times, the error may get stashed multiple times. To fix the user experience, Ruby, Perl, Python and others de-duplicate the reported errors by error message. This change moves stashing of errors to the point where the token is accepted into the AST, which means that multiples of the same error are discarded when that makes sense. E.g. the lookahead discards the errors and *only* looks at whether there is a match with the desired token type. Note: The structure of returning a boolean accepting the line and a second element indicating an error, adds the currently-missing capability of saying 'yes, this is what you're looking for, but there are problems with it'. * Further simplify the parser Move the responsibility to check that there even *is* an input line to match, to the token matcher. Now that the parser largely isn't responsible for it anymore, we can do away with a whole slew of equally-named wrapper functions in the parser that already exist in the token matcher. Not having two sets of functions by the same name helps to navigate the code.
- Loading branch information