new type declaration style
parent
a2e5cb434b
commit
b344635c8d
16
wraith.y
16
wraith.y
|
@ -166,13 +166,13 @@ Expression : PrimaryExpression
|
|||
| BinaryExpression
|
||||
;
|
||||
|
||||
VariableDeclaration : Type Identifier
|
||||
VariableDeclaration : Identifier COLON Type
|
||||
{
|
||||
$$ = MakeDeclarationNode($1, $2);
|
||||
$$ = MakeDeclarationNode($3, $1);
|
||||
}
|
||||
| Identifier Identifier
|
||||
| Identifier COLON Identifier
|
||||
{
|
||||
$$ = MakeDeclarationNode(MakeCustomTypeNode($1), $2);
|
||||
$$ = MakeDeclarationNode(MakeCustomTypeNode($3), $1);
|
||||
}
|
||||
|
||||
AssignmentStatement : VariableDeclaration EQUAL Expression
|
||||
|
@ -265,24 +265,24 @@ Body : LEFT_BRACE Statements RIGHT_BRACE
|
|||
PopStackFrame(stack);
|
||||
}
|
||||
|
||||
FunctionSignature : Type Identifier LEFT_PAREN SignatureArguments RIGHT_PAREN
|
||||
FunctionSignature : Identifier LEFT_PAREN SignatureArguments RIGHT_PAREN COLON Type
|
||||
{
|
||||
Node **declarations;
|
||||
uint32_t declarationCount;
|
||||
|
||||
declarations = GetNodes(stack, &declarationCount);
|
||||
$$ = MakeFunctionSignatureNode($2, $1, MakeFunctionSignatureArgumentsNode(declarations, declarationCount), MakeFunctionModifiersNode(NULL, 0));
|
||||
$$ = MakeFunctionSignatureNode($1, $6, MakeFunctionSignatureArgumentsNode(declarations, declarationCount), MakeFunctionModifiersNode(NULL, 0));
|
||||
|
||||
PopStackFrame(stack);
|
||||
}
|
||||
| STATIC Type Identifier LEFT_PAREN SignatureArguments RIGHT_PAREN
|
||||
| STATIC Identifier LEFT_PAREN SignatureArguments RIGHT_PAREN COLON Type
|
||||
{
|
||||
Node **declarations;
|
||||
uint32_t declarationCount;
|
||||
Node *modifier = MakeStaticNode();
|
||||
|
||||
declarations = GetNodes(stack, &declarationCount);
|
||||
$$ = MakeFunctionSignatureNode($3, $2, MakeFunctionSignatureArgumentsNode(declarations, declarationCount), MakeFunctionModifiersNode(&modifier, 1));
|
||||
$$ = MakeFunctionSignatureNode($2, $7, MakeFunctionSignatureArgumentsNode(declarations, declarationCount), MakeFunctionModifiersNode(&modifier, 1));
|
||||
|
||||
PopStackFrame(stack);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue