OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [gdb/] [p-exp.c] - Blame information for rev 841

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
 
2 342 jeremybenn
/* A Bison parser, made by GNU Bison 2.4.1.  */
3 330 jeremybenn
 
4 342 jeremybenn
/* Skeleton implementation for Bison's Yacc-like parsers in C
5
 
6
      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7
   Free Software Foundation, Inc.
8
 
9
   This program is free software: you can redistribute it and/or modify
10 330 jeremybenn
   it under the terms of the GNU General Public License as published by
11 342 jeremybenn
   the Free Software Foundation, either version 3 of the License, or
12
   (at your option) any later version.
13
 
14 330 jeremybenn
   This program is distributed in the hope that it will be useful,
15
   but WITHOUT ANY WARRANTY; without even the implied warranty of
16
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
   GNU General Public License for more details.
18 342 jeremybenn
 
19 330 jeremybenn
   You should have received a copy of the GNU General Public License
20 342 jeremybenn
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21 330 jeremybenn
 
22 342 jeremybenn
/* As a special exception, you may create a larger work that contains
23
   part or all of the Bison parser skeleton and distribute that work
24
   under terms of your choice, so long as that work isn't itself a
25
   parser generator using the skeleton or a modified version thereof
26
   as a parser skeleton.  Alternatively, if you modify or redistribute
27
   the parser skeleton itself, you may (at your option) remove this
28
   special exception, which will cause the skeleton and the resulting
29
   Bison output files to be licensed under the GNU General Public
30
   License without this special exception.
31
 
32
   This special exception was added by the Free Software Foundation in
33
   version 2.2 of Bison.  */
34 330 jeremybenn
 
35 342 jeremybenn
/* C LALR(1) parser skeleton written by Richard Stallman, by
36
   simplifying the original so-called "semantic" parser.  */
37 330 jeremybenn
 
38
/* All symbols defined below should begin with yy or YY, to avoid
39
   infringing on user name space.  This should be done even for local
40
   variables, as they might otherwise be expanded by user macros.
41
   There are some unavoidable exceptions within include files to
42
   define necessary library symbols; they are noted "INFRINGES ON
43
   USER NAME SPACE" below.  */
44
 
45
/* Identify Bison output.  */
46
#define YYBISON 1
47
 
48 342 jeremybenn
/* Bison version.  */
49
#define YYBISON_VERSION "2.4.1"
50
 
51 330 jeremybenn
/* Skeleton name.  */
52
#define YYSKELETON_NAME "yacc.c"
53
 
54
/* Pure parsers.  */
55
#define YYPURE 0
56
 
57 342 jeremybenn
/* Push parsers.  */
58
#define YYPUSH 0
59
 
60
/* Pull parsers.  */
61
#define YYPULL 1
62
 
63 330 jeremybenn
/* Using locations.  */
64
#define YYLSP_NEEDED 0
65
 
66
 
67
 
68 342 jeremybenn
/* Copy the first part of user declarations.  */
69 330 jeremybenn
 
70 342 jeremybenn
/* Line 189 of yacc.c  */
71 330 jeremybenn
#line 45 "p-exp.y"
72
 
73
 
74
#include "defs.h"
75
#include "gdb_string.h"
76
#include <ctype.h>
77
#include "expression.h"
78
#include "value.h"
79
#include "parser-defs.h"
80
#include "language.h"
81
#include "p-lang.h"
82
#include "bfd.h" /* Required by objfiles.h.  */
83
#include "symfile.h" /* Required by objfiles.h.  */
84
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
85
#include "block.h"
86
 
87
#define parse_type builtin_type (parse_gdbarch)
88
 
89
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
90
   as well as gratuitiously global symbol names, so we can have multiple
91
   yacc generated parsers in gdb.  Note that these are only the variables
92
   produced by yacc.  If other parser generators (bison, byacc, etc) produce
93
   additional global names that conflict at link time, then those parser
94
   generators need to be fixed instead of adding those names to this list. */
95
 
96
#define yymaxdepth pascal_maxdepth
97
#define yyparse pascal_parse
98
#define yylex   pascal_lex
99
#define yyerror pascal_error
100
#define yylval  pascal_lval
101
#define yychar  pascal_char
102
#define yydebug pascal_debug
103
#define yypact  pascal_pact     
104
#define yyr1    pascal_r1                       
105
#define yyr2    pascal_r2                       
106
#define yydef   pascal_def              
107
#define yychk   pascal_chk              
108
#define yypgo   pascal_pgo              
109
#define yyact   pascal_act
110
#define yyexca  pascal_exca
111
#define yyerrflag pascal_errflag
112
#define yynerrs pascal_nerrs
113
#define yyps    pascal_ps
114
#define yypv    pascal_pv
115
#define yys     pascal_s
116
#define yy_yys  pascal_yys
117
#define yystate pascal_state
118
#define yytmp   pascal_tmp
119
#define yyv     pascal_v
120
#define yy_yyv  pascal_yyv
121
#define yyval   pascal_val
122
#define yylloc  pascal_lloc
123
#define yyreds  pascal_reds             /* With YYDEBUG defined */
124
#define yytoks  pascal_toks             /* With YYDEBUG defined */
125
#define yyname  pascal_name             /* With YYDEBUG defined */
126
#define yyrule  pascal_rule             /* With YYDEBUG defined */
127
#define yylhs   pascal_yylhs
128
#define yylen   pascal_yylen
129
#define yydefred pascal_yydefred
130
#define yydgoto pascal_yydgoto
131
#define yysindex pascal_yysindex
132
#define yyrindex pascal_yyrindex
133
#define yygindex pascal_yygindex
134
#define yytable  pascal_yytable
135
#define yycheck  pascal_yycheck
136
 
137
#ifndef YYDEBUG
138
#define YYDEBUG 1               /* Default to yydebug support */
139
#endif
140
 
141
#define YYFPRINTF parser_fprintf
142
 
143
int yyparse (void);
144
 
145
static int yylex (void);
146
 
147
void
148
yyerror (char *);
149
 
150
static char * uptok (char *, int);
151
 
152
 
153 342 jeremybenn
/* Line 189 of yacc.c  */
154
#line 155 "p-exp.c.tmp"
155
 
156 330 jeremybenn
/* Enabling traces.  */
157
#ifndef YYDEBUG
158
# define YYDEBUG 0
159
#endif
160
 
161
/* Enabling verbose error messages.  */
162
#ifdef YYERROR_VERBOSE
163
# undef YYERROR_VERBOSE
164
# define YYERROR_VERBOSE 1
165
#else
166
# define YYERROR_VERBOSE 0
167
#endif
168
 
169 342 jeremybenn
/* Enabling the token table.  */
170
#ifndef YYTOKEN_TABLE
171
# define YYTOKEN_TABLE 0
172
#endif
173
 
174
 
175
/* Tokens.  */
176
#ifndef YYTOKENTYPE
177
# define YYTOKENTYPE
178
   /* Put the tokens into the symbol table, so that GDB and other debuggers
179
      know about them.  */
180
   enum yytokentype {
181
     INT = 258,
182
     FLOAT = 259,
183
     STRING = 260,
184
     FIELDNAME = 261,
185
     NAME = 262,
186
     TYPENAME = 263,
187
     NAME_OR_INT = 264,
188
     STRUCT = 265,
189
     CLASS = 266,
190
     SIZEOF = 267,
191
     COLONCOLON = 268,
192
     ERROR = 269,
193
     VARIABLE = 270,
194
     THIS = 271,
195
     TRUEKEYWORD = 272,
196
     FALSEKEYWORD = 273,
197
     ABOVE_COMMA = 274,
198
     ASSIGN = 275,
199
     NOT = 276,
200
     OR = 277,
201
     XOR = 278,
202
     ANDAND = 279,
203
     NOTEQUAL = 280,
204
     GEQ = 281,
205
     LEQ = 282,
206
     MOD = 283,
207
     DIV = 284,
208
     RSH = 285,
209
     LSH = 286,
210
     DECREMENT = 287,
211
     INCREMENT = 288,
212
     UNARY = 289,
213
     ARROW = 290,
214
     BLOCKNAME = 291
215
   };
216
#endif
217
/* Tokens.  */
218
#define INT 258
219
#define FLOAT 259
220
#define STRING 260
221
#define FIELDNAME 261
222
#define NAME 262
223
#define TYPENAME 263
224
#define NAME_OR_INT 264
225
#define STRUCT 265
226
#define CLASS 266
227
#define SIZEOF 267
228
#define COLONCOLON 268
229
#define ERROR 269
230
#define VARIABLE 270
231
#define THIS 271
232
#define TRUEKEYWORD 272
233
#define FALSEKEYWORD 273
234
#define ABOVE_COMMA 274
235
#define ASSIGN 275
236
#define NOT 276
237
#define OR 277
238
#define XOR 278
239
#define ANDAND 279
240
#define NOTEQUAL 280
241
#define GEQ 281
242
#define LEQ 282
243
#define MOD 283
244
#define DIV 284
245
#define RSH 285
246
#define LSH 286
247
#define DECREMENT 287
248
#define INCREMENT 288
249
#define UNARY 289
250
#define ARROW 290
251
#define BLOCKNAME 291
252
 
253
 
254
 
255
 
256
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
257
typedef union YYSTYPE
258
{
259
 
260
/* Line 214 of yacc.c  */
261 330 jeremybenn
#line 131 "p-exp.y"
262 342 jeremybenn
 
263 330 jeremybenn
    LONGEST lval;
264
    struct {
265
      LONGEST val;
266
      struct type *type;
267
    } typed_val_int;
268
    struct {
269
      DOUBLEST dval;
270
      struct type *type;
271
    } typed_val_float;
272
    struct symbol *sym;
273
    struct type *tval;
274
    struct stoken sval;
275
    struct ttype tsym;
276
    struct symtoken ssym;
277
    int voidval;
278
    struct block *bval;
279
    enum exp_opcode opcode;
280
    struct internalvar *ivar;
281
 
282
    struct type **tvec;
283
    int *ivec;
284 342 jeremybenn
 
285
 
286
 
287
/* Line 214 of yacc.c  */
288
#line 289 "p-exp.c.tmp"
289
} YYSTYPE;
290
# define YYSTYPE_IS_TRIVIAL 1
291 330 jeremybenn
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
292
# define YYSTYPE_IS_DECLARED 1
293
#endif
294
 
295
 
296 342 jeremybenn
/* Copy the second part of user declarations.  */
297 330 jeremybenn
 
298 342 jeremybenn
/* Line 264 of yacc.c  */
299 330 jeremybenn
#line 155 "p-exp.y"
300
 
301
/* YYSTYPE gets defined by %union */
302
static int
303
parse_number (char *, int, int, YYSTYPE *);
304
 
305
static struct type *current_type;
306
static int leftdiv_is_integer;
307
static void push_current_type (void);
308
static void pop_current_type (void);
309
static int search_field;
310
 
311
 
312 342 jeremybenn
/* Line 264 of yacc.c  */
313
#line 314 "p-exp.c.tmp"
314 330 jeremybenn
 
315 342 jeremybenn
#ifdef short
316
# undef short
317
#endif
318 330 jeremybenn
 
319 342 jeremybenn
#ifdef YYTYPE_UINT8
320
typedef YYTYPE_UINT8 yytype_uint8;
321
#else
322
typedef unsigned char yytype_uint8;
323
#endif
324
 
325
#ifdef YYTYPE_INT8
326
typedef YYTYPE_INT8 yytype_int8;
327
#elif (defined __STDC__ || defined __C99__FUNC__ \
328
     || defined __cplusplus || defined _MSC_VER)
329
typedef signed char yytype_int8;
330
#else
331
typedef short int yytype_int8;
332
#endif
333
 
334
#ifdef YYTYPE_UINT16
335
typedef YYTYPE_UINT16 yytype_uint16;
336
#else
337
typedef unsigned short int yytype_uint16;
338
#endif
339
 
340
#ifdef YYTYPE_INT16
341
typedef YYTYPE_INT16 yytype_int16;
342
#else
343
typedef short int yytype_int16;
344
#endif
345
 
346
#ifndef YYSIZE_T
347
# ifdef __SIZE_TYPE__
348
#  define YYSIZE_T __SIZE_TYPE__
349
# elif defined size_t
350
#  define YYSIZE_T size_t
351
# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
352
     || defined __cplusplus || defined _MSC_VER)
353
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
354
#  define YYSIZE_T size_t
355
# else
356
#  define YYSIZE_T unsigned int
357 330 jeremybenn
# endif
358 342 jeremybenn
#endif
359
 
360
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
361
 
362
#ifndef YY_
363
# if YYENABLE_NLS
364
#  if ENABLE_NLS
365
#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
366
#   define YY_(msgid) dgettext ("bison-runtime", msgid)
367
#  endif
368 330 jeremybenn
# endif
369 342 jeremybenn
# ifndef YY_
370
#  define YY_(msgid) msgid
371
# endif
372
#endif
373 330 jeremybenn
 
374 342 jeremybenn
/* Suppress unused-variable warnings by "using" E.  */
375
#if ! defined lint || defined __GNUC__
376
# define YYUSE(e) ((void) (e))
377
#else
378
# define YYUSE(e) /* empty */
379
#endif
380
 
381
/* Identity function, used to suppress warnings about constant conditions.  */
382
#ifndef lint
383
# define YYID(n) (n)
384
#else
385
#if (defined __STDC__ || defined __C99__FUNC__ \
386
     || defined __cplusplus || defined _MSC_VER)
387
static int
388
YYID (int yyi)
389
#else
390
static int
391
YYID (yyi)
392
    int yyi;
393
#endif
394
{
395
  return yyi;
396
}
397
#endif
398
 
399
#if ! defined yyoverflow || YYERROR_VERBOSE
400
 
401 330 jeremybenn
/* The parser invokes alloca or xmalloc; define the necessary symbols.  */
402
 
403
# ifdef YYSTACK_USE_ALLOCA
404
#  if YYSTACK_USE_ALLOCA
405
#   ifdef __GNUC__
406
#    define YYSTACK_ALLOC __builtin_alloca
407 342 jeremybenn
#   elif defined __BUILTIN_VA_ARG_INCR
408
#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
409
#   elif defined _AIX
410
#    define YYSTACK_ALLOC __alloca
411
#   elif defined _MSC_VER
412
#    define alloca _alloca
413
#   else
414
#    define YYSTACK_ALLOC alloca
415
#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
416
     || defined __cplusplus || defined _MSC_VER)
417
#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
418
#     ifndef _STDLIB_H
419
#      define _STDLIB_H 1
420
#     endif
421
#    endif
422 330 jeremybenn
#   endif
423
#  endif
424
# endif
425
 
426
# ifdef YYSTACK_ALLOC
427 342 jeremybenn
   /* Pacify GCC's `empty if-body' warning.  */
428
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
429
#  ifndef YYSTACK_ALLOC_MAXIMUM
430
    /* The OS might guarantee only one guard page at the bottom of the stack,
431
       and a page size can be as small as 4096 bytes.  So we cannot safely
432
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
433
       to allow for a few compiler-allocated temporary stack slots.  */
434
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
435
#  endif
436 330 jeremybenn
# else
437 342 jeremybenn
#  define YYSTACK_ALLOC YYMALLOC
438
#  define YYSTACK_FREE YYFREE
439
#  ifndef YYSTACK_ALLOC_MAXIMUM
440
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
441
#  endif
442
#  if (defined __cplusplus && ! defined _STDLIB_H \
443
       && ! ((defined YYMALLOC || defined xmalloc) \
444
             && (defined YYFREE || defined xfree)))
445 330 jeremybenn
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
446 342 jeremybenn
#   ifndef _STDLIB_H
447
#    define _STDLIB_H 1
448
#   endif
449 330 jeremybenn
#  endif
450 342 jeremybenn
#  ifndef YYMALLOC
451
#   define YYMALLOC xmalloc
452
#   if ! defined xmalloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
453
     || defined __cplusplus || defined _MSC_VER)
454
void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
455
#   endif
456
#  endif
457
#  ifndef YYFREE
458
#   define YYFREE xfree
459
#   if ! defined xfree && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
460
     || defined __cplusplus || defined _MSC_VER)
461
void xfree (void *); /* INFRINGES ON USER NAME SPACE */
462
#   endif
463
#  endif
464 330 jeremybenn
# endif
465 342 jeremybenn
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
466 330 jeremybenn
 
467
 
468 342 jeremybenn
#if (! defined yyoverflow \
469
     && (! defined __cplusplus \
470
         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
471 330 jeremybenn
 
472
/* A type that is properly aligned for any stack member.  */
473
union yyalloc
474
{
475 342 jeremybenn
  yytype_int16 yyss_alloc;
476
  YYSTYPE yyvs_alloc;
477
};
478 330 jeremybenn
 
479
/* The size of the maximum gap between one aligned stack and the next.  */
480
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
481
 
482
/* The size of an array large to enough to hold all stacks, each with
483
   N elements.  */
484
# define YYSTACK_BYTES(N) \
485 342 jeremybenn
     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
486 330 jeremybenn
      + YYSTACK_GAP_MAXIMUM)
487
 
488
/* Copy COUNT objects from FROM to TO.  The source and destination do
489
   not overlap.  */
490
# ifndef YYCOPY
491 342 jeremybenn
#  if defined __GNUC__ && 1 < __GNUC__
492 330 jeremybenn
#   define YYCOPY(To, From, Count) \
493
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
494
#  else
495
#   define YYCOPY(To, From, Count)              \
496
      do                                        \
