Parse-unary-expression
Parse a unary expression.
- Signature
(parse-unary-expression parstate)
→
(mv erp expr span new-parstate)
- Arguments
- parstate — Guard (parstatep parstate).
- Returns
- expr — Type (exprp expr).
- span — Type (spanp span).
- new-parstate — Type (parstatep new-parstate), given (parstatep parstate).
We can always distinguish the alternatives of
the grammar rule for unary expressions based on the next token,
except for the potential ambiguity between
parenthesized expressions or type names
after sizeof or _Alignof,
the latter only if GCC extensions are enabled.
If we encounter a sizeof or _Alignof
not followed by an open parenthesis,
there is no potential ambiguity: the operand must be an expression.
If there is an open parenthesis,
we parse an expression or type name via a separate function,
and based on the result we return
a sizeof or _Alignof expression with
an expression, a type name, or an ambiguous type name or expression.