From b4a2b5d965de89f09018a34b86dc2603a6b7cece Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Wed, 16 Dec 2015 05:49:38 +0000 Subject: [PATCH] src/c-types-parse.lisp (parse-declarator): Explain how it works. Organization: Straylight/Edgeware From: Mark Wooding It's a little confusing, even to me. --- src/c-types-parse.lisp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/c-types-parse.lisp b/src/c-types-parse.lisp index b9a53db..c797010 100644 --- a/src/c-types-parse.lisp +++ b/src/c-types-parse.lisp @@ -319,6 +319,16 @@ (defun parse-declarator (scanner base-type &key kernel abstractp) 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 KERNEL." + + ;; This is a bit confusing. This is a strangely-shaped operator grammer, + ;; which wouldn't be so bad, but the `values' being operated on are pairs + ;; of the form (FUNC . NAME). The NAME is whatever the KERNEL parser + ;; produces as its result, and will be passed out unchanged. The FUNC is a + ;; type-constructor function which will be eventually be applied to the + ;; input BASE-TYPE, but we can't calculate the actual result as we go along + ;; because of the rather annoying inside-out nature of the declarator + ;; syntax. + (with-parser-context (token-scanner-context :scanner scanner) (let ((kernel-parser (cond (kernel kernel) (abstractp (parser () (? :id))) -- [mdw]