497
        {                                       \
498 342 jeremybenn
          YYSIZE_T yyi;                         \
499 330 jeremybenn
          for (yyi = 0; yyi < (Count); yyi++)    \
500
            (To)[yyi] = (From)[yyi];            \
501
        }                                       \
502 342 jeremybenn
      while (YYID (0))
503 330 jeremybenn
#  endif
504
# endif
505
 
506
/* Relocate STACK from its old location to the new one.  The
507
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
508
   elements in the stack, and YYPTR gives the new location of the
509
   stack.  Advance YYPTR to a properly aligned location for the next
510
   stack.  */
511 342 jeremybenn
# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
512 330 jeremybenn
    do                                                                  \
513
      {                                                                 \
514
        YYSIZE_T yynewbytes;                                            \
515 342 jeremybenn
        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
516
        Stack = &yyptr->Stack_alloc;                                    \
517 330 jeremybenn
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
518
        yyptr += yynewbytes / sizeof (*yyptr);                          \
519
      }                                                                 \
520 342 jeremybenn
    while (YYID (0))
521 330 jeremybenn
 
522
#endif
523
 
524 342 jeremybenn
/* YYFINAL -- State number of the termination state.  */
525 330 jeremybenn
#define YYFINAL  3
526
/* YYLAST -- Last index in YYTABLE.  */
527
#define YYLAST   387
528
 
529 342 jeremybenn
/* YYNTOKENS -- Number of terminals.  */
530 330 jeremybenn
#define YYNTOKENS  52
531 342 jeremybenn
/* YYNNTS -- Number of nonterminals.  */
532 330 jeremybenn
#define YYNNTS  20
533 342 jeremybenn
/* YYNRULES -- Number of rules.  */
534 330 jeremybenn
#define YYNRULES  74
535 342 jeremybenn
/* YYNRULES -- Number of states.  */
536 330 jeremybenn
#define YYNSTATES  123
537
 
538
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
539
#define YYUNDEFTOK  2
540
#define YYMAXUTOK   291
541
 
542 342 jeremybenn
#define YYTRANSLATE(YYX)                                                \
543 330 jeremybenn
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
544
 
545
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
546 342 jeremybenn
static const yytype_uint8 yytranslate[] =
547 330 jeremybenn
{
548
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
549
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
550
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
551
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
552
      46,    50,    39,    37,    19,    38,    44,    40,     2,     2,
553
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
554
      28,    26,    29,     2,    36,     2,     2,     2,     2,     2,
555
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
556
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
557
       2,    45,     2,    51,    48,     2,     2,     2,     2,     2,
558
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
559
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
560
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
561
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
562
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
563
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
564
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
565
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
566
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
567
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
568
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
569
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
570
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
571
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
572
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
573
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
574
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
575
      15,    16,    17,    18,    20,    21,    22,    23,    24,    25,
576
      27,    30,    31,    32,    33,    34,    35,    41,    42,    43,
577
      47,    49
578
};
579
 
580
#if YYDEBUG
581
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
582
   YYRHS.  */
583 342 jeremybenn
static const yytype_uint8 yyprhs[] =
584 330 jeremybenn
{
585
       0,     0,     3,     4,     7,     9,    11,    13,    15,    19,
586
      22,    25,    28,    31,    36,    41,    42,    47,    48,    54,
587
      55,    61,    62,    64,    68,    73,    77,    81,    82,    87,
588
      91,    95,    99,   103,   107,   111,   115,   119,   123,   127,
589
     131,   135,   139,   143,   147,   151,   153,   155,   157,   159,
590
     161,   163,   165,   170,   175,   177,   179,   181,   185,   189,
591
     193,   195,   198,   200,   202,   204,   207,   209,   212,   215,
592
     217,   219,   221,   223,   225
593
};
594
 
595 342 jeremybenn
/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
596
static const yytype_int8 yyrhs[] =
597 330 jeremybenn
{
598
      53,     0,    -1,    -1,    54,    55,    -1,    57,    -1,    56,
599
      -1,    68,    -1,    58,    -1,    57,    19,    58,    -1,    58,
600
      48,    -1,    36,    58,    -1,    38,    58,    -1,    22,    58,
601
      -1,    42,    46,    58,    50,    -1,    41,    46,    58,    50,
602
      -1,    -1,    58,    44,    59,     6,    -1,    -1,    58,    45,
603
      60,    57,    51,    -1,    -1,    58,    46,    61,    62,    50,
604
      -1,    -1,    58,    -1,    62,    19,    58,    -1,    68,    46,
605
      58,    50,    -1,    46,    57,    50,    -1,    58,    39,    58,
606
      -1,    -1,    58,    40,    63,    58,    -1,    58,    33,    58,
607
      -1,    58,    32,    58,    -1,    58,    37,    58,    -1,    58,
608
      38,    58,    -1,    58,    35,    58,    -1,    58,    34,    58,
609
      -1,    58,    26,    58,    -1,    58,    27,    58,    -1,    58,
610
      31,    58,    -1,    58,    30,    58,    -1,    58,    28,    58,
611
      -1,    58,    29,    58,    -1,    58,    25,    58,    -1,    58,
612
      24,    58,    -1,    58,    23,    58,    -1,    58,    21,    58,
613
      -1,    17,    -1,    18,    -1,     3,    -1,     9,    -1,     4,
614
      -1,    65,    -1,    15,    -1,    12,    46,    68,    50,    -1,
615
      12,    46,    58,    50,    -1,     5,    -1,    16,    -1,    49,
616
      -1,    64,    13,    70,    -1,    64,    13,    70,    -1,    69,
617
      13,    70,    -1,    66,    -1,    13,    70,    -1,    71,    -1,
618
      69,    -1,    67,    -1,    48,    69,    -1,     8,    -1,    10,
619
      70,    -1,    11,    70,    -1,     7,    -1,    49,    -1,     8,
620
      -1,     9,    -1,     7,    -1,    49,    -1
621
};
622
 
623
/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
624 342 jeremybenn
static const yytype_uint16 yyrline[] =
625 330 jeremybenn
{
626
       0,   235,   235,   235,   243,   244,   247,   254,   255,   260,
627
     266,   272,   276,   280,   284,   288,   288,   303,   301,   331,
628
     328,   343,   344,   346,   350,   365,   371,   375,   375,   395,
629
     399,   403,   407,   411,   415,   419,   425,   431,   437,   443,
630
     449,   455,   459,   463,   467,   471,   478,   485,   493,   505,
631
     513,   516,   520,   528,   531,   556,   583,   600,   610,   625,
632
     640,   641,   669,   738,   749,   753,   755,   757,   760,   768,
633
     769,   770,   771,   774,   775
634
};
635
#endif
636
 
637 342 jeremybenn
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
638
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
639
   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
640 330 jeremybenn
static const char *const yytname[] =
641
{
642
  "$end", "error", "$undefined", "INT", "FLOAT", "STRING", "FIELDNAME",
643
  "NAME", "TYPENAME", "NAME_OR_INT", "STRUCT", "CLASS", "SIZEOF",
644
  "COLONCOLON", "ERROR", "VARIABLE", "THIS", "TRUEKEYWORD", "FALSEKEYWORD",
645
  "','", "ABOVE_COMMA", "ASSIGN", "NOT", "OR", "XOR", "ANDAND", "'='",
646
  "NOTEQUAL", "'<'", "'>'", "GEQ", "LEQ", "MOD", "DIV", "RSH", "LSH",
647
  "'@'", "'+'", "'-'", "'*'", "'/'", "DECREMENT", "INCREMENT", "UNARY",
648
  "'.'", "'['", "'('", "ARROW", "'^'", "BLOCKNAME", "')'", "']'",
649 342 jeremybenn
  "$accept", "start", "$@1", "normal_start", "type_exp", "exp1", "exp",
650
  "$@2", "$@3", "$@4", "arglist", "$@5", "block", "variable",
651
  "qualified_name", "ptype", "type", "typebase", "name",
652
  "name_not_typename", 0
653 330 jeremybenn
};
654
#endif
655
 
656
# ifdef YYPRINT
657
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
658
   token YYLEX-NUM.  */
659 342 jeremybenn
static const yytype_uint16 yytoknum[] =
660 330 jeremybenn
{
661
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
662
     265,   266,   267,   268,   269,   270,   271,   272,   273,    44,
663
     274,   275,   276,   277,   278,   279,    61,   280,    60,    62,
664
     281,   282,   283,   284,   285,   286,    64,    43,    45,    42,
665
      47,   287,   288,   289,    46,    91,    40,   290,    94,   291,
666
      41,    93
667
};
668
# endif
669
 
670
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
671 342 jeremybenn
static const yytype_uint8 yyr1[] =
672 330 jeremybenn
{
673
       0,    52,    54,    53,    55,    55,    56,    57,    57,    58,
674
      58,    58,    58,    58,    58,    59,    58,    60,    58,    61,
675
      58,    62,    62,    62,    58,    58,    58,    63,    58,    58,
676
      58,    58,    58,    58,    58,    58,    58,    58,    58,    58,
677
      58,    58,    58,    58,    58,    58,    58,    58,    58,    58,
678
      58,    58,    58,    58,    58,    58,    64,    64,    65,    66,
679
      65,    65,    65,    67,    68,    69,    69,    69,    69,    70,
680
      70,    70,    70,    71,    71
681
};
682
 
683
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
684 342 jeremybenn
static const yytype_uint8 yyr2[] =
685 330 jeremybenn
{
686
       0,     2,     0,     2,     1,     1,     1,     1,     3,     2,
687
       2,     2,     2,     4,     4,     0,     4,     0,     5,     0,
688
       5,     0,     1,     3,     4,     3,     3,     0,     4,     3,
689
       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
690
       3,     3,     3,     3,     3,     1,     1,     1,     1,     1,
691
       1,     1,     4,     4,     1,     1,     1,     3,     3,     3,
692
       1,     2,     1,     1,     1,     2,     1,     2,     2,     1,
693
       1,     1,     1,     1,     1
694
};
695
 
696
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
697
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
698
   means the default is an error.  */
699 342 jeremybenn
static const yytype_uint8 yydefact[] =
700 330 jeremybenn
{
701
       2,     0,     0,     1,    47,    49,    54,    73,    66,    48,
702
       0,     0,     0,     0,    51,    55,    45,    46,     0,     0,
703
       0,     0,     0,     0,     0,    74,     3,     5,     4,     7,
704
       0,    50,    60,    64,     6,    63,    62,    69,    71,    72,
705
      70,    67,    68,     0,    61,    12,     0,    10,    11,     0,
706
       0,     0,    65,     0,     0,     0,     0,     0,     0,     0,
707
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
708
       0,    27,    15,    17,    19,     9,     0,     0,     0,     0,
709
       0,     0,     0,    25,     8,    44,    43,    42,    41,    35,
710
      36,    39,    40,    38,    37,    30,    29,    34,    33,    31,
711
      32,    26,     0,     0,     0,    21,    58,     0,    59,    53,
712
      52,    14,    13,    28,    16,     0,    22,     0,    24,    18,
713
       0,    20,    23
714
};
715
 
716 342 jeremybenn
/* YYDEFGOTO[NTERM-NUM].  */
717
static const yytype_int8 yydefgoto[] =
718 330 jeremybenn
{
719
      -1,     1,     2,    26,    27,    28,    29,   103,   104,   105,
720
     117,   102,    30,    31,    32,    33,    46,    35,    41,    36
721
};
722
 
723
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
724
   STATE-NUM.  */
725
#define YYPACT_NINF -39
726 342 jeremybenn
static const yytype_int16 yypact[] =
727 330 jeremybenn
{
728
     -39,     9,    88,   -39,   -39,   -39,   -39,   -39,   -39,   -39,
729
       4,     4,   -31,     4,   -39,   -39,   -39,   -39,    88,    88,
730
      88,   -26,   -23,    88,     8,    11,   -39,   -39,    14,   229,
731
      15,   -39,   -39,   -39,   -16,    21,   -39,   -39,   -39,   -39,
732
     -39,   -39,   -39,    88,   -39,   -38,   -16,   -38,   -38,    88,
733
      88,     7,   -39,    88,    88,    88,    88,    88,    88,    88,
734
      88,    88,    88,    88,    88,    88,    88,    88,    88,    88,
735
      88,   -39,   -39,   -39,   -39,   -39,     4,    88,     4,   117,
736
     -29,   145,   173,   -39,   229,   229,   254,   278,   301,   322,
737
     322,   339,   339,   339,   339,    27,    27,    27,    27,    68,
738
      68,   -38,    88,    52,    88,    88,    48,   201,   -39,   -39,
739
     -39,   -39,   -39,   -38,   -39,     3,   229,    10,   -39,   -39,
740
      88,   -39,   229
741
};
742
 
743
/* YYPGOTO[NTERM-NUM].  */
744 342 jeremybenn
static const yytype_int8 yypgoto[] =
745 330 jeremybenn
{
746
     -39,   -39,   -39,   -39,   -39,   -19,   -18,   -39,   -39,   -39,
747
     -39,   -39,   -39,   -39,   -39,   -39,    12,    38,    -8,   -39
748
};
749
 
750
/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
751
   positive, shift that token.  If negative, reduce the rule which
752
   number is the opposite.  If zero, do what YYDEFACT says.
753
   If YYTABLE_NINF, syntax error.  */
754
#define YYTABLE_NINF -58
755 342 jeremybenn
static const yytype_int8 yytable[] =
756 330 jeremybenn
{
757
      45,    47,    48,    42,    51,    44,    72,    73,    74,     3,
758
      75,    37,    38,    39,    34,    43,     8,    77,    10,    11,
759
      49,   110,    53,    50,   -56,    79,    53,     0,    76,   120,
760
      77,    81,    82,    53,    78,    84,    85,    86,    87,    88,
761
      89,    90,    91,    92,    93,    94,    95,    96,    97,    98,
762
      99,   100,   101,    40,   119,    80,    24,    83,   114,   107,
763
     121,   -57,    52,     0,    68,    69,    70,    71,   106,     0,
764
     108,    72,    73,    74,     0,    75,     0,     0,     0,     0,
765
       0,     0,     0,     0,   113,   115,     0,   116,     0,     0,
766
       0,     4,     5,     6,     0,     7,     8,     9,    10,    11,
767
      12,    13,   122,    14,    15,    16,    17,    70,    71,     0,
768
      18,     0,    72,    73,    74,     0,    75,     0,     0,     0,
769
       0,     0,     0,     0,    19,     0,    20,     0,     0,    21,
770
      22,     0,     0,     0,    23,     0,    24,    25,    54,     0,
771
      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
772
      65,    66,    67,     0,    68,    69,    70,    71,     0,     0,
773
       0,    72,    73,    74,     0,    75,    54,   109,    55,    56,
774
      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
775
      67,     0,    68,    69,    70,    71,     0,     0,     0,    72,
776
      73,    74,     0,    75,    54,   111,    55,    56,    57,    58,
777
      59,    60,    61,    62,    63,    64,    65,    66,    67,     0,
778
      68,    69,    70,    71,     0,     0,     0,    72,    73,    74,
779
       0,    75,    54,   112,    55,    56,    57,    58,    59,    60,
780
      61,    62,    63,    64,    65,    66,    67,     0,    68,    69,
781
      70,    71,     0,     0,     0,    72,    73,    74,     0,    75,
782
      54,   118,    55,    56,    57,    58,    59,    60,    61,    62,
783
      63,    64,    65,    66,    67,     0,    68,    69,    70,    71,
784
       0,     0,     0,    72,    73,    74,     0,    75,    56,    57,
785
      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
786
       0,    68,    69,    70,    71,     0,     0,     0,    72,    73,
787
      74,     0,    75,    57,    58,    59,    60,    61,    62,    63,
788
      64,    65,    66,    67,     0,    68,    69,    70,    71,     0,
789
       0,     0,    72,    73,    74,     0,    75,    58,    59,    60,
790
      61,    62,    63,    64,    65,    66,    67,     0,    68,    69,
791
      70,    71,     0,     0,     0,    72,    73,    74,     0,    75,
792
      60,    61,    62,    63,    64,    65,    66,    67,     0,    68,
793
      69,    70,    71,     0,     0,     0,    72,    73,    74,     0,
794
      75,    64,    65,    66,    67,     0,    68,    69,    70,    71,
795
       0,     0,     0,    72,    73,    74,     0,    75
796
};
797
 
798 342 jeremybenn
static const yytype_int8 yycheck[] =
799 330 jeremybenn
{
800
      18,    19,    20,    11,    23,    13,    44,    45,    46,     0,
801
      48,     7,     8,     9,     2,    46,     8,    46,    10,    11,
802
      46,    50,    19,    46,    13,    43,    19,    -1,    13,    19,
803
      46,    49,    50,    19,    13,    53,    54,    55,    56,    57,
804
      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
805
      68,    69,    70,    49,    51,    43,    48,    50,     6,    77,
806
      50,    13,    24,    -1,    37,    38,    39,    40,    76,    -1,
807
      78,    44,    45,    46,    -1,    48,    -1,    -1,    -1,    -1,
808
      -1,    -1,    -1,    -1,   102,   104,    -1,   105,    -1,    -1,
809
      -1,     3,     4,     5,    -1,     7,     8,     9,    10,    11,
810
      12,    13,   120,    15,    16,    17,    18,    39,    40,    -1,
811
      22,    -1,    44,    45,    46,    -1,    48,    -1,    -1,    -1,
812
      -1,    -1,    -1,    -1,    36,    -1,    38,    -1,    -1,    41,
813
      42,    -1,    -1,    -1,    46,    -1,    48,    49,    21,    -1,
814
      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
815
      33,    34,    35,    -1,    37,    38,    39,    40,    -1,    -1,
816
      -1,    44,    45,    46,    -1,    48,    21,    50,    23,    24,
817
      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
818
      35,    -1,    37,    38,    39,    40,    -1,    -1,    -1,    44,
819
      45,    46,    -1,    48,    21,    50,    23,    24,    25,    26,
820
      27,    28,    29,    30,    31,    32,    33,    34,    35,    -1,
821
      37,    38,    39,    40,    -1,    -1,    -1,    44,    45,    46,
822
      -1,    48,    21,    50,    23,    24,    25,    26,    27,    28,
823
      29,    30,    31,    32,    33,    34,    35,    -1,    37,    38,
824
      39,    40,    -1,    -1,    -1,    44,    45,    46,    -1,    48,
825
      21,    50,    23,    24,    25,    26,    27,    28,    29,    30,
826
      31,    32,    33,    34,    35,    -1,    37,    38,    39,    40,
827
      -1,    -1,    -1,    44,    45,    46,    -1,    48,    24,    25,
828
      26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
829
      -1,    37,    38,    39,    40,    -1,    -1,    -1,    44,    45,
830
      46,    -1,    48,    25,    26,    27,    28,    29,    30,    31,
831
      32,    33,    34,    35,    -1,    37,    38,    39,    40,    -1,
832
      -1,    -1,    44,    45,    46,    -1,    48,    26,    27,    28,
833
      29,    30,    31,    32,    33,    34,    35,    -1,    37,    38,
834
      39,    40,    -1,    -1,    -1,    44,    45,    46,    -1,    48,
835
      28,    29,    30,    31,    32,    33,    34,    35,    -1,    37,
836
      38,    39,    40,    -1,    -1,    -1,    44,    45,    46,    -1,
837
      48,    32,    33,    34,    35,    -1,    37,    38,    39,    40,
838
      -1,    -1,    -1,    44,    45,    46,    -1,    48
839
};
840
 
841
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
842
   symbol of state STATE-NUM.  */
843 342 jeremybenn
static const yytype_uint8 yystos[] =
844 330 jeremybenn
{
845
       0,    53,    54,     0,     3,     4,     5,     7,     8,     9,
846
      10,    11,    12,    13,    15,    16,    17,    18,    22,    36,
847
      38,    41,    42,    46,    48,    49,    55,    56,    57,    58,
848
      64,    65,    66,    67,    68,    69,    71,     7,     8,     9,
849
      49,    70,    70,    46,    70,    58,    68,    58,    58,    46,
850
      46,    57,    69,    19,    21,    23,    24,    25,    26,    27,
851
      28,    29,    30,    31,    32,    33,    34,    35,    37,    38,
852
      39,    40,    44,    45,    46,    48,    13,    46,    13,    58,
853
      68,    58,    58,    50,    58,    58,    58,    58,    58,    58,
854
      58,    58,    58,    58,    58,    58,    58,    58,    58,    58,
855
      58,    58,    63,    59,    60,    61,    70,    58,    70,    50,
856
      50,    50,    50,    58,     6,    57,    58,    62,    50,    51,
857
      19,    50,    58
858
};
859
 
860
#define yyerrok         (yyerrstatus = 0)
861
#define yyclearin       (yychar = YYEMPTY)
862
#define YYEMPTY         (-2)
863
#define YYEOF           0
864
 
865
#define YYACCEPT        goto yyacceptlab
866
#define YYABORT         goto yyabortlab
867
#define YYERROR         goto yyerrorlab
868
 
869
 
870
/* Like YYERROR except do call yyerror.  This remains here temporarily
871
   to ease the transition to the new meaning of YYERROR, for GCC.
872
   Once GCC version 2 has supplanted version 1, this can go.  */
873
 
874
#define YYFAIL          goto yyerrlab
875
 
876
#define YYRECOVERING()  (!!yyerrstatus)
877
 
878
#define YYBACKUP(Token, Value)                                  \
879
do                                                              \
880
  if (yychar == YYEMPTY && yylen == 1)                          \
881
    {                                                           \
882
      yychar = (Token);                                         \
883
      yylval = (Value);                                         \
884
      yytoken = YYTRANSLATE (yychar);                           \
885 342 jeremybenn
      YYPOPSTACK (1);                                           \
886 330 jeremybenn
      goto yybackup;                                            \
887
    }                                                           \
888
  else                                                          \
889 342 jeremybenn
    {                                                           \
890
      yyerror (YY_("syntax error: cannot back up")); \
891 330 jeremybenn
      YYERROR;                                                  \
892
    }                                                           \
893 342 jeremybenn
while (YYID (0))
894 330 jeremybenn
 
895 342 jeremybenn
 
896 330 jeremybenn
#define YYTERROR        1
897
#define YYERRCODE       256
898
 
899
 
900 342 jeremybenn
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
901
   If N is 0, then set CURRENT to the empty location which ends
902
   the previous symbol: RHS[0] (always defined).  */
903
 
904
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
905 330 jeremybenn
#ifndef YYLLOC_DEFAULT
906 342 jeremybenn
# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
907
    do                                                                  \
908
      if (YYID (N))                                                    \
909
        {                                                               \
910
          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
911
          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
912
          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
913
          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
914
        }                                                               \
915
      else                                                              \
916
        {                                                               \
917
          (Current).first_line   = (Current).last_line   =              \
918
            YYRHSLOC (Rhs, 0).last_line;                         \
919
          (Current).first_column = (Current).last_column =              \
920
            YYRHSLOC (Rhs, 0).last_column;                               \
921
        }                                                               \
922
    while (YYID (0))
923 330 jeremybenn
#endif
924
 
925 342 jeremybenn
 
926
/* YY_LOCATION_PRINT -- Print the location on the stream.
927
   This macro was not mandated originally: define only if we know
928
   we won't break user code: when these are the locations we know.  */
929
 
930
#ifndef YY_LOCATION_PRINT
931
# if YYLTYPE_IS_TRIVIAL
932
#  define YY_LOCATION_PRINT(File, Loc)                  \
933
     fprintf (File, "%d.%d-%d.%d",                      \
934
              (Loc).first_line, (Loc).first_column,     \
935
              (Loc).last_line,  (Loc).last_column)
936
# else
937
#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
938
# endif
939
#endif
940
 
941
 
942 330 jeremybenn
/* YYLEX -- calling `yylex' with the right arguments.  */
943
 
944
#ifdef YYLEX_PARAM
945
# define YYLEX yylex (YYLEX_PARAM)
946
#else
947
# define YYLEX yylex ()
948
#endif
949
 
950
/* Enable debugging if requested.  */
951
#if YYDEBUG
952
 
953
# ifndef YYFPRINTF
954
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
955
#  define YYFPRINTF fprintf
956
# endif
957
 
958
# define YYDPRINTF(Args)                        \
959
do {                                            \
960
  if (yydebug)                                  \
961
    YYFPRINTF Args;                             \
962 342 jeremybenn
} while (YYID (0))
963 330 jeremybenn
 
964 342 jeremybenn
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
965
do {                                                                      \
966
  if (yydebug)                                                            \
967
    {                                                                     \
968
      YYFPRINTF (stderr, "%s ", Title);                                   \
969
      yy_symbol_print (stderr,                                            \
970
                  Type, Value); \
971
      YYFPRINTF (stderr, "\n");                                           \
972
    }                                                                     \
973
} while (YYID (0))
974 330 jeremybenn
 
975
 
976 342 jeremybenn
/*--------------------------------.
977
| Print this symbol on YYOUTPUT.  |
978
`--------------------------------*/
979
 
980
/*ARGSUSED*/
981
#if (defined __STDC__ || defined __C99__FUNC__ \
982
     || defined __cplusplus || defined _MSC_VER)
983
static void
984
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
985
#else
986
static void
987
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
988
    FILE *yyoutput;
989
    int yytype;
990
    YYSTYPE const * const yyvaluep;
991
#endif
992
{
993
  if (!yyvaluep)
994
    return;
995
# ifdef YYPRINT
996
  if (yytype < YYNTOKENS)
997
    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
998
# else
999
  YYUSE (yyoutput);
1000
# endif
1001
  switch (yytype)
1002
    {
1003
      default:
1004
        break;
1005
    }
1006
}
1007
 
1008
 
1009
/*--------------------------------.
1010
| Print this symbol on YYOUTPUT.  |
1011
`--------------------------------*/
1012
 
1013
#if (defined __STDC__ || defined __C99__FUNC__ \
1014
     || defined __cplusplus || defined _MSC_VER)
1015
static void
1016
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1017
#else
1018
static void
1019
yy_symbol_print (yyoutput, yytype, yyvaluep)
1020
    FILE *yyoutput;
1021
    int yytype;
1022
    YYSTYPE const * const yyvaluep;
1023
#endif
1024
{
1025
  if (yytype < YYNTOKENS)
1026
    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1027
  else
1028
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1029
 
1030
  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1031
  YYFPRINTF (yyoutput, ")");
1032
}
1033
 
1034 330 jeremybenn
/*------------------------------------------------------------------.
1035
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1036
| TOP (included).                                                   |
1037
`------------------------------------------------------------------*/
1038
 
1039 342 jeremybenn
#if (defined __STDC__ || defined __C99__FUNC__ \
1040
     || defined __cplusplus || defined _MSC_VER)
1041 330 jeremybenn
static void
1042 342 jeremybenn
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1043 330 jeremybenn
#else
1044
static void
1045 342 jeremybenn
yy_stack_print (yybottom, yytop)
1046
    yytype_int16 *yybottom;
1047
    yytype_int16 *yytop;
1048 330 jeremybenn
#endif
1049
{
1050
  YYFPRINTF (stderr, "Stack now");
1051 342 jeremybenn
  for (; yybottom <= yytop; yybottom++)
1052
    {
1053
      int yybot = *yybottom;
1054
      YYFPRINTF (stderr, " %d", yybot);
1055
    }
1056 330 jeremybenn
  YYFPRINTF (stderr, "\n");
1057
}
1058
 
1059
# define YY_STACK_PRINT(Bottom, Top)                            \
1060
do {                                                            \
1061
  if (yydebug)                                                  \
1062
    yy_stack_print ((Bottom), (Top));                           \
1063 342 jeremybenn
} while (YYID (0))
1064 330 jeremybenn
 
1065
 
1066
/*------------------------------------------------.
1067
| Report that the YYRULE is going to be reduced.  |
1068
`------------------------------------------------*/
1069
 
1070 342 jeremybenn
#if (defined __STDC__ || defined __C99__FUNC__ \
1071
     || defined __cplusplus || defined _MSC_VER)
1072 330 jeremybenn
static void
1073 342 jeremybenn
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1074 330 jeremybenn
#else
1075
static void
1076 342 jeremybenn
yy_reduce_print (yyvsp, yyrule)
1077
    YYSTYPE *yyvsp;
1078 330 jeremybenn
    int yyrule;
1079
#endif
1080
{
1081 342 jeremybenn
  int yynrhs = yyr2[yyrule];
1082 330 jeremybenn
  int yyi;
1083 342 jeremybenn
  unsigned long int yylno = yyrline[yyrule];
1084
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1085
             yyrule - 1, yylno);
1086
  /* The symbols being reduced.  */
1087
  for (yyi = 0; yyi < yynrhs; yyi++)
1088
    {
1089
      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
1090
      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1091
                       &(yyvsp[(yyi + 1) - (yynrhs)])
1092
                                       );
1093
      YYFPRINTF (stderr, "\n");
1094
    }
1095 330 jeremybenn
}
1096
 
1097
# define YY_REDUCE_PRINT(Rule)          \
1098
do {                                    \
1099
  if (yydebug)                          \
1100 342 jeremybenn
    yy_reduce_print (yyvsp, Rule); \
1101
} while (YYID (0))
1102 330 jeremybenn
 
1103
/* Nonzero means print parse trace.  It is left uninitialized so that
1104
   multiple parsers can coexist.  */
1105
int yydebug;
1106
#else /* !YYDEBUG */
1107
# define YYDPRINTF(Args)
1108 342 jeremybenn
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1109 330 jeremybenn
# define YY_STACK_PRINT(Bottom, Top)
1110
# define YY_REDUCE_PRINT(Rule)
1111
#endif /* !YYDEBUG */
1112
 
1113
 
1114
/* YYINITDEPTH -- initial size of the parser's stacks.  */
1115
#ifndef YYINITDEPTH
1116
# define YYINITDEPTH 200
1117
#endif
1118
 
1119
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1120
   if the built-in stack extension method is used).
1121
 
1122
   Do not make this value too large; the results are undefined if
1123 342 jeremybenn
   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1124 330 jeremybenn
   evaluated with infinite-precision integer arithmetic.  */
1125
 
1126
#ifndef YYMAXDEPTH
1127
# define YYMAXDEPTH 10000
1128
#endif
1129
 
1130
 
1131
 
1132
#if YYERROR_VERBOSE
1133
 
1134
# ifndef yystrlen
1135 342 jeremybenn
#  if defined __GLIBC__ && defined _STRING_H
1136 330 jeremybenn
#   define yystrlen strlen
1137
#  else
1138
/* Return the length of YYSTR.  */
1139 342 jeremybenn
#if (defined __STDC__ || defined __C99__FUNC__ \
1140
     || defined __cplusplus || defined _MSC_VER)
1141 330 jeremybenn
static YYSIZE_T
1142
yystrlen (const char *yystr)
1143 342 jeremybenn
#else
1144
static YYSIZE_T
1145 330 jeremybenn
yystrlen (yystr)
1146 342 jeremybenn
    const char *yystr;
1147
#endif
1148 330 jeremybenn
{
1149 342 jeremybenn
  YYSIZE_T yylen;
1150
  for (yylen = 0; yystr[yylen]; yylen++)
1151 330 jeremybenn
    continue;
1152 342 jeremybenn
  return yylen;
1153 330 jeremybenn
}
1154
#  endif
1155
# endif
1156
 
1157
# ifndef yystpcpy
1158 342 jeremybenn
#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1159 330 jeremybenn
#   define yystpcpy stpcpy
1160
#  else
1161
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1162
   YYDEST.  */
1163 342 jeremybenn
#if (defined __STDC__ || defined __C99__FUNC__ \
1164
     || defined __cplusplus || defined _MSC_VER)
1165 330 jeremybenn
static char *
1166
yystpcpy (char *yydest, const char *yysrc)
1167 342 jeremybenn
#else
1168
static char *
1169 330 jeremybenn
yystpcpy (yydest, yysrc)
1170 342 jeremybenn
    char *yydest;
1171
    const char *yysrc;
1172
#endif
1173 330 jeremybenn
{
1174 342 jeremybenn
  char *yyd = yydest;
1175
  const char *yys = yysrc;
1176 330 jeremybenn
 
1177
  while ((*yyd++ = *yys++) != '\0')
1178
    continue;
1179
 
1180
  return yyd - 1;
1181
}
1182
#  endif
1183
# endif
1184
 
1185 342 jeremybenn
# ifndef yytnamerr
1186
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1187
   quotes and backslashes, so that it's suitable for yyerror.  The
1188
   heuristic is that double-quoting is unnecessary unless the string
