Skip to content

Commit c962fdd

Browse files
fix(web): Fix issue where quotes cannot be used within a query (#629)
1 parent 8e036a3 commit c962fdd

File tree

10 files changed

+106
-73
lines changed

10 files changed

+106
-73
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
- Fixed issue where single quotes could not be used in search queries. [#629](https://github.com/sourcebot-dev/sourcebot/pull/629)
12+
1013
## [4.10.0] - 2025-11-24
1114

1215
### Added

packages/queryLanguage/src/parser.terms.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This file was generated by lezer-generator. You probably shouldn't edit it.
22
export const
3-
negate = 22,
3+
negate = 23,
44
Program = 1,
55
OrExpr = 2,
66
AndExpr = 3,
@@ -18,4 +18,5 @@ export const
1818
SymExpr = 15,
1919
RepoSetExpr = 16,
2020
ParenExpr = 17,
21-
Term = 18
21+
QuotedTerm = 18,
22+
Term = 19

packages/queryLanguage/src/parser.ts

Lines changed: 8 additions & 8 deletions
Large diffs are not rendered by default.

packages/queryLanguage/src/query.grammar

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ expr {
2424
NegateExpr |
2525
ParenExpr |
2626
PrefixExpr |
27+
QuotedTerm |
2728
Term
2829
}
2930

3031
NegateExpr { !negate negate (PrefixExpr | ParenExpr) }
3132

32-
ParenExpr { "(" query ")" }
33+
ParenExpr { "(" query? ")" }
3334

3435
PrefixExpr {
3536
ArchivedExpr |
@@ -63,7 +64,8 @@ archivedValue { "yes" | "no" | "only" }
6364
forkValue { "yes" | "no" | "only" }
6465
visibilityValue { "public" | "private" | "any" }
6566

66-
Term { quotedString | word }
67+
QuotedTerm { quotedString }
68+
Term { word }
6769

6870
value { quotedString | word }
6971

@@ -86,9 +88,7 @@ value { quotedString | word }
8688

8789
quotedString { '"' (!["\\\n] | "\\" _)* '"' }
8890

89-
// Allow almost anything in a word except spaces, parens, quotes
90-
// Colons and dashes are allowed anywhere in words (including at the start)
91-
word { (![ \t\n()"]) (![ \t\n()":] | ":" | "-")* }
91+
word { (![ \t\n()]) (![ \t\n():] | ":" | "-")* }
9292

9393
space { $[ \t\n]+ }
9494

packages/queryLanguage/test/grouping.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
==>
66

7-
Program(ParenExpr(Term(⚠)))
7+
Program(ParenExpr)
88

99
# Simple grouping
1010

packages/queryLanguage/test/negation.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Program(Term)
1212

1313
==>
1414

15-
Program(Term)
15+
Program(QuotedTerm)
1616

1717
# Dash in middle
1818

@@ -244,7 +244,7 @@ Program(NegateExpr(ParenExpr(AndExpr(PrefixExpr(FileExpr),PrefixExpr(LangExpr)))
244244

245245
==>
246246

247-
Program(NegateExpr(ParenExpr(Term(⚠))))
247+
Program(NegateExpr(ParenExpr))
248248

249249
# Negate with space after dash
250250

packages/queryLanguage/test/operators.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Program(OrExpr(Term,NegateExpr(PrefixExpr(FileExpr))))
3636

3737
==>
3838

39-
Program(OrExpr(Term,Term))
39+
Program(OrExpr(QuotedTerm,QuotedTerm))
4040

4141
# OR with different prefixes
4242

@@ -260,7 +260,7 @@ Program(OrExpr(PrefixExpr(FileExpr),PrefixExpr(FileExpr)))
260260

261261
==>
262262

263-
Program(OrExpr(ParenExpr(Term(⚠)),ParenExpr(Term(⚠))))
263+
Program(OrExpr(ParenExpr,ParenExpr))
264264

265265
# OR with negated groups
266266

packages/queryLanguage/test/precedence.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Program(AndExpr(ParenExpr(OrExpr(Term,Term)),ParenExpr(OrExpr(Term,Term))))
156156

157157
==>
158158

159-
Program(Term)
159+
Program(QuotedTerm)
160160

161161
# Prefix with OR value doesn't split
162162

@@ -188,13 +188,13 @@ Program(OrExpr(Term,ParenExpr(AndExpr(Term,Term))))
188188

189189
==>
190190

191-
Program(OrExpr(ParenExpr(Term(⚠)),AndExpr(Term,Term)))
191+
Program(OrExpr(ParenExpr,AndExpr(Term,Term)))
192192

193193
# Negation of empty group
194194

195195
-() a
196196

197197
==>
198198

199-
Program(AndExpr(NegateExpr(ParenExpr(Term(⚠))),Term))
199+
Program(AndExpr(NegateExpr(ParenExpr),Term))
200200

0 commit comments

Comments
 (0)