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

Meld consecutive template string literals #584

Merged
merged 1 commit into from
Jan 30, 2023

Commits on Jan 27, 2023

  1. Meld consecutive template string literals

    When processing a template string, the lexer can emit multiple string
    literal tokens for what ought to be a single string literal. This occurs
    when the string contains escape sequences, or consecutive characters
    which are indistinguishable from escape sequences at tokenization time.
    
    This leads to a confusing AST and causes heuristics about template
    expressions to fail. Specifically, when parsing a traversal with an
    index, a key value containing an escape symbol will cause the parser to
    generate an index expression instead of a traversal.
    
    This commit adds a post-processing step to the template parser to meld
    any sequences of string literals into a single string literal. Existing
    tests covered the previous misbehaviour (several of which had comments
    apologizing for it), and have been updated accordingly.
    
    The new behaviour of the `IsStringLiteral` method of `TemplateExpr` is
    covered with a new set of tests.
    alisdair committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    5fe5697 View commit details
    Browse the repository at this point in the history