1/* A Bison parser, made by GNU Bison 1.875.  */
2
3/* Skeleton parser for Yacc-like parsing with Bison,
4   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   This program is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with this program; if not, write to the Free Software
18   Foundation, Inc., 59 Temple Place - Suite 330,
19   Boston, MA 02111-1307, USA.  */
20
21/* As a special exception, when this file is copied by Bison into a
22   Bison output file, you may use that output file without restriction.
23   This special exception was added by the Free Software Foundation
24   in version 1.24 of Bison.  */
25
26/* Written by Richard Stallman by simplifying the original so called
27   ``semantic'' parser.  */
28
29/* All symbols defined below should begin with yy or YY, to avoid
30   infringing on user name space.  This should be done even for local
31   variables, as they might otherwise be expanded by user macros.
32   There are some unavoidable exceptions within include files to
33   define necessary library symbols; they are noted "INFRINGES ON
34   USER NAME SPACE" below.  */
35
36/* Identify Bison output.  */
37#define YYBISON 1
38
39/* Skeleton name.  */
40#define YYSKELETON_NAME "yacc.c"
41
42/* Pure parsers.  */
43#define YYPURE 0
44
45/* Using locations.  */
46#define YYLSP_NEEDED 0
47
48
49
50/* Tokens.  */
51#ifndef YYTOKENTYPE
52# define YYTOKENTYPE
53   /* Put the tokens into the symbol table, so that GDB and other debuggers
54      know about them.  */
55   enum yytokentype {
56     INT = 258,
57     FLOAT = 259,
58     STRING_LITERAL = 260,
59     BOOLEAN_LITERAL = 261,
60     NAME = 262,
61     TYPENAME = 263,
62     NAME_OR_INT = 264,
63     SIZEOF = 265,
64     ERROR = 266,
65     INT_KEYWORD = 267,
66     INT_S2_KEYWORD = 268,
67     LOGICAL_S1_KEYWORD = 269,
68     LOGICAL_S2_KEYWORD = 270,
69     LOGICAL_KEYWORD = 271,
70     REAL_KEYWORD = 272,
71     REAL_S8_KEYWORD = 273,
72     REAL_S16_KEYWORD = 274,
73     COMPLEX_S8_KEYWORD = 275,
74     COMPLEX_S16_KEYWORD = 276,
75     COMPLEX_S32_KEYWORD = 277,
76     BOOL_AND = 278,
77     BOOL_OR = 279,
78     BOOL_NOT = 280,
79     CHARACTER = 281,
80     VARIABLE = 282,
81     ASSIGN_MODIFY = 283,
82     ABOVE_COMMA = 284,
83     NOTEQUAL = 285,
84     EQUAL = 286,
85     GEQ = 287,
86     LEQ = 288,
87     GREATERTHAN = 289,
88     LESSTHAN = 290,
89     RSH = 291,
90     LSH = 292,
91     UNARY = 293
92   };
93#endif
94#define INT 258
95#define FLOAT 259
96#define STRING_LITERAL 260
97#define BOOLEAN_LITERAL 261
98#define NAME 262
99#define TYPENAME 263
100#define NAME_OR_INT 264
101#define SIZEOF 265
102#define ERROR 266
103#define INT_KEYWORD 267
104#define INT_S2_KEYWORD 268
105#define LOGICAL_S1_KEYWORD 269
106#define LOGICAL_S2_KEYWORD 270
107#define LOGICAL_KEYWORD 271
108#define REAL_KEYWORD 272
109#define REAL_S8_KEYWORD 273
110#define REAL_S16_KEYWORD 274
111#define COMPLEX_S8_KEYWORD 275
112#define COMPLEX_S16_KEYWORD 276
113#define COMPLEX_S32_KEYWORD 277
114#define BOOL_AND 278
115#define BOOL_OR 279
116#define BOOL_NOT 280
117#define CHARACTER 281
118#define VARIABLE 282
119#define ASSIGN_MODIFY 283
120#define ABOVE_COMMA 284
121#define NOTEQUAL 285
122#define EQUAL 286
123#define GEQ 287
124#define LEQ 288
125#define GREATERTHAN 289
126#define LESSTHAN 290
127#define RSH 291
128#define LSH 292
129#define UNARY 293
130
131
132
133
134/* Copy the first part of user declarations.  */
135#line 44 "f-exp.y"
136
137
138#include "defs.h"
139#include "gdb_string.h"
140#include "expression.h"
141#include "value.h"
142#include "parser-defs.h"
143#include "language.h"
144#include "f-lang.h"
145#include "bfd.h" /* Required by objfiles.h.  */
146#include "symfile.h" /* Required by objfiles.h.  */
147#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
148#include "block.h"
149#include <ctype.h>
150
151/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
152   as well as gratuitiously global symbol names, so we can have multiple
153   yacc generated parsers in gdb.  Note that these are only the variables
154   produced by yacc.  If other parser generators (bison, byacc, etc) produce
155   additional global names that conflict at link time, then those parser
156   generators need to be fixed instead of adding those names to this list. */
157
158#define	yymaxdepth f_maxdepth
159#define	yyparse	f_parse
160#define	yylex	f_lex
161#define	yyerror	f_error
162#define	yylval	f_lval
163#define	yychar	f_char
164#define	yydebug	f_debug
165#define	yypact	f_pact
166#define	yyr1	f_r1
167#define	yyr2	f_r2
168#define	yydef	f_def
169#define	yychk	f_chk
170#define	yypgo	f_pgo
171#define	yyact	f_act
172#define	yyexca	f_exca
173#define yyerrflag f_errflag
174#define yynerrs	f_nerrs
175#define	yyps	f_ps
176#define	yypv	f_pv
177#define	yys	f_s
178#define	yy_yys	f_yys
179#define	yystate	f_state
180#define	yytmp	f_tmp
181#define	yyv	f_v
182#define	yy_yyv	f_yyv
183#define	yyval	f_val
184#define	yylloc	f_lloc
185#define yyreds	f_reds		/* With YYDEBUG defined */
186#define yytoks	f_toks		/* With YYDEBUG defined */
187#define yyname	f_name		/* With YYDEBUG defined */
188#define yyrule	f_rule		/* With YYDEBUG defined */
189#define yylhs	f_yylhs
190#define yylen	f_yylen
191#define yydefred f_yydefred
192#define yydgoto	f_yydgoto
193#define yysindex f_yysindex
194#define yyrindex f_yyrindex
195#define yygindex f_yygindex
196#define yytable	 f_yytable
197#define yycheck	 f_yycheck
198
199#ifndef YYDEBUG
200#define	YYDEBUG	1		/* Default to yydebug support */
201#endif
202
203#define YYFPRINTF parser_fprintf
204
205int yyparse (void);
206
207static int yylex (void);
208
209void yyerror (char *);
210
211static void growbuf_by_size (int);
212
213static int match_string_literal (void);
214
215
216
217/* Enabling traces.  */
218#ifndef YYDEBUG
219# define YYDEBUG 0
220#endif
221
222/* Enabling verbose error messages.  */
223#ifdef YYERROR_VERBOSE
224# undef YYERROR_VERBOSE
225# define YYERROR_VERBOSE 1
226#else
227# define YYERROR_VERBOSE 0
228#endif
229
230#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
231#line 130 "f-exp.y"
232typedef union YYSTYPE {
233    LONGEST lval;
234    struct {
235      LONGEST val;
236      struct type *type;
237    } typed_val;
238    DOUBLEST dval;
239    struct symbol *sym;
240    struct type *tval;
241    struct stoken sval;
242    struct ttype tsym;
243    struct symtoken ssym;
244    int voidval;
245    struct block *bval;
246    enum exp_opcode opcode;
247    struct internalvar *ivar;
248
249    struct type **tvec;
250    int *ivec;
251  } YYSTYPE;
252/* Line 191 of yacc.c.  */
253# define yystype YYSTYPE /* obsolescent; will be withdrawn */
254# define YYSTYPE_IS_DECLARED 1
255# define YYSTYPE_IS_TRIVIAL 1
256#endif
257
258
259
260/* Copy the second part of user declarations.  */
261#line 151 "f-exp.y"
262
263/* YYSTYPE gets defined by %union */
264static int parse_number (char *, int, int, YYSTYPE *);
265
266
267/* Line 214 of yacc.c.  */
268
269#if ! defined (yyoverflow) || YYERROR_VERBOSE
270
271/* The parser invokes alloca or xmalloc; define the necessary symbols.  */
272
273# if YYSTACK_USE_ALLOCA
274#  define YYSTACK_ALLOC alloca
275# else
276#  ifndef YYSTACK_USE_ALLOCA
277#   if defined (alloca) || defined (_ALLOCA_H)
278#    define YYSTACK_ALLOC alloca
279#   else
280#    ifdef __GNUC__
281#     define YYSTACK_ALLOC __builtin_alloca
282#    endif
283#   endif
284#  endif
285# endif
286
287# ifdef YYSTACK_ALLOC
288   /* Pacify GCC's `empty if-body' warning. */
289#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
290# else
291#  if defined (__STDC__) || defined (__cplusplus)
292#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
293#   define YYSIZE_T size_t
294#  endif
295#  define YYSTACK_ALLOC xmalloc
296#  define YYSTACK_FREE free
297# endif
298#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
299
300
301#if (! defined (yyoverflow) \
302     && (! defined (__cplusplus) \
303	 || (YYSTYPE_IS_TRIVIAL)))
304
305/* A type that is properly aligned for any stack member.  */
306union yyalloc
307{
308  short yyss;
309  YYSTYPE yyvs;
310  };
311
312/* The size of the maximum gap between one aligned stack and the next.  */
313# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
314
315/* The size of an array large to enough to hold all stacks, each with
316   N elements.  */
317# define YYSTACK_BYTES(N) \
318     ((N) * (sizeof (short) + sizeof (YYSTYPE))				\
319      + YYSTACK_GAP_MAXIMUM)
320
321/* Copy COUNT objects from FROM to TO.  The source and destination do
322   not overlap.  */
323# ifndef YYCOPY
324#  if 1 < __GNUC__
325#   define YYCOPY(To, From, Count) \
326      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
327#  else
328#   define YYCOPY(To, From, Count)		\
329      do					\
330	{					\
331	  register YYSIZE_T yyi;		\
332	  for (yyi = 0; yyi < (Count); yyi++)	\
333	    (To)[yyi] = (From)[yyi];		\
334	}					\
335      while (0)
336#  endif
337# endif
338
339/* Relocate STACK from its old location to the new one.  The
340   local variables YYSIZE and YYSTACKSIZE give the old and new number of
341   elements in the stack, and YYPTR gives the new location of the
342   stack.  Advance YYPTR to a properly aligned location for the next
343   stack.  */
344# define YYSTACK_RELOCATE(Stack)					\
345    do									\
346      {									\
347	YYSIZE_T yynewbytes;						\
348	YYCOPY (&yyptr->Stack, Stack, yysize);				\
349	Stack = &yyptr->Stack;						\
350	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
351	yyptr += yynewbytes / sizeof (*yyptr);				\
352      }									\
353    while (0)
354
355#endif
356
357#if defined (__STDC__) || defined (__cplusplus)
358   typedef signed char yysigned_char;
359#else
360   typedef short yysigned_char;
361#endif
362
363/* YYFINAL -- State number of the termination state. */
364#define YYFINAL  46
365/* YYLAST -- Last index in YYTABLE.  */
366#define YYLAST   460
367
368/* YYNTOKENS -- Number of terminals. */
369#define YYNTOKENS  55
370/* YYNNTS -- Number of nonterminals. */
371#define YYNNTS  17
372/* YYNRULES -- Number of rules. */
373#define YYNRULES  80
374/* YYNRULES -- Number of states. */
375#define YYNSTATES  125
376
377/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
378#define YYUNDEFTOK  2
379#define YYMAXUTOK   293
380
381#define YYTRANSLATE(YYX) 						\
382  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
383
384/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
385static const unsigned char yytranslate[] =
386{
387       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
388       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
389       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
390       2,     2,     2,     2,     2,     2,     2,    49,    35,     2,
391      51,    52,    47,    45,    29,    46,     2,    48,     2,     2,
392       2,     2,     2,     2,     2,     2,     2,     2,    54,     2,
393       2,    31,     2,    32,    44,     2,     2,     2,     2,     2,
394       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
395       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
396       2,     2,     2,     2,    34,     2,     2,     2,     2,     2,
397       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
398       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
399       2,     2,     2,     2,    33,     2,    53,     2,     2,     2,
400       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
401       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
402       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
403       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
404       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
405       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
406       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
407       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
408       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
409       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
410       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
411       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
412       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
413       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
414      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
415      25,    26,    27,    28,    30,    36,    37,    38,    39,    40,
416      41,    42,    43,    50
417};
418
419#if YYDEBUG
420/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
421   YYRHS.  */
422static const unsigned char yyprhs[] =
423{
424       0,     0,     3,     5,     7,     9,    13,    16,    19,    22,
425      25,    28,    31,    32,    38,    39,    41,    43,    47,    51,
426      55,    59,    64,    68,    72,    76,    80,    84,    88,    92,
427      96,   100,   104,   108,   112,   116,   120,   124,   128,   132,
428     136,   140,   144,   148,   150,   152,   154,   156,   158,   163,
429     165,   167,   169,   171,   173,   176,   178,   181,   183,   186,
430     188,   192,   195,   197,   200,   204,   206,   208,   210,   212,
431     214,   216,   218,   220,   222,   224,   226,   228,   230,   232,
432     236
433};
434
435/* YYRHS -- A `-1'-separated list of the rules' RHS. */
436static const yysigned_char yyrhs[] =
437{
438      56,     0,    -1,    58,    -1,    57,    -1,    64,    -1,    51,
439      58,    52,    -1,    47,    58,    -1,    35,    58,    -1,    46,
440      58,    -1,    25,    58,    -1,    53,    58,    -1,    10,    58,
441      -1,    -1,    58,    51,    59,    60,    52,    -1,    -1,    58,
442      -1,    61,    -1,    60,    29,    58,    -1,    58,    54,    58,
443      -1,    58,    29,    58,    -1,    51,    62,    52,    -1,    51,
444      64,    52,    58,    -1,    58,    44,    58,    -1,    58,    47,
445      58,    -1,    58,    48,    58,    -1,    58,    49,    58,    -1,
446      58,    45,    58,    -1,    58,    46,    58,    -1,    58,    43,
447      58,    -1,    58,    42,    58,    -1,    58,    37,    58,    -1,
448      58,    36,    58,    -1,    58,    39,    58,    -1,    58,    38,
449      58,    -1,    58,    41,    58,    -1,    58,    40,    58,    -1,
450      58,    35,    58,    -1,    58,    34,    58,    -1,    58,    33,
451      58,    -1,    58,    23,    58,    -1,    58,    24,    58,    -1,
452      58,    31,    58,    -1,    58,    28,    58,    -1,     3,    -1,
453       9,    -1,     4,    -1,    63,    -1,    27,    -1,    10,    51,
454      64,    52,    -1,     6,    -1,     5,    -1,    71,    -1,    65,
455      -1,    69,    -1,    69,    66,    -1,    47,    -1,    47,    66,
456      -1,    35,    -1,    35,    66,    -1,    67,    -1,    51,    66,
457      52,    -1,    67,    68,    -1,    68,    -1,    51,    52,    -1,
458      51,    70,    52,    -1,     8,    -1,    12,    -1,    13,    -1,
459      26,    -1,    16,    -1,    15,    -1,    14,    -1,    17,    -1,
460      18,    -1,    19,    -1,    20,    -1,    21,    -1,    22,    -1,
461      64,    -1,    70,    29,    64,    -1,     7,    -1
462};
463
464/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
465static const unsigned short yyrline[] =
466{
467       0,   228,   228,   229,   232,   238,   243,   247,   251,   255,
468     259,   263,   273,   272,   280,   283,   287,   291,   295,   300,
469     304,   308,   316,   320,   324,   328,   332,   336,   340,   344,
470     348,   352,   356,   360,   364,   368,   372,   376,   380,   384,
471     389,   393,   397,   403,   410,   419,   426,   429,   432,   440,
472     447,   455,   499,   502,   503,   546,   548,   550,   552,   554,
473     557,   559,   561,   565,   567,   572,   574,   576,   578,   580,
474     582,   584,   586,   588,   590,   592,   594,   596,   604,   609,
475     624
476};
477#endif
478
479#if YYDEBUG || YYERROR_VERBOSE
480/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
481   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
482static const char *const yytname[] =
483{
484  "$end", "error", "$undefined", "INT", "FLOAT", "STRING_LITERAL",
485  "BOOLEAN_LITERAL", "NAME", "TYPENAME", "NAME_OR_INT", "SIZEOF", "ERROR",
486  "INT_KEYWORD", "INT_S2_KEYWORD", "LOGICAL_S1_KEYWORD",
487  "LOGICAL_S2_KEYWORD", "LOGICAL_KEYWORD", "REAL_KEYWORD",
488  "REAL_S8_KEYWORD", "REAL_S16_KEYWORD", "COMPLEX_S8_KEYWORD",
489  "COMPLEX_S16_KEYWORD", "COMPLEX_S32_KEYWORD", "BOOL_AND", "BOOL_OR",
490  "BOOL_NOT", "CHARACTER", "VARIABLE", "ASSIGN_MODIFY", "','",
491  "ABOVE_COMMA", "'='", "'?'", "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL",
492  "GEQ", "LEQ", "GREATERTHAN", "LESSTHAN", "RSH", "LSH", "'@'", "'+'",
493  "'-'", "'*'", "'/'", "'%'", "UNARY", "'('", "')'", "'~'", "':'",
494  "$accept", "start", "type_exp", "exp", "@1", "arglist", "substring",
495  "complexnum", "variable", "type", "ptype", "abs_decl",
496  "direct_abs_decl", "func_mod", "typebase", "nonempty_typelist",
497  "name_not_typename", 0
498};
499#endif
500
501# ifdef YYPRINT
502/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
503   token YYLEX-NUM.  */
504static const unsigned short yytoknum[] =
505{
506       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
507     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
508     275,   276,   277,   278,   279,   280,   281,   282,   283,    44,
509     284,    61,    63,   124,    94,    38,   285,   286,   287,   288,
510     289,   290,   291,   292,    64,    43,    45,    42,    47,    37,
511     293,    40,    41,   126,    58
512};
513# endif
514
515/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
516static const unsigned char yyr1[] =
517{
518       0,    55,    56,    56,    57,    58,    58,    58,    58,    58,
519      58,    58,    59,    58,    60,    60,    60,    60,    61,    62,
520      58,    58,    58,    58,    58,    58,    58,    58,    58,    58,
521      58,    58,    58,    58,    58,    58,    58,    58,    58,    58,
522      58,    58,    58,    58,    58,    58,    58,    58,    58,    58,
523      58,    63,    64,    65,    65,    66,    66,    66,    66,    66,
524      67,    67,    67,    68,    68,    69,    69,    69,    69,    69,
525      69,    69,    69,    69,    69,    69,    69,    69,    70,    70,
526      71
527};
528
529/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
530static const unsigned char yyr2[] =
531{
532       0,     2,     1,     1,     1,     3,     2,     2,     2,     2,
533       2,     2,     0,     5,     0,     1,     1,     3,     3,     3,
534       3,     4,     3,     3,     3,     3,     3,     3,     3,     3,
535       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
536       3,     3,     3,     1,     1,     1,     1,     1,     4,     1,
537       1,     1,     1,     1,     2,     1,     2,     1,     2,     1,
538       3,     2,     1,     2,     3,     1,     1,     1,     1,     1,
539       1,     1,     1,     1,     1,     1,     1,     1,     1,     3,
540       1
541};
542
543/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
544   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
545   means the default is an error.  */
546static const unsigned char yydefact[] =
547{
548       0,    43,    45,    50,    49,    80,    65,    44,     0,    66,
549      67,    71,    70,    69,    72,    73,    74,    75,    76,    77,
550       0,    68,    47,     0,     0,     0,     0,     0,     0,     3,
551       2,    46,     4,    52,    53,    51,     0,    11,     9,     7,
552       8,     6,     0,     0,     0,    10,     1,     0,     0,     0,
553       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
554       0,     0,     0,     0,     0,     0,     0,     0,    12,    57,
555      55,     0,    54,    59,    62,     0,     0,     5,    20,     0,
556      39,    40,    42,    41,    38,    37,    36,    31,    30,    33,
557      32,    35,    34,    29,    28,    22,    26,    27,    23,    24,
558      25,    14,    58,    56,    63,    78,     0,     0,     0,    61,
559      48,    19,    21,    15,     0,    16,    60,     0,    64,     0,
560       0,    13,    79,    18,    17
561};
562
563/* YYDEFGOTO[NTERM-NUM]. */
564static const yysigned_char yydefgoto[] =
565{
566      -1,    28,    29,    42,   101,   114,   115,    43,    31,   105,
567      33,    72,    73,    74,    34,   107,    35
568};
569
570/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
571   STATE-NUM.  */
572#define YYPACT_NINF -59
573static const short yypact[] =
574{
575      77,   -59,   -59,   -59,   -59,   -59,   -59,   -59,   128,   -59,
576     -59,   -59,   -59,   -59,   -59,   -59,   -59,   -59,   -59,   -59,
577     137,   -59,   -59,   137,   137,   137,    77,   137,     2,   -59,
578     311,   -59,   -59,   -59,   -34,   -59,    77,   -45,   -45,   -45,
579     -45,   -45,   281,   -43,   -36,   -45,   -59,   137,   137,   137,
580     137,   137,   137,   137,   137,   137,   137,   137,   137,   137,
581     137,   137,   137,   137,   137,   137,   137,   137,   -59,   -34,
582     -34,   208,   -59,   -44,   -59,   -33,   137,   -59,   -59,   137,
583     357,   338,   311,   311,   392,   409,   163,   223,   223,   -10,
584     -10,   -10,   -10,    24,    24,    60,   -37,   -37,   -45,   -45,
585     -45,   137,   -59,   -59,   -59,   -59,   -31,   -26,   232,   -59,
586     188,   311,   -45,   252,   -24,   -59,   -59,   399,   -59,   137,
587     137,   -59,   -59,   311,   311
588};
589
590/* YYPGOTO[NTERM-NUM].  */
591static const yysigned_char yypgoto[] =
592{
593     -59,   -59,   -59,     0,   -59,   -59,   -59,   -59,   -59,     4,
594     -59,   -27,   -59,   -58,   -59,   -59,   -59
595};
596
597/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
598   positive, shift that token.  If negative, reduce the rule which
599   number is the opposite.  If zero, do what YYDEFACT says.
600   If YYTABLE_NINF, syntax error.  */
601#define YYTABLE_NINF -1
602static const unsigned char yytable[] =
603{
604      30,    69,    46,   117,    32,   120,    68,   108,    37,    78,
605      65,    66,    67,    70,    68,   109,    79,    71,     0,   110,
606      38,   116,     0,    39,    40,    41,   118,    45,   121,     0,
607      44,     0,    60,    61,    62,    63,    64,    65,    66,    67,
608      75,    68,   102,   103,   106,     0,     0,    80,    81,    82,
609      83,    84,    85,    86,    87,    88,    89,    90,    91,    92,
610      93,    94,    95,    96,    97,    98,    99,   100,    62,    63,
611      64,    65,    66,    67,     0,    68,   111,     0,     0,   112,
612       1,     2,     3,     4,     5,     6,     7,     8,     0,     9,
613      10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
614       0,   113,    20,    21,    22,    63,    64,    65,    66,    67,
615     112,    68,    23,     0,     0,     0,     0,     0,     0,   123,
616     124,   122,     0,    24,    25,     0,     0,     0,    26,     0,
617      27,     1,     2,     3,     4,     5,     0,     7,     8,     0,
618       1,     2,     3,     4,     5,     0,     7,     8,     0,     0,
619       0,     0,     0,    20,     0,    22,     0,     0,     0,     0,
620       0,     0,    20,    23,    22,     0,     0,     0,     0,     0,
621       0,     0,    23,     0,    24,    25,     0,     0,     0,    36,
622       0,    27,     0,    24,    25,     0,     0,     0,    26,     0,
623      27,     1,     2,     3,     4,     5,     0,     7,     8,    54,
624      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
625      65,    66,    67,    20,    68,    22,     6,     0,     0,     0,
626       9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
627      19,     0,     0,     0,    21,     0,     0,     0,     0,    26,
628       6,    27,     0,    69,     9,    10,    11,    12,    13,    14,
629      15,    16,    17,    18,    19,    70,     0,     0,    21,    71,
630     104,    56,    57,    58,    59,    60,    61,    62,    63,    64,
631      65,    66,    67,     0,    68,    47,    48,     0,     0,     0,
632      49,     0,     0,    50,   104,    51,    52,    53,    54,    55,
633      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
634      66,    67,     0,    68,    47,    48,   119,     0,     0,    49,
635      76,     0,    50,     0,    51,    52,    53,    54,    55,    56,
636      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
637      67,     0,    68,    77,    47,    48,     0,     0,     0,    49,
638       0,     0,    50,     0,    51,    52,    53,    54,    55,    56,
639      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
640      67,    47,    68,     0,     0,     0,     0,     0,     0,     0,
641       0,    51,    52,    53,    54,    55,    56,    57,    58,    59,
642      60,    61,    62,    63,    64,    65,    66,    67,     0,    68,
643      51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
644      61,    62,    63,    64,    65,    66,    67,     6,    68,     0,
645       0,     9,    10,    11,    12,    13,    14,    15,    16,    17,
646      18,    19,     0,     0,     0,    21,    52,    53,    54,    55,
647      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
648      66,    67,     0,    68,    53,    54,    55,    56,    57,    58,
649      59,    60,    61,    62,    63,    64,    65,    66,    67,     0,
650      68
651};
652
653static const yysigned_char yycheck[] =
654{
655       0,    35,     0,    29,     0,    29,    51,    51,     8,    52,
656      47,    48,    49,    47,    51,    73,    52,    51,    -1,    52,
657      20,    52,    -1,    23,    24,    25,    52,    27,    52,    -1,
658      26,    -1,    42,    43,    44,    45,    46,    47,    48,    49,
659      36,    51,    69,    70,    71,    -1,    -1,    47,    48,    49,
660      50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
661      60,    61,    62,    63,    64,    65,    66,    67,    44,    45,
662      46,    47,    48,    49,    -1,    51,    76,    -1,    -1,    79,
663       3,     4,     5,     6,     7,     8,     9,    10,    -1,    12,
664      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
665      -1,   101,    25,    26,    27,    45,    46,    47,    48,    49,
666     110,    51,    35,    -1,    -1,    -1,    -1,    -1,    -1,   119,
667     120,   117,    -1,    46,    47,    -1,    -1,    -1,    51,    -1,
668      53,     3,     4,     5,     6,     7,    -1,     9,    10,    -1,
669       3,     4,     5,     6,     7,    -1,     9,    10,    -1,    -1,
670      -1,    -1,    -1,    25,    -1,    27,    -1,    -1,    -1,    -1,
671      -1,    -1,    25,    35,    27,    -1,    -1,    -1,    -1,    -1,
672      -1,    -1,    35,    -1,    46,    47,    -1,    -1,    -1,    51,
673      -1,    53,    -1,    46,    47,    -1,    -1,    -1,    51,    -1,
674      53,     3,     4,     5,     6,     7,    -1,     9,    10,    36,
675      37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
676      47,    48,    49,    25,    51,    27,     8,    -1,    -1,    -1,
677      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
678      22,    -1,    -1,    -1,    26,    -1,    -1,    -1,    -1,    51,
679       8,    53,    -1,    35,    12,    13,    14,    15,    16,    17,
680      18,    19,    20,    21,    22,    47,    -1,    -1,    26,    51,
681      52,    38,    39,    40,    41,    42,    43,    44,    45,    46,
682      47,    48,    49,    -1,    51,    23,    24,    -1,    -1,    -1,
683      28,    -1,    -1,    31,    52,    33,    34,    35,    36,    37,
684      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
685      48,    49,    -1,    51,    23,    24,    54,    -1,    -1,    28,
686      29,    -1,    31,    -1,    33,    34,    35,    36,    37,    38,
687      39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
688      49,    -1,    51,    52,    23,    24,    -1,    -1,    -1,    28,
689      -1,    -1,    31,    -1,    33,    34,    35,    36,    37,    38,
690      39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
691      49,    23,    51,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
692      -1,    33,    34,    35,    36,    37,    38,    39,    40,    41,
693      42,    43,    44,    45,    46,    47,    48,    49,    -1,    51,
694      33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
695      43,    44,    45,    46,    47,    48,    49,     8,    51,    -1,
696      -1,    12,    13,    14,    15,    16,    17,    18,    19,    20,
697      21,    22,    -1,    -1,    -1,    26,    34,    35,    36,    37,
698      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
699      48,    49,    -1,    51,    35,    36,    37,    38,    39,    40,
700      41,    42,    43,    44,    45,    46,    47,    48,    49,    -1,
701      51
702};
703
704/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
705   symbol of state STATE-NUM.  */
706static const unsigned char yystos[] =
707{
708       0,     3,     4,     5,     6,     7,     8,     9,    10,    12,
709      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
710      25,    26,    27,    35,    46,    47,    51,    53,    56,    57,
711      58,    63,    64,    65,    69,    71,    51,    58,    58,    58,
712      58,    58,    58,    62,    64,    58,     0,    23,    24,    28,
713      31,    33,    34,    35,    36,    37,    38,    39,    40,    41,
714      42,    43,    44,    45,    46,    47,    48,    49,    51,    35,
715      47,    51,    66,    67,    68,    64,    29,    52,    52,    52,
716      58,    58,    58,    58,    58,    58,    58,    58,    58,    58,
717      58,    58,    58,    58,    58,    58,    58,    58,    58,    58,
718      58,    59,    66,    66,    52,    64,    66,    70,    51,    68,
719      52,    58,    58,    58,    60,    61,    52,    29,    52,    54,
720      29,    52,    64,    58,    58
721};
722
723#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
724# define YYSIZE_T __SIZE_TYPE__
725#endif
726#if ! defined (YYSIZE_T) && defined (size_t)
727# define YYSIZE_T size_t
728#endif
729#if ! defined (YYSIZE_T)
730# if defined (__STDC__) || defined (__cplusplus)
731#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
732#  define YYSIZE_T size_t
733# endif
734#endif
735#if ! defined (YYSIZE_T)
736# define YYSIZE_T unsigned int
737#endif
738
739#define yyerrok		(yyerrstatus = 0)
740#define yyclearin	(yychar = YYEMPTY)
741#define YYEMPTY		(-2)
742#define YYEOF		0
743
744#define YYACCEPT	goto yyacceptlab
745#define YYABORT		goto yyabortlab
746#define YYERROR		goto yyerrlab1
747
748/* Like YYERROR except do call yyerror.  This remains here temporarily
749   to ease the transition to the new meaning of YYERROR, for GCC.
750   Once GCC version 2 has supplanted version 1, this can go.  */
751
752#define YYFAIL		goto yyerrlab
753
754#define YYRECOVERING()  (!!yyerrstatus)
755
756#define YYBACKUP(Token, Value)					\
757do								\
758  if (yychar == YYEMPTY && yylen == 1)				\
759    {								\
760      yychar = (Token);						\
761      yylval = (Value);						\
762      yytoken = YYTRANSLATE (yychar);				\
763      YYPOPSTACK;						\
764      goto yybackup;						\
765    }								\
766  else								\
767    { 								\
768      yyerror ("syntax error: cannot back up");\
769      YYERROR;							\
770    }								\
771while (0)
772
773#define YYTERROR	1
774#define YYERRCODE	256
775
776/* YYLLOC_DEFAULT -- Compute the default location (before the actions
777   are run).  */
778
779#ifndef YYLLOC_DEFAULT
780# define YYLLOC_DEFAULT(Current, Rhs, N)         \
781  Current.first_line   = Rhs[1].first_line;      \
782  Current.first_column = Rhs[1].first_column;    \
783  Current.last_line    = Rhs[N].last_line;       \
784  Current.last_column  = Rhs[N].last_column;
785#endif
786
787/* YYLEX -- calling `yylex' with the right arguments.  */
788
789#ifdef YYLEX_PARAM
790# define YYLEX yylex (YYLEX_PARAM)
791#else
792# define YYLEX yylex ()
793#endif
794
795/* Enable debugging if requested.  */
796#if YYDEBUG
797
798# ifndef YYFPRINTF
799#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
800#  define YYFPRINTF fprintf
801# endif
802
803# define YYDPRINTF(Args)			\
804do {						\
805  if (yydebug)					\
806    YYFPRINTF Args;				\
807} while (0)
808
809# define YYDSYMPRINT(Args)			\
810do {						\
811  if (yydebug)					\
812    yysymprint Args;				\
813} while (0)
814
815# define YYDSYMPRINTF(Title, Token, Value, Location)		\
816do {								\
817  if (yydebug)							\
818    {								\
819      YYFPRINTF (stderr, "%s ", Title);				\
820      yysymprint (stderr, 					\
821                  Token, Value);	\
822      YYFPRINTF (stderr, "\n");					\
823    }								\
824} while (0)
825
826/*------------------------------------------------------------------.
827| yy_stack_print -- Print the state stack from its BOTTOM up to its |
828| TOP (cinluded).                                                   |
829`------------------------------------------------------------------*/
830
831#if defined (__STDC__) || defined (__cplusplus)
832static void
833yy_stack_print (short *bottom, short *top)
834#else
835static void
836yy_stack_print (bottom, top)
837    short *bottom;
838    short *top;
839#endif
840{
841  YYFPRINTF (stderr, "Stack now");
842  for (/* Nothing. */; bottom <= top; ++bottom)
843    YYFPRINTF (stderr, " %d", *bottom);
844  YYFPRINTF (stderr, "\n");
845}
846
847# define YY_STACK_PRINT(Bottom, Top)				\
848do {								\
849  if (yydebug)							\
850    yy_stack_print ((Bottom), (Top));				\
851} while (0)
852
853
854/*------------------------------------------------.
855| Report that the YYRULE is going to be reduced.  |
856`------------------------------------------------*/
857
858#if defined (__STDC__) || defined (__cplusplus)
859static void
860yy_reduce_print (int yyrule)
861#else
862static void
863yy_reduce_print (yyrule)
864    int yyrule;
865#endif
866{
867  int yyi;
868  unsigned int yylineno = yyrline[yyrule];
869  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
870             yyrule - 1, yylineno);
871  /* Print the symbols being reduced, and their result.  */
872  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
873    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
874  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
875}
876
877# define YY_REDUCE_PRINT(Rule)		\
878do {					\
879  if (yydebug)				\
880    yy_reduce_print (Rule);		\
881} while (0)
882
883/* Nonzero means print parse trace.  It is left uninitialized so that
884   multiple parsers can coexist.  */
885int yydebug;
886#else /* !YYDEBUG */
887# define YYDPRINTF(Args)
888# define YYDSYMPRINT(Args)
889# define YYDSYMPRINTF(Title, Token, Value, Location)
890# define YY_STACK_PRINT(Bottom, Top)
891# define YY_REDUCE_PRINT(Rule)
892#endif /* !YYDEBUG */
893
894
895/* YYINITDEPTH -- initial size of the parser's stacks.  */
896#ifndef	YYINITDEPTH
897# define YYINITDEPTH 200
898#endif
899
900/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
901   if the built-in stack extension method is used).
902
903   Do not make this value too large; the results are undefined if
904   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
905   evaluated with infinite-precision integer arithmetic.  */
906
907#if YYMAXDEPTH == 0
908# undef YYMAXDEPTH
909#endif
910
911#ifndef YYMAXDEPTH
912# define YYMAXDEPTH 10000
913#endif
914
915
916
917#if YYERROR_VERBOSE
918
919# ifndef yystrlen
920#  if defined (__GLIBC__) && defined (_STRING_H)
921#   define yystrlen strlen
922#  else
923/* Return the length of YYSTR.  */
924static YYSIZE_T
925#   if defined (__STDC__) || defined (__cplusplus)
926yystrlen (const char *yystr)
927#   else
928yystrlen (yystr)
929     const char *yystr;
930#   endif
931{
932  register const char *yys = yystr;
933
934  while (*yys++ != '\0')
935    continue;
936
937  return yys - yystr - 1;
938}
939#  endif
940# endif
941
942# ifndef yystpcpy
943#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
944#   define yystpcpy stpcpy
945#  else
946/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
947   YYDEST.  */
948static char *
949#   if defined (__STDC__) || defined (__cplusplus)
950yystpcpy (char *yydest, const char *yysrc)
951#   else
952yystpcpy (yydest, yysrc)
953     char *yydest;
954     const char *yysrc;
955#   endif
956{
957  register char *yyd = yydest;
958  register const char *yys = yysrc;
959
960  while ((*yyd++ = *yys++) != '\0')
961    continue;
962
963  return yyd - 1;
964}
965#  endif
966# endif
967
968#endif /* !YYERROR_VERBOSE */
969
970
971
972#if YYDEBUG
973/*--------------------------------.
974| Print this symbol on YYOUTPUT.  |
975`--------------------------------*/
976
977#if defined (__STDC__) || defined (__cplusplus)
978static void
979yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
980#else
981static void
982yysymprint (yyoutput, yytype, yyvaluep)
983    FILE *yyoutput;
984    int yytype;
985    YYSTYPE *yyvaluep;
986#endif
987{
988  /* Pacify ``unused variable'' warnings.  */
989  (void) yyvaluep;
990
991  if (yytype < YYNTOKENS)
992    {
993      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
994# ifdef YYPRINT
995      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
996# endif
997    }
998  else
999    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1000
1001  switch (yytype)
1002    {
1003      default:
1004        break;
1005    }
1006  YYFPRINTF (yyoutput, ")");
1007}
1008
1009#endif /* ! YYDEBUG */
1010/*-----------------------------------------------.
1011| Release the memory associated to this symbol.  |
1012`-----------------------------------------------*/
1013
1014#if defined (__STDC__) || defined (__cplusplus)
1015static void
1016yydestruct (int yytype, YYSTYPE *yyvaluep)
1017#else
1018static void
1019yydestruct (yytype, yyvaluep)
1020    int yytype;
1021    YYSTYPE *yyvaluep;
1022#endif
1023{
1024  /* Pacify ``unused variable'' warnings.  */
1025  (void) yyvaluep;
1026
1027  switch (yytype)
1028    {
1029
1030      default:
1031        break;
1032    }
1033}
1034
1035
1036/* Prevent warnings from -Wmissing-prototypes.  */
1037
1038#ifdef YYPARSE_PARAM
1039# if defined (__STDC__) || defined (__cplusplus)
1040int yyparse (void *YYPARSE_PARAM);
1041# else
1042int yyparse ();
1043# endif
1044#else /* ! YYPARSE_PARAM */
1045#if defined (__STDC__) || defined (__cplusplus)
1046int yyparse (void);
1047#else
1048int yyparse ();
1049#endif
1050#endif /* ! YYPARSE_PARAM */
1051
1052
1053
1054/* The lookahead symbol.  */
1055int yychar;
1056
1057/* The semantic value of the lookahead symbol.  */
1058YYSTYPE yylval;
1059
1060/* Number of syntax errors so far.  */
1061int yynerrs;
1062
1063
1064
1065/*----------.
1066| yyparse.  |
1067`----------*/
1068
1069#ifdef YYPARSE_PARAM
1070# if defined (__STDC__) || defined (__cplusplus)
1071int yyparse (void *YYPARSE_PARAM)
1072# else
1073int yyparse (YYPARSE_PARAM)
1074  void *YYPARSE_PARAM;
1075# endif
1076#else /* ! YYPARSE_PARAM */
1077#if defined (__STDC__) || defined (__cplusplus)
1078int
1079yyparse (void)
1080#else
1081int
1082yyparse ()
1083
1084#endif
1085#endif
1086{
1087
1088  register int yystate;
1089  register int yyn;
1090  int yyresult;
1091  /* Number of tokens to shift before error messages enabled.  */
1092  int yyerrstatus;
1093  /* Lookahead token as an internal (translated) token number.  */
1094  int yytoken = 0;
1095
1096  /* Three stacks and their tools:
1097     `yyss': related to states,
1098     `yyvs': related to semantic values,
1099     `yyls': related to locations.
1100
1101     Refer to the stacks thru separate pointers, to allow yyoverflow
1102     to xreallocate them elsewhere.  */
1103
1104  /* The state stack.  */
1105  short	yyssa[YYINITDEPTH];
1106  short *yyss = yyssa;
1107  register short *yyssp;
1108
1109  /* The semantic value stack.  */
1110  YYSTYPE yyvsa[YYINITDEPTH];
1111  YYSTYPE *yyvs = yyvsa;
1112  register YYSTYPE *yyvsp;
1113
1114
1115
1116#define YYPOPSTACK   (yyvsp--, yyssp--)
1117
1118  YYSIZE_T yystacksize = YYINITDEPTH;
1119
1120  /* The variables used to return semantic value and location from the
1121     action routines.  */
1122  YYSTYPE yyval;
1123
1124
1125  /* When reducing, the number of symbols on the RHS of the reduced
1126     rule.  */
1127  int yylen;
1128
1129  YYDPRINTF ((stderr, "Starting parse\n"));
1130
1131  yystate = 0;
1132  yyerrstatus = 0;
1133  yynerrs = 0;
1134  yychar = YYEMPTY;		/* Cause a token to be read.  */
1135
1136  /* Initialize stack pointers.
1137     Waste one element of value and location stack
1138     so that they stay on the same level as the state stack.
1139     The wasted elements are never initialized.  */
1140
1141  yyssp = yyss;
1142  yyvsp = yyvs;
1143
1144  goto yysetstate;
1145
1146/*------------------------------------------------------------.
1147| yynewstate -- Push a new state, which is found in yystate.  |
1148`------------------------------------------------------------*/
1149 yynewstate:
1150  /* In all cases, when you get here, the value and location stacks
1151     have just been pushed. so pushing a state here evens the stacks.
1152     */
1153  yyssp++;
1154
1155 yysetstate:
1156  *yyssp = yystate;
1157
1158  if (yyss + yystacksize - 1 <= yyssp)
1159    {
1160      /* Get the current used size of the three stacks, in elements.  */
1161      YYSIZE_T yysize = yyssp - yyss + 1;
1162
1163#ifdef yyoverflow
1164      {
1165	/* Give user a chance to xreallocate the stack. Use copies of
1166	   these so that the &'s don't force the real ones into
1167	   memory.  */
1168	YYSTYPE *yyvs1 = yyvs;
1169	short *yyss1 = yyss;
1170
1171
1172	/* Each stack pointer address is followed by the size of the
1173	   data in use in that stack, in bytes.  This used to be a
1174	   conditional around just the two extra args, but that might
1175	   be undefined if yyoverflow is a macro.  */
1176	yyoverflow ("parser stack overflow",
1177		    &yyss1, yysize * sizeof (*yyssp),
1178		    &yyvs1, yysize * sizeof (*yyvsp),
1179
1180		    &yystacksize);
1181
1182	yyss = yyss1;
1183	yyvs = yyvs1;
1184      }
1185#else /* no yyoverflow */
1186# ifndef YYSTACK_RELOCATE
1187      goto yyoverflowlab;
1188# else
1189      /* Extend the stack our own way.  */
1190      if (YYMAXDEPTH <= yystacksize)
1191	goto yyoverflowlab;
1192      yystacksize *= 2;
1193      if (YYMAXDEPTH < yystacksize)
1194	yystacksize = YYMAXDEPTH;
1195
1196      {
1197	short *yyss1 = yyss;
1198	union yyalloc *yyptr =
1199	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1200	if (! yyptr)
1201	  goto yyoverflowlab;
1202	YYSTACK_RELOCATE (yyss);
1203	YYSTACK_RELOCATE (yyvs);
1204
1205#  undef YYSTACK_RELOCATE
1206	if (yyss1 != yyssa)
1207	  YYSTACK_FREE (yyss1);
1208      }
1209# endif
1210#endif /* no yyoverflow */
1211
1212      yyssp = yyss + yysize - 1;
1213      yyvsp = yyvs + yysize - 1;
1214
1215
1216      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1217		  (unsigned long int) yystacksize));
1218
1219      if (yyss + yystacksize - 1 <= yyssp)
1220	YYABORT;
1221    }
1222
1223  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1224
1225  goto yybackup;
1226
1227/*-----------.
1228| yybackup.  |
1229`-----------*/
1230yybackup:
1231
1232/* Do appropriate processing given the current state.  */
1233/* Read a lookahead token if we need one and don't already have one.  */
1234/* yyresume: */
1235
1236  /* First try to decide what to do without reference to lookahead token.  */
1237
1238  yyn = yypact[yystate];
1239  if (yyn == YYPACT_NINF)
1240    goto yydefault;
1241
1242  /* Not known => get a lookahead token if don't already have one.  */
1243
1244  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1245  if (yychar == YYEMPTY)
1246    {
1247      YYDPRINTF ((stderr, "Reading a token: "));
1248      yychar = YYLEX;
1249    }
1250
1251  if (yychar <= YYEOF)
1252    {
1253      yychar = yytoken = YYEOF;
1254      YYDPRINTF ((stderr, "Now at end of input.\n"));
1255    }
1256  else
1257    {
1258      yytoken = YYTRANSLATE (yychar);
1259      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1260    }
1261
1262  /* If the proper action on seeing token YYTOKEN is to reduce or to
1263     detect an error, take that action.  */
1264  yyn += yytoken;
1265  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1266    goto yydefault;
1267  yyn = yytable[yyn];
1268  if (yyn <= 0)
1269    {
1270      if (yyn == 0 || yyn == YYTABLE_NINF)
1271	goto yyerrlab;
1272      yyn = -yyn;
1273      goto yyreduce;
1274    }
1275
1276  if (yyn == YYFINAL)
1277    YYACCEPT;
1278
1279  /* Shift the lookahead token.  */
1280  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1281
1282  /* Discard the token being shifted unless it is eof.  */
1283  if (yychar != YYEOF)
1284    yychar = YYEMPTY;
1285
1286  *++yyvsp = yylval;
1287
1288
1289  /* Count tokens shifted since error; after three, turn off error
1290     status.  */
1291  if (yyerrstatus)
1292    yyerrstatus--;
1293
1294  yystate = yyn;
1295  goto yynewstate;
1296
1297
1298/*-----------------------------------------------------------.
1299| yydefault -- do the default action for the current state.  |
1300`-----------------------------------------------------------*/
1301yydefault:
1302  yyn = yydefact[yystate];
1303  if (yyn == 0)
1304    goto yyerrlab;
1305  goto yyreduce;
1306
1307
1308/*-----------------------------.
1309| yyreduce -- Do a reduction.  |
1310`-----------------------------*/
1311yyreduce:
1312  /* yyn is the number of a rule to reduce with.  */
1313  yylen = yyr2[yyn];
1314
1315  /* If YYLEN is nonzero, implement the default value of the action:
1316     `$$ = $1'.
1317
1318     Otherwise, the following line sets YYVAL to garbage.
1319     This behavior is undocumented and Bison
1320     users should not rely upon it.  Assigning to YYVAL
1321     unconditionally makes the parser a bit smaller, and it avoids a
1322     GCC warning that YYVAL may be used uninitialized.  */
1323  yyval = yyvsp[1-yylen];
1324
1325
1326  YY_REDUCE_PRINT (yyn);
1327  switch (yyn)
1328    {
1329        case 4:
1330#line 233 "f-exp.y"
1331    { write_exp_elt_opcode(OP_TYPE);
1332			  write_exp_elt_type(yyvsp[0].tval);
1333			  write_exp_elt_opcode(OP_TYPE); }
1334    break;
1335
1336  case 5:
1337#line 239 "f-exp.y"
1338    { }
1339    break;
1340
1341  case 6:
1342#line 244 "f-exp.y"
1343    { write_exp_elt_opcode (UNOP_IND); }
1344    break;
1345
1346  case 7:
1347#line 248 "f-exp.y"
1348    { write_exp_elt_opcode (UNOP_ADDR); }
1349    break;
1350
1351  case 8:
1352#line 252 "f-exp.y"
1353    { write_exp_elt_opcode (UNOP_NEG); }
1354    break;
1355
1356  case 9:
1357#line 256 "f-exp.y"
1358    { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1359    break;
1360
1361  case 10:
1362#line 260 "f-exp.y"
1363    { write_exp_elt_opcode (UNOP_COMPLEMENT); }
1364    break;
1365
1366  case 11:
1367#line 264 "f-exp.y"
1368    { write_exp_elt_opcode (UNOP_SIZEOF); }
1369    break;
1370
1371  case 12:
1372#line 273 "f-exp.y"
1373    { start_arglist (); }
1374    break;
1375
1376  case 13:
1377#line 275 "f-exp.y"
1378    { write_exp_elt_opcode (OP_F77_UNDETERMINED_ARGLIST);
1379			  write_exp_elt_longcst ((LONGEST) end_arglist ());
1380			  write_exp_elt_opcode (OP_F77_UNDETERMINED_ARGLIST); }
1381    break;
1382
1383  case 15:
1384#line 284 "f-exp.y"
1385    { arglist_len = 1; }
1386    break;
1387
1388  case 16:
1389#line 288 "f-exp.y"
1390    { arglist_len = 2;}
1391    break;
1392
1393  case 17:
1394#line 292 "f-exp.y"
1395    { arglist_len++; }
1396    break;
1397
1398  case 18:
1399#line 296 "f-exp.y"
1400    { }
1401    break;
1402
1403  case 19:
1404#line 301 "f-exp.y"
1405    { }
1406    break;
1407
1408  case 20:
1409#line 305 "f-exp.y"
1410    { write_exp_elt_opcode(OP_COMPLEX); }
1411    break;
1412
1413  case 21:
1414#line 309 "f-exp.y"
1415    { write_exp_elt_opcode (UNOP_CAST);
1416			  write_exp_elt_type (yyvsp[-2].tval);
1417			  write_exp_elt_opcode (UNOP_CAST); }
1418    break;
1419
1420  case 22:
1421#line 317 "f-exp.y"
1422    { write_exp_elt_opcode (BINOP_REPEAT); }
1423    break;
1424
1425  case 23:
1426#line 321 "f-exp.y"
1427    { write_exp_elt_opcode (BINOP_MUL); }
1428    break;
1429
1430  case 24:
1431#line 325 "f-exp.y"
1432    { write_exp_elt_opcode (BINOP_DIV); }
1433    break;
1434
1435  case 25:
1436#line 329 "f-exp.y"
1437    { write_exp_elt_opcode (BINOP_REM); }
1438    break;
1439
1440  case 26:
1441#line 333 "f-exp.y"
1442    { write_exp_elt_opcode (BINOP_ADD); }
1443    break;
1444
1445  case 27:
1446#line 337 "f-exp.y"
1447    { write_exp_elt_opcode (BINOP_SUB); }
1448    break;
1449
1450  case 28:
1451#line 341 "f-exp.y"
1452    { write_exp_elt_opcode (BINOP_LSH); }
1453    break;
1454
1455  case 29:
1456#line 345 "f-exp.y"
1457    { write_exp_elt_opcode (BINOP_RSH); }
1458    break;
1459
1460  case 30:
1461#line 349 "f-exp.y"
1462    { write_exp_elt_opcode (BINOP_EQUAL); }
1463    break;
1464
1465  case 31:
1466#line 353 "f-exp.y"
1467    { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1468    break;
1469
1470  case 32:
1471#line 357 "f-exp.y"
1472    { write_exp_elt_opcode (BINOP_LEQ); }
1473    break;
1474
1475  case 33:
1476#line 361 "f-exp.y"
1477    { write_exp_elt_opcode (BINOP_GEQ); }
1478    break;
1479
1480  case 34:
1481#line 365 "f-exp.y"
1482    { write_exp_elt_opcode (BINOP_LESS); }
1483    break;
1484
1485  case 35:
1486#line 369 "f-exp.y"
1487    { write_exp_elt_opcode (BINOP_GTR); }
1488    break;
1489
1490  case 36:
1491#line 373 "f-exp.y"
1492    { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1493    break;
1494
1495  case 37:
1496#line 377 "f-exp.y"
1497    { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1498    break;
1499
1500  case 38:
1501#line 381 "f-exp.y"
1502    { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1503    break;
1504
1505  case 39:
1506#line 385 "f-exp.y"
1507    { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1508    break;
1509
1510  case 40:
1511#line 390 "f-exp.y"
1512    { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
1513    break;
1514
1515  case 41:
1516#line 394 "f-exp.y"
1517    { write_exp_elt_opcode (BINOP_ASSIGN); }
1518    break;
1519
1520  case 42:
1521#line 398 "f-exp.y"
1522    { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
1523			  write_exp_elt_opcode (yyvsp[-1].opcode);
1524			  write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
1525    break;
1526
1527  case 43:
1528#line 404 "f-exp.y"
1529    { write_exp_elt_opcode (OP_LONG);
1530			  write_exp_elt_type (yyvsp[0].typed_val.type);
1531			  write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val.val));
1532			  write_exp_elt_opcode (OP_LONG); }
1533    break;
1534
1535  case 44:
1536#line 411 "f-exp.y"
1537    { YYSTYPE val;
1538			  parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
1539			  write_exp_elt_opcode (OP_LONG);
1540			  write_exp_elt_type (val.typed_val.type);
1541			  write_exp_elt_longcst ((LONGEST)val.typed_val.val);
1542			  write_exp_elt_opcode (OP_LONG); }
1543    break;
1544
1545  case 45:
1546#line 420 "f-exp.y"
1547    { write_exp_elt_opcode (OP_DOUBLE);
1548			  write_exp_elt_type (builtin_type_f_real_s8);
1549			  write_exp_elt_dblcst (yyvsp[0].dval);
1550			  write_exp_elt_opcode (OP_DOUBLE); }
1551    break;
1552
1553  case 48:
1554#line 433 "f-exp.y"
1555    { write_exp_elt_opcode (OP_LONG);
1556			  write_exp_elt_type (builtin_type_f_integer);
1557			  CHECK_TYPEDEF (yyvsp[-1].tval);
1558			  write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
1559			  write_exp_elt_opcode (OP_LONG); }
1560    break;
1561
1562  case 49:
1563#line 441 "f-exp.y"
1564    { write_exp_elt_opcode (OP_BOOL);
1565			  write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1566			  write_exp_elt_opcode (OP_BOOL);
1567			}
1568    break;
1569
1570  case 50:
1571#line 448 "f-exp.y"
1572    {
1573			  write_exp_elt_opcode (OP_STRING);
1574			  write_exp_string (yyvsp[0].sval);
1575			  write_exp_elt_opcode (OP_STRING);
1576			}
1577    break;
1578
1579  case 51:
1580#line 456 "f-exp.y"
1581    { struct symbol *sym = yyvsp[0].ssym.sym;
1582
1583			  if (sym)
1584			    {
1585			      if (symbol_read_needs_frame (sym))
1586				{
1587				  if (innermost_block == 0 ||
1588				      contained_in (block_found,
1589						    innermost_block))
1590				    innermost_block = block_found;
1591				}
1592			      write_exp_elt_opcode (OP_VAR_VALUE);
1593			      /* We want to use the selected frame, not
1594				 another more inner frame which happens to
1595				 be in the same block.  */
1596			      write_exp_elt_block (NULL);
1597			      write_exp_elt_sym (sym);
1598			      write_exp_elt_opcode (OP_VAR_VALUE);
1599			      break;
1600			    }
1601			  else
1602			    {
1603			      struct minimal_symbol *msymbol;
1604			      char *arg = copy_name (yyvsp[0].ssym.stoken);
1605
1606			      msymbol =
1607				lookup_minimal_symbol (arg, NULL, NULL);
1608			      if (msymbol != NULL)
1609				{
1610				  write_exp_msymbol (msymbol,
1611						     lookup_function_type (builtin_type_int),
1612						     builtin_type_int);
1613				}
1614			      else if (!have_full_symbols () && !have_partial_symbols ())
1615				error ("No symbol table is loaded.  Use the \"file\" command.");
1616			      else
1617				error ("No symbol \"%s\" in current context.",
1618				       copy_name (yyvsp[0].ssym.stoken));
1619			    }
1620			}
1621    break;
1622
1623  case 54:
1624#line 504 "f-exp.y"
1625    {
1626		  /* This is where the interesting stuff happens.  */
1627		  int done = 0;
1628		  int array_size;
1629		  struct type *follow_type = yyvsp[-1].tval;
1630		  struct type *range_type;
1631
1632		  while (!done)
1633		    switch (pop_type ())
1634		      {
1635		      case tp_end:
1636			done = 1;
1637			break;
1638		      case tp_pointer:
1639			follow_type = lookup_pointer_type (follow_type);
1640			break;
1641		      case tp_reference:
1642			follow_type = lookup_reference_type (follow_type);
1643			break;
1644		      case tp_array:
1645			array_size = pop_type_int ();
1646			if (array_size != -1)
1647			  {
1648			    range_type =
1649			      create_range_type ((struct type *) NULL,
1650						 builtin_type_f_integer, 0,
1651						 array_size - 1);
1652			    follow_type =
1653			      create_array_type ((struct type *) NULL,
1654						 follow_type, range_type);
1655			  }
1656			else
1657			  follow_type = lookup_pointer_type (follow_type);
1658			break;
1659		      case tp_function:
1660			follow_type = lookup_function_type (follow_type);
1661			break;
1662		      }
1663		  yyval.tval = follow_type;
1664		}
1665    break;
1666
1667  case 55:
1668#line 547 "f-exp.y"
1669    { push_type (tp_pointer); yyval.voidval = 0; }
1670    break;
1671
1672  case 56:
1673#line 549 "f-exp.y"
1674    { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; }
1675    break;
1676
1677  case 57:
1678#line 551 "f-exp.y"
1679    { push_type (tp_reference); yyval.voidval = 0; }
1680    break;
1681
1682  case 58:
1683#line 553 "f-exp.y"
1684    { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; }
1685    break;
1686
1687  case 60:
1688#line 558 "f-exp.y"
1689    { yyval.voidval = yyvsp[-1].voidval; }
1690    break;
1691
1692  case 61:
1693#line 560 "f-exp.y"
1694    { push_type (tp_function); }
1695    break;
1696
1697  case 62:
1698#line 562 "f-exp.y"
1699    { push_type (tp_function); }
1700    break;
1701
1702  case 63:
1703#line 566 "f-exp.y"
1704    { yyval.voidval = 0; }
1705    break;
1706
1707  case 64:
1708#line 568 "f-exp.y"
1709    { free (yyvsp[-1].tvec); yyval.voidval = 0; }
1710    break;
1711
1712  case 65:
1713#line 573 "f-exp.y"
1714    { yyval.tval = yyvsp[0].tsym.type; }
1715    break;
1716
1717  case 66:
1718#line 575 "f-exp.y"
1719    { yyval.tval = builtin_type_f_integer; }
1720    break;
1721
1722  case 67:
1723#line 577 "f-exp.y"
1724    { yyval.tval = builtin_type_f_integer_s2; }
1725    break;
1726
1727  case 68:
1728#line 579 "f-exp.y"
1729    { yyval.tval = builtin_type_f_character; }
1730    break;
1731
1732  case 69:
1733#line 581 "f-exp.y"
1734    { yyval.tval = builtin_type_f_logical;}
1735    break;
1736
1737  case 70:
1738#line 583 "f-exp.y"
1739    { yyval.tval = builtin_type_f_logical_s2;}
1740    break;
1741
1742  case 71:
1743#line 585 "f-exp.y"
1744    { yyval.tval = builtin_type_f_logical_s1;}
1745    break;
1746
1747  case 72:
1748#line 587 "f-exp.y"
1749    { yyval.tval = builtin_type_f_real;}
1750    break;
1751
1752  case 73:
1753#line 589 "f-exp.y"
1754    { yyval.tval = builtin_type_f_real_s8;}
1755    break;
1756
1757  case 74:
1758#line 591 "f-exp.y"
1759    { yyval.tval = builtin_type_f_real_s16;}
1760    break;
1761
1762  case 75:
1763#line 593 "f-exp.y"
1764    { yyval.tval = builtin_type_f_complex_s8;}
1765    break;
1766
1767  case 76:
1768#line 595 "f-exp.y"
1769    { yyval.tval = builtin_type_f_complex_s16;}
1770    break;
1771
1772  case 77:
1773#line 597 "f-exp.y"
1774    { yyval.tval = builtin_type_f_complex_s32;}
1775    break;
1776
1777  case 78:
1778#line 605 "f-exp.y"
1779    { yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2);
1780		  yyval.ivec[0] = 1;	/* Number of types in vector */
1781		  yyval.tvec[1] = yyvsp[0].tval;
1782		}
1783    break;
1784
1785  case 79:
1786#line 610 "f-exp.y"
1787    { int len = sizeof (struct type *) * (++(yyvsp[-2].ivec[0]) + 1);
1788		  yyval.tvec = (struct type **) xrealloc ((char *) yyvsp[-2].tvec, len);
1789		  yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval;
1790		}
1791    break;
1792
1793
1794    }
1795
1796/* Line 991 of yacc.c.  */
1797
1798  yyvsp -= yylen;
1799  yyssp -= yylen;
1800
1801
1802  YY_STACK_PRINT (yyss, yyssp);
1803
1804  *++yyvsp = yyval;
1805
1806
1807  /* Now `shift' the result of the reduction.  Determine what state
1808     that goes to, based on the state we popped back to and the rule
1809     number reduced by.  */
1810
1811  yyn = yyr1[yyn];
1812
1813  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1814  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1815    yystate = yytable[yystate];
1816  else
1817    yystate = yydefgoto[yyn - YYNTOKENS];
1818
1819  goto yynewstate;
1820
1821
1822/*------------------------------------.
1823| yyerrlab -- here on detecting error |
1824`------------------------------------*/
1825yyerrlab:
1826  /* If not already recovering from an error, report this error.  */
1827  if (!yyerrstatus)
1828    {
1829      ++yynerrs;
1830#if YYERROR_VERBOSE
1831      yyn = yypact[yystate];
1832
1833      if (YYPACT_NINF < yyn && yyn < YYLAST)
1834	{
1835	  YYSIZE_T yysize = 0;
1836	  int yytype = YYTRANSLATE (yychar);
1837	  char *yymsg;
1838	  int yyx, yycount;
1839
1840	  yycount = 0;
1841	  /* Start YYX at -YYN if negative to avoid negative indexes in
1842	     YYCHECK.  */
1843	  for (yyx = yyn < 0 ? -yyn : 0;
1844	       yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1845	    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1846	      yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1847	  yysize += yystrlen ("syntax error, unexpected ") + 1;
1848	  yysize += yystrlen (yytname[yytype]);
1849	  yymsg = (char *) YYSTACK_ALLOC (yysize);
1850	  if (yymsg != 0)
1851	    {
1852	      char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1853	      yyp = yystpcpy (yyp, yytname[yytype]);
1854
1855	      if (yycount < 5)
1856		{
1857		  yycount = 0;
1858		  for (yyx = yyn < 0 ? -yyn : 0;
1859		       yyx < (int) (sizeof (yytname) / sizeof (char *));
1860		       yyx++)
1861		    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1862		      {
1863			const char *yyq = ! yycount ? ", expecting " : " or ";
1864			yyp = yystpcpy (yyp, yyq);
1865			yyp = yystpcpy (yyp, yytname[yyx]);
1866			yycount++;
1867		      }
1868		}
1869	      yyerror (yymsg);
1870	      YYSTACK_FREE (yymsg);
1871	    }
1872	  else
1873	    yyerror ("syntax error; also virtual memory exhausted");
1874	}
1875      else
1876#endif /* YYERROR_VERBOSE */
1877	yyerror ("syntax error");
1878    }
1879
1880
1881
1882  if (yyerrstatus == 3)
1883    {
1884      /* If just tried and failed to reuse lookahead token after an
1885	 error, discard it.  */
1886
1887      /* Return failure if at end of input.  */
1888      if (yychar == YYEOF)
1889        {
1890	  /* Pop the error token.  */
1891          YYPOPSTACK;
1892	  /* Pop the rest of the stack.  */
1893	  while (yyss < yyssp)
1894	    {
1895	      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1896	      yydestruct (yystos[*yyssp], yyvsp);
1897	      YYPOPSTACK;
1898	    }
1899	  YYABORT;
1900        }
1901
1902      YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1903      yydestruct (yytoken, &yylval);
1904      yychar = YYEMPTY;
1905
1906    }
1907
1908  /* Else will try to reuse lookahead token after shifting the error
1909     token.  */
1910  goto yyerrlab2;
1911
1912
1913/*----------------------------------------------------.
1914| yyerrlab1 -- error raised explicitly by an action.  |
1915`----------------------------------------------------*/
1916yyerrlab1:
1917
1918  /* Suppress GCC warning that yyerrlab1 is unused when no action
1919     invokes YYERROR.  Doesn't work in C++ */
1920#ifndef __cplusplus
1921#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
1922  __attribute__ ((__unused__))
1923#endif
1924#endif
1925
1926
1927  goto yyerrlab2;
1928
1929
1930/*---------------------------------------------------------------.
1931| yyerrlab2 -- pop states until the error token can be shifted.  |
1932`---------------------------------------------------------------*/
1933yyerrlab2:
1934  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
1935
1936  for (;;)
1937    {
1938      yyn = yypact[yystate];
1939      if (yyn != YYPACT_NINF)
1940	{
1941	  yyn += YYTERROR;
1942	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1943	    {
1944	      yyn = yytable[yyn];
1945	      if (0 < yyn)
1946		break;
1947	    }
1948	}
1949
1950      /* Pop the current state because it cannot handle the error token.  */
1951      if (yyssp == yyss)
1952	YYABORT;
1953
1954      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1955      yydestruct (yystos[yystate], yyvsp);
1956      yyvsp--;
1957      yystate = *--yyssp;
1958
1959      YY_STACK_PRINT (yyss, yyssp);
1960    }
1961
1962  if (yyn == YYFINAL)
1963    YYACCEPT;
1964
1965  YYDPRINTF ((stderr, "Shifting error token, "));
1966
1967  *++yyvsp = yylval;
1968
1969
1970  yystate = yyn;
1971  goto yynewstate;
1972
1973
1974/*-------------------------------------.
1975| yyacceptlab -- YYACCEPT comes here.  |
1976`-------------------------------------*/
1977yyacceptlab:
1978  yyresult = 0;
1979  goto yyreturn;
1980
1981/*-----------------------------------.
1982| yyabortlab -- YYABORT comes here.  |
1983`-----------------------------------*/
1984yyabortlab:
1985  yyresult = 1;
1986  goto yyreturn;
1987
1988#ifndef yyoverflow
1989/*----------------------------------------------.
1990| yyoverflowlab -- parser overflow comes here.  |
1991`----------------------------------------------*/
1992yyoverflowlab:
1993  yyerror ("parser stack overflow");
1994  yyresult = 2;
1995  /* Fall through.  */
1996#endif
1997
1998yyreturn:
1999#ifndef yyoverflow
2000  if (yyss != yyssa)
2001    YYSTACK_FREE (yyss);
2002#endif
2003  return yyresult;
2004}
2005
2006
2007#line 634 "f-exp.y"
2008
2009
2010/* Take care of parsing a number (anything that starts with a digit).
2011   Set yylval and return the token type; update lexptr.
2012   LEN is the number of characters in it.  */
2013
2014/*** Needs some error checking for the float case ***/
2015
2016static int
2017parse_number (p, len, parsed_float, putithere)
2018     char *p;
2019     int len;
2020     int parsed_float;
2021     YYSTYPE *putithere;
2022{
2023  LONGEST n = 0;
2024  LONGEST prevn = 0;
2025  int c;
2026  int base = input_radix;
2027  int unsigned_p = 0;
2028  int long_p = 0;
2029  ULONGEST high_bit;
2030  struct type *signed_type;
2031  struct type *unsigned_type;
2032
2033  if (parsed_float)
2034    {
2035      /* It's a float since it contains a point or an exponent.  */
2036      /* [dD] is not understood as an exponent by atof, change it to 'e'.  */
2037      char *tmp, *tmp2;
2038
2039      tmp = xstrdup (p);
2040      for (tmp2 = tmp; *tmp2; ++tmp2)
2041	if (*tmp2 == 'd' || *tmp2 == 'D')
2042	  *tmp2 = 'e';
2043      putithere->dval = atof (tmp);
2044      free (tmp);
2045      return FLOAT;
2046    }
2047
2048  /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2049  if (p[0] == '0')
2050    switch (p[1])
2051      {
2052      case 'x':
2053      case 'X':
2054	if (len >= 3)
2055	  {
2056	    p += 2;
2057	    base = 16;
2058	    len -= 2;
2059	  }
2060	break;
2061
2062      case 't':
2063      case 'T':
2064      case 'd':
2065      case 'D':
2066	if (len >= 3)
2067	  {
2068	    p += 2;
2069	    base = 10;
2070	    len -= 2;
2071	  }
2072	break;
2073
2074      default:
2075	base = 8;
2076	break;
2077      }
2078
2079  while (len-- > 0)
2080    {
2081      c = *p++;
2082      if (isupper (c))
2083	c = tolower (c);
2084      if (len == 0 && c == 'l')
2085	long_p = 1;
2086      else if (len == 0 && c == 'u')
2087	unsigned_p = 1;
2088      else
2089	{
2090	  int i;
2091	  if (c >= '0' && c <= '9')
2092	    i = c - '0';
2093	  else if (c >= 'a' && c <= 'f')
2094	    i = c - 'a' + 10;
2095	  else
2096	    return ERROR;	/* Char not a digit */
2097	  if (i >= base)
2098	    return ERROR;		/* Invalid digit in this base */
2099	  n *= base;
2100	  n += i;
2101	}
2102      /* Portably test for overflow (only works for nonzero values, so make
2103	 a second check for zero).  */
2104      if ((prevn >= n) && n != 0)
2105	unsigned_p=1;		/* Try something unsigned */
2106      /* If range checking enabled, portably test for unsigned overflow.  */
2107      if (RANGE_CHECK && n != 0)
2108	{
2109	  if ((unsigned_p && (unsigned)prevn >= (unsigned)n))
2110	    range_error("Overflow on numeric constant.");
2111	}
2112      prevn = n;
2113    }
2114
2115  /* If the number is too big to be an int, or it's got an l suffix
2116     then it's a long.  Work out if this has to be a long by
2117     shifting right and and seeing if anything remains, and the
2118     target int size is different to the target long size.
2119
2120     In the expression below, we could have tested
2121     (n >> TARGET_INT_BIT)
2122     to see if it was zero,
2123     but too many compilers warn about that, when ints and longs
2124     are the same size.  So we shift it twice, with fewer bits
2125     each time, for the same result.  */
2126
2127  if ((TARGET_INT_BIT != TARGET_LONG_BIT
2128       && ((n >> 2) >> (TARGET_INT_BIT-2)))   /* Avoid shift warning */
2129      || long_p)
2130    {
2131      high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1);
2132      unsigned_type = builtin_type_unsigned_long;
2133      signed_type = builtin_type_long;
2134    }
2135  else
2136    {
2137      high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1);
2138      unsigned_type = builtin_type_unsigned_int;
2139      signed_type = builtin_type_int;
2140    }
2141
2142  putithere->typed_val.val = n;
2143
2144  /* If the high bit of the worked out type is set then this number
2145     has to be unsigned. */
2146
2147  if (unsigned_p || (n & high_bit))
2148    putithere->typed_val.type = unsigned_type;
2149  else
2150    putithere->typed_val.type = signed_type;
2151
2152  return INT;
2153}
2154
2155struct token
2156{
2157  char *operator;
2158  int token;
2159  enum exp_opcode opcode;
2160};
2161
2162static const struct token dot_ops[] =
2163{
2164  { ".and.", BOOL_AND, BINOP_END },
2165  { ".AND.", BOOL_AND, BINOP_END },
2166  { ".or.", BOOL_OR, BINOP_END },
2167  { ".OR.", BOOL_OR, BINOP_END },
2168  { ".not.", BOOL_NOT, BINOP_END },
2169  { ".NOT.", BOOL_NOT, BINOP_END },
2170  { ".eq.", EQUAL, BINOP_END },
2171  { ".EQ.", EQUAL, BINOP_END },
2172  { ".eqv.", EQUAL, BINOP_END },
2173  { ".NEQV.", NOTEQUAL, BINOP_END },
2174  { ".neqv.", NOTEQUAL, BINOP_END },
2175  { ".EQV.", EQUAL, BINOP_END },
2176  { ".ne.", NOTEQUAL, BINOP_END },
2177  { ".NE.", NOTEQUAL, BINOP_END },
2178  { ".le.", LEQ, BINOP_END },
2179  { ".LE.", LEQ, BINOP_END },
2180  { ".ge.", GEQ, BINOP_END },
2181  { ".GE.", GEQ, BINOP_END },
2182  { ".gt.", GREATERTHAN, BINOP_END },
2183  { ".GT.", GREATERTHAN, BINOP_END },
2184  { ".lt.", LESSTHAN, BINOP_END },
2185  { ".LT.", LESSTHAN, BINOP_END },
2186  { NULL, 0, 0 }
2187};
2188
2189struct f77_boolean_val
2190{
2191  char *name;
2192  int value;
2193};
2194
2195static const struct f77_boolean_val boolean_values[]  =
2196{
2197  { ".true.", 1 },
2198  { ".TRUE.", 1 },
2199  { ".false.", 0 },
2200  { ".FALSE.", 0 },
2201  { NULL, 0 }
2202};
2203
2204static const struct token f77_keywords[] =
2205{
2206  { "complex_16", COMPLEX_S16_KEYWORD, BINOP_END },
2207  { "complex_32", COMPLEX_S32_KEYWORD, BINOP_END },
2208  { "character", CHARACTER, BINOP_END },
2209  { "integer_2", INT_S2_KEYWORD, BINOP_END },
2210  { "logical_1", LOGICAL_S1_KEYWORD, BINOP_END },
2211  { "logical_2", LOGICAL_S2_KEYWORD, BINOP_END },
2212  { "complex_8", COMPLEX_S8_KEYWORD, BINOP_END },
2213  { "integer", INT_KEYWORD, BINOP_END },
2214  { "logical", LOGICAL_KEYWORD, BINOP_END },
2215  { "real_16", REAL_S16_KEYWORD, BINOP_END },
2216  { "complex", COMPLEX_S8_KEYWORD, BINOP_END },
2217  { "sizeof", SIZEOF, BINOP_END },
2218  { "real_8", REAL_S8_KEYWORD, BINOP_END },
2219  { "real", REAL_KEYWORD, BINOP_END },
2220  { NULL, 0, 0 }
2221};
2222
2223/* Implementation of a dynamically expandable buffer for processing input
2224   characters acquired through lexptr and building a value to return in
2225   yylval. Ripped off from ch-exp.y */
2226
2227static char *tempbuf;		/* Current buffer contents */
2228static int tempbufsize;		/* Size of allocated buffer */
2229static int tempbufindex;	/* Current index into buffer */
2230
2231#define GROWBY_MIN_SIZE 64	/* Minimum amount to grow buffer by */
2232
2233#define CHECKBUF(size) \
2234  do { \
2235    if (tempbufindex + (size) >= tempbufsize) \
2236      { \
2237	growbuf_by_size (size); \
2238      } \
2239  } while (0);
2240
2241
2242/* Grow the static temp buffer if necessary, including allocating the first one
2243   on demand. */
2244
2245static void
2246growbuf_by_size (count)
2247     int count;
2248{
2249  int growby;
2250
2251  growby = max (count, GROWBY_MIN_SIZE);
2252  tempbufsize += growby;
2253  if (tempbuf == NULL)
2254    tempbuf = (char *) xmalloc (tempbufsize);
2255  else
2256    tempbuf = (char *) xrealloc (tempbuf, tempbufsize);
2257}
2258
2259/* Blatantly ripped off from ch-exp.y. This routine recognizes F77
2260   string-literals.
2261
2262   Recognize a string literal.  A string literal is a nonzero sequence
2263   of characters enclosed in matching single quotes, except that
2264   a single character inside single quotes is a character literal, which
2265   we reject as a string literal.  To embed the terminator character inside
2266   a string, it is simply doubled (I.E. 'this''is''one''string') */
2267
2268static int
2269match_string_literal ()
2270{
2271  char *tokptr = lexptr;
2272
2273  for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++)
2274    {
2275      CHECKBUF (1);
2276      if (*tokptr == *lexptr)
2277	{
2278	  if (*(tokptr + 1) == *lexptr)
2279	    tokptr++;
2280	  else
2281	    break;
2282	}
2283      tempbuf[tempbufindex++] = *tokptr;
2284    }
2285  if (*tokptr == '\0'					/* no terminator */
2286      || tempbufindex == 0)				/* no string */
2287    return 0;
2288  else
2289    {
2290      tempbuf[tempbufindex] = '\0';
2291      yylval.sval.ptr = tempbuf;
2292      yylval.sval.length = tempbufindex;
2293      lexptr = ++tokptr;
2294      return STRING_LITERAL;
2295    }
2296}
2297
2298/* Read one token, getting characters through lexptr.  */
2299
2300static int
2301yylex ()
2302{
2303  int c;
2304  int namelen;
2305  unsigned int i,token;
2306  char *tokstart;
2307
2308 retry:
2309
2310  prev_lexptr = lexptr;
2311
2312  tokstart = lexptr;
2313
2314  /* First of all, let us make sure we are not dealing with the
2315     special tokens .true. and .false. which evaluate to 1 and 0.  */
2316
2317  if (*lexptr == '.')
2318    {
2319      for (i = 0; boolean_values[i].name != NULL; i++)
2320	{
2321	  if (strncmp (tokstart, boolean_values[i].name,
2322		       strlen (boolean_values[i].name)) == 0)
2323	    {
2324	      lexptr += strlen (boolean_values[i].name);
2325	      yylval.lval = boolean_values[i].value;
2326	      return BOOLEAN_LITERAL;
2327	    }
2328	}
2329    }
2330
2331  /* See if it is a special .foo. operator */
2332
2333  for (i = 0; dot_ops[i].operator != NULL; i++)
2334    if (strncmp (tokstart, dot_ops[i].operator, strlen (dot_ops[i].operator)) == 0)
2335      {
2336	lexptr += strlen (dot_ops[i].operator);
2337	yylval.opcode = dot_ops[i].opcode;
2338	return dot_ops[i].token;
2339      }
2340
2341  switch (c = *tokstart)
2342    {
2343    case 0:
2344      return 0;
2345
2346    case ' ':
2347    case '\t':
2348    case '\n':
2349      lexptr++;
2350      goto retry;
2351
2352    case '\'':
2353      token = match_string_literal ();
2354      if (token != 0)
2355	return (token);
2356      break;
2357
2358    case '(':
2359      paren_depth++;
2360      lexptr++;
2361      return c;
2362
2363    case ')':
2364      if (paren_depth == 0)
2365	return 0;
2366      paren_depth--;
2367      lexptr++;
2368      return c;
2369
2370    case ',':
2371      if (comma_terminates && paren_depth == 0)
2372	return 0;
2373      lexptr++;
2374      return c;
2375
2376    case '.':
2377      /* Might be a floating point number.  */
2378      if (lexptr[1] < '0' || lexptr[1] > '9')
2379	goto symbol;		/* Nope, must be a symbol. */
2380      /* FALL THRU into number case.  */
2381
2382    case '0':
2383    case '1':
2384    case '2':
2385    case '3':
2386    case '4':
2387    case '5':
2388    case '6':
2389    case '7':
2390    case '8':
2391    case '9':
2392      {
2393        /* It's a number.  */
2394	int got_dot = 0, got_e = 0, got_d = 0, toktype;
2395	char *p = tokstart;
2396	int hex = input_radix > 10;
2397
2398	if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2399	  {
2400	    p += 2;
2401	    hex = 1;
2402	  }
2403	else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
2404	  {
2405	    p += 2;
2406	    hex = 0;
2407	  }
2408
2409	for (;; ++p)
2410	  {
2411	    if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2412	      got_dot = got_e = 1;
2413	    else if (!hex && !got_d && (*p == 'd' || *p == 'D'))
2414	      got_dot = got_d = 1;
2415	    else if (!hex && !got_dot && *p == '.')
2416	      got_dot = 1;
2417	    else if (((got_e && (p[-1] == 'e' || p[-1] == 'E'))
2418		     || (got_d && (p[-1] == 'd' || p[-1] == 'D')))
2419		     && (*p == '-' || *p == '+'))
2420	      /* This is the sign of the exponent, not the end of the
2421		 number.  */
2422	      continue;
2423	    /* We will take any letters or digits.  parse_number will
2424	       complain if past the radix, or if L or U are not final.  */
2425	    else if ((*p < '0' || *p > '9')
2426		     && ((*p < 'a' || *p > 'z')
2427			 && (*p < 'A' || *p > 'Z')))
2428	      break;
2429	  }
2430	toktype = parse_number (tokstart, p - tokstart, got_dot|got_e|got_d,
2431				&yylval);
2432        if (toktype == ERROR)
2433          {
2434	    char *err_copy = (char *) alloca (p - tokstart + 1);
2435
2436	    memcpy (err_copy, tokstart, p - tokstart);
2437	    err_copy[p - tokstart] = 0;
2438	    error ("Invalid number \"%s\".", err_copy);
2439	  }
2440	lexptr = p;
2441	return toktype;
2442      }
2443
2444    case '+':
2445    case '-':
2446    case '*':
2447    case '/':
2448    case '%':
2449    case '|':
2450    case '&':
2451    case '^':
2452    case '~':
2453    case '!':
2454    case '@':
2455    case '<':
2456    case '>':
2457    case '[':
2458    case ']':
2459    case '?':
2460    case ':':
2461    case '=':
2462    case '{':
2463    case '}':
2464    symbol:
2465      lexptr++;
2466      return c;
2467    }
2468
2469  if (!(c == '_' || c == '$'
2470	|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2471    /* We must have come across a bad character (e.g. ';').  */
2472    error ("Invalid character '%c' in expression.", c);
2473
2474  namelen = 0;
2475  for (c = tokstart[namelen];
2476       (c == '_' || c == '$' || (c >= '0' && c <= '9')
2477	|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
2478       c = tokstart[++namelen]);
2479
2480  /* The token "if" terminates the expression and is NOT
2481     removed from the input stream.  */
2482
2483  if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2484    return 0;
2485
2486  lexptr += namelen;
2487
2488  /* Catch specific keywords.  */
2489
2490  for (i = 0; f77_keywords[i].operator != NULL; i++)
2491    if (strncmp (tokstart, f77_keywords[i].operator,
2492		 strlen(f77_keywords[i].operator)) == 0)
2493      {
2494	/* 	lexptr += strlen(f77_keywords[i].operator); */
2495	yylval.opcode = f77_keywords[i].opcode;
2496	return f77_keywords[i].token;
2497      }
2498
2499  yylval.sval.ptr = tokstart;
2500  yylval.sval.length = namelen;
2501
2502  if (*tokstart == '$')
2503    {
2504      write_dollar_variable (yylval.sval);
2505      return VARIABLE;
2506    }
2507
2508  /* Use token-type TYPENAME for symbols that happen to be defined
2509     currently as names of types; NAME for other symbols.
2510     The caller is not constrained to care about the distinction.  */
2511  {
2512    char *tmp = copy_name (yylval.sval);
2513    struct symbol *sym;
2514    int is_a_field_of_this = 0;
2515    int hextype;
2516
2517    sym = lookup_symbol (tmp, expression_context_block,
2518			 VAR_DOMAIN,
2519			 current_language->la_language == language_cplus
2520			 ? &is_a_field_of_this : NULL,
2521			 NULL);
2522    if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
2523      {
2524	yylval.tsym.type = SYMBOL_TYPE (sym);
2525	return TYPENAME;
2526      }
2527    if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
2528      return TYPENAME;
2529
2530    /* Input names that aren't symbols but ARE valid hex numbers,
2531       when the input radix permits them, can be names or numbers
2532       depending on the parse.  Note we support radixes > 16 here.  */
2533    if (!sym
2534	&& ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
2535	    || (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2536      {
2537 	YYSTYPE newlval;	/* Its value is ignored.  */
2538	hextype = parse_number (tokstart, namelen, 0, &newlval);
2539	if (hextype == INT)
2540	  {
2541	    yylval.ssym.sym = sym;
2542	    yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2543	    return NAME_OR_INT;
2544	  }
2545      }
2546
2547    /* Any other kind of symbol */
2548    yylval.ssym.sym = sym;
2549    yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2550    return NAME;
2551  }
2552}
2553
2554void
2555yyerror (msg)
2556     char *msg;
2557{
2558  if (prev_lexptr)
2559    lexptr = prev_lexptr;
2560
2561  error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
2562}
2563
2564
2565