Repository navigation
Conversation
The grammar nests a chain to the right, and filterEvent evaluated it that way, so "A and B or C" was read as "A and (B or C)". Flatten the chain and evaluate it as an or of and groups, so it is "(A and B) or C" as in Wireshark display filters. not still applies to the clause after it, and parentheses still group explicitly.
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.
Fixes #241
What changed
filterEventwalked the right-nested query tree as it was parsed, soA and B or Cwas evaluated asA and (B or C). It now flattens the chain into clauses and operators and evaluates it as anorofandgroups, soandbinds tighter thanor, as in Wireshark display filters:notstill applies to the clause right after it.andgroup fails, its remaining clauses are skipped, and the first group that matches returns.The grammar is unchanged, so the generated types, the syntax diagram and the suggestions are untouched.
frontend/syntax.mdgets a short "Precedence" section.Testing
and binds tighter than ortests infrontend/__tests__/dsl.test.ts:A and B or C, the same query with the sides oforswapped,A or B and C or D,notinside a chain, and parentheses grouping anorfirst. Two of them (A and B or C,A or B and C or D) fail onmain; all pass with this change.npm run test: 69 passed. Prettier is clean on the changed files.npm run checkreports only the existing missing.routify/routes.default.js(generated by a build), not from this change.Note: this changes the result of saved queries that mix
andandorwithout parentheses. That's the point of the fix, but I'm happy to adjust if you'd prefer a different approach.AI disclosure: I used Claude Code to help find the bug, write the fix and tests, and draft this description. I reviewed the change and ran the tests myself.