-
Notifications
You must be signed in to change notification settings - Fork 395
Open
Description
Currently the parser does not support new-line separation for message constant field due to that only check for:
self.tokenizer.next_symbol_if_in(&[',', ';'])?;
Additionally, extra separator without field definition will also give an error.
Test data:
option (blabla) = {
foo: bar
baz: bur
boo: biz
};
option (blabla) = {
foo: bar,
baz: bur,
boo: biz,
};
rust-protobuf/protobuf-parse/src/pure/parser.rs
Lines 381 to 390 in a542121
| // Consume the comma or semicolon if present. Commas and semicolons | |
| // between message fields are optional, all these are valid: | |
| // | |
| // {foo: 1,bar: 2,baz: 3,} | |
| // {foo: 1;bar: 2;baz: 3;} | |
| // {foo: 1 bar: 2 baz: 3} | |
| // {foo: 1,bar: 2;baz: 3} | |
| // {foo: 1,bar: 2 baz: 3} | |
| // | |
| self.tokenizer.next_symbol_if_in(&[',', ';'])?; |
Error:
Caused by:
0: error in `<stripped>.proto`: at <stripped>:3: While parsing message constant, expecting char `}`
1: at <stripped>:3: While parsing message constant, expecting char `}`
2: While parsing message constant, expecting char `}`
Metadata
Metadata
Assignees
Labels
No labels