X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;ds=sidebyside;f=parser.lisp;h=cdd093ff62035a33627491357b713a368d27a473;hb=def3034dec037482673061f6e84d3abe65fd5cea;hp=dd8a2931ef89d466d3b0574294dab9f38a525dba;hpb=d03727d014a68c6722befbc5a254fe3fce22a111;p=cl-protobufs.git diff --git a/parser.lisp b/parser.lisp index dd8a293..cdd093f 100644 --- a/parser.lisp +++ b/parser.lisp @@ -288,9 +288,10 @@ :start-pos start :end-pos end))) (defgeneric resolve-lisp-names (protobuf) - (:documentation "Second pass of schema parsing which recursively resolves protobuf type names to - lisp type names in all messages and services contained within 'protobuf'. No - return value.")) + (:documentation + "Second pass of schema parsing which recursively resolves Protobuf type names + to Lisp type names in all messages and services contained within 'protobuf'. + No return value.")) ;; The syntax for Protocol Buffers is so simple that it doesn't seem worth ;; writing a sophisticated parser @@ -349,8 +350,7 @@ (setq *protobuf-package* package))) (defmethod resolve-lisp-names ((schema protobuf-schema)) - "Recursively resolves protobuf type names to lisp type names in the messages and services in - 'schema'." + "Recursively resolves Protobuf type names to Lisp type names in the messages and services in 'schema'." (map () #'resolve-lisp-names (proto-messages schema)) (map () #'resolve-lisp-names (proto-services schema))) @@ -399,8 +399,8 @@ ((or (digit-char-p ch) (member ch '(#\- #\+ #\.))) (parse-number stream)) ((eql ch #\{) - ;;---bwagner: this is incorrect -- we need to find the field name in - ;; the locally-extended version of + ;;---bwagner: This is incorrect + ;; We need to find the field name in the locally-extended version of ;; google.protobuf.[File,Message,Field,Enum,EnumValue,Service,Method]Options ;; and get its type (let ((message (find-message (or protobuf *protobuf*) key))) @@ -522,8 +522,7 @@ token (file-position stream)))))))) (defmethod resolve-lisp-names ((message protobuf-message)) - "Recursively resolves protobuf type names to lisp type names in nested messages and fields of - 'message'." + "Recursively resolves protobuf type names to lisp type names in nested messages and fields of 'message'." (map () #'resolve-lisp-names (proto-messages message)) (map () #'resolve-lisp-names (proto-fields message))) @@ -535,7 +534,7 @@ (name (prog1 (parse-token stream) (expect-char stream #\{ () "extend") (maybe-skip-comments stream))) - ;;---bwagner: is 'extend' allowed to use a forward reference to a message? + ;;---bwagner: Is 'extend' allowed to use a forward reference to a message? (message (find-message protobuf name)) (extends (and message (make-instance 'protobuf-message @@ -637,8 +636,8 @@ (find-enum (proto-parent field) type))))) (unless (or ptype message) (error 'undefined-field-type - :type-name type - :field field)) + :type-name type + :field field)) (setf (proto-class field) (or ptype (proto-class message)))) nil) @@ -793,32 +792,32 @@ "Resolves input, output, and streams protobuf type names to lisp type names and sets `proto-input-type', `proto-output-type', and, if `proto-streams-name' is set, `proto-streams-type' on 'method'." - (let* ((input-name (proto-input-name method)) - (output-name (proto-output-name method)) + (let* ((input-name (proto-input-name method)) + (output-name (proto-output-name method)) (streams-name (proto-streams-name method)) (service (proto-parent method)) - (schema (proto-parent service)) - (input-message (find-message schema input-name)) - (output-message (find-message schema output-name)) + (schema (proto-parent service)) + (input-message (find-message schema input-name)) + (output-message (find-message schema output-name)) (streams-message (and streams-name - ;; this is supposed to be the fully-qualified name, but we don't - ;; require that + ;; This is supposed to be the fully-qualified name, + ;; but we don't require that (find-message schema streams-name)))) (unless input-message (error 'undefined-input-type - :type-name input-name - :method method)) + :type-name input-name + :method method)) (unless output-message (error 'undefined-output-type - :type-name output-name - :method method)) + :type-name output-name + :method method)) (setf (proto-input-type method) (proto-class input-message)) (setf (proto-output-type method) (proto-class output-message)) (when streams-name (unless streams-message (error 'undefined-stream-type - :type-name streams-name - :method method)) + :type-name streams-name + :method method)) (setf (proto-streams-type method) (proto-class streams-message)))) nil)