File indexing completed on 2024-04-14 04:00:05

0001 /* A Bison parser, made by GNU Bison 3.8.2.  */
0002 
0003 /* Bison implementation for Yacc-like parsers in C
0004 
0005    Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
0006    Inc.
0007 
0008    This program is free software: you can redistribute it and/or modify
0009    it under the terms of the GNU General Public License as published by
0010    the Free Software Foundation, either version 3 of the License, or
0011    (at your option) any later version.
0012 
0013    This program is distributed in the hope that it will be useful,
0014    but WITHOUT ANY WARRANTY; without even the implied warranty of
0015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0016    GNU General Public License for more details.
0017 
0018    You should have received a copy of the GNU General Public License
0019    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
0020 
0021 /* As a special exception, you may create a larger work that contains
0022    part or all of the Bison parser skeleton and distribute that work
0023    under terms of your choice, so long as that work isn't itself a
0024    parser generator using the skeleton or a modified version thereof
0025    as a parser skeleton.  Alternatively, if you modify or redistribute
0026    the parser skeleton itself, you may (at your option) remove this
0027    special exception, which will cause the skeleton and the resulting
0028    Bison output files to be licensed under the GNU General Public
0029    License without this special exception.
0030 
0031    This special exception was added by the Free Software Foundation in
0032    version 2.2 of Bison.  */
0033 
0034 /* C LALR(1) parser skeleton written by Richard Stallman, by
0035    simplifying the original so-called "semantic" parser.  */
0036 
0037 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
0038    especially those whose name start with YY_ or yy_.  They are
0039    private implementation details that can be changed or removed.  */
0040 
0041 /* All symbols defined below should begin with yy or YY, to avoid
0042    infringing on user name space.  This should be done even for local
0043    variables, as they might otherwise be expanded by user macros.
0044    There are some unavoidable exceptions within include files to
0045    define necessary library symbols; they are noted "INFRINGES ON
0046    USER NAME SPACE" below.  */
0047 
0048 /* Identify Bison output, and Bison version.  */
0049 #define YYBISON 30802
0050 
0051 /* Bison version string.  */
0052 #define YYBISON_VERSION "3.8.2"
0053 
0054 /* Skeleton name.  */
0055 #define YYSKELETON_NAME "yacc.c"
0056 
0057 /* Pure parsers.  */
0058 #define YYPURE 0
0059 
0060 /* Push parsers.  */
0061 #define YYPUSH 0
0062 
0063 /* Pull parsers.  */
0064 #define YYPULL 1
0065 
0066 
0067 
0068 
0069 /* First part of user prologue.  */
0070 #line 1 "libs/bison-input.ypp"
0071 
0072 /*
0073 Copyright 2005-2011 Tomas Mecir <kmuddy@kmuddy.com>
0074 Copyright 2005 Alex Bache <alexbache@ntlworld.com>
0075 
0076 This program is free software; you can redistribute it and/or
0077 modify it under the terms of the GNU General Public License as
0078 published by the Free Software Foundation; either version 2 of 
0079 the License, or (at your option) any later version.
0080 
0081 This program is distributed in the hope that it will be useful,
0082 but WITHOUT ANY WARRANTY; without even the implied warranty of
0083 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0084 GNU General Public License for more details.
0085 
0086 You should have received a copy of the GNU General Public License
0087 along with this program.  If not, see <http://www.gnu.org/licenses/>.
0088 */
0089 
0090    #include <list>
0091   
0092    #include "instructions.h"
0093    
0094    using namespace std;
0095    
0096    // Source code and destination for compiled instructions
0097    const char        *source;
0098    bool               new_source;
0099    list<instruction> *code;
0100    instruction        op;
0101    
0102    // Marker to notify of invalid characters in expression
0103    bool token_error;
0104    
0105    // Functions required by Flex/Bison
0106    int yylex(void);
0107    void yyerror(const char *);
0108    
0109    // Compile an expression into a list of instructions
0110    bool compile(const char        *source_code,
0111                 list<instruction> *compiled_code);
0112    
0113    // Output an 'operation' instruction
0114    void make_op(instruction::instruction_type instr);
0115    
0116    // Output an instruction with an integer operand
0117    void make_integer_op(instruction::instruction_type instr,
0118                         const int                     operand);
0119    
0120    // Output an instruction with a double operand
0121    void make_double_op(instruction::instruction_type instr,
0122                        const double                  operand);
0123    
0124    // Output an instruction with a string operand
0125    void make_string_op(instruction::instruction_type  instr,
0126                        char                          *operand);
0127    
0128 
0129 #line 130 "bison-input.tab.cpp"
0130 
0131 # ifndef YY_CAST
0132 #  ifdef __cplusplus
0133 #   define YY_CAST(Type, Val) static_cast<Type> (Val)
0134 #   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
0135 #  else
0136 #   define YY_CAST(Type, Val) ((Type) (Val))
0137 #   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
0138 #  endif
0139 # endif
0140 # ifndef YY_NULLPTR
0141 #  if defined __cplusplus
0142 #   if 201103L <= __cplusplus
0143 #    define YY_NULLPTR nullptr
0144 #   else
0145 #    define YY_NULLPTR 0
0146 #   endif
0147 #  else
0148 #   define YY_NULLPTR ((void*)0)
0149 #  endif
0150 # endif
0151 
0152 #include "bison-input.tab.hpp"
0153 /* Symbol kind.  */
0154 enum yysymbol_kind_t
0155 {
0156   YYSYMBOL_YYEMPTY = -2,
0157   YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
0158   YYSYMBOL_YYerror = 1,                    /* error  */
0159   YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
0160   YYSYMBOL_INTEGER = 3,                    /* INTEGER  */
0161   YYSYMBOL_DOUBLE_V = 4,                   /* DOUBLE_V  */
0162   YYSYMBOL_STRING_V = 5,                   /* STRING_V  */
0163   YYSYMBOL_STRING_LITERAL = 6,             /* STRING_LITERAL  */
0164   YYSYMBOL_FUNCTION_NAME = 7,              /* FUNCTION_NAME  */
0165   YYSYMBOL_STRING_TYPECAST = 8,            /* STRING_TYPECAST  */
0166   YYSYMBOL_INT_TYPECAST = 9,               /* INT_TYPECAST  */
0167   YYSYMBOL_DOUBLE_TYPECAST = 10,           /* DOUBLE_TYPECAST  */
0168   YYSYMBOL_AND = 11,                       /* AND  */
0169   YYSYMBOL_OR = 12,                        /* OR  */
0170   YYSYMBOL_GT = 13,                        /* GT  */
0171   YYSYMBOL_GE = 14,                        /* GE  */
0172   YYSYMBOL_LT = 15,                        /* LT  */
0173   YYSYMBOL_LE = 16,                        /* LE  */
0174   YYSYMBOL_EQUALS = 17,                    /* EQUALS  */
0175   YYSYMBOL_NOT_EQUALS = 18,                /* NOT_EQUALS  */
0176   YYSYMBOL_EQ = 19,                        /* EQ  */
0177   YYSYMBOL_NE = 20,                        /* NE  */
0178   YYSYMBOL_21_ = 21,                       /* '+'  */
0179   YYSYMBOL_22_ = 22,                       /* '-'  */
0180   YYSYMBOL_23_ = 23,                       /* '.'  */
0181   YYSYMBOL_24_ = 24,                       /* '*'  */
0182   YYSYMBOL_25_ = 25,                       /* '/'  */
0183   YYSYMBOL_UMINUS = 26,                    /* UMINUS  */
0184   YYSYMBOL_27_ = 27,                       /* '!'  */
0185   YYSYMBOL_FUNCTION_CALL = 28,             /* FUNCTION_CALL  */
0186   YYSYMBOL_29_ = 29,                       /* '('  */
0187   YYSYMBOL_30_ = 30,                       /* ')'  */
0188   YYSYMBOL_31_ = 31,                       /* ','  */
0189   YYSYMBOL_YYACCEPT = 32,                  /* $accept  */
0190   YYSYMBOL_expr = 33,                      /* expr  */
0191   YYSYMBOL_func_call = 34,                 /* func_call  */
0192   YYSYMBOL_arg_list = 35                   /* arg_list  */
0193 };
0194 typedef enum yysymbol_kind_t yysymbol_kind_t;
0195 
0196 
0197 
0198 
0199 #ifdef short
0200 # undef short
0201 #endif
0202 
0203 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
0204    <limits.h> and (if available) <stdint.h> are included
0205    so that the code can choose integer types of a good width.  */
0206 
0207 #ifndef __PTRDIFF_MAX__
0208 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
0209 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
0210 #  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
0211 #  define YY_STDINT_H
0212 # endif
0213 #endif
0214 
0215 /* Narrow types that promote to a signed type and that can represent a
0216    signed or unsigned integer of at least N bits.  In tables they can
0217    save space and decrease cache pressure.  Promoting to a signed type
0218    helps avoid bugs in integer arithmetic.  */
0219 
0220 #ifdef __INT_LEAST8_MAX__
0221 typedef __INT_LEAST8_TYPE__ yytype_int8;
0222 #elif defined YY_STDINT_H
0223 typedef int_least8_t yytype_int8;
0224 #else
0225 typedef signed char yytype_int8;
0226 #endif
0227 
0228 #ifdef __INT_LEAST16_MAX__
0229 typedef __INT_LEAST16_TYPE__ yytype_int16;
0230 #elif defined YY_STDINT_H
0231 typedef int_least16_t yytype_int16;
0232 #else
0233 typedef short yytype_int16;
0234 #endif
0235 
0236 /* Work around bug in HP-UX 11.23, which defines these macros
0237    incorrectly for preprocessor constants.  This workaround can likely
0238    be removed in 2023, as HPE has promised support for HP-UX 11.23
0239    (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
0240    <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>.  */
0241 #ifdef __hpux
0242 # undef UINT_LEAST8_MAX
0243 # undef UINT_LEAST16_MAX
0244 # define UINT_LEAST8_MAX 255
0245 # define UINT_LEAST16_MAX 65535
0246 #endif
0247 
0248 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
0249 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
0250 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
0251        && UINT_LEAST8_MAX <= INT_MAX)
0252 typedef uint_least8_t yytype_uint8;
0253 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
0254 typedef unsigned char yytype_uint8;
0255 #else
0256 typedef short yytype_uint8;
0257 #endif
0258 
0259 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
0260 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
0261 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
0262        && UINT_LEAST16_MAX <= INT_MAX)
0263 typedef uint_least16_t yytype_uint16;
0264 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
0265 typedef unsigned short yytype_uint16;
0266 #else
0267 typedef int yytype_uint16;
0268 #endif
0269 
0270 #ifndef YYPTRDIFF_T
0271 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
0272 #  define YYPTRDIFF_T __PTRDIFF_TYPE__
0273 #  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
0274 # elif defined PTRDIFF_MAX
0275 #  ifndef ptrdiff_t
0276 #   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
0277 #  endif
0278 #  define YYPTRDIFF_T ptrdiff_t
0279 #  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
0280 # else
0281 #  define YYPTRDIFF_T long
0282 #  define YYPTRDIFF_MAXIMUM LONG_MAX
0283 # endif
0284 #endif
0285 
0286 #ifndef YYSIZE_T
0287 # ifdef __SIZE_TYPE__
0288 #  define YYSIZE_T __SIZE_TYPE__
0289 # elif defined size_t
0290 #  define YYSIZE_T size_t
0291 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
0292 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
0293 #  define YYSIZE_T size_t
0294 # else
0295 #  define YYSIZE_T unsigned
0296 # endif
0297 #endif
0298 
0299 #define YYSIZE_MAXIMUM                                  \
0300   YY_CAST (YYPTRDIFF_T,                                 \
0301            (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
0302             ? YYPTRDIFF_MAXIMUM                         \
0303             : YY_CAST (YYSIZE_T, -1)))
0304 
0305 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
0306 
0307 
0308 /* Stored state numbers (used for stacks). */
0309 typedef yytype_int8 yy_state_t;
0310 
0311 /* State numbers in computations.  */
0312 typedef int yy_state_fast_t;
0313 
0314 #ifndef YY_
0315 # if defined YYENABLE_NLS && YYENABLE_NLS
0316 #  if ENABLE_NLS
0317 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
0318 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
0319 #  endif
0320 # endif
0321 # ifndef YY_
0322 #  define YY_(Msgid) Msgid
0323 # endif
0324 #endif
0325 
0326 
0327 #ifndef YY_ATTRIBUTE_PURE
0328 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
0329 #  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
0330 # else
0331 #  define YY_ATTRIBUTE_PURE
0332 # endif
0333 #endif
0334 
0335 #ifndef YY_ATTRIBUTE_UNUSED
0336 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
0337 #  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
0338 # else
0339 #  define YY_ATTRIBUTE_UNUSED
0340 # endif
0341 #endif
0342 
0343 /* Suppress unused-variable warnings by "using" E.  */
0344 #if ! defined lint || defined __GNUC__
0345 # define YY_USE(E) ((void) (E))
0346 #else
0347 # define YY_USE(E) /* empty */
0348 #endif
0349 
0350 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
0351 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
0352 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
0353 #  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
0354     _Pragma ("GCC diagnostic push")                                     \
0355     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
0356 # else
0357 #  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
0358     _Pragma ("GCC diagnostic push")                                     \
0359     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
0360     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
0361 # endif
0362 # define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
0363     _Pragma ("GCC diagnostic pop")
0364 #else
0365 # define YY_INITIAL_VALUE(Value) Value
0366 #endif
0367 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
0368 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
0369 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
0370 #endif
0371 #ifndef YY_INITIAL_VALUE
0372 # define YY_INITIAL_VALUE(Value) /* Nothing. */
0373 #endif
0374 
0375 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
0376 # define YY_IGNORE_USELESS_CAST_BEGIN                          \
0377     _Pragma ("GCC diagnostic push")                            \
0378     _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
0379 # define YY_IGNORE_USELESS_CAST_END            \
0380     _Pragma ("GCC diagnostic pop")
0381 #endif
0382 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
0383 # define YY_IGNORE_USELESS_CAST_BEGIN
0384 # define YY_IGNORE_USELESS_CAST_END
0385 #endif
0386 
0387 
0388 #define YY_ASSERT(E) ((void) (0 && (E)))
0389 
0390 #if !defined yyoverflow
0391 
0392 /* The parser invokes alloca or malloc; define the necessary symbols.  */
0393 
0394 # ifdef YYSTACK_USE_ALLOCA
0395 #  if YYSTACK_USE_ALLOCA
0396 #   ifdef __GNUC__
0397 #    define YYSTACK_ALLOC __builtin_alloca
0398 #   elif defined __BUILTIN_VA_ARG_INCR
0399 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
0400 #   elif defined _AIX
0401 #    define YYSTACK_ALLOC __alloca
0402 #   elif defined _MSC_VER
0403 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
0404 #    define alloca _alloca
0405 #   else
0406 #    define YYSTACK_ALLOC alloca
0407 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
0408 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
0409       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
0410 #     ifndef EXIT_SUCCESS
0411 #      define EXIT_SUCCESS 0
0412 #     endif
0413 #    endif
0414 #   endif
0415 #  endif
0416 # endif
0417 
0418 # ifdef YYSTACK_ALLOC
0419    /* Pacify GCC's 'empty if-body' warning.  */
0420 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
0421 #  ifndef YYSTACK_ALLOC_MAXIMUM
0422     /* The OS might guarantee only one guard page at the bottom of the stack,
0423        and a page size can be as small as 4096 bytes.  So we cannot safely
0424        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
0425        to allow for a few compiler-allocated temporary stack slots.  */
0426 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
0427 #  endif
0428 # else
0429 #  define YYSTACK_ALLOC YYMALLOC
0430 #  define YYSTACK_FREE YYFREE
0431 #  ifndef YYSTACK_ALLOC_MAXIMUM
0432 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
0433 #  endif
0434 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
0435        && ! ((defined YYMALLOC || defined malloc) \
0436              && (defined YYFREE || defined free)))
0437 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
0438 #   ifndef EXIT_SUCCESS
0439 #    define EXIT_SUCCESS 0
0440 #   endif
0441 #  endif
0442 #  ifndef YYMALLOC
0443 #   define YYMALLOC malloc
0444 #   if ! defined malloc && ! defined EXIT_SUCCESS
0445 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
0446 #   endif
0447 #  endif
0448 #  ifndef YYFREE
0449 #   define YYFREE free
0450 #   if ! defined free && ! defined EXIT_SUCCESS
0451 void free (void *); /* INFRINGES ON USER NAME SPACE */
0452 #   endif
0453 #  endif
0454 # endif
0455 #endif /* !defined yyoverflow */
0456 
0457 #if (! defined yyoverflow \
0458      && (! defined __cplusplus \
0459          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
0460 
0461 /* A type that is properly aligned for any stack member.  */
0462 union yyalloc
0463 {
0464   yy_state_t yyss_alloc;
0465   YYSTYPE yyvs_alloc;
0466 };
0467 
0468 /* The size of the maximum gap between one aligned stack and the next.  */
0469 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
0470 
0471 /* The size of an array large to enough to hold all stacks, each with
0472    N elements.  */
0473 # define YYSTACK_BYTES(N) \
0474      ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
0475       + YYSTACK_GAP_MAXIMUM)
0476 
0477 # define YYCOPY_NEEDED 1
0478 
0479 /* Relocate STACK from its old location to the new one.  The
0480    local variables YYSIZE and YYSTACKSIZE give the old and new number of
0481    elements in the stack, and YYPTR gives the new location of the
0482    stack.  Advance YYPTR to a properly aligned location for the next
0483    stack.  */
0484 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
0485     do                                                                  \
0486       {                                                                 \
0487         YYPTRDIFF_T yynewbytes;                                         \
0488         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
0489         Stack = &yyptr->Stack_alloc;                                    \
0490         yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
0491         yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
0492       }                                                                 \
0493     while (0)
0494 
0495 #endif
0496 
0497 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
0498 /* Copy COUNT objects from SRC to DST.  The source and destination do
0499    not overlap.  */
0500 # ifndef YYCOPY
0501 #  if defined __GNUC__ && 1 < __GNUC__
0502 #   define YYCOPY(Dst, Src, Count) \
0503       __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
0504 #  else
0505 #   define YYCOPY(Dst, Src, Count)              \
0506       do                                        \
0507         {                                       \
0508           YYPTRDIFF_T yyi;                      \
0509           for (yyi = 0; yyi < (Count); yyi++)   \
0510             (Dst)[yyi] = (Src)[yyi];            \
0511         }                                       \
0512       while (0)
0513 #  endif
0514 # endif
0515 #endif /* !YYCOPY_NEEDED */
0516 
0517 /* YYFINAL -- State number of the termination state.  */
0518 #define YYFINAL  20
0519 /* YYLAST -- Last index in YYTABLE.  */
0520 #define YYLAST   117
0521 
0522 /* YYNTOKENS -- Number of terminals.  */
0523 #define YYNTOKENS  32
0524 /* YYNNTS -- Number of nonterminals.  */
0525 #define YYNNTS  4
0526 /* YYNRULES -- Number of rules.  */
0527 #define YYNRULES  28
0528 /* YYNSTATES -- Number of states.  */
0529 #define YYNSTATES  53
0530 
0531 /* YYMAXUTOK -- Last valid token kind.  */
0532 #define YYMAXUTOK   277
0533 
0534 
0535 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
0536    as returned by yylex, with out-of-bounds checking.  */
0537 #define YYTRANSLATE(YYX)                                \
0538   (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
0539    ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
0540    : YYSYMBOL_YYUNDEF)
0541 
0542 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
0543    as returned by yylex.  */
0544 static const yytype_int8 yytranslate[] =
0545 {
0546        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0547        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0548        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0549        2,     2,     2,    27,     2,     2,     2,     2,     2,     2,
0550       29,    30,    24,    21,    31,    22,    23,    25,     2,     2,
0551        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0552        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0553        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0554        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0555        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0556        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0557        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0558        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0559        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0560        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0561        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0562        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0563        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0564        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0565        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0566        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0567        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0568        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0569        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0570        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
0571        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
0572        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
0573       15,    16,    17,    18,    19,    20,    26,    28
0574 };
0575 
0576 #if YYDEBUG
0577 /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
0578 static const yytype_int8 yyrline[] =
0579 {
0580        0,    92,    92,    93,    94,    95,    96,    97,    98,    99,
0581      100,   101,   102,   103,   104,   105,   106,   111,   112,   113,
0582      114,   115,   116,   117,   118,   119,   122,   125,   126
0583 };
0584 #endif
0585 
0586 /** Accessing symbol of state STATE.  */
0587 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
0588 
0589 #if YYDEBUG || 0
0590 /* The user-facing name of the symbol whose (internal) number is
0591    YYSYMBOL.  No bounds checking.  */
0592 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
0593 
0594 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
0595    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
0596 static const char *const yytname[] =
0597 {
0598   "\"end of file\"", "error", "\"invalid token\"", "INTEGER", "DOUBLE_V",
0599   "STRING_V", "STRING_LITERAL", "FUNCTION_NAME", "STRING_TYPECAST",
0600   "INT_TYPECAST", "DOUBLE_TYPECAST", "AND", "OR", "GT", "GE", "LT", "LE",
0601   "EQUALS", "NOT_EQUALS", "EQ", "NE", "'+'", "'-'", "'.'", "'*'", "'/'",
0602   "UMINUS", "'!'", "FUNCTION_CALL", "'('", "')'", "','", "$accept", "expr",
0603   "func_call", "arg_list", YY_NULLPTR
0604 };
0605 
0606 static const char *
0607 yysymbol_name (yysymbol_kind_t yysymbol)
0608 {
0609   return yytname[yysymbol];
0610 }
0611 #endif
0612 
0613 #define YYPACT_NINF (-18)
0614 
0615 #define yypact_value_is_default(Yyn) \
0616   ((Yyn) == YYPACT_NINF)
0617 
0618 #define YYTABLE_NINF (-1)
0619 
0620 #define yytable_value_is_error(Yyn) \
0621   0
0622 
0623 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
0624    STATE-NUM.  */
0625 static const yytype_int8 yypact[] =
0626 {
0627       25,   -18,   -18,   -18,   -18,   -18,    25,    25,    25,    25,
0628       25,    25,    44,    25,   -18,   -18,   -18,   -18,   -18,    59,
0629      -18,    25,    25,    25,    25,    25,    25,    25,    25,    25,
0630       25,    25,    25,    25,    79,   -17,   -18,    92,    92,   -13,
0631      -13,   -13,   -13,   -13,   -13,    12,    12,    12,   -18,   -18,
0632      -18,    25,    79
0633 };
0634 
0635 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
0636    Performed when YYTABLE does not specify something else to do.  Zero
0637    means the default is an error.  */
0638 static const yytype_int8 yydefact[] =
0639 {
0640        0,    17,    18,    19,    20,    26,     0,     0,     0,     0,
0641        0,     0,     0,     0,    25,    23,    24,    21,    22,     0,
0642        1,     0,     0,     0,     0,     0,     0,     0,     0,     0,
0643        0,     0,     0,     0,    27,     0,    15,     2,     3,     4,
0644        5,     6,     7,     8,     9,    10,    11,    14,    12,    13,
0645       16,     0,    28
0646 };
0647 
0648 /* YYPGOTO[NTERM-NUM].  */
0649 static const yytype_int8 yypgoto[] =
0650 {
0651      -18,    -6,   -18,   -18
0652 };
0653 
0654 /* YYDEFGOTO[NTERM-NUM].  */
0655 static const yytype_int8 yydefgoto[] =
0656 {
0657        0,    12,    13,    35
0658 };
0659 
0660 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
0661    positive, shift that token.  If negative, reduce the rule whose
0662    number is the opposite.  If YYTABLE_NINF, syntax error.  */
0663 static const yytype_int8 yytable[] =
0664 {
0665       14,    15,    16,    17,    18,    19,     0,    34,    29,    30,
0666       31,    32,    33,    50,    51,    37,    38,    39,    40,    41,
0667       42,    43,    44,    45,    46,    47,    48,    49,     1,     2,
0668        3,     4,     5,     6,     7,     8,    32,    33,     0,     0,
0669        0,     0,     0,     0,    20,    52,     0,     9,     0,     0,
0670        0,     0,    10,     0,    11,    21,    22,    23,    24,    25,
0671       26,     0,     0,    27,    28,    29,    30,    31,    32,    33,
0672       21,    22,    23,    24,    25,    26,     0,     0,    27,    28,
0673       29,    30,    31,    32,    33,     0,     0,     0,     0,    36,
0674       21,    22,    23,    24,    25,    26,     0,     0,    27,    28,
0675       29,    30,    31,    32,    33,    23,    24,    25,    26,     0,
0676        0,    27,    28,    29,    30,    31,    32,    33
0677 };
0678 
0679 static const yytype_int8 yycheck[] =
0680 {
0681        6,     7,     8,     9,    10,    11,    -1,    13,    21,    22,
0682       23,    24,    25,    30,    31,    21,    22,    23,    24,    25,
0683       26,    27,    28,    29,    30,    31,    32,    33,     3,     4,
0684        5,     6,     7,     8,     9,    10,    24,    25,    -1,    -1,
0685       -1,    -1,    -1,    -1,     0,    51,    -1,    22,    -1,    -1,
0686       -1,    -1,    27,    -1,    29,    11,    12,    13,    14,    15,
0687       16,    -1,    -1,    19,    20,    21,    22,    23,    24,    25,
0688       11,    12,    13,    14,    15,    16,    -1,    -1,    19,    20,
0689       21,    22,    23,    24,    25,    -1,    -1,    -1,    -1,    30,
0690       11,    12,    13,    14,    15,    16,    -1,    -1,    19,    20,
0691       21,    22,    23,    24,    25,    13,    14,    15,    16,    -1,
0692       -1,    19,    20,    21,    22,    23,    24,    25
0693 };
0694 
0695 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
0696    state STATE-NUM.  */
0697 static const yytype_int8 yystos[] =
0698 {
0699        0,     3,     4,     5,     6,     7,     8,     9,    10,    22,
0700       27,    29,    33,    34,    33,    33,    33,    33,    33,    33,
0701        0,    11,    12,    13,    14,    15,    16,    19,    20,    21,
0702       22,    23,    24,    25,    33,    35,    30,    33,    33,    33,
0703       33,    33,    33,    33,    33,    33,    33,    33,    33,    33,
0704       30,    31,    33
0705 };
0706 
0707 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.  */
0708 static const yytype_int8 yyr1[] =
0709 {
0710        0,    32,    33,    33,    33,    33,    33,    33,    33,    33,
0711       33,    33,    33,    33,    33,    33,    33,    33,    33,    33,
0712       33,    33,    33,    33,    33,    33,    34,    35,    35
0713 };
0714 
0715 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.  */
0716 static const yytype_int8 yyr2[] =
0717 {
0718        0,     2,     3,     3,     3,     3,     3,     3,     3,     3,
0719        3,     3,     3,     3,     3,     3,     3,     1,     1,     1,
0720        1,     2,     2,     2,     2,     2,     1,     1,     3
0721 };
0722 
0723 
0724 enum { YYENOMEM = -2 };
0725 
0726 #define yyerrok         (yyerrstatus = 0)
0727 #define yyclearin       (yychar = YYEMPTY)
0728 
0729 #define YYACCEPT        goto yyacceptlab
0730 #define YYABORT         goto yyabortlab
0731 #define YYERROR         goto yyerrorlab
0732 #define YYNOMEM         goto yyexhaustedlab
0733 
0734 
0735 #define YYRECOVERING()  (!!yyerrstatus)
0736 
0737 #define YYBACKUP(Token, Value)                                    \
0738   do                                                              \
0739     if (yychar == YYEMPTY)                                        \
0740       {                                                           \
0741         yychar = (Token);                                         \
0742         yylval = (Value);                                         \
0743         YYPOPSTACK (yylen);                                       \
0744         yystate = *yyssp;                                         \
0745         goto yybackup;                                            \
0746       }                                                           \
0747     else                                                          \
0748       {                                                           \
0749         yyerror (YY_("syntax error: cannot back up")); \
0750         YYERROR;                                                  \
0751       }                                                           \
0752   while (0)
0753 
0754 /* Backward compatibility with an undocumented macro.
0755    Use YYerror or YYUNDEF. */
0756 #define YYERRCODE YYUNDEF
0757 
0758 
0759 /* Enable debugging if requested.  */
0760 #if YYDEBUG
0761 
0762 # ifndef YYFPRINTF
0763 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
0764 #  define YYFPRINTF fprintf
0765 # endif
0766 
0767 # define YYDPRINTF(Args)                        \
0768 do {                                            \
0769   if (yydebug)                                  \
0770     YYFPRINTF Args;                             \
0771 } while (0)
0772 
0773 
0774 
0775 
0776 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
0777 do {                                                                      \
0778   if (yydebug)                                                            \
0779     {                                                                     \
0780       YYFPRINTF (stderr, "%s ", Title);                                   \
0781       yy_symbol_print (stderr,                                            \
0782                   Kind, Value); \
0783       YYFPRINTF (stderr, "\n");                                           \
0784     }                                                                     \
0785 } while (0)
0786 
0787 
0788 /*-----------------------------------.
0789 | Print this symbol's value on YYO.  |
0790 `-----------------------------------*/
0791 
0792 static void
0793 yy_symbol_value_print (FILE *yyo,
0794                        yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
0795 {
0796   FILE *yyoutput = yyo;
0797   YY_USE (yyoutput);
0798   if (!yyvaluep)
0799     return;
0800   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
0801   YY_USE (yykind);
0802   YY_IGNORE_MAYBE_UNINITIALIZED_END
0803 }
0804 
0805 
0806 /*---------------------------.
0807 | Print this symbol on YYO.  |
0808 `---------------------------*/
0809 
0810 static void
0811 yy_symbol_print (FILE *yyo,
0812                  yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
0813 {
0814   YYFPRINTF (yyo, "%s %s (",
0815              yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
0816 
0817   yy_symbol_value_print (yyo, yykind, yyvaluep);
0818   YYFPRINTF (yyo, ")");
0819 }
0820 
0821 /*------------------------------------------------------------------.
0822 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
0823 | TOP (included).                                                   |
0824 `------------------------------------------------------------------*/
0825 
0826 static void
0827 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
0828 {
0829   YYFPRINTF (stderr, "Stack now");
0830   for (; yybottom <= yytop; yybottom++)
0831     {
0832       int yybot = *yybottom;
0833       YYFPRINTF (stderr, " %d", yybot);
0834     }
0835   YYFPRINTF (stderr, "\n");
0836 }
0837 
0838 # define YY_STACK_PRINT(Bottom, Top)                            \
0839 do {                                                            \
0840   if (yydebug)                                                  \
0841     yy_stack_print ((Bottom), (Top));                           \
0842 } while (0)
0843 
0844 
0845 /*------------------------------------------------.
0846 | Report that the YYRULE is going to be reduced.  |
0847 `------------------------------------------------*/
0848 
0849 static void
0850 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
0851                  int yyrule)
0852 {
0853   int yylno = yyrline[yyrule];
0854   int yynrhs = yyr2[yyrule];
0855   int yyi;
0856   YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
0857              yyrule - 1, yylno);
0858   /* The symbols being reduced.  */
0859   for (yyi = 0; yyi < yynrhs; yyi++)
0860     {
0861       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
0862       yy_symbol_print (stderr,
0863                        YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
0864                        &yyvsp[(yyi + 1) - (yynrhs)]);
0865       YYFPRINTF (stderr, "\n");
0866     }
0867 }
0868 
0869 # define YY_REDUCE_PRINT(Rule)          \
0870 do {                                    \
0871   if (yydebug)                          \
0872     yy_reduce_print (yyssp, yyvsp, Rule); \
0873 } while (0)
0874 
0875 /* Nonzero means print parse trace.  It is left uninitialized so that
0876    multiple parsers can coexist.  */
0877 int yydebug;
0878 #else /* !YYDEBUG */
0879 # define YYDPRINTF(Args) ((void) 0)
0880 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
0881 # define YY_STACK_PRINT(Bottom, Top)
0882 # define YY_REDUCE_PRINT(Rule)
0883 #endif /* !YYDEBUG */
0884 
0885 
0886 /* YYINITDEPTH -- initial size of the parser's stacks.  */
0887 #ifndef YYINITDEPTH
0888 # define YYINITDEPTH 200
0889 #endif
0890 
0891 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
0892    if the built-in stack extension method is used).
0893 
0894    Do not make this value too large; the results are undefined if
0895    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
0896    evaluated with infinite-precision integer arithmetic.  */
0897 
0898 #ifndef YYMAXDEPTH
0899 # define YYMAXDEPTH 10000
0900 #endif
0901 
0902 
0903 
0904 
0905 
0906 
0907 /*-----------------------------------------------.
0908 | Release the memory associated to this symbol.  |
0909 `-----------------------------------------------*/
0910 
0911 static void
0912 yydestruct (const char *yymsg,
0913             yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
0914 {
0915   YY_USE (yyvaluep);
0916   if (!yymsg)
0917     yymsg = "Deleting";
0918   YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
0919 
0920   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
0921   YY_USE (yykind);
0922   YY_IGNORE_MAYBE_UNINITIALIZED_END
0923 }
0924 
0925 
0926 /* Lookahead token kind.  */
0927 int yychar;
0928 
0929 /* The semantic value of the lookahead symbol.  */
0930 YYSTYPE yylval;
0931 /* Number of syntax errors so far.  */
0932 int yynerrs;
0933 
0934 
0935 
0936 
0937 /*----------.
0938 | yyparse.  |
0939 `----------*/
0940 
0941 int
0942 yyparse (void)
0943 {
0944     yy_state_fast_t yystate = 0;
0945     /* Number of tokens to shift before error messages enabled.  */
0946     int yyerrstatus = 0;
0947 
0948     /* Refer to the stacks through separate pointers, to allow yyoverflow
0949        to reallocate them elsewhere.  */
0950 
0951     /* Their size.  */
0952     YYPTRDIFF_T yystacksize = YYINITDEPTH;
0953 
0954     /* The state stack: array, bottom, top.  */
0955     yy_state_t yyssa[YYINITDEPTH];
0956     yy_state_t *yyss = yyssa;
0957     yy_state_t *yyssp = yyss;
0958 
0959     /* The semantic value stack: array, bottom, top.  */
0960     YYSTYPE yyvsa[YYINITDEPTH];
0961     YYSTYPE *yyvs = yyvsa;
0962     YYSTYPE *yyvsp = yyvs;
0963 
0964   int yyn;
0965   /* The return value of yyparse.  */
0966   int yyresult;
0967   /* Lookahead symbol kind.  */
0968   yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
0969   /* The variables used to return semantic value and location from the
0970      action routines.  */
0971   YYSTYPE yyval;
0972 
0973 
0974 
0975 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
0976 
0977   /* The number of symbols on the RHS of the reduced rule.
0978      Keep to zero when no symbol should be popped.  */
0979   int yylen = 0;
0980 
0981   YYDPRINTF ((stderr, "Starting parse\n"));
0982 
0983   yychar = YYEMPTY; /* Cause a token to be read.  */
0984 
0985   goto yysetstate;
0986 
0987 
0988 /*------------------------------------------------------------.
0989 | yynewstate -- push a new state, which is found in yystate.  |
0990 `------------------------------------------------------------*/
0991 yynewstate:
0992   /* In all cases, when you get here, the value and location stacks
0993      have just been pushed.  So pushing a state here evens the stacks.  */
0994   yyssp++;
0995 
0996 
0997 /*--------------------------------------------------------------------.
0998 | yysetstate -- set current state (the top of the stack) to yystate.  |
0999 `--------------------------------------------------------------------*/
1000 yysetstate:
1001   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1002   YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1003   YY_IGNORE_USELESS_CAST_BEGIN
1004   *yyssp = YY_CAST (yy_state_t, yystate);
1005   YY_IGNORE_USELESS_CAST_END
1006   YY_STACK_PRINT (yyss, yyssp);
1007 
1008   if (yyss + yystacksize - 1 <= yyssp)
1009 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1010     YYNOMEM;
1011 #else
1012     {
1013       /* Get the current used size of the three stacks, in elements.  */
1014       YYPTRDIFF_T yysize = yyssp - yyss + 1;
1015 
1016 # if defined yyoverflow
1017       {
1018         /* Give user a chance to reallocate the stack.  Use copies of
1019            these so that the &'s don't force the real ones into
1020            memory.  */
1021         yy_state_t *yyss1 = yyss;
1022         YYSTYPE *yyvs1 = yyvs;
1023 
1024         /* Each stack pointer address is followed by the size of the
1025            data in use in that stack, in bytes.  This used to be a
1026            conditional around just the two extra args, but that might
1027            be undefined if yyoverflow is a macro.  */
1028         yyoverflow (YY_("memory exhausted"),
1029                     &yyss1, yysize * YYSIZEOF (*yyssp),
1030                     &yyvs1, yysize * YYSIZEOF (*yyvsp),
1031                     &yystacksize);
1032         yyss = yyss1;
1033         yyvs = yyvs1;
1034       }
1035 # else /* defined YYSTACK_RELOCATE */
1036       /* Extend the stack our own way.  */
1037       if (YYMAXDEPTH <= yystacksize)
1038         YYNOMEM;
1039       yystacksize *= 2;
1040       if (YYMAXDEPTH < yystacksize)
1041         yystacksize = YYMAXDEPTH;
1042 
1043       {
1044         yy_state_t *yyss1 = yyss;
1045         union yyalloc *yyptr =
1046           YY_CAST (union yyalloc *,
1047                    YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1048         if (! yyptr)
1049           YYNOMEM;
1050         YYSTACK_RELOCATE (yyss_alloc, yyss);
1051         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1052 #  undef YYSTACK_RELOCATE
1053         if (yyss1 != yyssa)
1054           YYSTACK_FREE (yyss1);
1055       }
1056 # endif
1057 
1058       yyssp = yyss + yysize - 1;
1059       yyvsp = yyvs + yysize - 1;
1060 
1061       YY_IGNORE_USELESS_CAST_BEGIN
1062       YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1063                   YY_CAST (long, yystacksize)));
1064       YY_IGNORE_USELESS_CAST_END
1065 
1066       if (yyss + yystacksize - 1 <= yyssp)
1067         YYABORT;
1068     }
1069 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1070 
1071 
1072   if (yystate == YYFINAL)
1073     YYACCEPT;
1074 
1075   goto yybackup;
1076 
1077 
1078 /*-----------.
1079 | yybackup.  |
1080 `-----------*/
1081 yybackup:
1082   /* Do appropriate processing given the current state.  Read a
1083      lookahead token if we need one and don't already have one.  */
1084 
1085   /* First try to decide what to do without reference to lookahead token.  */
1086   yyn = yypact[yystate];
1087   if (yypact_value_is_default (yyn))
1088     goto yydefault;
1089 
1090   /* Not known => get a lookahead token if don't already have one.  */
1091 
1092   /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
1093   if (yychar == YYEMPTY)
1094     {
1095       YYDPRINTF ((stderr, "Reading a token\n"));
1096       yychar = yylex ();
1097     }
1098 
1099   if (yychar <= YYEOF)
1100     {
1101       yychar = YYEOF;
1102       yytoken = YYSYMBOL_YYEOF;
1103       YYDPRINTF ((stderr, "Now at end of input.\n"));
1104     }
1105   else if (yychar == YYerror)
1106     {
1107       /* The scanner already issued an error message, process directly
1108          to error recovery.  But do not keep the error token as
1109          lookahead, it is too special and may lead us to an endless
1110          loop in error recovery. */
1111       yychar = YYUNDEF;
1112       yytoken = YYSYMBOL_YYerror;
1113       goto yyerrlab1;
1114     }
1115   else
1116     {
1117       yytoken = YYTRANSLATE (yychar);
1118       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1119     }
1120 
1121   /* If the proper action on seeing token YYTOKEN is to reduce or to
1122      detect an error, take that action.  */
1123   yyn += yytoken;
1124   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1125     goto yydefault;
1126   yyn = yytable[yyn];
1127   if (yyn <= 0)
1128     {
1129       if (yytable_value_is_error (yyn))
1130         goto yyerrlab;
1131       yyn = -yyn;
1132       goto yyreduce;
1133     }
1134 
1135   /* Count tokens shifted since error; after three, turn off error
1136      status.  */
1137   if (yyerrstatus)
1138     yyerrstatus--;
1139 
1140   /* Shift the lookahead token.  */
1141   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1142   yystate = yyn;
1143   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1144   *++yyvsp = yylval;
1145   YY_IGNORE_MAYBE_UNINITIALIZED_END
1146 
1147   /* Discard the shifted token.  */
1148   yychar = YYEMPTY;
1149   goto yynewstate;
1150 
1151 
1152 /*-----------------------------------------------------------.
1153 | yydefault -- do the default action for the current state.  |
1154 `-----------------------------------------------------------*/
1155 yydefault:
1156   yyn = yydefact[yystate];
1157   if (yyn == 0)
1158     goto yyerrlab;
1159   goto yyreduce;
1160 
1161 
1162 /*-----------------------------.
1163 | yyreduce -- do a reduction.  |
1164 `-----------------------------*/
1165 yyreduce:
1166   /* yyn is the number of a rule to reduce with.  */
1167   yylen = yyr2[yyn];
1168 
1169   /* If YYLEN is nonzero, implement the default value of the action:
1170      '$$ = $1'.
1171 
1172      Otherwise, the following line sets YYVAL to garbage.
1173      This behavior is undocumented and Bison
1174      users should not rely upon it.  Assigning to YYVAL
1175      unconditionally makes the parser a bit smaller, and it avoids a
1176      GCC warning that YYVAL may be used uninitialized.  */
1177   yyval = yyvsp[1-yylen];
1178 
1179 
1180   YY_REDUCE_PRINT (yyn);
1181   switch (yyn)
1182     {
1183   case 2: /* expr: expr AND expr  */
1184 #line 92 "libs/bison-input.ypp"
1185                             { make_op(instruction::and_op); }
1186 #line 1187 "bison-input.tab.cpp"
1187     break;
1188 
1189   case 3: /* expr: expr OR expr  */
1190 #line 93 "libs/bison-input.ypp"
1191                             { make_op(instruction::or_op);  }
1192 #line 1193 "bison-input.tab.cpp"
1193     break;
1194 
1195   case 4: /* expr: expr GT expr  */
1196 #line 94 "libs/bison-input.ypp"
1197                             { make_op(instruction::greater_than);  }
1198 #line 1199 "bison-input.tab.cpp"
1199     break;
1200 
1201   case 5: /* expr: expr GE expr  */
1202 #line 95 "libs/bison-input.ypp"
1203                             { make_op(instruction::greater_or_equal); }
1204 #line 1205 "bison-input.tab.cpp"
1205     break;
1206 
1207   case 6: /* expr: expr LT expr  */
1208 #line 96 "libs/bison-input.ypp"
1209                             { make_op(instruction::less_than);     }
1210 #line 1211 "bison-input.tab.cpp"
1211     break;
1212 
1213   case 7: /* expr: expr LE expr  */
1214 #line 97 "libs/bison-input.ypp"
1215                             { make_op(instruction::less_or_equal); }
1216 #line 1217 "bison-input.tab.cpp"
1217     break;
1218 
1219   case 8: /* expr: expr EQ expr  */
1220 #line 98 "libs/bison-input.ypp"
1221                             { make_op(instruction::equals);    }
1222 #line 1223 "bison-input.tab.cpp"
1223     break;
1224 
1225   case 9: /* expr: expr NE expr  */
1226 #line 99 "libs/bison-input.ypp"
1227                             { make_op(instruction::not_equal); }
1228 #line 1229 "bison-input.tab.cpp"
1229     break;
1230 
1231   case 10: /* expr: expr '+' expr  */
1232 #line 100 "libs/bison-input.ypp"
1233                             { make_op(instruction::add);  }
1234 #line 1235 "bison-input.tab.cpp"
1235     break;
1236 
1237   case 11: /* expr: expr '-' expr  */
1238 #line 101 "libs/bison-input.ypp"
1239                             { make_op(instruction::sub);  }
1240 #line 1241 "bison-input.tab.cpp"
1241     break;
1242 
1243   case 12: /* expr: expr '*' expr  */
1244 #line 102 "libs/bison-input.ypp"
1245                             { make_op(instruction::mult); }
1246 #line 1247 "bison-input.tab.cpp"
1247     break;
1248 
1249   case 13: /* expr: expr '/' expr  */
1250 #line 103 "libs/bison-input.ypp"
1251                             { make_op(instruction::div);  }
1252 #line 1253 "bison-input.tab.cpp"
1253     break;
1254 
1255   case 14: /* expr: expr '.' expr  */
1256 #line 104 "libs/bison-input.ypp"
1257                             { make_op(instruction::string_concat); }
1258 #line 1259 "bison-input.tab.cpp"
1259     break;
1260 
1261   case 15: /* expr: '(' expr ')'  */
1262 #line 105 "libs/bison-input.ypp"
1263                       { }
1264 #line 1265 "bison-input.tab.cpp"
1265     break;
1266 
1267   case 16: /* expr: func_call arg_list ')'  */
1268 #line 106 "libs/bison-input.ypp"
1269                                                    { make_string_op(instruction::function_call, (yyvsp[-2].string_val)); }
1270 #line 1271 "bison-input.tab.cpp"
1271     break;
1272 
1273   case 17: /* expr: INTEGER  */
1274 #line 111 "libs/bison-input.ypp"
1275                      { make_integer_op(instruction::push_value, (yyvsp[0].int_val)); }
1276 #line 1277 "bison-input.tab.cpp"
1277     break;
1278 
1279   case 18: /* expr: DOUBLE_V  */
1280 #line 112 "libs/bison-input.ypp"
1281                      { make_double_op(instruction::push_value, (yyvsp[0].double_val));  }
1282 #line 1283 "bison-input.tab.cpp"
1283     break;
1284 
1285   case 19: /* expr: STRING_V  */
1286 #line 113 "libs/bison-input.ypp"
1287                   { make_string_op(instruction::push_variable, (yyvsp[0].string_val));     }
1288 #line 1289 "bison-input.tab.cpp"
1289     break;
1290 
1291   case 20: /* expr: STRING_LITERAL  */
1292 #line 114 "libs/bison-input.ypp"
1293                        { make_string_op(instruction::push_value, (yyvsp[0].string_val)); }
1294 #line 1295 "bison-input.tab.cpp"
1295     break;
1296 
1297   case 21: /* expr: '-' expr  */
1298 #line 115 "libs/bison-input.ypp"
1299                                { make_op(instruction::unary_minus); }
1300 #line 1301 "bison-input.tab.cpp"
1301     break;
1302 
1303   case 22: /* expr: '!' expr  */
1304 #line 116 "libs/bison-input.ypp"
1305                                { make_op(instruction::not_op);      }
1306 #line 1307 "bison-input.tab.cpp"
1307     break;
1308 
1309   case 23: /* expr: INT_TYPECAST expr  */
1310 #line 117 "libs/bison-input.ypp"
1311                                              { make_op(instruction::cast_to_int); }
1312 #line 1313 "bison-input.tab.cpp"
1313     break;
1314 
1315   case 24: /* expr: DOUBLE_TYPECAST expr  */
1316 #line 118 "libs/bison-input.ypp"
1317                                                    { make_op(instruction::cast_to_double); }
1318 #line 1319 "bison-input.tab.cpp"
1319     break;
1320 
1321   case 25: /* expr: STRING_TYPECAST expr  */
1322 #line 119 "libs/bison-input.ypp"
1323                                                    { make_op(instruction::cast_to_string); }
1324 #line 1325 "bison-input.tab.cpp"
1325     break;
1326 
1327   case 26: /* func_call: FUNCTION_NAME  */
1328 #line 122 "libs/bison-input.ypp"
1329                          { make_op(instruction::push_func_arg_marker); }
1330 #line 1331 "bison-input.tab.cpp"
1331     break;
1332 
1333 
1334 #line 1335 "bison-input.tab.cpp"
1335 
1336       default: break;
1337     }
1338   /* User semantic actions sometimes alter yychar, and that requires
1339      that yytoken be updated with the new translation.  We take the
1340      approach of translating immediately before every use of yytoken.
1341      One alternative is translating here after every semantic action,
1342      but that translation would be missed if the semantic action invokes
1343      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1344      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
1345      incorrect destructor might then be invoked immediately.  In the
1346      case of YYERROR or YYBACKUP, subsequent parser actions might lead
1347      to an incorrect destructor call or verbose syntax error message
1348      before the lookahead is translated.  */
1349   YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1350 
1351   YYPOPSTACK (yylen);
1352   yylen = 0;
1353 
1354   *++yyvsp = yyval;
1355 
1356   /* Now 'shift' the result of the reduction.  Determine what state
1357      that goes to, based on the state we popped back to and the rule
1358      number reduced by.  */
1359   {
1360     const int yylhs = yyr1[yyn] - YYNTOKENS;
1361     const int yyi = yypgoto[yylhs] + *yyssp;
1362     yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1363                ? yytable[yyi]
1364                : yydefgoto[yylhs]);
1365   }
1366 
1367   goto yynewstate;
1368 
1369 
1370 /*--------------------------------------.
1371 | yyerrlab -- here on detecting error.  |
1372 `--------------------------------------*/
1373 yyerrlab:
1374   /* Make sure we have latest lookahead translation.  See comments at
1375      user semantic actions for why this is necessary.  */
1376   yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1377   /* If not already recovering from an error, report this error.  */
1378   if (!yyerrstatus)
1379     {
1380       ++yynerrs;
1381       yyerror (YY_("syntax error"));
1382     }
1383 
1384   if (yyerrstatus == 3)
1385     {
1386       /* If just tried and failed to reuse lookahead token after an
1387          error, discard it.  */
1388 
1389       if (yychar <= YYEOF)
1390         {
1391           /* Return failure if at end of input.  */
1392           if (yychar == YYEOF)
1393             YYABORT;
1394         }
1395       else
1396         {
1397           yydestruct ("Error: discarding",
1398                       yytoken, &yylval);
1399           yychar = YYEMPTY;
1400         }
1401     }
1402 
1403   /* Else will try to reuse lookahead token after shifting the error
1404      token.  */
1405   goto yyerrlab1;
1406 
1407 
1408 /*---------------------------------------------------.
1409 | yyerrorlab -- error raised explicitly by YYERROR.  |
1410 `---------------------------------------------------*/
1411 yyerrorlab:
1412   /* Pacify compilers when the user code never invokes YYERROR and the
1413      label yyerrorlab therefore never appears in user code.  */
1414   if (0)
1415     YYERROR;
1416   ++yynerrs;
1417 
1418   /* Do not reclaim the symbols of the rule whose action triggered
1419      this YYERROR.  */
1420   YYPOPSTACK (yylen);
1421   yylen = 0;
1422   YY_STACK_PRINT (yyss, yyssp);
1423   yystate = *yyssp;
1424   goto yyerrlab1;
1425 
1426 
1427 /*-------------------------------------------------------------.
1428 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1429 `-------------------------------------------------------------*/
1430 yyerrlab1:
1431   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1432 
1433   /* Pop stack until we find a state that shifts the error token.  */
1434   for (;;)
1435     {
1436       yyn = yypact[yystate];
1437       if (!yypact_value_is_default (yyn))
1438         {
1439           yyn += YYSYMBOL_YYerror;
1440           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1441             {
1442               yyn = yytable[yyn];
1443               if (0 < yyn)
1444                 break;
1445             }
1446         }
1447 
1448       /* Pop the current state because it cannot handle the error token.  */
1449       if (yyssp == yyss)
1450         YYABORT;
1451 
1452 
1453       yydestruct ("Error: popping",
1454                   YY_ACCESSING_SYMBOL (yystate), yyvsp);
1455       YYPOPSTACK (1);
1456       yystate = *yyssp;
1457       YY_STACK_PRINT (yyss, yyssp);
1458     }
1459 
1460   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1461   *++yyvsp = yylval;
1462   YY_IGNORE_MAYBE_UNINITIALIZED_END
1463 
1464 
1465   /* Shift the error token.  */
1466   YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1467 
1468   yystate = yyn;
1469   goto yynewstate;
1470 
1471 
1472 /*-------------------------------------.
1473 | yyacceptlab -- YYACCEPT comes here.  |
1474 `-------------------------------------*/
1475 yyacceptlab:
1476   yyresult = 0;
1477   goto yyreturnlab;
1478 
1479 
1480 /*-----------------------------------.
1481 | yyabortlab -- YYABORT comes here.  |
1482 `-----------------------------------*/
1483 yyabortlab:
1484   yyresult = 1;
1485   goto yyreturnlab;
1486 
1487 
1488 /*-----------------------------------------------------------.
1489 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
1490 `-----------------------------------------------------------*/
1491 yyexhaustedlab:
1492   yyerror (YY_("memory exhausted"));
1493   yyresult = 2;
1494   goto yyreturnlab;
1495 
1496 
1497 /*----------------------------------------------------------.
1498 | yyreturnlab -- parsing is finished, clean up and return.  |
1499 `----------------------------------------------------------*/
1500 yyreturnlab:
1501   if (yychar != YYEMPTY)
1502     {
1503       /* Make sure we have latest lookahead translation.  See comments at
1504          user semantic actions for why this is necessary.  */
1505       yytoken = YYTRANSLATE (yychar);
1506       yydestruct ("Cleanup: discarding lookahead",
1507                   yytoken, &yylval);
1508     }
1509   /* Do not reclaim the symbols of the rule whose action triggered
1510      this YYABORT or YYACCEPT.  */
1511   YYPOPSTACK (yylen);
1512   YY_STACK_PRINT (yyss, yyssp);
1513   while (yyssp != yyss)
1514     {
1515       yydestruct ("Cleanup: popping",
1516                   YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
1517       YYPOPSTACK (1);
1518     }
1519 #ifndef yyoverflow
1520   if (yyss != yyssa)
1521     YYSTACK_FREE (yyss);
1522 #endif
1523 
1524   return yyresult;
1525 }
1526 
1527 #line 130 "libs/bison-input.ypp"
1528 
1529 
1530 //***************************************************************
1531 // Function to handle errors (required by Bison)
1532 //***************************************************************
1533 
1534 void yyerror(const char *)
1535 {
1536 } // yyerror
1537 
1538 
1539 
1540 //***************************************************************
1541 // Function to compile source into a list of instructions using
1542 // Bison.
1543 //
1544 // Returns true if compiled successfully
1545 //***************************************************************
1546 
1547 bool compile(const char        *source_code,
1548              list<instruction> *compiled_code)
1549 {
1550    source      = source_code;
1551    new_source  = true;
1552    code        = compiled_code;
1553    token_error = false;
1554    
1555    code->clear();
1556    
1557    if ((yyparse()   == 0)    &&
1558        (token_error == false)  )
1559    {
1560       return true;
1561    } // endif compiled source successfully
1562    else
1563    {
1564       code->clear();
1565       
1566       return false;
1567    } // endelse failed to compile
1568    
1569 } // compile
1570 
1571 
1572 
1573 //***************************************************************
1574 // Output an 'operation' instruction
1575 //***************************************************************
1576 
1577 void make_op(instruction::instruction_type instr)
1578 {
1579    op.instr = instr;
1580    op.arg = cValue::empty();
1581 
1582    code->push_back(op);
1583    
1584 } // make_op
1585 
1586 
1587 
1588 //***************************************************************
1589 // Output an instruction with an integer operand
1590 //***************************************************************
1591 
1592 void make_integer_op(instruction::instruction_type instr,
1593                      const int                     operand)
1594 {
1595    op.instr      = instr;
1596    op.arg = cValue (operand);
1597    
1598    code->push_back(op);
1599    
1600 } // make_integer_op
1601 
1602    
1603 
1604 //***************************************************************
1605 // Output an instruction with a double operand
1606 //***************************************************************
1607 
1608 void make_double_op(instruction::instruction_type instr,
1609                     const double                  operand)
1610 {
1611    op.instr         = instr;
1612    op.arg = cValue (operand);
1613    
1614    code->push_back(op);
1615    
1616 } // make_double_op
1617 
1618 
1619    
1620 //***************************************************************
1621 // Output an instruction with a string operand
1622 //***************************************************************
1623 
1624 void make_string_op(instruction::instruction_type  instr,
1625                     char                          *operand)
1626 {
1627    op.instr         = instr;
1628    op.arg = cValue (QString (operand));
1629    
1630    code->push_back(op);
1631    
1632 } // make_string_op
1633