;*/
function_definition
- : IDENTIFIER IDENTIFIER '(' optional_parameter_definitions ')' '{' optional_statements '}' {
+ : type IDENTIFIER '(' optional_parameter_definitions ')' '{' optional_statements '}' {
$$ = sltNodeMakeFunctionDefinition($1, $2, $4, $7);
}
;
;
parameter_definition
- : IDENTIFIER IDENTIFIER {
+ : type IDENTIFIER {
$$ = sltNodeMakeFunctionParameterDefinition($1, $2);
}
;
;*/
variable_definition
- : IDENTIFIER IDENTIFIER {
+ : type IDENTIFIER {
$$ = sltNodeMakeVariableDefinition($1, $2, NULL);
}
- | IDENTIFIER IDENTIFIER '=' expression {
+ | type IDENTIFIER '=' expression {
$$ = sltNodeMakeVariableDefinition($1, $2, $4);
}
;
+type
+ : IDENTIFIER {
+ $$ = $1;//sltNodeMakeTypeDefinition($1, 1);
+ }
+ | '[' type ':' INT ']' {
+ $$ = $2;//sltNodeMakeTypeDefinition($1, $2);
+ }
+ ;
+
optional_statements
: /* nothing */ {
$$ = NULL;
$$ = sltNodeMakeFunctionCall($1, $3);
}
| postfix_expression '.' IDENTIFIER {
- $$ = sltNodeMakeTypeAccess($1, $3);
+ $$ = sltNodeMakeMemberAccess($1, $3);
}
/*| postfix_expression postfix_unary_operator {
$$ = sltNodeMakeUnaryOperation($1, $2);