|
|
1.1 root 1: /* ident "@(#)ctrans:src/node_classes.h 1.2" */
2: /*
3: * node_classes.h
4: */
5:
6: #ifndef _node_classes
7: #define _node_classes
8:
9: enum discriminator_error {
10: discrim_none_valid = 0,
11: discrim_bad_index = -1,
12: discrim_inconsistent_node = -2,
13: };
14:
15: enum node_class {
16: nc_unused = 0,
17: nc_eof = 1,
18: nc_virt = 2,
19: nc_nlist = 3,
20: nc_gen = 4,
21: nc_vec = 5,
22: nc_ptr = 6,
23: nc_fct = 7,
24: nc_table = 8,
25: nc_basetype = 9,
26: nc_name = 10,
27: nc_expr = 11,
28: nc_stmt = 12,
29: nc_enumdef = 13,
30: nc_classdef = 14,
31: nc_baseclass = 15,
32: nc_iline = 16,
33: nc_ia = 17,
34: };
35:
36: /*
37: searching this is slower than a directly indexed array,
38: but this is more maintainable. We can speed it up later.
39: */
40:
41: #ifdef DEFINE_TOKEN_CLASS_TABLE
42: struct token_class {
43: TOK token;
44: node_class nclass;
45: } token_classes[] = {
46: { EOFTOK, nc_eof },
47: { ASM, nc_stmt },
48: { AUTO, nc_basetype },
49: { BREAK, nc_stmt },
50: { CASE, nc_stmt },
51: { CHAR, nc_basetype },
52: { CLASS, nc_classdef },
53: { CONTINUE, nc_stmt },
54: { DEFAULT, nc_stmt },
55: { DELETE, nc_expr },
56: { DO, nc_stmt },
57: { DOUBLE, nc_basetype },
58: { ELSE, nc_stmt },
59: { ENUM, nc_enumdef },
60: { EXTERN, nc_basetype },
61: { FLOAT, nc_basetype },
62: { FOR, nc_stmt },
63: { FORTRAN, nc_unused },
64: { FRIEND, nc_basetype },
65: { GOTO, nc_stmt },
66: { IF, nc_stmt },
67: { INT, nc_basetype },
68: { LONG, nc_basetype },
69: { NEW, nc_expr },
70: { OPERATOR, nc_fct },
71: { RETURN, nc_stmt },
72: { PUBLIC, nc_name },
73: { CONST, nc_basetype },
74: { REGISTER, nc_basetype },
75: { RETURN, nc_stmt },
76: { SHORT, nc_basetype },
77: { SIZEOF, nc_expr },
78: { STATIC, nc_basetype },
79: { STRUCT, nc_unused },
80: { SWITCH, nc_stmt },
81: { THIS, nc_expr },
82: { TYPEDEF, nc_basetype },
83: { UNION, nc_unused },
84: { UNSIGNED, nc_basetype },
85: { VOID, nc_basetype },
86: { WHILE, nc_stmt },
87: { LP, nc_unused },
88: { RP, nc_unused },
89: { LB, nc_unused },
90: { RB, nc_unused },
91: { REF, nc_expr },
92: { DOT, nc_expr },
93: { NOT, nc_expr },
94: { COMPL, nc_expr },
95: { INCR, nc_expr },
96: { DECR, nc_expr },
97: { MUL, nc_expr },
98: { DIV, nc_expr },
99: { AND, nc_expr },
100: { MOD, nc_expr },
101: { PLUS, nc_expr },
102: { MINUS, nc_expr },
103: { LS, nc_expr },
104: { RS, nc_expr },
105: { LT, nc_expr },
106: { LE, nc_expr },
107: { GT, nc_expr },
108: { GE, nc_expr },
109: { EQ, nc_expr },
110: { NE, nc_expr },
111: { ER, nc_expr },
112: { OR, nc_expr },
113: { ANDAND, nc_expr },
114: { OROR, nc_expr },
115: { QUEST, nc_expr },
116: { COLON, nc_unused },
117: { ASSIGN, nc_expr },
118: { CM, nc_expr },
119: { SM, nc_stmt },
120: { SM_PARAM, nc_stmt },
121: { LC, nc_unused },
122: { RC, nc_unused },
123: { INLINE, nc_fct },
124: { OVERLOAD, nc_gen },
125: { VIRTUAL, nc_fct }, /* but might be a basecl */
126: { COERCE, nc_unused },
127: { PROTECTED, nc_name },
128: { ID, nc_unused },
129: { STRING, nc_expr },
130: { ICON, nc_expr },
131: { FCON, nc_expr },
132: { CCON, nc_expr },
133: { NAME, nc_name }, /* but might be basecl */
134: { ZERO, nc_expr },
135: { ASOP, nc_expr },
136: { RELOP, nc_expr },
137: { EQUOP, nc_expr },
138: { DIVOP, nc_expr },
139: { SHIFTOP, nc_expr },
140: { ICOP, nc_expr },
141: { UNOP, nc_expr },
142: { TYPE, nc_basetype },
143: { UMINUS, nc_expr },
144: { FCT, nc_fct },
145: { CALL, nc_expr },
146: { VEC, nc_vec },
147: { DEREF, nc_expr },
148: { ADDROF, nc_expr },
149: { CAST, nc_expr },
150: { FIELD, nc_basetype },
151: { LABEL, nc_stmt },
152: { BLOCK, nc_stmt },
153: { DCL, nc_stmt },
154: { COBJ, nc_basetype },
155: { EOBJ, nc_basetype },
156: { TNAME, nc_name },
157: { ILIST, nc_expr },
158: { PTR, nc_ptr },
159: { ASPLUS, nc_expr },
160: { ASMINUS, nc_expr },
161: { ASMUL, nc_expr },
162: { ASDIV, nc_expr },
163: { ASMOD, nc_expr },
164: { ASAND, nc_expr },
165: { ASOR, nc_expr },
166: { ASER, nc_expr },
167: { ASLS, nc_expr },
168: { ASRS, nc_expr },
169: { ARG, nc_basetype },
170: { ZTYPE, nc_basetype },
171: { ARGT, nc_basetype },
172: { ELIST, nc_expr },
173: { ANY, nc_basetype },
174: { TABLE, nc_table },
175: { LOC, nc_unused },
176: { DUMMY, nc_expr },
177: { G_ADDROF, nc_expr },
178: { G_CALL, nc_expr },
179: { G_CM, nc_expr },
180: { IVAL, nc_expr },
181: { ELLIPSIS, nc_unused },
182: { AGGR, nc_unused },
183: { RPTR, nc_ptr },
184: { HIDDEN, nc_unused },
185: { MEM, nc_expr },
186: { CTOR, nc_unused },
187: { DTOR, nc_unused },
188: { CONST_PTR, nc_ptr },
189: { CONST_RPTR, nc_ptr },
190: { TEXT, nc_expr },
191: { PAIR, nc_stmt },
192: { ANON, nc_unused },
193: { ICALL, nc_expr },
194: { ANAME, nc_expr },
195: { VOLATILE, nc_basetype },
196: { SIGNED, nc_basetype },
197: { UPLUS, nc_expr },
198: { MEMPTR, nc_unused },
199: { PRIVATE, nc_name },
200: { PR, nc_unused },
201: { MDOT, nc_expr },
202: { TSCOPE, nc_unused },
203: { DECL_MARKER, nc_unused },
204: { REFMUL, nc_expr },
205: { LDOUBLE, nc_basetype },
206: { LINKAGE, nc_unused },
207: { LOCAL, nc_basetype },
208: { GNEW, nc_expr },
209: { TEMPLATE, nc_unused },
210: { STAT_INIT, nc_unused },
211: { CATCH, nc_unused },
212: { GDELETE, nc_expr },
213: { XVIRT, nc_virt },
214: { XNLIST, nc_nlist },
215: { XILINE, nc_iline },
216: { XIA, nc_ia },
217: { VALUE, nc_expr },
218: { XDELETED_NODE, nc_unused },
219: };
220: #endif
221:
222: node_class classify_node (Pnode, int&);
223: node_class classify_node (Pnode);
224:
225: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.