:
[
other_specifier(ds)+
- [%prefer /* the thin ice in R.M. 11.1 */
+ [%if (DOT != IDENTIFIER || AHEAD == IDENTIFIER)
+ /* the thin ice in R.M. 11.1 */
single_type_specifier(ds) other_specifier(ds)*
|
empty
single_type_specifier(register struct decspecs *ds;):
TYPE_IDENTIFIER /* this includes INT, CHAR, etc. */
{idf2type(dot.tk_idf, &ds->ds_type);}
+|
+ IDENTIFIER
+ {error("%s is not a type identifier", dot.tk_idf->id_text);
+ ds->ds_type = error_type;
+ }
|
struct_or_union_specifier(&ds->ds_type)
|
unary(register struct expr **expp;)
{struct type *tp; int oper;}
:
-%if (first_of_type_specifier(AHEAD))
+%if (first_of_type_specifier(AHEAD) && AHEAD != IDENTIFIER)
cast(&tp) unary(expp)
{ ch7cast(expp, CAST, tp);
(*expp)->ex_flags |= EX_CAST;
{struct type *tp;}
:
SIZEOF
- [%if (first_of_type_specifier(AHEAD))
+ [%if (first_of_type_specifier(AHEAD) && AHEAD != IDENTIFIER)
cast(&tp)
{
*expp = intexpr(size_of_type(tp, "type"), INT);
register struct e_stack *p;
register struct sdef *sd;
+ if (tpp && *tpp == error_type) {
+ gen_error = 1;
+ return 0;
+ }
if (gen_error) return tpp;
p = new_e_stack();
p->next = p_stack;
sd = next_field(sd, p);
}
#endif
+ if (! sd) {
+ /* something wrong with this struct */
+ gen_error = 1;
+ p_stack = p->next;
+ free_e_stack(p);
+ return 0;
+ }
p->s_def = sd;
if (AHEAD != '{' && aggregate_type(sd->sd_type)) {
return gen_tphead(&(sd->sd_type), 1);
register struct sdef *sd;
register struct e_stack *p = p_stack;
- if (gen_error) if (p) return p->s_tpp; else return 0;
+ if (gen_error) {
+ if (p) return p->s_tpp;
+ return 0;
+ }
again:
tp = *(p->s_tpp);
switch(tp->tp_fund) {
;
ext_decl_specifiers(struct decspecs *ds;) :
-%prefer /* the thin ice in R.M. 11.1 */
+%if (DOT != IDENTIFIER || AHEAD == IDENTIFIER) /* the thin ice in R.M. 11.1 */
decl_specifiers(ds)
|
empty
{
stack_level();
}
- [%while (AHEAD != ':') /* >>> conflict on TYPE_IDENTIFIER */
+ [%while ((DOT != IDENTIFIER && AHEAD != ':') ||
+ (DOT == IDENTIFIER && AHEAD == IDENTIFIER))
+ /* >>> conflict on TYPE_IDENTIFIER, IDENTIFIER */
declaration
]*
[%persistent