Fix bug for macro expansion in binary expression evaluation#57
Fix bug for macro expansion in binary expression evaluation#5706wj wants to merge 2 commits intoShaderFrog:mainfrom
Conversation
|
Ah yikes, I didn't know this was a valid preprocessor case. Thank you for the fix and the tests. I think a different strategy is needed here unfortunately. The grammar might need to instead be updated to support parsing the right hand side of a This library will likely be run on raw user input (it is in the case of Shaderfrog), so the Or maybe a different strategy is needed entirely, like parse -> expand all macros -> reparse the new lexeme, to handle expanded preproecssor expressions, that are then properly picked up by the peg grammar. "Preprocessing Directives" begins on page 157 of this nightmare https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf which I need to read through more closely. I see there are other behaviors I missed like |
|
Ah yeah, in the grammar, the body of a define is not only a string. The peg grammar currently treats the body as simply a string. The doc linked above has (this is condensed from a few different pages): I included your commit in #58 (wip) and removed the eval so you're still in the commit history. I think this new PR is a better approach - treat the body of a define as token sequence, not a single string. I wasn't sure if I could push to this PR so I went with opening a new one. |
No description provided.