source: branches/libc-0.6/src/binutils/gas/itbl-parse.c

Last change on this file was 610, checked in by bird, 22 years ago

This commit was generated by cvs2svn to compensate for changes in r609,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 41.2 KB
Line 
1/* A Bison parser, made from itbl-parse.y
2 by GNU bison 1.35. */
3
4#define YYBISON 1 /* Identify Bison output. */
5
6# define DREG 257
7# define CREG 258
8# define GREG 259
9# define IMMED 260
10# define ADDR 261
11# define INSN 262
12# define NUM 263
13# define ID 264
14# define NL 265
15# define PNUM 266
16
17#line 21 "itbl-parse.y"
18
19
20/*
21
22Yacc grammar for instruction table entries.
23
24=======================================================================
25Original Instruction table specification document:
26
27 MIPS Coprocessor Table Specification
28 ====================================
29
30This document describes the format of the MIPS coprocessor table. The
31table specifies a list of valid functions, data registers and control
32registers that can be used in coprocessor instructions. This list,
33together with the coprocessor instruction classes listed below,
34specifies the complete list of coprocessor instructions that will
35be recognized and assembled by the GNU assembler. In effect,
36this makes the GNU assembler table-driven, where the table is
37specified by the programmer.
38
39The table is an ordinary text file that the GNU assembler reads when
40it starts. Using the information in the table, the assembler
41generates an internal list of valid coprocessor registers and
42functions. The assembler uses this internal list in addition to the
43standard MIPS registers and instructions which are built-in to the
44assembler during code generation.
45
46To specify the coprocessor table when invoking the GNU assembler, use
47the command line option "--itbl file", where file is the
48complete name of the table, including path and extension.
49
50Examples:
51
52 gas -t cop.tbl test.s -o test.o
53 gas -t /usr/local/lib/cop.tbl test.s -o test.o
54 gas --itbl d:\gnu\data\cop.tbl test.s -o test.o
55
56Only one table may be supplied during a single invocation of
57the assembler.
58
59
60Instruction classes
61===================
62
63Below is a list of the valid coprocessor instruction classes for
64any given coprocessor "z". These instructions are already recognized
65by the assembler, and are listed here only for reference.
66
67Class format instructions
68-------------------------------------------------
69Class1:
70 op base rt offset
71 LWCz rt,offset (base)
72 SWCz rt,offset (base)
73Class2:
74 COPz sub rt rd 0
75 MTCz rt,rd
76 MFCz rt,rd
77 CTCz rt,rd
78 CFCz rt,rd
79Class3:
80 COPz CO cofun
81 COPz cofun
82Class4:
83 COPz BC br offset
84 BCzT offset
85 BCzF offset
86Class5:
87 COPz sub rt rd 0
88 DMFCz rt,rd
89 DMTCz rt,rd
90Class6:
91 op base rt offset
92 LDCz rt,offset (base)
93 SDCz rt,offset (base)
94Class7:
95 COPz BC br offset
96 BCzTL offset
97 BCzFL offset
98
99The coprocessor table defines coprocessor-specific registers that can
100be used with all of the above classes of instructions, where
101appropriate. It also defines additional coprocessor-specific
102functions for Class3 (COPz cofun) instructions, Thus, the table allows
103the programmer to use convenient mnemonics and operands for these
104functions, instead of the COPz mmenmonic and cofun operand.
105
106The names of the MIPS general registers and their aliases are defined
107by the assembler and will be recognized as valid register names by the
108assembler when used (where allowed) in coprocessor instructions.
109However, the names and values of all coprocessor data and control
110register mnemonics must be specified in the coprocessor table.
111
112
113Table Grammar
114=============
115
116Here is the grammar for the coprocessor table:
117
118 table -> entry*
119
120 entry -> [z entrydef] [comment] '\n'
121
122 entrydef -> type name val
123 entrydef -> 'insn' name val funcdef ; type of entry (instruction)
124
125 z -> 'p'['0'..'3'] ; processor number
126 type -> ['dreg' | 'creg' | 'greg' ] ; type of entry (register)
127 ; 'dreg', 'creg' or 'greg' specifies a data, control, or general
128 ; register mnemonic, respectively
129 name -> [ltr|dec]* ; mnemonic of register/function
130 val -> [dec|hex] ; register/function number (integer constant)
131
132 funcdef -> frange flags fields
133 ; bitfield range for opcode
134 ; list of fields' formats
135 fields -> field*
136 field -> [','] ftype frange flags
137 flags -> ['*' flagexpr]
138 flagexpr -> '[' flagexpr ']'
139 flagexpr -> val '|' flagexpr
140 ftype -> [ type | 'immed' | 'addr' ]
141 ; 'immed' specifies an immediate value; see grammar for "val" above
142 ; 'addr' specifies a C identifier; name of symbol to be resolved at
143 ; link time
144 frange -> ':' val '-' val ; starting to ending bit positions, where
145 ; where 0 is least significant bit
146 frange -> (null) ; default range of 31-0 will be assumed
147
148 comment -> [';'|'#'] [char]*
149 char -> any printable character
150 ltr -> ['a'..'z'|'A'..'Z']
151 dec -> ['0'..'9']* ; value in decimal
152 hex -> '0x'['0'..'9' | 'a'..'f' | 'A'..'F']* ; value in hexidecimal
153
154
155Examples
156========
157
158Example 1:
159
160The table:
161
162 p1 dreg d1 1 ; data register "d1" for COP1 has value 1
163 p1 creg c3 3 ; ctrl register "c3" for COP1 has value 3
164 p3 func fill 0x1f:24-20 ; function "fill" for COP3 has value 31 and
165 ; no fields
166
167will allow the assembler to accept the following coprocessor instructions:
168
169 LWC1 d1,0x100 ($2)
170 fill
171
172Here, the general purpose register "$2", and instruction "LWC1", are standard
173mnemonics built-in to the MIPS assembler.
174
175
176Example 2:
177
178The table:
179
180 p3 dreg d3 3 ; data register "d3" for COP3 has value 3
181 p3 creg c2 22 ; control register "c2" for COP3 has value 22
182 p3 func fee 0x1f:24-20 dreg:17-13 creg:12-8 immed:7-0
183 ; function "fee" for COP3 has value 31, and 3 fields
184 ; consisting of a data register, a control register,
185 ; and an immediate value.
186
187will allow the assembler to accept the following coprocessor instruction:
188
189 fee d3,c2,0x1
190
191and will emit the object code:
192
193 31-26 25 24-20 19-18 17-13 12-8 7-0
194 COPz CO fun dreg creg immed
195 010011 1 11111 00 00011 10110 00000001
196
197 0x4ff07601
198
199
200Example 3:
201
202The table:
203
204 p3 dreg d3 3 ; data register "d3" for COP3 has value 3
205 p3 creg c2 22 ; control register "c2" for COP3 has value 22
206 p3 func fuu 0x01f00001 dreg:17-13 creg:12-8
207
208will allow the assembler to accept the following coprocessor
209instruction:
210
211 fuu d3,c2
212
213and will emit the object code:
214
215 31-26 25 24-20 19-18 17-13 12-8 7-0
216 COPz CO fun dreg creg
217 010011 1 11111 00 00011 10110 00000001
218
219 0x4ff07601
220
221In this way, the programmer can force arbitrary bits of an instruction
222to have predefined values.
223
224=======================================================================
225Additional notes:
226
227Encoding of ranges:
228To handle more than one bit position range within an instruction,
229use 0s to mask out the ranges which don't apply.
230May decide to modify the syntax to allow commas separate multiple
231ranges within an instruction (range','range).
232
233Changes in grammar:
234 The number of parms argument to the function entry
235was deleted from the original format such that we now count the fields.
236
237----
238FIXME! should really change lexical analyzer
239to recognize 'dreg' etc. in context sensative way.
240Currently function names or mnemonics may be incorrectly parsed as keywords
241
242FIXME! hex is ambiguous with any digit
243
244*/
245
246#include <stdio.h>
247#include "itbl-ops.h"
248
249/* #define DEBUG */
250
251#ifdef DEBUG
252#ifndef DBG_LVL
253#define DBG_LVL 1
254#endif
255#else
256#define DBG_LVL 0
257#endif
258
259#if DBG_LVL >= 1
260#define DBG(x) printf x
261#else
262#define DBG(x)
263#endif
264
265#if DBG_LVL >= 2
266#define DBGL2(x) printf x
267#else
268#define DBGL2(x)
269#endif
270
271static int sbit, ebit;
272static struct itbl_entry *insn=0;
273extern int insntbl_line;
274int yyparse PARAMS ((void));
275int yylex PARAMS ((void));
276static int yyerror PARAMS ((const char *));
277
278
279#line 283 "itbl-parse.y"
280#ifndef YYSTYPE
281typedef union
282 {
283 char *str;
284 int num;
285 int processor;
286 unsigned long val;
287 } yystype;
288# define YYSTYPE yystype
289# define YYSTYPE_IS_TRIVIAL 1
290#endif
291#ifndef YYDEBUG
292# define YYDEBUG 0
293#endif
294
295
296
297#define YYFINAL 51
298#define YYFLAG -32768
299#define YYNTBASE 20
300
301/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
302#define YYTRANSLATE(x) ((unsigned)(x) <= 266 ? yytranslate[x] : 34)
303
304/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
305static const char yytranslate[] =
306{
307 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
308 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
309 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
310 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
311 2, 2, 17, 2, 13, 19, 2, 2, 2, 2,
312 2, 2, 2, 2, 2, 2, 2, 2, 18, 2,
313 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
314 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
315 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
316 2, 15, 2, 16, 2, 2, 2, 2, 2, 2,
317 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
318 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
319 2, 2, 2, 2, 14, 2, 2, 2, 2, 2,
320 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
321 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
322 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
323 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
324 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
325 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
326 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
327 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
328 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
329 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
330 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
331 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
332 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
333 6, 7, 8, 9, 10, 11, 12
334};
335
336#if YYDEBUG
337static const short yyprhs[] =
338{
339 0, 0, 2, 5, 6, 12, 13, 23, 25, 28,
340 32, 35, 36, 38, 40, 42, 46, 50, 54, 56,
341 59, 60, 65, 66, 68, 70, 72, 74, 76, 78
342};
343static const short yyrhs[] =
344{
345 21, 0, 22, 21, 0, 0, 30, 31, 32, 33,
346 11, 0, 0, 30, 8, 32, 33, 29, 28, 23,
347 24, 11, 0, 11, 0, 1, 11, 0, 13, 26,
348 24, 0, 26, 24, 0, 0, 31, 0, 7, 0,
349 6, 0, 25, 29, 28, 0, 9, 14, 27, 0,
350 15, 27, 16, 0, 9, 0, 17, 27, 0, 0,
351 18, 9, 19, 9, 0, 0, 12, 0, 3, 0,
352 4, 0, 5, 0, 10, 0, 9, 0, 9, 0
353};
354
355#endif
356
357#if YYDEBUG
358/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
359static const short yyrline[] =
360{
361 0, 300, 304, 306, 309, 316, 316, 325, 326, 329,
362 331, 332, 335, 341, 346, 353, 362, 367, 371, 377,
363 383, 389, 396, 403, 411, 417, 422, 429, 437, 445
364};
365#endif
366
367
368#if (YYDEBUG) || defined YYERROR_VERBOSE
369
370/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
371static const char *const yytname[] =
372{
373 "$", "error", "$undefined.", "DREG", "CREG", "GREG", "IMMED", "ADDR",
374 "INSN", "NUM", "ID", "NL", "PNUM", "','", "'|'", "'['", "']'", "'*'",
375 "':'", "'-'", "insntbl", "entrys", "entry", "@1", "fieldspecs", "ftype",
376 "fieldspec", "flagexpr", "flags", "range", "pnum", "regtype", "name",
377 "value", 0
378};
379#endif
380
381/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
382static const short yyr1[] =
383{
384 0, 20, 21, 21, 22, 23, 22, 22, 22, 24,
385 24, 24, 25, 25, 25, 26, 27, 27, 27, 28,
386 28, 29, 29, 30, 31, 31, 31, 32, 34, 33
387};
388
389/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
390static const short yyr2[] =
391{
392 0, 1, 2, 0, 5, 0, 9, 1, 2, 3,
393 2, 0, 1, 1, 1, 3, 3, 3, 1, 2,
394 0, 4, 0, 1, 1, 1, 1, 1, 1, 1
395};
396
397/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
398 doesn't specify something else to do. Zero means the default is an
399 error. */
400static const short yydefact[] =
401{
402 0, 0, 7, 23, 1, 0, 0, 8, 2, 24,
403 25, 26, 0, 0, 27, 0, 0, 29, 22, 0,
404 0, 20, 4, 0, 0, 5, 0, 18, 0, 19,
405 11, 21, 0, 0, 14, 13, 0, 0, 22, 11,
406 12, 16, 17, 11, 6, 20, 10, 9, 15, 0,
407 0, 0
408};
409
410static const short yydefgoto[] =
411{
412 49, 4, 5, 30, 37, 38, 39, 29, 25, 21,
413 6, 40, 15, 18
414};
415
416static const short yypact[] =
417{
418 0, -9,-32768,-32768,-32768, 0, 12,-32768,-32768,-32768,
419 -32768,-32768, 3, 3,-32768, 9, 9,-32768, -8, 8,
420 19, 15,-32768, 10, -6,-32768, 24, 20, -6,-32768,
421 1,-32768, -6, 21,-32768,-32768, 18, 25, -8, 1,
422 -32768,-32768,-32768, 1,-32768, 15,-32768,-32768,-32768, 35,
423 38,-32768
424};
425
426static const short yypgoto[] =
427{
428 -32768, 34,-32768,-32768, -13,-32768, 4, -1, -4, 5,
429 -32768, 36, 31, 29
430};
431
432
433#define YYLAST 45
434
435
436static const short yytable[] =
437{
438 -3, 1, 7, 27, 9, 10, 11, 34, 35, 28,
439 20, 2, 3, 14, 36, 9, 10, 11, 17, 22,
440 12, 9, 10, 11, 34, 35, 46, 33, 23, 26,
441 47, 41, 24, 31, 32, 50, 44, 42, 51, 8,
442 43, 48, 13, 45, 16, 19
443};
444
445static const short yycheck[] =
446{
447 0, 1, 11, 9, 3, 4, 5, 6, 7, 15,
448 18, 11, 12, 10, 13, 3, 4, 5, 9, 11,
449 8, 3, 4, 5, 6, 7, 39, 28, 9, 19,
450 43, 32, 17, 9, 14, 0, 11, 16, 0, 5,
451 36, 45, 6, 38, 13, 16
452};
453/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
454#line 3 "/usr/share/bison-1.35/bison.simple"
455
456/* Skeleton output parser for bison,
457
458 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
459 Foundation, Inc.
460
461 This program is free software; you can redistribute it and/or modify
462 it under the terms of the GNU General Public License as published by
463 the Free Software Foundation; either version 2, or (at your option)
464 any later version.
465
466 This program is distributed in the hope that it will be useful,
467 but WITHOUT ANY WARRANTY; without even the implied warranty of
468 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
469 GNU General Public License for more details.
470
471 You should have received a copy of the GNU General Public License
472 along with this program; if not, write to the Free Software
473 Foundation, Inc., 59 Temple Place - Suite 330,
474 Boston, MA 02111-1307, USA. */
475
476/* As a special exception, when this file is copied by Bison into a
477 Bison output file, you may use that output file without restriction.
478 This special exception was added by the Free Software Foundation
479 in version 1.24 of Bison. */
480
481/* This is the parser code that is written into each bison parser when
482 the %semantic_parser declaration is not specified in the grammar.
483 It was written by Richard Stallman by simplifying the hairy parser
484 used when %semantic_parser is specified. */
485
486/* All symbols defined below should begin with yy or YY, to avoid
487 infringing on user name space. This should be done even for local
488 variables, as they might otherwise be expanded by user macros.
489 There are some unavoidable exceptions within include files to
490 define necessary library symbols; they are noted "INFRINGES ON
491 USER NAME SPACE" below. */
492
493#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
494
495/* The parser invokes alloca or malloc; define the necessary symbols. */
496
497# if YYSTACK_USE_ALLOCA
498# define YYSTACK_ALLOC alloca
499# else
500# ifndef YYSTACK_USE_ALLOCA
501# if defined (alloca) || defined (_ALLOCA_H)
502# define YYSTACK_ALLOC alloca
503# else
504# ifdef __GNUC__
505# define YYSTACK_ALLOC __builtin_alloca
506# endif
507# endif
508# endif
509# endif
510
511# ifdef YYSTACK_ALLOC
512 /* Pacify GCC's `empty if-body' warning. */
513# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
514# else
515# if defined (__STDC__) || defined (__cplusplus)
516# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
517# define YYSIZE_T size_t
518# endif
519# define YYSTACK_ALLOC malloc
520# define YYSTACK_FREE free
521# endif
522#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
523
524
525#if (! defined (yyoverflow) \
526 && (! defined (__cplusplus) \
527 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
528
529/* A type that is properly aligned for any stack member. */
530union yyalloc
531{
532 short yyss;
533 YYSTYPE yyvs;
534# if YYLSP_NEEDED
535 YYLTYPE yyls;
536# endif
537};
538
539/* The size of the maximum gap between one aligned stack and the next. */
540# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
541
542/* The size of an array large to enough to hold all stacks, each with
543 N elements. */
544# if YYLSP_NEEDED
545# define YYSTACK_BYTES(N) \
546 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
547 + 2 * YYSTACK_GAP_MAX)
548# else
549# define YYSTACK_BYTES(N) \
550 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
551 + YYSTACK_GAP_MAX)
552# endif
553
554/* Copy COUNT objects from FROM to TO. The source and destination do
555 not overlap. */
556# ifndef YYCOPY
557# if 1 < __GNUC__
558# define YYCOPY(To, From, Count) \
559 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
560# else
561# define YYCOPY(To, From, Count) \
562 do \
563 { \
564 register YYSIZE_T yyi; \
565 for (yyi = 0; yyi < (Count); yyi++) \
566 (To)[yyi] = (From)[yyi]; \
567 } \
568 while (0)
569# endif
570# endif
571
572/* Relocate STACK from its old location to the new one. The
573 local variables YYSIZE and YYSTACKSIZE give the old and new number of
574 elements in the stack, and YYPTR gives the new location of the
575 stack. Advance YYPTR to a properly aligned location for the next
576 stack. */
577# define YYSTACK_RELOCATE(Stack) \
578 do \
579 { \
580 YYSIZE_T yynewbytes; \
581 YYCOPY (&yyptr->Stack, Stack, yysize); \
582 Stack = &yyptr->Stack; \
583 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
584 yyptr += yynewbytes / sizeof (*yyptr); \
585 } \
586 while (0)
587
588#endif
589
590
591#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
592# define YYSIZE_T __SIZE_TYPE__
593#endif
594#if ! defined (YYSIZE_T) && defined (size_t)
595# define YYSIZE_T size_t
596#endif
597#if ! defined (YYSIZE_T)
598# if defined (__STDC__) || defined (__cplusplus)
599# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
600# define YYSIZE_T size_t
601# endif
602#endif
603#if ! defined (YYSIZE_T)
604# define YYSIZE_T unsigned int
605#endif
606
607#define yyerrok (yyerrstatus = 0)
608#define yyclearin (yychar = YYEMPTY)
609#define YYEMPTY -2
610#define YYEOF 0
611#define YYACCEPT goto yyacceptlab
612#define YYABORT goto yyabortlab
613#define YYERROR goto yyerrlab1
614/* Like YYERROR except do call yyerror. This remains here temporarily
615 to ease the transition to the new meaning of YYERROR, for GCC.
616 Once GCC version 2 has supplanted version 1, this can go. */
617#define YYFAIL goto yyerrlab
618#define YYRECOVERING() (!!yyerrstatus)
619#define YYBACKUP(Token, Value) \
620do \
621 if (yychar == YYEMPTY && yylen == 1) \
622 { \
623 yychar = (Token); \
624 yylval = (Value); \
625 yychar1 = YYTRANSLATE (yychar); \
626 YYPOPSTACK; \
627 goto yybackup; \
628 } \
629 else \
630 { \
631 yyerror ("syntax error: cannot back up"); \
632 YYERROR; \
633 } \
634while (0)
635
636#define YYTERROR 1
637#define YYERRCODE 256
638
639
640/* YYLLOC_DEFAULT -- Compute the default location (before the actions
641 are run).
642
643 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
644 first token. By default, to implement support for ranges, extend
645 its range to the last symbol. */
646
647#ifndef YYLLOC_DEFAULT
648# define YYLLOC_DEFAULT(Current, Rhs, N) \
649 Current.last_line = Rhs[N].last_line; \
650 Current.last_column = Rhs[N].last_column;
651#endif
652
653
654/* YYLEX -- calling `yylex' with the right arguments. */
655
656#if YYPURE
657# if YYLSP_NEEDED
658# ifdef YYLEX_PARAM
659# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
660# else
661# define YYLEX yylex (&yylval, &yylloc)
662# endif
663# else /* !YYLSP_NEEDED */
664# ifdef YYLEX_PARAM
665# define YYLEX yylex (&yylval, YYLEX_PARAM)
666# else
667# define YYLEX yylex (&yylval)
668# endif
669# endif /* !YYLSP_NEEDED */
670#else /* !YYPURE */
671# define YYLEX yylex ()
672#endif /* !YYPURE */
673
674
675/* Enable debugging if requested. */
676#if YYDEBUG
677
678# ifndef YYFPRINTF
679# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
680# define YYFPRINTF fprintf
681# endif
682
683# define YYDPRINTF(Args) \
684do { \
685 if (yydebug) \
686 YYFPRINTF Args; \
687} while (0)
688/* Nonzero means print parse trace. It is left uninitialized so that
689 multiple parsers can coexist. */
690int yydebug;
691#else /* !YYDEBUG */
692# define YYDPRINTF(Args)
693#endif /* !YYDEBUG */
694
695/* YYINITDEPTH -- initial size of the parser's stacks. */
696#ifndef YYINITDEPTH
697# define YYINITDEPTH 200
698#endif
699
700/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
701 if the built-in stack extension method is used).
702
703 Do not make this value too large; the results are undefined if
704 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
705 evaluated with infinite-precision integer arithmetic. */
706
707#if YYMAXDEPTH == 0
708# undef YYMAXDEPTH
709#endif
710
711#ifndef YYMAXDEPTH
712# define YYMAXDEPTH 10000
713#endif
714
715
716#ifdef YYERROR_VERBOSE
717
718# ifndef yystrlen
719# if defined (__GLIBC__) && defined (_STRING_H)
720# define yystrlen strlen
721# else
722/* Return the length of YYSTR. */
723static YYSIZE_T
724# if defined (__STDC__) || defined (__cplusplus)
725yystrlen (const char *yystr)
726# else
727yystrlen (yystr)
728 const char *yystr;
729# endif
730{
731 register const char *yys = yystr;
732
733 while (*yys++ != '\0')
734 continue;
735
736 return yys - yystr - 1;
737}
738# endif
739# endif
740
741# ifndef yystpcpy
742# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
743# define yystpcpy stpcpy
744# else
745/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
746 YYDEST. */
747static char *
748# if defined (__STDC__) || defined (__cplusplus)
749yystpcpy (char *yydest, const char *yysrc)
750# else
751yystpcpy (yydest, yysrc)
752 char *yydest;
753 const char *yysrc;
754# endif
755{
756 register char *yyd = yydest;
757 register const char *yys = yysrc;
758
759 while ((*yyd++ = *yys++) != '\0')
760 continue;
761
762 return yyd - 1;
763}
764# endif
765# endif
766#endif
767
768
769#line 315 "/usr/share/bison-1.35/bison.simple"
770
771
772/* The user can define YYPARSE_PARAM as the name of an argument to be passed
773 into yyparse. The argument should have type void *.
774 It should actually point to an object.
775 Grammar actions can access the variable by casting it
776 to the proper pointer type. */
777
778#ifdef YYPARSE_PARAM
779# if defined (__STDC__) || defined (__cplusplus)
780# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
781# define YYPARSE_PARAM_DECL
782# else
783# define YYPARSE_PARAM_ARG YYPARSE_PARAM
784# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
785# endif
786#else /* !YYPARSE_PARAM */
787# define YYPARSE_PARAM_ARG
788# define YYPARSE_PARAM_DECL
789#endif /* !YYPARSE_PARAM */
790
791/* Prevent warning if -Wstrict-prototypes. */
792#ifdef __GNUC__
793# ifdef YYPARSE_PARAM
794int yyparse (void *);
795# else
796int yyparse (void);
797# endif
798#endif
799
800/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
801 variables are global, or local to YYPARSE. */
802
803#define YY_DECL_NON_LSP_VARIABLES \
804/* The lookahead symbol. */ \
805int yychar; \
806 \
807/* The semantic value of the lookahead symbol. */ \
808YYSTYPE yylval; \
809 \
810/* Number of parse errors so far. */ \
811int yynerrs;
812
813#if YYLSP_NEEDED
814# define YY_DECL_VARIABLES \
815YY_DECL_NON_LSP_VARIABLES \
816 \
817/* Location data for the lookahead symbol. */ \
818YYLTYPE yylloc;
819#else
820# define YY_DECL_VARIABLES \
821YY_DECL_NON_LSP_VARIABLES
822#endif
823
824
825/* If nonreentrant, generate the variables here. */
826
827#if !YYPURE
828YY_DECL_VARIABLES
829#endif /* !YYPURE */
830
831int
832yyparse (YYPARSE_PARAM_ARG)
833 YYPARSE_PARAM_DECL
834{
835 /* If reentrant, generate the variables here. */
836#if YYPURE
837 YY_DECL_VARIABLES
838#endif /* !YYPURE */
839
840 register int yystate;
841 register int yyn;
842 int yyresult;
843 /* Number of tokens to shift before error messages enabled. */
844 int yyerrstatus;
845 /* Lookahead token as an internal (translated) token number. */
846 int yychar1 = 0;
847
848 /* Three stacks and their tools:
849 `yyss': related to states,
850 `yyvs': related to semantic values,
851 `yyls': related to locations.
852
853 Refer to the stacks thru separate pointers, to allow yyoverflow
854 to reallocate them elsewhere. */
855
856 /* The state stack. */
857 short yyssa[YYINITDEPTH];
858 short *yyss = yyssa;
859 register short *yyssp;
860
861 /* The semantic value stack. */
862 YYSTYPE yyvsa[YYINITDEPTH];
863 YYSTYPE *yyvs = yyvsa;
864 register YYSTYPE *yyvsp;
865
866#if YYLSP_NEEDED
867 /* The location stack. */
868 YYLTYPE yylsa[YYINITDEPTH];
869 YYLTYPE *yyls = yylsa;
870 YYLTYPE *yylsp;
871#endif
872
873#if YYLSP_NEEDED
874# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
875#else
876# define YYPOPSTACK (yyvsp--, yyssp--)
877#endif
878
879 YYSIZE_T yystacksize = YYINITDEPTH;
880
881
882 /* The variables used to return semantic value and location from the
883 action routines. */
884 YYSTYPE yyval;
885#if YYLSP_NEEDED
886 YYLTYPE yyloc;
887#endif
888
889 /* When reducing, the number of symbols on the RHS of the reduced
890 rule. */
891 int yylen;
892
893 YYDPRINTF ((stderr, "Starting parse\n"));
894
895 yystate = 0;
896 yyerrstatus = 0;
897 yynerrs = 0;
898 yychar = YYEMPTY; /* Cause a token to be read. */
899
900 /* Initialize stack pointers.
901 Waste one element of value and location stack
902 so that they stay on the same level as the state stack.
903 The wasted elements are never initialized. */
904
905 yyssp = yyss;
906 yyvsp = yyvs;
907#if YYLSP_NEEDED
908 yylsp = yyls;
909#endif
910 goto yysetstate;
911
912/*------------------------------------------------------------.
913| yynewstate -- Push a new state, which is found in yystate. |
914`------------------------------------------------------------*/
915 yynewstate:
916 /* In all cases, when you get here, the value and location stacks
917 have just been pushed. so pushing a state here evens the stacks.
918 */
919 yyssp++;
920
921 yysetstate:
922 *yyssp = yystate;
923
924 if (yyssp >= yyss + yystacksize - 1)
925 {
926 /* Get the current used size of the three stacks, in elements. */
927 YYSIZE_T yysize = yyssp - yyss + 1;
928
929#ifdef yyoverflow
930 {
931 /* Give user a chance to reallocate the stack. Use copies of
932 these so that the &'s don't force the real ones into
933 memory. */
934 YYSTYPE *yyvs1 = yyvs;
935 short *yyss1 = yyss;
936
937 /* Each stack pointer address is followed by the size of the
938 data in use in that stack, in bytes. */
939# if YYLSP_NEEDED
940 YYLTYPE *yyls1 = yyls;
941 /* This used to be a conditional around just the two extra args,
942 but that might be undefined if yyoverflow is a macro. */
943 yyoverflow ("parser stack overflow",
944 &yyss1, yysize * sizeof (*yyssp),
945 &yyvs1, yysize * sizeof (*yyvsp),
946 &yyls1, yysize * sizeof (*yylsp),
947 &yystacksize);
948 yyls = yyls1;
949# else
950 yyoverflow ("parser stack overflow",
951 &yyss1, yysize * sizeof (*yyssp),
952 &yyvs1, yysize * sizeof (*yyvsp),
953 &yystacksize);
954# endif
955 yyss = yyss1;
956 yyvs = yyvs1;
957 }
958#else /* no yyoverflow */
959# ifndef YYSTACK_RELOCATE
960 goto yyoverflowlab;
961# else
962 /* Extend the stack our own way. */
963 if (yystacksize >= YYMAXDEPTH)
964 goto yyoverflowlab;
965 yystacksize *= 2;
966 if (yystacksize > YYMAXDEPTH)
967 yystacksize = YYMAXDEPTH;
968
969 {
970 short *yyss1 = yyss;
971 union yyalloc *yyptr =
972 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
973 if (! yyptr)
974 goto yyoverflowlab;
975 YYSTACK_RELOCATE (yyss);
976 YYSTACK_RELOCATE (yyvs);
977# if YYLSP_NEEDED
978 YYSTACK_RELOCATE (yyls);
979# endif
980# undef YYSTACK_RELOCATE
981 if (yyss1 != yyssa)
982 YYSTACK_FREE (yyss1);
983 }
984# endif
985#endif /* no yyoverflow */
986
987 yyssp = yyss + yysize - 1;
988 yyvsp = yyvs + yysize - 1;
989#if YYLSP_NEEDED
990 yylsp = yyls + yysize - 1;
991#endif
992
993 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
994 (unsigned long int) yystacksize));
995
996 if (yyssp >= yyss + yystacksize - 1)
997 YYABORT;
998 }
999
1000 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1001
1002 goto yybackup;
1003
1004
1005/*-----------.
1006| yybackup. |
1007`-----------*/
1008yybackup:
1009
1010/* Do appropriate processing given the current state. */
1011/* Read a lookahead token if we need one and don't already have one. */
1012/* yyresume: */
1013
1014 /* First try to decide what to do without reference to lookahead token. */
1015
1016 yyn = yypact[yystate];
1017 if (yyn == YYFLAG)
1018 goto yydefault;
1019
1020 /* Not known => get a lookahead token if don't already have one. */
1021
1022 /* yychar is either YYEMPTY or YYEOF
1023 or a valid token in external form. */
1024
1025 if (yychar == YYEMPTY)
1026 {
1027 YYDPRINTF ((stderr, "Reading a token: "));
1028 yychar = YYLEX;
1029 }
1030
1031 /* Convert token to internal form (in yychar1) for indexing tables with */
1032
1033 if (yychar <= 0) /* This means end of input. */
1034 {
1035 yychar1 = 0;
1036 yychar = YYEOF; /* Don't call YYLEX any more */
1037
1038 YYDPRINTF ((stderr, "Now at end of input.\n"));
1039 }
1040 else
1041 {
1042 yychar1 = YYTRANSLATE (yychar);
1043
1044#if YYDEBUG
1045 /* We have to keep this `#if YYDEBUG', since we use variables
1046 which are defined only if `YYDEBUG' is set. */
1047 if (yydebug)
1048 {
1049 YYFPRINTF (stderr, "Next token is %d (%s",
1050 yychar, yytname[yychar1]);
1051 /* Give the individual parser a way to print the precise
1052 meaning of a token, for further debugging info. */
1053# ifdef YYPRINT
1054 YYPRINT (stderr, yychar, yylval);
1055# endif
1056 YYFPRINTF (stderr, ")\n");
1057 }
1058#endif
1059 }
1060
1061 yyn += yychar1;
1062 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1063 goto yydefault;
1064
1065 yyn = yytable[yyn];
1066
1067 /* yyn is what to do for this token type in this state.
1068 Negative => reduce, -yyn is rule number.
1069 Positive => shift, yyn is new state.
1070 New state is final state => don't bother to shift,
1071 just return success.
1072 0, or most negative number => error. */
1073
1074 if (yyn < 0)
1075 {
1076 if (yyn == YYFLAG)
1077 goto yyerrlab;
1078 yyn = -yyn;
1079 goto yyreduce;
1080 }
1081 else if (yyn == 0)
1082 goto yyerrlab;
1083
1084 if (yyn == YYFINAL)
1085 YYACCEPT;
1086
1087 /* Shift the lookahead token. */
1088 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
1089 yychar, yytname[yychar1]));
1090
1091 /* Discard the token being shifted unless it is eof. */
1092 if (yychar != YYEOF)
1093 yychar = YYEMPTY;
1094
1095 *++yyvsp = yylval;
1096#if YYLSP_NEEDED
1097 *++yylsp = yylloc;
1098#endif
1099
1100 /* Count tokens shifted since error; after three, turn off error
1101 status. */
1102 if (yyerrstatus)
1103 yyerrstatus--;
1104
1105 yystate = yyn;
1106 goto yynewstate;
1107
1108
1109/*-----------------------------------------------------------.
1110| yydefault -- do the default action for the current state. |
1111`-----------------------------------------------------------*/
1112yydefault:
1113 yyn = yydefact[yystate];
1114 if (yyn == 0)
1115 goto yyerrlab;
1116 goto yyreduce;
1117
1118
1119/*-----------------------------.
1120| yyreduce -- Do a reduction. |
1121`-----------------------------*/
1122yyreduce:
1123 /* yyn is the number of a rule to reduce with. */
1124 yylen = yyr2[yyn];
1125
1126 /* If YYLEN is nonzero, implement the default value of the action:
1127 `$$ = $1'.
1128
1129 Otherwise, the following line sets YYVAL to the semantic value of
1130 the lookahead token. This behavior is undocumented and Bison
1131 users should not rely upon it. Assigning to YYVAL
1132 unconditionally makes the parser a bit smaller, and it avoids a
1133 GCC warning that YYVAL may be used uninitialized. */
1134 yyval = yyvsp[1-yylen];
1135
1136#if YYLSP_NEEDED
1137 /* Similarly for the default location. Let the user run additional
1138 commands if for instance locations are ranges. */
1139 yyloc = yylsp[1-yylen];
1140 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1141#endif
1142
1143#if YYDEBUG
1144 /* We have to keep this `#if YYDEBUG', since we use variables which
1145 are defined only if `YYDEBUG' is set. */
1146 if (yydebug)
1147 {
1148 int yyi;
1149
1150 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
1151 yyn, yyrline[yyn]);
1152
1153 /* Print the symbols being reduced, and their result. */
1154 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
1155 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1156 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1157 }
1158#endif
1159
1160 switch (yyn) {
1161
1162case 4:
1163#line 311 "itbl-parse.y"
1164{
1165 DBG (("line %d: entry pnum=%d type=%d name=%s value=x%x\n",
1166 insntbl_line, yyvsp[-4].num, yyvsp[-3].num, yyvsp[-2].str, yyvsp[-1].val));
1167 itbl_add_reg (yyvsp[-4].num, yyvsp[-3].num, yyvsp[-2].str, yyvsp[-1].val);
1168 }
1169 break;
1170case 5:
1171#line 317 "itbl-parse.y"
1172{
1173 DBG (("line %d: entry pnum=%d type=INSN name=%s value=x%x",
1174 insntbl_line, yyvsp[-5].num, yyvsp[-3].str, yyvsp[-2].val));
1175 DBG ((" sbit=%d ebit=%d flags=0x%x\n", sbit, ebit, yyvsp[0].val));
1176 insn=itbl_add_insn (yyvsp[-5].num, yyvsp[-3].str, yyvsp[-2].val, sbit, ebit, yyvsp[0].val);
1177 }
1178 break;
1179case 6:
1180#line 324 "itbl-parse.y"
1181{}
1182 break;
1183case 12:
1184#line 337 "itbl-parse.y"
1185{
1186 DBGL2 (("ftype\n"));
1187 yyval.num = yyvsp[0].num;
1188 }
1189 break;
1190case 13:
1191#line 342 "itbl-parse.y"
1192{
1193 DBGL2 (("addr\n"));
1194 yyval.num = ADDR;
1195 }
1196 break;
1197case 14:
1198#line 347 "itbl-parse.y"
1199{
1200 DBGL2 (("immed\n"));
1201 yyval.num = IMMED;
1202 }
1203 break;
1204case 15:
1205#line 355 "itbl-parse.y"
1206{
1207 DBG (("line %d: field type=%d sbit=%d ebit=%d, flags=0x%x\n",
1208 insntbl_line, yyvsp[-2].num, sbit, ebit, yyvsp[0].val));
1209 itbl_add_operand (insn, yyvsp[-2].num, sbit, ebit, yyvsp[0].val);
1210 }
1211 break;
1212case 16:
1213#line 364 "itbl-parse.y"
1214{
1215 yyval.val = yyvsp[-2].num | yyvsp[0].val;
1216 }
1217 break;
1218case 17:
1219#line 368 "itbl-parse.y"
1220{
1221 yyval.val = yyvsp[-1].val;
1222 }
1223 break;
1224case 18:
1225#line 372 "itbl-parse.y"
1226{
1227 yyval.val = yyvsp[0].num;
1228 }
1229 break;
1230case 19:
1231#line 379 "itbl-parse.y"
1232{
1233 DBGL2 (("flags=%d\n", yyvsp[0].val));
1234 yyval.val = yyvsp[0].val;
1235 }
1236 break;
1237case 20:
1238#line 384 "itbl-parse.y"
1239{
1240 yyval.val = 0;
1241 }
1242 break;
1243case 21:
1244#line 391 "itbl-parse.y"
1245{
1246 DBGL2 (("range %d %d\n", yyvsp[-2].num, yyvsp[0].num));
1247 sbit = yyvsp[-2].num;
1248 ebit = yyvsp[0].num;
1249 }
1250 break;
1251case 22:
1252#line 397 "itbl-parse.y"
1253{
1254 sbit = 31;
1255 ebit = 0;
1256 }
1257 break;
1258case 23:
1259#line 405 "itbl-parse.y"
1260{
1261 DBGL2 (("pnum=%d\n",yyvsp[0].num));
1262 yyval.num = yyvsp[0].num;
1263 }
1264 break;
1265case 24:
1266#line 413 "itbl-parse.y"
1267{
1268 DBGL2 (("dreg\n"));
1269 yyval.num = DREG;
1270 }
1271 break;
1272case 25:
1273#line 418 "itbl-parse.y"
1274{
1275 DBGL2 (("creg\n"));
1276 yyval.num = CREG;
1277 }
1278 break;
1279case 26:
1280#line 423 "itbl-parse.y"
1281{
1282 DBGL2 (("greg\n"));
1283 yyval.num = GREG;
1284 }
1285 break;
1286case 27:
1287#line 431 "itbl-parse.y"
1288{
1289 DBGL2 (("name=%s\n",yyvsp[0].str));
1290 yyval.str = yyvsp[0].str;
1291 }
1292 break;
1293case 28:
1294#line 439 "itbl-parse.y"
1295{
1296 DBGL2 (("num=%d\n",yyvsp[0].num));
1297 yyval.num = yyvsp[0].num;
1298 }
1299 break;
1300case 29:
1301#line 447 "itbl-parse.y"
1302{
1303 DBGL2 (("val=x%x\n",yyvsp[0].num));
1304 yyval.val = yyvsp[0].num;
1305 }
1306 break;
1307}
1308
1309#line 705 "/usr/share/bison-1.35/bison.simple"
1310
1311
1312
1313 yyvsp -= yylen;
1314 yyssp -= yylen;
1315#if YYLSP_NEEDED
1316 yylsp -= yylen;
1317#endif
1318
1319#if YYDEBUG
1320 if (yydebug)
1321 {
1322 short *yyssp1 = yyss - 1;
1323 YYFPRINTF (stderr, "state stack now");
1324 while (yyssp1 != yyssp)
1325 YYFPRINTF (stderr, " %d", *++yyssp1);
1326 YYFPRINTF (stderr, "\n");
1327 }
1328#endif
1329
1330 *++yyvsp = yyval;
1331#if YYLSP_NEEDED
1332 *++yylsp = yyloc;
1333#endif
1334
1335 /* Now `shift' the result of the reduction. Determine what state
1336 that goes to, based on the state we popped back to and the rule
1337 number reduced by. */
1338
1339 yyn = yyr1[yyn];
1340
1341 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1342 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1343 yystate = yytable[yystate];
1344 else
1345 yystate = yydefgoto[yyn - YYNTBASE];
1346
1347 goto yynewstate;
1348
1349
1350/*------------------------------------.
1351| yyerrlab -- here on detecting error |
1352`------------------------------------*/
1353yyerrlab:
1354 /* If not already recovering from an error, report this error. */
1355 if (!yyerrstatus)
1356 {
1357 ++yynerrs;
1358
1359#ifdef YYERROR_VERBOSE
1360 yyn = yypact[yystate];
1361
1362 if (yyn > YYFLAG && yyn < YYLAST)
1363 {
1364 YYSIZE_T yysize = 0;
1365 char *yymsg;
1366 int yyx, yycount;
1367
1368 yycount = 0;
1369 /* Start YYX at -YYN if negative to avoid negative indexes in
1370 YYCHECK. */
1371 for (yyx = yyn < 0 ? -yyn : 0;
1372 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1373 if (yycheck[yyx + yyn] == yyx)
1374 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1375 yysize += yystrlen ("parse error, unexpected ") + 1;
1376 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
1377 yymsg = (char *) YYSTACK_ALLOC (yysize);
1378 if (yymsg != 0)
1379 {
1380 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1381 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
1382
1383 if (yycount < 5)
1384 {
1385 yycount = 0;
1386 for (yyx = yyn < 0 ? -yyn : 0;
1387 yyx < (int) (sizeof (yytname) / sizeof (char *));
1388 yyx++)
1389 if (yycheck[yyx + yyn] == yyx)
1390 {
1391 const char *yyq = ! yycount ? ", expecting " : " or ";
1392 yyp = yystpcpy (yyp, yyq);
1393 yyp = yystpcpy (yyp, yytname[yyx]);
1394 yycount++;
1395 }
1396 }
1397 yyerror (yymsg);
1398 YYSTACK_FREE (yymsg);
1399 }
1400 else
1401 yyerror ("parse error; also virtual memory exhausted");
1402 }
1403 else
1404#endif /* defined (YYERROR_VERBOSE) */
1405 yyerror ("parse error");
1406 }
1407 goto yyerrlab1;
1408
1409
1410/*--------------------------------------------------.
1411| yyerrlab1 -- error raised explicitly by an action |
1412`--------------------------------------------------*/
1413yyerrlab1:
1414 if (yyerrstatus == 3)
1415 {
1416 /* If just tried and failed to reuse lookahead token after an
1417 error, discard it. */
1418
1419 /* return failure if at end of input */
1420 if (yychar == YYEOF)
1421 YYABORT;
1422 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1423 yychar, yytname[yychar1]));
1424 yychar = YYEMPTY;
1425 }
1426
1427 /* Else will try to reuse lookahead token after shifting the error
1428 token. */
1429
1430 yyerrstatus = 3; /* Each real token shifted decrements this */
1431
1432 goto yyerrhandle;
1433
1434
1435/*-------------------------------------------------------------------.
1436| yyerrdefault -- current state does not do anything special for the |
1437| error token. |
1438`-------------------------------------------------------------------*/
1439yyerrdefault:
1440#if 0
1441 /* This is wrong; only states that explicitly want error tokens
1442 should shift them. */
1443
1444 /* If its default is to accept any token, ok. Otherwise pop it. */
1445 yyn = yydefact[yystate];
1446 if (yyn)
1447 goto yydefault;
1448#endif
1449
1450
1451/*---------------------------------------------------------------.
1452| yyerrpop -- pop the current state because it cannot handle the |
1453| error token |
1454`---------------------------------------------------------------*/
1455yyerrpop:
1456 if (yyssp == yyss)
1457 YYABORT;
1458 yyvsp--;
1459 yystate = *--yyssp;
1460#if YYLSP_NEEDED
1461 yylsp--;
1462#endif
1463
1464#if YYDEBUG
1465 if (yydebug)
1466 {
1467 short *yyssp1 = yyss - 1;
1468 YYFPRINTF (stderr, "Error: state stack now");
1469 while (yyssp1 != yyssp)
1470 YYFPRINTF (stderr, " %d", *++yyssp1);
1471 YYFPRINTF (stderr, "\n");
1472 }
1473#endif
1474
1475/*--------------.
1476| yyerrhandle. |
1477`--------------*/
1478yyerrhandle:
1479 yyn = yypact[yystate];
1480 if (yyn == YYFLAG)
1481 goto yyerrdefault;
1482
1483 yyn += YYTERROR;
1484 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1485 goto yyerrdefault;
1486
1487 yyn = yytable[yyn];
1488 if (yyn < 0)
1489 {
1490 if (yyn == YYFLAG)
1491 goto yyerrpop;
1492 yyn = -yyn;
1493 goto yyreduce;
1494 }
1495 else if (yyn == 0)
1496 goto yyerrpop;
1497
1498 if (yyn == YYFINAL)
1499 YYACCEPT;
1500
1501 YYDPRINTF ((stderr, "Shifting error token, "));
1502
1503 *++yyvsp = yylval;
1504#if YYLSP_NEEDED
1505 *++yylsp = yylloc;
1506#endif
1507
1508 yystate = yyn;
1509 goto yynewstate;
1510
1511
1512/*-------------------------------------.
1513| yyacceptlab -- YYACCEPT comes here. |
1514`-------------------------------------*/
1515yyacceptlab:
1516 yyresult = 0;
1517 goto yyreturn;
1518
1519/*-----------------------------------.
1520| yyabortlab -- YYABORT comes here. |
1521`-----------------------------------*/
1522yyabortlab:
1523 yyresult = 1;
1524 goto yyreturn;
1525
1526/*---------------------------------------------.
1527| yyoverflowab -- parser overflow comes here. |
1528`---------------------------------------------*/
1529yyoverflowlab:
1530 yyerror ("parser stack overflow");
1531 yyresult = 2;
1532 /* Fall through. */
1533
1534yyreturn:
1535#ifndef yyoverflow
1536 if (yyss != yyssa)
1537 YYSTACK_FREE (yyss);
1538#endif
1539 return yyresult;
1540}
1541#line 452 "itbl-parse.y"
1542
1543
1544static int
1545yyerror (msg)
1546 const char *msg;
1547{
1548 printf ("line %d: %s\n", insntbl_line, msg);
1549 return 0;
1550}
Note: See TracBrowser for help on using the repository browser.