Skip to content

Commit

Permalink
fix(chapi-ast-c): fix macro expansion declaration in C.g4 #24
Browse files Browse the repository at this point in the history
The macro expansion declaration in C.g4 was not correctly defined. This commit fixes the issue by updating the grammar rules.
  • Loading branch information
phodal committed Jan 31, 2024
1 parent 56c876f commit 84d5421
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chapi-ast-c/src/main/antlr/C.g4
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ primaryExpression
| '__builtin_offsetof' '(' typeName ',' unaryExpression ')'
// for macro support
| typeQualifier? (typeKeywords | Identifier | '==' | '!=') (Identifier | typeKeywords)* pointer?
| (directDeclarator | StringLiteral)+
| StringLiteral? (directDeclarator | StringLiteral)+
| Ellipsis
;

Expand Down Expand Up @@ -471,9 +471,9 @@ macroStatement

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

macroKeywords
Expand Down

0 comments on commit 84d5421

Please # to comment.