1 |
|
---|
2 | /* A Bison parser, made from m68k-parse.y
|
---|
3 | by GNU Bison version 1.28 */
|
---|
4 |
|
---|
5 | #define YYBISON 1 /* Identify Bison output. */
|
---|
6 |
|
---|
7 | #define DR 257
|
---|
8 | #define AR 258
|
---|
9 | #define FPR 259
|
---|
10 | #define FPCR 260
|
---|
11 | #define LPC 261
|
---|
12 | #define ZAR 262
|
---|
13 | #define ZDR 263
|
---|
14 | #define LZPC 264
|
---|
15 | #define CREG 265
|
---|
16 | #define INDEXREG 266
|
---|
17 | #define EXPR 267
|
---|
18 |
|
---|
19 | #line 27 "m68k-parse.y"
|
---|
20 |
|
---|
21 |
|
---|
22 | #include "as.h"
|
---|
23 | #include "tc-m68k.h"
|
---|
24 | #include "m68k-parse.h"
|
---|
25 |
|
---|
26 | /* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
|
---|
27 | etc), as well as gratuitiously global symbol names If other parser
|
---|
28 | generators (bison, byacc, etc) produce additional global names that
|
---|
29 | conflict at link time, then those parser generators need to be
|
---|
30 | fixed instead of adding those names to this list. */
|
---|
31 |
|
---|
32 | #define yymaxdepth m68k_maxdepth
|
---|
33 | #define yyparse m68k_parse
|
---|
34 | #define yylex m68k_lex
|
---|
35 | #define yyerror m68k_error
|
---|
36 | #define yylval m68k_lval
|
---|
37 | #define yychar m68k_char
|
---|
38 | #define yydebug m68k_debug
|
---|
39 | #define yypact m68k_pact
|
---|
40 | #define yyr1 m68k_r1
|
---|
41 | #define yyr2 m68k_r2
|
---|
42 | #define yydef m68k_def
|
---|
43 | #define yychk m68k_chk
|
---|
44 | #define yypgo m68k_pgo
|
---|
45 | #define yyact m68k_act
|
---|
46 | #define yyexca m68k_exca
|
---|
47 | #define yyerrflag m68k_errflag
|
---|
48 | #define yynerrs m68k_nerrs
|
---|
49 | #define yyps m68k_ps
|
---|
50 | #define yypv m68k_pv
|
---|
51 | #define yys m68k_s
|
---|
52 | #define yy_yys m68k_yys
|
---|
53 | #define yystate m68k_state
|
---|
54 | #define yytmp m68k_tmp
|
---|
55 | #define yyv m68k_v
|
---|
56 | #define yy_yyv m68k_yyv
|
---|
57 | #define yyval m68k_val
|
---|
58 | #define yylloc m68k_lloc
|
---|
59 | #define yyreds m68k_reds /* With YYDEBUG defined */
|
---|
60 | #define yytoks m68k_toks /* With YYDEBUG defined */
|
---|
61 | #define yylhs m68k_yylhs
|
---|
62 | #define yylen m68k_yylen
|
---|
63 | #define yydefred m68k_yydefred
|
---|
64 | #define yydgoto m68k_yydgoto
|
---|
65 | #define yysindex m68k_yysindex
|
---|
66 | #define yyrindex m68k_yyrindex
|
---|
67 | #define yygindex m68k_yygindex
|
---|
68 | #define yytable m68k_yytable
|
---|
69 | #define yycheck m68k_yycheck
|
---|
70 |
|
---|
71 | #ifndef YYDEBUG
|
---|
72 | #define YYDEBUG 1
|
---|
73 | #endif
|
---|
74 |
|
---|
75 | /* Internal functions. */
|
---|
76 |
|
---|
77 | static enum m68k_register m68k_reg_parse PARAMS ((char **));
|
---|
78 | static int yylex PARAMS ((void));
|
---|
79 | static void yyerror PARAMS ((const char *));
|
---|
80 |
|
---|
81 | /* The parser sets fields pointed to by this global variable. */
|
---|
82 | static struct m68k_op *op;
|
---|
83 |
|
---|
84 |
|
---|
85 | #line 93 "m68k-parse.y"
|
---|
86 | typedef union
|
---|
87 | {
|
---|
88 | struct m68k_indexreg indexreg;
|
---|
89 | enum m68k_register reg;
|
---|
90 | struct m68k_exp exp;
|
---|
91 | unsigned long mask;
|
---|
92 | int onereg;
|
---|
93 | } YYSTYPE;
|
---|
94 | #include <stdio.h>
|
---|
95 |
|
---|
96 | #ifndef __cplusplus
|
---|
97 | #ifndef __STDC__
|
---|
98 | #define const
|
---|
99 | #endif
|
---|
100 | #endif
|
---|
101 |
|
---|
102 |
|
---|
103 |
|
---|
104 | #define YYFINAL 173
|
---|
105 | #define YYFLAG -32768
|
---|
106 | #define YYNTBASE 25
|
---|
107 |
|
---|
108 | #define YYTRANSLATE(x) ((unsigned)(x) <= 267 ? yytranslate[x] : 44)
|
---|
109 |
|
---|
110 | static const char yytranslate[] = { 0,
|
---|
111 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
112 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
113 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
114 | 2, 2, 2, 2, 14, 2, 2, 15, 2, 16,
|
---|
115 | 17, 2, 18, 20, 19, 2, 24, 2, 2, 2,
|
---|
116 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
117 | 2, 2, 2, 23, 2, 2, 2, 2, 2, 2,
|
---|
118 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
119 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
120 | 21, 2, 22, 2, 2, 2, 2, 2, 2, 2,
|
---|
121 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
122 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
123 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
124 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
125 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
126 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
127 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
128 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
129 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
130 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
131 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
132 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
133 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
134 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
135 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
136 | 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
|
---|
137 | 7, 8, 9, 10, 11, 12, 13
|
---|
138 | };
|
---|
139 |
|
---|
140 | #if YYDEBUG != 0
|
---|
141 | static const short yyprhs[] = { 0,
|
---|
142 | 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
|
---|
143 | 21, 24, 26, 30, 35, 40, 46, 52, 57, 61,
|
---|
144 | 65, 69, 77, 85, 92, 98, 105, 111, 118, 124,
|
---|
145 | 130, 135, 145, 153, 162, 169, 180, 189, 200, 209,
|
---|
146 | 218, 221, 225, 229, 235, 242, 253, 263, 274, 276,
|
---|
147 | 278, 280, 282, 284, 286, 288, 290, 292, 294, 296,
|
---|
148 | 298, 300, 302, 303, 305, 307, 309, 310, 313, 314,
|
---|
149 | 317, 318, 321, 323, 327, 331, 333, 335, 339, 343,
|
---|
150 | 347, 349, 351, 353
|
---|
151 | };
|
---|
152 |
|
---|
153 | static const short yyrhs[] = { 26,
|
---|
154 | 0, 27, 0, 28, 0, 3, 0, 4, 0, 5,
|
---|
155 | 0, 6, 0, 11, 0, 13, 0, 14, 13, 0,
|
---|
156 | 15, 13, 0, 40, 0, 16, 4, 17, 0, 16,
|
---|
157 | 4, 17, 18, 0, 19, 16, 4, 17, 0, 16,
|
---|
158 | 13, 20, 34, 17, 0, 16, 34, 20, 13, 17,
|
---|
159 | 0, 13, 16, 34, 17, 0, 16, 7, 17, 0,
|
---|
160 | 16, 8, 17, 0, 16, 10, 17, 0, 16, 13,
|
---|
161 | 20, 34, 20, 29, 17, 0, 16, 13, 20, 34,
|
---|
162 | 20, 36, 17, 0, 16, 13, 20, 30, 37, 17,
|
---|
163 | 0, 16, 30, 20, 13, 17, 0, 13, 16, 34,
|
---|
164 | 20, 29, 17, 0, 16, 34, 20, 29, 17, 0,
|
---|
165 | 13, 16, 34, 20, 36, 17, 0, 16, 34, 20,
|
---|
166 | 36, 17, 0, 13, 16, 30, 37, 17, 0, 16,
|
---|
167 | 30, 37, 17, 0, 16, 21, 13, 37, 22, 20,
|
---|
168 | 29, 38, 17, 0, 16, 21, 13, 37, 22, 38,
|
---|
169 | 17, 0, 16, 21, 34, 22, 20, 29, 38, 17,
|
---|
170 | 0, 16, 21, 34, 22, 38, 17, 0, 16, 21,
|
---|
171 | 13, 20, 34, 20, 29, 22, 38, 17, 0, 16,
|
---|
172 | 21, 34, 20, 29, 22, 38, 17, 0, 16, 21,
|
---|
173 | 13, 20, 34, 20, 36, 22, 38, 17, 0, 16,
|
---|
174 | 21, 34, 20, 36, 22, 38, 17, 0, 16, 21,
|
---|
175 | 39, 30, 37, 22, 38, 17, 0, 35, 23, 0,
|
---|
176 | 35, 23, 18, 0, 35, 23, 19, 0, 35, 23,
|
---|
177 | 16, 13, 17, 0, 35, 23, 16, 39, 29, 17,
|
---|
178 | 0, 35, 23, 16, 13, 17, 23, 16, 39, 29,
|
---|
179 | 17, 0, 35, 23, 16, 13, 17, 23, 16, 13,
|
---|
180 | 17, 0, 35, 23, 16, 39, 29, 17, 23, 16,
|
---|
181 | 13, 17, 0, 12, 0, 31, 0, 12, 0, 32,
|
---|
182 | 0, 32, 0, 4, 0, 8, 0, 3, 0, 9,
|
---|
183 | 0, 4, 0, 7, 0, 33, 0, 10, 0, 8,
|
---|
184 | 0, 0, 34, 0, 7, 0, 10, 0, 0, 20,
|
---|
185 | 34, 0, 0, 20, 13, 0, 0, 13, 20, 0,
|
---|
186 | 42, 0, 42, 24, 41, 0, 43, 24, 41, 0,
|
---|
187 | 43, 0, 42, 0, 42, 24, 41, 0, 43, 24,
|
---|
188 | 41, 0, 43, 19, 43, 0, 3, 0, 4, 0,
|
---|
189 | 5, 0, 6, 0
|
---|
190 | };
|
---|
191 |
|
---|
192 | #endif
|
---|
193 |
|
---|
194 | #if YYDEBUG != 0
|
---|
195 | static const short yyrline[] = { 0,
|
---|
196 | 116, 118, 119, 124, 130, 135, 140, 145, 150, 155,
|
---|
197 | 160, 165, 177, 183, 188, 193, 203, 213, 223, 228,
|
---|
198 | 233, 238, 245, 256, 263, 269, 276, 282, 293, 303,
|
---|
199 | 310, 316, 324, 331, 338, 344, 352, 359, 371, 382,
|
---|
200 | 394, 403, 411, 419, 429, 436, 444, 451, 464, 466,
|
---|
201 | 478, 480, 491, 493, 494, 499, 501, 506, 508, 514,
|
---|
202 | 516, 517, 522, 527, 532, 534, 539, 544, 552, 558,
|
---|
203 | 566, 572, 580, 582, 586, 597, 602, 603, 607, 613,
|
---|
204 | 623, 628, 632, 636
|
---|
205 | };
|
---|
206 | #endif
|
---|
207 |
|
---|
208 |
|
---|
209 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
|
---|
210 |
|
---|
211 | static const char * const yytname[] = { "$","error","$undefined.","DR","AR",
|
---|
212 | "FPR","FPCR","LPC","ZAR","ZDR","LZPC","CREG","INDEXREG","EXPR","'#'","'&'","'('",
|
---|
213 | "')'","'+'","'-'","','","'['","']'","'@'","'/'","operand","generic_operand",
|
---|
214 | "motorola_operand","mit_operand","zireg","zdireg","zadr","zdr","apc","zapc",
|
---|
215 | "optzapc","zpc","optczapc","optcexpr","optexprc","reglist","ireglist","reglistpair",
|
---|
216 | "reglistreg", NULL
|
---|
217 | };
|
---|
218 | #endif
|
---|
219 |
|
---|
220 | static const short yyr1[] = { 0,
|
---|
221 | 25, 25, 25, 26, 26, 26, 26, 26, 26, 26,
|
---|
222 | 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
|
---|
223 | 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
|
---|
224 | 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
|
---|
225 | 28, 28, 28, 28, 28, 28, 28, 28, 29, 29,
|
---|
226 | 30, 30, 31, 31, 31, 32, 32, 33, 33, 34,
|
---|
227 | 34, 34, 35, 35, 36, 36, 37, 37, 38, 38,
|
---|
228 | 39, 39, 40, 40, 40, 41, 41, 41, 41, 42,
|
---|
229 | 43, 43, 43, 43
|
---|
230 | };
|
---|
231 |
|
---|
232 | static const short yyr2[] = { 0,
|
---|
233 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
|
---|
234 | 2, 1, 3, 4, 4, 5, 5, 4, 3, 3,
|
---|
235 | 3, 7, 7, 6, 5, 6, 5, 6, 5, 5,
|
---|
236 | 4, 9, 7, 8, 6, 10, 8, 10, 8, 8,
|
---|
237 | 2, 3, 3, 5, 6, 10, 9, 10, 1, 1,
|
---|
238 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
---|
239 | 1, 1, 0, 1, 1, 1, 0, 2, 0, 2,
|
---|
240 | 0, 2, 1, 3, 3, 1, 1, 3, 3, 3,
|
---|
241 | 1, 1, 1, 1
|
---|
242 | };
|
---|
243 |
|
---|
244 | static const short yydefact[] = { 63,
|
---|
245 | 81, 82, 83, 84, 59, 62, 61, 8, 9, 0,
|
---|
246 | 0, 0, 0, 1, 2, 3, 60, 64, 0, 12,
|
---|
247 | 73, 0, 0, 10, 11, 56, 58, 59, 62, 57,
|
---|
248 | 61, 51, 0, 71, 67, 52, 0, 0, 41, 0,
|
---|
249 | 0, 0, 58, 67, 0, 13, 19, 20, 21, 0,
|
---|
250 | 67, 0, 0, 0, 0, 0, 0, 71, 42, 43,
|
---|
251 | 81, 82, 83, 84, 74, 77, 76, 80, 75, 0,
|
---|
252 | 0, 18, 0, 14, 67, 0, 72, 0, 0, 69,
|
---|
253 | 67, 0, 68, 31, 54, 65, 55, 66, 49, 0,
|
---|
254 | 0, 50, 53, 0, 15, 0, 0, 0, 0, 30,
|
---|
255 | 0, 0, 0, 16, 0, 68, 69, 0, 0, 0,
|
---|
256 | 0, 0, 25, 17, 27, 29, 44, 72, 0, 78,
|
---|
257 | 79, 26, 28, 24, 0, 0, 0, 0, 0, 69,
|
---|
258 | 69, 70, 69, 35, 69, 0, 45, 22, 23, 0,
|
---|
259 | 0, 69, 33, 0, 0, 0, 0, 0, 71, 0,
|
---|
260 | 69, 69, 0, 37, 39, 34, 40, 0, 0, 0,
|
---|
261 | 0, 0, 32, 47, 0, 0, 36, 38, 46, 48,
|
---|
262 | 0, 0, 0
|
---|
263 | };
|
---|
264 |
|
---|
265 | static const short yydefgoto[] = { 171,
|
---|
266 | 14, 15, 16, 91, 35, 92, 93, 17, 83, 19,
|
---|
267 | 94, 55, 111, 53, 20, 65, 66, 67
|
---|
268 | };
|
---|
269 |
|
---|
270 | static const short yypact[] = { 89,
|
---|
271 | 10, 11, 19, 23,-32768,-32768,-32768,-32768, 13, -4,
|
---|
272 | 22, 57, 36,-32768,-32768,-32768,-32768,-32768, 18,-32768,
|
---|
273 | 33, -2, 114,-32768,-32768,-32768, 46, 62, 66,-32768,
|
---|
274 | 67,-32768, 68, 131, 69,-32768, 70, 105, 147, 156,
|
---|
275 | 156, 156,-32768, 94, 25, 101,-32768,-32768,-32768, 114,
|
---|
276 | 100, 53, 9, 138, 108, 103, 112, 117,-32768,-32768,
|
---|
277 | -32768,-32768,-32768,-32768,-32768, 119, 12,-32768,-32768, 64,
|
---|
278 | 130,-32768, 124,-32768, 94, 81, 64, 135, 124, 132,
|
---|
279 | 94, 150,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 151,
|
---|
280 | 152,-32768,-32768, 153,-32768, 120, 146, 156, 156,-32768,
|
---|
281 | 154, 155, 157,-32768, 124, 144, 158, 159, 160, 73,
|
---|
282 | 162, 161,-32768,-32768,-32768,-32768, 163,-32768, 167,-32768,
|
---|
283 | -32768,-32768,-32768,-32768, 168, 170, 124, 73, 171, 169,
|
---|
284 | 169,-32768, 169,-32768, 169, 164, 172,-32768,-32768, 174,
|
---|
285 | 175, 169,-32768, 177, 176, 181, 182, 183, 178, 185,
|
---|
286 | 169, 169, 186,-32768,-32768,-32768,-32768, 136, 146, 179,
|
---|
287 | 187, 188,-32768,-32768, 189, 190,-32768,-32768,-32768,-32768,
|
---|
288 | 173, 194,-32768
|
---|
289 | };
|
---|
290 |
|
---|
291 | static const short yypgoto[] = {-32768,
|
---|
292 | -32768,-32768,-32768, -72, 1,-32768, -7,-32768, 3,-32768,
|
---|
293 | -65, -31, -103, -58,-32768, -40, 202, 6
|
---|
294 | };
|
---|
295 |
|
---|
296 |
|
---|
297 | #define YYLAST 207
|
---|
298 |
|
---|
299 |
|
---|
300 | static const short yytable[] = { 97,
|
---|
301 | 101, 69, 18, 129, 36, 22, 108, 102, 24, -4,
|
---|
302 | -5, 26, 71, 109, 37, 36, 41, 30, -6, 78,
|
---|
303 | 32, 42, -7, 44, 119, 45, 145, 146, 23, 147,
|
---|
304 | 41, 148, 125, -58, 25, 99, 52, 133, 153, 126,
|
---|
305 | 39, 72, 36, 103, 73, 36, 68, 161, 162, 112,
|
---|
306 | 75, 38, 76, 81, 140, 142, 40, 120, 121, 26,
|
---|
307 | 27, 141, 46, 28, 29, 30, 31, 43, 32, 33,
|
---|
308 | 5, 6, 79, 7, 80, 26, 85, 34, 47, 106,
|
---|
309 | 87, 30, 48, 49, 89, 132, 165, 50, 54, 56,
|
---|
310 | 159, 1, 2, 3, 4, 5, 6, 104, 7, 8,
|
---|
311 | 105, 9, 10, 11, 12, 26, 85, 13, 57, 86,
|
---|
312 | 87, 30, 88, 70, 89, 90, 26, 43, 74, 77,
|
---|
313 | 5, 6, 30, 7, 84, 32, 26, 85, 95, 96,
|
---|
314 | 86, 87, 30, 88, 43, 89, 117, 5, 6, 118,
|
---|
315 | 7, 43, 98, 51, 5, 6, 100, 7, 26, 85,
|
---|
316 | 82, 110, 164, 87, 30, 118, 107, 89, 61, 62,
|
---|
317 | 63, 64, 58, 127, 59, 60, 113, 114, 115, 116,
|
---|
318 | 122, 123, 172, 124, 0, 0, 0, 128, 134, 149,
|
---|
319 | 130, 131, 135, 137, 138, 136, 139, 143, 144, 132,
|
---|
320 | 158, 166, 154, 173, 150, 151, 152, 155, 156, 157,
|
---|
321 | 160, 21, 163, 167, 168, 169, 170
|
---|
322 | };
|
---|
323 |
|
---|
324 | static const short yycheck[] = { 58,
|
---|
325 | 73, 42, 0, 107, 12, 0, 79, 73, 13, 0,
|
---|
326 | 0, 3, 44, 79, 12, 23, 19, 9, 0, 51,
|
---|
327 | 12, 24, 0, 23, 97, 23, 130, 131, 16, 133,
|
---|
328 | 19, 135, 105, 23, 13, 24, 34, 110, 142, 105,
|
---|
329 | 23, 17, 50, 75, 20, 53, 41, 151, 152, 81,
|
---|
330 | 50, 16, 50, 53, 127, 128, 24, 98, 99, 3,
|
---|
331 | 4, 127, 17, 7, 8, 9, 10, 4, 12, 13,
|
---|
332 | 7, 8, 20, 10, 22, 3, 4, 21, 17, 77,
|
---|
333 | 8, 9, 17, 17, 12, 13, 159, 20, 20, 20,
|
---|
334 | 149, 3, 4, 5, 6, 7, 8, 17, 10, 11,
|
---|
335 | 20, 13, 14, 15, 16, 3, 4, 19, 4, 7,
|
---|
336 | 8, 9, 10, 20, 12, 13, 3, 4, 18, 20,
|
---|
337 | 7, 8, 9, 10, 17, 12, 3, 4, 17, 13,
|
---|
338 | 7, 8, 9, 10, 4, 12, 17, 7, 8, 20,
|
---|
339 | 10, 4, 24, 13, 7, 8, 17, 10, 3, 4,
|
---|
340 | 13, 20, 17, 8, 9, 20, 22, 12, 3, 4,
|
---|
341 | 5, 6, 16, 20, 18, 19, 17, 17, 17, 17,
|
---|
342 | 17, 17, 0, 17, -1, -1, -1, 20, 17, 16,
|
---|
343 | 22, 22, 22, 17, 17, 23, 17, 17, 20, 13,
|
---|
344 | 13, 13, 17, 0, 23, 22, 22, 17, 17, 17,
|
---|
345 | 16, 0, 17, 17, 17, 17, 17
|
---|
346 | };
|
---|
347 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
---|
348 | #line 3 "/usr/share/bison/bison.simple"
|
---|
349 | /* This file comes from bison-1.28. */
|
---|
350 |
|
---|
351 | /* Skeleton output parser for bison,
|
---|
352 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
|
---|
353 |
|
---|
354 | This program is free software; you can redistribute it and/or modify
|
---|
355 | it under the terms of the GNU General Public License as published by
|
---|
356 | the Free Software Foundation; either version 2, or (at your option)
|
---|
357 | any later version.
|
---|
358 |
|
---|
359 | This program is distributed in the hope that it will be useful,
|
---|
360 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
361 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
362 | GNU General Public License for more details.
|
---|
363 |
|
---|
364 | You should have received a copy of the GNU General Public License
|
---|
365 | along with this program; if not, write to the Free Software
|
---|
366 | Foundation, Inc., 59 Temple Place - Suite 330,
|
---|
367 | Boston, MA 02111-1307, USA. */
|
---|
368 |
|
---|
369 | /* As a special exception, when this file is copied by Bison into a
|
---|
370 | Bison output file, you may use that output file without restriction.
|
---|
371 | This special exception was added by the Free Software Foundation
|
---|
372 | in version 1.24 of Bison. */
|
---|
373 |
|
---|
374 | /* This is the parser code that is written into each bison parser
|
---|
375 | when the %semantic_parser declaration is not specified in the grammar.
|
---|
376 | It was written by Richard Stallman by simplifying the hairy parser
|
---|
377 | used when %semantic_parser is specified. */
|
---|
378 |
|
---|
379 | #ifndef YYSTACK_USE_ALLOCA
|
---|
380 | #ifdef alloca
|
---|
381 | #define YYSTACK_USE_ALLOCA
|
---|
382 | #else /* alloca not defined */
|
---|
383 | #ifdef __GNUC__
|
---|
384 | #define YYSTACK_USE_ALLOCA
|
---|
385 | #define alloca __builtin_alloca
|
---|
386 | #else /* not GNU C. */
|
---|
387 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
|
---|
388 | #define YYSTACK_USE_ALLOCA
|
---|
389 | #include <alloca.h>
|
---|
390 | #else /* not sparc */
|
---|
391 | /* We think this test detects Watcom and Microsoft C. */
|
---|
392 | /* This used to test MSDOS, but that is a bad idea
|
---|
393 | since that symbol is in the user namespace. */
|
---|
394 | #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
|
---|
395 | #if 0 /* No need for malloc.h, which pollutes the namespace;
|
---|
396 | instead, just don't use alloca. */
|
---|
397 | #include <malloc.h>
|
---|
398 | #endif
|
---|
399 | #else /* not MSDOS, or __TURBOC__ */
|
---|
400 | #if defined(_AIX)
|
---|
401 | /* I don't know what this was needed for, but it pollutes the namespace.
|
---|
402 | So I turned it off. rms, 2 May 1997. */
|
---|
403 | /* #include <malloc.h> */
|
---|
404 | #pragma alloca
|
---|
405 | #define YYSTACK_USE_ALLOCA
|
---|
406 | #else /* not MSDOS, or __TURBOC__, or _AIX */
|
---|
407 | #if 0
|
---|
408 | #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
|
---|
409 | and on HPUX 10. Eventually we can turn this on. */
|
---|
410 | #define YYSTACK_USE_ALLOCA
|
---|
411 | #define alloca __builtin_alloca
|
---|
412 | #endif /* __hpux */
|
---|
413 | #endif
|
---|
414 | #endif /* not _AIX */
|
---|
415 | #endif /* not MSDOS, or __TURBOC__ */
|
---|
416 | #endif /* not sparc */
|
---|
417 | #endif /* not GNU C */
|
---|
418 | #endif /* alloca not defined */
|
---|
419 | #endif /* YYSTACK_USE_ALLOCA not defined */
|
---|
420 |
|
---|
421 | #ifdef YYSTACK_USE_ALLOCA
|
---|
422 | #define YYSTACK_ALLOC alloca
|
---|
423 | #else
|
---|
424 | #define YYSTACK_ALLOC malloc
|
---|
425 | #endif
|
---|
426 |
|
---|
427 | /* Note: there must be only one dollar sign in this file.
|
---|
428 | It is replaced by the list of actions, each action
|
---|
429 | as one case of the switch. */
|
---|
430 |
|
---|
431 | #define yyerrok (yyerrstatus = 0)
|
---|
432 | #define yyclearin (yychar = YYEMPTY)
|
---|
433 | #define YYEMPTY -2
|
---|
434 | #define YYEOF 0
|
---|
435 | #define YYACCEPT goto yyacceptlab
|
---|
436 | #define YYABORT goto yyabortlab
|
---|
437 | #define YYERROR goto yyerrlab1
|
---|
438 | /* Like YYERROR except do call yyerror.
|
---|
439 | This remains here temporarily to ease the
|
---|
440 | transition to the new meaning of YYERROR, for GCC.
|
---|
441 | Once GCC version 2 has supplanted version 1, this can go. */
|
---|
442 | #define YYFAIL goto yyerrlab
|
---|
443 | #define YYRECOVERING() (!!yyerrstatus)
|
---|
444 | #define YYBACKUP(token, value) \
|
---|
445 | do \
|
---|
446 | if (yychar == YYEMPTY && yylen == 1) \
|
---|
447 | { yychar = (token), yylval = (value); \
|
---|
448 | yychar1 = YYTRANSLATE (yychar); \
|
---|
449 | YYPOPSTACK; \
|
---|
450 | goto yybackup; \
|
---|
451 | } \
|
---|
452 | else \
|
---|
453 | { yyerror ("syntax error: cannot back up"); YYERROR; } \
|
---|
454 | while (0)
|
---|
455 |
|
---|
456 | #define YYTERROR 1
|
---|
457 | #define YYERRCODE 256
|
---|
458 |
|
---|
459 | #ifndef YYPURE
|
---|
460 | #define YYLEX yylex()
|
---|
461 | #endif
|
---|
462 |
|
---|
463 | #ifdef YYPURE
|
---|
464 | #ifdef YYLSP_NEEDED
|
---|
465 | #ifdef YYLEX_PARAM
|
---|
466 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
|
---|
467 | #else
|
---|
468 | #define YYLEX yylex(&yylval, &yylloc)
|
---|
469 | #endif
|
---|
470 | #else /* not YYLSP_NEEDED */
|
---|
471 | #ifdef YYLEX_PARAM
|
---|
472 | #define YYLEX yylex(&yylval, YYLEX_PARAM)
|
---|
473 | #else
|
---|
474 | #define YYLEX yylex(&yylval)
|
---|
475 | #endif
|
---|
476 | #endif /* not YYLSP_NEEDED */
|
---|
477 | #endif
|
---|
478 |
|
---|
479 | /* If nonreentrant, generate the variables here */
|
---|
480 |
|
---|
481 | #ifndef YYPURE
|
---|
482 |
|
---|
483 | int yychar; /* the lookahead symbol */
|
---|
484 | YYSTYPE yylval; /* the semantic value of the */
|
---|
485 | /* lookahead symbol */
|
---|
486 |
|
---|
487 | #ifdef YYLSP_NEEDED
|
---|
488 | YYLTYPE yylloc; /* location data for the lookahead */
|
---|
489 | /* symbol */
|
---|
490 | #endif
|
---|
491 |
|
---|
492 | int yynerrs; /* number of parse errors so far */
|
---|
493 | #endif /* not YYPURE */
|
---|
494 |
|
---|
495 | #if YYDEBUG != 0
|
---|
496 | int yydebug; /* nonzero means print parse trace */
|
---|
497 | /* Since this is uninitialized, it does not stop multiple parsers
|
---|
498 | from coexisting. */
|
---|
499 | #endif
|
---|
500 |
|
---|
501 | /* YYINITDEPTH indicates the initial size of the parser's stacks */
|
---|
502 |
|
---|
503 | #ifndef YYINITDEPTH
|
---|
504 | #define YYINITDEPTH 200
|
---|
505 | #endif
|
---|
506 |
|
---|
507 | /* YYMAXDEPTH is the maximum size the stacks can grow to
|
---|
508 | (effective only if the built-in stack extension method is used). */
|
---|
509 |
|
---|
510 | #if YYMAXDEPTH == 0
|
---|
511 | #undef YYMAXDEPTH
|
---|
512 | #endif
|
---|
513 |
|
---|
514 | #ifndef YYMAXDEPTH
|
---|
515 | #define YYMAXDEPTH 10000
|
---|
516 | #endif
|
---|
517 | |
---|
518 |
|
---|
519 | /* Define __yy_memcpy. Note that the size argument
|
---|
520 | should be passed with type unsigned int, because that is what the non-GCC
|
---|
521 | definitions require. With GCC, __builtin_memcpy takes an arg
|
---|
522 | of type size_t, but it can handle unsigned int. */
|
---|
523 |
|
---|
524 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
---|
525 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
---|
526 | #else /* not GNU C or C++ */
|
---|
527 | #ifndef __cplusplus
|
---|
528 |
|
---|
529 | /* This is the most reliable way to avoid incompatibilities
|
---|
530 | in available built-in functions on various systems. */
|
---|
531 | static void
|
---|
532 | __yy_memcpy (to, from, count)
|
---|
533 | char *to;
|
---|
534 | char *from;
|
---|
535 | unsigned int count;
|
---|
536 | {
|
---|
537 | register char *f = from;
|
---|
538 | register char *t = to;
|
---|
539 | register int i = count;
|
---|
540 |
|
---|
541 | while (i-- > 0)
|
---|
542 | *t++ = *f++;
|
---|
543 | }
|
---|
544 |
|
---|
545 | #else /* __cplusplus */
|
---|
546 |
|
---|
547 | /* This is the most reliable way to avoid incompatibilities
|
---|
548 | in available built-in functions on various systems. */
|
---|
549 | static void
|
---|
550 | __yy_memcpy (char *to, char *from, unsigned int count)
|
---|
551 | {
|
---|
552 | register char *t = to;
|
---|
553 | register char *f = from;
|
---|
554 | register int i = count;
|
---|
555 |
|
---|
556 | while (i-- > 0)
|
---|
557 | *t++ = *f++;
|
---|
558 | }
|
---|
559 |
|
---|
560 | #endif
|
---|
561 | #endif
|
---|
562 | |
---|
563 |
|
---|
564 | #line 217 "/usr/share/bison/bison.simple"
|
---|
565 |
|
---|
566 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
---|
567 | into yyparse. The argument should have type void *.
|
---|
568 | It should actually point to an object.
|
---|
569 | Grammar actions can access the variable by casting it
|
---|
570 | to the proper pointer type. */
|
---|
571 |
|
---|
572 | #ifdef YYPARSE_PARAM
|
---|
573 | #ifdef __cplusplus
|
---|
574 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
|
---|
575 | #define YYPARSE_PARAM_DECL
|
---|
576 | #else /* not __cplusplus */
|
---|
577 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM
|
---|
578 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
|
---|
579 | #endif /* not __cplusplus */
|
---|
580 | #else /* not YYPARSE_PARAM */
|
---|
581 | #define YYPARSE_PARAM_ARG
|
---|
582 | #define YYPARSE_PARAM_DECL
|
---|
583 | #endif /* not YYPARSE_PARAM */
|
---|
584 |
|
---|
585 | /* Prevent warning if -Wstrict-prototypes. */
|
---|
586 | #ifdef __GNUC__
|
---|
587 | #ifdef YYPARSE_PARAM
|
---|
588 | int yyparse (void *);
|
---|
589 | #else
|
---|
590 | int yyparse (void);
|
---|
591 | #endif
|
---|
592 | #endif
|
---|
593 |
|
---|
594 | int
|
---|
595 | yyparse(YYPARSE_PARAM_ARG)
|
---|
596 | YYPARSE_PARAM_DECL
|
---|
597 | {
|
---|
598 | register int yystate;
|
---|
599 | register int yyn;
|
---|
600 | register short *yyssp;
|
---|
601 | register YYSTYPE *yyvsp;
|
---|
602 | int yyerrstatus; /* number of tokens to shift before error messages enabled */
|
---|
603 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */
|
---|
604 |
|
---|
605 | short yyssa[YYINITDEPTH]; /* the state stack */
|
---|
606 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
|
---|
607 |
|
---|
608 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */
|
---|
609 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
|
---|
610 |
|
---|
611 | #ifdef YYLSP_NEEDED
|
---|
612 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
|
---|
613 | YYLTYPE *yyls = yylsa;
|
---|
614 | YYLTYPE *yylsp;
|
---|
615 |
|
---|
616 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
|
---|
617 | #else
|
---|
618 | #define YYPOPSTACK (yyvsp--, yyssp--)
|
---|
619 | #endif
|
---|
620 |
|
---|
621 | int yystacksize = YYINITDEPTH;
|
---|
622 | int yyfree_stacks = 0;
|
---|
623 |
|
---|
624 | #ifdef YYPURE
|
---|
625 | int yychar;
|
---|
626 | YYSTYPE yylval;
|
---|
627 | int yynerrs;
|
---|
628 | #ifdef YYLSP_NEEDED
|
---|
629 | YYLTYPE yylloc;
|
---|
630 | #endif
|
---|
631 | #endif
|
---|
632 |
|
---|
633 | YYSTYPE yyval; /* the variable used to return */
|
---|
634 | /* semantic values from the action */
|
---|
635 | /* routines */
|
---|
636 |
|
---|
637 | int yylen;
|
---|
638 |
|
---|
639 | #if YYDEBUG != 0
|
---|
640 | if (yydebug)
|
---|
641 | fprintf(stderr, "Starting parse\n");
|
---|
642 | #endif
|
---|
643 |
|
---|
644 | yystate = 0;
|
---|
645 | yyerrstatus = 0;
|
---|
646 | yynerrs = 0;
|
---|
647 | yychar = YYEMPTY; /* Cause a token to be read. */
|
---|
648 |
|
---|
649 | /* Initialize stack pointers.
|
---|
650 | Waste one element of value and location stack
|
---|
651 | so that they stay on the same level as the state stack.
|
---|
652 | The wasted elements are never initialized. */
|
---|
653 |
|
---|
654 | yyssp = yyss - 1;
|
---|
655 | yyvsp = yyvs;
|
---|
656 | #ifdef YYLSP_NEEDED
|
---|
657 | yylsp = yyls;
|
---|
658 | #endif
|
---|
659 |
|
---|
660 | /* Push a new state, which is found in yystate . */
|
---|
661 | /* In all cases, when you get here, the value and location stacks
|
---|
662 | have just been pushed. so pushing a state here evens the stacks. */
|
---|
663 | yynewstate:
|
---|
664 |
|
---|
665 | *++yyssp = yystate;
|
---|
666 |
|
---|
667 | if (yyssp >= yyss + yystacksize - 1)
|
---|
668 | {
|
---|
669 | /* Give user a chance to reallocate the stack */
|
---|
670 | /* Use copies of these so that the &'s don't force the real ones into memory. */
|
---|
671 | YYSTYPE *yyvs1 = yyvs;
|
---|
672 | short *yyss1 = yyss;
|
---|
673 | #ifdef YYLSP_NEEDED
|
---|
674 | YYLTYPE *yyls1 = yyls;
|
---|
675 | #endif
|
---|
676 |
|
---|
677 | /* Get the current used size of the three stacks, in elements. */
|
---|
678 | int size = yyssp - yyss + 1;
|
---|
679 |
|
---|
680 | #ifdef yyoverflow
|
---|
681 | /* Each stack pointer address is followed by the size of
|
---|
682 | the data in use in that stack, in bytes. */
|
---|
683 | #ifdef YYLSP_NEEDED
|
---|
684 | /* This used to be a conditional around just the two extra args,
|
---|
685 | but that might be undefined if yyoverflow is a macro. */
|
---|
686 | yyoverflow("parser stack overflow",
|
---|
687 | &yyss1, size * sizeof (*yyssp),
|
---|
688 | &yyvs1, size * sizeof (*yyvsp),
|
---|
689 | &yyls1, size * sizeof (*yylsp),
|
---|
690 | &yystacksize);
|
---|
691 | #else
|
---|
692 | yyoverflow("parser stack overflow",
|
---|
693 | &yyss1, size * sizeof (*yyssp),
|
---|
694 | &yyvs1, size * sizeof (*yyvsp),
|
---|
695 | &yystacksize);
|
---|
696 | #endif
|
---|
697 |
|
---|
698 | yyss = yyss1; yyvs = yyvs1;
|
---|
699 | #ifdef YYLSP_NEEDED
|
---|
700 | yyls = yyls1;
|
---|
701 | #endif
|
---|
702 | #else /* no yyoverflow */
|
---|
703 | /* Extend the stack our own way. */
|
---|
704 | if (yystacksize >= YYMAXDEPTH)
|
---|
705 | {
|
---|
706 | yyerror("parser stack overflow");
|
---|
707 | if (yyfree_stacks)
|
---|
708 | {
|
---|
709 | free (yyss);
|
---|
710 | free (yyvs);
|
---|
711 | #ifdef YYLSP_NEEDED
|
---|
712 | free (yyls);
|
---|
713 | #endif
|
---|
714 | }
|
---|
715 | return 2;
|
---|
716 | }
|
---|
717 | yystacksize *= 2;
|
---|
718 | if (yystacksize > YYMAXDEPTH)
|
---|
719 | yystacksize = YYMAXDEPTH;
|
---|
720 | #ifndef YYSTACK_USE_ALLOCA
|
---|
721 | yyfree_stacks = 1;
|
---|
722 | #endif
|
---|
723 | yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
|
---|
724 | __yy_memcpy ((char *)yyss, (char *)yyss1,
|
---|
725 | size * (unsigned int) sizeof (*yyssp));
|
---|
726 | yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
|
---|
727 | __yy_memcpy ((char *)yyvs, (char *)yyvs1,
|
---|
728 | size * (unsigned int) sizeof (*yyvsp));
|
---|
729 | #ifdef YYLSP_NEEDED
|
---|
730 | yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
|
---|
731 | __yy_memcpy ((char *)yyls, (char *)yyls1,
|
---|
732 | size * (unsigned int) sizeof (*yylsp));
|
---|
733 | #endif
|
---|
734 | #endif /* no yyoverflow */
|
---|
735 |
|
---|
736 | yyssp = yyss + size - 1;
|
---|
737 | yyvsp = yyvs + size - 1;
|
---|
738 | #ifdef YYLSP_NEEDED
|
---|
739 | yylsp = yyls + size - 1;
|
---|
740 | #endif
|
---|
741 |
|
---|
742 | #if YYDEBUG != 0
|
---|
743 | if (yydebug)
|
---|
744 | fprintf(stderr, "Stack size increased to %d\n", yystacksize);
|
---|
745 | #endif
|
---|
746 |
|
---|
747 | if (yyssp >= yyss + yystacksize - 1)
|
---|
748 | YYABORT;
|
---|
749 | }
|
---|
750 |
|
---|
751 | #if YYDEBUG != 0
|
---|
752 | if (yydebug)
|
---|
753 | fprintf(stderr, "Entering state %d\n", yystate);
|
---|
754 | #endif
|
---|
755 |
|
---|
756 | goto yybackup;
|
---|
757 | yybackup:
|
---|
758 |
|
---|
759 | /* Do appropriate processing given the current state. */
|
---|
760 | /* Read a lookahead token if we need one and don't already have one. */
|
---|
761 | /* yyresume: */
|
---|
762 |
|
---|
763 | /* First try to decide what to do without reference to lookahead token. */
|
---|
764 |
|
---|
765 | yyn = yypact[yystate];
|
---|
766 | if (yyn == YYFLAG)
|
---|
767 | goto yydefault;
|
---|
768 |
|
---|
769 | /* Not known => get a lookahead token if don't already have one. */
|
---|
770 |
|
---|
771 | /* yychar is either YYEMPTY or YYEOF
|
---|
772 | or a valid token in external form. */
|
---|
773 |
|
---|
774 | if (yychar == YYEMPTY)
|
---|
775 | {
|
---|
776 | #if YYDEBUG != 0
|
---|
777 | if (yydebug)
|
---|
778 | fprintf(stderr, "Reading a token: ");
|
---|
779 | #endif
|
---|
780 | yychar = YYLEX;
|
---|
781 | }
|
---|
782 |
|
---|
783 | /* Convert token to internal form (in yychar1) for indexing tables with */
|
---|
784 |
|
---|
785 | if (yychar <= 0) /* This means end of input. */
|
---|
786 | {
|
---|
787 | yychar1 = 0;
|
---|
788 | yychar = YYEOF; /* Don't call YYLEX any more */
|
---|
789 |
|
---|
790 | #if YYDEBUG != 0
|
---|
791 | if (yydebug)
|
---|
792 | fprintf(stderr, "Now at end of input.\n");
|
---|
793 | #endif
|
---|
794 | }
|
---|
795 | else
|
---|
796 | {
|
---|
797 | yychar1 = YYTRANSLATE(yychar);
|
---|
798 |
|
---|
799 | #if YYDEBUG != 0
|
---|
800 | if (yydebug)
|
---|
801 | {
|
---|
802 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
|
---|
803 | /* Give the individual parser a way to print the precise meaning
|
---|
804 | of a token, for further debugging info. */
|
---|
805 | #ifdef YYPRINT
|
---|
806 | YYPRINT (stderr, yychar, yylval);
|
---|
807 | #endif
|
---|
808 | fprintf (stderr, ")\n");
|
---|
809 | }
|
---|
810 | #endif
|
---|
811 | }
|
---|
812 |
|
---|
813 | yyn += yychar1;
|
---|
814 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
|
---|
815 | goto yydefault;
|
---|
816 |
|
---|
817 | yyn = yytable[yyn];
|
---|
818 |
|
---|
819 | /* yyn is what to do for this token type in this state.
|
---|
820 | Negative => reduce, -yyn is rule number.
|
---|
821 | Positive => shift, yyn is new state.
|
---|
822 | New state is final state => don't bother to shift,
|
---|
823 | just return success.
|
---|
824 | 0, or most negative number => error. */
|
---|
825 |
|
---|
826 | if (yyn < 0)
|
---|
827 | {
|
---|
828 | if (yyn == YYFLAG)
|
---|
829 | goto yyerrlab;
|
---|
830 | yyn = -yyn;
|
---|
831 | goto yyreduce;
|
---|
832 | }
|
---|
833 | else if (yyn == 0)
|
---|
834 | goto yyerrlab;
|
---|
835 |
|
---|
836 | if (yyn == YYFINAL)
|
---|
837 | YYACCEPT;
|
---|
838 |
|
---|
839 | /* Shift the lookahead token. */
|
---|
840 |
|
---|
841 | #if YYDEBUG != 0
|
---|
842 | if (yydebug)
|
---|
843 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
|
---|
844 | #endif
|
---|
845 |
|
---|
846 | /* Discard the token being shifted unless it is eof. */
|
---|
847 | if (yychar != YYEOF)
|
---|
848 | yychar = YYEMPTY;
|
---|
849 |
|
---|
850 | *++yyvsp = yylval;
|
---|
851 | #ifdef YYLSP_NEEDED
|
---|
852 | *++yylsp = yylloc;
|
---|
853 | #endif
|
---|
854 |
|
---|
855 | /* count tokens shifted since error; after three, turn off error status. */
|
---|
856 | if (yyerrstatus) yyerrstatus--;
|
---|
857 |
|
---|
858 | yystate = yyn;
|
---|
859 | goto yynewstate;
|
---|
860 |
|
---|
861 | /* Do the default action for the current state. */
|
---|
862 | yydefault:
|
---|
863 |
|
---|
864 | yyn = yydefact[yystate];
|
---|
865 | if (yyn == 0)
|
---|
866 | goto yyerrlab;
|
---|
867 |
|
---|
868 | /* Do a reduction. yyn is the number of a rule to reduce with. */
|
---|
869 | yyreduce:
|
---|
870 | yylen = yyr2[yyn];
|
---|
871 | if (yylen > 0)
|
---|
872 | yyval = yyvsp[1-yylen]; /* implement default value of the action */
|
---|
873 |
|
---|
874 | #if YYDEBUG != 0
|
---|
875 | if (yydebug)
|
---|
876 | {
|
---|
877 | int i;
|
---|
878 |
|
---|
879 | fprintf (stderr, "Reducing via rule %d (line %d), ",
|
---|
880 | yyn, yyrline[yyn]);
|
---|
881 |
|
---|
882 | /* Print the symbols being reduced, and their result. */
|
---|
883 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
|
---|
884 | fprintf (stderr, "%s ", yytname[yyrhs[i]]);
|
---|
885 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
|
---|
886 | }
|
---|
887 | #endif
|
---|
888 |
|
---|
889 |
|
---|
890 | switch (yyn) {
|
---|
891 |
|
---|
892 | case 4:
|
---|
893 | #line 126 "m68k-parse.y"
|
---|
894 | {
|
---|
895 | op->mode = DREG;
|
---|
896 | op->reg = yyvsp[0].reg;
|
---|
897 | ;
|
---|
898 | break;}
|
---|
899 | case 5:
|
---|
900 | #line 131 "m68k-parse.y"
|
---|
901 | {
|
---|
902 | op->mode = AREG;
|
---|
903 | op->reg = yyvsp[0].reg;
|
---|
904 | ;
|
---|
905 | break;}
|
---|
906 | case 6:
|
---|
907 | #line 136 "m68k-parse.y"
|
---|
908 | {
|
---|
909 | op->mode = FPREG;
|
---|
910 | op->reg = yyvsp[0].reg;
|
---|
911 | ;
|
---|
912 | break;}
|
---|
913 | case 7:
|
---|
914 | #line 141 "m68k-parse.y"
|
---|
915 | {
|
---|
916 | op->mode = CONTROL;
|
---|
917 | op->reg = yyvsp[0].reg;
|
---|
918 | ;
|
---|
919 | break;}
|
---|
920 | case 8:
|
---|
921 | #line 146 "m68k-parse.y"
|
---|
922 | {
|
---|
923 | op->mode = CONTROL;
|
---|
924 | op->reg = yyvsp[0].reg;
|
---|
925 | ;
|
---|
926 | break;}
|
---|
927 | case 9:
|
---|
928 | #line 151 "m68k-parse.y"
|
---|
929 | {
|
---|
930 | op->mode = ABSL;
|
---|
931 | op->disp = yyvsp[0].exp;
|
---|
932 | ;
|
---|
933 | break;}
|
---|
934 | case 10:
|
---|
935 | #line 156 "m68k-parse.y"
|
---|
936 | {
|
---|
937 | op->mode = IMMED;
|
---|
938 | op->disp = yyvsp[0].exp;
|
---|
939 | ;
|
---|
940 | break;}
|
---|
941 | case 11:
|
---|
942 | #line 161 "m68k-parse.y"
|
---|
943 | {
|
---|
944 | op->mode = IMMED;
|
---|
945 | op->disp = yyvsp[0].exp;
|
---|
946 | ;
|
---|
947 | break;}
|
---|
948 | case 12:
|
---|
949 | #line 166 "m68k-parse.y"
|
---|
950 | {
|
---|
951 | op->mode = REGLST;
|
---|
952 | op->mask = yyvsp[0].mask;
|
---|
953 | ;
|
---|
954 | break;}
|
---|
955 | case 13:
|
---|
956 | #line 179 "m68k-parse.y"
|
---|
957 | {
|
---|
958 | op->mode = AINDR;
|
---|
959 | op->reg = yyvsp[-1].reg;
|
---|
960 | ;
|
---|
961 | break;}
|
---|
962 | case 14:
|
---|
963 | #line 184 "m68k-parse.y"
|
---|
964 | {
|
---|
965 | op->mode = AINC;
|
---|
966 | op->reg = yyvsp[-2].reg;
|
---|
967 | ;
|
---|
968 | break;}
|
---|
969 | case 15:
|
---|
970 | #line 189 "m68k-parse.y"
|
---|
971 | {
|
---|
972 | op->mode = ADEC;
|
---|
973 | op->reg = yyvsp[-1].reg;
|
---|
974 | ;
|
---|
975 | break;}
|
---|
976 | case 16:
|
---|
977 | #line 194 "m68k-parse.y"
|
---|
978 | {
|
---|
979 | op->reg = yyvsp[-1].reg;
|
---|
980 | op->disp = yyvsp[-3].exp;
|
---|
981 | if ((yyvsp[-1].reg >= ZADDR0 && yyvsp[-1].reg <= ZADDR7)
|
---|
982 | || yyvsp[-1].reg == ZPC)
|
---|
983 | op->mode = BASE;
|
---|
984 | else
|
---|
985 | op->mode = DISP;
|
---|
986 | ;
|
---|
987 | break;}
|
---|
988 | case 17:
|
---|
989 | #line 204 "m68k-parse.y"
|
---|
990 | {
|
---|
991 | op->reg = yyvsp[-3].reg;
|
---|
992 | op->disp = yyvsp[-1].exp;
|
---|
993 | if ((yyvsp[-3].reg >= ZADDR0 && yyvsp[-3].reg <= ZADDR7)
|
---|
994 | || yyvsp[-3].reg == ZPC)
|
---|
995 | op->mode = BASE;
|
---|
996 | else
|
---|
997 | op->mode = DISP;
|
---|
998 | ;
|
---|
999 | break;}
|
---|
1000 | case 18:
|
---|
1001 | #line 214 "m68k-parse.y"
|
---|
1002 | {
|
---|
1003 | op->reg = yyvsp[-1].reg;
|
---|
1004 | op->disp = yyvsp[-3].exp;
|
---|
1005 | if ((yyvsp[-1].reg >= ZADDR0 && yyvsp[-1].reg <= ZADDR7)
|
---|
1006 | || yyvsp[-1].reg == ZPC)
|
---|
1007 | op->mode = BASE;
|
---|
1008 | else
|
---|
1009 | op->mode = DISP;
|
---|
1010 | ;
|
---|
1011 | break;}
|
---|
1012 | case 19:
|
---|
1013 | #line 224 "m68k-parse.y"
|
---|
1014 | {
|
---|
1015 | op->mode = DISP;
|
---|
1016 | op->reg = yyvsp[-1].reg;
|
---|
1017 | ;
|
---|
1018 | break;}
|
---|
1019 | case 20:
|
---|
1020 | #line 229 "m68k-parse.y"
|
---|
1021 | {
|
---|
1022 | op->mode = BASE;
|
---|
1023 | op->reg = yyvsp[-1].reg;
|
---|
1024 | ;
|
---|
1025 | break;}
|
---|
1026 | case 21:
|
---|
1027 | #line 234 "m68k-parse.y"
|
---|
1028 | {
|
---|
1029 | op->mode = BASE;
|
---|
1030 | op->reg = yyvsp[-1].reg;
|
---|
1031 | ;
|
---|
1032 | break;}
|
---|
1033 | case 22:
|
---|
1034 | #line 239 "m68k-parse.y"
|
---|
1035 | {
|
---|
1036 | op->mode = BASE;
|
---|
1037 | op->reg = yyvsp[-3].reg;
|
---|
1038 | op->disp = yyvsp[-5].exp;
|
---|
1039 | op->index = yyvsp[-1].indexreg;
|
---|
1040 | ;
|
---|
1041 | break;}
|
---|
1042 | case 23:
|
---|
1043 | #line 246 "m68k-parse.y"
|
---|
1044 | {
|
---|
1045 | if (yyvsp[-3].reg == PC || yyvsp[-3].reg == ZPC)
|
---|
1046 | yyerror (_("syntax error"));
|
---|
1047 | op->mode = BASE;
|
---|
1048 | op->reg = yyvsp[-1].reg;
|
---|
1049 | op->disp = yyvsp[-5].exp;
|
---|
1050 | op->index.reg = yyvsp[-3].reg;
|
---|
1051 | op->index.size = SIZE_UNSPEC;
|
---|
1052 | op->index.scale = 1;
|
---|
1053 | ;
|
---|
1054 | break;}
|
---|
1055 | case 24:
|
---|
1056 | #line 257 "m68k-parse.y"
|
---|
1057 | {
|
---|
1058 | op->mode = BASE;
|
---|
1059 | op->reg = yyvsp[-1].reg;
|
---|
1060 | op->disp = yyvsp[-4].exp;
|
---|
1061 | op->index = yyvsp[-2].indexreg;
|
---|
1062 | ;
|
---|
1063 | break;}
|
---|
1064 | case 25:
|
---|
1065 | #line 264 "m68k-parse.y"
|
---|
1066 | {
|
---|
1067 | op->mode = BASE;
|
---|
1068 | op->disp = yyvsp[-1].exp;
|
---|
1069 | op->index = yyvsp[-3].indexreg;
|
---|
1070 | ;
|
---|
1071 | break;}
|
---|
1072 | case 26:
|
---|
1073 | #line 270 "m68k-parse.y"
|
---|
1074 | {
|
---|
1075 | op->mode = BASE;
|
---|
1076 | op->reg = yyvsp[-3].reg;
|
---|
1077 | op->disp = yyvsp[-5].exp;
|
---|
1078 | op->index = yyvsp[-1].indexreg;
|
---|
1079 | ;
|
---|
1080 | break;}
|
---|
1081 | case 27:
|
---|
1082 | #line 277 "m68k-parse.y"
|
---|
1083 | {
|
---|
1084 | op->mode = BASE;
|
---|
1085 | op->reg = yyvsp[-3].reg;
|
---|
1086 | op->index = yyvsp[-1].indexreg;
|
---|
1087 | ;
|
---|
1088 | break;}
|
---|
1089 | case 28:
|
---|
1090 | #line 283 "m68k-parse.y"
|
---|
1091 | {
|
---|
1092 | if (yyvsp[-3].reg == PC || yyvsp[-3].reg == ZPC)
|
---|
1093 | yyerror (_("syntax error"));
|
---|
1094 | op->mode = BASE;
|
---|
1095 | op->reg = yyvsp[-1].reg;
|
---|
1096 | op->disp = yyvsp[-5].exp;
|
---|
1097 | op->index.reg = yyvsp[-3].reg;
|
---|
1098 | op->index.size = SIZE_UNSPEC;
|
---|
1099 | op->index.scale = 1;
|
---|
1100 | ;
|
---|
1101 | break;}
|
---|
1102 | case 29:
|
---|
1103 | #line 294 "m68k-parse.y"
|
---|
1104 | {
|
---|
1105 | if (yyvsp[-3].reg == PC || yyvsp[-3].reg == ZPC)
|
---|
1106 | yyerror (_("syntax error"));
|
---|
1107 | op->mode = BASE;
|
---|
1108 | op->reg = yyvsp[-1].reg;
|
---|
1109 | op->index.reg = yyvsp[-3].reg;
|
---|
1110 | op->index.size = SIZE_UNSPEC;
|
---|
1111 | op->index.scale = 1;
|
---|
1112 | ;
|
---|
1113 | break;}
|
---|
1114 | case 30:
|
---|
1115 | #line 304 "m68k-parse.y"
|
---|
1116 | {
|
---|
1117 | op->mode = BASE;
|
---|
1118 | op->reg = yyvsp[-1].reg;
|
---|
1119 | op->disp = yyvsp[-4].exp;
|
---|
1120 | op->index = yyvsp[-2].indexreg;
|
---|
1121 | ;
|
---|
1122 | break;}
|
---|
1123 | case 31:
|
---|
1124 | #line 311 "m68k-parse.y"
|
---|
1125 | {
|
---|
1126 | op->mode = BASE;
|
---|
1127 | op->reg = yyvsp[-1].reg;
|
---|
1128 | op->index = yyvsp[-2].indexreg;
|
---|
1129 | ;
|
---|
1130 | break;}
|
---|
1131 | case 32:
|
---|
1132 | #line 317 "m68k-parse.y"
|
---|
1133 | {
|
---|
1134 | op->mode = POST;
|
---|
1135 | op->reg = yyvsp[-5].reg;
|
---|
1136 | op->disp = yyvsp[-6].exp;
|
---|
1137 | op->index = yyvsp[-2].indexreg;
|
---|
1138 | op->odisp = yyvsp[-1].exp;
|
---|
1139 | ;
|
---|
1140 | break;}
|
---|
1141 | case 33:
|
---|
1142 | #line 325 "m68k-parse.y"
|
---|
1143 | {
|
---|
1144 | op->mode = POST;
|
---|
1145 | op->reg = yyvsp[-3].reg;
|
---|
1146 | op->disp = yyvsp[-4].exp;
|
---|
1147 | op->odisp = yyvsp[-1].exp;
|
---|
1148 | ;
|
---|
1149 | break;}
|
---|
1150 | case 34:
|
---|
1151 | #line 332 "m68k-parse.y"
|
---|
1152 | {
|
---|
1153 | op->mode = POST;
|
---|
1154 | op->reg = yyvsp[-5].reg;
|
---|
1155 | op->index = yyvsp[-2].indexreg;
|
---|
1156 | op->odisp = yyvsp[-1].exp;
|
---|
1157 | ;
|
---|
1158 | break;}
|
---|
1159 | case 35:
|
---|
1160 | #line 339 "m68k-parse.y"
|
---|
1161 | {
|
---|
1162 | op->mode = POST;
|
---|
1163 | op->reg = yyvsp[-3].reg;
|
---|
1164 | op->odisp = yyvsp[-1].exp;
|
---|
1165 | ;
|
---|
1166 | break;}
|
---|
1167 | case 36:
|
---|
1168 | #line 345 "m68k-parse.y"
|
---|
1169 | {
|
---|
1170 | op->mode = PRE;
|
---|
1171 | op->reg = yyvsp[-5].reg;
|
---|
1172 | op->disp = yyvsp[-7].exp;
|
---|
1173 | op->index = yyvsp[-3].indexreg;
|
---|
1174 | op->odisp = yyvsp[-1].exp;
|
---|
1175 | ;
|
---|
1176 | break;}
|
---|
1177 | case 37:
|
---|
1178 | #line 353 "m68k-parse.y"
|
---|
1179 | {
|
---|
1180 | op->mode = PRE;
|
---|
1181 | op->reg = yyvsp[-5].reg;
|
---|
1182 | op->index = yyvsp[-3].indexreg;
|
---|
1183 | op->odisp = yyvsp[-1].exp;
|
---|
1184 | ;
|
---|
1185 | break;}
|
---|
1186 | case 38:
|
---|
1187 | #line 360 "m68k-parse.y"
|
---|
1188 | {
|
---|
1189 | if (yyvsp[-5].reg == PC || yyvsp[-5].reg == ZPC)
|
---|
1190 | yyerror (_("syntax error"));
|
---|
1191 | op->mode = PRE;
|
---|
1192 | op->reg = yyvsp[-3].reg;
|
---|
1193 | op->disp = yyvsp[-7].exp;
|
---|
1194 | op->index.reg = yyvsp[-5].reg;
|
---|
1195 | op->index.size = SIZE_UNSPEC;
|
---|
1196 | op->index.scale = 1;
|
---|
1197 | op->odisp = yyvsp[-1].exp;
|
---|
1198 | ;
|
---|
1199 | break;}
|
---|
1200 | case 39:
|
---|
1201 | #line 372 "m68k-parse.y"
|
---|
1202 | {
|
---|
1203 | if (yyvsp[-5].reg == PC || yyvsp[-5].reg == ZPC)
|
---|
1204 | yyerror (_("syntax error"));
|
---|
1205 | op->mode = PRE;
|
---|
1206 | op->reg = yyvsp[-3].reg;
|
---|
1207 | op->index.reg = yyvsp[-5].reg;
|
---|
1208 | op->index.size = SIZE_UNSPEC;
|
---|
1209 | op->index.scale = 1;
|
---|
1210 | op->odisp = yyvsp[-1].exp;
|
---|
1211 | ;
|
---|
1212 | break;}
|
---|
1213 | case 40:
|
---|
1214 | #line 383 "m68k-parse.y"
|
---|
1215 | {
|
---|
1216 | op->mode = PRE;
|
---|
1217 | op->reg = yyvsp[-3].reg;
|
---|
1218 | op->disp = yyvsp[-5].exp;
|
---|
1219 | op->index = yyvsp[-4].indexreg;
|
---|
1220 | op->odisp = yyvsp[-1].exp;
|
---|
1221 | ;
|
---|
1222 | break;}
|
---|
1223 | case 41:
|
---|
1224 | #line 396 "m68k-parse.y"
|
---|
1225 | {
|
---|
1226 | /* We use optzapc to avoid a shift/reduce conflict. */
|
---|
1227 | if (yyvsp[-1].reg < ADDR0 || yyvsp[-1].reg > ADDR7)
|
---|
1228 | yyerror (_("syntax error"));
|
---|
1229 | op->mode = AINDR;
|
---|
1230 | op->reg = yyvsp[-1].reg;
|
---|
1231 | ;
|
---|
1232 | break;}
|
---|
1233 | case 42:
|
---|
1234 | #line 404 "m68k-parse.y"
|
---|
1235 | {
|
---|
1236 | /* We use optzapc to avoid a shift/reduce conflict. */
|
---|
1237 | if (yyvsp[-2].reg < ADDR0 || yyvsp[-2].reg > ADDR7)
|
---|
1238 | yyerror (_("syntax error"));
|
---|
1239 | op->mode = AINC;
|
---|
1240 | op->reg = yyvsp[-2].reg;
|
---|
1241 | ;
|
---|
1242 | break;}
|
---|
1243 | case 43:
|
---|
1244 | #line 412 "m68k-parse.y"
|
---|
1245 | {
|
---|
1246 | /* We use optzapc to avoid a shift/reduce conflict. */
|
---|
1247 | if (yyvsp[-2].reg < ADDR0 || yyvsp[-2].reg > ADDR7)
|
---|
1248 | yyerror (_("syntax error"));
|
---|
1249 | op->mode = ADEC;
|
---|
1250 | op->reg = yyvsp[-2].reg;
|
---|
1251 | ;
|
---|
1252 | break;}
|
---|
1253 | case 44:
|
---|
1254 | #line 420 "m68k-parse.y"
|
---|
1255 | {
|
---|
1256 | op->reg = yyvsp[-4].reg;
|
---|
1257 | op->disp = yyvsp[-1].exp;
|
---|
1258 | if ((yyvsp[-4].reg >= ZADDR0 && yyvsp[-4].reg <= ZADDR7)
|
---|
1259 | || yyvsp[-4].reg == ZPC)
|
---|
1260 | op->mode = BASE;
|
---|
1261 | else
|
---|
1262 | op->mode = DISP;
|
---|
1263 | ;
|
---|
1264 | break;}
|
---|
1265 | case 45:
|
---|
1266 | #line 430 "m68k-parse.y"
|
---|
1267 | {
|
---|
1268 | op->mode = BASE;
|
---|
1269 | op->reg = yyvsp[-5].reg;
|
---|
1270 | op->disp = yyvsp[-2].exp;
|
---|
1271 | op->index = yyvsp[-1].indexreg;
|
---|
1272 | ;
|
---|
1273 | break;}
|
---|
1274 | case 46:
|
---|
1275 | #line 437 "m68k-parse.y"
|
---|
1276 | {
|
---|
1277 | op->mode = POST;
|
---|
1278 | op->reg = yyvsp[-9].reg;
|
---|
1279 | op->disp = yyvsp[-6].exp;
|
---|
1280 | op->index = yyvsp[-1].indexreg;
|
---|
1281 | op->odisp = yyvsp[-2].exp;
|
---|
1282 | ;
|
---|
1283 | break;}
|
---|
1284 | case 47:
|
---|
1285 | #line 445 "m68k-parse.y"
|
---|
1286 | {
|
---|
1287 | op->mode = POST;
|
---|
1288 | op->reg = yyvsp[-8].reg;
|
---|
1289 | op->disp = yyvsp[-5].exp;
|
---|
1290 | op->odisp = yyvsp[-1].exp;
|
---|
1291 | ;
|
---|
1292 | break;}
|
---|
1293 | case 48:
|
---|
1294 | #line 452 "m68k-parse.y"
|
---|
1295 | {
|
---|
1296 | op->mode = PRE;
|
---|
1297 | op->reg = yyvsp[-9].reg;
|
---|
1298 | op->disp = yyvsp[-6].exp;
|
---|
1299 | op->index = yyvsp[-5].indexreg;
|
---|
1300 | op->odisp = yyvsp[-1].exp;
|
---|
1301 | ;
|
---|
1302 | break;}
|
---|
1303 | case 50:
|
---|
1304 | #line 467 "m68k-parse.y"
|
---|
1305 | {
|
---|
1306 | yyval.indexreg.reg = yyvsp[0].reg;
|
---|
1307 | yyval.indexreg.size = SIZE_UNSPEC;
|
---|
1308 | yyval.indexreg.scale = 1;
|
---|
1309 | ;
|
---|
1310 | break;}
|
---|
1311 | case 52:
|
---|
1312 | #line 481 "m68k-parse.y"
|
---|
1313 | {
|
---|
1314 | yyval.indexreg.reg = yyvsp[0].reg;
|
---|
1315 | yyval.indexreg.size = SIZE_UNSPEC;
|
---|
1316 | yyval.indexreg.scale = 1;
|
---|
1317 | ;
|
---|
1318 | break;}
|
---|
1319 | case 63:
|
---|
1320 | #line 524 "m68k-parse.y"
|
---|
1321 | {
|
---|
1322 | yyval.reg = ZADDR0;
|
---|
1323 | ;
|
---|
1324 | break;}
|
---|
1325 | case 67:
|
---|
1326 | #line 541 "m68k-parse.y"
|
---|
1327 | {
|
---|
1328 | yyval.reg = ZADDR0;
|
---|
1329 | ;
|
---|
1330 | break;}
|
---|
1331 | case 68:
|
---|
1332 | #line 545 "m68k-parse.y"
|
---|
1333 | {
|
---|
1334 | yyval.reg = yyvsp[0].reg;
|
---|
1335 | ;
|
---|
1336 | break;}
|
---|
1337 | case 69:
|
---|
1338 | #line 554 "m68k-parse.y"
|
---|
1339 | {
|
---|
1340 | yyval.exp.exp.X_op = O_absent;
|
---|
1341 | yyval.exp.size = SIZE_UNSPEC;
|
---|
1342 | ;
|
---|
1343 | break;}
|
---|
1344 | case 70:
|
---|
1345 | #line 559 "m68k-parse.y"
|
---|
1346 | {
|
---|
1347 | yyval.exp = yyvsp[0].exp;
|
---|
1348 | ;
|
---|
1349 | break;}
|
---|
1350 | case 71:
|
---|
1351 | #line 568 "m68k-parse.y"
|
---|
1352 | {
|
---|
1353 | yyval.exp.exp.X_op = O_absent;
|
---|
1354 | yyval.exp.size = SIZE_UNSPEC;
|
---|
1355 | ;
|
---|
1356 | break;}
|
---|
1357 | case 72:
|
---|
1358 | #line 573 "m68k-parse.y"
|
---|
1359 | {
|
---|
1360 | yyval.exp = yyvsp[-1].exp;
|
---|
1361 | ;
|
---|
1362 | break;}
|
---|
1363 | case 74:
|
---|
1364 | #line 583 "m68k-parse.y"
|
---|
1365 | {
|
---|
1366 | yyval.mask = yyvsp[-2].mask | yyvsp[0].mask;
|
---|
1367 | ;
|
---|
1368 | break;}
|
---|
1369 | case 75:
|
---|
1370 | #line 587 "m68k-parse.y"
|
---|
1371 | {
|
---|
1372 | yyval.mask = (1 << yyvsp[-2].onereg) | yyvsp[0].mask;
|
---|
1373 | ;
|
---|
1374 | break;}
|
---|
1375 | case 76:
|
---|
1376 | #line 599 "m68k-parse.y"
|
---|
1377 | {
|
---|
1378 | yyval.mask = 1 << yyvsp[0].onereg;
|
---|
1379 | ;
|
---|
1380 | break;}
|
---|
1381 | case 78:
|
---|
1382 | #line 604 "m68k-parse.y"
|
---|
1383 | {
|
---|
1384 | yyval.mask = yyvsp[-2].mask | yyvsp[0].mask;
|
---|
1385 | ;
|
---|
1386 | break;}
|
---|
1387 | case 79:
|
---|
1388 | #line 608 "m68k-parse.y"
|
---|
1389 | {
|
---|
1390 | yyval.mask = (1 << yyvsp[-2].onereg) | yyvsp[0].mask;
|
---|
1391 | ;
|
---|
1392 | break;}
|
---|
1393 | case 80:
|
---|
1394 | #line 615 "m68k-parse.y"
|
---|
1395 | {
|
---|
1396 | if (yyvsp[-2].onereg <= yyvsp[0].onereg)
|
---|
1397 | yyval.mask = (1 << (yyvsp[0].onereg + 1)) - 1 - ((1 << yyvsp[-2].onereg) - 1);
|
---|
1398 | else
|
---|
1399 | yyval.mask = (1 << (yyvsp[-2].onereg + 1)) - 1 - ((1 << yyvsp[0].onereg) - 1);
|
---|
1400 | ;
|
---|
1401 | break;}
|
---|
1402 | case 81:
|
---|
1403 | #line 625 "m68k-parse.y"
|
---|
1404 | {
|
---|
1405 | yyval.onereg = yyvsp[0].reg - DATA0;
|
---|
1406 | ;
|
---|
1407 | break;}
|
---|
1408 | case 82:
|
---|
1409 | #line 629 "m68k-parse.y"
|
---|
1410 | {
|
---|
1411 | yyval.onereg = yyvsp[0].reg - ADDR0 + 8;
|
---|
1412 | ;
|
---|
1413 | break;}
|
---|
1414 | case 83:
|
---|
1415 | #line 633 "m68k-parse.y"
|
---|
1416 | {
|
---|
1417 | yyval.onereg = yyvsp[0].reg - FP0 + 16;
|
---|
1418 | ;
|
---|
1419 | break;}
|
---|
1420 | case 84:
|
---|
1421 | #line 637 "m68k-parse.y"
|
---|
1422 | {
|
---|
1423 | if (yyvsp[0].reg == FPI)
|
---|
1424 | yyval.onereg = 24;
|
---|
1425 | else if (yyvsp[0].reg == FPS)
|
---|
1426 | yyval.onereg = 25;
|
---|
1427 | else
|
---|
1428 | yyval.onereg = 26;
|
---|
1429 | ;
|
---|
1430 | break;}
|
---|
1431 | }
|
---|
1432 | /* the action file gets copied in in place of this dollarsign */
|
---|
1433 | #line 543 "/usr/share/bison/bison.simple"
|
---|
1434 | |
---|
1435 |
|
---|
1436 | yyvsp -= yylen;
|
---|
1437 | yyssp -= yylen;
|
---|
1438 | #ifdef YYLSP_NEEDED
|
---|
1439 | yylsp -= yylen;
|
---|
1440 | #endif
|
---|
1441 |
|
---|
1442 | #if YYDEBUG != 0
|
---|
1443 | if (yydebug)
|
---|
1444 | {
|
---|
1445 | short *ssp1 = yyss - 1;
|
---|
1446 | fprintf (stderr, "state stack now");
|
---|
1447 | while (ssp1 != yyssp)
|
---|
1448 | fprintf (stderr, " %d", *++ssp1);
|
---|
1449 | fprintf (stderr, "\n");
|
---|
1450 | }
|
---|
1451 | #endif
|
---|
1452 |
|
---|
1453 | *++yyvsp = yyval;
|
---|
1454 |
|
---|
1455 | #ifdef YYLSP_NEEDED
|
---|
1456 | yylsp++;
|
---|
1457 | if (yylen == 0)
|
---|
1458 | {
|
---|
1459 | yylsp->first_line = yylloc.first_line;
|
---|
1460 | yylsp->first_column = yylloc.first_column;
|
---|
1461 | yylsp->last_line = (yylsp-1)->last_line;
|
---|
1462 | yylsp->last_column = (yylsp-1)->last_column;
|
---|
1463 | yylsp->text = 0;
|
---|
1464 | }
|
---|
1465 | else
|
---|
1466 | {
|
---|
1467 | yylsp->last_line = (yylsp+yylen-1)->last_line;
|
---|
1468 | yylsp->last_column = (yylsp+yylen-1)->last_column;
|
---|
1469 | }
|
---|
1470 | #endif
|
---|
1471 |
|
---|
1472 | /* Now "shift" the result of the reduction.
|
---|
1473 | Determine what state that goes to,
|
---|
1474 | based on the state we popped back to
|
---|
1475 | and the rule number reduced by. */
|
---|
1476 |
|
---|
1477 | yyn = yyr1[yyn];
|
---|
1478 |
|
---|
1479 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
|
---|
1480 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
|
---|
1481 | yystate = yytable[yystate];
|
---|
1482 | else
|
---|
1483 | yystate = yydefgoto[yyn - YYNTBASE];
|
---|
1484 |
|
---|
1485 | goto yynewstate;
|
---|
1486 |
|
---|
1487 | yyerrlab: /* here on detecting error */
|
---|
1488 |
|
---|
1489 | if (! yyerrstatus)
|
---|
1490 | /* If not already recovering from an error, report this error. */
|
---|
1491 | {
|
---|
1492 | ++yynerrs;
|
---|
1493 |
|
---|
1494 | #ifdef YYERROR_VERBOSE
|
---|
1495 | yyn = yypact[yystate];
|
---|
1496 |
|
---|
1497 | if (yyn > YYFLAG && yyn < YYLAST)
|
---|
1498 | {
|
---|
1499 | int size = 0;
|
---|
1500 | char *msg;
|
---|
1501 | int x, count;
|
---|
1502 |
|
---|
1503 | count = 0;
|
---|
1504 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
|
---|
1505 | for (x = (yyn < 0 ? -yyn : 0);
|
---|
1506 | x < (sizeof(yytname) / sizeof(char *)); x++)
|
---|
1507 | if (yycheck[x + yyn] == x)
|
---|
1508 | size += strlen(yytname[x]) + 15, count++;
|
---|
1509 | msg = (char *) malloc(size + 15);
|
---|
1510 | if (msg != 0)
|
---|
1511 | {
|
---|
1512 | strcpy(msg, "parse error");
|
---|
1513 |
|
---|
1514 | if (count < 5)
|
---|
1515 | {
|
---|
1516 | count = 0;
|
---|
1517 | for (x = (yyn < 0 ? -yyn : 0);
|
---|
1518 | x < (sizeof(yytname) / sizeof(char *)); x++)
|
---|
1519 | if (yycheck[x + yyn] == x)
|
---|
1520 | {
|
---|
1521 | strcat(msg, count == 0 ? ", expecting `" : " or `");
|
---|
1522 | strcat(msg, yytname[x]);
|
---|
1523 | strcat(msg, "'");
|
---|
1524 | count++;
|
---|
1525 | }
|
---|
1526 | }
|
---|
1527 | yyerror(msg);
|
---|
1528 | free(msg);
|
---|
1529 | }
|
---|
1530 | else
|
---|
1531 | yyerror ("parse error; also virtual memory exceeded");
|
---|
1532 | }
|
---|
1533 | else
|
---|
1534 | #endif /* YYERROR_VERBOSE */
|
---|
1535 | yyerror("parse error");
|
---|
1536 | }
|
---|
1537 |
|
---|
1538 | goto yyerrlab1;
|
---|
1539 | yyerrlab1: /* here on error raised explicitly by an action */
|
---|
1540 |
|
---|
1541 | if (yyerrstatus == 3)
|
---|
1542 | {
|
---|
1543 | /* if just tried and failed to reuse lookahead token after an error, discard it. */
|
---|
1544 |
|
---|
1545 | /* return failure if at end of input */
|
---|
1546 | if (yychar == YYEOF)
|
---|
1547 | YYABORT;
|
---|
1548 |
|
---|
1549 | #if YYDEBUG != 0
|
---|
1550 | if (yydebug)
|
---|
1551 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
|
---|
1552 | #endif
|
---|
1553 |
|
---|
1554 | yychar = YYEMPTY;
|
---|
1555 | }
|
---|
1556 |
|
---|
1557 | /* Else will try to reuse lookahead token
|
---|
1558 | after shifting the error token. */
|
---|
1559 |
|
---|
1560 | yyerrstatus = 3; /* Each real token shifted decrements this */
|
---|
1561 |
|
---|
1562 | goto yyerrhandle;
|
---|
1563 |
|
---|
1564 | yyerrdefault: /* current state does not do anything special for the error token. */
|
---|
1565 |
|
---|
1566 | #if 0
|
---|
1567 | /* This is wrong; only states that explicitly want error tokens
|
---|
1568 | should shift them. */
|
---|
1569 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
|
---|
1570 | if (yyn) goto yydefault;
|
---|
1571 | #endif
|
---|
1572 |
|
---|
1573 | yyerrpop: /* pop the current state because it cannot handle the error token */
|
---|
1574 |
|
---|
1575 | if (yyssp == yyss) YYABORT;
|
---|
1576 | yyvsp--;
|
---|
1577 | yystate = *--yyssp;
|
---|
1578 | #ifdef YYLSP_NEEDED
|
---|
1579 | yylsp--;
|
---|
1580 | #endif
|
---|
1581 |
|
---|
1582 | #if YYDEBUG != 0
|
---|
1583 | if (yydebug)
|
---|
1584 | {
|
---|
1585 | short *ssp1 = yyss - 1;
|
---|
1586 | fprintf (stderr, "Error: state stack now");
|
---|
1587 | while (ssp1 != yyssp)
|
---|
1588 | fprintf (stderr, " %d", *++ssp1);
|
---|
1589 | fprintf (stderr, "\n");
|
---|
1590 | }
|
---|
1591 | #endif
|
---|
1592 |
|
---|
1593 | yyerrhandle:
|
---|
1594 |
|
---|
1595 | yyn = yypact[yystate];
|
---|
1596 | if (yyn == YYFLAG)
|
---|
1597 | goto yyerrdefault;
|
---|
1598 |
|
---|
1599 | yyn += YYTERROR;
|
---|
1600 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
|
---|
1601 | goto yyerrdefault;
|
---|
1602 |
|
---|
1603 | yyn = yytable[yyn];
|
---|
1604 | if (yyn < 0)
|
---|
1605 | {
|
---|
1606 | if (yyn == YYFLAG)
|
---|
1607 | goto yyerrpop;
|
---|
1608 | yyn = -yyn;
|
---|
1609 | goto yyreduce;
|
---|
1610 | }
|
---|
1611 | else if (yyn == 0)
|
---|
1612 | goto yyerrpop;
|
---|
1613 |
|
---|
1614 | if (yyn == YYFINAL)
|
---|
1615 | YYACCEPT;
|
---|
1616 |
|
---|
1617 | #if YYDEBUG != 0
|
---|
1618 | if (yydebug)
|
---|
1619 | fprintf(stderr, "Shifting error token, ");
|
---|
1620 | #endif
|
---|
1621 |
|
---|
1622 | *++yyvsp = yylval;
|
---|
1623 | #ifdef YYLSP_NEEDED
|
---|
1624 | *++yylsp = yylloc;
|
---|
1625 | #endif
|
---|
1626 |
|
---|
1627 | yystate = yyn;
|
---|
1628 | goto yynewstate;
|
---|
1629 |
|
---|
1630 | yyacceptlab:
|
---|
1631 | /* YYACCEPT comes here. */
|
---|
1632 | if (yyfree_stacks)
|
---|
1633 | {
|
---|
1634 | free (yyss);
|
---|
1635 | free (yyvs);
|
---|
1636 | #ifdef YYLSP_NEEDED
|
---|
1637 | free (yyls);
|
---|
1638 | #endif
|
---|
1639 | }
|
---|
1640 | return 0;
|
---|
1641 |
|
---|
1642 | yyabortlab:
|
---|
1643 | /* YYABORT comes here. */
|
---|
1644 | if (yyfree_stacks)
|
---|
1645 | {
|
---|
1646 | free (yyss);
|
---|
1647 | free (yyvs);
|
---|
1648 | #ifdef YYLSP_NEEDED
|
---|
1649 | free (yyls);
|
---|
1650 | #endif
|
---|
1651 | }
|
---|
1652 | return 1;
|
---|
1653 | }
|
---|
1654 | #line 647 "m68k-parse.y"
|
---|
1655 |
|
---|
1656 |
|
---|
1657 | /* The string to parse is stored here, and modified by yylex. */
|
---|
1658 |
|
---|
1659 | static char *str;
|
---|
1660 |
|
---|
1661 | /* The original string pointer. */
|
---|
1662 |
|
---|
1663 | static char *strorig;
|
---|
1664 |
|
---|
1665 | /* If *CCP could be a register, return the register number and advance
|
---|
1666 | *CCP. Otherwise don't change *CCP, and return 0. */
|
---|
1667 |
|
---|
1668 | static enum m68k_register
|
---|
1669 | m68k_reg_parse (ccp)
|
---|
1670 | register char **ccp;
|
---|
1671 | {
|
---|
1672 | char *start = *ccp;
|
---|
1673 | char c;
|
---|
1674 | char *p;
|
---|
1675 | symbolS *symbolp;
|
---|
1676 |
|
---|
1677 | if (flag_reg_prefix_optional)
|
---|
1678 | {
|
---|
1679 | if (*start == REGISTER_PREFIX)
|
---|
1680 | start++;
|
---|
1681 | p = start;
|
---|
1682 | }
|
---|
1683 | else
|
---|
1684 | {
|
---|
1685 | if (*start != REGISTER_PREFIX)
|
---|
1686 | return 0;
|
---|
1687 | p = start + 1;
|
---|
1688 | }
|
---|
1689 |
|
---|
1690 | if (! is_name_beginner (*p))
|
---|
1691 | return 0;
|
---|
1692 |
|
---|
1693 | p++;
|
---|
1694 | while (is_part_of_name (*p) && *p != '.' && *p != ':' && *p != '*')
|
---|
1695 | p++;
|
---|
1696 |
|
---|
1697 | c = *p;
|
---|
1698 | *p = 0;
|
---|
1699 | symbolp = symbol_find (start);
|
---|
1700 | *p = c;
|
---|
1701 |
|
---|
1702 | if (symbolp != NULL && S_GET_SEGMENT (symbolp) == reg_section)
|
---|
1703 | {
|
---|
1704 | *ccp = p;
|
---|
1705 | return S_GET_VALUE (symbolp);
|
---|
1706 | }
|
---|
1707 |
|
---|
1708 | /* In MRI mode, something like foo.bar can be equated to a register
|
---|
1709 | name. */
|
---|
1710 | while (flag_mri && c == '.')
|
---|
1711 | {
|
---|
1712 | ++p;
|
---|
1713 | while (is_part_of_name (*p) && *p != '.' && *p != ':' && *p != '*')
|
---|
1714 | p++;
|
---|
1715 | c = *p;
|
---|
1716 | *p = '\0';
|
---|
1717 | symbolp = symbol_find (start);
|
---|
1718 | *p = c;
|
---|
1719 | if (symbolp != NULL && S_GET_SEGMENT (symbolp) == reg_section)
|
---|
1720 | {
|
---|
1721 | *ccp = p;
|
---|
1722 | return S_GET_VALUE (symbolp);
|
---|
1723 | }
|
---|
1724 | }
|
---|
1725 |
|
---|
1726 | return 0;
|
---|
1727 | }
|
---|
1728 |
|
---|
1729 | /* The lexer. */
|
---|
1730 |
|
---|
1731 | static int
|
---|
1732 | yylex ()
|
---|
1733 | {
|
---|
1734 | enum m68k_register reg;
|
---|
1735 | char *s;
|
---|
1736 | int parens;
|
---|
1737 | int c = 0;
|
---|
1738 | int tail = 0;
|
---|
1739 | char *hold;
|
---|
1740 |
|
---|
1741 | if (*str == ' ')
|
---|
1742 | ++str;
|
---|
1743 |
|
---|
1744 | if (*str == '\0')
|
---|
1745 | return 0;
|
---|
1746 |
|
---|
1747 | /* Various special characters are just returned directly. */
|
---|
1748 | switch (*str)
|
---|
1749 | {
|
---|
1750 | case '@':
|
---|
1751 | /* In MRI mode, this can be the start of an octal number. */
|
---|
1752 | if (flag_mri)
|
---|
1753 | {
|
---|
1754 | if (isdigit (str[1])
|
---|
1755 | || ((str[1] == '+' || str[1] == '-')
|
---|
1756 | && isdigit (str[2])))
|
---|
1757 | break;
|
---|
1758 | }
|
---|
1759 | /* Fall through. */
|
---|
1760 | case '#':
|
---|
1761 | case '&':
|
---|
1762 | case ',':
|
---|
1763 | case ')':
|
---|
1764 | case '/':
|
---|
1765 | case '[':
|
---|
1766 | case ']':
|
---|
1767 | return *str++;
|
---|
1768 | case '+':
|
---|
1769 | /* It so happens that a '+' can only appear at the end of an
|
---|
1770 | operand. If it appears anywhere else, it must be a unary
|
---|
1771 | plus on an expression. */
|
---|
1772 | if (str[1] == '\0')
|
---|
1773 | return *str++;
|
---|
1774 | break;
|
---|
1775 | case '-':
|
---|
1776 | /* A '-' can only appear in -(ar), rn-rn, or ar@-. If it
|
---|
1777 | appears anywhere else, it must be a unary minus on an
|
---|
1778 | expression. */
|
---|
1779 | if (str[1] == '\0')
|
---|
1780 | return *str++;
|
---|
1781 | s = str + 1;
|
---|
1782 | if (*s == '(')
|
---|
1783 | ++s;
|
---|
1784 | if (m68k_reg_parse (&s) != 0)
|
---|
1785 | return *str++;
|
---|
1786 | break;
|
---|
1787 | case '(':
|
---|
1788 | /* A '(' can only appear in `(reg)', `(expr,...', `([', `@(', or
|
---|
1789 | `)('. If it appears anywhere else, it must be starting an
|
---|
1790 | expression. */
|
---|
1791 | if (str[1] == '['
|
---|
1792 | || (str > strorig
|
---|
1793 | && (str[-1] == '@'
|
---|
1794 | || str[-1] == ')')))
|
---|
1795 | return *str++;
|
---|
1796 | s = str + 1;
|
---|
1797 | if (m68k_reg_parse (&s) != 0)
|
---|
1798 | return *str++;
|
---|
1799 | /* Check for the case of '(expr,...' by scanning ahead. If we
|
---|
1800 | find a comma outside of balanced parentheses, we return '('.
|
---|
1801 | If we find an unbalanced right parenthesis, then presumably
|
---|
1802 | the '(' really starts an expression. */
|
---|
1803 | parens = 0;
|
---|
1804 | for (s = str + 1; *s != '\0'; s++)
|
---|
1805 | {
|
---|
1806 | if (*s == '(')
|
---|
1807 | ++parens;
|
---|
1808 | else if (*s == ')')
|
---|
1809 | {
|
---|
1810 | if (parens == 0)
|
---|
1811 | break;
|
---|
1812 | --parens;
|
---|
1813 | }
|
---|
1814 | else if (*s == ',' && parens == 0)
|
---|
1815 | {
|
---|
1816 | /* A comma can not normally appear in an expression, so
|
---|
1817 | this is a case of '(expr,...'. */
|
---|
1818 | return *str++;
|
---|
1819 | }
|
---|
1820 | }
|
---|
1821 | }
|
---|
1822 |
|
---|
1823 | /* See if it's a register. */
|
---|
1824 |
|
---|
1825 | reg = m68k_reg_parse (&str);
|
---|
1826 | if (reg != 0)
|
---|
1827 | {
|
---|
1828 | int ret;
|
---|
1829 |
|
---|
1830 | yylval.reg = reg;
|
---|
1831 |
|
---|
1832 | if (reg >= DATA0 && reg <= DATA7)
|
---|
1833 | ret = DR;
|
---|
1834 | else if (reg >= ADDR0 && reg <= ADDR7)
|
---|
1835 | ret = AR;
|
---|
1836 | else if (reg >= FP0 && reg <= FP7)
|
---|
1837 | return FPR;
|
---|
1838 | else if (reg == FPI
|
---|
1839 | || reg == FPS
|
---|
1840 | || reg == FPC)
|
---|
1841 | return FPCR;
|
---|
1842 | else if (reg == PC)
|
---|
1843 | return LPC;
|
---|
1844 | else if (reg >= ZDATA0 && reg <= ZDATA7)
|
---|
1845 | ret = ZDR;
|
---|
1846 | else if (reg >= ZADDR0 && reg <= ZADDR7)
|
---|
1847 | ret = ZAR;
|
---|
1848 | else if (reg == ZPC)
|
---|
1849 | return LZPC;
|
---|
1850 | else
|
---|
1851 | return CREG;
|
---|
1852 |
|
---|
1853 | /* If we get here, we have a data or address register. We
|
---|
1854 | must check for a size or scale; if we find one, we must
|
---|
1855 | return INDEXREG. */
|
---|
1856 |
|
---|
1857 | s = str;
|
---|
1858 |
|
---|
1859 | if (*s != '.' && *s != ':' && *s != '*')
|
---|
1860 | return ret;
|
---|
1861 |
|
---|
1862 | yylval.indexreg.reg = reg;
|
---|
1863 |
|
---|
1864 | if (*s != '.' && *s != ':')
|
---|
1865 | yylval.indexreg.size = SIZE_UNSPEC;
|
---|
1866 | else
|
---|
1867 | {
|
---|
1868 | ++s;
|
---|
1869 | switch (*s)
|
---|
1870 | {
|
---|
1871 | case 'w':
|
---|
1872 | case 'W':
|
---|
1873 | yylval.indexreg.size = SIZE_WORD;
|
---|
1874 | ++s;
|
---|
1875 | break;
|
---|
1876 | case 'l':
|
---|
1877 | case 'L':
|
---|
1878 | yylval.indexreg.size = SIZE_LONG;
|
---|
1879 | ++s;
|
---|
1880 | break;
|
---|
1881 | default:
|
---|
1882 | yyerror (_("illegal size specification"));
|
---|
1883 | yylval.indexreg.size = SIZE_UNSPEC;
|
---|
1884 | break;
|
---|
1885 | }
|
---|
1886 | }
|
---|
1887 |
|
---|
1888 | yylval.indexreg.scale = 1;
|
---|
1889 |
|
---|
1890 | if (*s == '*' || *s == ':')
|
---|
1891 | {
|
---|
1892 | expressionS scale;
|
---|
1893 |
|
---|
1894 | ++s;
|
---|
1895 |
|
---|
1896 | hold = input_line_pointer;
|
---|
1897 | input_line_pointer = s;
|
---|
1898 | expression (&scale);
|
---|
1899 | s = input_line_pointer;
|
---|
1900 | input_line_pointer = hold;
|
---|
1901 |
|
---|
1902 | if (scale.X_op != O_constant)
|
---|
1903 | yyerror (_("scale specification must resolve to a number"));
|
---|
1904 | else
|
---|
1905 | {
|
---|
1906 | switch (scale.X_add_number)
|
---|
1907 | {
|
---|
1908 | case 1:
|
---|
1909 | case 2:
|
---|
1910 | case 4:
|
---|
1911 | case 8:
|
---|
1912 | yylval.indexreg.scale = scale.X_add_number;
|
---|
1913 | break;
|
---|
1914 | default:
|
---|
1915 | yyerror (_("invalid scale value"));
|
---|
1916 | break;
|
---|
1917 | }
|
---|
1918 | }
|
---|
1919 | }
|
---|
1920 |
|
---|
1921 | str = s;
|
---|
1922 |
|
---|
1923 | return INDEXREG;
|
---|
1924 | }
|
---|
1925 |
|
---|
1926 | /* It must be an expression. Before we call expression, we need to
|
---|
1927 | look ahead to see if there is a size specification. We must do
|
---|
1928 | that first, because otherwise foo.l will be treated as the symbol
|
---|
1929 | foo.l, rather than as the symbol foo with a long size
|
---|
1930 | specification. The grammar requires that all expressions end at
|
---|
1931 | the end of the operand, or with ',', '(', ']', ')'. */
|
---|
1932 |
|
---|
1933 | parens = 0;
|
---|
1934 | for (s = str; *s != '\0'; s++)
|
---|
1935 | {
|
---|
1936 | if (*s == '(')
|
---|
1937 | {
|
---|
1938 | if (parens == 0
|
---|
1939 | && s > str
|
---|
1940 | && (s[-1] == ')' || isalnum ((unsigned char) s[-1])))
|
---|
1941 | break;
|
---|
1942 | ++parens;
|
---|
1943 | }
|
---|
1944 | else if (*s == ')')
|
---|
1945 | {
|
---|
1946 | if (parens == 0)
|
---|
1947 | break;
|
---|
1948 | --parens;
|
---|
1949 | }
|
---|
1950 | else if (parens == 0
|
---|
1951 | && (*s == ',' || *s == ']'))
|
---|
1952 | break;
|
---|
1953 | }
|
---|
1954 |
|
---|
1955 | yylval.exp.size = SIZE_UNSPEC;
|
---|
1956 | if (s <= str + 2
|
---|
1957 | || (s[-2] != '.' && s[-2] != ':'))
|
---|
1958 | tail = 0;
|
---|
1959 | else
|
---|
1960 | {
|
---|
1961 | switch (s[-1])
|
---|
1962 | {
|
---|
1963 | case 's':
|
---|
1964 | case 'S':
|
---|
1965 | case 'b':
|
---|
1966 | case 'B':
|
---|
1967 | yylval.exp.size = SIZE_BYTE;
|
---|
1968 | break;
|
---|
1969 | case 'w':
|
---|
1970 | case 'W':
|
---|
1971 | yylval.exp.size = SIZE_WORD;
|
---|
1972 | break;
|
---|
1973 | case 'l':
|
---|
1974 | case 'L':
|
---|
1975 | yylval.exp.size = SIZE_LONG;
|
---|
1976 | break;
|
---|
1977 | default:
|
---|
1978 | break;
|
---|
1979 | }
|
---|
1980 | if (yylval.exp.size != SIZE_UNSPEC)
|
---|
1981 | tail = 2;
|
---|
1982 | }
|
---|
1983 |
|
---|
1984 | #ifdef OBJ_ELF
|
---|
1985 | {
|
---|
1986 | /* Look for @PLTPC, etc. */
|
---|
1987 | char *cp;
|
---|
1988 |
|
---|
1989 | yylval.exp.pic_reloc = pic_none;
|
---|
1990 | cp = s - tail;
|
---|
1991 | if (cp - 6 > str && cp[-6] == '@')
|
---|
1992 | {
|
---|
1993 | if (strncmp (cp - 6, "@PLTPC", 6) == 0)
|
---|
1994 | {
|
---|
1995 | yylval.exp.pic_reloc = pic_plt_pcrel;
|
---|
1996 | tail += 6;
|
---|
1997 | }
|
---|
1998 | else if (strncmp (cp - 6, "@GOTPC", 6) == 0)
|
---|
1999 | {
|
---|
2000 | yylval.exp.pic_reloc = pic_got_pcrel;
|
---|
2001 | tail += 6;
|
---|
2002 | }
|
---|
2003 | }
|
---|
2004 | else if (cp - 4 > str && cp[-4] == '@')
|
---|
2005 | {
|
---|
2006 | if (strncmp (cp - 4, "@PLT", 4) == 0)
|
---|
2007 | {
|
---|
2008 | yylval.exp.pic_reloc = pic_plt_off;
|
---|
2009 | tail += 4;
|
---|
2010 | }
|
---|
2011 | else if (strncmp (cp - 4, "@GOT", 4) == 0)
|
---|
2012 | {
|
---|
2013 | yylval.exp.pic_reloc = pic_got_off;
|
---|
2014 | tail += 4;
|
---|
2015 | }
|
---|
2016 | }
|
---|
2017 | }
|
---|
2018 | #endif
|
---|
2019 |
|
---|
2020 | if (tail != 0)
|
---|
2021 | {
|
---|
2022 | c = s[-tail];
|
---|
2023 | s[-tail] = 0;
|
---|
2024 | }
|
---|
2025 |
|
---|
2026 | hold = input_line_pointer;
|
---|
2027 | input_line_pointer = str;
|
---|
2028 | expression (&yylval.exp.exp);
|
---|
2029 | str = input_line_pointer;
|
---|
2030 | input_line_pointer = hold;
|
---|
2031 |
|
---|
2032 | if (tail != 0)
|
---|
2033 | {
|
---|
2034 | s[-tail] = c;
|
---|
2035 | str = s;
|
---|
2036 | }
|
---|
2037 |
|
---|
2038 | return EXPR;
|
---|
2039 | }
|
---|
2040 |
|
---|
2041 | /* Parse an m68k operand. This is the only function which is called
|
---|
2042 | from outside this file. */
|
---|
2043 |
|
---|
2044 | int
|
---|
2045 | m68k_ip_op (s, oparg)
|
---|
2046 | char *s;
|
---|
2047 | struct m68k_op *oparg;
|
---|
2048 | {
|
---|
2049 | memset (oparg, 0, sizeof *oparg);
|
---|
2050 | oparg->error = NULL;
|
---|
2051 | oparg->index.reg = ZDATA0;
|
---|
2052 | oparg->index.scale = 1;
|
---|
2053 | oparg->disp.exp.X_op = O_absent;
|
---|
2054 | oparg->odisp.exp.X_op = O_absent;
|
---|
2055 |
|
---|
2056 | str = strorig = s;
|
---|
2057 | op = oparg;
|
---|
2058 |
|
---|
2059 | return yyparse ();
|
---|
2060 | }
|
---|
2061 |
|
---|
2062 | /* The error handler. */
|
---|
2063 |
|
---|
2064 | static void
|
---|
2065 | yyerror (s)
|
---|
2066 | const char *s;
|
---|
2067 | {
|
---|
2068 | op->error = s;
|
---|
2069 | }
|
---|