Parse-declaration-specifier
Parse a declaration specifier.
- Signature
(parse-declaration-specifier tyspec-seenp pstate)
→
(mv erp declspec span new-pstate)
- Arguments
- tyspec-seenp — Guard (booleanp tyspec-seenp).
- pstate — Guard (parstatep pstate).
- Returns
- declspec — Type (declspecp declspec).
- span — Type (spanp span).
- new-pstate — Type (parstatep new-pstate).
This is an element of a declaration specifier list,
which is declaration-specifiers in the ABNF grammar,
but there is no explicit declaration-specifier rule name.
Nonetheless, since we need to parse a list of these,
it is clearly useful to have a parsing function for each.
If this had its own grammar rule,
it would be defined as an alternation of
a storage class specifier,
a type specifier,
a type qualifier,
a function specifier,
an alignment specifier,
or an attribute specifier (the last one is a GCC extension).
A declaration specifier (list) may always be followed by a declarator.
It may also be followed by an abstract declarator
when forming a parameter declaration,
but in that case the abstract declarator is optional,
so the declaration specifier may be followed by
a comma or a closed parenthesis.
This function is called when we expect a declaration specifier,
which is the case at the start of a declaration specifier list
(because the list cannot be empty),
and when the caller parse-declaration-specifiers
determines that there must be another specifier or qualifier.
This is similar to parse-specifier/qualifier,
but more complex because there are more alternatives.
The syntactic overlap between
the _Atomic type qualifier and the _Atomic type specifier
is resolved in the same way as in parse-specifier/qualifier,
which motivates the tyspec-seenp flag passed to this function;
see that function's documentation.