(with-parser-context (token-scanner-context :scanner scanner)
(parse (and "typename"
(skip-many ()
- (seq ((id :id))
- (if (gethash id *module-type-map*)
- (cerror* "Type `~A' already defined" id)
- (add-to-module *module*
- (make-instance 'type-item
- :name id))))
+ (error ()
+ (seq ((id :id))
+ (if (or (gethash id *module-type-map*)
+ (find-simple-c-type id))
+ (cerror* "Type `~A' already defined" id)
+ (add-to-module *module*
+ (make-instance 'type-item
+ :name id))))
+ (skip-until () #\, #\;))
#\,)
- #\;))))
+ (must #\;)))))
;;; Fragments.
(seq (#\( (names (list (:min 1) (kw))) #\))
names)))))
(parse (seq ("code"
- (reason (kw))
- #\:
- (name (item))
+ (reason (must (kw)))
+ (nil (must #\:))
+ (name (must (item)))
(constraints (? (seq (#\[
- (constraints (list (:min 1)
- (list (:min 1)
- (item))
- #\,))
+ (constraints
+ (list ()
+ (list (:min 1)
+ (error (:ignore-unconsumed t)
+ (item)
+ (skip-until ()
+ :id #\( #\, #\])))
+ #\,))
#\])
constraints)))
(fragment (parse-delimited-fragment scanner #\{ #\})))
- (add-to-module *module*
- (make-instance 'code-fragment-item
- :fragment fragment
- :constraints constraints
- :reason reason
- :name name)))))))
+ (when name
+ (add-to-module *module*
+ (make-instance 'code-fragment-item
+ :fragment fragment
+ :constraints constraints
+ :reason reason
+ :name name))))))))
;;; External files.
:location (p-location prop))
(setf (p-seenp prop) t))
pset))
- (parse (skip-many (:min 0)
+ (parse (skip-many (:min (if pset 0 1))
(error (:ignore-unconsumed t)
(parse-property scanner module-pset)
(skip-until () #\, #\;))