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

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

E-mail: