doc/list-exports.lisp: Better pretty formatting for keywords.
[sod] / src / pset-parse.lisp
index be7984e..11b4003 100644 (file)
@@ -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)
                            (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)))))