Repository navigation
fix(parser): reject what the grammar rejects (#651) - #659
Merged
Merged
Conversation
The grammar verifier (#643) found inputs the parser accepted and tests/grammar/grammar.pest rejects, some with wrong answers: - a value after a query option and its argument joined the section before the option ([:find ?a :any-valid-time ?b ...] returned ?b as a column): now PRS-061 - a :where list headed by an operator or a variable, (< ?a ?b) or (?r ?a), was a call of a rule of that name and returned no rows: now PRS-097; a rule named by one: PRS-105 - a rule head argument that is not a variable: new PRS-114 - an aggregate, window or expression named by a variable failed at run time: now PRS-025 / PRS-029 / PRS-063 - (query []): new PRS-111; an empty :find/:where/:with: new PRS-112; an unknown query keyword: new PRS-113 - an unterminated string: new PRS-109; a ':' with no name: new PRS-110 A lone '-' stays the subtraction operator: the grammar's op_sym now lists it. Removes the #651 entries from the verifier's KNOWN_DRIFT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019kY61Y11gcRD91Y6b7jbGT
Collaborator
Author
|
Bound 4 verifier passed locally: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…RIFT now empty; test counts combined) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019kY61Y11gcRD91Y6b7jbGT
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.
Closes #651 (closing keywords don't fire on
v3; I'll close the issue by hand after merge).The grammar verifier (#643) found inputs the parser accepted and
tests/grammar/grammar.pestrejects. Some of them gave wrong answers. They are now errors (breaking for v3.0.0):[:find ?a :any-valid-time ?b :where …](a value after any option and its argument)?bjoined:findPRS-061(< ?a ?b),(?r ?a)as a clause (also innot/or/rule bodies)PRS-097(rule [(?r ?a) …]),(rule [(< ?a) …])PRS-105(rule [(r ?a :c) …])(r ?a ?x)bound?x = :cPRS-114(?f ?x)as an aggregate / window / expressionQRY-010/QRY-007at run timePRS-025/PRS-029/PRS-063(query [])PRS-111:find/:where/:withPRS-112:foo,:limit,:in)PRS-061PRS-113"abc(no closing quote)PRS-109:with no name (:+):PRS-110Decisions (agreed with the maintainer):
-stays the subtraction operator. The grammar gets the fix:op_symnow has"-" ~ !word_cont, like+.PRS-114): bind in the body,(rule [(r ?a ?x) [?a :edge ?x] [(= ?x :c)]]).PRS-025/029/063/097/105), whose docs now mention the v2.x behaviour.Also included:
[(?f ?x) ?y]UDF-by-variable case the issue lists as beyond the default bound.KNOWN_DRIFTentries and their classifiers are removed.structural_causenow returnsNone. Only Grammar: document or drop line comments and non-ASCII identifiers #650's two lexical entries remain, and PR docs(grammar): document line comments and Unicode identifiers (#650) #658 removes those; the two PRs will conflict mechanically inverifier.rs.tests/error_codes_prs_test.rs, 13invalid/syntaxfixtures and 1validfixture ((- ?n 1)).docs/GRAMMAR.mdis regenerated.I scanned every
(query …)/(rule …)form in the docs site, playground, demos, examples, src and tests: none outside the new tests hits a new rejection.Verification:
cargo testpasses, and the verifier passes at bound 3 with no #651 drift. Bound 4 is running locally; I'll post the result here. Codex review: two findings, both checked against the code and both wrong (-?ais aplain_sym;(= ?x :c)is the binary form and runs).Docs site: project-minigraf/minigraf-docs PR to follow (
@since v3.0.0notes in the Datalog reference).🤖 Generated with Claude Code
https://claude.ai/code/session_019kY61Y11gcRD91Y6b7jbGT