diff --git a/gnoemoe/parser/parser.c b/gnoemoe/parser/parser.c deleted file mode 100644 index e715a39..0000000 --- a/gnoemoe/parser/parser.c +++ /dev/null @@ -1,3224 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.0. */ - -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* Written by Richard Stallman by simplifying the original so called - ``semantic'' parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - tINTEGER = 258, - tOBJECT = 259, - tFLOAT = 260, - tSTRING = 261, - tID = 262, - tERROR = 263, - tIF = 264, - tELSE = 265, - tELSEIF = 266, - tENDIF = 267, - tFOR = 268, - tIN = 269, - tENDFOR = 270, - tRETURN = 271, - tFORK = 272, - tENDFORK = 273, - tWHILE = 274, - tENDWHILE = 275, - tTRY = 276, - tENDTRY = 277, - tEXCEPT = 278, - tFINALLY = 279, - tANY = 280, - tBREAK = 281, - tCONTINUE = 282, - tTO = 283, - tARROW = 284, - tAND = 285, - tOR = 286, - tGE = 287, - tLE = 288, - tNE = 289, - tEQ = 290, - tUNARYMINUS = 291 - }; -#endif -#define tINTEGER 258 -#define tOBJECT 259 -#define tFLOAT 260 -#define tSTRING 261 -#define tID 262 -#define tERROR 263 -#define tIF 264 -#define tELSE 265 -#define tELSEIF 266 -#define tENDIF 267 -#define tFOR 268 -#define tIN 269 -#define tENDFOR 270 -#define tRETURN 271 -#define tFORK 272 -#define tENDFORK 273 -#define tWHILE 274 -#define tENDWHILE 275 -#define tTRY 276 -#define tENDTRY 277 -#define tEXCEPT 278 -#define tFINALLY 279 -#define tANY 280 -#define tBREAK 281 -#define tCONTINUE 282 -#define tTO 283 -#define tARROW 284 -#define tAND 285 -#define tOR 286 -#define tGE 287 -#define tLE 288 -#define tNE 289 -#define tEQ 290 -#define tUNARYMINUS 291 - - - - -/* Copy the first part of user declarations. */ -#line 1 "parser.y" - -/****************************************************************************** - Copyright (c) 1992, 1995, 1996 Xerox Corporation. All rights reserved. - Portions of this code were written by Stephen White, aka ghond. - Use and copying of this software and preparation of derivative works based - upon this software are permitted. Any distribution of this software or - derivative works must comply with all applicable United States export - control laws. This software is made available AS IS, and Xerox Corporation - makes no warranty about the software, its performance or its conformity to - any specification. Any person obtaining a copy of this software is requested - to send their name and post office or electronic mail address to: - Pavel Curtis - Xerox PARC - 3333 Coyote Hill Rd. - Palo Alto, CA 94304 - Pavel@Xerox.Com - *****************************************************************************/ - -/*************************************************************************/ -/* NOTE: If you add an #include here, make sure you properly update the */ -/* parser.o dependency line in the Makefile. */ -/*************************************************************************/ - -#include -#include -#include -#include - -#include "ast.h" -#include "config.h" -#include "functions.h" -#include "keywords.h" -#include "list.h" -//#include "numbers.h" -//#include "opcode.h" -#include "parser.h" -#include "parsen.h" -//#include "program.h" -#include "storage.h" -#include "streams.h" -#include "structures.h" -//#include "sym_table.h" -#include "utils.h" -#include "version.h" - -static Stmt *prog_start; -static int dollars_ok; -static DB_Version language_version; - -static void error(const char *, const char *); -static void warning(const char *, const char *); -static int find_id(char *name); -static void yyerror(const char *s); -static int yylex(void); -static Scatter *scatter_from_arglist(Arg_List *); -static Scatter *add_scatter_item(Scatter *, Scatter *); -static void vet_scatter(Scatter *); -static void push_loop_name(const char *); -static void pop_loop_name(void); -static void suspend_loop_scope(void); -static void resume_loop_scope(void); - -enum loop_exit_kind { LOOP_BREAK, LOOP_CONTINUE }; - -static void check_loop_name(const char *, enum loop_exit_kind); - - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 68 "parser.y" -typedef union YYSTYPE { - Stmt *stmt; - Expr *expr; - int integer; - Objid object; - double *real; - char *string; - enum error error; - Arg_List *args; - Cond_Arm *arm; - Except_Arm *except; - Scatter *scatter; -} YYSTYPE; -/* Line 190 of yacc.c. */ -#line 229 "parser.c" -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif - - - -/* Copy the second part of user declarations. */ - - -/* Line 213 of yacc.c. */ -#line 241 "parser.c" - -#if ! defined (yyoverflow) || YYERROR_VERBOSE - -# ifndef YYFREE -# define YYFREE free -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# endif - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# else -# define YYSTACK_ALLOC alloca -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# endif -#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ - - -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - short int yyss; - YYSTYPE yyvs; - }; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined (__GNUC__) && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - register YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (0) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif - -#if defined (__STDC__) || defined (__cplusplus) - typedef signed char yysigned_char; -#else - typedef short int yysigned_char; -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 3 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 1481 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 63 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 24 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 94 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 216 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 291 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const unsigned char yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 47, 2, 2, 52, 45, 2, 60, - 53, 54, 43, 41, 62, 42, 49, 44, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 50, 56, - 35, 30, 36, 31, 61, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 51, 2, 55, 46, 2, 59, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 57, 32, 58, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 33, 34, 37, 38, 39, - 40, 48 -}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const unsigned short int yyprhs[] = -{ - 0, 0, 3, 5, 6, 9, 18, 19, 29, 30, - 42, 43, 51, 52, 61, 62, 70, 71, 80, 83, - 86, 90, 93, 97, 101, 104, 106, 111, 117, 118, - 125, 126, 129, 132, 133, 138, 144, 145, 147, 149, - 151, 153, 155, 157, 159, 162, 166, 172, 179, 185, - 194, 200, 208, 210, 214, 220, 225, 229, 233, 237, - 241, 245, 249, 253, 257, 261, 265, 269, 273, 277, - 281, 285, 288, 291, 295, 299, 305, 312, 313, 315, - 317, 318, 321, 322, 324, 326, 329, 333, 338, 342, - 346, 350, 355, 357, 360 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yysigned_char yyrhs[] = -{ - 64, 0, -1, 65, -1, -1, 65, 66, -1, 9, - 53, 79, 54, 65, 73, 74, 12, -1, -1, 13, - 7, 14, 53, 79, 54, 67, 65, 15, -1, -1, - 13, 7, 14, 51, 79, 28, 79, 55, 68, 65, - 15, -1, -1, 19, 53, 79, 54, 69, 65, 20, - -1, -1, 19, 7, 53, 79, 54, 70, 65, 20, - -1, -1, 17, 53, 79, 54, 71, 65, 18, -1, - -1, 17, 7, 53, 79, 54, 72, 65, 18, -1, - 79, 56, -1, 26, 56, -1, 26, 7, 56, -1, - 27, 56, -1, 27, 7, 56, -1, 16, 79, 56, - -1, 16, 56, -1, 56, -1, 21, 65, 75, 22, - -1, 21, 65, 24, 65, 22, -1, -1, 73, 11, - 53, 79, 54, 65, -1, -1, 10, 65, -1, 23, - 77, -1, -1, 75, 23, 76, 77, -1, 78, 53, - 81, 54, 65, -1, -1, 7, -1, 3, -1, 5, - -1, 6, -1, 4, -1, 8, -1, 7, -1, 52, - 7, -1, 79, 49, 7, -1, 79, 49, 53, 79, - 54, -1, 79, 50, 7, 53, 83, 54, -1, 52, - 7, 53, 83, 54, -1, 79, 50, 53, 79, 54, - 53, 83, 54, -1, 79, 51, 80, 79, 55, -1, - 79, 51, 80, 79, 28, 79, 55, -1, 52, -1, - 79, 30, 79, -1, 57, 85, 58, 30, 79, -1, - 7, 53, 83, 54, -1, 79, 41, 79, -1, 79, - 42, 79, -1, 79, 43, 79, -1, 79, 44, 79, - -1, 79, 45, 79, -1, 79, 46, 79, -1, 79, - 33, 79, -1, 79, 34, 79, -1, 79, 40, 79, - -1, 79, 39, 79, -1, 79, 35, 79, -1, 79, - 38, 79, -1, 79, 36, 79, -1, 79, 37, 79, - -1, 79, 14, 79, -1, 42, 79, -1, 47, 79, - -1, 53, 79, 54, -1, 57, 83, 58, -1, 79, - 31, 79, 32, 79, -1, 59, 79, 47, 81, 82, - 60, -1, -1, 25, -1, 84, -1, -1, 29, 79, - -1, -1, 84, -1, 79, -1, 61, 79, -1, 84, - 62, 79, -1, 84, 62, 61, 79, -1, 84, 62, - 86, -1, 85, 62, 86, -1, 85, 62, 7, -1, - 85, 62, 61, 7, -1, 86, -1, 31, 7, -1, - 31, 7, 30, 79, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short int yyrline[] = -{ - 0, 112, 112, 118, 119, 134, 143, 142, 155, 154, - 168, 167, 180, 179, 192, 191, 204, 203, 215, 220, - 226, 232, 238, 244, 249, 254, 256, 262, 272, 273, - 291, 292, 297, 300, 299, 325, 331, 332, 337, 342, - 347, 352, 357, 362, 367, 376, 383, 387, 394, 403, - 407, 412, 420, 426, 448, 456, 477, 481, 485, 489, - 493, 497, 501, 505, 509, 513, 517, 521, 525, 529, - 533, 537, 558, 563, 565, 570, 577, 588, 591, 593, - 598, 599, 604, 605, 610, 612, 614, 628, 645, 654, - 658, 663, 668, 673, 677 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE -/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "tINTEGER", "tOBJECT", "tFLOAT", - "tSTRING", "tID", "tERROR", "tIF", "tELSE", "tELSEIF", "tENDIF", "tFOR", - "tIN", "tENDFOR", "tRETURN", "tFORK", "tENDFORK", "tWHILE", "tENDWHILE", - "tTRY", "tENDTRY", "tEXCEPT", "tFINALLY", "tANY", "tBREAK", "tCONTINUE", - "tTO", "tARROW", "'='", "'?'", "'|'", "tAND", "tOR", "'<'", "'>'", "tGE", - "tLE", "tNE", "tEQ", "'+'", "'-'", "'*'", "'/'", "'%'", "'^'", "'!'", - "tUNARYMINUS", "'.'", "':'", "'['", "'$'", "'('", "')'", "']'", "';'", - "'{'", "'}'", "'`'", "'''", "'@'", "','", "$accept", "program", - "statements", "statement", "@1", "@2", "@3", "@4", "@5", "@6", "elseifs", - "elsepart", "excepts", "@7", "except", "opt_id", "expr", "dollars_up", - "codes", "default", "arglist", "ne_arglist", "scatter", "scatter_item", 0 -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const unsigned short int yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 61, 63, 124, 285, 286, 60, 62, 287, 288, 289, - 290, 43, 45, 42, 47, 37, 94, 33, 291, 46, - 58, 91, 36, 40, 41, 93, 59, 123, 125, 96, - 39, 64, 44 -}; -# endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const unsigned char yyr1[] = -{ - 0, 63, 64, 65, 65, 66, 67, 66, 68, 66, - 69, 66, 70, 66, 71, 66, 72, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, 73, 73, - 74, 74, 75, 76, 75, 77, 78, 78, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 80, 81, 81, - 82, 82, 83, 83, 84, 84, 84, 84, 85, 85, - 85, 85, 85, 86, 86 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const unsigned char yyr2[] = -{ - 0, 2, 1, 0, 2, 8, 0, 9, 0, 11, - 0, 7, 0, 8, 0, 7, 0, 8, 2, 2, - 3, 2, 3, 3, 2, 1, 4, 5, 0, 6, - 0, 2, 2, 0, 4, 5, 0, 1, 1, 1, - 1, 1, 1, 1, 2, 3, 5, 6, 5, 8, - 5, 7, 1, 3, 5, 4, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 2, 2, 3, 3, 5, 6, 0, 1, 1, - 0, 2, 0, 1, 1, 2, 3, 4, 3, 3, - 3, 4, 1, 2, 4 -}; - -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const unsigned char yydefact[] = -{ - 3, 0, 2, 1, 38, 41, 39, 40, 43, 42, - 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, - 52, 0, 25, 82, 0, 4, 0, 82, 0, 0, - 24, 0, 0, 0, 0, 0, 0, 0, 19, 0, - 21, 71, 72, 44, 0, 0, 0, 84, 0, 83, - 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 77, 18, 0, 83, 0, 0, 23, 0, - 0, 0, 0, 36, 3, 0, 20, 22, 82, 73, - 93, 85, 74, 0, 0, 0, 0, 70, 53, 0, - 62, 63, 66, 68, 69, 67, 65, 64, 56, 57, - 58, 59, 60, 61, 45, 0, 0, 0, 0, 55, - 0, 3, 0, 0, 0, 14, 0, 10, 37, 32, - 0, 0, 26, 33, 0, 0, 0, 86, 88, 0, - 90, 0, 89, 78, 80, 79, 0, 0, 82, 0, - 0, 28, 0, 0, 16, 3, 12, 3, 0, 27, - 36, 48, 94, 87, 54, 91, 0, 0, 75, 46, - 0, 0, 0, 50, 30, 0, 6, 3, 0, 3, - 0, 0, 34, 81, 76, 47, 82, 0, 3, 0, - 0, 0, 3, 0, 15, 0, 11, 3, 0, 51, - 31, 0, 5, 8, 0, 17, 13, 35, 49, 0, - 3, 7, 3, 0, 29, 9 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const short int yydefgoto[] = -{ - -1, 1, 2, 25, 192, 210, 157, 179, 155, 177, - 174, 190, 85, 160, 129, 130, 26, 118, 144, 167, - 48, 75, 50, 51 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -53 -static const short int yypact[] = -{ - -53, 1, 754, -53, -53, -53, -53, -53, -35, -53, - -26, 28, 331, 12, 17, -53, 8, 15, 445, 445, - 37, 445, -53, 149, 445, -53, 784, 26, 445, 52, - -53, 817, 22, 445, 24, 445, 298, 32, -53, 47, - -53, -9, -9, 27, 949, 97, 445, 1379, 51, 43, - -52, -53, 1279, 445, 445, 445, 445, 445, 445, 445, - 445, 445, 445, 445, 445, 445, 445, 445, 445, 445, - 29, 31, -53, -53, 53, 50, 982, -28, -53, 445, - 1015, 445, 1048, 107, -53, 74, -53, -53, 26, -53, - 87, 1379, -53, 180, 92, 6, 209, 49, 1379, 1313, - 1430, 1430, 49, 49, 49, 49, 49, 49, 75, 75, - -42, -42, -42, -42, -53, 445, 77, 445, 445, -53, - 239, -53, 445, 445, 1081, -53, 1114, -53, -53, -53, - 78, 355, -53, -53, 73, 445, 445, 1379, -53, 445, - -53, 126, -53, -53, 105, 50, 445, 1147, 26, 1180, - 850, 754, 1346, 1213, -53, -53, -53, -53, 209, -53, - 107, -53, 1379, 1379, 1379, -53, 445, 76, 1412, -53, - 81, 84, 445, -53, 91, 445, -53, -53, 412, -53, - 469, 89, -53, 1379, -53, -53, 26, 883, -53, 93, - 132, 916, -53, 526, -53, 583, -53, -53, 94, -53, - 754, 445, -53, -53, 640, -53, -53, 754, -53, 1246, - -53, -53, -53, 697, 754, -53 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yysigned_char yypgoto[] = -{ - -53, -53, -15, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -13, -53, -7, -53, -8, -53, - -25, -20, -53, -50 -}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 -static const short int yytable[] = -{ - 36, 3, 74, 49, 69, 31, 94, 70, 71, 72, - 95, 41, 42, 140, 44, 37, 47, 52, 27, 32, - 47, 76, 39, 122, 34, 123, 80, 28, 82, 4, - 5, 6, 7, 8, 9, 29, 114, 45, 116, 91, - 70, 71, 72, 138, 43, 142, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 134, 38, 33, 77, 141, 18, 131, - 35, 40, 124, 19, 126, 79, 145, 81, 20, 21, - 88, 47, 115, 23, 117, 24, 137, 46, 86, 47, - 64, 65, 66, 67, 68, 69, 132, 133, 70, 71, - 72, 188, 189, 87, 90, 93, 151, 119, 147, 92, - 149, 150, 120, 137, 128, 152, 153, 135, 66, 67, - 68, 69, 139, 170, 70, 71, 72, 161, 162, 163, - 148, 158, 164, 165, 166, 185, 184, 186, 145, 168, - 178, 47, 180, 197, 202, 0, 201, 182, 208, 0, - 181, 47, 4, 5, 6, 7, 8, 9, 0, 183, - 0, 198, 193, 0, 195, 187, 0, 0, 191, 0, - 0, 0, 0, 200, 0, 0, 0, 204, 0, 47, - 45, 0, 207, 4, 5, 6, 7, 8, 9, 0, - 0, 18, 0, 0, 209, 213, 19, 214, 0, 0, - 0, 20, 21, 0, 0, 0, 23, 0, 24, 0, - 46, 45, 4, 5, 6, 7, 8, 9, 0, 0, - 0, 0, 18, 0, 0, 0, 0, 19, 0, 0, - 0, 0, 20, 21, 143, 0, 0, 23, 0, 24, - 0, 136, 4, 5, 6, 7, 8, 9, 0, 0, - 0, 18, 0, 0, 0, 0, 19, 0, 0, 0, - 0, 20, 21, 0, 0, 0, 23, 0, 24, 0, - 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 18, 0, 0, 0, 0, 19, 0, 0, 0, - 0, 20, 21, 0, 0, 0, 23, 0, 24, 0, - 136, 4, 5, 6, 7, 8, 9, 10, 0, 0, - 0, 11, 0, 0, 12, 13, 0, 14, 0, 15, - 0, 83, 84, 0, 16, 17, 0, 0, 0, 0, - 0, 0, 0, 0, 4, 5, 6, 7, 8, 9, - 18, 0, 0, 0, 0, 19, 0, 0, 0, 0, - 20, 21, 0, 0, 22, 23, 0, 24, 4, 5, - 6, 7, 8, 9, 10, 0, 0, 0, 11, 0, - 0, 12, 13, 18, 14, 0, 15, 159, 19, 0, - 0, 16, 17, 20, 21, 0, 0, 30, 23, 0, - 24, 0, 0, 0, 0, 0, 0, 18, 0, 0, - 0, 0, 19, 0, 0, 0, 0, 20, 21, 0, - 0, 22, 23, 0, 24, 4, 5, 6, 7, 8, - 9, 10, 0, 0, 0, 11, 0, 0, 12, 13, - 194, 14, 0, 15, 0, 0, 0, 0, 16, 17, - 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, - 6, 7, 8, 9, 18, 0, 0, 0, 0, 19, - 0, 0, 0, 0, 20, 21, 0, 0, 22, 23, - 0, 24, 4, 5, 6, 7, 8, 9, 10, 0, - 0, 0, 11, 0, 0, 12, 13, 18, 14, 196, - 15, 0, 19, 0, 0, 16, 17, 20, 21, 0, - 0, 0, 23, 0, 24, 0, 0, 0, 0, 0, - 0, 18, 0, 0, 0, 0, 19, 0, 0, 0, - 0, 20, 21, 0, 0, 22, 23, 0, 24, 4, - 5, 6, 7, 8, 9, 10, 0, 0, 0, 11, - 0, 0, 12, 13, 205, 14, 0, 15, 0, 0, - 0, 0, 16, 17, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, - 0, 0, 0, 19, 0, 0, 0, 0, 20, 21, - 0, 0, 22, 23, 0, 24, 4, 5, 6, 7, - 8, 9, 10, 0, 0, 0, 11, 0, 0, 12, - 13, 0, 14, 206, 15, 0, 0, 0, 0, 16, - 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, - 19, 0, 0, 0, 0, 20, 21, 0, 0, 22, - 23, 0, 24, 4, 5, 6, 7, 8, 9, 10, - 0, 0, 0, 11, 0, 211, 12, 13, 0, 14, - 0, 15, 0, 0, 0, 0, 16, 17, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 18, 0, 0, 0, 0, 19, 0, 0, - 0, 0, 20, 21, 0, 0, 22, 23, 0, 24, - 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, - 11, 0, 215, 12, 13, 0, 14, 0, 15, 0, - 0, 0, 0, 16, 17, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, - 0, 0, 0, 0, 19, 0, 0, 0, 0, 20, - 21, 0, 0, 22, 23, 0, 24, 4, 5, 6, - 7, 8, 9, 10, 0, 0, 0, 11, 0, 0, - 12, 13, 0, 14, 0, 15, 0, 0, 0, 0, - 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 53, 0, - 0, 19, 0, 0, 0, 0, 20, 21, 0, 0, - 22, 23, 0, 24, 54, 55, 0, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 53, 0, 70, 71, 72, 0, 0, 0, 0, - 73, 0, 0, 0, 0, 0, 0, 54, 55, 0, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 53, 0, 70, 71, 72, 0, - 0, 0, 0, 78, 0, 0, 0, 0, 172, 0, - 54, 55, 0, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 53, 0, 70, - 71, 72, 0, 0, 0, 173, 0, 0, 0, 0, - 0, 0, 0, 54, 55, 0, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 53, 0, 70, 71, 72, 0, 0, 0, 199, 0, - 0, 0, 0, 0, 0, 0, 54, 55, 0, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 53, 0, 70, 71, 72, 0, 0, - 0, 203, 0, 0, 0, 0, 0, 0, 0, 54, - 55, 0, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 53, 0, 70, 71, - 72, 0, 0, 89, 0, 0, 0, 0, 0, 0, - 0, 0, 54, 55, 0, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 53, - 0, 70, 71, 72, 0, 0, 121, 0, 0, 0, - 0, 0, 0, 0, 0, 54, 55, 0, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 53, 0, 70, 71, 72, 0, 0, 125, - 0, 0, 0, 0, 0, 0, 0, 0, 54, 55, - 0, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 53, 0, 70, 71, 72, - 0, 0, 127, 0, 0, 0, 0, 0, 0, 0, - 0, 54, 55, 0, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 53, 0, - 70, 71, 72, 0, 0, 154, 0, 0, 0, 0, - 0, 0, 0, 0, 54, 55, 0, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 53, 0, 70, 71, 72, 0, 0, 156, 0, - 0, 0, 0, 0, 0, 0, 0, 54, 55, 0, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 53, 0, 70, 71, 72, 0, - 0, 169, 0, 0, 0, 0, 0, 0, 0, 0, - 54, 55, 0, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 53, 0, 70, - 71, 72, 0, 0, 171, 0, 0, 0, 0, 0, - 0, 0, 0, 54, 55, 0, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 53, 0, 70, 71, 72, 0, 0, 176, 0, 0, - 0, 0, 0, 0, 0, 0, 54, 55, 0, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 53, 0, 70, 71, 72, 0, 0, - 212, 0, 0, 0, 0, 0, 0, 0, 0, 54, - 55, 0, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 96, 53, 70, 71, - 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 54, 55, 146, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 53, 0, 70, 71, 72, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 175, 0, 54, 55, 0, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 53, 0, 70, 71, 72, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, - 55, 0, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 53, 0, 70, 71, - 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -1, 53, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, - 0, 70, 71, 72, 0, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 0, 0, 70, - 71, 72 -}; - -static const short int yycheck[] = -{ - 15, 0, 27, 23, 46, 12, 58, 49, 50, 51, - 62, 18, 19, 7, 21, 7, 23, 24, 53, 7, - 27, 28, 7, 51, 7, 53, 33, 53, 35, 3, - 4, 5, 6, 7, 8, 7, 7, 31, 7, 46, - 49, 50, 51, 93, 7, 95, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 88, 56, 53, 14, 61, 42, 84, - 53, 56, 79, 47, 81, 53, 96, 53, 52, 53, - 53, 88, 53, 57, 53, 59, 93, 61, 56, 96, - 41, 42, 43, 44, 45, 46, 22, 23, 49, 50, - 51, 10, 11, 56, 7, 62, 121, 54, 115, 58, - 117, 118, 62, 120, 7, 122, 123, 30, 43, 44, - 45, 46, 30, 148, 49, 50, 51, 54, 135, 136, - 53, 53, 139, 7, 29, 54, 60, 53, 158, 146, - 155, 148, 157, 54, 12, -1, 53, 160, 54, -1, - 158, 158, 3, 4, 5, 6, 7, 8, -1, 166, - -1, 186, 177, -1, 179, 172, -1, -1, 175, -1, - -1, -1, -1, 188, -1, -1, -1, 192, -1, 186, - 31, -1, 197, 3, 4, 5, 6, 7, 8, -1, - -1, 42, -1, -1, 201, 210, 47, 212, -1, -1, - -1, 52, 53, -1, -1, -1, 57, -1, 59, -1, - 61, 31, 3, 4, 5, 6, 7, 8, -1, -1, - -1, -1, 42, -1, -1, -1, -1, 47, -1, -1, - -1, -1, 52, 53, 25, -1, -1, 57, -1, 59, - -1, 61, 3, 4, 5, 6, 7, 8, -1, -1, - -1, 42, -1, -1, -1, -1, 47, -1, -1, -1, - -1, 52, 53, -1, -1, -1, 57, -1, 59, -1, - 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 42, -1, -1, -1, -1, 47, -1, -1, -1, - -1, 52, 53, -1, -1, -1, 57, -1, 59, -1, - 61, 3, 4, 5, 6, 7, 8, 9, -1, -1, - -1, 13, -1, -1, 16, 17, -1, 19, -1, 21, - -1, 23, 24, -1, 26, 27, -1, -1, -1, -1, - -1, -1, -1, -1, 3, 4, 5, 6, 7, 8, - 42, -1, -1, -1, -1, 47, -1, -1, -1, -1, - 52, 53, -1, -1, 56, 57, -1, 59, 3, 4, - 5, 6, 7, 8, 9, -1, -1, -1, 13, -1, - -1, 16, 17, 42, 19, -1, 21, 22, 47, -1, - -1, 26, 27, 52, 53, -1, -1, 56, 57, -1, - 59, -1, -1, -1, -1, -1, -1, 42, -1, -1, - -1, -1, 47, -1, -1, -1, -1, 52, 53, -1, - -1, 56, 57, -1, 59, 3, 4, 5, 6, 7, - 8, 9, -1, -1, -1, 13, -1, -1, 16, 17, - 18, 19, -1, 21, -1, -1, -1, -1, 26, 27, - -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, - 5, 6, 7, 8, 42, -1, -1, -1, -1, 47, - -1, -1, -1, -1, 52, 53, -1, -1, 56, 57, - -1, 59, 3, 4, 5, 6, 7, 8, 9, -1, - -1, -1, 13, -1, -1, 16, 17, 42, 19, 20, - 21, -1, 47, -1, -1, 26, 27, 52, 53, -1, - -1, -1, 57, -1, 59, -1, -1, -1, -1, -1, - -1, 42, -1, -1, -1, -1, 47, -1, -1, -1, - -1, 52, 53, -1, -1, 56, 57, -1, 59, 3, - 4, 5, 6, 7, 8, 9, -1, -1, -1, 13, - -1, -1, 16, 17, 18, 19, -1, 21, -1, -1, - -1, -1, 26, 27, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, - -1, -1, -1, 47, -1, -1, -1, -1, 52, 53, - -1, -1, 56, 57, -1, 59, 3, 4, 5, 6, - 7, 8, 9, -1, -1, -1, 13, -1, -1, 16, - 17, -1, 19, 20, 21, -1, -1, -1, -1, 26, - 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, - 47, -1, -1, -1, -1, 52, 53, -1, -1, 56, - 57, -1, 59, 3, 4, 5, 6, 7, 8, 9, - -1, -1, -1, 13, -1, 15, 16, 17, -1, 19, - -1, 21, -1, -1, -1, -1, 26, 27, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 42, -1, -1, -1, -1, 47, -1, -1, - -1, -1, 52, 53, -1, -1, 56, 57, -1, 59, - 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, - 13, -1, 15, 16, 17, -1, 19, -1, 21, -1, - -1, -1, -1, 26, 27, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, - -1, -1, -1, -1, 47, -1, -1, -1, -1, 52, - 53, -1, -1, 56, 57, -1, 59, 3, 4, 5, - 6, 7, 8, 9, -1, -1, -1, 13, -1, -1, - 16, 17, -1, 19, -1, 21, -1, -1, -1, -1, - 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 42, -1, 14, -1, - -1, 47, -1, -1, -1, -1, 52, 53, -1, -1, - 56, 57, -1, 59, 30, 31, -1, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 14, -1, 49, 50, 51, -1, -1, -1, -1, - 56, -1, -1, -1, -1, -1, -1, 30, 31, -1, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 14, -1, 49, 50, 51, -1, - -1, -1, -1, 56, -1, -1, -1, -1, 28, -1, - 30, 31, -1, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 14, -1, 49, - 50, 51, -1, -1, -1, 55, -1, -1, -1, -1, - -1, -1, -1, 30, 31, -1, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 14, -1, 49, 50, 51, -1, -1, -1, 55, -1, - -1, -1, -1, -1, -1, -1, 30, 31, -1, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 14, -1, 49, 50, 51, -1, -1, - -1, 55, -1, -1, -1, -1, -1, -1, -1, 30, - 31, -1, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 14, -1, 49, 50, - 51, -1, -1, 54, -1, -1, -1, -1, -1, -1, - -1, -1, 30, 31, -1, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 14, - -1, 49, 50, 51, -1, -1, 54, -1, -1, -1, - -1, -1, -1, -1, -1, 30, 31, -1, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 14, -1, 49, 50, 51, -1, -1, 54, - -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, - -1, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 14, -1, 49, 50, 51, - -1, -1, 54, -1, -1, -1, -1, -1, -1, -1, - -1, 30, 31, -1, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 14, -1, - 49, 50, 51, -1, -1, 54, -1, -1, -1, -1, - -1, -1, -1, -1, 30, 31, -1, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 14, -1, 49, 50, 51, -1, -1, 54, -1, - -1, -1, -1, -1, -1, -1, -1, 30, 31, -1, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 14, -1, 49, 50, 51, -1, - -1, 54, -1, -1, -1, -1, -1, -1, -1, -1, - 30, 31, -1, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 14, -1, 49, - 50, 51, -1, -1, 54, -1, -1, -1, -1, -1, - -1, -1, -1, 30, 31, -1, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 14, -1, 49, 50, 51, -1, -1, 54, -1, -1, - -1, -1, -1, -1, -1, -1, 30, 31, -1, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 14, -1, 49, 50, 51, -1, -1, - 54, -1, -1, -1, -1, -1, -1, -1, -1, 30, - 31, -1, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 14, 49, 50, - 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 14, -1, 49, 50, 51, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 28, -1, 30, 31, -1, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 14, -1, 49, 50, 51, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, - 31, -1, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 14, -1, 49, 50, - 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 31, 14, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, -1, - -1, 49, 50, 51, -1, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, -1, -1, 49, - 50, 51 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const unsigned char yystos[] = -{ - 0, 64, 65, 0, 3, 4, 5, 6, 7, 8, - 9, 13, 16, 17, 19, 21, 26, 27, 42, 47, - 52, 53, 56, 57, 59, 66, 79, 53, 53, 7, - 56, 79, 7, 53, 7, 53, 65, 7, 56, 7, - 56, 79, 79, 7, 79, 31, 61, 79, 83, 84, - 85, 86, 79, 14, 30, 31, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 49, 50, 51, 56, 83, 84, 79, 14, 56, 53, - 79, 53, 79, 23, 24, 75, 56, 56, 53, 54, - 7, 79, 58, 62, 58, 62, 47, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 7, 53, 7, 53, 80, 54, - 62, 54, 51, 53, 79, 54, 79, 54, 7, 77, - 78, 65, 22, 23, 83, 30, 61, 79, 86, 30, - 7, 61, 86, 25, 81, 84, 32, 79, 53, 79, - 79, 65, 79, 79, 54, 71, 54, 69, 53, 22, - 76, 54, 79, 79, 79, 7, 29, 82, 79, 54, - 83, 54, 28, 55, 73, 28, 54, 72, 65, 70, - 65, 81, 77, 79, 60, 54, 53, 79, 10, 11, - 74, 79, 67, 65, 18, 65, 20, 54, 83, 55, - 65, 53, 12, 55, 65, 18, 20, 65, 54, 79, - 68, 15, 54, 65, 65, 15 -}; - -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ - -#define YYFAIL goto yyerrlab - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror ("syntax error: cannot back up");\ - YYERROR; \ - } \ -while (0) - - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (N) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (0) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -yy_stack_print (short int *bottom, short int *top) -#else -static void -yy_stack_print (bottom, top) - short int *bottom; - short int *top; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (/* Nothing. */; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -yy_reduce_print (int yyrule) -#else -static void -yy_reduce_print (yyrule) - int yyrule; -#endif -{ - int yyi; - unsigned int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", - yyrule - 1, yylno); - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (Rule); \ -} while (0) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) -yystrlen (const char *yystr) -# else -yystrlen (yystr) - const char *yystr; -# endif -{ - register const char *yys = yystr; - - while (*yys++ != '\0') - continue; - - return yys - yystr - 1; -} -# endif -# endif - -# ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -# if defined (__STDC__) || defined (__cplusplus) -yystpcpy (char *yydest, const char *yysrc) -# else -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -# endif -{ - register char *yyd = yydest; - register const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -#endif /* !YYERROR_VERBOSE */ - - - -#if YYDEBUG -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) -#else -static void -yysymprint (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; - - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - switch (yytype) - { - default: - break; - } - YYFPRINTF (yyoutput, ")"); -} - -#endif /* ! YYDEBUG */ -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} - - -/* Prevent warnings from -Wmissing-prototypes. */ - -#ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM); -# else -int yyparse (); -# endif -#else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - - - -/* The look-ahead symbol. */ -int yychar; - -/* The semantic value of the look-ahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; - - - -/*----------. -| yyparse. | -`----------*/ - -#ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM) -# else -int yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -# endif -#else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) -int -yyparse (void) -#else -int -yyparse () - -#endif -#endif -{ - - register int yystate; - register int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - short int yyssa[YYINITDEPTH]; - short int *yyss = yyssa; - register short int *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - register YYSTYPE *yyvsp; - - - -#define YYPOPSTACK (yyvsp--, yyssp--) - - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - - - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ - int yylen; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss; - yyvsp = yyvs; - - - yyvsp[0] = yylval; - - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - short int *yyss1 = yyss; - - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyoverflowlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyoverflowlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - short int *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyoverflowlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - -/* Do appropriate processing given the current state. */ -/* Read a look-ahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to look-ahead token. */ - - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) - goto yydefault; - - /* Not known => get a look-ahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; - - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - yystate = yyn; - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: -#line 113 "parser.y" - { prog_start = (yyvsp[0].stmt); } - break; - - case 3: -#line 118 "parser.y" - { (yyval.stmt) = 0; } - break; - - case 4: -#line 120 "parser.y" - { - if ((yyvsp[-1].stmt)) { - Stmt *tmp = (yyvsp[-1].stmt); - - while (tmp->next) - tmp = tmp->next; - tmp->next = (yyvsp[0].stmt); - (yyval.stmt) = (yyvsp[-1].stmt); - } else - (yyval.stmt) = (yyvsp[0].stmt); - } - break; - - case 5: -#line 135 "parser.y" - { - - (yyval.stmt) = alloc_stmt(STMT_COND); - (yyval.stmt)->s.cond.arms = alloc_cond_arm((yyvsp[-5].expr), (yyvsp[-3].stmt)); - (yyval.stmt)->s.cond.arms->next = (yyvsp[-2].arm); - (yyval.stmt)->s.cond.otherwise = (yyvsp[-1].stmt); - } - break; - - case 6: -#line 143 "parser.y" - { - push_loop_name((yyvsp[-4].string)); - } - break; - - case 7: -#line 147 "parser.y" - { - (yyval.stmt) = alloc_stmt(STMT_LIST); - (yyval.stmt)->s.list.id = find_id((yyvsp[-7].string)); - (yyval.stmt)->s.list.expr = (yyvsp[-4].expr); - (yyval.stmt)->s.list.body = (yyvsp[-1].stmt); - pop_loop_name(); - } - break; - - case 8: -#line 155 "parser.y" - { - push_loop_name((yyvsp[-6].string)); - } - break; - - case 9: -#line 159 "parser.y" - { - (yyval.stmt) = alloc_stmt(STMT_RANGE); - (yyval.stmt)->s.range.id = find_id((yyvsp[-9].string)); - (yyval.stmt)->s.range.from = (yyvsp[-6].expr); - (yyval.stmt)->s.range.to = (yyvsp[-4].expr); - (yyval.stmt)->s.range.body = (yyvsp[-1].stmt); - pop_loop_name(); - } - break; - - case 10: -#line 168 "parser.y" - { - push_loop_name(0); - } - break; - - case 11: -#line 172 "parser.y" - { - (yyval.stmt) = alloc_stmt(STMT_WHILE); - (yyval.stmt)->s.loop.id = -1; - (yyval.stmt)->s.loop.condition = (yyvsp[-4].expr); - (yyval.stmt)->s.loop.body = (yyvsp[-1].stmt); - pop_loop_name(); - } - break; - - case 12: -#line 180 "parser.y" - { - push_loop_name((yyvsp[-3].string)); - } - break; - - case 13: -#line 184 "parser.y" - { - (yyval.stmt) = alloc_stmt(STMT_WHILE); - (yyval.stmt)->s.loop.id = find_id((yyvsp[-6].string)); - (yyval.stmt)->s.loop.condition = (yyvsp[-4].expr); - (yyval.stmt)->s.loop.body = (yyvsp[-1].stmt); - pop_loop_name(); - } - break; - - case 14: -#line 192 "parser.y" - { - suspend_loop_scope(); - } - break; - - case 15: -#line 196 "parser.y" - { - (yyval.stmt) = alloc_stmt(STMT_FORK); - (yyval.stmt)->s.fork.id = -1; - (yyval.stmt)->s.fork.time = (yyvsp[-4].expr); - (yyval.stmt)->s.fork.body = (yyvsp[-1].stmt); - resume_loop_scope(); - } - break; - - case 16: -#line 204 "parser.y" - { - suspend_loop_scope(); - } - break; - - case 17: -#line 208 "parser.y" - { - (yyval.stmt) = alloc_stmt(STMT_FORK); - (yyval.stmt)->s.fork.id = find_id((yyvsp[-6].string)); - (yyval.stmt)->s.fork.time = (yyvsp[-4].expr); - (yyval.stmt)->s.fork.body = (yyvsp[-1].stmt); - resume_loop_scope(); - } - break; - - case 18: -#line 216 "parser.y" - { - (yyval.stmt) = alloc_stmt(STMT_EXPR); - (yyval.stmt)->s.expr = (yyvsp[-1].expr); - } - break; - - case 19: -#line 221 "parser.y" - { - check_loop_name(0, LOOP_BREAK); - (yyval.stmt) = alloc_stmt(STMT_BREAK); - (yyval.stmt)->s.exit = -1; - } - break; - - case 20: -#line 227 "parser.y" - { - check_loop_name((yyvsp[-1].string), LOOP_BREAK); - (yyval.stmt) = alloc_stmt(STMT_BREAK); - (yyval.stmt)->s.exit = find_id((yyvsp[-1].string)); - } - break; - - case 21: -#line 233 "parser.y" - { - check_loop_name(0, LOOP_CONTINUE); - (yyval.stmt) = alloc_stmt(STMT_CONTINUE); - (yyval.stmt)->s.exit = -1; - } - break; - - case 22: -#line 239 "parser.y" - { - check_loop_name((yyvsp[-1].string), LOOP_CONTINUE); - (yyval.stmt) = alloc_stmt(STMT_CONTINUE); - (yyval.stmt)->s.exit = find_id((yyvsp[-1].string)); - } - break; - - case 23: -#line 245 "parser.y" - { - (yyval.stmt) = alloc_stmt(STMT_RETURN); - (yyval.stmt)->s.expr = (yyvsp[-1].expr); - } - break; - - case 24: -#line 250 "parser.y" - { - (yyval.stmt) = alloc_stmt(STMT_RETURN); - (yyval.stmt)->s.expr = 0; - } - break; - - case 25: -#line 255 "parser.y" - { (yyval.stmt) = 0; } - break; - - case 26: -#line 257 "parser.y" - { - (yyval.stmt) = alloc_stmt(STMT_TRY_EXCEPT); - (yyval.stmt)->s.catch.body = (yyvsp[-2].stmt); - (yyval.stmt)->s.catch.excepts = (yyvsp[-1].except); - } - break; - - case 27: -#line 263 "parser.y" - { - (yyval.stmt) = alloc_stmt(STMT_TRY_FINALLY); - (yyval.stmt)->s.finally.body = (yyvsp[-3].stmt); - (yyval.stmt)->s.finally.handler = (yyvsp[-1].stmt); - } - break; - - case 28: -#line 272 "parser.y" - { (yyval.arm) = 0; } - break; - - case 29: -#line 274 "parser.y" - { - Cond_Arm *this_arm = alloc_cond_arm((yyvsp[-2].expr), (yyvsp[0].stmt)); - - if ((yyvsp[-5].arm)) { - Cond_Arm *tmp = (yyvsp[-5].arm); - - while (tmp->next) - tmp = tmp->next; - tmp->next = this_arm; - (yyval.arm) = (yyvsp[-5].arm); - } else - (yyval.arm) = this_arm; - } - break; - - case 30: -#line 291 "parser.y" - { (yyval.stmt) = 0; } - break; - - case 31: -#line 293 "parser.y" - { (yyval.stmt) = (yyvsp[0].stmt); } - break; - - case 32: -#line 298 "parser.y" - { (yyval.except) = (yyvsp[0].except); } - break; - - case 33: -#line 300 "parser.y" - { - Except_Arm *tmp = (yyvsp[-1].except); - int count = 1; - - while (tmp->next) { - tmp = tmp->next; - count++; - } - if (!tmp->codes) - yyerror("Unreachable EXCEPT clause"); - else if (count > 255) - yyerror("Too many EXCEPT clauses (max. 255)"); - } - break; - - case 34: -#line 314 "parser.y" - { - Except_Arm *tmp = (yyvsp[-3].except); - - while (tmp->next) - tmp = tmp->next; - - tmp->next = (yyvsp[0].except); - (yyval.except) = (yyvsp[-3].except); - } - break; - - case 35: -#line 326 "parser.y" - { (yyval.except) = alloc_except((yyvsp[-4].string) ? find_id((yyvsp[-4].string)) : -1, (yyvsp[-2].args), (yyvsp[0].stmt)); } - break; - - case 36: -#line 331 "parser.y" - { (yyval.string) = 0; } - break; - - case 37: -#line 333 "parser.y" - { (yyval.string) = (yyvsp[0].string); } - break; - - case 38: -#line 338 "parser.y" - { - (yyval.expr) = alloc_var(TYPE_INT); - (yyval.expr)->e.var.v.num = (yyvsp[0].integer); - } - break; - - case 39: -#line 343 "parser.y" - { - (yyval.expr) = alloc_var(TYPE_FLOAT); - (yyval.expr)->e.var.v.fnum = (yyvsp[0].real); - } - break; - - case 40: -#line 348 "parser.y" - { - (yyval.expr) = alloc_var(TYPE_STR); - (yyval.expr)->e.var.v.str = (yyvsp[0].string); - } - break; - - case 41: -#line 353 "parser.y" - { - (yyval.expr) = alloc_var(TYPE_OBJ); - (yyval.expr)->e.var.v.obj = (yyvsp[0].object); - } - break; - - case 42: -#line 358 "parser.y" - { - (yyval.expr) = alloc_var(TYPE_ERR); - (yyval.expr)->e.var.v.err = (yyvsp[0].error); - } - break; - - case 43: -#line 363 "parser.y" - { - (yyval.expr) = alloc_expr(EXPR_ID); - (yyval.expr)->e.id = find_id((yyvsp[0].string)); - } - break; - - case 44: -#line 368 "parser.y" - { - /* Treat $foo like #0.("foo") */ - Expr *obj = alloc_var(TYPE_OBJ); - Expr *prop = alloc_var(TYPE_STR); - obj->e.var.v.obj = 0; - prop->e.var.v.str = (yyvsp[0].string); - (yyval.expr) = alloc_binary(EXPR_PROP, obj, prop); - } - break; - - case 45: -#line 377 "parser.y" - { - /* Treat foo.bar like foo.("bar") for simplicity */ - Expr *prop = alloc_var(TYPE_STR); - prop->e.var.v.str = (yyvsp[0].string); - (yyval.expr) = alloc_binary(EXPR_PROP, (yyvsp[-2].expr), prop); - } - break; - - case 46: -#line 384 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_PROP, (yyvsp[-4].expr), (yyvsp[-1].expr)); - } - break; - - case 47: -#line 388 "parser.y" - { - /* treat foo:bar(args) like foo:("bar")(args) */ - Expr *verb = alloc_var(TYPE_STR); - verb->e.var.v.str = (yyvsp[-3].string); - (yyval.expr) = alloc_verb((yyvsp[-5].expr), verb, (yyvsp[-1].args)); - } - break; - - case 48: -#line 395 "parser.y" - { - /* treat $bar(args) like #0:("bar")(args) */ - Expr *obj = alloc_var(TYPE_OBJ); - Expr *verb = alloc_var(TYPE_STR); - obj->e.var.v.obj = 0; - verb->e.var.v.str = (yyvsp[-3].string); - (yyval.expr) = alloc_verb(obj, verb, (yyvsp[-1].args)); - } - break; - - case 49: -#line 404 "parser.y" - { - (yyval.expr) = alloc_verb((yyvsp[-7].expr), (yyvsp[-4].expr), (yyvsp[-1].args)); - } - break; - - case 50: -#line 408 "parser.y" - { - dollars_ok--; - (yyval.expr) = alloc_binary(EXPR_INDEX, (yyvsp[-4].expr), (yyvsp[-1].expr)); - } - break; - - case 51: -#line 413 "parser.y" - { - dollars_ok--; - (yyval.expr) = alloc_expr(EXPR_RANGE); - (yyval.expr)->e.range.base = (yyvsp[-6].expr); - (yyval.expr)->e.range.from = (yyvsp[-3].expr); - (yyval.expr)->e.range.to = (yyvsp[-1].expr); - } - break; - - case 52: -#line 421 "parser.y" - { - if (!dollars_ok) - yyerror("Illegal context for `$' expression."); - (yyval.expr) = alloc_expr(EXPR_LENGTH); - } - break; - - case 53: -#line 427 "parser.y" - { - Expr *e = (yyvsp[-2].expr); - - if (e->kind == EXPR_LIST) { - e->kind = EXPR_SCATTER; - if (e->e.list) { - e->e.scatter = scatter_from_arglist(e->e.list); - vet_scatter(e->e.scatter); - } else - yyerror("Empty list in scattering assignment."); - } else { - if (e->kind == EXPR_RANGE) - e = e->e.range.base; - while (e->kind == EXPR_INDEX) - e = e->e.bin.lhs; - if (e->kind != EXPR_ID && e->kind != EXPR_PROP) - yyerror("Illegal expression on left side of" - " assignment."); - } - (yyval.expr) = alloc_binary(EXPR_ASGN, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 54: -#line 449 "parser.y" - { - Expr *e = alloc_expr(EXPR_SCATTER); - - e->e.scatter = (yyvsp[-3].scatter); - vet_scatter((yyvsp[-3].scatter)); - (yyval.expr) = alloc_binary(EXPR_ASGN, e, (yyvsp[0].expr)); - } - break; - - case 55: -#line 457 "parser.y" - { - unsigned f_no; - - (yyval.expr) = alloc_expr(EXPR_CALL); - if ((f_no = number_func_by_name((yyvsp[-3].string))) == FUNC_NOT_FOUND) { - /* Replace with call_function("$1", @args) */ - Expr *fname = alloc_var(TYPE_STR); - Arg_List *a = alloc_arg_list(ARG_NORMAL, fname); - - fname->e.var.v.str = (yyvsp[-3].string); - a->next = (yyvsp[-1].args); - warning("Unknown built-in function: ", (yyvsp[-3].string)); - (yyval.expr)->e.call.func = number_func_by_name("call_function"); - (yyval.expr)->e.call.args = a; - } else { - (yyval.expr)->e.call.func = f_no; - (yyval.expr)->e.call.args = (yyvsp[-1].args); - dealloc_string((yyvsp[-3].string)); - } - } - break; - - case 56: -#line 478 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_PLUS, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 57: -#line 482 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_MINUS, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 58: -#line 486 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_TIMES, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 59: -#line 490 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_DIVIDE, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 60: -#line 494 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_MOD, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 61: -#line 498 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_EXP, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 62: -#line 502 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 63: -#line 506 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 64: -#line 510 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_EQ, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 65: -#line 514 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_NE, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 66: -#line 518 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_LT, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 67: -#line 522 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_LE, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 68: -#line 526 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_GT, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 69: -#line 530 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_GE, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 70: -#line 534 "parser.y" - { - (yyval.expr) = alloc_binary(EXPR_IN, (yyvsp[-2].expr), (yyvsp[0].expr)); - } - break; - - case 71: -#line 538 "parser.y" - { - if ((yyvsp[0].expr)->kind == EXPR_VAR - && ((yyvsp[0].expr)->e.var.type == TYPE_INT - || (yyvsp[0].expr)->e.var.type == TYPE_FLOAT)) { - switch ((yyvsp[0].expr)->e.var.type) { - case TYPE_INT: - (yyvsp[0].expr)->e.var.v.num = -(yyvsp[0].expr)->e.var.v.num; - break; - case TYPE_FLOAT: - *((yyvsp[0].expr)->e.var.v.fnum) = - (*((yyvsp[0].expr)->e.var.v.fnum)); - break; - default: - break; - } - (yyval.expr) = (yyvsp[0].expr); - } else { - (yyval.expr) = alloc_expr(EXPR_NEGATE); - (yyval.expr)->e.expr = (yyvsp[0].expr); - } - } - break; - - case 72: -#line 559 "parser.y" - { - (yyval.expr) = alloc_expr(EXPR_NOT); - (yyval.expr)->e.expr = (yyvsp[0].expr); - } - break; - - case 73: -#line 564 "parser.y" - { (yyval.expr) = (yyvsp[-1].expr); } - break; - - case 74: -#line 566 "parser.y" - { - (yyval.expr) = alloc_expr(EXPR_LIST); - (yyval.expr)->e.list = (yyvsp[-1].args); - } - break; - - case 75: -#line 571 "parser.y" - { - (yyval.expr) = alloc_expr(EXPR_COND); - (yyval.expr)->e.cond.condition = (yyvsp[-4].expr); - (yyval.expr)->e.cond.consequent = (yyvsp[-2].expr); - (yyval.expr)->e.cond.alternate = (yyvsp[0].expr); - } - break; - - case 76: -#line 578 "parser.y" - { - (yyval.expr) = alloc_expr(EXPR_CATCH); - (yyval.expr)->e.catch.try = (yyvsp[-4].expr); - (yyval.expr)->e.catch.codes = (yyvsp[-2].args); - (yyval.expr)->e.catch.except = (yyvsp[-1].expr); - } - break; - - case 77: -#line 588 "parser.y" - { dollars_ok++; } - break; - - case 78: -#line 592 "parser.y" - { (yyval.args) = 0; } - break; - - case 79: -#line 594 "parser.y" - { (yyval.args) = (yyvsp[0].args); } - break; - - case 80: -#line 598 "parser.y" - { (yyval.expr) = 0; } - break; - - case 81: -#line 600 "parser.y" - { (yyval.expr) = (yyvsp[0].expr); } - break; - - case 82: -#line 604 "parser.y" - { (yyval.args) = 0; } - break; - - case 83: -#line 606 "parser.y" - { (yyval.args) = (yyvsp[0].args); } - break; - - case 84: -#line 611 "parser.y" - { (yyval.args) = alloc_arg_list(ARG_NORMAL, (yyvsp[0].expr)); } - break; - - case 85: -#line 613 "parser.y" - { (yyval.args) = alloc_arg_list(ARG_SPLICE, (yyvsp[0].expr)); } - break; - - case 86: -#line 615 "parser.y" - { - Arg_List *this_arg = alloc_arg_list(ARG_NORMAL, (yyvsp[0].expr)); - - if ((yyvsp[-2].args)) { - Arg_List *tmp = (yyvsp[-2].args); - - while (tmp->next) - tmp = tmp->next; - tmp->next = this_arg; - (yyval.args) = (yyvsp[-2].args); - } else - (yyval.args) = this_arg; - } - break; - - case 87: -#line 629 "parser.y" - { - Arg_List *this_arg = alloc_arg_list(ARG_SPLICE, (yyvsp[0].expr)); - - if ((yyvsp[-3].args)) { - Arg_List *tmp = (yyvsp[-3].args); - - while (tmp->next) - tmp = tmp->next; - tmp->next = this_arg; - (yyval.args) = (yyvsp[-3].args); - } else - (yyval.args) = this_arg; - } - break; - - case 88: -#line 646 "parser.y" - { - Scatter *sc = scatter_from_arglist((yyvsp[-2].args)); - - if (sc) - (yyval.scatter) = add_scatter_item(sc, (yyvsp[0].scatter)); - else - (yyval.scatter) = (yyvsp[0].scatter); - } - break; - - case 89: -#line 655 "parser.y" - { - (yyval.scatter) = add_scatter_item((yyvsp[-2].scatter), (yyvsp[0].scatter)); - } - break; - - case 90: -#line 659 "parser.y" - { - (yyval.scatter) = add_scatter_item((yyvsp[-2].scatter), alloc_scatter(SCAT_REQUIRED, - find_id((yyvsp[0].string)), 0)); - } - break; - - case 91: -#line 664 "parser.y" - { - (yyval.scatter) = add_scatter_item((yyvsp[-3].scatter), alloc_scatter(SCAT_REST, - find_id((yyvsp[0].string)), 0)); - } - break; - - case 92: -#line 669 "parser.y" - { (yyval.scatter) = (yyvsp[0].scatter); } - break; - - case 93: -#line 674 "parser.y" - { - (yyval.scatter) = alloc_scatter(SCAT_OPTIONAL, find_id((yyvsp[0].string)), 0); - } - break; - - case 94: -#line 678 "parser.y" - { - (yyval.scatter) = alloc_scatter(SCAT_OPTIONAL, find_id((yyvsp[-2].string)), (yyvsp[0].expr)); - } - break; - - - } - -/* Line 1037 of yacc.c. */ -#line 2396 "parser.c" - - yyvsp -= yylen; - yyssp -= yylen; - - - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (YYPACT_NINF < yyn && yyn < YYLAST) - { - YYSIZE_T yysize = 0; - int yytype = YYTRANSLATE (yychar); - const char* yyprefix; - char *yymsg; - int yyx; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 0; - - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); - yycount += 1; - if (yycount == 5) - { - yysize = 0; - break; - } - } - yysize += (sizeof ("syntax error, unexpected ") - + yystrlen (yytname[yytype])); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) - { - char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); - yyp = yystpcpy (yyp, yytname[yytype]); - - if (yycount < 5) - { - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - yyp = yystpcpy (yyp, yyprefix); - yyp = yystpcpy (yyp, yytname[yyx]); - yyprefix = " or "; - } - } - yyerror (yymsg); - YYSTACK_FREE (yymsg); - } - else - yyerror ("syntax error; also virtual memory exhausted"); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror ("syntax error"); - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* If at end of input, pop the error token, - then the rest of the stack, then return failure. */ - if (yychar == YYEOF) - for (;;) - { - - YYPOPSTACK; - if (yyssp == yyss) - YYABORT; - yydestruct ("Error: popping", - yystos[*yyssp], yyvsp); - } - } - else - { - yydestruct ("Error: discarding", yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse look-ahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - -#ifdef __GNUC__ - /* Pacify GCC when the user code never invokes YYERROR and the label - yyerrorlab therefore never appears in user code. */ - if (0) - goto yyerrorlab; -#endif - -yyvsp -= yylen; - yyssp -= yylen; - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", yystos[yystate], yyvsp); - YYPOPSTACK; - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - if (yyn == YYFINAL) - YYACCEPT; - - *++yyvsp = yylval; - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yydestruct ("Error: discarding lookahead", - yytoken, &yylval); - yychar = YYEMPTY; - yyresult = 1; - goto yyreturn; - -#ifndef yyoverflow -/*----------------------------------------------. -| yyoverflowlab -- parser overflow comes here. | -`----------------------------------------------*/ -yyoverflowlab: - yyerror ("parser stack overflow"); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif - return yyresult; -} - - -#line 683 "parser.y" - - -static int lineno, nerrors, must_rename_keywords; -static Parser_Client client; -static void *client_data; -static Names *local_names; - -static int -find_id(char *name) -{ - int slot = find_or_add_name(&local_names, name); - - dealloc_string(name); - return slot; -} - -static void -yyerror(const char *s) -{ - error(s, 0); -} - -static const char * -fmt_error(const char *s, const char *t) -{ - static Stream *str = 0; - - if (str == 0) - str = new_stream(100); - if (t) - stream_printf(str, "Line %d: %s%s", lineno, s, t); - else - stream_printf(str, "Line %d: %s", lineno, s); - return reset_stream(str); -} - -static void -error(const char *s, const char *t) -{ - nerrors++; - (*(client.error))(client_data, fmt_error(s, t)); -} - -static void -warning(const char *s, const char *t) -{ - if (client.warning) - (*(client.warning))(client_data, fmt_error(s, t)); - else - error(s, t); -} - -static int unget_buffer[5], unget_count; - -static int -lex_getc(void) -{ - if (unget_count > 0) - return unget_buffer[--unget_count]; - else - return (*(client.getch))(client_data); -} - -static void -lex_ungetc(int c) -{ - unget_buffer[unget_count++] = c; -} - -static int -follow(int expect, int ifyes, int ifno) /* look ahead for >=, etc. */ -{ - int c = lex_getc(); - - if (c == expect) - return ifyes; - lex_ungetc(c); - return ifno; -} - -static Stream *token_stream = 0; - -static int -yylex(void) -{ - int c; - - reset_stream(token_stream); - -start_over: - - do { - c = lex_getc(); - if (c == '\n') lineno++; - } while (isspace(c)); - - if (c == '/') { - c = lex_getc(); - if (c == '*') { - for (;;) { - c = lex_getc(); - if (c == '*') { - c = lex_getc(); - if (c == '/') - goto start_over; - } - if (c == EOF) { - yyerror("End of program while in a comment"); - return c; - } - } - } else { - lex_ungetc(c); - return '/'; - } - } - - if (c == '#') { - int negative = 0; - Objid oid = 0; - - c = lex_getc(); - if (c == '-') { - negative = 1; - c = lex_getc(); - } - if (!isdigit(c)) { - yyerror("Malformed object number"); - lex_ungetc(c); - return 0; - } - do { - oid = oid * 10 + (c - '0'); - c = lex_getc(); - } while (isdigit(c)); - lex_ungetc(c); - - yylval.object = negative ? -oid : oid; - return tOBJECT; - } - - if (isdigit(c) || (c == '.' && language_version >= DBV_Float)) { - int n = 0; - int type = tINTEGER; - - while (isdigit(c)) { - n = n * 10 + (c - '0'); - stream_add_char(token_stream, c); - c = lex_getc(); - } - - if (language_version >= DBV_Float && c == '.') { - /* maybe floating-point (but maybe `..') */ - int cc; - - lex_ungetc(cc = lex_getc()); /* peek ahead */ - if (isdigit(cc)) { /* definitely floating-point */ - type = tFLOAT; - do { - stream_add_char(token_stream, c); - c = lex_getc(); - } while (isdigit(c)); - } else if (stream_length(token_stream) == 0) - /* no digits before or after `.'; not a number at all */ - goto normal_dot; - else if (cc != '.') { - /* Some digits before dot, not `..' */ - type = tFLOAT; - stream_add_char(token_stream, c); - c = lex_getc(); - } - } - - if (language_version >= DBV_Float && (c == 'e' || c == 'E')) { - /* better be an exponent */ - type = tFLOAT; - stream_add_char(token_stream, c); - c = lex_getc(); - if (c == '+' || c == '-') { - stream_add_char(token_stream, c); - c = lex_getc(); - } - if (!isdigit(c)) { - yyerror("Malformed floating-point literal"); - lex_ungetc(c); - return 0; - } - do { - stream_add_char(token_stream, c); - c = lex_getc(); - } while (isdigit(c)); - } - - lex_ungetc(c); - - if (type == tINTEGER) - yylval.integer = n; - else { - double d; - - d = strtod(reset_stream(token_stream), 0); - if (!IS_REAL(d)) { - yyerror("Floating-point literal out of range"); - d = 0.0; - } - yylval.real = alloc_float(d); - } - return type; - } - - if (isalpha(c) || c == '_') { - char *buf; - Keyword *k; - - stream_add_char(token_stream, c); - while (isalnum(c = lex_getc()) || c == '_') - stream_add_char(token_stream, c); - lex_ungetc(c); - buf = reset_stream(token_stream); - - k = find_keyword(buf); - if (k) { - if (k->version <= language_version) { - int t = k->token; - - if (t == tERROR) - yylval.error = k->error; - return t; - } else { /* New keyword being used as an identifier */ - if (!must_rename_keywords) - warning("Renaming old use of new keyword: ", buf); - must_rename_keywords = 1; - } - } - - yylval.string = alloc_string(buf); - return tID; - } - - if (c == '"') { - while(1) { - c = lex_getc(); - if (c == '"') - break; - if (c == '\\') - c = lex_getc(); - if (c == '\n' || c == EOF) { - yyerror("Missing quote"); - break; - } - stream_add_char(token_stream, c); - } - yylval.string = alloc_string(reset_stream(token_stream)); - return tSTRING; - } - - switch(c) { - case '>': return follow('=', tGE, '>'); - case '<': return follow('=', tLE, '<'); - case '=': return ((c = follow('=', tEQ, 0)) - ? c - : follow('>', tARROW, '=')); - case '!': return follow('=', tNE, '!'); - case '|': return follow('|', tOR, '|'); - case '&': return follow('&', tAND, '&'); - normal_dot: - case '.': return follow('.', tTO, '.'); - default: return c; - } -} - -static Scatter * -add_scatter_item(Scatter *first, Scatter *last) -{ - Scatter *tmp = first; - - while (tmp->next) - tmp = tmp->next; - tmp->next = last; - - return first; -} - -static Scatter * -scatter_from_arglist(Arg_List *a) -{ - Scatter *sc = 0, **scp; - Arg_List *anext; - - for (scp = ≻ a; a = anext, scp = &((*scp)->next)) { - if (a->expr->kind == EXPR_ID) { - *scp = alloc_scatter(a->kind == ARG_NORMAL ? SCAT_REQUIRED - : SCAT_REST, - a->expr->e.id, 0); - anext = a->next; - dealloc_node(a->expr); - dealloc_node(a); - } else { - yyerror("Scattering assignment targets must be simple variables."); - return 0; - } - } - - return sc; -} - -static void -vet_scatter(Scatter *sc) -{ - int seen_rest = 0, count = 0; - - for (; sc; sc = sc->next) { - if (sc->kind == SCAT_REST) { - if (seen_rest) - yyerror("More than one `@' target in scattering assignment."); - else - seen_rest = 1; - } - count++; - } - - if (count > 255) - yyerror("Too many targets in scattering assignment."); -} - -struct loop_entry { - struct loop_entry *next; - const char *name; - int is_barrier; -}; - -static struct loop_entry *loop_stack; - -static void -push_loop_name(const char *name) -{ - struct loop_entry *entry = mymalloc(sizeof(struct loop_entry), M_AST); - - entry->next = loop_stack; - entry->name = (name ? str_dup(name) : 0); - entry->is_barrier = 0; - loop_stack = entry; -} - -static void -pop_loop_name(void) -{ - if (loop_stack && loop_stack->is_barrier) { - struct loop_entry *entry = loop_stack; - - loop_stack = loop_stack->next; - if (entry->name) - free_str(entry->name); - myfree(entry, M_AST); - } -} - -static void -suspend_loop_scope(void) -{ - struct loop_entry *entry = mymalloc(sizeof(struct loop_entry), M_AST); - - entry->next = loop_stack; - entry->name = 0; - entry->is_barrier = 1; - loop_stack = entry; -} - -static void -resume_loop_scope(void) -{ - if (loop_stack && loop_stack->is_barrier){ - struct loop_entry *entry = loop_stack; - - loop_stack = loop_stack->next; - myfree(entry, M_AST); - } -} - -static void -check_loop_name(const char *name, enum loop_exit_kind kind) -{ - struct loop_entry *entry; - - if (!name) { - if (!loop_stack || loop_stack->is_barrier) { - if (kind == LOOP_BREAK) - yyerror("No enclosing loop for `break' statement"); - else - yyerror("No enclosing loop for `continue' statement"); - } - return; - } - - for (entry = loop_stack; entry && !entry->is_barrier; entry = entry->next) - if (entry->name && mystrcasecmp(entry->name, name) == 0) - return; - - if (kind == LOOP_BREAK) - error("Invalid loop name in `break' statement: ", name); - else - error("Invalid loop name in `continue' statement: ", name); -} - -void -parse_program(DB_Version version, Parser_Client c, void *data) -{ - extern int yyparse(); - - if (token_stream == 0) - token_stream = new_stream(1024); - unget_count = 0; - nerrors = 0; - must_rename_keywords = 0; - lineno = 1; - client = c; - client_data = data; - local_names = new_builtin_names(version); - dollars_ok = 0; - loop_stack = 0; - language_version = version; - - begin_code_allocation(); - yyparse(); - end_code_allocation(nerrors > 0); - if (loop_stack) { - while (loop_stack) { - struct loop_entry *entry = loop_stack; - - loop_stack = loop_stack->next; - if (entry->name) - free_str(entry->name); - myfree(entry, M_AST); - } - } -} - -struct parser_state { - Var code; /* a list of strings */ - int cur_string; /* which string? */ - int cur_char; /* which character in that string? */ - Var errors; /* a list of strings */ -}; - -static void -my_error(void *data, const char *msg) -{ - struct parser_state *state = (struct parser_state *) data; - Var v; - - v.type = TYPE_STR; - v.v.str = str_dup(msg); - state->errors = listappend(state->errors, v); -} - -static int -my_getc(void *data) -{ - struct parser_state *state = (struct parser_state *) data; - Var code; - unsigned char c; - - code = state->code; - if (state->cur_string > code.v.list[0].v.num) - return EOF; - else if (!(c = code.v.list[state->cur_string].v.str[state->cur_char])) { - state->cur_string++; - state->cur_char = 0; - return '\n'; - } else { - state->cur_char++; - return c; - } -} - -static Parser_Client list_parser_client = { my_error, 0, my_getc }; - -void -parse_list_as_program(Var code, Var *errors) -{ - struct parser_state state; - state.code = code; - state.cur_string = 1; - state.cur_char = 0; - state.errors = new_list(0); - parse_program(current_version, list_parser_client, &state); - *errors = state.errors; -} - -char rcsid_parser[] = "$Id: parser.y,v 1.1.1.1 2004/02/26 13:13:58 jesse Exp $"; - -/* - * $Log: parser.y,v $ - * Revision 1.1.1.1 2004/02/26 13:13:58 jesse - * Initial import into CVS - * - * Revision 1.8.1fa 2004/01/02 - * my_getc, changed char c to unsigned; - * - * Revision 1.2 1998/12/14 13:18:45 nop - * Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims - * - * Revision 1.1.1.1 1997/03/03 03:45:02 nop - * LambdaMOO 1.8.0p5 - * - * Revision 2.11 1996/05/12 21:28:37 pavel - * Removed non-backward-compatible parse error for negating a non-numeric - * literal. Made certain aspects of floating-point literal parsing be - * language-version-dependent, to maintain backward compatibility with DBs - * written by pre-float servers. Release 1.8.0p5. - * - * Revision 2.10 1996/04/19 01:26:38 pavel - * Fixed potential memory smash when `$' expression occurs in an illegal - * context. Release 1.8.0p4. - * - * Revision 2.9 1996/03/10 01:08:01 pavel - * Removed bogus `call_function("foo", ...)' --> `foo(...)' conversion. - * Fixed line numbers of renamed-variable warnings. Release 1.8.0. - * - * Revision 2.8 1996/02/18 23:14:54 pavel - * Liberalized parsing of floating-point numbers to accept `3.' and `3.e1'. - * Changed parsing to replace call_function("foo", @args) with foo(@args) if - * foo is a known function. Release 1.8.0beta3. - * - * Revision 2.7 1996/02/11 00:46:01 pavel - * Liberalized parsing of floating-point literals to accept `.02' and the - * like. Fixed a bug where `1E6' and the like would be parsed as an integer. - * Release 1.8.0beta2. - * - * Revision 2.6 1996/02/08 06:32:48 pavel - * Added support for floating-point literals, exponentiation expression, named - * WHILE loops, and BREAK and CONTINUE statements. Generalized support for - * version-dependent compilation. Renamed TYPE_NUM to TYPE_INT. Removed use - * of ungetch() method on Parser_Client. Updated copyright notice for 1996. - * Release 1.8.0beta1. - * - * Revision 2.5 1996/01/16 07:17:05 pavel - * Add support for scattering assignment. Release 1.8.0alpha6. - * - * Revision 2.4 1996/01/11 07:50:49 pavel - * Added missing #include "my-string.h". Release 1.8.0alpha5. - * - * Revision 2.3 1995/12/31 00:09:40 pavel - * Removed unused tokens tRAISE and tFORLIST (huh?). Added `$' expression. - * Release 1.8.0alpha4. - * - * Revision 2.2 1995/12/28 00:43:25 pavel - * Added some support for MOO-compilation warnings. Changed `unknown built-in - * function' error into a warning with recovery. Changed identifier-renaming - * log message into a warning. Release 1.8.0alpha3. - * - * Revision 2.1 1995/12/11 08:01:26 pavel - * Added support for `$foo(...)' syntax. Release 1.8.0alpha2. - * - * Revision 2.0 1995/11/30 04:48:11 pavel - * New baseline version, corresponding to release 1.8.0alpha1. - * - * Revision 1.13 1992/10/23 23:03:47 pavel - * Added copyright notice. - * - * Revision 1.12 1992/10/23 22:21:43 pavel - * Eliminated all uses of the useless macro NULL. - * - * Revision 1.11 1992/10/21 03:02:35 pavel - * Converted to use new automatic configuration system. - * - * Revision 1.10 1992/08/31 22:25:51 pjames - * Changed some `char *'s to `const char *' - * - * Revision 1.9 1992/08/28 23:18:38 pjames - * Added ASGN_RANGE parsing code. Fixed tiny memory leak. - * - * Revision 1.8 1992/08/28 16:16:52 pjames - * Changed `ak_dealloc_string()' to `free_str()'. - * - * Revision 1.7 1992/08/12 01:49:58 pjames - * Negative literals are now accepted (instead of negated positive literals). - * - * Revision 1.6 1992/08/10 16:55:59 pjames - * Updated #includes. - * - * Revision 1.5 1992/07/30 21:22:08 pjames - * Removed max_stack calculations (moved to vector.c). - * - * Revision 1.4 1992/07/29 18:05:12 pjames - * $$ no longer = NULL when there is an illegal left hand side of an - * expression. - * - * Revision 1.3 1992/07/27 18:12:41 pjames - * Changed name of ct_env to var_names and const_env to literals. - * Modified call to vectorize to use new argument format. - * Assignment statements now check left hand side properly for allowable - * expressions, and now frees memory from reused expressions. - * - * Revision 1.2 1992/07/21 00:05:16 pavel - * Added rcsid_ declaration to hold the RCS ident. string. - * - * Revision 1.1 1992/07/20 23:23:12 pavel - * Initial RCS-controlled version. - */ - diff --git a/gnoemoe/parser/parser.h b/gnoemoe/parser/parser.h deleted file mode 100644 index eb722b0..0000000 --- a/gnoemoe/parser/parser.h +++ /dev/null @@ -1,131 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.0. */ - -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - tINTEGER = 258, - tOBJECT = 259, - tFLOAT = 260, - tSTRING = 261, - tID = 262, - tERROR = 263, - tIF = 264, - tELSE = 265, - tELSEIF = 266, - tENDIF = 267, - tFOR = 268, - tIN = 269, - tENDFOR = 270, - tRETURN = 271, - tFORK = 272, - tENDFORK = 273, - tWHILE = 274, - tENDWHILE = 275, - tTRY = 276, - tENDTRY = 277, - tEXCEPT = 278, - tFINALLY = 279, - tANY = 280, - tBREAK = 281, - tCONTINUE = 282, - tTO = 283, - tARROW = 284, - tAND = 285, - tOR = 286, - tGE = 287, - tLE = 288, - tNE = 289, - tEQ = 290, - tUNARYMINUS = 291 - }; -#endif -#define tINTEGER 258 -#define tOBJECT 259 -#define tFLOAT 260 -#define tSTRING 261 -#define tID 262 -#define tERROR 263 -#define tIF 264 -#define tELSE 265 -#define tELSEIF 266 -#define tENDIF 267 -#define tFOR 268 -#define tIN 269 -#define tENDFOR 270 -#define tRETURN 271 -#define tFORK 272 -#define tENDFORK 273 -#define tWHILE 274 -#define tENDWHILE 275 -#define tTRY 276 -#define tENDTRY 277 -#define tEXCEPT 278 -#define tFINALLY 279 -#define tANY 280 -#define tBREAK 281 -#define tCONTINUE 282 -#define tTO 283 -#define tARROW 284 -#define tAND 285 -#define tOR 286 -#define tGE 287 -#define tLE 288 -#define tNE 289 -#define tEQ 290 -#define tUNARYMINUS 291 - - - - -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 68 "parser.y" -typedef union YYSTYPE { - Stmt *stmt; - Expr *expr; - int integer; - Objid object; - double *real; - char *string; - enum error error; - Arg_List *args; - Cond_Arm *arm; - Except_Arm *except; - Scatter *scatter; -} YYSTYPE; -/* Line 1318 of yacc.c. */ -#line 123 "parser.h" -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif - -extern YYSTYPE yylval; - - -