X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/239fa5bd3dff0b38b0cebdd3438311f21c24ba4f..9ec578d9fe450b7e7f9030dc9d930185593aa991:/src/c-types-parse.lisp diff --git a/src/c-types-parse.lisp b/src/c-types-parse.lisp index e3ac625..4a8e1d7 100644 --- a/src/c-types-parse.lisp +++ b/src/c-types-parse.lisp @@ -290,7 +290,7 @@ ;;; `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 @@ -299,16 +299,16 @@ 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))))) @@ -362,20 +362,20 @@ (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 `)' @@ -408,7 +408,7 @@ (parse (seq ((value (expr (:nestedp nestedp) ;; An actual operand. - (centre) + (kernel) ;; Binary operators. There aren't any. nil