Refuse the write and transaction statements by name - #211
Merged
Merged
Conversation
The reserved keyword list exists so that a statement the v0 core does not parse is turned away by name, and its comment says as much, but the list was missing the one statement most likely to be typed. GQL spells element creation INSERT, CREATE is the Cypher spelling of something GQL does not have, and only CREATE was listed. So INSERT (x:Person {name: 'Zoe'}) came back as expected MATCH, OPTIONAL MATCH, CALL, UNWIND, WITH, or RETURN, which sends a reader looking for a typo in a statement they spelled correctly.
Adds INSERT, REMOVE, START, COMMIT, ROLLBACK, SESSION, FINISH and FOR alongside the keywords already there. Nothing new parses and no case changes outcome; eleven conformance cases that were failing on a misleading message now fail on an accurate one, which is where G3 and G8 will pick them up.
Two tests. One walks every reserved statement and checks the refusal names the keyword. The other guards the risk the change carries: ORDER, SKIP and LIMIT belong to the projection in front of them, so reserving keywords at the head of a clause must not reach inside a RETURN that is parsing normally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First piece of G3 (#118), and it is a message fix rather than a feature.
The reserved keyword list in the parser exists so that a statement the v0 core does not parse is turned away by name, and the comment above it says exactly that. It was missing the statement most likely to be typed. GQL spells element creation INSERT, CREATE is the Cypher spelling of something GQL does not have, and only CREATE was in the list. Writing INSERT (x:Person {name: 'Zoe'}) came back with expected MATCH, OPTIONAL MATCH, CALL, UNWIND, WITH, or RETURN, which sends a reader hunting for a typo in a statement they spelled correctly.
This adds INSERT, REMOVE, START, COMMIT, ROLLBACK, SESSION, FINISH and FOR next to the keywords already there. Nothing new parses and no conformance case changes outcome. Eleven cases that were failing on a misleading message now fail on an accurate one: the gd01, gd02 and gd04 write cases, performance/write/insert-one-node and gq10/for-over-list all name the statement they are waiting on, which is where G3 and G8 will pick them up.
Two tests. One walks every reserved statement and checks the refusal names the keyword. The other guards the risk the change carries: ORDER, SKIP and LIMIT belong to the projection in front of them, so reserving keywords at the head of a clause must not reach inside a RETURN that is parsing normally.
cargo fmt --check, cargo clippy -p zu-query --all-targets and cargo test --workspace are green.