diff --git a/chapi-ast-c/src/main/antlr/C.g4 b/chapi-ast-c/src/main/antlr/C.g4 index 6524a71e..07317e8a 100644 --- a/chapi-ast-c/src/main/antlr/C.g4 +++ b/chapi-ast-c/src/main/antlr/C.g4 @@ -40,10 +40,14 @@ compilationUnit oneLineMacroDeclaration : '#' include (StringLiteral | ('<' includeIdentifier '>' )) #includeDeclaration | '#' 'define' expression* #defineDeclaration - | '#'( 'if' | 'undef' | 'else' | 'pragma' | 'endif' ) expression* #conditionalDeclaration + | '#' macroKeywords expression* #conditionalDeclaration | Identifier postixCall? compoundStatement? #macroCall ; +macroKeywords + : 'if' | 'undef' | 'else' | 'pragma' | 'endif' | 'ifdef' + ; + MultiLineMacro : '#' (~[\n]*? '\\' '\r'? '\n')+ ~ [\n]+ -> channel (HIDDEN) ;