Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors once #152

Merged
merged 2 commits into from
Aug 17, 2023
Merged

Errors once #152

merged 2 commits into from
Aug 17, 2023

Commits on Aug 16, 2023

  1. [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'.
    ehuelsmann committed Aug 16, 2023
    Configuration menu
    Copy the full SHA
    0589cd0 View commit details
    Browse the repository at this point in the history
  2. 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.
    ehuelsmann committed Aug 16, 2023
    Configuration menu
    Copy the full SHA
    7b84c3f View commit details
    Browse the repository at this point in the history