-
Notifications
You must be signed in to change notification settings - Fork 9
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
Extended parsing of preparser options #301
Conversation
🦋 Changeset detectedLatest commit: 4ff7cf0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
I guess this should have a changeset but no version bumps? |
…th preparser options
9c8384a
to
6d736dc
Compare
EXPLAIN | PROFILE | CYPHER (UNSIGNED_DECIMAL_INTEGER | IDENTIFIER EQ (IDENTIFIER | numberLiteral))*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be cleaner to extract the Cypher part to another rule?
preparserOption:
EXPLAIN | PROFILE | cypherOptions
cypherOptions:
CYPHER (cypherVersion | cypherOption)*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add some syntax colouring tests.
Also there's a test in syntacticValidation.test.ts
that checks we can use preparser keywords in other parts of the code and it still works, so we should have something for CYPHER
there.
There's a rule in CypherCmdParser
that overrides the keywords we can use:
// This rule overrides the identifiers adding EXPLAIN, PROFILE, etc
unescapedLabelSymbolicNameString:
preparserOption
| HISTORY
| CLEAR
| PARAM
| CONNECT
| DISCONNECT
| WELCOME
| SYSINFO
| unescapedLabelSymbolicNameString_
;
Probably best to add a preparserKeyword: EXPLAIN | PROFILE | CYPHER
to the preparser so we can rely on that one.
Don't think I understand the comment about preparserKeyword. You want preparserKeyword clashing with preparserOption? |
…AIN) and CYPHER-option. Adjusted cypherOptions-definition to require version first (like in db)
Also in the background the tokentype for the setting name ("runtime" here) was changed, but seems vscode currently has the same color for the new tokentype as the old. Considered removing it, but I suppose the different grouping would have an effect if vscode changes coloring |
Probably assigning |
…o constants.ts objects
Yup that looks nicer. TODO is still test making (Edit: not todo anymore) |
added parsing of preparser options for cypher versions and key=value
Can now parse queries like
CYPHER <versionnumber> <option1> = <value1> <option2> = <value2>
where options are identifiers and values either identifiers or numberLiterals