Skip to content

Commit c05c58f

Browse files
drigzdcodeIO
authored andcommitted
Fixed: Ignore optional commas in aggregate options (#999)
1 parent 07c5d59 commit c05c58f

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

src/parse.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@ function parse(source, root, options) {
567567
else
568568
setOption(parent, name + "." + token, readValue(true));
569569
}
570+
skip(",", true);
570571
} while (!skip("}", true));
571572
} else
572573
setOption(parent, name, readValue(true));

tests/comp_options-textformat.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ extend google.protobuf.FieldOptions {\
1414
message Test {\
1515
string value = 1 [(my_options) = { a: \"foo\" b: \"bar\" }];\
1616
string value2 = 2 [(my_options) = { a: \"foo\" b { c: \"bar\" } }];\
17+
string value3 = 3 [(my_options) = { a: \"foo\", b: \"bar\" }];\
1718
}";
1819

1920
tape.test("options in textformat", function(test) {
2021
var root = protobuf.parse(proto).root;
2122
var Test = root.lookup("Test");
2223
test.same(Test.fields.value.options, { "(my_options).a": "foo", "(my_options).b": "bar" }, "should parse correctly");
2324
test.same(Test.fields.value2.options, { "(my_options).a": "foo", "(my_options).b.c": "bar" }, "should parse correctly when nested");
25+
test.same(Test.fields.value3.options, { "(my_options).a": "foo", "(my_options).b": "bar" }, "should parse correctly when comma-separated");
2426
test.end();
2527
});

0 commit comments

Comments
 (0)