sourcebot/packages/queryLanguage/test/grouping.txt
Brendan Kellam c962fdd636
Some checks are pending
Publish to ghcr / build (linux/amd64, blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Publish to ghcr / build (linux/arm64, blacksmith-8vcpu-ubuntu-2204-arm) (push) Waiting to run
Publish to ghcr / merge (push) Blocked by required conditions
Update Roadmap Released / update (push) Waiting to run
fix(web): Fix issue where quotes cannot be used within a query (#629)
2025-11-25 12:06:51 -08:00

120 lines
1.3 KiB
Text

# Empty parentheses
()
==>
Program(ParenExpr)
# Simple grouping
(test)
==>
Program(ParenExpr(Term))
# Multiple terms in group
(hello world)
==>
Program(ParenExpr(AndExpr(Term,Term)))
# Nested parentheses
((test))
==>
Program(ParenExpr(ParenExpr(Term)))
# Multiple groups
(first) (second)
==>
Program(AndExpr(ParenExpr(Term),ParenExpr(Term)))
# Group with multiple terms
(one two three)
==>
Program(ParenExpr(AndExpr(Term,Term,Term)))
# Mixed grouped and ungrouped
test (grouped) another
==>
Program(AndExpr(Term,ParenExpr(Term),Term))
# Deeply nested
(((nested)))
==>
Program(ParenExpr(ParenExpr(ParenExpr(Term))))
# Multiple nested groups
((a b) (c d))
==>
Program(ParenExpr(AndExpr(ParenExpr(AndExpr(Term,Term)),ParenExpr(AndExpr(Term,Term)))))
# Group at start
(start) middle end
==>
Program(AndExpr(ParenExpr(Term),Term,Term))
# Group at end
start middle (end)
==>
Program(AndExpr(Term,Term,ParenExpr(Term)))
# Complex grouping pattern
(a (b c) d)
==>
Program(ParenExpr(AndExpr(Term,ParenExpr(AndExpr(Term,Term)),Term)))
# Sequential groups
(a)(b)(c)
==>
Program(AndExpr(ParenExpr(Term),ParenExpr(Term),ParenExpr(Term)))
# Group with regex
([a-z]+)
==>
Program(ParenExpr(Term))
# Group with dots
(com.example.test)
==>
Program(ParenExpr(Term))