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