1130803Smarcel/* A Bison parser, made by GNU Bison 1.875. */ 2130803Smarcel 3130803Smarcel/* Skeleton parser for Yacc-like parsing with Bison, 4130803Smarcel Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. 5130803Smarcel 6130803Smarcel This program is free software; you can redistribute it and/or modify 7130803Smarcel it under the terms of the GNU General Public License as published by 8130803Smarcel the Free Software Foundation; either version 2, or (at your option) 9130803Smarcel any later version. 10130803Smarcel 11130803Smarcel This program is distributed in the hope that it will be useful, 12130803Smarcel but WITHOUT ANY WARRANTY; without even the implied warranty of 13130803Smarcel MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14130803Smarcel GNU General Public License for more details. 15130803Smarcel 16130803Smarcel You should have received a copy of the GNU General Public License 17130803Smarcel along with this program; if not, write to the Free Software 18130803Smarcel Foundation, Inc., 59 Temple Place - Suite 330, 19130803Smarcel Boston, MA 02111-1307, USA. */ 20130803Smarcel 21130803Smarcel/* As a special exception, when this file is copied by Bison into a 22130803Smarcel Bison output file, you may use that output file without restriction. 23130803Smarcel This special exception was added by the Free Software Foundation 24130803Smarcel in version 1.24 of Bison. */ 25130803Smarcel 26130803Smarcel/* Written by Richard Stallman by simplifying the original so called 27130803Smarcel ``semantic'' parser. */ 28130803Smarcel 29130803Smarcel/* All symbols defined below should begin with yy or YY, to avoid 30130803Smarcel infringing on user name space. This should be done even for local 31130803Smarcel variables, as they might otherwise be expanded by user macros. 32130803Smarcel There are some unavoidable exceptions within include files to 33130803Smarcel define necessary library symbols; they are noted "INFRINGES ON 34130803Smarcel USER NAME SPACE" below. */ 35130803Smarcel 36130803Smarcel/* Identify Bison output. */ 37130803Smarcel#define YYBISON 1 38130803Smarcel 39130803Smarcel/* Skeleton name. */ 40130803Smarcel#define YYSKELETON_NAME "yacc.c" 41130803Smarcel 42130803Smarcel/* Pure parsers. */ 43130803Smarcel#define YYPURE 0 44130803Smarcel 45130803Smarcel/* Using locations. */ 46130803Smarcel#define YYLSP_NEEDED 0 47130803Smarcel 48130803Smarcel 49130803Smarcel 50130803Smarcel/* Tokens. */ 51130803Smarcel#ifndef YYTOKENTYPE 52130803Smarcel# define YYTOKENTYPE 53130803Smarcel /* Put the tokens into the symbol table, so that GDB and other debuggers 54130803Smarcel know about them. */ 55130803Smarcel enum yytokentype { 56130803Smarcel INT = 258, 57130803Smarcel FLOAT = 259, 58130803Smarcel STRING = 260, 59130803Smarcel NAME = 261, 60130803Smarcel TYPENAME = 262, 61130803Smarcel NAME_OR_INT = 263, 62130803Smarcel STRUCT = 264, 63130803Smarcel CLASS = 265, 64130803Smarcel UNION = 266, 65130803Smarcel ENUM = 267, 66130803Smarcel SIZEOF = 268, 67130803Smarcel UNSIGNED = 269, 68130803Smarcel COLONCOLON = 270, 69130803Smarcel TEMPLATE = 271, 70130803Smarcel ERROR = 272, 71130803Smarcel SIGNED_KEYWORD = 273, 72130803Smarcel LONG = 274, 73130803Smarcel SHORT = 275, 74130803Smarcel INT_KEYWORD = 276, 75130803Smarcel CONST_KEYWORD = 277, 76130803Smarcel VOLATILE_KEYWORD = 278, 77130803Smarcel DOUBLE_KEYWORD = 279, 78130803Smarcel VARIABLE = 280, 79130803Smarcel ASSIGN_MODIFY = 281, 80130803Smarcel TRUEKEYWORD = 282, 81130803Smarcel FALSEKEYWORD = 283, 82130803Smarcel ABOVE_COMMA = 284, 83130803Smarcel OROR = 285, 84130803Smarcel ANDAND = 286, 85130803Smarcel NOTEQUAL = 287, 86130803Smarcel EQUAL = 288, 87130803Smarcel GEQ = 289, 88130803Smarcel LEQ = 290, 89130803Smarcel RSH = 291, 90130803Smarcel LSH = 292, 91130803Smarcel DECREMENT = 293, 92130803Smarcel INCREMENT = 294, 93130803Smarcel UNARY = 295, 94130803Smarcel ARROW = 296, 95130803Smarcel BLOCKNAME = 297, 96130803Smarcel FILENAME = 298 97130803Smarcel }; 98130803Smarcel#endif 99130803Smarcel#define INT 258 100130803Smarcel#define FLOAT 259 101130803Smarcel#define STRING 260 102130803Smarcel#define NAME 261 103130803Smarcel#define TYPENAME 262 104130803Smarcel#define NAME_OR_INT 263 105130803Smarcel#define STRUCT 264 106130803Smarcel#define CLASS 265 107130803Smarcel#define UNION 266 108130803Smarcel#define ENUM 267 109130803Smarcel#define SIZEOF 268 110130803Smarcel#define UNSIGNED 269 111130803Smarcel#define COLONCOLON 270 112130803Smarcel#define TEMPLATE 271 113130803Smarcel#define ERROR 272 114130803Smarcel#define SIGNED_KEYWORD 273 115130803Smarcel#define LONG 274 116130803Smarcel#define SHORT 275 117130803Smarcel#define INT_KEYWORD 276 118130803Smarcel#define CONST_KEYWORD 277 119130803Smarcel#define VOLATILE_KEYWORD 278 120130803Smarcel#define DOUBLE_KEYWORD 279 121130803Smarcel#define VARIABLE 280 122130803Smarcel#define ASSIGN_MODIFY 281 123130803Smarcel#define TRUEKEYWORD 282 124130803Smarcel#define FALSEKEYWORD 283 125130803Smarcel#define ABOVE_COMMA 284 126130803Smarcel#define OROR 285 127130803Smarcel#define ANDAND 286 128130803Smarcel#define NOTEQUAL 287 129130803Smarcel#define EQUAL 288 130130803Smarcel#define GEQ 289 131130803Smarcel#define LEQ 290 132130803Smarcel#define RSH 291 133130803Smarcel#define LSH 292 134130803Smarcel#define DECREMENT 293 135130803Smarcel#define INCREMENT 294 136130803Smarcel#define UNARY 295 137130803Smarcel#define ARROW 296 138130803Smarcel#define BLOCKNAME 297 139130803Smarcel#define FILENAME 298 140130803Smarcel 141130803Smarcel 142130803Smarcel 143130803Smarcel 144130803Smarcel/* Copy the first part of user declarations. */ 145130803Smarcel#line 39 "c-exp.y" 146130803Smarcel 147130803Smarcel 148130803Smarcel#include "defs.h" 149130803Smarcel#include "gdb_string.h" 150130803Smarcel#include <ctype.h> 151130803Smarcel#include "expression.h" 152130803Smarcel#include "value.h" 153130803Smarcel#include "parser-defs.h" 154130803Smarcel#include "language.h" 155130803Smarcel#include "c-lang.h" 156130803Smarcel#include "bfd.h" /* Required by objfiles.h. */ 157130803Smarcel#include "symfile.h" /* Required by objfiles.h. */ 158130803Smarcel#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ 159130803Smarcel#include "charset.h" 160130803Smarcel#include "block.h" 161130803Smarcel#include "cp-support.h" 162130803Smarcel 163130803Smarcel/* Flag indicating we're dealing with HP-compiled objects */ 164130803Smarcelextern int hp_som_som_object_present; 165130803Smarcel 166130803Smarcel/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), 167130803Smarcel as well as gratuitiously global symbol names, so we can have multiple 168130803Smarcel yacc generated parsers in gdb. Note that these are only the variables 169130803Smarcel produced by yacc. If other parser generators (bison, byacc, etc) produce 170130803Smarcel additional global names that conflict at link time, then those parser 171130803Smarcel generators need to be fixed instead of adding those names to this list. */ 172130803Smarcel 173130803Smarcel#define yymaxdepth c_maxdepth 174130803Smarcel#define yyparse c_parse 175130803Smarcel#define yylex c_lex 176130803Smarcel#define yyerror c_error 177130803Smarcel#define yylval c_lval 178130803Smarcel#define yychar c_char 179130803Smarcel#define yydebug c_debug 180130803Smarcel#define yypact c_pact 181130803Smarcel#define yyr1 c_r1 182130803Smarcel#define yyr2 c_r2 183130803Smarcel#define yydef c_def 184130803Smarcel#define yychk c_chk 185130803Smarcel#define yypgo c_pgo 186130803Smarcel#define yyact c_act 187130803Smarcel#define yyexca c_exca 188130803Smarcel#define yyerrflag c_errflag 189130803Smarcel#define yynerrs c_nerrs 190130803Smarcel#define yyps c_ps 191130803Smarcel#define yypv c_pv 192130803Smarcel#define yys c_s 193130803Smarcel#define yy_yys c_yys 194130803Smarcel#define yystate c_state 195130803Smarcel#define yytmp c_tmp 196130803Smarcel#define yyv c_v 197130803Smarcel#define yy_yyv c_yyv 198130803Smarcel#define yyval c_val 199130803Smarcel#define yylloc c_lloc 200130803Smarcel#define yyreds c_reds /* With YYDEBUG defined */ 201130803Smarcel#define yytoks c_toks /* With YYDEBUG defined */ 202130803Smarcel#define yyname c_name /* With YYDEBUG defined */ 203130803Smarcel#define yyrule c_rule /* With YYDEBUG defined */ 204130803Smarcel#define yylhs c_yylhs 205130803Smarcel#define yylen c_yylen 206130803Smarcel#define yydefred c_yydefred 207130803Smarcel#define yydgoto c_yydgoto 208130803Smarcel#define yysindex c_yysindex 209130803Smarcel#define yyrindex c_yyrindex 210130803Smarcel#define yygindex c_yygindex 211130803Smarcel#define yytable c_yytable 212130803Smarcel#define yycheck c_yycheck 213130803Smarcel 214130803Smarcel#ifndef YYDEBUG 215130803Smarcel#define YYDEBUG 1 /* Default to yydebug support */ 216130803Smarcel#endif 217130803Smarcel 218130803Smarcel#define YYFPRINTF parser_fprintf 219130803Smarcel 220130803Smarcelint yyparse (void); 221130803Smarcel 222130803Smarcelstatic int yylex (void); 223130803Smarcel 224130803Smarcelvoid yyerror (char *); 225130803Smarcel 226130803Smarcel 227130803Smarcel 228130803Smarcel/* Enabling traces. */ 229130803Smarcel#ifndef YYDEBUG 230130803Smarcel# define YYDEBUG 0 231130803Smarcel#endif 232130803Smarcel 233130803Smarcel/* Enabling verbose error messages. */ 234130803Smarcel#ifdef YYERROR_VERBOSE 235130803Smarcel# undef YYERROR_VERBOSE 236130803Smarcel# define YYERROR_VERBOSE 1 237130803Smarcel#else 238130803Smarcel# define YYERROR_VERBOSE 0 239130803Smarcel#endif 240130803Smarcel 241130803Smarcel#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) 242130803Smarcel#line 126 "c-exp.y" 243130803Smarceltypedef union YYSTYPE { 244130803Smarcel LONGEST lval; 245130803Smarcel struct { 246130803Smarcel LONGEST val; 247130803Smarcel struct type *type; 248130803Smarcel } typed_val_int; 249130803Smarcel struct { 250130803Smarcel DOUBLEST dval; 251130803Smarcel struct type *type; 252130803Smarcel } typed_val_float; 253130803Smarcel struct symbol *sym; 254130803Smarcel struct type *tval; 255130803Smarcel struct stoken sval; 256130803Smarcel struct ttype tsym; 257130803Smarcel struct symtoken ssym; 258130803Smarcel int voidval; 259130803Smarcel struct block *bval; 260130803Smarcel enum exp_opcode opcode; 261130803Smarcel struct internalvar *ivar; 262130803Smarcel 263130803Smarcel struct type **tvec; 264130803Smarcel int *ivec; 265130803Smarcel } YYSTYPE; 266130803Smarcel/* Line 191 of yacc.c. */ 267130803Smarcel# define yystype YYSTYPE /* obsolescent; will be withdrawn */ 268130803Smarcel# define YYSTYPE_IS_DECLARED 1 269130803Smarcel# define YYSTYPE_IS_TRIVIAL 1 270130803Smarcel#endif 271130803Smarcel 272130803Smarcel 273130803Smarcel 274130803Smarcel/* Copy the second part of user declarations. */ 275130803Smarcel#line 150 "c-exp.y" 276130803Smarcel 277130803Smarcel/* YYSTYPE gets defined by %union */ 278130803Smarcelstatic int parse_number (char *, int, int, YYSTYPE *); 279130803Smarcel 280130803Smarcel 281130803Smarcel/* Line 214 of yacc.c. */ 282130803Smarcel 283130803Smarcel#if ! defined (yyoverflow) || YYERROR_VERBOSE 284130803Smarcel 285130803Smarcel/* The parser invokes alloca or xmalloc; define the necessary symbols. */ 286130803Smarcel 287130803Smarcel# if YYSTACK_USE_ALLOCA 288130803Smarcel# define YYSTACK_ALLOC alloca 289130803Smarcel# else 290130803Smarcel# ifndef YYSTACK_USE_ALLOCA 291130803Smarcel# if defined (alloca) || defined (_ALLOCA_H) 292130803Smarcel# define YYSTACK_ALLOC alloca 293130803Smarcel# else 294130803Smarcel# ifdef __GNUC__ 295130803Smarcel# define YYSTACK_ALLOC __builtin_alloca 296130803Smarcel# endif 297130803Smarcel# endif 298130803Smarcel# endif 299130803Smarcel# endif 300130803Smarcel 301130803Smarcel# ifdef YYSTACK_ALLOC 302130803Smarcel /* Pacify GCC's `empty if-body' warning. */ 303130803Smarcel# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 304130803Smarcel# else 305130803Smarcel# if defined (__STDC__) || defined (__cplusplus) 306130803Smarcel# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 307130803Smarcel# define YYSIZE_T size_t 308130803Smarcel# endif 309130803Smarcel# define YYSTACK_ALLOC xmalloc 310130803Smarcel# define YYSTACK_FREE free 311130803Smarcel# endif 312130803Smarcel#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ 313130803Smarcel 314130803Smarcel 315130803Smarcel#if (! defined (yyoverflow) \ 316130803Smarcel && (! defined (__cplusplus) \ 317130803Smarcel || (YYSTYPE_IS_TRIVIAL))) 318130803Smarcel 319130803Smarcel/* A type that is properly aligned for any stack member. */ 320130803Smarcelunion yyalloc 321130803Smarcel{ 322130803Smarcel short yyss; 323130803Smarcel YYSTYPE yyvs; 324130803Smarcel }; 325130803Smarcel 326130803Smarcel/* The size of the maximum gap between one aligned stack and the next. */ 327130803Smarcel# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 328130803Smarcel 329130803Smarcel/* The size of an array large to enough to hold all stacks, each with 330130803Smarcel N elements. */ 331130803Smarcel# define YYSTACK_BYTES(N) \ 332130803Smarcel ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ 333130803Smarcel + YYSTACK_GAP_MAXIMUM) 334130803Smarcel 335130803Smarcel/* Copy COUNT objects from FROM to TO. The source and destination do 336130803Smarcel not overlap. */ 337130803Smarcel# ifndef YYCOPY 338130803Smarcel# if 1 < __GNUC__ 339130803Smarcel# define YYCOPY(To, From, Count) \ 340130803Smarcel __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 341130803Smarcel# else 342130803Smarcel# define YYCOPY(To, From, Count) \ 343130803Smarcel do \ 344130803Smarcel { \ 345130803Smarcel register YYSIZE_T yyi; \ 346130803Smarcel for (yyi = 0; yyi < (Count); yyi++) \ 347130803Smarcel (To)[yyi] = (From)[yyi]; \ 348130803Smarcel } \ 349130803Smarcel while (0) 350130803Smarcel# endif 351130803Smarcel# endif 352130803Smarcel 353130803Smarcel/* Relocate STACK from its old location to the new one. The 354130803Smarcel local variables YYSIZE and YYSTACKSIZE give the old and new number of 355130803Smarcel elements in the stack, and YYPTR gives the new location of the 356130803Smarcel stack. Advance YYPTR to a properly aligned location for the next 357130803Smarcel stack. */ 358130803Smarcel# define YYSTACK_RELOCATE(Stack) \ 359130803Smarcel do \ 360130803Smarcel { \ 361130803Smarcel YYSIZE_T yynewbytes; \ 362130803Smarcel YYCOPY (&yyptr->Stack, Stack, yysize); \ 363130803Smarcel Stack = &yyptr->Stack; \ 364130803Smarcel yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 365130803Smarcel yyptr += yynewbytes / sizeof (*yyptr); \ 366130803Smarcel } \ 367130803Smarcel while (0) 368130803Smarcel 369130803Smarcel#endif 370130803Smarcel 371130803Smarcel#if defined (__STDC__) || defined (__cplusplus) 372130803Smarcel typedef signed char yysigned_char; 373130803Smarcel#else 374130803Smarcel typedef short yysigned_char; 375130803Smarcel#endif 376130803Smarcel 377130803Smarcel/* YYFINAL -- State number of the termination state. */ 378130803Smarcel#define YYFINAL 94 379130803Smarcel/* YYLAST -- Last index in YYTABLE. */ 380130803Smarcel#define YYLAST 804 381130803Smarcel 382130803Smarcel/* YYNTOKENS -- Number of terminals. */ 383130803Smarcel#define YYNTOKENS 68 384130803Smarcel/* YYNNTS -- Number of nonterminals. */ 385130803Smarcel#define YYNNTS 31 386130803Smarcel/* YYNRULES -- Number of rules. */ 387130803Smarcel#define YYNRULES 159 388130803Smarcel/* YYNRULES -- Number of states. */ 389130803Smarcel#define YYNSTATES 242 390130803Smarcel 391130803Smarcel/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 392130803Smarcel#define YYUNDEFTOK 2 393130803Smarcel#define YYMAXUTOK 298 394130803Smarcel 395130803Smarcel#define YYTRANSLATE(YYX) \ 396130803Smarcel ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 397130803Smarcel 398130803Smarcel/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 399130803Smarcelstatic const unsigned char yytranslate[] = 400130803Smarcel{ 401130803Smarcel 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 402130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 403130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 404130803Smarcel 2, 2, 2, 61, 2, 2, 2, 51, 37, 2, 405130803Smarcel 57, 64, 49, 47, 29, 48, 55, 50, 2, 2, 406130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 67, 2, 407130803Smarcel 40, 31, 41, 32, 46, 2, 2, 2, 2, 2, 408130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 409130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 410130803Smarcel 2, 56, 2, 63, 36, 2, 2, 2, 2, 2, 411130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 412130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 413130803Smarcel 2, 2, 2, 65, 35, 66, 62, 2, 2, 2, 414130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 415130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 416130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 417130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 418130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 419130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 420130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 421130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 422130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 423130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 424130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 425130803Smarcel 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 426130803Smarcel 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 427130803Smarcel 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 428130803Smarcel 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 429130803Smarcel 25, 26, 27, 28, 30, 33, 34, 38, 39, 42, 430130803Smarcel 43, 44, 45, 52, 53, 54, 58, 59, 60 431130803Smarcel}; 432130803Smarcel 433130803Smarcel#if YYDEBUG 434130803Smarcel/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 435130803Smarcel YYRHS. */ 436130803Smarcelstatic const unsigned short yyprhs[] = 437130803Smarcel{ 438130803Smarcel 0, 0, 3, 5, 7, 9, 11, 15, 18, 21, 439130803Smarcel 24, 27, 30, 33, 36, 39, 42, 45, 49, 53, 440130803Smarcel 58, 62, 66, 71, 76, 77, 83, 85, 86, 88, 441130803Smarcel 92, 94, 98, 103, 108, 112, 116, 120, 124, 128, 442130803Smarcel 132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 443130803Smarcel 172, 176, 180, 184, 188, 194, 198, 202, 204, 206, 444130803Smarcel 208, 210, 212, 217, 219, 221, 223, 225, 227, 231, 445130803Smarcel 235, 239, 244, 246, 249, 251, 254, 256, 257, 261, 446130803Smarcel 263, 265, 267, 268, 270, 273, 275, 278, 280, 284, 447130803Smarcel 287, 289, 292, 294, 297, 301, 304, 308, 310, 314, 448130803Smarcel 316, 318, 320, 322, 325, 329, 332, 336, 340, 344, 449130803Smarcel 347, 350, 354, 359, 363, 367, 372, 376, 381, 385, 450130803Smarcel 390, 393, 397, 400, 404, 407, 411, 413, 416, 419, 451130803Smarcel 422, 425, 428, 431, 433, 436, 438, 444, 447, 450, 452130803Smarcel 452, 456, 458, 460, 462, 464, 466, 470, 472, 477, 453130803Smarcel 480, 483, 485, 487, 489, 491, 493, 495, 497, 499 454130803Smarcel}; 455130803Smarcel 456130803Smarcel/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 457130803Smarcelstatic const yysigned_char yyrhs[] = 458130803Smarcel{ 459130803Smarcel 69, 0, -1, 71, -1, 70, -1, 89, -1, 72, 460130803Smarcel -1, 71, 29, 72, -1, 49, 72, -1, 37, 72, 461130803Smarcel -1, 48, 72, -1, 61, 72, -1, 62, 72, -1, 462130803Smarcel 53, 72, -1, 52, 72, -1, 72, 53, -1, 72, 463130803Smarcel 52, -1, 13, 72, -1, 72, 58, 97, -1, 72, 464130803Smarcel 58, 79, -1, 72, 58, 49, 72, -1, 72, 55, 465130803Smarcel 97, -1, 72, 55, 79, -1, 72, 55, 49, 72, 466130803Smarcel -1, 72, 56, 71, 63, -1, -1, 72, 57, 73, 467130803Smarcel 75, 64, -1, 65, -1, -1, 72, -1, 75, 29, 468130803Smarcel 72, -1, 66, -1, 74, 75, 76, -1, 74, 89, 469130803Smarcel 76, 72, -1, 57, 89, 64, 72, -1, 57, 71, 470130803Smarcel 64, -1, 72, 46, 72, -1, 72, 49, 72, -1, 471130803Smarcel 72, 50, 72, -1, 72, 51, 72, -1, 72, 47, 472130803Smarcel 72, -1, 72, 48, 72, -1, 72, 45, 72, -1, 473130803Smarcel 72, 44, 72, -1, 72, 39, 72, -1, 72, 38, 474130803Smarcel 72, -1, 72, 43, 72, -1, 72, 42, 72, -1, 475130803Smarcel 72, 40, 72, -1, 72, 41, 72, -1, 72, 37, 476130803Smarcel 72, -1, 72, 36, 72, -1, 72, 35, 72, -1, 477130803Smarcel 72, 34, 72, -1, 72, 33, 72, -1, 72, 32, 478130803Smarcel 72, 67, 72, -1, 72, 31, 72, -1, 72, 26, 479130803Smarcel 72, -1, 3, -1, 8, -1, 4, -1, 78, -1, 480130803Smarcel 25, -1, 13, 57, 89, 64, -1, 5, -1, 27, 481130803Smarcel -1, 28, -1, 59, -1, 60, -1, 77, 15, 97, 482130803Smarcel -1, 77, 15, 97, -1, 90, 15, 97, -1, 90, 483130803Smarcel 15, 62, 97, -1, 79, -1, 15, 97, -1, 98, 484130803Smarcel -1, 46, 6, -1, 96, -1, -1, 81, 80, 81, 485130803Smarcel -1, 82, -1, 96, -1, 83, -1, -1, 49, -1, 486130803Smarcel 49, 85, -1, 37, -1, 37, 85, -1, 86, -1, 487130803Smarcel 57, 85, 64, -1, 86, 87, -1, 87, -1, 86, 488130803Smarcel 88, -1, 88, -1, 56, 63, -1, 56, 3, 63, 489130803Smarcel -1, 57, 64, -1, 57, 93, 64, -1, 94, -1, 490130803Smarcel 90, 15, 49, -1, 7, -1, 21, -1, 19, -1, 491130803Smarcel 20, -1, 19, 21, -1, 19, 18, 21, -1, 19, 492130803Smarcel 18, -1, 18, 19, 21, -1, 14, 19, 21, -1, 493130803Smarcel 19, 14, 21, -1, 19, 14, -1, 19, 19, -1, 494130803Smarcel 19, 19, 21, -1, 19, 19, 18, 21, -1, 19, 495130803Smarcel 19, 18, -1, 18, 19, 19, -1, 18, 19, 19, 496130803Smarcel 21, -1, 14, 19, 19, -1, 14, 19, 19, 21, 497130803Smarcel -1, 19, 19, 14, -1, 19, 19, 14, 21, -1, 498130803Smarcel 20, 21, -1, 20, 18, 21, -1, 20, 18, -1, 499130803Smarcel 14, 20, 21, -1, 20, 14, -1, 20, 14, 21, 500130803Smarcel -1, 24, -1, 19, 24, -1, 9, 97, -1, 10, 501130803Smarcel 97, -1, 11, 97, -1, 12, 97, -1, 14, 92, 502130803Smarcel -1, 14, -1, 18, 92, -1, 18, -1, 16, 97, 503130803Smarcel 40, 89, 41, -1, 83, 90, -1, 90, 83, -1, 504130803Smarcel 91, -1, 90, 15, 97, -1, 7, -1, 21, -1, 505130803Smarcel 19, -1, 20, -1, 89, -1, 93, 29, 89, -1, 506130803Smarcel 90, -1, 94, 84, 85, 84, -1, 22, 23, -1, 507130803Smarcel 23, 22, -1, 95, -1, 22, -1, 23, -1, 6, 508130803Smarcel -1, 59, -1, 7, -1, 8, -1, 6, -1, 59, 509130803Smarcel -1 510130803Smarcel}; 511130803Smarcel 512130803Smarcel/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 513130803Smarcelstatic const unsigned short yyrline[] = 514130803Smarcel{ 515130803Smarcel 0, 233, 233, 234, 237, 244, 245, 250, 254, 258, 516130803Smarcel 262, 266, 270, 274, 278, 282, 286, 290, 296, 304, 517130803Smarcel 308, 314, 322, 326, 333, 330, 340, 344, 347, 351, 518130803Smarcel 355, 358, 365, 371, 377, 383, 387, 391, 395, 399, 519130803Smarcel 403, 407, 411, 415, 419, 423, 427, 431, 435, 439, 520130803Smarcel 443, 447, 451, 455, 459, 463, 467, 473, 480, 491, 521130803Smarcel 498, 501, 505, 513, 538, 545, 554, 562, 568, 579, 522130803Smarcel 595, 609, 634, 635, 669, 726, 732, 733, 736, 739, 523130803Smarcel 740, 744, 745, 748, 750, 752, 754, 756, 759, 761, 524130803Smarcel 766, 773, 775, 779, 781, 785, 787, 799, 800, 805, 525130803Smarcel 807, 809, 811, 813, 815, 817, 819, 821, 823, 825, 526130803Smarcel 827, 829, 831, 833, 835, 837, 839, 841, 843, 845, 527130803Smarcel 847, 849, 851, 853, 855, 857, 859, 861, 863, 866, 528130803Smarcel 869, 872, 875, 877, 879, 881, 886, 890, 892, 894, 529130803Smarcel 942, 967, 968, 974, 980, 989, 994, 1001, 1002, 1006, 530130803Smarcel 1007, 1010, 1014, 1016, 1020, 1021, 1022, 1023, 1026, 1027 531130803Smarcel}; 532130803Smarcel#endif 533130803Smarcel 534130803Smarcel#if YYDEBUG || YYERROR_VERBOSE 535130803Smarcel/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 536130803Smarcel First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 537130803Smarcelstatic const char *const yytname[] = 538130803Smarcel{ 539130803Smarcel "$end", "error", "$undefined", "INT", "FLOAT", "STRING", "NAME", 540130803Smarcel "TYPENAME", "NAME_OR_INT", "STRUCT", "CLASS", "UNION", "ENUM", "SIZEOF", 541130803Smarcel "UNSIGNED", "COLONCOLON", "TEMPLATE", "ERROR", "SIGNED_KEYWORD", "LONG", 542130803Smarcel "SHORT", "INT_KEYWORD", "CONST_KEYWORD", "VOLATILE_KEYWORD", 543130803Smarcel "DOUBLE_KEYWORD", "VARIABLE", "ASSIGN_MODIFY", "TRUEKEYWORD", 544130803Smarcel "FALSEKEYWORD", "','", "ABOVE_COMMA", "'='", "'?'", "OROR", "ANDAND", 545130803Smarcel "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL", "'<'", "'>'", "GEQ", "LEQ", 546130803Smarcel "RSH", "LSH", "'@'", "'+'", "'-'", "'*'", "'/'", "'%'", "DECREMENT", 547130803Smarcel "INCREMENT", "UNARY", "'.'", "'['", "'('", "ARROW", "BLOCKNAME", 548130803Smarcel "FILENAME", "'!'", "'~'", "']'", "')'", "'{'", "'}'", "':'", "$accept", 549130803Smarcel "start", "type_exp", "exp1", "exp", "@1", "lcurly", "arglist", "rcurly", 550130803Smarcel "block", "variable", "qualified_name", "space_identifier", 551130803Smarcel "const_or_volatile", "cv_with_space_id", 552130803Smarcel "const_or_volatile_or_space_identifier_noopt", 553130803Smarcel "const_or_volatile_or_space_identifier", "abs_decl", "direct_abs_decl", 554130803Smarcel "array_mod", "func_mod", "type", "typebase", "qualified_type", 555130803Smarcel "typename", "nonempty_typelist", "ptype", "const_and_volatile", 556130803Smarcel "const_or_volatile_noopt", "name", "name_not_typename", 0 557130803Smarcel}; 558130803Smarcel#endif 559130803Smarcel 560130803Smarcel# ifdef YYPRINT 561130803Smarcel/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 562130803Smarcel token YYLEX-NUM. */ 563130803Smarcelstatic const unsigned short yytoknum[] = 564130803Smarcel{ 565130803Smarcel 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 566130803Smarcel 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 567130803Smarcel 275, 276, 277, 278, 279, 280, 281, 282, 283, 44, 568130803Smarcel 284, 61, 63, 285, 286, 124, 94, 38, 287, 288, 569130803Smarcel 60, 62, 289, 290, 291, 292, 64, 43, 45, 42, 570130803Smarcel 47, 37, 293, 294, 295, 46, 91, 40, 296, 297, 571130803Smarcel 298, 33, 126, 93, 41, 123, 125, 58 572130803Smarcel}; 573130803Smarcel# endif 574130803Smarcel 575130803Smarcel/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 576130803Smarcelstatic const unsigned char yyr1[] = 577130803Smarcel{ 578130803Smarcel 0, 68, 69, 69, 70, 71, 71, 72, 72, 72, 579130803Smarcel 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 580130803Smarcel 72, 72, 72, 72, 73, 72, 74, 75, 75, 75, 581130803Smarcel 76, 72, 72, 72, 72, 72, 72, 72, 72, 72, 582130803Smarcel 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 583130803Smarcel 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 584130803Smarcel 72, 72, 72, 72, 72, 72, 77, 77, 77, 78, 585130803Smarcel 79, 79, 78, 78, 78, 80, 81, 81, 82, 83, 586130803Smarcel 83, 84, 84, 85, 85, 85, 85, 85, 86, 86, 587130803Smarcel 86, 86, 86, 87, 87, 88, 88, 89, 89, 90, 588130803Smarcel 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 589130803Smarcel 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 590130803Smarcel 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 591130803Smarcel 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 592130803Smarcel 91, 92, 92, 92, 92, 93, 93, 94, 94, 95, 593130803Smarcel 95, 96, 96, 96, 97, 97, 97, 97, 98, 98 594130803Smarcel}; 595130803Smarcel 596130803Smarcel/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 597130803Smarcelstatic const unsigned char yyr2[] = 598130803Smarcel{ 599130803Smarcel 0, 2, 1, 1, 1, 1, 3, 2, 2, 2, 600130803Smarcel 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 601130803Smarcel 3, 3, 4, 4, 0, 5, 1, 0, 1, 3, 602130803Smarcel 1, 3, 4, 4, 3, 3, 3, 3, 3, 3, 603130803Smarcel 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 604130803Smarcel 3, 3, 3, 3, 5, 3, 3, 1, 1, 1, 605130803Smarcel 1, 1, 4, 1, 1, 1, 1, 1, 3, 3, 606130803Smarcel 3, 4, 1, 2, 1, 2, 1, 0, 3, 1, 607130803Smarcel 1, 1, 0, 1, 2, 1, 2, 1, 3, 2, 608130803Smarcel 1, 2, 1, 2, 3, 2, 3, 1, 3, 1, 609130803Smarcel 1, 1, 1, 2, 3, 2, 3, 3, 3, 2, 610130803Smarcel 2, 3, 4, 3, 3, 4, 3, 4, 3, 4, 611130803Smarcel 2, 3, 2, 3, 2, 3, 1, 2, 2, 2, 612130803Smarcel 2, 2, 2, 1, 2, 1, 5, 2, 2, 1, 613130803Smarcel 3, 1, 1, 1, 1, 1, 3, 1, 4, 2, 614130803Smarcel 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 615130803Smarcel}; 616130803Smarcel 617130803Smarcel/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 618130803Smarcel STATE-NUM when YYTABLE doesn't specify something else to do. Zero 619130803Smarcel means the default is an error. */ 620130803Smarcelstatic const unsigned char yydefact[] = 621130803Smarcel{ 622130803Smarcel 77, 57, 59, 63, 158, 99, 58, 0, 0, 0, 623130803Smarcel 0, 77, 133, 0, 0, 135, 101, 102, 100, 152, 624130803Smarcel 153, 126, 61, 64, 65, 77, 77, 77, 77, 77, 625130803Smarcel 77, 159, 67, 77, 77, 26, 0, 3, 2, 5, 626130803Smarcel 27, 0, 60, 72, 0, 79, 77, 4, 147, 139, 627130803Smarcel 97, 151, 80, 74, 154, 156, 157, 155, 128, 129, 628130803Smarcel 130, 131, 77, 16, 77, 141, 143, 144, 142, 132, 629130803Smarcel 73, 0, 143, 144, 134, 109, 105, 110, 103, 127, 630130803Smarcel 124, 122, 120, 149, 150, 8, 9, 7, 13, 12, 631130803Smarcel 0, 0, 10, 11, 1, 77, 77, 77, 77, 77, 632130803Smarcel 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 633130803Smarcel 77, 77, 77, 77, 77, 77, 77, 77, 15, 14, 634130803Smarcel 77, 77, 24, 77, 28, 0, 0, 0, 0, 77, 635130803Smarcel 137, 0, 138, 81, 0, 0, 0, 116, 107, 123, 636130803Smarcel 77, 114, 106, 108, 104, 118, 113, 111, 125, 121, 637130803Smarcel 34, 77, 6, 56, 55, 0, 53, 52, 51, 50, 638130803Smarcel 49, 44, 43, 47, 48, 46, 45, 42, 41, 35, 639130803Smarcel 39, 40, 36, 37, 38, 156, 77, 21, 20, 0, 640130803Smarcel 27, 77, 18, 17, 77, 30, 31, 77, 69, 75, 641130803Smarcel 78, 76, 0, 98, 0, 70, 85, 83, 0, 77, 642130803Smarcel 82, 87, 90, 92, 62, 117, 0, 147, 115, 119, 643130803Smarcel 112, 33, 77, 22, 23, 0, 19, 29, 32, 140, 644130803Smarcel 71, 86, 84, 0, 93, 95, 0, 145, 0, 148, 645130803Smarcel 77, 89, 91, 136, 0, 54, 25, 94, 88, 77, 646130803Smarcel 96, 146 647130803Smarcel}; 648130803Smarcel 649130803Smarcel/* YYDEFGOTO[NTERM-NUM]. */ 650130803Smarcelstatic const short yydefgoto[] = 651130803Smarcel{ 652130803Smarcel -1, 36, 37, 90, 39, 180, 40, 125, 186, 41, 653130803Smarcel 42, 43, 129, 44, 45, 46, 134, 200, 201, 202, 654130803Smarcel 203, 227, 64, 49, 69, 228, 50, 51, 52, 195, 655130803Smarcel 53 656130803Smarcel}; 657130803Smarcel 658130803Smarcel/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 659130803Smarcel STATE-NUM. */ 660130803Smarcel#define YYPACT_NINF -101 661130803Smarcelstatic const short yypact[] = 662130803Smarcel{ 663130803Smarcel 320, -101, -101, -101, -101, -101, -101, 30, 30, 30, 664130803Smarcel 30, 383, 45, 30, 30, 200, 152, 36, -101, -11, 665130803Smarcel 17, -101, -101, -101, -101, 320, 320, 320, 320, 320, 666130803Smarcel 320, 29, -101, 320, 320, -101, 84, -101, 39, 597, 667130803Smarcel 257, 56, -101, -101, 57, -101, 172, -101, 68, -101, 668130803Smarcel 55, -101, 67, -101, -101, -101, -101, -101, -101, -101, 669130803Smarcel -101, -101, 320, 460, 87, -101, 40, 95, -101, -101, 670130803Smarcel -101, 99, 190, -101, -101, 156, 159, 223, -101, -101, 671130803Smarcel 164, 176, -101, -101, -101, 460, 460, 460, 460, 460, 672130803Smarcel -15, 158, 460, 460, -101, 320, 320, 320, 320, 320, 673130803Smarcel 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 674130803Smarcel 320, 320, 320, 320, 320, 320, 320, 320, -101, -101, 675130803Smarcel 194, 320, -101, 531, 597, -19, 160, 30, 218, -1, 676130803Smarcel 71, 20, -101, -101, -14, 171, 26, 215, -101, -101, 677130803Smarcel 172, 217, -101, -101, -101, 221, 224, -101, -101, -101, 678130803Smarcel -101, 320, 597, 597, 597, 560, 622, 646, 669, 691, 679130803Smarcel 712, 731, 731, 746, 746, 746, 746, 240, 240, 303, 680130803Smarcel 366, 366, 460, 460, 460, 83, 320, -101, -101, -18, 681130803Smarcel 257, 320, -101, -101, 320, -101, -101, 320, 231, -101, 682130803Smarcel -101, -101, 30, -101, 30, 210, 118, 63, 4, 472, 683130803Smarcel 2, 112, -101, -101, 446, -101, 206, 85, -101, -101, 684130803Smarcel -101, 460, 320, 460, -101, -13, 460, 597, 460, -101, 685130803Smarcel -101, -101, -101, 185, -101, -101, 186, -101, -9, -101, 686130803Smarcel 114, -101, -101, -101, 11, 526, -101, -101, -101, 172, 687130803Smarcel -101, -101 688130803Smarcel}; 689130803Smarcel 690130803Smarcel/* YYPGOTO[NTERM-NUM]. */ 691130803Smarcelstatic const short yypgoto[] = 692130803Smarcel{ 693130803Smarcel -101, -101, -101, 6, 47, -101, -101, 69, 126, -101, 694130803Smarcel -101, -67, -101, 125, -101, -35, 58, -100, -101, 54, 695130803Smarcel 73, 1, 0, -101, 241, -101, -101, -101, 128, -5, 696130803Smarcel -101 697130803Smarcel}; 698130803Smarcel 699130803Smarcel/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 700130803Smarcel positive, shift that token. If negative, reduce the rule which 701130803Smarcel number is the opposite. If zero, do what YYDEFACT says. 702130803Smarcel If YYTABLE_NINF, syntax error. */ 703130803Smarcel#define YYTABLE_NINF -141 704130803Smarcelstatic const short yytable[] = 705130803Smarcel{ 706130803Smarcel 48, 47, 58, 59, 60, 61, 38, 223, 70, 71, 707130803Smarcel 184, 95, 83, 132, 95, 133, 184, 54, 55, 56, 708130803Smarcel 239, 19, 20, 196, 19, 20, 54, 55, 56, 132, 709130803Smarcel 48, 91, 54, 55, 56, 197, 54, 55, 56, 84, 710130803Smarcel 48, 126, 198, 199, -66, 214, 130, 185, -77, 150, 711130803Smarcel 80, 236, 65, 177, 81, 240, 182, 82, 63, 137, 712130803Smarcel 193, 138, 48, 135, 66, 67, 68, 224, 95, 193, 713130803Smarcel 57, 127, 85, 86, 87, 88, 89, 19, 20, 57, 714130803Smarcel 92, 93, 194, 131, 94, 57, 192, 124, 194, 57, 715130803Smarcel 19, 20, -82, 19, 20, 132, 221, 222, -99, 226, 716130803Smarcel 234, -77, 136, 128, -82, -99, -99, 19, 20, 19, 717130803Smarcel 20, -82, -82, -76, -77, 178, 139, -77, 183, 198, 718130803Smarcel 199, 5, 188, 7, 8, 9, 10, 179, 12, -99, 719130803Smarcel 14, -77, 15, 16, 17, 18, 19, 20, 21, 140, 720130803Smarcel 207, 206, 152, 153, 154, 155, 156, 157, 158, 159, 721130803Smarcel 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 722130803Smarcel 170, 171, 172, 173, 174, 133, 75, 197, 198, 230, 723130803Smarcel 76, 77, 132, 78, 198, 199, 79, 143, 225, 5, 724130803Smarcel 144, 7, 8, 9, 10, 148, 12, 219, 14, 220, 725130803Smarcel 15, 16, 17, 18, 19, 20, 21, 149, 211, 207, 726130803Smarcel 54, 175, 56, 7, 8, 9, 10, 65, 12, 141, 727130803Smarcel 14, 142, 15, 16, 17, 18, 19, 20, 21, 72, 728130803Smarcel 73, 68, 151, 213, 189, -140, 185, 124, 216, 219, 729130803Smarcel 207, 217, -140, -140, 218, 204, 205, 145, 208, 207, 730130803Smarcel 241, 146, 209, 176, 147, 210, -68, 233, 237, 215, 731130803Smarcel 238, 211, 187, 57, 190, 231, 74, 191, 229, 235, 732130803Smarcel 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 733130803Smarcel 11, 12, 13, 14, 232, 15, 16, 17, 18, 19, 734130803Smarcel 20, 21, 22, 0, 23, 24, 112, 113, 114, 115, 735130803Smarcel 116, 117, 118, 119, 25, 120, 121, 122, 123, 0, 736130803Smarcel 0, 0, 0, -77, 0, 26, 27, 0, 0, 28, 737130803Smarcel 29, 0, 0, 0, 30, 0, 31, 32, 33, 34, 738130803Smarcel 0, 0, 35, 1, 2, 3, 4, 5, 6, 7, 739130803Smarcel 8, 9, 10, 11, 12, 13, 14, 0, 15, 16, 740130803Smarcel 17, 18, 19, 20, 21, 22, 0, 23, 24, 0, 741130803Smarcel 113, 114, 115, 116, 117, 118, 119, 25, 120, 121, 742130803Smarcel 122, 123, 0, 0, 0, 0, 0, 0, 26, 27, 743130803Smarcel 0, 0, 28, 29, 0, 0, 0, 30, 0, 31, 744130803Smarcel 32, 33, 34, 0, 0, 35, 1, 2, 3, 4, 745130803Smarcel 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 746130803Smarcel 0, 15, 16, 17, 18, 19, 20, 21, 22, 0, 747130803Smarcel 23, 24, 0, 0, 0, 115, 116, 117, 118, 119, 748130803Smarcel 25, 120, 121, 122, 123, 0, 0, 0, 0, 0, 749130803Smarcel 0, 26, 27, 0, 0, 28, 29, 0, 0, 0, 750130803Smarcel 62, 0, 31, 32, 33, 34, 0, 0, 35, 1, 751130803Smarcel 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 752130803Smarcel 12, 13, 14, 0, 15, 16, 17, 18, 19, 20, 753130803Smarcel 21, 22, 0, 23, 24, 0, 0, 0, 0, 5, 754130803Smarcel 0, 7, 8, 9, 10, 0, 12, 0, 14, 0, 755130803Smarcel 15, 16, 17, 18, 19, 20, 21, 0, 28, 29, 756130803Smarcel 0, 0, 0, 30, 0, 31, 32, 33, 34, 196, 757130803Smarcel 0, 35, 118, 119, 0, 120, 121, 122, 123, 0, 758130803Smarcel 0, 197, 0, 0, 0, 0, 0, 0, 198, 199, 759130803Smarcel 0, 0, 0, 0, 0, 0, 225, 54, 175, 56, 760130803Smarcel 7, 8, 9, 10, 0, 12, 0, 14, 0, 15, 761130803Smarcel 16, 17, 18, 19, 20, 21, 0, 0, 98, 99, 762130803Smarcel 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 763130803Smarcel 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 764130803Smarcel 181, 120, 121, 122, 123, 0, 96, 0, 0, 0, 765130803Smarcel 57, 97, 98, 99, 100, 101, 102, 103, 104, 105, 766130803Smarcel 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 767130803Smarcel 116, 117, 118, 119, 0, 120, 121, 122, 123, 0, 768130803Smarcel 0, 0, 0, 96, 0, 0, 0, 212, 97, 98, 769130803Smarcel 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 770130803Smarcel 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 771130803Smarcel 119, 0, 120, 121, 122, 123, 100, 101, 102, 103, 772130803Smarcel 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 773130803Smarcel 114, 115, 116, 117, 118, 119, 0, 120, 121, 122, 774130803Smarcel 123, 101, 102, 103, 104, 105, 106, 107, 108, 109, 775130803Smarcel 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 776130803Smarcel 0, 120, 121, 122, 123, 102, 103, 104, 105, 106, 777130803Smarcel 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 778130803Smarcel 117, 118, 119, 0, 120, 121, 122, 123, 103, 104, 779130803Smarcel 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 780130803Smarcel 115, 116, 117, 118, 119, 0, 120, 121, 122, 123, 781130803Smarcel 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 782130803Smarcel 114, 115, 116, 117, 118, 119, 0, 120, 121, 122, 783130803Smarcel 123, 106, 107, 108, 109, 110, 111, 112, 113, 114, 784130803Smarcel 115, 116, 117, 118, 119, 0, 120, 121, 122, 123, 785130803Smarcel 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 786130803Smarcel 0, 120, 121, 122, 123 787130803Smarcel}; 788130803Smarcel 789130803Smarcelstatic const short yycheck[] = 790130803Smarcel{ 791130803Smarcel 0, 0, 7, 8, 9, 10, 0, 3, 13, 14, 792130803Smarcel 29, 29, 23, 48, 29, 50, 29, 6, 7, 8, 793130803Smarcel 29, 22, 23, 37, 22, 23, 6, 7, 8, 64, 794130803Smarcel 30, 30, 6, 7, 8, 49, 6, 7, 8, 22, 795130803Smarcel 40, 40, 56, 57, 15, 63, 46, 66, 46, 64, 796130803Smarcel 14, 64, 7, 120, 18, 64, 123, 21, 11, 19, 797130803Smarcel 49, 21, 62, 62, 19, 20, 21, 63, 29, 49, 798130803Smarcel 59, 15, 25, 26, 27, 28, 29, 22, 23, 59, 799130803Smarcel 33, 34, 62, 15, 0, 59, 15, 40, 62, 59, 800130803Smarcel 22, 23, 37, 22, 23, 130, 196, 197, 15, 199, 801130803Smarcel 15, 46, 15, 46, 49, 22, 23, 22, 23, 22, 802130803Smarcel 23, 56, 57, 46, 46, 120, 21, 46, 123, 56, 803130803Smarcel 57, 7, 127, 9, 10, 11, 12, 121, 14, 46, 804130803Smarcel 16, 46, 18, 19, 20, 21, 22, 23, 24, 40, 805130803Smarcel 140, 140, 95, 96, 97, 98, 99, 100, 101, 102, 806130803Smarcel 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 807130803Smarcel 113, 114, 115, 116, 117, 200, 14, 49, 56, 57, 808130803Smarcel 18, 19, 207, 21, 56, 57, 24, 21, 64, 7, 809130803Smarcel 21, 9, 10, 11, 12, 21, 14, 192, 16, 194, 810130803Smarcel 18, 19, 20, 21, 22, 23, 24, 21, 151, 199, 811130803Smarcel 6, 7, 8, 9, 10, 11, 12, 7, 14, 19, 812130803Smarcel 16, 21, 18, 19, 20, 21, 22, 23, 24, 19, 813130803Smarcel 20, 21, 64, 176, 6, 15, 66, 180, 181, 234, 814130803Smarcel 230, 184, 22, 23, 187, 64, 21, 14, 21, 239, 815130803Smarcel 239, 18, 21, 49, 21, 21, 15, 41, 63, 180, 816130803Smarcel 64, 204, 126, 59, 129, 201, 15, 129, 200, 212, 817130803Smarcel 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 818130803Smarcel 13, 14, 15, 16, 201, 18, 19, 20, 21, 22, 819130803Smarcel 23, 24, 25, -1, 27, 28, 46, 47, 48, 49, 820130803Smarcel 50, 51, 52, 53, 37, 55, 56, 57, 58, -1, 821130803Smarcel -1, -1, -1, 46, -1, 48, 49, -1, -1, 52, 822130803Smarcel 53, -1, -1, -1, 57, -1, 59, 60, 61, 62, 823130803Smarcel -1, -1, 65, 3, 4, 5, 6, 7, 8, 9, 824130803Smarcel 10, 11, 12, 13, 14, 15, 16, -1, 18, 19, 825130803Smarcel 20, 21, 22, 23, 24, 25, -1, 27, 28, -1, 826130803Smarcel 47, 48, 49, 50, 51, 52, 53, 37, 55, 56, 827130803Smarcel 57, 58, -1, -1, -1, -1, -1, -1, 48, 49, 828130803Smarcel -1, -1, 52, 53, -1, -1, -1, 57, -1, 59, 829130803Smarcel 60, 61, 62, -1, -1, 65, 3, 4, 5, 6, 830130803Smarcel 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 831130803Smarcel -1, 18, 19, 20, 21, 22, 23, 24, 25, -1, 832130803Smarcel 27, 28, -1, -1, -1, 49, 50, 51, 52, 53, 833130803Smarcel 37, 55, 56, 57, 58, -1, -1, -1, -1, -1, 834130803Smarcel -1, 48, 49, -1, -1, 52, 53, -1, -1, -1, 835130803Smarcel 57, -1, 59, 60, 61, 62, -1, -1, 65, 3, 836130803Smarcel 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 837130803Smarcel 14, 15, 16, -1, 18, 19, 20, 21, 22, 23, 838130803Smarcel 24, 25, -1, 27, 28, -1, -1, -1, -1, 7, 839130803Smarcel -1, 9, 10, 11, 12, -1, 14, -1, 16, -1, 840130803Smarcel 18, 19, 20, 21, 22, 23, 24, -1, 52, 53, 841130803Smarcel -1, -1, -1, 57, -1, 59, 60, 61, 62, 37, 842130803Smarcel -1, 65, 52, 53, -1, 55, 56, 57, 58, -1, 843130803Smarcel -1, 49, -1, -1, -1, -1, -1, -1, 56, 57, 844130803Smarcel -1, -1, -1, -1, -1, -1, 64, 6, 7, 8, 845130803Smarcel 9, 10, 11, 12, -1, 14, -1, 16, -1, 18, 846130803Smarcel 19, 20, 21, 22, 23, 24, -1, -1, 32, 33, 847130803Smarcel 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 848130803Smarcel 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 849130803Smarcel 49, 55, 56, 57, 58, -1, 26, -1, -1, -1, 850130803Smarcel 59, 31, 32, 33, 34, 35, 36, 37, 38, 39, 851130803Smarcel 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 852130803Smarcel 50, 51, 52, 53, -1, 55, 56, 57, 58, -1, 853130803Smarcel -1, -1, -1, 26, -1, -1, -1, 67, 31, 32, 854130803Smarcel 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 855130803Smarcel 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 856130803Smarcel 53, -1, 55, 56, 57, 58, 34, 35, 36, 37, 857130803Smarcel 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 858130803Smarcel 48, 49, 50, 51, 52, 53, -1, 55, 56, 57, 859130803Smarcel 58, 35, 36, 37, 38, 39, 40, 41, 42, 43, 860130803Smarcel 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 861130803Smarcel -1, 55, 56, 57, 58, 36, 37, 38, 39, 40, 862130803Smarcel 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 863130803Smarcel 51, 52, 53, -1, 55, 56, 57, 58, 37, 38, 864130803Smarcel 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 865130803Smarcel 49, 50, 51, 52, 53, -1, 55, 56, 57, 58, 866130803Smarcel 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 867130803Smarcel 48, 49, 50, 51, 52, 53, -1, 55, 56, 57, 868130803Smarcel 58, 40, 41, 42, 43, 44, 45, 46, 47, 48, 869130803Smarcel 49, 50, 51, 52, 53, -1, 55, 56, 57, 58, 870130803Smarcel 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 871130803Smarcel -1, 55, 56, 57, 58 872130803Smarcel}; 873130803Smarcel 874130803Smarcel/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 875130803Smarcel symbol of state STATE-NUM. */ 876130803Smarcelstatic const unsigned char yystos[] = 877130803Smarcel{ 878130803Smarcel 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 879130803Smarcel 12, 13, 14, 15, 16, 18, 19, 20, 21, 22, 880130803Smarcel 23, 24, 25, 27, 28, 37, 48, 49, 52, 53, 881130803Smarcel 57, 59, 60, 61, 62, 65, 69, 70, 71, 72, 882130803Smarcel 74, 77, 78, 79, 81, 82, 83, 89, 90, 91, 883130803Smarcel 94, 95, 96, 98, 6, 7, 8, 59, 97, 97, 884130803Smarcel 97, 97, 57, 72, 90, 7, 19, 20, 21, 92, 885130803Smarcel 97, 97, 19, 20, 92, 14, 18, 19, 21, 24, 886130803Smarcel 14, 18, 21, 23, 22, 72, 72, 72, 72, 72, 887130803Smarcel 71, 89, 72, 72, 0, 29, 26, 31, 32, 33, 888130803Smarcel 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 889130803Smarcel 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 890130803Smarcel 55, 56, 57, 58, 72, 75, 89, 15, 46, 80, 891130803Smarcel 90, 15, 83, 83, 84, 89, 15, 19, 21, 21, 892130803Smarcel 40, 19, 21, 21, 21, 14, 18, 21, 21, 21, 893130803Smarcel 64, 64, 72, 72, 72, 72, 72, 72, 72, 72, 894130803Smarcel 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 895130803Smarcel 72, 72, 72, 72, 72, 7, 49, 79, 97, 71, 896130803Smarcel 73, 49, 79, 97, 29, 66, 76, 76, 97, 6, 897130803Smarcel 81, 96, 15, 49, 62, 97, 37, 49, 56, 57, 898130803Smarcel 85, 86, 87, 88, 64, 21, 89, 90, 21, 21, 899130803Smarcel 21, 72, 67, 72, 63, 75, 72, 72, 72, 97, 900130803Smarcel 97, 85, 85, 3, 63, 64, 85, 89, 93, 84, 901130803Smarcel 57, 87, 88, 41, 15, 72, 64, 63, 64, 29, 902130803Smarcel 64, 89 903130803Smarcel}; 904130803Smarcel 905130803Smarcel#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) 906130803Smarcel# define YYSIZE_T __SIZE_TYPE__ 907130803Smarcel#endif 908130803Smarcel#if ! defined (YYSIZE_T) && defined (size_t) 909130803Smarcel# define YYSIZE_T size_t 910130803Smarcel#endif 911130803Smarcel#if ! defined (YYSIZE_T) 912130803Smarcel# if defined (__STDC__) || defined (__cplusplus) 913130803Smarcel# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 914130803Smarcel# define YYSIZE_T size_t 915130803Smarcel# endif 916130803Smarcel#endif 917130803Smarcel#if ! defined (YYSIZE_T) 918130803Smarcel# define YYSIZE_T unsigned int 919130803Smarcel#endif 920130803Smarcel 921130803Smarcel#define yyerrok (yyerrstatus = 0) 922130803Smarcel#define yyclearin (yychar = YYEMPTY) 923130803Smarcel#define YYEMPTY (-2) 924130803Smarcel#define YYEOF 0 925130803Smarcel 926130803Smarcel#define YYACCEPT goto yyacceptlab 927130803Smarcel#define YYABORT goto yyabortlab 928130803Smarcel#define YYERROR goto yyerrlab1 929130803Smarcel 930130803Smarcel/* Like YYERROR except do call yyerror. This remains here temporarily 931130803Smarcel to ease the transition to the new meaning of YYERROR, for GCC. 932130803Smarcel Once GCC version 2 has supplanted version 1, this can go. */ 933130803Smarcel 934130803Smarcel#define YYFAIL goto yyerrlab 935130803Smarcel 936130803Smarcel#define YYRECOVERING() (!!yyerrstatus) 937130803Smarcel 938130803Smarcel#define YYBACKUP(Token, Value) \ 939130803Smarceldo \ 940130803Smarcel if (yychar == YYEMPTY && yylen == 1) \ 941130803Smarcel { \ 942130803Smarcel yychar = (Token); \ 943130803Smarcel yylval = (Value); \ 944130803Smarcel yytoken = YYTRANSLATE (yychar); \ 945130803Smarcel YYPOPSTACK; \ 946130803Smarcel goto yybackup; \ 947130803Smarcel } \ 948130803Smarcel else \ 949130803Smarcel { \ 950130803Smarcel yyerror ("syntax error: cannot back up");\ 951130803Smarcel YYERROR; \ 952130803Smarcel } \ 953130803Smarcelwhile (0) 954130803Smarcel 955130803Smarcel#define YYTERROR 1 956130803Smarcel#define YYERRCODE 256 957130803Smarcel 958130803Smarcel/* YYLLOC_DEFAULT -- Compute the default location (before the actions 959130803Smarcel are run). */ 960130803Smarcel 961130803Smarcel#ifndef YYLLOC_DEFAULT 962130803Smarcel# define YYLLOC_DEFAULT(Current, Rhs, N) \ 963130803Smarcel Current.first_line = Rhs[1].first_line; \ 964130803Smarcel Current.first_column = Rhs[1].first_column; \ 965130803Smarcel Current.last_line = Rhs[N].last_line; \ 966130803Smarcel Current.last_column = Rhs[N].last_column; 967130803Smarcel#endif 968130803Smarcel 969130803Smarcel/* YYLEX -- calling `yylex' with the right arguments. */ 970130803Smarcel 971130803Smarcel#ifdef YYLEX_PARAM 972130803Smarcel# define YYLEX yylex (YYLEX_PARAM) 973130803Smarcel#else 974130803Smarcel# define YYLEX yylex () 975130803Smarcel#endif 976130803Smarcel 977130803Smarcel/* Enable debugging if requested. */ 978130803Smarcel#if YYDEBUG 979130803Smarcel 980130803Smarcel# ifndef YYFPRINTF 981130803Smarcel# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 982130803Smarcel# define YYFPRINTF fprintf 983130803Smarcel# endif 984130803Smarcel 985130803Smarcel# define YYDPRINTF(Args) \ 986130803Smarceldo { \ 987130803Smarcel if (yydebug) \ 988130803Smarcel YYFPRINTF Args; \ 989130803Smarcel} while (0) 990130803Smarcel 991130803Smarcel# define YYDSYMPRINT(Args) \ 992130803Smarceldo { \ 993130803Smarcel if (yydebug) \ 994130803Smarcel yysymprint Args; \ 995130803Smarcel} while (0) 996130803Smarcel 997130803Smarcel# define YYDSYMPRINTF(Title, Token, Value, Location) \ 998130803Smarceldo { \ 999130803Smarcel if (yydebug) \ 1000130803Smarcel { \ 1001130803Smarcel YYFPRINTF (stderr, "%s ", Title); \ 1002130803Smarcel yysymprint (stderr, \ 1003130803Smarcel Token, Value); \ 1004130803Smarcel YYFPRINTF (stderr, "\n"); \ 1005130803Smarcel } \ 1006130803Smarcel} while (0) 1007130803Smarcel 1008130803Smarcel/*------------------------------------------------------------------. 1009130803Smarcel| yy_stack_print -- Print the state stack from its BOTTOM up to its | 1010130803Smarcel| TOP (cinluded). | 1011130803Smarcel`------------------------------------------------------------------*/ 1012130803Smarcel 1013130803Smarcel#if defined (__STDC__) || defined (__cplusplus) 1014130803Smarcelstatic void 1015130803Smarcelyy_stack_print (short *bottom, short *top) 1016130803Smarcel#else 1017130803Smarcelstatic void 1018130803Smarcelyy_stack_print (bottom, top) 1019130803Smarcel short *bottom; 1020130803Smarcel short *top; 1021130803Smarcel#endif 1022130803Smarcel{ 1023130803Smarcel YYFPRINTF (stderr, "Stack now"); 1024130803Smarcel for (/* Nothing. */; bottom <= top; ++bottom) 1025130803Smarcel YYFPRINTF (stderr, " %d", *bottom); 1026130803Smarcel YYFPRINTF (stderr, "\n"); 1027130803Smarcel} 1028130803Smarcel 1029130803Smarcel# define YY_STACK_PRINT(Bottom, Top) \ 1030130803Smarceldo { \ 1031130803Smarcel if (yydebug) \ 1032130803Smarcel yy_stack_print ((Bottom), (Top)); \ 1033130803Smarcel} while (0) 1034130803Smarcel 1035130803Smarcel 1036130803Smarcel/*------------------------------------------------. 1037130803Smarcel| Report that the YYRULE is going to be reduced. | 1038130803Smarcel`------------------------------------------------*/ 1039130803Smarcel 1040130803Smarcel#if defined (__STDC__) || defined (__cplusplus) 1041130803Smarcelstatic void 1042130803Smarcelyy_reduce_print (int yyrule) 1043130803Smarcel#else 1044130803Smarcelstatic void 1045130803Smarcelyy_reduce_print (yyrule) 1046130803Smarcel int yyrule; 1047130803Smarcel#endif 1048130803Smarcel{ 1049130803Smarcel int yyi; 1050130803Smarcel unsigned int yylineno = yyrline[yyrule]; 1051130803Smarcel YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", 1052130803Smarcel yyrule - 1, yylineno); 1053130803Smarcel /* Print the symbols being reduced, and their result. */ 1054130803Smarcel for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) 1055130803Smarcel YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); 1056130803Smarcel YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); 1057130803Smarcel} 1058130803Smarcel 1059130803Smarcel# define YY_REDUCE_PRINT(Rule) \ 1060130803Smarceldo { \ 1061130803Smarcel if (yydebug) \ 1062130803Smarcel yy_reduce_print (Rule); \ 1063130803Smarcel} while (0) 1064130803Smarcel 1065130803Smarcel/* Nonzero means print parse trace. It is left uninitialized so that 1066130803Smarcel multiple parsers can coexist. */ 1067130803Smarcelint yydebug; 1068130803Smarcel#else /* !YYDEBUG */ 1069130803Smarcel# define YYDPRINTF(Args) 1070130803Smarcel# define YYDSYMPRINT(Args) 1071130803Smarcel# define YYDSYMPRINTF(Title, Token, Value, Location) 1072130803Smarcel# define YY_STACK_PRINT(Bottom, Top) 1073130803Smarcel# define YY_REDUCE_PRINT(Rule) 1074130803Smarcel#endif /* !YYDEBUG */ 1075130803Smarcel 1076130803Smarcel 1077130803Smarcel/* YYINITDEPTH -- initial size of the parser's stacks. */ 1078130803Smarcel#ifndef YYINITDEPTH 1079130803Smarcel# define YYINITDEPTH 200 1080130803Smarcel#endif 1081130803Smarcel 1082130803Smarcel/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 1083130803Smarcel if the built-in stack extension method is used). 1084130803Smarcel 1085130803Smarcel Do not make this value too large; the results are undefined if 1086130803Smarcel SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) 1087130803Smarcel evaluated with infinite-precision integer arithmetic. */ 1088130803Smarcel 1089130803Smarcel#if YYMAXDEPTH == 0 1090130803Smarcel# undef YYMAXDEPTH 1091130803Smarcel#endif 1092130803Smarcel 1093130803Smarcel#ifndef YYMAXDEPTH 1094130803Smarcel# define YYMAXDEPTH 10000 1095130803Smarcel#endif 1096130803Smarcel 1097130803Smarcel 1098130803Smarcel 1099130803Smarcel#if YYERROR_VERBOSE 1100130803Smarcel 1101130803Smarcel# ifndef yystrlen 1102130803Smarcel# if defined (__GLIBC__) && defined (_STRING_H) 1103130803Smarcel# define yystrlen strlen 1104130803Smarcel# else 1105130803Smarcel/* Return the length of YYSTR. */ 1106130803Smarcelstatic YYSIZE_T 1107130803Smarcel# if defined (__STDC__) || defined (__cplusplus) 1108130803Smarcelyystrlen (const char *yystr) 1109130803Smarcel# else 1110130803Smarcelyystrlen (yystr) 1111130803Smarcel const char *yystr; 1112130803Smarcel# endif 1113130803Smarcel{ 1114130803Smarcel register const char *yys = yystr; 1115130803Smarcel 1116130803Smarcel while (*yys++ != '\0') 1117130803Smarcel continue; 1118130803Smarcel 1119130803Smarcel return yys - yystr - 1; 1120130803Smarcel} 1121130803Smarcel# endif 1122130803Smarcel# endif 1123130803Smarcel 1124130803Smarcel# ifndef yystpcpy 1125130803Smarcel# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) 1126130803Smarcel# define yystpcpy stpcpy 1127130803Smarcel# else 1128130803Smarcel/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 1129130803Smarcel YYDEST. */ 1130130803Smarcelstatic char * 1131130803Smarcel# if defined (__STDC__) || defined (__cplusplus) 1132130803Smarcelyystpcpy (char *yydest, const char *yysrc) 1133130803Smarcel# else 1134130803Smarcelyystpcpy (yydest, yysrc) 1135130803Smarcel char *yydest; 1136130803Smarcel const char *yysrc; 1137130803Smarcel# endif 1138130803Smarcel{ 1139130803Smarcel register char *yyd = yydest; 1140130803Smarcel register const char *yys = yysrc; 1141130803Smarcel 1142130803Smarcel while ((*yyd++ = *yys++) != '\0') 1143130803Smarcel continue; 1144130803Smarcel 1145130803Smarcel return yyd - 1; 1146130803Smarcel} 1147130803Smarcel# endif 1148130803Smarcel# endif 1149130803Smarcel 1150130803Smarcel#endif /* !YYERROR_VERBOSE */ 1151130803Smarcel 1152130803Smarcel 1153130803Smarcel 1154130803Smarcel#if YYDEBUG 1155130803Smarcel/*--------------------------------. 1156130803Smarcel| Print this symbol on YYOUTPUT. | 1157130803Smarcel`--------------------------------*/ 1158130803Smarcel 1159130803Smarcel#if defined (__STDC__) || defined (__cplusplus) 1160130803Smarcelstatic void 1161130803Smarcelyysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) 1162130803Smarcel#else 1163130803Smarcelstatic void 1164130803Smarcelyysymprint (yyoutput, yytype, yyvaluep) 1165130803Smarcel FILE *yyoutput; 1166130803Smarcel int yytype; 1167130803Smarcel YYSTYPE *yyvaluep; 1168130803Smarcel#endif 1169130803Smarcel{ 1170130803Smarcel /* Pacify ``unused variable'' warnings. */ 1171130803Smarcel (void) yyvaluep; 1172130803Smarcel 1173130803Smarcel if (yytype < YYNTOKENS) 1174130803Smarcel { 1175130803Smarcel YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 1176130803Smarcel# ifdef YYPRINT 1177130803Smarcel YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 1178130803Smarcel# endif 1179130803Smarcel } 1180130803Smarcel else 1181130803Smarcel YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 1182130803Smarcel 1183130803Smarcel switch (yytype) 1184130803Smarcel { 1185130803Smarcel default: 1186130803Smarcel break; 1187130803Smarcel } 1188130803Smarcel YYFPRINTF (yyoutput, ")"); 1189130803Smarcel} 1190130803Smarcel 1191130803Smarcel#endif /* ! YYDEBUG */ 1192130803Smarcel/*-----------------------------------------------. 1193130803Smarcel| Release the memory associated to this symbol. | 1194130803Smarcel`-----------------------------------------------*/ 1195130803Smarcel 1196130803Smarcel#if defined (__STDC__) || defined (__cplusplus) 1197130803Smarcelstatic void 1198130803Smarcelyydestruct (int yytype, YYSTYPE *yyvaluep) 1199130803Smarcel#else 1200130803Smarcelstatic void 1201130803Smarcelyydestruct (yytype, yyvaluep) 1202130803Smarcel int yytype; 1203130803Smarcel YYSTYPE *yyvaluep; 1204130803Smarcel#endif 1205130803Smarcel{ 1206130803Smarcel /* Pacify ``unused variable'' warnings. */ 1207130803Smarcel (void) yyvaluep; 1208130803Smarcel 1209130803Smarcel switch (yytype) 1210130803Smarcel { 1211130803Smarcel 1212130803Smarcel default: 1213130803Smarcel break; 1214130803Smarcel } 1215130803Smarcel} 1216130803Smarcel 1217130803Smarcel 1218130803Smarcel/* Prevent warnings from -Wmissing-prototypes. */ 1219130803Smarcel 1220130803Smarcel#ifdef YYPARSE_PARAM 1221130803Smarcel# if defined (__STDC__) || defined (__cplusplus) 1222130803Smarcelint yyparse (void *YYPARSE_PARAM); 1223130803Smarcel# else 1224130803Smarcelint yyparse (); 1225130803Smarcel# endif 1226130803Smarcel#else /* ! YYPARSE_PARAM */ 1227130803Smarcel#if defined (__STDC__) || defined (__cplusplus) 1228130803Smarcelint yyparse (void); 1229130803Smarcel#else 1230130803Smarcelint yyparse (); 1231130803Smarcel#endif 1232130803Smarcel#endif /* ! YYPARSE_PARAM */ 1233130803Smarcel 1234130803Smarcel 1235130803Smarcel 1236130803Smarcel/* The lookahead symbol. */ 1237130803Smarcelint yychar; 1238130803Smarcel 1239130803Smarcel/* The semantic value of the lookahead symbol. */ 1240130803SmarcelYYSTYPE yylval; 1241130803Smarcel 1242130803Smarcel/* Number of syntax errors so far. */ 1243130803Smarcelint yynerrs; 1244130803Smarcel 1245130803Smarcel 1246130803Smarcel 1247130803Smarcel/*----------. 1248130803Smarcel| yyparse. | 1249130803Smarcel`----------*/ 1250130803Smarcel 1251130803Smarcel#ifdef YYPARSE_PARAM 1252130803Smarcel# if defined (__STDC__) || defined (__cplusplus) 1253130803Smarcelint yyparse (void *YYPARSE_PARAM) 1254130803Smarcel# else 1255130803Smarcelint yyparse (YYPARSE_PARAM) 1256130803Smarcel void *YYPARSE_PARAM; 1257130803Smarcel# endif 1258130803Smarcel#else /* ! YYPARSE_PARAM */ 1259130803Smarcel#if defined (__STDC__) || defined (__cplusplus) 1260130803Smarcelint 1261130803Smarcelyyparse (void) 1262130803Smarcel#else 1263130803Smarcelint 1264130803Smarcelyyparse () 1265130803Smarcel 1266130803Smarcel#endif 1267130803Smarcel#endif 1268130803Smarcel{ 1269130803Smarcel 1270130803Smarcel register int yystate; 1271130803Smarcel register int yyn; 1272130803Smarcel int yyresult; 1273130803Smarcel /* Number of tokens to shift before error messages enabled. */ 1274130803Smarcel int yyerrstatus; 1275130803Smarcel /* Lookahead token as an internal (translated) token number. */ 1276130803Smarcel int yytoken = 0; 1277130803Smarcel 1278130803Smarcel /* Three stacks and their tools: 1279130803Smarcel `yyss': related to states, 1280130803Smarcel `yyvs': related to semantic values, 1281130803Smarcel `yyls': related to locations. 1282130803Smarcel 1283130803Smarcel Refer to the stacks thru separate pointers, to allow yyoverflow 1284130803Smarcel to xreallocate them elsewhere. */ 1285130803Smarcel 1286130803Smarcel /* The state stack. */ 1287130803Smarcel short yyssa[YYINITDEPTH]; 1288130803Smarcel short *yyss = yyssa; 1289130803Smarcel register short *yyssp; 1290130803Smarcel 1291130803Smarcel /* The semantic value stack. */ 1292130803Smarcel YYSTYPE yyvsa[YYINITDEPTH]; 1293130803Smarcel YYSTYPE *yyvs = yyvsa; 1294130803Smarcel register YYSTYPE *yyvsp; 1295130803Smarcel 1296130803Smarcel 1297130803Smarcel 1298130803Smarcel#define YYPOPSTACK (yyvsp--, yyssp--) 1299130803Smarcel 1300130803Smarcel YYSIZE_T yystacksize = YYINITDEPTH; 1301130803Smarcel 1302130803Smarcel /* The variables used to return semantic value and location from the 1303130803Smarcel action routines. */ 1304130803Smarcel YYSTYPE yyval; 1305130803Smarcel 1306130803Smarcel 1307130803Smarcel /* When reducing, the number of symbols on the RHS of the reduced 1308130803Smarcel rule. */ 1309130803Smarcel int yylen; 1310130803Smarcel 1311130803Smarcel YYDPRINTF ((stderr, "Starting parse\n")); 1312130803Smarcel 1313130803Smarcel yystate = 0; 1314130803Smarcel yyerrstatus = 0; 1315130803Smarcel yynerrs = 0; 1316130803Smarcel yychar = YYEMPTY; /* Cause a token to be read. */ 1317130803Smarcel 1318130803Smarcel /* Initialize stack pointers. 1319130803Smarcel Waste one element of value and location stack 1320130803Smarcel so that they stay on the same level as the state stack. 1321130803Smarcel The wasted elements are never initialized. */ 1322130803Smarcel 1323130803Smarcel yyssp = yyss; 1324130803Smarcel yyvsp = yyvs; 1325130803Smarcel 1326130803Smarcel goto yysetstate; 1327130803Smarcel 1328130803Smarcel/*------------------------------------------------------------. 1329130803Smarcel| yynewstate -- Push a new state, which is found in yystate. | 1330130803Smarcel`------------------------------------------------------------*/ 1331130803Smarcel yynewstate: 1332130803Smarcel /* In all cases, when you get here, the value and location stacks 1333130803Smarcel have just been pushed. so pushing a state here evens the stacks. 1334130803Smarcel */ 1335130803Smarcel yyssp++; 1336130803Smarcel 1337130803Smarcel yysetstate: 1338130803Smarcel *yyssp = yystate; 1339130803Smarcel 1340130803Smarcel if (yyss + yystacksize - 1 <= yyssp) 1341130803Smarcel { 1342130803Smarcel /* Get the current used size of the three stacks, in elements. */ 1343130803Smarcel YYSIZE_T yysize = yyssp - yyss + 1; 1344130803Smarcel 1345130803Smarcel#ifdef yyoverflow 1346130803Smarcel { 1347130803Smarcel /* Give user a chance to xreallocate the stack. Use copies of 1348130803Smarcel these so that the &'s don't force the real ones into 1349130803Smarcel memory. */ 1350130803Smarcel YYSTYPE *yyvs1 = yyvs; 1351130803Smarcel short *yyss1 = yyss; 1352130803Smarcel 1353130803Smarcel 1354130803Smarcel /* Each stack pointer address is followed by the size of the 1355130803Smarcel data in use in that stack, in bytes. This used to be a 1356130803Smarcel conditional around just the two extra args, but that might 1357130803Smarcel be undefined if yyoverflow is a macro. */ 1358130803Smarcel yyoverflow ("parser stack overflow", 1359130803Smarcel &yyss1, yysize * sizeof (*yyssp), 1360130803Smarcel &yyvs1, yysize * sizeof (*yyvsp), 1361130803Smarcel 1362130803Smarcel &yystacksize); 1363130803Smarcel 1364130803Smarcel yyss = yyss1; 1365130803Smarcel yyvs = yyvs1; 1366130803Smarcel } 1367130803Smarcel#else /* no yyoverflow */ 1368130803Smarcel# ifndef YYSTACK_RELOCATE 1369130803Smarcel goto yyoverflowlab; 1370130803Smarcel# else 1371130803Smarcel /* Extend the stack our own way. */ 1372130803Smarcel if (YYMAXDEPTH <= yystacksize) 1373130803Smarcel goto yyoverflowlab; 1374130803Smarcel yystacksize *= 2; 1375130803Smarcel if (YYMAXDEPTH < yystacksize) 1376130803Smarcel yystacksize = YYMAXDEPTH; 1377130803Smarcel 1378130803Smarcel { 1379130803Smarcel short *yyss1 = yyss; 1380130803Smarcel union yyalloc *yyptr = 1381130803Smarcel (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1382130803Smarcel if (! yyptr) 1383130803Smarcel goto yyoverflowlab; 1384130803Smarcel YYSTACK_RELOCATE (yyss); 1385130803Smarcel YYSTACK_RELOCATE (yyvs); 1386130803Smarcel 1387130803Smarcel# undef YYSTACK_RELOCATE 1388130803Smarcel if (yyss1 != yyssa) 1389130803Smarcel YYSTACK_FREE (yyss1); 1390130803Smarcel } 1391130803Smarcel# endif 1392130803Smarcel#endif /* no yyoverflow */ 1393130803Smarcel 1394130803Smarcel yyssp = yyss + yysize - 1; 1395130803Smarcel yyvsp = yyvs + yysize - 1; 1396130803Smarcel 1397130803Smarcel 1398130803Smarcel YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1399130803Smarcel (unsigned long int) yystacksize)); 1400130803Smarcel 1401130803Smarcel if (yyss + yystacksize - 1 <= yyssp) 1402130803Smarcel YYABORT; 1403130803Smarcel } 1404130803Smarcel 1405130803Smarcel YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1406130803Smarcel 1407130803Smarcel goto yybackup; 1408130803Smarcel 1409130803Smarcel/*-----------. 1410130803Smarcel| yybackup. | 1411130803Smarcel`-----------*/ 1412130803Smarcelyybackup: 1413130803Smarcel 1414130803Smarcel/* Do appropriate processing given the current state. */ 1415130803Smarcel/* Read a lookahead token if we need one and don't already have one. */ 1416130803Smarcel/* yyresume: */ 1417130803Smarcel 1418130803Smarcel /* First try to decide what to do without reference to lookahead token. */ 1419130803Smarcel 1420130803Smarcel yyn = yypact[yystate]; 1421130803Smarcel if (yyn == YYPACT_NINF) 1422130803Smarcel goto yydefault; 1423130803Smarcel 1424130803Smarcel /* Not known => get a lookahead token if don't already have one. */ 1425130803Smarcel 1426130803Smarcel /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1427130803Smarcel if (yychar == YYEMPTY) 1428130803Smarcel { 1429130803Smarcel YYDPRINTF ((stderr, "Reading a token: ")); 1430130803Smarcel yychar = YYLEX; 1431130803Smarcel } 1432130803Smarcel 1433130803Smarcel if (yychar <= YYEOF) 1434130803Smarcel { 1435130803Smarcel yychar = yytoken = YYEOF; 1436130803Smarcel YYDPRINTF ((stderr, "Now at end of input.\n")); 1437130803Smarcel } 1438130803Smarcel else 1439130803Smarcel { 1440130803Smarcel yytoken = YYTRANSLATE (yychar); 1441130803Smarcel YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); 1442130803Smarcel } 1443130803Smarcel 1444130803Smarcel /* If the proper action on seeing token YYTOKEN is to reduce or to 1445130803Smarcel detect an error, take that action. */ 1446130803Smarcel yyn += yytoken; 1447130803Smarcel if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1448130803Smarcel goto yydefault; 1449130803Smarcel yyn = yytable[yyn]; 1450130803Smarcel if (yyn <= 0) 1451130803Smarcel { 1452130803Smarcel if (yyn == 0 || yyn == YYTABLE_NINF) 1453130803Smarcel goto yyerrlab; 1454130803Smarcel yyn = -yyn; 1455130803Smarcel goto yyreduce; 1456130803Smarcel } 1457130803Smarcel 1458130803Smarcel if (yyn == YYFINAL) 1459130803Smarcel YYACCEPT; 1460130803Smarcel 1461130803Smarcel /* Shift the lookahead token. */ 1462130803Smarcel YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); 1463130803Smarcel 1464130803Smarcel /* Discard the token being shifted unless it is eof. */ 1465130803Smarcel if (yychar != YYEOF) 1466130803Smarcel yychar = YYEMPTY; 1467130803Smarcel 1468130803Smarcel *++yyvsp = yylval; 1469130803Smarcel 1470130803Smarcel 1471130803Smarcel /* Count tokens shifted since error; after three, turn off error 1472130803Smarcel status. */ 1473130803Smarcel if (yyerrstatus) 1474130803Smarcel yyerrstatus--; 1475130803Smarcel 1476130803Smarcel yystate = yyn; 1477130803Smarcel goto yynewstate; 1478130803Smarcel 1479130803Smarcel 1480130803Smarcel/*-----------------------------------------------------------. 1481130803Smarcel| yydefault -- do the default action for the current state. | 1482130803Smarcel`-----------------------------------------------------------*/ 1483130803Smarcelyydefault: 1484130803Smarcel yyn = yydefact[yystate]; 1485130803Smarcel if (yyn == 0) 1486130803Smarcel goto yyerrlab; 1487130803Smarcel goto yyreduce; 1488130803Smarcel 1489130803Smarcel 1490130803Smarcel/*-----------------------------. 1491130803Smarcel| yyreduce -- Do a reduction. | 1492130803Smarcel`-----------------------------*/ 1493130803Smarcelyyreduce: 1494130803Smarcel /* yyn is the number of a rule to reduce with. */ 1495130803Smarcel yylen = yyr2[yyn]; 1496130803Smarcel 1497130803Smarcel /* If YYLEN is nonzero, implement the default value of the action: 1498130803Smarcel `$$ = $1'. 1499130803Smarcel 1500130803Smarcel Otherwise, the following line sets YYVAL to garbage. 1501130803Smarcel This behavior is undocumented and Bison 1502130803Smarcel users should not rely upon it. Assigning to YYVAL 1503130803Smarcel unconditionally makes the parser a bit smaller, and it avoids a 1504130803Smarcel GCC warning that YYVAL may be used uninitialized. */ 1505130803Smarcel yyval = yyvsp[1-yylen]; 1506130803Smarcel 1507130803Smarcel 1508130803Smarcel YY_REDUCE_PRINT (yyn); 1509130803Smarcel switch (yyn) 1510130803Smarcel { 1511130803Smarcel case 4: 1512130803Smarcel#line 238 "c-exp.y" 1513130803Smarcel { write_exp_elt_opcode(OP_TYPE); 1514130803Smarcel write_exp_elt_type(yyvsp[0].tval); 1515130803Smarcel write_exp_elt_opcode(OP_TYPE);} 1516130803Smarcel break; 1517130803Smarcel 1518130803Smarcel case 6: 1519130803Smarcel#line 246 "c-exp.y" 1520130803Smarcel { write_exp_elt_opcode (BINOP_COMMA); } 1521130803Smarcel break; 1522130803Smarcel 1523130803Smarcel case 7: 1524130803Smarcel#line 251 "c-exp.y" 1525130803Smarcel { write_exp_elt_opcode (UNOP_IND); } 1526130803Smarcel break; 1527130803Smarcel 1528130803Smarcel case 8: 1529130803Smarcel#line 255 "c-exp.y" 1530130803Smarcel { write_exp_elt_opcode (UNOP_ADDR); } 1531130803Smarcel break; 1532130803Smarcel 1533130803Smarcel case 9: 1534130803Smarcel#line 259 "c-exp.y" 1535130803Smarcel { write_exp_elt_opcode (UNOP_NEG); } 1536130803Smarcel break; 1537130803Smarcel 1538130803Smarcel case 10: 1539130803Smarcel#line 263 "c-exp.y" 1540130803Smarcel { write_exp_elt_opcode (UNOP_LOGICAL_NOT); } 1541130803Smarcel break; 1542130803Smarcel 1543130803Smarcel case 11: 1544130803Smarcel#line 267 "c-exp.y" 1545130803Smarcel { write_exp_elt_opcode (UNOP_COMPLEMENT); } 1546130803Smarcel break; 1547130803Smarcel 1548130803Smarcel case 12: 1549130803Smarcel#line 271 "c-exp.y" 1550130803Smarcel { write_exp_elt_opcode (UNOP_PREINCREMENT); } 1551130803Smarcel break; 1552130803Smarcel 1553130803Smarcel case 13: 1554130803Smarcel#line 275 "c-exp.y" 1555130803Smarcel { write_exp_elt_opcode (UNOP_PREDECREMENT); } 1556130803Smarcel break; 1557130803Smarcel 1558130803Smarcel case 14: 1559130803Smarcel#line 279 "c-exp.y" 1560130803Smarcel { write_exp_elt_opcode (UNOP_POSTINCREMENT); } 1561130803Smarcel break; 1562130803Smarcel 1563130803Smarcel case 15: 1564130803Smarcel#line 283 "c-exp.y" 1565130803Smarcel { write_exp_elt_opcode (UNOP_POSTDECREMENT); } 1566130803Smarcel break; 1567130803Smarcel 1568130803Smarcel case 16: 1569130803Smarcel#line 287 "c-exp.y" 1570130803Smarcel { write_exp_elt_opcode (UNOP_SIZEOF); } 1571130803Smarcel break; 1572130803Smarcel 1573130803Smarcel case 17: 1574130803Smarcel#line 291 "c-exp.y" 1575130803Smarcel { write_exp_elt_opcode (STRUCTOP_PTR); 1576130803Smarcel write_exp_string (yyvsp[0].sval); 1577130803Smarcel write_exp_elt_opcode (STRUCTOP_PTR); } 1578130803Smarcel break; 1579130803Smarcel 1580130803Smarcel case 18: 1581130803Smarcel#line 297 "c-exp.y" 1582130803Smarcel { /* exp->type::name becomes exp->*(&type::name) */ 1583130803Smarcel /* Note: this doesn't work if name is a 1584130803Smarcel static member! FIXME */ 1585130803Smarcel write_exp_elt_opcode (UNOP_ADDR); 1586130803Smarcel write_exp_elt_opcode (STRUCTOP_MPTR); } 1587130803Smarcel break; 1588130803Smarcel 1589130803Smarcel case 19: 1590130803Smarcel#line 305 "c-exp.y" 1591130803Smarcel { write_exp_elt_opcode (STRUCTOP_MPTR); } 1592130803Smarcel break; 1593130803Smarcel 1594130803Smarcel case 20: 1595130803Smarcel#line 309 "c-exp.y" 1596130803Smarcel { write_exp_elt_opcode (STRUCTOP_STRUCT); 1597130803Smarcel write_exp_string (yyvsp[0].sval); 1598130803Smarcel write_exp_elt_opcode (STRUCTOP_STRUCT); } 1599130803Smarcel break; 1600130803Smarcel 1601130803Smarcel case 21: 1602130803Smarcel#line 315 "c-exp.y" 1603130803Smarcel { /* exp.type::name becomes exp.*(&type::name) */ 1604130803Smarcel /* Note: this doesn't work if name is a 1605130803Smarcel static member! FIXME */ 1606130803Smarcel write_exp_elt_opcode (UNOP_ADDR); 1607130803Smarcel write_exp_elt_opcode (STRUCTOP_MEMBER); } 1608130803Smarcel break; 1609130803Smarcel 1610130803Smarcel case 22: 1611130803Smarcel#line 323 "c-exp.y" 1612130803Smarcel { write_exp_elt_opcode (STRUCTOP_MEMBER); } 1613130803Smarcel break; 1614130803Smarcel 1615130803Smarcel case 23: 1616130803Smarcel#line 327 "c-exp.y" 1617130803Smarcel { write_exp_elt_opcode (BINOP_SUBSCRIPT); } 1618130803Smarcel break; 1619130803Smarcel 1620130803Smarcel case 24: 1621130803Smarcel#line 333 "c-exp.y" 1622130803Smarcel { start_arglist (); } 1623130803Smarcel break; 1624130803Smarcel 1625130803Smarcel case 25: 1626130803Smarcel#line 335 "c-exp.y" 1627130803Smarcel { write_exp_elt_opcode (OP_FUNCALL); 1628130803Smarcel write_exp_elt_longcst ((LONGEST) end_arglist ()); 1629130803Smarcel write_exp_elt_opcode (OP_FUNCALL); } 1630130803Smarcel break; 1631130803Smarcel 1632130803Smarcel case 26: 1633130803Smarcel#line 341 "c-exp.y" 1634130803Smarcel { start_arglist (); } 1635130803Smarcel break; 1636130803Smarcel 1637130803Smarcel case 28: 1638130803Smarcel#line 348 "c-exp.y" 1639130803Smarcel { arglist_len = 1; } 1640130803Smarcel break; 1641130803Smarcel 1642130803Smarcel case 29: 1643130803Smarcel#line 352 "c-exp.y" 1644130803Smarcel { arglist_len++; } 1645130803Smarcel break; 1646130803Smarcel 1647130803Smarcel case 30: 1648130803Smarcel#line 356 "c-exp.y" 1649130803Smarcel { yyval.lval = end_arglist () - 1; } 1650130803Smarcel break; 1651130803Smarcel 1652130803Smarcel case 31: 1653130803Smarcel#line 359 "c-exp.y" 1654130803Smarcel { write_exp_elt_opcode (OP_ARRAY); 1655130803Smarcel write_exp_elt_longcst ((LONGEST) 0); 1656130803Smarcel write_exp_elt_longcst ((LONGEST) yyvsp[0].lval); 1657130803Smarcel write_exp_elt_opcode (OP_ARRAY); } 1658130803Smarcel break; 1659130803Smarcel 1660130803Smarcel case 32: 1661130803Smarcel#line 366 "c-exp.y" 1662130803Smarcel { write_exp_elt_opcode (UNOP_MEMVAL); 1663130803Smarcel write_exp_elt_type (yyvsp[-2].tval); 1664130803Smarcel write_exp_elt_opcode (UNOP_MEMVAL); } 1665130803Smarcel break; 1666130803Smarcel 1667130803Smarcel case 33: 1668130803Smarcel#line 372 "c-exp.y" 1669130803Smarcel { write_exp_elt_opcode (UNOP_CAST); 1670130803Smarcel write_exp_elt_type (yyvsp[-2].tval); 1671130803Smarcel write_exp_elt_opcode (UNOP_CAST); } 1672130803Smarcel break; 1673130803Smarcel 1674130803Smarcel case 34: 1675130803Smarcel#line 378 "c-exp.y" 1676130803Smarcel { } 1677130803Smarcel break; 1678130803Smarcel 1679130803Smarcel case 35: 1680130803Smarcel#line 384 "c-exp.y" 1681130803Smarcel { write_exp_elt_opcode (BINOP_REPEAT); } 1682130803Smarcel break; 1683130803Smarcel 1684130803Smarcel case 36: 1685130803Smarcel#line 388 "c-exp.y" 1686130803Smarcel { write_exp_elt_opcode (BINOP_MUL); } 1687130803Smarcel break; 1688130803Smarcel 1689130803Smarcel case 37: 1690130803Smarcel#line 392 "c-exp.y" 1691130803Smarcel { write_exp_elt_opcode (BINOP_DIV); } 1692130803Smarcel break; 1693130803Smarcel 1694130803Smarcel case 38: 1695130803Smarcel#line 396 "c-exp.y" 1696130803Smarcel { write_exp_elt_opcode (BINOP_REM); } 1697130803Smarcel break; 1698130803Smarcel 1699130803Smarcel case 39: 1700130803Smarcel#line 400 "c-exp.y" 1701130803Smarcel { write_exp_elt_opcode (BINOP_ADD); } 1702130803Smarcel break; 1703130803Smarcel 1704130803Smarcel case 40: 1705130803Smarcel#line 404 "c-exp.y" 1706130803Smarcel { write_exp_elt_opcode (BINOP_SUB); } 1707130803Smarcel break; 1708130803Smarcel 1709130803Smarcel case 41: 1710130803Smarcel#line 408 "c-exp.y" 1711130803Smarcel { write_exp_elt_opcode (BINOP_LSH); } 1712130803Smarcel break; 1713130803Smarcel 1714130803Smarcel case 42: 1715130803Smarcel#line 412 "c-exp.y" 1716130803Smarcel { write_exp_elt_opcode (BINOP_RSH); } 1717130803Smarcel break; 1718130803Smarcel 1719130803Smarcel case 43: 1720130803Smarcel#line 416 "c-exp.y" 1721130803Smarcel { write_exp_elt_opcode (BINOP_EQUAL); } 1722130803Smarcel break; 1723130803Smarcel 1724130803Smarcel case 44: 1725130803Smarcel#line 420 "c-exp.y" 1726130803Smarcel { write_exp_elt_opcode (BINOP_NOTEQUAL); } 1727130803Smarcel break; 1728130803Smarcel 1729130803Smarcel case 45: 1730130803Smarcel#line 424 "c-exp.y" 1731130803Smarcel { write_exp_elt_opcode (BINOP_LEQ); } 1732130803Smarcel break; 1733130803Smarcel 1734130803Smarcel case 46: 1735130803Smarcel#line 428 "c-exp.y" 1736130803Smarcel { write_exp_elt_opcode (BINOP_GEQ); } 1737130803Smarcel break; 1738130803Smarcel 1739130803Smarcel case 47: 1740130803Smarcel#line 432 "c-exp.y" 1741130803Smarcel { write_exp_elt_opcode (BINOP_LESS); } 1742130803Smarcel break; 1743130803Smarcel 1744130803Smarcel case 48: 1745130803Smarcel#line 436 "c-exp.y" 1746130803Smarcel { write_exp_elt_opcode (BINOP_GTR); } 1747130803Smarcel break; 1748130803Smarcel 1749130803Smarcel case 49: 1750130803Smarcel#line 440 "c-exp.y" 1751130803Smarcel { write_exp_elt_opcode (BINOP_BITWISE_AND); } 1752130803Smarcel break; 1753130803Smarcel 1754130803Smarcel case 50: 1755130803Smarcel#line 444 "c-exp.y" 1756130803Smarcel { write_exp_elt_opcode (BINOP_BITWISE_XOR); } 1757130803Smarcel break; 1758130803Smarcel 1759130803Smarcel case 51: 1760130803Smarcel#line 448 "c-exp.y" 1761130803Smarcel { write_exp_elt_opcode (BINOP_BITWISE_IOR); } 1762130803Smarcel break; 1763130803Smarcel 1764130803Smarcel case 52: 1765130803Smarcel#line 452 "c-exp.y" 1766130803Smarcel { write_exp_elt_opcode (BINOP_LOGICAL_AND); } 1767130803Smarcel break; 1768130803Smarcel 1769130803Smarcel case 53: 1770130803Smarcel#line 456 "c-exp.y" 1771130803Smarcel { write_exp_elt_opcode (BINOP_LOGICAL_OR); } 1772130803Smarcel break; 1773130803Smarcel 1774130803Smarcel case 54: 1775130803Smarcel#line 460 "c-exp.y" 1776130803Smarcel { write_exp_elt_opcode (TERNOP_COND); } 1777130803Smarcel break; 1778130803Smarcel 1779130803Smarcel case 55: 1780130803Smarcel#line 464 "c-exp.y" 1781130803Smarcel { write_exp_elt_opcode (BINOP_ASSIGN); } 1782130803Smarcel break; 1783130803Smarcel 1784130803Smarcel case 56: 1785130803Smarcel#line 468 "c-exp.y" 1786130803Smarcel { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); 1787130803Smarcel write_exp_elt_opcode (yyvsp[-1].opcode); 1788130803Smarcel write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); } 1789130803Smarcel break; 1790130803Smarcel 1791130803Smarcel case 57: 1792130803Smarcel#line 474 "c-exp.y" 1793130803Smarcel { write_exp_elt_opcode (OP_LONG); 1794130803Smarcel write_exp_elt_type (yyvsp[0].typed_val_int.type); 1795130803Smarcel write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val_int.val)); 1796130803Smarcel write_exp_elt_opcode (OP_LONG); } 1797130803Smarcel break; 1798130803Smarcel 1799130803Smarcel case 58: 1800130803Smarcel#line 481 "c-exp.y" 1801130803Smarcel { YYSTYPE val; 1802130803Smarcel parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val); 1803130803Smarcel write_exp_elt_opcode (OP_LONG); 1804130803Smarcel write_exp_elt_type (val.typed_val_int.type); 1805130803Smarcel write_exp_elt_longcst ((LONGEST)val.typed_val_int.val); 1806130803Smarcel write_exp_elt_opcode (OP_LONG); 1807130803Smarcel } 1808130803Smarcel break; 1809130803Smarcel 1810130803Smarcel case 59: 1811130803Smarcel#line 492 "c-exp.y" 1812130803Smarcel { write_exp_elt_opcode (OP_DOUBLE); 1813130803Smarcel write_exp_elt_type (yyvsp[0].typed_val_float.type); 1814130803Smarcel write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval); 1815130803Smarcel write_exp_elt_opcode (OP_DOUBLE); } 1816130803Smarcel break; 1817130803Smarcel 1818130803Smarcel case 62: 1819130803Smarcel#line 506 "c-exp.y" 1820130803Smarcel { write_exp_elt_opcode (OP_LONG); 1821130803Smarcel write_exp_elt_type (builtin_type_int); 1822130803Smarcel CHECK_TYPEDEF (yyvsp[-1].tval); 1823130803Smarcel write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval)); 1824130803Smarcel write_exp_elt_opcode (OP_LONG); } 1825130803Smarcel break; 1826130803Smarcel 1827130803Smarcel case 63: 1828130803Smarcel#line 514 "c-exp.y" 1829130803Smarcel { /* C strings are converted into array constants with 1830130803Smarcel an explicit null byte added at the end. Thus 1831130803Smarcel the array upper bound is the string length. 1832130803Smarcel There is no such thing in C as a completely empty 1833130803Smarcel string. */ 1834130803Smarcel char *sp = yyvsp[0].sval.ptr; int count = yyvsp[0].sval.length; 1835130803Smarcel while (count-- > 0) 1836130803Smarcel { 1837130803Smarcel write_exp_elt_opcode (OP_LONG); 1838130803Smarcel write_exp_elt_type (builtin_type_char); 1839130803Smarcel write_exp_elt_longcst ((LONGEST)(*sp++)); 1840130803Smarcel write_exp_elt_opcode (OP_LONG); 1841130803Smarcel } 1842130803Smarcel write_exp_elt_opcode (OP_LONG); 1843130803Smarcel write_exp_elt_type (builtin_type_char); 1844130803Smarcel write_exp_elt_longcst ((LONGEST)'\0'); 1845130803Smarcel write_exp_elt_opcode (OP_LONG); 1846130803Smarcel write_exp_elt_opcode (OP_ARRAY); 1847130803Smarcel write_exp_elt_longcst ((LONGEST) 0); 1848130803Smarcel write_exp_elt_longcst ((LONGEST) (yyvsp[0].sval.length)); 1849130803Smarcel write_exp_elt_opcode (OP_ARRAY); } 1850130803Smarcel break; 1851130803Smarcel 1852130803Smarcel case 64: 1853130803Smarcel#line 539 "c-exp.y" 1854130803Smarcel { write_exp_elt_opcode (OP_LONG); 1855130803Smarcel write_exp_elt_type (builtin_type_bool); 1856130803Smarcel write_exp_elt_longcst ((LONGEST) 1); 1857130803Smarcel write_exp_elt_opcode (OP_LONG); } 1858130803Smarcel break; 1859130803Smarcel 1860130803Smarcel case 65: 1861130803Smarcel#line 546 "c-exp.y" 1862130803Smarcel { write_exp_elt_opcode (OP_LONG); 1863130803Smarcel write_exp_elt_type (builtin_type_bool); 1864130803Smarcel write_exp_elt_longcst ((LONGEST) 0); 1865130803Smarcel write_exp_elt_opcode (OP_LONG); } 1866130803Smarcel break; 1867130803Smarcel 1868130803Smarcel case 66: 1869130803Smarcel#line 555 "c-exp.y" 1870130803Smarcel { 1871130803Smarcel if (yyvsp[0].ssym.sym) 1872130803Smarcel yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym); 1873130803Smarcel else 1874130803Smarcel error ("No file or function \"%s\".", 1875130803Smarcel copy_name (yyvsp[0].ssym.stoken)); 1876130803Smarcel } 1877130803Smarcel break; 1878130803Smarcel 1879130803Smarcel case 67: 1880130803Smarcel#line 563 "c-exp.y" 1881130803Smarcel { 1882130803Smarcel yyval.bval = yyvsp[0].bval; 1883130803Smarcel } 1884130803Smarcel break; 1885130803Smarcel 1886130803Smarcel case 68: 1887130803Smarcel#line 569 "c-exp.y" 1888130803Smarcel { struct symbol *tem 1889130803Smarcel = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval, 1890130803Smarcel VAR_DOMAIN, (int *) NULL, 1891130803Smarcel (struct symtab **) NULL); 1892130803Smarcel if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK) 1893130803Smarcel error ("No function \"%s\" in specified context.", 1894130803Smarcel copy_name (yyvsp[0].sval)); 1895130803Smarcel yyval.bval = SYMBOL_BLOCK_VALUE (tem); } 1896130803Smarcel break; 1897130803Smarcel 1898130803Smarcel case 69: 1899130803Smarcel#line 580 "c-exp.y" 1900130803Smarcel { struct symbol *sym; 1901130803Smarcel sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval, 1902130803Smarcel VAR_DOMAIN, (int *) NULL, 1903130803Smarcel (struct symtab **) NULL); 1904130803Smarcel if (sym == 0) 1905130803Smarcel error ("No symbol \"%s\" in specified context.", 1906130803Smarcel copy_name (yyvsp[0].sval)); 1907130803Smarcel 1908130803Smarcel write_exp_elt_opcode (OP_VAR_VALUE); 1909130803Smarcel /* block_found is set by lookup_symbol. */ 1910130803Smarcel write_exp_elt_block (block_found); 1911130803Smarcel write_exp_elt_sym (sym); 1912130803Smarcel write_exp_elt_opcode (OP_VAR_VALUE); } 1913130803Smarcel break; 1914130803Smarcel 1915130803Smarcel case 70: 1916130803Smarcel#line 596 "c-exp.y" 1917130803Smarcel { 1918130803Smarcel struct type *type = yyvsp[-2].tval; 1919130803Smarcel if (TYPE_CODE (type) != TYPE_CODE_STRUCT 1920130803Smarcel && TYPE_CODE (type) != TYPE_CODE_UNION 1921130803Smarcel && TYPE_CODE (type) != TYPE_CODE_NAMESPACE) 1922130803Smarcel error ("`%s' is not defined as an aggregate type.", 1923130803Smarcel TYPE_NAME (type)); 1924130803Smarcel 1925130803Smarcel write_exp_elt_opcode (OP_SCOPE); 1926130803Smarcel write_exp_elt_type (type); 1927130803Smarcel write_exp_string (yyvsp[0].sval); 1928130803Smarcel write_exp_elt_opcode (OP_SCOPE); 1929130803Smarcel } 1930130803Smarcel break; 1931130803Smarcel 1932130803Smarcel case 71: 1933130803Smarcel#line 610 "c-exp.y" 1934130803Smarcel { 1935130803Smarcel struct type *type = yyvsp[-3].tval; 1936130803Smarcel struct stoken tmp_token; 1937130803Smarcel if (TYPE_CODE (type) != TYPE_CODE_STRUCT 1938130803Smarcel && TYPE_CODE (type) != TYPE_CODE_UNION 1939130803Smarcel && TYPE_CODE (type) != TYPE_CODE_NAMESPACE) 1940130803Smarcel error ("`%s' is not defined as an aggregate type.", 1941130803Smarcel TYPE_NAME (type)); 1942130803Smarcel 1943130803Smarcel tmp_token.ptr = (char*) alloca (yyvsp[0].sval.length + 2); 1944130803Smarcel tmp_token.length = yyvsp[0].sval.length + 1; 1945130803Smarcel tmp_token.ptr[0] = '~'; 1946130803Smarcel memcpy (tmp_token.ptr+1, yyvsp[0].sval.ptr, yyvsp[0].sval.length); 1947130803Smarcel tmp_token.ptr[tmp_token.length] = 0; 1948130803Smarcel 1949130803Smarcel /* Check for valid destructor name. */ 1950130803Smarcel destructor_name_p (tmp_token.ptr, type); 1951130803Smarcel write_exp_elt_opcode (OP_SCOPE); 1952130803Smarcel write_exp_elt_type (type); 1953130803Smarcel write_exp_string (tmp_token); 1954130803Smarcel write_exp_elt_opcode (OP_SCOPE); 1955130803Smarcel } 1956130803Smarcel break; 1957130803Smarcel 1958130803Smarcel case 73: 1959130803Smarcel#line 636 "c-exp.y" 1960130803Smarcel { 1961130803Smarcel char *name = copy_name (yyvsp[0].sval); 1962130803Smarcel struct symbol *sym; 1963130803Smarcel struct minimal_symbol *msymbol; 1964130803Smarcel 1965130803Smarcel sym = 1966130803Smarcel lookup_symbol (name, (const struct block *) NULL, 1967130803Smarcel VAR_DOMAIN, (int *) NULL, 1968130803Smarcel (struct symtab **) NULL); 1969130803Smarcel if (sym) 1970130803Smarcel { 1971130803Smarcel write_exp_elt_opcode (OP_VAR_VALUE); 1972130803Smarcel write_exp_elt_block (NULL); 1973130803Smarcel write_exp_elt_sym (sym); 1974130803Smarcel write_exp_elt_opcode (OP_VAR_VALUE); 1975130803Smarcel break; 1976130803Smarcel } 1977130803Smarcel 1978130803Smarcel msymbol = lookup_minimal_symbol (name, NULL, NULL); 1979130803Smarcel if (msymbol != NULL) 1980130803Smarcel { 1981130803Smarcel write_exp_msymbol (msymbol, 1982130803Smarcel lookup_function_type (builtin_type_int), 1983130803Smarcel builtin_type_int); 1984130803Smarcel } 1985130803Smarcel else 1986130803Smarcel if (!have_full_symbols () && !have_partial_symbols ()) 1987130803Smarcel error ("No symbol table is loaded. Use the \"file\" command."); 1988130803Smarcel else 1989130803Smarcel error ("No symbol \"%s\" in current context.", name); 1990130803Smarcel } 1991130803Smarcel break; 1992130803Smarcel 1993130803Smarcel case 74: 1994130803Smarcel#line 670 "c-exp.y" 1995130803Smarcel { struct symbol *sym = yyvsp[0].ssym.sym; 1996130803Smarcel 1997130803Smarcel if (sym) 1998130803Smarcel { 1999130803Smarcel if (symbol_read_needs_frame (sym)) 2000130803Smarcel { 2001130803Smarcel if (innermost_block == 0 || 2002130803Smarcel contained_in (block_found, 2003130803Smarcel innermost_block)) 2004130803Smarcel innermost_block = block_found; 2005130803Smarcel } 2006130803Smarcel 2007130803Smarcel write_exp_elt_opcode (OP_VAR_VALUE); 2008130803Smarcel /* We want to use the selected frame, not 2009130803Smarcel another more inner frame which happens to 2010130803Smarcel be in the same block. */ 2011130803Smarcel write_exp_elt_block (NULL); 2012130803Smarcel write_exp_elt_sym (sym); 2013130803Smarcel write_exp_elt_opcode (OP_VAR_VALUE); 2014130803Smarcel } 2015130803Smarcel else if (yyvsp[0].ssym.is_a_field_of_this) 2016130803Smarcel { 2017130803Smarcel /* C++: it hangs off of `this'. Must 2018130803Smarcel not inadvertently convert from a method call 2019130803Smarcel to data ref. */ 2020130803Smarcel if (innermost_block == 0 || 2021130803Smarcel contained_in (block_found, innermost_block)) 2022130803Smarcel innermost_block = block_found; 2023130803Smarcel write_exp_elt_opcode (OP_THIS); 2024130803Smarcel write_exp_elt_opcode (OP_THIS); 2025130803Smarcel write_exp_elt_opcode (STRUCTOP_PTR); 2026130803Smarcel write_exp_string (yyvsp[0].ssym.stoken); 2027130803Smarcel write_exp_elt_opcode (STRUCTOP_PTR); 2028130803Smarcel } 2029130803Smarcel else 2030130803Smarcel { 2031130803Smarcel struct minimal_symbol *msymbol; 2032130803Smarcel char *arg = copy_name (yyvsp[0].ssym.stoken); 2033130803Smarcel 2034130803Smarcel msymbol = 2035130803Smarcel lookup_minimal_symbol (arg, NULL, NULL); 2036130803Smarcel if (msymbol != NULL) 2037130803Smarcel { 2038130803Smarcel write_exp_msymbol (msymbol, 2039130803Smarcel lookup_function_type (builtin_type_int), 2040130803Smarcel builtin_type_int); 2041130803Smarcel } 2042130803Smarcel else if (!have_full_symbols () && !have_partial_symbols ()) 2043130803Smarcel error ("No symbol table is loaded. Use the \"file\" command."); 2044130803Smarcel else 2045130803Smarcel error ("No symbol \"%s\" in current context.", 2046130803Smarcel copy_name (yyvsp[0].ssym.stoken)); 2047130803Smarcel } 2048130803Smarcel } 2049130803Smarcel break; 2050130803Smarcel 2051130803Smarcel case 75: 2052130803Smarcel#line 727 "c-exp.y" 2053130803Smarcel { push_type_address_space (copy_name (yyvsp[0].ssym.stoken)); 2054130803Smarcel push_type (tp_space_identifier); 2055130803Smarcel } 2056130803Smarcel break; 2057130803Smarcel 2058130803Smarcel case 83: 2059130803Smarcel#line 749 "c-exp.y" 2060130803Smarcel { push_type (tp_pointer); yyval.voidval = 0; } 2061130803Smarcel break; 2062130803Smarcel 2063130803Smarcel case 84: 2064130803Smarcel#line 751 "c-exp.y" 2065130803Smarcel { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; } 2066130803Smarcel break; 2067130803Smarcel 2068130803Smarcel case 85: 2069130803Smarcel#line 753 "c-exp.y" 2070130803Smarcel { push_type (tp_reference); yyval.voidval = 0; } 2071130803Smarcel break; 2072130803Smarcel 2073130803Smarcel case 86: 2074130803Smarcel#line 755 "c-exp.y" 2075130803Smarcel { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; } 2076130803Smarcel break; 2077130803Smarcel 2078130803Smarcel case 88: 2079130803Smarcel#line 760 "c-exp.y" 2080130803Smarcel { yyval.voidval = yyvsp[-1].voidval; } 2081130803Smarcel break; 2082130803Smarcel 2083130803Smarcel case 89: 2084130803Smarcel#line 762 "c-exp.y" 2085130803Smarcel { 2086130803Smarcel push_type_int (yyvsp[0].lval); 2087130803Smarcel push_type (tp_array); 2088130803Smarcel } 2089130803Smarcel break; 2090130803Smarcel 2091130803Smarcel case 90: 2092130803Smarcel#line 767 "c-exp.y" 2093130803Smarcel { 2094130803Smarcel push_type_int (yyvsp[0].lval); 2095130803Smarcel push_type (tp_array); 2096130803Smarcel yyval.voidval = 0; 2097130803Smarcel } 2098130803Smarcel break; 2099130803Smarcel 2100130803Smarcel case 91: 2101130803Smarcel#line 774 "c-exp.y" 2102130803Smarcel { push_type (tp_function); } 2103130803Smarcel break; 2104130803Smarcel 2105130803Smarcel case 92: 2106130803Smarcel#line 776 "c-exp.y" 2107130803Smarcel { push_type (tp_function); } 2108130803Smarcel break; 2109130803Smarcel 2110130803Smarcel case 93: 2111130803Smarcel#line 780 "c-exp.y" 2112130803Smarcel { yyval.lval = -1; } 2113130803Smarcel break; 2114130803Smarcel 2115130803Smarcel case 94: 2116130803Smarcel#line 782 "c-exp.y" 2117130803Smarcel { yyval.lval = yyvsp[-1].typed_val_int.val; } 2118130803Smarcel break; 2119130803Smarcel 2120130803Smarcel case 95: 2121130803Smarcel#line 786 "c-exp.y" 2122130803Smarcel { yyval.voidval = 0; } 2123130803Smarcel break; 2124130803Smarcel 2125130803Smarcel case 96: 2126130803Smarcel#line 788 "c-exp.y" 2127130803Smarcel { free (yyvsp[-1].tvec); yyval.voidval = 0; } 2128130803Smarcel break; 2129130803Smarcel 2130130803Smarcel case 98: 2131130803Smarcel#line 801 "c-exp.y" 2132130803Smarcel { yyval.tval = lookup_member_type (builtin_type_int, yyvsp[-2].tval); } 2133130803Smarcel break; 2134130803Smarcel 2135130803Smarcel case 99: 2136130803Smarcel#line 806 "c-exp.y" 2137130803Smarcel { yyval.tval = yyvsp[0].tsym.type; } 2138130803Smarcel break; 2139130803Smarcel 2140130803Smarcel case 100: 2141130803Smarcel#line 808 "c-exp.y" 2142130803Smarcel { yyval.tval = builtin_type_int; } 2143130803Smarcel break; 2144130803Smarcel 2145130803Smarcel case 101: 2146130803Smarcel#line 810 "c-exp.y" 2147130803Smarcel { yyval.tval = builtin_type_long; } 2148130803Smarcel break; 2149130803Smarcel 2150130803Smarcel case 102: 2151130803Smarcel#line 812 "c-exp.y" 2152130803Smarcel { yyval.tval = builtin_type_short; } 2153130803Smarcel break; 2154130803Smarcel 2155130803Smarcel case 103: 2156130803Smarcel#line 814 "c-exp.y" 2157130803Smarcel { yyval.tval = builtin_type_long; } 2158130803Smarcel break; 2159130803Smarcel 2160130803Smarcel case 104: 2161130803Smarcel#line 816 "c-exp.y" 2162130803Smarcel { yyval.tval = builtin_type_long; } 2163130803Smarcel break; 2164130803Smarcel 2165130803Smarcel case 105: 2166130803Smarcel#line 818 "c-exp.y" 2167130803Smarcel { yyval.tval = builtin_type_long; } 2168130803Smarcel break; 2169130803Smarcel 2170130803Smarcel case 106: 2171130803Smarcel#line 820 "c-exp.y" 2172130803Smarcel { yyval.tval = builtin_type_long; } 2173130803Smarcel break; 2174130803Smarcel 2175130803Smarcel case 107: 2176130803Smarcel#line 822 "c-exp.y" 2177130803Smarcel { yyval.tval = builtin_type_unsigned_long; } 2178130803Smarcel break; 2179130803Smarcel 2180130803Smarcel case 108: 2181130803Smarcel#line 824 "c-exp.y" 2182130803Smarcel { yyval.tval = builtin_type_unsigned_long; } 2183130803Smarcel break; 2184130803Smarcel 2185130803Smarcel case 109: 2186130803Smarcel#line 826 "c-exp.y" 2187130803Smarcel { yyval.tval = builtin_type_unsigned_long; } 2188130803Smarcel break; 2189130803Smarcel 2190130803Smarcel case 110: 2191130803Smarcel#line 828 "c-exp.y" 2192130803Smarcel { yyval.tval = builtin_type_long_long; } 2193130803Smarcel break; 2194130803Smarcel 2195130803Smarcel case 111: 2196130803Smarcel#line 830 "c-exp.y" 2197130803Smarcel { yyval.tval = builtin_type_long_long; } 2198130803Smarcel break; 2199130803Smarcel 2200130803Smarcel case 112: 2201130803Smarcel#line 832 "c-exp.y" 2202130803Smarcel { yyval.tval = builtin_type_long_long; } 2203130803Smarcel break; 2204130803Smarcel 2205130803Smarcel case 113: 2206130803Smarcel#line 834 "c-exp.y" 2207130803Smarcel { yyval.tval = builtin_type_long_long; } 2208130803Smarcel break; 2209130803Smarcel 2210130803Smarcel case 114: 2211130803Smarcel#line 836 "c-exp.y" 2212130803Smarcel { yyval.tval = builtin_type_long_long; } 2213130803Smarcel break; 2214130803Smarcel 2215130803Smarcel case 115: 2216130803Smarcel#line 838 "c-exp.y" 2217130803Smarcel { yyval.tval = builtin_type_long_long; } 2218130803Smarcel break; 2219130803Smarcel 2220130803Smarcel case 116: 2221130803Smarcel#line 840 "c-exp.y" 2222130803Smarcel { yyval.tval = builtin_type_unsigned_long_long; } 2223130803Smarcel break; 2224130803Smarcel 2225130803Smarcel case 117: 2226130803Smarcel#line 842 "c-exp.y" 2227130803Smarcel { yyval.tval = builtin_type_unsigned_long_long; } 2228130803Smarcel break; 2229130803Smarcel 2230130803Smarcel case 118: 2231130803Smarcel#line 844 "c-exp.y" 2232130803Smarcel { yyval.tval = builtin_type_unsigned_long_long; } 2233130803Smarcel break; 2234130803Smarcel 2235130803Smarcel case 119: 2236130803Smarcel#line 846 "c-exp.y" 2237130803Smarcel { yyval.tval = builtin_type_unsigned_long_long; } 2238130803Smarcel break; 2239130803Smarcel 2240130803Smarcel case 120: 2241130803Smarcel#line 848 "c-exp.y" 2242130803Smarcel { yyval.tval = builtin_type_short; } 2243130803Smarcel break; 2244130803Smarcel 2245130803Smarcel case 121: 2246130803Smarcel#line 850 "c-exp.y" 2247130803Smarcel { yyval.tval = builtin_type_short; } 2248130803Smarcel break; 2249130803Smarcel 2250130803Smarcel case 122: 2251130803Smarcel#line 852 "c-exp.y" 2252130803Smarcel { yyval.tval = builtin_type_short; } 2253130803Smarcel break; 2254130803Smarcel 2255130803Smarcel case 123: 2256130803Smarcel#line 854 "c-exp.y" 2257130803Smarcel { yyval.tval = builtin_type_unsigned_short; } 2258130803Smarcel break; 2259130803Smarcel 2260130803Smarcel case 124: 2261130803Smarcel#line 856 "c-exp.y" 2262130803Smarcel { yyval.tval = builtin_type_unsigned_short; } 2263130803Smarcel break; 2264130803Smarcel 2265130803Smarcel case 125: 2266130803Smarcel#line 858 "c-exp.y" 2267130803Smarcel { yyval.tval = builtin_type_unsigned_short; } 2268130803Smarcel break; 2269130803Smarcel 2270130803Smarcel case 126: 2271130803Smarcel#line 860 "c-exp.y" 2272130803Smarcel { yyval.tval = builtin_type_double; } 2273130803Smarcel break; 2274130803Smarcel 2275130803Smarcel case 127: 2276130803Smarcel#line 862 "c-exp.y" 2277130803Smarcel { yyval.tval = builtin_type_long_double; } 2278130803Smarcel break; 2279130803Smarcel 2280130803Smarcel case 128: 2281130803Smarcel#line 864 "c-exp.y" 2282130803Smarcel { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval), 2283130803Smarcel expression_context_block); } 2284130803Smarcel break; 2285130803Smarcel 2286130803Smarcel case 129: 2287130803Smarcel#line 867 "c-exp.y" 2288130803Smarcel { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval), 2289130803Smarcel expression_context_block); } 2290130803Smarcel break; 2291130803Smarcel 2292130803Smarcel case 130: 2293130803Smarcel#line 870 "c-exp.y" 2294130803Smarcel { yyval.tval = lookup_union (copy_name (yyvsp[0].sval), 2295130803Smarcel expression_context_block); } 2296130803Smarcel break; 2297130803Smarcel 2298130803Smarcel case 131: 2299130803Smarcel#line 873 "c-exp.y" 2300130803Smarcel { yyval.tval = lookup_enum (copy_name (yyvsp[0].sval), 2301130803Smarcel expression_context_block); } 2302130803Smarcel break; 2303130803Smarcel 2304130803Smarcel case 132: 2305130803Smarcel#line 876 "c-exp.y" 2306130803Smarcel { yyval.tval = lookup_unsigned_typename (TYPE_NAME(yyvsp[0].tsym.type)); } 2307130803Smarcel break; 2308130803Smarcel 2309130803Smarcel case 133: 2310130803Smarcel#line 878 "c-exp.y" 2311130803Smarcel { yyval.tval = builtin_type_unsigned_int; } 2312130803Smarcel break; 2313130803Smarcel 2314130803Smarcel case 134: 2315130803Smarcel#line 880 "c-exp.y" 2316130803Smarcel { yyval.tval = lookup_signed_typename (TYPE_NAME(yyvsp[0].tsym.type)); } 2317130803Smarcel break; 2318130803Smarcel 2319130803Smarcel case 135: 2320130803Smarcel#line 882 "c-exp.y" 2321130803Smarcel { yyval.tval = builtin_type_int; } 2322130803Smarcel break; 2323130803Smarcel 2324130803Smarcel case 136: 2325130803Smarcel#line 887 "c-exp.y" 2326130803Smarcel { yyval.tval = lookup_template_type(copy_name(yyvsp[-3].sval), yyvsp[-1].tval, 2327130803Smarcel expression_context_block); 2328130803Smarcel } 2329130803Smarcel break; 2330130803Smarcel 2331130803Smarcel case 137: 2332130803Smarcel#line 891 "c-exp.y" 2333130803Smarcel { yyval.tval = follow_types (yyvsp[0].tval); } 2334130803Smarcel break; 2335130803Smarcel 2336130803Smarcel case 138: 2337130803Smarcel#line 893 "c-exp.y" 2338130803Smarcel { yyval.tval = follow_types (yyvsp[-1].tval); } 2339130803Smarcel break; 2340130803Smarcel 2341130803Smarcel case 140: 2342130803Smarcel#line 943 "c-exp.y" 2343130803Smarcel { 2344130803Smarcel struct type *type = yyvsp[-2].tval; 2345130803Smarcel struct type *new_type; 2346130803Smarcel char *ncopy = alloca (yyvsp[0].sval.length + 1); 2347130803Smarcel 2348130803Smarcel memcpy (ncopy, yyvsp[0].sval.ptr, yyvsp[0].sval.length); 2349130803Smarcel ncopy[yyvsp[0].sval.length] = '\0'; 2350130803Smarcel 2351130803Smarcel if (TYPE_CODE (type) != TYPE_CODE_STRUCT 2352130803Smarcel && TYPE_CODE (type) != TYPE_CODE_UNION 2353130803Smarcel && TYPE_CODE (type) != TYPE_CODE_NAMESPACE) 2354130803Smarcel error ("`%s' is not defined as an aggregate type.", 2355130803Smarcel TYPE_NAME (type)); 2356130803Smarcel 2357130803Smarcel new_type = cp_lookup_nested_type (type, ncopy, 2358130803Smarcel expression_context_block); 2359130803Smarcel if (new_type == NULL) 2360130803Smarcel error ("No type \"%s\" within class or namespace \"%s\".", 2361130803Smarcel ncopy, TYPE_NAME (type)); 2362130803Smarcel 2363130803Smarcel yyval.tval = new_type; 2364130803Smarcel } 2365130803Smarcel break; 2366130803Smarcel 2367130803Smarcel case 142: 2368130803Smarcel#line 969 "c-exp.y" 2369130803Smarcel { 2370130803Smarcel yyval.tsym.stoken.ptr = "int"; 2371130803Smarcel yyval.tsym.stoken.length = 3; 2372130803Smarcel yyval.tsym.type = builtin_type_int; 2373130803Smarcel } 2374130803Smarcel break; 2375130803Smarcel 2376130803Smarcel case 143: 2377130803Smarcel#line 975 "c-exp.y" 2378130803Smarcel { 2379130803Smarcel yyval.tsym.stoken.ptr = "long"; 2380130803Smarcel yyval.tsym.stoken.length = 4; 2381130803Smarcel yyval.tsym.type = builtin_type_long; 2382130803Smarcel } 2383130803Smarcel break; 2384130803Smarcel 2385130803Smarcel case 144: 2386130803Smarcel#line 981 "c-exp.y" 2387130803Smarcel { 2388130803Smarcel yyval.tsym.stoken.ptr = "short"; 2389130803Smarcel yyval.tsym.stoken.length = 5; 2390130803Smarcel yyval.tsym.type = builtin_type_short; 2391130803Smarcel } 2392130803Smarcel break; 2393130803Smarcel 2394130803Smarcel case 145: 2395130803Smarcel#line 990 "c-exp.y" 2396130803Smarcel { yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2); 2397130803Smarcel yyval.ivec[0] = 1; /* Number of types in vector */ 2398130803Smarcel yyval.tvec[1] = yyvsp[0].tval; 2399130803Smarcel } 2400130803Smarcel break; 2401130803Smarcel 2402130803Smarcel case 146: 2403130803Smarcel#line 995 "c-exp.y" 2404130803Smarcel { int len = sizeof (struct type *) * (++(yyvsp[-2].ivec[0]) + 1); 2405130803Smarcel yyval.tvec = (struct type **) xrealloc ((char *) yyvsp[-2].tvec, len); 2406130803Smarcel yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval; 2407130803Smarcel } 2408130803Smarcel break; 2409130803Smarcel 2410130803Smarcel case 148: 2411130803Smarcel#line 1003 "c-exp.y" 2412130803Smarcel { yyval.tval = follow_types (yyvsp[-3].tval); } 2413130803Smarcel break; 2414130803Smarcel 2415130803Smarcel case 151: 2416130803Smarcel#line 1011 "c-exp.y" 2417130803Smarcel { push_type (tp_const); 2418130803Smarcel push_type (tp_volatile); 2419130803Smarcel } 2420130803Smarcel break; 2421130803Smarcel 2422130803Smarcel case 152: 2423130803Smarcel#line 1015 "c-exp.y" 2424130803Smarcel { push_type (tp_const); } 2425130803Smarcel break; 2426130803Smarcel 2427130803Smarcel case 153: 2428130803Smarcel#line 1017 "c-exp.y" 2429130803Smarcel { push_type (tp_volatile); } 2430130803Smarcel break; 2431130803Smarcel 2432130803Smarcel case 154: 2433130803Smarcel#line 1020 "c-exp.y" 2434130803Smarcel { yyval.sval = yyvsp[0].ssym.stoken; } 2435130803Smarcel break; 2436130803Smarcel 2437130803Smarcel case 155: 2438130803Smarcel#line 1021 "c-exp.y" 2439130803Smarcel { yyval.sval = yyvsp[0].ssym.stoken; } 2440130803Smarcel break; 2441130803Smarcel 2442130803Smarcel case 156: 2443130803Smarcel#line 1022 "c-exp.y" 2444130803Smarcel { yyval.sval = yyvsp[0].tsym.stoken; } 2445130803Smarcel break; 2446130803Smarcel 2447130803Smarcel case 157: 2448130803Smarcel#line 1023 "c-exp.y" 2449130803Smarcel { yyval.sval = yyvsp[0].ssym.stoken; } 2450130803Smarcel break; 2451130803Smarcel 2452130803Smarcel 2453130803Smarcel } 2454130803Smarcel 2455130803Smarcel/* Line 991 of yacc.c. */ 2456130803Smarcel 2457130803Smarcel yyvsp -= yylen; 2458130803Smarcel yyssp -= yylen; 2459130803Smarcel 2460130803Smarcel 2461130803Smarcel YY_STACK_PRINT (yyss, yyssp); 2462130803Smarcel 2463130803Smarcel *++yyvsp = yyval; 2464130803Smarcel 2465130803Smarcel 2466130803Smarcel /* Now `shift' the result of the reduction. Determine what state 2467130803Smarcel that goes to, based on the state we popped back to and the rule 2468130803Smarcel number reduced by. */ 2469130803Smarcel 2470130803Smarcel yyn = yyr1[yyn]; 2471130803Smarcel 2472130803Smarcel yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 2473130803Smarcel if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 2474130803Smarcel yystate = yytable[yystate]; 2475130803Smarcel else 2476130803Smarcel yystate = yydefgoto[yyn - YYNTOKENS]; 2477130803Smarcel 2478130803Smarcel goto yynewstate; 2479130803Smarcel 2480130803Smarcel 2481130803Smarcel/*------------------------------------. 2482130803Smarcel| yyerrlab -- here on detecting error | 2483130803Smarcel`------------------------------------*/ 2484130803Smarcelyyerrlab: 2485130803Smarcel /* If not already recovering from an error, report this error. */ 2486130803Smarcel if (!yyerrstatus) 2487130803Smarcel { 2488130803Smarcel ++yynerrs; 2489130803Smarcel#if YYERROR_VERBOSE 2490130803Smarcel yyn = yypact[yystate]; 2491130803Smarcel 2492130803Smarcel if (YYPACT_NINF < yyn && yyn < YYLAST) 2493130803Smarcel { 2494130803Smarcel YYSIZE_T yysize = 0; 2495130803Smarcel int yytype = YYTRANSLATE (yychar); 2496130803Smarcel char *yymsg; 2497130803Smarcel int yyx, yycount; 2498130803Smarcel 2499130803Smarcel yycount = 0; 2500130803Smarcel /* Start YYX at -YYN if negative to avoid negative indexes in 2501130803Smarcel YYCHECK. */ 2502130803Smarcel for (yyx = yyn < 0 ? -yyn : 0; 2503130803Smarcel yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) 2504130803Smarcel if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 2505130803Smarcel yysize += yystrlen (yytname[yyx]) + 15, yycount++; 2506130803Smarcel yysize += yystrlen ("syntax error, unexpected ") + 1; 2507130803Smarcel yysize += yystrlen (yytname[yytype]); 2508130803Smarcel yymsg = (char *) YYSTACK_ALLOC (yysize); 2509130803Smarcel if (yymsg != 0) 2510130803Smarcel { 2511130803Smarcel char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); 2512130803Smarcel yyp = yystpcpy (yyp, yytname[yytype]); 2513130803Smarcel 2514130803Smarcel if (yycount < 5) 2515130803Smarcel { 2516130803Smarcel yycount = 0; 2517130803Smarcel for (yyx = yyn < 0 ? -yyn : 0; 2518130803Smarcel yyx < (int) (sizeof (yytname) / sizeof (char *)); 2519130803Smarcel yyx++) 2520130803Smarcel if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 2521130803Smarcel { 2522130803Smarcel const char *yyq = ! yycount ? ", expecting " : " or "; 2523130803Smarcel yyp = yystpcpy (yyp, yyq); 2524130803Smarcel yyp = yystpcpy (yyp, yytname[yyx]); 2525130803Smarcel yycount++; 2526130803Smarcel } 2527130803Smarcel } 2528130803Smarcel yyerror (yymsg); 2529130803Smarcel YYSTACK_FREE (yymsg); 2530130803Smarcel } 2531130803Smarcel else 2532130803Smarcel yyerror ("syntax error; also virtual memory exhausted"); 2533130803Smarcel } 2534130803Smarcel else 2535130803Smarcel#endif /* YYERROR_VERBOSE */ 2536130803Smarcel yyerror ("syntax error"); 2537130803Smarcel } 2538130803Smarcel 2539130803Smarcel 2540130803Smarcel 2541130803Smarcel if (yyerrstatus == 3) 2542130803Smarcel { 2543130803Smarcel /* If just tried and failed to reuse lookahead token after an 2544130803Smarcel error, discard it. */ 2545130803Smarcel 2546130803Smarcel /* Return failure if at end of input. */ 2547130803Smarcel if (yychar == YYEOF) 2548130803Smarcel { 2549130803Smarcel /* Pop the error token. */ 2550130803Smarcel YYPOPSTACK; 2551130803Smarcel /* Pop the rest of the stack. */ 2552130803Smarcel while (yyss < yyssp) 2553130803Smarcel { 2554130803Smarcel YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); 2555130803Smarcel yydestruct (yystos[*yyssp], yyvsp); 2556130803Smarcel YYPOPSTACK; 2557130803Smarcel } 2558130803Smarcel YYABORT; 2559130803Smarcel } 2560130803Smarcel 2561130803Smarcel YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); 2562130803Smarcel yydestruct (yytoken, &yylval); 2563130803Smarcel yychar = YYEMPTY; 2564130803Smarcel 2565130803Smarcel } 2566130803Smarcel 2567130803Smarcel /* Else will try to reuse lookahead token after shifting the error 2568130803Smarcel token. */ 2569130803Smarcel goto yyerrlab2; 2570130803Smarcel 2571130803Smarcel 2572130803Smarcel/*----------------------------------------------------. 2573130803Smarcel| yyerrlab1 -- error raised explicitly by an action. | 2574130803Smarcel`----------------------------------------------------*/ 2575130803Smarcelyyerrlab1: 2576130803Smarcel 2577130803Smarcel /* Suppress GCC warning that yyerrlab1 is unused when no action 2578130803Smarcel invokes YYERROR. Doesn't work in C++ */ 2579130803Smarcel#ifndef __cplusplus 2580130803Smarcel#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__) 2581130803Smarcel __attribute__ ((__unused__)) 2582130803Smarcel#endif 2583130803Smarcel#endif 2584130803Smarcel 2585130803Smarcel 2586130803Smarcel goto yyerrlab2; 2587130803Smarcel 2588130803Smarcel 2589130803Smarcel/*---------------------------------------------------------------. 2590130803Smarcel| yyerrlab2 -- pop states until the error token can be shifted. | 2591130803Smarcel`---------------------------------------------------------------*/ 2592130803Smarcelyyerrlab2: 2593130803Smarcel yyerrstatus = 3; /* Each real token shifted decrements this. */ 2594130803Smarcel 2595130803Smarcel for (;;) 2596130803Smarcel { 2597130803Smarcel yyn = yypact[yystate]; 2598130803Smarcel if (yyn != YYPACT_NINF) 2599130803Smarcel { 2600130803Smarcel yyn += YYTERROR; 2601130803Smarcel if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2602130803Smarcel { 2603130803Smarcel yyn = yytable[yyn]; 2604130803Smarcel if (0 < yyn) 2605130803Smarcel break; 2606130803Smarcel } 2607130803Smarcel } 2608130803Smarcel 2609130803Smarcel /* Pop the current state because it cannot handle the error token. */ 2610130803Smarcel if (yyssp == yyss) 2611130803Smarcel YYABORT; 2612130803Smarcel 2613130803Smarcel YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); 2614130803Smarcel yydestruct (yystos[yystate], yyvsp); 2615130803Smarcel yyvsp--; 2616130803Smarcel yystate = *--yyssp; 2617130803Smarcel 2618130803Smarcel YY_STACK_PRINT (yyss, yyssp); 2619130803Smarcel } 2620130803Smarcel 2621130803Smarcel if (yyn == YYFINAL) 2622130803Smarcel YYACCEPT; 2623130803Smarcel 2624130803Smarcel YYDPRINTF ((stderr, "Shifting error token, ")); 2625130803Smarcel 2626130803Smarcel *++yyvsp = yylval; 2627130803Smarcel 2628130803Smarcel 2629130803Smarcel yystate = yyn; 2630130803Smarcel goto yynewstate; 2631130803Smarcel 2632130803Smarcel 2633130803Smarcel/*-------------------------------------. 2634130803Smarcel| yyacceptlab -- YYACCEPT comes here. | 2635130803Smarcel`-------------------------------------*/ 2636130803Smarcelyyacceptlab: 2637130803Smarcel yyresult = 0; 2638130803Smarcel goto yyreturn; 2639130803Smarcel 2640130803Smarcel/*-----------------------------------. 2641130803Smarcel| yyabortlab -- YYABORT comes here. | 2642130803Smarcel`-----------------------------------*/ 2643130803Smarcelyyabortlab: 2644130803Smarcel yyresult = 1; 2645130803Smarcel goto yyreturn; 2646130803Smarcel 2647130803Smarcel#ifndef yyoverflow 2648130803Smarcel/*----------------------------------------------. 2649130803Smarcel| yyoverflowlab -- parser overflow comes here. | 2650130803Smarcel`----------------------------------------------*/ 2651130803Smarcelyyoverflowlab: 2652130803Smarcel yyerror ("parser stack overflow"); 2653130803Smarcel yyresult = 2; 2654130803Smarcel /* Fall through. */ 2655130803Smarcel#endif 2656130803Smarcel 2657130803Smarcelyyreturn: 2658130803Smarcel#ifndef yyoverflow 2659130803Smarcel if (yyss != yyssa) 2660130803Smarcel YYSTACK_FREE (yyss); 2661130803Smarcel#endif 2662130803Smarcel return yyresult; 2663130803Smarcel} 2664130803Smarcel 2665130803Smarcel 2666130803Smarcel#line 1037 "c-exp.y" 2667130803Smarcel 2668130803Smarcel 2669130803Smarcel/* Take care of parsing a number (anything that starts with a digit). 2670130803Smarcel Set yylval and return the token type; update lexptr. 2671130803Smarcel LEN is the number of characters in it. */ 2672130803Smarcel 2673130803Smarcel/*** Needs some error checking for the float case ***/ 2674130803Smarcel 2675130803Smarcelstatic int 2676130803Smarcelparse_number (p, len, parsed_float, putithere) 2677130803Smarcel char *p; 2678130803Smarcel int len; 2679130803Smarcel int parsed_float; 2680130803Smarcel YYSTYPE *putithere; 2681130803Smarcel{ 2682130803Smarcel /* FIXME: Shouldn't these be unsigned? We don't deal with negative values 2683130803Smarcel here, and we do kind of silly things like cast to unsigned. */ 2684130803Smarcel LONGEST n = 0; 2685130803Smarcel LONGEST prevn = 0; 2686130803Smarcel ULONGEST un; 2687130803Smarcel 2688130803Smarcel int i = 0; 2689130803Smarcel int c; 2690130803Smarcel int base = input_radix; 2691130803Smarcel int unsigned_p = 0; 2692130803Smarcel 2693130803Smarcel /* Number of "L" suffixes encountered. */ 2694130803Smarcel int long_p = 0; 2695130803Smarcel 2696130803Smarcel /* We have found a "L" or "U" suffix. */ 2697130803Smarcel int found_suffix = 0; 2698130803Smarcel 2699130803Smarcel ULONGEST high_bit; 2700130803Smarcel struct type *signed_type; 2701130803Smarcel struct type *unsigned_type; 2702130803Smarcel 2703130803Smarcel if (parsed_float) 2704130803Smarcel { 2705130803Smarcel /* It's a float since it contains a point or an exponent. */ 2706130803Smarcel char c; 2707130803Smarcel int num = 0; /* number of tokens scanned by scanf */ 2708130803Smarcel char saved_char = p[len]; 2709130803Smarcel 2710130803Smarcel p[len] = 0; /* null-terminate the token */ 2711130803Smarcel if (sizeof (putithere->typed_val_float.dval) <= sizeof (float)) 2712130803Smarcel num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval,&c); 2713130803Smarcel else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double)) 2714130803Smarcel num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval,&c); 2715130803Smarcel else 2716130803Smarcel { 2717130803Smarcel#ifdef SCANF_HAS_LONG_DOUBLE 2718130803Smarcel num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval,&c); 2719130803Smarcel#else 2720130803Smarcel /* Scan it into a double, then assign it to the long double. 2721130803Smarcel This at least wins with values representable in the range 2722130803Smarcel of doubles. */ 2723130803Smarcel double temp; 2724130803Smarcel num = sscanf (p, "%lg%c", &temp,&c); 2725130803Smarcel putithere->typed_val_float.dval = temp; 2726130803Smarcel#endif 2727130803Smarcel } 2728130803Smarcel p[len] = saved_char; /* restore the input stream */ 2729130803Smarcel if (num != 1) /* check scanf found ONLY a float ... */ 2730130803Smarcel return ERROR; 2731130803Smarcel /* See if it has `f' or `l' suffix (float or long double). */ 2732130803Smarcel 2733130803Smarcel c = tolower (p[len - 1]); 2734130803Smarcel 2735130803Smarcel if (c == 'f') 2736130803Smarcel putithere->typed_val_float.type = builtin_type_float; 2737130803Smarcel else if (c == 'l') 2738130803Smarcel putithere->typed_val_float.type = builtin_type_long_double; 2739130803Smarcel else if (isdigit (c) || c == '.') 2740130803Smarcel putithere->typed_val_float.type = builtin_type_double; 2741130803Smarcel else 2742130803Smarcel return ERROR; 2743130803Smarcel 2744130803Smarcel return FLOAT; 2745130803Smarcel } 2746130803Smarcel 2747130803Smarcel /* Handle base-switching prefixes 0x, 0t, 0d, 0 */ 2748130803Smarcel if (p[0] == '0') 2749130803Smarcel switch (p[1]) 2750130803Smarcel { 2751130803Smarcel case 'x': 2752130803Smarcel case 'X': 2753130803Smarcel if (len >= 3) 2754130803Smarcel { 2755130803Smarcel p += 2; 2756130803Smarcel base = 16; 2757130803Smarcel len -= 2; 2758130803Smarcel } 2759130803Smarcel break; 2760130803Smarcel 2761130803Smarcel case 't': 2762130803Smarcel case 'T': 2763130803Smarcel case 'd': 2764130803Smarcel case 'D': 2765130803Smarcel if (len >= 3) 2766130803Smarcel { 2767130803Smarcel p += 2; 2768130803Smarcel base = 10; 2769130803Smarcel len -= 2; 2770130803Smarcel } 2771130803Smarcel break; 2772130803Smarcel 2773130803Smarcel default: 2774130803Smarcel base = 8; 2775130803Smarcel break; 2776130803Smarcel } 2777130803Smarcel 2778130803Smarcel while (len-- > 0) 2779130803Smarcel { 2780130803Smarcel c = *p++; 2781130803Smarcel if (c >= 'A' && c <= 'Z') 2782130803Smarcel c += 'a' - 'A'; 2783130803Smarcel if (c != 'l' && c != 'u') 2784130803Smarcel n *= base; 2785130803Smarcel if (c >= '0' && c <= '9') 2786130803Smarcel { 2787130803Smarcel if (found_suffix) 2788130803Smarcel return ERROR; 2789130803Smarcel n += i = c - '0'; 2790130803Smarcel } 2791130803Smarcel else 2792130803Smarcel { 2793130803Smarcel if (base > 10 && c >= 'a' && c <= 'f') 2794130803Smarcel { 2795130803Smarcel if (found_suffix) 2796130803Smarcel return ERROR; 2797130803Smarcel n += i = c - 'a' + 10; 2798130803Smarcel } 2799130803Smarcel else if (c == 'l') 2800130803Smarcel { 2801130803Smarcel ++long_p; 2802130803Smarcel found_suffix = 1; 2803130803Smarcel } 2804130803Smarcel else if (c == 'u') 2805130803Smarcel { 2806130803Smarcel unsigned_p = 1; 2807130803Smarcel found_suffix = 1; 2808130803Smarcel } 2809130803Smarcel else 2810130803Smarcel return ERROR; /* Char not a digit */ 2811130803Smarcel } 2812130803Smarcel if (i >= base) 2813130803Smarcel return ERROR; /* Invalid digit in this base */ 2814130803Smarcel 2815130803Smarcel /* Portably test for overflow (only works for nonzero values, so make 2816130803Smarcel a second check for zero). FIXME: Can't we just make n and prevn 2817130803Smarcel unsigned and avoid this? */ 2818130803Smarcel if (c != 'l' && c != 'u' && (prevn >= n) && n != 0) 2819130803Smarcel unsigned_p = 1; /* Try something unsigned */ 2820130803Smarcel 2821130803Smarcel /* Portably test for unsigned overflow. 2822130803Smarcel FIXME: This check is wrong; for example it doesn't find overflow 2823130803Smarcel on 0x123456789 when LONGEST is 32 bits. */ 2824130803Smarcel if (c != 'l' && c != 'u' && n != 0) 2825130803Smarcel { 2826130803Smarcel if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n)) 2827130803Smarcel error ("Numeric constant too large."); 2828130803Smarcel } 2829130803Smarcel prevn = n; 2830130803Smarcel } 2831130803Smarcel 2832130803Smarcel /* An integer constant is an int, a long, or a long long. An L 2833130803Smarcel suffix forces it to be long; an LL suffix forces it to be long 2834130803Smarcel long. If not forced to a larger size, it gets the first type of 2835130803Smarcel the above that it fits in. To figure out whether it fits, we 2836130803Smarcel shift it right and see whether anything remains. Note that we 2837130803Smarcel can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one 2838130803Smarcel operation, because many compilers will warn about such a shift 2839130803Smarcel (which always produces a zero result). Sometimes TARGET_INT_BIT 2840130803Smarcel or TARGET_LONG_BIT will be that big, sometimes not. To deal with 2841130803Smarcel the case where it is we just always shift the value more than 2842130803Smarcel once, with fewer bits each time. */ 2843130803Smarcel 2844130803Smarcel un = (ULONGEST)n >> 2; 2845130803Smarcel if (long_p == 0 2846130803Smarcel && (un >> (TARGET_INT_BIT - 2)) == 0) 2847130803Smarcel { 2848130803Smarcel high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1); 2849130803Smarcel 2850130803Smarcel /* A large decimal (not hex or octal) constant (between INT_MAX 2851130803Smarcel and UINT_MAX) is a long or unsigned long, according to ANSI, 2852130803Smarcel never an unsigned int, but this code treats it as unsigned 2853130803Smarcel int. This probably should be fixed. GCC gives a warning on 2854130803Smarcel such constants. */ 2855130803Smarcel 2856130803Smarcel unsigned_type = builtin_type_unsigned_int; 2857130803Smarcel signed_type = builtin_type_int; 2858130803Smarcel } 2859130803Smarcel else if (long_p <= 1 2860130803Smarcel && (un >> (TARGET_LONG_BIT - 2)) == 0) 2861130803Smarcel { 2862130803Smarcel high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1); 2863130803Smarcel unsigned_type = builtin_type_unsigned_long; 2864130803Smarcel signed_type = builtin_type_long; 2865130803Smarcel } 2866130803Smarcel else 2867130803Smarcel { 2868130803Smarcel int shift; 2869130803Smarcel if (sizeof (ULONGEST) * HOST_CHAR_BIT < TARGET_LONG_LONG_BIT) 2870130803Smarcel /* A long long does not fit in a LONGEST. */ 2871130803Smarcel shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1); 2872130803Smarcel else 2873130803Smarcel shift = (TARGET_LONG_LONG_BIT - 1); 2874130803Smarcel high_bit = (ULONGEST) 1 << shift; 2875130803Smarcel unsigned_type = builtin_type_unsigned_long_long; 2876130803Smarcel signed_type = builtin_type_long_long; 2877130803Smarcel } 2878130803Smarcel 2879130803Smarcel putithere->typed_val_int.val = n; 2880130803Smarcel 2881130803Smarcel /* If the high bit of the worked out type is set then this number 2882130803Smarcel has to be unsigned. */ 2883130803Smarcel 2884130803Smarcel if (unsigned_p || (n & high_bit)) 2885130803Smarcel { 2886130803Smarcel putithere->typed_val_int.type = unsigned_type; 2887130803Smarcel } 2888130803Smarcel else 2889130803Smarcel { 2890130803Smarcel putithere->typed_val_int.type = signed_type; 2891130803Smarcel } 2892130803Smarcel 2893130803Smarcel return INT; 2894130803Smarcel} 2895130803Smarcel 2896130803Smarcelstruct token 2897130803Smarcel{ 2898130803Smarcel char *operator; 2899130803Smarcel int token; 2900130803Smarcel enum exp_opcode opcode; 2901130803Smarcel}; 2902130803Smarcel 2903130803Smarcelstatic const struct token tokentab3[] = 2904130803Smarcel { 2905130803Smarcel {">>=", ASSIGN_MODIFY, BINOP_RSH}, 2906130803Smarcel {"<<=", ASSIGN_MODIFY, BINOP_LSH} 2907130803Smarcel }; 2908130803Smarcel 2909130803Smarcelstatic const struct token tokentab2[] = 2910130803Smarcel { 2911130803Smarcel {"+=", ASSIGN_MODIFY, BINOP_ADD}, 2912130803Smarcel {"-=", ASSIGN_MODIFY, BINOP_SUB}, 2913130803Smarcel {"*=", ASSIGN_MODIFY, BINOP_MUL}, 2914130803Smarcel {"/=", ASSIGN_MODIFY, BINOP_DIV}, 2915130803Smarcel {"%=", ASSIGN_MODIFY, BINOP_REM}, 2916130803Smarcel {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR}, 2917130803Smarcel {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND}, 2918130803Smarcel {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR}, 2919130803Smarcel {"++", INCREMENT, BINOP_END}, 2920130803Smarcel {"--", DECREMENT, BINOP_END}, 2921130803Smarcel {"->", ARROW, BINOP_END}, 2922130803Smarcel {"&&", ANDAND, BINOP_END}, 2923130803Smarcel {"||", OROR, BINOP_END}, 2924130803Smarcel {"::", COLONCOLON, BINOP_END}, 2925130803Smarcel {"<<", LSH, BINOP_END}, 2926130803Smarcel {">>", RSH, BINOP_END}, 2927130803Smarcel {"==", EQUAL, BINOP_END}, 2928130803Smarcel {"!=", NOTEQUAL, BINOP_END}, 2929130803Smarcel {"<=", LEQ, BINOP_END}, 2930130803Smarcel {">=", GEQ, BINOP_END} 2931130803Smarcel }; 2932130803Smarcel 2933130803Smarcel/* Read one token, getting characters through lexptr. */ 2934130803Smarcel 2935130803Smarcelstatic int 2936130803Smarcelyylex () 2937130803Smarcel{ 2938130803Smarcel int c; 2939130803Smarcel int namelen; 2940130803Smarcel unsigned int i; 2941130803Smarcel char *tokstart; 2942130803Smarcel char *tokptr; 2943130803Smarcel int tempbufindex; 2944130803Smarcel static char *tempbuf; 2945130803Smarcel static int tempbufsize; 2946130803Smarcel struct symbol * sym_class = NULL; 2947130803Smarcel char * token_string = NULL; 2948130803Smarcel int class_prefix = 0; 2949130803Smarcel int unquoted_expr; 2950130803Smarcel 2951130803Smarcel retry: 2952130803Smarcel 2953130803Smarcel /* Check if this is a macro invocation that we need to expand. */ 2954130803Smarcel if (! scanning_macro_expansion ()) 2955130803Smarcel { 2956130803Smarcel char *expanded = macro_expand_next (&lexptr, 2957130803Smarcel expression_macro_lookup_func, 2958130803Smarcel expression_macro_lookup_baton); 2959130803Smarcel 2960130803Smarcel if (expanded) 2961130803Smarcel scan_macro_expansion (expanded); 2962130803Smarcel } 2963130803Smarcel 2964130803Smarcel prev_lexptr = lexptr; 2965130803Smarcel unquoted_expr = 1; 2966130803Smarcel 2967130803Smarcel tokstart = lexptr; 2968130803Smarcel /* See if it is a special token of length 3. */ 2969130803Smarcel for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++) 2970130803Smarcel if (strncmp (tokstart, tokentab3[i].operator, 3) == 0) 2971130803Smarcel { 2972130803Smarcel lexptr += 3; 2973130803Smarcel yylval.opcode = tokentab3[i].opcode; 2974130803Smarcel return tokentab3[i].token; 2975130803Smarcel } 2976130803Smarcel 2977130803Smarcel /* See if it is a special token of length 2. */ 2978130803Smarcel for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) 2979130803Smarcel if (strncmp (tokstart, tokentab2[i].operator, 2) == 0) 2980130803Smarcel { 2981130803Smarcel lexptr += 2; 2982130803Smarcel yylval.opcode = tokentab2[i].opcode; 2983130803Smarcel return tokentab2[i].token; 2984130803Smarcel } 2985130803Smarcel 2986130803Smarcel switch (c = *tokstart) 2987130803Smarcel { 2988130803Smarcel case 0: 2989130803Smarcel /* If we were just scanning the result of a macro expansion, 2990130803Smarcel then we need to resume scanning the original text. 2991130803Smarcel Otherwise, we were already scanning the original text, and 2992130803Smarcel we're really done. */ 2993130803Smarcel if (scanning_macro_expansion ()) 2994130803Smarcel { 2995130803Smarcel finished_macro_expansion (); 2996130803Smarcel goto retry; 2997130803Smarcel } 2998130803Smarcel else 2999130803Smarcel return 0; 3000130803Smarcel 3001130803Smarcel case ' ': 3002130803Smarcel case '\t': 3003130803Smarcel case '\n': 3004130803Smarcel lexptr++; 3005130803Smarcel goto retry; 3006130803Smarcel 3007130803Smarcel case '\'': 3008130803Smarcel /* We either have a character constant ('0' or '\177' for example) 3009130803Smarcel or we have a quoted symbol reference ('foo(int,int)' in C++ 3010130803Smarcel for example). */ 3011130803Smarcel lexptr++; 3012130803Smarcel c = *lexptr++; 3013130803Smarcel if (c == '\\') 3014130803Smarcel c = parse_escape (&lexptr); 3015130803Smarcel else if (c == '\'') 3016130803Smarcel error ("Empty character constant."); 3017130803Smarcel else if (! host_char_to_target (c, &c)) 3018130803Smarcel { 3019130803Smarcel int toklen = lexptr - tokstart + 1; 3020130803Smarcel char *tok = alloca (toklen + 1); 3021130803Smarcel memcpy (tok, tokstart, toklen); 3022130803Smarcel tok[toklen] = '\0'; 3023130803Smarcel error ("There is no character corresponding to %s in the target " 3024130803Smarcel "character set `%s'.", tok, target_charset ()); 3025130803Smarcel } 3026130803Smarcel 3027130803Smarcel yylval.typed_val_int.val = c; 3028130803Smarcel yylval.typed_val_int.type = builtin_type_char; 3029130803Smarcel 3030130803Smarcel c = *lexptr++; 3031130803Smarcel if (c != '\'') 3032130803Smarcel { 3033130803Smarcel namelen = skip_quoted (tokstart) - tokstart; 3034130803Smarcel if (namelen > 2) 3035130803Smarcel { 3036130803Smarcel lexptr = tokstart + namelen; 3037130803Smarcel unquoted_expr = 0; 3038130803Smarcel if (lexptr[-1] != '\'') 3039130803Smarcel error ("Unmatched single quote."); 3040130803Smarcel namelen -= 2; 3041130803Smarcel tokstart++; 3042130803Smarcel goto tryname; 3043130803Smarcel } 3044130803Smarcel error ("Invalid character constant."); 3045130803Smarcel } 3046130803Smarcel return INT; 3047130803Smarcel 3048130803Smarcel case '(': 3049130803Smarcel paren_depth++; 3050130803Smarcel lexptr++; 3051130803Smarcel return c; 3052130803Smarcel 3053130803Smarcel case ')': 3054130803Smarcel if (paren_depth == 0) 3055130803Smarcel return 0; 3056130803Smarcel paren_depth--; 3057130803Smarcel lexptr++; 3058130803Smarcel return c; 3059130803Smarcel 3060130803Smarcel case ',': 3061130803Smarcel if (comma_terminates 3062130803Smarcel && paren_depth == 0 3063130803Smarcel && ! scanning_macro_expansion ()) 3064130803Smarcel return 0; 3065130803Smarcel lexptr++; 3066130803Smarcel return c; 3067130803Smarcel 3068130803Smarcel case '.': 3069130803Smarcel /* Might be a floating point number. */ 3070130803Smarcel if (lexptr[1] < '0' || lexptr[1] > '9') 3071130803Smarcel goto symbol; /* Nope, must be a symbol. */ 3072130803Smarcel /* FALL THRU into number case. */ 3073130803Smarcel 3074130803Smarcel case '0': 3075130803Smarcel case '1': 3076130803Smarcel case '2': 3077130803Smarcel case '3': 3078130803Smarcel case '4': 3079130803Smarcel case '5': 3080130803Smarcel case '6': 3081130803Smarcel case '7': 3082130803Smarcel case '8': 3083130803Smarcel case '9': 3084130803Smarcel { 3085130803Smarcel /* It's a number. */ 3086130803Smarcel int got_dot = 0, got_e = 0, toktype; 3087130803Smarcel char *p = tokstart; 3088130803Smarcel int hex = input_radix > 10; 3089130803Smarcel 3090130803Smarcel if (c == '0' && (p[1] == 'x' || p[1] == 'X')) 3091130803Smarcel { 3092130803Smarcel p += 2; 3093130803Smarcel hex = 1; 3094130803Smarcel } 3095130803Smarcel else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D')) 3096130803Smarcel { 3097130803Smarcel p += 2; 3098130803Smarcel hex = 0; 3099130803Smarcel } 3100130803Smarcel 3101130803Smarcel for (;; ++p) 3102130803Smarcel { 3103130803Smarcel /* This test includes !hex because 'e' is a valid hex digit 3104130803Smarcel and thus does not indicate a floating point number when 3105130803Smarcel the radix is hex. */ 3106130803Smarcel if (!hex && !got_e && (*p == 'e' || *p == 'E')) 3107130803Smarcel got_dot = got_e = 1; 3108130803Smarcel /* This test does not include !hex, because a '.' always indicates 3109130803Smarcel a decimal floating point number regardless of the radix. */ 3110130803Smarcel else if (!got_dot && *p == '.') 3111130803Smarcel got_dot = 1; 3112130803Smarcel else if (got_e && (p[-1] == 'e' || p[-1] == 'E') 3113130803Smarcel && (*p == '-' || *p == '+')) 3114130803Smarcel /* This is the sign of the exponent, not the end of the 3115130803Smarcel number. */ 3116130803Smarcel continue; 3117130803Smarcel /* We will take any letters or digits. parse_number will 3118130803Smarcel complain if past the radix, or if L or U are not final. */ 3119130803Smarcel else if ((*p < '0' || *p > '9') 3120130803Smarcel && ((*p < 'a' || *p > 'z') 3121130803Smarcel && (*p < 'A' || *p > 'Z'))) 3122130803Smarcel break; 3123130803Smarcel } 3124130803Smarcel toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval); 3125130803Smarcel if (toktype == ERROR) 3126130803Smarcel { 3127130803Smarcel char *err_copy = (char *) alloca (p - tokstart + 1); 3128130803Smarcel 3129130803Smarcel memcpy (err_copy, tokstart, p - tokstart); 3130130803Smarcel err_copy[p - tokstart] = 0; 3131130803Smarcel error ("Invalid number \"%s\".", err_copy); 3132130803Smarcel } 3133130803Smarcel lexptr = p; 3134130803Smarcel return toktype; 3135130803Smarcel } 3136130803Smarcel 3137130803Smarcel case '+': 3138130803Smarcel case '-': 3139130803Smarcel case '*': 3140130803Smarcel case '/': 3141130803Smarcel case '%': 3142130803Smarcel case '|': 3143130803Smarcel case '&': 3144130803Smarcel case '^': 3145130803Smarcel case '~': 3146130803Smarcel case '!': 3147130803Smarcel case '@': 3148130803Smarcel case '<': 3149130803Smarcel case '>': 3150130803Smarcel case '[': 3151130803Smarcel case ']': 3152130803Smarcel case '?': 3153130803Smarcel case ':': 3154130803Smarcel case '=': 3155130803Smarcel case '{': 3156130803Smarcel case '}': 3157130803Smarcel symbol: 3158130803Smarcel lexptr++; 3159130803Smarcel return c; 3160130803Smarcel 3161130803Smarcel case '"': 3162130803Smarcel 3163130803Smarcel /* Build the gdb internal form of the input string in tempbuf, 3164130803Smarcel translating any standard C escape forms seen. Note that the 3165130803Smarcel buffer is null byte terminated *only* for the convenience of 3166130803Smarcel debugging gdb itself and printing the buffer contents when 3167130803Smarcel the buffer contains no embedded nulls. Gdb does not depend 3168130803Smarcel upon the buffer being null byte terminated, it uses the length 3169130803Smarcel string instead. This allows gdb to handle C strings (as well 3170130803Smarcel as strings in other languages) with embedded null bytes */ 3171130803Smarcel 3172130803Smarcel tokptr = ++tokstart; 3173130803Smarcel tempbufindex = 0; 3174130803Smarcel 3175130803Smarcel do { 3176130803Smarcel char *char_start_pos = tokptr; 3177130803Smarcel 3178130803Smarcel /* Grow the static temp buffer if necessary, including allocating 3179130803Smarcel the first one on demand. */ 3180130803Smarcel if (tempbufindex + 1 >= tempbufsize) 3181130803Smarcel { 3182130803Smarcel tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64); 3183130803Smarcel } 3184130803Smarcel switch (*tokptr) 3185130803Smarcel { 3186130803Smarcel case '\0': 3187130803Smarcel case '"': 3188130803Smarcel /* Do nothing, loop will terminate. */ 3189130803Smarcel break; 3190130803Smarcel case '\\': 3191130803Smarcel tokptr++; 3192130803Smarcel c = parse_escape (&tokptr); 3193130803Smarcel if (c == -1) 3194130803Smarcel { 3195130803Smarcel continue; 3196130803Smarcel } 3197130803Smarcel tempbuf[tempbufindex++] = c; 3198130803Smarcel break; 3199130803Smarcel default: 3200130803Smarcel c = *tokptr++; 3201130803Smarcel if (! host_char_to_target (c, &c)) 3202130803Smarcel { 3203130803Smarcel int len = tokptr - char_start_pos; 3204130803Smarcel char *copy = alloca (len + 1); 3205130803Smarcel memcpy (copy, char_start_pos, len); 3206130803Smarcel copy[len] = '\0'; 3207130803Smarcel 3208130803Smarcel error ("There is no character corresponding to `%s' " 3209130803Smarcel "in the target character set `%s'.", 3210130803Smarcel copy, target_charset ()); 3211130803Smarcel } 3212130803Smarcel tempbuf[tempbufindex++] = c; 3213130803Smarcel break; 3214130803Smarcel } 3215130803Smarcel } while ((*tokptr != '"') && (*tokptr != '\0')); 3216130803Smarcel if (*tokptr++ != '"') 3217130803Smarcel { 3218130803Smarcel error ("Unterminated string in expression."); 3219130803Smarcel } 3220130803Smarcel tempbuf[tempbufindex] = '\0'; /* See note above */ 3221130803Smarcel yylval.sval.ptr = tempbuf; 3222130803Smarcel yylval.sval.length = tempbufindex; 3223130803Smarcel lexptr = tokptr; 3224130803Smarcel return (STRING); 3225130803Smarcel } 3226130803Smarcel 3227130803Smarcel if (!(c == '_' || c == '$' 3228130803Smarcel || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) 3229130803Smarcel /* We must have come across a bad character (e.g. ';'). */ 3230130803Smarcel error ("Invalid character '%c' in expression.", c); 3231130803Smarcel 3232130803Smarcel /* It's a name. See how long it is. */ 3233130803Smarcel namelen = 0; 3234130803Smarcel for (c = tokstart[namelen]; 3235130803Smarcel (c == '_' || c == '$' || (c >= '0' && c <= '9') 3236130803Smarcel || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');) 3237130803Smarcel { 3238130803Smarcel /* Template parameter lists are part of the name. 3239130803Smarcel FIXME: This mishandles `print $a<4&&$a>3'. */ 3240130803Smarcel 3241130803Smarcel if (c == '<') 3242130803Smarcel { 3243130803Smarcel /* Scan ahead to get rest of the template specification. Note 3244130803Smarcel that we look ahead only when the '<' adjoins non-whitespace 3245130803Smarcel characters; for comparison expressions, e.g. "a < b > c", 3246130803Smarcel there must be spaces before the '<', etc. */ 3247130803Smarcel 3248130803Smarcel char * p = find_template_name_end (tokstart + namelen); 3249130803Smarcel if (p) 3250130803Smarcel namelen = p - tokstart; 3251130803Smarcel break; 3252130803Smarcel } 3253130803Smarcel c = tokstart[++namelen]; 3254130803Smarcel } 3255130803Smarcel 3256130803Smarcel /* The token "if" terminates the expression and is NOT removed from 3257130803Smarcel the input stream. It doesn't count if it appears in the 3258130803Smarcel expansion of a macro. */ 3259130803Smarcel if (namelen == 2 3260130803Smarcel && tokstart[0] == 'i' 3261130803Smarcel && tokstart[1] == 'f' 3262130803Smarcel && ! scanning_macro_expansion ()) 3263130803Smarcel { 3264130803Smarcel return 0; 3265130803Smarcel } 3266130803Smarcel 3267130803Smarcel lexptr += namelen; 3268130803Smarcel 3269130803Smarcel tryname: 3270130803Smarcel 3271130803Smarcel /* Catch specific keywords. Should be done with a data structure. */ 3272130803Smarcel switch (namelen) 3273130803Smarcel { 3274130803Smarcel case 8: 3275130803Smarcel if (strncmp (tokstart, "unsigned", 8) == 0) 3276130803Smarcel return UNSIGNED; 3277130803Smarcel if (current_language->la_language == language_cplus 3278130803Smarcel && strncmp (tokstart, "template", 8) == 0) 3279130803Smarcel return TEMPLATE; 3280130803Smarcel if (strncmp (tokstart, "volatile", 8) == 0) 3281130803Smarcel return VOLATILE_KEYWORD; 3282130803Smarcel break; 3283130803Smarcel case 6: 3284130803Smarcel if (strncmp (tokstart, "struct", 6) == 0) 3285130803Smarcel return STRUCT; 3286130803Smarcel if (strncmp (tokstart, "signed", 6) == 0) 3287130803Smarcel return SIGNED_KEYWORD; 3288130803Smarcel if (strncmp (tokstart, "sizeof", 6) == 0) 3289130803Smarcel return SIZEOF; 3290130803Smarcel if (strncmp (tokstart, "double", 6) == 0) 3291130803Smarcel return DOUBLE_KEYWORD; 3292130803Smarcel break; 3293130803Smarcel case 5: 3294130803Smarcel if (current_language->la_language == language_cplus) 3295130803Smarcel { 3296130803Smarcel if (strncmp (tokstart, "false", 5) == 0) 3297130803Smarcel return FALSEKEYWORD; 3298130803Smarcel if (strncmp (tokstart, "class", 5) == 0) 3299130803Smarcel return CLASS; 3300130803Smarcel } 3301130803Smarcel if (strncmp (tokstart, "union", 5) == 0) 3302130803Smarcel return UNION; 3303130803Smarcel if (strncmp (tokstart, "short", 5) == 0) 3304130803Smarcel return SHORT; 3305130803Smarcel if (strncmp (tokstart, "const", 5) == 0) 3306130803Smarcel return CONST_KEYWORD; 3307130803Smarcel break; 3308130803Smarcel case 4: 3309130803Smarcel if (strncmp (tokstart, "enum", 4) == 0) 3310130803Smarcel return ENUM; 3311130803Smarcel if (strncmp (tokstart, "long", 4) == 0) 3312130803Smarcel return LONG; 3313130803Smarcel if (current_language->la_language == language_cplus) 3314130803Smarcel { 3315130803Smarcel if (strncmp (tokstart, "true", 4) == 0) 3316130803Smarcel return TRUEKEYWORD; 3317130803Smarcel } 3318130803Smarcel break; 3319130803Smarcel case 3: 3320130803Smarcel if (strncmp (tokstart, "int", 3) == 0) 3321130803Smarcel return INT_KEYWORD; 3322130803Smarcel break; 3323130803Smarcel default: 3324130803Smarcel break; 3325130803Smarcel } 3326130803Smarcel 3327130803Smarcel yylval.sval.ptr = tokstart; 3328130803Smarcel yylval.sval.length = namelen; 3329130803Smarcel 3330130803Smarcel if (*tokstart == '$') 3331130803Smarcel { 3332130803Smarcel write_dollar_variable (yylval.sval); 3333130803Smarcel return VARIABLE; 3334130803Smarcel } 3335130803Smarcel 3336130803Smarcel /* Look ahead and see if we can consume more of the input 3337130803Smarcel string to get a reasonable class/namespace spec or a 3338130803Smarcel fully-qualified name. This is a kludge to get around the 3339130803Smarcel HP aCC compiler's generation of symbol names with embedded 3340130803Smarcel colons for namespace and nested classes. */ 3341130803Smarcel 3342130803Smarcel /* NOTE: carlton/2003-09-24: I don't entirely understand the 3343130803Smarcel HP-specific code, either here or in linespec. Having said that, 3344130803Smarcel I suspect that we're actually moving towards their model: we want 3345130803Smarcel symbols whose names are fully qualified, which matches the 3346130803Smarcel description above. */ 3347130803Smarcel if (unquoted_expr) 3348130803Smarcel { 3349130803Smarcel /* Only do it if not inside single quotes */ 3350130803Smarcel sym_class = parse_nested_classes_for_hpacc (yylval.sval.ptr, yylval.sval.length, 3351130803Smarcel &token_string, &class_prefix, &lexptr); 3352130803Smarcel if (sym_class) 3353130803Smarcel { 3354130803Smarcel /* Replace the current token with the bigger one we found */ 3355130803Smarcel yylval.sval.ptr = token_string; 3356130803Smarcel yylval.sval.length = strlen (token_string); 3357130803Smarcel } 3358130803Smarcel } 3359130803Smarcel 3360130803Smarcel /* Use token-type BLOCKNAME for symbols that happen to be defined as 3361130803Smarcel functions or symtabs. If this is not so, then ... 3362130803Smarcel Use token-type TYPENAME for symbols that happen to be defined 3363130803Smarcel currently as names of types; NAME for other symbols. 3364130803Smarcel The caller is not constrained to care about the distinction. */ 3365130803Smarcel { 3366130803Smarcel char *tmp = copy_name (yylval.sval); 3367130803Smarcel struct symbol *sym; 3368130803Smarcel int is_a_field_of_this = 0; 3369130803Smarcel int hextype; 3370130803Smarcel 3371130803Smarcel sym = lookup_symbol (tmp, expression_context_block, 3372130803Smarcel VAR_DOMAIN, 3373130803Smarcel current_language->la_language == language_cplus 3374130803Smarcel ? &is_a_field_of_this : (int *) NULL, 3375130803Smarcel (struct symtab **) NULL); 3376130803Smarcel /* Call lookup_symtab, not lookup_partial_symtab, in case there are 3377130803Smarcel no psymtabs (coff, xcoff, or some future change to blow away the 3378130803Smarcel psymtabs once once symbols are read). */ 3379130803Smarcel if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK) 3380130803Smarcel { 3381130803Smarcel yylval.ssym.sym = sym; 3382130803Smarcel yylval.ssym.is_a_field_of_this = is_a_field_of_this; 3383130803Smarcel return BLOCKNAME; 3384130803Smarcel } 3385130803Smarcel else if (!sym) 3386130803Smarcel { /* See if it's a file name. */ 3387130803Smarcel struct symtab *symtab; 3388130803Smarcel 3389130803Smarcel symtab = lookup_symtab (tmp); 3390130803Smarcel 3391130803Smarcel if (symtab) 3392130803Smarcel { 3393130803Smarcel yylval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK); 3394130803Smarcel return FILENAME; 3395130803Smarcel } 3396130803Smarcel } 3397130803Smarcel 3398130803Smarcel if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF) 3399130803Smarcel { 3400130803Smarcel /* NOTE: carlton/2003-09-25: There used to be code here to 3401130803Smarcel handle nested types. It didn't work very well. See the 3402130803Smarcel comment before qualified_type for more info. */ 3403130803Smarcel yylval.tsym.type = SYMBOL_TYPE (sym); 3404130803Smarcel return TYPENAME; 3405130803Smarcel } 3406130803Smarcel if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0) 3407130803Smarcel return TYPENAME; 3408130803Smarcel 3409130803Smarcel /* Input names that aren't symbols but ARE valid hex numbers, 3410130803Smarcel when the input radix permits them, can be names or numbers 3411130803Smarcel depending on the parse. Note we support radixes > 16 here. */ 3412130803Smarcel if (!sym && 3413130803Smarcel ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) || 3414130803Smarcel (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10))) 3415130803Smarcel { 3416130803Smarcel YYSTYPE newlval; /* Its value is ignored. */ 3417130803Smarcel hextype = parse_number (tokstart, namelen, 0, &newlval); 3418130803Smarcel if (hextype == INT) 3419130803Smarcel { 3420130803Smarcel yylval.ssym.sym = sym; 3421130803Smarcel yylval.ssym.is_a_field_of_this = is_a_field_of_this; 3422130803Smarcel return NAME_OR_INT; 3423130803Smarcel } 3424130803Smarcel } 3425130803Smarcel 3426130803Smarcel /* Any other kind of symbol */ 3427130803Smarcel yylval.ssym.sym = sym; 3428130803Smarcel yylval.ssym.is_a_field_of_this = is_a_field_of_this; 3429130803Smarcel return NAME; 3430130803Smarcel } 3431130803Smarcel} 3432130803Smarcel 3433130803Smarcelvoid 3434130803Smarcelyyerror (msg) 3435130803Smarcel char *msg; 3436130803Smarcel{ 3437130803Smarcel if (prev_lexptr) 3438130803Smarcel lexptr = prev_lexptr; 3439130803Smarcel 3440130803Smarcel error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr); 3441130803Smarcel} 3442130803Smarcel 3443130803Smarcel 3444