From af0c1d5ac3960776a4a485ca587744464630e634 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Sun, 24 May 2020 08:06:34 -0700 Subject: contin: in the middle of reorganizing the declaration parsing. check-in before reorganizing keywords --- sys/cmd/cc/cc.h | 53 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 16 deletions(-) (limited to 'sys/cmd/cc/cc.h') diff --git a/sys/cmd/cc/cc.h b/sys/cmd/cc/cc.h index 7d30360..4b61346 100644 --- a/sys/cmd/cc/cc.h +++ b/sys/cmd/cc/cc.h @@ -373,10 +373,10 @@ enum Dvars, /* names (shouldn't interact with base AST node enumeration */ - Nident = iota(0), - Nparen = iota(1), - Nindex = iota(2), - Ncall = iota(3), + Nident, + Nparen, + Nindex, + Ncall, }; /* expressions */ @@ -561,23 +561,40 @@ struct Ptr Ptr *link; }; +struct Param +{ + uint32 qual; + Type *type; + string name; +}; + struct Name { - struct Node; + uint32 kind; union { string ident; struct Dtor *paren; - }; - union { - Expr *i; - Expr *p; + /* This is bloated ! */ + struct { + Name *name; + union { + struct { + uint32 q; + Expr *x; + } idx; + struct { + int n; + struct Param *arg; + } call; + }; + } sfx; }; }; struct Dtor { - Ptr ptr; - Name name; + Ptr ptr; + Name *name; }; struct Decls @@ -592,12 +609,16 @@ struct Decl { struct Node; uint32 spec; - string name; - Type *type; union { - Stmt *func; - Expr *init; - struct Decls *link; + struct { + string name; + Type *type; + union { + Stmt *body; + Expr *init; + }; + }; + struct Decls vars; }; }; -- cgit v1.2.1