48 lines
1.5 KiB
C
48 lines
1.5 KiB
C
/* N O D E O F A N A B S T R A C T P A R S E T R E E */
|
|
|
|
struct node {
|
|
struct node *nd_left;
|
|
#define nd_next nd_left
|
|
struct node *nd_right;
|
|
int nd_class; /* kind of node */
|
|
#define Value 0 /* constant */
|
|
#define Name 1 /* an identifier */
|
|
#define Uoper 2 /* unary operator */
|
|
#define Boper 3 /* binary operator */
|
|
#define Xset 4 /* a set */
|
|
#define Set 5 /* a set constant */
|
|
#define Call 6 /* a function call */
|
|
#define NameOrCall 7 /* call or name of function */
|
|
#define Arrow 8 /* ^ construction */
|
|
#define Arrsel 9 /* array selection */
|
|
#define Def 10 /* an identified name */
|
|
#define Link 11
|
|
#define LinkDef 12
|
|
#define Cast 13 /* convert integer to real */
|
|
/* do NOT change the order or the numbers!!! */
|
|
struct type *nd_type; /* type of this node */
|
|
struct token nd_token;
|
|
#define nd_def nd_token.tk_data.tk_def
|
|
#define nd_set nd_token.tk_data.tk_set
|
|
#define nd_lab nd_token.tk_data.tk_lab
|
|
#define nd_symb nd_token.tk_symb
|
|
#define nd_lineno nd_token.tk_lineno
|
|
#define nd_IDF nd_token.TOK_IDF
|
|
#define nd_STR nd_token.TOK_STR
|
|
#define nd_SLE nd_token.TOK_SLE
|
|
#define nd_SLA nd_token.TOK_SLA
|
|
#define nd_INT nd_token.TOK_INT
|
|
#define nd_REL nd_token.TOK_REL
|
|
#define nd_RLA nd_token.TOK_RLA
|
|
#define nd_RIV nd_token.TOK_RIV
|
|
#define nd_RSI nd_token.TOK_RSI
|
|
};
|
|
|
|
/* ALLOCDEF "node" 50 */
|
|
|
|
extern struct node *MkNode(), *MkLeaf(), *ChkStdInOut();
|
|
|
|
#define IsProcCall(lnd) ((lnd)->nd_type->tp_fund & T_ROUTINE)
|
|
|
|
#define NULLNODE ((struct node *) 0)
|