[642] | 1 | /* A Bison parser, made by GNU Bison 3.0.2. */ |
---|
[458] | 2 | |
---|
[642] | 3 | /* Bison implementation for Yacc-like parsers in C |
---|
[458] | 4 | |
---|
[642] | 5 | Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. |
---|
| 6 | |
---|
[458] | 7 | This program is free software: you can redistribute it and/or modify |
---|
| 8 | it under the terms of the GNU General Public License as published by |
---|
| 9 | the Free Software Foundation, either version 3 of the License, or |
---|
| 10 | (at your option) any later version. |
---|
[642] | 11 | |
---|
[458] | 12 | This program is distributed in the hope that it will be useful, |
---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | GNU General Public License for more details. |
---|
[642] | 16 | |
---|
[458] | 17 | You should have received a copy of the GNU General Public License |
---|
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
---|
| 19 | |
---|
| 20 | /* As a special exception, you may create a larger work that contains |
---|
| 21 | part or all of the Bison parser skeleton and distribute that work |
---|
| 22 | under terms of your choice, so long as that work isn't itself a |
---|
| 23 | parser generator using the skeleton or a modified version thereof |
---|
| 24 | as a parser skeleton. Alternatively, if you modify or redistribute |
---|
| 25 | the parser skeleton itself, you may (at your option) remove this |
---|
| 26 | special exception, which will cause the skeleton and the resulting |
---|
| 27 | Bison output files to be licensed under the GNU General Public |
---|
| 28 | License without this special exception. |
---|
[642] | 29 | |
---|
[458] | 30 | This special exception was added by the Free Software Foundation in |
---|
| 31 | version 2.2 of Bison. */ |
---|
| 32 | |
---|
| 33 | /* C LALR(1) parser skeleton written by Richard Stallman, by |
---|
| 34 | simplifying the original so-called "semantic" parser. */ |
---|
| 35 | |
---|
| 36 | /* All symbols defined below should begin with yy or YY, to avoid |
---|
| 37 | infringing on user name space. This should be done even for local |
---|
| 38 | variables, as they might otherwise be expanded by user macros. |
---|
| 39 | There are some unavoidable exceptions within include files to |
---|
| 40 | define necessary library symbols; they are noted "INFRINGES ON |
---|
| 41 | USER NAME SPACE" below. */ |
---|
| 42 | |
---|
| 43 | /* Identify Bison output. */ |
---|
| 44 | #define YYBISON 1 |
---|
| 45 | |
---|
| 46 | /* Bison version. */ |
---|
[642] | 47 | #define YYBISON_VERSION "3.0.2" |
---|
[458] | 48 | |
---|
| 49 | /* Skeleton name. */ |
---|
| 50 | #define YYSKELETON_NAME "yacc.c" |
---|
| 51 | |
---|
| 52 | /* Pure parsers. */ |
---|
| 53 | #define YYPURE 0 |
---|
| 54 | |
---|
| 55 | /* Push parsers. */ |
---|
| 56 | #define YYPUSH 0 |
---|
| 57 | |
---|
| 58 | /* Pull parsers. */ |
---|
| 59 | #define YYPULL 1 |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | /* Copy the first part of user declarations. */ |
---|
[642] | 65 | #line 1 "yacc_parser.yacc" /* yacc.c:339 */ |
---|
[458] | 66 | |
---|
[642] | 67 | #include "filter_expr_node.hpp" |
---|
[458] | 68 | #include <string> |
---|
| 69 | #include <iostream> |
---|
[493] | 70 | #include "exception.hpp" |
---|
| 71 | |
---|
[642] | 72 | using namespace std; |
---|
| 73 | using namespace xios; |
---|
[493] | 74 | |
---|
[458] | 75 | extern "C" |
---|
| 76 | { |
---|
| 77 | int yyparse(void); |
---|
| 78 | int yylex(void); |
---|
[642] | 79 | int yyerror(const char *s); |
---|
[458] | 80 | } |
---|
| 81 | |
---|
[642] | 82 | IFilterExprNode* parsed; |
---|
| 83 | std::string globalInputText; |
---|
| 84 | size_t globalReadOffset = 0; |
---|
| 85 | |
---|
| 86 | int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead) |
---|
| 87 | { |
---|
| 88 | size_t numBytesToRead = maxBytesToRead; |
---|
| 89 | size_t bytesRemaining = globalInputText.length()-globalReadOffset; |
---|
| 90 | size_t i; |
---|
| 91 | if (numBytesToRead > bytesRemaining) numBytesToRead = bytesRemaining; |
---|
| 92 | for (i = 0; i < numBytesToRead; i++) buffer[i] = globalInputText.c_str()[globalReadOffset + i]; |
---|
[458] | 93 | *numBytesRead = numBytesToRead; |
---|
| 94 | globalReadOffset += numBytesToRead; |
---|
| 95 | return 0; |
---|
[642] | 96 | } |
---|
[458] | 97 | |
---|
[642] | 98 | #line 99 "yacc_parser.cpp" /* yacc.c:339 */ |
---|
[458] | 99 | |
---|
[642] | 100 | # ifndef YY_NULLPTR |
---|
| 101 | # if defined __cplusplus && 201103L <= __cplusplus |
---|
| 102 | # define YY_NULLPTR nullptr |
---|
| 103 | # else |
---|
| 104 | # define YY_NULLPTR 0 |
---|
| 105 | # endif |
---|
| 106 | # endif |
---|
[458] | 107 | |
---|
| 108 | /* Enabling verbose error messages. */ |
---|
| 109 | #ifdef YYERROR_VERBOSE |
---|
| 110 | # undef YYERROR_VERBOSE |
---|
| 111 | # define YYERROR_VERBOSE 1 |
---|
| 112 | #else |
---|
| 113 | # define YYERROR_VERBOSE 0 |
---|
| 114 | #endif |
---|
| 115 | |
---|
[642] | 116 | /* In a future release of Bison, this section will be replaced |
---|
| 117 | by #include "yacc_parser.hpp". */ |
---|
| 118 | #ifndef YY_YY_YACC_PARSER_HPP_INCLUDED |
---|
| 119 | # define YY_YY_YACC_PARSER_HPP_INCLUDED |
---|
| 120 | /* Debug traces. */ |
---|
| 121 | #ifndef YYDEBUG |
---|
| 122 | # define YYDEBUG 0 |
---|
[458] | 123 | #endif |
---|
[642] | 124 | #if YYDEBUG |
---|
| 125 | extern int yydebug; |
---|
| 126 | #endif |
---|
[458] | 127 | |
---|
[642] | 128 | /* Token type. */ |
---|
[458] | 129 | #ifndef YYTOKENTYPE |
---|
| 130 | # define YYTOKENTYPE |
---|
[642] | 131 | enum yytokentype |
---|
| 132 | { |
---|
| 133 | NUMBER = 258, |
---|
| 134 | VAR = 259, |
---|
| 135 | ID = 260, |
---|
| 136 | AVERAGE = 261, |
---|
| 137 | PLUS = 262, |
---|
| 138 | MINUS = 263, |
---|
| 139 | TIMES = 264, |
---|
| 140 | DIVIDE = 265, |
---|
| 141 | POWER = 266, |
---|
| 142 | LEFT_PARENTHESIS = 267, |
---|
| 143 | RIGHT_PARENTHESIS = 268, |
---|
| 144 | END = 269, |
---|
| 145 | NEG = 270 |
---|
| 146 | }; |
---|
[458] | 147 | #endif |
---|
| 148 | |
---|
[642] | 149 | /* Value type. */ |
---|
[458] | 150 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
---|
[642] | 151 | typedef union YYSTYPE YYSTYPE; |
---|
| 152 | union YYSTYPE |
---|
[458] | 153 | { |
---|
[642] | 154 | #line 35 "yacc_parser.yacc" /* yacc.c:355 */ |
---|
[458] | 155 | |
---|
[642] | 156 | std::string* str; /* symbol table index */ |
---|
| 157 | xios::IScalarExprNode* scalarNode; |
---|
| 158 | xios::IFilterExprNode* filterNode; |
---|
[458] | 159 | |
---|
[642] | 160 | #line 161 "yacc_parser.cpp" /* yacc.c:355 */ |
---|
| 161 | }; |
---|
[458] | 162 | # define YYSTYPE_IS_TRIVIAL 1 |
---|
| 163 | # define YYSTYPE_IS_DECLARED 1 |
---|
| 164 | #endif |
---|
| 165 | |
---|
| 166 | |
---|
[642] | 167 | extern YYSTYPE yylval; |
---|
| 168 | |
---|
| 169 | int yyparse (void); |
---|
| 170 | |
---|
| 171 | #endif /* !YY_YY_YACC_PARSER_HPP_INCLUDED */ |
---|
| 172 | |
---|
[458] | 173 | /* Copy the second part of user declarations. */ |
---|
| 174 | |
---|
[642] | 175 | #line 176 "yacc_parser.cpp" /* yacc.c:358 */ |
---|
[458] | 176 | |
---|
| 177 | #ifdef short |
---|
| 178 | # undef short |
---|
| 179 | #endif |
---|
| 180 | |
---|
| 181 | #ifdef YYTYPE_UINT8 |
---|
| 182 | typedef YYTYPE_UINT8 yytype_uint8; |
---|
| 183 | #else |
---|
| 184 | typedef unsigned char yytype_uint8; |
---|
| 185 | #endif |
---|
| 186 | |
---|
| 187 | #ifdef YYTYPE_INT8 |
---|
| 188 | typedef YYTYPE_INT8 yytype_int8; |
---|
[642] | 189 | #else |
---|
[458] | 190 | typedef signed char yytype_int8; |
---|
| 191 | #endif |
---|
| 192 | |
---|
| 193 | #ifdef YYTYPE_UINT16 |
---|
| 194 | typedef YYTYPE_UINT16 yytype_uint16; |
---|
| 195 | #else |
---|
| 196 | typedef unsigned short int yytype_uint16; |
---|
| 197 | #endif |
---|
| 198 | |
---|
| 199 | #ifdef YYTYPE_INT16 |
---|
| 200 | typedef YYTYPE_INT16 yytype_int16; |
---|
| 201 | #else |
---|
| 202 | typedef short int yytype_int16; |
---|
| 203 | #endif |
---|
| 204 | |
---|
| 205 | #ifndef YYSIZE_T |
---|
| 206 | # ifdef __SIZE_TYPE__ |
---|
| 207 | # define YYSIZE_T __SIZE_TYPE__ |
---|
| 208 | # elif defined size_t |
---|
| 209 | # define YYSIZE_T size_t |
---|
[642] | 210 | # elif ! defined YYSIZE_T |
---|
[458] | 211 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
---|
| 212 | # define YYSIZE_T size_t |
---|
| 213 | # else |
---|
| 214 | # define YYSIZE_T unsigned int |
---|
| 215 | # endif |
---|
| 216 | #endif |
---|
| 217 | |
---|
| 218 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
---|
| 219 | |
---|
| 220 | #ifndef YY_ |
---|
[642] | 221 | # if defined YYENABLE_NLS && YYENABLE_NLS |
---|
[458] | 222 | # if ENABLE_NLS |
---|
| 223 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
---|
[642] | 224 | # define YY_(Msgid) dgettext ("bison-runtime", Msgid) |
---|
[458] | 225 | # endif |
---|
| 226 | # endif |
---|
| 227 | # ifndef YY_ |
---|
[642] | 228 | # define YY_(Msgid) Msgid |
---|
[458] | 229 | # endif |
---|
| 230 | #endif |
---|
| 231 | |
---|
[642] | 232 | #ifndef YY_ATTRIBUTE |
---|
| 233 | # if (defined __GNUC__ \ |
---|
| 234 | && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ |
---|
| 235 | || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C |
---|
| 236 | # define YY_ATTRIBUTE(Spec) __attribute__(Spec) |
---|
| 237 | # else |
---|
| 238 | # define YY_ATTRIBUTE(Spec) /* empty */ |
---|
| 239 | # endif |
---|
| 240 | #endif |
---|
| 241 | |
---|
| 242 | #ifndef YY_ATTRIBUTE_PURE |
---|
| 243 | # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) |
---|
| 244 | #endif |
---|
| 245 | |
---|
| 246 | #ifndef YY_ATTRIBUTE_UNUSED |
---|
| 247 | # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) |
---|
| 248 | #endif |
---|
| 249 | |
---|
| 250 | #if !defined _Noreturn \ |
---|
| 251 | && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) |
---|
| 252 | # if defined _MSC_VER && 1200 <= _MSC_VER |
---|
| 253 | # define _Noreturn __declspec (noreturn) |
---|
| 254 | # else |
---|
| 255 | # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) |
---|
| 256 | # endif |
---|
| 257 | #endif |
---|
| 258 | |
---|
[458] | 259 | /* Suppress unused-variable warnings by "using" E. */ |
---|
| 260 | #if ! defined lint || defined __GNUC__ |
---|
[642] | 261 | # define YYUSE(E) ((void) (E)) |
---|
[458] | 262 | #else |
---|
[642] | 263 | # define YYUSE(E) /* empty */ |
---|
[458] | 264 | #endif |
---|
| 265 | |
---|
[642] | 266 | #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ |
---|
| 267 | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ |
---|
| 268 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
---|
| 269 | _Pragma ("GCC diagnostic push") \ |
---|
| 270 | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ |
---|
| 271 | _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") |
---|
| 272 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ |
---|
| 273 | _Pragma ("GCC diagnostic pop") |
---|
[458] | 274 | #else |
---|
[642] | 275 | # define YY_INITIAL_VALUE(Value) Value |
---|
[458] | 276 | #endif |
---|
[642] | 277 | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
---|
| 278 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
---|
| 279 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END |
---|
[458] | 280 | #endif |
---|
[642] | 281 | #ifndef YY_INITIAL_VALUE |
---|
| 282 | # define YY_INITIAL_VALUE(Value) /* Nothing. */ |
---|
| 283 | #endif |
---|
[458] | 284 | |
---|
[642] | 285 | |
---|
[458] | 286 | #if ! defined yyoverflow || YYERROR_VERBOSE |
---|
| 287 | |
---|
| 288 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
---|
| 289 | |
---|
| 290 | # ifdef YYSTACK_USE_ALLOCA |
---|
| 291 | # if YYSTACK_USE_ALLOCA |
---|
| 292 | # ifdef __GNUC__ |
---|
| 293 | # define YYSTACK_ALLOC __builtin_alloca |
---|
| 294 | # elif defined __BUILTIN_VA_ARG_INCR |
---|
| 295 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
---|
| 296 | # elif defined _AIX |
---|
| 297 | # define YYSTACK_ALLOC __alloca |
---|
| 298 | # elif defined _MSC_VER |
---|
| 299 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
---|
| 300 | # define alloca _alloca |
---|
| 301 | # else |
---|
| 302 | # define YYSTACK_ALLOC alloca |
---|
[642] | 303 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS |
---|
[458] | 304 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
---|
[642] | 305 | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
---|
| 306 | # ifndef EXIT_SUCCESS |
---|
| 307 | # define EXIT_SUCCESS 0 |
---|
[458] | 308 | # endif |
---|
| 309 | # endif |
---|
| 310 | # endif |
---|
| 311 | # endif |
---|
| 312 | # endif |
---|
| 313 | |
---|
| 314 | # ifdef YYSTACK_ALLOC |
---|
[642] | 315 | /* Pacify GCC's 'empty if-body' warning. */ |
---|
| 316 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
---|
[458] | 317 | # ifndef YYSTACK_ALLOC_MAXIMUM |
---|
| 318 | /* The OS might guarantee only one guard page at the bottom of the stack, |
---|
| 319 | and a page size can be as small as 4096 bytes. So we cannot safely |
---|
| 320 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
---|
| 321 | to allow for a few compiler-allocated temporary stack slots. */ |
---|
| 322 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
---|
| 323 | # endif |
---|
| 324 | # else |
---|
| 325 | # define YYSTACK_ALLOC YYMALLOC |
---|
| 326 | # define YYSTACK_FREE YYFREE |
---|
| 327 | # ifndef YYSTACK_ALLOC_MAXIMUM |
---|
| 328 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
---|
| 329 | # endif |
---|
[642] | 330 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
---|
[458] | 331 | && ! ((defined YYMALLOC || defined malloc) \ |
---|
[642] | 332 | && (defined YYFREE || defined free))) |
---|
[458] | 333 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
---|
[642] | 334 | # ifndef EXIT_SUCCESS |
---|
| 335 | # define EXIT_SUCCESS 0 |
---|
[458] | 336 | # endif |
---|
| 337 | # endif |
---|
| 338 | # ifndef YYMALLOC |
---|
| 339 | # define YYMALLOC malloc |
---|
[642] | 340 | # if ! defined malloc && ! defined EXIT_SUCCESS |
---|
[458] | 341 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
---|
| 342 | # endif |
---|
| 343 | # endif |
---|
| 344 | # ifndef YYFREE |
---|
| 345 | # define YYFREE free |
---|
[642] | 346 | # if ! defined free && ! defined EXIT_SUCCESS |
---|
[458] | 347 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
---|
| 348 | # endif |
---|
| 349 | # endif |
---|
| 350 | # endif |
---|
| 351 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ |
---|
| 352 | |
---|
| 353 | |
---|
| 354 | #if (! defined yyoverflow \ |
---|
| 355 | && (! defined __cplusplus \ |
---|
[642] | 356 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
---|
[458] | 357 | |
---|
| 358 | /* A type that is properly aligned for any stack member. */ |
---|
| 359 | union yyalloc |
---|
| 360 | { |
---|
| 361 | yytype_int16 yyss_alloc; |
---|
| 362 | YYSTYPE yyvs_alloc; |
---|
| 363 | }; |
---|
| 364 | |
---|
| 365 | /* The size of the maximum gap between one aligned stack and the next. */ |
---|
| 366 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
---|
| 367 | |
---|
| 368 | /* The size of an array large to enough to hold all stacks, each with |
---|
| 369 | N elements. */ |
---|
| 370 | # define YYSTACK_BYTES(N) \ |
---|
| 371 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ |
---|
| 372 | + YYSTACK_GAP_MAXIMUM) |
---|
| 373 | |
---|
[642] | 374 | # define YYCOPY_NEEDED 1 |
---|
[458] | 375 | |
---|
| 376 | /* Relocate STACK from its old location to the new one. The |
---|
| 377 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
---|
| 378 | elements in the stack, and YYPTR gives the new location of the |
---|
| 379 | stack. Advance YYPTR to a properly aligned location for the next |
---|
| 380 | stack. */ |
---|
[642] | 381 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
---|
| 382 | do \ |
---|
| 383 | { \ |
---|
| 384 | YYSIZE_T yynewbytes; \ |
---|
| 385 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
---|
| 386 | Stack = &yyptr->Stack_alloc; \ |
---|
| 387 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
---|
| 388 | yyptr += yynewbytes / sizeof (*yyptr); \ |
---|
| 389 | } \ |
---|
| 390 | while (0) |
---|
[458] | 391 | |
---|
| 392 | #endif |
---|
| 393 | |
---|
[642] | 394 | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
---|
| 395 | /* Copy COUNT objects from SRC to DST. The source and destination do |
---|
| 396 | not overlap. */ |
---|
| 397 | # ifndef YYCOPY |
---|
| 398 | # if defined __GNUC__ && 1 < __GNUC__ |
---|
| 399 | # define YYCOPY(Dst, Src, Count) \ |
---|
| 400 | __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) |
---|
| 401 | # else |
---|
| 402 | # define YYCOPY(Dst, Src, Count) \ |
---|
| 403 | do \ |
---|
| 404 | { \ |
---|
| 405 | YYSIZE_T yyi; \ |
---|
| 406 | for (yyi = 0; yyi < (Count); yyi++) \ |
---|
| 407 | (Dst)[yyi] = (Src)[yyi]; \ |
---|
| 408 | } \ |
---|
| 409 | while (0) |
---|
| 410 | # endif |
---|
| 411 | # endif |
---|
| 412 | #endif /* !YYCOPY_NEEDED */ |
---|
| 413 | |
---|
[458] | 414 | /* YYFINAL -- State number of the termination state. */ |
---|
| 415 | #define YYFINAL 16 |
---|
| 416 | /* YYLAST -- Last index in YYTABLE. */ |
---|
| 417 | #define YYLAST 134 |
---|
| 418 | |
---|
| 419 | /* YYNTOKENS -- Number of terminals. */ |
---|
| 420 | #define YYNTOKENS 16 |
---|
| 421 | /* YYNNTS -- Number of nonterminals. */ |
---|
| 422 | #define YYNNTS 4 |
---|
| 423 | /* YYNRULES -- Number of rules. */ |
---|
| 424 | #define YYNRULES 32 |
---|
[642] | 425 | /* YYNSTATES -- Number of states. */ |
---|
[458] | 426 | #define YYNSTATES 68 |
---|
| 427 | |
---|
[642] | 428 | /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned |
---|
| 429 | by yylex, with out-of-bounds checking. */ |
---|
[458] | 430 | #define YYUNDEFTOK 2 |
---|
| 431 | #define YYMAXUTOK 270 |
---|
| 432 | |
---|
[642] | 433 | #define YYTRANSLATE(YYX) \ |
---|
[458] | 434 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
---|
| 435 | |
---|
[642] | 436 | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
---|
| 437 | as returned by yylex, without out-of-bounds checking. */ |
---|
[458] | 438 | static const yytype_uint8 yytranslate[] = |
---|
| 439 | { |
---|
| 440 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 441 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 442 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 443 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 444 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 445 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 446 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 447 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 448 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 449 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 450 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 451 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 452 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 453 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 454 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 455 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 456 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 457 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 458 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 459 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 460 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 461 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 462 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 463 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 464 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 465 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
---|
| 466 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
---|
| 467 | 15 |
---|
| 468 | }; |
---|
| 469 | |
---|
| 470 | #if YYDEBUG |
---|
[642] | 471 | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
---|
[458] | 472 | static const yytype_uint8 yyrline[] = |
---|
| 473 | { |
---|
[642] | 474 | 0, 59, 59, 60, 64, 65, 66, 67, 68, 69, |
---|
| 475 | 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, |
---|
| 476 | 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, |
---|
| 477 | 93, 94, 95 |
---|
[458] | 478 | }; |
---|
| 479 | #endif |
---|
| 480 | |
---|
[642] | 481 | #if YYDEBUG || YYERROR_VERBOSE || 0 |
---|
[458] | 482 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
---|
| 483 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
---|
| 484 | static const char *const yytname[] = |
---|
| 485 | { |
---|
| 486 | "$end", "error", "$undefined", "NUMBER", "VAR", "ID", "AVERAGE", "PLUS", |
---|
| 487 | "MINUS", "TIMES", "DIVIDE", "POWER", "LEFT_PARENTHESIS", |
---|
| 488 | "RIGHT_PARENTHESIS", "END", "NEG", "$accept", "Line", "Expression", |
---|
[642] | 489 | "Field_expr", YY_NULLPTR |
---|
[458] | 490 | }; |
---|
| 491 | #endif |
---|
| 492 | |
---|
| 493 | # ifdef YYPRINT |
---|
[642] | 494 | /* YYTOKNUM[NUM] -- (External) token number corresponding to the |
---|
| 495 | (internal) symbol number NUM (which must be that of a token). */ |
---|
[458] | 496 | static const yytype_uint16 yytoknum[] = |
---|
| 497 | { |
---|
| 498 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
---|
| 499 | 265, 266, 267, 268, 269, 270 |
---|
| 500 | }; |
---|
| 501 | # endif |
---|
| 502 | |
---|
[642] | 503 | #define YYPACT_NINF -6 |
---|
[458] | 504 | |
---|
[642] | 505 | #define yypact_value_is_default(Yystate) \ |
---|
| 506 | (!!((Yystate) == (-6))) |
---|
| 507 | |
---|
| 508 | #define YYTABLE_NINF -1 |
---|
| 509 | |
---|
| 510 | #define yytable_value_is_error(Yytable_value) \ |
---|
| 511 | 0 |
---|
| 512 | |
---|
| 513 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
---|
| 514 | STATE-NUM. */ |
---|
| 515 | static const yytype_int8 yypact[] = |
---|
[458] | 516 | { |
---|
[642] | 517 | 55, -6, -6, -4, -6, -1, -1, -6, 9, 123, |
---|
| 518 | 73, -1, 14, 20, 81, 88, -6, -1, -1, -1, |
---|
| 519 | -1, 67, -1, -1, -1, -1, -1, -6, 95, 102, |
---|
| 520 | -6, -6, 13, 19, 13, 19, 14, 20, 14, 20, |
---|
| 521 | -2, 67, 67, 14, 13, 19, 13, 19, 14, 20, |
---|
| 522 | 14, 20, 14, 20, -6, -6, 67, 14, 109, 67, |
---|
| 523 | 67, 67, 67, 116, 24, 24, 14, 14 |
---|
[458] | 524 | }; |
---|
| 525 | |
---|
[642] | 526 | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
---|
| 527 | Performed when YYTABLE does not specify something else to do. Zero |
---|
| 528 | means the default is an error. */ |
---|
[458] | 529 | static const yytype_uint8 yydefact[] = |
---|
| 530 | { |
---|
| 531 | 0, 4, 5, 14, 15, 0, 0, 2, 0, 0, |
---|
| 532 | 0, 0, 10, 20, 0, 0, 1, 0, 0, 0, |
---|
| 533 | 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, |
---|
| 534 | 12, 22, 6, 24, 7, 26, 8, 28, 9, 30, |
---|
| 535 | 0, 0, 0, 11, 23, 16, 25, 17, 27, 18, |
---|
| 536 | 29, 19, 31, 21, 13, 32, 0, 10, 0, 0, |
---|
| 537 | 0, 0, 0, 0, 6, 7, 8, 9 |
---|
| 538 | }; |
---|
| 539 | |
---|
[642] | 540 | /* YYPGOTO[NTERM-NUM]. */ |
---|
| 541 | static const yytype_int8 yypgoto[] = |
---|
[458] | 542 | { |
---|
[642] | 543 | -6, -6, -5, 21 |
---|
[458] | 544 | }; |
---|
| 545 | |
---|
[642] | 546 | /* YYDEFGOTO[NTERM-NUM]. */ |
---|
| 547 | static const yytype_int8 yydefgoto[] = |
---|
[458] | 548 | { |
---|
[642] | 549 | -1, 8, 9, 10 |
---|
[458] | 550 | }; |
---|
| 551 | |
---|
[642] | 552 | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
---|
| 553 | positive, shift that token. If negative, reduce the rule whose |
---|
| 554 | number is the opposite. If YYTABLE_NINF, syntax error. */ |
---|
[458] | 555 | static const yytype_uint8 yytable[] = |
---|
| 556 | { |
---|
| 557 | 12, 14, 1, 2, 3, 4, 28, 5, 11, 16, |
---|
| 558 | 56, 6, 32, 34, 36, 38, 43, 44, 46, 48, |
---|
| 559 | 50, 52, 19, 20, 21, 21, 13, 15, 24, 25, |
---|
| 560 | 26, 26, 29, 61, 62, 21, 57, 58, 33, 35, |
---|
| 561 | 37, 39, 0, 45, 47, 49, 51, 53, 0, 0, |
---|
| 562 | 0, 63, 0, 0, 64, 65, 66, 67, 1, 2, |
---|
| 563 | 3, 4, 0, 5, 0, 0, 0, 6, 0, 7, |
---|
| 564 | 1, 2, 40, 0, 0, 41, 0, 0, 0, 42, |
---|
| 565 | 22, 23, 24, 25, 26, 0, 0, 27, 17, 18, |
---|
| 566 | 19, 20, 21, 0, 30, 22, 23, 24, 25, 26, |
---|
| 567 | 0, 31, 17, 18, 19, 20, 21, 0, 54, 22, |
---|
| 568 | 23, 24, 25, 26, 0, 55, 59, 60, 61, 62, |
---|
| 569 | 21, 0, 30, 59, 60, 61, 62, 21, 0, 54, |
---|
| 570 | 17, 18, 19, 20, 21 |
---|
| 571 | }; |
---|
| 572 | |
---|
| 573 | static const yytype_int8 yycheck[] = |
---|
| 574 | { |
---|
| 575 | 5, 6, 3, 4, 5, 6, 11, 8, 12, 0, |
---|
| 576 | 12, 12, 17, 18, 19, 20, 21, 22, 23, 24, |
---|
| 577 | 25, 26, 9, 10, 11, 11, 5, 6, 9, 10, |
---|
| 578 | 11, 11, 11, 9, 10, 11, 41, 42, 17, 18, |
---|
| 579 | 19, 20, -1, 22, 23, 24, 25, 26, -1, -1, |
---|
| 580 | -1, 56, -1, -1, 59, 60, 61, 62, 3, 4, |
---|
| 581 | 5, 6, -1, 8, -1, -1, -1, 12, -1, 14, |
---|
| 582 | 3, 4, 5, -1, -1, 8, -1, -1, -1, 12, |
---|
| 583 | 7, 8, 9, 10, 11, -1, -1, 14, 7, 8, |
---|
| 584 | 9, 10, 11, -1, 13, 7, 8, 9, 10, 11, |
---|
| 585 | -1, 13, 7, 8, 9, 10, 11, -1, 13, 7, |
---|
| 586 | 8, 9, 10, 11, -1, 13, 7, 8, 9, 10, |
---|
| 587 | 11, -1, 13, 7, 8, 9, 10, 11, -1, 13, |
---|
| 588 | 7, 8, 9, 10, 11 |
---|
| 589 | }; |
---|
| 590 | |
---|
[642] | 591 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
---|
| 592 | symbol of state STATE-NUM. */ |
---|
[458] | 593 | static const yytype_uint8 yystos[] = |
---|
| 594 | { |
---|
| 595 | 0, 3, 4, 5, 6, 8, 12, 14, 17, 18, |
---|
| 596 | 19, 12, 18, 19, 18, 19, 0, 7, 8, 9, |
---|
| 597 | 10, 11, 7, 8, 9, 10, 11, 14, 18, 19, |
---|
| 598 | 13, 13, 18, 19, 18, 19, 18, 19, 18, 19, |
---|
| 599 | 5, 8, 12, 18, 18, 19, 18, 19, 18, 19, |
---|
| 600 | 18, 19, 18, 19, 13, 13, 12, 18, 18, 7, |
---|
| 601 | 8, 9, 10, 18, 18, 18, 18, 18 |
---|
| 602 | }; |
---|
| 603 | |
---|
[642] | 604 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
---|
| 605 | static const yytype_uint8 yyr1[] = |
---|
| 606 | { |
---|
| 607 | 0, 16, 17, 17, 18, 18, 18, 18, 18, 18, |
---|
| 608 | 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, |
---|
| 609 | 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, |
---|
| 610 | 19, 19, 19 |
---|
| 611 | }; |
---|
[458] | 612 | |
---|
[642] | 613 | /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ |
---|
| 614 | static const yytype_uint8 yyr2[] = |
---|
| 615 | { |
---|
| 616 | 0, 2, 1, 2, 1, 1, 3, 3, 3, 3, |
---|
| 617 | 2, 3, 3, 4, 1, 1, 3, 3, 3, 3, |
---|
| 618 | 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
---|
| 619 | 3, 3, 4 |
---|
| 620 | }; |
---|
[458] | 621 | |
---|
| 622 | |
---|
[642] | 623 | #define yyerrok (yyerrstatus = 0) |
---|
| 624 | #define yyclearin (yychar = YYEMPTY) |
---|
| 625 | #define YYEMPTY (-2) |
---|
| 626 | #define YYEOF 0 |
---|
[458] | 627 | |
---|
[642] | 628 | #define YYACCEPT goto yyacceptlab |
---|
| 629 | #define YYABORT goto yyabortlab |
---|
| 630 | #define YYERROR goto yyerrorlab |
---|
[458] | 631 | |
---|
[642] | 632 | |
---|
[458] | 633 | #define YYRECOVERING() (!!yyerrstatus) |
---|
| 634 | |
---|
[642] | 635 | #define YYBACKUP(Token, Value) \ |
---|
| 636 | do \ |
---|
| 637 | if (yychar == YYEMPTY) \ |
---|
| 638 | { \ |
---|
| 639 | yychar = (Token); \ |
---|
| 640 | yylval = (Value); \ |
---|
| 641 | YYPOPSTACK (yylen); \ |
---|
| 642 | yystate = *yyssp; \ |
---|
| 643 | goto yybackup; \ |
---|
| 644 | } \ |
---|
| 645 | else \ |
---|
| 646 | { \ |
---|
[458] | 647 | yyerror (YY_("syntax error: cannot back up")); \ |
---|
[642] | 648 | YYERROR; \ |
---|
| 649 | } \ |
---|
| 650 | while (0) |
---|
[458] | 651 | |
---|
[642] | 652 | /* Error token number */ |
---|
| 653 | #define YYTERROR 1 |
---|
| 654 | #define YYERRCODE 256 |
---|
[458] | 655 | |
---|
| 656 | |
---|
| 657 | |
---|
| 658 | /* Enable debugging if requested. */ |
---|
| 659 | #if YYDEBUG |
---|
| 660 | |
---|
| 661 | # ifndef YYFPRINTF |
---|
| 662 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
---|
| 663 | # define YYFPRINTF fprintf |
---|
| 664 | # endif |
---|
| 665 | |
---|
[642] | 666 | # define YYDPRINTF(Args) \ |
---|
| 667 | do { \ |
---|
| 668 | if (yydebug) \ |
---|
| 669 | YYFPRINTF Args; \ |
---|
| 670 | } while (0) |
---|
[458] | 671 | |
---|
[642] | 672 | /* This macro is provided for backward compatibility. */ |
---|
| 673 | #ifndef YY_LOCATION_PRINT |
---|
| 674 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
---|
| 675 | #endif |
---|
[458] | 676 | |
---|
| 677 | |
---|
[642] | 678 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
---|
| 679 | do { \ |
---|
| 680 | if (yydebug) \ |
---|
| 681 | { \ |
---|
| 682 | YYFPRINTF (stderr, "%s ", Title); \ |
---|
| 683 | yy_symbol_print (stderr, \ |
---|
| 684 | Type, Value); \ |
---|
| 685 | YYFPRINTF (stderr, "\n"); \ |
---|
| 686 | } \ |
---|
| 687 | } while (0) |
---|
[458] | 688 | |
---|
[642] | 689 | |
---|
| 690 | /*----------------------------------------. |
---|
| 691 | | Print this symbol's value on YYOUTPUT. | |
---|
| 692 | `----------------------------------------*/ |
---|
| 693 | |
---|
[458] | 694 | static void |
---|
| 695 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
---|
| 696 | { |
---|
[642] | 697 | FILE *yyo = yyoutput; |
---|
| 698 | YYUSE (yyo); |
---|
[458] | 699 | if (!yyvaluep) |
---|
| 700 | return; |
---|
| 701 | # ifdef YYPRINT |
---|
| 702 | if (yytype < YYNTOKENS) |
---|
| 703 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
---|
| 704 | # endif |
---|
[642] | 705 | YYUSE (yytype); |
---|
[458] | 706 | } |
---|
| 707 | |
---|
| 708 | |
---|
| 709 | /*--------------------------------. |
---|
| 710 | | Print this symbol on YYOUTPUT. | |
---|
| 711 | `--------------------------------*/ |
---|
| 712 | |
---|
| 713 | static void |
---|
| 714 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
---|
| 715 | { |
---|
[642] | 716 | YYFPRINTF (yyoutput, "%s %s (", |
---|
| 717 | yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); |
---|
[458] | 718 | |
---|
| 719 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); |
---|
| 720 | YYFPRINTF (yyoutput, ")"); |
---|
| 721 | } |
---|
| 722 | |
---|
| 723 | /*------------------------------------------------------------------. |
---|
| 724 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
---|
| 725 | | TOP (included). | |
---|
| 726 | `------------------------------------------------------------------*/ |
---|
| 727 | |
---|
| 728 | static void |
---|
| 729 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) |
---|
| 730 | { |
---|
| 731 | YYFPRINTF (stderr, "Stack now"); |
---|
| 732 | for (; yybottom <= yytop; yybottom++) |
---|
| 733 | { |
---|
| 734 | int yybot = *yybottom; |
---|
| 735 | YYFPRINTF (stderr, " %d", yybot); |
---|
| 736 | } |
---|
| 737 | YYFPRINTF (stderr, "\n"); |
---|
| 738 | } |
---|
| 739 | |
---|
[642] | 740 | # define YY_STACK_PRINT(Bottom, Top) \ |
---|
| 741 | do { \ |
---|
| 742 | if (yydebug) \ |
---|
| 743 | yy_stack_print ((Bottom), (Top)); \ |
---|
| 744 | } while (0) |
---|
[458] | 745 | |
---|
| 746 | |
---|
| 747 | /*------------------------------------------------. |
---|
| 748 | | Report that the YYRULE is going to be reduced. | |
---|
| 749 | `------------------------------------------------*/ |
---|
| 750 | |
---|
| 751 | static void |
---|
[642] | 752 | yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) |
---|
[458] | 753 | { |
---|
[642] | 754 | unsigned long int yylno = yyrline[yyrule]; |
---|
[458] | 755 | int yynrhs = yyr2[yyrule]; |
---|
| 756 | int yyi; |
---|
| 757 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", |
---|
[642] | 758 | yyrule - 1, yylno); |
---|
[458] | 759 | /* The symbols being reduced. */ |
---|
| 760 | for (yyi = 0; yyi < yynrhs; yyi++) |
---|
| 761 | { |
---|
| 762 | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
---|
[642] | 763 | yy_symbol_print (stderr, |
---|
| 764 | yystos[yyssp[yyi + 1 - yynrhs]], |
---|
| 765 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
---|
| 766 | ); |
---|
[458] | 767 | YYFPRINTF (stderr, "\n"); |
---|
| 768 | } |
---|
| 769 | } |
---|
| 770 | |
---|
[642] | 771 | # define YY_REDUCE_PRINT(Rule) \ |
---|
| 772 | do { \ |
---|
| 773 | if (yydebug) \ |
---|
| 774 | yy_reduce_print (yyssp, yyvsp, Rule); \ |
---|
| 775 | } while (0) |
---|
[458] | 776 | |
---|
| 777 | /* Nonzero means print parse trace. It is left uninitialized so that |
---|
| 778 | multiple parsers can coexist. */ |
---|
| 779 | int yydebug; |
---|
| 780 | #else /* !YYDEBUG */ |
---|
| 781 | # define YYDPRINTF(Args) |
---|
| 782 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
---|
| 783 | # define YY_STACK_PRINT(Bottom, Top) |
---|
| 784 | # define YY_REDUCE_PRINT(Rule) |
---|
| 785 | #endif /* !YYDEBUG */ |
---|
| 786 | |
---|
| 787 | |
---|
| 788 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
---|
[642] | 789 | #ifndef YYINITDEPTH |
---|
[458] | 790 | # define YYINITDEPTH 200 |
---|
| 791 | #endif |
---|
| 792 | |
---|
| 793 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
---|
| 794 | if the built-in stack extension method is used). |
---|
| 795 | |
---|
| 796 | Do not make this value too large; the results are undefined if |
---|
| 797 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
---|
| 798 | evaluated with infinite-precision integer arithmetic. */ |
---|
| 799 | |
---|
| 800 | #ifndef YYMAXDEPTH |
---|
| 801 | # define YYMAXDEPTH 10000 |
---|
| 802 | #endif |
---|
| 803 | |
---|
| 804 | |
---|
| 805 | #if YYERROR_VERBOSE |
---|
| 806 | |
---|
| 807 | # ifndef yystrlen |
---|
| 808 | # if defined __GLIBC__ && defined _STRING_H |
---|
| 809 | # define yystrlen strlen |
---|
| 810 | # else |
---|
| 811 | /* Return the length of YYSTR. */ |
---|
| 812 | static YYSIZE_T |
---|
| 813 | yystrlen (const char *yystr) |
---|
| 814 | { |
---|
| 815 | YYSIZE_T yylen; |
---|
| 816 | for (yylen = 0; yystr[yylen]; yylen++) |
---|
| 817 | continue; |
---|
| 818 | return yylen; |
---|
| 819 | } |
---|
| 820 | # endif |
---|
| 821 | # endif |
---|
| 822 | |
---|
| 823 | # ifndef yystpcpy |
---|
| 824 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
---|
| 825 | # define yystpcpy stpcpy |
---|
| 826 | # else |
---|
| 827 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
---|
| 828 | YYDEST. */ |
---|
| 829 | static char * |
---|
| 830 | yystpcpy (char *yydest, const char *yysrc) |
---|
| 831 | { |
---|
| 832 | char *yyd = yydest; |
---|
| 833 | const char *yys = yysrc; |
---|
| 834 | |
---|
| 835 | while ((*yyd++ = *yys++) != '\0') |
---|
| 836 | continue; |
---|
| 837 | |
---|
| 838 | return yyd - 1; |
---|
| 839 | } |
---|
| 840 | # endif |
---|
| 841 | # endif |
---|
| 842 | |
---|
| 843 | # ifndef yytnamerr |
---|
| 844 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
---|
| 845 | quotes and backslashes, so that it's suitable for yyerror. The |
---|
| 846 | heuristic is that double-quoting is unnecessary unless the string |
---|
| 847 | contains an apostrophe, a comma, or backslash (other than |
---|
| 848 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
---|
| 849 | null, do not copy; instead, return the length of what the result |
---|
| 850 | would have been. */ |
---|
| 851 | static YYSIZE_T |
---|
| 852 | yytnamerr (char *yyres, const char *yystr) |
---|
| 853 | { |
---|
| 854 | if (*yystr == '"') |
---|
| 855 | { |
---|
| 856 | YYSIZE_T yyn = 0; |
---|
| 857 | char const *yyp = yystr; |
---|
| 858 | |
---|
| 859 | for (;;) |
---|
[642] | 860 | switch (*++yyp) |
---|
| 861 | { |
---|
| 862 | case '\'': |
---|
| 863 | case ',': |
---|
| 864 | goto do_not_strip_quotes; |
---|
[458] | 865 | |
---|
[642] | 866 | case '\\': |
---|
| 867 | if (*++yyp != '\\') |
---|
| 868 | goto do_not_strip_quotes; |
---|
| 869 | /* Fall through. */ |
---|
| 870 | default: |
---|
| 871 | if (yyres) |
---|
| 872 | yyres[yyn] = *yyp; |
---|
| 873 | yyn++; |
---|
| 874 | break; |
---|
[458] | 875 | |
---|
[642] | 876 | case '"': |
---|
| 877 | if (yyres) |
---|
| 878 | yyres[yyn] = '\0'; |
---|
| 879 | return yyn; |
---|
| 880 | } |
---|
[458] | 881 | do_not_strip_quotes: ; |
---|
| 882 | } |
---|
| 883 | |
---|
| 884 | if (! yyres) |
---|
| 885 | return yystrlen (yystr); |
---|
| 886 | |
---|
| 887 | return yystpcpy (yyres, yystr) - yyres; |
---|
| 888 | } |
---|
| 889 | # endif |
---|
| 890 | |
---|
[642] | 891 | /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message |
---|
| 892 | about the unexpected token YYTOKEN for the state stack whose top is |
---|
| 893 | YYSSP. |
---|
| 894 | |
---|
| 895 | Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is |
---|
| 896 | not large enough to hold the message. In that case, also set |
---|
| 897 | *YYMSG_ALLOC to the required number of bytes. Return 2 if the |
---|
| 898 | required number of bytes is too large to store. */ |
---|
| 899 | static int |
---|
| 900 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, |
---|
| 901 | yytype_int16 *yyssp, int yytoken) |
---|
[458] | 902 | { |
---|
[642] | 903 | YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); |
---|
| 904 | YYSIZE_T yysize = yysize0; |
---|
| 905 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
---|
| 906 | /* Internationalized format string. */ |
---|
| 907 | const char *yyformat = YY_NULLPTR; |
---|
| 908 | /* Arguments of yyformat. */ |
---|
| 909 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
---|
| 910 | /* Number of reported tokens (one for the "unexpected", one per |
---|
| 911 | "expected"). */ |
---|
| 912 | int yycount = 0; |
---|
[458] | 913 | |
---|
[642] | 914 | /* There are many possibilities here to consider: |
---|
| 915 | - If this state is a consistent state with a default action, then |
---|
| 916 | the only way this function was invoked is if the default action |
---|
| 917 | is an error action. In that case, don't check for expected |
---|
| 918 | tokens because there are none. |
---|
| 919 | - The only way there can be no lookahead present (in yychar) is if |
---|
| 920 | this state is a consistent state with a default action. Thus, |
---|
| 921 | detecting the absence of a lookahead is sufficient to determine |
---|
| 922 | that there is no unexpected or expected token to report. In that |
---|
| 923 | case, just report a simple "syntax error". |
---|
| 924 | - Don't assume there isn't a lookahead just because this state is a |
---|
| 925 | consistent state with a default action. There might have been a |
---|
| 926 | previous inconsistent state, consistent state with a non-default |
---|
| 927 | action, or user semantic action that manipulated yychar. |
---|
| 928 | - Of course, the expected token list depends on states to have |
---|
| 929 | correct lookahead information, and it depends on the parser not |
---|
| 930 | to perform extra reductions after fetching a lookahead from the |
---|
| 931 | scanner and before detecting a syntax error. Thus, state merging |
---|
| 932 | (from LALR or IELR) and default reductions corrupt the expected |
---|
| 933 | token list. However, the list is correct for canonical LR with |
---|
| 934 | one exception: it will still contain any token that will not be |
---|
| 935 | accepted due to an error action in a later state. |
---|
| 936 | */ |
---|
| 937 | if (yytoken != YYEMPTY) |
---|
[458] | 938 | { |
---|
[642] | 939 | int yyn = yypact[*yyssp]; |
---|
| 940 | yyarg[yycount++] = yytname[yytoken]; |
---|
| 941 | if (!yypact_value_is_default (yyn)) |
---|
| 942 | { |
---|
| 943 | /* Start YYX at -YYN if negative to avoid negative indexes in |
---|
| 944 | YYCHECK. In other words, skip the first -YYN actions for |
---|
| 945 | this state because they are default actions. */ |
---|
| 946 | int yyxbegin = yyn < 0 ? -yyn : 0; |
---|
| 947 | /* Stay within bounds of both yycheck and yytname. */ |
---|
| 948 | int yychecklim = YYLAST - yyn + 1; |
---|
| 949 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
---|
| 950 | int yyx; |
---|
[458] | 951 | |
---|
[642] | 952 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
---|
| 953 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR |
---|
| 954 | && !yytable_value_is_error (yytable[yyx + yyn])) |
---|
| 955 | { |
---|
| 956 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
---|
| 957 | { |
---|
| 958 | yycount = 1; |
---|
| 959 | yysize = yysize0; |
---|
| 960 | break; |
---|
| 961 | } |
---|
| 962 | yyarg[yycount++] = yytname[yyx]; |
---|
| 963 | { |
---|
| 964 | YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); |
---|
| 965 | if (! (yysize <= yysize1 |
---|
| 966 | && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
---|
| 967 | return 2; |
---|
| 968 | yysize = yysize1; |
---|
| 969 | } |
---|
| 970 | } |
---|
| 971 | } |
---|
| 972 | } |
---|
[458] | 973 | |
---|
[642] | 974 | switch (yycount) |
---|
| 975 | { |
---|
| 976 | # define YYCASE_(N, S) \ |
---|
| 977 | case N: \ |
---|
| 978 | yyformat = S; \ |
---|
| 979 | break |
---|
| 980 | YYCASE_(0, YY_("syntax error")); |
---|
| 981 | YYCASE_(1, YY_("syntax error, unexpected %s")); |
---|
| 982 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); |
---|
| 983 | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); |
---|
| 984 | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); |
---|
| 985 | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); |
---|
| 986 | # undef YYCASE_ |
---|
| 987 | } |
---|
[458] | 988 | |
---|
[642] | 989 | { |
---|
| 990 | YYSIZE_T yysize1 = yysize + yystrlen (yyformat); |
---|
| 991 | if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
---|
| 992 | return 2; |
---|
| 993 | yysize = yysize1; |
---|
| 994 | } |
---|
[458] | 995 | |
---|
[642] | 996 | if (*yymsg_alloc < yysize) |
---|
| 997 | { |
---|
| 998 | *yymsg_alloc = 2 * yysize; |
---|
| 999 | if (! (yysize <= *yymsg_alloc |
---|
| 1000 | && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
---|
| 1001 | *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
---|
| 1002 | return 1; |
---|
| 1003 | } |
---|
[458] | 1004 | |
---|
[642] | 1005 | /* Avoid sprintf, as that infringes on the user's name space. |
---|
| 1006 | Don't have undefined behavior even if the translation |
---|
| 1007 | produced a string with the wrong number of "%s"s. */ |
---|
| 1008 | { |
---|
| 1009 | char *yyp = *yymsg; |
---|
| 1010 | int yyi = 0; |
---|
| 1011 | while ((*yyp = *yyformat) != '\0') |
---|
| 1012 | if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) |
---|
| 1013 | { |
---|
| 1014 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
---|
| 1015 | yyformat += 2; |
---|
| 1016 | } |
---|
| 1017 | else |
---|
| 1018 | { |
---|
| 1019 | yyp++; |
---|
| 1020 | yyformat++; |
---|
| 1021 | } |
---|
| 1022 | } |
---|
| 1023 | return 0; |
---|
[458] | 1024 | } |
---|
| 1025 | #endif /* YYERROR_VERBOSE */ |
---|
| 1026 | |
---|
| 1027 | /*-----------------------------------------------. |
---|
| 1028 | | Release the memory associated to this symbol. | |
---|
| 1029 | `-----------------------------------------------*/ |
---|
| 1030 | |
---|
| 1031 | static void |
---|
| 1032 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
---|
| 1033 | { |
---|
| 1034 | YYUSE (yyvaluep); |
---|
| 1035 | if (!yymsg) |
---|
| 1036 | yymsg = "Deleting"; |
---|
| 1037 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
---|
| 1038 | |
---|
[642] | 1039 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
---|
| 1040 | YYUSE (yytype); |
---|
| 1041 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
---|
[458] | 1042 | } |
---|
| 1043 | |
---|
| 1044 | |
---|
| 1045 | |
---|
[642] | 1046 | |
---|
[458] | 1047 | /* The lookahead symbol. */ |
---|
| 1048 | int yychar; |
---|
| 1049 | |
---|
| 1050 | /* The semantic value of the lookahead symbol. */ |
---|
| 1051 | YYSTYPE yylval; |
---|
| 1052 | /* Number of syntax errors so far. */ |
---|
| 1053 | int yynerrs; |
---|
| 1054 | |
---|
| 1055 | |
---|
[642] | 1056 | /*----------. |
---|
| 1057 | | yyparse. | |
---|
| 1058 | `----------*/ |
---|
[458] | 1059 | |
---|
| 1060 | int |
---|
| 1061 | yyparse (void) |
---|
| 1062 | { |
---|
| 1063 | int yystate; |
---|
| 1064 | /* Number of tokens to shift before error messages enabled. */ |
---|
| 1065 | int yyerrstatus; |
---|
| 1066 | |
---|
| 1067 | /* The stacks and their tools: |
---|
[642] | 1068 | 'yyss': related to states. |
---|
| 1069 | 'yyvs': related to semantic values. |
---|
[458] | 1070 | |
---|
[642] | 1071 | Refer to the stacks through separate pointers, to allow yyoverflow |
---|
[458] | 1072 | to reallocate them elsewhere. */ |
---|
| 1073 | |
---|
| 1074 | /* The state stack. */ |
---|
| 1075 | yytype_int16 yyssa[YYINITDEPTH]; |
---|
| 1076 | yytype_int16 *yyss; |
---|
| 1077 | yytype_int16 *yyssp; |
---|
| 1078 | |
---|
| 1079 | /* The semantic value stack. */ |
---|
| 1080 | YYSTYPE yyvsa[YYINITDEPTH]; |
---|
| 1081 | YYSTYPE *yyvs; |
---|
| 1082 | YYSTYPE *yyvsp; |
---|
| 1083 | |
---|
| 1084 | YYSIZE_T yystacksize; |
---|
| 1085 | |
---|
| 1086 | int yyn; |
---|
| 1087 | int yyresult; |
---|
| 1088 | /* Lookahead token as an internal (translated) token number. */ |
---|
[642] | 1089 | int yytoken = 0; |
---|
[458] | 1090 | /* The variables used to return semantic value and location from the |
---|
| 1091 | action routines. */ |
---|
| 1092 | YYSTYPE yyval; |
---|
| 1093 | |
---|
| 1094 | #if YYERROR_VERBOSE |
---|
| 1095 | /* Buffer for error messages, and its allocated size. */ |
---|
| 1096 | char yymsgbuf[128]; |
---|
| 1097 | char *yymsg = yymsgbuf; |
---|
| 1098 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
---|
| 1099 | #endif |
---|
| 1100 | |
---|
| 1101 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
---|
| 1102 | |
---|
| 1103 | /* The number of symbols on the RHS of the reduced rule. |
---|
| 1104 | Keep to zero when no symbol should be popped. */ |
---|
| 1105 | int yylen = 0; |
---|
| 1106 | |
---|
[642] | 1107 | yyssp = yyss = yyssa; |
---|
| 1108 | yyvsp = yyvs = yyvsa; |
---|
[458] | 1109 | yystacksize = YYINITDEPTH; |
---|
| 1110 | |
---|
| 1111 | YYDPRINTF ((stderr, "Starting parse\n")); |
---|
| 1112 | |
---|
| 1113 | yystate = 0; |
---|
| 1114 | yyerrstatus = 0; |
---|
| 1115 | yynerrs = 0; |
---|
| 1116 | yychar = YYEMPTY; /* Cause a token to be read. */ |
---|
| 1117 | goto yysetstate; |
---|
| 1118 | |
---|
| 1119 | /*------------------------------------------------------------. |
---|
| 1120 | | yynewstate -- Push a new state, which is found in yystate. | |
---|
| 1121 | `------------------------------------------------------------*/ |
---|
| 1122 | yynewstate: |
---|
| 1123 | /* In all cases, when you get here, the value and location stacks |
---|
| 1124 | have just been pushed. So pushing a state here evens the stacks. */ |
---|
| 1125 | yyssp++; |
---|
| 1126 | |
---|
| 1127 | yysetstate: |
---|
| 1128 | *yyssp = yystate; |
---|
| 1129 | |
---|
| 1130 | if (yyss + yystacksize - 1 <= yyssp) |
---|
| 1131 | { |
---|
| 1132 | /* Get the current used size of the three stacks, in elements. */ |
---|
| 1133 | YYSIZE_T yysize = yyssp - yyss + 1; |
---|
| 1134 | |
---|
| 1135 | #ifdef yyoverflow |
---|
| 1136 | { |
---|
[642] | 1137 | /* Give user a chance to reallocate the stack. Use copies of |
---|
| 1138 | these so that the &'s don't force the real ones into |
---|
| 1139 | memory. */ |
---|
| 1140 | YYSTYPE *yyvs1 = yyvs; |
---|
| 1141 | yytype_int16 *yyss1 = yyss; |
---|
[458] | 1142 | |
---|
[642] | 1143 | /* Each stack pointer address is followed by the size of the |
---|
| 1144 | data in use in that stack, in bytes. This used to be a |
---|
| 1145 | conditional around just the two extra args, but that might |
---|
| 1146 | be undefined if yyoverflow is a macro. */ |
---|
| 1147 | yyoverflow (YY_("memory exhausted"), |
---|
| 1148 | &yyss1, yysize * sizeof (*yyssp), |
---|
| 1149 | &yyvs1, yysize * sizeof (*yyvsp), |
---|
| 1150 | &yystacksize); |
---|
[458] | 1151 | |
---|
[642] | 1152 | yyss = yyss1; |
---|
| 1153 | yyvs = yyvs1; |
---|
[458] | 1154 | } |
---|
| 1155 | #else /* no yyoverflow */ |
---|
| 1156 | # ifndef YYSTACK_RELOCATE |
---|
| 1157 | goto yyexhaustedlab; |
---|
| 1158 | # else |
---|
| 1159 | /* Extend the stack our own way. */ |
---|
| 1160 | if (YYMAXDEPTH <= yystacksize) |
---|
[642] | 1161 | goto yyexhaustedlab; |
---|
[458] | 1162 | yystacksize *= 2; |
---|
| 1163 | if (YYMAXDEPTH < yystacksize) |
---|
[642] | 1164 | yystacksize = YYMAXDEPTH; |
---|
[458] | 1165 | |
---|
| 1166 | { |
---|
[642] | 1167 | yytype_int16 *yyss1 = yyss; |
---|
| 1168 | union yyalloc *yyptr = |
---|
| 1169 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
---|
| 1170 | if (! yyptr) |
---|
| 1171 | goto yyexhaustedlab; |
---|
| 1172 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
---|
| 1173 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
---|
[458] | 1174 | # undef YYSTACK_RELOCATE |
---|
[642] | 1175 | if (yyss1 != yyssa) |
---|
| 1176 | YYSTACK_FREE (yyss1); |
---|
[458] | 1177 | } |
---|
| 1178 | # endif |
---|
| 1179 | #endif /* no yyoverflow */ |
---|
| 1180 | |
---|
| 1181 | yyssp = yyss + yysize - 1; |
---|
| 1182 | yyvsp = yyvs + yysize - 1; |
---|
| 1183 | |
---|
| 1184 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
---|
[642] | 1185 | (unsigned long int) yystacksize)); |
---|
[458] | 1186 | |
---|
| 1187 | if (yyss + yystacksize - 1 <= yyssp) |
---|
[642] | 1188 | YYABORT; |
---|
[458] | 1189 | } |
---|
| 1190 | |
---|
| 1191 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
---|
| 1192 | |
---|
| 1193 | if (yystate == YYFINAL) |
---|
| 1194 | YYACCEPT; |
---|
| 1195 | |
---|
| 1196 | goto yybackup; |
---|
| 1197 | |
---|
| 1198 | /*-----------. |
---|
| 1199 | | yybackup. | |
---|
| 1200 | `-----------*/ |
---|
| 1201 | yybackup: |
---|
| 1202 | |
---|
| 1203 | /* Do appropriate processing given the current state. Read a |
---|
| 1204 | lookahead token if we need one and don't already have one. */ |
---|
| 1205 | |
---|
| 1206 | /* First try to decide what to do without reference to lookahead token. */ |
---|
| 1207 | yyn = yypact[yystate]; |
---|
[642] | 1208 | if (yypact_value_is_default (yyn)) |
---|
[458] | 1209 | goto yydefault; |
---|
| 1210 | |
---|
| 1211 | /* Not known => get a lookahead token if don't already have one. */ |
---|
| 1212 | |
---|
| 1213 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
---|
| 1214 | if (yychar == YYEMPTY) |
---|
| 1215 | { |
---|
| 1216 | YYDPRINTF ((stderr, "Reading a token: ")); |
---|
[642] | 1217 | yychar = yylex (); |
---|
[458] | 1218 | } |
---|
| 1219 | |
---|
| 1220 | if (yychar <= YYEOF) |
---|
| 1221 | { |
---|
| 1222 | yychar = yytoken = YYEOF; |
---|
| 1223 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
---|
| 1224 | } |
---|
| 1225 | else |
---|
| 1226 | { |
---|
| 1227 | yytoken = YYTRANSLATE (yychar); |
---|
| 1228 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
---|
| 1229 | } |
---|
| 1230 | |
---|
| 1231 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
---|
| 1232 | detect an error, take that action. */ |
---|
| 1233 | yyn += yytoken; |
---|
| 1234 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
---|
| 1235 | goto yydefault; |
---|
| 1236 | yyn = yytable[yyn]; |
---|
| 1237 | if (yyn <= 0) |
---|
| 1238 | { |
---|
[642] | 1239 | if (yytable_value_is_error (yyn)) |
---|
| 1240 | goto yyerrlab; |
---|
[458] | 1241 | yyn = -yyn; |
---|
| 1242 | goto yyreduce; |
---|
| 1243 | } |
---|
| 1244 | |
---|
| 1245 | /* Count tokens shifted since error; after three, turn off error |
---|
| 1246 | status. */ |
---|
| 1247 | if (yyerrstatus) |
---|
| 1248 | yyerrstatus--; |
---|
| 1249 | |
---|
| 1250 | /* Shift the lookahead token. */ |
---|
| 1251 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
---|
| 1252 | |
---|
| 1253 | /* Discard the shifted token. */ |
---|
| 1254 | yychar = YYEMPTY; |
---|
| 1255 | |
---|
| 1256 | yystate = yyn; |
---|
[642] | 1257 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
---|
[458] | 1258 | *++yyvsp = yylval; |
---|
[642] | 1259 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
---|
[458] | 1260 | |
---|
| 1261 | goto yynewstate; |
---|
| 1262 | |
---|
| 1263 | |
---|
| 1264 | /*-----------------------------------------------------------. |
---|
| 1265 | | yydefault -- do the default action for the current state. | |
---|
| 1266 | `-----------------------------------------------------------*/ |
---|
| 1267 | yydefault: |
---|
| 1268 | yyn = yydefact[yystate]; |
---|
| 1269 | if (yyn == 0) |
---|
| 1270 | goto yyerrlab; |
---|
| 1271 | goto yyreduce; |
---|
| 1272 | |
---|
| 1273 | |
---|
| 1274 | /*-----------------------------. |
---|
| 1275 | | yyreduce -- Do a reduction. | |
---|
| 1276 | `-----------------------------*/ |
---|
| 1277 | yyreduce: |
---|
| 1278 | /* yyn is the number of a rule to reduce with. */ |
---|
| 1279 | yylen = yyr2[yyn]; |
---|
| 1280 | |
---|
| 1281 | /* If YYLEN is nonzero, implement the default value of the action: |
---|
[642] | 1282 | '$$ = $1'. |
---|
[458] | 1283 | |
---|
| 1284 | Otherwise, the following line sets YYVAL to garbage. |
---|
| 1285 | This behavior is undocumented and Bison |
---|
| 1286 | users should not rely upon it. Assigning to YYVAL |
---|
| 1287 | unconditionally makes the parser a bit smaller, and it avoids a |
---|
| 1288 | GCC warning that YYVAL may be used uninitialized. */ |
---|
| 1289 | yyval = yyvsp[1-yylen]; |
---|
| 1290 | |
---|
| 1291 | |
---|
| 1292 | YY_REDUCE_PRINT (yyn); |
---|
| 1293 | switch (yyn) |
---|
| 1294 | { |
---|
| 1295 | case 2: |
---|
[642] | 1296 | #line 59 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1297 | { /* Nothing to do */ } |
---|
| 1298 | #line 1299 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1299 | break; |
---|
| 1300 | |
---|
| 1301 | case 3: |
---|
[642] | 1302 | #line 60 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1303 | { parsed = (yyvsp[-1].filterNode); } |
---|
| 1304 | #line 1305 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1305 | break; |
---|
| 1306 | |
---|
| 1307 | case 4: |
---|
[642] | 1308 | #line 64 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1309 | { (yyval.scalarNode) = new CScalarValExprNode(*(yyvsp[0].str)); delete (yyvsp[0].str); } |
---|
| 1310 | #line 1311 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1311 | break; |
---|
| 1312 | |
---|
| 1313 | case 5: |
---|
[642] | 1314 | #line 65 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1315 | { (yyval.scalarNode) = new CScalarVarExprNode(*(yyvsp[0].str)); delete (yyvsp[0].str); } |
---|
| 1316 | #line 1317 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1317 | break; |
---|
| 1318 | |
---|
| 1319 | case 6: |
---|
[642] | 1320 | #line 66 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1321 | { (yyval.scalarNode) = new CScalarBinaryOpExprNode((yyvsp[-2].scalarNode), "add", (yyvsp[0].scalarNode)); } |
---|
| 1322 | #line 1323 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1323 | break; |
---|
| 1324 | |
---|
| 1325 | case 7: |
---|
[642] | 1326 | #line 67 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1327 | { (yyval.scalarNode) = new CScalarBinaryOpExprNode((yyvsp[-2].scalarNode), "minus", (yyvsp[0].scalarNode)); } |
---|
| 1328 | #line 1329 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1329 | break; |
---|
| 1330 | |
---|
| 1331 | case 8: |
---|
[642] | 1332 | #line 68 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1333 | { (yyval.scalarNode) = new CScalarBinaryOpExprNode((yyvsp[-2].scalarNode), "mult", (yyvsp[0].scalarNode)); } |
---|
| 1334 | #line 1335 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1335 | break; |
---|
| 1336 | |
---|
| 1337 | case 9: |
---|
[642] | 1338 | #line 69 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1339 | { (yyval.scalarNode) = new CScalarBinaryOpExprNode((yyvsp[-2].scalarNode), "div", (yyvsp[0].scalarNode)); } |
---|
| 1340 | #line 1341 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1341 | break; |
---|
| 1342 | |
---|
| 1343 | case 10: |
---|
[642] | 1344 | #line 70 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1345 | { (yyval.scalarNode) = new CScalarUnaryOpExprNode("neg", (yyvsp[0].scalarNode)); } |
---|
| 1346 | #line 1347 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1347 | break; |
---|
| 1348 | |
---|
| 1349 | case 11: |
---|
[642] | 1350 | #line 71 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1351 | { (yyval.scalarNode) = new CScalarBinaryOpExprNode((yyvsp[-2].scalarNode), "pow", (yyvsp[0].scalarNode)); } |
---|
| 1352 | #line 1353 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1353 | break; |
---|
| 1354 | |
---|
| 1355 | case 12: |
---|
[642] | 1356 | #line 72 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1357 | { (yyval.scalarNode) = (yyvsp[-1].scalarNode); } |
---|
| 1358 | #line 1359 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1359 | break; |
---|
| 1360 | |
---|
| 1361 | case 13: |
---|
[642] | 1362 | #line 73 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1363 | { (yyval.scalarNode) = new CScalarUnaryOpExprNode(*(yyvsp[-3].str), (yyvsp[-1].scalarNode)); delete (yyvsp[-3].str); } |
---|
| 1364 | #line 1365 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1365 | break; |
---|
| 1366 | |
---|
| 1367 | case 14: |
---|
[642] | 1368 | #line 77 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1369 | { (yyval.filterNode) = new CFilterFieldExprNode(*(yyvsp[0].str)); delete (yyvsp[0].str); } |
---|
| 1370 | #line 1371 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1371 | break; |
---|
| 1372 | |
---|
| 1373 | case 15: |
---|
[642] | 1374 | #line 78 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
[643] | 1375 | { (yyval.filterNode) = new CFilterTemporalFieldExprNode(*(yyvsp[0].str)); delete (yyvsp[0].str); } |
---|
[642] | 1376 | #line 1377 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1377 | break; |
---|
| 1378 | |
---|
| 1379 | case 16: |
---|
[642] | 1380 | #line 79 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1381 | { (yyval.filterNode) = new CFilterFieldFieldOpExprNode((yyvsp[-2].filterNode), "add", (yyvsp[0].filterNode)); } |
---|
| 1382 | #line 1383 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1383 | break; |
---|
| 1384 | |
---|
| 1385 | case 17: |
---|
[642] | 1386 | #line 80 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1387 | { (yyval.filterNode) = new CFilterFieldFieldOpExprNode((yyvsp[-2].filterNode), "minus", (yyvsp[0].filterNode)); } |
---|
| 1388 | #line 1389 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1389 | break; |
---|
| 1390 | |
---|
| 1391 | case 18: |
---|
[642] | 1392 | #line 81 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1393 | { (yyval.filterNode) = new CFilterFieldFieldOpExprNode((yyvsp[-2].filterNode), "mult", (yyvsp[0].filterNode)); } |
---|
| 1394 | #line 1395 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1395 | break; |
---|
| 1396 | |
---|
| 1397 | case 19: |
---|
[642] | 1398 | #line 82 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1399 | { (yyval.filterNode) = new CFilterFieldFieldOpExprNode((yyvsp[-2].filterNode), "div", (yyvsp[0].filterNode)); } |
---|
| 1400 | #line 1401 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1401 | break; |
---|
| 1402 | |
---|
| 1403 | case 20: |
---|
[642] | 1404 | #line 83 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1405 | { (yyval.filterNode) = new CFilterUnaryOpExprNode("neg", (yyvsp[0].filterNode)); } |
---|
| 1406 | #line 1407 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1407 | break; |
---|
| 1408 | |
---|
| 1409 | case 21: |
---|
[642] | 1410 | #line 84 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1411 | { (yyval.filterNode) = new CFilterFieldFieldOpExprNode((yyvsp[-2].filterNode), "pow", (yyvsp[0].filterNode)); } |
---|
| 1412 | #line 1413 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1413 | break; |
---|
| 1414 | |
---|
| 1415 | case 22: |
---|
[642] | 1416 | #line 85 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1417 | { (yyval.filterNode) = (yyvsp[-1].filterNode); } |
---|
| 1418 | #line 1419 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1419 | break; |
---|
| 1420 | |
---|
| 1421 | case 23: |
---|
[642] | 1422 | #line 86 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1423 | { (yyval.filterNode) = new CFilterFieldScalarOpExprNode((yyvsp[-2].filterNode), "add", (yyvsp[0].scalarNode)); } |
---|
| 1424 | #line 1425 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1425 | break; |
---|
| 1426 | |
---|
| 1427 | case 24: |
---|
[642] | 1428 | #line 87 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1429 | { (yyval.filterNode) = new CFilterScalarFieldOpExprNode((yyvsp[-2].scalarNode), "add", (yyvsp[0].filterNode)); } |
---|
| 1430 | #line 1431 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1431 | break; |
---|
| 1432 | |
---|
| 1433 | case 25: |
---|
[642] | 1434 | #line 88 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1435 | { (yyval.filterNode) = new CFilterFieldScalarOpExprNode((yyvsp[-2].filterNode), "minus", (yyvsp[0].scalarNode)); } |
---|
| 1436 | #line 1437 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1437 | break; |
---|
| 1438 | |
---|
| 1439 | case 26: |
---|
[642] | 1440 | #line 89 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1441 | { (yyval.filterNode) = new CFilterScalarFieldOpExprNode((yyvsp[-2].scalarNode), "minus", (yyvsp[0].filterNode)); } |
---|
| 1442 | #line 1443 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1443 | break; |
---|
| 1444 | |
---|
| 1445 | case 27: |
---|
[642] | 1446 | #line 90 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1447 | { (yyval.filterNode) = new CFilterFieldScalarOpExprNode((yyvsp[-2].filterNode), "mult", (yyvsp[0].scalarNode)); } |
---|
| 1448 | #line 1449 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1449 | break; |
---|
| 1450 | |
---|
| 1451 | case 28: |
---|
[642] | 1452 | #line 91 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1453 | { (yyval.filterNode) = new CFilterScalarFieldOpExprNode((yyvsp[-2].scalarNode), "mult", (yyvsp[0].filterNode)); } |
---|
| 1454 | #line 1455 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1455 | break; |
---|
| 1456 | |
---|
| 1457 | case 29: |
---|
[642] | 1458 | #line 92 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1459 | { (yyval.filterNode) = new CFilterFieldScalarOpExprNode((yyvsp[-2].filterNode), "div", (yyvsp[0].scalarNode)); } |
---|
| 1460 | #line 1461 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1461 | break; |
---|
| 1462 | |
---|
| 1463 | case 30: |
---|
[642] | 1464 | #line 93 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1465 | { (yyval.filterNode) = new CFilterScalarFieldOpExprNode((yyvsp[-2].scalarNode), "div", (yyvsp[0].filterNode)); } |
---|
| 1466 | #line 1467 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1467 | break; |
---|
| 1468 | |
---|
| 1469 | case 31: |
---|
[642] | 1470 | #line 94 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1471 | { (yyval.filterNode) = new CFilterFieldScalarOpExprNode((yyvsp[-2].filterNode), "pow", (yyvsp[0].scalarNode)); } |
---|
| 1472 | #line 1473 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1473 | break; |
---|
| 1474 | |
---|
| 1475 | case 32: |
---|
[642] | 1476 | #line 95 "yacc_parser.yacc" /* yacc.c:1646 */ |
---|
| 1477 | { (yyval.filterNode) = new CFilterUnaryOpExprNode(*(yyvsp[-3].str), (yyvsp[-1].filterNode)); delete (yyvsp[-3].str); } |
---|
| 1478 | #line 1479 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1479 | break; |
---|
| 1480 | |
---|
| 1481 | |
---|
[642] | 1482 | #line 1483 "yacc_parser.cpp" /* yacc.c:1646 */ |
---|
[458] | 1483 | default: break; |
---|
| 1484 | } |
---|
[642] | 1485 | /* User semantic actions sometimes alter yychar, and that requires |
---|
| 1486 | that yytoken be updated with the new translation. We take the |
---|
| 1487 | approach of translating immediately before every use of yytoken. |
---|
| 1488 | One alternative is translating here after every semantic action, |
---|
| 1489 | but that translation would be missed if the semantic action invokes |
---|
| 1490 | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or |
---|
| 1491 | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
---|
| 1492 | incorrect destructor might then be invoked immediately. In the |
---|
| 1493 | case of YYERROR or YYBACKUP, subsequent parser actions might lead |
---|
| 1494 | to an incorrect destructor call or verbose syntax error message |
---|
| 1495 | before the lookahead is translated. */ |
---|
[458] | 1496 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
---|
| 1497 | |
---|
| 1498 | YYPOPSTACK (yylen); |
---|
| 1499 | yylen = 0; |
---|
| 1500 | YY_STACK_PRINT (yyss, yyssp); |
---|
| 1501 | |
---|
| 1502 | *++yyvsp = yyval; |
---|
| 1503 | |
---|
[642] | 1504 | /* Now 'shift' the result of the reduction. Determine what state |
---|
[458] | 1505 | that goes to, based on the state we popped back to and the rule |
---|
| 1506 | number reduced by. */ |
---|
| 1507 | |
---|
| 1508 | yyn = yyr1[yyn]; |
---|
| 1509 | |
---|
| 1510 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
---|
| 1511 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
---|
| 1512 | yystate = yytable[yystate]; |
---|
| 1513 | else |
---|
| 1514 | yystate = yydefgoto[yyn - YYNTOKENS]; |
---|
| 1515 | |
---|
| 1516 | goto yynewstate; |
---|
| 1517 | |
---|
| 1518 | |
---|
[642] | 1519 | /*--------------------------------------. |
---|
| 1520 | | yyerrlab -- here on detecting error. | |
---|
| 1521 | `--------------------------------------*/ |
---|
[458] | 1522 | yyerrlab: |
---|
[642] | 1523 | /* Make sure we have latest lookahead translation. See comments at |
---|
| 1524 | user semantic actions for why this is necessary. */ |
---|
| 1525 | yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); |
---|
| 1526 | |
---|
[458] | 1527 | /* If not already recovering from an error, report this error. */ |
---|
| 1528 | if (!yyerrstatus) |
---|
| 1529 | { |
---|
| 1530 | ++yynerrs; |
---|
| 1531 | #if ! YYERROR_VERBOSE |
---|
| 1532 | yyerror (YY_("syntax error")); |
---|
| 1533 | #else |
---|
[642] | 1534 | # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ |
---|
| 1535 | yyssp, yytoken) |
---|
[458] | 1536 | { |
---|
[642] | 1537 | char const *yymsgp = YY_("syntax error"); |
---|
| 1538 | int yysyntax_error_status; |
---|
| 1539 | yysyntax_error_status = YYSYNTAX_ERROR; |
---|
| 1540 | if (yysyntax_error_status == 0) |
---|
| 1541 | yymsgp = yymsg; |
---|
| 1542 | else if (yysyntax_error_status == 1) |
---|
| 1543 | { |
---|
| 1544 | if (yymsg != yymsgbuf) |
---|
| 1545 | YYSTACK_FREE (yymsg); |
---|
| 1546 | yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); |
---|
| 1547 | if (!yymsg) |
---|
| 1548 | { |
---|
| 1549 | yymsg = yymsgbuf; |
---|
| 1550 | yymsg_alloc = sizeof yymsgbuf; |
---|
| 1551 | yysyntax_error_status = 2; |
---|
| 1552 | } |
---|
| 1553 | else |
---|
| 1554 | { |
---|
| 1555 | yysyntax_error_status = YYSYNTAX_ERROR; |
---|
| 1556 | yymsgp = yymsg; |
---|
| 1557 | } |
---|
| 1558 | } |
---|
| 1559 | yyerror (yymsgp); |
---|
| 1560 | if (yysyntax_error_status == 2) |
---|
| 1561 | goto yyexhaustedlab; |
---|
[458] | 1562 | } |
---|
[642] | 1563 | # undef YYSYNTAX_ERROR |
---|
[458] | 1564 | #endif |
---|
| 1565 | } |
---|
| 1566 | |
---|
| 1567 | |
---|
| 1568 | |
---|
| 1569 | if (yyerrstatus == 3) |
---|
| 1570 | { |
---|
| 1571 | /* If just tried and failed to reuse lookahead token after an |
---|
[642] | 1572 | error, discard it. */ |
---|
[458] | 1573 | |
---|
| 1574 | if (yychar <= YYEOF) |
---|
[642] | 1575 | { |
---|
| 1576 | /* Return failure if at end of input. */ |
---|
| 1577 | if (yychar == YYEOF) |
---|
| 1578 | YYABORT; |
---|
| 1579 | } |
---|
[458] | 1580 | else |
---|
[642] | 1581 | { |
---|
| 1582 | yydestruct ("Error: discarding", |
---|
| 1583 | yytoken, &yylval); |
---|
| 1584 | yychar = YYEMPTY; |
---|
| 1585 | } |
---|
[458] | 1586 | } |
---|
| 1587 | |
---|
| 1588 | /* Else will try to reuse lookahead token after shifting the error |
---|
| 1589 | token. */ |
---|
| 1590 | goto yyerrlab1; |
---|
| 1591 | |
---|
| 1592 | |
---|
| 1593 | /*---------------------------------------------------. |
---|
| 1594 | | yyerrorlab -- error raised explicitly by YYERROR. | |
---|
| 1595 | `---------------------------------------------------*/ |
---|
| 1596 | yyerrorlab: |
---|
| 1597 | |
---|
| 1598 | /* Pacify compilers like GCC when the user code never invokes |
---|
| 1599 | YYERROR and the label yyerrorlab therefore never appears in user |
---|
| 1600 | code. */ |
---|
| 1601 | if (/*CONSTCOND*/ 0) |
---|
| 1602 | goto yyerrorlab; |
---|
| 1603 | |
---|
[642] | 1604 | /* Do not reclaim the symbols of the rule whose action triggered |
---|
[458] | 1605 | this YYERROR. */ |
---|
| 1606 | YYPOPSTACK (yylen); |
---|
| 1607 | yylen = 0; |
---|
| 1608 | YY_STACK_PRINT (yyss, yyssp); |
---|
| 1609 | yystate = *yyssp; |
---|
| 1610 | goto yyerrlab1; |
---|
| 1611 | |
---|
| 1612 | |
---|
| 1613 | /*-------------------------------------------------------------. |
---|
| 1614 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
---|
| 1615 | `-------------------------------------------------------------*/ |
---|
| 1616 | yyerrlab1: |
---|
[642] | 1617 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
---|
[458] | 1618 | |
---|
| 1619 | for (;;) |
---|
| 1620 | { |
---|
| 1621 | yyn = yypact[yystate]; |
---|
[642] | 1622 | if (!yypact_value_is_default (yyn)) |
---|
| 1623 | { |
---|
| 1624 | yyn += YYTERROR; |
---|
| 1625 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
---|
| 1626 | { |
---|
| 1627 | yyn = yytable[yyn]; |
---|
| 1628 | if (0 < yyn) |
---|
| 1629 | break; |
---|
| 1630 | } |
---|
| 1631 | } |
---|
[458] | 1632 | |
---|
| 1633 | /* Pop the current state because it cannot handle the error token. */ |
---|
| 1634 | if (yyssp == yyss) |
---|
[642] | 1635 | YYABORT; |
---|
[458] | 1636 | |
---|
| 1637 | |
---|
| 1638 | yydestruct ("Error: popping", |
---|
[642] | 1639 | yystos[yystate], yyvsp); |
---|
[458] | 1640 | YYPOPSTACK (1); |
---|
| 1641 | yystate = *yyssp; |
---|
| 1642 | YY_STACK_PRINT (yyss, yyssp); |
---|
| 1643 | } |
---|
| 1644 | |
---|
[642] | 1645 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
---|
[458] | 1646 | *++yyvsp = yylval; |
---|
[642] | 1647 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
---|
[458] | 1648 | |
---|
| 1649 | |
---|
| 1650 | /* Shift the error token. */ |
---|
| 1651 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
---|
| 1652 | |
---|
| 1653 | yystate = yyn; |
---|
| 1654 | goto yynewstate; |
---|
| 1655 | |
---|
| 1656 | |
---|
| 1657 | /*-------------------------------------. |
---|
| 1658 | | yyacceptlab -- YYACCEPT comes here. | |
---|
| 1659 | `-------------------------------------*/ |
---|
| 1660 | yyacceptlab: |
---|
| 1661 | yyresult = 0; |
---|
| 1662 | goto yyreturn; |
---|
| 1663 | |
---|
| 1664 | /*-----------------------------------. |
---|
| 1665 | | yyabortlab -- YYABORT comes here. | |
---|
| 1666 | `-----------------------------------*/ |
---|
| 1667 | yyabortlab: |
---|
| 1668 | yyresult = 1; |
---|
| 1669 | goto yyreturn; |
---|
| 1670 | |
---|
[642] | 1671 | #if !defined yyoverflow || YYERROR_VERBOSE |
---|
[458] | 1672 | /*-------------------------------------------------. |
---|
| 1673 | | yyexhaustedlab -- memory exhaustion comes here. | |
---|
| 1674 | `-------------------------------------------------*/ |
---|
| 1675 | yyexhaustedlab: |
---|
| 1676 | yyerror (YY_("memory exhausted")); |
---|
| 1677 | yyresult = 2; |
---|
| 1678 | /* Fall through. */ |
---|
| 1679 | #endif |
---|
| 1680 | |
---|
| 1681 | yyreturn: |
---|
| 1682 | if (yychar != YYEMPTY) |
---|
[642] | 1683 | { |
---|
| 1684 | /* Make sure we have latest lookahead translation. See comments at |
---|
| 1685 | user semantic actions for why this is necessary. */ |
---|
| 1686 | yytoken = YYTRANSLATE (yychar); |
---|
| 1687 | yydestruct ("Cleanup: discarding lookahead", |
---|
| 1688 | yytoken, &yylval); |
---|
| 1689 | } |
---|
| 1690 | /* Do not reclaim the symbols of the rule whose action triggered |
---|
[458] | 1691 | this YYABORT or YYACCEPT. */ |
---|
| 1692 | YYPOPSTACK (yylen); |
---|
| 1693 | YY_STACK_PRINT (yyss, yyssp); |
---|
| 1694 | while (yyssp != yyss) |
---|
| 1695 | { |
---|
| 1696 | yydestruct ("Cleanup: popping", |
---|
[642] | 1697 | yystos[*yyssp], yyvsp); |
---|
[458] | 1698 | YYPOPSTACK (1); |
---|
| 1699 | } |
---|
| 1700 | #ifndef yyoverflow |
---|
| 1701 | if (yyss != yyssa) |
---|
| 1702 | YYSTACK_FREE (yyss); |
---|
| 1703 | #endif |
---|
| 1704 | #if YYERROR_VERBOSE |
---|
| 1705 | if (yymsg != yymsgbuf) |
---|
| 1706 | YYSTACK_FREE (yymsg); |
---|
| 1707 | #endif |
---|
[642] | 1708 | return yyresult; |
---|
[458] | 1709 | } |
---|
[642] | 1710 | #line 97 "yacc_parser.yacc" /* yacc.c:1906 */ |
---|
[458] | 1711 | |
---|
| 1712 | |
---|
| 1713 | extern "C" |
---|
| 1714 | { |
---|
[642] | 1715 | int yyerror(const char *s) |
---|
[458] | 1716 | { |
---|
[642] | 1717 | ERROR("int yyerror(const char *s)", << "Parsing error: " << s << endl); |
---|
[458] | 1718 | } |
---|
| 1719 | } |
---|
| 1720 | |
---|
| 1721 | namespace xios |
---|
| 1722 | { |
---|
[642] | 1723 | IFilterExprNode* parseExpr(const string& strExpr) |
---|
[458] | 1724 | { |
---|
[642] | 1725 | globalInputText = strExpr; |
---|
| 1726 | globalReadOffset = 0; |
---|
[458] | 1727 | yyparse(); |
---|
[642] | 1728 | return parsed; |
---|
[458] | 1729 | } |
---|
| 1730 | } |
---|
| 1731 | |
---|
| 1732 | |
---|