Parse-array/function-declarator
Parse an array or function declarator.
- Signature
(parse-array/function-declarator prev-dirdeclor prev-span parstate)
→
(mv erp dirdeclor span new-parstate)
- Arguments
- prev-dirdeclor — Guard (dirdeclorp prev-dirdeclor).
- prev-span — Guard (spanp prev-span).
- parstate — Guard (parstatep parstate).
- Returns
- dirdeclor — Type (dirdeclorp dirdeclor).
- span — Type (spanp span).
- new-parstate — Type (parstatep new-parstate), given (parstatep parstate).
These are the kinds of direct declarators
that can be chained, one after the other.
See parse-direct-declarator.
This function is called when we expect this kind of declarator.
The prev-dirdeclor input to this function
is the direct declarator parsed so far,
which must be extended with the next array or function declarator.
The prev-span input is the span of that direct declarator.
Although there are two possible variants for function declarators,
since an identifier is a type specifier and thus a parameter declaration,
we cannot disambiguate the :function-params and :function-names
variants during parsing;
we always generate :function-params during parsing,
and potentially re-classify it to :function-names
during post-parsing semantic analysis.