aboutsummaryrefslogtreecommitdiff
path: root/argot.lisp
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2023-09-10 12:01:07 -0700
committercolin <colin@cicadas.surf>2023-09-10 12:01:07 -0700
commit1504c36d166a81de08d93d8a5a85e4c36467f7b1 (patch)
treea9930f25f6c6d8df4efbbab77ccafa88b8ca0b22 /argot.lisp
parentb1d927635d4a15d4904080bc9738799fb4873fff (diff)
Added custom literals comparator for grammarsHEADmain
Diffstat (limited to 'argot.lisp')
-rw-r--r--argot.lisp9
1 files changed, 7 insertions, 2 deletions
diff --git a/argot.lisp b/argot.lisp
index 8ab90ba..aebe3d6 100644
--- a/argot.lisp
+++ b/argot.lisp
@@ -81,7 +81,10 @@ and it returns VAR in that case."
(symbolp (second s))
(endp (cddr s)))))
-(defmacro deflanguage (name (&key (documentation "")) &body ruledefs)
+(defmacro deflanguage (name (&key
+ (documentation "")
+ literals=)
+ &body ruledefs)
(let ((bindings-var (gensym "BINDINGS")))
(labels ((collect-let-bindings (lhs vars)
"Create let-bindings forms for the body of the :action."
@@ -152,7 +155,9 @@ and it returns VAR in that case."
(setf (get ',name 'argot::grammar-property)
(make-instance 'grammar
:documentation ,documentation
- :start-rule ',(first (first ruledefs))))
+ :start-rule ',(first (first ruledefs))
+ ,@(when literals=
+ `(:literal-comparator ,literals=))))
,@rule-adder-forms
(defmacro ,name (&body tokens)