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

add experimental rule to catch missing close brace #1981

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

mtoy-googly-moogly
Copy link
Collaborator

@mtoy-googly-moogly mtoy-googly-moogly commented Oct 28, 2024

Adding this rule to the grammar ...

closeCurly
  : CCURLY
  | { this.notifyErrorListeners("'{' missing a '}'"); }
  ;

Makes turns this error message ...

    line 2: extraneous input '<EOF>' expecting {AGGREGATE, CALCULATE, DECLARE, DIMENSION, EXTENDQ,
    GROUP_BY, HAVING, INDEX, JOIN_CROSS, JOIN_ONE, JOIN_MANY, LIMIT, MEASURE, NEST, ORDER_BY,
    PROJECT, QUERY, RUN, SAMPLE, SELECT, SOURCE, TOP, WHERE, VIEW, TIMEZONE, ALL, AVG, CASE, CAST,
    COUNT, DAY, EXCLUDE, FALSE, HOUR, IS, MAX, MIN, MINUTE, MONTH, NOT, NOW, NULL, PICK, QUARTER,
    SECOND, SOURCE_KW, SUM, TABLE, TRUE, WEEK, YEAR, HACKY_REGEX, SQ_STRING, DQ_STRING,
    BQ_STRING, DOC_ANNOTATION, ANNOTATION, '(', '[', '{', '}', '-', ';', LITERAL_TIMESTAMP, LITERAL_HOUR,
    LITERAL_DAY, LITERAL_QUARTER, LITERAL_MONTH, LITERAL_WEEK, LITERAL_YEAR, IDENTIFIER,
    NUMERIC_LITERAL, INTEGER_LITERAL, '"""'}

Into '{' missing a '}'

But I worry that would somehow break the parser for legal sentences, so we might have to back this out.

@mtoy-googly-moogly mtoy-googly-moogly merged commit 7ff2e62 into main Oct 28, 2024
11 checks passed
@mtoy-googly-moogly mtoy-googly-moogly deleted the close-curly-experiment branch October 28, 2024 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant