Annotation of parser3/src/main/compile.tab.C, revision 1.170

1.163     moko        1: /* A Bison parser, made by GNU Bison 3.0.2.  */
1.112     paf         2: 
1.158     misha       3: /* Bison implementation for Yacc-like parsers in C
1.163     moko        4: 
                      5:    Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
                      6: 
1.156     moko        7:    This program is free software: you can redistribute it and/or modify
1.112     paf         8:    it under the terms of the GNU General Public License as published by
1.156     moko        9:    the Free Software Foundation, either version 3 of the License, or
                     10:    (at your option) any later version.
1.163     moko       11: 
1.112     paf        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.
1.163     moko       16: 
1.156     moko       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/>.  */
1.155     misha      19: 
1.156     moko       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.
1.163     moko       29: 
1.156     moko       30:    This special exception was added by the Free Software Foundation in
                     31:    version 2.2 of Bison.  */
1.112     paf        32: 
1.156     moko       33: /* C LALR(1) parser skeleton written by Richard Stallman, by
                     34:    simplifying the original so-called "semantic" parser.  */
1.112     paf        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: 
1.156     moko       46: /* Bison version.  */
1.163     moko       47: #define YYBISON_VERSION "3.0.2"
1.156     moko       48: 
1.112     paf        49: /* Skeleton name.  */
1.113     paf        50: #define YYSKELETON_NAME "yacc.c"
1.112     paf        51: 
                     52: /* Pure parsers.  */
                     53: #define YYPURE 1
                     54: 
1.156     moko       55: /* Push parsers.  */
                     56: #define YYPUSH 0
                     57: 
                     58: /* Pull parsers.  */
                     59: #define YYPULL 1
                     60: 
1.155     misha      61: 
                     62: 
1.154     moko       63: 
1.156     moko       64: /* Copy the first part of user declarations.  */
1.163     moko       65: #line 1 "compile.y" /* yacc.c:339  */
1.1       parser     66: 
1.14      parser     67: /** @file
                     68:        Parser: compiler(lexical parser and grammar).
                     69: 
1.166     moko       70:        Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com)
1.27      paf        71:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.109     paf        72: 
1.154     moko       73:        
1.14      parser     74: */
1.1       parser     75: 
1.170   ! moko       76: volatile const char * IDENT_COMPILE_Y = "$Id: compile.y,v 1.280 2016/05/24 16:38:40 moko Exp $";
1.154     moko       77: 
1.1       parser     78: /**
                     79:        @todo parser4: 
                     80:        - cache compiled code from request to request. to do that...
                     81:                -#:     make method definitions, @CLASS, @BASE, @USE instructions,
                     82:                        which would be executed afterwards, and actions
                     83:                        now performed at compile time would be delayed to run time.
                     84:                -#:     make cache expiration on time and on disk-change of class source
                     85:                -#:     in apache use subpools for compiled class storage
                     86:                -#:     in iis make up specialized Pool object for that
                     87: */
                     88: 
1.84      paf        89: #define YYSTYPE  ArrayOperation* 
1.1       parser     90: #define YYDEBUG  1
1.163     moko       91: #define YYERROR_VERBOSE  1
                     92: #define yyerror(pc, msg)  real_yyerror(pc, msg)
1.1       parser     93: #define YYPRINT(file, type, value)  yyprint(file, type, value)
1.161     moko       94: #define YYMALLOC pa_malloc
                     95: #define YYFREE pa_free
1.1       parser     96: 
1.84      paf        97: // includes
                     98: 
1.1       parser     99: #include "compile_tools.h"
                    100: #include "pa_value.h"
                    101: #include "pa_request.h"
                    102: #include "pa_vobject.h"
                    103: #include "pa_vdouble.h"
                    104: #include "pa_globals.h"
1.72      paf       105: #include "pa_vmethod_frame.h"
1.1       parser    106: 
1.84      paf       107: // defines
                    108: 
1.170   ! moko      109: #define CLASS_NAME "CLASS"
1.1       parser    110: #define USE_CONTROL_METHOD_NAME "USE"
1.119     misha     111: #define OPTIONS_CONTROL_METHOD_NAME "OPTIONS"
1.1       parser    112: 
1.84      paf       113: // forwards
                    114: 
1.156     moko      115: static int real_yyerror(Parse_control* pc, const char* s);
1.84      paf       116: static void yyprint(FILE* file, int type, YYSTYPE value);
                    117: static int yylex(YYSTYPE* lvalp, void* pc);
1.1       parser    118: 
1.107     paf       119: static const VBool vfalse(false);
                    120: static const VBool vtrue(true);
1.153     moko      121: static const VString vempty;
1.107     paf       122: 
1.1       parser    123: // local convinient inplace typecast & var
1.83      paf       124: #undef PC
1.163     moko      125: #define PC  (*pc)
1.84      paf       126: #undef POOL
1.1       parser    127: #define POOL  (*PC.pool)
                    128: #ifndef DOXYGEN
1.112     paf       129: 
1.157     moko      130: #define CLASS_ADD if(PC.class_add()){                                  \
1.167     moko      131:        strncpy(PC.error, PC.cclass->type(), MAX_STRING/2);             \
1.157     moko      132:        strcat(PC.error, " - class is already defined");                \
                    133:        YYERROR;                                                        \
                    134: }
                    135: 
                    136: 
1.170   ! moko      137: #line 138 "compile.tab.C" /* yacc.c:339  */
1.112     paf       138: 
1.163     moko      139: # ifndef YY_NULLPTR
                    140: #  if defined __cplusplus && 201103L <= __cplusplus
                    141: #   define YY_NULLPTR nullptr
                    142: #  else
                    143: #   define YY_NULLPTR 0
                    144: #  endif
                    145: # endif
1.108     paf       146: 
1.112     paf       147: /* Enabling verbose error messages.  */
                    148: #ifdef YYERROR_VERBOSE
                    149: # undef YYERROR_VERBOSE
                    150: # define YYERROR_VERBOSE 1
                    151: #else
                    152: # define YYERROR_VERBOSE 0
1.106     paf       153: #endif
1.112     paf       154: 
1.163     moko      155: 
                    156: /* Debug traces.  */
                    157: #ifndef YYDEBUG
                    158: # define YYDEBUG 0
                    159: #endif
                    160: #if YYDEBUG
                    161: extern int yydebug;
1.156     moko      162: #endif
                    163: 
1.163     moko      164: /* Token type.  */
1.156     moko      165: #ifndef YYTOKENTYPE
                    166: # define YYTOKENTYPE
1.163     moko      167:   enum yytokentype
                    168:   {
                    169:     EON = 258,
                    170:     STRING = 259,
                    171:     BOGUS = 260,
                    172:     BAD_STRING_COMPARISON_OPERATOR = 261,
                    173:     BAD_HEX_LITERAL = 262,
                    174:     BAD_METHOD_DECL_START = 263,
                    175:     BAD_METHOD_PARAMETER_NAME_CHARACTER = 264,
1.168     moko      176:     LAND = 265,
                    177:     LOR = 266,
                    178:     LXOR = 267,
                    179:     NXOR = 268,
                    180:     NLE = 269,
                    181:     NGE = 270,
                    182:     NEQ = 271,
                    183:     NNE = 272,
                    184:     NSL = 273,
                    185:     NSR = 274,
                    186:     SLT = 275,
                    187:     SGT = 276,
                    188:     SLE = 277,
                    189:     SGE = 278,
                    190:     SEQ = 279,
                    191:     SNE = 280,
                    192:     DEF = 281,
                    193:     IN = 282,
                    194:     FEXISTS = 283,
                    195:     DEXISTS = 284,
                    196:     IS = 285,
                    197:     LITERAL_TRUE = 286,
                    198:     LITERAL_FALSE = 287,
                    199:     NUNARY = 288
1.163     moko      200:   };
1.156     moko      201: #endif
                    202: 
1.163     moko      203: /* Value type.  */
1.156     moko      204: #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1.112     paf       205: typedef int YYSTYPE;
1.156     moko      206: # define YYSTYPE_IS_TRIVIAL 1
1.112     paf       207: # define YYSTYPE_IS_DECLARED 1
                    208: #endif
                    209: 
                    210: 
1.163     moko      211: 
                    212: int yyparse (Parse_control* pc);
                    213: 
                    214: 
                    215: 
1.156     moko      216: /* Copy the second part of user declarations.  */
                    217: 
1.170   ! moko      218: #line 219 "compile.tab.C" /* yacc.c:358  */
1.156     moko      219: 
                    220: #ifdef short
                    221: # undef short
                    222: #endif
                    223: 
                    224: #ifdef YYTYPE_UINT8
                    225: typedef YYTYPE_UINT8 yytype_uint8;
                    226: #else
                    227: typedef unsigned char yytype_uint8;
                    228: #endif
                    229: 
                    230: #ifdef YYTYPE_INT8
                    231: typedef YYTYPE_INT8 yytype_int8;
1.163     moko      232: #else
1.156     moko      233: typedef signed char yytype_int8;
                    234: #endif
1.155     misha     235: 
1.156     moko      236: #ifdef YYTYPE_UINT16
                    237: typedef YYTYPE_UINT16 yytype_uint16;
                    238: #else
                    239: typedef unsigned short int yytype_uint16;
                    240: #endif
1.154     moko      241: 
1.156     moko      242: #ifdef YYTYPE_INT16
                    243: typedef YYTYPE_INT16 yytype_int16;
                    244: #else
                    245: typedef short int yytype_int16;
                    246: #endif
1.154     moko      247: 
1.156     moko      248: #ifndef YYSIZE_T
                    249: # ifdef __SIZE_TYPE__
                    250: #  define YYSIZE_T __SIZE_TYPE__
                    251: # elif defined size_t
                    252: #  define YYSIZE_T size_t
1.163     moko      253: # elif ! defined YYSIZE_T
1.156     moko      254: #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
                    255: #  define YYSIZE_T size_t
                    256: # else
                    257: #  define YYSIZE_T unsigned int
                    258: # endif
                    259: #endif
1.112     paf       260: 
1.156     moko      261: #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1.112     paf       262: 
1.156     moko      263: #ifndef YY_
                    264: # if defined YYENABLE_NLS && YYENABLE_NLS
                    265: #  if ENABLE_NLS
                    266: #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1.163     moko      267: #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
1.156     moko      268: #  endif
1.114     misha     269: # endif
1.156     moko      270: # ifndef YY_
1.163     moko      271: #  define YY_(Msgid) Msgid
                    272: # endif
                    273: #endif
                    274: 
                    275: #ifndef YY_ATTRIBUTE
                    276: # if (defined __GNUC__                                               \
                    277:       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
                    278:      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
                    279: #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
                    280: # else
                    281: #  define YY_ATTRIBUTE(Spec) /* empty */
                    282: # endif
                    283: #endif
                    284: 
                    285: #ifndef YY_ATTRIBUTE_PURE
                    286: # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
                    287: #endif
                    288: 
                    289: #ifndef YY_ATTRIBUTE_UNUSED
                    290: # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
                    291: #endif
                    292: 
                    293: #if !defined _Noreturn \
                    294:      && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
                    295: # if defined _MSC_VER && 1200 <= _MSC_VER
                    296: #  define _Noreturn __declspec (noreturn)
                    297: # else
                    298: #  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
1.114     misha     299: # endif
1.156     moko      300: #endif
                    301: 
                    302: /* Suppress unused-variable warnings by "using" E.  */
                    303: #if ! defined lint || defined __GNUC__
1.163     moko      304: # define YYUSE(E) ((void) (E))
1.156     moko      305: #else
1.163     moko      306: # define YYUSE(E) /* empty */
1.156     moko      307: #endif
                    308: 
1.163     moko      309: #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
                    310: /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
                    311: # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
                    312:     _Pragma ("GCC diagnostic push") \
                    313:     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
                    314:     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
                    315: # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
                    316:     _Pragma ("GCC diagnostic pop")
1.156     moko      317: #else
1.163     moko      318: # define YY_INITIAL_VALUE(Value) Value
                    319: #endif
                    320: #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
                    321: # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
                    322: # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1.156     moko      323: #endif
1.163     moko      324: #ifndef YY_INITIAL_VALUE
                    325: # define YY_INITIAL_VALUE(Value) /* Nothing. */
1.156     moko      326: #endif
                    327: 
1.163     moko      328: 
1.156     moko      329: #if ! defined yyoverflow || YYERROR_VERBOSE
1.114     misha     330: 
1.112     paf       331: /* The parser invokes alloca or malloc; define the necessary symbols.  */
                    332: 
1.113     paf       333: # ifdef YYSTACK_USE_ALLOCA
                    334: #  if YYSTACK_USE_ALLOCA
                    335: #   ifdef __GNUC__
                    336: #    define YYSTACK_ALLOC __builtin_alloca
1.156     moko      337: #   elif defined __BUILTIN_VA_ARG_INCR
                    338: #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
                    339: #   elif defined _AIX
                    340: #    define YYSTACK_ALLOC __alloca
                    341: #   elif defined _MSC_VER
                    342: #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
                    343: #    define alloca _alloca
                    344: #   else
                    345: #    define YYSTACK_ALLOC alloca
1.163     moko      346: #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
1.156     moko      347: #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1.163     moko      348:       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
1.158     misha     349: #     ifndef EXIT_SUCCESS
                    350: #      define EXIT_SUCCESS 0
1.156     moko      351: #     endif
                    352: #    endif
1.112     paf       353: #   endif
                    354: #  endif
                    355: # endif
                    356: 
                    357: # ifdef YYSTACK_ALLOC
1.163     moko      358:    /* Pacify GCC's 'empty if-body' warning.  */
                    359: #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1.156     moko      360: #  ifndef YYSTACK_ALLOC_MAXIMUM
                    361:     /* The OS might guarantee only one guard page at the bottom of the stack,
                    362:        and a page size can be as small as 4096 bytes.  So we cannot safely
                    363:        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
                    364:        to allow for a few compiler-allocated temporary stack slots.  */
                    365: #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
                    366: #  endif
1.155     misha     367: # else
1.156     moko      368: #  define YYSTACK_ALLOC YYMALLOC
                    369: #  define YYSTACK_FREE YYFREE
                    370: #  ifndef YYSTACK_ALLOC_MAXIMUM
                    371: #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
                    372: #  endif
1.158     misha     373: #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
1.156     moko      374:        && ! ((defined YYMALLOC || defined malloc) \
1.163     moko      375:              && (defined YYFREE || defined free)))
1.155     misha     376: #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1.158     misha     377: #   ifndef EXIT_SUCCESS
                    378: #    define EXIT_SUCCESS 0
1.156     moko      379: #   endif
                    380: #  endif
                    381: #  ifndef YYMALLOC
                    382: #   define YYMALLOC malloc
1.163     moko      383: #   if ! defined malloc && ! defined EXIT_SUCCESS
1.156     moko      384: void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
                    385: #   endif
                    386: #  endif
                    387: #  ifndef YYFREE
                    388: #   define YYFREE free
1.163     moko      389: #   if ! defined free && ! defined EXIT_SUCCESS
1.156     moko      390: void free (void *); /* INFRINGES ON USER NAME SPACE */
                    391: #   endif
1.154     moko      392: #  endif
1.112     paf       393: # endif
1.156     moko      394: #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1.112     paf       395: 
                    396: 
1.156     moko      397: #if (! defined yyoverflow \
                    398:      && (! defined __cplusplus \
1.163     moko      399:          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1.112     paf       400: 
                    401: /* A type that is properly aligned for any stack member.  */
                    402: union yyalloc
                    403: {
1.156     moko      404:   yytype_int16 yyss_alloc;
                    405:   YYSTYPE yyvs_alloc;
                    406: };
1.112     paf       407: 
                    408: /* The size of the maximum gap between one aligned stack and the next.  */
                    409: # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
                    410: 
                    411: /* The size of an array large to enough to hold all stacks, each with
                    412:    N elements.  */
                    413: # define YYSTACK_BYTES(N) \
1.156     moko      414:      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1.112     paf       415:       + YYSTACK_GAP_MAXIMUM)
                    416: 
1.158     misha     417: # define YYCOPY_NEEDED 1
1.112     paf       418: 
                    419: /* Relocate STACK from its old location to the new one.  The
                    420:    local variables YYSIZE and YYSTACKSIZE give the old and new number of
                    421:    elements in the stack, and YYPTR gives the new location of the
                    422:    stack.  Advance YYPTR to a properly aligned location for the next
                    423:    stack.  */
1.163     moko      424: # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
                    425:     do                                                                  \
                    426:       {                                                                 \
                    427:         YYSIZE_T yynewbytes;                                            \
                    428:         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
                    429:         Stack = &yyptr->Stack_alloc;                                    \
                    430:         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
                    431:         yyptr += yynewbytes / sizeof (*yyptr);                          \
                    432:       }                                                                 \
                    433:     while (0)
1.108     paf       434: 
1.155     misha     435: #endif
                    436: 
1.158     misha     437: #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
1.163     moko      438: /* Copy COUNT objects from SRC to DST.  The source and destination do
1.158     misha     439:    not overlap.  */
                    440: # ifndef YYCOPY
                    441: #  if defined __GNUC__ && 1 < __GNUC__
1.163     moko      442: #   define YYCOPY(Dst, Src, Count) \
                    443:       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
1.158     misha     444: #  else
1.163     moko      445: #   define YYCOPY(Dst, Src, Count)              \
                    446:       do                                        \
                    447:         {                                       \
                    448:           YYSIZE_T yyi;                         \
                    449:           for (yyi = 0; yyi < (Count); yyi++)   \
                    450:             (Dst)[yyi] = (Src)[yyi];            \
                    451:         }                                       \
                    452:       while (0)
1.158     misha     453: #  endif
                    454: # endif
                    455: #endif /* !YYCOPY_NEEDED */
                    456: 
1.156     moko      457: /* YYFINAL -- State number of the termination state.  */
1.112     paf       458: #define YYFINAL  51
                    459: /* YYLAST -- Last index in YYTABLE.  */
1.168     moko      460: #define YYLAST   473
1.112     paf       461: 
1.156     moko      462: /* YYNTOKENS -- Number of terminals.  */
1.168     moko      463: #define YYNTOKENS  61
1.156     moko      464: /* YYNNTS -- Number of nonterminals.  */
1.115     misha     465: #define YYNNTS  89
1.156     moko      466: /* YYNRULES -- Number of rules.  */
1.115     misha     467: #define YYNRULES  172
1.163     moko      468: /* YYNSTATES -- Number of states.  */
1.115     misha     469: #define YYNSTATES  263
1.112     paf       470: 
1.163     moko      471: /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
                    472:    by yylex, with out-of-bounds checking.  */
1.112     paf       473: #define YYUNDEFTOK  2
1.168     moko      474: #define YYMAXUTOK   288
1.112     paf       475: 
1.163     moko      476: #define YYTRANSLATE(YYX)                                                \
1.112     paf       477:   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
                    478: 
1.163     moko      479: /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
                    480:    as returned by yylex, without out-of-bounds checking.  */
1.156     moko      481: static const yytype_uint8 yytranslate[] =
1.112     paf       482: {
                    483:        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1.168     moko      484:       47,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1.112     paf       485:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1.168     moko      486:        2,     2,     2,    45,    59,     2,    51,    42,    36,    60,
                    487:       55,    56,    39,    37,     2,    38,    54,    40,     2,     2,
                    488:        2,     2,     2,     2,     2,     2,     2,     2,    58,    50,
                    489:       33,     2,    34,     2,    46,     2,     2,     2,     2,     2,
1.112     paf       490:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    491:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1.168     moko      492:        2,    48,    41,    49,    57,     2,     2,     2,     2,     2,
1.112     paf       493:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    494:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1.168     moko      495:        2,     2,     2,    52,    35,    53,    44,     2,     2,     2,
1.112     paf       496:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    497:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    498:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    499:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    500:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    501:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    502:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    503:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    504:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    505:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    506:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    507:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    508:        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
                    509:        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
                    510:       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
1.168     moko      511:       25,    26,    27,    28,    29,    30,    31,    32,    43
1.112     paf       512: };
1.105     paf       513: 
1.112     paf       514: #if YYDEBUG
1.163     moko      515:   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
1.156     moko      516: static const yytype_uint16 yyrline[] =
1.112     paf       517: {
1.170   ! moko      518:        0,   139,   139,   146,   148,   148,   149,   151,   151,   153,
        !           519:      262,   262,   263,   263,   264,   265,   265,   267,   267,   315,
        !           520:      315,   316,   317,   317,   318,   318,   320,   320,   324,   324,
        !           521:      326,   326,   327,   327,   328,   328,   328,   332,   380,   381,
        !           522:      381,   382,   384,   385,   386,   439,   440,   440,   444,   457,
        !           523:      458,   459,   460,   486,   491,   494,   495,   496,   498,   501,
        !           524:      498,   509,   517,   524,   525,   526,   528,   534,   535,   535,
        !           525:      539,   552,   555,   552,   604,   620,   620,   622,   623,   624,
        !           526:      626,   629,   626,   632,   633,   635,   636,   639,   640,   643,
        !           527:      644,   646,   649,   663,   668,   669,   670,   675,   675,   677,
        !           528:      677,   678,   679,   691,   700,   703,   704,   705,   706,   708,
        !           529:      712,   721,   724,   721,   737,   742,   742,   743,   749,   750,
        !           530:      752,   765,   777,   779,   780,   781,   782,   783,   784,   785,
        !           531:      786,   788,   789,   790,   791,   792,   793,   794,   795,   797,
        !           532:      798,   799,   800,   801,   802,   803,   804,   805,   806,   807,
        !           533:      808,   809,   810,   811,   812,   813,   814,   815,   816,   817,
        !           534:      818,   819,   820,   821,   822,   823,   826,   831,   852,   857,
        !           535:      858,   859,   861
1.106     paf       536: };
1.109     paf       537: #endif
1.1       parser    538: 
1.163     moko      539: #if YYDEBUG || YYERROR_VERBOSE || 0
1.156     moko      540: /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
                    541:    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
1.112     paf       542: static const char *const yytname[] =
                    543: {
1.113     paf       544:   "$end", "error", "$undefined", "EON", "STRING", "BOGUS",
                    545:   "BAD_STRING_COMPARISON_OPERATOR", "BAD_HEX_LITERAL",
1.168     moko      546:   "BAD_METHOD_DECL_START", "BAD_METHOD_PARAMETER_NAME_CHARACTER", "\"&&\"",
1.113     paf       547:   "\"||\"", "\"!||\"", "\"!|\"", "\"<=\"", "\">=\"", "\"==\"", "\"!=\"",
                    548:   "\"<<\"", "\">>\"", "\"lt\"", "\"gt\"", "\"le\"", "\"ge\"", "\"eq\"",
                    549:   "\"ne\"", "\"def\"", "\"in\"", "\"-f\"", "\"-d\"", "\"is\"", "\"true\"",
                    550:   "\"false\"", "'<'", "'>'", "'|'", "'&'", "'+'", "'-'", "'*'", "'/'",
                    551:   "'\\\\'", "'%'", "NUNARY", "'~'", "'!'", "'@'", "'\\n'", "'['", "']'",
                    552:   "';'", "'$'", "'{'", "'}'", "'.'", "'('", "')'", "'^'", "':'", "'\"'",
1.156     moko      553:   "'\\''", "$accept", "all", "methods", "one_big_piece", "method",
1.113     paf       554:   "control_method", "maybe_control_strings", "control_strings",
1.115     misha     555:   "control_string", "maybe_string", "code_method", "@1",
1.113     paf       556:   "maybe_bracketed_strings", "bracketed_maybe_strings", "maybe_strings",
                    557:   "strings", "maybe_comment", "maybe_codes", "codes", "code", "action",
                    558:   "get", "get_value", "get_name_value", "name_in_curly_rdive",
                    559:   "name_without_curly_rdive", "name_without_curly_rdive_read",
                    560:   "name_without_curly_rdive_class", "name_without_curly_rdive_code", "put",
                    561:   "name_expr_wdive", "name_expr_wdive_root", "name_expr_wdive_write",
1.156     moko      562:   "name_expr_wdive_class", "construct", "construct_square", "@2", "$@3",
1.113     paf       563:   "construct_round", "construct_curly", "any_constructor_code_value",
                    564:   "constructor_code_value", "constructor_code",
1.156     moko      565:   "codes__excluding_sole_str_literal", "call", "call_value", "$@4", "$@5",
1.115     misha     566:   "call_name", "store_params", "store_param", "store_square_param", "@6",
1.156     moko      567:   "$@7", "store_round_param", "store_curly_param",
                    568:   "store_code_param_parts", "store_expr_param_parts",
                    569:   "store_curly_param_parts", "store_code_param_part",
                    570:   "store_expr_param_part", "store_curly_param_part", "code_param_value",
                    571:   "name_expr_dive_code", "name_path", "name_step", "name_advance1",
                    572:   "name_advance2", "name_expr_value", "name_expr_subvar_value",
                    573:   "name_expr_with_subvar_value", "name_square_code_value", "@8", "$@9",
1.113     paf       574:   "subvar_ref_name_rdive", "subvar_get_writes", "subvar__get_write",
                    575:   "class_prefix", "class_static_prefix", "class_constructor_prefix",
                    576:   "expr_value", "expr", "double_or_STRING", "string_inside_quotes_value",
1.163     moko      577:   "write_string", "empty_value", "true_value", "false_value", "empty", YY_NULLPTR
1.1       parser    578: };
1.106     paf       579: #endif
1.1       parser    580: 
1.112     paf       581: # ifdef YYPRINT
1.163     moko      582: /* YYTOKNUM[NUM] -- (External) token number corresponding to the
                    583:    (internal) symbol number NUM (which must be that of a token).  */
1.156     moko      584: static const yytype_uint16 yytoknum[] =
1.112     paf       585: {
                    586:        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
                    587:      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
                    588:      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
1.168     moko      589:      285,   286,   287,    60,    62,   124,    38,    43,    45,    42,
                    590:       47,    92,    37,   288,   126,    33,    64,    10,    91,    93,
                    591:       59,    36,   123,   125,    46,    40,    41,    94,    58,    34,
                    592:       39
1.112     paf       593: };
                    594: # endif
1.109     paf       595: 
1.163     moko      596: #define YYPACT_NINF -107
                    597: 
                    598: #define yypact_value_is_default(Yystate) \
                    599:   (!!((Yystate) == (-107)))
                    600: 
                    601: #define YYTABLE_NINF -173
                    602: 
                    603: #define yytable_value_is_error(Yytable_value) \
                    604:   0
1.1       parser    605: 
1.163     moko      606:   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
                    607:      STATE-NUM.  */
                    608: static const yytype_int16 yypact[] =
1.112     paf       609: {
1.168     moko      610:       12,  -107,     9,    41,  -107,    23,   -21,  -107,  -107,  -107,
                    611:     -107,  -107,    27,  -107,  -107,  -107,  -107,  -107,  -107,  -107,
                    612:     -107,  -107,    34,    10,  -107,    37,   106,   108,  -107,  -107,
                    613:       24,  -107,  -107,  -107,   -31,  -107,  -107,  -107,  -107,   110,
                    614:     -107,    -6,  -107,    16,  -107,  -107,  -107,   110,    42,  -107,
                    615:      106,  -107,  -107,  -107,    63,   103,    65,  -107,    37,  -107,
                    616:       77,  -107,    27,  -107,  -107,    88,   110,    76,   110,    77,
                    617:     -107,   108,    76,  -107,  -107,    27,    28,  -107,  -107,  -107,
                    618:     -107,    29,  -107,  -107,    16,  -107,  -107,  -107,  -107,  -107,
                    619:     -107,  -107,  -107,     4,  -107,    96,   100,  -107,   104,   102,
                    620:     -107,   141,  -107,  -107,  -107,  -107,    27,  -107,    76,    39,
                    621:      109,  -107,    28,    28,    28,    28,  -107,  -107,    28,    28,
                    622:       28,    28,    67,    28,    27,    27,  -107,  -107,   120,   324,
                    623:     -107,  -107,  -107,   -26,  -107,  -107,  -107,  -107,   151,  -107,
                    624:      130,  -107,   129,   132,    27,    82,  -107,  -107,  -107,  -107,
                    625:     -107,  -107,   425,   425,   425,   425,  -107,  -107,  -107,  -107,
                    626:      277,  -107,   123,   119,  -107,    28,    28,    28,    28,    28,
                    627:       28,    28,    28,    28,    28,    28,    28,    28,    28,    28,
                    628:       28,    28,    28,    28,    28,    28,    28,    28,    28,    28,
                    629:       28,    28,  -107,    27,    28,    46,  -107,  -107,  -107,  -107,
                    630:     -107,  -107,  -107,    27,   148,  -107,  -107,  -107,   387,   150,
                    631:      357,    98,   417,   417,   290,   290,   192,   192,   417,   417,
                    632:      417,   417,   290,   290,   425,   417,   417,   183,   431,    81,
                    633:       81,  -107,  -107,  -107,  -107,    40,  -107,   -14,  -107,   -10,
                    634:     -107,  -107,  -107,  -107,    27,  -107,    99,  -107,   149,  -107,
                    635:     -107,  -107,    27,  -107,    28,  -107,  -107,    40,   155,  -107,
1.163     moko      636:     -107,  -107,  -107
1.108     paf       637: };
1.106     paf       638: 
1.163     moko      639:   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
                    640:      Performed when YYTABLE does not specify something else to do.  Zero
                    641:      means the default is an error.  */
1.156     moko      642: static const yytype_uint8 yydefact[] =
1.112     paf       643: {
1.115     misha     644:      172,   168,     0,     0,    71,     0,     3,     2,     4,     7,
                    645:        8,     6,    29,    30,    33,    34,    37,    35,    36,    70,
                    646:       32,    28,     0,   105,   111,     0,     0,     0,    38,    40,
                    647:        0,    42,    43,    44,     0,    49,    50,    51,    52,     0,
                    648:       99,     0,    46,    97,   106,   107,   108,     0,   118,   119,
                    649:        0,     1,     5,    31,   172,   172,   172,   104,     0,   120,
                    650:      110,   115,     0,   114,   109,     0,     0,   103,     0,   105,
                    651:       53,     0,    97,    39,    58,   172,     0,    48,    55,    56,
                    652:       57,   105,   100,    47,    98,   101,    45,    54,   121,    74,
                    653:       72,    16,     9,    11,    12,     0,    10,    24,     0,    23,
                    654:       22,   172,    20,    19,   117,   116,   112,    41,    98,   169,
                    655:        0,   166,     0,     0,     0,     0,   170,   171,     0,     0,
                    656:        0,     0,     0,     0,   172,   172,   126,   127,     0,   122,
                    657:      123,   124,   125,     0,    13,    15,    14,    21,     0,    27,
                    658:        0,    26,     0,   168,     0,    33,    59,    65,    66,    67,
                    659:       63,    62,   135,   136,   137,   138,   132,   131,   133,   134,
                    660:        0,   167,     0,     0,    61,     0,     0,     0,     0,     0,
1.112     paf       661:        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
                    662:        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1.115     misha     663:        0,     0,    80,   172,     0,     0,    75,    77,    78,    79,
                    664:       25,    17,   113,    69,     0,   130,   128,   129,   150,   151,
                    665:      152,   149,   155,   156,   157,   158,   145,   146,   159,   160,
                    666:      161,   162,   163,   164,   165,   153,   154,   148,   147,   140,
                    667:      139,   141,   142,   144,   143,   169,    93,     0,    89,     0,
                    668:       87,    92,    73,    76,   172,    60,   168,    96,    81,    85,
                    669:       91,    94,   172,    84,     0,    83,    18,   169,     0,    90,
                    670:       88,    86,    82
1.1       parser    671: };
                    672: 
1.163     moko      673:   /* YYPGOTO[NTERM-NUM].  */
                    674: static const yytype_int16 yypgoto[] =
                    675: {
1.168     moko      676:     -107,  -107,  -107,  -107,   194,  -107,  -107,  -107,   105,  -107,
                    677:     -107,  -107,  -107,   156,  -107,  -107,  -107,     1,   -58,    -7,
                    678:     -106,  -107,     0,  -107,  -107,   -15,  -107,  -107,   -40,  -107,
1.163     moko      679:     -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,
1.168     moko      680:     -107,    97,  -107,  -107,  -107,     2,  -107,  -107,  -107,  -107,
                    681:       22,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,   -46,
                    682:      -28,   -25,  -107,    -9,     6,   -19,  -107,   -29,     3,  -107,
                    683:     -107,  -107,  -107,  -107,   178,  -107,   179,   235,  -107,  -107,
                    684:      164,    95,  -107,   116,  -107,   133,  -107,  -107,    49
1.163     moko      685: };
                    686: 
                    687:   /* YYDEFGOTO[NTERM-NUM].  */
1.156     moko      688: static const yytype_int16 yydefgoto[] =
1.112     paf       689: {
                    690:       -1,     5,     6,     7,     8,     9,    92,    93,    94,    95,
1.115     misha     691:       10,   244,   101,    56,    98,    99,   140,   161,    12,    13,
                    692:       14,    15,   126,    28,    29,    30,    31,    32,    33,    17,
                    693:       34,    35,    36,    37,    77,    78,   109,   204,    79,    80,
                    694:      146,   247,   148,   149,    18,   127,    50,   133,    90,   195,
                    695:      196,   197,   235,   258,   198,   199,   248,   239,   237,   249,
                    696:      240,   238,   250,    38,    66,    40,    41,    42,    67,    44,
                    697:       45,    46,    62,   142,    64,    60,    61,    68,    48,    49,
                    698:      241,   129,   130,   162,    20,   251,   131,   132,    21
1.105     paf       699: };
1.1       parser    700: 
1.163     moko      701:   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
                    702:      positive, shift that token.  If negative, reduce the rule whose
                    703:      number is the opposite.  If YYTABLE_NINF, syntax error.  */
1.156     moko      704: static const yytype_int16 yytable[] =
1.112     paf       705: {
1.168     moko      706:       16,    11,    19,   145,   106,    53,    43,    86,    91,    39,
                    707:       83,    65,    16,    22,    19,    57,     1,    74,    70,  -103,
                    708:       82,    75,   192,    51,    76,     2,   193,    73,    86,   194,
                    709:       72,     1,   111,    71,    57,    89,   252,    83,    87,   253,
                    710:      254,    63,    84,   143,   246,    23,   255,    82,    85,   242,
                    711:       43,  -172,    82,    39,   112,   113,   114,   115,     2,   116,
                    712:      117,    58,    16,     3,    19,   118,   119,    91,    59,     4,
                    713:     -102,    23,   120,   121,   108,    16,   110,    19,     3,   122,
                    714:       58,    54,    55,   123,     4,     4,   203,   124,   125,    24,
                    715:        3,     3,    25,    26,   192,    27,     4,     4,   193,    53,
                    716:       88,   194,   144,    96,   100,   103,    16,    97,    19,    16,
                    717:       23,    19,    69,    55,    81,    24,   173,   174,    25,    26,
                    718:      188,   189,   190,   191,    16,    16,    19,    19,    58,   145,
                    719:     -102,   -68,   -68,   184,   185,   186,   187,   188,   189,   190,
                    720:      191,   107,   135,   136,    16,   139,    19,   -15,   -95,   -95,
                    721:      141,   145,   138,   137,    24,   200,    24,    25,    24,    25,
                    722:      165,    25,   151,   168,   169,   170,   171,   172,   173,   174,
                    723:      175,   176,   177,   178,   179,   180,   164,   201,   202,   207,
                    724:      181,   -64,   206,   182,   183,   184,   185,   186,   187,   188,
                    725:      189,   190,   191,    16,   236,    19,    53,   245,   134,   257,
                    726:       52,   173,   174,    16,   262,    19,   147,   152,   153,   154,
                    727:      155,   261,   102,   156,   157,   158,   159,   243,   160,   185,
                    728:      186,   187,   188,   189,   190,   191,   260,   259,   144,   186,
                    729:      187,   188,   189,   190,   191,    16,   104,    19,    47,   105,
                    730:      128,   163,   150,     0,    16,   256,    19,     0,     0,     0,
                    731:      144,     0,    16,   236,    19,     0,     0,    16,     0,    19,
1.115     misha     732:      208,   209,   210,   211,   212,   213,   214,   215,   216,   217,
                    733:      218,   219,   220,   221,   222,   223,   224,   225,   226,   227,
                    734:      228,   229,   230,   231,   232,   233,   234,   165,   166,   167,
                    735:      168,   169,   170,   171,   172,   173,   174,   175,   176,   177,
1.168     moko      736:      178,   179,   180,   168,     0,     0,     0,   181,   173,   174,
1.115     misha     737:      182,   183,   184,   185,   186,   187,   188,   189,   190,   191,
1.168     moko      738:      181,     0,     0,     0,     0,   184,   185,   186,   187,   188,
                    739:      189,   190,   191,   205,   165,   166,   167,   168,   169,   170,
1.115     misha     740:      171,   172,   173,   174,   175,   176,   177,   178,   179,   180,
                    741:        0,     0,     0,     0,   181,     0,     0,   182,   183,   184,
                    742:      185,   186,   187,   188,   189,   190,   191,   165,   166,     0,
                    743:      168,   169,   170,   171,   172,   173,   174,   175,   176,   177,
                    744:      178,   179,   180,     0,     0,     0,     0,   181,     0,     0,
                    745:      182,   183,   184,   185,   186,   187,   188,   189,   190,   191,
1.168     moko      746:      168,   169,   170,   171,   172,   173,   174,   175,   176,   177,
                    747:      178,   179,   180,     0,     0,     0,     0,   181,     0,     0,
                    748:      182,   183,   184,   185,   186,   187,   188,   189,   190,   191,
                    749:      168,     0,     0,   171,   172,   173,   174,     0,   168,     0,
                    750:        0,   179,   180,   173,   174,     0,     0,   181,     0,   173,
                    751:      174,     0,   184,   185,   186,   187,   188,   189,   190,   191,
                    752:      184,   185,   186,   187,   188,   189,   190,   191,   186,   187,
                    753:      188,   189,   190,   191
1.1       parser    754: };
                    755: 
1.156     moko      756: static const yytype_int16 yycheck[] =
1.112     paf       757: {
1.168     moko      758:        0,     0,     0,   109,    62,    12,     3,    47,     4,     3,
                    759:       39,    26,    12,     4,    12,     5,     4,    48,    27,     3,
                    760:       39,    52,    48,     0,    55,    46,    52,     3,    68,    55,
                    761:       27,     4,     4,    27,     5,    50,    50,    66,    47,    53,
                    762:       50,     4,    39,     4,     4,     4,    56,    66,    54,     3,
                    763:       47,    47,    71,    47,    26,    27,    28,    29,    46,    31,
                    764:       32,    51,    62,    51,    62,    37,    38,     4,    58,    57,
                    765:       54,     4,    44,    45,    71,    75,    75,    75,    51,    51,
                    766:       51,    47,    48,    55,    57,    57,   144,    59,    60,    48,
                    767:       51,    51,    51,    52,    48,    54,    57,    57,    52,   106,
                    768:       58,    55,   109,    54,    55,    56,   106,     4,   106,   109,
                    769:        4,   109,     4,    48,     4,    48,    18,    19,    51,    52,
                    770:       39,    40,    41,    42,   124,   125,   124,   125,    51,   235,
                    771:       54,    49,    50,    35,    36,    37,    38,    39,    40,    41,
                    772:       42,    53,    93,    47,   144,     4,   144,    47,    49,    50,
                    773:      101,   257,    50,    49,    48,     4,    48,    51,    48,    51,
                    774:       10,    51,    53,    13,    14,    15,    16,    17,    18,    19,
                    775:       20,    21,    22,    23,    24,    25,    56,    47,    49,    60,
                    776:       30,    49,    59,    33,    34,    35,    36,    37,    38,    39,
                    777:       40,    41,    42,   193,   193,   193,   203,    49,    93,    50,
                    778:        6,    18,    19,   203,    49,   203,   109,   112,   113,   114,
                    779:      115,   257,    56,   118,   119,   120,   121,   195,   123,    36,
                    780:       37,    38,    39,    40,    41,    42,   254,   252,   235,    37,
                    781:       38,    39,    40,    41,    42,   235,    58,   235,     3,    60,
                    782:       76,   125,   109,    -1,   244,   244,   244,    -1,    -1,    -1,
                    783:      257,    -1,   252,   252,   252,    -1,    -1,   257,    -1,   257,
1.115     misha     784:      165,   166,   167,   168,   169,   170,   171,   172,   173,   174,
                    785:      175,   176,   177,   178,   179,   180,   181,   182,   183,   184,
1.168     moko      786:      185,   186,   187,   188,   189,   190,   191,    10,    11,    12,
                    787:       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
                    788:       23,    24,    25,    13,    -1,    -1,    -1,    30,    18,    19,
                    789:       33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
                    790:       30,    -1,    -1,    -1,    -1,    35,    36,    37,    38,    39,
                    791:       40,    41,    42,    56,    10,    11,    12,    13,    14,    15,
                    792:       16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
                    793:       -1,    -1,    -1,    -1,    30,    -1,    -1,    33,    34,    35,
                    794:       36,    37,    38,    39,    40,    41,    42,    10,    11,    -1,
                    795:       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
                    796:       23,    24,    25,    -1,    -1,    -1,    -1,    30,    -1,    -1,
                    797:       33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
                    798:       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
                    799:       23,    24,    25,    -1,    -1,    -1,    -1,    30,    -1,    -1,
                    800:       33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
                    801:       13,    -1,    -1,    16,    17,    18,    19,    -1,    13,    -1,
                    802:       -1,    24,    25,    18,    19,    -1,    -1,    30,    -1,    18,
                    803:       19,    -1,    35,    36,    37,    38,    39,    40,    41,    42,
                    804:       35,    36,    37,    38,    39,    40,    41,    42,    37,    38,
                    805:       39,    40,    41,    42
1.1       parser    806: };
                    807: 
1.163     moko      808:   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
                    809:      symbol of state STATE-NUM.  */
1.156     moko      810: static const yytype_uint8 yystos[] =
1.112     paf       811: {
1.168     moko      812:        0,     4,    46,    51,    57,    62,    63,    64,    65,    66,
                    813:       71,    78,    79,    80,    81,    82,    83,    90,   105,   106,
                    814:      145,   149,     4,     4,    48,    51,    52,    54,    84,    85,
                    815:       86,    87,    88,    89,    91,    92,    93,    94,   124,   125,
                    816:      126,   127,   128,   129,   130,   131,   132,   138,   139,   140,
                    817:      107,     0,    65,    80,    47,    48,    74,     5,    51,    58,
                    818:      136,   137,   133,     4,   135,    86,   125,   129,   138,     4,
                    819:      124,   125,   129,     3,    48,    52,    55,    95,    96,    99,
                    820:      100,     4,   126,   128,   129,    54,    89,   124,    58,    86,
                    821:      109,     4,    67,    68,    69,    70,   149,     4,    75,    76,
                    822:      149,    73,    74,   149,   135,   137,    79,    53,   129,    97,
                    823:       78,     4,    26,    27,    28,    29,    31,    32,    37,    38,
                    824:       44,    45,    51,    55,    59,    60,    83,   106,   141,   142,
                    825:      143,   147,   148,   108,    69,   149,    47,    49,    50,     4,
                    826:       77,   149,   134,     4,    80,    81,   101,   102,   103,   104,
                    827:      146,    53,   142,   142,   142,   142,   142,   142,   142,   142,
                    828:      142,    78,   144,   144,    56,    10,    11,    12,    13,    14,
                    829:       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
                    830:       25,    30,    33,    34,    35,    36,    37,    38,    39,    40,
                    831:       41,    42,    48,    52,    55,   110,   111,   112,   115,   116,
                    832:        4,    47,    49,    79,    98,    56,    59,    60,   142,   142,
                    833:      142,   142,   142,   142,   142,   142,   142,   142,   142,   142,
                    834:      142,   142,   142,   142,   142,   142,   142,   142,   142,   142,
                    835:      142,   142,   142,   142,   142,   113,    78,   119,   122,   118,
                    836:      121,   141,     3,   111,    72,    49,     4,   102,   117,   120,
                    837:      123,   146,    50,    53,    50,    56,    78,    50,   114,   122,
                    838:      121,   120,    49
1.1       parser    839: };
1.109     paf       840: 
1.163     moko      841:   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
                    842: static const yytype_uint8 yyr1[] =
                    843: {
1.168     moko      844:        0,    61,    62,    62,    63,    63,    64,    65,    65,    66,
                    845:       67,    67,    68,    68,    69,    70,    70,    72,    71,    73,
                    846:       73,    74,    75,    75,    76,    76,    77,    77,    78,    78,
                    847:       79,    79,    80,    80,    81,    81,    81,    82,    83,    84,
                    848:       84,    85,    86,    86,    87,    88,    89,    89,    90,    91,
                    849:       91,    91,    92,    93,    94,    95,    95,    95,    97,    98,
                    850:       96,    99,   100,   101,   101,   101,   102,   103,   104,   104,
                    851:      105,   107,   108,   106,   109,   110,   110,   111,   111,   111,
                    852:      113,   114,   112,   115,   116,   117,   117,   118,   118,   119,
                    853:      119,   120,   121,   122,   123,   123,   123,   124,   124,   125,
                    854:      125,   126,   127,   128,   128,   129,   129,   129,   129,   130,
                    855:      131,   133,   134,   132,   135,   136,   136,   137,   138,   138,
                    856:      139,   140,   141,   142,   142,   142,   142,   142,   142,   142,
                    857:      142,   142,   142,   142,   142,   142,   142,   142,   142,   142,
                    858:      142,   142,   142,   142,   142,   142,   142,   142,   142,   142,
                    859:      142,   142,   142,   142,   142,   142,   142,   142,   142,   142,
                    860:      142,   142,   142,   142,   142,   142,   143,   144,   145,   146,
                    861:      147,   148,   149
1.163     moko      862: };
1.112     paf       863: 
1.163     moko      864:   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
                    865: static const yytype_uint8 yyr2[] =
                    866: {
                    867:        0,     2,     1,     1,     1,     2,     1,     1,     1,     4,
                    868:        1,     1,     1,     2,     2,     1,     1,     0,     8,     1,
                    869:        1,     3,     1,     1,     1,     3,     1,     1,     1,     1,
                    870:        1,     2,     1,     1,     1,     1,     1,     1,     2,     2,
                    871:        1,     3,     1,     1,     1,     2,     1,     2,     3,     1,
                    872:        1,     1,     1,     2,     2,     1,     1,     1,     0,     0,
                    873:        5,     3,     3,     1,     1,     1,     1,     1,     1,     2,
                    874:        1,     0,     0,     6,     1,     1,     2,     1,     1,     1,
                    875:        0,     0,     5,     3,     3,     1,     3,     1,     3,     1,
                    876:        3,     1,     1,     1,     1,     1,     1,     1,     2,     1,
                    877:        2,     2,     1,     1,     2,     1,     1,     1,     1,     2,
                    878:        2,     0,     0,     5,     1,     1,     2,     2,     1,     1,
                    879:        2,     2,     1,     1,     1,     1,     1,     1,     3,     3,
                    880:        3,     2,     2,     2,     2,     2,     2,     2,     2,     3,
                    881:        3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
                    882:        3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
                    883:        3,     3,     3,     3,     3,     3,     1,     1,     1,     0,
                    884:        1,     1,     0
                    885: };
1.112     paf       886: 
1.156     moko      887: 
1.163     moko      888: #define yyerrok         (yyerrstatus = 0)
                    889: #define yyclearin       (yychar = YYEMPTY)
                    890: #define YYEMPTY         (-2)
                    891: #define YYEOF           0
                    892: 
                    893: #define YYACCEPT        goto yyacceptlab
                    894: #define YYABORT         goto yyabortlab
                    895: #define YYERROR         goto yyerrorlab
1.156     moko      896: 
                    897: 
1.163     moko      898: #define YYRECOVERING()  (!!yyerrstatus)
1.108     paf       899: 
1.163     moko      900: #define YYBACKUP(Token, Value)                                  \
                    901: do                                                              \
                    902:   if (yychar == YYEMPTY)                                        \
                    903:     {                                                           \
                    904:       yychar = (Token);                                         \
                    905:       yylval = (Value);                                         \
                    906:       YYPOPSTACK (yylen);                                       \
                    907:       yystate = *yyssp;                                         \
                    908:       goto yybackup;                                            \
                    909:     }                                                           \
                    910:   else                                                          \
                    911:     {                                                           \
                    912:       yyerror (pc, YY_("syntax error: cannot back up")); \
                    913:       YYERROR;                                                  \
                    914:     }                                                           \
                    915: while (0)
                    916: 
                    917: /* Error token number */
                    918: #define YYTERROR        1
                    919: #define YYERRCODE       256
1.156     moko      920: 
1.112     paf       921: 
                    922: 
                    923: /* Enable debugging if requested.  */
                    924: #if YYDEBUG
                    925: 
                    926: # ifndef YYFPRINTF
                    927: #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
                    928: #  define YYFPRINTF fprintf
                    929: # endif
                    930: 
1.163     moko      931: # define YYDPRINTF(Args)                        \
                    932: do {                                            \
                    933:   if (yydebug)                                  \
                    934:     YYFPRINTF Args;                             \
                    935: } while (0)
                    936: 
                    937: /* This macro is provided for backward compatibility. */
                    938: #ifndef YY_LOCATION_PRINT
                    939: # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
                    940: #endif
                    941: 
1.156     moko      942: 
1.163     moko      943: # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
                    944: do {                                                                      \
                    945:   if (yydebug)                                                            \
                    946:     {                                                                     \
                    947:       YYFPRINTF (stderr, "%s ", Title);                                   \
                    948:       yy_symbol_print (stderr,                                            \
                    949:                   Type, Value, pc); \
                    950:       YYFPRINTF (stderr, "\n");                                           \
                    951:     }                                                                     \
                    952: } while (0)
1.154     moko      953: 
1.156     moko      954: 
1.163     moko      955: /*----------------------------------------.
                    956: | Print this symbol's value on YYOUTPUT.  |
                    957: `----------------------------------------*/
                    958: 
1.156     moko      959: static void
1.163     moko      960: yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, Parse_control* pc)
1.156     moko      961: {
1.163     moko      962:   FILE *yyo = yyoutput;
                    963:   YYUSE (yyo);
                    964:   YYUSE (pc);
1.156     moko      965:   if (!yyvaluep)
                    966:     return;
                    967: # ifdef YYPRINT
                    968:   if (yytype < YYNTOKENS)
                    969:     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
                    970: # endif
1.163     moko      971:   YYUSE (yytype);
1.156     moko      972: }
                    973: 
                    974: 
                    975: /*--------------------------------.
                    976: | Print this symbol on YYOUTPUT.  |
                    977: `--------------------------------*/
                    978: 
                    979: static void
1.163     moko      980: yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, Parse_control* pc)
1.156     moko      981: {
1.163     moko      982:   YYFPRINTF (yyoutput, "%s %s (",
                    983:              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
1.154     moko      984: 
1.163     moko      985:   yy_symbol_value_print (yyoutput, yytype, yyvaluep, pc);
1.156     moko      986:   YYFPRINTF (yyoutput, ")");
                    987: }
1.112     paf       988: 
                    989: /*------------------------------------------------------------------.
                    990: | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1.113     paf       991: | TOP (included).                                                   |
1.112     paf       992: `------------------------------------------------------------------*/
                    993: 
                    994: static void
1.156     moko      995: yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1.112     paf       996: {
                    997:   YYFPRINTF (stderr, "Stack now");
1.156     moko      998:   for (; yybottom <= yytop; yybottom++)
                    999:     {
                   1000:       int yybot = *yybottom;
                   1001:       YYFPRINTF (stderr, " %d", yybot);
                   1002:     }
1.112     paf      1003:   YYFPRINTF (stderr, "\n");
                   1004: }
1.108     paf      1005: 
1.163     moko     1006: # define YY_STACK_PRINT(Bottom, Top)                            \
                   1007: do {                                                            \
                   1008:   if (yydebug)                                                  \
                   1009:     yy_stack_print ((Bottom), (Top));                           \
                   1010: } while (0)
1.108     paf      1011: 
                   1012: 
1.112     paf      1013: /*------------------------------------------------.
                   1014: | Report that the YYRULE is going to be reduced.  |
                   1015: `------------------------------------------------*/
1.108     paf      1016: 
1.112     paf      1017: static void
1.163     moko     1018: yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, Parse_control* pc)
1.112     paf      1019: {
1.163     moko     1020:   unsigned long int yylno = yyrline[yyrule];
1.156     moko     1021:   int yynrhs = yyr2[yyrule];
1.112     paf      1022:   int yyi;
1.156     moko     1023:   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1.163     moko     1024:              yyrule - 1, yylno);
1.156     moko     1025:   /* The symbols being reduced.  */
                   1026:   for (yyi = 0; yyi < yynrhs; yyi++)
                   1027:     {
                   1028:       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
1.163     moko     1029:       yy_symbol_print (stderr,
                   1030:                        yystos[yyssp[yyi + 1 - yynrhs]],
                   1031:                        &(yyvsp[(yyi + 1) - (yynrhs)])
                   1032:                                               , pc);
1.156     moko     1033:       YYFPRINTF (stderr, "\n");
                   1034:     }
1.112     paf      1035: }
1.105     paf      1036: 
1.163     moko     1037: # define YY_REDUCE_PRINT(Rule)          \
                   1038: do {                                    \
                   1039:   if (yydebug)                          \
                   1040:     yy_reduce_print (yyssp, yyvsp, Rule, pc); \
                   1041: } while (0)
1.112     paf      1042: 
                   1043: /* Nonzero means print parse trace.  It is left uninitialized so that
                   1044:    multiple parsers can coexist.  */
                   1045: int yydebug;
                   1046: #else /* !YYDEBUG */
                   1047: # define YYDPRINTF(Args)
1.156     moko     1048: # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1.112     paf      1049: # define YY_STACK_PRINT(Bottom, Top)
                   1050: # define YY_REDUCE_PRINT(Rule)
                   1051: #endif /* !YYDEBUG */
1.1       parser   1052: 
                   1053: 
1.112     paf      1054: /* YYINITDEPTH -- initial size of the parser's stacks.  */
1.163     moko     1055: #ifndef YYINITDEPTH
1.112     paf      1056: # define YYINITDEPTH 200
1.1       parser   1057: #endif
                   1058: 
1.112     paf      1059: /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
                   1060:    if the built-in stack extension method is used).
                   1061: 
                   1062:    Do not make this value too large; the results are undefined if
1.156     moko     1063:    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1.112     paf      1064:    evaluated with infinite-precision integer arithmetic.  */
1.1       parser   1065: 
                   1066: #ifndef YYMAXDEPTH
1.112     paf      1067: # define YYMAXDEPTH 10000
1.1       parser   1068: #endif
1.112     paf      1069: 
1.1       parser   1070: 
1.112     paf      1071: #if YYERROR_VERBOSE
                   1072: 
                   1073: # ifndef yystrlen
1.156     moko     1074: #  if defined __GLIBC__ && defined _STRING_H
1.112     paf      1075: #   define yystrlen strlen
                   1076: #  else
                   1077: /* Return the length of YYSTR.  */
                   1078: static YYSIZE_T
                   1079: yystrlen (const char *yystr)
                   1080: {
1.156     moko     1081:   YYSIZE_T yylen;
                   1082:   for (yylen = 0; yystr[yylen]; yylen++)
1.112     paf      1083:     continue;
1.156     moko     1084:   return yylen;
1.112     paf      1085: }
                   1086: #  endif
                   1087: # endif
                   1088: 
                   1089: # ifndef yystpcpy
1.156     moko     1090: #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1.112     paf      1091: #   define yystpcpy stpcpy
                   1092: #  else
                   1093: /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
                   1094:    YYDEST.  */
                   1095: static char *
                   1096: yystpcpy (char *yydest, const char *yysrc)
                   1097: {
1.156     moko     1098:   char *yyd = yydest;
                   1099:   const char *yys = yysrc;
1.112     paf      1100: 
                   1101:   while ((*yyd++ = *yys++) != '\0')
                   1102:     continue;
1.105     paf      1103: 
1.112     paf      1104:   return yyd - 1;
1.105     paf      1105: }
1.112     paf      1106: #  endif
                   1107: # endif
                   1108: 
1.156     moko     1109: # ifndef yytnamerr
                   1110: /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
                   1111:    quotes and backslashes, so that it's suitable for yyerror.  The
                   1112:    heuristic is that double-quoting is unnecessary unless the string
                   1113:    contains an apostrophe, a comma, or backslash (other than
                   1114:    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
                   1115:    null, do not copy; instead, return the length of what the result
                   1116:    would have been.  */
                   1117: static YYSIZE_T
                   1118: yytnamerr (char *yyres, const char *yystr)
                   1119: {
                   1120:   if (*yystr == '"')
                   1121:     {
                   1122:       YYSIZE_T yyn = 0;
                   1123:       char const *yyp = yystr;
1.154     moko     1124: 
1.156     moko     1125:       for (;;)
1.163     moko     1126:         switch (*++yyp)
                   1127:           {
                   1128:           case '\'':
                   1129:           case ',':
                   1130:             goto do_not_strip_quotes;
                   1131: 
                   1132:           case '\\':
                   1133:             if (*++yyp != '\\')
                   1134:               goto do_not_strip_quotes;
                   1135:             /* Fall through.  */
                   1136:           default:
                   1137:             if (yyres)
                   1138:               yyres[yyn] = *yyp;
                   1139:             yyn++;
                   1140:             break;
                   1141: 
                   1142:           case '"':
                   1143:             if (yyres)
                   1144:               yyres[yyn] = '\0';
                   1145:             return yyn;
                   1146:           }
1.156     moko     1147:     do_not_strip_quotes: ;
                   1148:     }
                   1149: 
                   1150:   if (! yyres)
                   1151:     return yystrlen (yystr);
1.112     paf      1152: 
1.156     moko     1153:   return yystpcpy (yyres, yystr) - yyres;
                   1154: }
                   1155: # endif
1.105     paf      1156: 
1.158     misha    1157: /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
                   1158:    about the unexpected token YYTOKEN for the state stack whose top is
                   1159:    YYSSP.
                   1160: 
                   1161:    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
                   1162:    not large enough to hold the message.  In that case, also set
                   1163:    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
                   1164:    required number of bytes is too large to store.  */
                   1165: static int
                   1166: yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                   1167:                 yytype_int16 *yyssp, int yytoken)
1.1       parser   1168: {
1.163     moko     1169:   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1.158     misha    1170:   YYSIZE_T yysize = yysize0;
                   1171:   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
                   1172:   /* Internationalized format string. */
1.163     moko     1173:   const char *yyformat = YY_NULLPTR;
1.158     misha    1174:   /* Arguments of yyformat. */
                   1175:   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
                   1176:   /* Number of reported tokens (one for the "unexpected", one per
                   1177:      "expected"). */
                   1178:   int yycount = 0;
                   1179: 
                   1180:   /* There are many possibilities here to consider:
                   1181:      - If this state is a consistent state with a default action, then
                   1182:        the only way this function was invoked is if the default action
                   1183:        is an error action.  In that case, don't check for expected
                   1184:        tokens because there are none.
                   1185:      - The only way there can be no lookahead present (in yychar) is if
                   1186:        this state is a consistent state with a default action.  Thus,
                   1187:        detecting the absence of a lookahead is sufficient to determine
                   1188:        that there is no unexpected or expected token to report.  In that
                   1189:        case, just report a simple "syntax error".
                   1190:      - Don't assume there isn't a lookahead just because this state is a
                   1191:        consistent state with a default action.  There might have been a
                   1192:        previous inconsistent state, consistent state with a non-default
                   1193:        action, or user semantic action that manipulated yychar.
                   1194:      - Of course, the expected token list depends on states to have
                   1195:        correct lookahead information, and it depends on the parser not
                   1196:        to perform extra reductions after fetching a lookahead from the
                   1197:        scanner and before detecting a syntax error.  Thus, state merging
                   1198:        (from LALR or IELR) and default reductions corrupt the expected
                   1199:        token list.  However, the list is correct for canonical LR with
                   1200:        one exception: it will still contain any token that will not be
                   1201:        accepted due to an error action in a later state.
                   1202:   */
                   1203:   if (yytoken != YYEMPTY)
                   1204:     {
                   1205:       int yyn = yypact[*yyssp];
                   1206:       yyarg[yycount++] = yytname[yytoken];
                   1207:       if (!yypact_value_is_default (yyn))
                   1208:         {
                   1209:           /* Start YYX at -YYN if negative to avoid negative indexes in
                   1210:              YYCHECK.  In other words, skip the first -YYN actions for
                   1211:              this state because they are default actions.  */
                   1212:           int yyxbegin = yyn < 0 ? -yyn : 0;
                   1213:           /* Stay within bounds of both yycheck and yytname.  */
                   1214:           int yychecklim = YYLAST - yyn + 1;
                   1215:           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
                   1216:           int yyx;
                   1217: 
                   1218:           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
                   1219:             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
                   1220:                 && !yytable_value_is_error (yytable[yyx + yyn]))
                   1221:               {
                   1222:                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
                   1223:                   {
                   1224:                     yycount = 1;
                   1225:                     yysize = yysize0;
                   1226:                     break;
                   1227:                   }
                   1228:                 yyarg[yycount++] = yytname[yyx];
1.163     moko     1229:                 {
                   1230:                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
                   1231:                   if (! (yysize <= yysize1
                   1232:                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
                   1233:                     return 2;
                   1234:                   yysize = yysize1;
                   1235:                 }
1.158     misha    1236:               }
                   1237:         }
                   1238:     }
1.112     paf      1239: 
1.158     misha    1240:   switch (yycount)
1.112     paf      1241:     {
1.158     misha    1242: # define YYCASE_(N, S)                      \
                   1243:       case N:                               \
                   1244:         yyformat = S;                       \
                   1245:       break
                   1246:       YYCASE_(0, YY_("syntax error"));
                   1247:       YYCASE_(1, YY_("syntax error, unexpected %s"));
                   1248:       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
                   1249:       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
                   1250:       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
                   1251:       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
                   1252: # undef YYCASE_
                   1253:     }
1.156     moko     1254: 
1.163     moko     1255:   {
                   1256:     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
                   1257:     if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
                   1258:       return 2;
                   1259:     yysize = yysize1;
                   1260:   }
1.158     misha    1261: 
                   1262:   if (*yymsg_alloc < yysize)
                   1263:     {
                   1264:       *yymsg_alloc = 2 * yysize;
                   1265:       if (! (yysize <= *yymsg_alloc
                   1266:              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
                   1267:         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
                   1268:       return 1;
                   1269:     }
1.156     moko     1270: 
1.158     misha    1271:   /* Avoid sprintf, as that infringes on the user's name space.
                   1272:      Don't have undefined behavior even if the translation
                   1273:      produced a string with the wrong number of "%s"s.  */
                   1274:   {
                   1275:     char *yyp = *yymsg;
                   1276:     int yyi = 0;
                   1277:     while ((*yyp = *yyformat) != '\0')
                   1278:       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
                   1279:         {
                   1280:           yyp += yytnamerr (yyp, yyarg[yyi++]);
                   1281:           yyformat += 2;
                   1282:         }
                   1283:       else
                   1284:         {
                   1285:           yyp++;
                   1286:           yyformat++;
                   1287:         }
                   1288:   }
                   1289:   return 0;
1.1       parser   1290: }
1.156     moko     1291: #endif /* YYERROR_VERBOSE */
1.1       parser   1292: 
1.112     paf      1293: /*-----------------------------------------------.
                   1294: | Release the memory associated to this symbol.  |
                   1295: `-----------------------------------------------*/
                   1296: 
                   1297: static void
1.163     moko     1298: yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, Parse_control* pc)
1.112     paf      1299: {
1.156     moko     1300:   YYUSE (yyvaluep);
1.163     moko     1301:   YYUSE (pc);
1.156     moko     1302:   if (!yymsg)
                   1303:     yymsg = "Deleting";
                   1304:   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1.112     paf      1305: 
1.163     moko     1306:   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
                   1307:   YYUSE (yytype);
                   1308:   YY_IGNORE_MAYBE_UNINITIALIZED_END
1.112     paf      1309: }
1.1       parser   1310: 
1.158     misha    1311: 
1.112     paf      1312: 
                   1313: 
1.158     misha    1314: /*----------.
                   1315: | yyparse.  |
                   1316: `----------*/
1.1       parser   1317: 
1.112     paf      1318: int
1.163     moko     1319: yyparse (Parse_control* pc)
1.112     paf      1320: {
1.156     moko     1321: /* The lookahead symbol.  */
1.112     paf      1322: int yychar;
                   1323: 
1.163     moko     1324: 
1.112     paf      1325: /* The semantic value of the lookahead symbol.  */
1.163     moko     1326: /* Default value used for initialization, for pacifying older GCCs
                   1327:    or non-GCC compilers.  */
                   1328: YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
                   1329: YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1.112     paf      1330: 
1.156     moko     1331:     /* Number of syntax errors so far.  */
                   1332:     int yynerrs;
1.155     misha    1333: 
1.156     moko     1334:     int yystate;
                   1335:     /* Number of tokens to shift before error messages enabled.  */
                   1336:     int yyerrstatus;
1.155     misha    1337: 
1.156     moko     1338:     /* The stacks and their tools:
1.163     moko     1339:        'yyss': related to states.
                   1340:        'yyvs': related to semantic values.
1.109     paf      1341: 
1.163     moko     1342:        Refer to the stacks through separate pointers, to allow yyoverflow
1.156     moko     1343:        to reallocate them elsewhere.  */
1.112     paf      1344: 
1.156     moko     1345:     /* The state stack.  */
                   1346:     yytype_int16 yyssa[YYINITDEPTH];
                   1347:     yytype_int16 *yyss;
                   1348:     yytype_int16 *yyssp;
1.112     paf      1349: 
1.156     moko     1350:     /* The semantic value stack.  */
                   1351:     YYSTYPE yyvsa[YYINITDEPTH];
                   1352:     YYSTYPE *yyvs;
                   1353:     YYSTYPE *yyvsp;
1.112     paf      1354: 
1.156     moko     1355:     YYSIZE_T yystacksize;
1.112     paf      1356: 
1.156     moko     1357:   int yyn;
                   1358:   int yyresult;
                   1359:   /* Lookahead token as an internal (translated) token number.  */
1.163     moko     1360:   int yytoken = 0;
1.112     paf      1361:   /* The variables used to return semantic value and location from the
                   1362:      action routines.  */
                   1363:   YYSTYPE yyval;
1.1       parser   1364: 
1.156     moko     1365: #if YYERROR_VERBOSE
                   1366:   /* Buffer for error messages, and its allocated size.  */
                   1367:   char yymsgbuf[128];
                   1368:   char *yymsg = yymsgbuf;
                   1369:   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
                   1370: #endif
                   1371: 
                   1372: #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
                   1373: 
                   1374:   /* The number of symbols on the RHS of the reduced rule.
                   1375:      Keep to zero when no symbol should be popped.  */
                   1376:   int yylen = 0;
                   1377: 
1.163     moko     1378:   yyssp = yyss = yyssa;
                   1379:   yyvsp = yyvs = yyvsa;
1.156     moko     1380:   yystacksize = YYINITDEPTH;
1.1       parser   1381: 
1.112     paf      1382:   YYDPRINTF ((stderr, "Starting parse\n"));
1.1       parser   1383: 
                   1384:   yystate = 0;
                   1385:   yyerrstatus = 0;
                   1386:   yynerrs = 0;
1.156     moko     1387:   yychar = YYEMPTY; /* Cause a token to be read.  */
1.112     paf      1388:   goto yysetstate;
                   1389: 
                   1390: /*------------------------------------------------------------.
                   1391: | yynewstate -- Push a new state, which is found in yystate.  |
                   1392: `------------------------------------------------------------*/
                   1393:  yynewstate:
                   1394:   /* In all cases, when you get here, the value and location stacks
1.156     moko     1395:      have just been pushed.  So pushing a state here evens the stacks.  */
1.112     paf      1396:   yyssp++;
1.105     paf      1397: 
1.112     paf      1398:  yysetstate:
                   1399:   *yyssp = yystate;
1.108     paf      1400: 
1.112     paf      1401:   if (yyss + yystacksize - 1 <= yyssp)
1.109     paf      1402:     {
1.1       parser   1403:       /* Get the current used size of the three stacks, in elements.  */
1.112     paf      1404:       YYSIZE_T yysize = yyssp - yyss + 1;
1.1       parser   1405: 
                   1406: #ifdef yyoverflow
1.112     paf      1407:       {
1.163     moko     1408:         /* Give user a chance to reallocate the stack.  Use copies of
                   1409:            these so that the &'s don't force the real ones into
                   1410:            memory.  */
                   1411:         YYSTYPE *yyvs1 = yyvs;
                   1412:         yytype_int16 *yyss1 = yyss;
                   1413: 
                   1414:         /* Each stack pointer address is followed by the size of the
                   1415:            data in use in that stack, in bytes.  This used to be a
                   1416:            conditional around just the two extra args, but that might
                   1417:            be undefined if yyoverflow is a macro.  */
                   1418:         yyoverflow (YY_("memory exhausted"),
                   1419:                     &yyss1, yysize * sizeof (*yyssp),
                   1420:                     &yyvs1, yysize * sizeof (*yyvsp),
                   1421:                     &yystacksize);
1.112     paf      1422: 
1.163     moko     1423:         yyss = yyss1;
                   1424:         yyvs = yyvs1;
1.112     paf      1425:       }
1.1       parser   1426: #else /* no yyoverflow */
1.112     paf      1427: # ifndef YYSTACK_RELOCATE
1.156     moko     1428:       goto yyexhaustedlab;
1.112     paf      1429: # else
1.1       parser   1430:       /* Extend the stack our own way.  */
1.112     paf      1431:       if (YYMAXDEPTH <= yystacksize)
1.163     moko     1432:         goto yyexhaustedlab;
1.1       parser   1433:       yystacksize *= 2;
1.112     paf      1434:       if (YYMAXDEPTH < yystacksize)
1.163     moko     1435:         yystacksize = YYMAXDEPTH;
1.112     paf      1436: 
                   1437:       {
1.163     moko     1438:         yytype_int16 *yyss1 = yyss;
                   1439:         union yyalloc *yyptr =
                   1440:           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
                   1441:         if (! yyptr)
                   1442:           goto yyexhaustedlab;
                   1443:         YYSTACK_RELOCATE (yyss_alloc, yyss);
                   1444:         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1.112     paf      1445: #  undef YYSTACK_RELOCATE
1.163     moko     1446:         if (yyss1 != yyssa)
                   1447:           YYSTACK_FREE (yyss1);
1.112     paf      1448:       }
                   1449: # endif
1.1       parser   1450: #endif /* no yyoverflow */
                   1451: 
1.112     paf      1452:       yyssp = yyss + yysize - 1;
                   1453:       yyvsp = yyvs + yysize - 1;
                   1454: 
                   1455:       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1.163     moko     1456:                   (unsigned long int) yystacksize));
1.105     paf      1457: 
1.112     paf      1458:       if (yyss + yystacksize - 1 <= yyssp)
1.163     moko     1459:         YYABORT;
1.1       parser   1460:     }
                   1461: 
1.112     paf      1462:   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1.1       parser   1463: 
1.156     moko     1464:   if (yystate == YYFINAL)
                   1465:     YYACCEPT;
                   1466: 
1.1       parser   1467:   goto yybackup;
1.112     paf      1468: 
                   1469: /*-----------.
                   1470: | yybackup.  |
                   1471: `-----------*/
                   1472: yybackup:
1.1       parser   1473: 
1.156     moko     1474:   /* Do appropriate processing given the current state.  Read a
                   1475:      lookahead token if we need one and don't already have one.  */
1.1       parser   1476: 
                   1477:   /* First try to decide what to do without reference to lookahead token.  */
                   1478:   yyn = yypact[yystate];
1.158     misha    1479:   if (yypact_value_is_default (yyn))
1.1       parser   1480:     goto yydefault;
                   1481: 
                   1482:   /* Not known => get a lookahead token if don't already have one.  */
                   1483: 
1.112     paf      1484:   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1.1       parser   1485:   if (yychar == YYEMPTY)
                   1486:     {
1.112     paf      1487:       YYDPRINTF ((stderr, "Reading a token: "));
1.163     moko     1488:       yychar = yylex (&yylval, pc);
1.1       parser   1489:     }
                   1490: 
1.112     paf      1491:   if (yychar <= YYEOF)
1.1       parser   1492:     {
1.112     paf      1493:       yychar = yytoken = YYEOF;
                   1494:       YYDPRINTF ((stderr, "Now at end of input.\n"));
1.1       parser   1495:     }
                   1496:   else
                   1497:     {
1.112     paf      1498:       yytoken = YYTRANSLATE (yychar);
1.156     moko     1499:       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1.1       parser   1500:     }
                   1501: 
1.112     paf      1502:   /* If the proper action on seeing token YYTOKEN is to reduce or to
                   1503:      detect an error, take that action.  */
                   1504:   yyn += yytoken;
                   1505:   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1.1       parser   1506:     goto yydefault;
                   1507:   yyn = yytable[yyn];
1.112     paf      1508:   if (yyn <= 0)
1.1       parser   1509:     {
1.158     misha    1510:       if (yytable_value_is_error (yyn))
                   1511:         goto yyerrlab;
1.1       parser   1512:       yyn = -yyn;
                   1513:       goto yyreduce;
                   1514:     }
                   1515: 
1.156     moko     1516:   /* Count tokens shifted since error; after three, turn off error
                   1517:      status.  */
                   1518:   if (yyerrstatus)
                   1519:     yyerrstatus--;
1.155     misha    1520: 
                   1521:   /* Shift the lookahead token.  */
1.156     moko     1522:   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1.155     misha    1523: 
1.156     moko     1524:   /* Discard the shifted token.  */
                   1525:   yychar = YYEMPTY;
1.155     misha    1526: 
1.156     moko     1527:   yystate = yyn;
1.163     moko     1528:   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1.155     misha    1529:   *++yyvsp = yylval;
1.163     moko     1530:   YY_IGNORE_MAYBE_UNINITIALIZED_END
1.155     misha    1531: 
1.1       parser   1532:   goto yynewstate;
                   1533: 
1.112     paf      1534: 
                   1535: /*-----------------------------------------------------------.
                   1536: | yydefault -- do the default action for the current state.  |
                   1537: `-----------------------------------------------------------*/
1.109     paf      1538: yydefault:
1.1       parser   1539:   yyn = yydefact[yystate];
                   1540:   if (yyn == 0)
                   1541:     goto yyerrlab;
1.112     paf      1542:   goto yyreduce;
                   1543: 
1.105     paf      1544: 
1.112     paf      1545: /*-----------------------------.
                   1546: | yyreduce -- Do a reduction.  |
                   1547: `-----------------------------*/
1.1       parser   1548: yyreduce:
1.112     paf      1549:   /* yyn is the number of a rule to reduce with.  */
1.1       parser   1550:   yylen = yyr2[yyn];
1.109     paf      1551: 
1.112     paf      1552:   /* If YYLEN is nonzero, implement the default value of the action:
1.163     moko     1553:      '$$ = $1'.
1.109     paf      1554: 
1.112     paf      1555:      Otherwise, the following line sets YYVAL to garbage.
                   1556:      This behavior is undocumented and Bison
                   1557:      users should not rely upon it.  Assigning to YYVAL
                   1558:      unconditionally makes the parser a bit smaller, and it avoids a
                   1559:      GCC warning that YYVAL may be used uninitialized.  */
                   1560:   yyval = yyvsp[1-yylen];
1.106     paf      1561: 
1.1       parser   1562: 
1.112     paf      1563:   YY_REDUCE_PRINT (yyn);
                   1564:   switch (yyn)
                   1565:     {
                   1566:         case 2:
1.170   ! moko     1567: #line 139 "compile.y" /* yacc.c:1646  */
1.112     paf      1568:     {
1.144     misha    1569:        Method* method=new Method(Method::CT_ANY,
1.1       parser   1570:                0, 0, /*min, max numbered_params_count*/
                   1571:                0/*param_names*/, 0/*local_names*/, 
1.163     moko     1572:                (yyvsp[0])/*parser_code*/, 0/*native_code*/);
1.144     misha    1573:        PC.cclass->set_method(PC.alias_method(main_method_name), method);
1.158     misha    1574: }
1.170   ! moko     1575: #line 1576 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1576:     break;
                   1577: 
                   1578:   case 9:
1.170   ! moko     1579: #line 154 "compile.y" /* yacc.c:1646  */
1.112     paf      1580:     {
1.163     moko     1581:        const String& command=LA2S(*(yyvsp[-2]))->trim(String::TRIM_END);
                   1582:        YYSTYPE strings_code=(yyvsp[0]);
1.84      paf      1583:        if(strings_code->count()<1*OPERATIONS_PER_OPVALUE) {
1.1       parser   1584:                strcpy(PC.error, "@");
                   1585:                strcat(PC.error, command.cstr());
                   1586:                strcat(PC.error, " is empty");
                   1587:                YYERROR;
                   1588:        }
                   1589:        if(command==CLASS_NAME) {
1.84      paf      1590:                if(strings_code->count()==1*OPERATIONS_PER_OPVALUE) {
1.157     moko     1591:                        CLASS_ADD;
1.1       parser   1592:                        // new class' name
1.152     misha    1593:                        const String& name=LA2S(*strings_code)->trim(String::TRIM_END);
1.1       parser   1594:                        // creating the class
1.84      paf      1595:                        VStateless_class* cclass=new VClass;
1.119     misha    1596:                        PC.cclass_new=cclass;
1.167     moko     1597:                        PC.cclass_new->set_type(name.cstr());
1.158     misha    1598:                        PC.append=false;
1.1       parser   1599:                } else {
1.160     moko     1600:                        strcpy(PC.error, "@" CLASS_NAME " must contain only one line with class name (contains more then one)");
1.1       parser   1601:                        YYERROR;
                   1602:                }
                   1603:        } else if(command==USE_CONTROL_METHOD_NAME) {
1.157     moko     1604:                CLASS_ADD;
1.165     moko     1605:                for(size_t i=0; i<strings_code->count(); i+=OPERATIONS_PER_OPVALUE){
                   1606:                        PC.request.use_file(PC.request.main_class, LA2S(*strings_code, i)->trim(String::TRIM_END),
                   1607:                                PC.request.get_used_filename(PC.file_no), strings_code->get(i+1).origin);
                   1608:                }
1.1       parser   1609:        } else if(command==BASE_NAME) {
1.119     misha    1610:                if(PC.append){
                   1611:                        strcpy(PC.error, "can't set base while appending methods to class '");
1.167     moko     1612:                        strncat(PC.error, PC.cclass->type(), MAX_STRING/2);
1.119     misha    1613:                        strcat(PC.error, "'");
                   1614:                        YYERROR;
                   1615:                }
1.157     moko     1616:                CLASS_ADD;
1.59      paf      1617:                if(PC.cclass->base_class()) { // already changed from default?
1.1       parser   1618:                        strcpy(PC.error, "class already have a base '");
1.167     moko     1619:                        strncat(PC.error, PC.cclass->base_class()->type(), MAX_STRING/2);
1.1       parser   1620:                        strcat(PC.error, "'");
                   1621:                        YYERROR;
                   1622:                }
1.84      paf      1623:                if(strings_code->count()==1*OPERATIONS_PER_OPVALUE) {
1.152     misha    1624:                        const String& base_name=LA2S(*strings_code)->trim(String::TRIM_END);
1.145     misha    1625:                        if(Value* base_class_value=PC.request.get_class(base_name)) {
1.84      paf      1626:                                // @CLASS == @BASE sanity check
                   1627:                                if(VStateless_class *base_class=base_class_value->get_class()) {
                   1628:                                        if(PC.cclass==base_class) {
1.160     moko     1629:                                                strcpy(PC.error, "@" CLASS_NAME " equals @" BASE_NAME);
1.84      paf      1630:                                                YYERROR;
                   1631:                                        }
                   1632:                                        PC.cclass->get_class()->set_base(base_class);
                   1633:                                } else { // they asked to derive from a class without methods ['env' & co]
                   1634:                                        strcpy(PC.error, base_name.cstr());
1.160     moko     1635:                                        strcat(PC.error, ": you can not derive from this class in @" BASE_NAME);
1.84      paf      1636:                                        YYERROR;
                   1637:                                }
                   1638:                        } else {
1.1       parser   1639:                                strcpy(PC.error, base_name.cstr());
1.160     moko     1640:                                strcat(PC.error, ": undefined class in @" BASE_NAME);
1.1       parser   1641:                                YYERROR;
                   1642:                        }
                   1643:                } else {
1.160     moko     1644:                        strcpy(PC.error, "@" BASE_NAME " must contain sole name");
1.1       parser   1645:                        YYERROR;
                   1646:                }
1.116     misha    1647:        } else if(command==OPTIONS_CONTROL_METHOD_NAME) {
1.118     misha    1648:                for(size_t i=0; i<strings_code->count(); i+=OPERATIONS_PER_OPVALUE) {
1.152     misha    1649:                        const String& option=LA2S(*strings_code, i)->trim(String::TRIM_END);
1.170   ! moko     1650:                        if(option==Symbols::LOCALS_SYMBOL){
1.119     misha    1651:                                PC.set_all_vars_local();
1.170   ! moko     1652:                        } else if(option==Symbols::PARTIAL_SYMBOL){
1.123     misha    1653:                                if(PC.cclass_new){
                   1654:                                        if(VStateless_class* existed=PC.get_existed_class(PC.cclass_new)){
                   1655:                                                if(!PC.reuse_existed_class(existed)){
                   1656:                                                        strcpy(PC.error, "can't append methods to '");
1.167     moko     1657:                                                        strncat(PC.error, PC.cclass_new->type(), MAX_STRING/2);
1.123     misha    1658:                                                        strcat(PC.error, "' - the class wasn't marked as partial");
                   1659:                                                        YYERROR;
                   1660:                                                }
1.119     misha    1661:                                        } else {
1.149     misha    1662:                                                // marks the new class as partial. we will be able to add methods here later.
1.123     misha    1663:                                                PC.cclass_new->set_partial();
1.119     misha    1664:                                        }
1.123     misha    1665:                                } else {
1.170   ! moko     1666:                                        strcpy(PC.error, "'partial' option should be used straight after @" CLASS_NAME);
1.119     misha    1667:                                        YYERROR;
                   1668:                                }
1.170   ! moko     1669:                        } else if(option==Symbols::STATIC_SYMBOL){
1.149     misha    1670:                                PC.set_methods_call_type(Method::CT_STATIC);
1.170   ! moko     1671:                        } else if(option==Symbols::DYNAMIC_SYMBOL){
1.149     misha    1672:                                PC.set_methods_call_type(Method::CT_DYNAMIC);
1.118     misha    1673:                        } else {
1.119     misha    1674:                                strcpy(PC.error, "'");
                   1675:                                strncat(PC.error, option.cstr(), MAX_STRING/2);
1.170   ! moko     1676:                                strcat(PC.error, "' invalid option. valid options are 'partial', 'locals', 'static' and 'dynamic'");
1.118     misha    1677:                                YYERROR;
1.116     misha    1678:                        }
                   1679:                }
1.1       parser   1680:        } else {
                   1681:                strcpy(PC.error, "'");
                   1682:                strncat(PC.error, command.cstr(), MAX_STRING/2);
                   1683:                strcat(PC.error, "' invalid special name. valid names are "
1.160     moko     1684:                        "'" CLASS_NAME "', '" USE_CONTROL_METHOD_NAME "', '" BASE_NAME "' and '" OPTIONS_CONTROL_METHOD_NAME "'.");
1.1       parser   1685:                YYERROR;
                   1686:        }
1.158     misha    1687: }
1.170   ! moko     1688: #line 1689 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1689:     break;
                   1690: 
                   1691:   case 13:
1.170   ! moko     1692: #line 263 "compile.y" /* yacc.c:1646  */
1.163     moko     1693:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.170   ! moko     1694: #line 1695 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1695:     break;
                   1696: 
                   1697:   case 17:
1.170   ! moko     1698: #line 267 "compile.y" /* yacc.c:1646  */
1.112     paf      1699:     { 
1.157     moko     1700:        CLASS_ADD;
1.96      paf      1701:        PC.explicit_result=false;
1.1       parser   1702: 
1.163     moko     1703:        YYSTYPE params_names_code=(yyvsp[-3]);
1.84      paf      1704:        ArrayString* params_names=0;
                   1705:        if(int size=params_names_code->count()) {
                   1706:                params_names=new ArrayString;
                   1707:                for(int i=0; i<size; i+=OPERATIONS_PER_OPVALUE)
                   1708:                        *params_names+=LA2S(*params_names_code, i);
1.1       parser   1709:        }
                   1710: 
1.163     moko     1711:        YYSTYPE locals_names_code=(yyvsp[-2]);
1.84      paf      1712:        ArrayString* locals_names=0;
1.116     misha    1713:        bool all_vars_local=false;
1.84      paf      1714:        if(int size=locals_names_code->count()) {
                   1715:                locals_names=new ArrayString;
1.96      paf      1716:                for(int i=0; i<size; i+=OPERATIONS_PER_OPVALUE) {
                   1717:                        const String* local_name=LA2S(*locals_names_code, i);
1.170   ! moko     1718:                        if(SYMBOLS_EQ(*local_name,RESULT_SYMBOL))
1.96      paf      1719:                                PC.explicit_result=true;
1.170   ! moko     1720:                        else if(SYMBOLS_EQ(*local_name,LOCALS_SYMBOL))
1.116     misha    1721:                                all_vars_local=true;
1.96      paf      1722:                        else
                   1723:                                *locals_names+=local_name;
                   1724:                }
1.1       parser   1725:        }
1.124     misha    1726:        if(!all_vars_local && PC.cclass && PC.cclass->is_vars_local())
1.116     misha    1727:                all_vars_local=true;
1.1       parser   1728: 
1.96      paf      1729:        Method* method=new Method(
1.84      paf      1730:                //name, 
1.163     moko     1731:                GetMethodCallType(PC, *(yyvsp[-4])),
1.1       parser   1732:                0, 0/*min,max numbered_params_count*/, 
                   1733:                params_names, locals_names, 
1.116     misha    1734:                0/*to be filled later in next {} */, 0, all_vars_local);
1.114     misha    1735: 
1.156     moko     1736:        *reinterpret_cast<Method**>(&(yyval))=method;
1.158     misha    1737: }
1.170   ! moko     1738: #line 1739 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1739:     break;
                   1740: 
1.115     misha    1741:   case 18:
1.170   ! moko     1742: #line 305 "compile.y" /* yacc.c:1646  */
1.115     misha    1743:     {
1.163     moko     1744:                Method* method=reinterpret_cast<Method*>((yyvsp[-1]));
1.124     misha    1745:                // fill in the code
1.163     moko     1746:                method->parser_code=(yyvsp[0]);
1.124     misha    1747: 
                   1748:                // register in class
1.163     moko     1749:                const String& name=*LA2S(*(yyvsp[-6]));
1.144     misha    1750:                PC.cclass->set_method(PC.alias_method(name), method);
1.158     misha    1751: }
1.170   ! moko     1752: #line 1753 "compile.tab.C" /* yacc.c:1646  */
1.115     misha    1753:     break;
                   1754: 
                   1755:   case 21:
1.170   ! moko     1756: #line 316 "compile.y" /* yacc.c:1646  */
1.163     moko     1757:     {(yyval)=(yyvsp[-1]);}
1.170   ! moko     1758: #line 1759 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1759:     break;
                   1760: 
1.115     misha    1761:   case 25:
1.170   ! moko     1762: #line 318 "compile.y" /* yacc.c:1646  */
1.163     moko     1763:     { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); }
1.170   ! moko     1764: #line 1765 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1765:     break;
                   1766: 
1.115     misha    1767:   case 31:
1.170   ! moko     1768: #line 326 "compile.y" /* yacc.c:1646  */
1.163     moko     1769:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.170   ! moko     1770: #line 1771 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1771:     break;
                   1772: 
1.115     misha    1773:   case 37:
1.170   ! moko     1774: #line 332 "compile.y" /* yacc.c:1646  */
1.112     paf      1775:     {
1.156     moko     1776:        (yyval)=N();
1.163     moko     1777:        YYSTYPE code=(yyvsp[0]);
1.140     misha    1778:        size_t count=code->count();
1.138     misha    1779: 
1.128     misha    1780: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
1.140     misha    1781:        if(
                   1782:                count!=3
1.159     misha    1783:                || !change_first(*code, OP::OP_VALUE__GET_ELEMENT, /*=>*/OP::OP_VALUE__GET_ELEMENT__WRITE)
1.140     misha    1784:        )
1.131     misha    1785: #endif
1.140     misha    1786: 
1.138     misha    1787: #ifdef OPTIMIZE_BYTECODE_GET_SELF_ELEMENT
1.140     misha    1788:        if(
                   1789:                count!=3
1.159     misha    1790:                || !change_first(*code, OP::OP_WITH_SELF__VALUE__GET_ELEMENT, /*=>*/OP::OP_WITH_SELF__VALUE__GET_ELEMENT__WRITE)
1.140     misha    1791:        )
1.138     misha    1792: #endif
                   1793: 
1.132     misha    1794: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_ELEMENT
1.140     misha    1795:        if(
                   1796:                count!=5
1.159     misha    1797:                || !change_first(*code, OP::OP_GET_OBJECT_ELEMENT, /*=>*/OP::OP_GET_OBJECT_ELEMENT__WRITE)
1.140     misha    1798:        )
1.128     misha    1799: #endif
1.132     misha    1800: 
                   1801: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_VAR_ELEMENT
1.140     misha    1802:        if(
                   1803:                count!=5
1.159     misha    1804:                || !change_first(*code, OP::OP_GET_OBJECT_VAR_ELEMENT, /*=>*/OP::OP_GET_OBJECT_VAR_ELEMENT__WRITE)
1.140     misha    1805:        )
1.131     misha    1806: #endif
1.159     misha    1807: 
                   1808: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
                   1809:        if(
                   1810:                !change(*code, count-1/* last */, OP::OP_GET_ELEMENT__SPECIAL, /*=>*/OP::OP_GET_ELEMENT__SPECIAL__WRITE)
                   1811:        )
                   1812: #endif
                   1813: 
1.140     misha    1814:        {
1.159     misha    1815:                change_or_append(*code, count-1 /* last */,
                   1816:                        OP::OP_GET_ELEMENT, /*=>*/OP::OP_GET_ELEMENT__WRITE,
1.140     misha    1817:                        /*or */OP::OP_WRITE_VALUE
                   1818:                        ); /* value=pop; wcontext.write(value) */
1.139     misha    1819:        }
1.140     misha    1820: 
1.156     moko     1821:        P(*(yyval), *code);
1.158     misha    1822: }
1.170   ! moko     1823: #line 1824 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1824:     break;
                   1825: 
1.115     misha    1826:   case 38:
1.170   ! moko     1827: #line 380 "compile.y" /* yacc.c:1646  */
1.163     moko     1828:     { (yyval)=(yyvsp[0]); }
1.170   ! moko     1829: #line 1830 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1830:     break;
                   1831: 
1.115     misha    1832:   case 41:
1.170   ! moko     1833: #line 382 "compile.y" /* yacc.c:1646  */
1.163     moko     1834:     { (yyval)=(yyvsp[-1]); }
1.170   ! moko     1835: #line 1836 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1836:     break;
                   1837: 
1.115     misha    1838:   case 44:
1.170   ! moko     1839: #line 386 "compile.y" /* yacc.c:1646  */
1.112     paf      1840:     {
1.156     moko     1841:        (yyval)=N(); 
1.163     moko     1842:        YYSTYPE diving_code=(yyvsp[0]);
1.132     misha    1843:        size_t count=diving_code->count();
1.140     misha    1844: 
1.156     moko     1845:        if(maybe_make_self(*(yyval), *diving_code, count)) {
1.140     misha    1846:                // $self.
                   1847:        } else
1.132     misha    1848: 
                   1849: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_ELEMENT
1.156     moko     1850:        if(maybe_make_get_object_element(*(yyval), *diving_code, count)){
1.138     misha    1851:                // optimization for $object.field + ^object.method[
1.140     misha    1852:        } else
1.131     misha    1853: #endif
1.132     misha    1854: 
                   1855: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_VAR_ELEMENT
1.156     moko     1856:        if(maybe_make_get_object_var_element(*(yyval), *diving_code, count)){
1.138     misha    1857:                // optimization for $object.$var
1.140     misha    1858:        } else
1.131     misha    1859: #endif
1.132     misha    1860: 
                   1861: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
1.141     misha    1862:        if(
                   1863:                count>=4
                   1864:                && (*diving_code)[0].code==OP::OP_VALUE
                   1865:                && (*diving_code)[3].code==OP::OP_GET_ELEMENT
                   1866:        ){
                   1867:                 // optimization
1.156     moko     1868:                O(*(yyval),
1.140     misha    1869:                        (PC.in_call_value && count==4)
1.132     misha    1870:                        ? OP::OP_VALUE__GET_ELEMENT_OR_OPERATOR // ^object[ : OP_VALUE+origin+string+OP_GET_ELEMENT => OP_VALUE__GET_ELEMENT_OR_OPERATOR+origin+string
                   1871:                        : OP::OP_VALUE__GET_ELEMENT             // $object  : OP_VALUE+origin+string+OP_GET_ELEMENT => OP_VALUE__GET_ELEMENT+origin+string
                   1872:                );
1.156     moko     1873:                P(*(yyval), *diving_code, 1/*offset*/, 2/*limit*/); // copy origin+value
1.140     misha    1874:                if(count>4)
1.156     moko     1875:                        P(*(yyval), *diving_code, 4); // copy tail
1.132     misha    1876:        } else {
1.156     moko     1877:                O(*(yyval), OP::OP_WITH_READ); /* stack: starting context */
                   1878:                P(*(yyval), *diving_code);
1.132     misha    1879:        }
1.126     misha    1880: #else
1.140     misha    1881:        {
1.156     moko     1882:                O(*(yyval), OP::OP_WITH_READ); /* stack: starting context */
1.37      paf      1883: 
1.131     misha    1884:                // ^if OP_ELEMENT => ^if OP_ELEMENT_OR_OPERATOR
                   1885:                // optimized OP_VALUE+origin+string+OP_GET_ELEMENT. => OP_VALUE+origin+string+OP_GET_ELEMENT_OR_OPERATOR.
1.132     misha    1886:                if(PC.in_call_value && count==4)
                   1887:                        diving_code->put(count-1, OP::OP_GET_ELEMENT_OR_OPERATOR);
1.156     moko     1888:                P(*(yyval), *diving_code);
1.132     misha    1889:        }
1.126     misha    1890: #endif
1.1       parser   1891:        /* diving code; stack: current context */
1.158     misha    1892: }
1.170   ! moko     1893: #line 1894 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1894:     break;
                   1895: 
1.115     misha    1896:   case 45:
1.170   ! moko     1897: #line 439 "compile.y" /* yacc.c:1646  */
1.163     moko     1898:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.170   ! moko     1899: #line 1900 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1900:     break;
                   1901: 
1.115     misha    1902:   case 47:
1.170   ! moko     1903: #line 440 "compile.y" /* yacc.c:1646  */
1.163     moko     1904:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.170   ! moko     1905: #line 1906 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1906:     break;
                   1907: 
1.115     misha    1908:   case 48:
1.170   ! moko     1909: #line 444 "compile.y" /* yacc.c:1646  */
1.112     paf      1910:     {
1.156     moko     1911:        (yyval)=N();
1.137     misha    1912: #ifdef OPTIMIZE_BYTECODE_CONSTRUCT
1.163     moko     1913:        if(maybe_optimize_construct(*(yyval), *(yyvsp[-1]), *(yyvsp[0]))){
1.139     misha    1914:                // $a(expr), $.a(expr), $a[value], $.a[value], $self.a[value], $self.a(expr)
1.134     misha    1915:        } else 
                   1916: #endif
                   1917:        {
1.163     moko     1918:                P(*(yyval), *(yyvsp[-1])); /* stack: context,name */
                   1919:                P(*(yyval), *(yyvsp[0])); /* stack: context,name,constructor_value */
1.134     misha    1920:        }
1.158     misha    1921: }
1.170   ! moko     1922: #line 1923 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1923:     break;
                   1924: 
1.115     misha    1925:   case 52:
1.170   ! moko     1926: #line 460 "compile.y" /* yacc.c:1646  */
1.112     paf      1927:     {
1.156     moko     1928:        (yyval)=N();
1.163     moko     1929:        YYSTYPE diving_code=(yyvsp[0]);
1.140     misha    1930:        size_t count=diving_code->count();
                   1931: 
1.156     moko     1932:        if(maybe_make_self(*(yyval), *diving_code, count)) {
1.140     misha    1933:                // $self.
                   1934:        } else
                   1935: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
                   1936:        if(
                   1937:                count>=4
                   1938:                && (*diving_code)[0].code==OP::OP_VALUE
                   1939:                && (*diving_code)[3].code==OP::OP_GET_ELEMENT
                   1940:        ){
1.156     moko     1941:                O(*(yyval), OP::OP_WITH_ROOT__VALUE__GET_ELEMENT);
                   1942:                P(*(yyval), *diving_code, 1/*offset*/, 2/*limit*/); // copy origin+value
1.140     misha    1943:                if(count>4)
1.156     moko     1944:                        P(*(yyval), *diving_code, 4); // tail
1.140     misha    1945:        } else
                   1946: #endif
                   1947:        {
1.156     moko     1948:                O(*(yyval), OP::OP_WITH_ROOT); /* stack: starting context */
                   1949:                P(*(yyval), *diving_code);
1.1       parser   1950:        }
                   1951:        /* diving code; stack: current context */
1.158     misha    1952: }
1.170   ! moko     1953: #line 1954 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1954:     break;
                   1955: 
1.115     misha    1956:   case 53:
1.170   ! moko     1957: #line 486 "compile.y" /* yacc.c:1646  */
1.112     paf      1958:     {
1.156     moko     1959:        (yyval)=N(); 
                   1960:        O(*(yyval), OP::OP_WITH_WRITE); /* stack: starting context */
1.163     moko     1961:        P(*(yyval), *(yyvsp[0])); /* diving code; stack: context,name */
1.158     misha    1962: }
1.170   ! moko     1963: #line 1964 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1964:     break;
                   1965: 
1.115     misha    1966:   case 54:
1.170   ! moko     1967: #line 491 "compile.y" /* yacc.c:1646  */
1.163     moko     1968:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.170   ! moko     1969: #line 1970 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1970:     break;
                   1971: 
1.115     misha    1972:   case 58:
1.170   ! moko     1973: #line 498 "compile.y" /* yacc.c:1646  */
1.112     paf      1974:     {
1.100     paf      1975:        // allow $result_or_other_variable[ letters here any time ]
1.156     moko     1976:        *reinterpret_cast<bool*>(&(yyval))=PC.explicit_result; PC.explicit_result=false;
1.158     misha    1977: }
1.170   ! moko     1978: #line 1979 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1979:     break;
                   1980: 
1.115     misha    1981:   case 59:
1.170   ! moko     1982: #line 501 "compile.y" /* yacc.c:1646  */
1.112     paf      1983:     {
1.163     moko     1984:        PC.explicit_result=*reinterpret_cast<bool*>(&(yyvsp[-1]));
1.158     misha    1985: }
1.170   ! moko     1986: #line 1987 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1987:     break;
                   1988: 
1.115     misha    1989:   case 60:
1.170   ! moko     1990: #line 503 "compile.y" /* yacc.c:1646  */
1.112     paf      1991:     {
1.1       parser   1992:        // stack: context, name
1.163     moko     1993:        (yyval)=(yyvsp[-2]); // stack: context, name, value
1.156     moko     1994:        O(*(yyval), OP::OP_CONSTRUCT_VALUE); /* value=pop; name=pop; context=pop; construct(context,name,value) */
1.158     misha    1995: }
1.170   ! moko     1996: #line 1997 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1997:     break;
                   1998: 
1.115     misha    1999:   case 61:
1.170   ! moko     2000: #line 509 "compile.y" /* yacc.c:1646  */
1.112     paf      2001:     { 
1.156     moko     2002:        (yyval)=N(); 
                   2003:        O(*(yyval), OP::OP_PREPARE_TO_EXPRESSION);
1.1       parser   2004:        // stack: context, name
1.163     moko     2005:        P(*(yyval), *(yyvsp[-1])); // stack: context, name, value
1.156     moko     2006:        O(*(yyval), OP::OP_CONSTRUCT_EXPR); /* value=pop->as_expr_result; name=pop; context=pop; construct(context,name,value) */
1.158     misha    2007: }
1.170   ! moko     2008: #line 2009 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2009:     break;
                   2010: 
1.115     misha    2011:   case 62:
1.170   ! moko     2012: #line 517 "compile.y" /* yacc.c:1646  */
1.112     paf      2013:     {
1.1       parser   2014:        // stack: context, name
1.156     moko     2015:        (yyval)=N(); 
1.163     moko     2016:        OA(*(yyval), OP::OP_CURLY_CODE__CONSTRUCT, (yyvsp[-1])); /* code=pop; name=pop; context=pop; construct(context,name,junction(code)) */
1.158     misha    2017: }
1.170   ! moko     2018: #line 2019 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2019:     break;
                   2020: 
1.115     misha    2021:   case 66:
1.170   ! moko     2022: #line 528 "compile.y" /* yacc.c:1646  */
1.112     paf      2023:     {
1.156     moko     2024:        (yyval)=N(); 
1.163     moko     2025:        OA(*(yyval), OP::OP_OBJECT_POOL, (yyvsp[0])); /* stack: empty write context */
1.47      paf      2026:        /* some code that writes to that context */
                   2027:        /* context=pop; stack: context.value() */
1.158     misha    2028: }
1.170   ! moko     2029: #line 2030 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2030:     break;
                   2031: 
1.115     misha    2032:   case 69:
1.170   ! moko     2033: #line 535 "compile.y" /* yacc.c:1646  */
1.163     moko     2034:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.170   ! moko     2035: #line 2036 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2036:     break;
                   2037: 
1.115     misha    2038:   case 70:
1.170   ! moko     2039: #line 539 "compile.y" /* yacc.c:1646  */
1.112     paf      2040:     {
1.163     moko     2041:        size_t count=(yyvsp[0])->count();
1.131     misha    2042: #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR
1.159     misha    2043:        if(count)
1.131     misha    2044: #endif
                   2045:        {
1.163     moko     2046:                (yyval)=(yyvsp[0]); /* stack: value */
1.159     misha    2047:                if(!change_first(*(yyval), OP::OP_CONSTRUCT_OBJECT, /*=>*/OP::OP_CONSTRUCT_OBJECT__WRITE))
                   2048:                        change_or_append(*(yyval), count-2 /* second last */,
                   2049:                                OP::OP_CALL, /*=>*/ OP::OP_CALL__WRITE,
1.142     misha    2050:                                /*or */OP::OP_WRITE_VALUE); /* value=pop; wcontext.write(value) */
1.131     misha    2051:        }
1.158     misha    2052: }
1.170   ! moko     2053: #line 2054 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2054:     break;
                   2055: 
1.115     misha    2056:   case 71:
1.170   ! moko     2057: #line 552 "compile.y" /* yacc.c:1646  */
1.112     paf      2058:     { 
1.39      paf      2059:                                        PC.in_call_value=true; 
1.158     misha    2060:                        }
1.170   ! moko     2061: #line 2062 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2062:     break;
                   2063: 
1.115     misha    2064:   case 72:
1.170   ! moko     2065: #line 555 "compile.y" /* yacc.c:1646  */
1.112     paf      2066:     {
1.39      paf      2067:                                PC.in_call_value=false;
1.158     misha    2068:                        }
1.170   ! moko     2069: #line 2070 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2070:     break;
                   2071: 
1.115     misha    2072:   case 73:
1.170   ! moko     2073: #line 558 "compile.y" /* yacc.c:1646  */
1.112     paf      2074:     { /* ^field.$method{vasya} */
1.131     misha    2075: #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR
1.135     misha    2076: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
1.163     moko     2077:        const String* operator_name=LA2S(*(yyvsp[-3]), 0, OP::OP_VALUE__GET_ELEMENT_OR_OPERATOR);
1.135     misha    2078: #else
1.163     moko     2079:        const String* operator_name=LA2S(*(yyvsp[-3]), 1);
1.135     misha    2080: #endif
1.170   ! moko     2081:        if(operator_name && SYMBOLS_EQ(*operator_name,REM_SYMBOL)){
1.156     moko     2082:                (yyval)=N();
1.131     misha    2083:        } else 
                   2084: #endif
                   2085:                {
1.163     moko     2086:                        YYSTYPE params_code=(yyvsp[-1]);
1.131     misha    2087:                        if(params_code->count()==3) { // probably [] case. [OP::OP_VALUE+origin+Void]
                   2088:                                if(Value* value=LA2V(*params_code)) // it is OP_VALUE+origin+value?
1.153     moko     2089:                                        if(const String * string=value->get_string())
                   2090:                                                if(string->is_empty()) // value is empty string?
                   2091:                                                        params_code=0; // ^zzz[] case. don't append lone empty param.
1.131     misha    2092:                        }
                   2093:                        /* stack: context, method_junction */
1.142     misha    2094: 
1.163     moko     2095:                        YYSTYPE var_code=(yyvsp[-3]);
1.142     misha    2096:                        if(
                   2097:                                var_code->count()==8
                   2098:                                && (*var_code)[0].code==OP::OP_VALUE__GET_CLASS
                   2099:                                && (*var_code)[3].code==OP::OP_PREPARE_TO_CONSTRUCT_OBJECT
                   2100:                                && (*var_code)[4].code==OP::OP_VALUE
1.164     moko     2101: #ifdef FEATURE_GET_ELEMENT4CALL
                   2102:                                && (*var_code)[7].code==OP::OP_GET_ELEMENT4CALL
                   2103: #else
1.142     misha    2104:                                && (*var_code)[7].code==OP::OP_GET_ELEMENT
1.164     moko     2105: #endif
1.142     misha    2106:                        ){
1.159     misha    2107:                                (yyval)=N();
1.156     moko     2108:                                O(*(yyval), OP::OP_CONSTRUCT_OBJECT);
                   2109:                                P(*(yyval), *var_code, 1/*offset*/, 2/*limit*/); // class name
                   2110:                                P(*(yyval), *var_code, 5/*offset*/, 2/*limit*/); // constructor name
                   2111:                                OA(*(yyval), params_code);
1.142     misha    2112:                        } else 
                   2113:                                {
1.156     moko     2114:                                        (yyval)=var_code; /* with_xxx,diving code; stack: context,method_junction */
                   2115:                                        OA(*(yyval), OP::OP_CALL, params_code); // method_frame=make frame(pop junction); ncontext=pop; call(ncontext,method_frame) stack: value
1.142     misha    2116:                                }
1.131     misha    2117:                }
1.158     misha    2118: }
1.170   ! moko     2119: #line 2120 "compile.tab.C" /* yacc.c:1646  */
1.164     moko     2120:     break;
                   2121: 
                   2122:   case 74:
1.170   ! moko     2123: #line 604 "compile.y" /* yacc.c:1646  */
1.164     moko     2124:     {
                   2125: #ifdef FEATURE_GET_ELEMENT4CALL
                   2126:        size_t count=(yyvsp[0])->count();
                   2127:        if(count){
                   2128:                (yyval)=(yyvsp[0]);
                   2129: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_ELEMENT
                   2130:                !(count==5 && change_first(*(yyval), OP::OP_GET_OBJECT_ELEMENT, OP::OP_GET_OBJECT_ELEMENT4CALL)) &&
                   2131: #endif
                   2132: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_VAR_ELEMENT
                   2133:                !(count==5 && change_first(*(yyval), OP::OP_GET_OBJECT_VAR_ELEMENT, OP::OP_GET_OBJECT_VAR_ELEMENT4CALL)) &&
                   2134: #endif
                   2135:                !change(*(yyval), count-1, OP::OP_GET_ELEMENT, OP::OP_GET_ELEMENT4CALL);
                   2136:        }
                   2137: #endif
                   2138: }
1.170   ! moko     2139: #line 2140 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2140:     break;
                   2141: 
1.115     misha    2142:   case 76:
1.170   ! moko     2143: #line 620 "compile.y" /* yacc.c:1646  */
1.163     moko     2144:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.170   ! moko     2145: #line 2146 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2146:     break;
                   2147: 
1.115     misha    2148:   case 80:
1.170   ! moko     2149: #line 626 "compile.y" /* yacc.c:1646  */
1.112     paf      2150:     {
1.100     paf      2151:        // allow ^call[ letters here any time ]
1.156     moko     2152:        *reinterpret_cast<bool*>(&(yyval))=PC.explicit_result; PC.explicit_result=false;
1.158     misha    2153: }
1.170   ! moko     2154: #line 2155 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2155:     break;
                   2156: 
1.115     misha    2157:   case 81:
1.170   ! moko     2158: #line 629 "compile.y" /* yacc.c:1646  */
1.112     paf      2159:     {
1.163     moko     2160:        PC.explicit_result=*reinterpret_cast<bool*>(&(yyvsp[-1]));
1.158     misha    2161: }
1.170   ! moko     2162: #line 2163 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2163:     break;
                   2164: 
1.115     misha    2165:   case 82:
1.170   ! moko     2166: #line 631 "compile.y" /* yacc.c:1646  */
1.163     moko     2167:     {(yyval)=(yyvsp[-2]);}
1.170   ! moko     2168: #line 2169 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2169:     break;
                   2170: 
1.115     misha    2171:   case 83:
1.170   ! moko     2172: #line 632 "compile.y" /* yacc.c:1646  */
1.163     moko     2173:     {(yyval)=(yyvsp[-1]);}
1.170   ! moko     2174: #line 2175 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2175:     break;
                   2176: 
1.115     misha    2177:   case 84:
1.170   ! moko     2178: #line 633 "compile.y" /* yacc.c:1646  */
1.163     moko     2179:     {(yyval)=(yyvsp[-1]);}
1.170   ! moko     2180: #line 2181 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2181:     break;
                   2182: 
1.115     misha    2183:   case 86:
1.170   ! moko     2184: #line 636 "compile.y" /* yacc.c:1646  */
1.163     moko     2185:     { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); }
1.170   ! moko     2186: #line 2187 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2187:     break;
                   2188: 
1.115     misha    2189:   case 88:
1.170   ! moko     2190: #line 640 "compile.y" /* yacc.c:1646  */
1.163     moko     2191:     { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); }
1.170   ! moko     2192: #line 2193 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2193:     break;
                   2194: 
1.115     misha    2195:   case 90:
1.170   ! moko     2196: #line 644 "compile.y" /* yacc.c:1646  */
1.163     moko     2197:     { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); }
1.170   ! moko     2198: #line 2199 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2199:     break;
                   2200: 
1.115     misha    2201:   case 91:
1.170   ! moko     2202: #line 646 "compile.y" /* yacc.c:1646  */
1.112     paf      2203:     {
1.163     moko     2204:        (yyval)=(yyvsp[0]);
1.158     misha    2205: }
1.170   ! moko     2206: #line 2207 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2207:     break;
                   2208: 
1.115     misha    2209:   case 92:
1.170   ! moko     2210: #line 649 "compile.y" /* yacc.c:1646  */
1.112     paf      2211:     {
1.163     moko     2212:        YYSTYPE expr_code=(yyvsp[0]);
1.106     paf      2213:        if(expr_code->count()==3
1.127     misha    2214:                && (*expr_code)[0].code==OP::OP_VALUE) { // optimizing (double/bool/incidently 'string' too) case. [OP::OP_VALUE+origin+Double]. no evaluating
1.156     moko     2215:                (yyval)=expr_code; 
1.104     paf      2216:        } else {
1.131     misha    2217:                YYSTYPE code=N();
1.122     misha    2218:                O(*code, OP::OP_PREPARE_TO_EXPRESSION);
1.104     paf      2219:                P(*code, *expr_code);
1.122     misha    2220:                O(*code, OP::OP_WRITE_EXPR_RESULT);
1.156     moko     2221:                (yyval)=N(); 
                   2222:                OA(*(yyval), OP::OP_EXPR_CODE__STORE_PARAM, code);
1.104     paf      2223:        }
1.158     misha    2224: }
1.170   ! moko     2225: #line 2226 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2226:     break;
                   2227: 
1.115     misha    2228:   case 93:
1.170   ! moko     2229: #line 663 "compile.y" /* yacc.c:1646  */
1.112     paf      2230:     {
1.156     moko     2231:        (yyval)=N(); 
1.163     moko     2232:        OA(*(yyval), OP::OP_CURLY_CODE__STORE_PARAM, (yyvsp[0]));
1.158     misha    2233: }
1.170   ! moko     2234: #line 2235 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2235:     break;
                   2236: 
1.115     misha    2237:   case 98:
1.170   ! moko     2238: #line 675 "compile.y" /* yacc.c:1646  */
1.163     moko     2239:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.170   ! moko     2240: #line 2241 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2241:     break;
                   2242: 
1.115     misha    2243:   case 100:
1.170   ! moko     2244: #line 677 "compile.y" /* yacc.c:1646  */
1.163     moko     2245:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.170   ! moko     2246: #line 2247 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2247:     break;
                   2248: 
1.115     misha    2249:   case 102:
1.170   ! moko     2250: #line 679 "compile.y" /* yacc.c:1646  */
1.112     paf      2251:     {
1.33      paf      2252:        // we know that name_advance1 not called from ^xxx context
                   2253:        // so we'll not check for operator call possibility as we do in name_advance2
                   2254: 
1.1       parser   2255:        /* stack: context */
1.163     moko     2256:        (yyval)=(yyvsp[0]); /* stack: context,name */
1.159     misha    2257: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
                   2258:        O(*(yyval), is_special_element(*(yyval)) ? OP::OP_GET_ELEMENT__SPECIAL : OP::OP_GET_ELEMENT);
                   2259: #else
1.156     moko     2260:        O(*(yyval), OP::OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.159     misha    2261: #endif
1.158     misha    2262: }
1.170   ! moko     2263: #line 2264 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2264:     break;
                   2265: 
1.115     misha    2266:   case 103:
1.170   ! moko     2267: #line 691 "compile.y" /* yacc.c:1646  */
1.112     paf      2268:     {
1.1       parser   2269:        /* stack: context */
1.163     moko     2270:        (yyval)=(yyvsp[0]); /* stack: context,name */
1.159     misha    2271: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
                   2272:        O(*(yyval), is_special_element(*(yyval)) ? OP::OP_GET_ELEMENT__SPECIAL : OP::OP_GET_ELEMENT);
                   2273: #else
1.156     moko     2274:        O(*(yyval), OP::OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.159     misha    2275: #endif
1.158     misha    2276: }
1.170   ! moko     2277: #line 2278 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2278:     break;
                   2279: 
1.115     misha    2280:   case 109:
1.170   ! moko     2281: #line 708 "compile.y" /* yacc.c:1646  */
1.112     paf      2282:     {
1.163     moko     2283:        (yyval)=(yyvsp[0]);
1.156     moko     2284:        O(*(yyval), OP::OP_GET_ELEMENT);
1.158     misha    2285: }
1.170   ! moko     2286: #line 2287 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2287:     break;
                   2288: 
1.115     misha    2289:   case 110:
1.170   ! moko     2290: #line 712 "compile.y" /* yacc.c:1646  */
1.112     paf      2291:     {
1.131     misha    2292:        YYSTYPE code;
1.47      paf      2293:        {
1.163     moko     2294:                change_string_literal_to_write_string_literal(*(code=(yyvsp[-1])));
                   2295:                P(*code, *(yyvsp[0]));
1.47      paf      2296:        }
1.156     moko     2297:        (yyval)=N(); 
                   2298:        OA(*(yyval), OP::OP_STRING_POOL, code);
1.158     misha    2299: }
1.170   ! moko     2300: #line 2301 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2301:     break;
                   2302: 
1.115     misha    2303:   case 111:
1.170   ! moko     2304: #line 721 "compile.y" /* yacc.c:1646  */
1.112     paf      2305:     {
1.100     paf      2306:        // allow $result_or_other_variable[ letters here any time ]
1.156     moko     2307:        *reinterpret_cast<bool*>(&(yyval))=PC.explicit_result; PC.explicit_result=false;
1.158     misha    2308: }
1.170   ! moko     2309: #line 2310 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2310:     break;
                   2311: 
1.115     misha    2312:   case 112:
1.170   ! moko     2313: #line 724 "compile.y" /* yacc.c:1646  */
1.112     paf      2314:     {
1.163     moko     2315:        PC.explicit_result=*reinterpret_cast<bool*>(&(yyvsp[-1]));
1.158     misha    2316: }
1.170   ! moko     2317: #line 2318 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2318:     break;
                   2319: 
1.115     misha    2320:   case 113:
1.170   ! moko     2321: #line 726 "compile.y" /* yacc.c:1646  */
1.112     paf      2322:     {
1.156     moko     2323:        (yyval)=N(); 
1.159     misha    2324: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
1.163     moko     2325:        if(!maybe_append_simple_diving_code(*(yyval), *(yyvsp[-2])))
1.159     misha    2326: #endif
                   2327:        {
1.163     moko     2328:        OA(*(yyval), OP::OP_OBJECT_POOL, (yyvsp[-2])); /* stack: empty write context */
1.47      paf      2329:        /* some code that writes to that context */
                   2330:        /* context=pop; stack: context.value() */
1.159     misha    2331:        }
1.158     misha    2332: }
1.170   ! moko     2333: #line 2334 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2334:     break;
                   2335: 
1.115     misha    2336:   case 114:
1.170   ! moko     2337: #line 737 "compile.y" /* yacc.c:1646  */
1.112     paf      2338:     {
1.156     moko     2339:        (yyval)=N(); 
                   2340:        O(*(yyval), OP::OP_WITH_READ);
1.163     moko     2341:        P(*(yyval), *(yyvsp[0]));
1.158     misha    2342: }
1.170   ! moko     2343: #line 2344 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2344:     break;
                   2345: 
1.115     misha    2346:   case 116:
1.170   ! moko     2347: #line 742 "compile.y" /* yacc.c:1646  */
1.163     moko     2348:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.170   ! moko     2349: #line 2350 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2350:     break;
                   2351: 
1.115     misha    2352:   case 117:
1.170   ! moko     2353: #line 743 "compile.y" /* yacc.c:1646  */
1.112     paf      2354:     {
1.163     moko     2355:        (yyval)=(yyvsp[0]);
1.156     moko     2356:        O(*(yyval), OP::OP_GET_ELEMENT__WRITE);
1.158     misha    2357: }
1.170   ! moko     2358: #line 2359 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2359:     break;
                   2360: 
1.115     misha    2361:   case 120:
1.170   ! moko     2362: #line 752 "compile.y" /* yacc.c:1646  */
1.112     paf      2363:     {
1.163     moko     2364:        (yyval)=(yyvsp[-1]); // stack: class name string
1.156     moko     2365:        if(*LA2S(*(yyval)) == BASE_NAME) { // pseudo BASE class
1.84      paf      2366:                if(VStateless_class* base=PC.cclass->base_class()) {
1.167     moko     2367:                        change_string_literal_value(*(yyval), *new String(base->type()));
1.61      paf      2368:                } else {
                   2369:                        strcpy(PC.error, "no base class declared");
                   2370:                        YYERROR;
                   2371:                }
                   2372:        }
1.131     misha    2373:        // optimized OP_VALUE+origin+string+OP_GET_CLASS => OP_VALUE__GET_CLASS+origin+string
1.159     misha    2374:        change_first(*(yyval), OP::OP_VALUE, OP::OP_VALUE__GET_CLASS);
1.158     misha    2375: }
1.170   ! moko     2376: #line 2377 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2377:     break;
                   2378: 
1.115     misha    2379:   case 121:
1.170   ! moko     2380: #line 765 "compile.y" /* yacc.c:1646  */
1.112     paf      2381:     {
1.163     moko     2382:        (yyval)=(yyvsp[-1]);
1.39      paf      2383:        if(!PC.in_call_value) {
1.1       parser   2384:                strcpy(PC.error, ":: not allowed here");
                   2385:                YYERROR;
                   2386:        }
1.156     moko     2387:        O(*(yyval), OP::OP_PREPARE_TO_CONSTRUCT_OBJECT);
1.158     misha    2388: }
1.170   ! moko     2389: #line 2390 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2390:     break;
                   2391: 
1.115     misha    2392:   case 128:
1.170   ! moko     2393: #line 784 "compile.y" /* yacc.c:1646  */
1.163     moko     2394:     { (yyval) = (yyvsp[-1]); }
1.170   ! moko     2395: #line 2396 "compile.tab.C" /* yacc.c:1646  */
1.114     misha    2396:     break;
                   2397: 
1.115     misha    2398:   case 129:
1.170   ! moko     2399: #line 785 "compile.y" /* yacc.c:1646  */
1.163     moko     2400:     { (yyval) = (yyvsp[-1]); }
1.170   ! moko     2401: #line 2402 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2402:     break;
                   2403: 
1.115     misha    2404:   case 130:
1.170   ! moko     2405: #line 786 "compile.y" /* yacc.c:1646  */
1.163     moko     2406:     { (yyval) = (yyvsp[-1]); }
1.170   ! moko     2407: #line 2408 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2408:     break;
                   2409: 
1.115     misha    2410:   case 131:
1.170   ! moko     2411: #line 788 "compile.y" /* yacc.c:1646  */
1.163     moko     2412:     { (yyval)=(yyvsp[0]);  O(*(yyval), OP::OP_NEG); }
1.170   ! moko     2413: #line 2414 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2414:     break;
                   2415: 
1.115     misha    2416:   case 132:
1.170   ! moko     2417: #line 789 "compile.y" /* yacc.c:1646  */
1.163     moko     2418:     { (yyval)=(yyvsp[0]); }
1.170   ! moko     2419: #line 2420 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2420:     break;
                   2421: 
1.115     misha    2422:   case 133:
1.170   ! moko     2423: #line 790 "compile.y" /* yacc.c:1646  */
1.163     moko     2424:     { (yyval)=(yyvsp[0]);       O(*(yyval), OP::OP_INV); }
1.170   ! moko     2425: #line 2426 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2426:     break;
                   2427: 
1.115     misha    2428:   case 134:
1.170   ! moko     2429: #line 791 "compile.y" /* yacc.c:1646  */
1.163     moko     2430:     { (yyval)=(yyvsp[0]);  O(*(yyval), OP::OP_NOT); }
1.170   ! moko     2431: #line 2432 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2432:     break;
                   2433: 
1.115     misha    2434:   case 135:
1.170   ! moko     2435: #line 792 "compile.y" /* yacc.c:1646  */
1.163     moko     2436:     { (yyval)=(yyvsp[0]);  O(*(yyval), OP::OP_DEF); }
1.170   ! moko     2437: #line 2438 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2438:     break;
                   2439: 
1.115     misha    2440:   case 136:
1.170   ! moko     2441: #line 793 "compile.y" /* yacc.c:1646  */
1.163     moko     2442:     { (yyval)=(yyvsp[0]);  O(*(yyval), OP::OP_IN); }
1.170   ! moko     2443: #line 2444 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2444:     break;
                   2445: 
1.115     misha    2446:   case 137:
1.170   ! moko     2447: #line 794 "compile.y" /* yacc.c:1646  */
1.163     moko     2448:     { (yyval)=(yyvsp[0]);  O(*(yyval), OP::OP_FEXISTS); }
1.170   ! moko     2449: #line 2450 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2450:     break;
                   2451: 
1.115     misha    2452:   case 138:
1.170   ! moko     2453: #line 795 "compile.y" /* yacc.c:1646  */
1.163     moko     2454:     { (yyval)=(yyvsp[0]);  O(*(yyval), OP::OP_DEXISTS); }
1.170   ! moko     2455: #line 2456 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2456:     break;
                   2457: 
1.115     misha    2458:   case 139:
1.170   ! moko     2459: #line 797 "compile.y" /* yacc.c:1646  */
1.163     moko     2460:     {  (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_SUB); }
1.170   ! moko     2461: #line 2462 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2462:     break;
                   2463: 
1.115     misha    2464:   case 140:
1.170   ! moko     2465: #line 798 "compile.y" /* yacc.c:1646  */
1.163     moko     2466:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_ADD); }
1.170   ! moko     2467: #line 2468 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2468:     break;
                   2469: 
1.115     misha    2470:   case 141:
1.170   ! moko     2471: #line 799 "compile.y" /* yacc.c:1646  */
1.163     moko     2472:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_MUL); }
1.170   ! moko     2473: #line 2474 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2474:     break;
                   2475: 
1.115     misha    2476:   case 142:
1.170   ! moko     2477: #line 800 "compile.y" /* yacc.c:1646  */
1.163     moko     2478:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_DIV); }
1.170   ! moko     2479: #line 2480 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2480:     break;
                   2481: 
1.115     misha    2482:   case 143:
1.170   ! moko     2483: #line 801 "compile.y" /* yacc.c:1646  */
1.163     moko     2484:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_MOD); }
1.170   ! moko     2485: #line 2486 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2486:     break;
                   2487: 
1.115     misha    2488:   case 144:
1.170   ! moko     2489: #line 802 "compile.y" /* yacc.c:1646  */
1.163     moko     2490:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_INTDIV); }
1.170   ! moko     2491: #line 2492 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2492:     break;
                   2493: 
1.115     misha    2494:   case 145:
1.170   ! moko     2495: #line 803 "compile.y" /* yacc.c:1646  */
1.163     moko     2496:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_BIN_SL); }
1.170   ! moko     2497: #line 2498 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2498:     break;
                   2499: 
1.115     misha    2500:   case 146:
1.170   ! moko     2501: #line 804 "compile.y" /* yacc.c:1646  */
1.163     moko     2502:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_BIN_SR); }
1.170   ! moko     2503: #line 2504 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2504:     break;
                   2505: 
1.115     misha    2506:   case 147:
1.170   ! moko     2507: #line 805 "compile.y" /* yacc.c:1646  */
1.163     moko     2508:     { (yyval)=(yyvsp[-2]);     P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_BIN_AND); }
1.170   ! moko     2509: #line 2510 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2510:     break;
                   2511: 
1.115     misha    2512:   case 148:
1.170   ! moko     2513: #line 806 "compile.y" /* yacc.c:1646  */
1.163     moko     2514:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_BIN_OR); }
1.170   ! moko     2515: #line 2516 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2516:     break;
                   2517: 
1.115     misha    2518:   case 149:
1.170   ! moko     2519: #line 807 "compile.y" /* yacc.c:1646  */
1.163     moko     2520:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_BIN_XOR); }
1.170   ! moko     2521: #line 2522 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2522:     break;
                   2523: 
1.115     misha    2524:   case 150:
1.170   ! moko     2525: #line 808 "compile.y" /* yacc.c:1646  */
1.163     moko     2526:     { (yyval)=(yyvsp[-2]);  OA(*(yyval), OP::OP_NESTED_CODE, (yyvsp[0]));  O(*(yyval), OP::OP_LOG_AND); }
1.170   ! moko     2527: #line 2528 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2528:     break;
                   2529: 
1.115     misha    2530:   case 151:
1.170   ! moko     2531: #line 809 "compile.y" /* yacc.c:1646  */
1.163     moko     2532:     { (yyval)=(yyvsp[-2]);  OA(*(yyval), OP::OP_NESTED_CODE, (yyvsp[0]));  O(*(yyval), OP::OP_LOG_OR); }
1.170   ! moko     2533: #line 2534 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2534:     break;
                   2535: 
1.115     misha    2536:   case 152:
1.170   ! moko     2537: #line 810 "compile.y" /* yacc.c:1646  */
1.163     moko     2538:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_LOG_XOR); }
1.170   ! moko     2539: #line 2540 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2540:     break;
                   2541: 
1.115     misha    2542:   case 153:
1.170   ! moko     2543: #line 811 "compile.y" /* yacc.c:1646  */
1.163     moko     2544:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_NUM_LT); }
1.170   ! moko     2545: #line 2546 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2546:     break;
                   2547: 
1.115     misha    2548:   case 154:
1.170   ! moko     2549: #line 812 "compile.y" /* yacc.c:1646  */
1.163     moko     2550:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_NUM_GT); }
1.170   ! moko     2551: #line 2552 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2552:     break;
                   2553: 
1.115     misha    2554:   case 155:
1.170   ! moko     2555: #line 813 "compile.y" /* yacc.c:1646  */
1.163     moko     2556:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_NUM_LE); }
1.170   ! moko     2557: #line 2558 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2558:     break;
                   2559: 
1.115     misha    2560:   case 156:
1.170   ! moko     2561: #line 814 "compile.y" /* yacc.c:1646  */
1.163     moko     2562:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_NUM_GE); }
1.170   ! moko     2563: #line 2564 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2564:     break;
                   2565: 
1.115     misha    2566:   case 157:
1.170   ! moko     2567: #line 815 "compile.y" /* yacc.c:1646  */
1.163     moko     2568:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_NUM_EQ); }
1.170   ! moko     2569: #line 2570 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2570:     break;
                   2571: 
1.115     misha    2572:   case 158:
1.170   ! moko     2573: #line 816 "compile.y" /* yacc.c:1646  */
1.163     moko     2574:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_NUM_NE); }
1.170   ! moko     2575: #line 2576 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2576:     break;
                   2577: 
1.115     misha    2578:   case 159:
1.170   ! moko     2579: #line 817 "compile.y" /* yacc.c:1646  */
1.163     moko     2580:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_STR_LT); }
1.170   ! moko     2581: #line 2582 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2582:     break;
                   2583: 
1.115     misha    2584:   case 160:
1.170   ! moko     2585: #line 818 "compile.y" /* yacc.c:1646  */
1.163     moko     2586:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_STR_GT); }
1.170   ! moko     2587: #line 2588 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2588:     break;
                   2589: 
1.115     misha    2590:   case 161:
1.170   ! moko     2591: #line 819 "compile.y" /* yacc.c:1646  */
1.163     moko     2592:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_STR_LE); }
1.170   ! moko     2593: #line 2594 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2594:     break;
                   2595: 
1.115     misha    2596:   case 162:
1.170   ! moko     2597: #line 820 "compile.y" /* yacc.c:1646  */
1.163     moko     2598:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_STR_GE); }
1.170   ! moko     2599: #line 2600 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2600:     break;
                   2601: 
1.115     misha    2602:   case 163:
1.170   ! moko     2603: #line 821 "compile.y" /* yacc.c:1646  */
1.163     moko     2604:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_STR_EQ); }
1.170   ! moko     2605: #line 2606 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2606:     break;
                   2607: 
1.115     misha    2608:   case 164:
1.170   ! moko     2609: #line 822 "compile.y" /* yacc.c:1646  */
1.163     moko     2610:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_STR_NE); }
1.170   ! moko     2611: #line 2612 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2612:     break;
                   2613: 
1.115     misha    2614:   case 165:
1.170   ! moko     2615: #line 823 "compile.y" /* yacc.c:1646  */
1.163     moko     2616:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_IS); }
1.170   ! moko     2617: #line 2618 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2618:     break;
                   2619: 
1.115     misha    2620:   case 166:
1.170   ! moko     2621: #line 826 "compile.y" /* yacc.c:1646  */
1.112     paf      2622:     {
1.131     misha    2623:        // optimized OP_STRING => OP_VALUE for doubles
1.163     moko     2624:        maybe_change_string_literal_to_double_literal(*((yyval)=(yyvsp[0])));
1.158     misha    2625: }
1.170   ! moko     2626: #line 2627 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2627:     break;
                   2628: 
1.115     misha    2629:   case 167:
1.170   ! moko     2630: #line 831 "compile.y" /* yacc.c:1646  */
1.112     paf      2631:     {
1.131     misha    2632: #ifdef OPTIMIZE_BYTECODE_STRING_POOL
                   2633:        // it brakes ^if(" 09 "){...}
1.163     moko     2634:        YYSTYPE code=(yyvsp[0]);
1.156     moko     2635:        (yyval)=N();
1.159     misha    2636:        if(code->count()==3 && change_first(*code, OP::OP_STRING__WRITE, OP::OP_VALUE)){
1.131     misha    2637:                // optimized OP_STRING__WRITE+origin+value => OP_VALUE+origin+value without starting OP_STRING_POOL
1.156     moko     2638:                P(*(yyval), *code);
1.131     misha    2639:        } else {
1.156     moko     2640:                OA(*(yyval), OP::OP_STRING_POOL, code); /* stack: empty write context */
1.131     misha    2641:        }
                   2642: #else
1.156     moko     2643:        (yyval)=N();
1.163     moko     2644:        OA(*(yyval), OP::OP_STRING_POOL, (yyvsp[0])); /* stack: empty write context */
1.131     misha    2645: #endif
1.47      paf      2646:        /* some code that writes to that context */
                   2647:        /* context=pop; stack: context.get_string() */
1.158     misha    2648: }
1.170   ! moko     2649: #line 2650 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2650:     break;
                   2651: 
1.115     misha    2652:   case 168:
1.170   ! moko     2653: #line 852 "compile.y" /* yacc.c:1646  */
1.112     paf      2654:     {
1.131     misha    2655:        // optimized OP_STRING+OP_WRITE_VALUE => OP_STRING__WRITE
1.163     moko     2656:        change_string_literal_to_write_string_literal(*((yyval)=(yyvsp[0])));
1.158     misha    2657: }
1.170   ! moko     2658: #line 2659 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2659:     break;
                   2660: 
1.115     misha    2661:   case 169:
1.170   ! moko     2662: #line 857 "compile.y" /* yacc.c:1646  */
1.158     misha    2663:     { (yyval)=VL(/*we know that we will not change it*/const_cast<VString*>(&vempty), 0, 0, 0); }
1.170   ! moko     2664: #line 2665 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2665:     break;
                   2666: 
1.115     misha    2667:   case 170:
1.170   ! moko     2668: #line 858 "compile.y" /* yacc.c:1646  */
1.158     misha    2669:     { (yyval) = VL(/*we know that we will not change it*/const_cast<VBool*>(&vtrue), 0, 0, 0); }
1.170   ! moko     2670: #line 2671 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2671:     break;
                   2672: 
1.115     misha    2673:   case 171:
1.170   ! moko     2674: #line 859 "compile.y" /* yacc.c:1646  */
1.158     misha    2675:     { (yyval) = VL(/*we know that we will not change it*/const_cast<VBool*>(&vfalse), 0, 0, 0); }
1.170   ! moko     2676: #line 2677 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2677:     break;
                   2678: 
1.115     misha    2679:   case 172:
1.170   ! moko     2680: #line 861 "compile.y" /* yacc.c:1646  */
1.158     misha    2681:     { (yyval)=N(); }
1.170   ! moko     2682: #line 2683 "compile.tab.C" /* yacc.c:1646  */
1.155     misha    2683:     break;
1.154     moko     2684: 
1.112     paf      2685: 
1.170   ! moko     2686: #line 2687 "compile.tab.C" /* yacc.c:1646  */
1.156     moko     2687:       default: break;
1.155     misha    2688:     }
1.158     misha    2689:   /* User semantic actions sometimes alter yychar, and that requires
                   2690:      that yytoken be updated with the new translation.  We take the
                   2691:      approach of translating immediately before every use of yytoken.
                   2692:      One alternative is translating here after every semantic action,
                   2693:      but that translation would be missed if the semantic action invokes
                   2694:      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
                   2695:      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
                   2696:      incorrect destructor might then be invoked immediately.  In the
                   2697:      case of YYERROR or YYBACKUP, subsequent parser actions might lead
                   2698:      to an incorrect destructor call or verbose syntax error message
                   2699:      before the lookahead is translated.  */
1.156     moko     2700:   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1.112     paf      2701: 
1.156     moko     2702:   YYPOPSTACK (yylen);
                   2703:   yylen = 0;
1.112     paf      2704:   YY_STACK_PRINT (yyss, yyssp);
1.1       parser   2705: 
                   2706:   *++yyvsp = yyval;
                   2707: 
1.163     moko     2708:   /* Now 'shift' the result of the reduction.  Determine what state
1.112     paf      2709:      that goes to, based on the state we popped back to and the rule
                   2710:      number reduced by.  */
1.1       parser   2711: 
                   2712:   yyn = yyr1[yyn];
                   2713: 
1.112     paf      2714:   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
                   2715:   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1.1       parser   2716:     yystate = yytable[yystate];
                   2717:   else
1.112     paf      2718:     yystate = yydefgoto[yyn - YYNTOKENS];
1.1       parser   2719: 
                   2720:   goto yynewstate;
                   2721: 
                   2722: 
1.163     moko     2723: /*--------------------------------------.
                   2724: | yyerrlab -- here on detecting error.  |
                   2725: `--------------------------------------*/
1.112     paf      2726: yyerrlab:
1.158     misha    2727:   /* Make sure we have latest lookahead translation.  See comments at
                   2728:      user semantic actions for why this is necessary.  */
                   2729:   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
                   2730: 
1.112     paf      2731:   /* If not already recovering from an error, report this error.  */
                   2732:   if (!yyerrstatus)
1.1       parser   2733:     {
                   2734:       ++yynerrs;
1.156     moko     2735: #if ! YYERROR_VERBOSE
1.163     moko     2736:       yyerror (pc, YY_("syntax error"));
1.156     moko     2737: #else
1.158     misha    2738: # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
                   2739:                                         yyssp, yytoken)
1.156     moko     2740:       {
1.158     misha    2741:         char const *yymsgp = YY_("syntax error");
                   2742:         int yysyntax_error_status;
                   2743:         yysyntax_error_status = YYSYNTAX_ERROR;
                   2744:         if (yysyntax_error_status == 0)
                   2745:           yymsgp = yymsg;
                   2746:         else if (yysyntax_error_status == 1)
                   2747:           {
                   2748:             if (yymsg != yymsgbuf)
                   2749:               YYSTACK_FREE (yymsg);
                   2750:             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
                   2751:             if (!yymsg)
                   2752:               {
                   2753:                 yymsg = yymsgbuf;
                   2754:                 yymsg_alloc = sizeof yymsgbuf;
                   2755:                 yysyntax_error_status = 2;
                   2756:               }
                   2757:             else
                   2758:               {
                   2759:                 yysyntax_error_status = YYSYNTAX_ERROR;
                   2760:                 yymsgp = yymsg;
                   2761:               }
                   2762:           }
1.163     moko     2763:         yyerror (pc, yymsgp);
1.158     misha    2764:         if (yysyntax_error_status == 2)
                   2765:           goto yyexhaustedlab;
1.156     moko     2766:       }
1.158     misha    2767: # undef YYSYNTAX_ERROR
1.156     moko     2768: #endif
1.1       parser   2769:     }
                   2770: 
1.112     paf      2771: 
1.1       parser   2772: 
                   2773:   if (yyerrstatus == 3)
                   2774:     {
1.112     paf      2775:       /* If just tried and failed to reuse lookahead token after an
1.163     moko     2776:          error, discard it.  */
1.109     paf      2777: 
1.113     paf      2778:       if (yychar <= YYEOF)
1.163     moko     2779:         {
                   2780:           /* Return failure if at end of input.  */
                   2781:           if (yychar == YYEOF)
                   2782:             YYABORT;
                   2783:         }
1.113     paf      2784:       else
1.163     moko     2785:         {
                   2786:           yydestruct ("Error: discarding",
                   2787:                       yytoken, &yylval, pc);
                   2788:           yychar = YYEMPTY;
                   2789:         }
1.106     paf      2790:     }
1.1       parser   2791: 
1.112     paf      2792:   /* Else will try to reuse lookahead token after shifting the error
                   2793:      token.  */
                   2794:   goto yyerrlab1;
1.109     paf      2795: 
1.1       parser   2796: 
1.113     paf      2797: /*---------------------------------------------------.
                   2798: | yyerrorlab -- error raised explicitly by YYERROR.  |
                   2799: `---------------------------------------------------*/
                   2800: yyerrorlab:
                   2801: 
1.156     moko     2802:   /* Pacify compilers like GCC when the user code never invokes
                   2803:      YYERROR and the label yyerrorlab therefore never appears in user
                   2804:      code.  */
                   2805:   if (/*CONSTCOND*/ 0)
1.113     paf      2806:      goto yyerrorlab;
                   2807: 
1.163     moko     2808:   /* Do not reclaim the symbols of the rule whose action triggered
1.156     moko     2809:      this YYERROR.  */
                   2810:   YYPOPSTACK (yylen);
                   2811:   yylen = 0;
                   2812:   YY_STACK_PRINT (yyss, yyssp);
1.113     paf      2813:   yystate = *yyssp;
                   2814:   goto yyerrlab1;
                   2815: 
                   2816: 
                   2817: /*-------------------------------------------------------------.
                   2818: | yyerrlab1 -- common code for both syntax error and YYERROR.  |
                   2819: `-------------------------------------------------------------*/
1.112     paf      2820: yyerrlab1:
1.163     moko     2821:   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1.1       parser   2822: 
1.112     paf      2823:   for (;;)
1.109     paf      2824:     {
1.112     paf      2825:       yyn = yypact[yystate];
1.158     misha    2826:       if (!yypact_value_is_default (yyn))
1.163     moko     2827:         {
                   2828:           yyn += YYTERROR;
                   2829:           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
                   2830:             {
                   2831:               yyn = yytable[yyn];
                   2832:               if (0 < yyn)
                   2833:                 break;
                   2834:             }
                   2835:         }
1.1       parser   2836: 
1.112     paf      2837:       /* Pop the current state because it cannot handle the error token.  */
                   2838:       if (yyssp == yyss)
1.163     moko     2839:         YYABORT;
1.1       parser   2840: 
1.156     moko     2841: 
                   2842:       yydestruct ("Error: popping",
1.163     moko     2843:                   yystos[yystate], yyvsp, pc);
1.156     moko     2844:       YYPOPSTACK (1);
1.113     paf      2845:       yystate = *yyssp;
1.112     paf      2846:       YY_STACK_PRINT (yyss, yyssp);
1.1       parser   2847:     }
                   2848: 
1.163     moko     2849:   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1.156     moko     2850:   *++yyvsp = yylval;
1.163     moko     2851:   YY_IGNORE_MAYBE_UNINITIALIZED_END
1.155     misha    2852: 
1.1       parser   2853: 
1.156     moko     2854:   /* Shift the error token.  */
                   2855:   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1.112     paf      2856: 
1.1       parser   2857:   yystate = yyn;
                   2858:   goto yynewstate;
                   2859: 
                   2860: 
1.112     paf      2861: /*-------------------------------------.
                   2862: | yyacceptlab -- YYACCEPT comes here.  |
                   2863: `-------------------------------------*/
                   2864: yyacceptlab:
                   2865:   yyresult = 0;
                   2866:   goto yyreturn;
                   2867: 
                   2868: /*-----------------------------------.
                   2869: | yyabortlab -- YYABORT comes here.  |
                   2870: `-----------------------------------*/
                   2871: yyabortlab:
                   2872:   yyresult = 1;
                   2873:   goto yyreturn;
                   2874: 
1.163     moko     2875: #if !defined yyoverflow || YYERROR_VERBOSE
1.156     moko     2876: /*-------------------------------------------------.
                   2877: | yyexhaustedlab -- memory exhaustion comes here.  |
                   2878: `-------------------------------------------------*/
                   2879: yyexhaustedlab:
1.163     moko     2880:   yyerror (pc, YY_("memory exhausted"));
1.112     paf      2881:   yyresult = 2;
                   2882:   /* Fall through.  */
                   2883: #endif
                   2884: 
                   2885: yyreturn:
1.156     moko     2886:   if (yychar != YYEMPTY)
1.158     misha    2887:     {
                   2888:       /* Make sure we have latest lookahead translation.  See comments at
                   2889:          user semantic actions for why this is necessary.  */
                   2890:       yytoken = YYTRANSLATE (yychar);
                   2891:       yydestruct ("Cleanup: discarding lookahead",
1.163     moko     2892:                   yytoken, &yylval, pc);
1.158     misha    2893:     }
1.163     moko     2894:   /* Do not reclaim the symbols of the rule whose action triggered
1.156     moko     2895:      this YYABORT or YYACCEPT.  */
                   2896:   YYPOPSTACK (yylen);
                   2897:   YY_STACK_PRINT (yyss, yyssp);
                   2898:   while (yyssp != yyss)
                   2899:     {
                   2900:       yydestruct ("Cleanup: popping",
1.163     moko     2901:                   yystos[*yyssp], yyvsp, pc);
1.156     moko     2902:       YYPOPSTACK (1);
                   2903:     }
1.112     paf      2904: #ifndef yyoverflow
                   2905:   if (yyss != yyssa)
                   2906:     YYSTACK_FREE (yyss);
1.1       parser   2907: #endif
1.156     moko     2908: #if YYERROR_VERBOSE
                   2909:   if (yymsg != yymsgbuf)
                   2910:     YYSTACK_FREE (yymsg);
                   2911: #endif
1.163     moko     2912:   return yyresult;
1.1       parser   2913: }
1.170   ! moko     2914: #line 863 "compile.y" /* yacc.c:1906  */
1.1       parser   2915: 
                   2916: #endif
                   2917: 
                   2918: /*
                   2919:        000$111(2222)00 
                   2920:                000$111{3333}00
                   2921:        $,^: push,=0
                   2922:        1:( { break=pop
                   2923:        2:( )  pop
                   2924:        3:{ }  pop
                   2925: 
                   2926:        000^111(2222)4444{33333}4000
                   2927:        $,^: push,=0
                   2928:        1:( { break=pop
                   2929:        2:( )=4
                   2930:        3:{ }=4
                   2931:                4:[^({]=pop
                   2932: */
                   2933: 
