From 16e75749e1de9f27c952380fda8a6dc277da57c0 Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Wed, 31 Jan 2024 17:49:28 +0800 Subject: [PATCH] refactor(chapi-ast-c): modify singleLineMacroDeclaration Refactor singleLineMacroDeclaration in C.g4 to improve readability and maintainability. Removed unnecessary code and added optional parameters for better flexibility. --- chapi-ast-c/src/main/antlr/C.g4 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chapi-ast-c/src/main/antlr/C.g4 b/chapi-ast-c/src/main/antlr/C.g4 index 03626900..8de6a1c7 100644 --- a/chapi-ast-c/src/main/antlr/C.g4 +++ b/chapi-ast-c/src/main/antlr/C.g4 @@ -475,10 +475,10 @@ macroStatement singleLineMacroDeclaration : include (StringLiteral | Identifier | ('<' includeIdentifier '>' )) #includeDeclaration - | macroKeywords Identifier? expression* '#' macroKeywords identifierList? #ifdefDeclaration // #define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } - | macroKeywords #defineDeclaration - | 'define' Identifier structOrUnionSpecifier #macroFunctionDeclaration + | macroKeywords Identifier? (structOrUnionSpecifier | expression)* + ('#' macroKeywords)? identifierList? #ifdefDeclaration +// | macroKeywords #defineDeclaration | '#'? Identifier #macroCastDeclaration // | 'define' expression* '#' 'undef' identifierList? #macroExpansionDeclaration // | macroKeywords expression* '#' macroKeywords identifierList? #macroExpansionDeclaration2