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

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

E-mail: