;;; `parse-declarator' will be of this form.
(export 'parse-declarator)
-(defun parse-declarator (scanner base-type &key centre abstractp)
+(defun parse-declarator (scanner base-type &key kernel abstractp)
"Parse a C declarator, returning a pair (C-TYPE . NAME).
The SCANNER is a token scanner to read from. The BASE-TYPE is the type
The result contains both the resulting constructed C-TYPE (with any
qualifiers etc. as necessary), and the name from the middle of the
- declarator. The name is parsed using the CENTRE parser provided, and
+ declarator. The name is parsed using the KERNEL parser provided, and
defaults to matching a simple identifier `:id'. This might, e.g., be
(? :id) to parse an `abstract declarator' which has optional names.
- There's an annoying ambiguity in the syntax, if an empty CENTRE is
+ There's an annoying ambiguity in the syntax, if an empty KERNEL is
permitted. In this case, you must ensure that ABSTRACTP is true so that
the appropriate heuristic can be applied. As a convenience, if ABSTRACTP
- is true then `(? :id)' is used as the default CENTRE."
+ is true then `(? :id)' is used as the default KERNEL."
(with-parser-context (token-scanner-context :scanner scanner)
- (let ((centre-parser (cond (centre centre)
+ (let ((kernel-parser (cond (kernel kernel)
(abstractp (parser () (? :id)))
(t (parser () :id)))))
(values t t nil))))
(lparen #\))))))
- (centre ()
- (parse (seq ((name (funcall centre-parser)))
+ (kernel ()
+ (parse (seq ((name (funcall kernel-parser)))
(cons #'identity name))))
(argument-list ()
;; [ argument [ `,' argument ]* ]
- (parse (list ()
- (seq ((base-type (parse-c-type scanner))
- (dtor (parse-declarator scanner
- base-type
- :abstractp t)))
- (make-argument (cdr dtor) (car dtor)))
- #\,)))
+ (parse (list (:min 0)
+ (seq ((base-type (parse-c-type scanner))
+ (dtor (parse-declarator scanner
+ base-type
+ :abstractp t)))
+ (make-argument (cdr dtor) (car dtor)))
+ #\,)))
(postfix-lparen ()
;; Postfix: `(' argument-list `)'
(parse (seq ((value (expr (:nestedp nestedp)
;; An actual operand.
- (centre)
+ (kernel)
;; Binary operators. There aren't any.
nil