Amb-decl/stmt
Fixtype of ambiguous declarations or statements.
This is a product type introduced by fty::defprod.
Fields
- decl — decl
- stmt — expr
A block item may be a declaration or a statement,
but there is a complex syntactic overlap
between declarations and statements, specifically expression statements.
For instance, if I1, ..., In are identifiers,
I1(I2(...(In)...)); could be either a declaration or a statement.
It is a declaration if I1 is a type specifier (a typedef name)
and (I2(...(In)...)) is a declarator of I2,
which is a function with a parameter I3,
which is a function with a parameter I4,
and so on;
here I3, I4, etc. are type specifiers (typedef names).
It is instead an expression statement if
I1 is a function, called with argument I2(...(In)...),
which is itself a function call, and so on.
There are also other, more complex patterns,
for example similar to the ones above
but with multiple function arguments.
So, similarly to
amb-expr/tyname and amb-declor/absdeclor,
here we define a fixtype of ambiguous declarations or statements,
which contain both the declaration and the expression
(since the only ambiguity is with expression statements).
These two components should look the same in concrete syntax,
but we do not enforce that in this fixtype definition.
Subtopics
- Amb-decl/stmt-equiv
- Basic equivalence relation for amb-decl/stmt structures.
- Make-amb-decl/stmt
- Basic constructor macro for amb-decl/stmt structures.
- Change-amb-decl/stmt
- Modifying constructor for amb-decl/stmt structures.
- Amb-decl/stmt->stmt
- Get the stmt field from a amb-decl/stmt.
- Amb-decl/stmt->decl
- Get the decl field from a amb-decl/stmt.
- Amb-decl/stmt-p
- Recognizer for amb-decl/stmt structures.
- Amb-decl/stmt-fix
- Fixing function for amb-decl/stmt structures.
- Amb-decl/stmt-count
- Measure for recurring over amb-decl/stmt structures.