X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/e0808c472145fc81e52898bc9ac289e10c4f4f41..3e166443f7ed632f0a8b3d0e680c2afcc265d56f:/src/pset-parse.lisp diff --git a/src/pset-parse.lisp b/src/pset-parse.lisp index 6b91696..b3b1d8c 100644 --- a/src/pset-parse.lisp +++ b/src/pset-parse.lisp @@ -83,7 +83,7 @@ term: factor | term `*' factor | term `/' factor factor: primary | `+' factor | `-' factor primary: int | id | string | `(' expression `)' | `{' fragment `}' - | `?' lisp-expression + | `<' declspec+ declarator[empty] `>' | `?' lisp-expression Only operators for dealing with integers are provided." (with-parser-context (token-scanner-context :scanner scanner) @@ -100,13 +100,25 @@ (sexp (read stream t))) (scanner-step scanner) (multiple-value-bind (type value) - (decode-property sexp) + (restart-case (decode-property (eval sexp)) + (continue () (values :invalid nil))) (values (cons type value) t t)))) (#\{ (values (cons :fragment (parse-delimited-fragment scanner #\{ #\})) t t)) + (#\< + (parse (seq (#\< + (ds (parse-c-type scanner)) + (dc (parse-declarator + scanner ds + :kernel (lambda () + (values nil t nil)) + :abstractp t)) + #\>) + (values (cons :type (car dc)) + t t)))) (t (values (list :int :id :char :string #\?) nil nil))))) @@ -122,6 +134,7 @@ ;;;-------------------------------------------------------------------------- ;;; Parsing property sets. +(export 'parse-property) (defun parse-property (scanner pset) "Parse a single property using the SCANNER; add it to the PSET." ;; property ::= id `=' expression