X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/blobdiff_plain/9ec578d9fe450b7e7f9030dc9d930185593aa991..0e7cdea08f8c635a46e66bd0a96bb6f12b907bbc:/src/module-parse.lisp?ds=sidebyside diff --git a/src/module-parse.lisp b/src/module-parse.lisp index df4ea27..d9bde30 100644 --- a/src/module-parse.lisp +++ b/src/module-parse.lisp @@ -7,7 +7,7 @@ ;;;----- Licensing notice --------------------------------------------------- ;;; -;;; This file is part of the Sensble Object Design, an object system for C. +;;; This file is part of the Sensible Object Design, an object system for C. ;;; ;;; SOD is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by @@ -167,6 +167,8 @@ (define-pluggable-parser module lisp (scanner pset) ;;;-------------------------------------------------------------------------- ;;; Class declarations. +(export 'class-item) + (defun parse-class-body (scanner pset name supers) ;; class-body ::= `{' class-item* `}' ;; @@ -197,9 +199,16 @@ (defun parse-class-body (scanner pset name supers) (parse-message-item (sub-pset type name) ;; message-item ::= ;; declspec+ declarator -!- (method-body | `;') - (make-sod-message class name type sub-pset scanner) - (parse (or #\; (parse-method-item sub-pset - type nick name)))) + ;; + ;; Don't allow a method-body here if the message takes a + ;; varargs list, because we don't have a name for the + ;; `va_list' parameter. + (let ((message (make-sod-message class name type + sub-pset scanner))) + (if (varargs-message-p message) + (parse #\;) + (parse (or #\; (parse-method-item sub-pset + type nick name)))))) (parse-method-item (sub-pset type sub-nick name) ;; method-item ::= @@ -335,13 +344,13 @@ (defun parse-class-body (scanner pset name supers) ;; (which might be dotted). So we parse that here and ;; dispatch based on what we find. (parse (or (plug class-item scanner class sub-pset) - ;(peek + (peek (seq ((ds (parse-c-type scanner)) (dc (parse-maybe-dotted-declarator ds)) (nil (class-item-dispatch sub-pset ds (car dc) - (cdr dc)))));) + (cdr dc)))))) (and "class" (parse-initializer-item sub-pset