Skip to content
Permalink
Browse files
fix: properly parse empty messages in options (#1429)
* Properly parse empty messages in options

* Add missing semicolon in test
  • Loading branch information
murgatroid99 committed Jun 17, 2020
1 parent ad3cffd commit 7fbc79f11d89b263dafc8f332ccba59a8d181fca
Showing with 4 additions and 2 deletions.
  1. +2 −2 src/parse.js
  2. +2 −0 tests/data/uncommon.proto
@@ -555,7 +555,7 @@ function parse(source, root, options) {

function parseOptionValue(parent, name) {
if (skip("{", true)) { // { a: "foo" b { c: "bar" } }
do {
while (!skip("}", true)) {
/* istanbul ignore if */
if (!nameRe.test(token = next()))
throw illegal(token, "name");
@@ -570,7 +570,7 @@ function parse(source, root, options) {
setOption(parent, name + "." + token, readValue(true));
}
skip(",", true);
} while (!skip("}", true));
}
} else
setOption(parent, name, readValue(true));
// Does not enforce a delimiter to be universal
@@ -31,6 +31,8 @@ message Test2 {

map<uint64,Test> longmap = 10;

int32 optionTest = 11 [(my_options) = { a: "foo" b {} }];

/** pre */
oneof kind;
oneof kind2; /// post

0 comments on commit 7fbc79f

Please sign in to comment.