1189
   contains an apostrophe, a comma, or backslash (other than
1190
   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1191
   null, do not copy; instead, return the length of what the result
1192
   would have been.  */
1193
static YYSIZE_T
1194
yytnamerr (char *yyres, const char *yystr)
1195
{
1196
  if (*yystr == '"')
1197
    {
1198
      YYSIZE_T yyn = 0;
1199
      char const *yyp = yystr;
1200 330 jeremybenn
 
1201 342 jeremybenn
      for (;;)
1202
        switch (*++yyp)
1203
          {
1204
          case '\'':
1205
          case ',':
1206
            goto do_not_strip_quotes;
1207 330 jeremybenn
 
1208 342 jeremybenn
          case '\\':
1209
            if (*++yyp != '\\')
1210
              goto do_not_strip_quotes;
1211
            /* Fall through.  */
1212
          default:
1213
            if (yyres)
1214
              yyres[yyn] = *yyp;
1215
            yyn++;
1216
            break;
1217 330 jeremybenn
 
1218 342 jeremybenn
          case '"':
1219
            if (yyres)
1220
              yyres[yyn] = '\0';
1221
            return yyn;
1222
          }
1223
    do_not_strip_quotes: ;
1224
    }
1225
 
1226
  if (! yyres)
1227
    return yystrlen (yystr);
1228
 
1229
  return yystpcpy (yyres, yystr) - yyres;
1230
}
1231
# endif
1232
 
1233
/* Copy into YYRESULT an error message about the unexpected token
1234
   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
1235
   including the terminating null byte.  If YYRESULT is null, do not
1236
   copy anything; just return the number of bytes that would be
1237
   copied.  As a special case, return 0 if an ordinary "syntax error"
1238
   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
1239
   size calculation.  */
1240
static YYSIZE_T
1241
yysyntax_error (char *yyresult, int yystate, int yychar)
1242 330 jeremybenn
{
1243 342 jeremybenn
  int yyn = yypact[yystate];
1244 330 jeremybenn
 
1245 342 jeremybenn
  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1246
    return 0;
1247
  else
1248 330 jeremybenn
    {
1249 342 jeremybenn
      int yytype = YYTRANSLATE (yychar);
1250
      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1251
      YYSIZE_T yysize = yysize0;
1252
      YYSIZE_T yysize1;
1253
      int yysize_overflow = 0;
1254
      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1255
      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1256
      int yyx;
1257
 
1258
# if 0
1259
      /* This is so xgettext sees the translatable formats that are
1260
         constructed on the fly.  */
1261
      YY_("syntax error, unexpected %s");
1262
      YY_("syntax error, unexpected %s, expecting %s");
1263
      YY_("syntax error, unexpected %s, expecting %s or %s");
1264
      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1265
      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1266 330 jeremybenn
# endif
1267 342 jeremybenn
      char *yyfmt;
1268
      char const *yyf;
1269
      static char const yyunexpected[] = "syntax error, unexpected %s";
1270
      static char const yyexpecting[] = ", expecting %s";
1271
      static char const yyor[] = " or %s";
1272
      char yyformat[sizeof yyunexpected
1273
                    + sizeof yyexpecting - 1
1274
                    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1275
                       * (sizeof yyor - 1))];
1276
      char const *yyprefix = yyexpecting;
1277 330 jeremybenn
 
1278 342 jeremybenn
      /* Start YYX at -YYN if negative to avoid negative indexes in
1279
         YYCHECK.  */
1280
      int yyxbegin = yyn < 0 ? -yyn : 0;
1281
 
1282
      /* Stay within bounds of both yycheck and yytname.  */
1283
      int yychecklim = YYLAST - yyn + 1;
1284
      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1285
      int yycount = 1;
1286
 
1287
      yyarg[0] = yytname[yytype];
1288
      yyfmt = yystpcpy (yyformat, yyunexpected);
1289
 
1290
      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1291
        if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1292
          {
1293
            if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1294
              {
1295
                yycount = 1;
1296
                yysize = yysize0;
1297
                yyformat[sizeof yyunexpected - 1] = '\0';
1298
                break;
1299
              }
1300
            yyarg[yycount++] = yytname[yyx];
1301
            yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1302
            yysize_overflow |= (yysize1 < yysize);
1303
            yysize = yysize1;
1304
            yyfmt = yystpcpy (yyfmt, yyprefix);
1305
            yyprefix = yyor;
1306
          }
1307
 
1308
      yyf = YY_(yyformat);
1309
      yysize1 = yysize + yystrlen (yyf);
1310
      yysize_overflow |= (yysize1 < yysize);
1311
      yysize = yysize1;
1312
 
1313
      if (yysize_overflow)
1314
        return YYSIZE_MAXIMUM;
1315
 
1316
      if (yyresult)
1317
        {
1318
          /* Avoid sprintf, as that infringes on the user's name space.
1319
             Don't have undefined behavior even if the translation
1320
             produced a string with the wrong number of "%s"s.  */
1321
          char *yyp = yyresult;
1322
          int yyi = 0;
1323
          while ((*yyp = *yyf) != '\0')
1324
            {
1325
              if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1326
                {
1327
                  yyp += yytnamerr (yyp, yyarg[yyi++]);
1328
                  yyf += 2;
1329
                }
1330
              else
1331
                {
1332
                  yyp++;
1333
                  yyf++;
1334
                }
1335
            }
1336
        }
1337
      return yysize;
1338 330 jeremybenn
    }
1339
}
1340 342 jeremybenn
#endif /* YYERROR_VERBOSE */
1341
 
1342 330 jeremybenn
 
1343
/*-----------------------------------------------.
1344
| Release the memory associated to this symbol.  |
1345
`-----------------------------------------------*/
1346
 
1347 342 jeremybenn
/*ARGSUSED*/
1348
#if (defined __STDC__ || defined __C99__FUNC__ \
1349
     || defined __cplusplus || defined _MSC_VER)
1350 330 jeremybenn
static void
1351 342 jeremybenn
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1352 330 jeremybenn
#else
1353
static void
1354 342 jeremybenn
yydestruct (yymsg, yytype, yyvaluep)
1355
    const char *yymsg;
1356 330 jeremybenn
    int yytype;
1357
    YYSTYPE *yyvaluep;
1358
#endif
1359
{
1360 342 jeremybenn
  YYUSE (yyvaluep);
1361 330 jeremybenn
 
1362 342 jeremybenn
  if (!yymsg)
1363
    yymsg = "Deleting";
1364
  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1365
 
1366 330 jeremybenn
  switch (yytype)
1367
    {
1368
 
1369
      default:
1370 342 jeremybenn
        break;
1371 330 jeremybenn
    }
1372
}
1373
 
1374
/* Prevent warnings from -Wmissing-prototypes.  */
1375
#ifdef YYPARSE_PARAM
1376 342 jeremybenn
#if defined __STDC__ || defined __cplusplus
1377 330 jeremybenn
int yyparse (void *YYPARSE_PARAM);
1378 342 jeremybenn
#else
1379 330 jeremybenn
int yyparse ();
1380 342 jeremybenn
#endif
1381 330 jeremybenn
#else /* ! YYPARSE_PARAM */
1382 342 jeremybenn
#if defined __STDC__ || defined __cplusplus
1383 330 jeremybenn
int yyparse (void);
1384
#else
1385
int yyparse ();
1386
#endif
1387
#endif /* ! YYPARSE_PARAM */
1388
 
1389
 
1390
/* The lookahead symbol.  */
1391
int yychar;
1392
 
1393
/* The semantic value of the lookahead symbol.  */
1394
YYSTYPE yylval;
1395
 
1396
/* Number of syntax errors so far.  */
1397
int yynerrs;
1398
 
1399
 
1400
 
1401 342 jeremybenn
/*-------------------------.
1402
| yyparse or yypush_parse.  |
1403
`-------------------------*/
1404 330 jeremybenn
 
1405
#ifdef YYPARSE_PARAM
1406 342 jeremybenn
#if (defined __STDC__ || defined __C99__FUNC__ \
1407
     || defined __cplusplus || defined _MSC_VER)
1408
int
1409
yyparse (void *YYPARSE_PARAM)
1410
#else
1411
int
1412
yyparse (YYPARSE_PARAM)
1413
    void *YYPARSE_PARAM;
1414
#endif
1415 330 jeremybenn
#else /* ! YYPARSE_PARAM */
1416 342 jeremybenn
#if (defined __STDC__ || defined __C99__FUNC__ \
1417
     || defined __cplusplus || defined _MSC_VER)
1418 330 jeremybenn
int
1419
yyparse (void)
1420
#else
1421
int
1422
yyparse ()
1423
 
1424
#endif
1425
#endif
1426
{
1427
 
1428
 
1429 342 jeremybenn
    int yystate;
1430
    /* Number of tokens to shift before error messages enabled.  */
1431
    int yyerrstatus;
1432 330 jeremybenn
 
1433 342 jeremybenn
    /* The stacks and their tools:
1434
       `yyss': related to states.
1435
       `yyvs': related to semantic values.
1436 330 jeremybenn
 
1437 342 jeremybenn
       Refer to the stacks thru separate pointers, to allow yyoverflow
1438
       to xreallocate them elsewhere.  */
1439 330 jeremybenn
 
1440 342 jeremybenn
    /* The state stack.  */
1441
    yytype_int16 yyssa[YYINITDEPTH];
1442
    yytype_int16 *yyss;
1443
    yytype_int16 *yyssp;
1444 330 jeremybenn
 
1445 342 jeremybenn
    /* The semantic value stack.  */
1446
    YYSTYPE yyvsa[YYINITDEPTH];
1447
    YYSTYPE *yyvs;
1448
    YYSTYPE *yyvsp;
1449 330 jeremybenn
 
1450 342 jeremybenn
    YYSIZE_T yystacksize;
1451 330 jeremybenn
 
1452 342 jeremybenn
  int yyn;
1453
  int yyresult;
1454
  /* Lookahead token as an internal (translated) token number.  */
1455
  int yytoken;
1456 330 jeremybenn
  /* The variables used to return semantic value and location from the
1457
     action routines.  */
1458
  YYSTYPE yyval;
1459
 
1460 342 jeremybenn
#if YYERROR_VERBOSE
1461
  /* Buffer for error messages, and its allocated size.  */
1462
  char yymsgbuf[128];
1463
  char *yymsg = yymsgbuf;
1464
  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1465
#endif
1466 330 jeremybenn
 
1467 342 jeremybenn
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1468 330 jeremybenn
 
1469 342 jeremybenn
  /* The number of symbols on the RHS of the reduced rule.
1470
     Keep to zero when no symbol should be popped.  */
1471
  int yylen = 0;
1472
 
1473
  yytoken = 0;
1474
  yyss = yyssa;
1475
  yyvs = yyvsa;
1476
  yystacksize = YYINITDEPTH;
1477
 
1478 330 jeremybenn
  YYDPRINTF ((stderr, "Starting parse\n"));
1479
 
1480
  yystate = 0;
1481
  yyerrstatus = 0;
1482
  yynerrs = 0;
1483 342 jeremybenn
  yychar = YYEMPTY; /* Cause a token to be read.  */
1484 330 jeremybenn
 
1485
  /* Initialize stack pointers.
1486
     Waste one element of value and location stack
1487
     so that they stay on the same level as the state stack.
1488
     The wasted elements are never initialized.  */
1489
  yyssp = yyss;
1490
  yyvsp = yyvs;
1491
 
1492
  goto yysetstate;
1493
 
1494
/*------------------------------------------------------------.
1495
| yynewstate -- Push a new state, which is found in yystate.  |
1496
`------------------------------------------------------------*/
1497
 yynewstate:
1498
  /* In all cases, when you get here, the value and location stacks
1499 342 jeremybenn
     have just been pushed.  So pushing a state here evens the stacks.  */
1500 330 jeremybenn
  yyssp++;
1501
 
1502
 yysetstate:
1503
  *yyssp = yystate;
1504
 
1505
  if (yyss + yystacksize - 1 <= yyssp)
1506
    {
1507
      /* Get the current used size of the three stacks, in elements.  */
1508
      YYSIZE_T yysize = yyssp - yyss + 1;
1509
 
1510
#ifdef yyoverflow
1511
      {
1512 342 jeremybenn
        /* Give user a chance to xreallocate the stack.  Use copies of
1513 330 jeremybenn
           these so that the &'s don't force the real ones into
1514
           memory.  */
1515
        YYSTYPE *yyvs1 = yyvs;
1516 342 jeremybenn
        yytype_int16 *yyss1 = yyss;
1517 330 jeremybenn
 
1518
        /* Each stack pointer address is followed by the size of the
1519
           data in use in that stack, in bytes.  This used to be a
1520
           conditional around just the two extra args, but that might
1521
           be undefined if yyoverflow is a macro.  */
1522 342 jeremybenn
        yyoverflow (YY_("memory exhausted"),
1523 330 jeremybenn
                    &yyss1, yysize * sizeof (*yyssp),
1524
                    &yyvs1, yysize * sizeof (*yyvsp),
1525
                    &yystacksize);
1526
 
1527
        yyss = yyss1;
1528
        yyvs = yyvs1;
1529
      }
1530
#else /* no yyoverflow */
1531
# ifndef YYSTACK_RELOCATE
1532 342 jeremybenn
      goto yyexhaustedlab;
1533 330 jeremybenn
# else
1534
      /* Extend the stack our own way.  */
1535
      if (YYMAXDEPTH <= yystacksize)
1536 342 jeremybenn
        goto yyexhaustedlab;
1537 330 jeremybenn
      yystacksize *= 2;
1538
      if (YYMAXDEPTH < yystacksize)
1539
        yystacksize = YYMAXDEPTH;
1540
 
1541
      {
1542 342 jeremybenn
        yytype_int16 *yyss1 = yyss;
1543 330 jeremybenn
        union yyalloc *yyptr =
1544
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1545
        if (! yyptr)
1546 342 jeremybenn
          goto yyexhaustedlab;
1547
        YYSTACK_RELOCATE (yyss_alloc, yyss);
1548
        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1549 330 jeremybenn
#  undef YYSTACK_RELOCATE
1550
        if (yyss1 != yyssa)
1551
          YYSTACK_FREE (yyss1);
1552
      }
1553
# endif
1554
#endif /* no yyoverflow */
1555
 
1556
      yyssp = yyss + yysize - 1;
1557
      yyvsp = yyvs + yysize - 1;
1558
 
1559
      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1560
                  (unsigned long int) yystacksize));
1561
 
1562
      if (yyss + yystacksize - 1 <= yyssp)
1563
        YYABORT;
1564
    }
1565
 
1566
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1567
 
1568 342 jeremybenn
  if (yystate == YYFINAL)
1569
    YYACCEPT;
1570
 
1571 330 jeremybenn
  goto yybackup;
1572
 
1573
/*-----------.
1574
| yybackup.  |
1575
`-----------*/
1576
yybackup:
1577
 
1578 342 jeremybenn
  /* Do appropriate processing given the current state.  Read a
1579
     lookahead token if we need one and don't already have one.  */
1580 330 jeremybenn
 
1581
  /* First try to decide what to do without reference to lookahead token.  */
1582
  yyn = yypact[yystate];
1583
  if (yyn == YYPACT_NINF)
1584
    goto yydefault;
1585
 
1586
  /* Not known => get a lookahead token if don't already have one.  */
1587
 
1588
  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1589
  if (yychar == YYEMPTY)
1590
    {
1591
      YYDPRINTF ((stderr, "Reading a token: "));
1592
      yychar = YYLEX;
1593
    }
1594
 
1595
  if (yychar <= YYEOF)
1596
    {
1597
      yychar = yytoken = YYEOF;
1598
      YYDPRINTF ((stderr, "Now at end of input.\n"));
1599
    }
1600
  else
1601
    {
1602
      yytoken = YYTRANSLATE (yychar);
1603 342 jeremybenn
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1604 330 jeremybenn
    }
1605
 
1606
  /* If the proper action on seeing token YYTOKEN is to reduce or to
1607
     detect an error, take that action.  */
1608
  yyn += yytoken;
1609
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1610
    goto yydefault;
1611
  yyn = yytable[yyn];
1612
  if (yyn <= 0)
1613
    {
1614
      if (yyn == 0 || yyn == YYTABLE_NINF)
1615
        goto yyerrlab;
1616
      yyn = -yyn;
1617
      goto yyreduce;
1618
    }
1619
 
1620 342 jeremybenn
  /* Count tokens shifted since error; after three, turn off error
1621
     status.  */
1622
  if (yyerrstatus)
1623
    yyerrstatus--;
1624 330 jeremybenn
 
1625
  /* Shift the lookahead token.  */
1626 342 jeremybenn
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1627 330 jeremybenn
 
1628 342 jeremybenn
  /* Discard the shifted token.  */
1629
  yychar = YYEMPTY;
1630 330 jeremybenn
 
1631 342 jeremybenn
  yystate = yyn;
1632 330 jeremybenn
  *++yyvsp = yylval;
1633
 
1634
  goto yynewstate;
1635
 
1636
 
1637
/*-----------------------------------------------------------.
1638
| yydefault -- do the default action for the current state.  |
1639
`-----------------------------------------------------------*/
1640
yydefault:
1641
  yyn = yydefact[yystate];
1642
  if (yyn == 0)
1643
    goto yyerrlab;
1644
  goto yyreduce;
1645
 
1646
 
1647
/*-----------------------------.
1648
| yyreduce -- Do a reduction.  |
1649
`-----------------------------*/
1650
yyreduce:
1651
  /* yyn is the number of a rule to reduce with.  */
1652
  yylen = yyr2[yyn];
1653
 
1654
  /* If YYLEN is nonzero, implement the default value of the action:
1655
     `$$ = $1'.
1656
 
1657
     Otherwise, the following line sets YYVAL to garbage.
1658
     This behavior is undocumented and Bison
1659
     users should not rely upon it.  Assigning to YYVAL
1660
     unconditionally makes the parser a bit smaller, and it avoids a
1661
     GCC warning that YYVAL may be used uninitialized.  */
1662
  yyval = yyvsp[1-yylen];
1663
 
1664
 
1665
  YY_REDUCE_PRINT (yyn);
1666
  switch (yyn)
