X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/239fa5bd3dff0b38b0cebdd3438311f21c24ba4f..ed00691544c3b6d4ad15b1c7ef975964ea72b0b6:/src/pset-parse.lisp diff --git a/src/pset-parse.lisp b/src/pset-parse.lisp index be7984e..11b4003 100644 --- a/src/pset-parse.lisp +++ b/src/pset-parse.lisp @@ -23,6 +23,8 @@ ;;; along with SOD; if not, write to the Free Software Foundation, ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +(in-package #:sod) + ;;;-------------------------------------------------------------------------- ;;; The expression parser. @@ -80,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 `}' + | `?' lisp-expression Only operators for dealing with integers are provided." (with-parser-context (token-scanner-context :scanner scanner) @@ -96,8 +99,14 @@ (let* ((stream (make-scanner-stream scanner)) (sexp (read stream t))) (scanner-step scanner) - (values (cons (property-type sexp) sexp) - t t))) + (multiple-value-bind (type value) + (decode-property sexp) + (values (cons type value) t t)))) + (#\{ + (values (cons :fragment + (parse-delimited-fragment scanner + #\{ #\})) + t t)) (t (values (list :int :id :char :string #\?) nil nil))))) @@ -127,12 +136,14 @@ (export 'parse-property-set) (defun parse-property-set (scanner) - "Parse an optional property set from the SCANNER and return it, or `nil'." + "Parse an optional property set from the SCANNER and return it." ;; property-set ::= [`[' property-list `]'] (with-parser-context (token-scanner-context :scanner scanner) (parse (? (seq (#\[ (pset (many (pset (make-property-set) pset) - (parse-property scanner pset) + (error () + (parse-property scanner pset) + (skip-until () #\, #\])) #\,)) #\]) pset)))))