Closed ltcmelo closed 2 years ago
This article illustrates the syntax of a function in K&R C.
Add the syntax — follow the guidance from this wiki page.
ExtKR_ParameterDeclarationSyntax
ParameterDeclarationSyntax
typedef SyntaxNodePlainList<ExtKR_ParameterDeclarationSyntax*> ExtKR_ParameterDeclarationListSyntax;
FunctionDefinitionSyntax
Parse the syntax
Parser::parseDeclarationOrFunctionDefinition_AtFollowOfSpecifiers
default
Backtracker BT(this);
Parser::parseParameterDeclarationList
parseParameterDeclaration
BT.backtrack();
BT.discard();
Test the syntax
TestParser::case0280' to
This was implemented in https://github.com/ltcmelo/psychec/pull/84
Implement the parse of parameters in K&R style functions
This article illustrates the syntax of a function in K&R C.
Add the syntax — follow the guidance from this wiki page.
ExtKR_ParameterDeclarationSyntax
(similar toParameterDeclarationSyntax
but with a semicolon token).typedef SyntaxNodePlainList<ExtKR_ParameterDeclarationSyntax*> ExtKR_ParameterDeclarationListSyntax;
.FunctionDefinitionSyntax
.Parse the syntax
Parser::parseDeclarationOrFunctionDefinition_AtFollowOfSpecifiers
at labeldefault
, after the parse of an initializer syntax.Backtracker BT(this);
(mind the non-K&R parameter functionsParser::parseParameterDeclarationList
andparseParameterDeclaration
).BT.backtrack();
orBT.discard();
Test the syntax
TestParser::case0280' to
TestParser::case0299'.