1667
    {
1668
        case 2:
1669 342 jeremybenn
 
1670
/* Line 1455 of yacc.c  */
1671 330 jeremybenn
#line 235 "p-exp.y"
1672
    { current_type = NULL;
1673
                  search_field = 0;
1674
                  leftdiv_is_integer = 0;
1675
                }
1676
    break;
1677
 
1678
  case 3:
1679 342 jeremybenn
 
1680
/* Line 1455 of yacc.c  */
1681 330 jeremybenn
#line 239 "p-exp.y"
1682
    {}
1683
    break;
1684
 
1685
  case 6:
1686 342 jeremybenn
 
1687
/* Line 1455 of yacc.c  */
1688 330 jeremybenn
#line 248 "p-exp.y"
1689
    { write_exp_elt_opcode(OP_TYPE);
1690 342 jeremybenn
                          write_exp_elt_type((yyvsp[(1) - (1)].tval));
1691 330 jeremybenn
                          write_exp_elt_opcode(OP_TYPE);
1692 342 jeremybenn
                          current_type = (yyvsp[(1) - (1)].tval); }
1693 330 jeremybenn
    break;
1694
 
1695
  case 8:
1696 342 jeremybenn
 
1697
/* Line 1455 of yacc.c  */
1698 330 jeremybenn
#line 256 "p-exp.y"
1699
    { write_exp_elt_opcode (BINOP_COMMA); }
1700
    break;
1701
 
1702
  case 9:
1703 342 jeremybenn
 
1704
/* Line 1455 of yacc.c  */
1705 330 jeremybenn
#line 261 "p-exp.y"
1706
    { write_exp_elt_opcode (UNOP_IND);
1707
                          if (current_type)
1708
                            current_type = TYPE_TARGET_TYPE (current_type); }
1709
    break;
1710
 
1711
  case 10:
1712 342 jeremybenn
 
1713
/* Line 1455 of yacc.c  */
1714 330 jeremybenn
#line 267 "p-exp.y"
1715
    { write_exp_elt_opcode (UNOP_ADDR);
1716
                          if (current_type)
1717
                            current_type = TYPE_POINTER_TYPE (current_type); }
1718
    break;
1719
 
1720
  case 11:
1721 342 jeremybenn
 
1722
/* Line 1455 of yacc.c  */
1723 330 jeremybenn
#line 273 "p-exp.y"
1724
    { write_exp_elt_opcode (UNOP_NEG); }
1725
    break;
1726
 
1727
  case 12:
1728 342 jeremybenn
 
1729
/* Line 1455 of yacc.c  */
1730 330 jeremybenn
#line 277 "p-exp.y"
1731
    { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1732
    break;
1733
 
1734
  case 13:
1735 342 jeremybenn
 
1736
/* Line 1455 of yacc.c  */
1737 330 jeremybenn
#line 281 "p-exp.y"
1738
    { write_exp_elt_opcode (UNOP_PREINCREMENT); }
1739
    break;
1740
 
1741
  case 14:
1742 342 jeremybenn
 
1743
/* Line 1455 of yacc.c  */
1744 330 jeremybenn
#line 285 "p-exp.y"
1745
    { write_exp_elt_opcode (UNOP_PREDECREMENT); }
1746
    break;
1747
 
1748
  case 15:
1749 342 jeremybenn
 
1750
/* Line 1455 of yacc.c  */
1751 330 jeremybenn
#line 288 "p-exp.y"
1752
    { search_field = 1; }
1753
    break;
1754
 
1755
  case 16:
1756 342 jeremybenn
 
1757
/* Line 1455 of yacc.c  */
1758 330 jeremybenn
#line 291 "p-exp.y"
1759
    { write_exp_elt_opcode (STRUCTOP_STRUCT);
1760 342 jeremybenn
                          write_exp_string ((yyvsp[(4) - (4)].sval));
1761 330 jeremybenn
                          write_exp_elt_opcode (STRUCTOP_STRUCT);
1762
                          search_field = 0;
1763
                          if (current_type)
1764
                            { while (TYPE_CODE (current_type) == TYPE_CODE_PTR)
1765
                                current_type = TYPE_TARGET_TYPE (current_type);
1766
                              current_type = lookup_struct_elt_type (
1767 342 jeremybenn
                                current_type, (yyvsp[(4) - (4)].sval).ptr, 0); };
1768 330 jeremybenn
                         }
1769
    break;
1770
 
1771
  case 17:
1772 342 jeremybenn
 
1773
/* Line 1455 of yacc.c  */
1774 330 jeremybenn
#line 303 "p-exp.y"
1775
    { char *arrayname;
1776
                          int arrayfieldindex;
1777
                          arrayfieldindex = is_pascal_string_type (
1778
                                current_type, NULL, NULL,
1779
                                NULL, NULL, &arrayname);
1780
                          if (arrayfieldindex)
1781
                            {
1782
                              struct stoken stringsval;
1783
                              stringsval.ptr = alloca (strlen (arrayname) + 1);
1784
                              stringsval.length = strlen (arrayname);
1785
                              strcpy (stringsval.ptr, arrayname);
1786
                              current_type = TYPE_FIELD_TYPE (current_type,
1787
                                arrayfieldindex - 1);
1788
                              write_exp_elt_opcode (STRUCTOP_STRUCT);
1789
                              write_exp_string (stringsval);
1790
                              write_exp_elt_opcode (STRUCTOP_STRUCT);
1791
                            }
1792
                          push_current_type ();  }
1793
    break;
1794
 
1795
  case 18:
1796 342 jeremybenn
 
1797
/* Line 1455 of yacc.c  */
1798 330 jeremybenn
#line 322 "p-exp.y"
1799
    { pop_current_type ();
1800
                          write_exp_elt_opcode (BINOP_SUBSCRIPT);
1801
                          if (current_type)
1802
                            current_type = TYPE_TARGET_TYPE (current_type); }
1803
    break;
1804
 
1805
  case 19:
1806 342 jeremybenn
 
1807
/* Line 1455 of yacc.c  */
1808 330 jeremybenn
#line 331 "p-exp.y"
1809
    { push_current_type ();
1810
                          start_arglist (); }
1811
    break;
1812
 
1813
  case 20:
1814 342 jeremybenn
 
1815
/* Line 1455 of yacc.c  */
1816 330 jeremybenn
#line 334 "p-exp.y"
1817
    { write_exp_elt_opcode (OP_FUNCALL);
1818
                          write_exp_elt_longcst ((LONGEST) end_arglist ());
1819
                          write_exp_elt_opcode (OP_FUNCALL);
1820
                          pop_current_type ();
1821
                          if (current_type)
1822
                            current_type = TYPE_TARGET_TYPE (current_type);
1823
                        }
1824
    break;
1825
 
1826
  case 22:
1827 342 jeremybenn
 
1828
/* Line 1455 of yacc.c  */
1829 330 jeremybenn
#line 345 "p-exp.y"
1830
    { arglist_len = 1; }
1831
    break;
1832
 
1833
  case 23:
1834 342 jeremybenn
 
1835
/* Line 1455 of yacc.c  */
1836 330 jeremybenn
#line 347 "p-exp.y"
1837
    { arglist_len++; }
1838
    break;
1839
 
1840
  case 24:
1841 342 jeremybenn
 
1842
/* Line 1455 of yacc.c  */
1843 330 jeremybenn
#line 351 "p-exp.y"
1844
    { if (current_type)
1845
                            {
1846
                              /* Allow automatic dereference of classes.  */
1847
                              if ((TYPE_CODE (current_type) == TYPE_CODE_PTR)
1848
                                  && (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_CLASS)
1849 342 jeremybenn
                                  && (TYPE_CODE ((yyvsp[(1) - (4)].tval)) == TYPE_CODE_CLASS))
1850 330 jeremybenn
                                write_exp_elt_opcode (UNOP_IND);
1851
                            }
1852
                          write_exp_elt_opcode (UNOP_CAST);
1853 342 jeremybenn
                          write_exp_elt_type ((yyvsp[(1) - (4)].tval));
1854 330 jeremybenn
                          write_exp_elt_opcode (UNOP_CAST);
1855 342 jeremybenn
                          current_type = (yyvsp[(1) - (4)].tval); }
1856 330 jeremybenn
    break;
1857
 
1858
  case 25:
1859 342 jeremybenn
 
1860
/* Line 1455 of yacc.c  */
1861 330 jeremybenn
#line 366 "p-exp.y"
1862
    { }
1863
    break;
1864
 
1865
  case 26:
1866 342 jeremybenn
 
1867
/* Line 1455 of yacc.c  */
1868 330 jeremybenn
#line 372 "p-exp.y"
1869
    { write_exp_elt_opcode (BINOP_MUL); }
1870
    break;
1871
 
1872
  case 27:
1873 342 jeremybenn
 
1874
/* Line 1455 of yacc.c  */
1875 330 jeremybenn
#line 375 "p-exp.y"
1876
    {
1877
                          if (current_type && is_integral_type (current_type))
1878
                            leftdiv_is_integer = 1;
1879
                        }
1880
    break;
1881
 
1882
  case 28:
1883 342 jeremybenn
 
1884
/* Line 1455 of yacc.c  */
1885 330 jeremybenn
#line 380 "p-exp.y"
1886
    {
1887
                          if (leftdiv_is_integer && current_type
1888
                              && is_integral_type (current_type))
1889
                            {
1890
                              write_exp_elt_opcode (UNOP_CAST);
1891
                              write_exp_elt_type (parse_type->builtin_long_double);
1892
                              current_type = parse_type->builtin_long_double;
1893
                              write_exp_elt_opcode (UNOP_CAST);
1894
                              leftdiv_is_integer = 0;
1895
                            }
1896
 
1897
                          write_exp_elt_opcode (BINOP_DIV);
1898
                        }
1899
    break;
1900
 
1901
  case 29:
1902 342 jeremybenn
 
1903
/* Line 1455 of yacc.c  */
1904 330 jeremybenn
#line 396 "p-exp.y"
1905
    { write_exp_elt_opcode (BINOP_INTDIV); }
1906
    break;
1907
 
1908
  case 30:
1909 342 jeremybenn
 
1910
/* Line 1455 of yacc.c  */
1911 330 jeremybenn
#line 400 "p-exp.y"
1912
    { write_exp_elt_opcode (BINOP_REM); }
1913
    break;
1914
 
1915
  case 31:
1916 342 jeremybenn
 
1917
/* Line 1455 of yacc.c  */
1918 330 jeremybenn
#line 404 "p-exp.y"
1919
    { write_exp_elt_opcode (BINOP_ADD); }
1920
    break;
1921
 
1922
  case 32:
1923 342 jeremybenn
 
1924
/* Line 1455 of yacc.c  */
1925 330 jeremybenn
#line 408 "p-exp.y"
1926
    { write_exp_elt_opcode (BINOP_SUB); }
1927
    break;
1928
 
1929
  case 33:
1930 342 jeremybenn
 
1931
/* Line 1455 of yacc.c  */
1932 330 jeremybenn
#line 412 "p-exp.y"
1933
    { write_exp_elt_opcode (BINOP_LSH); }
1934
    break;
1935
 
1936
  case 34:
1937 342 jeremybenn
 
1938
/* Line 1455 of yacc.c  */
1939 330 jeremybenn
#line 416 "p-exp.y"
1940
    { write_exp_elt_opcode (BINOP_RSH); }
1941
    break;
1942
 
1943
  case 35:
1944 342 jeremybenn
 
1945
/* Line 1455 of yacc.c  */
1946 330 jeremybenn
#line 420 "p-exp.y"
1947
    { write_exp_elt_opcode (BINOP_EQUAL);
1948
                          current_type = parse_type->builtin_bool;
1949
                        }
1950
    break;
1951
 
1952
  case 36:
1953 342 jeremybenn
 
1954
/* Line 1455 of yacc.c  */
1955 330 jeremybenn
#line 426 "p-exp.y"
1956
    { write_exp_elt_opcode (BINOP_NOTEQUAL);
1957
                          current_type = parse_type->builtin_bool;
1958
                        }
1959
    break;
1960
 
1961
  case 37:
1962 342 jeremybenn
 
1963
/* Line 1455 of yacc.c  */
1964 330 jeremybenn
#line 432 "p-exp.y"
1965
    { write_exp_elt_opcode (BINOP_LEQ);
1966
                          current_type = parse_type->builtin_bool;
1967
                        }
1968
    break;
1969
 
1970
  case 38:
1971 342 jeremybenn
 
1972
/* Line 1455 of yacc.c  */
1973 330 jeremybenn
#line 438 "p-exp.y"
1974
    { write_exp_elt_opcode (BINOP_GEQ);
1975
                          current_type = parse_type->builtin_bool;
1976
                        }
1977
    break;
1978
 
1979
  case 39:
1980 342 jeremybenn
 
1981
/* Line 1455 of yacc.c  */
1982 330 jeremybenn
#line 444 "p-exp.y"
1983
    { write_exp_elt_opcode (BINOP_LESS);
1984
                          current_type = parse_type->builtin_bool;
1985
                        }
1986
    break;
1987
 
1988
  case 40:
1989 342 jeremybenn
 
1990
/* Line 1455 of yacc.c  */
1991 330 jeremybenn
#line 450 "p-exp.y"
1992
    { write_exp_elt_opcode (BINOP_GTR);
1993
                          current_type = parse_type->builtin_bool;
1994
                        }
1995
    break;
1996
 
1997
  case 41:
1998 342 jeremybenn
 
1999
/* Line 1455 of yacc.c  */
2000 330 jeremybenn
#line 456 "p-exp.y"
2001
    { write_exp_elt_opcode (BINOP_BITWISE_AND); }
2002
    break;
2003
 
2004
  case 42:
2005 342 jeremybenn
 
2006
/* Line 1455 of yacc.c  */
2007 330 jeremybenn
#line 460 "p-exp.y"
2008
    { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
2009
    break;
2010
 
2011
  case 43:
2012 342 jeremybenn
 
2013
/* Line 1455 of yacc.c  */
2014 330 jeremybenn
#line 464 "p-exp.y"
2015
    { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
2016
    break;
2017
 
2018
  case 44:
2019 342 jeremybenn
 
2020
/* Line 1455 of yacc.c  */
2021 330 jeremybenn
#line 468 "p-exp.y"
2022
    { write_exp_elt_opcode (BINOP_ASSIGN); }
2023
    break;
2024
 
2025
  case 45:
2026 342 jeremybenn
 
2027
/* Line 1455 of yacc.c  */
2028 330 jeremybenn
#line 472 "p-exp.y"
2029
    { write_exp_elt_opcode (OP_BOOL);
2030 342 jeremybenn
                          write_exp_elt_longcst ((LONGEST) (yyvsp[(1) - (1)].lval));
2031 330 jeremybenn
                          current_type = parse_type->builtin_bool;
2032
                          write_exp_elt_opcode (OP_BOOL); }
2033
    break;
2034
 
2035
  case 46:
2036 342 jeremybenn
 
2037
/* Line 1455 of yacc.c  */
2038 330 jeremybenn
#line 479 "p-exp.y"
2039
    { write_exp_elt_opcode (OP_BOOL);
2040 342 jeremybenn
                          write_exp_elt_longcst ((LONGEST) (yyvsp[(1) - (1)].lval));
2041 330 jeremybenn
                          current_type = parse_type->builtin_bool;
2042
                          write_exp_elt_opcode (OP_BOOL); }
2043
    break;
2044
 
2045
  case 47:
2046 342 jeremybenn
 
2047
/* Line 1455 of yacc.c  */
2048 330 jeremybenn
#line 486 "p-exp.y"
2049
    { write_exp_elt_opcode (OP_LONG);
2050 342 jeremybenn
                          write_exp_elt_type ((yyvsp[(1) - (1)].typed_val_int).type);
2051
                          current_type = (yyvsp[(1) - (1)].typed_val_int).type;
2052
                          write_exp_elt_longcst ((LONGEST)((yyvsp[(1) - (1)].typed_val_int).val));
2053 330 jeremybenn
                          write_exp_elt_opcode (OP_LONG); }
2054
    break;
2055
 
2056
  case 48:
2057 342 jeremybenn
 
2058
/* Line 1455 of yacc.c  */
2059 330 jeremybenn
#line 494 "p-exp.y"
2060
    { YYSTYPE val;
2061 342 jeremybenn
                          parse_number ((yyvsp[(1) - (1)].ssym).stoken.ptr, (yyvsp[(1) - (1)].ssym).stoken.length, 0, &val);
2062 330 jeremybenn
                          write_exp_elt_opcode (OP_LONG);
2063
                          write_exp_elt_type (val.typed_val_int.type);
2064
                          current_type = val.typed_val_int.type;
2065
                          write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
2066
                          write_exp_elt_opcode (OP_LONG);
2067
                        }
2068
    break;
2069
 
2070
  case 49:
2071 342 jeremybenn
 
2072
/* Line 1455 of yacc.c  */
2073 330 jeremybenn
#line 506 "p-exp.y"
2074
    { write_exp_elt_opcode (OP_DOUBLE);
2075 342 jeremybenn
                          write_exp_elt_type ((yyvsp[(1) - (1)].typed_val_float).type);
2076
                          current_type = (yyvsp[(1) - (1)].typed_val_float).type;
2077
                          write_exp_elt_dblcst ((yyvsp[(1) - (1)].typed_val_float).dval);
2078 330 jeremybenn
                          write_exp_elt_opcode (OP_DOUBLE); }
2079
    break;
2080
 
2081
  case 52:
2082 342 jeremybenn
 
2083
/* Line 1455 of yacc.c  */
2084 330 jeremybenn
#line 521 "p-exp.y"
2085
    { write_exp_elt_opcode (OP_LONG);
2086
                          write_exp_elt_type (parse_type->builtin_int);
2087 342 jeremybenn
                          CHECK_TYPEDEF ((yyvsp[(3) - (4)].tval));
2088
                          write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ((yyvsp[(3) - (4)].tval)));
2089 330 jeremybenn
                          write_exp_elt_opcode (OP_LONG); }
2090
    break;
2091
 
2092
  case 53:
2093 342 jeremybenn
 
2094
/* Line 1455 of yacc.c  */
2095 330 jeremybenn
#line 529 "p-exp.y"
2096
    { write_exp_elt_opcode (UNOP_SIZEOF); }
2097
    break;
2098
 
2099
  case 54:
2100 342 jeremybenn
 
2101
/* Line 1455 of yacc.c  */
2102 330 jeremybenn
#line 532 "p-exp.y"
2103
    { /* C strings are converted into array constants with
2104
                             an explicit null byte added at the end.  Thus
2105
                             the array upper bound is the string length.
2106
                             There is no such thing in C as a completely empty
2107
                             string. */
2108 342 jeremybenn
                          char *sp = (yyvsp[(1) - (1)].sval).ptr; int count = (yyvsp[(1) - (1)].sval).length;
2109 330 jeremybenn
                          while (count-- > 0)
2110
                            {
2111
                              write_exp_elt_opcode (OP_LONG);
2112
                              write_exp_elt_type (parse_type->builtin_char);
2113
                              write_exp_elt_longcst ((LONGEST)(*sp++));
2114
                              write_exp_elt_opcode (OP_LONG);
2115
                            }
2116
                          write_exp_elt_opcode (OP_LONG);
2117
                          write_exp_elt_type (parse_type->builtin_char);
2118
                          write_exp_elt_longcst ((LONGEST)'\0');
2119
                          write_exp_elt_opcode (OP_LONG);
2120
                          write_exp_elt_opcode (OP_ARRAY);
2121
                          write_exp_elt_longcst ((LONGEST) 0);
2122 342 jeremybenn
                          write_exp_elt_longcst ((LONGEST) ((yyvsp[(1) - (1)].sval).length));
2123 330 jeremybenn
                          write_exp_elt_opcode (OP_ARRAY); }
2124
    break;
2125
 
2126
  case 55:
2127 342 jeremybenn
 
2128
/* Line 1455 of yacc.c  */
2129 330 jeremybenn
#line 557 "p-exp.y"
2130
    {
2131
                          struct value * this_val;
2132
                          struct type * this_type;
2133
                          write_exp_elt_opcode (OP_THIS);
2134
                          write_exp_elt_opcode (OP_THIS);
2135
                          /* we need type of this */
2136
                          this_val = value_of_this (0);
2137
                          if (this_val)
2138
                            this_type = value_type (this_val);
2139
                          else
2140
                            this_type = NULL;
2141
                          if (this_type)
2142
                            {
2143
                              if (TYPE_CODE (this_type) == TYPE_CODE_PTR)
2144
                                {
2145
                                  this_type = TYPE_TARGET_TYPE (this_type);
2146
                                  write_exp_elt_opcode (UNOP_IND);
2147
                                }
2148
                            }
2149
 
2150
                          current_type = this_type;
2151
                        }
2152
    break;
2153
 
2154
  case 56:
2155 342 jeremybenn
 
2156
/* Line 1455 of yacc.c  */
2157 330 jeremybenn
#line 584 "p-exp.y"
2158
    {
2159 342 jeremybenn
                          if ((yyvsp[(1) - (1)].ssym).sym != 0)
2160
                              (yyval.bval) = SYMBOL_BLOCK_VALUE ((yyvsp[(1) - (1)].ssym).sym);
2161 330 jeremybenn
                          else
2162
                            {
2163
                              struct symtab *tem =
2164 342 jeremybenn
                                  lookup_symtab (copy_name ((yyvsp[(1) - (1)].ssym).stoken));
2165 330 jeremybenn
                              if (tem)
2166 342 jeremybenn
                                (yyval.bval) = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK);
2167 330 jeremybenn
                              else
2168
                                error ("No file or function \"%s\".",
2169 342 jeremybenn
                                       copy_name ((yyvsp[(1) - (1)].ssym).stoken));
2170 330 jeremybenn
                            }
2171
                        }
2172
    break;
2173
 
2174
  case 57:
2175 342 jeremybenn
 
2176
/* Line 1455 of yacc.c  */
2177 330 jeremybenn
#line 601 "p-exp.y"
2178
    { struct symbol *tem
2179 342 jeremybenn
                            = lookup_symbol (copy_name ((yyvsp[(3) - (3)].sval)), (yyvsp[(1) - (3)].bval),
2180 330 jeremybenn
                                             VAR_DOMAIN, (int *) NULL);
2181
                          if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
2182
                            error ("No function \"%s\" in specified context.",
2183 342 jeremybenn
                                   copy_name ((yyvsp[(3) - (3)].sval)));
2184
                          (yyval.bval) = SYMBOL_BLOCK_VALUE (tem); }
2185 330 jeremybenn
    break;
2186
 
2187
  case 58:
2188 342 jeremybenn
 
2189
/* Line 1455 of yacc.c  */
2190 330 jeremybenn
#line 611 "p-exp.y"
2191
    { struct symbol *sym;
2192 342 jeremybenn
                          sym = lookup_symbol (copy_name ((yyvsp[(3) - (3)].sval)), (yyvsp[(1) - (3)].bval),
2193 330 jeremybenn
                                               VAR_DOMAIN, (int *) NULL);
2194
                          if (sym == 0)
2195
                            error ("No symbol \"%s\" in specified context.",
2196 342 jeremybenn
                                   copy_name ((yyvsp[(3) - (3)].sval)));
2197 330 jeremybenn
 
2198
                          write_exp_elt_opcode (OP_VAR_VALUE);
2199
                          /* block_found is set by lookup_symbol.  */
2200
                          write_exp_elt_block (block_found);
2201
                          write_exp_elt_sym (sym);
2202
                          write_exp_elt_opcode (OP_VAR_VALUE); }
2203
    break;
2204
 
2205
  case 59:
2206 342 jeremybenn
 
2207
/* Line 1455 of yacc.c  */
2208 330 jeremybenn
#line 626 "p-exp.y"
2209
    {
2210 342 jeremybenn
                          struct type *type = (yyvsp[(1) - (3)].tval);
2211 330 jeremybenn
                          if (TYPE_CODE (type) != TYPE_CODE_STRUCT
2212
                              && TYPE_CODE (type) != TYPE_CODE_UNION)
2213
                            error ("`%s' is not defined as an aggregate type.",
2214
                                   TYPE_NAME (type));
2215
 
2216
                          write_exp_elt_opcode (OP_SCOPE);
2217
                          write_exp_elt_type (type);
2218 342 jeremybenn
                          write_exp_string ((yyvsp[(3) - (3)].sval));
2219 330 jeremybenn
                          write_exp_elt_opcode (OP_SCOPE);
2220
                        }
2221
    break;
2222
 
2223
  case 61:
2224 342 jeremybenn
 
2225
/* Line 1455 of yacc.c  */
2226 330 jeremybenn
#line 642 "p-exp.y"
2227
    {
2228 342 jeremybenn
                          char *name = copy_name ((yyvsp[(2) - (2)].sval));
2229 330 jeremybenn
                          struct symbol *sym;
2230
                          struct minimal_symbol *msymbol;
2231
 
2232
                          sym =
2233
                            lookup_symbol (name, (const struct block *) NULL,
2234
                                           VAR_DOMAIN, (int *) NULL);
2235
                          if (sym)
2236
                            {
2237
                              write_exp_elt_opcode (OP_VAR_VALUE);
2238
                              write_exp_elt_block (NULL);
2239
                              write_exp_elt_sym (sym);
2240
                              write_exp_elt_opcode (OP_VAR_VALUE);
2241
                              break;
2242
                            }
2243
 
2244
                          msymbol = lookup_minimal_symbol (name, NULL, NULL);
2245
                          if (msymbol != NULL)
2246
                            write_exp_msymbol (msymbol);
2247
                          else if (!have_full_symbols () && !have_partial_symbols ())
2248
                            error ("No symbol table is loaded.  Use the \"file\" command.");
2249
                          else
2250
                            error ("No symbol \"%s\" in current context.", name);
2251
                        }
2252
    break;
2253
 
2254
  case 62:
2255 342 jeremybenn
 
2256
/* Line 1455 of yacc.c  */
2257 330 jeremybenn
#line 670 "p-exp.y"
2258 342 jeremybenn
    { struct symbol *sym = (yyvsp[(1) - (1)].ssym).sym;
2259 330 jeremybenn
 
2260
                          if (sym)
2261
                            {
2262
                              if (symbol_read_needs_frame (sym))
2263
                                {
2264
                                  if (innermost_block == 0
2265
                                      || contained_in (block_found,
2266
                                                       innermost_block))
2267
                                    innermost_block = block_found;
2268
                                }
2269
 
2270
                              write_exp_elt_opcode (OP_VAR_VALUE);
2271
                              /* We want to use the selected frame, not
2272
                                 another more inner frame which happens to
2273
                                 be in the same block.  */
2274
                              write_exp_elt_block (NULL);
2275
                              write_exp_elt_sym (sym);
2276
                              write_exp_elt_opcode (OP_VAR_VALUE);
2277
                              current_type = sym->type; }
2278 342 jeremybenn
                          else if ((yyvsp[(1) - (1)].ssym).is_a_field_of_this)
2279 330 jeremybenn
                            {
2280
                              struct value * this_val;
2281
                              struct type * this_type;
2282
                              /* Object pascal: it hangs off of `this'.  Must
2283
                                 not inadvertently convert from a method call
2284
                                 to data ref.  */
2285
                              if (innermost_block == 0
2286
                                  || contained_in (block_found,
2287
                                                   innermost_block))
2288
                                innermost_block = block_found;
2289
                              write_exp_elt_opcode (OP_THIS);
2290
                              write_exp_elt_opcode (OP_THIS);
2291
                              write_exp_elt_opcode (STRUCTOP_PTR);
2292 342 jeremybenn
                              write_exp_string ((yyvsp[(1) - (1)].ssym).stoken);
2293 330 jeremybenn
                              write_exp_elt_opcode (STRUCTOP_PTR);
2294
                              /* we need type of this */
2295
                              this_val = value_of_this (0);
2296
                              if (this_val)
2297
                                this_type = value_type (this_val);
2298
                              else
2299
                                this_type = NULL;
2300
                              if (this_type)
2301
                                current_type = lookup_struct_elt_type (
2302
                                  this_type,
2303 342 jeremybenn
                                  copy_name ((yyvsp[(1) - (1)].ssym).stoken), 0);
2304 330 jeremybenn
                              else
2305
                                current_type = NULL;
2306
                            }
2307
                          else
2308
                            {
2309
                              struct minimal_symbol *msymbol;
2310 342 jeremybenn
                              char *arg = copy_name ((yyvsp[(1) - (1)].ssym).stoken);
2311 330 jeremybenn
 
2312
                              msymbol =
2313
                                lookup_minimal_symbol (arg, NULL, NULL);
2314
                              if (msymbol != NULL)
2315
                                write_exp_msymbol (msymbol);
2316
                              else if (!have_full_symbols () && !have_partial_symbols ())
2317
                                error ("No symbol table is loaded.  Use the \"file\" command.");
2318
                              else
2319
                                error ("No symbol \"%s\" in current context.",
2320 342 jeremybenn
                                       copy_name ((yyvsp[(1) - (1)].ssym).stoken));
2321 330 jeremybenn
                            }
2322
                        }
2323
    break;
2324
 
2325
  case 65:
2326 342 jeremybenn
 
2327
/* Line 1455 of yacc.c  */
2328 330 jeremybenn
#line 754 "p-exp.y"
2329 342 jeremybenn
    { (yyval.tval) = lookup_pointer_type ((yyvsp[(2) - (2)].tval)); }
2330 330 jeremybenn
    break;
2331
 
2332
  case 66:
2333 342 jeremybenn
 
2334
/* Line 1455 of yacc.c  */
2335 330 jeremybenn
#line 756 "p-exp.y"
2336 342 jeremybenn
    { (yyval.tval) = (yyvsp[(1) - (1)].tsym).type; }
2337 330 jeremybenn
    break;
2338
 
2339
  case 67:
2340 342 jeremybenn
 
2341
/* Line 1455 of yacc.c  */
2342 330 jeremybenn
#line 758 "p-exp.y"
2343 342 jeremybenn
    { (yyval.tval) = lookup_struct (copy_name ((yyvsp[(2) - (2)].sval)),
2344 330 jeremybenn
                                              expression_context_block); }
2345
    break;
2346
 
2347
  case 68:
2348 342 jeremybenn
 
2349
/* Line 1455 of yacc.c  */
2350 330 jeremybenn
#line 761 "p-exp.y"
2351 342 jeremybenn
    { (yyval.tval) = lookup_struct (copy_name ((yyvsp[(2) - (2)].sval)),
2352 330 jeremybenn
                                              expression_context_block); }
2353
    break;
2354
 
2355
  case 69:
2356 342 jeremybenn
 
2357
/* Line 1455 of yacc.c  */
2358 330 jeremybenn
#line 768 "p-exp.y"
2359 342 jeremybenn
    { (yyval.sval) = (yyvsp[(1) - (1)].ssym).stoken; }
2360 330 jeremybenn
    break;
2361
 
2362
  case 70:
2363 342 jeremybenn
 
2364
/* Line 1455 of yacc.c  */
2365 330 jeremybenn
#line 769 "p-exp.y"
2366 342 jeremybenn
    { (yyval.sval) = (yyvsp[(1) - (1)].ssym).stoken; }
2367 330 jeremybenn
    break;
2368
 
2369
  case 71:
2370 342 jeremybenn
 
2371
/* Line 1455 of yacc.c  */
2372 330 jeremybenn
#line 770 "p-exp.y"
2373 342 jeremybenn
    { (yyval.sval) = (yyvsp[(1) - (1)].tsym).stoken; }
2374 330 jeremybenn
    break;
2375
 
2376
  case 72:
2377 342 jeremybenn
 
2378
/* Line 1455 of yacc.c  */
2379 330 jeremybenn
#line 771 "p-exp.y"
2380 342 jeremybenn
    { (yyval.sval) = (yyvsp[(1) - (1)].ssym).stoken; }
2381 330 jeremybenn
    break;
2382
 
2383
 
2384 342 jeremybenn
 
2385
/* Line 1455 of yacc.c  */
2386
#line 2388 "p-exp.c.tmp"
2387
      default: break;
2388 330 jeremybenn
    }
2389 342 jeremybenn
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2390 330 jeremybenn
 
2391 342 jeremybenn
  YYPOPSTACK (yylen);
2392
  yylen = 0;
2393 330 jeremybenn
  YY_STACK_PRINT (yyss, yyssp);
2394
 
2395
  *++yyvsp = yyval;
2396
 
2397
  /* Now `shift' the result of the reduction.  Determine what state
2398
     that goes to, based on the state we popped back to and the rule
2399
     number reduced by.  */
2400
 
2401
  yyn = yyr1[yyn];
2402
 
2403
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2404
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2405
    yystate = yytable[yystate];
2406
  else
2407
    yystate = yydefgoto[yyn - YYNTOKENS];
2408
 
2409
  goto yynewstate;
2410
 
2411
 
2412
/*------------------------------------.
2413
| yyerrlab -- here on detecting error |
2414
`------------------------------------*/
2415
yyerrlab:
2416
  /* If not already recovering from an error, report this error.  */
2417
  if (!yyerrstatus)
2418
    {
2419
      ++yynerrs;
2420 342 jeremybenn
#if ! YYERROR_VERBOSE
2421
      yyerror (YY_("syntax error"));
2422
#else
2423
      {
2424
        YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2425
        if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2426
          {
2427
            YYSIZE_T yyalloc = 2 * yysize;
2428
            if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2429
              yyalloc = YYSTACK_ALLOC_MAXIMUM;
2430
            if (yymsg != yymsgbuf)
2431
              YYSTACK_FREE (yymsg);
2432
            yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2433
            if (yymsg)
2434
              yymsg_alloc = yyalloc;
2435
            else
2436 330 jeremybenn
              {
2437 342 jeremybenn
                yymsg = yymsgbuf;
2438
                yymsg_alloc = sizeof yymsgbuf;
2439 330 jeremybenn
              }
2440 342 jeremybenn
          }
2441 330 jeremybenn
 
2442 342 jeremybenn
        if (0 < yysize && yysize <= yymsg_alloc)
2443
          {
2444
            (void) yysyntax_error (yymsg, yystate, yychar);
2445
            yyerror (yymsg);
2446
          }
2447
        else
2448
          {
2449
            yyerror (YY_("syntax error"));
2450
            if (yysize != 0)
2451
              goto yyexhaustedlab;
2452
          }
2453
      }
2454
#endif
2455 330 jeremybenn
    }
2456
 
2457
 
2458
 
2459
  if (yyerrstatus == 3)
2460
    {
2461
      /* If just tried and failed to reuse lookahead token after an
2462
         error, discard it.  */
2463
 
2464
      if (yychar <= YYEOF)
2465 342 jeremybenn
        {
2466
          /* Return failure if at end of input.  */
2467 330 jeremybenn
          if (yychar == YYEOF)
2468 342 jeremybenn
            YYABORT;
2469
        }
2470 330 jeremybenn
      else
2471
        {
2472 342 jeremybenn
          yydestruct ("Error: discarding",
2473
                      yytoken, &yylval);
2474 330 jeremybenn
          yychar = YYEMPTY;
2475
        }
2476
    }
2477
 
2478
  /* Else will try to reuse lookahead token after shifting the error
2479
     token.  */
2480
  goto yyerrlab1;
2481
 
2482
 
2483
/*---------------------------------------------------.
2484
| yyerrorlab -- error raised explicitly by YYERROR.  |
2485
`---------------------------------------------------*/
2486
yyerrorlab:
2487
 
2488 342 jeremybenn
  /* Pacify compilers like GCC when the user code never invokes
2489
     YYERROR and the label yyerrorlab therefore never appears in user
2490
     code.  */
2491
  if (/*CONSTCOND*/ 0)
2492 330 jeremybenn
     goto yyerrorlab;
2493
 
2494 342 jeremybenn
  /* Do not reclaim the symbols of the rule which action triggered
2495
     this YYERROR.  */
2496
  YYPOPSTACK (yylen);
2497
  yylen = 0;
2498
  YY_STACK_PRINT (yyss, yyssp);
2499 330 jeremybenn
  yystate = *yyssp;
2500
  goto yyerrlab1;
2501
 
2502
 
2503
/*-------------------------------------------------------------.
2504
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
2505
`-------------------------------------------------------------*/
2506
yyerrlab1:
2507
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2508
 
2509
  for (;;)
2510
    {
2511
      yyn = yypact[yystate];
2512
      if (yyn != YYPACT_NINF)
2513
        {
2514
          yyn += YYTERROR;
2515
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2516
            {
2517
              yyn = yytable[yyn];
2518
              if (0 < yyn)
2519
                break;
2520
            }
2521
        }
2522
 
2523
      /* Pop the current state because it cannot handle the error token.  */
2524
      if (yyssp == yyss)
2525
        YYABORT;
2526
 
2527 342 jeremybenn
 
2528
      yydestruct ("Error: popping",
2529
                  yystos[yystate], yyvsp);
2530
      YYPOPSTACK (1);
2531 330 jeremybenn
      yystate = *yyssp;
2532
      YY_STACK_PRINT (yyss, yyssp);
2533
    }
2534
 
2535 342 jeremybenn
  *++yyvsp = yylval;
2536 330 jeremybenn
 
2537
 
2538 342 jeremybenn
  /* Shift the error token.  */
2539
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2540 330 jeremybenn
 
2541
  yystate = yyn;
2542
  goto yynewstate;
2543
 
2544
 
2545
/*-------------------------------------.
2546
| yyacceptlab -- YYACCEPT comes here.  |
2547
`-------------------------------------*/
2548
yyacceptlab:
2549
  yyresult = 0;
2550
  goto yyreturn;
2551
 
2552
/*-----------------------------------.
2553
| yyabortlab -- YYABORT comes here.  |
2554
`-----------------------------------*/
2555
yyabortlab:
2556
  yyresult = 1;
2557
  goto yyreturn;
2558
 
2559 342 jeremybenn
#if !defined(yyoverflow) || YYERROR_VERBOSE
2560
/*-------------------------------------------------.
2561
| yyexhaustedlab -- memory exhaustion comes here.  |
2562
`-------------------------------------------------*/
2563
yyexhaustedlab:
2564
  yyerror (YY_("memory exhausted"));
2565 330 jeremybenn
  yyresult = 2;
2566
  /* Fall through.  */
2567
#endif
2568
 
2569
yyreturn:
2570 342 jeremybenn
  if (yychar != YYEMPTY)
2571
     yydestruct ("Cleanup: discarding lookahead",
2572
                 yytoken, &yylval);
2573
  /* Do not reclaim the symbols of the rule which action triggered
2574
     this YYABORT or YYACCEPT.  */
2575
  YYPOPSTACK (yylen);
2576
  YY_STACK_PRINT (yyss, yyssp);
2577
  while (yyssp != yyss)
2578
    {
2579
      yydestruct ("Cleanup: popping",
2580
                  yystos[*yyssp], yyvsp);
2581
      YYPOPSTACK (1);
2582
    }
2583 330 jeremybenn
#ifndef yyoverflow
2584
  if (yyss != yyssa)
2585
    YYSTACK_FREE (yyss);
2586
#endif
2587 342 jeremybenn
#if YYERROR_VERBOSE
2588
  if (yymsg != yymsgbuf)
2589
    YYSTACK_FREE (yymsg);
2590
#endif
2591
  /* Make sure YYID is used.  */
2592
  return YYID (yyresult);
2593 330 jeremybenn
}
2594
 
2595
 
2596 342 jeremybenn
 
2597
/* Line 1675 of yacc.c  */
2598 330 jeremybenn
#line 785 "p-exp.y"
2599
 
2600
 
2601
/* Take care of parsing a number (anything that starts with a digit).
2602
   Set yylval and return the token type; update lexptr.
2603
   LEN is the number of characters in it.  */
2604
 
2605
/*** Needs some error checking for the float case ***/
2606
 
2607
static int
2608
parse_number (p, len, parsed_float, putithere)
2609
     char *p;
2610
     int len;
2611
     int parsed_float;
2612
     YYSTYPE *putithere;
2613
{
2614
  /* FIXME: Shouldn't these be unsigned?  We don't deal with negative values
2615
     here, and we do kind of silly things like cast to unsigned.  */
2616
  LONGEST n = 0;
2617
  LONGEST prevn = 0;
2618
  ULONGEST un;
2619
 
2620
  int i = 0;
2621
  int c;
2622
  int base = input_radix;
2623
  int unsigned_p = 0;
2624
 
2625
  /* Number of "L" suffixes encountered.  */
2626
  int long_p = 0;
2627
 
2628
  /* We have found a "L" or "U" suffix.  */
2629
  int found_suffix = 0;
2630
 
2631
  ULONGEST high_bit;
2632
  struct type *signed_type;
2633
  struct type *unsigned_type;
2634
 
2635
  if (parsed_float)
2636
    {
2637
      /* It's a float since it contains a point or an exponent.  */
2638
      char c;
2639
      int num = 0;       /* number of tokens scanned by scanf */
2640
      char saved_char = p[len];
2641
 
2642
      p[len] = 0;        /* null-terminate the token */
2643
      num = sscanf (p, "%" DOUBLEST_SCAN_FORMAT "%c",
2644
                    &putithere->typed_val_float.dval, &c);
2645
      p[len] = saved_char;      /* restore the input stream */
2646
      if (num != 1)             /* check scanf found ONLY a float ... */
2647
        return ERROR;
2648
      /* See if it has `f' or `l' suffix (float or long double).  */
2649
 
2650
      c = tolower (p[len - 1]);
2651
 
2652
      if (c == 'f')
2653
        putithere->typed_val_float.type = parse_type->builtin_float;
2654
      else if (c == 'l')
2655
        putithere->typed_val_float.type = parse_type->builtin_long_double;
2656
      else if (isdigit (c) || c == '.')
2657
        putithere->typed_val_float.type = parse_type->builtin_double;
2658
      else
2659
        return ERROR;
2660
 
2661
      return FLOAT;
2662
    }
2663
 
2664
  /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2665
  if (p[0] == '0')
2666
    switch (p[1])
2667
      {
2668
      case 'x':
2669
      case 'X':
2670
        if (len >= 3)
2671
          {
2672
            p += 2;
2673
            base = 16;
2674
            len -= 2;
2675
          }
2676
        break;
2677
 
2678
      case 't':
2679
      case 'T':
2680
      case 'd':
2681
      case 'D':
2682
        if (len >= 3)
2683
          {
2684
            p += 2;
2685
            base = 10;
2686
            len -= 2;
2687
          }
2688
        break;
2689
 
2690
      default:
2691
        base = 8;
2692
        break;
2693
      }
2694
 
2695
  while (len-- > 0)
2696
    {
2697
      c = *p++;
2698
      if (c >= 'A' && c <= 'Z')
2699
        c += 'a' - 'A';
2700
      if (c != 'l' && c != 'u')
2701
        n *= base;
2702
      if (c >= '0' && c <= '9')
2703
        {
2704
          if (found_suffix)
2705
            return ERROR;
2706
          n += i = c - '0';
2707
        }
2708
      else
2709
        {
2710
          if (base > 10 && c >= 'a' && c <= 'f')
2711
            {
2712
              if (found_suffix)
2713
                return ERROR;
2714
              n += i = c - 'a' + 10;
2715
            }
2716
          else if (c == 'l')
2717
            {
2718
              ++long_p;
2719
              found_suffix = 1;
2720
            }
2721
          else if (c == 'u')
2722
            {
2723
              unsigned_p = 1;
2724
              found_suffix = 1;
2725
            }
2726
          else
2727
            return ERROR;       /* Char not a digit */
2728
        }
2729
      if (i >= base)
2730
        return ERROR;           /* Invalid digit in this base */
2731
 
2732
      /* Portably test for overflow (only works for nonzero values, so make
2733
         a second check for zero).  FIXME: Can't we just make n and prevn
2734
         unsigned and avoid this?  */
2735
      if (c != 'l' && c != 'u' && (prevn >= n) && n != 0)
2736
        unsigned_p = 1;         /* Try something unsigned */
2737
 
2738
      /* Portably test for unsigned overflow.
2739
         FIXME: This check is wrong; for example it doesn't find overflow
2740
         on 0x123456789 when LONGEST is 32 bits.  */
2741
      if (c != 'l' && c != 'u' && n != 0)
2742
        {
2743
          if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n))
2744
            error ("Numeric constant too large.");
2745
        }
2746
      prevn = n;
2747
    }
2748
 
2749
  /* An integer constant is an int, a long, or a long long.  An L
2750
     suffix forces it to be long; an LL suffix forces it to be long
2751
     long.  If not forced to a larger size, it gets the first type of
2752
     the above that it fits in.  To figure out whether it fits, we
2753
     shift it right and see whether anything remains.  Note that we
2754
     can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
2755
     operation, because many compilers will warn about such a shift
2756
     (which always produces a zero result).  Sometimes gdbarch_int_bit
2757
     or gdbarch_long_bit will be that big, sometimes not.  To deal with
2758
     the case where it is we just always shift the value more than
2759
     once, with fewer bits each time.  */
2760
 
2761
  un = (ULONGEST)n >> 2;
2762
  if (long_p == 0
2763
      && (un >> (gdbarch_int_bit (parse_gdbarch) - 2)) == 0)
2764
    {
2765
      high_bit = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1);
2766
 
2767
      /* A large decimal (not hex or octal) constant (between INT_MAX
2768
         and UINT_MAX) is a long or unsigned long, according to ANSI,
2769
         never an unsigned int, but this code treats it as unsigned
2770
         int.  This probably should be fixed.  GCC gives a warning on
2771
         such constants.  */
2772
 
2773
      unsigned_type = parse_type->builtin_unsigned_int;
2774
      signed_type = parse_type->builtin_int;
2775
    }
2776
  else if (long_p <= 1
2777
           && (un >> (gdbarch_long_bit (parse_gdbarch) - 2)) == 0)
2778
    {
2779
      high_bit = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1);
2780
      unsigned_type = parse_type->builtin_unsigned_long;
2781
      signed_type = parse_type->builtin_long;
2782
    }
2783
  else
2784
    {
2785
      int shift;
2786
      if (sizeof (ULONGEST) * HOST_CHAR_BIT
2787
          < gdbarch_long_long_bit (parse_gdbarch))
2788
        /* A long long does not fit in a LONGEST.  */
2789
        shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
2790
      else
2791
        shift = (gdbarch_long_long_bit (parse_gdbarch) - 1);
2792
      high_bit = (ULONGEST) 1 << shift;
2793
      unsigned_type = parse_type->builtin_unsigned_long_long;
2794
      signed_type = parse_type->builtin_long_long;
2795
    }
2796
 
2797
   putithere->typed_val_int.val = n;
2798
 
2799
   /* If the high bit of the worked out type is set then this number
2800
      has to be unsigned. */
2801
 
2802
   if (unsigned_p || (n & high_bit))
2803
     {
2804
       putithere->typed_val_int.type = unsigned_type;
2805
     }
2806
   else
2807
     {
2808
       putithere->typed_val_int.type = signed_type;
2809
     }
2810
 
2811
   return INT;
2812
}
2813
 
2814
 
2815
struct type_push
2816
{
2817
  struct type *stored;
2818
  struct type_push *next;
2819
};
2820
 
2821
static struct type_push *tp_top = NULL;
2822
 
2823
static void
2824
push_current_type (void)
2825
{
2826
  struct type_push *tpnew;
2827
  tpnew = (struct type_push *) xmalloc (sizeof (struct type_push));
2828
  tpnew->next = tp_top;
2829
  tpnew->stored = current_type;
2830
  current_type = NULL;
2831
  tp_top = tpnew;
2832
}
2833
 
2834
static void
2835
pop_current_type (void)
2836
{
2837
  struct type_push *tp = tp_top;
2838
  if (tp)
2839
    {
2840
      current_type = tp->stored;
2841
      tp_top = tp->next;
2842
      xfree (tp);
2843
    }
2844
}
2845
 
2846
struct token
2847
{
2848
  char *operator;
2849
  int token;
2850
  enum exp_opcode opcode;
2851
};
2852
 
2853
static const struct token tokentab3[] =
2854
  {
2855
    {"shr", RSH, BINOP_END},
2856
    {"shl", LSH, BINOP_END},
2857
    {"and", ANDAND, BINOP_END},
2858
    {"div", DIV, BINOP_END},
2859
    {"not", NOT, BINOP_END},
2860
    {"mod", MOD, BINOP_END},
2861
    {"inc", INCREMENT, BINOP_END},
2862
    {"dec", DECREMENT, BINOP_END},
2863
    {"xor", XOR, BINOP_END}
2864
  };
2865
 
2866
static const struct token tokentab2[] =
2867
  {
2868
    {"or", OR, BINOP_END},
2869
    {"<>", NOTEQUAL, BINOP_END},
2870
    {"<=", LEQ, BINOP_END},
2871
    {">=", GEQ, BINOP_END},
2872
    {":=", ASSIGN, BINOP_END},
2873
    {"::", COLONCOLON, BINOP_END} };
2874
 
2875
/* Allocate uppercased var */
2876
/* make an uppercased copy of tokstart */
2877
static char * uptok (tokstart, namelen)
2878
  char *tokstart;
2879
  int namelen;
2880
{
2881
  int i;
2882
  char *uptokstart = (char *)xmalloc(namelen+1);
2883
  for (i = 0;i <= namelen;i++)
2884
    {
2885
      if ((tokstart[i]>='a' && tokstart[i]<='z'))
2886
        uptokstart[i] = tokstart[i]-('a'-'A');
2887
      else
2888
        uptokstart[i] = tokstart[i];
2889
    }
2890
  uptokstart[namelen]='\0';
2891
  return uptokstart;
2892
}
2893
/* Read one token, getting characters through lexptr.  */
2894
 
2895
 
