diff options
Diffstat (limited to 'argot.lisp')
-rw-r--r-- | argot.lisp | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -217,16 +217,16 @@ any pattern fails the whole parse fails." (defun parse-rule (nonterminal) (if-let (rule (gethash nonterminal *grammar*)) - (try-parse (result) (parse-pattern (rule-pattern rule)) - (if (rule-action rule) - (succeed (funcall (rule-action rule))) - (succeed result))) + (let ((*bindings* nil)) + (try-parse (result) (parse-pattern (rule-pattern rule)) + (if (rule-action rule) + (succeed (funcall (rule-action rule) *bindings*)) + (succeed result)))) (fail))) (defun parse (grammar rule tokens) (let ((*position* 0) (*grammar* grammar) - (*tokens* tokens) - (*bindings* nil)) + (*tokens* tokens)) (parse-rule rule))) |