Skip to content

Commit

Permalink
feat(c): refactor support for macro expansion #24
Browse files Browse the repository at this point in the history
Add support for macro expansion in the C grammar by introducing a new rule `macroExpandDeclaration` in the `C.g4` file. This allows for more flexible macro usage in the code.
  • Loading branch information
phodal committed Jan 31, 2024
1 parent eb3ee99 commit 924fcdb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion chapi-ast-c/src/main/antlr/C.g4
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,8 @@ macroStatement

singleLineMacroDeclaration
: '#' include (StringLiteral | ('<' includeIdentifier '>' )) #includeDeclaration
| '#' macroKeywords expression* #defineDeclaration
| '#' macroKeywords expression* '#' macroKeywords identifierList? #macroExpansionDeclaration
| '#' macroKeywords #defineDeclaration
| '#' '#'? Identifier #macroCastDeclaration
;

Expand Down

0 comments on commit 924fcdb

Please # to comment.