2896
static int
2897
yylex ()
2898
{
2899
  int c;
2900
  int namelen;
2901
  unsigned int i;
2902
  char *tokstart;
2903
  char *uptokstart;
2904
  char *tokptr;
2905
  int explen, tempbufindex;
2906
  static char *tempbuf;
2907
  static int tempbufsize;
2908
 
2909
 retry:
2910
 
2911
  prev_lexptr = lexptr;
2912
 
2913
  tokstart = lexptr;
2914
  explen = strlen (lexptr);
2915
  /* See if it is a special token of length 3.  */
2916
  if (explen > 2)
2917
    for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
2918
      if (strncasecmp (tokstart, tokentab3[i].operator, 3) == 0
2919
          && (!isalpha (tokentab3[i].operator[0]) || explen == 3
2920
              || (!isalpha (tokstart[3]) && !isdigit (tokstart[3]) && tokstart[3] != '_')))
2921
        {
2922
          lexptr += 3;
2923
          yylval.opcode = tokentab3[i].opcode;
2924
          return tokentab3[i].token;
2925
        }
2926
 
2927
  /* See if it is a special token of length 2.  */
2928
  if (explen > 1)
2929
  for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
2930
      if (strncasecmp (tokstart, tokentab2[i].operator, 2) == 0
2931
          && (!isalpha (tokentab2[i].operator[0]) || explen == 2
2932
              || (!isalpha (tokstart[2]) && !isdigit (tokstart[2]) && tokstart[2] != '_')))
2933
        {
2934
          lexptr += 2;
2935
          yylval.opcode = tokentab2[i].opcode;
2936
          return tokentab2[i].token;
2937
        }
2938
 
2939
  switch (c = *tokstart)
2940
    {
2941
    case 0:
2942
      return 0;
2943
 
2944
    case ' ':
2945
    case '\t':
2946
    case '\n':
2947
      lexptr++;
2948
      goto retry;
2949
 
2950
    case '\'':
2951
      /* We either have a character constant ('0' or '\177' for example)
2952
         or we have a quoted symbol reference ('foo(int,int)' in object pascal
2953
         for example). */
2954
      lexptr++;
2955
      c = *lexptr++;
2956
      if (c == '\\')
2957
        c = parse_escape (parse_gdbarch, &lexptr);
2958
      else if (c == '\'')
2959
        error ("Empty character constant.");
2960
 
2961
      yylval.typed_val_int.val = c;
2962
      yylval.typed_val_int.type = parse_type->builtin_char;
2963
 
2964
      c = *lexptr++;
2965
      if (c != '\'')
2966
        {
2967
          namelen = skip_quoted (tokstart) - tokstart;
2968
          if (namelen > 2)
2969
            {
2970
              lexptr = tokstart + namelen;
2971
              if (lexptr[-1] != '\'')
2972
                error ("Unmatched single quote.");
2973
              namelen -= 2;
2974
              tokstart++;
2975
              uptokstart = uptok(tokstart,namelen);
2976
              goto tryname;
2977
            }
2978
          error ("Invalid character constant.");
2979
        }
2980
      return INT;
2981
 
2982
    case '(':
2983
      paren_depth++;
2984
      lexptr++;
2985
      return c;
2986
 
2987
    case ')':
2988
      if (paren_depth == 0)
2989
        return 0;
2990
      paren_depth--;
2991
      lexptr++;
2992
      return c;
2993
 
2994
    case ',':
2995
      if (comma_terminates && paren_depth == 0)
2996
        return 0;
2997
      lexptr++;
2998
      return c;
2999
 
3000
    case '.':
3001
      /* Might be a floating point number.  */
3002
      if (lexptr[1] < '0' || lexptr[1] > '9')
3003
        goto symbol;            /* Nope, must be a symbol. */
3004
      /* FALL THRU into number case.  */
3005
 
3006
    case '0':
3007
    case '1':
3008
    case '2':
3009
    case '3':
3010
    case '4':
3011
    case '5':
3012
    case '6':
3013
    case '7':
3014
    case '8':
3015
    case '9':
3016
      {
3017
        /* It's a number.  */
3018
        int got_dot = 0, got_e = 0, toktype;
3019
        char *p = tokstart;
3020
        int hex = input_radix > 10;
3021
 
3022
        if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
3023
          {
3024
            p += 2;
3025
            hex = 1;
3026
          }
3027
        else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
3028
          {
3029
            p += 2;
3030
            hex = 0;
3031
          }
3032
 
3033
        for (;; ++p)
3034
          {
3035
            /* This test includes !hex because 'e' is a valid hex digit
3036
               and thus does not indicate a floating point number when
3037
               the radix is hex.  */
3038
            if (!hex && !got_e && (*p == 'e' || *p == 'E'))
3039
              got_dot = got_e = 1;
3040
            /* This test does not include !hex, because a '.' always indicates
3041
               a decimal floating point number regardless of the radix.  */
3042
            else if (!got_dot && *p == '.')
3043
              got_dot = 1;
3044
            else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
3045
                     && (*p == '-' || *p == '+'))
3046
              /* This is the sign of the exponent, not the end of the
3047
                 number.  */
3048
              continue;
3049
            /* We will take any letters or digits.  parse_number will
3050
               complain if past the radix, or if L or U are not final.  */
3051
            else if ((*p < '0' || *p > '9')
3052
                     && ((*p < 'a' || *p > 'z')
3053
                                  && (*p < 'A' || *p > 'Z')))
3054
              break;
3055
          }
3056
        toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
3057
        if (toktype == ERROR)
3058
          {
3059
            char *err_copy = (char *) alloca (p - tokstart + 1);
3060
 
3061
            memcpy (err_copy, tokstart, p - tokstart);
3062
            err_copy[p - tokstart] = 0;
3063
            error ("Invalid number \"%s\".", err_copy);
3064
          }
3065
        lexptr = p;
3066
        return toktype;
3067
      }
3068
 
3069
    case '+':
3070
    case '-':
3071
    case '*':
3072
    case '/':
3073
    case '|':
3074
    case '&':
3075
    case '^':
3076
    case '~':
3077
    case '!':
3078
    case '@':
3079
    case '<':
3080
    case '>':
3081
    case '[':
3082
    case ']':
3083
    case '?':
3084
    case ':':
3085
    case '=':
3086
    case '{':
3087
    case '}':
3088
    symbol:
3089
      lexptr++;
3090
      return c;
3091
 
3092
    case '"':
3093
 
3094
      /* Build the gdb internal form of the input string in tempbuf,
3095
         translating any standard C escape forms seen.  Note that the
3096
         buffer is null byte terminated *only* for the convenience of
3097
         debugging gdb itself and printing the buffer contents when
3098
         the buffer contains no embedded nulls.  Gdb does not depend
3099
         upon the buffer being null byte terminated, it uses the length
3100
         string instead.  This allows gdb to handle C strings (as well
3101
         as strings in other languages) with embedded null bytes */
3102
 
3103
      tokptr = ++tokstart;
3104
      tempbufindex = 0;
3105
 
3106
      do {
3107
        /* Grow the static temp buffer if necessary, including allocating
3108
           the first one on demand. */
3109
        if (tempbufindex + 1 >= tempbufsize)
3110
          {
3111
            tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
3112
          }
3113
 
3114
        switch (*tokptr)
3115
          {
3116
          case '\0':
3117
          case '"':
3118
            /* Do nothing, loop will terminate. */
3119
            break;
3120
          case '\\':
3121
            tokptr++;
3122
            c = parse_escape (parse_gdbarch, &tokptr);
3123
            if (c == -1)
3124
              {
3125
                continue;
3126
              }
3127
            tempbuf[tempbufindex++] = c;
3128
            break;
3129
          default:
3130
            tempbuf[tempbufindex++] = *tokptr++;
3131
            break;
3132
          }
3133
      } while ((*tokptr != '"') && (*tokptr != '\0'));
3134
      if (*tokptr++ != '"')
3135
        {
3136
          error ("Unterminated string in expression.");
3137
        }
3138
      tempbuf[tempbufindex] = '\0';     /* See note above */
3139
      yylval.sval.ptr = tempbuf;
3140
      yylval.sval.length = tempbufindex;
3141
      lexptr = tokptr;
3142
      return (STRING);
3143
    }
3144
 
3145
  if (!(c == '_' || c == '$'
3146
        || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
3147
    /* We must have come across a bad character (e.g. ';').  */
3148
    error ("Invalid character '%c' in expression.", c);
3149
 
3150
  /* It's a name.  See how long it is.  */
3151
  namelen = 0;
3152
  for (c = tokstart[namelen];
3153
       (c == '_' || c == '$' || (c >= '0' && c <= '9')
3154
        || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
3155
    {
3156
      /* Template parameter lists are part of the name.
3157
         FIXME: This mishandles `print $a<4&&$a>3'.  */
3158
      if (c == '<')
3159
        {
3160
          int i = namelen;
3161
          int nesting_level = 1;
3162
          while (tokstart[++i])
3163
            {
3164
              if (tokstart[i] == '<')
3165
                nesting_level++;
3166
              else if (tokstart[i] == '>')
3167
                {
3168
                  if (--nesting_level == 0)
3169
                    break;
3170
                }
3171
            }
3172
          if (tokstart[i] == '>')
3173
            namelen = i;
3174
          else
3175
            break;
3176
        }
3177
 
3178
      /* do NOT uppercase internals because of registers !!! */
3179
      c = tokstart[++namelen];
3180
    }
3181
 
3182
  uptokstart = uptok(tokstart,namelen);
3183
 
3184
  /* The token "if" terminates the expression and is NOT
3185
     removed from the input stream.  */
3186
  if (namelen == 2 && uptokstart[0] == 'I' && uptokstart[1] == 'F')
3187
    {
3188
      xfree (uptokstart);
3189
      return 0;
3190
    }
3191
 
3192
  lexptr += namelen;
3193
 
3194
  tryname:
3195
 
3196
  /* Catch specific keywords.  Should be done with a data structure.  */
3197
  switch (namelen)
3198
    {
3199
    case 6:
3200
      if (strcmp (uptokstart, "OBJECT") == 0)
3201
        {
3202
          xfree (uptokstart);
3203
          return CLASS;
3204
        }
3205
      if (strcmp (uptokstart, "RECORD") == 0)
3206
        {
3207
          xfree (uptokstart);
3208
          return STRUCT;
3209
        }
3210
      if (strcmp (uptokstart, "SIZEOF") == 0)
3211
        {
3212
          xfree (uptokstart);
3213
          return SIZEOF;
3214
        }
3215
      break;
3216
    case 5:
3217
      if (strcmp (uptokstart, "CLASS") == 0)
3218
        {
3219
          xfree (uptokstart);
3220
          return CLASS;
3221
        }
3222
      if (strcmp (uptokstart, "FALSE") == 0)
3223
        {
3224
          yylval.lval = 0;
3225
          xfree (uptokstart);
3226
          return FALSEKEYWORD;
3227
        }
3228
      break;
3229
    case 4:
3230
      if (strcmp (uptokstart, "TRUE") == 0)
3231
        {
3232
          yylval.lval = 1;
3233
          xfree (uptokstart);
3234
          return TRUEKEYWORD;
3235
        }
3236
      if (strcmp (uptokstart, "SELF") == 0)
3237
        {
3238
          /* here we search for 'this' like
3239
             inserted in FPC stabs debug info */
3240
          static const char this_name[] = "this";
3241
 
3242
          if (lookup_symbol (this_name, expression_context_block,
3243
                             VAR_DOMAIN, (int *) NULL))
3244
            {
3245
              xfree (uptokstart);
3246
              return THIS;
3247
            }
3248
        }
3249
      break;
3250
    default:
3251
      break;
3252
    }
3253
 
3254
  yylval.sval.ptr = tokstart;
3255
  yylval.sval.length = namelen;
3256
 
3257
  if (*tokstart == '$')
3258
    {
3259
      /* $ is the normal prefix for pascal hexadecimal values
3260
        but this conflicts with the GDB use for debugger variables
3261
        so in expression to enter hexadecimal values
3262
        we still need to use C syntax with 0xff  */
3263
      write_dollar_variable (yylval.sval);
3264
      xfree (uptokstart);
3265
      return VARIABLE;
3266
    }
3267
 
3268
  /* Use token-type BLOCKNAME for symbols that happen to be defined as
3269
     functions or symtabs.  If this is not so, then ...
3270
     Use token-type TYPENAME for symbols that happen to be defined
3271
     currently as names of types; NAME for other symbols.
3272
     The caller is not constrained to care about the distinction.  */
3273
  {
3274
    char *tmp = copy_name (yylval.sval);
3275
    struct symbol *sym;
3276
    int is_a_field_of_this = 0;
3277
    int is_a_field = 0;
3278
    int hextype;
3279
 
3280
 
3281
    if (search_field && current_type)
3282
      is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
3283
    if (is_a_field)
3284
      sym = NULL;
3285
    else
3286
      sym = lookup_symbol (tmp, expression_context_block,
3287
                           VAR_DOMAIN, &is_a_field_of_this);
3288
    /* second chance uppercased (as Free Pascal does).  */
3289
    if (!sym && !is_a_field_of_this && !is_a_field)
3290
      {
3291
       for (i = 0; i <= namelen; i++)
3292
         {
3293
           if ((tmp[i] >= 'a' && tmp[i] <= 'z'))
3294
             tmp[i] -= ('a'-'A');
3295
         }
3296
       if (search_field && current_type)
3297
         is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
3298
       if (is_a_field)
3299
         sym = NULL;
3300
       else
3301
         sym = lookup_symbol (tmp, expression_context_block,
3302
                              VAR_DOMAIN, &is_a_field_of_this);
3303
       if (sym || is_a_field_of_this || is_a_field)
3304
         for (i = 0; i <= namelen; i++)
3305
           {
3306
             if ((tokstart[i] >= 'a' && tokstart[i] <= 'z'))
3307
               tokstart[i] -= ('a'-'A');
3308
           }
3309
      }
3310
    /* Third chance Capitalized (as GPC does).  */
3311
    if (!sym && !is_a_field_of_this && !is_a_field)
3312
      {
3313
       for (i = 0; i <= namelen; i++)
3314
         {
3315
           if (i == 0)
3316
             {
3317
              if ((tmp[i] >= 'a' && tmp[i] <= 'z'))
3318
                tmp[i] -= ('a'-'A');
3319
             }
3320
           else
3321
           if ((tmp[i] >= 'A' && tmp[i] <= 'Z'))
3322
             tmp[i] -= ('A'-'a');
3323
          }
3324
       if (search_field && current_type)
3325
         is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
3326
       if (is_a_field)
3327
         sym = NULL;
3328
       else
3329
         sym = lookup_symbol (tmp, expression_context_block,
3330
                              VAR_DOMAIN, &is_a_field_of_this);
3331
       if (sym || is_a_field_of_this || is_a_field)
3332
          for (i = 0; i <= namelen; i++)
3333
            {
3334
              if (i == 0)
3335
                {
3336
                  if ((tokstart[i] >= 'a' && tokstart[i] <= 'z'))
3337
                    tokstart[i] -= ('a'-'A');
3338
                }
3339
              else
3340
                if ((tokstart[i] >= 'A' && tokstart[i] <= 'Z'))
3341
                  tokstart[i] -= ('A'-'a');
3342
            }
3343
      }
3344
 
3345
    if (is_a_field)
3346
      {
3347
        tempbuf = (char *) xrealloc (tempbuf, namelen + 1);
3348
        strncpy (tempbuf, tokstart, namelen); tempbuf [namelen] = 0;
3349
        yylval.sval.ptr = tempbuf;
3350
        yylval.sval.length = namelen;
3351
        xfree (uptokstart);
3352
        return FIELDNAME;
3353
      }
3354
    /* Call lookup_symtab, not lookup_partial_symtab, in case there are
3355
       no psymtabs (coff, xcoff, or some future change to blow away the
3356
       psymtabs once once symbols are read).  */
3357
    if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
3358
        || lookup_symtab (tmp))
3359
      {
3360
        yylval.ssym.sym = sym;
3361
        yylval.ssym.is_a_field_of_this = is_a_field_of_this;
3362
        xfree (uptokstart);
3363
        return BLOCKNAME;
3364
      }
3365
    if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
3366
        {
3367
#if 1
3368
          /* Despite the following flaw, we need to keep this code enabled.
3369
             Because we can get called from check_stub_method, if we don't
3370
             handle nested types then it screws many operations in any
3371
             program which uses nested types.  */
3372
          /* In "A::x", if x is a member function of A and there happens
3373
             to be a type (nested or not, since the stabs don't make that
3374
             distinction) named x, then this code incorrectly thinks we
3375
             are dealing with nested types rather than a member function.  */
3376
 
3377
          char *p;
3378
          char *namestart;
3379
          struct symbol *best_sym;
3380
 
3381
          /* Look ahead to detect nested types.  This probably should be
3382
             done in the grammar, but trying seemed to introduce a lot
3383
             of shift/reduce and reduce/reduce conflicts.  It's possible
3384
             that it could be done, though.  Or perhaps a non-grammar, but
3385
             less ad hoc, approach would work well.  */
3386
 
3387
          /* Since we do not currently have any way of distinguishing
3388
             a nested type from a non-nested one (the stabs don't tell
3389
             us whether a type is nested), we just ignore the
3390
             containing type.  */
3391
 
3392
          p = lexptr;
3393
          best_sym = sym;
3394
          while (1)
3395
            {
3396
              /* Skip whitespace.  */
3397
              while (*p == ' ' || *p == '\t' || *p == '\n')
3398
                ++p;
3399
              if (*p == ':' && p[1] == ':')
3400
                {
3401
                  /* Skip the `::'.  */
3402
                  p += 2;
3403
                  /* Skip whitespace.  */
3404
                  while (*p == ' ' || *p == '\t' || *p == '\n')
3405
                    ++p;
3406
                  namestart = p;
3407
                  while (*p == '_' || *p == '$' || (*p >= '0' && *p <= '9')
3408
                         || (*p >= 'a' && *p <= 'z')
3409
                         || (*p >= 'A' && *p <= 'Z'))
3410
                    ++p;
3411
                  if (p != namestart)
3412
                    {
3413
                      struct symbol *cur_sym;
3414
                      /* As big as the whole rest of the expression, which is
3415
                         at least big enough.  */
3416
                      char *ncopy = alloca (strlen (tmp)+strlen (namestart)+3);
3417
                      char *tmp1;
3418
 
3419
                      tmp1 = ncopy;
3420
                      memcpy (tmp1, tmp, strlen (tmp));
3421
                      tmp1 += strlen (tmp);
3422
                      memcpy (tmp1, "::", 2);
3423
                      tmp1 += 2;
3424
                      memcpy (tmp1, namestart, p - namestart);
3425
                      tmp1[p - namestart] = '\0';
3426
                      cur_sym = lookup_symbol (ncopy, expression_context_block,
3427
                                               VAR_DOMAIN, (int *) NULL);
3428
                      if (cur_sym)
3429
                        {
3430
                          if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)
3431
                            {
3432
                              best_sym = cur_sym;
3433
                              lexptr = p;
3434
                            }
3435
                          else
3436
                            break;
3437
                        }
3438
                      else
3439
                        break;
3440
                    }
3441
                  else
3442
                    break;
3443
                }
3444
              else
3445
                break;
3446
            }
3447
 
3448
          yylval.tsym.type = SYMBOL_TYPE (best_sym);
3449
#else /* not 0 */
3450
          yylval.tsym.type = SYMBOL_TYPE (sym);
3451
#endif /* not 0 */
3452
          xfree (uptokstart);
3453
          return TYPENAME;
3454
        }
3455
    yylval.tsym.type
3456
      = language_lookup_primitive_type_by_name (parse_language,
3457
                                                parse_gdbarch, tmp);
3458
    if (yylval.tsym.type != NULL)
3459
      {
3460
        xfree (uptokstart);
3461
        return TYPENAME;
3462
      }
3463
 
3464
    /* Input names that aren't symbols but ARE valid hex numbers,
3465
       when the input radix permits them, can be names or numbers
3466
       depending on the parse.  Note we support radixes > 16 here.  */
3467
    if (!sym
3468
        && ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
3469
            || (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
3470
      {
3471
        YYSTYPE newlval;        /* Its value is ignored.  */
3472
        hextype = parse_number (tokstart, namelen, 0, &newlval);
3473
        if (hextype == INT)
3474
          {
3475
            yylval.ssym.sym = sym;
3476
            yylval.ssym.is_a_field_of_this = is_a_field_of_this;
3477
            xfree (uptokstart);
3478
            return NAME_OR_INT;
3479
          }
3480
      }
3481
 
3482
    xfree(uptokstart);
3483
    /* Any other kind of symbol */
3484
    yylval.ssym.sym = sym;
3485
    yylval.ssym.is_a_field_of_this = is_a_field_of_this;
3486
    return NAME;
3487
  }
3488
}
3489
 
3490
void
3491
yyerror (msg)
3492
     char *msg;
3493
{
3494
  if (prev_lexptr)
3495
    lexptr = prev_lexptr;
3496
 
3497
  error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
3498
}
3499
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.