Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-line support for message constant field separator #752

Open
ii64 opened this issue Jan 8, 2025 · 0 comments
Open

New-line support for message constant field separator #752

ii64 opened this issue Jan 8, 2025 · 0 comments

Comments

@ii64
Copy link

ii64 commented Jan 8, 2025

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,
};

// 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 `}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant