Changeset View
Changeset View
Standalone View
Standalone View
support/xhpast/parser.y
Show First 20 Lines • Show All 1,079 Lines • ▼ Show 20 Lines | | T_CALLABLE { | ||||
$$ = NTYPE($1, n_TYPE_NAME); | $$ = NTYPE($1, n_TYPE_NAME); | ||||
} | } | ||||
; | ; | ||||
return_type: | return_type: | ||||
%empty { | %empty { | ||||
$$ = NNEW(n_EMPTY); | $$ = NNEW(n_EMPTY); | ||||
} | } | ||||
| ':' '?' type { | |||||
$$ = NNEW(n_DECLARATION_RETURN); | |||||
joshuaspence: I was trying to avoid adding a new node type (which is technically a breaking API change), but… | |||||
Not Done Inline ActionsThis technically allows ?void, which is a fatal error... but I'm not sure it's worth special casing that here. joshuaspence: This technically allows `?void`, which is a fatal error... but I'm not sure it's worth special… | |||||
Not Done Inline ActionsMaybe we should add a new T_VOID token and exclude void from type. wjiang: Maybe we should add a new `T_VOID` token and exclude `void` from `type`. | |||||
Not Done Inline ActionsYeah, that sounds reasonable. I'll do that in a separate diff though. joshuaspence: Yeah, that sounds reasonable. I'll do that in a separate diff though. | |||||
$$->appendChild($2); | |||||
$$->appendChild($3); | |||||
} | |||||
| ':' type { | | ':' type { | ||||
$$ = $2; | $$ = NNEW(n_DECLARATION_RETURN); | ||||
$$->appendChild(NNEW(n_EMPTY)); | |||||
$$->appendChild($2); | |||||
} | } | ||||
; | ; | ||||
function_call_parameter_list: | function_call_parameter_list: | ||||
non_empty_function_call_parameter_list | non_empty_function_call_parameter_list | ||||
| %empty { | | %empty { | ||||
$$ = NNEW(n_CALL_PARAMETER_LIST); | $$ = NNEW(n_CALL_PARAMETER_LIST); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,669 Lines • Show Last 20 Lines |
I was trying to avoid adding a new node type (which is technically a breaking API change), but it seems necessary to accommodate nullability.