From ea4843d5bc48fb15f209a6ccd32db4b4ffab0eb7 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Thu, 26 May 2016 09:26:09 +0100 Subject: [PATCH] src/module-parse.lisp: Improve error recovery for `code' items. Organization: Straylight/Edgeware From: Mark Wooding --- src/module-parse.lisp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/module-parse.lisp b/src/module-parse.lisp index cb3fcb2..142992e 100644 --- a/src/module-parse.lisp +++ b/src/module-parse.lisp @@ -66,23 +66,28 @@ (define-pluggable-parser module code (scanner pset) (seq (#\( (names (list (:min 1) (kw))) #\)) names))))) (parse (seq ("code" - (reason (kw)) - #\: - (name (item)) + (reason (must (kw))) + (nil (must #\:)) + (name (must (item))) (constraints (? (seq (#\[ - (constraints (list (:min 1) - (list (:min 1) - (item)) - #\,)) + (constraints + (list () + (list (:min 1) + (error (:ignore-unconsumed t) + (item) + (skip-until () + :id #\( #\, #\]))) + #\,)) #\]) constraints))) (fragment (parse-delimited-fragment scanner #\{ #\}))) - (add-to-module *module* - (make-instance 'code-fragment-item - :fragment fragment - :constraints constraints - :reason reason - :name name))))))) + (when name + (add-to-module *module* + (make-instance 'code-fragment-item + :fragment fragment + :constraints constraints + :reason reason + :name name)))))))) ;;; External files. -- [mdw]