A Nix language parser implemented in C (ragel + bison)
at main 67 kB view raw
1/* A Bison parser, made by GNU Bison 3.8.2. */ 2 3/* Bison implementation for Yacc-like parsers in C 4 5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, 6 Inc. 7 8 This program is free software: you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation, either version 3 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 20 21/* As a special exception, you may create a larger work that contains 22 part or all of the Bison parser skeleton and distribute that work 23 under terms of your choice, so long as that work isn't itself a 24 parser generator using the skeleton or a modified version thereof 25 as a parser skeleton. Alternatively, if you modify or redistribute 26 the parser skeleton itself, you may (at your option) remove this 27 special exception, which will cause the skeleton and the resulting 28 Bison output files to be licensed under the GNU General Public 29 License without this special exception. 30 31 This special exception was added by the Free Software Foundation in 32 version 2.2 of Bison. */ 33 34/* C LALR(1) parser skeleton written by Richard Stallman, by 35 simplifying the original so-called "semantic" parser. */ 36 37/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, 38 especially those whose name start with YY_ or yy_. They are 39 private implementation details that can be changed or removed. */ 40 41/* All symbols defined below should begin with yy or YY, to avoid 42 infringing on user name space. This should be done even for local 43 variables, as they might otherwise be expanded by user macros. 44 There are some unavoidable exceptions within include files to 45 define necessary library symbols; they are noted "INFRINGES ON 46 USER NAME SPACE" below. */ 47 48/* Identify Bison output, and Bison version. */ 49#define YYBISON 30802 50 51/* Bison version string. */ 52#define YYBISON_VERSION "3.8.2" 53 54/* Skeleton name. */ 55#define YYSKELETON_NAME "yacc.c" 56 57/* Pure parsers. */ 58#define YYPURE 2 59 60/* Push parsers. */ 61#define YYPUSH 0 62 63/* Pull parsers. */ 64#define YYPULL 1 65 66 67 68 69/* First part of user prologue. */ 70#line 1 "parser/parser.y" 71 72#include "node.h" 73#include "lexer.h" 74#include <stdio.h> 75#include <stdlib.h> 76 77/* Forward declarations of node helpers implemented in parser/nodetype.c */ 78Node* new_node(NodeType type, int token_start); 79Node* new_node1(NodeType type, int token_start, Node* n1); 80Node* new_node2(NodeType type, int token_start, Node* n1, Node* n2); 81Node* new_node3(NodeType type, int token_start, Node* n1, Node* n2, Node* n3); 82Node* op_node1(int op, int token_start, Node* n1); 83Node* op_node2(int op, int token_start, Node* n1, Node* n2); 84void set_node_type(Node* node, NodeType type); 85void add_child(Node* parent, Node* child); 86void set_token_end(Node* node, int token_end); 87 88/* yyerror matching the generated parser expectations */ 89void yyerror(void **ast_root, void *scanner, const char *s) { 90 (void)ast_root; (void)scanner; 91 fprintf(stderr, "parse error: %s\n", s); 92} 93 94/* yylex prototype using void* so it's visible before YYSTYPE is defined in the generated file */ 95int yylex(void *yylval_param, void *scanner); 96 97 98#line 99 "parser/parser.c" 99 100# ifndef YY_CAST 101# ifdef __cplusplus 102# define YY_CAST(Type, Val) static_cast<Type> (Val) 103# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) 104# else 105# define YY_CAST(Type, Val) ((Type) (Val)) 106# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) 107# endif 108# endif 109# ifndef YY_NULLPTR 110# if defined __cplusplus 111# if 201103L <= __cplusplus 112# define YY_NULLPTR nullptr 113# else 114# define YY_NULLPTR 0 115# endif 116# else 117# define YY_NULLPTR ((void*)0) 118# endif 119# endif 120 121#include "parser.h" 122/* Symbol kind. */ 123enum yysymbol_kind_t 124{ 125 YYSYMBOL_YYEMPTY = -2, 126 YYSYMBOL_YYEOF = 0, /* "end of file" */ 127 YYSYMBOL_YYerror = 1, /* error */ 128 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ 129 YYSYMBOL_ASSERT_ = 3, /* ASSERT_ */ 130 YYSYMBOL_IF_ = 4, /* IF_ */ 131 YYSYMBOL_THEN = 5, /* THEN */ 132 YYSYMBOL_ELSE_ = 6, /* ELSE_ */ 133 YYSYMBOL_LET = 7, /* LET */ 134 YYSYMBOL_IN = 8, /* IN */ 135 YYSYMBOL_WITH = 9, /* WITH */ 136 YYSYMBOL_OR_ = 10, /* OR_ */ 137 YYSYMBOL_REC = 11, /* REC */ 138 YYSYMBOL_INHERIT = 12, /* INHERIT */ 139 YYSYMBOL_ELLIPSIS = 13, /* ELLIPSIS */ 140 YYSYMBOL_INTERP = 14, /* INTERP */ 141 YYSYMBOL_SPACE = 15, /* SPACE */ 142 YYSYMBOL_COMMENT = 16, /* COMMENT */ 143 YYSYMBOL_II = 17, /* II */ 144 YYSYMBOL_URI = 18, /* URI */ 145 YYSYMBOL_PATH = 19, /* PATH */ 146 YYSYMBOL_FLOAT = 20, /* FLOAT */ 147 YYSYMBOL_INT_ = 21, /* INT_ */ 148 YYSYMBOL_T_ID = 22, /* T_ID */ 149 YYSYMBOL_TEXT = 23, /* TEXT */ 150 YYSYMBOL_ARG_ID = 24, /* ARG_ID */ 151 YYSYMBOL_ARG_BRACKET = 25, /* ARG_BRACKET */ 152 YYSYMBOL_26_ = 26, /* ':' */ 153 YYSYMBOL_27_ = 27, /* '@' */ 154 YYSYMBOL_28_ = 28, /* ',' */ 155 YYSYMBOL_29_ = 29, /* ';' */ 156 YYSYMBOL_30_ = 30, /* '"' */ 157 YYSYMBOL_31_ = 31, /* '.' */ 158 YYSYMBOL_32_ = 32, /* '(' */ 159 YYSYMBOL_33_ = 33, /* ')' */ 160 YYSYMBOL_34_ = 34, /* '[' */ 161 YYSYMBOL_35_ = 35, /* ']' */ 162 YYSYMBOL_36_ = 36, /* '{' */ 163 YYSYMBOL_37_ = 37, /* '}' */ 164 YYSYMBOL_38_ = 38, /* '=' */ 165 YYSYMBOL_IMPL = 39, /* IMPL */ 166 YYSYMBOL_OR = 40, /* OR */ 167 YYSYMBOL_AND = 41, /* AND */ 168 YYSYMBOL_EQ = 42, /* EQ */ 169 YYSYMBOL_NEQ = 43, /* NEQ */ 170 YYSYMBOL_44_ = 44, /* '<' */ 171 YYSYMBOL_45_ = 45, /* '>' */ 172 YYSYMBOL_LEQ = 46, /* LEQ */ 173 YYSYMBOL_GEQ = 47, /* GEQ */ 174 YYSYMBOL_UPDATE = 48, /* UPDATE */ 175 YYSYMBOL_49_ = 49, /* '!' */ 176 YYSYMBOL_50_ = 50, /* '+' */ 177 YYSYMBOL_51_ = 51, /* '-' */ 178 YYSYMBOL_52_ = 52, /* '*' */ 179 YYSYMBOL_53_ = 53, /* '/' */ 180 YYSYMBOL_CONCAT = 54, /* CONCAT */ 181 YYSYMBOL_55_ = 55, /* '?' */ 182 YYSYMBOL_NEGATE = 56, /* NEGATE */ 183 YYSYMBOL_YYACCEPT = 57, /* $accept */ 184 YYSYMBOL_Main = 58, /* Main */ 185 YYSYMBOL_Expression = 59, /* Expression */ 186 YYSYMBOL_Interp = 60, /* Interp */ 187 YYSYMBOL_String = 61, /* String */ 188 YYSYMBOL_ID = 62, /* ID */ 189 YYSYMBOL_Atom = 63, /* Atom */ 190 YYSYMBOL_Select = 64, /* Select */ 191 YYSYMBOL_Apply = 65, /* Apply */ 192 YYSYMBOL_Op = 66, /* Op */ 193 YYSYMBOL_InterpID = 67, /* InterpID */ 194 YYSYMBOL_AttrPath = 68, /* AttrPath */ 195 YYSYMBOL_List = 69, /* List */ 196 YYSYMBOL_Binds = 70, /* Binds */ 197 YYSYMBOL_InheritList = 71, /* InheritList */ 198 YYSYMBOL_Function = 72, /* Function */ 199 YYSYMBOL_ArgSet = 73, /* ArgSet */ 200 YYSYMBOL_Arg = 74 /* Arg */ 201}; 202typedef enum yysymbol_kind_t yysymbol_kind_t; 203 204 205 206 207#ifdef short 208# undef short 209#endif 210 211/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure 212 <limits.h> and (if available) <stdint.h> are included 213 so that the code can choose integer types of a good width. */ 214 215#ifndef __PTRDIFF_MAX__ 216# include <limits.h> /* INFRINGES ON USER NAME SPACE */ 217# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ 218# include <stdint.h> /* INFRINGES ON USER NAME SPACE */ 219# define YY_STDINT_H 220# endif 221#endif 222 223/* Narrow types that promote to a signed type and that can represent a 224 signed or unsigned integer of at least N bits. In tables they can 225 save space and decrease cache pressure. Promoting to a signed type 226 helps avoid bugs in integer arithmetic. */ 227 228#ifdef __INT_LEAST8_MAX__ 229typedef __INT_LEAST8_TYPE__ yytype_int8; 230#elif defined YY_STDINT_H 231typedef int_least8_t yytype_int8; 232#else 233typedef signed char yytype_int8; 234#endif 235 236#ifdef __INT_LEAST16_MAX__ 237typedef __INT_LEAST16_TYPE__ yytype_int16; 238#elif defined YY_STDINT_H 239typedef int_least16_t yytype_int16; 240#else 241typedef short yytype_int16; 242#endif 243 244/* Work around bug in HP-UX 11.23, which defines these macros 245 incorrectly for preprocessor constants. This workaround can likely 246 be removed in 2023, as HPE has promised support for HP-UX 11.23 247 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of 248 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */ 249#ifdef __hpux 250# undef UINT_LEAST8_MAX 251# undef UINT_LEAST16_MAX 252# define UINT_LEAST8_MAX 255 253# define UINT_LEAST16_MAX 65535 254#endif 255 256#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ 257typedef __UINT_LEAST8_TYPE__ yytype_uint8; 258#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ 259 && UINT_LEAST8_MAX <= INT_MAX) 260typedef uint_least8_t yytype_uint8; 261#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX 262typedef unsigned char yytype_uint8; 263#else 264typedef short yytype_uint8; 265#endif 266 267#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ 268typedef __UINT_LEAST16_TYPE__ yytype_uint16; 269#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ 270 && UINT_LEAST16_MAX <= INT_MAX) 271typedef uint_least16_t yytype_uint16; 272#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX 273typedef unsigned short yytype_uint16; 274#else 275typedef int yytype_uint16; 276#endif 277 278#ifndef YYPTRDIFF_T 279# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ 280# define YYPTRDIFF_T __PTRDIFF_TYPE__ 281# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ 282# elif defined PTRDIFF_MAX 283# ifndef ptrdiff_t 284# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 285# endif 286# define YYPTRDIFF_T ptrdiff_t 287# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX 288# else 289# define YYPTRDIFF_T long 290# define YYPTRDIFF_MAXIMUM LONG_MAX 291# endif 292#endif 293 294#ifndef YYSIZE_T 295# ifdef __SIZE_TYPE__ 296# define YYSIZE_T __SIZE_TYPE__ 297# elif defined size_t 298# define YYSIZE_T size_t 299# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ 300# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 301# define YYSIZE_T size_t 302# else 303# define YYSIZE_T unsigned 304# endif 305#endif 306 307#define YYSIZE_MAXIMUM \ 308 YY_CAST (YYPTRDIFF_T, \ 309 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ 310 ? YYPTRDIFF_MAXIMUM \ 311 : YY_CAST (YYSIZE_T, -1))) 312 313#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) 314 315 316/* Stored state numbers (used for stacks). */ 317typedef yytype_uint8 yy_state_t; 318 319/* State numbers in computations. */ 320typedef int yy_state_fast_t; 321 322#ifndef YY_ 323# if defined YYENABLE_NLS && YYENABLE_NLS 324# if ENABLE_NLS 325# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 326# define YY_(Msgid) dgettext ("bison-runtime", Msgid) 327# endif 328# endif 329# ifndef YY_ 330# define YY_(Msgid) Msgid 331# endif 332#endif 333 334 335#ifndef YY_ATTRIBUTE_PURE 336# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) 337# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) 338# else 339# define YY_ATTRIBUTE_PURE 340# endif 341#endif 342 343#ifndef YY_ATTRIBUTE_UNUSED 344# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) 345# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 346# else 347# define YY_ATTRIBUTE_UNUSED 348# endif 349#endif 350 351/* Suppress unused-variable warnings by "using" E. */ 352#if ! defined lint || defined __GNUC__ 353# define YY_USE(E) ((void) (E)) 354#else 355# define YY_USE(E) /* empty */ 356#endif 357 358/* Suppress an incorrect diagnostic about yylval being uninitialized. */ 359#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ 360# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 361# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 362 _Pragma ("GCC diagnostic push") \ 363 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") 364# else 365# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 366 _Pragma ("GCC diagnostic push") \ 367 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ 368 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 369# endif 370# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 371 _Pragma ("GCC diagnostic pop") 372#else 373# define YY_INITIAL_VALUE(Value) Value 374#endif 375#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 376# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 377# define YY_IGNORE_MAYBE_UNINITIALIZED_END 378#endif 379#ifndef YY_INITIAL_VALUE 380# define YY_INITIAL_VALUE(Value) /* Nothing. */ 381#endif 382 383#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ 384# define YY_IGNORE_USELESS_CAST_BEGIN \ 385 _Pragma ("GCC diagnostic push") \ 386 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") 387# define YY_IGNORE_USELESS_CAST_END \ 388 _Pragma ("GCC diagnostic pop") 389#endif 390#ifndef YY_IGNORE_USELESS_CAST_BEGIN 391# define YY_IGNORE_USELESS_CAST_BEGIN 392# define YY_IGNORE_USELESS_CAST_END 393#endif 394 395 396#define YY_ASSERT(E) ((void) (0 && (E))) 397 398#if !defined yyoverflow 399 400/* The parser invokes alloca or malloc; define the necessary symbols. */ 401 402# ifdef YYSTACK_USE_ALLOCA 403# if YYSTACK_USE_ALLOCA 404# ifdef __GNUC__ 405# define YYSTACK_ALLOC __builtin_alloca 406# elif defined __BUILTIN_VA_ARG_INCR 407# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 408# elif defined _AIX 409# define YYSTACK_ALLOC __alloca 410# elif defined _MSC_VER 411# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 412# define alloca _alloca 413# else 414# define YYSTACK_ALLOC alloca 415# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 416# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 417 /* Use EXIT_SUCCESS as a witness for stdlib.h. */ 418# ifndef EXIT_SUCCESS 419# define EXIT_SUCCESS 0 420# endif 421# endif 422# endif 423# endif 424# endif 425 426# ifdef YYSTACK_ALLOC 427 /* Pacify GCC's 'empty if-body' warning. */ 428# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 429# ifndef YYSTACK_ALLOC_MAXIMUM 430 /* The OS might guarantee only one guard page at the bottom of the stack, 431 and a page size can be as small as 4096 bytes. So we cannot safely 432 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 433 to allow for a few compiler-allocated temporary stack slots. */ 434# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 435# endif 436# else 437# define YYSTACK_ALLOC YYMALLOC 438# define YYSTACK_FREE YYFREE 439# ifndef YYSTACK_ALLOC_MAXIMUM 440# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 441# endif 442# if (defined __cplusplus && ! defined EXIT_SUCCESS \ 443 && ! ((defined YYMALLOC || defined malloc) \ 444 && (defined YYFREE || defined free))) 445# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 446# ifndef EXIT_SUCCESS 447# define EXIT_SUCCESS 0 448# endif 449# endif 450# ifndef YYMALLOC 451# define YYMALLOC malloc 452# if ! defined malloc && ! defined EXIT_SUCCESS 453void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 454# endif 455# endif 456# ifndef YYFREE 457# define YYFREE free 458# if ! defined free && ! defined EXIT_SUCCESS 459void free (void *); /* INFRINGES ON USER NAME SPACE */ 460# endif 461# endif 462# endif 463#endif /* !defined yyoverflow */ 464 465#if (! defined yyoverflow \ 466 && (! defined __cplusplus \ 467 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 468 469/* A type that is properly aligned for any stack member. */ 470union yyalloc 471{ 472 yy_state_t yyss_alloc; 473 YYSTYPE yyvs_alloc; 474}; 475 476/* The size of the maximum gap between one aligned stack and the next. */ 477# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) 478 479/* The size of an array large to enough to hold all stacks, each with 480 N elements. */ 481# define YYSTACK_BYTES(N) \ 482 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ 483 + YYSTACK_GAP_MAXIMUM) 484 485# define YYCOPY_NEEDED 1 486 487/* Relocate STACK from its old location to the new one. The 488 local variables YYSIZE and YYSTACKSIZE give the old and new number of 489 elements in the stack, and YYPTR gives the new location of the 490 stack. Advance YYPTR to a properly aligned location for the next 491 stack. */ 492# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 493 do \ 494 { \ 495 YYPTRDIFF_T yynewbytes; \ 496 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 497 Stack = &yyptr->Stack_alloc; \ 498 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ 499 yyptr += yynewbytes / YYSIZEOF (*yyptr); \ 500 } \ 501 while (0) 502 503#endif 504 505#if defined YYCOPY_NEEDED && YYCOPY_NEEDED 506/* Copy COUNT objects from SRC to DST. The source and destination do 507 not overlap. */ 508# ifndef YYCOPY 509# if defined __GNUC__ && 1 < __GNUC__ 510# define YYCOPY(Dst, Src, Count) \ 511 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) 512# else 513# define YYCOPY(Dst, Src, Count) \ 514 do \ 515 { \ 516 YYPTRDIFF_T yyi; \ 517 for (yyi = 0; yyi < (Count); yyi++) \ 518 (Dst)[yyi] = (Src)[yyi]; \ 519 } \ 520 while (0) 521# endif 522# endif 523#endif /* !YYCOPY_NEEDED */ 524 525/* YYFINAL -- State number of the termination state. */ 526#define YYFINAL 46 527/* YYLAST -- Last index in YYTABLE. */ 528#define YYLAST 293 529 530/* YYNTOKENS -- Number of terminals. */ 531#define YYNTOKENS 57 532/* YYNNTS -- Number of nonterminals. */ 533#define YYNNTS 18 534/* YYNRULES -- Number of rules. */ 535#define YYNRULES 73 536/* YYNSTATES -- Number of states. */ 537#define YYNSTATES 149 538 539/* YYMAXUTOK -- Last valid token kind. */ 540#define YYMAXUTOK 290 541 542 543/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM 544 as returned by yylex, with out-of-bounds checking. */ 545#define YYTRANSLATE(YYX) \ 546 (0 <= (YYX) && (YYX) <= YYMAXUTOK \ 547 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ 548 : YYSYMBOL_YYUNDEF) 549 550/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM 551 as returned by yylex. */ 552static const yytype_int8 yytranslate[] = 553{ 554 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 557 2, 2, 2, 49, 30, 2, 2, 2, 2, 2, 558 32, 33, 52, 50, 28, 51, 31, 53, 2, 2, 559 2, 2, 2, 2, 2, 2, 2, 2, 26, 29, 560 44, 38, 45, 55, 27, 2, 2, 2, 2, 2, 561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 563 2, 34, 2, 35, 2, 2, 2, 2, 2, 2, 564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 566 2, 2, 2, 36, 2, 37, 2, 2, 2, 2, 567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 579 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 580 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 581 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 582 25, 39, 40, 41, 42, 43, 46, 47, 48, 54, 583 56 584}; 585 586#if YYDEBUG 587/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ 588static const yytype_uint8 yyrline[] = 589{ 590 0, 66, 66, 71, 72, 74, 76, 78, 80, 84, 591 90, 91, 93, 98, 103, 105, 107, 109, 111, 112, 592 114, 116, 118, 120, 122, 127, 128, 130, 135, 136, 593 141, 142, 144, 146, 148, 150, 152, 154, 156, 158, 594 160, 162, 164, 166, 168, 170, 172, 174, 176, 181, 595 182, 184, 185, 190, 192, 198, 199, 205, 206, 208, 596 210, 216, 217, 222, 224, 226, 228, 230, 236, 237, 597 239, 241, 246, 248 598}; 599#endif 600 601/** Accessing symbol of state STATE. */ 602#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) 603 604#if YYDEBUG || 0 605/* The user-facing name of the symbol whose (internal) number is 606 YYSYMBOL. No bounds checking. */ 607static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; 608 609/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 610 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 611static const char *const yytname[] = 612{ 613 "\"end of file\"", "error", "\"invalid token\"", "ASSERT_", "IF_", 614 "THEN", "ELSE_", "LET", "IN", "WITH", "OR_", "REC", "INHERIT", 615 "ELLIPSIS", "INTERP", "SPACE", "COMMENT", "II", "URI", "PATH", "FLOAT", 616 "INT_", "T_ID", "TEXT", "ARG_ID", "ARG_BRACKET", "':'", "'@'", "','", 617 "';'", "'\"'", "'.'", "'('", "')'", "'['", "']'", "'{'", "'}'", "'='", 618 "IMPL", "OR", "AND", "EQ", "NEQ", "'<'", "'>'", "LEQ", "GEQ", "UPDATE", 619 "'!'", "'+'", "'-'", "'*'", "'/'", "CONCAT", "'?'", "NEGATE", "$accept", 620 "Main", "Expression", "Interp", "String", "ID", "Atom", "Select", 621 "Apply", "Op", "InterpID", "AttrPath", "List", "Binds", "InheritList", 622 "Function", "ArgSet", "Arg", YY_NULLPTR 623}; 624 625static const char * 626yysymbol_name (yysymbol_kind_t yysymbol) 627{ 628 return yytname[yysymbol]; 629} 630#endif 631 632#define YYPACT_NINF (-91) 633 634#define yypact_value_is_default(Yyn) \ 635 ((Yyn) == YYPACT_NINF) 636 637#define YYTABLE_NINF (-1) 638 639#define yytable_value_is_error(Yyn) \ 640 ((Yyn) == YYTABLE_NINF) 641 642/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 643 STATE-NUM. */ 644static const yytype_int16 yypact[] = 645{ 646 127, 127, 127, -91, 127, -18, -91, -91, -91, -91, 647 -91, -91, 65, 13, -91, 127, -91, -91, 147, 147, 648 24, -91, -91, 25, -91, 189, 187, -91, 8, 56, 649 86, 43, -91, 76, 127, 63, -91, 40, 75, 74, 650 6, 81, 169, 48, 120, -91, -91, 95, -91, 147, 651 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 652 147, 147, 147, 147, 95, 127, 127, 127, -91, 89, 653 127, -91, -91, -91, -91, 36, 127, 67, -91, -91, 654 -91, -91, 13, 127, 96, 13, -91, -91, -91, -91, 655 -91, -3, 187, 202, 216, 230, 230, 238, 238, 238, 656 238, 238, 101, 101, 29, 29, 29, 87, -91, 122, 657 -91, 127, 1, 92, 57, 95, 127, -91, -91, 100, 658 -91, 127, 35, -91, 189, 127, 99, -91, -91, -91, 659 -91, -91, 104, 113, -91, 117, 124, -91, -91, -91, 660 -91, 127, 127, 127, 97, -91, -91, -91, -91 661}; 662 663/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. 664 Performed when YYTABLE does not specify something else to do. Zero 665 means the default is an error. */ 666static const yytype_int8 yydefact[] = 667{ 668 0, 0, 0, 57, 0, 0, 10, 14, 15, 16, 669 17, 13, 0, 68, 10, 0, 55, 57, 0, 0, 670 0, 2, 18, 25, 28, 30, 3, 8, 0, 0, 671 0, 0, 57, 0, 0, 0, 70, 72, 0, 69, 672 0, 0, 0, 0, 38, 31, 1, 0, 29, 0, 673 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 674 0, 0, 0, 0, 0, 0, 0, 0, 50, 61, 675 0, 10, 51, 49, 53, 0, 0, 0, 20, 11, 676 12, 63, 68, 0, 0, 68, 19, 21, 22, 56, 677 23, 26, 48, 47, 46, 45, 44, 43, 42, 41, 678 40, 39, 37, 36, 35, 34, 33, 32, 4, 0, 679 6, 0, 0, 0, 0, 0, 0, 7, 24, 0, 680 73, 0, 0, 71, 0, 0, 0, 59, 62, 9, 681 52, 54, 0, 0, 64, 0, 0, 27, 5, 61, 682 58, 0, 0, 0, 0, 65, 67, 66, 60 683}; 684 685/* YYPGOTO[NTERM-NUM]. */ 686static const yytype_int8 yypgoto[] = 687{ 688 -91, -91, -1, -28, -8, -9, -91, -23, -91, -10, 689 -90, -37, -91, 0, 21, -91, -69, -91 690}; 691 692/* YYDEFGOTO[NTERM-NUM]. */ 693static const yytype_int8 yydefgoto[] = 694{ 695 0, 20, 21, 72, 33, 22, 23, 24, 25, 26, 696 74, 75, 42, 30, 112, 27, 38, 39 697}; 698 699/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If 700 positive, shift that token. If negative, reduce the rule whose 701 number is the opposite. If YYTABLE_NINF, syntax error. */ 702static const yytype_int16 yytable[] = 703{ 704 28, 29, 48, 31, 37, 80, 40, 124, 44, 45, 705 91, 68, 80, 119, 41, 70, 123, 43, 32, 89, 706 70, 73, 128, 11, 46, 131, 36, 107, 115, 79, 707 127, 71, 77, 81, 73, 11, 86, 65, 73, 92, 708 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 709 103, 104, 105, 106, 128, 73, 47, 11, 68, 135, 710 69, 66, 70, 114, 108, 109, 110, 115, 73, 113, 711 11, 70, 76, 37, 116, 117, 37, 68, 71, 69, 712 79, 70, 120, 63, 64, 90, 80, 130, 82, 11, 713 70, 34, 35, 78, 67, 83, 68, 71, 69, 79, 714 70, 137, 85, 73, 118, 68, 73, 68, 11, 70, 715 126, 70, 84, 136, 87, 132, 71, 11, 115, 11, 716 134, 111, 121, 122, 138, 71, 148, 71, 125, 129, 717 1, 2, 139, 140, 3, 73, 4, 133, 5, 141, 718 145, 146, 147, 142, 6, 7, 8, 9, 10, 11, 719 143, 12, 13, 61, 62, 63, 64, 14, 5, 15, 720 144, 16, 0, 17, 6, 7, 8, 9, 10, 11, 721 59, 60, 61, 62, 63, 64, 18, 14, 19, 15, 722 5, 16, 0, 17, 0, 0, 6, 7, 8, 9, 723 10, 11, 0, 0, 0, 0, 18, 0, 19, 14, 724 5, 15, 0, 16, 88, 17, 6, 7, 8, 9, 725 10, 11, 0, 0, 0, 0, 0, 0, 0, 14, 726 0, 15, 0, 16, 0, 17, 49, 50, 51, 52, 727 53, 54, 55, 56, 57, 58, 0, 59, 60, 61, 728 62, 63, 64, 51, 52, 53, 54, 55, 56, 57, 729 58, 0, 59, 60, 61, 62, 63, 64, 52, 53, 730 54, 55, 56, 57, 58, 0, 59, 60, 61, 62, 731 63, 64, -1, -1, 54, 55, 56, 57, 58, 0, 732 59, 60, 61, 62, 63, 64, 58, 0, 59, 60, 733 61, 62, 63, 64 734}; 735 736static const yytype_int16 yycheck[] = 737{ 738 1, 2, 25, 4, 13, 33, 14, 10, 18, 19, 739 47, 10, 40, 82, 15, 14, 85, 17, 36, 42, 740 14, 30, 112, 22, 0, 115, 13, 64, 31, 23, 741 29, 30, 32, 34, 43, 22, 30, 29, 47, 49, 742 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 743 60, 61, 62, 63, 144, 64, 31, 22, 10, 24, 744 12, 5, 14, 71, 65, 66, 67, 31, 77, 70, 745 22, 14, 29, 82, 38, 76, 85, 10, 30, 12, 746 23, 14, 83, 54, 55, 37, 114, 30, 25, 22, 747 14, 26, 27, 17, 8, 55, 10, 30, 12, 23, 748 14, 124, 28, 112, 37, 10, 115, 10, 22, 14, 749 111, 14, 37, 122, 33, 116, 30, 22, 31, 22, 750 121, 32, 26, 27, 125, 30, 29, 30, 6, 37, 751 3, 4, 33, 29, 7, 144, 9, 37, 11, 26, 752 141, 142, 143, 26, 17, 18, 19, 20, 21, 22, 753 26, 24, 25, 52, 53, 54, 55, 30, 11, 32, 754 139, 34, -1, 36, 17, 18, 19, 20, 21, 22, 755 50, 51, 52, 53, 54, 55, 49, 30, 51, 32, 756 11, 34, -1, 36, -1, -1, 17, 18, 19, 20, 757 21, 22, -1, -1, -1, -1, 49, -1, 51, 30, 758 11, 32, -1, 34, 35, 36, 17, 18, 19, 20, 759 21, 22, -1, -1, -1, -1, -1, -1, -1, 30, 760 -1, 32, -1, 34, -1, 36, 39, 40, 41, 42, 761 43, 44, 45, 46, 47, 48, -1, 50, 51, 52, 762 53, 54, 55, 41, 42, 43, 44, 45, 46, 47, 763 48, -1, 50, 51, 52, 53, 54, 55, 42, 43, 764 44, 45, 46, 47, 48, -1, 50, 51, 52, 53, 765 54, 55, 42, 43, 44, 45, 46, 47, 48, -1, 766 50, 51, 52, 53, 54, 55, 48, -1, 50, 51, 767 52, 53, 54, 55 768}; 769 770/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of 771 state STATE-NUM. */ 772static const yytype_int8 yystos[] = 773{ 774 0, 3, 4, 7, 9, 11, 17, 18, 19, 20, 775 21, 22, 24, 25, 30, 32, 34, 36, 49, 51, 776 58, 59, 62, 63, 64, 65, 66, 72, 59, 59, 777 70, 59, 36, 61, 26, 27, 13, 62, 73, 74, 778 61, 59, 69, 70, 66, 66, 0, 31, 64, 39, 779 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 780 51, 52, 53, 54, 55, 29, 5, 8, 10, 12, 781 14, 30, 60, 62, 67, 68, 29, 70, 17, 23, 782 60, 59, 25, 55, 37, 28, 30, 33, 35, 64, 783 37, 68, 66, 66, 66, 66, 66, 66, 66, 66, 784 66, 66, 66, 66, 66, 66, 66, 68, 59, 59, 785 59, 32, 71, 59, 61, 31, 38, 59, 37, 73, 786 59, 26, 27, 73, 10, 6, 59, 29, 67, 37, 787 30, 67, 59, 37, 59, 24, 62, 64, 59, 33, 788 29, 26, 26, 26, 71, 59, 59, 59, 29 789}; 790 791/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ 792static const yytype_int8 yyr1[] = 793{ 794 0, 57, 58, 59, 59, 59, 59, 59, 59, 60, 795 61, 61, 61, 62, 63, 63, 63, 63, 63, 63, 796 63, 63, 63, 63, 63, 64, 64, 64, 65, 65, 797 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 798 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, 799 67, 67, 67, 68, 68, 69, 69, 70, 70, 70, 800 70, 71, 71, 72, 72, 72, 72, 72, 73, 73, 801 73, 73, 74, 74 802}; 803 804/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ 805static const yytype_int8 yyr2[] = 806{ 807 0, 2, 1, 1, 4, 6, 4, 4, 1, 3, 808 0, 2, 2, 1, 1, 1, 1, 1, 1, 3, 809 3, 3, 3, 3, 4, 1, 3, 5, 1, 2, 810 1, 2, 3, 3, 3, 3, 3, 3, 2, 3, 811 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 812 1, 1, 3, 1, 3, 0, 2, 0, 5, 4, 813 7, 0, 2, 3, 5, 7, 7, 7, 0, 1, 814 1, 3, 1, 3 815}; 816 817 818enum { YYENOMEM = -2 }; 819 820#define yyerrok (yyerrstatus = 0) 821#define yyclearin (yychar = YYEMPTY) 822 823#define YYACCEPT goto yyacceptlab 824#define YYABORT goto yyabortlab 825#define YYERROR goto yyerrorlab 826#define YYNOMEM goto yyexhaustedlab 827 828 829#define YYRECOVERING() (!!yyerrstatus) 830 831#define YYBACKUP(Token, Value) \ 832 do \ 833 if (yychar == YYEMPTY) \ 834 { \ 835 yychar = (Token); \ 836 yylval = (Value); \ 837 YYPOPSTACK (yylen); \ 838 yystate = *yyssp; \ 839 goto yybackup; \ 840 } \ 841 else \ 842 { \ 843 yyerror (ast_root, scanner, YY_("syntax error: cannot back up")); \ 844 YYERROR; \ 845 } \ 846 while (0) 847 848/* Backward compatibility with an undocumented macro. 849 Use YYerror or YYUNDEF. */ 850#define YYERRCODE YYUNDEF 851 852 853/* Enable debugging if requested. */ 854#if YYDEBUG 855 856# ifndef YYFPRINTF 857# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 858# define YYFPRINTF fprintf 859# endif 860 861# define YYDPRINTF(Args) \ 862do { \ 863 if (yydebug) \ 864 YYFPRINTF Args; \ 865} while (0) 866 867 868 869 870# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ 871do { \ 872 if (yydebug) \ 873 { \ 874 YYFPRINTF (stderr, "%s ", Title); \ 875 yy_symbol_print (stderr, \ 876 Kind, Value, ast_root, scanner); \ 877 YYFPRINTF (stderr, "\n"); \ 878 } \ 879} while (0) 880 881 882/*-----------------------------------. 883| Print this symbol's value on YYO. | 884`-----------------------------------*/ 885 886static void 887yy_symbol_value_print (FILE *yyo, 888 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void** ast_root, void* scanner) 889{ 890 FILE *yyoutput = yyo; 891 YY_USE (yyoutput); 892 YY_USE (ast_root); 893 YY_USE (scanner); 894 if (!yyvaluep) 895 return; 896 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 897 YY_USE (yykind); 898 YY_IGNORE_MAYBE_UNINITIALIZED_END 899} 900 901 902/*---------------------------. 903| Print this symbol on YYO. | 904`---------------------------*/ 905 906static void 907yy_symbol_print (FILE *yyo, 908 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void** ast_root, void* scanner) 909{ 910 YYFPRINTF (yyo, "%s %s (", 911 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); 912 913 yy_symbol_value_print (yyo, yykind, yyvaluep, ast_root, scanner); 914 YYFPRINTF (yyo, ")"); 915} 916 917/*------------------------------------------------------------------. 918| yy_stack_print -- Print the state stack from its BOTTOM up to its | 919| TOP (included). | 920`------------------------------------------------------------------*/ 921 922static void 923yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) 924{ 925 YYFPRINTF (stderr, "Stack now"); 926 for (; yybottom <= yytop; yybottom++) 927 { 928 int yybot = *yybottom; 929 YYFPRINTF (stderr, " %d", yybot); 930 } 931 YYFPRINTF (stderr, "\n"); 932} 933 934# define YY_STACK_PRINT(Bottom, Top) \ 935do { \ 936 if (yydebug) \ 937 yy_stack_print ((Bottom), (Top)); \ 938} while (0) 939 940 941/*------------------------------------------------. 942| Report that the YYRULE is going to be reduced. | 943`------------------------------------------------*/ 944 945static void 946yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, 947 int yyrule, void** ast_root, void* scanner) 948{ 949 int yylno = yyrline[yyrule]; 950 int yynrhs = yyr2[yyrule]; 951 int yyi; 952 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", 953 yyrule - 1, yylno); 954 /* The symbols being reduced. */ 955 for (yyi = 0; yyi < yynrhs; yyi++) 956 { 957 YYFPRINTF (stderr, " $%d = ", yyi + 1); 958 yy_symbol_print (stderr, 959 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), 960 &yyvsp[(yyi + 1) - (yynrhs)], ast_root, scanner); 961 YYFPRINTF (stderr, "\n"); 962 } 963} 964 965# define YY_REDUCE_PRINT(Rule) \ 966do { \ 967 if (yydebug) \ 968 yy_reduce_print (yyssp, yyvsp, Rule, ast_root, scanner); \ 969} while (0) 970 971/* Nonzero means print parse trace. It is left uninitialized so that 972 multiple parsers can coexist. */ 973int yydebug; 974#else /* !YYDEBUG */ 975# define YYDPRINTF(Args) ((void) 0) 976# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) 977# define YY_STACK_PRINT(Bottom, Top) 978# define YY_REDUCE_PRINT(Rule) 979#endif /* !YYDEBUG */ 980 981 982/* YYINITDEPTH -- initial size of the parser's stacks. */ 983#ifndef YYINITDEPTH 984# define YYINITDEPTH 200 985#endif 986 987/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 988 if the built-in stack extension method is used). 989 990 Do not make this value too large; the results are undefined if 991 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 992 evaluated with infinite-precision integer arithmetic. */ 993 994#ifndef YYMAXDEPTH 995# define YYMAXDEPTH 10000 996#endif 997 998 999 1000 1001 1002 1003/*-----------------------------------------------. 1004| Release the memory associated to this symbol. | 1005`-----------------------------------------------*/ 1006 1007static void 1008yydestruct (const char *yymsg, 1009 yysymbol_kind_t yykind, YYSTYPE *yyvaluep, void** ast_root, void* scanner) 1010{ 1011 YY_USE (yyvaluep); 1012 YY_USE (ast_root); 1013 YY_USE (scanner); 1014 if (!yymsg) 1015 yymsg = "Deleting"; 1016 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); 1017 1018 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1019 YY_USE (yykind); 1020 YY_IGNORE_MAYBE_UNINITIALIZED_END 1021} 1022 1023 1024 1025 1026 1027 1028/*----------. 1029| yyparse. | 1030`----------*/ 1031 1032int 1033yyparse (void** ast_root, void* scanner) 1034{ 1035/* Lookahead token kind. */ 1036int yychar; 1037 1038 1039/* The semantic value of the lookahead symbol. */ 1040/* Default value used for initialization, for pacifying older GCCs 1041 or non-GCC compilers. */ 1042YY_INITIAL_VALUE (static YYSTYPE yyval_default;) 1043YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); 1044 1045 /* Number of syntax errors so far. */ 1046 int yynerrs = 0; 1047 1048 yy_state_fast_t yystate = 0; 1049 /* Number of tokens to shift before error messages enabled. */ 1050 int yyerrstatus = 0; 1051 1052 /* Refer to the stacks through separate pointers, to allow yyoverflow 1053 to reallocate them elsewhere. */ 1054 1055 /* Their size. */ 1056 YYPTRDIFF_T yystacksize = YYINITDEPTH; 1057 1058 /* The state stack: array, bottom, top. */ 1059 yy_state_t yyssa[YYINITDEPTH]; 1060 yy_state_t *yyss = yyssa; 1061 yy_state_t *yyssp = yyss; 1062 1063 /* The semantic value stack: array, bottom, top. */ 1064 YYSTYPE yyvsa[YYINITDEPTH]; 1065 YYSTYPE *yyvs = yyvsa; 1066 YYSTYPE *yyvsp = yyvs; 1067 1068 int yyn; 1069 /* The return value of yyparse. */ 1070 int yyresult; 1071 /* Lookahead symbol kind. */ 1072 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; 1073 /* The variables used to return semantic value and location from the 1074 action routines. */ 1075 YYSTYPE yyval; 1076 1077 1078 1079#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1080 1081 /* The number of symbols on the RHS of the reduced rule. 1082 Keep to zero when no symbol should be popped. */ 1083 int yylen = 0; 1084 1085 YYDPRINTF ((stderr, "Starting parse\n")); 1086 1087 yychar = YYEMPTY; /* Cause a token to be read. */ 1088 1089 goto yysetstate; 1090 1091 1092/*------------------------------------------------------------. 1093| yynewstate -- push a new state, which is found in yystate. | 1094`------------------------------------------------------------*/ 1095yynewstate: 1096 /* In all cases, when you get here, the value and location stacks 1097 have just been pushed. So pushing a state here evens the stacks. */ 1098 yyssp++; 1099 1100 1101/*--------------------------------------------------------------------. 1102| yysetstate -- set current state (the top of the stack) to yystate. | 1103`--------------------------------------------------------------------*/ 1104yysetstate: 1105 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1106 YY_ASSERT (0 <= yystate && yystate < YYNSTATES); 1107 YY_IGNORE_USELESS_CAST_BEGIN 1108 *yyssp = YY_CAST (yy_state_t, yystate); 1109 YY_IGNORE_USELESS_CAST_END 1110 YY_STACK_PRINT (yyss, yyssp); 1111 1112 if (yyss + yystacksize - 1 <= yyssp) 1113#if !defined yyoverflow && !defined YYSTACK_RELOCATE 1114 YYNOMEM; 1115#else 1116 { 1117 /* Get the current used size of the three stacks, in elements. */ 1118 YYPTRDIFF_T yysize = yyssp - yyss + 1; 1119 1120# if defined yyoverflow 1121 { 1122 /* Give user a chance to reallocate the stack. Use copies of 1123 these so that the &'s don't force the real ones into 1124 memory. */ 1125 yy_state_t *yyss1 = yyss; 1126 YYSTYPE *yyvs1 = yyvs; 1127 1128 /* Each stack pointer address is followed by the size of the 1129 data in use in that stack, in bytes. This used to be a 1130 conditional around just the two extra args, but that might 1131 be undefined if yyoverflow is a macro. */ 1132 yyoverflow (YY_("memory exhausted"), 1133 &yyss1, yysize * YYSIZEOF (*yyssp), 1134 &yyvs1, yysize * YYSIZEOF (*yyvsp), 1135 &yystacksize); 1136 yyss = yyss1; 1137 yyvs = yyvs1; 1138 } 1139# else /* defined YYSTACK_RELOCATE */ 1140 /* Extend the stack our own way. */ 1141 if (YYMAXDEPTH <= yystacksize) 1142 YYNOMEM; 1143 yystacksize *= 2; 1144 if (YYMAXDEPTH < yystacksize) 1145 yystacksize = YYMAXDEPTH; 1146 1147 { 1148 yy_state_t *yyss1 = yyss; 1149 union yyalloc *yyptr = 1150 YY_CAST (union yyalloc *, 1151 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); 1152 if (! yyptr) 1153 YYNOMEM; 1154 YYSTACK_RELOCATE (yyss_alloc, yyss); 1155 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1156# undef YYSTACK_RELOCATE 1157 if (yyss1 != yyssa) 1158 YYSTACK_FREE (yyss1); 1159 } 1160# endif 1161 1162 yyssp = yyss + yysize - 1; 1163 yyvsp = yyvs + yysize - 1; 1164 1165 YY_IGNORE_USELESS_CAST_BEGIN 1166 YYDPRINTF ((stderr, "Stack size increased to %ld\n", 1167 YY_CAST (long, yystacksize))); 1168 YY_IGNORE_USELESS_CAST_END 1169 1170 if (yyss + yystacksize - 1 <= yyssp) 1171 YYABORT; 1172 } 1173#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ 1174 1175 1176 if (yystate == YYFINAL) 1177 YYACCEPT; 1178 1179 goto yybackup; 1180 1181 1182/*-----------. 1183| yybackup. | 1184`-----------*/ 1185yybackup: 1186 /* Do appropriate processing given the current state. Read a 1187 lookahead token if we need one and don't already have one. */ 1188 1189 /* First try to decide what to do without reference to lookahead token. */ 1190 yyn = yypact[yystate]; 1191 if (yypact_value_is_default (yyn)) 1192 goto yydefault; 1193 1194 /* Not known => get a lookahead token if don't already have one. */ 1195 1196 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ 1197 if (yychar == YYEMPTY) 1198 { 1199 YYDPRINTF ((stderr, "Reading a token\n")); 1200 yychar = yylex (&yylval, scanner); 1201 } 1202 1203 if (yychar <= YYEOF) 1204 { 1205 yychar = YYEOF; 1206 yytoken = YYSYMBOL_YYEOF; 1207 YYDPRINTF ((stderr, "Now at end of input.\n")); 1208 } 1209 else if (yychar == YYerror) 1210 { 1211 /* The scanner already issued an error message, process directly 1212 to error recovery. But do not keep the error token as 1213 lookahead, it is too special and may lead us to an endless 1214 loop in error recovery. */ 1215 yychar = YYUNDEF; 1216 yytoken = YYSYMBOL_YYerror; 1217 goto yyerrlab1; 1218 } 1219 else 1220 { 1221 yytoken = YYTRANSLATE (yychar); 1222 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1223 } 1224 1225 /* If the proper action on seeing token YYTOKEN is to reduce or to 1226 detect an error, take that action. */ 1227 yyn += yytoken; 1228 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1229 goto yydefault; 1230 yyn = yytable[yyn]; 1231 if (yyn <= 0) 1232 { 1233 if (yytable_value_is_error (yyn)) 1234 goto yyerrlab; 1235 yyn = -yyn; 1236 goto yyreduce; 1237 } 1238 1239 /* Count tokens shifted since error; after three, turn off error 1240 status. */ 1241 if (yyerrstatus) 1242 yyerrstatus--; 1243 1244 /* Shift the lookahead token. */ 1245 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1246 yystate = yyn; 1247 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1248 *++yyvsp = yylval; 1249 YY_IGNORE_MAYBE_UNINITIALIZED_END 1250 1251 /* Discard the shifted token. */ 1252 yychar = YYEMPTY; 1253 goto yynewstate; 1254 1255 1256/*-----------------------------------------------------------. 1257| yydefault -- do the default action for the current state. | 1258`-----------------------------------------------------------*/ 1259yydefault: 1260 yyn = yydefact[yystate]; 1261 if (yyn == 0) 1262 goto yyerrlab; 1263 goto yyreduce; 1264 1265 1266/*-----------------------------. 1267| yyreduce -- do a reduction. | 1268`-----------------------------*/ 1269yyreduce: 1270 /* yyn is the number of a rule to reduce with. */ 1271 yylen = yyr2[yyn]; 1272 1273 /* If YYLEN is nonzero, implement the default value of the action: 1274 '$$ = $1'. 1275 1276 Otherwise, the following line sets YYVAL to garbage. 1277 This behavior is undocumented and Bison 1278 users should not rely upon it. Assigning to YYVAL 1279 unconditionally makes the parser a bit smaller, and it avoids a 1280 GCC warning that YYVAL may be used uninitialized. */ 1281 yyval = yyvsp[1-yylen]; 1282 1283 1284 YY_REDUCE_PRINT (yyn); 1285 switch (yyn) 1286 { 1287 case 2: /* Main: Expression */ 1288#line 67 "parser/parser.y" 1289{ *ast_root = (yyvsp[0].node); } 1290#line 1291 "parser/parser.c" 1291 break; 1292 1293 case 4: /* Expression: ASSERT_ Expression ';' Expression */ 1294#line 73 "parser/parser.y" 1295{ (yyval.node) = new_node2(ASSERT_NODE, (yyvsp[-3].token), (yyvsp[-2].node), (yyvsp[0].node)); set_token_end((yyval.node), (yyvsp[-1].token)); } 1296#line 1297 "parser/parser.c" 1297 break; 1298 1299 case 5: /* Expression: IF_ Expression THEN Expression ELSE_ Expression */ 1300#line 75 "parser/parser.y" 1301{ (yyval.node) = new_node3(IF_NODE, (yyvsp[-5].token), (yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[0].node)); set_token_end((yyval.node), (yyvsp[-3].token)); } 1302#line 1303 "parser/parser.c" 1303 break; 1304 1305 case 6: /* Expression: LET Binds IN Expression */ 1306#line 77 "parser/parser.y" 1307{ (yyval.node) = new_node2(LET_NODE, (yyvsp[-3].token), (yyvsp[-2].node), (yyvsp[0].node)); set_token_end((yyval.node), (yyvsp[-1].token)); } 1308#line 1309 "parser/parser.c" 1309 break; 1310 1311 case 7: /* Expression: WITH Expression ';' Expression */ 1312#line 79 "parser/parser.y" 1313{ (yyval.node) = new_node2(WITH_NODE, (yyvsp[-3].token), (yyvsp[-2].node), (yyvsp[0].node)); set_token_end((yyval.node), (yyvsp[-1].token)); } 1314#line 1315 "parser/parser.c" 1315 break; 1316 1317 case 9: /* Interp: INTERP Expression '}' */ 1318#line 85 "parser/parser.y" 1319{ (yyval.node) = new_node1(INTERP_NODE, (yyvsp[-2].token), (yyvsp[-1].node)); set_token_end((yyval.node), (yyvsp[0].token)); } 1320#line 1321 "parser/parser.c" 1321 break; 1322 1323 case 10: /* String: %empty */ 1324#line 90 "parser/parser.y" 1325{ (yyval.node) = new_node(STRING_NODE, 0); } 1326#line 1327 "parser/parser.c" 1327 break; 1328 1329 case 11: /* String: String TEXT */ 1330#line 92 "parser/parser.y" 1331{ add_child((yyvsp[-1].node), new_node(TEXT_NODE, (yyvsp[0].token))); (yyval.node) = (yyvsp[-1].node); } 1332#line 1333 "parser/parser.c" 1333 break; 1334 1335 case 12: /* String: String Interp */ 1336#line 94 "parser/parser.y" 1337{ add_child((yyvsp[-1].node), (yyvsp[0].node)); (yyval.node) = (yyvsp[-1].node); } 1338#line 1339 "parser/parser.c" 1339 break; 1340 1341 case 13: /* ID: T_ID */ 1342#line 99 "parser/parser.y" 1343{ (yyval.node) = new_node(ID_NODE, (yyvsp[0].token)); } 1344#line 1345 "parser/parser.c" 1345 break; 1346 1347 case 14: /* Atom: URI */ 1348#line 104 "parser/parser.y" 1349{ (yyval.node) = new_node(URI_NODE, (yyvsp[0].token)); } 1350#line 1351 "parser/parser.c" 1351 break; 1352 1353 case 15: /* Atom: PATH */ 1354#line 106 "parser/parser.y" 1355{ (yyval.node) = new_node(PATH_NODE, (yyvsp[0].token)); } 1356#line 1357 "parser/parser.c" 1357 break; 1358 1359 case 16: /* Atom: FLOAT */ 1360#line 108 "parser/parser.y" 1361{ (yyval.node) = new_node(FLOAT_NODE, (yyvsp[0].token)); } 1362#line 1363 "parser/parser.c" 1363 break; 1364 1365 case 17: /* Atom: INT_ */ 1366#line 110 "parser/parser.y" 1367{ (yyval.node) = new_node(INT_NODE, (yyvsp[0].token)); } 1368#line 1369 "parser/parser.c" 1369 break; 1370 1371 case 19: /* Atom: '"' String '"' */ 1372#line 113 "parser/parser.y" 1373{ set_token_end((yyvsp[-1].node), (yyvsp[0].token)); (yyval.node) = (yyvsp[-1].node); } 1374#line 1375 "parser/parser.c" 1375 break; 1376 1377 case 20: /* Atom: II String II */ 1378#line 115 "parser/parser.y" 1379{ set_node_type((yyvsp[-1].node), I_STRING_NODE); set_token_end((yyvsp[-1].node), (yyvsp[0].token)); (yyval.node) = (yyvsp[-1].node); } 1380#line 1381 "parser/parser.c" 1381 break; 1382 1383 case 21: /* Atom: '(' Expression ')' */ 1384#line 117 "parser/parser.y" 1385{ (yyval.node) = new_node1(PARENS_NODE, (yyvsp[-2].token), (yyvsp[-1].node)); set_token_end((yyval.node), (yyvsp[0].token)); } 1386#line 1387 "parser/parser.c" 1387 break; 1388 1389 case 22: /* Atom: '[' List ']' */ 1390#line 119 "parser/parser.y" 1391{ set_token_end((yyvsp[-1].node), (yyvsp[0].token)); (yyval.node) = (yyvsp[-1].node); } 1392#line 1393 "parser/parser.c" 1393 break; 1394 1395 case 23: /* Atom: '{' Binds '}' */ 1396#line 121 "parser/parser.y" 1397{ set_node_type((yyvsp[-1].node), SET_NODE); set_token_end((yyvsp[-1].node), (yyvsp[0].token)); (yyval.node) = (yyvsp[-1].node); } 1398#line 1399 "parser/parser.c" 1399 break; 1400 1401 case 24: /* Atom: REC '{' Binds '}' */ 1402#line 123 "parser/parser.y" 1403{ set_node_type((yyvsp[-1].node), REC_SET_NODE); set_token_end((yyvsp[-1].node), (yyvsp[0].token)); (yyval.node) = (yyvsp[-1].node); } 1404#line 1405 "parser/parser.c" 1405 break; 1406 1407 case 26: /* Select: Atom '.' AttrPath */ 1408#line 129 "parser/parser.y" 1409{ (yyval.node) = new_node2(SELECT_NODE, (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1410#line 1411 "parser/parser.c" 1411 break; 1412 1413 case 27: /* Select: Atom '.' AttrPath OR_ Select */ 1414#line 131 "parser/parser.y" 1415{ (yyval.node) = new_node3(SELECT_OR_NODE, (yyvsp[-3].token), (yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[0].node)); set_token_end((yyval.node), (yyvsp[-1].token)); } 1416#line 1417 "parser/parser.c" 1417 break; 1418 1419 case 29: /* Apply: Apply Select */ 1420#line 137 "parser/parser.y" 1421{ (yyval.node) = new_node2(APPLY_NODE, 0, (yyvsp[-1].node), (yyvsp[0].node)); } 1422#line 1423 "parser/parser.c" 1423 break; 1424 1425 case 31: /* Op: '-' Op */ 1426#line 143 "parser/parser.y" 1427{ (yyval.node) = op_node1('-', (yyvsp[-1].token), (yyvsp[0].node)); } 1428#line 1429 "parser/parser.c" 1429 break; 1430 1431 case 32: /* Op: Op '?' AttrPath */ 1432#line 145 "parser/parser.y" 1433{ (yyval.node) = op_node2('?', (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1434#line 1435 "parser/parser.c" 1435 break; 1436 1437 case 33: /* Op: Op CONCAT Op */ 1438#line 147 "parser/parser.y" 1439{ (yyval.node) = op_node2(CONCAT, (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1440#line 1441 "parser/parser.c" 1441 break; 1442 1443 case 34: /* Op: Op '/' Op */ 1444#line 149 "parser/parser.y" 1445{ (yyval.node) = op_node2('/', (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1446#line 1447 "parser/parser.c" 1447 break; 1448 1449 case 35: /* Op: Op '*' Op */ 1450#line 151 "parser/parser.y" 1451{ (yyval.node) = op_node2('*', (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1452#line 1453 "parser/parser.c" 1453 break; 1454 1455 case 36: /* Op: Op '-' Op */ 1456#line 153 "parser/parser.y" 1457{ (yyval.node) = op_node2('-', (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1458#line 1459 "parser/parser.c" 1459 break; 1460 1461 case 37: /* Op: Op '+' Op */ 1462#line 155 "parser/parser.y" 1463{ (yyval.node) = op_node2('+', (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1464#line 1465 "parser/parser.c" 1465 break; 1466 1467 case 38: /* Op: '!' Op */ 1468#line 157 "parser/parser.y" 1469{ (yyval.node) = op_node1('!', (yyvsp[-1].token), (yyvsp[0].node)); } 1470#line 1471 "parser/parser.c" 1471 break; 1472 1473 case 39: /* Op: Op UPDATE Op */ 1474#line 159 "parser/parser.y" 1475{ (yyval.node) = op_node2(UPDATE, (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1476#line 1477 "parser/parser.c" 1477 break; 1478 1479 case 40: /* Op: Op GEQ Op */ 1480#line 161 "parser/parser.y" 1481{ (yyval.node) = op_node2(GEQ, (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1482#line 1483 "parser/parser.c" 1483 break; 1484 1485 case 41: /* Op: Op LEQ Op */ 1486#line 163 "parser/parser.y" 1487{ (yyval.node) = op_node2(LEQ, (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1488#line 1489 "parser/parser.c" 1489 break; 1490 1491 case 42: /* Op: Op '>' Op */ 1492#line 165 "parser/parser.y" 1493{ (yyval.node) = op_node2('>', (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1494#line 1495 "parser/parser.c" 1495 break; 1496 1497 case 43: /* Op: Op '<' Op */ 1498#line 167 "parser/parser.y" 1499{ (yyval.node) = op_node2('<', (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1500#line 1501 "parser/parser.c" 1501 break; 1502 1503 case 44: /* Op: Op NEQ Op */ 1504#line 169 "parser/parser.y" 1505{ (yyval.node) = op_node2(NEQ, (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1506#line 1507 "parser/parser.c" 1507 break; 1508 1509 case 45: /* Op: Op EQ Op */ 1510#line 171 "parser/parser.y" 1511{ (yyval.node) = op_node2(EQ, (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1512#line 1513 "parser/parser.c" 1513 break; 1514 1515 case 46: /* Op: Op AND Op */ 1516#line 173 "parser/parser.y" 1517{ (yyval.node) = op_node2(AND, (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1518#line 1519 "parser/parser.c" 1519 break; 1520 1521 case 47: /* Op: Op OR Op */ 1522#line 175 "parser/parser.y" 1523{ (yyval.node) = op_node2(OR, (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1524#line 1525 "parser/parser.c" 1525 break; 1526 1527 case 48: /* Op: Op IMPL Op */ 1528#line 177 "parser/parser.y" 1529{ (yyval.node) = op_node2(IMPL, (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1530#line 1531 "parser/parser.c" 1531 break; 1532 1533 case 50: /* InterpID: OR_ */ 1534#line 183 "parser/parser.y" 1535{ (yyval.node) = new_node(ID_NODE, (yyvsp[0].token)); } 1536#line 1537 "parser/parser.c" 1537 break; 1538 1539 case 52: /* InterpID: '"' String '"' */ 1540#line 186 "parser/parser.y" 1541{ set_token_end((yyvsp[-1].node), (yyvsp[0].token)); (yyval.node) = (yyvsp[-1].node); } 1542#line 1543 "parser/parser.c" 1543 break; 1544 1545 case 53: /* AttrPath: InterpID */ 1546#line 191 "parser/parser.y" 1547{ (yyval.node) = new_node1(ATTR_PATH_NODE, 0, (yyvsp[0].node)); } 1548#line 1549 "parser/parser.c" 1549 break; 1550 1551 case 54: /* AttrPath: AttrPath '.' InterpID */ 1552#line 193 "parser/parser.y" 1553{ add_child((yyvsp[-2].node), (yyvsp[0].node)); set_token_end((yyvsp[-2].node), 0); (yyval.node) = (yyvsp[-2].node); } 1554#line 1555 "parser/parser.c" 1555 break; 1556 1557 case 55: /* List: %empty */ 1558#line 198 "parser/parser.y" 1559{ (yyval.node) = new_node(LIST_NODE, 0); } 1560#line 1561 "parser/parser.c" 1561 break; 1562 1563 case 56: /* List: List Select */ 1564#line 200 "parser/parser.y" 1565{ add_child((yyvsp[-1].node), (yyvsp[0].node)); (yyval.node) = (yyvsp[-1].node); } 1566#line 1567 "parser/parser.c" 1567 break; 1568 1569 case 57: /* Binds: %empty */ 1570#line 205 "parser/parser.y" 1571{ (yyval.node) = new_node(BINDS_NODE, 0); } 1572#line 1573 "parser/parser.c" 1573 break; 1574 1575 case 58: /* Binds: Binds AttrPath '=' Expression ';' */ 1576#line 207 "parser/parser.y" 1577{ add_child((yyvsp[-4].node), new_node2(BIND_NODE, (yyvsp[-2].token), (yyvsp[-3].node), (yyvsp[-1].node))); (yyval.node) = (yyvsp[-4].node); } 1578#line 1579 "parser/parser.c" 1579 break; 1580 1581 case 59: /* Binds: Binds INHERIT InheritList ';' */ 1582#line 209 "parser/parser.y" 1583{ add_child((yyvsp[-3].node), new_node1(INHERIT_NODE, (yyvsp[-2].token), (yyvsp[-1].node))); (yyval.node) = (yyvsp[-3].node); } 1584#line 1585 "parser/parser.c" 1585 break; 1586 1587 case 60: /* Binds: Binds INHERIT '(' Expression ')' InheritList ';' */ 1588#line 211 "parser/parser.y" 1589{ add_child((yyvsp[-6].node), new_node2(INHERIT_FROM_NODE, (yyvsp[-5].token), (yyvsp[-3].node), (yyvsp[-1].node))); (yyval.node) = (yyvsp[-6].node); } 1590#line 1591 "parser/parser.c" 1591 break; 1592 1593 case 61: /* InheritList: %empty */ 1594#line 216 "parser/parser.y" 1595{ (yyval.node) = new_node(INHERIT_LIST_NODE, 0); } 1596#line 1597 "parser/parser.c" 1597 break; 1598 1599 case 62: /* InheritList: InheritList InterpID */ 1600#line 218 "parser/parser.y" 1601{ add_child((yyvsp[-1].node), (yyvsp[0].node)); (yyval.node) = (yyvsp[-1].node); } 1602#line 1603 "parser/parser.c" 1603 break; 1604 1605 case 63: /* Function: ARG_ID ':' Expression */ 1606#line 223 "parser/parser.y" 1607{ (yyval.node) = new_node2(FUNCTION_NODE, (yyvsp[-1].token), new_node(ID_NODE, (yyvsp[-2].token)), (yyvsp[0].node)); } 1608#line 1609 "parser/parser.c" 1609 break; 1610 1611 case 64: /* Function: ARG_BRACKET ArgSet '}' ':' Expression */ 1612#line 225 "parser/parser.y" 1613{ (yyval.node) = new_node2(FUNCTION_NODE, (yyvsp[-1].token), (yyvsp[-3].node), (yyvsp[0].node)); set_token_end((yyvsp[-3].node), (yyvsp[-2].token)); } 1614#line 1615 "parser/parser.c" 1615 break; 1616 1617 case 65: /* Function: ARG_ID '@' ARG_BRACKET ArgSet '}' ':' Expression */ 1618#line 227 "parser/parser.y" 1619{ (yyval.node) = new_node3(FUNCTION_NODE, (yyvsp[-5].token), new_node(ID_NODE, (yyvsp[-6].token)), (yyvsp[-3].node), (yyvsp[0].node)); set_token_end((yyvsp[-3].node), (yyvsp[-2].token)); } 1620#line 1621 "parser/parser.c" 1621 break; 1622 1623 case 66: /* Function: ARG_BRACKET ArgSet '}' '@' ID ':' Expression */ 1624#line 229 "parser/parser.y" 1625{ (yyval.node) = new_node3(FUNCTION_NODE, (yyvsp[-3].token), (yyvsp[-2].node), (yyvsp[-5].node), (yyvsp[0].node)); set_token_end((yyvsp[-5].node), (yyvsp[-4].token)); } 1626#line 1627 "parser/parser.c" 1627 break; 1628 1629 case 67: /* Function: ARG_BRACKET ArgSet '}' '@' ARG_ID ':' Expression */ 1630#line 231 "parser/parser.y" 1631{ (yyval.node) = new_node3(FUNCTION_NODE, (yyvsp[-3].token), new_node(ID_NODE, (yyvsp[-2].token)), (yyvsp[-5].node), (yyvsp[0].node)); set_token_end((yyvsp[-5].node), (yyvsp[-4].token)); } 1632#line 1633 "parser/parser.c" 1633 break; 1634 1635 case 68: /* ArgSet: %empty */ 1636#line 236 "parser/parser.y" 1637{ (yyval.node) = new_node(ARG_SET_NODE, 0); } 1638#line 1639 "parser/parser.c" 1639 break; 1640 1641 case 69: /* ArgSet: Arg */ 1642#line 238 "parser/parser.y" 1643{ (yyval.node) = new_node1(ARG_SET_NODE, 0, (yyvsp[0].node)); } 1644#line 1645 "parser/parser.c" 1645 break; 1646 1647 case 70: /* ArgSet: ELLIPSIS */ 1648#line 240 "parser/parser.y" 1649{ (yyval.node) = new_node1(ARG_SET_NODE, 0, new_node(ARG_NODE, (yyvsp[0].token))); } 1650#line 1651 "parser/parser.c" 1651 break; 1652 1653 case 71: /* ArgSet: Arg ',' ArgSet */ 1654#line 242 "parser/parser.y" 1655{ add_child((yyvsp[0].node), (yyvsp[-2].node)); (yyval.node) = (yyvsp[0].node); } 1656#line 1657 "parser/parser.c" 1657 break; 1658 1659 case 72: /* Arg: ID */ 1660#line 247 "parser/parser.y" 1661{ (yyval.node) = new_node1(ARG_NODE, 0, (yyvsp[0].node)); } 1662#line 1663 "parser/parser.c" 1663 break; 1664 1665 case 73: /* Arg: ID '?' Expression */ 1666#line 249 "parser/parser.y" 1667{ (yyval.node) = new_node2(ARG_NODE, (yyvsp[-1].token), (yyvsp[-2].node), (yyvsp[0].node)); } 1668#line 1669 "parser/parser.c" 1669 break; 1670 1671 1672#line 1673 "parser/parser.c" 1673 1674 default: break; 1675 } 1676 /* User semantic actions sometimes alter yychar, and that requires 1677 that yytoken be updated with the new translation. We take the 1678 approach of translating immediately before every use of yytoken. 1679 One alternative is translating here after every semantic action, 1680 but that translation would be missed if the semantic action invokes 1681 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 1682 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 1683 incorrect destructor might then be invoked immediately. In the 1684 case of YYERROR or YYBACKUP, subsequent parser actions might lead 1685 to an incorrect destructor call or verbose syntax error message 1686 before the lookahead is translated. */ 1687 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); 1688 1689 YYPOPSTACK (yylen); 1690 yylen = 0; 1691 1692 *++yyvsp = yyval; 1693 1694 /* Now 'shift' the result of the reduction. Determine what state 1695 that goes to, based on the state we popped back to and the rule 1696 number reduced by. */ 1697 { 1698 const int yylhs = yyr1[yyn] - YYNTOKENS; 1699 const int yyi = yypgoto[yylhs] + *yyssp; 1700 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp 1701 ? yytable[yyi] 1702 : yydefgoto[yylhs]); 1703 } 1704 1705 goto yynewstate; 1706 1707 1708/*--------------------------------------. 1709| yyerrlab -- here on detecting error. | 1710`--------------------------------------*/ 1711yyerrlab: 1712 /* Make sure we have latest lookahead translation. See comments at 1713 user semantic actions for why this is necessary. */ 1714 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); 1715 /* If not already recovering from an error, report this error. */ 1716 if (!yyerrstatus) 1717 { 1718 ++yynerrs; 1719 yyerror (ast_root, scanner, YY_("syntax error")); 1720 } 1721 1722 if (yyerrstatus == 3) 1723 { 1724 /* If just tried and failed to reuse lookahead token after an 1725 error, discard it. */ 1726 1727 if (yychar <= YYEOF) 1728 { 1729 /* Return failure if at end of input. */ 1730 if (yychar == YYEOF) 1731 YYABORT; 1732 } 1733 else 1734 { 1735 yydestruct ("Error: discarding", 1736 yytoken, &yylval, ast_root, scanner); 1737 yychar = YYEMPTY; 1738 } 1739 } 1740 1741 /* Else will try to reuse lookahead token after shifting the error 1742 token. */ 1743 goto yyerrlab1; 1744 1745 1746/*---------------------------------------------------. 1747| yyerrorlab -- error raised explicitly by YYERROR. | 1748`---------------------------------------------------*/ 1749yyerrorlab: 1750 /* Pacify compilers when the user code never invokes YYERROR and the 1751 label yyerrorlab therefore never appears in user code. */ 1752 if (0) 1753 YYERROR; 1754 ++yynerrs; 1755 1756 /* Do not reclaim the symbols of the rule whose action triggered 1757 this YYERROR. */ 1758 YYPOPSTACK (yylen); 1759 yylen = 0; 1760 YY_STACK_PRINT (yyss, yyssp); 1761 yystate = *yyssp; 1762 goto yyerrlab1; 1763 1764 1765/*-------------------------------------------------------------. 1766| yyerrlab1 -- common code for both syntax error and YYERROR. | 1767`-------------------------------------------------------------*/ 1768yyerrlab1: 1769 yyerrstatus = 3; /* Each real token shifted decrements this. */ 1770 1771 /* Pop stack until we find a state that shifts the error token. */ 1772 for (;;) 1773 { 1774 yyn = yypact[yystate]; 1775 if (!yypact_value_is_default (yyn)) 1776 { 1777 yyn += YYSYMBOL_YYerror; 1778 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) 1779 { 1780 yyn = yytable[yyn]; 1781 if (0 < yyn) 1782 break; 1783 } 1784 } 1785 1786 /* Pop the current state because it cannot handle the error token. */ 1787 if (yyssp == yyss) 1788 YYABORT; 1789 1790 1791 yydestruct ("Error: popping", 1792 YY_ACCESSING_SYMBOL (yystate), yyvsp, ast_root, scanner); 1793 YYPOPSTACK (1); 1794 yystate = *yyssp; 1795 YY_STACK_PRINT (yyss, yyssp); 1796 } 1797 1798 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1799 *++yyvsp = yylval; 1800 YY_IGNORE_MAYBE_UNINITIALIZED_END 1801 1802 1803 /* Shift the error token. */ 1804 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); 1805 1806 yystate = yyn; 1807 goto yynewstate; 1808 1809 1810/*-------------------------------------. 1811| yyacceptlab -- YYACCEPT comes here. | 1812`-------------------------------------*/ 1813yyacceptlab: 1814 yyresult = 0; 1815 goto yyreturnlab; 1816 1817 1818/*-----------------------------------. 1819| yyabortlab -- YYABORT comes here. | 1820`-----------------------------------*/ 1821yyabortlab: 1822 yyresult = 1; 1823 goto yyreturnlab; 1824 1825 1826/*-----------------------------------------------------------. 1827| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | 1828`-----------------------------------------------------------*/ 1829yyexhaustedlab: 1830 yyerror (ast_root, scanner, YY_("memory exhausted")); 1831 yyresult = 2; 1832 goto yyreturnlab; 1833 1834 1835/*----------------------------------------------------------. 1836| yyreturnlab -- parsing is finished, clean up and return. | 1837`----------------------------------------------------------*/ 1838yyreturnlab: 1839 if (yychar != YYEMPTY) 1840 { 1841 /* Make sure we have latest lookahead translation. See comments at 1842 user semantic actions for why this is necessary. */ 1843 yytoken = YYTRANSLATE (yychar); 1844 yydestruct ("Cleanup: discarding lookahead", 1845 yytoken, &yylval, ast_root, scanner); 1846 } 1847 /* Do not reclaim the symbols of the rule whose action triggered 1848 this YYABORT or YYACCEPT. */ 1849 YYPOPSTACK (yylen); 1850 YY_STACK_PRINT (yyss, yyssp); 1851 while (yyssp != yyss) 1852 { 1853 yydestruct ("Cleanup: popping", 1854 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, ast_root, scanner); 1855 YYPOPSTACK (1); 1856 } 1857#ifndef yyoverflow 1858 if (yyss != yyssa) 1859 YYSTACK_FREE (yyss); 1860#endif 1861 1862 return yyresult; 1863} 1864 1865#line 252 "parser/parser.y" 1866