Skip to content

fix(lxlquery): handle unclosed quotes + pills - #1647

Draft
jesperengstrom wants to merge 4 commits into
developfrom
fix-lxlquery-unclosed-quotes-in-qualifiers
Draft

fix(lxlquery): handle unclosed quotes + pills#1647
jesperengstrom wants to merge 4 commits into
developfrom
fix-lxlquery-unclosed-quotes-in-qualifiers

Conversation

@jesperengstrom

@jesperengstrom jesperengstrom commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Description

Solves

Needs to be thoroughly tested…

An attempt to fix the fact that a single quote char can break the pill rendering:

gif1.

This is of course because the " makes everything up until the next quote parse as a strLiteral, swallowing the subsequent qualifier.

We need to allow the stray to parse as something allowed inside a QualifierValue, in order for the qualifier to stay intact.
If we add a new token for the incomplete quoted string, StrliteralIncomplete, and include it in the definition of String, it now "adds upp", allowing the rest to stay intact too. (a little deceiving, because it is in fact an invalid query)

gif2.

But we still have a problem:

gif3.

The parser still sees the quoted string ” contribution:(” instead of an incomplete string and a qualifier.

The only thing I've come up with is to disallow certain chars in quoted strings. When the parser sees (), or ():=~<> in a incomplete quoted string, it breaks and instead goes with the qualifier:

gif4.

Downsides / tradeoffs

More convoluted grammar
We lose the "error highlighting" of unclosed quotes, since it's now part of the grammar
Will probably never be 100% waterproof:

the query
" title:"hello"

Will still be parsed as a the string literal " title:" (as long as we don't disallow more chars here)

This should only be merged in combination with a fix to make sure the api don't wipe groups () from the query. These are now key to recognizing qualifiers in these cases.

Summary of changes

  • Update grammar

@jesperengstrom
jesperengstrom force-pushed the fix-lxlquery-unclosed-quotes-in-qualifiers branch from 5acd5b9 to 5cc5f5a Compare June 25, 2026 08:13
@johanbissemattsson

Copy link
Copy Markdown
Contributor

Seems to work fine now! 🙌 LGTM!

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.

2 participants