|
|
1.1 root 1: /*ident "@(#)ctrans:src/token.h 1.4" */
2: /**************************************************************************
3:
4: C++ source for cfront, the C++ compiler front-end
5: written in the computer science research center of Bell Labs
6:
7: Copyright (c) 1984 AT&T, Inc. All Rights Reserved
8: THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T, INC.
9:
10: token.h:
11:
12: *****************************************************************************/
13: /*
14: #ifndef PRESAFE
15: extern "C" {
16: #endif
17:
18: extern void free(char*); // alloc.h
19: extern char* malloc(unsigned);
20: extern char* calloc(unsigned, unsigned);
21:
22: extern strncmp(const char*, const char*, const); // string.h
23: extern strcmp(const char*, const char*);
24: extern int strlen(const char*);
25: extern char* strcpy(char*, const char*);
26:
27: #ifdef apollo
28: extern void set_sbrk_size(int);
29: #endif
30:
31: #ifndef PRESAFE
32: }
33: #endif
34: */
35:
36: #include <malloc.h>
37: #include <string.h>
38: #include <stdio.h>
39:
40: extern void lex_clear();
41: extern void otbl_init();
42:
43: //#define yylex() lalex()
44:
45: #define putstring(s) fputs(s,out_file)
46: #define putst(s) (fputs(s,out_file),putc(' ',out_file))
47: #define putch(c) putc(c,out_file)
48: #define putcat(c,s) (putc(c,out_file),fputs(s,out_file))
49:
50: /* token numbers for C parser */
51:
52: #define MAXTOK 255
53: extern char* keys[MAXTOK+1];
54:
55: #define EOFTOK 0 /* EOF */
56: /* keywords in alphabetical order */
57: #define ASM 1
58: #define AUTO 2
59: #define BREAK 3
60: #define CASE 4
61: #define CHAR 5
62: #define CLASS 6
63: #define CONTINUE 7
64: #define DEFAULT 8
65: #define DELETE 9
66: #define DO 10
67: #define DOUBLE 11
68: #define ELSE 12
69: #define ENUM 13
70: #define EXTERN 14
71: #define FLOAT 15
72: #define FOR 16
73: #define FORTRAN 17
74: #define FRIEND 18
75: #define GOTO 19
76: #define IF 20
77: #define INT 21
78: #define LONG 22
79: #define NEW 23
80: #define OPERATOR 24
81: #define PUBLIC 25
82: #define CONST 26
83: #define REGISTER 27
84: #define RETURN 28
85: #define SHORT 29
86: #define SIZEOF 30
87: #define STATIC 31
88: #define STRUCT 32
89: #define SWITCH 33
90: #define THIS 34
91: #define TYPEDEF 35
92: #define UNION 36
93: #define UNSIGNED 37
94: #define VOID 38
95: #define WHILE 39
96:
97: /* operators in priority order (sort of) */
98: #define LP 40
99: #define RP 41
100: #define LB 42
101: #define RB 43
102: #define REF 44
103: #define DOT 45
104: #define NOT 46
105: #define COMPL 47
106: #define INCR 48
107: #define DECR 49
108: #define MUL 50
109: #define DIV 51
110: #define AND 52
111: #define MOD 53
112: #define PLUS 54
113: #define MINUS 55
114: #define LS 56
115: #define RS 57
116: #define LT 58
117: #define LE 59
118: #define GT 60
119: #define GE 61
120: #define EQ 62
121: #define NE 63
122: #define ER 64
123: #define OR 65
124: #define ANDAND 66
125: #define OROR 67
126: #define QUEST 68
127: #define COLON 69
128: #define ASSIGN 70
129: #define CM 71
130: #define SM 72
131: #define LC 73
132: #define RC 74
133:
134: #define INLINE 75
135: #define OVERLOAD 76
136: #define VIRTUAL 77
137: #define COERCE 78
138: #define PROTECTED 79
139:
140: /* constants etc. */
141: #define ID 80
142: #define STRING 81
143: #define ICON 82
144: #define FCON 83
145: #define CCON 84
146: #define NAME 85
147: #define ZERO 86
148:
149: /* groups of tokens */
150: #define ASOP 90 /* op= */
151: #define RELOP 91 /* LE GE LT GT */
152: #define EQUOP 92 /* EQ NE */
153: #define DIVOP 93 /* DIV MOD */
154: #define SHIFTOP 94 /* LS RS */
155: #define ICOP 95 /* INCR DECR */
156: #define UNOP 96 /* NOT COMPL */
157: #define TYPE 97
158: /* TYPE = INT FLOAT CHAR DOUBLE REGISTER STATIC EXTERN AUTO
159: LONG SHORT UNSIGNED INLINE FRIEND VIRTUAL */
160:
161: /* new tokens generated by syn() */
162: #define UMINUS 107
163: #define FCT 108
164: #define CALL 109
165: #define VEC 110
166: #define DEREF 111
167: #define ADDROF 112
168: #define CAST 113
169: //#define ENDCAST 122
170: #define FIELD 114
171: #define LABEL 115
172: #define BLOCK 116
173: //#define QUA 117
174: #define DCL 118 /* local declaration statement */
175: #define COBJ 119
176: #define EOBJ 121
177: #define TNAME 123
178: #define ILIST 124
179: #define PTR 125
180:
181: #define ASPLUS 126
182: #define ASMINUS 127
183: #define ASMUL 128
184: #define ASDIV 129
185: #define ASMOD 130
186: #define ASAND 131
187: #define ASOR 132
188: #define ASER 133
189: #define ASLS 134
190: #define ASRS 135
191:
192: #define ARG 136
193: #define ARGS 137
194: #define ZTYPE 138
195: #define ARGT 139
196: #define ELIST 140
197: #define ANY 141
198: #define TABLE 142
199: #define LOC 143
200: #define DUMMY 144
201: #define G_ADDROF 145
202: #define G_CALL 146
203: #define G_CM 147
204: #define IVAL 150
205: //#define FVAL 151
206: //#define LVAL 152
207: #define ELLIPSIS 155
208: #define AGGR 156
209: #define VALUE 157 /* constructor call */
210: #define RPTR 158 /* reference */
211: #define HIDDEN 159
212: #define MEM 160
213: #define CTOR 161
214: #define DTOR 162
215: #define CONST_PTR 163
216: #define CONST_RPTR 164
217: #define TEXT 165
218: #define PAIR 166
219: #define ANON 167
220: #define ICALL 168
221: #define ANAME 169
222: #define VOLATILE 170
223: #define SIGNED 171
224: #define UPLUS 172
225: #define MEMPTR 173
226: #define PRIVATE 174
227: #define PR 175 /* PUBLIC PRIVATE or PROTECTED */
228: #define MDOT 177
229: #define TSCOPE 178
230: #define DECL_MARKER 179
231: #define REFMUL 180
232: #define LDOUBLE 181
233: #define LINKAGE 182
234: #define LOCAL 183
235: #define GNEW 184
236: #define TEMPLATE 185
237: #define STAT_INIT 186
238: #define CATCH 187
239: #define GDELETE 188
240: //#define CONVERT 189
241: #define NESTED 190
242: #define TRY 191
243:
244: // class parameterized types constants
245: #define XVIRT 200 /* class virt */
246: #define XNLIST 201 /* struct name_list */
247: #define XILINE 202
248: #define XIA 203
249: #define STATEMENT 205
250: #define EXPRESSION 206
251: #define SM_PARAM 207
252: #define TEMPLATE_TEST 208
253: #define PTNAME 209
254: #define NEW_INIT_KLUDGE 210
255: #define XDELETED_NODE 211
256: #define DUMMY_LAST_NODE 212
257:
258: //#define SYN 1
259: //#define TYP 2
260: //#define SIMPL 3
261: //#define ERROR 4
262:
263: //#define ICTOR 88
264: //#define IDTOR 89
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.