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

Incorrect parsing of multiple declarators in a single declaration #85

Open
d3dave opened this issue Apr 29, 2024 · 1 comment
Open

Incorrect parsing of multiple declarators in a single declaration #85

d3dave opened this issue Apr 29, 2024 · 1 comment

Comments

@d3dave
Copy link
Contributor

d3dave commented Apr 29, 2024

The definition struct X { int x : 16, y : 16; } gets parsed incorrectly into the following tokens:

[<Token.STRUCT value='struct'>,
 <Token.IDENTIFIER value='X'>,
 <Token.BLOCK value='{'>,
 <Token.IDENTIFIER value='int'>,
 <Token.IDENTIFIER value='x'>,
 <Token.NAME value='y : 16'>,
 <Token.EOL value=';'>,
 <Token.BLOCK value='}'>]

As you can see, x : 16 is mistakenly truncated and treated as an identifier instead of a name like y : 16.

@d3dave d3dave changed the title Incorrect parsing of multiple bitfield declarators in a single declaration Incorrect parsing of multiple declarators in a single declaration Apr 29, 2024
@Schamper
Copy link
Member

Schamper commented May 6, 2024

This is unfortunately a known limitation of the current parser. Would love to support this since I also regularly run into this issue. Not sure how feasible it is with the current parser though. Ideally we get a better parser with perhaps a proper AST down the line.

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

2 participants