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