diff options
Diffstat (limited to 'Lisp')
-rw-r--r-- | Lisp/tests.lisp | 8 | ||||
-rw-r--r-- | Lisp/type-conversion.lisp | 27 |
2 files changed, 29 insertions, 6 deletions
diff --git a/Lisp/tests.lisp b/Lisp/tests.lisp index 7d6ddb9..1404f86 100644 --- a/Lisp/tests.lisp +++ b/Lisp/tests.lisp @@ -5,7 +5,7 @@ (:shadowing-import-from #:objcl #:struct #:union #:pointer #:oneway #:out #:in #:inout #:const #:parse-typespec #:objc-class - #:bit-field)) + #:bit-field #:opaque)) (in-package #:mulk.objective-cl.tests) @@ -123,7 +123,11 @@ (:string ()) (struct () "Untermulk" (struct () "Unteruntermulk")) - (:int ())))))) + (:int ())))) + ((ensure-same (parse-typespec "^^{OpaqueStruct}") + '(pointer () + (pointer () + (struct (opaque) "OpaqueStruct"))))))) (deftestsuite data-coercion (objective-cl) diff --git a/Lisp/type-conversion.lisp b/Lisp/type-conversion.lisp index 05bb08e..715e906 100644 --- a/Lisp/type-conversion.lisp +++ b/Lisp/type-conversion.lisp @@ -102,14 +102,33 @@ Returns: (VALUES typespec byte-position string-position)" (push qualifier qualifiers)))) (values (case init-char ((#\{ #\() - (let ((name-end (position #\= typestring :start start))) + (let* ((=-token (position #\= typestring :start start)) + (name-end (or =-token + ;; An opaque struct whose contents + ;; we don't know. + (position (ecase init-char + (#\{ #\}) + (#\( #\))) + typestring + :start start) + (error "Premature end of file in~ + typespec: ~A." + typestring))) + (struct-name (subseq typestring + (1+ string-position) + name-end))) (list* (ecase init-char (#\{ 'struct) (#\( 'union)) - qualifiers - (subseq typestring (1+ start) name-end) + (if =-token + qualifiers + (cons 'opaque qualifiers)) + struct-name (progn - (setq string-position (1+ name-end)) ; skip #\= + (setq string-position + (if =-token + (1+ name-end) ; skip #\= + name-end)) (loop until (char= (char typestring string-position) (ecase init-char (#\{ #\}) |