X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/1d8cc67a3f4ded443f5efc673a616883cbae9c50..6c3c2dd3e236da72ce43b923e4eeac7d33eb5cbd:/src/pset-parse.lisp diff --git a/src/pset-parse.lisp b/src/pset-parse.lisp index f81ce92..b3b1d8c 100644 --- a/src/pset-parse.lisp +++ b/src/pset-parse.lisp @@ -7,7 +7,7 @@ ;;;----- Licensing notice --------------------------------------------------- ;;; -;;; This file is part of the Sensble Object Design, an object system for C. +;;; This file is part of the Sensible Object Design, an object system for C. ;;; ;;; SOD is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by @@ -82,7 +82,8 @@ expression: term | expression `+' term | expression `-' term term: factor | term `*' factor | term `/' factor factor: primary | `+' factor | `-' factor - primary: int | id | string | `(' expression `)' | `?' lisp-expression + primary: int | id | string | `(' expression `)' | `{' fragment `}' + | `<' declspec+ declarator[empty] `>' | `?' lisp-expression Only operators for dealing with integers are provided." (with-parser-context (token-scanner-context :scanner scanner) @@ -99,8 +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))))) @@ -116,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