;;;----- 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
;;; 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.
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)
(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)))))
(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)))))