1130803Smarcel/* A Bison parser, made by GNU Bison 1.875.  */
2130803Smarcel
3130803Smarcel/* Skeleton parser for Yacc-like parsing with Bison,
4130803Smarcel   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
5130803Smarcel
6130803Smarcel   This program is free software; you can redistribute it and/or modify
7130803Smarcel   it under the terms of the GNU General Public License as published by
8130803Smarcel   the Free Software Foundation; either version 2, or (at your option)
9130803Smarcel   any later version.
10130803Smarcel
11130803Smarcel   This program is distributed in the hope that it will be useful,
12130803Smarcel   but WITHOUT ANY WARRANTY; without even the implied warranty of
13130803Smarcel   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14130803Smarcel   GNU General Public License for more details.
15130803Smarcel
16130803Smarcel   You should have received a copy of the GNU General Public License
17130803Smarcel   along with this program; if not, write to the Free Software
18130803Smarcel   Foundation, Inc., 59 Temple Place - Suite 330,
19130803Smarcel   Boston, MA 02111-1307, USA.  */
20130803Smarcel
21130803Smarcel/* As a special exception, when this file is copied by Bison into a
22130803Smarcel   Bison output file, you may use that output file without restriction.
23130803Smarcel   This special exception was added by the Free Software Foundation
24130803Smarcel   in version 1.24 of Bison.  */
25130803Smarcel
26130803Smarcel/* Written by Richard Stallman by simplifying the original so called
27130803Smarcel   ``semantic'' parser.  */
28130803Smarcel
29130803Smarcel/* All symbols defined below should begin with yy or YY, to avoid
30130803Smarcel   infringing on user name space.  This should be done even for local
31130803Smarcel   variables, as they might otherwise be expanded by user macros.
32130803Smarcel   There are some unavoidable exceptions within include files to
33130803Smarcel   define necessary library symbols; they are noted "INFRINGES ON
34130803Smarcel   USER NAME SPACE" below.  */
35130803Smarcel
36130803Smarcel/* Identify Bison output.  */
37130803Smarcel#define YYBISON 1
38130803Smarcel
39130803Smarcel/* Skeleton name.  */
40130803Smarcel#define YYSKELETON_NAME "yacc.c"
41130803Smarcel
42130803Smarcel/* Pure parsers.  */
43130803Smarcel#define YYPURE 0
44130803Smarcel
45130803Smarcel/* Using locations.  */
46130803Smarcel#define YYLSP_NEEDED 0
47130803Smarcel
48130803Smarcel
49130803Smarcel
50130803Smarcel/* Tokens.  */
51130803Smarcel#ifndef YYTOKENTYPE
52130803Smarcel# define YYTOKENTYPE
53130803Smarcel   /* Put the tokens into the symbol table, so that GDB and other debuggers
54130803Smarcel      know about them.  */
55130803Smarcel   enum yytokentype {
56130803Smarcel     INT = 258,
57130803Smarcel     FLOAT = 259,
58130803Smarcel     STRING = 260,
59130803Smarcel     FIELDNAME = 261,
60130803Smarcel     NAME = 262,
61130803Smarcel     TYPENAME = 263,
62130803Smarcel     NAME_OR_INT = 264,
63130803Smarcel     STRUCT = 265,
64130803Smarcel     CLASS = 266,
65130803Smarcel     SIZEOF = 267,
66130803Smarcel     COLONCOLON = 268,
67130803Smarcel     ERROR = 269,
68130803Smarcel     VARIABLE = 270,
69130803Smarcel     THIS = 271,
70130803Smarcel     TRUEKEYWORD = 272,
71130803Smarcel     FALSEKEYWORD = 273,
72130803Smarcel     ABOVE_COMMA = 274,
73130803Smarcel     ASSIGN = 275,
74130803Smarcel     NOT = 276,
75130803Smarcel     OR = 277,
76130803Smarcel     XOR = 278,
77130803Smarcel     ANDAND = 279,
78130803Smarcel     NOTEQUAL = 280,
79130803Smarcel     GEQ = 281,
80130803Smarcel     LEQ = 282,
81130803Smarcel     MOD = 283,
82130803Smarcel     DIV = 284,
83130803Smarcel     RSH = 285,
84130803Smarcel     LSH = 286,
85130803Smarcel     DECREMENT = 287,
86130803Smarcel     INCREMENT = 288,
87130803Smarcel     UNARY = 289,
88130803Smarcel     ARROW = 290,
89130803Smarcel     BLOCKNAME = 291
90130803Smarcel   };
91130803Smarcel#endif
92130803Smarcel#define INT 258
93130803Smarcel#define FLOAT 259
94130803Smarcel#define STRING 260
95130803Smarcel#define FIELDNAME 261
96130803Smarcel#define NAME 262
97130803Smarcel#define TYPENAME 263
98130803Smarcel#define NAME_OR_INT 264
99130803Smarcel#define STRUCT 265
100130803Smarcel#define CLASS 266
101130803Smarcel#define SIZEOF 267
102130803Smarcel#define COLONCOLON 268
103130803Smarcel#define ERROR 269
104130803Smarcel#define VARIABLE 270
105130803Smarcel#define THIS 271
106130803Smarcel#define TRUEKEYWORD 272
107130803Smarcel#define FALSEKEYWORD 273
108130803Smarcel#define ABOVE_COMMA 274
109130803Smarcel#define ASSIGN 275
110130803Smarcel#define NOT 276
111130803Smarcel#define OR 277
112130803Smarcel#define XOR 278
113130803Smarcel#define ANDAND 279
114130803Smarcel#define NOTEQUAL 280
115130803Smarcel#define GEQ 281
116130803Smarcel#define LEQ 282
117130803Smarcel#define MOD 283
118130803Smarcel#define DIV 284
119130803Smarcel#define RSH 285
120130803Smarcel#define LSH 286
121130803Smarcel#define DECREMENT 287
122130803Smarcel#define INCREMENT 288
123130803Smarcel#define UNARY 289
124130803Smarcel#define ARROW 290
125130803Smarcel#define BLOCKNAME 291
126130803Smarcel
127130803Smarcel
128130803Smarcel
129130803Smarcel
130130803Smarcel/* Copy the first part of user declarations.  */
131130803Smarcel#line 46 "p-exp.y"
132130803Smarcel
133130803Smarcel
134130803Smarcel#include "defs.h"
135130803Smarcel#include "gdb_string.h"
136130803Smarcel#include <ctype.h>
137130803Smarcel#include "expression.h"
138130803Smarcel#include "value.h"
139130803Smarcel#include "parser-defs.h"
140130803Smarcel#include "language.h"
141130803Smarcel#include "p-lang.h"
142130803Smarcel#include "bfd.h" /* Required by objfiles.h.  */
143130803Smarcel#include "symfile.h" /* Required by objfiles.h.  */
144130803Smarcel#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
145130803Smarcel#include "block.h"
146130803Smarcel
147130803Smarcel/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
148130803Smarcel   as well as gratuitiously global symbol names, so we can have multiple
149130803Smarcel   yacc generated parsers in gdb.  Note that these are only the variables
150130803Smarcel   produced by yacc.  If other parser generators (bison, byacc, etc) produce
151130803Smarcel   additional global names that conflict at link time, then those parser
152130803Smarcel   generators need to be fixed instead of adding those names to this list. */
153130803Smarcel
154130803Smarcel#define	yymaxdepth pascal_maxdepth
155130803Smarcel#define	yyparse	pascal_parse
156130803Smarcel#define	yylex	pascal_lex
157130803Smarcel#define	yyerror	pascal_error
158130803Smarcel#define	yylval	pascal_lval
159130803Smarcel#define	yychar	pascal_char
160130803Smarcel#define	yydebug	pascal_debug
161130803Smarcel#define	yypact	pascal_pact
162130803Smarcel#define	yyr1	pascal_r1
163130803Smarcel#define	yyr2	pascal_r2
164130803Smarcel#define	yydef	pascal_def
165130803Smarcel#define	yychk	pascal_chk
166130803Smarcel#define	yypgo	pascal_pgo
167130803Smarcel#define	yyact	pascal_act
168130803Smarcel#define	yyexca	pascal_exca
169130803Smarcel#define yyerrflag pascal_errflag
170130803Smarcel#define yynerrs	pascal_nerrs
171130803Smarcel#define	yyps	pascal_ps
172130803Smarcel#define	yypv	pascal_pv
173130803Smarcel#define	yys	pascal_s
174130803Smarcel#define	yy_yys	pascal_yys
175130803Smarcel#define	yystate	pascal_state
176130803Smarcel#define	yytmp	pascal_tmp
177130803Smarcel#define	yyv	pascal_v
178130803Smarcel#define	yy_yyv	pascal_yyv
179130803Smarcel#define	yyval	pascal_val
180130803Smarcel#define	yylloc	pascal_lloc
181130803Smarcel#define yyreds	pascal_reds		/* With YYDEBUG defined */
182130803Smarcel#define yytoks	pascal_toks		/* With YYDEBUG defined */
183130803Smarcel#define yyname	pascal_name		/* With YYDEBUG defined */
184130803Smarcel#define yyrule	pascal_rule		/* With YYDEBUG defined */
185130803Smarcel#define yylhs	pascal_yylhs
186130803Smarcel#define yylen	pascal_yylen
187130803Smarcel#define yydefred pascal_yydefred
188130803Smarcel#define yydgoto	pascal_yydgoto
189130803Smarcel#define yysindex pascal_yysindex
190130803Smarcel#define yyrindex pascal_yyrindex
191130803Smarcel#define yygindex pascal_yygindex
192130803Smarcel#define yytable	 pascal_yytable
193130803Smarcel#define yycheck	 pascal_yycheck
194130803Smarcel
195130803Smarcel#ifndef YYDEBUG
196130803Smarcel#define	YYDEBUG 1		/* Default to yydebug support */
197130803Smarcel#endif
198130803Smarcel
199130803Smarcel#define YYFPRINTF parser_fprintf
200130803Smarcel
201130803Smarcelint yyparse (void);
202130803Smarcel
203130803Smarcelstatic int yylex (void);
204130803Smarcel
205130803Smarcelvoid
206130803Smarcelyyerror (char *);
207130803Smarcel
208130803Smarcelstatic char * uptok (char *, int);
209130803Smarcel
210130803Smarcel
211130803Smarcel/* Enabling traces.  */
212130803Smarcel#ifndef YYDEBUG
213130803Smarcel# define YYDEBUG 0
214130803Smarcel#endif
215130803Smarcel
216130803Smarcel/* Enabling verbose error messages.  */
217130803Smarcel#ifdef YYERROR_VERBOSE
218130803Smarcel# undef YYERROR_VERBOSE
219130803Smarcel# define YYERROR_VERBOSE 1
220130803Smarcel#else
221130803Smarcel# define YYERROR_VERBOSE 0
222130803Smarcel#endif
223130803Smarcel
224130803Smarcel#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
225130803Smarcel#line 130 "p-exp.y"
226130803Smarceltypedef union YYSTYPE {
227130803Smarcel    LONGEST lval;
228130803Smarcel    struct {
229130803Smarcel      LONGEST val;
230130803Smarcel      struct type *type;
231130803Smarcel    } typed_val_int;
232130803Smarcel    struct {
233130803Smarcel      DOUBLEST dval;
234130803Smarcel      struct type *type;
235130803Smarcel    } typed_val_float;
236130803Smarcel    struct symbol *sym;
237130803Smarcel    struct type *tval;
238130803Smarcel    struct stoken sval;
239130803Smarcel    struct ttype tsym;
240130803Smarcel    struct symtoken ssym;
241130803Smarcel    int voidval;
242130803Smarcel    struct block *bval;
243130803Smarcel    enum exp_opcode opcode;
244130803Smarcel    struct internalvar *ivar;
245130803Smarcel
246130803Smarcel    struct type **tvec;
247130803Smarcel    int *ivec;
248130803Smarcel  } YYSTYPE;
249130803Smarcel/* Line 191 of yacc.c.  */
250130803Smarcel# define yystype YYSTYPE /* obsolescent; will be withdrawn */
251130803Smarcel# define YYSTYPE_IS_DECLARED 1
252130803Smarcel# define YYSTYPE_IS_TRIVIAL 1
253130803Smarcel#endif
254130803Smarcel
255130803Smarcel
256130803Smarcel
257130803Smarcel/* Copy the second part of user declarations.  */
258130803Smarcel#line 154 "p-exp.y"
259130803Smarcel
260130803Smarcel/* YYSTYPE gets defined by %union */
261130803Smarcelstatic int
262130803Smarcelparse_number (char *, int, int, YYSTYPE *);
263130803Smarcel
264130803Smarcelstatic struct type *current_type;
265130803Smarcel
266130803Smarcelstatic void push_current_type (void);
267130803Smarcelstatic void pop_current_type (void);
268130803Smarcelstatic int search_field;
269130803Smarcel
270130803Smarcel
271130803Smarcel/* Line 214 of yacc.c.  */
272130803Smarcel
273130803Smarcel#if ! defined (yyoverflow) || YYERROR_VERBOSE
274130803Smarcel
275130803Smarcel/* The parser invokes alloca or xmalloc; define the necessary symbols.  */
276130803Smarcel
277130803Smarcel# if YYSTACK_USE_ALLOCA
278130803Smarcel#  define YYSTACK_ALLOC alloca
279130803Smarcel# else
280130803Smarcel#  ifndef YYSTACK_USE_ALLOCA
281130803Smarcel#   if defined (alloca) || defined (_ALLOCA_H)
282130803Smarcel#    define YYSTACK_ALLOC alloca
283130803Smarcel#   else
284130803Smarcel#    ifdef __GNUC__
285130803Smarcel#     define YYSTACK_ALLOC __builtin_alloca
286130803Smarcel#    endif
287130803Smarcel#   endif
288130803Smarcel#  endif
289130803Smarcel# endif
290130803Smarcel
291130803Smarcel# ifdef YYSTACK_ALLOC
292130803Smarcel   /* Pacify GCC's `empty if-body' warning. */
293130803Smarcel#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
294130803Smarcel# else
295130803Smarcel#  if defined (__STDC__) || defined (__cplusplus)
296130803Smarcel#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
297130803Smarcel#   define YYSIZE_T size_t
298130803Smarcel#  endif
299130803Smarcel#  define YYSTACK_ALLOC xmalloc
300130803Smarcel#  define YYSTACK_FREE free
301130803Smarcel# endif
302130803Smarcel#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
303130803Smarcel
304130803Smarcel
305130803Smarcel#if (! defined (yyoverflow) \
306130803Smarcel     && (! defined (__cplusplus) \
307130803Smarcel	 || (YYSTYPE_IS_TRIVIAL)))
308130803Smarcel
309130803Smarcel/* A type that is properly aligned for any stack member.  */
310130803Smarcelunion yyalloc
311130803Smarcel{
312130803Smarcel  short yyss;
313130803Smarcel  YYSTYPE yyvs;
314130803Smarcel  };
315130803Smarcel
316130803Smarcel/* The size of the maximum gap between one aligned stack and the next.  */
317130803Smarcel# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
318130803Smarcel
319130803Smarcel/* The size of an array large to enough to hold all stacks, each with
320130803Smarcel   N elements.  */
321130803Smarcel# define YYSTACK_BYTES(N) \
322130803Smarcel     ((N) * (sizeof (short) + sizeof (YYSTYPE))				\
323130803Smarcel      + YYSTACK_GAP_MAXIMUM)
324130803Smarcel
325130803Smarcel/* Copy COUNT objects from FROM to TO.  The source and destination do
326130803Smarcel   not overlap.  */
327130803Smarcel# ifndef YYCOPY
328130803Smarcel#  if 1 < __GNUC__
329130803Smarcel#   define YYCOPY(To, From, Count) \
330130803Smarcel      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
331130803Smarcel#  else
332130803Smarcel#   define YYCOPY(To, From, Count)		\
333130803Smarcel      do					\
334130803Smarcel	{					\
335130803Smarcel	  register YYSIZE_T yyi;		\
336130803Smarcel	  for (yyi = 0; yyi < (Count); yyi++)	\
337130803Smarcel	    (To)[yyi] = (From)[yyi];		\
338130803Smarcel	}					\
339130803Smarcel      while (0)
340130803Smarcel#  endif
341130803Smarcel# endif
342130803Smarcel
343130803Smarcel/* Relocate STACK from its old location to the new one.  The
344130803Smarcel   local variables YYSIZE and YYSTACKSIZE give the old and new number of
345130803Smarcel   elements in the stack, and YYPTR gives the new location of the
346130803Smarcel   stack.  Advance YYPTR to a properly aligned location for the next
347130803Smarcel   stack.  */
348130803Smarcel# define YYSTACK_RELOCATE(Stack)					\
349130803Smarcel    do									\
350130803Smarcel      {									\
351130803Smarcel	YYSIZE_T yynewbytes;						\
352130803Smarcel	YYCOPY (&yyptr->Stack, Stack, yysize);				\
353130803Smarcel	Stack = &yyptr->Stack;						\
354130803Smarcel	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
355130803Smarcel	yyptr += yynewbytes / sizeof (*yyptr);				\
356130803Smarcel      }									\
357130803Smarcel    while (0)
358130803Smarcel
359130803Smarcel#endif
360130803Smarcel
361130803Smarcel#if defined (__STDC__) || defined (__cplusplus)
362130803Smarcel   typedef signed char yysigned_char;
363130803Smarcel#else
364130803Smarcel   typedef short yysigned_char;
365130803Smarcel#endif
366130803Smarcel
367130803Smarcel/* YYFINAL -- State number of the termination state. */
368130803Smarcel#define YYFINAL  3
369130803Smarcel/* YYLAST -- Last index in YYTABLE.  */
370130803Smarcel#define YYLAST   359
371130803Smarcel
372130803Smarcel/* YYNTOKENS -- Number of terminals. */
373130803Smarcel#define YYNTOKENS  52
374130803Smarcel/* YYNNTS -- Number of nonterminals. */
375130803Smarcel#define YYNNTS  19
376130803Smarcel/* YYNRULES -- Number of rules. */
377130803Smarcel#define YYNRULES  73
378130803Smarcel/* YYNRULES -- Number of states. */
379130803Smarcel#define YYNSTATES  123
380130803Smarcel
381130803Smarcel/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
382130803Smarcel#define YYUNDEFTOK  2
383130803Smarcel#define YYMAXUTOK   291
384130803Smarcel
385130803Smarcel#define YYTRANSLATE(YYX) 						\
386130803Smarcel  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
387130803Smarcel
388130803Smarcel/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
389130803Smarcelstatic const unsigned char yytranslate[] =
390130803Smarcel{
391130803Smarcel       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
392130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
393130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
394130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
395130803Smarcel      46,    50,    39,    37,    19,    38,    44,    40,     2,     2,
396130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
397130803Smarcel      28,    26,    29,     2,    36,     2,     2,     2,     2,     2,
398130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
399130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
400130803Smarcel       2,    45,     2,    51,    48,     2,     2,     2,     2,     2,
401130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
402130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
403130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
404130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
405130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
406130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
407130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
408130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
409130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
410130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
411130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
412130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
413130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
414130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
415130803Smarcel       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
416130803Smarcel       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
417130803Smarcel       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
418130803Smarcel      15,    16,    17,    18,    20,    21,    22,    23,    24,    25,
419130803Smarcel      27,    30,    31,    32,    33,    34,    35,    41,    42,    43,
420130803Smarcel      47,    49
421130803Smarcel};
422130803Smarcel
423130803Smarcel#if YYDEBUG
424130803Smarcel/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
425130803Smarcel   YYRHS.  */
426130803Smarcelstatic const unsigned char yyprhs[] =
427130803Smarcel{
428130803Smarcel       0,     0,     3,     4,     7,     9,    11,    13,    15,    19,
429130803Smarcel      22,    25,    28,    31,    36,    41,    42,    47,    48,    54,
430130803Smarcel      55,    61,    62,    64,    68,    73,    77,    81,    85,    89,
431130803Smarcel      93,    97,   101,   105,   109,   113,   117,   121,   125,   129,
432130803Smarcel     133,   137,   141,   145,   149,   151,   153,   155,   157,   159,
433130803Smarcel     161,   163,   168,   170,   172,   174,   178,   182,   186,   188,
434130803Smarcel     191,   193,   195,   197,   201,   204,   206,   209,   212,   214,
435130803Smarcel     216,   218,   220,   222
436130803Smarcel};
437130803Smarcel
438130803Smarcel/* YYRHS -- A `-1'-separated list of the rules' RHS. */
439130803Smarcelstatic const yysigned_char yyrhs[] =
440130803Smarcel{
441130803Smarcel      53,     0,    -1,    -1,    54,    55,    -1,    57,    -1,    56,
442130803Smarcel      -1,    67,    -1,    58,    -1,    57,    19,    58,    -1,    58,
443130803Smarcel      48,    -1,    36,    58,    -1,    38,    58,    -1,    22,    58,
444130803Smarcel      -1,    42,    46,    58,    50,    -1,    41,    46,    58,    50,
445130803Smarcel      -1,    -1,    58,    44,    59,     6,    -1,    -1,    58,    45,
446130803Smarcel      60,    57,    51,    -1,    -1,    58,    46,    61,    62,    50,
447130803Smarcel      -1,    -1,    58,    -1,    62,    19,    58,    -1,    67,    46,
448130803Smarcel      58,    50,    -1,    46,    57,    50,    -1,    58,    39,    58,
449130803Smarcel      -1,    58,    40,    58,    -1,    58,    33,    58,    -1,    58,
450130803Smarcel      32,    58,    -1,    58,    37,    58,    -1,    58,    38,    58,
451130803Smarcel      -1,    58,    35,    58,    -1,    58,    34,    58,    -1,    58,
452130803Smarcel      26,    58,    -1,    58,    27,    58,    -1,    58,    31,    58,
453130803Smarcel      -1,    58,    30,    58,    -1,    58,    28,    58,    -1,    58,
454130803Smarcel      29,    58,    -1,    58,    25,    58,    -1,    58,    24,    58,
455130803Smarcel      -1,    58,    23,    58,    -1,    58,    21,    58,    -1,    17,
456130803Smarcel      -1,    18,    -1,     3,    -1,     9,    -1,     4,    -1,    64,
457130803Smarcel      -1,    15,    -1,    12,    46,    67,    50,    -1,     5,    -1,
458130803Smarcel      16,    -1,    49,    -1,    63,    13,    69,    -1,    63,    13,
459130803Smarcel      69,    -1,    68,    13,    69,    -1,    65,    -1,    13,    69,
460130803Smarcel      -1,    70,    -1,    68,    -1,    66,    -1,    68,    13,    39,
461130803Smarcel      -1,    48,    68,    -1,     8,    -1,    10,    69,    -1,    11,
462130803Smarcel      69,    -1,     7,    -1,    49,    -1,     8,    -1,     9,    -1,
463130803Smarcel       7,    -1,    49,    -1
464130803Smarcel};
465130803Smarcel
466130803Smarcel/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
467130803Smarcelstatic const unsigned short yyrline[] =
468130803Smarcel{
469130803Smarcel       0,   234,   234,   234,   241,   242,   245,   252,   253,   258,
470130803Smarcel     264,   270,   274,   278,   282,   286,   286,   301,   299,   329,
471130803Smarcel     326,   338,   339,   341,   345,   360,   366,   370,   374,   378,
472130803Smarcel     382,   386,   390,   394,   398,   402,   406,   410,   414,   418,
473130803Smarcel     422,   426,   430,   434,   438,   444,   450,   457,   468,   475,
474130803Smarcel     478,   482,   490,   515,   542,   559,   570,   586,   601,   602,
475130803Smarcel     636,   708,   719,   720,   725,   727,   729,   732,   740,   741,
476130803Smarcel     742,   743,   746,   747
477130803Smarcel};
478130803Smarcel#endif
479130803Smarcel
480130803Smarcel#if YYDEBUG || YYERROR_VERBOSE
481130803Smarcel/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
482130803Smarcel   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
483130803Smarcelstatic const char *const yytname[] =
484130803Smarcel{
485130803Smarcel  "$end", "error", "$undefined", "INT", "FLOAT", "STRING", "FIELDNAME",
486130803Smarcel  "NAME", "TYPENAME", "NAME_OR_INT", "STRUCT", "CLASS", "SIZEOF",
487130803Smarcel  "COLONCOLON", "ERROR", "VARIABLE", "THIS", "TRUEKEYWORD",
488130803Smarcel  "FALSEKEYWORD", "','", "ABOVE_COMMA", "ASSIGN", "NOT", "OR", "XOR",
489130803Smarcel  "ANDAND", "'='", "NOTEQUAL", "'<'", "'>'", "GEQ", "LEQ", "MOD", "DIV",
490130803Smarcel  "RSH", "LSH", "'@'", "'+'", "'-'", "'*'", "'/'", "DECREMENT",
491130803Smarcel  "INCREMENT", "UNARY", "'.'", "'['", "'('", "ARROW", "'^'", "BLOCKNAME",
492130803Smarcel  "')'", "']'", "$accept", "start", "@1", "normal_start", "type_exp",
493130803Smarcel  "exp1", "exp", "@2", "@3", "@4", "arglist", "block", "variable",
494130803Smarcel  "qualified_name", "ptype", "type", "typebase", "name",
495130803Smarcel  "name_not_typename", 0
496130803Smarcel};
497130803Smarcel#endif
498130803Smarcel
499130803Smarcel# ifdef YYPRINT
500130803Smarcel/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
501130803Smarcel   token YYLEX-NUM.  */
502130803Smarcelstatic const unsigned short yytoknum[] =
503130803Smarcel{
504130803Smarcel       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
505130803Smarcel     265,   266,   267,   268,   269,   270,   271,   272,   273,    44,
506130803Smarcel     274,   275,   276,   277,   278,   279,    61,   280,    60,    62,
507130803Smarcel     281,   282,   283,   284,   285,   286,    64,    43,    45,    42,
508130803Smarcel      47,   287,   288,   289,    46,    91,    40,   290,    94,   291,
509130803Smarcel      41,    93
510130803Smarcel};
511130803Smarcel# endif
512130803Smarcel
513130803Smarcel/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
514130803Smarcelstatic const unsigned char yyr1[] =
515130803Smarcel{
516130803Smarcel       0,    52,    54,    53,    55,    55,    56,    57,    57,    58,
517130803Smarcel      58,    58,    58,    58,    58,    59,    58,    60,    58,    61,
518130803Smarcel      58,    62,    62,    62,    58,    58,    58,    58,    58,    58,
519130803Smarcel      58,    58,    58,    58,    58,    58,    58,    58,    58,    58,
520130803Smarcel      58,    58,    58,    58,    58,    58,    58,    58,    58,    58,
521130803Smarcel      58,    58,    58,    58,    63,    63,    64,    65,    64,    64,
522130803Smarcel      64,    66,    67,    67,    68,    68,    68,    68,    69,    69,
523130803Smarcel      69,    69,    70,    70
524130803Smarcel};
525130803Smarcel
526130803Smarcel/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
527130803Smarcelstatic const unsigned char yyr2[] =
528130803Smarcel{
529130803Smarcel       0,     2,     0,     2,     1,     1,     1,     1,     3,     2,
530130803Smarcel       2,     2,     2,     4,     4,     0,     4,     0,     5,     0,
531130803Smarcel       5,     0,     1,     3,     4,     3,     3,     3,     3,     3,
532130803Smarcel       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
533130803Smarcel       3,     3,     3,     3,     1,     1,     1,     1,     1,     1,
534130803Smarcel       1,     4,     1,     1,     1,     3,     3,     3,     1,     2,
535130803Smarcel       1,     1,     1,     3,     2,     1,     2,     2,     1,     1,
536130803Smarcel       1,     1,     1,     1
537130803Smarcel};
538130803Smarcel
539130803Smarcel/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
540130803Smarcel   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
541130803Smarcel   means the default is an error.  */
542130803Smarcelstatic const unsigned char yydefact[] =
543130803Smarcel{
544130803Smarcel       2,     0,     0,     1,    46,    48,    52,    72,    65,    47,
545130803Smarcel       0,     0,     0,     0,    50,    53,    44,    45,     0,     0,
546130803Smarcel       0,     0,     0,     0,     0,    73,     3,     5,     4,     7,
547130803Smarcel       0,    49,    58,    62,     6,    61,    60,    68,    70,    71,
548130803Smarcel      69,    66,    67,     0,    59,    12,     0,    10,    11,     0,
549130803Smarcel       0,     0,    64,     0,     0,     0,     0,     0,     0,     0,
550130803Smarcel       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
551130803Smarcel       0,     0,    15,    17,    19,     9,     0,     0,     0,     0,
552130803Smarcel      61,     0,     0,    25,     8,    43,    42,    41,    40,    34,
553130803Smarcel      35,    38,    39,    37,    36,    29,    28,    33,    32,    30,
554130803Smarcel      31,    26,    27,     0,     0,    21,    56,     0,    63,    57,
555130803Smarcel      51,     0,    14,    13,    16,     0,    22,     0,    24,    18,
556130803Smarcel       0,    20,    23
557130803Smarcel};
558130803Smarcel
559130803Smarcel/* YYDEFGOTO[NTERM-NUM]. */
560130803Smarcelstatic const yysigned_char yydefgoto[] =
561130803Smarcel{
562130803Smarcel      -1,     1,     2,    26,    27,    28,    29,   103,   104,   105,
563130803Smarcel     117,    30,    31,    32,    33,    46,    35,    41,    36
564130803Smarcel};
565130803Smarcel
566130803Smarcel/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
567130803Smarcel   STATE-NUM.  */
568130803Smarcel#define YYPACT_NINF -37
569130803Smarcelstatic const short yypact[] =
570130803Smarcel{
571130803Smarcel     -37,     5,    88,   -37,   -37,   -37,   -37,   -37,   -37,   -37,
572130803Smarcel       6,     6,   -35,     6,   -37,   -37,   -37,   -37,    88,    88,
573130803Smarcel      88,   -29,   -27,    88,    10,    12,   -37,   -37,     8,   201,
574130803Smarcel      16,   -37,   -37,   -37,   -13,    21,   -37,   -37,   -37,   -37,
575130803Smarcel     -37,   -37,   -37,    10,   -37,   -36,   -13,   -36,   -36,    88,
576130803Smarcel      88,    11,   -37,    88,    88,    88,    88,    88,    88,    88,
577130803Smarcel      88,    88,    88,    88,    88,    88,    88,    88,    88,    88,
578130803Smarcel      88,    88,   -37,   -37,   -37,   -37,     6,    88,    15,    20,
579130803Smarcel      43,   117,   145,   -37,   201,   201,   226,   250,   273,   294,
580130803Smarcel     294,   311,   311,   311,   311,    28,    28,    28,    28,    68,
581130803Smarcel      68,   -36,   -36,    56,    88,    88,    62,   173,   -37,   -37,
582130803Smarcel     -37,    38,   -37,   -37,   -37,     9,   201,    44,   -37,   -37,
583130803Smarcel      88,   -37,   201
584130803Smarcel};
585130803Smarcel
586130803Smarcel/* YYPGOTO[NTERM-NUM].  */
587130803Smarcelstatic const yysigned_char yypgoto[] =
588130803Smarcel{
589130803Smarcel     -37,   -37,   -37,   -37,   -37,   -20,   -18,   -37,   -37,   -37,
590130803Smarcel     -37,   -37,   -37,   -37,   -37,    14,   -17,    -7,   -37
591130803Smarcel};
592130803Smarcel
593130803Smarcel/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
594130803Smarcel   positive, shift that token.  If negative, reduce the rule which
595130803Smarcel   number is the opposite.  If zero, do what YYDEFACT says.
596130803Smarcel   If YYTABLE_NINF, syntax error.  */
597130803Smarcel#define YYTABLE_NINF -56
598130803Smarcelstatic const yysigned_char yytable[] =
599130803Smarcel{
600130803Smarcel      45,    47,    48,    51,    42,     3,    44,    52,    72,    73,
601130803Smarcel      74,    43,    75,    37,    38,    39,    34,    49,     8,    50,
602130803Smarcel      10,    11,    37,    38,    39,   -54,    80,    53,    53,    76,
603130803Smarcel      53,    81,    82,    77,    78,    84,    85,    86,    87,    88,
604130803Smarcel      89,    90,    91,    92,    93,    94,    95,    96,    97,    98,
605130803Smarcel      99,   100,   101,   102,   108,    40,   111,    79,    24,   107,
606130803Smarcel     119,    83,   114,   120,    40,    68,    69,    70,    71,   106,
607130803Smarcel     110,   109,    72,    73,    74,   -55,    75,   108,     0,     0,
608130803Smarcel       0,     0,     0,     0,   115,     0,     0,   116,     0,     0,
609130803Smarcel       0,     4,     5,     6,   121,     7,     8,     9,    10,    11,
610130803Smarcel      12,    13,   122,    14,    15,    16,    17,    70,    71,     0,
611130803Smarcel      18,     0,    72,    73,    74,     0,    75,     0,     0,     0,
612130803Smarcel       0,     0,     0,     0,    19,     0,    20,     0,     0,    21,
613130803Smarcel      22,     0,     0,     0,    23,     0,    24,    25,    54,     0,
614130803Smarcel      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
615130803Smarcel      65,    66,    67,     0,    68,    69,    70,    71,     0,     0,
616130803Smarcel       0,    72,    73,    74,     0,    75,    54,   112,    55,    56,
617130803Smarcel      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
618130803Smarcel      67,     0,    68,    69,    70,    71,     0,     0,     0,    72,
619130803Smarcel      73,    74,     0,    75,    54,   113,    55,    56,    57,    58,
620130803Smarcel      59,    60,    61,    62,    63,    64,    65,    66,    67,     0,
621130803Smarcel      68,    69,    70,    71,     0,     0,     0,    72,    73,    74,
622130803Smarcel       0,    75,    54,   118,    55,    56,    57,    58,    59,    60,
623130803Smarcel      61,    62,    63,    64,    65,    66,    67,     0,    68,    69,
624130803Smarcel      70,    71,     0,     0,     0,    72,    73,    74,     0,    75,
625130803Smarcel      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
626130803Smarcel      66,    67,     0,    68,    69,    70,    71,     0,     0,     0,
627130803Smarcel      72,    73,    74,     0,    75,    57,    58,    59,    60,    61,
628130803Smarcel      62,    63,    64,    65,    66,    67,     0,    68,    69,    70,
629130803Smarcel      71,     0,     0,     0,    72,    73,    74,     0,    75,    58,
630130803Smarcel      59,    60,    61,    62,    63,    64,    65,    66,    67,     0,
631130803Smarcel      68,    69,    70,    71,     0,     0,     0,    72,    73,    74,
632130803Smarcel       0,    75,    60,    61,    62,    63,    64,    65,    66,    67,
633130803Smarcel       0,    68,    69,    70,    71,     0,     0,     0,    72,    73,
634130803Smarcel      74,     0,    75,    64,    65,    66,    67,     0,    68,    69,
635130803Smarcel      70,    71,     0,     0,     0,    72,    73,    74,     0,    75
636130803Smarcel};
637130803Smarcel
638130803Smarcelstatic const yysigned_char yycheck[] =
639130803Smarcel{
640130803Smarcel      18,    19,    20,    23,    11,     0,    13,    24,    44,    45,
641130803Smarcel      46,    46,    48,     7,     8,     9,     2,    46,     8,    46,
642130803Smarcel      10,    11,     7,     8,     9,    13,    43,    19,    19,    13,
643130803Smarcel      19,    49,    50,    46,    13,    53,    54,    55,    56,    57,
644130803Smarcel      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
645130803Smarcel      68,    69,    70,    71,    39,    49,    13,    43,    48,    77,
646130803Smarcel      51,    50,     6,    19,    49,    37,    38,    39,    40,    76,
647130803Smarcel      50,    78,    44,    45,    46,    13,    48,    39,    -1,    -1,
648130803Smarcel      -1,    -1,    -1,    -1,   104,    -1,    -1,   105,    -1,    -1,
649130803Smarcel      -1,     3,     4,     5,    50,     7,     8,     9,    10,    11,
650130803Smarcel      12,    13,   120,    15,    16,    17,    18,    39,    40,    -1,
651130803Smarcel      22,    -1,    44,    45,    46,    -1,    48,    -1,    -1,    -1,
652130803Smarcel      -1,    -1,    -1,    -1,    36,    -1,    38,    -1,    -1,    41,
653130803Smarcel      42,    -1,    -1,    -1,    46,    -1,    48,    49,    21,    -1,
654130803Smarcel      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
655130803Smarcel      33,    34,    35,    -1,    37,    38,    39,    40,    -1,    -1,
656130803Smarcel      -1,    44,    45,    46,    -1,    48,    21,    50,    23,    24,
657130803Smarcel      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
658130803Smarcel      35,    -1,    37,    38,    39,    40,    -1,    -1,    -1,    44,
659130803Smarcel      45,    46,    -1,    48,    21,    50,    23,    24,    25,    26,
660130803Smarcel      27,    28,    29,    30,    31,    32,    33,    34,    35,    -1,
661130803Smarcel      37,    38,    39,    40,    -1,    -1,    -1,    44,    45,    46,
662130803Smarcel      -1,    48,    21,    50,    23,    24,    25,    26,    27,    28,
663130803Smarcel      29,    30,    31,    32,    33,    34,    35,    -1,    37,    38,
664130803Smarcel      39,    40,    -1,    -1,    -1,    44,    45,    46,    -1,    48,
665130803Smarcel      24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
666130803Smarcel      34,    35,    -1,    37,    38,    39,    40,    -1,    -1,    -1,
667130803Smarcel      44,    45,    46,    -1,    48,    25,    26,    27,    28,    29,
668130803Smarcel      30,    31,    32,    33,    34,    35,    -1,    37,    38,    39,
669130803Smarcel      40,    -1,    -1,    -1,    44,    45,    46,    -1,    48,    26,
670130803Smarcel      27,    28,    29,    30,    31,    32,    33,    34,    35,    -1,
671130803Smarcel      37,    38,    39,    40,    -1,    -1,    -1,    44,    45,    46,
672130803Smarcel      -1,    48,    28,    29,    30,    31,    32,    33,    34,    35,
673130803Smarcel      -1,    37,    38,    39,    40,    -1,    -1,    -1,    44,    45,
674130803Smarcel      46,    -1,    48,    32,    33,    34,    35,    -1,    37,    38,
675130803Smarcel      39,    40,    -1,    -1,    -1,    44,    45,    46,    -1,    48
676130803Smarcel};
677130803Smarcel
678130803Smarcel/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
679130803Smarcel   symbol of state STATE-NUM.  */
680130803Smarcelstatic const unsigned char yystos[] =
681130803Smarcel{
682130803Smarcel       0,    53,    54,     0,     3,     4,     5,     7,     8,     9,
683130803Smarcel      10,    11,    12,    13,    15,    16,    17,    18,    22,    36,
684130803Smarcel      38,    41,    42,    46,    48,    49,    55,    56,    57,    58,
685130803Smarcel      63,    64,    65,    66,    67,    68,    70,     7,     8,     9,
686130803Smarcel      49,    69,    69,    46,    69,    58,    67,    58,    58,    46,
687130803Smarcel      46,    57,    68,    19,    21,    23,    24,    25,    26,    27,
688130803Smarcel      28,    29,    30,    31,    32,    33,    34,    35,    37,    38,
689130803Smarcel      39,    40,    44,    45,    46,    48,    13,    46,    13,    67,
690130803Smarcel      68,    58,    58,    50,    58,    58,    58,    58,    58,    58,
691130803Smarcel      58,    58,    58,    58,    58,    58,    58,    58,    58,    58,
692130803Smarcel      58,    58,    58,    59,    60,    61,    69,    58,    39,    69,
693130803Smarcel      50,    13,    50,    50,     6,    57,    58,    62,    50,    51,
694130803Smarcel      19,    50,    58
695130803Smarcel};
696130803Smarcel
697130803Smarcel#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
698130803Smarcel# define YYSIZE_T __SIZE_TYPE__
699130803Smarcel#endif
700130803Smarcel#if ! defined (YYSIZE_T) && defined (size_t)
701130803Smarcel# define YYSIZE_T size_t
702130803Smarcel#endif
703130803Smarcel#if ! defined (YYSIZE_T)
704130803Smarcel# if defined (__STDC__) || defined (__cplusplus)
705130803Smarcel#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
706130803Smarcel#  define YYSIZE_T size_t
707130803Smarcel# endif
708130803Smarcel#endif
709130803Smarcel#if ! defined (YYSIZE_T)
710130803Smarcel# define YYSIZE_T unsigned int
711130803Smarcel#endif
712130803Smarcel
713130803Smarcel#define yyerrok		(yyerrstatus = 0)
714130803Smarcel#define yyclearin	(yychar = YYEMPTY)
715130803Smarcel#define YYEMPTY		(-2)
716130803Smarcel#define YYEOF		0
717130803Smarcel
718130803Smarcel#define YYACCEPT	goto yyacceptlab
719130803Smarcel#define YYABORT		goto yyabortlab
720130803Smarcel#define YYERROR		goto yyerrlab1
721130803Smarcel
722130803Smarcel/* Like YYERROR except do call yyerror.  This remains here temporarily
723130803Smarcel   to ease the transition to the new meaning of YYERROR, for GCC.
724130803Smarcel   Once GCC version 2 has supplanted version 1, this can go.  */
725130803Smarcel
726130803Smarcel#define YYFAIL		goto yyerrlab
727130803Smarcel
728130803Smarcel#define YYRECOVERING()  (!!yyerrstatus)
729130803Smarcel
730130803Smarcel#define YYBACKUP(Token, Value)					\
731130803Smarceldo								\
732130803Smarcel  if (yychar == YYEMPTY && yylen == 1)				\
733130803Smarcel    {								\
734130803Smarcel      yychar = (Token);						\
735130803Smarcel      yylval = (Value);						\
736130803Smarcel      yytoken = YYTRANSLATE (yychar);				\
737130803Smarcel      YYPOPSTACK;						\
738130803Smarcel      goto yybackup;						\
739130803Smarcel    }								\
740130803Smarcel  else								\
741130803Smarcel    { 								\
742130803Smarcel      yyerror ("syntax error: cannot back up");\
743130803Smarcel      YYERROR;							\
744130803Smarcel    }								\
745130803Smarcelwhile (0)
746130803Smarcel
747130803Smarcel#define YYTERROR	1
748130803Smarcel#define YYERRCODE	256
749130803Smarcel
750130803Smarcel/* YYLLOC_DEFAULT -- Compute the default location (before the actions
751130803Smarcel   are run).  */
752130803Smarcel
753130803Smarcel#ifndef YYLLOC_DEFAULT
754130803Smarcel# define YYLLOC_DEFAULT(Current, Rhs, N)         \
755130803Smarcel  Current.first_line   = Rhs[1].first_line;      \
756130803Smarcel  Current.first_column = Rhs[1].first_column;    \
757130803Smarcel  Current.last_line    = Rhs[N].last_line;       \
758130803Smarcel  Current.last_column  = Rhs[N].last_column;
759130803Smarcel#endif
760130803Smarcel
761130803Smarcel/* YYLEX -- calling `yylex' with the right arguments.  */
762130803Smarcel
763130803Smarcel#ifdef YYLEX_PARAM
764130803Smarcel# define YYLEX yylex (YYLEX_PARAM)
765130803Smarcel#else
766130803Smarcel# define YYLEX yylex ()
767130803Smarcel#endif
768130803Smarcel
769130803Smarcel/* Enable debugging if requested.  */
770130803Smarcel#if YYDEBUG
771130803Smarcel
772130803Smarcel# ifndef YYFPRINTF
773130803Smarcel#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
774130803Smarcel#  define YYFPRINTF fprintf
775130803Smarcel# endif
776130803Smarcel
777130803Smarcel# define YYDPRINTF(Args)			\
778130803Smarceldo {						\
779130803Smarcel  if (yydebug)					\
780130803Smarcel    YYFPRINTF Args;				\
781130803Smarcel} while (0)
782130803Smarcel
783130803Smarcel# define YYDSYMPRINT(Args)			\
784130803Smarceldo {						\
785130803Smarcel  if (yydebug)					\
786130803Smarcel    yysymprint Args;				\
787130803Smarcel} while (0)
788130803Smarcel
789130803Smarcel# define YYDSYMPRINTF(Title, Token, Value, Location)		\
790130803Smarceldo {								\
791130803Smarcel  if (yydebug)							\
792130803Smarcel    {								\
793130803Smarcel      YYFPRINTF (stderr, "%s ", Title);				\
794130803Smarcel      yysymprint (stderr, 					\
795130803Smarcel                  Token, Value);	\
796130803Smarcel      YYFPRINTF (stderr, "\n");					\
797130803Smarcel    }								\
798130803Smarcel} while (0)
799130803Smarcel
800130803Smarcel/*------------------------------------------------------------------.
801130803Smarcel| yy_stack_print -- Print the state stack from its BOTTOM up to its |
802130803Smarcel| TOP (cinluded).                                                   |
803130803Smarcel`------------------------------------------------------------------*/
804130803Smarcel
805130803Smarcel#if defined (__STDC__) || defined (__cplusplus)
806130803Smarcelstatic void
807130803Smarcelyy_stack_print (short *bottom, short *top)
808130803Smarcel#else
809130803Smarcelstatic void
810130803Smarcelyy_stack_print (bottom, top)
811130803Smarcel    short *bottom;
812130803Smarcel    short *top;
813130803Smarcel#endif
814130803Smarcel{
815130803Smarcel  YYFPRINTF (stderr, "Stack now");
816130803Smarcel  for (/* Nothing. */; bottom <= top; ++bottom)
817130803Smarcel    YYFPRINTF (stderr, " %d", *bottom);
818130803Smarcel  YYFPRINTF (stderr, "\n");
819130803Smarcel}
820130803Smarcel
821130803Smarcel# define YY_STACK_PRINT(Bottom, Top)				\
822130803Smarceldo {								\
823130803Smarcel  if (yydebug)							\
824130803Smarcel    yy_stack_print ((Bottom), (Top));				\
825130803Smarcel} while (0)
826130803Smarcel
827130803Smarcel
828130803Smarcel/*------------------------------------------------.
829130803Smarcel| Report that the YYRULE is going to be reduced.  |
830130803Smarcel`------------------------------------------------*/
831130803Smarcel
832130803Smarcel#if defined (__STDC__) || defined (__cplusplus)
833130803Smarcelstatic void
834130803Smarcelyy_reduce_print (int yyrule)
835130803Smarcel#else
836130803Smarcelstatic void
837130803Smarcelyy_reduce_print (yyrule)
838130803Smarcel    int yyrule;
839130803Smarcel#endif
840130803Smarcel{
841130803Smarcel  int yyi;
842130803Smarcel  unsigned int yylineno = yyrline[yyrule];
843130803Smarcel  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
844130803Smarcel             yyrule - 1, yylineno);
845130803Smarcel  /* Print the symbols being reduced, and their result.  */
846130803Smarcel  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
847130803Smarcel    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
848130803Smarcel  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
849130803Smarcel}
850130803Smarcel
851130803Smarcel# define YY_REDUCE_PRINT(Rule)		\
852130803Smarceldo {					\
853130803Smarcel  if (yydebug)				\
854130803Smarcel    yy_reduce_print (Rule);		\
855130803Smarcel} while (0)
856130803Smarcel
857130803Smarcel/* Nonzero means print parse trace.  It is left uninitialized so that
858130803Smarcel   multiple parsers can coexist.  */
859130803Smarcelint yydebug;
860130803Smarcel#else /* !YYDEBUG */
861130803Smarcel# define YYDPRINTF(Args)
862130803Smarcel# define YYDSYMPRINT(Args)
863130803Smarcel# define YYDSYMPRINTF(Title, Token, Value, Location)
864130803Smarcel# define YY_STACK_PRINT(Bottom, Top)
865130803Smarcel# define YY_REDUCE_PRINT(Rule)
866130803Smarcel#endif /* !YYDEBUG */
867130803Smarcel
868130803Smarcel
869130803Smarcel/* YYINITDEPTH -- initial size of the parser's stacks.  */
870130803Smarcel#ifndef	YYINITDEPTH
871130803Smarcel# define YYINITDEPTH 200
872130803Smarcel#endif
873130803Smarcel
874130803Smarcel/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
875130803Smarcel   if the built-in stack extension method is used).
876130803Smarcel
877130803Smarcel   Do not make this value too large; the results are undefined if
878130803Smarcel   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
879130803Smarcel   evaluated with infinite-precision integer arithmetic.  */
880130803Smarcel
881130803Smarcel#if YYMAXDEPTH == 0
882130803Smarcel# undef YYMAXDEPTH
883130803Smarcel#endif
884130803Smarcel
885130803Smarcel#ifndef YYMAXDEPTH
886130803Smarcel# define YYMAXDEPTH 10000
887130803Smarcel#endif
888130803Smarcel
889130803Smarcel
890130803Smarcel
891130803Smarcel#if YYERROR_VERBOSE
892130803Smarcel
893130803Smarcel# ifndef yystrlen
894130803Smarcel#  if defined (__GLIBC__) && defined (_STRING_H)
895130803Smarcel#   define yystrlen strlen
896130803Smarcel#  else
897130803Smarcel/* Return the length of YYSTR.  */
898130803Smarcelstatic YYSIZE_T
899130803Smarcel#   if defined (__STDC__) || defined (__cplusplus)
900130803Smarcelyystrlen (const char *yystr)
901130803Smarcel#   else
902130803Smarcelyystrlen (yystr)
903130803Smarcel     const char *yystr;
904130803Smarcel#   endif
905130803Smarcel{
906130803Smarcel  register const char *yys = yystr;
907130803Smarcel
908130803Smarcel  while (*yys++ != '\0')
909130803Smarcel    continue;
910130803Smarcel
911130803Smarcel  return yys - yystr - 1;
912130803Smarcel}
913130803Smarcel#  endif
914130803Smarcel# endif
915130803Smarcel
916130803Smarcel# ifndef yystpcpy
917130803Smarcel#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
918130803Smarcel#   define yystpcpy stpcpy
919130803Smarcel#  else
920130803Smarcel/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
921130803Smarcel   YYDEST.  */
922130803Smarcelstatic char *
923130803Smarcel#   if defined (__STDC__) || defined (__cplusplus)
924130803Smarcelyystpcpy (char *yydest, const char *yysrc)
925130803Smarcel#   else
926130803Smarcelyystpcpy (yydest, yysrc)
927130803Smarcel     char *yydest;
928130803Smarcel     const char *yysrc;
929130803Smarcel#   endif
930130803Smarcel{
931130803Smarcel  register char *yyd = yydest;
932130803Smarcel  register const char *yys = yysrc;
933130803Smarcel
934130803Smarcel  while ((*yyd++ = *yys++) != '\0')
935130803Smarcel    continue;
936130803Smarcel
937130803Smarcel  return yyd - 1;
938130803Smarcel}
939130803Smarcel#  endif
940130803Smarcel# endif
941130803Smarcel
942130803Smarcel#endif /* !YYERROR_VERBOSE */
943130803Smarcel
944130803Smarcel
945130803Smarcel
946130803Smarcel#if YYDEBUG
947130803Smarcel/*--------------------------------.
948130803Smarcel| Print this symbol on YYOUTPUT.  |
949130803Smarcel`--------------------------------*/
950130803Smarcel
951130803Smarcel#if defined (__STDC__) || defined (__cplusplus)
952130803Smarcelstatic void
953130803Smarcelyysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
954130803Smarcel#else
955130803Smarcelstatic void
956130803Smarcelyysymprint (yyoutput, yytype, yyvaluep)
957130803Smarcel    FILE *yyoutput;
958130803Smarcel    int yytype;
959130803Smarcel    YYSTYPE *yyvaluep;
960130803Smarcel#endif
961130803Smarcel{
962130803Smarcel  /* Pacify ``unused variable'' warnings.  */
963130803Smarcel  (void) yyvaluep;
964130803Smarcel
965130803Smarcel  if (yytype < YYNTOKENS)
966130803Smarcel    {
967130803Smarcel      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
968130803Smarcel# ifdef YYPRINT
969130803Smarcel      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
970130803Smarcel# endif
971130803Smarcel    }
972130803Smarcel  else
973130803Smarcel    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
974130803Smarcel
975130803Smarcel  switch (yytype)
976130803Smarcel    {
977130803Smarcel      default:
978130803Smarcel        break;
979130803Smarcel    }
980130803Smarcel  YYFPRINTF (yyoutput, ")");
981130803Smarcel}
982130803Smarcel
983130803Smarcel#endif /* ! YYDEBUG */
984130803Smarcel/*-----------------------------------------------.
985130803Smarcel| Release the memory associated to this symbol.  |
986130803Smarcel`-----------------------------------------------*/
987130803Smarcel
988130803Smarcel#if defined (__STDC__) || defined (__cplusplus)
989130803Smarcelstatic void
990130803Smarcelyydestruct (int yytype, YYSTYPE *yyvaluep)
991130803Smarcel#else
992130803Smarcelstatic void
993130803Smarcelyydestruct (yytype, yyvaluep)
994130803Smarcel    int yytype;
995130803Smarcel    YYSTYPE *yyvaluep;
996130803Smarcel#endif
997130803Smarcel{
998130803Smarcel  /* Pacify ``unused variable'' warnings.  */
999130803Smarcel  (void) yyvaluep;
1000130803Smarcel
1001130803Smarcel  switch (yytype)
1002130803Smarcel    {
1003130803Smarcel
1004130803Smarcel      default:
1005130803Smarcel        break;
1006130803Smarcel    }
1007130803Smarcel}
1008130803Smarcel
1009130803Smarcel
1010130803Smarcel/* Prevent warnings from -Wmissing-prototypes.  */
1011130803Smarcel
1012130803Smarcel#ifdef YYPARSE_PARAM
1013130803Smarcel# if defined (__STDC__) || defined (__cplusplus)
1014130803Smarcelint yyparse (void *YYPARSE_PARAM);
1015130803Smarcel# else
1016130803Smarcelint yyparse ();
1017130803Smarcel# endif
1018130803Smarcel#else /* ! YYPARSE_PARAM */
1019130803Smarcel#if defined (__STDC__) || defined (__cplusplus)
1020130803Smarcelint yyparse (void);
1021130803Smarcel#else
1022130803Smarcelint yyparse ();
1023130803Smarcel#endif
1024130803Smarcel#endif /* ! YYPARSE_PARAM */
1025130803Smarcel
1026130803Smarcel
1027130803Smarcel
1028130803Smarcel/* The lookahead symbol.  */
1029130803Smarcelint yychar;
1030130803Smarcel
1031130803Smarcel/* The semantic value of the lookahead symbol.  */
1032130803SmarcelYYSTYPE yylval;
1033130803Smarcel
1034130803Smarcel/* Number of syntax errors so far.  */
1035130803Smarcelint yynerrs;
1036130803Smarcel
1037130803Smarcel
1038130803Smarcel
1039130803Smarcel/*----------.
1040130803Smarcel| yyparse.  |
1041130803Smarcel`----------*/
1042130803Smarcel
1043130803Smarcel#ifdef YYPARSE_PARAM
1044130803Smarcel# if defined (__STDC__) || defined (__cplusplus)
1045130803Smarcelint yyparse (void *YYPARSE_PARAM)
1046130803Smarcel# else
1047130803Smarcelint yyparse (YYPARSE_PARAM)
1048130803Smarcel  void *YYPARSE_PARAM;
1049130803Smarcel# endif
1050130803Smarcel#else /* ! YYPARSE_PARAM */
1051130803Smarcel#if defined (__STDC__) || defined (__cplusplus)
1052130803Smarcelint
1053130803Smarcelyyparse (void)
1054130803Smarcel#else
1055130803Smarcelint
1056130803Smarcelyyparse ()
1057130803Smarcel
1058130803Smarcel#endif
1059130803Smarcel#endif
1060130803Smarcel{
1061130803Smarcel
1062130803Smarcel  register int yystate;
1063130803Smarcel  register int yyn;
1064130803Smarcel  int yyresult;
1065130803Smarcel  /* Number of tokens to shift before error messages enabled.  */
1066130803Smarcel  int yyerrstatus;
1067130803Smarcel  /* Lookahead token as an internal (translated) token number.  */
1068130803Smarcel  int yytoken = 0;
1069130803Smarcel
1070130803Smarcel  /* Three stacks and their tools:
1071130803Smarcel     `yyss': related to states,
1072130803Smarcel     `yyvs': related to semantic values,
1073130803Smarcel     `yyls': related to locations.
1074130803Smarcel
1075130803Smarcel     Refer to the stacks thru separate pointers, to allow yyoverflow
1076130803Smarcel     to xreallocate them elsewhere.  */
1077130803Smarcel
1078130803Smarcel  /* The state stack.  */
1079130803Smarcel  short	yyssa[YYINITDEPTH];
1080130803Smarcel  short *yyss = yyssa;
1081130803Smarcel  register short *yyssp;
1082130803Smarcel
1083130803Smarcel  /* The semantic value stack.  */
1084130803Smarcel  YYSTYPE yyvsa[YYINITDEPTH];
1085130803Smarcel  YYSTYPE *yyvs = yyvsa;
1086130803Smarcel  register YYSTYPE *yyvsp;
1087130803Smarcel
1088130803Smarcel
1089130803Smarcel
1090130803Smarcel#define YYPOPSTACK   (yyvsp--, yyssp--)
1091130803Smarcel
1092130803Smarcel  YYSIZE_T yystacksize = YYINITDEPTH;
1093130803Smarcel
1094130803Smarcel  /* The variables used to return semantic value and location from the
1095130803Smarcel     action routines.  */
1096130803Smarcel  YYSTYPE yyval;
1097130803Smarcel
1098130803Smarcel
1099130803Smarcel  /* When reducing, the number of symbols on the RHS of the reduced
1100130803Smarcel     rule.  */
1101130803Smarcel  int yylen;
1102130803Smarcel
1103130803Smarcel  YYDPRINTF ((stderr, "Starting parse\n"));
1104130803Smarcel
1105130803Smarcel  yystate = 0;
1106130803Smarcel  yyerrstatus = 0;
1107130803Smarcel  yynerrs = 0;
1108130803Smarcel  yychar = YYEMPTY;		/* Cause a token to be read.  */
1109130803Smarcel
1110130803Smarcel  /* Initialize stack pointers.
1111130803Smarcel     Waste one element of value and location stack
1112130803Smarcel     so that they stay on the same level as the state stack.
1113130803Smarcel     The wasted elements are never initialized.  */
1114130803Smarcel
1115130803Smarcel  yyssp = yyss;
1116130803Smarcel  yyvsp = yyvs;
1117130803Smarcel
1118130803Smarcel  goto yysetstate;
1119130803Smarcel
1120130803Smarcel/*------------------------------------------------------------.
1121130803Smarcel| yynewstate -- Push a new state, which is found in yystate.  |
1122130803Smarcel`------------------------------------------------------------*/
1123130803Smarcel yynewstate:
1124130803Smarcel  /* In all cases, when you get here, the value and location stacks
1125130803Smarcel     have just been pushed. so pushing a state here evens the stacks.
1126130803Smarcel     */
1127130803Smarcel  yyssp++;
1128130803Smarcel
1129130803Smarcel yysetstate:
1130130803Smarcel  *yyssp = yystate;
1131130803Smarcel
1132130803Smarcel  if (yyss + yystacksize - 1 <= yyssp)
1133130803Smarcel    {
1134130803Smarcel      /* Get the current used size of the three stacks, in elements.  */
1135130803Smarcel      YYSIZE_T yysize = yyssp - yyss + 1;
1136130803Smarcel
1137130803Smarcel#ifdef yyoverflow
1138130803Smarcel      {
1139130803Smarcel	/* Give user a chance to xreallocate the stack. Use copies of
1140130803Smarcel	   these so that the &'s don't force the real ones into
1141130803Smarcel	   memory.  */
1142130803Smarcel	YYSTYPE *yyvs1 = yyvs;
1143130803Smarcel	short *yyss1 = yyss;
1144130803Smarcel
1145130803Smarcel
1146130803Smarcel	/* Each stack pointer address is followed by the size of the
1147130803Smarcel	   data in use in that stack, in bytes.  This used to be a
1148130803Smarcel	   conditional around just the two extra args, but that might
1149130803Smarcel	   be undefined if yyoverflow is a macro.  */
1150130803Smarcel	yyoverflow ("parser stack overflow",
1151130803Smarcel		    &yyss1, yysize * sizeof (*yyssp),
1152130803Smarcel		    &yyvs1, yysize * sizeof (*yyvsp),
1153130803Smarcel
1154130803Smarcel		    &yystacksize);
1155130803Smarcel
1156130803Smarcel	yyss = yyss1;
1157130803Smarcel	yyvs = yyvs1;
1158130803Smarcel      }
1159130803Smarcel#else /* no yyoverflow */
1160130803Smarcel# ifndef YYSTACK_RELOCATE
1161130803Smarcel      goto yyoverflowlab;
1162130803Smarcel# else
1163130803Smarcel      /* Extend the stack our own way.  */
1164130803Smarcel      if (YYMAXDEPTH <= yystacksize)
1165130803Smarcel	goto yyoverflowlab;
1166130803Smarcel      yystacksize *= 2;
1167130803Smarcel      if (YYMAXDEPTH < yystacksize)
1168130803Smarcel	yystacksize = YYMAXDEPTH;
1169130803Smarcel
1170130803Smarcel      {
1171130803Smarcel	short *yyss1 = yyss;
1172130803Smarcel	union yyalloc *yyptr =
1173130803Smarcel	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1174130803Smarcel	if (! yyptr)
1175130803Smarcel	  goto yyoverflowlab;
1176130803Smarcel	YYSTACK_RELOCATE (yyss);
1177130803Smarcel	YYSTACK_RELOCATE (yyvs);
1178130803Smarcel
1179130803Smarcel#  undef YYSTACK_RELOCATE
1180130803Smarcel	if (yyss1 != yyssa)
1181130803Smarcel	  YYSTACK_FREE (yyss1);
1182130803Smarcel      }
1183130803Smarcel# endif
1184130803Smarcel#endif /* no yyoverflow */
1185130803Smarcel
1186130803Smarcel      yyssp = yyss + yysize - 1;
1187130803Smarcel      yyvsp = yyvs + yysize - 1;
1188130803Smarcel
1189130803Smarcel
1190130803Smarcel      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1191130803Smarcel		  (unsigned long int) yystacksize));
1192130803Smarcel
1193130803Smarcel      if (yyss + yystacksize - 1 <= yyssp)
1194130803Smarcel	YYABORT;
1195130803Smarcel    }
1196130803Smarcel
1197130803Smarcel  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1198130803Smarcel
1199130803Smarcel  goto yybackup;
1200130803Smarcel
1201130803Smarcel/*-----------.
1202130803Smarcel| yybackup.  |
1203130803Smarcel`-----------*/
1204130803Smarcelyybackup:
1205130803Smarcel
1206130803Smarcel/* Do appropriate processing given the current state.  */
1207130803Smarcel/* Read a lookahead token if we need one and don't already have one.  */
1208130803Smarcel/* yyresume: */
1209130803Smarcel
1210130803Smarcel  /* First try to decide what to do without reference to lookahead token.  */
1211130803Smarcel
1212130803Smarcel  yyn = yypact[yystate];
1213130803Smarcel  if (yyn == YYPACT_NINF)
1214130803Smarcel    goto yydefault;
1215130803Smarcel
1216130803Smarcel  /* Not known => get a lookahead token if don't already have one.  */
1217130803Smarcel
1218130803Smarcel  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1219130803Smarcel  if (yychar == YYEMPTY)
1220130803Smarcel    {
1221130803Smarcel      YYDPRINTF ((stderr, "Reading a token: "));
1222130803Smarcel      yychar = YYLEX;
1223130803Smarcel    }
1224130803Smarcel
1225130803Smarcel  if (yychar <= YYEOF)
1226130803Smarcel    {
1227130803Smarcel      yychar = yytoken = YYEOF;
1228130803Smarcel      YYDPRINTF ((stderr, "Now at end of input.\n"));
1229130803Smarcel    }
1230130803Smarcel  else
1231130803Smarcel    {
1232130803Smarcel      yytoken = YYTRANSLATE (yychar);
1233130803Smarcel      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1234130803Smarcel    }
1235130803Smarcel
1236130803Smarcel  /* If the proper action on seeing token YYTOKEN is to reduce or to
1237130803Smarcel     detect an error, take that action.  */
1238130803Smarcel  yyn += yytoken;
1239130803Smarcel  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1240130803Smarcel    goto yydefault;
1241130803Smarcel  yyn = yytable[yyn];
1242130803Smarcel  if (yyn <= 0)
1243130803Smarcel    {
1244130803Smarcel      if (yyn == 0 || yyn == YYTABLE_NINF)
1245130803Smarcel	goto yyerrlab;
1246130803Smarcel      yyn = -yyn;
1247130803Smarcel      goto yyreduce;
1248130803Smarcel    }
1249130803Smarcel
1250130803Smarcel  if (yyn == YYFINAL)
1251130803Smarcel    YYACCEPT;
1252130803Smarcel
1253130803Smarcel  /* Shift the lookahead token.  */
1254130803Smarcel  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1255130803Smarcel
1256130803Smarcel  /* Discard the token being shifted unless it is eof.  */
1257130803Smarcel  if (yychar != YYEOF)
1258130803Smarcel    yychar = YYEMPTY;
1259130803Smarcel
1260130803Smarcel  *++yyvsp = yylval;
1261130803Smarcel
1262130803Smarcel
1263130803Smarcel  /* Count tokens shifted since error; after three, turn off error
1264130803Smarcel     status.  */
1265130803Smarcel  if (yyerrstatus)
1266130803Smarcel    yyerrstatus--;
1267130803Smarcel
1268130803Smarcel  yystate = yyn;
1269130803Smarcel  goto yynewstate;
1270130803Smarcel
1271130803Smarcel
1272130803Smarcel/*-----------------------------------------------------------.
1273130803Smarcel| yydefault -- do the default action for the current state.  |
1274130803Smarcel`-----------------------------------------------------------*/
1275130803Smarcelyydefault:
1276130803Smarcel  yyn = yydefact[yystate];
1277130803Smarcel  if (yyn == 0)
1278130803Smarcel    goto yyerrlab;
1279130803Smarcel  goto yyreduce;
1280130803Smarcel
1281130803Smarcel
1282130803Smarcel/*-----------------------------.
1283130803Smarcel| yyreduce -- Do a reduction.  |
1284130803Smarcel`-----------------------------*/
1285130803Smarcelyyreduce:
1286130803Smarcel  /* yyn is the number of a rule to reduce with.  */
1287130803Smarcel  yylen = yyr2[yyn];
1288130803Smarcel
1289130803Smarcel  /* If YYLEN is nonzero, implement the default value of the action:
1290130803Smarcel     `$$ = $1'.
1291130803Smarcel
1292130803Smarcel     Otherwise, the following line sets YYVAL to garbage.
1293130803Smarcel     This behavior is undocumented and Bison
1294130803Smarcel     users should not rely upon it.  Assigning to YYVAL
1295130803Smarcel     unconditionally makes the parser a bit smaller, and it avoids a
1296130803Smarcel     GCC warning that YYVAL may be used uninitialized.  */
1297130803Smarcel  yyval = yyvsp[1-yylen];
1298130803Smarcel
1299130803Smarcel
1300130803Smarcel  YY_REDUCE_PRINT (yyn);
1301130803Smarcel  switch (yyn)
1302130803Smarcel    {
1303130803Smarcel        case 2:
1304130803Smarcel#line 234 "p-exp.y"
1305130803Smarcel    { current_type = NULL;
1306130803Smarcel		  search_field = 0;
1307130803Smarcel		}
1308130803Smarcel    break;
1309130803Smarcel
1310130803Smarcel  case 3:
1311130803Smarcel#line 237 "p-exp.y"
1312130803Smarcel    {}
1313130803Smarcel    break;
1314130803Smarcel
1315130803Smarcel  case 6:
1316130803Smarcel#line 246 "p-exp.y"
1317130803Smarcel    { write_exp_elt_opcode(OP_TYPE);
1318130803Smarcel			  write_exp_elt_type(yyvsp[0].tval);
1319130803Smarcel			  write_exp_elt_opcode(OP_TYPE);
1320130803Smarcel			  current_type = yyvsp[0].tval; }
1321130803Smarcel    break;
1322130803Smarcel
1323130803Smarcel  case 8:
1324130803Smarcel#line 254 "p-exp.y"
1325130803Smarcel    { write_exp_elt_opcode (BINOP_COMMA); }
1326130803Smarcel    break;
1327130803Smarcel
1328130803Smarcel  case 9:
1329130803Smarcel#line 259 "p-exp.y"
1330130803Smarcel    { write_exp_elt_opcode (UNOP_IND);
1331130803Smarcel			  if (current_type)
1332130803Smarcel			    current_type = TYPE_TARGET_TYPE (current_type); }
1333130803Smarcel    break;
1334130803Smarcel
1335130803Smarcel  case 10:
1336130803Smarcel#line 265 "p-exp.y"
1337130803Smarcel    { write_exp_elt_opcode (UNOP_ADDR);
1338130803Smarcel			  if (current_type)
1339130803Smarcel			    current_type = TYPE_POINTER_TYPE (current_type); }
1340130803Smarcel    break;
1341130803Smarcel
1342130803Smarcel  case 11:
1343130803Smarcel#line 271 "p-exp.y"
1344130803Smarcel    { write_exp_elt_opcode (UNOP_NEG); }
1345130803Smarcel    break;
1346130803Smarcel
1347130803Smarcel  case 12:
1348130803Smarcel#line 275 "p-exp.y"
1349130803Smarcel    { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1350130803Smarcel    break;
1351130803Smarcel
1352130803Smarcel  case 13:
1353130803Smarcel#line 279 "p-exp.y"
1354130803Smarcel    { write_exp_elt_opcode (UNOP_PREINCREMENT); }
1355130803Smarcel    break;
1356130803Smarcel
1357130803Smarcel  case 14:
1358130803Smarcel#line 283 "p-exp.y"
1359130803Smarcel    { write_exp_elt_opcode (UNOP_PREDECREMENT); }
1360130803Smarcel    break;
1361130803Smarcel
1362130803Smarcel  case 15:
1363130803Smarcel#line 286 "p-exp.y"
1364130803Smarcel    { search_field = 1; }
1365130803Smarcel    break;
1366130803Smarcel
1367130803Smarcel  case 16:
1368130803Smarcel#line 289 "p-exp.y"
1369130803Smarcel    { write_exp_elt_opcode (STRUCTOP_STRUCT);
1370130803Smarcel			  write_exp_string (yyvsp[0].sval);
1371130803Smarcel			  write_exp_elt_opcode (STRUCTOP_STRUCT);
1372130803Smarcel			  search_field = 0;
1373130803Smarcel			  if (current_type)
1374130803Smarcel			    { while (TYPE_CODE (current_type) == TYPE_CODE_PTR)
1375130803Smarcel				current_type = TYPE_TARGET_TYPE (current_type);
1376130803Smarcel			      current_type = lookup_struct_elt_type (
1377130803Smarcel				current_type, yyvsp[0].sval.ptr, 0); };
1378130803Smarcel			 }
1379130803Smarcel    break;
1380130803Smarcel
1381130803Smarcel  case 17:
1382130803Smarcel#line 301 "p-exp.y"
1383130803Smarcel    { char *arrayname;
1384130803Smarcel			  int arrayfieldindex;
1385130803Smarcel			  arrayfieldindex = is_pascal_string_type (
1386130803Smarcel				current_type, NULL, NULL,
1387130803Smarcel				NULL, NULL, &arrayname);
1388130803Smarcel			  if (arrayfieldindex)
1389130803Smarcel			    {
1390130803Smarcel			      struct stoken stringsval;
1391130803Smarcel			      stringsval.ptr = alloca (strlen (arrayname) + 1);
1392130803Smarcel			      stringsval.length = strlen (arrayname);
1393130803Smarcel			      strcpy (stringsval.ptr, arrayname);
1394130803Smarcel			      current_type = TYPE_FIELD_TYPE (current_type,
1395130803Smarcel				arrayfieldindex - 1);
1396130803Smarcel			      write_exp_elt_opcode (STRUCTOP_STRUCT);
1397130803Smarcel			      write_exp_string (stringsval);
1398130803Smarcel			      write_exp_elt_opcode (STRUCTOP_STRUCT);
1399130803Smarcel			    }
1400130803Smarcel			  push_current_type ();  }
1401130803Smarcel    break;
1402130803Smarcel
1403130803Smarcel  case 18:
1404130803Smarcel#line 320 "p-exp.y"
1405130803Smarcel    { pop_current_type ();
1406130803Smarcel			  write_exp_elt_opcode (BINOP_SUBSCRIPT);
1407130803Smarcel			  if (current_type)
1408130803Smarcel			    current_type = TYPE_TARGET_TYPE (current_type); }
1409130803Smarcel    break;
1410130803Smarcel
1411130803Smarcel  case 19:
1412130803Smarcel#line 329 "p-exp.y"
1413130803Smarcel    { push_current_type ();
1414130803Smarcel			  start_arglist (); }
1415130803Smarcel    break;
1416130803Smarcel
1417130803Smarcel  case 20:
1418130803Smarcel#line 332 "p-exp.y"
1419130803Smarcel    { write_exp_elt_opcode (OP_FUNCALL);
1420130803Smarcel			  write_exp_elt_longcst ((LONGEST) end_arglist ());
1421130803Smarcel			  write_exp_elt_opcode (OP_FUNCALL);
1422130803Smarcel			  pop_current_type (); }
1423130803Smarcel    break;
1424130803Smarcel
1425130803Smarcel  case 22:
1426130803Smarcel#line 340 "p-exp.y"
1427130803Smarcel    { arglist_len = 1; }
1428130803Smarcel    break;
1429130803Smarcel
1430130803Smarcel  case 23:
1431130803Smarcel#line 342 "p-exp.y"
1432130803Smarcel    { arglist_len++; }
1433130803Smarcel    break;
1434130803Smarcel
1435130803Smarcel  case 24:
1436130803Smarcel#line 346 "p-exp.y"
1437130803Smarcel    { if (current_type)
1438130803Smarcel			    {
1439130803Smarcel			      /* Allow automatic dereference of classes.  */
1440130803Smarcel			      if ((TYPE_CODE (current_type) == TYPE_CODE_PTR)
1441130803Smarcel				  && (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_CLASS)
1442130803Smarcel				  && (TYPE_CODE (yyvsp[-3].tval) == TYPE_CODE_CLASS))
1443130803Smarcel				write_exp_elt_opcode (UNOP_IND);
1444130803Smarcel			    }
1445130803Smarcel			  write_exp_elt_opcode (UNOP_CAST);
1446130803Smarcel			  write_exp_elt_type (yyvsp[-3].tval);
1447130803Smarcel			  write_exp_elt_opcode (UNOP_CAST);
1448130803Smarcel			  current_type = yyvsp[-3].tval; }
1449130803Smarcel    break;
1450130803Smarcel
1451130803Smarcel  case 25:
1452130803Smarcel#line 361 "p-exp.y"
1453130803Smarcel    { }
1454130803Smarcel    break;
1455130803Smarcel
1456130803Smarcel  case 26:
1457130803Smarcel#line 367 "p-exp.y"
1458130803Smarcel    { write_exp_elt_opcode (BINOP_MUL); }
1459130803Smarcel    break;
1460130803Smarcel
1461130803Smarcel  case 27:
1462130803Smarcel#line 371 "p-exp.y"
1463130803Smarcel    { write_exp_elt_opcode (BINOP_DIV); }
1464130803Smarcel    break;
1465130803Smarcel
1466130803Smarcel  case 28:
1467130803Smarcel#line 375 "p-exp.y"
1468130803Smarcel    { write_exp_elt_opcode (BINOP_INTDIV); }
1469130803Smarcel    break;
1470130803Smarcel
1471130803Smarcel  case 29:
1472130803Smarcel#line 379 "p-exp.y"
1473130803Smarcel    { write_exp_elt_opcode (BINOP_REM); }
1474130803Smarcel    break;
1475130803Smarcel
1476130803Smarcel  case 30:
1477130803Smarcel#line 383 "p-exp.y"
1478130803Smarcel    { write_exp_elt_opcode (BINOP_ADD); }
1479130803Smarcel    break;
1480130803Smarcel
1481130803Smarcel  case 31:
1482130803Smarcel#line 387 "p-exp.y"
1483130803Smarcel    { write_exp_elt_opcode (BINOP_SUB); }
1484130803Smarcel    break;
1485130803Smarcel
1486130803Smarcel  case 32:
1487130803Smarcel#line 391 "p-exp.y"
1488130803Smarcel    { write_exp_elt_opcode (BINOP_LSH); }
1489130803Smarcel    break;
1490130803Smarcel
1491130803Smarcel  case 33:
1492130803Smarcel#line 395 "p-exp.y"
1493130803Smarcel    { write_exp_elt_opcode (BINOP_RSH); }
1494130803Smarcel    break;
1495130803Smarcel
1496130803Smarcel  case 34:
1497130803Smarcel#line 399 "p-exp.y"
1498130803Smarcel    { write_exp_elt_opcode (BINOP_EQUAL); }
1499130803Smarcel    break;
1500130803Smarcel
1501130803Smarcel  case 35:
1502130803Smarcel#line 403 "p-exp.y"
1503130803Smarcel    { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1504130803Smarcel    break;
1505130803Smarcel
1506130803Smarcel  case 36:
1507130803Smarcel#line 407 "p-exp.y"
1508130803Smarcel    { write_exp_elt_opcode (BINOP_LEQ); }
1509130803Smarcel    break;
1510130803Smarcel
1511130803Smarcel  case 37:
1512130803Smarcel#line 411 "p-exp.y"
1513130803Smarcel    { write_exp_elt_opcode (BINOP_GEQ); }
1514130803Smarcel    break;
1515130803Smarcel
1516130803Smarcel  case 38:
1517130803Smarcel#line 415 "p-exp.y"
1518130803Smarcel    { write_exp_elt_opcode (BINOP_LESS); }
1519130803Smarcel    break;
1520130803Smarcel
1521130803Smarcel  case 39:
1522130803Smarcel#line 419 "p-exp.y"
1523130803Smarcel    { write_exp_elt_opcode (BINOP_GTR); }
1524130803Smarcel    break;
1525130803Smarcel
1526130803Smarcel  case 40:
1527130803Smarcel#line 423 "p-exp.y"
1528130803Smarcel    { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1529130803Smarcel    break;
1530130803Smarcel
1531130803Smarcel  case 41:
1532130803Smarcel#line 427 "p-exp.y"
1533130803Smarcel    { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1534130803Smarcel    break;
1535130803Smarcel
1536130803Smarcel  case 42:
1537130803Smarcel#line 431 "p-exp.y"
1538130803Smarcel    { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1539130803Smarcel    break;
1540130803Smarcel
1541130803Smarcel  case 43:
1542130803Smarcel#line 435 "p-exp.y"
1543130803Smarcel    { write_exp_elt_opcode (BINOP_ASSIGN); }
1544130803Smarcel    break;
1545130803Smarcel
1546130803Smarcel  case 44:
1547130803Smarcel#line 439 "p-exp.y"
1548130803Smarcel    { write_exp_elt_opcode (OP_BOOL);
1549130803Smarcel			  write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1550130803Smarcel			  write_exp_elt_opcode (OP_BOOL); }
1551130803Smarcel    break;
1552130803Smarcel
1553130803Smarcel  case 45:
1554130803Smarcel#line 445 "p-exp.y"
1555130803Smarcel    { write_exp_elt_opcode (OP_BOOL);
1556130803Smarcel			  write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1557130803Smarcel			  write_exp_elt_opcode (OP_BOOL); }
1558130803Smarcel    break;
1559130803Smarcel
1560130803Smarcel  case 46:
1561130803Smarcel#line 451 "p-exp.y"
1562130803Smarcel    { write_exp_elt_opcode (OP_LONG);
1563130803Smarcel			  write_exp_elt_type (yyvsp[0].typed_val_int.type);
1564130803Smarcel			  write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val_int.val));
1565130803Smarcel			  write_exp_elt_opcode (OP_LONG); }
1566130803Smarcel    break;
1567130803Smarcel
1568130803Smarcel  case 47:
1569130803Smarcel#line 458 "p-exp.y"
1570130803Smarcel    { YYSTYPE val;
1571130803Smarcel			  parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
1572130803Smarcel			  write_exp_elt_opcode (OP_LONG);
1573130803Smarcel			  write_exp_elt_type (val.typed_val_int.type);
1574130803Smarcel			  write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
1575130803Smarcel			  write_exp_elt_opcode (OP_LONG);
1576130803Smarcel			}
1577130803Smarcel    break;
1578130803Smarcel
1579130803Smarcel  case 48:
1580130803Smarcel#line 469 "p-exp.y"
1581130803Smarcel    { write_exp_elt_opcode (OP_DOUBLE);
1582130803Smarcel			  write_exp_elt_type (yyvsp[0].typed_val_float.type);
1583130803Smarcel			  write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval);
1584130803Smarcel			  write_exp_elt_opcode (OP_DOUBLE); }
1585130803Smarcel    break;
1586130803Smarcel
1587130803Smarcel  case 51:
1588130803Smarcel#line 483 "p-exp.y"
1589130803Smarcel    { write_exp_elt_opcode (OP_LONG);
1590130803Smarcel			  write_exp_elt_type (builtin_type_int);
1591130803Smarcel			  CHECK_TYPEDEF (yyvsp[-1].tval);
1592130803Smarcel			  write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
1593130803Smarcel			  write_exp_elt_opcode (OP_LONG); }
1594130803Smarcel    break;
1595130803Smarcel
1596130803Smarcel  case 52:
1597130803Smarcel#line 491 "p-exp.y"
1598130803Smarcel    { /* C strings are converted into array constants with
1599130803Smarcel			     an explicit null byte added at the end.  Thus
1600130803Smarcel			     the array upper bound is the string length.
1601130803Smarcel			     There is no such thing in C as a completely empty
1602130803Smarcel			     string. */
1603130803Smarcel			  char *sp = yyvsp[0].sval.ptr; int count = yyvsp[0].sval.length;
1604130803Smarcel			  while (count-- > 0)
1605130803Smarcel			    {
1606130803Smarcel			      write_exp_elt_opcode (OP_LONG);
1607130803Smarcel			      write_exp_elt_type (builtin_type_char);
1608130803Smarcel			      write_exp_elt_longcst ((LONGEST)(*sp++));
1609130803Smarcel			      write_exp_elt_opcode (OP_LONG);
1610130803Smarcel			    }
1611130803Smarcel			  write_exp_elt_opcode (OP_LONG);
1612130803Smarcel			  write_exp_elt_type (builtin_type_char);
1613130803Smarcel			  write_exp_elt_longcst ((LONGEST)'\0');
1614130803Smarcel			  write_exp_elt_opcode (OP_LONG);
1615130803Smarcel			  write_exp_elt_opcode (OP_ARRAY);
1616130803Smarcel			  write_exp_elt_longcst ((LONGEST) 0);
1617130803Smarcel			  write_exp_elt_longcst ((LONGEST) (yyvsp[0].sval.length));
1618130803Smarcel			  write_exp_elt_opcode (OP_ARRAY); }
1619130803Smarcel    break;
1620130803Smarcel
1621130803Smarcel  case 53:
1622130803Smarcel#line 516 "p-exp.y"
1623130803Smarcel    {
1624130803Smarcel			  struct value * this_val;
1625130803Smarcel			  struct type * this_type;
1626130803Smarcel			  write_exp_elt_opcode (OP_THIS);
1627130803Smarcel			  write_exp_elt_opcode (OP_THIS);
1628130803Smarcel			  /* we need type of this */
1629130803Smarcel			  this_val = value_of_this (0);
1630130803Smarcel			  if (this_val)
1631130803Smarcel			    this_type = this_val->type;
1632130803Smarcel			  else
1633130803Smarcel			    this_type = NULL;
1634130803Smarcel			  if (this_type)
1635130803Smarcel			    {
1636130803Smarcel			      if (TYPE_CODE (this_type) == TYPE_CODE_PTR)
1637130803Smarcel				{
1638130803Smarcel				  this_type = TYPE_TARGET_TYPE (this_type);
1639130803Smarcel				  write_exp_elt_opcode (UNOP_IND);
1640130803Smarcel				}
1641130803Smarcel			    }
1642130803Smarcel
1643130803Smarcel			  current_type = this_type;
1644130803Smarcel			}
1645130803Smarcel    break;
1646130803Smarcel
1647130803Smarcel  case 54:
1648130803Smarcel#line 543 "p-exp.y"
1649130803Smarcel    {
1650130803Smarcel			  if (yyvsp[0].ssym.sym != 0)
1651130803Smarcel			      yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym);
1652130803Smarcel			  else
1653130803Smarcel			    {
1654130803Smarcel			      struct symtab *tem =
1655130803Smarcel				  lookup_symtab (copy_name (yyvsp[0].ssym.stoken));
1656130803Smarcel			      if (tem)
1657130803Smarcel				yyval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK);
1658130803Smarcel			      else
1659130803Smarcel				error ("No file or function \"%s\".",
1660130803Smarcel				       copy_name (yyvsp[0].ssym.stoken));
1661130803Smarcel			    }
1662130803Smarcel			}
1663130803Smarcel    break;
1664130803Smarcel
1665130803Smarcel  case 55:
1666130803Smarcel#line 560 "p-exp.y"
1667130803Smarcel    { struct symbol *tem
1668130803Smarcel			    = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1669130803Smarcel					     VAR_DOMAIN, (int *) NULL,
1670130803Smarcel					     (struct symtab **) NULL);
1671130803Smarcel			  if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
1672130803Smarcel			    error ("No function \"%s\" in specified context.",
1673130803Smarcel				   copy_name (yyvsp[0].sval));
1674130803Smarcel			  yyval.bval = SYMBOL_BLOCK_VALUE (tem); }
1675130803Smarcel    break;
1676130803Smarcel
1677130803Smarcel  case 56:
1678130803Smarcel#line 571 "p-exp.y"
1679130803Smarcel    { struct symbol *sym;
1680130803Smarcel			  sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1681130803Smarcel					       VAR_DOMAIN, (int *) NULL,
1682130803Smarcel					       (struct symtab **) NULL);
1683130803Smarcel			  if (sym == 0)
1684130803Smarcel			    error ("No symbol \"%s\" in specified context.",
1685130803Smarcel				   copy_name (yyvsp[0].sval));
1686130803Smarcel
1687130803Smarcel			  write_exp_elt_opcode (OP_VAR_VALUE);
1688130803Smarcel			  /* block_found is set by lookup_symbol.  */
1689130803Smarcel			  write_exp_elt_block (block_found);
1690130803Smarcel			  write_exp_elt_sym (sym);
1691130803Smarcel			  write_exp_elt_opcode (OP_VAR_VALUE); }
1692130803Smarcel    break;
1693130803Smarcel
1694130803Smarcel  case 57:
1695130803Smarcel#line 587 "p-exp.y"
1696130803Smarcel    {
1697130803Smarcel			  struct type *type = yyvsp[-2].tval;
1698130803Smarcel			  if (TYPE_CODE (type) != TYPE_CODE_STRUCT
1699130803Smarcel			      && TYPE_CODE (type) != TYPE_CODE_UNION)
1700130803Smarcel			    error ("`%s' is not defined as an aggregate type.",
1701130803Smarcel				   TYPE_NAME (type));
1702130803Smarcel
1703130803Smarcel			  write_exp_elt_opcode (OP_SCOPE);
1704130803Smarcel			  write_exp_elt_type (type);
1705130803Smarcel			  write_exp_string (yyvsp[0].sval);
1706130803Smarcel			  write_exp_elt_opcode (OP_SCOPE);
1707130803Smarcel			}
1708130803Smarcel    break;
1709130803Smarcel
1710130803Smarcel  case 59:
1711130803Smarcel#line 603 "p-exp.y"
1712130803Smarcel    {
1713130803Smarcel			  char *name = copy_name (yyvsp[0].sval);
1714130803Smarcel			  struct symbol *sym;
1715130803Smarcel			  struct minimal_symbol *msymbol;
1716130803Smarcel
1717130803Smarcel			  sym =
1718130803Smarcel			    lookup_symbol (name, (const struct block *) NULL,
1719130803Smarcel					   VAR_DOMAIN, (int *) NULL,
1720130803Smarcel					   (struct symtab **) NULL);
1721130803Smarcel			  if (sym)
1722130803Smarcel			    {
1723130803Smarcel			      write_exp_elt_opcode (OP_VAR_VALUE);
1724130803Smarcel			      write_exp_elt_block (NULL);
1725130803Smarcel			      write_exp_elt_sym (sym);
1726130803Smarcel			      write_exp_elt_opcode (OP_VAR_VALUE);
1727130803Smarcel			      break;
1728130803Smarcel			    }
1729130803Smarcel
1730130803Smarcel			  msymbol = lookup_minimal_symbol (name, NULL, NULL);
1731130803Smarcel			  if (msymbol != NULL)
1732130803Smarcel			    {
1733130803Smarcel			      write_exp_msymbol (msymbol,
1734130803Smarcel						 lookup_function_type (builtin_type_int),
1735130803Smarcel						 builtin_type_int);
1736130803Smarcel			    }
1737130803Smarcel			  else
1738130803Smarcel			    if (!have_full_symbols () && !have_partial_symbols ())
1739130803Smarcel			      error ("No symbol table is loaded.  Use the \"file\" command.");
1740130803Smarcel			    else
1741130803Smarcel			      error ("No symbol \"%s\" in current context.", name);
1742130803Smarcel			}
1743130803Smarcel    break;
1744130803Smarcel
1745130803Smarcel  case 60:
1746130803Smarcel#line 637 "p-exp.y"
1747130803Smarcel    { struct symbol *sym = yyvsp[0].ssym.sym;
1748130803Smarcel
1749130803Smarcel			  if (sym)
1750130803Smarcel			    {
1751130803Smarcel			      if (symbol_read_needs_frame (sym))
1752130803Smarcel				{
1753130803Smarcel				  if (innermost_block == 0 ||
1754130803Smarcel				      contained_in (block_found,
1755130803Smarcel						    innermost_block))
1756130803Smarcel				    innermost_block = block_found;
1757130803Smarcel				}
1758130803Smarcel
1759130803Smarcel			      write_exp_elt_opcode (OP_VAR_VALUE);
1760130803Smarcel			      /* We want to use the selected frame, not
1761130803Smarcel				 another more inner frame which happens to
1762130803Smarcel				 be in the same block.  */
1763130803Smarcel			      write_exp_elt_block (NULL);
1764130803Smarcel			      write_exp_elt_sym (sym);
1765130803Smarcel			      write_exp_elt_opcode (OP_VAR_VALUE);
1766130803Smarcel			      current_type = sym->type; }
1767130803Smarcel			  else if (yyvsp[0].ssym.is_a_field_of_this)
1768130803Smarcel			    {
1769130803Smarcel			      struct value * this_val;
1770130803Smarcel			      struct type * this_type;
1771130803Smarcel			      /* Object pascal: it hangs off of `this'.  Must
1772130803Smarcel			         not inadvertently convert from a method call
1773130803Smarcel				 to data ref.  */
1774130803Smarcel			      if (innermost_block == 0 ||
1775130803Smarcel				  contained_in (block_found, innermost_block))
1776130803Smarcel				innermost_block = block_found;
1777130803Smarcel			      write_exp_elt_opcode (OP_THIS);
1778130803Smarcel			      write_exp_elt_opcode (OP_THIS);
1779130803Smarcel			      write_exp_elt_opcode (STRUCTOP_PTR);
1780130803Smarcel			      write_exp_string (yyvsp[0].ssym.stoken);
1781130803Smarcel			      write_exp_elt_opcode (STRUCTOP_PTR);
1782130803Smarcel			      /* we need type of this */
1783130803Smarcel			      this_val = value_of_this (0);
1784130803Smarcel			      if (this_val)
1785130803Smarcel				this_type = this_val->type;
1786130803Smarcel			      else
1787130803Smarcel				this_type = NULL;
1788130803Smarcel			      if (this_type)
1789130803Smarcel				current_type = lookup_struct_elt_type (
1790130803Smarcel				  this_type,
1791130803Smarcel				  copy_name (yyvsp[0].ssym.stoken), 0);
1792130803Smarcel			      else
1793130803Smarcel				current_type = NULL;
1794130803Smarcel			    }
1795130803Smarcel			  else
1796130803Smarcel			    {
1797130803Smarcel			      struct minimal_symbol *msymbol;
1798130803Smarcel			      char *arg = copy_name (yyvsp[0].ssym.stoken);
1799130803Smarcel
1800130803Smarcel			      msymbol =
1801130803Smarcel				lookup_minimal_symbol (arg, NULL, NULL);
1802130803Smarcel			      if (msymbol != NULL)
1803130803Smarcel				{
1804130803Smarcel				  write_exp_msymbol (msymbol,
1805130803Smarcel						     lookup_function_type (builtin_type_int),
1806130803Smarcel						     builtin_type_int);
1807130803Smarcel				}
1808130803Smarcel			      else if (!have_full_symbols () && !have_partial_symbols ())
1809130803Smarcel				error ("No symbol table is loaded.  Use the \"file\" command.");
1810130803Smarcel			      else
1811130803Smarcel				error ("No symbol \"%s\" in current context.",
1812130803Smarcel				       copy_name (yyvsp[0].ssym.stoken));
1813130803Smarcel			    }
1814130803Smarcel			}
1815130803Smarcel    break;
1816130803Smarcel
1817130803Smarcel  case 63:
1818130803Smarcel#line 721 "p-exp.y"
1819130803Smarcel    { yyval.tval = lookup_member_type (builtin_type_int, yyvsp[-2].tval); }
1820130803Smarcel    break;
1821130803Smarcel
1822130803Smarcel  case 64:
1823130803Smarcel#line 726 "p-exp.y"
1824130803Smarcel    { yyval.tval = lookup_pointer_type (yyvsp[0].tval); }
1825130803Smarcel    break;
1826130803Smarcel
1827130803Smarcel  case 65:
1828130803Smarcel#line 728 "p-exp.y"
1829130803Smarcel    { yyval.tval = yyvsp[0].tsym.type; }
1830130803Smarcel    break;
1831130803Smarcel
1832130803Smarcel  case 66:
1833130803Smarcel#line 730 "p-exp.y"
1834130803Smarcel    { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
1835130803Smarcel					      expression_context_block); }
1836130803Smarcel    break;
1837130803Smarcel
1838130803Smarcel  case 67:
1839130803Smarcel#line 733 "p-exp.y"
1840130803Smarcel    { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
1841130803Smarcel					      expression_context_block); }
1842130803Smarcel    break;
1843130803Smarcel
1844130803Smarcel  case 68:
1845130803Smarcel#line 740 "p-exp.y"
1846130803Smarcel    { yyval.sval = yyvsp[0].ssym.stoken; }
1847130803Smarcel    break;
1848130803Smarcel
1849130803Smarcel  case 69:
1850130803Smarcel#line 741 "p-exp.y"
1851130803Smarcel    { yyval.sval = yyvsp[0].ssym.stoken; }
1852130803Smarcel    break;
1853130803Smarcel
1854130803Smarcel  case 70:
1855130803Smarcel#line 742 "p-exp.y"
1856130803Smarcel    { yyval.sval = yyvsp[0].tsym.stoken; }
1857130803Smarcel    break;
1858130803Smarcel
1859130803Smarcel  case 71:
1860130803Smarcel#line 743 "p-exp.y"
1861130803Smarcel    { yyval.sval = yyvsp[0].ssym.stoken; }
1862130803Smarcel    break;
1863130803Smarcel
1864130803Smarcel
1865130803Smarcel    }
1866130803Smarcel
1867130803Smarcel/* Line 991 of yacc.c.  */
1868130803Smarcel
1869130803Smarcel  yyvsp -= yylen;
1870130803Smarcel  yyssp -= yylen;
1871130803Smarcel
1872130803Smarcel
1873130803Smarcel  YY_STACK_PRINT (yyss, yyssp);
1874130803Smarcel
1875130803Smarcel  *++yyvsp = yyval;
1876130803Smarcel
1877130803Smarcel
1878130803Smarcel  /* Now `shift' the result of the reduction.  Determine what state
1879130803Smarcel     that goes to, based on the state we popped back to and the rule
1880130803Smarcel     number reduced by.  */
1881130803Smarcel
1882130803Smarcel  yyn = yyr1[yyn];
1883130803Smarcel
1884130803Smarcel  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1885130803Smarcel  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1886130803Smarcel    yystate = yytable[yystate];
1887130803Smarcel  else
1888130803Smarcel    yystate = yydefgoto[yyn - YYNTOKENS];
1889130803Smarcel
1890130803Smarcel  goto yynewstate;
1891130803Smarcel
1892130803Smarcel
1893130803Smarcel/*------------------------------------.
1894130803Smarcel| yyerrlab -- here on detecting error |
1895130803Smarcel`------------------------------------*/
1896130803Smarcelyyerrlab:
1897130803Smarcel  /* If not already recovering from an error, report this error.  */
1898130803Smarcel  if (!yyerrstatus)
1899130803Smarcel    {
1900130803Smarcel      ++yynerrs;
1901130803Smarcel#if YYERROR_VERBOSE
1902130803Smarcel      yyn = yypact[yystate];
1903130803Smarcel
1904130803Smarcel      if (YYPACT_NINF < yyn && yyn < YYLAST)
1905130803Smarcel	{
1906130803Smarcel	  YYSIZE_T yysize = 0;
1907130803Smarcel	  int yytype = YYTRANSLATE (yychar);
1908130803Smarcel	  char *yymsg;
1909130803Smarcel	  int yyx, yycount;
1910130803Smarcel
1911130803Smarcel	  yycount = 0;
1912130803Smarcel	  /* Start YYX at -YYN if negative to avoid negative indexes in
1913130803Smarcel	     YYCHECK.  */
1914130803Smarcel	  for (yyx = yyn < 0 ? -yyn : 0;
1915130803Smarcel	       yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1916130803Smarcel	    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1917130803Smarcel	      yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1918130803Smarcel	  yysize += yystrlen ("syntax error, unexpected ") + 1;
1919130803Smarcel	  yysize += yystrlen (yytname[yytype]);
1920130803Smarcel	  yymsg = (char *) YYSTACK_ALLOC (yysize);
1921130803Smarcel	  if (yymsg != 0)
1922130803Smarcel	    {
1923130803Smarcel	      char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1924130803Smarcel	      yyp = yystpcpy (yyp, yytname[yytype]);
1925130803Smarcel
1926130803Smarcel	      if (yycount < 5)
1927130803Smarcel		{
1928130803Smarcel		  yycount = 0;
1929130803Smarcel		  for (yyx = yyn < 0 ? -yyn : 0;
1930130803Smarcel		       yyx < (int) (sizeof (yytname) / sizeof (char *));
1931130803Smarcel		       yyx++)
1932130803Smarcel		    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1933130803Smarcel		      {
1934130803Smarcel			const char *yyq = ! yycount ? ", expecting " : " or ";
1935130803Smarcel			yyp = yystpcpy (yyp, yyq);
1936130803Smarcel			yyp = yystpcpy (yyp, yytname[yyx]);
1937130803Smarcel			yycount++;
1938130803Smarcel		      }
1939130803Smarcel		}
1940130803Smarcel	      yyerror (yymsg);
1941130803Smarcel	      YYSTACK_FREE (yymsg);
1942130803Smarcel	    }
1943130803Smarcel	  else
1944130803Smarcel	    yyerror ("syntax error; also virtual memory exhausted");
1945130803Smarcel	}
1946130803Smarcel      else
1947130803Smarcel#endif /* YYERROR_VERBOSE */
1948130803Smarcel	yyerror ("syntax error");
1949130803Smarcel    }
1950130803Smarcel
1951130803Smarcel
1952130803Smarcel
1953130803Smarcel  if (yyerrstatus == 3)
1954130803Smarcel    {
1955130803Smarcel      /* If just tried and failed to reuse lookahead token after an
1956130803Smarcel	 error, discard it.  */
1957130803Smarcel
1958130803Smarcel      /* Return failure if at end of input.  */
1959130803Smarcel      if (yychar == YYEOF)
1960130803Smarcel        {
1961130803Smarcel	  /* Pop the error token.  */
1962130803Smarcel          YYPOPSTACK;
1963130803Smarcel	  /* Pop the rest of the stack.  */
1964130803Smarcel	  while (yyss < yyssp)
1965130803Smarcel	    {
1966130803Smarcel	      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1967130803Smarcel	      yydestruct (yystos[*yyssp], yyvsp);
1968130803Smarcel	      YYPOPSTACK;
1969130803Smarcel	    }
1970130803Smarcel	  YYABORT;
1971130803Smarcel        }
1972130803Smarcel
1973130803Smarcel      YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1974130803Smarcel      yydestruct (yytoken, &yylval);
1975130803Smarcel      yychar = YYEMPTY;
1976130803Smarcel
1977130803Smarcel    }
1978130803Smarcel
1979130803Smarcel  /* Else will try to reuse lookahead token after shifting the error
1980130803Smarcel     token.  */
1981130803Smarcel  goto yyerrlab2;
1982130803Smarcel
1983130803Smarcel
1984130803Smarcel/*----------------------------------------------------.
1985130803Smarcel| yyerrlab1 -- error raised explicitly by an action.  |
1986130803Smarcel`----------------------------------------------------*/
1987130803Smarcelyyerrlab1:
1988130803Smarcel
1989130803Smarcel  /* Suppress GCC warning that yyerrlab1 is unused when no action
1990130803Smarcel     invokes YYERROR.  Doesn't work in C++ */
1991130803Smarcel#ifndef __cplusplus
1992130803Smarcel#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
1993130803Smarcel  __attribute__ ((__unused__))
1994130803Smarcel#endif
1995130803Smarcel#endif
1996130803Smarcel
1997130803Smarcel
1998130803Smarcel  goto yyerrlab2;
1999130803Smarcel
2000130803Smarcel
2001130803Smarcel/*---------------------------------------------------------------.
2002130803Smarcel| yyerrlab2 -- pop states until the error token can be shifted.  |
2003130803Smarcel`---------------------------------------------------------------*/
2004130803Smarcelyyerrlab2:
2005130803Smarcel  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
2006130803Smarcel
2007130803Smarcel  for (;;)
2008130803Smarcel    {
2009130803Smarcel      yyn = yypact[yystate];
2010130803Smarcel      if (yyn != YYPACT_NINF)
2011130803Smarcel	{
2012130803Smarcel	  yyn += YYTERROR;
2013130803Smarcel	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2014130803Smarcel	    {
2015130803Smarcel	      yyn = yytable[yyn];
2016130803Smarcel	      if (0 < yyn)
2017130803Smarcel		break;
2018130803Smarcel	    }
2019130803Smarcel	}
2020130803Smarcel
2021130803Smarcel      /* Pop the current state because it cannot handle the error token.  */
2022130803Smarcel      if (yyssp == yyss)
2023130803Smarcel	YYABORT;
2024130803Smarcel
2025130803Smarcel      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2026130803Smarcel      yydestruct (yystos[yystate], yyvsp);
2027130803Smarcel      yyvsp--;
2028130803Smarcel      yystate = *--yyssp;
2029130803Smarcel
2030130803Smarcel      YY_STACK_PRINT (yyss, yyssp);
2031130803Smarcel    }
2032130803Smarcel
2033130803Smarcel  if (yyn == YYFINAL)
2034130803Smarcel    YYACCEPT;
2035130803Smarcel
2036130803Smarcel  YYDPRINTF ((stderr, "Shifting error token, "));
2037130803Smarcel
2038130803Smarcel  *++yyvsp = yylval;
2039130803Smarcel
2040130803Smarcel
2041130803Smarcel  yystate = yyn;
2042130803Smarcel  goto yynewstate;
2043130803Smarcel
2044130803Smarcel
2045130803Smarcel/*-------------------------------------.
2046130803Smarcel| yyacceptlab -- YYACCEPT comes here.  |
2047130803Smarcel`-------------------------------------*/
2048130803Smarcelyyacceptlab:
2049130803Smarcel  yyresult = 0;
2050130803Smarcel  goto yyreturn;
2051130803Smarcel
2052130803Smarcel/*-----------------------------------.
2053130803Smarcel| yyabortlab -- YYABORT comes here.  |
2054130803Smarcel`-----------------------------------*/
2055130803Smarcelyyabortlab:
2056130803Smarcel  yyresult = 1;
2057130803Smarcel  goto yyreturn;
2058130803Smarcel
2059130803Smarcel#ifndef yyoverflow
2060130803Smarcel/*----------------------------------------------.
2061130803Smarcel| yyoverflowlab -- parser overflow comes here.  |
2062130803Smarcel`----------------------------------------------*/
2063130803Smarcelyyoverflowlab:
2064130803Smarcel  yyerror ("parser stack overflow");
2065130803Smarcel  yyresult = 2;
2066130803Smarcel  /* Fall through.  */
2067130803Smarcel#endif
2068130803Smarcel
2069130803Smarcelyyreturn:
2070130803Smarcel#ifndef yyoverflow
2071130803Smarcel  if (yyss != yyssa)
2072130803Smarcel    YYSTACK_FREE (yyss);
2073130803Smarcel#endif
2074130803Smarcel  return yyresult;
2075130803Smarcel}
2076130803Smarcel
2077130803Smarcel
2078130803Smarcel#line 757 "p-exp.y"
2079130803Smarcel
2080130803Smarcel
2081130803Smarcel/* Take care of parsing a number (anything that starts with a digit).
2082130803Smarcel   Set yylval and return the token type; update lexptr.
2083130803Smarcel   LEN is the number of characters in it.  */
2084130803Smarcel
2085130803Smarcel/*** Needs some error checking for the float case ***/
2086130803Smarcel
2087130803Smarcelstatic int
2088130803Smarcelparse_number (p, len, parsed_float, putithere)
2089130803Smarcel     char *p;
2090130803Smarcel     int len;
2091130803Smarcel     int parsed_float;
2092130803Smarcel     YYSTYPE *putithere;
2093130803Smarcel{
2094130803Smarcel  /* FIXME: Shouldn't these be unsigned?  We don't deal with negative values
2095130803Smarcel     here, and we do kind of silly things like cast to unsigned.  */
2096130803Smarcel  LONGEST n = 0;
2097130803Smarcel  LONGEST prevn = 0;
2098130803Smarcel  ULONGEST un;
2099130803Smarcel
2100130803Smarcel  int i = 0;
2101130803Smarcel  int c;
2102130803Smarcel  int base = input_radix;
2103130803Smarcel  int unsigned_p = 0;
2104130803Smarcel
2105130803Smarcel  /* Number of "L" suffixes encountered.  */
2106130803Smarcel  int long_p = 0;
2107130803Smarcel
2108130803Smarcel  /* We have found a "L" or "U" suffix.  */
2109130803Smarcel  int found_suffix = 0;
2110130803Smarcel
2111130803Smarcel  ULONGEST high_bit;
2112130803Smarcel  struct type *signed_type;
2113130803Smarcel  struct type *unsigned_type;
2114130803Smarcel
2115130803Smarcel  if (parsed_float)
2116130803Smarcel    {
2117130803Smarcel      /* It's a float since it contains a point or an exponent.  */
2118130803Smarcel      char c;
2119130803Smarcel      int num = 0;	/* number of tokens scanned by scanf */
2120130803Smarcel      char saved_char = p[len];
2121130803Smarcel
2122130803Smarcel      p[len] = 0;	/* null-terminate the token */
2123130803Smarcel      if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
2124130803Smarcel	num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval,&c);
2125130803Smarcel      else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
2126130803Smarcel	num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval,&c);
2127130803Smarcel      else
2128130803Smarcel	{
2129130803Smarcel#ifdef SCANF_HAS_LONG_DOUBLE
2130130803Smarcel	  num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval,&c);
2131130803Smarcel#else
2132130803Smarcel	  /* Scan it into a double, then assign it to the long double.
2133130803Smarcel	     This at least wins with values representable in the range
2134130803Smarcel	     of doubles. */
2135130803Smarcel	  double temp;
2136130803Smarcel	  num = sscanf (p, "%lg%c", &temp,&c);
2137130803Smarcel	  putithere->typed_val_float.dval = temp;
2138130803Smarcel#endif
2139130803Smarcel	}
2140130803Smarcel      p[len] = saved_char;	/* restore the input stream */
2141130803Smarcel      if (num != 1) 		/* check scanf found ONLY a float ... */
2142130803Smarcel	return ERROR;
2143130803Smarcel      /* See if it has `f' or `l' suffix (float or long double).  */
2144130803Smarcel
2145130803Smarcel      c = tolower (p[len - 1]);
2146130803Smarcel
2147130803Smarcel      if (c == 'f')
2148130803Smarcel	putithere->typed_val_float.type = builtin_type_float;
2149130803Smarcel      else if (c == 'l')
2150130803Smarcel	putithere->typed_val_float.type = builtin_type_long_double;
2151130803Smarcel      else if (isdigit (c) || c == '.')
2152130803Smarcel	putithere->typed_val_float.type = builtin_type_double;
2153130803Smarcel      else
2154130803Smarcel	return ERROR;
2155130803Smarcel
2156130803Smarcel      return FLOAT;
2157130803Smarcel    }
2158130803Smarcel
2159130803Smarcel  /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2160130803Smarcel  if (p[0] == '0')
2161130803Smarcel    switch (p[1])
2162130803Smarcel      {
2163130803Smarcel      case 'x':
2164130803Smarcel      case 'X':
2165130803Smarcel	if (len >= 3)
2166130803Smarcel	  {
2167130803Smarcel	    p += 2;
2168130803Smarcel	    base = 16;
2169130803Smarcel	    len -= 2;
2170130803Smarcel	  }
2171130803Smarcel	break;
2172130803Smarcel
2173130803Smarcel      case 't':
2174130803Smarcel      case 'T':
2175130803Smarcel      case 'd':
2176130803Smarcel      case 'D':
2177130803Smarcel	if (len >= 3)
2178130803Smarcel	  {
2179130803Smarcel	    p += 2;
2180130803Smarcel	    base = 10;
2181130803Smarcel	    len -= 2;
2182130803Smarcel	  }
2183130803Smarcel	break;
2184130803Smarcel
2185130803Smarcel      default:
2186130803Smarcel	base = 8;
2187130803Smarcel	break;
2188130803Smarcel      }
2189130803Smarcel
2190130803Smarcel  while (len-- > 0)
2191130803Smarcel    {
2192130803Smarcel      c = *p++;
2193130803Smarcel      if (c >= 'A' && c <= 'Z')
2194130803Smarcel	c += 'a' - 'A';
2195130803Smarcel      if (c != 'l' && c != 'u')
2196130803Smarcel	n *= base;
2197130803Smarcel      if (c >= '0' && c <= '9')
2198130803Smarcel	{
2199130803Smarcel	  if (found_suffix)
2200130803Smarcel	    return ERROR;
2201130803Smarcel	  n += i = c - '0';
2202130803Smarcel	}
2203130803Smarcel      else
2204130803Smarcel	{
2205130803Smarcel	  if (base > 10 && c >= 'a' && c <= 'f')
2206130803Smarcel	    {
2207130803Smarcel	      if (found_suffix)
2208130803Smarcel		return ERROR;
2209130803Smarcel	      n += i = c - 'a' + 10;
2210130803Smarcel	    }
2211130803Smarcel	  else if (c == 'l')
2212130803Smarcel	    {
2213130803Smarcel	      ++long_p;
2214130803Smarcel	      found_suffix = 1;
2215130803Smarcel	    }
2216130803Smarcel	  else if (c == 'u')
2217130803Smarcel	    {
2218130803Smarcel	      unsigned_p = 1;
2219130803Smarcel	      found_suffix = 1;
2220130803Smarcel	    }
2221130803Smarcel	  else
2222130803Smarcel	    return ERROR;	/* Char not a digit */
2223130803Smarcel	}
2224130803Smarcel      if (i >= base)
2225130803Smarcel	return ERROR;		/* Invalid digit in this base */
2226130803Smarcel
2227130803Smarcel      /* Portably test for overflow (only works for nonzero values, so make
2228130803Smarcel	 a second check for zero).  FIXME: Can't we just make n and prevn
2229130803Smarcel	 unsigned and avoid this?  */
2230130803Smarcel      if (c != 'l' && c != 'u' && (prevn >= n) && n != 0)
2231130803Smarcel	unsigned_p = 1;		/* Try something unsigned */
2232130803Smarcel
2233130803Smarcel      /* Portably test for unsigned overflow.
2234130803Smarcel	 FIXME: This check is wrong; for example it doesn't find overflow
2235130803Smarcel	 on 0x123456789 when LONGEST is 32 bits.  */
2236130803Smarcel      if (c != 'l' && c != 'u' && n != 0)
2237130803Smarcel	{
2238130803Smarcel	  if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n))
2239130803Smarcel	    error ("Numeric constant too large.");
2240130803Smarcel	}
2241130803Smarcel      prevn = n;
2242130803Smarcel    }
2243130803Smarcel
2244130803Smarcel  /* An integer constant is an int, a long, or a long long.  An L
2245130803Smarcel     suffix forces it to be long; an LL suffix forces it to be long
2246130803Smarcel     long.  If not forced to a larger size, it gets the first type of
2247130803Smarcel     the above that it fits in.  To figure out whether it fits, we
2248130803Smarcel     shift it right and see whether anything remains.  Note that we
2249130803Smarcel     can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
2250130803Smarcel     operation, because many compilers will warn about such a shift
2251130803Smarcel     (which always produces a zero result).  Sometimes TARGET_INT_BIT
2252130803Smarcel     or TARGET_LONG_BIT will be that big, sometimes not.  To deal with
2253130803Smarcel     the case where it is we just always shift the value more than
2254130803Smarcel     once, with fewer bits each time.  */
2255130803Smarcel
2256130803Smarcel  un = (ULONGEST)n >> 2;
2257130803Smarcel  if (long_p == 0
2258130803Smarcel      && (un >> (TARGET_INT_BIT - 2)) == 0)
2259130803Smarcel    {
2260130803Smarcel      high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1);
2261130803Smarcel
2262130803Smarcel      /* A large decimal (not hex or octal) constant (between INT_MAX
2263130803Smarcel	 and UINT_MAX) is a long or unsigned long, according to ANSI,
2264130803Smarcel	 never an unsigned int, but this code treats it as unsigned
2265130803Smarcel	 int.  This probably should be fixed.  GCC gives a warning on
2266130803Smarcel	 such constants.  */
2267130803Smarcel
2268130803Smarcel      unsigned_type = builtin_type_unsigned_int;
2269130803Smarcel      signed_type = builtin_type_int;
2270130803Smarcel    }
2271130803Smarcel  else if (long_p <= 1
2272130803Smarcel	   && (un >> (TARGET_LONG_BIT - 2)) == 0)
2273130803Smarcel    {
2274130803Smarcel      high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1);
2275130803Smarcel      unsigned_type = builtin_type_unsigned_long;
2276130803Smarcel      signed_type = builtin_type_long;
2277130803Smarcel    }
2278130803Smarcel  else
2279130803Smarcel    {
2280130803Smarcel      int shift;
2281130803Smarcel      if (sizeof (ULONGEST) * HOST_CHAR_BIT < TARGET_LONG_LONG_BIT)
2282130803Smarcel	/* A long long does not fit in a LONGEST.  */
2283130803Smarcel	shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
2284130803Smarcel      else
2285130803Smarcel	shift = (TARGET_LONG_LONG_BIT - 1);
2286130803Smarcel      high_bit = (ULONGEST) 1 << shift;
2287130803Smarcel      unsigned_type = builtin_type_unsigned_long_long;
2288130803Smarcel      signed_type = builtin_type_long_long;
2289130803Smarcel    }
2290130803Smarcel
2291130803Smarcel   putithere->typed_val_int.val = n;
2292130803Smarcel
2293130803Smarcel   /* If the high bit of the worked out type is set then this number
2294130803Smarcel      has to be unsigned. */
2295130803Smarcel
2296130803Smarcel   if (unsigned_p || (n & high_bit))
2297130803Smarcel     {
2298130803Smarcel       putithere->typed_val_int.type = unsigned_type;
2299130803Smarcel     }
2300130803Smarcel   else
2301130803Smarcel     {
2302130803Smarcel       putithere->typed_val_int.type = signed_type;
2303130803Smarcel     }
2304130803Smarcel
2305130803Smarcel   return INT;
2306130803Smarcel}
2307130803Smarcel
2308130803Smarcel
2309130803Smarcelstruct type_push
2310130803Smarcel{
2311130803Smarcel  struct type *stored;
2312130803Smarcel  struct type_push *next;
2313130803Smarcel};
2314130803Smarcel
2315130803Smarcelstatic struct type_push *tp_top = NULL;
2316130803Smarcel
2317130803Smarcelstatic void
2318130803Smarcelpush_current_type (void)
2319130803Smarcel{
2320130803Smarcel  struct type_push *tpnew;
2321130803Smarcel  tpnew = (struct type_push *) xmalloc (sizeof (struct type_push));
2322130803Smarcel  tpnew->next = tp_top;
2323130803Smarcel  tpnew->stored = current_type;
2324130803Smarcel  current_type = NULL;
2325130803Smarcel  tp_top = tpnew;
2326130803Smarcel}
2327130803Smarcel
2328130803Smarcelstatic void
2329130803Smarcelpop_current_type (void)
2330130803Smarcel{
2331130803Smarcel  struct type_push *tp = tp_top;
2332130803Smarcel  if (tp)
2333130803Smarcel    {
2334130803Smarcel      current_type = tp->stored;
2335130803Smarcel      tp_top = tp->next;
2336130803Smarcel      xfree (tp);
2337130803Smarcel    }
2338130803Smarcel}
2339130803Smarcel
2340130803Smarcelstruct token
2341130803Smarcel{
2342130803Smarcel  char *operator;
2343130803Smarcel  int token;
2344130803Smarcel  enum exp_opcode opcode;
2345130803Smarcel};
2346130803Smarcel
2347130803Smarcelstatic const struct token tokentab3[] =
2348130803Smarcel  {
2349130803Smarcel    {"shr", RSH, BINOP_END},
2350130803Smarcel    {"shl", LSH, BINOP_END},
2351130803Smarcel    {"and", ANDAND, BINOP_END},
2352130803Smarcel    {"div", DIV, BINOP_END},
2353130803Smarcel    {"not", NOT, BINOP_END},
2354130803Smarcel    {"mod", MOD, BINOP_END},
2355130803Smarcel    {"inc", INCREMENT, BINOP_END},
2356130803Smarcel    {"dec", DECREMENT, BINOP_END},
2357130803Smarcel    {"xor", XOR, BINOP_END}
2358130803Smarcel  };
2359130803Smarcel
2360130803Smarcelstatic const struct token tokentab2[] =
2361130803Smarcel  {
2362130803Smarcel    {"or", OR, BINOP_END},
2363130803Smarcel    {"<>", NOTEQUAL, BINOP_END},
2364130803Smarcel    {"<=", LEQ, BINOP_END},
2365130803Smarcel    {">=", GEQ, BINOP_END},
2366130803Smarcel    {":=", ASSIGN, BINOP_END},
2367130803Smarcel    {"::", COLONCOLON, BINOP_END} };
2368130803Smarcel
2369130803Smarcel/* Allocate uppercased var */
2370130803Smarcel/* make an uppercased copy of tokstart */
2371130803Smarcelstatic char * uptok (tokstart, namelen)
2372130803Smarcel  char *tokstart;
2373130803Smarcel  int namelen;
2374130803Smarcel{
2375130803Smarcel  int i;
2376130803Smarcel  char *uptokstart = (char *)xmalloc(namelen+1);
2377130803Smarcel  for (i = 0;i <= namelen;i++)
2378130803Smarcel    {
2379130803Smarcel      if ((tokstart[i]>='a' && tokstart[i]<='z'))
2380130803Smarcel        uptokstart[i] = tokstart[i]-('a'-'A');
2381130803Smarcel      else
2382130803Smarcel        uptokstart[i] = tokstart[i];
2383130803Smarcel    }
2384130803Smarcel  uptokstart[namelen]='\0';
2385130803Smarcel  return uptokstart;
2386130803Smarcel}
2387130803Smarcel/* Read one token, getting characters through lexptr.  */
2388130803Smarcel
2389130803Smarcel
2390130803Smarcelstatic int
2391130803Smarcelyylex ()
2392130803Smarcel{
2393130803Smarcel  int c;
2394130803Smarcel  int namelen;
2395130803Smarcel  unsigned int i;
2396130803Smarcel  char *tokstart;
2397130803Smarcel  char *uptokstart;
2398130803Smarcel  char *tokptr;
2399130803Smarcel  char *p;
2400130803Smarcel  int explen, tempbufindex;
2401130803Smarcel  static char *tempbuf;
2402130803Smarcel  static int tempbufsize;
2403130803Smarcel
2404130803Smarcel retry:
2405130803Smarcel
2406130803Smarcel  prev_lexptr = lexptr;
2407130803Smarcel
2408130803Smarcel  tokstart = lexptr;
2409130803Smarcel  explen = strlen (lexptr);
2410130803Smarcel  /* See if it is a special token of length 3.  */
2411130803Smarcel  if (explen > 2)
2412130803Smarcel    for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
2413130803Smarcel      if (strncasecmp (tokstart, tokentab3[i].operator, 3) == 0
2414130803Smarcel          && (!isalpha (tokentab3[i].operator[0]) || explen == 3
2415130803Smarcel              || (!isalpha (tokstart[3]) && !isdigit (tokstart[3]) && tokstart[3] != '_')))
2416130803Smarcel        {
2417130803Smarcel          lexptr += 3;
2418130803Smarcel          yylval.opcode = tokentab3[i].opcode;
2419130803Smarcel          return tokentab3[i].token;
2420130803Smarcel        }
2421130803Smarcel
2422130803Smarcel  /* See if it is a special token of length 2.  */
2423130803Smarcel  if (explen > 1)
2424130803Smarcel  for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
2425130803Smarcel      if (strncasecmp (tokstart, tokentab2[i].operator, 2) == 0
2426130803Smarcel          && (!isalpha (tokentab2[i].operator[0]) || explen == 2
2427130803Smarcel              || (!isalpha (tokstart[2]) && !isdigit (tokstart[2]) && tokstart[2] != '_')))
2428130803Smarcel        {
2429130803Smarcel          lexptr += 2;
2430130803Smarcel          yylval.opcode = tokentab2[i].opcode;
2431130803Smarcel          return tokentab2[i].token;
2432130803Smarcel        }
2433130803Smarcel
2434130803Smarcel  switch (c = *tokstart)
2435130803Smarcel    {
2436130803Smarcel    case 0:
2437130803Smarcel      return 0;
2438130803Smarcel
2439130803Smarcel    case ' ':
2440130803Smarcel    case '\t':
2441130803Smarcel    case '\n':
2442130803Smarcel      lexptr++;
2443130803Smarcel      goto retry;
2444130803Smarcel
2445130803Smarcel    case '\'':
2446130803Smarcel      /* We either have a character constant ('0' or '\177' for example)
2447130803Smarcel	 or we have a quoted symbol reference ('foo(int,int)' in object pascal
2448130803Smarcel	 for example). */
2449130803Smarcel      lexptr++;
2450130803Smarcel      c = *lexptr++;
2451130803Smarcel      if (c == '\\')
2452130803Smarcel	c = parse_escape (&lexptr);
2453130803Smarcel      else if (c == '\'')
2454130803Smarcel	error ("Empty character constant.");
2455130803Smarcel
2456130803Smarcel      yylval.typed_val_int.val = c;
2457130803Smarcel      yylval.typed_val_int.type = builtin_type_char;
2458130803Smarcel
2459130803Smarcel      c = *lexptr++;
2460130803Smarcel      if (c != '\'')
2461130803Smarcel	{
2462130803Smarcel	  namelen = skip_quoted (tokstart) - tokstart;
2463130803Smarcel	  if (namelen > 2)
2464130803Smarcel	    {
2465130803Smarcel	      lexptr = tokstart + namelen;
2466130803Smarcel	      if (lexptr[-1] != '\'')
2467130803Smarcel		error ("Unmatched single quote.");
2468130803Smarcel	      namelen -= 2;
2469130803Smarcel              tokstart++;
2470130803Smarcel              uptokstart = uptok(tokstart,namelen);
2471130803Smarcel	      goto tryname;
2472130803Smarcel	    }
2473130803Smarcel	  error ("Invalid character constant.");
2474130803Smarcel	}
2475130803Smarcel      return INT;
2476130803Smarcel
2477130803Smarcel    case '(':
2478130803Smarcel      paren_depth++;
2479130803Smarcel      lexptr++;
2480130803Smarcel      return c;
2481130803Smarcel
2482130803Smarcel    case ')':
2483130803Smarcel      if (paren_depth == 0)
2484130803Smarcel	return 0;
2485130803Smarcel      paren_depth--;
2486130803Smarcel      lexptr++;
2487130803Smarcel      return c;
2488130803Smarcel
2489130803Smarcel    case ',':
2490130803Smarcel      if (comma_terminates && paren_depth == 0)
2491130803Smarcel	return 0;
2492130803Smarcel      lexptr++;
2493130803Smarcel      return c;
2494130803Smarcel
2495130803Smarcel    case '.':
2496130803Smarcel      /* Might be a floating point number.  */
2497130803Smarcel      if (lexptr[1] < '0' || lexptr[1] > '9')
2498130803Smarcel	goto symbol;		/* Nope, must be a symbol. */
2499130803Smarcel      /* FALL THRU into number case.  */
2500130803Smarcel
2501130803Smarcel    case '0':
2502130803Smarcel    case '1':
2503130803Smarcel    case '2':
2504130803Smarcel    case '3':
2505130803Smarcel    case '4':
2506130803Smarcel    case '5':
2507130803Smarcel    case '6':
2508130803Smarcel    case '7':
2509130803Smarcel    case '8':
2510130803Smarcel    case '9':
2511130803Smarcel      {
2512130803Smarcel	/* It's a number.  */
2513130803Smarcel	int got_dot = 0, got_e = 0, toktype;
2514130803Smarcel	char *p = tokstart;
2515130803Smarcel	int hex = input_radix > 10;
2516130803Smarcel
2517130803Smarcel	if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2518130803Smarcel	  {
2519130803Smarcel	    p += 2;
2520130803Smarcel	    hex = 1;
2521130803Smarcel	  }
2522130803Smarcel	else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
2523130803Smarcel	  {
2524130803Smarcel	    p += 2;
2525130803Smarcel	    hex = 0;
2526130803Smarcel	  }
2527130803Smarcel
2528130803Smarcel	for (;; ++p)
2529130803Smarcel	  {
2530130803Smarcel	    /* This test includes !hex because 'e' is a valid hex digit
2531130803Smarcel	       and thus does not indicate a floating point number when
2532130803Smarcel	       the radix is hex.  */
2533130803Smarcel	    if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2534130803Smarcel	      got_dot = got_e = 1;
2535130803Smarcel	    /* This test does not include !hex, because a '.' always indicates
2536130803Smarcel	       a decimal floating point number regardless of the radix.  */
2537130803Smarcel	    else if (!got_dot && *p == '.')
2538130803Smarcel	      got_dot = 1;
2539130803Smarcel	    else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
2540130803Smarcel		     && (*p == '-' || *p == '+'))
2541130803Smarcel	      /* This is the sign of the exponent, not the end of the
2542130803Smarcel		 number.  */
2543130803Smarcel	      continue;
2544130803Smarcel	    /* We will take any letters or digits.  parse_number will
2545130803Smarcel	       complain if past the radix, or if L or U are not final.  */
2546130803Smarcel	    else if ((*p < '0' || *p > '9')
2547130803Smarcel		     && ((*p < 'a' || *p > 'z')
2548130803Smarcel				  && (*p < 'A' || *p > 'Z')))
2549130803Smarcel	      break;
2550130803Smarcel	  }
2551130803Smarcel	toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
2552130803Smarcel        if (toktype == ERROR)
2553130803Smarcel	  {
2554130803Smarcel	    char *err_copy = (char *) alloca (p - tokstart + 1);
2555130803Smarcel
2556130803Smarcel	    memcpy (err_copy, tokstart, p - tokstart);
2557130803Smarcel	    err_copy[p - tokstart] = 0;
2558130803Smarcel	    error ("Invalid number \"%s\".", err_copy);
2559130803Smarcel	  }
2560130803Smarcel	lexptr = p;
2561130803Smarcel	return toktype;
2562130803Smarcel      }
2563130803Smarcel
2564130803Smarcel    case '+':
2565130803Smarcel    case '-':
2566130803Smarcel    case '*':
2567130803Smarcel    case '/':
2568130803Smarcel    case '|':
2569130803Smarcel    case '&':
2570130803Smarcel    case '^':
2571130803Smarcel    case '~':
2572130803Smarcel    case '!':
2573130803Smarcel    case '@':
2574130803Smarcel    case '<':
2575130803Smarcel    case '>':
2576130803Smarcel    case '[':
2577130803Smarcel    case ']':
2578130803Smarcel    case '?':
2579130803Smarcel    case ':':
2580130803Smarcel    case '=':
2581130803Smarcel    case '{':
2582130803Smarcel    case '}':
2583130803Smarcel    symbol:
2584130803Smarcel      lexptr++;
2585130803Smarcel      return c;
2586130803Smarcel
2587130803Smarcel    case '"':
2588130803Smarcel
2589130803Smarcel      /* Build the gdb internal form of the input string in tempbuf,
2590130803Smarcel	 translating any standard C escape forms seen.  Note that the
2591130803Smarcel	 buffer is null byte terminated *only* for the convenience of
2592130803Smarcel	 debugging gdb itself and printing the buffer contents when
2593130803Smarcel	 the buffer contains no embedded nulls.  Gdb does not depend
2594130803Smarcel	 upon the buffer being null byte terminated, it uses the length
2595130803Smarcel	 string instead.  This allows gdb to handle C strings (as well
2596130803Smarcel	 as strings in other languages) with embedded null bytes */
2597130803Smarcel
2598130803Smarcel      tokptr = ++tokstart;
2599130803Smarcel      tempbufindex = 0;
2600130803Smarcel
2601130803Smarcel      do {
2602130803Smarcel	/* Grow the static temp buffer if necessary, including allocating
2603130803Smarcel	   the first one on demand. */
2604130803Smarcel	if (tempbufindex + 1 >= tempbufsize)
2605130803Smarcel	  {
2606130803Smarcel	    tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
2607130803Smarcel	  }
2608130803Smarcel
2609130803Smarcel	switch (*tokptr)
2610130803Smarcel	  {
2611130803Smarcel	  case '\0':
2612130803Smarcel	  case '"':
2613130803Smarcel	    /* Do nothing, loop will terminate. */
2614130803Smarcel	    break;
2615130803Smarcel	  case '\\':
2616130803Smarcel	    tokptr++;
2617130803Smarcel	    c = parse_escape (&tokptr);
2618130803Smarcel	    if (c == -1)
2619130803Smarcel	      {
2620130803Smarcel		continue;
2621130803Smarcel	      }
2622130803Smarcel	    tempbuf[tempbufindex++] = c;
2623130803Smarcel	    break;
2624130803Smarcel	  default:
2625130803Smarcel	    tempbuf[tempbufindex++] = *tokptr++;
2626130803Smarcel	    break;
2627130803Smarcel	  }
2628130803Smarcel      } while ((*tokptr != '"') && (*tokptr != '\0'));
2629130803Smarcel      if (*tokptr++ != '"')
2630130803Smarcel	{
2631130803Smarcel	  error ("Unterminated string in expression.");
2632130803Smarcel	}
2633130803Smarcel      tempbuf[tempbufindex] = '\0';	/* See note above */
2634130803Smarcel      yylval.sval.ptr = tempbuf;
2635130803Smarcel      yylval.sval.length = tempbufindex;
2636130803Smarcel      lexptr = tokptr;
2637130803Smarcel      return (STRING);
2638130803Smarcel    }
2639130803Smarcel
2640130803Smarcel  if (!(c == '_' || c == '$'
2641130803Smarcel	|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2642130803Smarcel    /* We must have come across a bad character (e.g. ';').  */
2643130803Smarcel    error ("Invalid character '%c' in expression.", c);
2644130803Smarcel
2645130803Smarcel  /* It's a name.  See how long it is.  */
2646130803Smarcel  namelen = 0;
2647130803Smarcel  for (c = tokstart[namelen];
2648130803Smarcel       (c == '_' || c == '$' || (c >= '0' && c <= '9')
2649130803Smarcel	|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
2650130803Smarcel    {
2651130803Smarcel      /* Template parameter lists are part of the name.
2652130803Smarcel	 FIXME: This mishandles `print $a<4&&$a>3'.  */
2653130803Smarcel      if (c == '<')
2654130803Smarcel	{
2655130803Smarcel	  int i = namelen;
2656130803Smarcel	  int nesting_level = 1;
2657130803Smarcel	  while (tokstart[++i])
2658130803Smarcel	    {
2659130803Smarcel	      if (tokstart[i] == '<')
2660130803Smarcel		nesting_level++;
2661130803Smarcel	      else if (tokstart[i] == '>')
2662130803Smarcel		{
2663130803Smarcel		  if (--nesting_level == 0)
2664130803Smarcel		    break;
2665130803Smarcel		}
2666130803Smarcel	    }
2667130803Smarcel	  if (tokstart[i] == '>')
2668130803Smarcel	    namelen = i;
2669130803Smarcel	  else
2670130803Smarcel	    break;
2671130803Smarcel	}
2672130803Smarcel
2673130803Smarcel      /* do NOT uppercase internals because of registers !!! */
2674130803Smarcel      c = tokstart[++namelen];
2675130803Smarcel    }
2676130803Smarcel
2677130803Smarcel  uptokstart = uptok(tokstart,namelen);
2678130803Smarcel
2679130803Smarcel  /* The token "if" terminates the expression and is NOT
2680130803Smarcel     removed from the input stream.  */
2681130803Smarcel  if (namelen == 2 && uptokstart[0] == 'I' && uptokstart[1] == 'F')
2682130803Smarcel    {
2683130803Smarcel      return 0;
2684130803Smarcel    }
2685130803Smarcel
2686130803Smarcel  lexptr += namelen;
2687130803Smarcel
2688130803Smarcel  tryname:
2689130803Smarcel
2690130803Smarcel  /* Catch specific keywords.  Should be done with a data structure.  */
2691130803Smarcel  switch (namelen)
2692130803Smarcel    {
2693130803Smarcel    case 6:
2694130803Smarcel      if (DEPRECATED_STREQ (uptokstart, "OBJECT"))
2695130803Smarcel	return CLASS;
2696130803Smarcel      if (DEPRECATED_STREQ (uptokstart, "RECORD"))
2697130803Smarcel	return STRUCT;
2698130803Smarcel      if (DEPRECATED_STREQ (uptokstart, "SIZEOF"))
2699130803Smarcel	return SIZEOF;
2700130803Smarcel      break;
2701130803Smarcel    case 5:
2702130803Smarcel      if (DEPRECATED_STREQ (uptokstart, "CLASS"))
2703130803Smarcel	return CLASS;
2704130803Smarcel      if (DEPRECATED_STREQ (uptokstart, "FALSE"))
2705130803Smarcel	{
2706130803Smarcel          yylval.lval = 0;
2707130803Smarcel          return FALSEKEYWORD;
2708130803Smarcel        }
2709130803Smarcel      break;
2710130803Smarcel    case 4:
2711130803Smarcel      if (DEPRECATED_STREQ (uptokstart, "TRUE"))
2712130803Smarcel	{
2713130803Smarcel          yylval.lval = 1;
2714130803Smarcel  	  return TRUEKEYWORD;
2715130803Smarcel        }
2716130803Smarcel      if (DEPRECATED_STREQ (uptokstart, "SELF"))
2717130803Smarcel        {
2718130803Smarcel          /* here we search for 'this' like
2719130803Smarcel             inserted in FPC stabs debug info */
2720130803Smarcel	  static const char this_name[] = "this";
2721130803Smarcel
2722130803Smarcel	  if (lookup_symbol (this_name, expression_context_block,
2723130803Smarcel			     VAR_DOMAIN, (int *) NULL,
2724130803Smarcel			     (struct symtab **) NULL))
2725130803Smarcel	    return THIS;
2726130803Smarcel	}
2727130803Smarcel      break;
2728130803Smarcel    default:
2729130803Smarcel      break;
2730130803Smarcel    }
2731130803Smarcel
2732130803Smarcel  yylval.sval.ptr = tokstart;
2733130803Smarcel  yylval.sval.length = namelen;
2734130803Smarcel
2735130803Smarcel  if (*tokstart == '$')
2736130803Smarcel    {
2737130803Smarcel      /* $ is the normal prefix for pascal hexadecimal values
2738130803Smarcel        but this conflicts with the GDB use for debugger variables
2739130803Smarcel        so in expression to enter hexadecimal values
2740130803Smarcel        we still need to use C syntax with 0xff  */
2741130803Smarcel      write_dollar_variable (yylval.sval);
2742130803Smarcel      return VARIABLE;
2743130803Smarcel    }
2744130803Smarcel
2745130803Smarcel  /* Use token-type BLOCKNAME for symbols that happen to be defined as
2746130803Smarcel     functions or symtabs.  If this is not so, then ...
2747130803Smarcel     Use token-type TYPENAME for symbols that happen to be defined
2748130803Smarcel     currently as names of types; NAME for other symbols.
2749130803Smarcel     The caller is not constrained to care about the distinction.  */
2750130803Smarcel  {
2751130803Smarcel    char *tmp = copy_name (yylval.sval);
2752130803Smarcel    struct symbol *sym;
2753130803Smarcel    int is_a_field_of_this = 0;
2754130803Smarcel    int is_a_field = 0;
2755130803Smarcel    int hextype;
2756130803Smarcel
2757130803Smarcel
2758130803Smarcel    if (search_field && current_type)
2759130803Smarcel      is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
2760130803Smarcel    if (is_a_field)
2761130803Smarcel      sym = NULL;
2762130803Smarcel    else
2763130803Smarcel      sym = lookup_symbol (tmp, expression_context_block,
2764130803Smarcel			   VAR_DOMAIN,
2765130803Smarcel			   &is_a_field_of_this,
2766130803Smarcel			   (struct symtab **) NULL);
2767130803Smarcel    /* second chance uppercased (as Free Pascal does).  */
2768130803Smarcel    if (!sym && !is_a_field_of_this && !is_a_field)
2769130803Smarcel      {
2770130803Smarcel       for (i = 0; i <= namelen; i++)
2771130803Smarcel         {
2772130803Smarcel           if ((tmp[i] >= 'a' && tmp[i] <= 'z'))
2773130803Smarcel             tmp[i] -= ('a'-'A');
2774130803Smarcel         }
2775130803Smarcel       if (search_field && current_type)
2776130803Smarcel	 is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
2777130803Smarcel       if (is_a_field)
2778130803Smarcel	 sym = NULL;
2779130803Smarcel       else
2780130803Smarcel	 sym = lookup_symbol (tmp, expression_context_block,
2781130803Smarcel                        VAR_DOMAIN,
2782130803Smarcel                        &is_a_field_of_this,
2783130803Smarcel                        (struct symtab **) NULL);
2784130803Smarcel       if (sym || is_a_field_of_this || is_a_field)
2785130803Smarcel         for (i = 0; i <= namelen; i++)
2786130803Smarcel           {
2787130803Smarcel             if ((tokstart[i] >= 'a' && tokstart[i] <= 'z'))
2788130803Smarcel               tokstart[i] -= ('a'-'A');
2789130803Smarcel           }
2790130803Smarcel      }
2791130803Smarcel    /* Third chance Capitalized (as GPC does).  */
2792130803Smarcel    if (!sym && !is_a_field_of_this && !is_a_field)
2793130803Smarcel      {
2794130803Smarcel       for (i = 0; i <= namelen; i++)
2795130803Smarcel         {
2796130803Smarcel           if (i == 0)
2797130803Smarcel             {
2798130803Smarcel              if ((tmp[i] >= 'a' && tmp[i] <= 'z'))
2799130803Smarcel                tmp[i] -= ('a'-'A');
2800130803Smarcel             }
2801130803Smarcel           else
2802130803Smarcel           if ((tmp[i] >= 'A' && tmp[i] <= 'Z'))
2803130803Smarcel             tmp[i] -= ('A'-'a');
2804130803Smarcel          }
2805130803Smarcel       if (search_field && current_type)
2806130803Smarcel	 is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
2807130803Smarcel       if (is_a_field)
2808130803Smarcel	 sym = NULL;
2809130803Smarcel       else
2810130803Smarcel	 sym = lookup_symbol (tmp, expression_context_block,
2811130803Smarcel                         VAR_DOMAIN,
2812130803Smarcel                         &is_a_field_of_this,
2813130803Smarcel                         (struct symtab **) NULL);
2814130803Smarcel       if (sym || is_a_field_of_this || is_a_field)
2815130803Smarcel          for (i = 0; i <= namelen; i++)
2816130803Smarcel            {
2817130803Smarcel              if (i == 0)
2818130803Smarcel                {
2819130803Smarcel                  if ((tokstart[i] >= 'a' && tokstart[i] <= 'z'))
2820130803Smarcel                    tokstart[i] -= ('a'-'A');
2821130803Smarcel                }
2822130803Smarcel              else
2823130803Smarcel                if ((tokstart[i] >= 'A' && tokstart[i] <= 'Z'))
2824130803Smarcel                  tokstart[i] -= ('A'-'a');
2825130803Smarcel            }
2826130803Smarcel      }
2827130803Smarcel
2828130803Smarcel    if (is_a_field)
2829130803Smarcel      {
2830130803Smarcel	tempbuf = (char *) xrealloc (tempbuf, namelen + 1);
2831130803Smarcel	strncpy (tempbuf, tokstart, namelen); tempbuf [namelen] = 0;
2832130803Smarcel	yylval.sval.ptr = tempbuf;
2833130803Smarcel	yylval.sval.length = namelen;
2834130803Smarcel	return FIELDNAME;
2835130803Smarcel      }
2836130803Smarcel    /* Call lookup_symtab, not lookup_partial_symtab, in case there are
2837130803Smarcel       no psymtabs (coff, xcoff, or some future change to blow away the
2838130803Smarcel       psymtabs once once symbols are read).  */
2839130803Smarcel    if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ||
2840130803Smarcel        lookup_symtab (tmp))
2841130803Smarcel      {
2842130803Smarcel	yylval.ssym.sym = sym;
2843130803Smarcel	yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2844130803Smarcel	return BLOCKNAME;
2845130803Smarcel      }
2846130803Smarcel    if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
2847130803Smarcel        {
2848130803Smarcel#if 1
2849130803Smarcel	  /* Despite the following flaw, we need to keep this code enabled.
2850130803Smarcel	     Because we can get called from check_stub_method, if we don't
2851130803Smarcel	     handle nested types then it screws many operations in any
2852130803Smarcel	     program which uses nested types.  */
2853130803Smarcel	  /* In "A::x", if x is a member function of A and there happens
2854130803Smarcel	     to be a type (nested or not, since the stabs don't make that
2855130803Smarcel	     distinction) named x, then this code incorrectly thinks we
2856130803Smarcel	     are dealing with nested types rather than a member function.  */
2857130803Smarcel
2858130803Smarcel	  char *p;
2859130803Smarcel	  char *namestart;
2860130803Smarcel	  struct symbol *best_sym;
2861130803Smarcel
2862130803Smarcel	  /* Look ahead to detect nested types.  This probably should be
2863130803Smarcel	     done in the grammar, but trying seemed to introduce a lot
2864130803Smarcel	     of shift/reduce and reduce/reduce conflicts.  It's possible
2865130803Smarcel	     that it could be done, though.  Or perhaps a non-grammar, but
2866130803Smarcel	     less ad hoc, approach would work well.  */
2867130803Smarcel
2868130803Smarcel	  /* Since we do not currently have any way of distinguishing
2869130803Smarcel	     a nested type from a non-nested one (the stabs don't tell
2870130803Smarcel	     us whether a type is nested), we just ignore the
2871130803Smarcel	     containing type.  */
2872130803Smarcel
2873130803Smarcel	  p = lexptr;
2874130803Smarcel	  best_sym = sym;
2875130803Smarcel	  while (1)
2876130803Smarcel	    {
2877130803Smarcel	      /* Skip whitespace.  */
2878130803Smarcel	      while (*p == ' ' || *p == '\t' || *p == '\n')
2879130803Smarcel		++p;
2880130803Smarcel	      if (*p == ':' && p[1] == ':')
2881130803Smarcel		{
2882130803Smarcel		  /* Skip the `::'.  */
2883130803Smarcel		  p += 2;
2884130803Smarcel		  /* Skip whitespace.  */
2885130803Smarcel		  while (*p == ' ' || *p == '\t' || *p == '\n')
2886130803Smarcel		    ++p;
2887130803Smarcel		  namestart = p;
2888130803Smarcel		  while (*p == '_' || *p == '$' || (*p >= '0' && *p <= '9')
2889130803Smarcel			 || (*p >= 'a' && *p <= 'z')
2890130803Smarcel			 || (*p >= 'A' && *p <= 'Z'))
2891130803Smarcel		    ++p;
2892130803Smarcel		  if (p != namestart)
2893130803Smarcel		    {
2894130803Smarcel		      struct symbol *cur_sym;
2895130803Smarcel		      /* As big as the whole rest of the expression, which is
2896130803Smarcel			 at least big enough.  */
2897130803Smarcel		      char *ncopy = alloca (strlen (tmp)+strlen (namestart)+3);
2898130803Smarcel		      char *tmp1;
2899130803Smarcel
2900130803Smarcel		      tmp1 = ncopy;
2901130803Smarcel		      memcpy (tmp1, tmp, strlen (tmp));
2902130803Smarcel		      tmp1 += strlen (tmp);
2903130803Smarcel		      memcpy (tmp1, "::", 2);
2904130803Smarcel		      tmp1 += 2;
2905130803Smarcel		      memcpy (tmp1, namestart, p - namestart);
2906130803Smarcel		      tmp1[p - namestart] = '\0';
2907130803Smarcel		      cur_sym = lookup_symbol (ncopy, expression_context_block,
2908130803Smarcel					       VAR_DOMAIN, (int *) NULL,
2909130803Smarcel					       (struct symtab **) NULL);
2910130803Smarcel		      if (cur_sym)
2911130803Smarcel			{
2912130803Smarcel			  if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)
2913130803Smarcel			    {
2914130803Smarcel			      best_sym = cur_sym;
2915130803Smarcel			      lexptr = p;
2916130803Smarcel			    }
2917130803Smarcel			  else
2918130803Smarcel			    break;
2919130803Smarcel			}
2920130803Smarcel		      else
2921130803Smarcel			break;
2922130803Smarcel		    }
2923130803Smarcel		  else
2924130803Smarcel		    break;
2925130803Smarcel		}
2926130803Smarcel	      else
2927130803Smarcel		break;
2928130803Smarcel	    }
2929130803Smarcel
2930130803Smarcel	  yylval.tsym.type = SYMBOL_TYPE (best_sym);
2931130803Smarcel#else /* not 0 */
2932130803Smarcel	  yylval.tsym.type = SYMBOL_TYPE (sym);
2933130803Smarcel#endif /* not 0 */
2934130803Smarcel	  return TYPENAME;
2935130803Smarcel        }
2936130803Smarcel    if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
2937130803Smarcel	return TYPENAME;
2938130803Smarcel
2939130803Smarcel    /* Input names that aren't symbols but ARE valid hex numbers,
2940130803Smarcel       when the input radix permits them, can be names or numbers
2941130803Smarcel       depending on the parse.  Note we support radixes > 16 here.  */
2942130803Smarcel    if (!sym &&
2943130803Smarcel        ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
2944130803Smarcel         (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2945130803Smarcel      {
2946130803Smarcel 	YYSTYPE newlval;	/* Its value is ignored.  */
2947130803Smarcel	hextype = parse_number (tokstart, namelen, 0, &newlval);
2948130803Smarcel	if (hextype == INT)
2949130803Smarcel	  {
2950130803Smarcel	    yylval.ssym.sym = sym;
2951130803Smarcel	    yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2952130803Smarcel	    return NAME_OR_INT;
2953130803Smarcel	  }
2954130803Smarcel      }
2955130803Smarcel
2956130803Smarcel    free(uptokstart);
2957130803Smarcel    /* Any other kind of symbol */
2958130803Smarcel    yylval.ssym.sym = sym;
2959130803Smarcel    yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2960130803Smarcel    return NAME;
2961130803Smarcel  }
2962130803Smarcel}
2963130803Smarcel
2964130803Smarcelvoid
2965130803Smarcelyyerror (msg)
2966130803Smarcel     char *msg;
2967130803Smarcel{
2968130803Smarcel  if (prev_lexptr)
2969130803Smarcel    lexptr = prev_lexptr;
2970130803Smarcel
2971130803Smarcel  error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
2972130803Smarcel}
2973130803Smarcel
2974130803Smarcel
2975