Parser: between, starts with, ends with — 297/831 (36%)

- is between X and Y / is not between X and Y: uses parse-atom for
  bounds to avoid consuming 'and' as logical operator
- starts with / ends with: comparison operators mapping to
  starts-with? / ends-with? primitives
- comparisonOperator: 12→17/40

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-10 22:52:28 +00:00
parent 52e4d38852
commit 6e38a2e1e1
2 changed files with 42 additions and 0 deletions

View File

@@ -363,6 +363,14 @@
(list (quote not) (list (quote empty?) left))) (list (quote not) (list (quote empty?) left)))
((match-kw "in") ((match-kw "in")
(list (quote not-in?) left (parse-expr))) (list (quote not-in?) left (parse-expr)))
((match-kw "between")
(let ((lo (parse-atom)))
(match-kw "and")
(let ((hi (parse-atom)))
(list (quote not)
(list (quote and)
(list (quote >=) left lo)
(list (quote <=) left hi))))))
((match-kw "really") ((match-kw "really")
(do (do
(match-kw "equal") (match-kw "equal")
@@ -420,6 +428,13 @@
(match-kw "to") (match-kw "to")
(list (quote >=) left (parse-expr))) (list (quote >=) left (parse-expr)))
(list (quote >) left (parse-expr))))) (list (quote >) left (parse-expr)))))
((match-kw "between")
(let ((lo (parse-atom)))
(match-kw "and")
(let ((hi (parse-atom)))
(list (quote and)
(list (quote >=) left lo)
(list (quote <=) left hi)))))
((match-kw "in") (list (quote in?) left (parse-expr))) ((match-kw "in") (list (quote in?) left (parse-expr)))
((match-kw "really") ((match-kw "really")
(do (do
@@ -475,6 +490,12 @@
(list (quote =) left right)))))) (list (quote =) left right))))))
((and (= typ "keyword") (= val "exists")) ((and (= typ "keyword") (= val "exists"))
(do (adv!) (list (quote exists?) left))) (do (adv!) (list (quote exists?) left)))
((and (or (= typ "keyword") (= typ "ident")) (= val "starts"))
(do (adv!) (match-kw "with")
(list (quote starts-with?) left (parse-expr))))
((and (or (= typ "keyword") (= typ "ident")) (= val "ends"))
(do (adv!) (match-kw "with")
(list (quote ends-with?) left (parse-expr))))
((and (= typ "keyword") (= val "matches")) ((and (= typ "keyword") (= val "matches"))
(do (adv!) (list (quote matches?) left (parse-expr)))) (do (adv!) (list (quote matches?) left (parse-expr))))
((and (= typ "keyword") (= val "contains")) ((and (= typ "keyword") (= val "contains"))

View File

@@ -363,6 +363,14 @@
(list (quote not) (list (quote empty?) left))) (list (quote not) (list (quote empty?) left)))
((match-kw "in") ((match-kw "in")
(list (quote not-in?) left (parse-expr))) (list (quote not-in?) left (parse-expr)))
((match-kw "between")
(let ((lo (parse-atom)))
(match-kw "and")
(let ((hi (parse-atom)))
(list (quote not)
(list (quote and)
(list (quote >=) left lo)
(list (quote <=) left hi))))))
((match-kw "really") ((match-kw "really")
(do (do
(match-kw "equal") (match-kw "equal")
@@ -420,6 +428,13 @@
(match-kw "to") (match-kw "to")
(list (quote >=) left (parse-expr))) (list (quote >=) left (parse-expr)))
(list (quote >) left (parse-expr))))) (list (quote >) left (parse-expr)))))
((match-kw "between")
(let ((lo (parse-atom)))
(match-kw "and")
(let ((hi (parse-atom)))
(list (quote and)
(list (quote >=) left lo)
(list (quote <=) left hi)))))
((match-kw "in") (list (quote in?) left (parse-expr))) ((match-kw "in") (list (quote in?) left (parse-expr)))
((match-kw "really") ((match-kw "really")
(do (do
@@ -475,6 +490,12 @@
(list (quote =) left right)))))) (list (quote =) left right))))))
((and (= typ "keyword") (= val "exists")) ((and (= typ "keyword") (= val "exists"))
(do (adv!) (list (quote exists?) left))) (do (adv!) (list (quote exists?) left)))
((and (or (= typ "keyword") (= typ "ident")) (= val "starts"))
(do (adv!) (match-kw "with")
(list (quote starts-with?) left (parse-expr))))
((and (or (= typ "keyword") (= typ "ident")) (= val "ends"))
(do (adv!) (match-kw "with")
(list (quote ends-with?) left (parse-expr))))
((and (= typ "keyword") (= val "matches")) ((and (= typ "keyword") (= val "matches"))
(do (adv!) (list (quote matches?) left (parse-expr)))) (do (adv!) (list (quote matches?) left (parse-expr))))
((and (= typ "keyword") (= val "contains")) ((and (= typ "keyword") (= val "contains"))