1.84      paf      2934: inline void ungetc(Parse_control& pc, uint last_line_end_col) {
                   2935:        pc.source--;
                   2936:        if(pc.pos.col==0) {
                   2937:                --pc.pos.line; pc.pos.col=last_line_end_col;
                   2938:        } else
                   2939:                --pc.pos.col;
                   2940: 
                   2941: }
                   2942: static int yylex(YYSTYPE *lvalp, void *apc) {
                   2943:        register Parse_control& pc=*static_cast<Parse_control*>(apc);
                   2944: 
                   2945:        #define lexical_brackets_nestage pc.brackets_nestages[pc.ls_sp]
1.1       parser   2946:        #define RC {result=c; goto break2; }
                   2947: 
1.84      paf      2948:        register int c;
                   2949:        int result;
1.1       parser   2950:        
1.84      paf      2951:        if(pc.pending_state) {
                   2952:                result=pc.pending_state;
                   2953:                pc.pending_state=0;
1.1       parser   2954:                return result;
                   2955:        }
                   2956:        
1.84      paf      2957:        const char *begin=pc.source;
                   2958:        Pos begin_pos=pc.pos;
1.1       parser   2959:        const char *end;
                   2960:        int skip_analized=0;
                   2961:        while(true) {
1.84      paf      2962:                c=*(end=(pc.source++));
                   2963: //             fprintf(stderr, "\nchar: %c %02X; nestage: %d, sp=%d", c, c, lexical_brackets_nestage, pc.sp);
1.1       parser   2964: 
1.96      paf      2965:                if(c=='\n')
1.84      paf      2966:                        pc.pos_next_line();
1.96      paf      2967:                else
1.84      paf      2968:                        pc.pos_next_c(c);
1.96      paf      2969: //             fprintf(stderr, "\nchar: %c file(%d:%d)", c, pc.pos.line, pc.pos.col);
1.1       parser   2970: 
1.96      paf      2971:                if(pc.pos.col==0+1 && c=='@') {
1.84      paf      2972:                        if(pc.ls==LS_DEF_SPECIAL_BODY) {
1.31      paf      2973:                                // @SPECIAL
                   2974:                                // ...
                   2975:                                // @<here = 
1.84      paf      2976:                                pop_LS(pc); // exiting from LS_DEF_SPECIAL_BODY state
1.31      paf      2977:                        } // continuing checks
1.84      paf      2978:                        if(pc.ls==LS_USER) {
                   2979:                                push_LS(pc, LS_DEF_NAME);
1.20      parser   2980:                                RC;
1.31      paf      2981:                        } else // @ in first column inside some code [when could that be?]
1.20      parser   2982:                                result=BAD_METHOD_DECL_START;
                   2983:                        goto break2;
1.97      paf      2984:                }
                   2985:                if(c=='^') {
1.84      paf      2986:                        if(pc.ls==LS_METHOD_AFTER) {
1.75      paf      2987:                                // handle after-method situation
1.84      paf      2988:                                pop_LS(pc);
1.75      paf      2989:                                result=EON;
                   2990:                                skip_analized=-1; // return to punctuation afterwards to assure it's literality
                   2991:                                goto break2;
                   2992:                        }
1.84      paf      2993:                        switch(pc.ls) {
1.15      parser   2994: case LS_EXPRESSION_VAR_NAME_WITH_COLON:
                   2995: case LS_EXPRESSION_VAR_NAME_WITHOUT_COLON:
                   2996: case LS_VAR_NAME_SIMPLE_WITH_COLON:
                   2997: case LS_VAR_NAME_SIMPLE_WITHOUT_COLON:
                   2998: case LS_VAR_NAME_CURLY:
                   2999: case LS_METHOD_NAME:
1.66      paf      3000: case LS_USER_COMMENT:
1.15      parser   3001: case LS_DEF_COMMENT:
                   3002:        // no literals in names, please
                   3003:        break;
                   3004: default:
1.84      paf      3005:                        switch(*pc.source) {
1.10      parser   3006:                        // ^escaping some punctuators
1.121     misha    3007:                        case '^': case '$': case ';': case '@':
1.1       parser   3008:                        case '(': case ')':
                   3009:                        case '[': case ']':
                   3010:                        case '{': case '}':
1.23      parser   3011:                        case '"':  case ':':
1.1       parser   3012:                                if(end!=begin) {
1.84      paf      3013:                                        if(!pc.string_start)
                   3014:                                                pc.string_start=begin_pos;
1.1       parser   3015:                                        // append piece till ^
1.84      paf      3016:                                        pc.string.append_strdup_know_length(begin, end-begin);
1.1       parser   3017:                                }
                   3018:                                // reset piece 'begin' position & line
1.84      paf      3019:                                begin=pc.source; // ->punctuation
                   3020:                                begin_pos=pc.pos;
1.75      paf      3021:                                // skip over _ after ^
1.84      paf      3022:                                pc.source++;  pc.pos.col++;
1.75      paf      3023:                                // skip analysis = forced literal
                   3024:                                continue;
1.1       parser   3025: 
                   3026:                        // converting ^#HH into char(hex(HH))
                   3027:                        case '#':
                   3028:                                if(end!=begin) {
1.84      paf      3029:                                        if(!pc.string_start)
                   3030:                                                pc.string_start=begin_pos;
1.1       parser   3031:                                        // append piece till ^
1.84      paf      3032:                                        pc.string.append_strdup_know_length(begin, end-begin);
1.1       parser   3033:                                }
                   3034:                                // #HH ?
1.121     misha    3035:                                if(pc.source[1] && isxdigit(pc.source[1]) && pc.source[2] && isxdigit(pc.source[2])) {
1.110     paf      3036:                                        char c=(char)(
1.84      paf      3037:                                                hex_value[(unsigned char)pc.source[1]]*0x10+
1.110     paf      3038:                                                hex_value[(unsigned char)pc.source[2]]);
1.84      paf      3039:                                        if(c==0) {
1.1       parser   3040:                                                result=BAD_HEX_LITERAL;
                   3041:                                                goto break2; // wrong hex value[no ^#00 chars allowed]: bail out
                   3042:                                        }
                   3043:                                        // append char(hex(HH))
1.84      paf      3044:                                        pc.string.append(c);
1.1       parser   3045:                                        // skip over ^#HH
1.84      paf      3046:                                        pc.source+=3;
                   3047:                                        pc.pos.col+=3;
1.1       parser   3048:                                        // reset piece 'begin' position & line
1.84      paf      3049:                                        begin=pc.source; // ->after ^#HH
                   3050:                                        begin_pos=pc.pos;
1.75      paf      3051:                                        // skip analysis = forced literal
1.1       parser   3052:                                        continue;
                   3053:                                }
1.121     misha    3054:                                // just escaped char
                   3055:                                // reset piece 'begin' position & line
                   3056:                                begin=pc.source;
                   3057:                                begin_pos=pc.pos;
                   3058:                                // skip over _ after ^
                   3059:                                pc.source++;  pc.pos.col++;
                   3060:                                // skip analysis = forced literal
                   3061:                                continue;
1.1       parser   3062:                        }
1.15      parser   3063:                        break;
1.75      paf      3064:                        }
1.15      parser   3065:                }
1.1       parser   3066:                // #comment  start skipping
1.84      paf      3067:                if(c=='#' && pc.pos.col==1) {
1.1       parser   3068:                        if(end!=begin) {
1.84      paf      3069:                                if(!pc.string_start)
                   3070:                                        pc.string_start=begin_pos;
1.1       parser   3071:                                // append piece till #
1.84      paf      3072:                                pc.string.append_strdup_know_length(begin, end-begin);
1.1       parser   3073:                        }
                   3074:                        // fall into COMMENT lexical state [wait for \n]
1.84      paf      3075:                        push_LS(pc, LS_USER_COMMENT);
1.31      paf      3076:                        continue;
1.1       parser   3077:                }
1.84      paf      3078:                switch(pc.ls) {
1.1       parser   3079: 
                   3080:                // USER'S = NOT OURS
                   3081:                case LS_USER:
1.84      paf      3082:                case LS_NAME_SQUARE_PART: // name.[here].xxx
                   3083:                        if(pc.trim_bof)
1.1       parser   3084:                                switch(c) {
                   3085:                                case '\n': case ' ': case '\t':
1.84      paf      3086:                                        begin=pc.source;
                   3087:                                        begin_pos=pc.pos;
1.1       parser   3088:                                        continue; // skip it
                   3089:                                default:
1.84      paf      3090:                                        pc.trim_bof=false;
1.1       parser   3091:                                }
                   3092:                        switch(c) {
                   3093:                        case '$':
1.84      paf      3094:                                push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1       parser   3095:                                RC;
                   3096:                        case '^':
1.84      paf      3097:                                push_LS(pc, LS_METHOD_NAME);
1.1       parser   3098:                                RC;
1.11      parser   3099:                        case ']':
1.84      paf      3100:                                if(pc.ls==LS_NAME_SQUARE_PART)
1.11      parser   3101:                                        if(--lexical_brackets_nestage==0) {// $name.[co<]?>de<]?>
1.84      paf      3102:                                                pop_LS(pc); // $name.[co<]>de<]!>
1.11      parser   3103:                                                RC;
                   3104:                                        }
1.3       parser   3105:                                break;
1.11      parser   3106:                        case '[': // $name.[co<[>de]
1.84      paf      3107:                                if(pc.ls==LS_NAME_SQUARE_PART)
1.11      parser   3108:                                        lexical_brackets_nestage++;
1.4       parser   3109:                                break;
1.1       parser   3110:                        }
1.97      paf      3111:                        if(pc.explicit_result && c)
                   3112:                                switch(c) {
1.168     moko     3113:                                default:
                   3114:                                        pc.string.append(c);
1.97      paf      3115:                                case '\n': case ' ': case '\t':
                   3116:                                        begin=pc.source;
                   3117:                                        begin_pos=pc.pos;
1.168     moko     3118:                                        continue;
1.97      paf      3119:                                }
1.1       parser   3120:                        break;
                   3121:                        
                   3122:                // #COMMENT
1.66      paf      3123:                case LS_USER_COMMENT:
1.1       parser   3124:                        if(c=='\n') {
                   3125:                                // skip comment
1.84      paf      3126:                                begin=pc.source;
                   3127:                                begin_pos=pc.pos;
1.1       parser   3128: 
1.84      paf      3129:                                pop_LS(pc);
1.1       parser   3130:                                continue;
                   3131:                        }
                   3132:                        break;
                   3133:                        
                   3134:                // STRING IN EXPRESSION
                   3135:                case LS_EXPRESSION_STRING_QUOTED:
                   3136:                case LS_EXPRESSION_STRING_APOSTROFED:
                   3137:                        switch(c) {
                   3138:                        case '"':
                   3139:                        case '\'':
                   3140:                                if(
1.162     moko     3141:                                        (pc.ls == LS_EXPRESSION_STRING_QUOTED && c=='"') ||
                   3142:                                        (pc.ls == LS_EXPRESSION_STRING_APOSTROFED && c=='\'') ) {
1.84      paf      3143:                                        pop_LS(pc); //"abc". | 'abc'.
1.1       parser   3144:                                        RC;
                   3145:                                }
                   3146:                                break;
                   3147:                        case '$':
1.84      paf      3148:                                push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1       parser   3149:                                RC;
                   3150:                        case '^':
1.84      paf      3151:                                push_LS(pc, LS_METHOD_NAME);
1.1       parser   3152:                                RC;
                   3153:                        }
                   3154:                        break;
                   3155: 
                   3156:                // METHOD DEFINITION
                   3157:                case LS_DEF_NAME:
                   3158:                        switch(c) {
                   3159:                        case '[':
1.84      paf      3160:                                pc.ls=LS_DEF_PARAMS;
1.1       parser   3161:                                RC;
                   3162:                        case '\n':
1.84      paf      3163:                                pc.ls=LS_DEF_SPECIAL_BODY;
1.1       parser   3164:                                RC;
                   3165:                        }
                   3166:                        break;
                   3167: 
                   3168:                case LS_DEF_PARAMS:
                   3169:                        switch(c) {
1.64      paf      3170:                        case '$': // common error
1.65      paf      3171:                                result=BAD_METHOD_PARAMETER_NAME_CHARACTER;
                   3172:                                goto break2;
1.1       parser   3173:                        case ';':
                   3174:                                RC;
                   3175:                        case ']':
1.84      paf      3176:                                pc.ls=*pc.source=='['?LS_DEF_LOCALS:LS_DEF_COMMENT;
1.1       parser   3177:                                RC;
                   3178:                        case '\n': // wrong. bailing out
1.84      paf      3179:                                pop_LS(pc);
1.1       parser   3180:                                RC;
                   3181:                        }
                   3182:                        break;
                   3183: 
                   3184:                case LS_DEF_LOCALS:
                   3185:                        switch(c) {
                   3186:                        case '[':
                   3187:                        case ';':
                   3188:                                RC;
                   3189:                        case ']':
1.84      paf      3190:                                pc.ls=LS_DEF_COMMENT;
1.1       parser   3191:                                RC;
                   3192:                        case '\n': // wrong. bailing out
1.84      paf      3193:                                pop_LS(pc);
1.1       parser   3194:                                RC;
                   3195:                        }
                   3196:                        break;
                   3197: 
                   3198:                case LS_DEF_COMMENT:
                   3199:                        if(c=='\n') {
1.84      paf      3200:                                pop_LS(pc);
1.1       parser   3201:                                RC;
                   3202:                        }
                   3203:                        break;
                   3204: 
                   3205:                case LS_DEF_SPECIAL_BODY:
1.31      paf      3206:                        if(c=='\n')
1.1       parser   3207:                                RC;
                   3208:                        break;
                   3209: 
                   3210:                // (EXPRESSION)
                   3211:                case LS_VAR_ROUND:
                   3212:                case LS_METHOD_ROUND:
                   3213:                        switch(c) {
                   3214:                        case ')':
1.162     moko     3215:                                if(--lexical_brackets_nestage==0) {
1.84      paf      3216:                                        if(pc.ls==LS_METHOD_ROUND) // method round param ended
                   3217:                                                pc.ls=LS_METHOD_AFTER; // look for method end
                   3218:                                        else // pc.ls==LS_VAR_ROUND // variable constructor ended
                   3219:                                                pop_LS(pc); // return to normal life
1.162     moko     3220:                                }
1.1       parser   3221:                                RC;
1.66      paf      3222:                        case '#': // comment start skipping
                   3223:                                if(end!=begin) {
1.84      paf      3224:                                        if(!pc.string_start)
                   3225:                                                pc.string_start=begin_pos;
1.66      paf      3226:                                        // append piece till #
1.84      paf      3227:                                        pc.string.append_strdup_know_length(begin, end-begin);
1.66      paf      3228:                                }
                   3229:                                // fall into COMMENT lexical state [wait for \n]
1.84      paf      3230:                                push_LS(pc, LS_EXPRESSION_COMMENT);
1.66      paf      3231:                                lexical_brackets_nestage=1;
                   3232:                                continue;
1.1       parser   3233:                        case '$':
1.84      paf      3234:                                push_LS(pc, LS_EXPRESSION_VAR_NAME_WITH_COLON);                         
1.1       parser   3235:                                RC;
                   3236:                        case '^':
1.84      paf      3237:                                push_LS(pc, LS_METHOD_NAME);
1.1       parser   3238:                                RC;
                   3239:                        case '(':
                   3240:                                lexical_brackets_nestage++;
                   3241:                                RC;
                   3242:                        case '-':
1.84      paf      3243:                                switch(*pc.source) {
1.1       parser   3244:                                case 'f': // -f
                   3245:                                        skip_analized=1;
                   3246:                                        result=FEXISTS;
                   3247:                                        goto break2;
                   3248:                                case 'd': // -d
                   3249:                                        skip_analized=1;
                   3250:                                        result=DEXISTS;
                   3251:                                        goto break2;
1.63      paf      3252:                                default: // minus
1.1       parser   3253:                                        result=c;
                   3254:                                        goto break2;
                   3255:                                }
                   3256:                                goto break2;
1.25      paf      3257:                        case '+': case '*': case '/': case '%': case '\\':
1.1       parser   3258:                        case '~':
                   3259:                        case ';':
                   3260:                                RC;
1.65      paf      3261:                        case '&': case '|':
1.84      paf      3262:                                if(*pc.source==c) { // && ||
1.65      paf      3263:                                        result=c=='&'?LAND:LOR;
1.1       parser   3264:                                        skip_analized=1;
                   3265:                                } else
                   3266:                                        result=c;
                   3267:                                goto break2;
1.65      paf      3268:                        case '!':
1.84      paf      3269:                                switch(pc.source[0]) { 
1.65      paf      3270:                                case '|': // !| !||
                   3271:                                        skip_analized=1;
1.84      paf      3272:                                        if(pc.source[1]=='|') {
1.65      paf      3273:                                                skip_analized++;
                   3274:                                                result=LXOR;
                   3275:                                        } else
                   3276:                                                result=NXOR;
                   3277:                                        goto break2;
                   3278:                                case '=': // !=
                   3279:                                        skip_analized=1;
                   3280:                                        result=NNE; 
                   3281:                                        goto break2;
                   3282:                                }
                   3283:                                RC;
1.67      paf      3284: 
                   3285:                        case '<': // <<, <=, <
1.84      paf      3286:                                switch(*pc.source) {
1.67      paf      3287:                                case '<': // <[<]
                   3288:                                        skip_analized=1; result=NSL; break;
                   3289:                                case '=': // <[=]
                   3290:                                        skip_analized=1; result=NLE; break;
                   3291:                                default: // <[]
                   3292:                                        result=c; break;
                   3293:                                }
                   3294:                                goto break2;
                   3295:                        case '>': // >>, >=, >
1.84      paf      3296:                                switch(*pc.source) {
1.67      paf      3297:                                case '>': // >[>]
                   3298:                                        skip_analized=1; result=NSR; break;
                   3299:                                case '=': // >[=]
                   3300:                                        skip_analized=1; result=NGE; break;
                   3301:                                default: // >[]
                   3302:                                        result=c; break;
                   3303:                                }
                   3304:                                goto break2;
                   3305:                        case '=': // ==
1.84      paf      3306:                                switch(*pc.source) {
1.67      paf      3307:                                case '=': // =[=]
                   3308:                                        skip_analized=1; result=NEQ; break;
                   3309:                                default: // =[]
                   3310:                                        result=c; break; // not used now
                   3311:                                }
1.1       parser   3312:                                goto break2;
1.67      paf      3313: 
1.1       parser   3314:                        case '"':
1.84      paf      3315:                                push_LS(pc, LS_EXPRESSION_STRING_QUOTED);
1.1       parser   3316:                                RC;
                   3317:                        case '\'':
1.84      paf      3318:                                push_LS(pc, LS_EXPRESSION_STRING_APOSTROFED);
1.1       parser   3319:                                RC;
                   3320:                        case 'l': case 'g': case 'e': case 'n':
                   3321:                                if(end==begin) // right after whitespace
1.84      paf      3322:                                        if(isspace(pc.source[1])) {
                   3323:                                                switch(*pc.source) {
1.1       parser   3324:                                                        //                                      case '?': // ok [and bad cases, yacc would bark at them]
                   3325:                                                case 't': // lt gt [et nt]
                   3326:                                                        result=c=='l'?SLT:c=='g'?SGT:BAD_STRING_COMPARISON_OPERATOR;
                   3327:                                                        skip_analized=1;
                   3328:                                                        goto break2;
                   3329:                                                case 'e': // le ge ne [ee]
                   3330:                                                        result=c=='l'?SLE:c=='g'?SGE:c=='n'?SNE:BAD_STRING_COMPARISON_OPERATOR;
                   3331:                                                        skip_analized=1;
                   3332:                                                        goto break2;
                   3333:                                                case 'q': // eq [lq gq nq]
                   3334:                                                        result=c=='e'?SEQ:BAD_STRING_COMPARISON_OPERATOR;
                   3335:                                                        skip_analized=1;
                   3336:                                                        goto break2;
                   3337:                                                }
                   3338:                                        }
                   3339:                                break;
                   3340:                        case 'i':
                   3341:                                if(end==begin) // right after whitespace
1.84      paf      3342:                                        if(isspace(pc.source[1])) {
                   3343:                                                switch(pc.source[0]) {
1.1       parser   3344:                                                case 'n': // in
                   3345:                                                        skip_analized=1;
                   3346:                                                        result=IN;
                   3347:                                                        goto break2;
                   3348:                                                case 's': // is
                   3349:                                                        skip_analized=1;
                   3350:                                                        result=IS;
                   3351:                                                        goto break2;
                   3352:                                                }
                   3353:                                        }
                   3354:                                break;
                   3355:                        case 'd':
                   3356:                                if(end==begin) // right after whitespace
1.84      paf      3357:                                        if(pc.source[0]=='e' && pc.source[1]=='f') { // def
1.118     misha    3358:                                                switch(pc.source[2]){
                   3359:                                                case ' ': case '\t': case '\n': case '"': case '\'': case '^': case '$': // non-quoted string without whitespace after 'def' is not allowed
                   3360:                                                        skip_analized=2;
                   3361:                                                        result=DEF;
                   3362:                                                        goto break2;
                   3363:                                                }
                   3364:                                                // error: incorrect char after 'def'
1.1       parser   3365:                                        }
                   3366:                                break;
1.107     paf      3367:                        case 't':
                   3368:                                if(end==begin) // right after whitespace
1.118     misha    3369:                                        if(pc.source[0]=='r' && pc.source[1]=='u' && pc.source[2]=='e') { // true
1.107     paf      3370:                                                skip_analized=3;
                   3371:                                                result=LITERAL_TRUE;
                   3372:                                                goto break2;
                   3373:                                        }
                   3374:                                break;
                   3375:                        case 'f':
                   3376:                                if(end==begin) // right after whitespace
1.118     misha    3377:                                        if(pc.source[0]=='a' && pc.source[1]=='l' && pc.source[2]=='s' && pc.source[3]=='e') { // false
1.107     paf      3378:                                                skip_analized=4;
                   3379:                                                result=LITERAL_FALSE;
                   3380:                                                goto break2;
                   3381:                                        }
                   3382:                                break;
1.1       parser   3383:                        case ' ': case '\t': case '\n':
                   3384:                                if(end!=begin) { // there were a string after previous operator?
                   3385:                                        result=0; // return that string
                   3386:                                        goto break2;
                   3387:                                }
                   3388:                                // that's a leading|traling space or after-operator-space
                   3389:                                // ignoring it
                   3390:                                // reset piece 'begin' position & line
1.84      paf      3391:                                begin=pc.source; // after whitespace char
                   3392:                                begin_pos=pc.pos;
1.1       parser   3393:                                continue;
                   3394:                        }
                   3395:                        break;
1.66      paf      3396:                case LS_EXPRESSION_COMMENT:
                   3397:                        if(c=='(')
                   3398:                                lexical_brackets_nestage++;
                   3399:                        
1.84      paf      3400:                        switch(*pc.source) {
1.66      paf      3401:                        case '\n': case ')':
1.84      paf      3402:                                if(*pc.source==')')
1.66      paf      3403:                                        if(--lexical_brackets_nestage!=0)
                   3404:                                                continue;
                   3405: 
                   3406:                                // skip comment
1.84      paf      3407:                                begin=pc.source;
                   3408:                                begin_pos=pc.pos;
1.66      paf      3409: 
1.84      paf      3410:                                pop_LS(pc);
1.66      paf      3411:                                continue;
                   3412:                        }
                   3413:                        break;
1.1       parser   3414: 
                   3415:                // VARIABLE GET/PUT/WITH
1.11      parser   3416:                case LS_VAR_NAME_SIMPLE_WITH_COLON: 
                   3417:                case LS_VAR_NAME_SIMPLE_WITHOUT_COLON:
                   3418:                case LS_EXPRESSION_VAR_NAME_WITH_COLON: 
                   3419:                case LS_EXPRESSION_VAR_NAME_WITHOUT_COLON:
                   3420:                        if(
1.84      paf      3421:                                pc.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON ||
                   3422:                                pc.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.41      paf      3423:                                // name in expr ends also before 
1.1       parser   3424:                                switch(c) {
1.41      paf      3425:                                // expression minus
1.1       parser   3426:                                case '-': 
1.41      paf      3427:                                // expression integer division
                   3428:                                case '\\':
1.84      paf      3429:                                        pop_LS(pc);
                   3430:                                        pc.ungetc();
1.1       parser   3431:                                        result=EON;
                   3432:                                        goto break2;
                   3433:                                }
                   3434:                        }
1.11      parser   3435:                        if(
1.84      paf      3436:                                pc.ls==LS_VAR_NAME_SIMPLE_WITHOUT_COLON ||
                   3437:                                pc.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.1       parser   3438:                                // name already has ':', stop before next 
                   3439:                                switch(c) {
                   3440:                                case ':': 
1.84      paf      3441:                                        pop_LS(pc);
                   3442:                                        pc.ungetc();
1.1       parser   3443:                                        result=EON;
                   3444:                                        goto break2;
                   3445:                                }
                   3446:                        }
                   3447:                        switch(c) {
                   3448:                        case 0:
                   3449:                        case ' ': case '\t': case '\n':
                   3450:                        case ';':
                   3451:                        case ']': case '}': case ')': 
                   3452:                        case '"': case '\'':
                   3453:                        case '<': case '>':  // these stand for HTML brackets AND expression binary ops
1.146     misha    3454:                        case '+': case '*': case '/': case '\\': case '%': 
1.1       parser   3455:                        case '&': case '|': 
                   3456:                        case '=': case '!':
                   3457:                        // common delimiters
1.62      paf      3458:                        case ',': case '?': case '#':
1.113     paf      3459:                        // mysql column separators
                   3460:                        case '`':
1.1       parser   3461:                        // before call
                   3462:                        case '^': 
1.84      paf      3463:                                pop_LS(pc);
                   3464:                                pc.ungetc();
1.1       parser   3465:                                result=EON;
                   3466:                                goto break2;
                   3467:                        case '[':
1.5       parser   3468:                                // $name.<[>code]
1.84      paf      3469:                                if(pc.pos.col>1/*not first column*/ && (
1.6       parser   3470:                                        end[-1]=='$'/*was start of get*/ ||
                   3471:                                        end[-1]==':'/*was class name delim */ ||
                   3472:                                        end[-1]=='.'/*was name delim */
1.5       parser   3473:                                        )) {
1.84      paf      3474:                                        push_LS(pc, LS_NAME_SQUARE_PART);
1.5       parser   3475:                                        lexical_brackets_nestage=1;
                   3476:                                        RC;
                   3477:                                }
1.84      paf      3478:                                pc.ls=LS_VAR_SQUARE;
1.1       parser   3479:                                lexical_brackets_nestage=1;
                   3480:                                RC;
                   3481:                        case '{':
                   3482:                                if(begin==end) { // ${name}, no need of EON, switching LS
1.84      paf      3483:                                        pc.ls=LS_VAR_NAME_CURLY; 
1.1       parser   3484:                                } else {
1.84      paf      3485:                                        pc.ls=LS_VAR_CURLY;
1.1       parser   3486:                                        lexical_brackets_nestage=1;
                   3487:                                }
                   3488: 
                   3489:                                RC;
                   3490:                        case '(':
1.84      paf      3491:                                pc.ls=LS_VAR_ROUND;
1.1       parser   3492:                                lexical_brackets_nestage=1;
                   3493:                                RC;
                   3494:                        case '.': // name part delim
                   3495:                        case '$': // name part subvar
1.3       parser   3496:                        case ':': // class<:>name
1.11      parser   3497:                                // go to _WITHOUT_COLON state variant...
1.84      paf      3498:                                if(pc.ls==LS_VAR_NAME_SIMPLE_WITH_COLON)
                   3499:                                        pc.ls=LS_VAR_NAME_SIMPLE_WITHOUT_COLON;
                   3500:                                else if(pc.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON)
                   3501:                                        pc.ls=LS_EXPRESSION_VAR_NAME_WITHOUT_COLON;
1.11      parser   3502:                                // ...stop before next ':'
1.1       parser   3503:                                RC;
                   3504:                        }
                   3505:                        break;
                   3506: 
                   3507:                case LS_VAR_NAME_CURLY:
                   3508:                        switch(c) {
1.5       parser   3509:                        case '[':
1.11      parser   3510:                                // ${name.<[>code]}
1.84      paf      3511:                                push_LS(pc, LS_NAME_SQUARE_PART);
1.3       parser   3512:                                lexical_brackets_nestage=1;
                   3513:                                RC;
1.1       parser   3514:                        case '}': // ${name} finished, restoring LS
1.84      paf      3515:                                pop_LS(pc);
1.1       parser   3516:                                RC;
                   3517:                        case '.': // name part delim
                   3518:                        case '$': // name part subvar
                   3519:                        case ':': // ':name' or 'class:name'
                   3520:                                RC;
                   3521:                        }
                   3522:                        break;
                   3523: 
                   3524:                case LS_VAR_SQUARE:
                   3525:                        switch(c) {
                   3526:                        case '$':
1.84      paf      3527:                                push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1       parser   3528:                                RC;
                   3529:                        case '^':
1.84      paf      3530:                                push_LS(pc, LS_METHOD_NAME);
1.1       parser   3531:                                RC;
                   3532:                        case ']':
                   3533:                                if(--lexical_brackets_nestage==0) {
1.84      paf      3534:                                        pop_LS(pc);
1.1       parser   3535:                                        RC;
                   3536:                                }
                   3537:                                break;
                   3538:                        case ';': // operator_or_fmt;value delim
                   3539:                                RC;
                   3540:                        case '[':
                   3541:                                lexical_brackets_nestage++;
                   3542:                                break;
                   3543:                        }
                   3544:                        break;
                   3545: 
                   3546:                case LS_VAR_CURLY:
                   3547:                        switch(c) {
                   3548:                        case '$':
1.84      paf      3549:                                push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1       parser   3550:                                RC;
                   3551:                        case '^':
1.84      paf      3552:                                push_LS(pc, LS_METHOD_NAME);
1.1       parser   3553:                                RC;
                   3554:                        case '}':
                   3555:                                if(--lexical_brackets_nestage==0) {
1.84      paf      3556:                                        pop_LS(pc);
1.1       parser   3557:                                        RC;
                   3558:                                }
                   3559:                                break;
                   3560:                        case '{':
                   3561:                                lexical_brackets_nestage++;
                   3562:                                break;
                   3563:                        }
                   3564:                        break;
                   3565: 
                   3566:                // METHOD CALL
                   3567:                case LS_METHOD_NAME:
                   3568:                        switch(c) {
                   3569:                        case '[':
1.11      parser   3570:                                // ^name.<[>code].xxx
1.84      paf      3571:                                if(pc.pos.col>1/*not first column*/ && (
1.6       parser   3572:                                        end[-1]=='^'/*was start of call*/ || // never, ^[ is literal...
                   3573:                                        end[-1]==':'/*was class name delim */ ||
                   3574:                                        end[-1]=='.'/*was name delim */
1.5       parser   3575:                                        )) {
1.84      paf      3576:                                        push_LS(pc, LS_NAME_SQUARE_PART);
1.5       parser   3577:                                        lexical_brackets_nestage=1;
                   3578:                                        RC;
                   3579:                                }
1.84      paf      3580:                                pc.ls=LS_METHOD_SQUARE;
1.1       parser   3581:                                lexical_brackets_nestage=1;
                   3582:                                RC;
                   3583:                        case '{':
1.84      paf      3584:                                pc.ls=LS_METHOD_CURLY;
1.1       parser   3585:                                lexical_brackets_nestage=1;
                   3586:                                RC;
                   3587:                        case '(':
1.84      paf      3588:                                pc.ls=LS_METHOD_ROUND;
1.1       parser   3589:                                lexical_brackets_nestage=1;
                   3590:                                RC;
                   3591:                        case '.': // name part delim 
                   3592:                        case '$': // name part subvar
                   3593:                        case ':': // ':name' or 'class:name'
1.19      parser   3594:                        case '^': // ^abc^xxx wrong. bailing out
                   3595:                        case ']': case '}': case ')': // ^abc]}) wrong. bailing out
1.90      paf      3596:                        case ' ': // ^if ( wrong. bailing out
1.1       parser   3597:                                RC;
                   3598:                        }
                   3599:                        break;
                   3600: 
                   3601:                case LS_METHOD_SQUARE:
                   3602:                        switch(c) {
                   3603:                        case '$':
1.84      paf      3604:                                push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1       parser   3605:                                RC;
                   3606:                        case '^':
1.84      paf      3607:                                push_LS(pc, LS_METHOD_NAME);
1.1       parser   3608:                                RC;
                   3609:                        case ';': // param delim
                   3610:                                RC;
                   3611:                        case ']':
                   3612:                                if(--lexical_brackets_nestage==0) {
1.84      paf      3613:                                        pc.ls=LS_METHOD_AFTER;
1.1       parser   3614:                                        RC;
                   3615:                                }
                   3616:                                break;
                   3617:                        case '[':
                   3618:                                lexical_brackets_nestage++;
                   3619:                                break;
                   3620:                        }
                   3621:                        break;
                   3622: 
                   3623:                case LS_METHOD_CURLY:
                   3624:                        switch(c) {
                   3625:                        case '$':
1.84      paf      3626:                                push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1       parser   3627:                                RC;
                   3628:                        case '^':
1.84      paf      3629:                                push_LS(pc, LS_METHOD_NAME);
1.1       parser   3630:                                RC;
                   3631:                        case ';': // param delim
                   3632:                                RC;
                   3633:                        case '}':
                   3634:                                if(--lexical_brackets_nestage==0) {
1.84      paf      3635:                                        pc.ls=LS_METHOD_AFTER;
1.1       parser   3636:                                        RC;
                   3637:                                }
                   3638:                                break;
                   3639:                        case '{':
                   3640:                                lexical_brackets_nestage++;
                   3641:                                break;
                   3642:                        }
1.97      paf      3643:                        if(pc.explicit_result && c)
                   3644:                                switch(c) {
1.168     moko     3645:                                default:
                   3646:                                        pc.string.append(c);
1.97      paf      3647:                                case '\n': case ' ': case '\t':
                   3648:                                        begin=pc.source;
                   3649:                                        begin_pos=pc.pos;
1.168     moko     3650:                                        continue;
1.97      paf      3651:                                }
1.1       parser   3652:                        break;
                   3653: 
                   3654:                case LS_METHOD_AFTER:
                   3655:                        if(c=='[') {/* ][ }[ )[ */
1.84      paf      3656:                                pc.ls=LS_METHOD_SQUARE;
1.1       parser   3657:                                lexical_brackets_nestage=1;
                   3658:                                RC;
                   3659:                        }                                          
                   3660:                        if(c=='{') {/* ]{ }{ ){ */
1.84      paf      3661:                                pc.ls=LS_METHOD_CURLY;
1.1       parser   3662:                                lexical_brackets_nestage=1;
                   3663:                                RC;
                   3664:                        }                                          
                   3665:                        if(c=='(') {/* ]( }( )( */
1.84      paf      3666:                                pc.ls=LS_METHOD_ROUND;
1.1       parser   3667:                                lexical_brackets_nestage=1;
                   3668:                                RC;
                   3669:                        }                                          
1.84      paf      3670:                        pop_LS(pc);
                   3671:                        pc.ungetc();
1.1       parser   3672:                        result=EON;
                   3673:                        goto break2;
                   3674:                }
                   3675:                if(c==0) {
                   3676:                        result=-1;
                   3677:                        break;
                   3678:                }
                   3679:        }
                   3680: 
                   3681: break2:
                   3682:        if(end!=begin) { // there is last piece?
1.150     misha    3683:                if(c=='@' || c==0) // we are before LS_DEF_NAME or EOF?
                   3684:                        while(end!=begin && end[-1]=='\n') // trim all empty lines before LS_DEF_NAME and EOF
1.1       parser   3685:                                end--;
1.84      paf      3686:                if(end!=begin && pc.ls!=LS_USER_COMMENT) { // last piece still alive and not comment?
                   3687:                        if(!pc.string_start)
                   3688:                                pc.string_start=begin_pos;
1.1       parser   3689:                        // append it
1.84      paf      3690:                        pc.string.append_strdup_know_length(begin, end-begin);
1.1       parser   3691:                }
                   3692:        }
1.84      paf      3693:        if(!pc.string.is_empty()) { // something accumulated?
                   3694:                // create STRING value: array of OP_VALUE+origin+vstring
1.170   ! moko     3695: #ifdef SYMBOLS_CACHING
        !          3696:                Value *lookup=symbols->get(pc.string);
        !          3697: #else
        !          3698:                Value *lookup=0;
        !          3699: #endif
1.84      paf      3700:                *lvalp=VL(
1.170   ! moko     3701:                        lookup ? lookup : new VString(*new String(pc.string, String::L_CLEAN)), pc.file_no, pc.string_start.line, pc.string_start.col);
1.1       parser   3702:                // new pieces storage
1.84      paf      3703:                pc.string.clear();
                   3704:                pc.string_start.clear();
1.1       parser   3705:                // make current result be pending for next call, return STRING for now
1.84      paf      3706:                pc.pending_state=result;  result=STRING;
1.1       parser   3707:        }
                   3708:        if(skip_analized) {
1.84      paf      3709:                pc.source+=skip_analized;  pc.pos.col+=skip_analized;
1.1       parser   3710:        }
                   3711:        return result;
                   3712: }
                   3713: 
1.156     moko     3714: static int real_yyerror(Parse_control *pc, const char *s) {  // Called by yyparse on error
1.10      parser   3715:           strncpy(PC.error, s, MAX_STRING);
1.1       parser   3716:           return 1;
                   3717: }
                   3718: 
                   3719: static void yyprint(FILE *file, int type, YYSTYPE value) {
                   3720:        if(type==STRING)
1.84      paf      3721:                fprintf(file, " \"%s\"", LA2S(*value)->cstr());
1.1       parser   3722: }

E-mail: