X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/e0808c472145fc81e52898bc9ac289e10c4f4f41..4fd69126f8b52945e0a572d1cf4a347468c1ced5:/src/module-parse.lisp diff --git a/src/module-parse.lisp b/src/module-parse.lisp index d9bde30..e33b6d3 100644 --- a/src/module-parse.lisp +++ b/src/module-parse.lisp @@ -48,21 +48,28 @@ ;;; Fragments. (define-pluggable-parser module code (scanner pset) - ;; `code' id `:' id [constraints] `{' c-fragment `}' + ;; `code' id `:' item-name [constraints] `{' c-fragment `}' ;; ;; constrains ::= `[' constraint-list `]' - ;; constraint ::= id+ + ;; constraint ::= item-name+ + ;; item-name ::= id | `(' id+ `)' (declare (ignore pset)) (with-parser-context (token-scanner-context :scanner scanner) - (flet ((kw () - (parse (seq ((kw :id)) (intern (string-upcase kw) 'keyword))))) + (labels ((kw () + (parse (seq ((kw :id)) + (intern (frob-identifier kw) 'keyword)))) + (item () + (parse (or (kw) + (seq (#\( (names (list (:min 1) (kw))) #\)) + names))))) (parse (seq ("code" (reason (kw)) #\: - (name (kw)) + (name (item)) (constraints (? (seq (#\[ (constraints (list (:min 1) - (list (:min 1) (kw)) + (list (:min 1) + (item)) #\,)) #\]) constraints))) @@ -148,6 +155,29 @@ (cerror* "Error loading Lisp file ~S: ~A" path error))))))))))) +;;; Setting properties. + +(define-pluggable-parser module set (scanner pset) + ;; `set' property-list `;' + (with-parser-context (token-scanner-context :scanner scanner) + (parse (and "set" + (lisp (let ((module-pset (module-pset *module*))) + (when pset + (pset-map (lambda (prop) + (add-property module-pset + (p-name prop) + (p-value prop) + :type (p-type prop) + :location (p-location prop)) + (setf (p-seenp prop) t)) + pset)) + (parse (skip-many (:min 0) + (error (:ignore-unconsumed t) + (parse-property scanner module-pset) + (skip-until (:keep-end t) #\, #\;)) + #\,)))) + #\;)))) + ;;; Lisp escape. (define-pluggable-parser module lisp (scanner pset) @@ -347,6 +377,7 @@ (peek (seq ((ds (parse-c-type scanner)) (dc (parse-maybe-dotted-declarator ds)) + (nil (commit)) (nil (class-item-dispatch sub-pset ds (car dc)