From 325c7032bf1c848e3317f65463c717b3301b4af7 Mon Sep 17 00:00:00 2001 From: Utz-Uwe Haus Date: Fri, 3 Oct 2008 23:46:02 +0200 Subject: [PATCH] Action-generating function in bootstrap code fixed. Now generates action code correctly, but does not generate action names containing context info anymore. --- pegparser-boot.lisp | 5 ++--- pegutils.lisp | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pegparser-boot.lisp b/pegparser-boot.lisp index 5bfa3a2..eade63e 100644 --- a/pegparser-boot.lisp +++ b/pegparser-boot.lisp @@ -89,7 +89,7 @@ (opossum::SEQ (|parse_bracketed-rule|) (LIST ':action NIL '|metapeg_action333|)) - (opossum::MATCH-STRING "!.") + (opossum::SEQ (opossum::MATCH-STRING "!") (|parse_expr|) (LIST ':action NIL @@ -192,8 +192,7 @@ (opossum::fix-escape-sequences (mapcar #'second action-sans-{)) 'string)) - (ctx (fourth (fourth data))) - (action-name (opossum::make-action-name :ctx ctx))) + (action-name (opossum::make-action-name))) (opossum::store-action opossum:*context* `(,action-name ,action-code)) `(list ':action nil ',action-name))) diff --git a/pegutils.lisp b/pegutils.lisp index 4171af8..e9a9382 100644 --- a/pegutils.lisp +++ b/pegutils.lisp @@ -134,7 +134,7 @@ (car (action-counter *context*)) (start-index ctx) (end-index ctx)) - (format nil "opossum-action-~D-~D~D" + (format nil "opossum-action-~D" (car (action-counter *context*)))) )) (intern aname (dst-package *context*)))) @@ -481,7 +481,7 @@ DST-PACKAGE will contain the 3 functions PARSE-STRING, PARSE-FILE and PARSE-STRE :when sym ;; the final action is named NIL because we push a ;; NIL ahead of us in store-actions :do (when *trace* (format *trace-output* "Inserting defun for ~A~%" sym)) - :and :do (format s "~%(defun ~S (data)~% (declare (ignorable data))~% ~A)~%" + :and :do (format s "~%(defun ~S (data)~% (declare (ignorable data) (type list data))~% ~A)~%" sym (cleanup-action-code code)))))))) (defun generate-parser-package (grammarfile &key (dst-package (make-package (gensym "opossum-parser-"))) -- 2.11.4.GIT