From 6ac9510ced970e660689f05191d8d720b6472f6a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alejandro=20R=20Sede=C3=B1o?= Date: Wed, 20 Feb 2013 12:54:53 -0500 Subject: [PATCH] parser.lisp: tweak method parsing Don't assume that returning no options meant there was no body in the method declaration. An empty body may have been there instead. Distinguish that scenario with a second return value from PARSE-PROTO-METHOD-OPTIONS and use that value in PARSE-PROTO-METHOD determine whether or not to look for a semicolon. --- parser.lisp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/parser.lisp b/parser.lisp index 30924c5..d80387f 100644 --- a/parser.lisp +++ b/parser.lisp @@ -771,8 +771,9 @@ (out (prog2 (expect-char stream #\( () "service") (parse-token stream) (expect-char stream #\) () "service"))) - (opts (let ((opts (parse-proto-method-options stream))) - (when (or (null opts) (eql (peek-char nil stream nil) #\;)) + (opts (multiple-value-bind (opts bodyp) + (parse-proto-method-options stream) + (when (or (not bodyp) (eql (peek-char nil stream nil) #\;)) (expect-char stream #\; () "service")) (maybe-skip-comments stream) opts)) @@ -836,7 +837,8 @@ (defun parse-proto-method-options (stream) "Parse any options in a Protobufs method from 'stream'. - Returns a list of 'protobuf-option' objects." + Returns a list of 'protobuf-option' objects. + If a body was parsed, returns a second value T." (when (eql (peek-char nil stream nil) #\{) (expect-char stream #\{ () "service") (maybe-skip-comments stream) @@ -849,4 +851,4 @@ (collect-option (parse-proto-option stream nil))) (expect-char stream #\} '(#\;) "service") (maybe-skip-comments stream) - options))) + (values options t))) -- 2.45.2