Skip to content

Commit

Permalink
fix: properly parse empty messages in options (#1429)
Browse files Browse the repository at this point in the history
* Properly parse empty messages in options

* Add missing semicolon in test
  • Loading branch information
murgatroid99 authored Jun 17, 2020
1 parent ad3cffd commit 7fbc79f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/data/uncommon.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7fbc79f

Please sign in to comment.