GDB (API)
/home/stan/gdb/linux/gdb/go-exp.c
Go to the documentation of this file.
00001 /* A Bison parser, made by GNU Bison 2.5.  */
00002 
00003 /* Bison implementation for Yacc-like parsers in C
00004    
00005       Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
00006    
00007    This program is free software: you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation, either version 3 of the License, or
00010    (at your option) any later version.
00011    
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016    
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 /* As a special exception, you may create a larger work that contains
00021    part or all of the Bison parser skeleton and distribute that work
00022    under terms of your choice, so long as that work isn't itself a
00023    parser generator using the skeleton or a modified version thereof
00024    as a parser skeleton.  Alternatively, if you modify or redistribute
00025    the parser skeleton itself, you may (at your option) remove this
00026    special exception, which will cause the skeleton and the resulting
00027    Bison output files to be licensed under the GNU General Public
00028    License without this special exception.
00029    
00030    This special exception was added by the Free Software Foundation in
00031    version 2.2 of Bison.  */
00032 
00033 /* C LALR(1) parser skeleton written by Richard Stallman, by
00034    simplifying the original so-called "semantic" parser.  */
00035 
00036 /* All symbols defined below should begin with yy or YY, to avoid
00037    infringing on user name space.  This should be done even for local
00038    variables, as they might otherwise be expanded by user macros.
00039    There are some unavoidable exceptions within include files to
00040    define necessary library symbols; they are noted "INFRINGES ON
00041    USER NAME SPACE" below.  */
00042 
00043 /* Identify Bison output.  */
00044 #define YYBISON 1
00045 
00046 /* Bison version.  */
00047 #define YYBISON_VERSION "2.5"
00048 
00049 /* Skeleton name.  */
00050 #define YYSKELETON_NAME "yacc.c"
00051 
00052 /* Pure parsers.  */
00053 #define YYPURE 0
00054 
00055 /* Push parsers.  */
00056 #define YYPUSH 0
00057 
00058 /* Pull parsers.  */
00059 #define YYPULL 1
00060 
00061 /* Using locations.  */
00062 #define YYLSP_NEEDED 0
00063 
00064 
00065 
00066 /* Copy the first part of user declarations.  */
00067 
00068 /* Line 268 of yacc.c  */
00069 #line 52 "../../src/gdb/go-exp.y"
00070 
00071 
00072 #include "defs.h"
00073 #include "gdb_string.h"
00074 #include <ctype.h>
00075 #include "expression.h"
00076 #include "value.h"
00077 #include "parser-defs.h"
00078 #include "language.h"
00079 #include "c-lang.h"
00080 #include "go-lang.h"
00081 #include "bfd.h" /* Required by objfiles.h.  */
00082 #include "symfile.h" /* Required by objfiles.h.  */
00083 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
00084 #include "charset.h"
00085 #include "block.h"
00086 
00087 #define parse_type builtin_type (parse_gdbarch)
00088 
00089 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
00090    as well as gratuitiously global symbol names, so we can have multiple
00091    yacc generated parsers in gdb.  Note that these are only the variables
00092    produced by yacc.  If other parser generators (bison, byacc, etc) produce
00093    additional global names that conflict at link time, then those parser
00094    generators need to be fixed instead of adding those names to this list.  */
00095 
00096 #define yymaxdepth go_maxdepth
00097 #define yyparse go_parse_internal
00098 #define yylex   go_lex
00099 #define yyerror go_error
00100 #define yylval  go_lval
00101 #define yychar  go_char
00102 #define yydebug go_debug
00103 #define yypact  go_pact
00104 #define yyr1    go_r1
00105 #define yyr2    go_r2
00106 #define yydef   go_def
00107 #define yychk   go_chk
00108 #define yypgo   go_pgo
00109 #define yyact   go_act
00110 #define yyexca  go_exca
00111 #define yyerrflag go_errflag
00112 #define yynerrs go_nerrs
00113 #define yyps    go_ps
00114 #define yypv    go_pv
00115 #define yys     go_s
00116 #define yy_yys  go_yys
00117 #define yystate go_state
00118 #define yytmp   go_tmp
00119 #define yyv     go_v
00120 #define yy_yyv  go_yyv
00121 #define yyval   go_val
00122 #define yylloc  go_lloc
00123 #define yyreds  go_reds         /* With YYDEBUG defined */
00124 #define yytoks  go_toks         /* With YYDEBUG defined */
00125 #define yyname  go_name         /* With YYDEBUG defined */
00126 #define yyrule  go_rule         /* With YYDEBUG defined */
00127 #define yylhs   go_yylhs
00128 #define yylen   go_yylen
00129 #define yydefred go_yydefred
00130 #define yydgoto go_yydgoto
00131 #define yysindex go_yysindex
00132 #define yyrindex go_yyrindex
00133 #define yygindex go_yygindex
00134 #define yytable  go_yytable
00135 #define yycheck  go_yycheck
00136 
00137 #ifndef YYDEBUG
00138 #define YYDEBUG 1               /* Default to yydebug support */
00139 #endif
00140 
00141 #define YYFPRINTF parser_fprintf
00142 
00143 int yyparse (void);
00144 
00145 static int yylex (void);
00146 
00147 void yyerror (char *);
00148 
00149 
00150 
00151 /* Line 268 of yacc.c  */
00152 #line 153 "go-exp.c"
00153 
00154 /* Enabling traces.  */
00155 #ifndef YYDEBUG
00156 # define YYDEBUG 0
00157 #endif
00158 
00159 /* Enabling verbose error messages.  */
00160 #ifdef YYERROR_VERBOSE
00161 # undef YYERROR_VERBOSE
00162 # define YYERROR_VERBOSE 1
00163 #else
00164 # define YYERROR_VERBOSE 0
00165 #endif
00166 
00167 /* Enabling the token table.  */
00168 #ifndef YYTOKEN_TABLE
00169 # define YYTOKEN_TABLE 0
00170 #endif
00171 
00172 
00173 /* Tokens.  */
00174 #ifndef YYTOKENTYPE
00175 # define YYTOKENTYPE
00176    /* Put the tokens into the symbol table, so that GDB and other debuggers
00177       know about them.  */
00178    enum yytokentype {
00179      INT = 258,
00180      FLOAT = 259,
00181      RAW_STRING = 260,
00182      STRING = 261,
00183      CHAR = 262,
00184      NAME = 263,
00185      TYPENAME = 264,
00186      COMPLETE = 265,
00187      NAME_OR_INT = 266,
00188      TRUE_KEYWORD = 267,
00189      FALSE_KEYWORD = 268,
00190      STRUCT_KEYWORD = 269,
00191      INTERFACE_KEYWORD = 270,
00192      TYPE_KEYWORD = 271,
00193      CHAN_KEYWORD = 272,
00194      SIZEOF_KEYWORD = 273,
00195      LEN_KEYWORD = 274,
00196      CAP_KEYWORD = 275,
00197      NEW_KEYWORD = 276,
00198      IOTA_KEYWORD = 277,
00199      NIL_KEYWORD = 278,
00200      CONST_KEYWORD = 279,
00201      DOTDOTDOT = 280,
00202      ENTRY = 281,
00203      ERROR = 282,
00204      BYTE_KEYWORD = 283,
00205      DOLLAR_VARIABLE = 284,
00206      ASSIGN_MODIFY = 285,
00207      ABOVE_COMMA = 286,
00208      OROR = 287,
00209      ANDAND = 288,
00210      ANDNOT = 289,
00211      NOTEQUAL = 290,
00212      EQUAL = 291,
00213      GEQ = 292,
00214      LEQ = 293,
00215      RSH = 294,
00216      LSH = 295,
00217      DECREMENT = 296,
00218      INCREMENT = 297,
00219      UNARY = 298,
00220      LEFT_ARROW = 299
00221    };
00222 #endif
00223 /* Tokens.  */
00224 #define INT 258
00225 #define FLOAT 259
00226 #define RAW_STRING 260
00227 #define STRING 261
00228 #define CHAR 262
00229 #define NAME 263
00230 #define TYPENAME 264
00231 #define COMPLETE 265
00232 #define NAME_OR_INT 266
00233 #define TRUE_KEYWORD 267
00234 #define FALSE_KEYWORD 268
00235 #define STRUCT_KEYWORD 269
00236 #define INTERFACE_KEYWORD 270
00237 #define TYPE_KEYWORD 271
00238 #define CHAN_KEYWORD 272
00239 #define SIZEOF_KEYWORD 273
00240 #define LEN_KEYWORD 274
00241 #define CAP_KEYWORD 275
00242 #define NEW_KEYWORD 276
00243 #define IOTA_KEYWORD 277
00244 #define NIL_KEYWORD 278
00245 #define CONST_KEYWORD 279
00246 #define DOTDOTDOT 280
00247 #define ENTRY 281
00248 #define ERROR 282
00249 #define BYTE_KEYWORD 283
00250 #define DOLLAR_VARIABLE 284
00251 #define ASSIGN_MODIFY 285
00252 #define ABOVE_COMMA 286
00253 #define OROR 287
00254 #define ANDAND 288
00255 #define ANDNOT 289
00256 #define NOTEQUAL 290
00257 #define EQUAL 291
00258 #define GEQ 292
00259 #define LEQ 293
00260 #define RSH 294
00261 #define LSH 295
00262 #define DECREMENT 296
00263 #define INCREMENT 297
00264 #define UNARY 298
00265 #define LEFT_ARROW 299
00266 
00267 
00268 
00269 
00270 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
00271 typedef union YYSTYPE
00272 {
00273 
00274 /* Line 293 of yacc.c  */
00275 #line 138 "../../src/gdb/go-exp.y"
00276 
00277     LONGEST lval;
00278     struct {
00279       LONGEST val;
00280       struct type *type;
00281     } typed_val_int;
00282     struct {
00283       DOUBLEST dval;
00284       struct type *type;
00285     } typed_val_float;
00286     struct stoken sval;
00287     struct symtoken ssym;
00288     struct type *tval;
00289     struct typed_stoken tsval;
00290     struct ttype tsym;
00291     int voidval;
00292     enum exp_opcode opcode;
00293     struct internalvar *ivar;
00294     struct stoken_vector svec;
00295   
00296 
00297 
00298 /* Line 293 of yacc.c  */
00299 #line 300 "go-exp.c"
00300 } YYSTYPE;
00301 # define YYSTYPE_IS_TRIVIAL 1
00302 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
00303 # define YYSTYPE_IS_DECLARED 1
00304 #endif
00305 
00306 
00307 /* Copy the second part of user declarations.  */
00308 
00309 /* Line 343 of yacc.c  */
00310 #line 159 "../../src/gdb/go-exp.y"
00311 
00312 /* YYSTYPE gets defined by %union.  */
00313 static int parse_number (const char *, int, int, YYSTYPE *);
00314 static int parse_go_float (struct gdbarch *gdbarch, const char *p, int len,
00315                            DOUBLEST *d, struct type **t);
00316 
00317 
00318 /* Line 343 of yacc.c  */
00319 #line 320 "go-exp.c"
00320 
00321 #ifdef short
00322 # undef short
00323 #endif
00324 
00325 #ifdef YYTYPE_UINT8
00326 typedef YYTYPE_UINT8 yytype_uint8;
00327 #else
00328 typedef unsigned char yytype_uint8;
00329 #endif
00330 
00331 #ifdef YYTYPE_INT8
00332 typedef YYTYPE_INT8 yytype_int8;
00333 #elif (defined __STDC__ || defined __C99__FUNC__ \
00334      || defined __cplusplus || defined _MSC_VER)
00335 typedef signed char yytype_int8;
00336 #else
00337 typedef short int yytype_int8;
00338 #endif
00339 
00340 #ifdef YYTYPE_UINT16
00341 typedef YYTYPE_UINT16 yytype_uint16;
00342 #else
00343 typedef unsigned short int yytype_uint16;
00344 #endif
00345 
00346 #ifdef YYTYPE_INT16
00347 typedef YYTYPE_INT16 yytype_int16;
00348 #else
00349 typedef short int yytype_int16;
00350 #endif
00351 
00352 #ifndef YYSIZE_T
00353 # ifdef __SIZE_TYPE__
00354 #  define YYSIZE_T __SIZE_TYPE__
00355 # elif defined size_t
00356 #  define YYSIZE_T size_t
00357 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00358      || defined __cplusplus || defined _MSC_VER)
00359 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
00360 #  define YYSIZE_T size_t
00361 # else
00362 #  define YYSIZE_T unsigned int
00363 # endif
00364 #endif
00365 
00366 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
00367 
00368 #ifndef YY_
00369 # if defined YYENABLE_NLS && YYENABLE_NLS
00370 #  if ENABLE_NLS
00371 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
00372 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
00373 #  endif
00374 # endif
00375 # ifndef YY_
00376 #  define YY_(msgid) msgid
00377 # endif
00378 #endif
00379 
00380 /* Suppress unused-variable warnings by "using" E.  */
00381 #if ! defined lint || defined __GNUC__
00382 # define YYUSE(e) ((void) (e))
00383 #else
00384 # define YYUSE(e) /* empty */
00385 #endif
00386 
00387 /* Identity function, used to suppress warnings about constant conditions.  */
00388 #ifndef lint
00389 # define YYID(n) (n)
00390 #else
00391 #if (defined __STDC__ || defined __C99__FUNC__ \
00392      || defined __cplusplus || defined _MSC_VER)
00393 static int
00394 YYID (int yyi)
00395 #else
00396 static int
00397 YYID (yyi)
00398     int yyi;
00399 #endif
00400 {
00401   return yyi;
00402 }
00403 #endif
00404 
00405 #if ! defined yyoverflow || YYERROR_VERBOSE
00406 
00407 /* The parser invokes alloca or xmalloc; define the necessary symbols.  */
00408 
00409 # ifdef YYSTACK_USE_ALLOCA
00410 #  if YYSTACK_USE_ALLOCA
00411 #   ifdef __GNUC__
00412 #    define YYSTACK_ALLOC __builtin_alloca
00413 #   elif defined __BUILTIN_VA_ARG_INCR
00414 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
00415 #   elif defined _AIX
00416 #    define YYSTACK_ALLOC __alloca
00417 #   elif defined _MSC_VER
00418 #    define alloca _alloca
00419 #   else
00420 #    define YYSTACK_ALLOC alloca
00421 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
00422      || defined __cplusplus || defined _MSC_VER)
00423 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00424 #     ifndef EXIT_SUCCESS
00425 #      define EXIT_SUCCESS 0
00426 #     endif
00427 #    endif
00428 #   endif
00429 #  endif
00430 # endif
00431 
00432 # ifdef YYSTACK_ALLOC
00433    /* Pacify GCC's `empty if-body' warning.  */
00434 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
00435 #  ifndef YYSTACK_ALLOC_MAXIMUM
00436     /* The OS might guarantee only one guard page at the bottom of the stack,
00437        and a page size can be as small as 4096 bytes.  So we cannot safely
00438        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
00439        to allow for a few compiler-allocated temporary stack slots.  */
00440 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
00441 #  endif
00442 # else
00443 #  define YYSTACK_ALLOC YYMALLOC
00444 #  define YYSTACK_FREE YYFREE
00445 #  ifndef YYSTACK_ALLOC_MAXIMUM
00446 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
00447 #  endif
00448 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
00449        && ! ((defined YYMALLOC || defined xmalloc) \
00450              && (defined YYFREE || defined xfree)))
00451 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00452 #   ifndef EXIT_SUCCESS
00453 #    define EXIT_SUCCESS 0
00454 #   endif
00455 #  endif
00456 #  ifndef YYMALLOC
00457 #   define YYMALLOC xmalloc
00458 #   if ! defined xmalloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
00459      || defined __cplusplus || defined _MSC_VER)
00460 void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
00461 #   endif
00462 #  endif
00463 #  ifndef YYFREE
00464 #   define YYFREE xfree
00465 #   if ! defined xfree && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
00466      || defined __cplusplus || defined _MSC_VER)
00467 void xfree (void *); /* INFRINGES ON USER NAME SPACE */
00468 #   endif
00469 #  endif
00470 # endif
00471 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
00472 
00473 
00474 #if (! defined yyoverflow \
00475      && (! defined __cplusplus \
00476          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00477 
00478 /* A type that is properly aligned for any stack member.  */
00479 union yyalloc
00480 {
00481   yytype_int16 yyss_alloc;
00482   YYSTYPE yyvs_alloc;
00483 };
00484 
00485 /* The size of the maximum gap between one aligned stack and the next.  */
00486 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00487 
00488 /* The size of an array large to enough to hold all stacks, each with
00489    N elements.  */
00490 # define YYSTACK_BYTES(N) \
00491      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
00492       + YYSTACK_GAP_MAXIMUM)
00493 
00494 # define YYCOPY_NEEDED 1
00495 
00496 /* Relocate STACK from its old location to the new one.  The
00497    local variables YYSIZE and YYSTACKSIZE give the old and new number of
00498    elements in the stack, and YYPTR gives the new location of the
00499    stack.  Advance YYPTR to a properly aligned location for the next
00500    stack.  */
00501 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
00502     do                                                                  \
00503       {                                                                 \
00504         YYSIZE_T yynewbytes;                                            \
00505         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
00506         Stack = &yyptr->Stack_alloc;                                    \
00507         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00508         yyptr += yynewbytes / sizeof (*yyptr);                          \
00509       }                                                                 \
00510     while (YYID (0))
00511 
00512 #endif
00513 
00514 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
00515 /* Copy COUNT objects from FROM to TO.  The source and destination do
00516    not overlap.  */
00517 # ifndef YYCOPY
00518 #  if defined __GNUC__ && 1 < __GNUC__
00519 #   define YYCOPY(To, From, Count) \
00520       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00521 #  else
00522 #   define YYCOPY(To, From, Count)              \
00523       do                                        \
00524         {                                       \
00525           YYSIZE_T yyi;                         \
00526           for (yyi = 0; yyi < (Count); yyi++)   \
00527             (To)[yyi] = (From)[yyi];            \
00528         }                                       \
00529       while (YYID (0))
00530 #  endif
00531 # endif
00532 #endif /* !YYCOPY_NEEDED */
00533 
00534 /* YYFINAL -- State number of the termination state.  */
00535 #define YYFINAL  40
00536 /* YYLAST -- Last index in YYTABLE.  */
00537 #define YYLAST   443
00538 
00539 /* YYNTOKENS -- Number of terminals.  */
00540 #define YYNTOKENS  68
00541 /* YYNNTS -- Number of nonterminals.  */
00542 #define YYNNTS  13
00543 /* YYNRULES -- Number of rules.  */
00544 #define YYNRULES  69
00545 /* YYNRULES -- Number of states.  */
00546 #define YYNSTATES  122
00547 
00548 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
00549 #define YYUNDEFTOK  2
00550 #define YYMAXUTOK   299
00551 
00552 #define YYTRANSLATE(YYX)                                                \
00553   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00554 
00555 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
00556 static const yytype_uint8 yytranslate[] =
00557 {
00558        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00559        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00560        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00561        2,     2,     2,    62,     2,     2,     2,    54,    39,     2,
00562       60,    64,    52,    50,    31,    51,    58,    53,     2,     2,
00563        2,     2,     2,     2,     2,     2,     2,     2,    67,     2,
00564       43,    33,    44,    34,    49,     2,     2,     2,     2,     2,
00565        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00566        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00567        2,    59,     2,    63,    38,     2,     2,     2,     2,     2,
00568        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00569        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00570        2,     2,     2,    65,    37,    66,     2,     2,     2,     2,
00571        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00572        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00573        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00574        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00575        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00576        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00577        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00578        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00579        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00580        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00581        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00582        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00583        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
00584        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
00585       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
00586       25,    26,    27,    28,    29,    30,    32,    35,    36,    40,
00587       41,    42,    45,    46,    47,    48,    55,    56,    57,    61
00588 };
00589 
00590 #if YYDEBUG
00591 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
00592    YYRHS.  */
00593 static const yytype_uint8 yyprhs[] =
00594 {
00595        0,     0,     3,     5,     7,     9,    11,    15,    18,    21,
00596       24,    27,    30,    33,    36,    39,    43,    48,    52,    57,
00597       58,    64,    66,    67,    69,    73,    75,    80,    85,    89,
00598       93,    97,   101,   105,   109,   113,   117,   121,   125,   129,
00599      133,   137,   141,   145,   149,   153,   157,   161,   165,   171,
00600      175,   179,   181,   183,   185,   187,   189,   191,   196,   201,
00601      203,   207,   209,   211,   213,   216,   218,   221,   223,   225
00602 };
00603 
00604 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
00605 static const yytype_int8 yyrhs[] =
00606 {
00607       69,     0,    -1,    71,    -1,    70,    -1,    79,    -1,    72,
00608       -1,    71,    31,    72,    -1,    52,    72,    -1,    39,    72,
00609       -1,    51,    72,    -1,    50,    72,    -1,    62,    72,    -1,
00610       38,    72,    -1,    72,    56,    -1,    72,    55,    -1,    72,
00611       58,    80,    -1,    72,    58,    80,    10,    -1,    72,    58,
00612       10,    -1,    72,    59,    71,    63,    -1,    -1,    72,    60,
00613       73,    75,    64,    -1,    65,    -1,    -1,    72,    -1,    75,
00614       31,    72,    -1,    66,    -1,    74,    79,    76,    72,    -1,
00615       79,    60,    72,    64,    -1,    60,    71,    64,    -1,    72,
00616       49,    72,    -1,    72,    52,    72,    -1,    72,    53,    72,
00617       -1,    72,    54,    72,    -1,    72,    50,    72,    -1,    72,
00618       51,    72,    -1,    72,    48,    72,    -1,    72,    47,    72,
00619       -1,    72,    42,    72,    -1,    72,    41,    72,    -1,    72,
00620       46,    72,    -1,    72,    45,    72,    -1,    72,    43,    72,
00621       -1,    72,    44,    72,    -1,    72,    39,    72,    -1,    72,
00622       38,    72,    -1,    72,    37,    72,    -1,    72,    36,    72,
00623       -1,    72,    35,    72,    -1,    72,    34,    72,    67,    72,
00624       -1,    72,    33,    72,    -1,    72,    30,    72,    -1,     3,
00625       -1,     7,    -1,    11,    -1,     4,    -1,    78,    -1,    29,
00626       -1,    18,    60,    79,    64,    -1,    18,    60,    72,    64,
00627       -1,     6,    -1,    77,    50,     6,    -1,    77,    -1,    12,
00628       -1,    13,    -1,    80,    26,    -1,    80,    -1,    52,    79,
00629       -1,     9,    -1,    28,    -1,     8,    -1
00630 };
00631 
00632 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
00633 static const yytype_uint16 yyrline[] =
00634 {
00635        0,   237,   237,   238,   241,   248,   249,   254,   258,   262,
00636      266,   270,   274,   278,   282,   288,   294,   301,   311,   318,
00637      315,   325,   329,   332,   336,   340,   344,   350,   356,   362,
00638      366,   370,   374,   378,   382,   386,   390,   394,   398,   402,
00639      406,   410,   414,   418,   422,   426,   430,   434,   438,   442,
00640      446,   452,   459,   468,   481,   488,   491,   497,   509,   516,
00641      533,   551,   562,   568,   574,   590,   645,   647,   654,   667
00642 };
00643 #endif
00644 
00645 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00646 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
00647    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
00648 static const char *const yytname[] =
00649 {
00650   "$end", "error", "$undefined", "INT", "FLOAT", "RAW_STRING", "STRING",
00651   "CHAR", "NAME", "TYPENAME", "COMPLETE", "NAME_OR_INT", "TRUE_KEYWORD",
00652   "FALSE_KEYWORD", "STRUCT_KEYWORD", "INTERFACE_KEYWORD", "TYPE_KEYWORD",
00653   "CHAN_KEYWORD", "SIZEOF_KEYWORD", "LEN_KEYWORD", "CAP_KEYWORD",
00654   "NEW_KEYWORD", "IOTA_KEYWORD", "NIL_KEYWORD", "CONST_KEYWORD",
00655   "DOTDOTDOT", "ENTRY", "ERROR", "BYTE_KEYWORD", "DOLLAR_VARIABLE",
00656   "ASSIGN_MODIFY", "','", "ABOVE_COMMA", "'='", "'?'", "OROR", "ANDAND",
00657   "'|'", "'^'", "'&'", "ANDNOT", "NOTEQUAL", "EQUAL", "'<'", "'>'", "GEQ",
00658   "LEQ", "RSH", "LSH", "'@'", "'+'", "'-'", "'*'", "'/'", "'%'",
00659   "DECREMENT", "INCREMENT", "UNARY", "'.'", "'['", "'('", "LEFT_ARROW",
00660   "'!'", "']'", "')'", "'{'", "'}'", "':'", "$accept", "start", "type_exp",
00661   "exp1", "exp", "$@1", "lcurly", "arglist", "rcurly", "string_exp",
00662   "variable", "type", "name_not_typename", 0
00663 };
00664 #endif
00665 
00666 # ifdef YYPRINT
00667 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
00668    token YYLEX-NUM.  */
00669 static const yytype_uint16 yytoknum[] =
00670 {
00671        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
00672      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
00673      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
00674      285,    44,   286,    61,    63,   287,   288,   124,    94,    38,
00675      289,   290,   291,    60,    62,   292,   293,   294,   295,    64,
00676       43,    45,    42,    47,    37,   296,   297,   298,    46,    91,
00677       40,   299,    33,    93,    41,   123,   125,    58
00678 };
00679 # endif
00680 
00681 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
00682 static const yytype_uint8 yyr1[] =
00683 {
00684        0,    68,    69,    69,    70,    71,    71,    72,    72,    72,
00685       72,    72,    72,    72,    72,    72,    72,    72,    72,    73,
00686       72,    74,    75,    75,    75,    76,    72,    72,    72,    72,
00687       72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
00688       72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
00689       72,    72,    72,    72,    72,    72,    72,    72,    72,    77,
00690       77,    72,    72,    72,    78,    78,    79,    79,    79,    80
00691 };
00692 
00693 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
00694 static const yytype_uint8 yyr2[] =
00695 {
00696        0,     2,     1,     1,     1,     1,     3,     2,     2,     2,
00697        2,     2,     2,     2,     2,     3,     4,     3,     4,     0,
00698        5,     1,     0,     1,     3,     1,     4,     4,     3,     3,
00699        3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
00700        3,     3,     3,     3,     3,     3,     3,     3,     5,     3,
00701        3,     1,     1,     1,     1,     1,     1,     4,     4,     1,
00702        3,     1,     1,     1,     2,     1,     2,     1,     1,     1
00703 };
00704 
00705 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
00706    Performed when YYTABLE doesn't specify something else to do.  Zero
00707    means the default is an error.  */
00708 static const yytype_uint8 yydefact[] =
00709 {
00710        0,    51,    54,    59,    52,    69,    67,    53,    62,    63,
00711        0,    68,    56,     0,     0,     0,     0,     0,     0,     0,
00712       21,     0,     3,     2,     5,     0,    61,    55,     4,    65,
00713        0,    12,     0,     8,    10,     9,     7,    66,     0,    11,
00714        1,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00715        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00716        0,     0,     0,     0,    14,    13,     0,     0,    19,     0,
00717        0,     0,     0,    64,     0,     0,    28,     6,    50,    49,
00718        0,    47,    46,    45,    44,    43,    38,    37,    41,    42,
00719       40,    39,    36,    35,    29,    33,    34,    30,    31,    32,
00720       17,    15,     0,    22,    66,    25,     0,    60,     0,    58,
00721       57,     0,    16,    18,    23,     0,    26,    27,    48,     0,
00722       20,    24
00723 };
00724 
00725 /* YYDEFGOTO[NTERM-NUM].  */
00726 static const yytype_int8 yydefgoto[] =
00727 {
00728       -1,    21,    22,    23,    24,   103,    25,   115,   106,    26,
00729       27,    32,    29
00730 };
00731 
00732 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
00733    STATE-NUM.  */
00734 #define YYPACT_NINF -56
00735 static const yytype_int16 yypact[] =
00736 {
00737       49,   -56,   -56,   -56,   -56,   -56,   -56,   -56,   -56,   -56,
00738      -44,   -56,   -56,    49,    49,    49,    49,    49,    49,    49,
00739      -56,    23,   -56,    34,   187,    45,   -23,   -56,     6,    46,
00740       49,   -48,     6,   -48,   -48,   -48,   -48,     6,    38,   -48,
00741      -56,    49,    49,    49,    49,    49,    49,    49,    49,    49,
00742       49,    49,    49,    49,    49,    49,    49,    49,    49,    49,
00743       49,    49,    49,    49,   -56,   -56,     5,    49,   -56,    45,
00744        8,    65,    49,   -56,   123,   -55,   -56,   187,   187,   187,
00745       88,   239,   263,   286,   308,   328,   346,   346,   360,   360,
00746      360,   360,   372,   372,   383,   -34,   -34,   -48,   -48,   -48,
00747      -56,    69,    33,    49,   -56,   -56,    49,   -56,   155,   -56,
00748      -56,    49,   -56,   -56,   187,    39,   -48,   -56,   214,    49,
00749      -56,   187
00750 };
00751 
00752 /* YYPGOTO[NTERM-NUM].  */
00753 static const yytype_int8 yypgoto[] =
00754 {
00755      -56,   -56,   -56,    -4,   -13,   -56,   -56,   -56,   -56,   -56,
00756      -56,    51,     9
00757 };
00758 
00759 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
00760    positive, shift that token.  If negative, reduce the rule which
00761    number is the opposite.  If YYTABLE_NINF, syntax error.  */
00762 #define YYTABLE_NINF -1
00763 static const yytype_uint8 yytable[] =
00764 {
00765       31,    33,    34,    35,    36,    72,    39,    64,    65,   110,
00766       66,    67,    68,     5,    38,   100,    30,    74,    61,    62,
00767       63,    64,    65,    40,    66,    67,    68,    71,    77,    78,
00768       79,    80,    81,    82,    83,    84,    85,    86,    87,    88,
00769       89,    90,    91,    92,    93,    94,    95,    96,    97,    98,
00770       99,    28,     1,     2,     6,     3,     4,     5,     6,   108,
00771        7,     8,     9,   102,    41,    41,    72,    10,    37,    41,
00772      119,   107,    73,    11,   105,   101,    70,    11,    12,   112,
00773        0,    75,     0,     0,     0,     0,     0,    13,    14,     0,
00774      114,     0,     0,   116,     0,     0,   113,    69,   118,    15,
00775       16,    17,    76,   120,     0,     0,   121,     0,     0,    18,
00776        0,    19,     0,     0,    20,     0,     0,     0,    42,     0,
00777      104,    43,    44,    45,    46,    47,    48,    49,     0,    50,
00778       51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
00779       61,    62,    63,    64,    65,     0,    66,    67,    68,     0,
00780        0,     0,     0,    42,     0,   111,    43,    44,    45,    46,
00781       47,    48,    49,     0,    50,    51,    52,    53,    54,    55,
00782       56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
00783        0,    66,    67,    68,     0,    42,     0,   109,    43,    44,
00784       45,    46,    47,    48,    49,     0,    50,    51,    52,    53,
00785       54,    55,    56,    57,    58,    59,    60,    61,    62,    63,
00786       64,    65,     0,    66,    67,    68,     0,    42,     0,   117,
00787       43,    44,    45,    46,    47,    48,    49,     0,    50,    51,
00788       52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
00789       62,    63,    64,    65,     0,    66,    67,    68,    44,    45,
00790       46,    47,    48,    49,     0,    50,    51,    52,    53,    54,
00791       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
00792       65,     0,    66,    67,    68,    46,    47,    48,    49,     0,
00793       50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
00794       60,    61,    62,    63,    64,    65,     0,    66,    67,    68,
00795       47,    48,    49,     0,    50,    51,    52,    53,    54,    55,
00796       56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
00797        0,    66,    67,    68,    48,    49,     0,    50,    51,    52,
00798       53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
00799       63,    64,    65,     0,    66,    67,    68,    49,     0,    50,
00800       51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
00801       61,    62,    63,    64,    65,     0,    66,    67,    68,    50,
00802       51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
00803       61,    62,    63,    64,    65,     0,    66,    67,    68,    52,
00804       53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
00805       63,    64,    65,     0,    66,    67,    68,    56,    57,    58,
00806       59,    60,    61,    62,    63,    64,    65,     0,    66,    67,
00807       68,    58,    59,    60,    61,    62,    63,    64,    65,     0,
00808       66,    67,    68,    59,    60,    61,    62,    63,    64,    65,
00809        0,    66,    67,    68
00810 };
00811 
00812 #define yypact_value_is_default(yystate) \
00813   ((yystate) == (-56))
00814 
00815 #define yytable_value_is_error(yytable_value) \
00816   YYID (0)
00817 
00818 static const yytype_int8 yycheck[] =
00819 {
00820       13,    14,    15,    16,    17,    60,    19,    55,    56,    64,
00821       58,    59,    60,     8,    18,    10,    60,    30,    52,    53,
00822       54,    55,    56,     0,    58,    59,    60,    50,    41,    42,
00823       43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
00824       53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
00825       63,     0,     3,     4,     9,     6,     7,     8,     9,    72,
00826       11,    12,    13,    67,    31,    31,    60,    18,    17,    31,
00827       31,     6,    26,    28,    66,    66,    25,    28,    29,    10,
00828       -1,    30,    -1,    -1,    -1,    -1,    -1,    38,    39,    -1,
00829      103,    -1,    -1,   106,    -1,    -1,    63,    52,   111,    50,
00830       51,    52,    64,    64,    -1,    -1,   119,    -1,    -1,    60,
00831       -1,    62,    -1,    -1,    65,    -1,    -1,    -1,    30,    -1,
00832       69,    33,    34,    35,    36,    37,    38,    39,    -1,    41,
00833       42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
00834       52,    53,    54,    55,    56,    -1,    58,    59,    60,    -1,
00835       -1,    -1,    -1,    30,    -1,    67,    33,    34,    35,    36,
00836       37,    38,    39,    -1,    41,    42,    43,    44,    45,    46,
00837       47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
00838       -1,    58,    59,    60,    -1,    30,    -1,    64,    33,    34,
00839       35,    36,    37,    38,    39,    -1,    41,    42,    43,    44,
00840       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
00841       55,    56,    -1,    58,    59,    60,    -1,    30,    -1,    64,
00842       33,    34,    35,    36,    37,    38,    39,    -1,    41,    42,
00843       43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
00844       53,    54,    55,    56,    -1,    58,    59,    60,    34,    35,
00845       36,    37,    38,    39,    -1,    41,    42,    43,    44,    45,
00846       46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
00847       56,    -1,    58,    59,    60,    36,    37,    38,    39,    -1,
00848       41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
00849       51,    52,    53,    54,    55,    56,    -1,    58,    59,    60,
00850       37,    38,    39,    -1,    41,    42,    43,    44,    45,    46,
00851       47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
00852       -1,    58,    59,    60,    38,    39,    -1,    41,    42,    43,
00853       44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
00854       54,    55,    56,    -1,    58,    59,    60,    39,    -1,    41,
00855       42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
00856       52,    53,    54,    55,    56,    -1,    58,    59,    60,    41,
00857       42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
00858       52,    53,    54,    55,    56,    -1,    58,    59,    60,    43,
00859       44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
00860       54,    55,    56,    -1,    58,    59,    60,    47,    48,    49,
00861       50,    51,    52,    53,    54,    55,    56,    -1,    58,    59,
00862       60,    49,    50,    51,    52,    53,    54,    55,    56,    -1,
00863       58,    59,    60,    50,    51,    52,    53,    54,    55,    56,
00864       -1,    58,    59,    60
00865 };
00866 
00867 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
00868    symbol of state STATE-NUM.  */
00869 static const yytype_uint8 yystos[] =
00870 {
00871        0,     3,     4,     6,     7,     8,     9,    11,    12,    13,
00872       18,    28,    29,    38,    39,    50,    51,    52,    60,    62,
00873       65,    69,    70,    71,    72,    74,    77,    78,    79,    80,
00874       60,    72,    79,    72,    72,    72,    72,    79,    71,    72,
00875        0,    31,    30,    33,    34,    35,    36,    37,    38,    39,
00876       41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
00877       51,    52,    53,    54,    55,    56,    58,    59,    60,    52,
00878       79,    50,    60,    26,    72,    79,    64,    72,    72,    72,
00879       72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
00880       72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
00881       10,    80,    71,    73,    79,    66,    76,     6,    72,    64,
00882       64,    67,    10,    63,    72,    75,    72,    64,    72,    31,
00883       64,    72
00884 };
00885 
00886 #define yyerrok         (yyerrstatus = 0)
00887 #define yyclearin       (yychar = YYEMPTY)
00888 #define YYEMPTY         (-2)
00889 #define YYEOF           0
00890 
00891 #define YYACCEPT        goto yyacceptlab
00892 #define YYABORT         goto yyabortlab
00893 #define YYERROR         goto yyerrorlab
00894 
00895 
00896 /* Like YYERROR except do call yyerror.  This remains here temporarily
00897    to ease the transition to the new meaning of YYERROR, for GCC.
00898    Once GCC version 2 has supplanted version 1, this can go.  However,
00899    YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
00900    in Bison 2.4.2's NEWS entry, where a plan to phase it out is
00901    discussed.  */
00902 
00903 #define YYFAIL          goto yyerrlab
00904 #if defined YYFAIL
00905   /* This is here to suppress warnings from the GCC cpp's
00906      -Wunused-macros.  Normally we don't worry about that warning, but
00907      some users do, and we want to make it easy for users to remove
00908      YYFAIL uses, which will produce warnings from Bison 2.5.  */
00909 #endif
00910 
00911 #define YYRECOVERING()  (!!yyerrstatus)
00912 
00913 #define YYBACKUP(Token, Value)                                  \
00914 do                                                              \
00915   if (yychar == YYEMPTY && yylen == 1)                          \
00916     {                                                           \
00917       yychar = (Token);                                         \
00918       yylval = (Value);                                         \
00919       YYPOPSTACK (1);                                           \
00920       goto yybackup;                                            \
00921     }                                                           \
00922   else                                                          \
00923     {                                                           \
00924       yyerror (YY_("syntax error: cannot back up")); \
00925       YYERROR;                                                  \
00926     }                                                           \
00927 while (YYID (0))
00928 
00929 
00930 #define YYTERROR        1
00931 #define YYERRCODE       256
00932 
00933 
00934 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
00935    If N is 0, then set CURRENT to the empty location which ends
00936    the previous symbol: RHS[0] (always defined).  */
00937 
00938 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
00939 #ifndef YYLLOC_DEFAULT
00940 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
00941     do                                                                  \
00942       if (YYID (N))                                                    \
00943         {                                                               \
00944           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
00945           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
00946           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
00947           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
00948         }                                                               \
00949       else                                                              \
00950         {                                                               \
00951           (Current).first_line   = (Current).last_line   =              \
00952             YYRHSLOC (Rhs, 0).last_line;                                \
00953           (Current).first_column = (Current).last_column =              \
00954             YYRHSLOC (Rhs, 0).last_column;                              \
00955         }                                                               \
00956     while (YYID (0))
00957 #endif
00958 
00959 
00960 /* This macro is provided for backward compatibility. */
00961 
00962 #ifndef YY_LOCATION_PRINT
00963 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
00964 #endif
00965 
00966 
00967 /* YYLEX -- calling `yylex' with the right arguments.  */
00968 
00969 #ifdef YYLEX_PARAM
00970 # define YYLEX yylex (YYLEX_PARAM)
00971 #else
00972 # define YYLEX yylex ()
00973 #endif
00974 
00975 /* Enable debugging if requested.  */
00976 #if YYDEBUG
00977 
00978 # ifndef YYFPRINTF
00979 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
00980 #  define YYFPRINTF fprintf
00981 # endif
00982 
00983 # define YYDPRINTF(Args)                        \
00984 do {                                            \
00985   if (yydebug)                                  \
00986     YYFPRINTF Args;                             \
00987 } while (YYID (0))
00988 
00989 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
00990 do {                                                                      \
00991   if (yydebug)                                                            \
00992     {                                                                     \
00993       YYFPRINTF (stderr, "%s ", Title);                                   \
00994       yy_symbol_print (stderr,                                            \
00995                   Type, Value); \
00996       YYFPRINTF (stderr, "\n");                                           \
00997     }                                                                     \
00998 } while (YYID (0))
00999 
01000 
01001 /*--------------------------------.
01002 | Print this symbol on YYOUTPUT.  |
01003 `--------------------------------*/
01004 
01005 /*ARGSUSED*/
01006 #if (defined __STDC__ || defined __C99__FUNC__ \
01007      || defined __cplusplus || defined _MSC_VER)
01008 static void
01009 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
01010 #else
01011 static void
01012 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
01013     FILE *yyoutput;
01014     int yytype;
01015     YYSTYPE const * const yyvaluep;
01016 #endif
01017 {
01018   if (!yyvaluep)
01019     return;
01020 # ifdef YYPRINT
01021   if (yytype < YYNTOKENS)
01022     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
01023 # else
01024   YYUSE (yyoutput);
01025 # endif
01026   switch (yytype)
01027     {
01028       default:
01029         break;
01030     }
01031 }
01032 
01033 
01034 /*--------------------------------.
01035 | Print this symbol on YYOUTPUT.  |
01036 `--------------------------------*/
01037 
01038 #if (defined __STDC__ || defined __C99__FUNC__ \
01039      || defined __cplusplus || defined _MSC_VER)
01040 static void
01041 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
01042 #else
01043 static void
01044 yy_symbol_print (yyoutput, yytype, yyvaluep)
01045     FILE *yyoutput;
01046     int yytype;
01047     YYSTYPE const * const yyvaluep;
01048 #endif
01049 {
01050   if (yytype < YYNTOKENS)
01051     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
01052   else
01053     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
01054 
01055   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
01056   YYFPRINTF (yyoutput, ")");
01057 }
01058 
01059 /*------------------------------------------------------------------.
01060 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
01061 | TOP (included).                                                   |
01062 `------------------------------------------------------------------*/
01063 
01064 #if (defined __STDC__ || defined __C99__FUNC__ \
01065      || defined __cplusplus || defined _MSC_VER)
01066 static void
01067 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
01068 #else
01069 static void
01070 yy_stack_print (yybottom, yytop)
01071     yytype_int16 *yybottom;
01072     yytype_int16 *yytop;
01073 #endif
01074 {
01075   YYFPRINTF (stderr, "Stack now");
01076   for (; yybottom <= yytop; yybottom++)
01077     {
01078       int yybot = *yybottom;
01079       YYFPRINTF (stderr, " %d", yybot);
01080     }
01081   YYFPRINTF (stderr, "\n");
01082 }
01083 
01084 # define YY_STACK_PRINT(Bottom, Top)                            \
01085 do {                                                            \
01086   if (yydebug)                                                  \
01087     yy_stack_print ((Bottom), (Top));                           \
01088 } while (YYID (0))
01089 
01090 
01091 /*------------------------------------------------.
01092 | Report that the YYRULE is going to be reduced.  |
01093 `------------------------------------------------*/
01094 
01095 #if (defined __STDC__ || defined __C99__FUNC__ \
01096      || defined __cplusplus || defined _MSC_VER)
01097 static void
01098 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
01099 #else
01100 static void
01101 yy_reduce_print (yyvsp, yyrule)
01102     YYSTYPE *yyvsp;
01103     int yyrule;
01104 #endif
01105 {
01106   int yynrhs = yyr2[yyrule];
01107   int yyi;
01108   unsigned long int yylno = yyrline[yyrule];
01109   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
01110              yyrule - 1, yylno);
01111   /* The symbols being reduced.  */
01112   for (yyi = 0; yyi < yynrhs; yyi++)
01113     {
01114       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
01115       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
01116                        &(yyvsp[(yyi + 1) - (yynrhs)])
01117                                        );
01118       YYFPRINTF (stderr, "\n");
01119     }
01120 }
01121 
01122 # define YY_REDUCE_PRINT(Rule)          \
01123 do {                                    \
01124   if (yydebug)                          \
01125     yy_reduce_print (yyvsp, Rule); \
01126 } while (YYID (0))
01127 
01128 /* Nonzero means print parse trace.  It is left uninitialized so that
01129    multiple parsers can coexist.  */
01130 int yydebug;
01131 #else /* !YYDEBUG */
01132 # define YYDPRINTF(Args)
01133 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
01134 # define YY_STACK_PRINT(Bottom, Top)
01135 # define YY_REDUCE_PRINT(Rule)
01136 #endif /* !YYDEBUG */
01137 
01138 
01139 /* YYINITDEPTH -- initial size of the parser's stacks.  */
01140 #ifndef YYINITDEPTH
01141 # define YYINITDEPTH 200
01142 #endif
01143 
01144 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
01145    if the built-in stack extension method is used).
01146 
01147    Do not make this value too large; the results are undefined if
01148    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
01149    evaluated with infinite-precision integer arithmetic.  */
01150 
01151 #ifndef YYMAXDEPTH
01152 # define YYMAXDEPTH 10000
01153 #endif
01154 
01155 
01156 #if YYERROR_VERBOSE
01157 
01158 # ifndef yystrlen
01159 #  if defined __GLIBC__ && defined _STRING_H
01160 #   define yystrlen strlen
01161 #  else
01162 /* Return the length of YYSTR.  */
01163 #if (defined __STDC__ || defined __C99__FUNC__ \
01164      || defined __cplusplus || defined _MSC_VER)
01165 static YYSIZE_T
01166 yystrlen (const char *yystr)
01167 #else
01168 static YYSIZE_T
01169 yystrlen (yystr)
01170     const char *yystr;
01171 #endif
01172 {
01173   YYSIZE_T yylen;
01174   for (yylen = 0; yystr[yylen]; yylen++)
01175     continue;
01176   return yylen;
01177 }
01178 #  endif
01179 # endif
01180 
01181 # ifndef yystpcpy
01182 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
01183 #   define yystpcpy stpcpy
01184 #  else
01185 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
01186    YYDEST.  */
01187 #if (defined __STDC__ || defined __C99__FUNC__ \
01188      || defined __cplusplus || defined _MSC_VER)
01189 static char *
01190 yystpcpy (char *yydest, const char *yysrc)
01191 #else
01192 static char *
01193 yystpcpy (yydest, yysrc)
01194     char *yydest;
01195     const char *yysrc;
01196 #endif
01197 {
01198   char *yyd = yydest;
01199   const char *yys = yysrc;
01200 
01201   while ((*yyd++ = *yys++) != '\0')
01202     continue;
01203 
01204   return yyd - 1;
01205 }
01206 #  endif
01207 # endif
01208 
01209 # ifndef yytnamerr
01210 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
01211    quotes and backslashes, so that it's suitable for yyerror.  The
01212    heuristic is that double-quoting is unnecessary unless the string
01213    contains an apostrophe, a comma, or backslash (other than
01214    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
01215    null, do not copy; instead, return the length of what the result
01216    would have been.  */
01217 static YYSIZE_T
01218 yytnamerr (char *yyres, const char *yystr)
01219 {
01220   if (*yystr == '"')
01221     {
01222       YYSIZE_T yyn = 0;
01223       char const *yyp = yystr;
01224 
01225       for (;;)
01226         switch (*++yyp)
01227           {
01228           case '\'':
01229           case ',':
01230             goto do_not_strip_quotes;
01231 
01232           case '\\':
01233             if (*++yyp != '\\')
01234               goto do_not_strip_quotes;
01235             /* Fall through.  */
01236           default:
01237             if (yyres)
01238               yyres[yyn] = *yyp;
01239             yyn++;
01240             break;
01241 
01242           case '"':
01243             if (yyres)
01244               yyres[yyn] = '\0';
01245             return yyn;
01246           }
01247     do_not_strip_quotes: ;
01248     }
01249 
01250   if (! yyres)
01251     return yystrlen (yystr);
01252 
01253   return yystpcpy (yyres, yystr) - yyres;
01254 }
01255 # endif
01256 
01257 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
01258    about the unexpected token YYTOKEN for the state stack whose top is
01259    YYSSP.
01260 
01261    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
01262    not large enough to hold the message.  In that case, also set
01263    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
01264    required number of bytes is too large to store.  */
01265 static int
01266 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
01267                 yytype_int16 *yyssp, int yytoken)
01268 {
01269   YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
01270   YYSIZE_T yysize = yysize0;
01271   YYSIZE_T yysize1;
01272   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
01273   /* Internationalized format string. */
01274   const char *yyformat = 0;
01275   /* Arguments of yyformat. */
01276   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
01277   /* Number of reported tokens (one for the "unexpected", one per
01278      "expected"). */
01279   int yycount = 0;
01280 
01281   /* There are many possibilities here to consider:
01282      - Assume YYFAIL is not used.  It's too flawed to consider.  See
01283        <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
01284        for details.  YYERROR is fine as it does not invoke this
01285        function.
01286      - If this state is a consistent state with a default action, then
01287        the only way this function was invoked is if the default action
01288        is an error action.  In that case, don't check for expected
01289        tokens because there are none.
01290      - The only way there can be no lookahead present (in yychar) is if
01291        this state is a consistent state with a default action.  Thus,
01292        detecting the absence of a lookahead is sufficient to determine
01293        that there is no unexpected or expected token to report.  In that
01294        case, just report a simple "syntax error".
01295      - Don't assume there isn't a lookahead just because this state is a
01296        consistent state with a default action.  There might have been a
01297        previous inconsistent state, consistent state with a non-default
01298        action, or user semantic action that manipulated yychar.
01299      - Of course, the expected token list depends on states to have
01300        correct lookahead information, and it depends on the parser not
01301        to perform extra reductions after fetching a lookahead from the
01302        scanner and before detecting a syntax error.  Thus, state merging
01303        (from LALR or IELR) and default reductions corrupt the expected
01304        token list.  However, the list is correct for canonical LR with
01305        one exception: it will still contain any token that will not be
01306        accepted due to an error action in a later state.
01307   */
01308   if (yytoken != YYEMPTY)
01309     {
01310       int yyn = yypact[*yyssp];
01311       yyarg[yycount++] = yytname[yytoken];
01312       if (!yypact_value_is_default (yyn))
01313         {
01314           /* Start YYX at -YYN if negative to avoid negative indexes in
01315              YYCHECK.  In other words, skip the first -YYN actions for
01316              this state because they are default actions.  */
01317           int yyxbegin = yyn < 0 ? -yyn : 0;
01318           /* Stay within bounds of both yycheck and yytname.  */
01319           int yychecklim = YYLAST - yyn + 1;
01320           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
01321           int yyx;
01322 
01323           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01324             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
01325                 && !yytable_value_is_error (yytable[yyx + yyn]))
01326               {
01327                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
01328                   {
01329                     yycount = 1;
01330                     yysize = yysize0;
01331                     break;
01332                   }
01333                 yyarg[yycount++] = yytname[yyx];
01334                 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
01335                 if (! (yysize <= yysize1
01336                        && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
01337                   return 2;
01338                 yysize = yysize1;
01339               }
01340         }
01341     }
01342 
01343   switch (yycount)
01344     {
01345 # define YYCASE_(N, S)                      \
01346       case N:                               \
01347         yyformat = S;                       \
01348       break
01349       YYCASE_(0, YY_("syntax error"));
01350       YYCASE_(1, YY_("syntax error, unexpected %s"));
01351       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
01352       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
01353       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
01354       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
01355 # undef YYCASE_
01356     }
01357 
01358   yysize1 = yysize + yystrlen (yyformat);
01359   if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
01360     return 2;
01361   yysize = yysize1;
01362 
01363   if (*yymsg_alloc < yysize)
01364     {
01365       *yymsg_alloc = 2 * yysize;
01366       if (! (yysize <= *yymsg_alloc
01367              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
01368         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
01369       return 1;
01370     }
01371 
01372   /* Avoid sprintf, as that infringes on the user's name space.
01373      Don't have undefined behavior even if the translation
01374      produced a string with the wrong number of "%s"s.  */
01375   {
01376     char *yyp = *yymsg;
01377     int yyi = 0;
01378     while ((*yyp = *yyformat) != '\0')
01379       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
01380         {
01381           yyp += yytnamerr (yyp, yyarg[yyi++]);
01382           yyformat += 2;
01383         }
01384       else
01385         {
01386           yyp++;
01387           yyformat++;
01388         }
01389   }
01390   return 0;
01391 }
01392 #endif /* YYERROR_VERBOSE */
01393 
01394 /*-----------------------------------------------.
01395 | Release the memory associated to this symbol.  |
01396 `-----------------------------------------------*/
01397 
01398 /*ARGSUSED*/
01399 #if (defined __STDC__ || defined __C99__FUNC__ \
01400      || defined __cplusplus || defined _MSC_VER)
01401 static void
01402 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
01403 #else
01404 static void
01405 yydestruct (yymsg, yytype, yyvaluep)
01406     const char *yymsg;
01407     int yytype;
01408     YYSTYPE *yyvaluep;
01409 #endif
01410 {
01411   YYUSE (yyvaluep);
01412 
01413   if (!yymsg)
01414     yymsg = "Deleting";
01415   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
01416 
01417   switch (yytype)
01418     {
01419 
01420       default:
01421         break;
01422     }
01423 }
01424 
01425 
01426 /* Prevent warnings from -Wmissing-prototypes.  */
01427 #ifdef YYPARSE_PARAM
01428 #if defined __STDC__ || defined __cplusplus
01429 int yyparse (void *YYPARSE_PARAM);
01430 #else
01431 int yyparse ();
01432 #endif
01433 #else /* ! YYPARSE_PARAM */
01434 #if defined __STDC__ || defined __cplusplus
01435 int yyparse (void);
01436 #else
01437 int yyparse ();
01438 #endif
01439 #endif /* ! YYPARSE_PARAM */
01440 
01441 
01442 /* The lookahead symbol.  */
01443 int yychar;
01444 
01445 /* The semantic value of the lookahead symbol.  */
01446 YYSTYPE yylval;
01447 
01448 /* Number of syntax errors so far.  */
01449 int yynerrs;
01450 
01451 
01452 /*----------.
01453 | yyparse.  |
01454 `----------*/
01455 
01456 #ifdef YYPARSE_PARAM
01457 #if (defined __STDC__ || defined __C99__FUNC__ \
01458      || defined __cplusplus || defined _MSC_VER)
01459 int
01460 yyparse (void *YYPARSE_PARAM)
01461 #else
01462 int
01463 yyparse (YYPARSE_PARAM)
01464     void *YYPARSE_PARAM;
01465 #endif
01466 #else /* ! YYPARSE_PARAM */
01467 #if (defined __STDC__ || defined __C99__FUNC__ \
01468      || defined __cplusplus || defined _MSC_VER)
01469 int
01470 yyparse (void)
01471 #else
01472 int
01473 yyparse ()
01474 
01475 #endif
01476 #endif
01477 {
01478     int yystate;
01479     /* Number of tokens to shift before error messages enabled.  */
01480     int yyerrstatus;
01481 
01482     /* The stacks and their tools:
01483        `yyss': related to states.
01484        `yyvs': related to semantic values.
01485 
01486        Refer to the stacks thru separate pointers, to allow yyoverflow
01487        to xreallocate them elsewhere.  */
01488 
01489     /* The state stack.  */
01490     yytype_int16 yyssa[YYINITDEPTH];
01491     yytype_int16 *yyss;
01492     yytype_int16 *yyssp;
01493 
01494     /* The semantic value stack.  */
01495     YYSTYPE yyvsa[YYINITDEPTH];
01496     YYSTYPE *yyvs;
01497     YYSTYPE *yyvsp;
01498 
01499     YYSIZE_T yystacksize;
01500 
01501   int yyn;
01502   int yyresult;
01503   /* Lookahead token as an internal (translated) token number.  */
01504   int yytoken;
01505   /* The variables used to return semantic value and location from the
01506      action routines.  */
01507   YYSTYPE yyval;
01508 
01509 #if YYERROR_VERBOSE
01510   /* Buffer for error messages, and its allocated size.  */
01511   char yymsgbuf[128];
01512   char *yymsg = yymsgbuf;
01513   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
01514 #endif
01515 
01516 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
01517 
01518   /* The number of symbols on the RHS of the reduced rule.
01519      Keep to zero when no symbol should be popped.  */
01520   int yylen = 0;
01521 
01522   yytoken = 0;
01523   yyss = yyssa;
01524   yyvs = yyvsa;
01525   yystacksize = YYINITDEPTH;
01526 
01527   YYDPRINTF ((stderr, "Starting parse\n"));
01528 
01529   yystate = 0;
01530   yyerrstatus = 0;
01531   yynerrs = 0;
01532   yychar = YYEMPTY; /* Cause a token to be read.  */
01533 
01534   /* Initialize stack pointers.
01535      Waste one element of value and location stack
01536      so that they stay on the same level as the state stack.
01537      The wasted elements are never initialized.  */
01538   yyssp = yyss;
01539   yyvsp = yyvs;
01540 
01541   goto yysetstate;
01542 
01543 /*------------------------------------------------------------.
01544 | yynewstate -- Push a new state, which is found in yystate.  |
01545 `------------------------------------------------------------*/
01546  yynewstate:
01547   /* In all cases, when you get here, the value and location stacks
01548      have just been pushed.  So pushing a state here evens the stacks.  */
01549   yyssp++;
01550 
01551  yysetstate:
01552   *yyssp = yystate;
01553 
01554   if (yyss + yystacksize - 1 <= yyssp)
01555     {
01556       /* Get the current used size of the three stacks, in elements.  */
01557       YYSIZE_T yysize = yyssp - yyss + 1;
01558 
01559 #ifdef yyoverflow
01560       {
01561         /* Give user a chance to xreallocate the stack.  Use copies of
01562            these so that the &'s don't force the real ones into
01563            memory.  */
01564         YYSTYPE *yyvs1 = yyvs;
01565         yytype_int16 *yyss1 = yyss;
01566 
01567         /* Each stack pointer address is followed by the size of the
01568            data in use in that stack, in bytes.  This used to be a
01569            conditional around just the two extra args, but that might
01570            be undefined if yyoverflow is a macro.  */
01571         yyoverflow (YY_("memory exhausted"),
01572                     &yyss1, yysize * sizeof (*yyssp),
01573                     &yyvs1, yysize * sizeof (*yyvsp),
01574                     &yystacksize);
01575 
01576         yyss = yyss1;
01577         yyvs = yyvs1;
01578       }
01579 #else /* no yyoverflow */
01580 # ifndef YYSTACK_RELOCATE
01581       goto yyexhaustedlab;
01582 # else
01583       /* Extend the stack our own way.  */
01584       if (YYMAXDEPTH <= yystacksize)
01585         goto yyexhaustedlab;
01586       yystacksize *= 2;
01587       if (YYMAXDEPTH < yystacksize)
01588         yystacksize = YYMAXDEPTH;
01589 
01590       {
01591         yytype_int16 *yyss1 = yyss;
01592         union yyalloc *yyptr =
01593           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01594         if (! yyptr)
01595           goto yyexhaustedlab;
01596         YYSTACK_RELOCATE (yyss_alloc, yyss);
01597         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
01598 #  undef YYSTACK_RELOCATE
01599         if (yyss1 != yyssa)
01600           YYSTACK_FREE (yyss1);
01601       }
01602 # endif
01603 #endif /* no yyoverflow */
01604 
01605       yyssp = yyss + yysize - 1;
01606       yyvsp = yyvs + yysize - 1;
01607 
01608       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01609                   (unsigned long int) yystacksize));
01610 
01611       if (yyss + yystacksize - 1 <= yyssp)
01612         YYABORT;
01613     }
01614 
01615   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01616 
01617   if (yystate == YYFINAL)
01618     YYACCEPT;
01619 
01620   goto yybackup;
01621 
01622 /*-----------.
01623 | yybackup.  |
01624 `-----------*/
01625 yybackup:
01626 
01627   /* Do appropriate processing given the current state.  Read a
01628      lookahead token if we need one and don't already have one.  */
01629 
01630   /* First try to decide what to do without reference to lookahead token.  */
01631   yyn = yypact[yystate];
01632   if (yypact_value_is_default (yyn))
01633     goto yydefault;
01634 
01635   /* Not known => get a lookahead token if don't already have one.  */
01636 
01637   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
01638   if (yychar == YYEMPTY)
01639     {
01640       YYDPRINTF ((stderr, "Reading a token: "));
01641       yychar = YYLEX;
01642     }
01643 
01644   if (yychar <= YYEOF)
01645     {
01646       yychar = yytoken = YYEOF;
01647       YYDPRINTF ((stderr, "Now at end of input.\n"));
01648     }
01649   else
01650     {
01651       yytoken = YYTRANSLATE (yychar);
01652       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
01653     }
01654 
01655   /* If the proper action on seeing token YYTOKEN is to reduce or to
01656      detect an error, take that action.  */
01657   yyn += yytoken;
01658   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01659     goto yydefault;
01660   yyn = yytable[yyn];
01661   if (yyn <= 0)
01662     {
01663       if (yytable_value_is_error (yyn))
01664         goto yyerrlab;
01665       yyn = -yyn;
01666       goto yyreduce;
01667     }
01668 
01669   /* Count tokens shifted since error; after three, turn off error
01670      status.  */
01671   if (yyerrstatus)
01672     yyerrstatus--;
01673 
01674   /* Shift the lookahead token.  */
01675   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
01676 
01677   /* Discard the shifted token.  */
01678   yychar = YYEMPTY;
01679 
01680   yystate = yyn;
01681   *++yyvsp = yylval;
01682 
01683   goto yynewstate;
01684 
01685 
01686 /*-----------------------------------------------------------.
01687 | yydefault -- do the default action for the current state.  |
01688 `-----------------------------------------------------------*/
01689 yydefault:
01690   yyn = yydefact[yystate];
01691   if (yyn == 0)
01692     goto yyerrlab;
01693   goto yyreduce;
01694 
01695 
01696 /*-----------------------------.
01697 | yyreduce -- Do a reduction.  |
01698 `-----------------------------*/
01699 yyreduce:
01700   /* yyn is the number of a rule to reduce with.  */
01701   yylen = yyr2[yyn];
01702 
01703   /* If YYLEN is nonzero, implement the default value of the action:
01704      `$$ = $1'.
01705 
01706      Otherwise, the following line sets YYVAL to garbage.
01707      This behavior is undocumented and Bison
01708      users should not rely upon it.  Assigning to YYVAL
01709      unconditionally makes the parser a bit smaller, and it avoids a
01710      GCC warning that YYVAL may be used uninitialized.  */
01711   yyval = yyvsp[1-yylen];
01712 
01713 
01714   YY_REDUCE_PRINT (yyn);
01715   switch (yyn)
01716     {
01717         case 4:
01718 
01719 /* Line 1806 of yacc.c  */
01720 #line 242 "../../src/gdb/go-exp.y"
01721     { write_exp_elt_opcode(OP_TYPE);
01722                           write_exp_elt_type((yyvsp[(1) - (1)].tval));
01723                           write_exp_elt_opcode(OP_TYPE); }
01724     break;
01725 
01726   case 6:
01727 
01728 /* Line 1806 of yacc.c  */
01729 #line 250 "../../src/gdb/go-exp.y"
01730     { write_exp_elt_opcode (BINOP_COMMA); }
01731     break;
01732 
01733   case 7:
01734 
01735 /* Line 1806 of yacc.c  */
01736 #line 255 "../../src/gdb/go-exp.y"
01737     { write_exp_elt_opcode (UNOP_IND); }
01738     break;
01739 
01740   case 8:
01741 
01742 /* Line 1806 of yacc.c  */
01743 #line 259 "../../src/gdb/go-exp.y"
01744     { write_exp_elt_opcode (UNOP_ADDR); }
01745     break;
01746 
01747   case 9:
01748 
01749 /* Line 1806 of yacc.c  */
01750 #line 263 "../../src/gdb/go-exp.y"
01751     { write_exp_elt_opcode (UNOP_NEG); }
01752     break;
01753 
01754   case 10:
01755 
01756 /* Line 1806 of yacc.c  */
01757 #line 267 "../../src/gdb/go-exp.y"
01758     { write_exp_elt_opcode (UNOP_PLUS); }
01759     break;
01760 
01761   case 11:
01762 
01763 /* Line 1806 of yacc.c  */
01764 #line 271 "../../src/gdb/go-exp.y"
01765     { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
01766     break;
01767 
01768   case 12:
01769 
01770 /* Line 1806 of yacc.c  */
01771 #line 275 "../../src/gdb/go-exp.y"
01772     { write_exp_elt_opcode (UNOP_COMPLEMENT); }
01773     break;
01774 
01775   case 13:
01776 
01777 /* Line 1806 of yacc.c  */
01778 #line 279 "../../src/gdb/go-exp.y"
01779     { write_exp_elt_opcode (UNOP_POSTINCREMENT); }
01780     break;
01781 
01782   case 14:
01783 
01784 /* Line 1806 of yacc.c  */
01785 #line 283 "../../src/gdb/go-exp.y"
01786     { write_exp_elt_opcode (UNOP_POSTDECREMENT); }
01787     break;
01788 
01789   case 15:
01790 
01791 /* Line 1806 of yacc.c  */
01792 #line 289 "../../src/gdb/go-exp.y"
01793     { write_exp_elt_opcode (STRUCTOP_STRUCT);
01794                           write_exp_string ((yyvsp[(3) - (3)].ssym).stoken);
01795                           write_exp_elt_opcode (STRUCTOP_STRUCT); }
01796     break;
01797 
01798   case 16:
01799 
01800 /* Line 1806 of yacc.c  */
01801 #line 295 "../../src/gdb/go-exp.y"
01802     { mark_struct_expression ();
01803                           write_exp_elt_opcode (STRUCTOP_STRUCT);
01804                           write_exp_string ((yyvsp[(3) - (4)].ssym).stoken);
01805                           write_exp_elt_opcode (STRUCTOP_STRUCT); }
01806     break;
01807 
01808   case 17:
01809 
01810 /* Line 1806 of yacc.c  */
01811 #line 302 "../../src/gdb/go-exp.y"
01812     { struct stoken s;
01813                           mark_struct_expression ();
01814                           write_exp_elt_opcode (STRUCTOP_STRUCT);
01815                           s.ptr = "";
01816                           s.length = 0;
01817                           write_exp_string (s);
01818                           write_exp_elt_opcode (STRUCTOP_STRUCT); }
01819     break;
01820 
01821   case 18:
01822 
01823 /* Line 1806 of yacc.c  */
01824 #line 312 "../../src/gdb/go-exp.y"
01825     { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
01826     break;
01827 
01828   case 19:
01829 
01830 /* Line 1806 of yacc.c  */
01831 #line 318 "../../src/gdb/go-exp.y"
01832     { start_arglist (); }
01833     break;
01834 
01835   case 20:
01836 
01837 /* Line 1806 of yacc.c  */
01838 #line 320 "../../src/gdb/go-exp.y"
01839     { write_exp_elt_opcode (OP_FUNCALL);
01840                           write_exp_elt_longcst ((LONGEST) end_arglist ());
01841                           write_exp_elt_opcode (OP_FUNCALL); }
01842     break;
01843 
01844   case 21:
01845 
01846 /* Line 1806 of yacc.c  */
01847 #line 326 "../../src/gdb/go-exp.y"
01848     { start_arglist (); }
01849     break;
01850 
01851   case 23:
01852 
01853 /* Line 1806 of yacc.c  */
01854 #line 333 "../../src/gdb/go-exp.y"
01855     { arglist_len = 1; }
01856     break;
01857 
01858   case 24:
01859 
01860 /* Line 1806 of yacc.c  */
01861 #line 337 "../../src/gdb/go-exp.y"
01862     { arglist_len++; }
01863     break;
01864 
01865   case 25:
01866 
01867 /* Line 1806 of yacc.c  */
01868 #line 341 "../../src/gdb/go-exp.y"
01869     { (yyval.lval) = end_arglist () - 1; }
01870     break;
01871 
01872   case 26:
01873 
01874 /* Line 1806 of yacc.c  */
01875 #line 345 "../../src/gdb/go-exp.y"
01876     { write_exp_elt_opcode (UNOP_MEMVAL);
01877                           write_exp_elt_type ((yyvsp[(2) - (4)].tval));
01878                           write_exp_elt_opcode (UNOP_MEMVAL); }
01879     break;
01880 
01881   case 27:
01882 
01883 /* Line 1806 of yacc.c  */
01884 #line 351 "../../src/gdb/go-exp.y"
01885     { write_exp_elt_opcode (UNOP_CAST);
01886                           write_exp_elt_type ((yyvsp[(1) - (4)].tval));
01887                           write_exp_elt_opcode (UNOP_CAST); }
01888     break;
01889 
01890   case 28:
01891 
01892 /* Line 1806 of yacc.c  */
01893 #line 357 "../../src/gdb/go-exp.y"
01894     { }
01895     break;
01896 
01897   case 29:
01898 
01899 /* Line 1806 of yacc.c  */
01900 #line 363 "../../src/gdb/go-exp.y"
01901     { write_exp_elt_opcode (BINOP_REPEAT); }
01902     break;
01903 
01904   case 30:
01905 
01906 /* Line 1806 of yacc.c  */
01907 #line 367 "../../src/gdb/go-exp.y"
01908     { write_exp_elt_opcode (BINOP_MUL); }
01909     break;
01910 
01911   case 31:
01912 
01913 /* Line 1806 of yacc.c  */
01914 #line 371 "../../src/gdb/go-exp.y"
01915     { write_exp_elt_opcode (BINOP_DIV); }
01916     break;
01917 
01918   case 32:
01919 
01920 /* Line 1806 of yacc.c  */
01921 #line 375 "../../src/gdb/go-exp.y"
01922     { write_exp_elt_opcode (BINOP_REM); }
01923     break;
01924 
01925   case 33:
01926 
01927 /* Line 1806 of yacc.c  */
01928 #line 379 "../../src/gdb/go-exp.y"
01929     { write_exp_elt_opcode (BINOP_ADD); }
01930     break;
01931 
01932   case 34:
01933 
01934 /* Line 1806 of yacc.c  */
01935 #line 383 "../../src/gdb/go-exp.y"
01936     { write_exp_elt_opcode (BINOP_SUB); }
01937     break;
01938 
01939   case 35:
01940 
01941 /* Line 1806 of yacc.c  */
01942 #line 387 "../../src/gdb/go-exp.y"
01943     { write_exp_elt_opcode (BINOP_LSH); }
01944     break;
01945 
01946   case 36:
01947 
01948 /* Line 1806 of yacc.c  */
01949 #line 391 "../../src/gdb/go-exp.y"
01950     { write_exp_elt_opcode (BINOP_RSH); }
01951     break;
01952 
01953   case 37:
01954 
01955 /* Line 1806 of yacc.c  */
01956 #line 395 "../../src/gdb/go-exp.y"
01957     { write_exp_elt_opcode (BINOP_EQUAL); }
01958     break;
01959 
01960   case 38:
01961 
01962 /* Line 1806 of yacc.c  */
01963 #line 399 "../../src/gdb/go-exp.y"
01964     { write_exp_elt_opcode (BINOP_NOTEQUAL); }
01965     break;
01966 
01967   case 39:
01968 
01969 /* Line 1806 of yacc.c  */
01970 #line 403 "../../src/gdb/go-exp.y"
01971     { write_exp_elt_opcode (BINOP_LEQ); }
01972     break;
01973 
01974   case 40:
01975 
01976 /* Line 1806 of yacc.c  */
01977 #line 407 "../../src/gdb/go-exp.y"
01978     { write_exp_elt_opcode (BINOP_GEQ); }
01979     break;
01980 
01981   case 41:
01982 
01983 /* Line 1806 of yacc.c  */
01984 #line 411 "../../src/gdb/go-exp.y"
01985     { write_exp_elt_opcode (BINOP_LESS); }
01986     break;
01987 
01988   case 42:
01989 
01990 /* Line 1806 of yacc.c  */
01991 #line 415 "../../src/gdb/go-exp.y"
01992     { write_exp_elt_opcode (BINOP_GTR); }
01993     break;
01994 
01995   case 43:
01996 
01997 /* Line 1806 of yacc.c  */
01998 #line 419 "../../src/gdb/go-exp.y"
01999     { write_exp_elt_opcode (BINOP_BITWISE_AND); }
02000     break;
02001 
02002   case 44:
02003 
02004 /* Line 1806 of yacc.c  */
02005 #line 423 "../../src/gdb/go-exp.y"
02006     { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
02007     break;
02008 
02009   case 45:
02010 
02011 /* Line 1806 of yacc.c  */
02012 #line 427 "../../src/gdb/go-exp.y"
02013     { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
02014     break;
02015 
02016   case 46:
02017 
02018 /* Line 1806 of yacc.c  */
02019 #line 431 "../../src/gdb/go-exp.y"
02020     { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
02021     break;
02022 
02023   case 47:
02024 
02025 /* Line 1806 of yacc.c  */
02026 #line 435 "../../src/gdb/go-exp.y"
02027     { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
02028     break;
02029 
02030   case 48:
02031 
02032 /* Line 1806 of yacc.c  */
02033 #line 439 "../../src/gdb/go-exp.y"
02034     { write_exp_elt_opcode (TERNOP_COND); }
02035     break;
02036 
02037   case 49:
02038 
02039 /* Line 1806 of yacc.c  */
02040 #line 443 "../../src/gdb/go-exp.y"
02041     { write_exp_elt_opcode (BINOP_ASSIGN); }
02042     break;
02043 
02044   case 50:
02045 
02046 /* Line 1806 of yacc.c  */
02047 #line 447 "../../src/gdb/go-exp.y"
02048     { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
02049                           write_exp_elt_opcode ((yyvsp[(2) - (3)].opcode));
02050                           write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
02051     break;
02052 
02053   case 51:
02054 
02055 /* Line 1806 of yacc.c  */
02056 #line 453 "../../src/gdb/go-exp.y"
02057     { write_exp_elt_opcode (OP_LONG);
02058                           write_exp_elt_type ((yyvsp[(1) - (1)].typed_val_int).type);
02059                           write_exp_elt_longcst ((LONGEST)((yyvsp[(1) - (1)].typed_val_int).val));
02060                           write_exp_elt_opcode (OP_LONG); }
02061     break;
02062 
02063   case 52:
02064 
02065 /* Line 1806 of yacc.c  */
02066 #line 460 "../../src/gdb/go-exp.y"
02067     {
02068                           struct stoken_vector vec;
02069                           vec.len = 1;
02070                           vec.tokens = &(yyvsp[(1) - (1)].tsval);
02071                           write_exp_string_vector ((yyvsp[(1) - (1)].tsval).type, &vec);
02072                         }
02073     break;
02074 
02075   case 53:
02076 
02077 /* Line 1806 of yacc.c  */
02078 #line 469 "../../src/gdb/go-exp.y"
02079     { YYSTYPE val;
02080                           parse_number ((yyvsp[(1) - (1)].ssym).stoken.ptr, (yyvsp[(1) - (1)].ssym).stoken.length,
02081                                         0, &val);
02082                           write_exp_elt_opcode (OP_LONG);
02083                           write_exp_elt_type (val.typed_val_int.type);
02084                           write_exp_elt_longcst ((LONGEST)
02085                                                  val.typed_val_int.val);
02086                           write_exp_elt_opcode (OP_LONG);
02087                         }
02088     break;
02089 
02090   case 54:
02091 
02092 /* Line 1806 of yacc.c  */
02093 #line 482 "../../src/gdb/go-exp.y"
02094     { write_exp_elt_opcode (OP_DOUBLE);
02095                           write_exp_elt_type ((yyvsp[(1) - (1)].typed_val_float).type);
02096                           write_exp_elt_dblcst ((yyvsp[(1) - (1)].typed_val_float).dval);
02097                           write_exp_elt_opcode (OP_DOUBLE); }
02098     break;
02099 
02100   case 56:
02101 
02102 /* Line 1806 of yacc.c  */
02103 #line 492 "../../src/gdb/go-exp.y"
02104     {
02105                           write_dollar_variable ((yyvsp[(1) - (1)].sval));
02106                         }
02107     break;
02108 
02109   case 57:
02110 
02111 /* Line 1806 of yacc.c  */
02112 #line 498 "../../src/gdb/go-exp.y"
02113     {
02114                           /* TODO(dje): Go objects in structs.  */
02115                           write_exp_elt_opcode (OP_LONG);
02116                           /* TODO(dje): What's the right type here?  */
02117                           write_exp_elt_type (parse_type->builtin_unsigned_int);
02118                           CHECK_TYPEDEF ((yyvsp[(3) - (4)].tval));
02119                           write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ((yyvsp[(3) - (4)].tval)));
02120                           write_exp_elt_opcode (OP_LONG);
02121                         }
02122     break;
02123 
02124   case 58:
02125 
02126 /* Line 1806 of yacc.c  */
02127 #line 510 "../../src/gdb/go-exp.y"
02128     {
02129                           /* TODO(dje): Go objects in structs.  */
02130                           write_exp_elt_opcode (UNOP_SIZEOF);
02131                         }
02132     break;
02133 
02134   case 59:
02135 
02136 /* Line 1806 of yacc.c  */
02137 #line 517 "../../src/gdb/go-exp.y"
02138     {
02139                           /* We copy the string here, and not in the
02140                              lexer, to guarantee that we do not leak a
02141                              string.  */
02142                           /* Note that we NUL-terminate here, but just
02143                              for convenience.  */
02144                           struct typed_stoken *vec = XNEW (struct typed_stoken);
02145                           (yyval.svec).len = 1;
02146                           (yyval.svec).tokens = vec;
02147 
02148                           vec->type = (yyvsp[(1) - (1)].tsval).type;
02149                           vec->length = (yyvsp[(1) - (1)].tsval).length;
02150                           vec->ptr = xmalloc ((yyvsp[(1) - (1)].tsval).length + 1);
02151                           memcpy (vec->ptr, (yyvsp[(1) - (1)].tsval).ptr, (yyvsp[(1) - (1)].tsval).length + 1);
02152                         }
02153     break;
02154 
02155   case 60:
02156 
02157 /* Line 1806 of yacc.c  */
02158 #line 534 "../../src/gdb/go-exp.y"
02159     {
02160                           /* Note that we NUL-terminate here, but just
02161                              for convenience.  */
02162                           char *p;
02163                           ++(yyval.svec).len;
02164                           (yyval.svec).tokens = xrealloc ((yyval.svec).tokens,
02165                                                (yyval.svec).len * sizeof (struct typed_stoken));
02166 
02167                           p = xmalloc ((yyvsp[(3) - (3)].tsval).length + 1);
02168                           memcpy (p, (yyvsp[(3) - (3)].tsval).ptr, (yyvsp[(3) - (3)].tsval).length + 1);
02169 
02170                           (yyval.svec).tokens[(yyval.svec).len - 1].type = (yyvsp[(3) - (3)].tsval).type;
02171                           (yyval.svec).tokens[(yyval.svec).len - 1].length = (yyvsp[(3) - (3)].tsval).length;
02172                           (yyval.svec).tokens[(yyval.svec).len - 1].ptr = p;
02173                         }
02174     break;
02175 
02176   case 61:
02177 
02178 /* Line 1806 of yacc.c  */
02179 #line 552 "../../src/gdb/go-exp.y"
02180     {
02181                           int i;
02182 
02183                           write_exp_string_vector (0 /*always utf8*/, &(yyvsp[(1) - (1)].svec));
02184                           for (i = 0; i < (yyvsp[(1) - (1)].svec).len; ++i)
02185                             xfree ((yyvsp[(1) - (1)].svec).tokens[i].ptr);
02186                           xfree ((yyvsp[(1) - (1)].svec).tokens);
02187                         }
02188     break;
02189 
02190   case 62:
02191 
02192 /* Line 1806 of yacc.c  */
02193 #line 563 "../../src/gdb/go-exp.y"
02194     { write_exp_elt_opcode (OP_BOOL);
02195                           write_exp_elt_longcst ((LONGEST) (yyvsp[(1) - (1)].lval));
02196                           write_exp_elt_opcode (OP_BOOL); }
02197     break;
02198 
02199   case 63:
02200 
02201 /* Line 1806 of yacc.c  */
02202 #line 569 "../../src/gdb/go-exp.y"
02203     { write_exp_elt_opcode (OP_BOOL);
02204                           write_exp_elt_longcst ((LONGEST) (yyvsp[(1) - (1)].lval));
02205                           write_exp_elt_opcode (OP_BOOL); }
02206     break;
02207 
02208   case 64:
02209 
02210 /* Line 1806 of yacc.c  */
02211 #line 575 "../../src/gdb/go-exp.y"
02212     { struct symbol *sym = (yyvsp[(1) - (2)].ssym).sym;
02213 
02214                           if (sym == NULL
02215                               || !SYMBOL_IS_ARGUMENT (sym)
02216                               || !symbol_read_needs_frame (sym))
02217                             error (_("@entry can be used only for function "
02218                                      "parameters, not for \"%s\""),
02219                                    copy_name ((yyvsp[(1) - (2)].ssym).stoken));
02220 
02221                           write_exp_elt_opcode (OP_VAR_ENTRY_VALUE);
02222                           write_exp_elt_sym (sym);
02223                           write_exp_elt_opcode (OP_VAR_ENTRY_VALUE);
02224                         }
02225     break;
02226 
02227   case 65:
02228 
02229 /* Line 1806 of yacc.c  */
02230 #line 591 "../../src/gdb/go-exp.y"
02231     { struct symbol *sym = (yyvsp[(1) - (1)].ssym).sym;
02232 
02233                           if (sym)
02234                             {
02235                               if (symbol_read_needs_frame (sym))
02236                                 {
02237                                   if (innermost_block == 0
02238                                       || contained_in (block_found,
02239                                                        innermost_block))
02240                                     innermost_block = block_found;
02241                                 }
02242 
02243                               write_exp_elt_opcode (OP_VAR_VALUE);
02244                               /* We want to use the selected frame, not
02245                                  another more inner frame which happens to
02246                                  be in the same block.  */
02247                               write_exp_elt_block (NULL);
02248                               write_exp_elt_sym (sym);
02249                               write_exp_elt_opcode (OP_VAR_VALUE);
02250                             }
02251                           else if ((yyvsp[(1) - (1)].ssym).is_a_field_of_this)
02252                             {
02253                               /* TODO(dje): Can we get here?
02254                                  E.g., via a mix of c++ and go?  */
02255                               gdb_assert_not_reached ("go with `this' field");
02256                             }
02257                           else
02258                             {
02259                               struct bound_minimal_symbol msymbol;
02260                               char *arg = copy_name ((yyvsp[(1) - (1)].ssym).stoken);
02261 
02262                               msymbol =
02263                                 lookup_bound_minimal_symbol (arg);
02264                               if (msymbol.minsym != NULL)
02265                                 write_exp_msymbol (msymbol);
02266                               else if (!have_full_symbols ()
02267                                        && !have_partial_symbols ())
02268                                 error (_("No symbol table is loaded.  "
02269                                        "Use the \"file\" command."));
02270                               else
02271                                 error (_("No symbol \"%s\" in current context."),
02272                                        copy_name ((yyvsp[(1) - (1)].ssym).stoken));
02273                             }
02274                         }
02275     break;
02276 
02277   case 66:
02278 
02279 /* Line 1806 of yacc.c  */
02280 #line 646 "../../src/gdb/go-exp.y"
02281     { (yyval.tval) = lookup_pointer_type ((yyvsp[(2) - (2)].tval)); }
02282     break;
02283 
02284   case 67:
02285 
02286 /* Line 1806 of yacc.c  */
02287 #line 648 "../../src/gdb/go-exp.y"
02288     { (yyval.tval) = (yyvsp[(1) - (1)].tsym).type; }
02289     break;
02290 
02291   case 68:
02292 
02293 /* Line 1806 of yacc.c  */
02294 #line 655 "../../src/gdb/go-exp.y"
02295     { (yyval.tval) = builtin_go_type (parse_gdbarch)
02296                             ->builtin_uint8; }
02297     break;
02298 
02299 
02300 
02301 /* Line 1806 of yacc.c  */
02302 #line 2304 "go-exp.c"
02303       default: break;
02304     }
02305   /* User semantic actions sometimes alter yychar, and that requires
02306      that yytoken be updated with the new translation.  We take the
02307      approach of translating immediately before every use of yytoken.
02308      One alternative is translating here after every semantic action,
02309      but that translation would be missed if the semantic action invokes
02310      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
02311      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
02312      incorrect destructor might then be invoked immediately.  In the
02313      case of YYERROR or YYBACKUP, subsequent parser actions might lead
02314      to an incorrect destructor call or verbose syntax error message
02315      before the lookahead is translated.  */
02316   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
02317 
02318   YYPOPSTACK (yylen);
02319   yylen = 0;
02320   YY_STACK_PRINT (yyss, yyssp);
02321 
02322   *++yyvsp = yyval;
02323 
02324   /* Now `shift' the result of the reduction.  Determine what state
02325      that goes to, based on the state we popped back to and the rule
02326      number reduced by.  */
02327 
02328   yyn = yyr1[yyn];
02329 
02330   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
02331   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
02332     yystate = yytable[yystate];
02333   else
02334     yystate = yydefgoto[yyn - YYNTOKENS];
02335 
02336   goto yynewstate;
02337 
02338 
02339 /*------------------------------------.
02340 | yyerrlab -- here on detecting error |
02341 `------------------------------------*/
02342 yyerrlab:
02343   /* Make sure we have latest lookahead translation.  See comments at
02344      user semantic actions for why this is necessary.  */
02345   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
02346 
02347   /* If not already recovering from an error, report this error.  */
02348   if (!yyerrstatus)
02349     {
02350       ++yynerrs;
02351 #if ! YYERROR_VERBOSE
02352       yyerror (YY_("syntax error"));
02353 #else
02354 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
02355                                         yyssp, yytoken)
02356       {
02357         char const *yymsgp = YY_("syntax error");
02358         int yysyntax_error_status;
02359         yysyntax_error_status = YYSYNTAX_ERROR;
02360         if (yysyntax_error_status == 0)
02361           yymsgp = yymsg;
02362         else if (yysyntax_error_status == 1)
02363           {
02364             if (yymsg != yymsgbuf)
02365               YYSTACK_FREE (yymsg);
02366             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
02367             if (!yymsg)
02368               {
02369                 yymsg = yymsgbuf;
02370                 yymsg_alloc = sizeof yymsgbuf;
02371                 yysyntax_error_status = 2;
02372               }
02373             else
02374               {
02375                 yysyntax_error_status = YYSYNTAX_ERROR;
02376                 yymsgp = yymsg;
02377               }
02378           }
02379         yyerror (yymsgp);
02380         if (yysyntax_error_status == 2)
02381           goto yyexhaustedlab;
02382       }
02383 # undef YYSYNTAX_ERROR
02384 #endif
02385     }
02386 
02387 
02388 
02389   if (yyerrstatus == 3)
02390     {
02391       /* If just tried and failed to reuse lookahead token after an
02392          error, discard it.  */
02393 
02394       if (yychar <= YYEOF)
02395         {
02396           /* Return failure if at end of input.  */
02397           if (yychar == YYEOF)
02398             YYABORT;
02399         }
02400       else
02401         {
02402           yydestruct ("Error: discarding",
02403                       yytoken, &yylval);
02404           yychar = YYEMPTY;
02405         }
02406     }
02407 
02408   /* Else will try to reuse lookahead token after shifting the error
02409      token.  */
02410   goto yyerrlab1;
02411 
02412 
02413 /*---------------------------------------------------.
02414 | yyerrorlab -- error raised explicitly by YYERROR.  |
02415 `---------------------------------------------------*/
02416 yyerrorlab:
02417 
02418   /* Pacify compilers like GCC when the user code never invokes
02419      YYERROR and the label yyerrorlab therefore never appears in user
02420      code.  */
02421   if (/*CONSTCOND*/ 0)
02422      goto yyerrorlab;
02423 
02424   /* Do not reclaim the symbols of the rule which action triggered
02425      this YYERROR.  */
02426   YYPOPSTACK (yylen);
02427   yylen = 0;
02428   YY_STACK_PRINT (yyss, yyssp);
02429   yystate = *yyssp;
02430   goto yyerrlab1;
02431 
02432 
02433 /*-------------------------------------------------------------.
02434 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
02435 `-------------------------------------------------------------*/
02436 yyerrlab1:
02437   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
02438 
02439   for (;;)
02440     {
02441       yyn = yypact[yystate];
02442       if (!yypact_value_is_default (yyn))
02443         {
02444           yyn += YYTERROR;
02445           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
02446             {
02447               yyn = yytable[yyn];
02448               if (0 < yyn)
02449                 break;
02450             }
02451         }
02452 
02453       /* Pop the current state because it cannot handle the error token.  */
02454       if (yyssp == yyss)
02455         YYABORT;
02456 
02457 
02458       yydestruct ("Error: popping",
02459                   yystos[yystate], yyvsp);
02460       YYPOPSTACK (1);
02461       yystate = *yyssp;
02462       YY_STACK_PRINT (yyss, yyssp);
02463     }
02464 
02465   *++yyvsp = yylval;
02466 
02467 
02468   /* Shift the error token.  */
02469   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
02470 
02471   yystate = yyn;
02472   goto yynewstate;
02473 
02474 
02475 /*-------------------------------------.
02476 | yyacceptlab -- YYACCEPT comes here.  |
02477 `-------------------------------------*/
02478 yyacceptlab:
02479   yyresult = 0;
02480   goto yyreturn;
02481 
02482 /*-----------------------------------.
02483 | yyabortlab -- YYABORT comes here.  |
02484 `-----------------------------------*/
02485 yyabortlab:
02486   yyresult = 1;
02487   goto yyreturn;
02488 
02489 #if !defined(yyoverflow) || YYERROR_VERBOSE
02490 /*-------------------------------------------------.
02491 | yyexhaustedlab -- memory exhaustion comes here.  |
02492 `-------------------------------------------------*/
02493 yyexhaustedlab:
02494   yyerror (YY_("memory exhausted"));
02495   yyresult = 2;
02496   /* Fall through.  */
02497 #endif
02498 
02499 yyreturn:
02500   if (yychar != YYEMPTY)
02501     {
02502       /* Make sure we have latest lookahead translation.  See comments at
02503          user semantic actions for why this is necessary.  */
02504       yytoken = YYTRANSLATE (yychar);
02505       yydestruct ("Cleanup: discarding lookahead",
02506                   yytoken, &yylval);
02507     }
02508   /* Do not reclaim the symbols of the rule which action triggered
02509      this YYABORT or YYACCEPT.  */
02510   YYPOPSTACK (yylen);
02511   YY_STACK_PRINT (yyss, yyssp);
02512   while (yyssp != yyss)
02513     {
02514       yydestruct ("Cleanup: popping",
02515                   yystos[*yyssp], yyvsp);
02516       YYPOPSTACK (1);
02517     }
02518 #ifndef yyoverflow
02519   if (yyss != yyssa)
02520     YYSTACK_FREE (yyss);
02521 #endif
02522 #if YYERROR_VERBOSE
02523   if (yymsg != yymsgbuf)
02524     YYSTACK_FREE (yymsg);
02525 #endif
02526   /* Make sure YYID is used.  */
02527   return YYID (yyresult);
02528 }
02529 
02530 
02531 
02532 /* Line 2067 of yacc.c  */
02533 #line 677 "../../src/gdb/go-exp.y"
02534 
02535 
02536 /* Wrapper on parse_c_float to get the type right for Go.  */
02537 
02538 static int
02539 parse_go_float (struct gdbarch *gdbarch, const char *p, int len,
02540                 DOUBLEST *d, struct type **t)
02541 {
02542   int result = parse_c_float (gdbarch, p, len, d, t);
02543   const struct builtin_type *builtin_types = builtin_type (gdbarch);
02544   const struct builtin_go_type *builtin_go_types = builtin_go_type (gdbarch);
02545 
02546   if (*t == builtin_types->builtin_float)
02547     *t = builtin_go_types->builtin_float32;
02548   else if (*t == builtin_types->builtin_double)
02549     *t = builtin_go_types->builtin_float64;
02550 
02551   return result;
02552 }
02553 
02554 /* Take care of parsing a number (anything that starts with a digit).
02555    Set yylval and return the token type; update lexptr.
02556    LEN is the number of characters in it.  */
02557 
02558 /* FIXME: Needs some error checking for the float case.  */
02559 /* FIXME(dje): IWBN to use c-exp.y's parse_number if we could.
02560    That will require moving the guts into a function that we both call
02561    as our YYSTYPE is different than c-exp.y's  */
02562 
02563 static int
02564 parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
02565 {
02566   /* FIXME: Shouldn't these be unsigned?  We don't deal with negative values
02567      here, and we do kind of silly things like cast to unsigned.  */
02568   LONGEST n = 0;
02569   LONGEST prevn = 0;
02570   ULONGEST un;
02571 
02572   int i = 0;
02573   int c;
02574   int base = input_radix;
02575   int unsigned_p = 0;
02576 
02577   /* Number of "L" suffixes encountered.  */
02578   int long_p = 0;
02579 
02580   /* We have found a "L" or "U" suffix.  */
02581   int found_suffix = 0;
02582 
02583   ULONGEST high_bit;
02584   struct type *signed_type;
02585   struct type *unsigned_type;
02586 
02587   if (parsed_float)
02588     {
02589       if (! parse_go_float (parse_gdbarch, p, len,
02590                             &putithere->typed_val_float.dval,
02591                             &putithere->typed_val_float.type))
02592         return ERROR;
02593       return FLOAT;
02594     }
02595 
02596   /* Handle base-switching prefixes 0x, 0t, 0d, 0.  */
02597   if (p[0] == '0')
02598     switch (p[1])
02599       {
02600       case 'x':
02601       case 'X':
02602         if (len >= 3)
02603           {
02604             p += 2;
02605             base = 16;
02606             len -= 2;
02607           }
02608         break;
02609 
02610       case 'b':
02611       case 'B':
02612         if (len >= 3)
02613           {
02614             p += 2;
02615             base = 2;
02616             len -= 2;
02617           }
02618         break;
02619 
02620       case 't':
02621       case 'T':
02622       case 'd':
02623       case 'D':
02624         if (len >= 3)
02625           {
02626             p += 2;
02627             base = 10;
02628             len -= 2;
02629           }
02630         break;
02631 
02632       default:
02633         base = 8;
02634         break;
02635       }
02636 
02637   while (len-- > 0)
02638     {
02639       c = *p++;
02640       if (c >= 'A' && c <= 'Z')
02641         c += 'a' - 'A';
02642       if (c != 'l' && c != 'u')
02643         n *= base;
02644       if (c >= '0' && c <= '9')
02645         {
02646           if (found_suffix)
02647             return ERROR;
02648           n += i = c - '0';
02649         }
02650       else
02651         {
02652           if (base > 10 && c >= 'a' && c <= 'f')
02653             {
02654               if (found_suffix)
02655                 return ERROR;
02656               n += i = c - 'a' + 10;
02657             }
02658           else if (c == 'l')
02659             {
02660               ++long_p;
02661               found_suffix = 1;
02662             }
02663           else if (c == 'u')
02664             {
02665               unsigned_p = 1;
02666               found_suffix = 1;
02667             }
02668           else
02669             return ERROR;       /* Char not a digit */
02670         }
02671       if (i >= base)
02672         return ERROR;           /* Invalid digit in this base.  */
02673 
02674       /* Portably test for overflow (only works for nonzero values, so make
02675          a second check for zero).  FIXME: Can't we just make n and prevn
02676          unsigned and avoid this?  */
02677       if (c != 'l' && c != 'u' && (prevn >= n) && n != 0)
02678         unsigned_p = 1;         /* Try something unsigned.  */
02679 
02680       /* Portably test for unsigned overflow.
02681          FIXME: This check is wrong; for example it doesn't find overflow
02682          on 0x123456789 when LONGEST is 32 bits.  */
02683       if (c != 'l' && c != 'u' && n != 0)
02684         {
02685           if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n))
02686             error (_("Numeric constant too large."));
02687         }
02688       prevn = n;
02689     }
02690 
02691   /* An integer constant is an int, a long, or a long long.  An L
02692      suffix forces it to be long; an LL suffix forces it to be long
02693      long.  If not forced to a larger size, it gets the first type of
02694      the above that it fits in.  To figure out whether it fits, we
02695      shift it right and see whether anything remains.  Note that we
02696      can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
02697      operation, because many compilers will warn about such a shift
02698      (which always produces a zero result).  Sometimes gdbarch_int_bit
02699      or gdbarch_long_bit will be that big, sometimes not.  To deal with
02700      the case where it is we just always shift the value more than
02701      once, with fewer bits each time.  */
02702 
02703   un = (ULONGEST)n >> 2;
02704   if (long_p == 0
02705       && (un >> (gdbarch_int_bit (parse_gdbarch) - 2)) == 0)
02706     {
02707       high_bit = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1);
02708 
02709       /* A large decimal (not hex or octal) constant (between INT_MAX
02710          and UINT_MAX) is a long or unsigned long, according to ANSI,
02711          never an unsigned int, but this code treats it as unsigned
02712          int.  This probably should be fixed.  GCC gives a warning on
02713          such constants.  */
02714 
02715       unsigned_type = parse_type->builtin_unsigned_int;
02716       signed_type = parse_type->builtin_int;
02717     }
02718   else if (long_p <= 1
02719            && (un >> (gdbarch_long_bit (parse_gdbarch) - 2)) == 0)
02720     {
02721       high_bit = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1);
02722       unsigned_type = parse_type->builtin_unsigned_long;
02723       signed_type = parse_type->builtin_long;
02724     }
02725   else
02726     {
02727       int shift;
02728       if (sizeof (ULONGEST) * HOST_CHAR_BIT
02729           < gdbarch_long_long_bit (parse_gdbarch))
02730         /* A long long does not fit in a LONGEST.  */
02731         shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
02732       else
02733         shift = (gdbarch_long_long_bit (parse_gdbarch) - 1);
02734       high_bit = (ULONGEST) 1 << shift;
02735       unsigned_type = parse_type->builtin_unsigned_long_long;
02736       signed_type = parse_type->builtin_long_long;
02737     }
02738 
02739    putithere->typed_val_int.val = n;
02740 
02741    /* If the high bit of the worked out type is set then this number
02742       has to be unsigned.  */
02743 
02744    if (unsigned_p || (n & high_bit))
02745      {
02746        putithere->typed_val_int.type = unsigned_type;
02747      }
02748    else
02749      {
02750        putithere->typed_val_int.type = signed_type;
02751      }
02752 
02753    return INT;
02754 }
02755 
02756 /* Temporary obstack used for holding strings.  */
02757 static struct obstack tempbuf;
02758 static int tempbuf_init;
02759 
02760 /* Parse a string or character literal from TOKPTR.  The string or
02761    character may be wide or unicode.  *OUTPTR is set to just after the
02762    end of the literal in the input string.  The resulting token is
02763    stored in VALUE.  This returns a token value, either STRING or
02764    CHAR, depending on what was parsed.  *HOST_CHARS is set to the
02765    number of host characters in the literal.  */
02766 
02767 static int
02768 parse_string_or_char (const char *tokptr, const char **outptr,
02769                       struct typed_stoken *value, int *host_chars)
02770 {
02771   int quote;
02772 
02773   /* Build the gdb internal form of the input string in tempbuf.  Note
02774      that the buffer is null byte terminated *only* for the
02775      convenience of debugging gdb itself and printing the buffer
02776      contents when the buffer contains no embedded nulls.  Gdb does
02777      not depend upon the buffer being null byte terminated, it uses
02778      the length string instead.  This allows gdb to handle C strings
02779      (as well as strings in other languages) with embedded null
02780      bytes */
02781 
02782   if (!tempbuf_init)
02783     tempbuf_init = 1;
02784   else
02785     obstack_free (&tempbuf, NULL);
02786   obstack_init (&tempbuf);
02787 
02788   /* Skip the quote.  */
02789   quote = *tokptr;
02790   ++tokptr;
02791 
02792   *host_chars = 0;
02793 
02794   while (*tokptr)
02795     {
02796       char c = *tokptr;
02797       if (c == '\\')
02798         {
02799           ++tokptr;
02800           *host_chars += c_parse_escape (&tokptr, &tempbuf);
02801         }
02802       else if (c == quote)
02803         break;
02804       else
02805         {
02806           obstack_1grow (&tempbuf, c);
02807           ++tokptr;
02808           /* FIXME: this does the wrong thing with multi-byte host
02809              characters.  We could use mbrlen here, but that would
02810              make "set host-charset" a bit less useful.  */
02811           ++*host_chars;
02812         }
02813     }
02814 
02815   if (*tokptr != quote)
02816     {
02817       if (quote == '"')
02818         error (_("Unterminated string in expression."));
02819       else
02820         error (_("Unmatched single quote."));
02821     }
02822   ++tokptr;
02823 
02824   value->type = C_STRING | (quote == '\'' ? C_CHAR : 0); /*FIXME*/
02825   value->ptr = obstack_base (&tempbuf);
02826   value->length = obstack_object_size (&tempbuf);
02827 
02828   *outptr = tokptr;
02829 
02830   return quote == '\'' ? CHAR : STRING;
02831 }
02832 
02833 struct token
02834 {
02835   char *operator;
02836   int token;
02837   enum exp_opcode opcode;
02838 };
02839 
02840 static const struct token tokentab3[] =
02841   {
02842     {">>=", ASSIGN_MODIFY, BINOP_RSH},
02843     {"<<=", ASSIGN_MODIFY, BINOP_LSH},
02844     /*{"&^=", ASSIGN_MODIFY, BINOP_BITWISE_ANDNOT}, TODO */
02845     {"...", DOTDOTDOT, OP_NULL},
02846   };
02847 
02848 static const struct token tokentab2[] =
02849   {
02850     {"+=", ASSIGN_MODIFY, BINOP_ADD},
02851     {"-=", ASSIGN_MODIFY, BINOP_SUB},
02852     {"*=", ASSIGN_MODIFY, BINOP_MUL},
02853     {"/=", ASSIGN_MODIFY, BINOP_DIV},
02854     {"%=", ASSIGN_MODIFY, BINOP_REM},
02855     {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
02856     {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
02857     {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
02858     {"++", INCREMENT, BINOP_END},
02859     {"--", DECREMENT, BINOP_END},
02860     /*{"->", RIGHT_ARROW, BINOP_END}, Doesn't exist in Go.  */
02861     {"<-", LEFT_ARROW, BINOP_END},
02862     {"&&", ANDAND, BINOP_END},
02863     {"||", OROR, BINOP_END},
02864     {"<<", LSH, BINOP_END},
02865     {">>", RSH, BINOP_END},
02866     {"==", EQUAL, BINOP_END},
02867     {"!=", NOTEQUAL, BINOP_END},
02868     {"<=", LEQ, BINOP_END},
02869     {">=", GEQ, BINOP_END},
02870     /*{"&^", ANDNOT, BINOP_END}, TODO */
02871   };
02872 
02873 /* Identifier-like tokens.  */
02874 static const struct token ident_tokens[] =
02875   {
02876     {"true", TRUE_KEYWORD, OP_NULL},
02877     {"false", FALSE_KEYWORD, OP_NULL},
02878     {"nil", NIL_KEYWORD, OP_NULL},
02879     {"const", CONST_KEYWORD, OP_NULL},
02880     {"struct", STRUCT_KEYWORD, OP_NULL},
02881     {"type", TYPE_KEYWORD, OP_NULL},
02882     {"interface", INTERFACE_KEYWORD, OP_NULL},
02883     {"chan", CHAN_KEYWORD, OP_NULL},
02884     {"byte", BYTE_KEYWORD, OP_NULL}, /* An alias of uint8.  */
02885     {"len", LEN_KEYWORD, OP_NULL},
02886     {"cap", CAP_KEYWORD, OP_NULL},
02887     {"new", NEW_KEYWORD, OP_NULL},
02888     {"iota", IOTA_KEYWORD, OP_NULL},
02889   };
02890 
02891 /* This is set if a NAME token appeared at the very end of the input
02892    string, with no whitespace separating the name from the EOF.  This
02893    is used only when parsing to do field name completion.  */
02894 static int saw_name_at_eof;
02895 
02896 /* This is set if the previously-returned token was a structure
02897    operator -- either '.' or ARROW.  This is used only when parsing to
02898    do field name completion.  */
02899 static int last_was_structop;
02900 
02901 /* Read one token, getting characters through lexptr.  */
02902 
02903 static int
02904 lex_one_token (void)
02905 {
02906   int c;
02907   int namelen;
02908   unsigned int i;
02909   const char *tokstart;
02910   int saw_structop = last_was_structop;
02911   char *copy;
02912 
02913   last_was_structop = 0;
02914 
02915  retry:
02916 
02917   prev_lexptr = lexptr;
02918 
02919   tokstart = lexptr;
02920   /* See if it is a special token of length 3.  */
02921   for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
02922     if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
02923       {
02924         lexptr += 3;
02925         yylval.opcode = tokentab3[i].opcode;
02926         return tokentab3[i].token;
02927       }
02928 
02929   /* See if it is a special token of length 2.  */
02930   for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
02931     if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
02932       {
02933         lexptr += 2;
02934         yylval.opcode = tokentab2[i].opcode;
02935         /* NOTE: -> doesn't exist in Go, so we don't need to watch for
02936            setting last_was_structop here.  */
02937         return tokentab2[i].token;
02938       }
02939 
02940   switch (c = *tokstart)
02941     {
02942     case 0:
02943       if (saw_name_at_eof)
02944         {
02945           saw_name_at_eof = 0;
02946           return COMPLETE;
02947         }
02948       else if (saw_structop)
02949         return COMPLETE;
02950       else
02951         return 0;
02952 
02953     case ' ':
02954     case '\t':
02955     case '\n':
02956       lexptr++;
02957       goto retry;
02958 
02959     case '[':
02960     case '(':
02961       paren_depth++;
02962       lexptr++;
02963       return c;
02964 
02965     case ']':
02966     case ')':
02967       if (paren_depth == 0)
02968         return 0;
02969       paren_depth--;
02970       lexptr++;
02971       return c;
02972 
02973     case ',':
02974       if (comma_terminates
02975           && paren_depth == 0)
02976         return 0;
02977       lexptr++;
02978       return c;
02979 
02980     case '.':
02981       /* Might be a floating point number.  */
02982       if (lexptr[1] < '0' || lexptr[1] > '9')
02983         {
02984           if (parse_completion)
02985             last_was_structop = 1;
02986           goto symbol;          /* Nope, must be a symbol. */
02987         }
02988       /* FALL THRU into number case.  */
02989 
02990     case '0':
02991     case '1':
02992     case '2':
02993     case '3':
02994     case '4':
02995     case '5':
02996     case '6':
02997     case '7':
02998     case '8':
02999     case '9':
03000       {
03001         /* It's a number.  */
03002         int got_dot = 0, got_e = 0, toktype;
03003         const char *p = tokstart;
03004         int hex = input_radix > 10;
03005 
03006         if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
03007           {
03008             p += 2;
03009             hex = 1;
03010           }
03011 
03012         for (;; ++p)
03013           {
03014             /* This test includes !hex because 'e' is a valid hex digit
03015                and thus does not indicate a floating point number when
03016                the radix is hex.  */
03017             if (!hex && !got_e && (*p == 'e' || *p == 'E'))
03018               got_dot = got_e = 1;
03019             /* This test does not include !hex, because a '.' always indicates
03020                a decimal floating point number regardless of the radix.  */
03021             else if (!got_dot && *p == '.')
03022               got_dot = 1;
03023             else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
03024                      && (*p == '-' || *p == '+'))
03025               /* This is the sign of the exponent, not the end of the
03026                  number.  */
03027               continue;
03028             /* We will take any letters or digits.  parse_number will
03029                complain if past the radix, or if L or U are not final.  */
03030             else if ((*p < '0' || *p > '9')
03031                      && ((*p < 'a' || *p > 'z')
03032                                   && (*p < 'A' || *p > 'Z')))
03033               break;
03034           }
03035         toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
03036         if (toktype == ERROR)
03037           {
03038             char *err_copy = (char *) alloca (p - tokstart + 1);
03039 
03040             memcpy (err_copy, tokstart, p - tokstart);
03041             err_copy[p - tokstart] = 0;
03042             error (_("Invalid number \"%s\"."), err_copy);
03043           }
03044         lexptr = p;
03045         return toktype;
03046       }
03047 
03048     case '@':
03049       {
03050         const char *p = &tokstart[1];
03051         size_t len = strlen ("entry");
03052 
03053         while (isspace (*p))
03054           p++;
03055         if (strncmp (p, "entry", len) == 0 && !isalnum (p[len])
03056             && p[len] != '_')
03057           {
03058             lexptr = &p[len];
03059             return ENTRY;
03060           }
03061       }
03062       /* FALLTHRU */
03063     case '+':
03064     case '-':
03065     case '*':
03066     case '/':
03067     case '%':
03068     case '|':
03069     case '&':
03070     case '^':
03071     case '~':
03072     case '!':
03073     case '<':
03074     case '>':
03075     case '?':
03076     case ':':
03077     case '=':
03078     case '{':
03079     case '}':
03080     symbol:
03081       lexptr++;
03082       return c;
03083 
03084     case '\'':
03085     case '"':
03086     case '`':
03087       {
03088         int host_len;
03089         int result = parse_string_or_char (tokstart, &lexptr, &yylval.tsval,
03090                                            &host_len);
03091         if (result == CHAR)
03092           {
03093             if (host_len == 0)
03094               error (_("Empty character constant."));
03095             else if (host_len > 2 && c == '\'')
03096               {
03097                 ++tokstart;
03098                 namelen = lexptr - tokstart - 1;
03099                 goto tryname;
03100               }
03101             else if (host_len > 1)
03102               error (_("Invalid character constant."));
03103           }
03104         return result;
03105       }
03106     }
03107 
03108   if (!(c == '_' || c == '$'
03109         || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
03110     /* We must have come across a bad character (e.g. ';').  */
03111     error (_("Invalid character '%c' in expression."), c);
03112 
03113   /* It's a name.  See how long it is.  */
03114   namelen = 0;
03115   for (c = tokstart[namelen];
03116        (c == '_' || c == '$' || (c >= '0' && c <= '9')
03117         || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));)
03118     {
03119       c = tokstart[++namelen];
03120     }
03121 
03122   /* The token "if" terminates the expression and is NOT removed from
03123      the input stream.  It doesn't count if it appears in the
03124      expansion of a macro.  */
03125   if (namelen == 2
03126       && tokstart[0] == 'i'
03127       && tokstart[1] == 'f')
03128     {
03129       return 0;
03130     }
03131 
03132   /* For the same reason (breakpoint conditions), "thread N"
03133      terminates the expression.  "thread" could be an identifier, but
03134      an identifier is never followed by a number without intervening
03135      punctuation.
03136      Handle abbreviations of these, similarly to
03137      breakpoint.c:find_condition_and_thread.
03138      TODO: Watch for "goroutine" here?  */
03139   if (namelen >= 1
03140       && strncmp (tokstart, "thread", namelen) == 0
03141       && (tokstart[namelen] == ' ' || tokstart[namelen] == '\t'))
03142     {
03143       const char *p = tokstart + namelen + 1;
03144 
03145       while (*p == ' ' || *p == '\t')
03146         p++;
03147       if (*p >= '0' && *p <= '9')
03148         return 0;
03149     }
03150 
03151   lexptr += namelen;
03152 
03153   tryname:
03154 
03155   yylval.sval.ptr = tokstart;
03156   yylval.sval.length = namelen;
03157 
03158   /* Catch specific keywords.  */
03159   copy = copy_name (yylval.sval);
03160   for (i = 0; i < sizeof (ident_tokens) / sizeof (ident_tokens[0]); i++)
03161     if (strcmp (copy, ident_tokens[i].operator) == 0)
03162       {
03163         /* It is ok to always set this, even though we don't always
03164            strictly need to.  */
03165         yylval.opcode = ident_tokens[i].opcode;
03166         return ident_tokens[i].token;
03167       }
03168 
03169   if (*tokstart == '$')
03170     return DOLLAR_VARIABLE;
03171 
03172   if (parse_completion && *lexptr == '\0')
03173     saw_name_at_eof = 1;
03174   return NAME;
03175 }
03176 
03177 /* An object of this type is pushed on a FIFO by the "outer" lexer.  */
03178 typedef struct
03179 {
03180   int token;
03181   YYSTYPE value;
03182 } token_and_value;
03183 
03184 DEF_VEC_O (token_and_value);
03185 
03186 /* A FIFO of tokens that have been read but not yet returned to the
03187    parser.  */
03188 static VEC (token_and_value) *token_fifo;
03189 
03190 /* Non-zero if the lexer should return tokens from the FIFO.  */
03191 static int popping;
03192 
03193 /* Temporary storage for yylex; this holds symbol names as they are
03194    built up.  */
03195 static struct obstack name_obstack;
03196 
03197 /* Build "package.name" in name_obstack.
03198    For convenience of the caller, the name is NUL-terminated,
03199    but the NUL is not included in the recorded length.  */
03200 
03201 static struct stoken
03202 build_packaged_name (const char *package, int package_len,
03203                      const char *name, int name_len)
03204 {
03205   struct stoken result;
03206 
03207   obstack_free (&name_obstack, obstack_base (&name_obstack));
03208   obstack_grow (&name_obstack, package, package_len);
03209   obstack_grow_str (&name_obstack, ".");
03210   obstack_grow (&name_obstack, name, name_len);
03211   obstack_grow (&name_obstack, "", 1);
03212   result.ptr = obstack_base (&name_obstack);
03213   result.length = obstack_object_size (&name_obstack) - 1;
03214 
03215   return result;
03216 }
03217 
03218 /* Return non-zero if NAME is a package name.
03219    BLOCK is the scope in which to interpret NAME; this can be NULL
03220    to mean the global scope.  */
03221 
03222 static int
03223 package_name_p (const char *name, const struct block *block)
03224 {
03225   struct symbol *sym;
03226   struct field_of_this_result is_a_field_of_this;
03227 
03228   sym = lookup_symbol (name, block, STRUCT_DOMAIN, &is_a_field_of_this);
03229 
03230   if (sym
03231       && SYMBOL_CLASS (sym) == LOC_TYPEDEF
03232       && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_MODULE)
03233     return 1;
03234 
03235   return 0;
03236 }
03237 
03238 /* Classify a (potential) function in the "unsafe" package.
03239    We fold these into "keywords" to keep things simple, at least until
03240    something more complex is warranted.  */
03241 
03242 static int
03243 classify_unsafe_function (struct stoken function_name)
03244 {
03245   char *copy = copy_name (function_name);
03246 
03247   if (strcmp (copy, "Sizeof") == 0)
03248     {
03249       yylval.sval = function_name;
03250       return SIZEOF_KEYWORD;
03251     }
03252 
03253   error (_("Unknown function in `unsafe' package: %s"), copy);
03254 }
03255 
03256 /* Classify token(s) "name1.name2" where name1 is known to be a package.
03257    The contents of the token are in `yylval'.
03258    Updates yylval and returns the new token type.
03259 
03260    The result is one of NAME, NAME_OR_INT, or TYPENAME.  */
03261 
03262 static int
03263 classify_packaged_name (const struct block *block)
03264 {
03265   char *copy;
03266   struct symbol *sym;
03267   struct field_of_this_result is_a_field_of_this;
03268 
03269   copy = copy_name (yylval.sval);
03270 
03271   sym = lookup_symbol (copy, block, VAR_DOMAIN, &is_a_field_of_this);
03272 
03273   if (sym)
03274     {
03275       yylval.ssym.sym = sym;
03276       yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
03277     }
03278 
03279   return NAME;
03280 }
03281 
03282 /* Classify a NAME token.
03283    The contents of the token are in `yylval'.
03284    Updates yylval and returns the new token type.
03285    BLOCK is the block in which lookups start; this can be NULL
03286    to mean the global scope.
03287 
03288    The result is one of NAME, NAME_OR_INT, or TYPENAME.  */
03289 
03290 static int
03291 classify_name (const struct block *block)
03292 {
03293   struct type *type;
03294   struct symbol *sym;
03295   char *copy;
03296   struct field_of_this_result is_a_field_of_this;
03297 
03298   copy = copy_name (yylval.sval);
03299 
03300   /* Try primitive types first so they win over bad/weird debug info.  */
03301   type = language_lookup_primitive_type_by_name (parse_language,
03302                                                  parse_gdbarch, copy);
03303   if (type != NULL)
03304     {
03305       /* NOTE: We take advantage of the fact that yylval coming in was a
03306          NAME, and that struct ttype is a compatible extension of struct
03307          stoken, so yylval.tsym.stoken is already filled in.  */
03308       yylval.tsym.type = type;
03309       return TYPENAME;
03310     }
03311 
03312   /* TODO: What about other types?  */
03313 
03314   sym = lookup_symbol (copy, block, VAR_DOMAIN, &is_a_field_of_this);
03315 
03316   if (sym)
03317     {
03318       yylval.ssym.sym = sym;
03319       yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
03320       return NAME;
03321     }
03322 
03323   /* If we didn't find a symbol, look again in the current package.
03324      This is to, e.g., make "p global_var" work without having to specify
03325      the package name.  We intentionally only looks for objects in the
03326      current package.  */
03327 
03328   {
03329     char *current_package_name = go_block_package_name (block);
03330 
03331     if (current_package_name != NULL)
03332       {
03333         struct stoken sval =
03334           build_packaged_name (current_package_name,
03335                                strlen (current_package_name),
03336                                copy, strlen (copy));
03337 
03338         xfree (current_package_name);
03339         sym = lookup_symbol (sval.ptr, block, VAR_DOMAIN,
03340                              &is_a_field_of_this);
03341         if (sym)
03342           {
03343             yylval.ssym.stoken = sval;
03344             yylval.ssym.sym = sym;
03345             yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
03346             return NAME;
03347           }
03348       }
03349   }
03350 
03351   /* Input names that aren't symbols but ARE valid hex numbers, when
03352      the input radix permits them, can be names or numbers depending
03353      on the parse.  Note we support radixes > 16 here.  */
03354   if ((copy[0] >= 'a' && copy[0] < 'a' + input_radix - 10)
03355       || (copy[0] >= 'A' && copy[0] < 'A' + input_radix - 10))
03356     {
03357       YYSTYPE newlval;  /* Its value is ignored.  */
03358       int hextype = parse_number (copy, yylval.sval.length, 0, &newlval);
03359       if (hextype == INT)
03360         {
03361           yylval.ssym.sym = NULL;
03362           yylval.ssym.is_a_field_of_this = 0;
03363           return NAME_OR_INT;
03364         }
03365     }
03366 
03367   yylval.ssym.sym = NULL;
03368   yylval.ssym.is_a_field_of_this = 0;
03369   return NAME;
03370 }
03371 
03372 /* This is taken from c-exp.y mostly to get something working.
03373    The basic structure has been kept because we may yet need some of it.  */
03374 
03375 static int
03376 yylex (void)
03377 {
03378   token_and_value current, next;
03379 
03380   if (popping && !VEC_empty (token_and_value, token_fifo))
03381     {
03382       token_and_value tv = *VEC_index (token_and_value, token_fifo, 0);
03383       VEC_ordered_remove (token_and_value, token_fifo, 0);
03384       yylval = tv.value;
03385       /* There's no need to fall through to handle package.name
03386          as that can never happen here.  In theory.  */
03387       return tv.token;
03388     }
03389   popping = 0;
03390 
03391   current.token = lex_one_token ();
03392 
03393   /* TODO: Need a way to force specifying name1 as a package.
03394      .name1.name2 ?  */
03395 
03396   if (current.token != NAME)
03397     return current.token;
03398 
03399   /* See if we have "name1 . name2".  */
03400 
03401   current.value = yylval;
03402   next.token = lex_one_token ();
03403   next.value = yylval;
03404 
03405   if (next.token == '.')
03406     {
03407       token_and_value name2;
03408 
03409       name2.token = lex_one_token ();
03410       name2.value = yylval;
03411 
03412       if (name2.token == NAME)
03413         {
03414           /* Ok, we have "name1 . name2".  */
03415           char *copy;
03416 
03417           copy = copy_name (current.value.sval);
03418 
03419           if (strcmp (copy, "unsafe") == 0)
03420             {
03421               popping = 1;
03422               return classify_unsafe_function (name2.value.sval);
03423             }
03424 
03425           if (package_name_p (copy, expression_context_block))
03426             {
03427               popping = 1;
03428               yylval.sval = build_packaged_name (current.value.sval.ptr,
03429                                                  current.value.sval.length,
03430                                                  name2.value.sval.ptr,
03431                                                  name2.value.sval.length);
03432               return classify_packaged_name (expression_context_block);
03433             }
03434         }
03435 
03436       VEC_safe_push (token_and_value, token_fifo, &next);
03437       VEC_safe_push (token_and_value, token_fifo, &name2);
03438     }
03439   else
03440     {
03441       VEC_safe_push (token_and_value, token_fifo, &next);
03442     }
03443 
03444   /* If we arrive here we don't have a package-qualified name.  */
03445 
03446   popping = 1;
03447   yylval = current.value;
03448   return classify_name (expression_context_block);
03449 }
03450 
03451 int
03452 go_parse (void)
03453 {
03454   int result;
03455   struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
03456 
03457   make_cleanup_restore_integer (&yydebug);
03458   yydebug = parser_debug;
03459 
03460   /* Initialize some state used by the lexer.  */
03461   last_was_structop = 0;
03462   saw_name_at_eof = 0;
03463 
03464   VEC_free (token_and_value, token_fifo);
03465   popping = 0;
03466   obstack_init (&name_obstack);
03467   make_cleanup_obstack_free (&name_obstack);
03468 
03469   result = yyparse ();
03470   do_cleanups (back_to);
03471   return result;
03472 }
03473 
03474 void
03475 yyerror (char *msg)
03476 {
03477   if (prev_lexptr)
03478     lexptr = prev_lexptr;
03479 
03480   error (_("A %s in expression, near `%s'."), (msg ? msg : "error"), lexptr);
03481 }
03482 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines