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

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.177   ! moko       76: volatile const char * IDENT_COMPILE_Y = "$Id: compile.y,v 1.288 2016/11/27 23:08:28 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.177   ! moko      525:      243,   243,   244,   244,   245,   246,   246,   248,   248,   295,
        !           526:      295,   296,   297,   297,   298,   298,   300,   300,   304,   304,
        !           527:      306,   306,   307,   307,   308,   308,   308,   312,   343,   344,
        !           528:      344,   345,   347,   348,   349,   398,   399,   399,   403,   416,
        !           529:      417,   418,   419,   441,   446,   449,   450,   451,   453,   456,
        !           530:      453,   464,   471,   478,   479,   480,   482,   488,   489,   489,
        !           531:      493,   504,   507,   504,   556,   572,   572,   574,   575,   576,
        !           532:      578,   581,   578,   584,   585,   587,   588,   591,   592,   595,
        !           533:      596,   598,   601,   614,   619,   620,   621,   626,   626,   628,
        !           534:      628,   629,   630,   642,   651,   654,   655,   656,   657,   659,
        !           535:      663,   672,   675,   672,   688,   693,   693,   694,   700,   701,
        !           536:      703,   723,   735,   737,   738,   739,   740,   741,   742,   743,
        !           537:      744,   746,   747,   748,   749,   750,   751,   752,   753,   755,
        !           538:      756,   757,   758,   759,   760,   761,   762,   763,   764,   765,
        !           539:      766,   767,   768,   769,   770,   771,   772,   773,   774,   775,
        !           540:      776,   777,   778,   779,   780,   781,   784,   789,   810,   815,
        !           541:      816,   817,   819
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.174     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*/, PC.cclass->is_vars_local());
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.177   ! moko     1596:                        VStateless_class* cclass=new VClass(name.cstr(), PC.request.get_used_filespec(PC.file_no));
1.119     misha    1597:                        PC.cclass_new=cclass;
1.158     misha    1598:                        PC.append=false;
1.1       parser   1599:                } else {
1.160     moko     1600:                        strcpy(PC.error, "@" CLASS_NAME " must contain only one line with class name (contains more then one)");
1.1       parser   1601:                        YYERROR;
                   1602:                }
                   1603:        } else if(command==USE_CONTROL_METHOD_NAME) {
1.157     moko     1604:                CLASS_ADD;
1.165     moko     1605:                for(size_t i=0; i<strings_code->count(); i+=OPERATIONS_PER_OPVALUE){
1.177   ! moko     1606:                        PC.request.use_file(LA2S(*strings_code, i)->trim(String::TRIM_END), PC.request.get_used_filespec(PC.file_no), strings_code->get(i+1).origin);
1.165     moko     1607:                }
1.1       parser   1608:        } else if(command==BASE_NAME) {
1.119     misha    1609:                if(PC.append){
1.171     moko     1610:                        PC_ERROR("can't set base while appending methods to class '", PC.cclass->type(), "'");
1.119     misha    1611:                        YYERROR;
                   1612:                }
1.157     moko     1613:                CLASS_ADD;
1.59      paf      1614:                if(PC.cclass->base_class()) { // already changed from default?
1.171     moko     1615:                        PC_ERROR("class already have a base '", PC.cclass->base_class()->type(), "'");
1.1       parser   1616:                        YYERROR;
                   1617:                }
1.84      paf      1618:                if(strings_code->count()==1*OPERATIONS_PER_OPVALUE) {
1.152     misha    1619:                        const String& base_name=LA2S(*strings_code)->trim(String::TRIM_END);
1.173     moko     1620:                        if(VStateless_class *base_class=PC.request.get_class(base_name)) {
1.84      paf      1621:                                // @CLASS == @BASE sanity check
1.173     moko     1622:                                if(PC.cclass==base_class) {
                   1623:                                        strcpy(PC.error, "@" CLASS_NAME " equals @" BASE_NAME);
1.84      paf      1624:                                        YYERROR;
                   1625:                                }
1.173     moko     1626:                                PC.cclass->get_class()->set_base(base_class);
1.84      paf      1627:                        } else {
1.171     moko     1628:                                PC_ERROR("'", base_name.cstr(), "': undefined class in @" BASE_NAME);
1.1       parser   1629:                                YYERROR;
                   1630:                        }
                   1631:                } else {
1.160     moko     1632:                        strcpy(PC.error, "@" BASE_NAME " must contain sole name");
1.1       parser   1633:                        YYERROR;
                   1634:                }
1.116     misha    1635:        } else if(command==OPTIONS_CONTROL_METHOD_NAME) {
1.118     misha    1636:                for(size_t i=0; i<strings_code->count(); i+=OPERATIONS_PER_OPVALUE) {
1.152     misha    1637:                        const String& option=LA2S(*strings_code, i)->trim(String::TRIM_END);
1.170     moko     1638:                        if(option==Symbols::LOCALS_SYMBOL){
1.119     misha    1639:                                PC.set_all_vars_local();
1.170     moko     1640:                        } else if(option==Symbols::PARTIAL_SYMBOL){
1.123     misha    1641:                                if(PC.cclass_new){
                   1642:                                        if(VStateless_class* existed=PC.get_existed_class(PC.cclass_new)){
                   1643:                                                if(!PC.reuse_existed_class(existed)){
1.171     moko     1644:                                                        PC_ERROR("can't append methods to '", PC.cclass_new->type(), "' - the class wasn't marked as partial");
1.123     misha    1645:                                                        YYERROR;
                   1646:                                                }
1.119     misha    1647:                                        } else {
1.149     misha    1648:                                                // marks the new class as partial. we will be able to add methods here later.
1.123     misha    1649:                                                PC.cclass_new->set_partial();
1.119     misha    1650:                                        }
1.123     misha    1651:                                } else {
1.170     moko     1652:                                        strcpy(PC.error, "'partial' option should be used straight after @" CLASS_NAME);
1.119     misha    1653:                                        YYERROR;
                   1654:                                }
1.170     moko     1655:                        } else if(option==Symbols::STATIC_SYMBOL){
1.149     misha    1656:                                PC.set_methods_call_type(Method::CT_STATIC);
1.170     moko     1657:                        } else if(option==Symbols::DYNAMIC_SYMBOL){
1.149     misha    1658:                                PC.set_methods_call_type(Method::CT_DYNAMIC);
1.118     misha    1659:                        } else {
1.171     moko     1660:                                PC_ERROR("'", option.cstr(), "' invalid option. valid options are 'partial', 'locals', 'static' and 'dynamic'");
1.118     misha    1661:                                YYERROR;
1.116     misha    1662:                        }
                   1663:                }
1.1       parser   1664:        } else {
1.171     moko     1665:                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   1666:                YYERROR;
                   1667:        }
1.158     misha    1668: }
1.177   ! moko     1669: #line 1670 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1670:     break;
                   1671: 
                   1672:   case 13:
1.177   ! moko     1673: #line 244 "compile.y" /* yacc.c:1646  */
1.163     moko     1674:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.177   ! moko     1675: #line 1676 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1676:     break;
                   1677: 
                   1678:   case 17:
1.177   ! moko     1679: #line 248 "compile.y" /* yacc.c:1646  */
1.112     paf      1680:     { 
1.157     moko     1681:        CLASS_ADD;
1.96      paf      1682:        PC.explicit_result=false;
1.1       parser   1683: 
1.163     moko     1684:        YYSTYPE params_names_code=(yyvsp[-3]);
1.84      paf      1685:        ArrayString* params_names=0;
                   1686:        if(int size=params_names_code->count()) {
                   1687:                params_names=new ArrayString;
                   1688:                for(int i=0; i<size; i+=OPERATIONS_PER_OPVALUE)
                   1689:                        *params_names+=LA2S(*params_names_code, i);
1.1       parser   1690:        }
                   1691: 
1.163     moko     1692:        YYSTYPE locals_names_code=(yyvsp[-2]);
1.84      paf      1693:        ArrayString* locals_names=0;
1.174     moko     1694:        bool all_vars_local=PC.cclass->is_vars_local();
                   1695: 
1.84      paf      1696:        if(int size=locals_names_code->count()) {
                   1697:                locals_names=new ArrayString;
1.96      paf      1698:                for(int i=0; i<size; i+=OPERATIONS_PER_OPVALUE) {
                   1699:                        const String* local_name=LA2S(*locals_names_code, i);
1.170     moko     1700:                        if(SYMBOLS_EQ(*local_name,RESULT_SYMBOL))
1.96      paf      1701:                                PC.explicit_result=true;
1.170     moko     1702:                        else if(SYMBOLS_EQ(*local_name,LOCALS_SYMBOL))
1.116     misha    1703:                                all_vars_local=true;
1.96      paf      1704:                        else
                   1705:                                *locals_names+=local_name;
                   1706:                }
1.1       parser   1707:        }
                   1708: 
1.96      paf      1709:        Method* method=new Method(
1.84      paf      1710:                //name, 
1.163     moko     1711:                GetMethodCallType(PC, *(yyvsp[-4])),
1.1       parser   1712:                0, 0/*min,max numbered_params_count*/, 
                   1713:                params_names, locals_names, 
1.116     misha    1714:                0/*to be filled later in next {} */, 0, all_vars_local);
1.114     misha    1715: 
1.156     moko     1716:        *reinterpret_cast<Method**>(&(yyval))=method;
1.158     misha    1717: }
1.177   ! moko     1718: #line 1719 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1719:     break;
                   1720: 
1.115     misha    1721:   case 18:
1.177   ! moko     1722: #line 285 "compile.y" /* yacc.c:1646  */
1.115     misha    1723:     {
1.163     moko     1724:                Method* method=reinterpret_cast<Method*>((yyvsp[-1]));
1.124     misha    1725:                // fill in the code
1.163     moko     1726:                method->parser_code=(yyvsp[0]);
1.124     misha    1727: 
                   1728:                // register in class
1.163     moko     1729:                const String& name=*LA2S(*(yyvsp[-6]));
1.144     misha    1730:                PC.cclass->set_method(PC.alias_method(name), method);
1.158     misha    1731: }
1.177   ! moko     1732: #line 1733 "compile.tab.C" /* yacc.c:1646  */
1.115     misha    1733:     break;
                   1734: 
                   1735:   case 21:
1.177   ! moko     1736: #line 296 "compile.y" /* yacc.c:1646  */
1.163     moko     1737:     {(yyval)=(yyvsp[-1]);}
1.177   ! moko     1738: #line 1739 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1739:     break;
                   1740: 
1.115     misha    1741:   case 25:
1.177   ! moko     1742: #line 298 "compile.y" /* yacc.c:1646  */
1.163     moko     1743:     { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); }
1.177   ! moko     1744: #line 1745 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1745:     break;
                   1746: 
1.115     misha    1747:   case 31:
1.177   ! moko     1748: #line 306 "compile.y" /* yacc.c:1646  */
1.163     moko     1749:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.177   ! moko     1750: #line 1751 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1751:     break;
                   1752: 
1.115     misha    1753:   case 37:
1.177   ! moko     1754: #line 312 "compile.y" /* yacc.c:1646  */
1.112     paf      1755:     {
1.156     moko     1756:        (yyval)=N();
1.163     moko     1757:        YYSTYPE code=(yyvsp[0]);
1.140     misha    1758:        size_t count=code->count();
1.138     misha    1759: 
1.128     misha    1760: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
1.171     moko     1761:        if(count!=3 || !change_first(*code, OP::OP_VALUE__GET_ELEMENT, /*=>*/OP::OP_VALUE__GET_ELEMENT__WRITE) )
1.131     misha    1762: #endif
1.140     misha    1763: 
1.138     misha    1764: #ifdef OPTIMIZE_BYTECODE_GET_SELF_ELEMENT
1.171     moko     1765:        if(count!=3 || !change_first(*code, OP::OP_WITH_SELF__VALUE__GET_ELEMENT, /*=>*/OP::OP_WITH_SELF__VALUE__GET_ELEMENT__WRITE) )
1.138     misha    1766: #endif
                   1767: 
1.132     misha    1768: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_ELEMENT
1.171     moko     1769:        if(count!=5 || !change_first(*code, OP::OP_GET_OBJECT_ELEMENT, /*=>*/OP::OP_GET_OBJECT_ELEMENT__WRITE) )
1.128     misha    1770: #endif
1.132     misha    1771: 
                   1772: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_VAR_ELEMENT
1.171     moko     1773:        if(count!=5 || !change_first(*code, OP::OP_GET_OBJECT_VAR_ELEMENT, /*=>*/OP::OP_GET_OBJECT_VAR_ELEMENT__WRITE) )
1.131     misha    1774: #endif
1.159     misha    1775: 
                   1776: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
1.171     moko     1777:        if(!change(*code, count-1/* last */, OP::OP_GET_ELEMENT__SPECIAL, /*=>*/OP::OP_GET_ELEMENT__SPECIAL__WRITE) )
1.159     misha    1778: #endif
                   1779: 
1.140     misha    1780:        {
1.171     moko     1781:                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    1782:        }
1.140     misha    1783: 
1.156     moko     1784:        P(*(yyval), *code);
1.158     misha    1785: }
1.177   ! moko     1786: #line 1787 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1787:     break;
                   1788: 
1.115     misha    1789:   case 38:
1.177   ! moko     1790: #line 343 "compile.y" /* yacc.c:1646  */
1.163     moko     1791:     { (yyval)=(yyvsp[0]); }
1.177   ! moko     1792: #line 1793 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1793:     break;
                   1794: 
1.115     misha    1795:   case 41:
1.177   ! moko     1796: #line 345 "compile.y" /* yacc.c:1646  */
1.163     moko     1797:     { (yyval)=(yyvsp[-1]); }
1.177   ! moko     1798: #line 1799 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1799:     break;
                   1800: 
1.115     misha    1801:   case 44:
1.177   ! moko     1802: #line 349 "compile.y" /* yacc.c:1646  */
1.112     paf      1803:     {
1.156     moko     1804:        (yyval)=N(); 
1.163     moko     1805:        YYSTYPE diving_code=(yyvsp[0]);
1.132     misha    1806:        size_t count=diving_code->count();
1.140     misha    1807: 
1.156     moko     1808:        if(maybe_make_self(*(yyval), *diving_code, count)) {
1.140     misha    1809:                // $self.
                   1810:        } else
1.132     misha    1811: 
                   1812: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_ELEMENT
1.156     moko     1813:        if(maybe_make_get_object_element(*(yyval), *diving_code, count)){
1.138     misha    1814:                // optimization for $object.field + ^object.method[
1.140     misha    1815:        } else
1.131     misha    1816: #endif
1.132     misha    1817: 
                   1818: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_VAR_ELEMENT
1.156     moko     1819:        if(maybe_make_get_object_var_element(*(yyval), *diving_code, count)){
1.138     misha    1820:                // optimization for $object.$var
1.140     misha    1821:        } else
1.131     misha    1822: #endif
1.132     misha    1823: 
                   1824: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
1.171     moko     1825:        if(count>=4 && (*diving_code)[0].code==OP::OP_VALUE && (*diving_code)[3].code==OP::OP_GET_ELEMENT ){
1.141     misha    1826:                 // optimization
1.156     moko     1827:                O(*(yyval),
1.140     misha    1828:                        (PC.in_call_value && count==4)
1.132     misha    1829:                        ? OP::OP_VALUE__GET_ELEMENT_OR_OPERATOR // ^object[ : OP_VALUE+origin+string+OP_GET_ELEMENT => OP_VALUE__GET_ELEMENT_OR_OPERATOR+origin+string
                   1830:                        : OP::OP_VALUE__GET_ELEMENT             // $object  : OP_VALUE+origin+string+OP_GET_ELEMENT => OP_VALUE__GET_ELEMENT+origin+string
                   1831:                );
1.156     moko     1832:                P(*(yyval), *diving_code, 1/*offset*/, 2/*limit*/); // copy origin+value
1.140     misha    1833:                if(count>4)
1.156     moko     1834:                        P(*(yyval), *diving_code, 4); // copy tail
1.132     misha    1835:        } else {
1.156     moko     1836:                O(*(yyval), OP::OP_WITH_READ); /* stack: starting context */
                   1837:                P(*(yyval), *diving_code);
1.132     misha    1838:        }
1.126     misha    1839: #else
1.140     misha    1840:        {
1.156     moko     1841:                O(*(yyval), OP::OP_WITH_READ); /* stack: starting context */
1.37      paf      1842: 
1.131     misha    1843:                // ^if OP_ELEMENT => ^if OP_ELEMENT_OR_OPERATOR
                   1844:                // optimized OP_VALUE+origin+string+OP_GET_ELEMENT. => OP_VALUE+origin+string+OP_GET_ELEMENT_OR_OPERATOR.
1.132     misha    1845:                if(PC.in_call_value && count==4)
                   1846:                        diving_code->put(count-1, OP::OP_GET_ELEMENT_OR_OPERATOR);
1.156     moko     1847:                P(*(yyval), *diving_code);
1.132     misha    1848:        }
1.126     misha    1849: #endif
1.1       parser   1850:        /* diving code; stack: current context */
1.158     misha    1851: }
1.177   ! moko     1852: #line 1853 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1853:     break;
                   1854: 
1.115     misha    1855:   case 45:
1.177   ! moko     1856: #line 398 "compile.y" /* yacc.c:1646  */
1.163     moko     1857:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.177   ! moko     1858: #line 1859 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1859:     break;
                   1860: 
1.115     misha    1861:   case 47:
1.177   ! moko     1862: #line 399 "compile.y" /* yacc.c:1646  */
1.163     moko     1863:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.177   ! moko     1864: #line 1865 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1865:     break;
                   1866: 
1.115     misha    1867:   case 48:
1.177   ! moko     1868: #line 403 "compile.y" /* yacc.c:1646  */
1.112     paf      1869:     {
1.156     moko     1870:        (yyval)=N();
1.137     misha    1871: #ifdef OPTIMIZE_BYTECODE_CONSTRUCT
1.163     moko     1872:        if(maybe_optimize_construct(*(yyval), *(yyvsp[-1]), *(yyvsp[0]))){
1.139     misha    1873:                // $a(expr), $.a(expr), $a[value], $.a[value], $self.a[value], $self.a(expr)
1.134     misha    1874:        } else 
                   1875: #endif
                   1876:        {
1.163     moko     1877:                P(*(yyval), *(yyvsp[-1])); /* stack: context,name */
                   1878:                P(*(yyval), *(yyvsp[0])); /* stack: context,name,constructor_value */
1.134     misha    1879:        }
1.158     misha    1880: }
1.177   ! moko     1881: #line 1882 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1882:     break;
                   1883: 
1.115     misha    1884:   case 52:
1.177   ! moko     1885: #line 419 "compile.y" /* yacc.c:1646  */
1.112     paf      1886:     {
1.156     moko     1887:        (yyval)=N();
1.163     moko     1888:        YYSTYPE diving_code=(yyvsp[0]);
1.140     misha    1889:        size_t count=diving_code->count();
                   1890: 
1.156     moko     1891:        if(maybe_make_self(*(yyval), *diving_code, count)) {
1.140     misha    1892:                // $self.
                   1893:        } else
                   1894: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
1.171     moko     1895:        if(count>=4 && (*diving_code)[0].code==OP::OP_VALUE && (*diving_code)[3].code==OP::OP_GET_ELEMENT ){
1.156     moko     1896:                O(*(yyval), OP::OP_WITH_ROOT__VALUE__GET_ELEMENT);
                   1897:                P(*(yyval), *diving_code, 1/*offset*/, 2/*limit*/); // copy origin+value
1.140     misha    1898:                if(count>4)
1.156     moko     1899:                        P(*(yyval), *diving_code, 4); // tail
1.140     misha    1900:        } else
                   1901: #endif
                   1902:        {
1.156     moko     1903:                O(*(yyval), OP::OP_WITH_ROOT); /* stack: starting context */
                   1904:                P(*(yyval), *diving_code);
1.1       parser   1905:        }
                   1906:        /* diving code; stack: current context */
1.158     misha    1907: }
1.177   ! moko     1908: #line 1909 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1909:     break;
                   1910: 
1.115     misha    1911:   case 53:
1.177   ! moko     1912: #line 441 "compile.y" /* yacc.c:1646  */
1.112     paf      1913:     {
1.156     moko     1914:        (yyval)=N(); 
                   1915:        O(*(yyval), OP::OP_WITH_WRITE); /* stack: starting context */
1.163     moko     1916:        P(*(yyval), *(yyvsp[0])); /* diving code; stack: context,name */
1.158     misha    1917: }
1.177   ! moko     1918: #line 1919 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1919:     break;
                   1920: 
1.115     misha    1921:   case 54:
1.177   ! moko     1922: #line 446 "compile.y" /* yacc.c:1646  */
1.163     moko     1923:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.177   ! moko     1924: #line 1925 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1925:     break;
                   1926: 
1.115     misha    1927:   case 58:
1.177   ! moko     1928: #line 453 "compile.y" /* yacc.c:1646  */
1.112     paf      1929:     {
1.100     paf      1930:        // allow $result_or_other_variable[ letters here any time ]
1.156     moko     1931:        *reinterpret_cast<bool*>(&(yyval))=PC.explicit_result; PC.explicit_result=false;
1.158     misha    1932: }
1.177   ! moko     1933: #line 1934 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1934:     break;
                   1935: 
1.115     misha    1936:   case 59:
1.177   ! moko     1937: #line 456 "compile.y" /* yacc.c:1646  */
1.112     paf      1938:     {
1.163     moko     1939:        PC.explicit_result=*reinterpret_cast<bool*>(&(yyvsp[-1]));
1.158     misha    1940: }
1.177   ! moko     1941: #line 1942 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1942:     break;
                   1943: 
1.115     misha    1944:   case 60:
1.177   ! moko     1945: #line 458 "compile.y" /* yacc.c:1646  */
1.112     paf      1946:     {
1.1       parser   1947:        // stack: context, name
1.163     moko     1948:        (yyval)=(yyvsp[-2]); // stack: context, name, value
1.156     moko     1949:        O(*(yyval), OP::OP_CONSTRUCT_VALUE); /* value=pop; name=pop; context=pop; construct(context,name,value) */
1.158     misha    1950: }
1.177   ! moko     1951: #line 1952 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1952:     break;
                   1953: 
1.115     misha    1954:   case 61:
1.177   ! moko     1955: #line 464 "compile.y" /* yacc.c:1646  */
1.112     paf      1956:     { 
1.156     moko     1957:        (yyval)=N(); 
1.1       parser   1958:        // stack: context, name
1.163     moko     1959:        P(*(yyval), *(yyvsp[-1])); // stack: context, name, value
1.156     moko     1960:        O(*(yyval), OP::OP_CONSTRUCT_EXPR); /* value=pop->as_expr_result; name=pop; context=pop; construct(context,name,value) */
1.158     misha    1961: }
1.177   ! moko     1962: #line 1963 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1963:     break;
                   1964: 
1.115     misha    1965:   case 62:
1.177   ! moko     1966: #line 471 "compile.y" /* yacc.c:1646  */
1.112     paf      1967:     {
1.1       parser   1968:        // stack: context, name
1.156     moko     1969:        (yyval)=N(); 
1.163     moko     1970:        OA(*(yyval), OP::OP_CURLY_CODE__CONSTRUCT, (yyvsp[-1])); /* code=pop; name=pop; context=pop; construct(context,name,junction(code)) */
1.158     misha    1971: }
1.177   ! moko     1972: #line 1973 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1973:     break;
                   1974: 
1.115     misha    1975:   case 66:
1.177   ! moko     1976: #line 482 "compile.y" /* yacc.c:1646  */
1.112     paf      1977:     {
1.156     moko     1978:        (yyval)=N(); 
1.163     moko     1979:        OA(*(yyval), OP::OP_OBJECT_POOL, (yyvsp[0])); /* stack: empty write context */
1.47      paf      1980:        /* some code that writes to that context */
                   1981:        /* context=pop; stack: context.value() */
1.158     misha    1982: }
1.177   ! moko     1983: #line 1984 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1984:     break;
                   1985: 
1.115     misha    1986:   case 69:
1.177   ! moko     1987: #line 489 "compile.y" /* yacc.c:1646  */
1.163     moko     1988:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.177   ! moko     1989: #line 1990 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      1990:     break;
                   1991: 
1.115     misha    1992:   case 70:
1.177   ! moko     1993: #line 493 "compile.y" /* yacc.c:1646  */
1.112     paf      1994:     {
1.163     moko     1995:        size_t count=(yyvsp[0])->count();
1.131     misha    1996: #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR
1.159     misha    1997:        if(count)
1.131     misha    1998: #endif
                   1999:        {
1.163     moko     2000:                (yyval)=(yyvsp[0]); /* stack: value */
1.171     moko     2001:                if(!change_first(*(yyval), OP::OP_CONSTRUCT_OBJECT, /*=>*/ OP::OP_CONSTRUCT_OBJECT__WRITE))
                   2002:                        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    2003:        }
1.158     misha    2004: }
1.177   ! moko     2005: #line 2006 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2006:     break;
                   2007: 
1.115     misha    2008:   case 71:
1.177   ! moko     2009: #line 504 "compile.y" /* yacc.c:1646  */
1.112     paf      2010:     { 
1.171     moko     2011:        PC.in_call_value=true; 
                   2012: }
1.177   ! moko     2013: #line 2014 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2014:     break;
                   2015: 
1.115     misha    2016:   case 72:
1.177   ! moko     2017: #line 507 "compile.y" /* yacc.c:1646  */
1.112     paf      2018:     {
1.171     moko     2019:        PC.in_call_value=false;
                   2020: }
1.177   ! moko     2021: #line 2022 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2022:     break;
                   2023: 
1.115     misha    2024:   case 73:
1.177   ! moko     2025: #line 510 "compile.y" /* yacc.c:1646  */
1.112     paf      2026:     { /* ^field.$method{vasya} */
1.131     misha    2027: #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR
1.135     misha    2028: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
1.163     moko     2029:        const String* operator_name=LA2S(*(yyvsp[-3]), 0, OP::OP_VALUE__GET_ELEMENT_OR_OPERATOR);
1.135     misha    2030: #else
1.163     moko     2031:        const String* operator_name=LA2S(*(yyvsp[-3]), 1);
1.135     misha    2032: #endif
1.170     moko     2033:        if(operator_name && SYMBOLS_EQ(*operator_name,REM_SYMBOL)){
1.156     moko     2034:                (yyval)=N();
1.131     misha    2035:        } else 
                   2036: #endif
                   2037:                {
1.163     moko     2038:                        YYSTYPE params_code=(yyvsp[-1]);
1.131     misha    2039:                        if(params_code->count()==3) { // probably [] case. [OP::OP_VALUE+origin+Void]
                   2040:                                if(Value* value=LA2V(*params_code)) // it is OP_VALUE+origin+value?
1.153     moko     2041:                                        if(const String * string=value->get_string())
                   2042:                                                if(string->is_empty()) // value is empty string?
                   2043:                                                        params_code=0; // ^zzz[] case. don't append lone empty param.
1.131     misha    2044:                        }
                   2045:                        /* stack: context, method_junction */
1.142     misha    2046: 
1.163     moko     2047:                        YYSTYPE var_code=(yyvsp[-3]);
1.142     misha    2048:                        if(
                   2049:                                var_code->count()==8
1.172     moko     2050:                                && ( (*var_code)[0].code==OP::OP_VALUE__GET_CLASS || (*var_code)[0].code==OP::OP_VALUE__GET_BASE_CLASS )
1.142     misha    2051:                                && (*var_code)[3].code==OP::OP_PREPARE_TO_CONSTRUCT_OBJECT
                   2052:                                && (*var_code)[4].code==OP::OP_VALUE
1.164     moko     2053: #ifdef FEATURE_GET_ELEMENT4CALL
                   2054:                                && (*var_code)[7].code==OP::OP_GET_ELEMENT4CALL
                   2055: #else
1.142     misha    2056:                                && (*var_code)[7].code==OP::OP_GET_ELEMENT
1.164     moko     2057: #endif
1.142     misha    2058:                        ){
1.159     misha    2059:                                (yyval)=N();
1.156     moko     2060:                                O(*(yyval), OP::OP_CONSTRUCT_OBJECT);
                   2061:                                P(*(yyval), *var_code, 1/*offset*/, 2/*limit*/); // class name
                   2062:                                P(*(yyval), *var_code, 5/*offset*/, 2/*limit*/); // constructor name
                   2063:                                OA(*(yyval), params_code);
1.142     misha    2064:                        } else 
                   2065:                                {
1.156     moko     2066:                                        (yyval)=var_code; /* with_xxx,diving code; stack: context,method_junction */
                   2067:                                        OA(*(yyval), OP::OP_CALL, params_code); // method_frame=make frame(pop junction); ncontext=pop; call(ncontext,method_frame) stack: value
1.142     misha    2068:                                }
1.131     misha    2069:                }
1.158     misha    2070: }
1.177   ! moko     2071: #line 2072 "compile.tab.C" /* yacc.c:1646  */
1.164     moko     2072:     break;
                   2073: 
                   2074:   case 74:
1.177   ! moko     2075: #line 556 "compile.y" /* yacc.c:1646  */
1.164     moko     2076:     {
                   2077: #ifdef FEATURE_GET_ELEMENT4CALL
                   2078:        size_t count=(yyvsp[0])->count();
                   2079:        if(count){
                   2080:                (yyval)=(yyvsp[0]);
                   2081: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_ELEMENT
                   2082:                !(count==5 && change_first(*(yyval), OP::OP_GET_OBJECT_ELEMENT, OP::OP_GET_OBJECT_ELEMENT4CALL)) &&
                   2083: #endif
                   2084: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_VAR_ELEMENT
                   2085:                !(count==5 && change_first(*(yyval), OP::OP_GET_OBJECT_VAR_ELEMENT, OP::OP_GET_OBJECT_VAR_ELEMENT4CALL)) &&
                   2086: #endif
                   2087:                !change(*(yyval), count-1, OP::OP_GET_ELEMENT, OP::OP_GET_ELEMENT4CALL);
                   2088:        }
                   2089: #endif
                   2090: }
1.177   ! moko     2091: #line 2092 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2092:     break;
                   2093: 
1.115     misha    2094:   case 76:
1.177   ! moko     2095: #line 572 "compile.y" /* yacc.c:1646  */
1.163     moko     2096:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.177   ! moko     2097: #line 2098 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2098:     break;
                   2099: 
1.115     misha    2100:   case 80:
1.177   ! moko     2101: #line 578 "compile.y" /* yacc.c:1646  */
1.112     paf      2102:     {
1.100     paf      2103:        // allow ^call[ letters here any time ]
1.156     moko     2104:        *reinterpret_cast<bool*>(&(yyval))=PC.explicit_result; PC.explicit_result=false;
1.158     misha    2105: }
1.177   ! moko     2106: #line 2107 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2107:     break;
                   2108: 
1.115     misha    2109:   case 81:
1.177   ! moko     2110: #line 581 "compile.y" /* yacc.c:1646  */
1.112     paf      2111:     {
1.163     moko     2112:        PC.explicit_result=*reinterpret_cast<bool*>(&(yyvsp[-1]));
1.158     misha    2113: }
1.177   ! moko     2114: #line 2115 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2115:     break;
                   2116: 
1.115     misha    2117:   case 82:
1.177   ! moko     2118: #line 583 "compile.y" /* yacc.c:1646  */
1.163     moko     2119:     {(yyval)=(yyvsp[-2]);}
1.177   ! moko     2120: #line 2121 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2121:     break;
                   2122: 
1.115     misha    2123:   case 83:
1.177   ! moko     2124: #line 584 "compile.y" /* yacc.c:1646  */
1.163     moko     2125:     {(yyval)=(yyvsp[-1]);}
1.177   ! moko     2126: #line 2127 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2127:     break;
                   2128: 
1.115     misha    2129:   case 84:
1.177   ! moko     2130: #line 585 "compile.y" /* yacc.c:1646  */
1.163     moko     2131:     {(yyval)=(yyvsp[-1]);}
1.177   ! moko     2132: #line 2133 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2133:     break;
                   2134: 
1.115     misha    2135:   case 86:
1.177   ! moko     2136: #line 588 "compile.y" /* yacc.c:1646  */
1.163     moko     2137:     { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); }
1.177   ! moko     2138: #line 2139 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2139:     break;
                   2140: 
1.115     misha    2141:   case 88:
1.177   ! moko     2142: #line 592 "compile.y" /* yacc.c:1646  */
1.163     moko     2143:     { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); }
1.177   ! moko     2144: #line 2145 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2145:     break;
                   2146: 
1.115     misha    2147:   case 90:
1.177   ! moko     2148: #line 596 "compile.y" /* yacc.c:1646  */
1.163     moko     2149:     { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); }
1.177   ! moko     2150: #line 2151 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2151:     break;
                   2152: 
1.115     misha    2153:   case 91:
1.177   ! moko     2154: #line 598 "compile.y" /* yacc.c:1646  */
1.112     paf      2155:     {
1.163     moko     2156:        (yyval)=(yyvsp[0]);
1.158     misha    2157: }
1.177   ! moko     2158: #line 2159 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2159:     break;
                   2160: 
1.115     misha    2161:   case 92:
1.177   ! moko     2162: #line 601 "compile.y" /* yacc.c:1646  */
1.112     paf      2163:     {
1.163     moko     2164:        YYSTYPE expr_code=(yyvsp[0]);
1.106     paf      2165:        if(expr_code->count()==3
1.127     misha    2166:                && (*expr_code)[0].code==OP::OP_VALUE) { // optimizing (double/bool/incidently 'string' too) case. [OP::OP_VALUE+origin+Double]. no evaluating
1.156     moko     2167:                (yyval)=expr_code; 
1.104     paf      2168:        } else {
1.131     misha    2169:                YYSTYPE code=N();
1.104     paf      2170:                P(*code, *expr_code);
1.122     misha    2171:                O(*code, OP::OP_WRITE_EXPR_RESULT);
1.156     moko     2172:                (yyval)=N(); 
                   2173:                OA(*(yyval), OP::OP_EXPR_CODE__STORE_PARAM, code);
1.104     paf      2174:        }
1.158     misha    2175: }
1.177   ! moko     2176: #line 2177 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2177:     break;
                   2178: 
1.115     misha    2179:   case 93:
1.177   ! moko     2180: #line 614 "compile.y" /* yacc.c:1646  */
1.112     paf      2181:     {
1.156     moko     2182:        (yyval)=N(); 
1.163     moko     2183:        OA(*(yyval), OP::OP_CURLY_CODE__STORE_PARAM, (yyvsp[0]));
1.158     misha    2184: }
1.177   ! moko     2185: #line 2186 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2186:     break;
                   2187: 
1.115     misha    2188:   case 98:
1.177   ! moko     2189: #line 626 "compile.y" /* yacc.c:1646  */
1.163     moko     2190:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.177   ! moko     2191: #line 2192 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2192:     break;
                   2193: 
1.115     misha    2194:   case 100:
1.177   ! moko     2195: #line 628 "compile.y" /* yacc.c:1646  */
1.163     moko     2196:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.177   ! moko     2197: #line 2198 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2198:     break;
                   2199: 
1.115     misha    2200:   case 102:
1.177   ! moko     2201: #line 630 "compile.y" /* yacc.c:1646  */
1.112     paf      2202:     {
1.33      paf      2203:        // we know that name_advance1 not called from ^xxx context
                   2204:        // so we'll not check for operator call possibility as we do in name_advance2
                   2205: 
1.1       parser   2206:        /* stack: context */
1.163     moko     2207:        (yyval)=(yyvsp[0]); /* stack: context,name */
1.159     misha    2208: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
                   2209:        O(*(yyval), is_special_element(*(yyval)) ? OP::OP_GET_ELEMENT__SPECIAL : OP::OP_GET_ELEMENT);
                   2210: #else
1.156     moko     2211:        O(*(yyval), OP::OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.159     misha    2212: #endif
1.158     misha    2213: }
1.177   ! moko     2214: #line 2215 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2215:     break;
                   2216: 
1.115     misha    2217:   case 103:
1.177   ! moko     2218: #line 642 "compile.y" /* yacc.c:1646  */
1.112     paf      2219:     {
1.1       parser   2220:        /* stack: context */
1.163     moko     2221:        (yyval)=(yyvsp[0]); /* stack: context,name */
1.159     misha    2222: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
                   2223:        O(*(yyval), is_special_element(*(yyval)) ? OP::OP_GET_ELEMENT__SPECIAL : OP::OP_GET_ELEMENT);
                   2224: #else
1.156     moko     2225:        O(*(yyval), OP::OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.159     misha    2226: #endif
1.158     misha    2227: }
1.177   ! moko     2228: #line 2229 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2229:     break;
                   2230: 
1.115     misha    2231:   case 109:
1.177   ! moko     2232: #line 659 "compile.y" /* yacc.c:1646  */
1.112     paf      2233:     {
1.163     moko     2234:        (yyval)=(yyvsp[0]);
1.156     moko     2235:        O(*(yyval), OP::OP_GET_ELEMENT);
1.158     misha    2236: }
1.177   ! moko     2237: #line 2238 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2238:     break;
                   2239: 
1.115     misha    2240:   case 110:
1.177   ! moko     2241: #line 663 "compile.y" /* yacc.c:1646  */
1.112     paf      2242:     {
1.131     misha    2243:        YYSTYPE code;
1.47      paf      2244:        {
1.163     moko     2245:                change_string_literal_to_write_string_literal(*(code=(yyvsp[-1])));
                   2246:                P(*code, *(yyvsp[0]));
1.47      paf      2247:        }
1.156     moko     2248:        (yyval)=N(); 
                   2249:        OA(*(yyval), OP::OP_STRING_POOL, code);
1.158     misha    2250: }
1.177   ! moko     2251: #line 2252 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2252:     break;
                   2253: 
1.115     misha    2254:   case 111:
1.177   ! moko     2255: #line 672 "compile.y" /* yacc.c:1646  */
1.112     paf      2256:     {
1.100     paf      2257:        // allow $result_or_other_variable[ letters here any time ]
1.156     moko     2258:        *reinterpret_cast<bool*>(&(yyval))=PC.explicit_result; PC.explicit_result=false;
1.158     misha    2259: }
1.177   ! moko     2260: #line 2261 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2261:     break;
                   2262: 
1.115     misha    2263:   case 112:
1.177   ! moko     2264: #line 675 "compile.y" /* yacc.c:1646  */
1.112     paf      2265:     {
1.163     moko     2266:        PC.explicit_result=*reinterpret_cast<bool*>(&(yyvsp[-1]));
1.158     misha    2267: }
1.177   ! moko     2268: #line 2269 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2269:     break;
                   2270: 
1.115     misha    2271:   case 113:
1.177   ! moko     2272: #line 677 "compile.y" /* yacc.c:1646  */
1.112     paf      2273:     {
1.156     moko     2274:        (yyval)=N(); 
1.159     misha    2275: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
1.163     moko     2276:        if(!maybe_append_simple_diving_code(*(yyval), *(yyvsp[-2])))
1.159     misha    2277: #endif
                   2278:        {
1.171     moko     2279:                OA(*(yyval), OP::OP_OBJECT_POOL, (yyvsp[-2])); /* stack: empty write context */
                   2280:                /* some code that writes to that context */
                   2281:                /* context=pop; stack: context.value() */
1.159     misha    2282:        }
1.158     misha    2283: }
1.177   ! moko     2284: #line 2285 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2285:     break;
                   2286: 
1.115     misha    2287:   case 114:
1.177   ! moko     2288: #line 688 "compile.y" /* yacc.c:1646  */
1.112     paf      2289:     {
1.156     moko     2290:        (yyval)=N(); 
                   2291:        O(*(yyval), OP::OP_WITH_READ);
1.163     moko     2292:        P(*(yyval), *(yyvsp[0]));
1.158     misha    2293: }
1.177   ! moko     2294: #line 2295 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2295:     break;
                   2296: 
1.115     misha    2297:   case 116:
1.177   ! moko     2298: #line 693 "compile.y" /* yacc.c:1646  */
1.163     moko     2299:     { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.177   ! moko     2300: #line 2301 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2301:     break;
                   2302: 
1.115     misha    2303:   case 117:
1.177   ! moko     2304: #line 694 "compile.y" /* yacc.c:1646  */
1.112     paf      2305:     {
1.163     moko     2306:        (yyval)=(yyvsp[0]);
1.156     moko     2307:        O(*(yyval), OP::OP_GET_ELEMENT__WRITE);
1.158     misha    2308: }
1.177   ! moko     2309: #line 2310 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2310:     break;
                   2311: 
1.115     misha    2312:   case 120:
1.177   ! moko     2313: #line 703 "compile.y" /* yacc.c:1646  */
1.112     paf      2314:     {
1.163     moko     2315:        (yyval)=(yyvsp[-1]); // stack: class name string
1.172     moko     2316:        OP::OPCODE code = OP::OP_VALUE__GET_CLASS;
1.156     moko     2317:        if(*LA2S(*(yyval)) == BASE_NAME) { // pseudo BASE class
1.84      paf      2318:                if(VStateless_class* base=PC.cclass->base_class()) {
1.167     moko     2319:                        change_string_literal_value(*(yyval), *new String(base->type()));
1.61      paf      2320:                } else {
                   2321:                        strcpy(PC.error, "no base class declared");
                   2322:                        YYERROR;
                   2323:                }
1.172     moko     2324:                code = OP::OP_VALUE__GET_BASE_CLASS;
                   2325:        } else {
1.173     moko     2326:                // can't use get_class because it will call @autouse[] if the class wasn't loaded
                   2327:                VStateless_class* base=PC.request.classes().get(*LA2S(*(yyval)));
                   2328:                if(base && PC.cclass->derived_from(*base))
1.172     moko     2329:                        code = OP::OP_VALUE__GET_BASE_CLASS;
1.61      paf      2330:        }
1.131     misha    2331:        // optimized OP_VALUE+origin+string+OP_GET_CLASS => OP_VALUE__GET_CLASS+origin+string
1.172     moko     2332:        change_first(*(yyval), OP::OP_VALUE, code);
1.158     misha    2333: }
1.177   ! moko     2334: #line 2335 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2335:     break;
                   2336: 
1.115     misha    2337:   case 121:
1.177   ! moko     2338: #line 723 "compile.y" /* yacc.c:1646  */
1.112     paf      2339:     {
1.163     moko     2340:        (yyval)=(yyvsp[-1]);
1.39      paf      2341:        if(!PC.in_call_value) {
1.1       parser   2342:                strcpy(PC.error, ":: not allowed here");
                   2343:                YYERROR;
                   2344:        }
1.156     moko     2345:        O(*(yyval), OP::OP_PREPARE_TO_CONSTRUCT_OBJECT);
1.158     misha    2346: }
1.177   ! moko     2347: #line 2348 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2348:     break;
                   2349: 
1.115     misha    2350:   case 128:
1.177   ! moko     2351: #line 742 "compile.y" /* yacc.c:1646  */
1.163     moko     2352:     { (yyval) = (yyvsp[-1]); }
1.177   ! moko     2353: #line 2354 "compile.tab.C" /* yacc.c:1646  */
1.114     misha    2354:     break;
                   2355: 
1.115     misha    2356:   case 129:
1.177   ! moko     2357: #line 743 "compile.y" /* yacc.c:1646  */
1.163     moko     2358:     { (yyval) = (yyvsp[-1]); }
1.177   ! moko     2359: #line 2360 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2360:     break;
                   2361: 
1.115     misha    2362:   case 130:
1.177   ! moko     2363: #line 744 "compile.y" /* yacc.c:1646  */
1.163     moko     2364:     { (yyval) = (yyvsp[-1]); }
1.177   ! moko     2365: #line 2366 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2366:     break;
                   2367: 
1.115     misha    2368:   case 131:
1.177   ! moko     2369: #line 746 "compile.y" /* yacc.c:1646  */
1.163     moko     2370:     { (yyval)=(yyvsp[0]);  O(*(yyval), OP::OP_NEG); }
1.177   ! moko     2371: #line 2372 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2372:     break;
                   2373: 
1.115     misha    2374:   case 132:
1.177   ! moko     2375: #line 747 "compile.y" /* yacc.c:1646  */
1.163     moko     2376:     { (yyval)=(yyvsp[0]); }
1.177   ! moko     2377: #line 2378 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2378:     break;
                   2379: 
1.115     misha    2380:   case 133:
1.177   ! moko     2381: #line 748 "compile.y" /* yacc.c:1646  */
1.163     moko     2382:     { (yyval)=(yyvsp[0]);       O(*(yyval), OP::OP_INV); }
1.177   ! moko     2383: #line 2384 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2384:     break;
                   2385: 
1.115     misha    2386:   case 134:
1.177   ! moko     2387: #line 749 "compile.y" /* yacc.c:1646  */
1.163     moko     2388:     { (yyval)=(yyvsp[0]);  O(*(yyval), OP::OP_NOT); }
1.177   ! moko     2389: #line 2390 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2390:     break;
                   2391: 
1.115     misha    2392:   case 135:
1.177   ! moko     2393: #line 750 "compile.y" /* yacc.c:1646  */
1.163     moko     2394:     { (yyval)=(yyvsp[0]);  O(*(yyval), OP::OP_DEF); }
1.177   ! moko     2395: #line 2396 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2396:     break;
                   2397: 
1.115     misha    2398:   case 136:
1.177   ! moko     2399: #line 751 "compile.y" /* yacc.c:1646  */
1.163     moko     2400:     { (yyval)=(yyvsp[0]);  O(*(yyval), OP::OP_IN); }
1.177   ! moko     2401: #line 2402 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2402:     break;
                   2403: 
1.115     misha    2404:   case 137:
1.177   ! moko     2405: #line 752 "compile.y" /* yacc.c:1646  */
1.163     moko     2406:     { (yyval)=(yyvsp[0]);  O(*(yyval), OP::OP_FEXISTS); }
1.177   ! moko     2407: #line 2408 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2408:     break;
                   2409: 
1.115     misha    2410:   case 138:
1.177   ! moko     2411: #line 753 "compile.y" /* yacc.c:1646  */
1.163     moko     2412:     { (yyval)=(yyvsp[0]);  O(*(yyval), OP::OP_DEXISTS); }
1.177   ! moko     2413: #line 2414 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2414:     break;
                   2415: 
1.115     misha    2416:   case 139:
1.177   ! moko     2417: #line 755 "compile.y" /* yacc.c:1646  */
1.163     moko     2418:     {  (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_SUB); }
1.177   ! moko     2419: #line 2420 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2420:     break;
                   2421: 
1.115     misha    2422:   case 140:
1.177   ! moko     2423: #line 756 "compile.y" /* yacc.c:1646  */
1.163     moko     2424:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_ADD); }
1.177   ! moko     2425: #line 2426 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2426:     break;
                   2427: 
1.115     misha    2428:   case 141:
1.177   ! moko     2429: #line 757 "compile.y" /* yacc.c:1646  */
1.163     moko     2430:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_MUL); }
1.177   ! moko     2431: #line 2432 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2432:     break;
                   2433: 
1.115     misha    2434:   case 142:
1.177   ! moko     2435: #line 758 "compile.y" /* yacc.c:1646  */
1.163     moko     2436:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_DIV); }
1.177   ! moko     2437: #line 2438 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2438:     break;
                   2439: 
1.115     misha    2440:   case 143:
1.177   ! moko     2441: #line 759 "compile.y" /* yacc.c:1646  */
1.163     moko     2442:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_MOD); }
1.177   ! moko     2443: #line 2444 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2444:     break;
                   2445: 
1.115     misha    2446:   case 144:
1.177   ! moko     2447: #line 760 "compile.y" /* yacc.c:1646  */
1.163     moko     2448:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_INTDIV); }
1.177   ! moko     2449: #line 2450 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2450:     break;
                   2451: 
1.115     misha    2452:   case 145:
1.177   ! moko     2453: #line 761 "compile.y" /* yacc.c:1646  */
1.163     moko     2454:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_BIN_SL); }
1.177   ! moko     2455: #line 2456 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2456:     break;
                   2457: 
1.115     misha    2458:   case 146:
1.177   ! moko     2459: #line 762 "compile.y" /* yacc.c:1646  */
1.163     moko     2460:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_BIN_SR); }
1.177   ! moko     2461: #line 2462 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2462:     break;
                   2463: 
1.115     misha    2464:   case 147:
1.177   ! moko     2465: #line 763 "compile.y" /* yacc.c:1646  */
1.163     moko     2466:     { (yyval)=(yyvsp[-2]);     P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_BIN_AND); }
1.177   ! moko     2467: #line 2468 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2468:     break;
                   2469: 
1.115     misha    2470:   case 148:
1.177   ! moko     2471: #line 764 "compile.y" /* yacc.c:1646  */
1.163     moko     2472:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_BIN_OR); }
1.177   ! moko     2473: #line 2474 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2474:     break;
                   2475: 
1.115     misha    2476:   case 149:
1.177   ! moko     2477: #line 765 "compile.y" /* yacc.c:1646  */
1.163     moko     2478:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_BIN_XOR); }
1.177   ! moko     2479: #line 2480 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2480:     break;
                   2481: 
1.115     misha    2482:   case 150:
1.177   ! moko     2483: #line 766 "compile.y" /* yacc.c:1646  */
1.163     moko     2484:     { (yyval)=(yyvsp[-2]);  OA(*(yyval), OP::OP_NESTED_CODE, (yyvsp[0]));  O(*(yyval), OP::OP_LOG_AND); }
1.177   ! moko     2485: #line 2486 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2486:     break;
                   2487: 
1.115     misha    2488:   case 151:
1.177   ! moko     2489: #line 767 "compile.y" /* yacc.c:1646  */
1.163     moko     2490:     { (yyval)=(yyvsp[-2]);  OA(*(yyval), OP::OP_NESTED_CODE, (yyvsp[0]));  O(*(yyval), OP::OP_LOG_OR); }
1.177   ! moko     2491: #line 2492 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2492:     break;
                   2493: 
1.115     misha    2494:   case 152:
1.177   ! moko     2495: #line 768 "compile.y" /* yacc.c:1646  */
1.163     moko     2496:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_LOG_XOR); }
1.177   ! moko     2497: #line 2498 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2498:     break;
                   2499: 
1.115     misha    2500:   case 153:
1.177   ! moko     2501: #line 769 "compile.y" /* yacc.c:1646  */
1.163     moko     2502:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_NUM_LT); }
1.177   ! moko     2503: #line 2504 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2504:     break;
                   2505: 
1.115     misha    2506:   case 154:
1.177   ! moko     2507: #line 770 "compile.y" /* yacc.c:1646  */
1.163     moko     2508:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_NUM_GT); }
1.177   ! moko     2509: #line 2510 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2510:     break;
                   2511: 
1.115     misha    2512:   case 155:
1.177   ! moko     2513: #line 771 "compile.y" /* yacc.c:1646  */
1.163     moko     2514:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_NUM_LE); }
1.177   ! moko     2515: #line 2516 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2516:     break;
                   2517: 
1.115     misha    2518:   case 156:
1.177   ! moko     2519: #line 772 "compile.y" /* yacc.c:1646  */
1.163     moko     2520:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_NUM_GE); }
1.177   ! moko     2521: #line 2522 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2522:     break;
                   2523: 
1.115     misha    2524:   case 157:
1.177   ! moko     2525: #line 773 "compile.y" /* yacc.c:1646  */
1.163     moko     2526:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_NUM_EQ); }
1.177   ! moko     2527: #line 2528 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2528:     break;
                   2529: 
1.115     misha    2530:   case 158:
1.177   ! moko     2531: #line 774 "compile.y" /* yacc.c:1646  */
1.163     moko     2532:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_NUM_NE); }
1.177   ! moko     2533: #line 2534 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2534:     break;
                   2535: 
1.115     misha    2536:   case 159:
1.177   ! moko     2537: #line 775 "compile.y" /* yacc.c:1646  */
1.163     moko     2538:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_STR_LT); }
1.177   ! moko     2539: #line 2540 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2540:     break;
                   2541: 
1.115     misha    2542:   case 160:
1.177   ! moko     2543: #line 776 "compile.y" /* yacc.c:1646  */
1.163     moko     2544:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_STR_GT); }
1.177   ! moko     2545: #line 2546 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2546:     break;
                   2547: 
1.115     misha    2548:   case 161:
1.177   ! moko     2549: #line 777 "compile.y" /* yacc.c:1646  */
1.163     moko     2550:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_STR_LE); }
1.177   ! moko     2551: #line 2552 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2552:     break;
                   2553: 
1.115     misha    2554:   case 162:
1.177   ! moko     2555: #line 778 "compile.y" /* yacc.c:1646  */
1.163     moko     2556:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_STR_GE); }
1.177   ! moko     2557: #line 2558 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2558:     break;
                   2559: 
1.115     misha    2560:   case 163:
1.177   ! moko     2561: #line 779 "compile.y" /* yacc.c:1646  */
1.163     moko     2562:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_STR_EQ); }
1.177   ! moko     2563: #line 2564 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2564:     break;
                   2565: 
1.115     misha    2566:   case 164:
1.177   ! moko     2567: #line 780 "compile.y" /* yacc.c:1646  */
1.163     moko     2568:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_STR_NE); }
1.177   ! moko     2569: #line 2570 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2570:     break;
                   2571: 
1.115     misha    2572:   case 165:
1.177   ! moko     2573: #line 781 "compile.y" /* yacc.c:1646  */
1.163     moko     2574:     { (yyval)=(yyvsp[-2]);  P(*(yyval), *(yyvsp[0]));  O(*(yyval), OP::OP_IS); }
1.177   ! moko     2575: #line 2576 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2576:     break;
                   2577: 
1.115     misha    2578:   case 166:
1.177   ! moko     2579: #line 784 "compile.y" /* yacc.c:1646  */
1.112     paf      2580:     {
1.131     misha    2581:        // optimized OP_STRING => OP_VALUE for doubles
1.163     moko     2582:        maybe_change_string_literal_to_double_literal(*((yyval)=(yyvsp[0])));
1.158     misha    2583: }
1.177   ! moko     2584: #line 2585 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2585:     break;
                   2586: 
1.115     misha    2587:   case 167:
1.177   ! moko     2588: #line 789 "compile.y" /* yacc.c:1646  */
1.112     paf      2589:     {
1.131     misha    2590: #ifdef OPTIMIZE_BYTECODE_STRING_POOL
                   2591:        // it brakes ^if(" 09 "){...}
1.163     moko     2592:        YYSTYPE code=(yyvsp[0]);
1.156     moko     2593:        (yyval)=N();
1.159     misha    2594:        if(code->count()==3 && change_first(*code, OP::OP_STRING__WRITE, OP::OP_VALUE)){
1.131     misha    2595:                // optimized OP_STRING__WRITE+origin+value => OP_VALUE+origin+value without starting OP_STRING_POOL
1.156     moko     2596:                P(*(yyval), *code);
1.131     misha    2597:        } else {
1.156     moko     2598:                OA(*(yyval), OP::OP_STRING_POOL, code); /* stack: empty write context */
1.131     misha    2599:        }
                   2600: #else
1.156     moko     2601:        (yyval)=N();
1.163     moko     2602:        OA(*(yyval), OP::OP_STRING_POOL, (yyvsp[0])); /* stack: empty write context */
1.131     misha    2603: #endif
1.47      paf      2604:        /* some code that writes to that context */
                   2605:        /* context=pop; stack: context.get_string() */
1.158     misha    2606: }
1.177   ! moko     2607: #line 2608 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2608:     break;
                   2609: 
1.115     misha    2610:   case 168:
1.177   ! moko     2611: #line 810 "compile.y" /* yacc.c:1646  */
1.112     paf      2612:     {
1.131     misha    2613:        // optimized OP_STRING+OP_WRITE_VALUE => OP_STRING__WRITE
1.163     moko     2614:        change_string_literal_to_write_string_literal(*((yyval)=(yyvsp[0])));
1.158     misha    2615: }
1.177   ! moko     2616: #line 2617 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2617:     break;
                   2618: 
1.115     misha    2619:   case 169:
1.177   ! moko     2620: #line 815 "compile.y" /* yacc.c:1646  */
1.158     misha    2621:     { (yyval)=VL(/*we know that we will not change it*/const_cast<VString*>(&vempty), 0, 0, 0); }
1.177   ! moko     2622: #line 2623 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2623:     break;
                   2624: 
1.115     misha    2625:   case 170:
1.177   ! moko     2626: #line 816 "compile.y" /* yacc.c:1646  */
1.158     misha    2627:     { (yyval) = VL(/*we know that we will not change it*/const_cast<VBool*>(&vtrue), 0, 0, 0); }
1.177   ! moko     2628: #line 2629 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2629:     break;
                   2630: 
1.115     misha    2631:   case 171:
1.177   ! moko     2632: #line 817 "compile.y" /* yacc.c:1646  */
1.158     misha    2633:     { (yyval) = VL(/*we know that we will not change it*/const_cast<VBool*>(&vfalse), 0, 0, 0); }
1.177   ! moko     2634: #line 2635 "compile.tab.C" /* yacc.c:1646  */
1.112     paf      2635:     break;
                   2636: 
1.115     misha    2637:   case 172:
1.177   ! moko     2638: #line 819 "compile.y" /* yacc.c:1646  */
1.158     misha    2639:     { (yyval)=N(); }
1.177   ! moko     2640: #line 2641 "compile.tab.C" /* yacc.c:1646  */
1.155     misha    2641:     break;
1.154     moko     2642: 
1.112     paf      2643: 
1.177   ! moko     2644: #line 2645 "compile.tab.C" /* yacc.c:1646  */
1.156     moko     2645:       default: break;
1.155     misha    2646:     }
1.158     misha    2647:   /* User semantic actions sometimes alter yychar, and that requires
                   2648:      that yytoken be updated with the new translation.  We take the
                   2649:      approach of translating immediately before every use of yytoken.
                   2650:      One alternative is translating here after every semantic action,
                   2651:      but that translation would be missed if the semantic action invokes
                   2652:      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
                   2653:      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
                   2654:      incorrect destructor might then be invoked immediately.  In the
                   2655:      case of YYERROR or YYBACKUP, subsequent parser actions might lead
                   2656:      to an incorrect destructor call or verbose syntax error message
                   2657:      before the lookahead is translated.  */
1.156     moko     2658:   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1.112     paf      2659: 
1.156     moko     2660:   YYPOPSTACK (yylen);
                   2661:   yylen = 0;
1.112     paf      2662:   YY_STACK_PRINT (yyss, yyssp);
1.1       parser   2663: 
                   2664:   *++yyvsp = yyval;
                   2665: 
1.163     moko     2666:   /* Now 'shift' the result of the reduction.  Determine what state
1.112     paf      2667:      that goes to, based on the state we popped back to and the rule
                   2668:      number reduced by.  */
1.1       parser   2669: 
                   2670:   yyn = yyr1[yyn];
                   2671: 
1.112     paf      2672:   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
                   2673:   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1.1       parser   2674:     yystate = yytable[yystate];
                   2675:   else
1.112     paf      2676:     yystate = yydefgoto[yyn - YYNTOKENS];
1.1       parser   2677: 
                   2678:   goto yynewstate;
                   2679: 
                   2680: 
1.163     moko     2681: /*--------------------------------------.
                   2682: | yyerrlab -- here on detecting error.  |
                   2683: `--------------------------------------*/
1.112     paf      2684: yyerrlab:
1.158     misha    2685:   /* Make sure we have latest lookahead translation.  See comments at
                   2686:      user semantic actions for why this is necessary.  */
                   2687:   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
                   2688: 
1.112     paf      2689:   /* If not already recovering from an error, report this error.  */
                   2690:   if (!yyerrstatus)
1.1       parser   2691:     {
                   2692:       ++yynerrs;
1.156     moko     2693: #if ! YYERROR_VERBOSE
1.163     moko     2694:       yyerror (pc, YY_("syntax error"));
1.156     moko     2695: #else
1.158     misha    2696: # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
                   2697:                                         yyssp, yytoken)
1.156     moko     2698:       {
1.158     misha    2699:         char const *yymsgp = YY_("syntax error");
                   2700:         int yysyntax_error_status;
                   2701:         yysyntax_error_status = YYSYNTAX_ERROR;
                   2702:         if (yysyntax_error_status == 0)
                   2703:           yymsgp = yymsg;
                   2704:         else if (yysyntax_error_status == 1)
                   2705:           {
                   2706:             if (yymsg != yymsgbuf)
                   2707:               YYSTACK_FREE (yymsg);
                   2708:             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
                   2709:             if (!yymsg)
                   2710:               {
                   2711:                 yymsg = yymsgbuf;
                   2712:                 yymsg_alloc = sizeof yymsgbuf;
                   2713:                 yysyntax_error_status = 2;
                   2714:               }
                   2715:             else
                   2716:               {
                   2717:                 yysyntax_error_status = YYSYNTAX_ERROR;
                   2718:                 yymsgp = yymsg;
                   2719:               }
                   2720:           }
1.163     moko     2721:         yyerror (pc, yymsgp);
1.158     misha    2722:         if (yysyntax_error_status == 2)
                   2723:           goto yyexhaustedlab;
1.156     moko     2724:       }
1.158     misha    2725: # undef YYSYNTAX_ERROR
1.156     moko     2726: #endif
1.1       parser   2727:     }
                   2728: 
1.112     paf      2729: 
1.1       parser   2730: 
                   2731:   if (yyerrstatus == 3)
                   2732:     {
1.112     paf      2733:       /* If just tried and failed to reuse lookahead token after an
1.163     moko     2734:          error, discard it.  */
1.109     paf      2735: 
1.113     paf      2736:       if (yychar <= YYEOF)
1.163     moko     2737:         {
                   2738:           /* Return failure if at end of input.  */
                   2739:           if (yychar == YYEOF)
                   2740:             YYABORT;
                   2741:         }
1.113     paf      2742:       else
1.163     moko     2743:         {
                   2744:           yydestruct ("Error: discarding",
                   2745:                       yytoken, &yylval, pc);
                   2746:           yychar = YYEMPTY;
                   2747:         }
1.106     paf      2748:     }
1.1       parser   2749: 
1.112     paf      2750:   /* Else will try to reuse lookahead token after shifting the error
                   2751:      token.  */
                   2752:   goto yyerrlab1;
1.109     paf      2753: 
1.1       parser   2754: 
1.113     paf      2755: /*---------------------------------------------------.
                   2756: | yyerrorlab -- error raised explicitly by YYERROR.  |
                   2757: `---------------------------------------------------*/
                   2758: yyerrorlab:
                   2759: 
1.156     moko     2760:   /* Pacify compilers like GCC when the user code never invokes
                   2761:      YYERROR and the label yyerrorlab therefore never appears in user
                   2762:      code.  */
                   2763:   if (/*CONSTCOND*/ 0)
1.113     paf      2764:      goto yyerrorlab;
                   2765: 
1.163     moko     2766:   /* Do not reclaim the symbols of the rule whose action triggered
1.156     moko     2767:      this YYERROR.  */
                   2768:   YYPOPSTACK (yylen);
                   2769:   yylen = 0;
                   2770:   YY_STACK_PRINT (yyss, yyssp);
1.113     paf      2771:   yystate = *yyssp;
                   2772:   goto yyerrlab1;
                   2773: 
                   2774: 
                   2775: /*-------------------------------------------------------------.
                   2776: | yyerrlab1 -- common code for both syntax error and YYERROR.  |
                   2777: `-------------------------------------------------------------*/
1.112     paf      2778: yyerrlab1:
1.163     moko     2779:   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1.1       parser   2780: 
1.112     paf      2781:   for (;;)
1.109     paf      2782:     {
1.112     paf      2783:       yyn = yypact[yystate];
1.158     misha    2784:       if (!yypact_value_is_default (yyn))
1.163     moko     2785:         {
                   2786:           yyn += YYTERROR;
                   2787:           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
                   2788:             {
                   2789:               yyn = yytable[yyn];
                   2790:               if (0 < yyn)
                   2791:                 break;
                   2792:             }
                   2793:         }
1.1       parser   2794: 
1.112     paf      2795:       /* Pop the current state because it cannot handle the error token.  */
                   2796:       if (yyssp == yyss)
1.163     moko     2797:         YYABORT;
1.1       parser   2798: 
1.156     moko     2799: 
                   2800:       yydestruct ("Error: popping",
1.163     moko     2801:                   yystos[yystate], yyvsp, pc);
1.156     moko     2802:       YYPOPSTACK (1);
1.113     paf      2803:       yystate = *yyssp;
1.112     paf      2804:       YY_STACK_PRINT (yyss, yyssp);
1.1       parser   2805:     }
                   2806: 
1.163     moko     2807:   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1.156     moko     2808:   *++yyvsp = yylval;
1.163     moko     2809:   YY_IGNORE_MAYBE_UNINITIALIZED_END
1.155     misha    2810: 
1.1       parser   2811: 
1.156     moko     2812:   /* Shift the error token.  */
                   2813:   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1.112     paf      2814: 
1.1       parser   2815:   yystate = yyn;
                   2816:   goto yynewstate;
                   2817: 
                   2818: 
1.112     paf      2819: /*-------------------------------------.
                   2820: | yyacceptlab -- YYACCEPT comes here.  |
                   2821: `-------------------------------------*/
                   2822: yyacceptlab:
                   2823:   yyresult = 0;
                   2824:   goto yyreturn;
                   2825: 
                   2826: /*-----------------------------------.
                   2827: | yyabortlab -- YYABORT comes here.  |
                   2828: `-----------------------------------*/
                   2829: yyabortlab:
                   2830:   yyresult = 1;
                   2831:   goto yyreturn;
                   2832: 
1.163     moko     2833: #if !defined yyoverflow || YYERROR_VERBOSE
1.156     moko     2834: /*-------------------------------------------------.
                   2835: | yyexhaustedlab -- memory exhaustion comes here.  |
                   2836: `-------------------------------------------------*/
                   2837: yyexhaustedlab:
1.163     moko     2838:   yyerror (pc, YY_("memory exhausted"));
1.112     paf      2839:   yyresult = 2;
                   2840:   /* Fall through.  */
                   2841: #endif
                   2842: 
                   2843: yyreturn:
1.156     moko     2844:   if (yychar != YYEMPTY)
1.158     misha    2845:     {
                   2846:       /* Make sure we have latest lookahead translation.  See comments at
                   2847:          user semantic actions for why this is necessary.  */
                   2848:       yytoken = YYTRANSLATE (yychar);
                   2849:       yydestruct ("Cleanup: discarding lookahead",
1.163     moko     2850:                   yytoken, &yylval, pc);
1.158     misha    2851:     }
1.163     moko     2852:   /* Do not reclaim the symbols of the rule whose action triggered
1.156     moko     2853:      this YYABORT or YYACCEPT.  */
                   2854:   YYPOPSTACK (yylen);
                   2855:   YY_STACK_PRINT (yyss, yyssp);
                   2856:   while (yyssp != yyss)
                   2857:     {
                   2858:       yydestruct ("Cleanup: popping",
1.163     moko     2859:                   yystos[*yyssp], yyvsp, pc);
1.156     moko     2860:       YYPOPSTACK (1);
                   2861:     }
1.112     paf      2862: #ifndef yyoverflow
                   2863:   if (yyss != yyssa)
                   2864:     YYSTACK_FREE (yyss);
1.1       parser   2865: #endif
1.156     moko     2866: #if YYERROR_VERBOSE
                   2867:   if (yymsg != yymsgbuf)
                   2868:     YYSTACK_FREE (yymsg);
                   2869: #endif
1.163     moko     2870:   return yyresult;
1.1       parser   2871: }
1.177   ! moko     2872: #line 821 "compile.y" /* yacc.c:1906  */
1.1       parser   2873: 
                   2874: #endif
                   2875: 
                   2876: /*
                   2877:        000$111(2222)00 
                   2878:                000$111{3333}00
                   2879:        $,^: push,=0
                   2880:        1:( { break=pop
                   2881:        2:( )  pop
                   2882:        3:{ }  pop
                   2883: 
                   2884:        000^111(2222)4444{33333}4000
                   2885:        $,^: push,=0
                   2886:        1:( { break=pop
                   2887:        2:( )=4
                   2888:        3:{ }=4
                   2889:                4:[^({]=pop
                   2890: */
                   2891: 
1.84      paf      2892: inline void ungetc(Parse_control& pc, uint last_line_end_col) {
                   2893:        pc.source--;
                   2894:        if(pc.pos.col==0) {
                   2895:                --pc.pos.line; pc.pos.col=last_line_end_col;
                   2896:        } else
                   2897:                --pc.pos.col;
                   2898: 
                   2899: }
                   2900: static int yylex(YYSTYPE *lvalp, void *apc) {
                   2901:        register Parse_control& pc=*static_cast<Parse_control*>(apc);
                   2902: 
                   2903:        #define lexical_brackets_nestage pc.brackets_nestages[pc.ls_sp]
1.1       parser   2904:        #define RC {result=c; goto break2; }
                   2905: 
1.84      paf      2906:        register int c;
                   2907:        int result;
1.1       parser   2908:        
1.84      paf      2909:        if(pc.pending_state) {
                   2910:                result=pc.pending_state;
                   2911:                pc.pending_state=0;
1.1       parser   2912:                return result;
                   2913:        }
                   2914:        
1.84      paf      2915:        const char *begin=pc.source;
                   2916:        Pos begin_pos=pc.pos;
1.1       parser   2917:        const char *end;
                   2918:        int skip_analized=0;
                   2919:        while(true) {
1.84      paf      2920:                c=*(end=(pc.source++));
                   2921: //             fprintf(stderr, "\nchar: %c %02X; nestage: %d, sp=%d", c, c, lexical_brackets_nestage, pc.sp);
1.1       parser   2922: 
1.96      paf      2923:                if(c=='\n')
1.84      paf      2924:                        pc.pos_next_line();
1.96      paf      2925:                else
1.84      paf      2926:                        pc.pos_next_c(c);
1.96      paf      2927: //             fprintf(stderr, "\nchar: %c file(%d:%d)", c, pc.pos.line, pc.pos.col);
1.1       parser   2928: 
1.96      paf      2929:                if(pc.pos.col==0+1 && c=='@') {
1.84      paf      2930:                        if(pc.ls==LS_DEF_SPECIAL_BODY) {
1.31      paf      2931:                                // @SPECIAL
                   2932:                                // ...
                   2933:                                // @<here = 
1.84      paf      2934:                                pop_LS(pc); // exiting from LS_DEF_SPECIAL_BODY state
1.31      paf      2935:                        } // continuing checks
1.84      paf      2936:                        if(pc.ls==LS_USER) {
                   2937:                                push_LS(pc, LS_DEF_NAME);
1.20      parser   2938:                                RC;
1.31      paf      2939:                        } else // @ in first column inside some code [when could that be?]
1.20      parser   2940:                                result=BAD_METHOD_DECL_START;
                   2941:                        goto break2;
1.97      paf      2942:                }
                   2943:                if(c=='^') {
1.84      paf      2944:                        if(pc.ls==LS_METHOD_AFTER) {
1.75      paf      2945:                                // handle after-method situation
1.84      paf      2946:                                pop_LS(pc);
1.75      paf      2947:                                result=EON;
                   2948:                                skip_analized=-1; // return to punctuation afterwards to assure it's literality
                   2949:                                goto break2;
                   2950:                        }
1.84      paf      2951:                        switch(pc.ls) {
1.15      parser   2952: case LS_EXPRESSION_VAR_NAME_WITH_COLON:
                   2953: case LS_EXPRESSION_VAR_NAME_WITHOUT_COLON:
                   2954: case LS_VAR_NAME_SIMPLE_WITH_COLON:
                   2955: case LS_VAR_NAME_SIMPLE_WITHOUT_COLON:
                   2956: case LS_VAR_NAME_CURLY:
                   2957: case LS_METHOD_NAME:
1.66      paf      2958: case LS_USER_COMMENT:
1.15      parser   2959: case LS_DEF_COMMENT:
                   2960:        // no literals in names, please
                   2961:        break;
                   2962: default:
1.84      paf      2963:                        switch(*pc.source) {
1.10      parser   2964:                        // ^escaping some punctuators
1.121     misha    2965:                        case '^': case '$': case ';': case '@':
1.1       parser   2966:                        case '(': case ')':
                   2967:                        case '[': case ']':
                   2968:                        case '{': case '}':
1.23      parser   2969:                        case '"':  case ':':
1.1       parser   2970:                                if(end!=begin) {
1.84      paf      2971:                                        if(!pc.string_start)
                   2972:                                                pc.string_start=begin_pos;
1.1       parser   2973:                                        // append piece till ^
1.84      paf      2974:                                        pc.string.append_strdup_know_length(begin, end-begin);
1.1       parser   2975:                                }
                   2976:                                // reset piece 'begin' position & line
1.84      paf      2977:                                begin=pc.source; // ->punctuation
                   2978:                                begin_pos=pc.pos;
1.75      paf      2979:                                // skip over _ after ^
1.84      paf      2980:                                pc.source++;  pc.pos.col++;
1.75      paf      2981:                                // skip analysis = forced literal
                   2982:                                continue;
1.1       parser   2983: 
                   2984:                        // converting ^#HH into char(hex(HH))
                   2985:                        case '#':
                   2986:                                if(end!=begin) {
1.84      paf      2987:                                        if(!pc.string_start)
                   2988:                                                pc.string_start=begin_pos;
1.1       parser   2989:                                        // append piece till ^
1.84      paf      2990:                                        pc.string.append_strdup_know_length(begin, end-begin);
1.1       parser   2991:                                }
                   2992:                                // #HH ?
1.121     misha    2993:                                if(pc.source[1] && isxdigit(pc.source[1]) && pc.source[2] && isxdigit(pc.source[2])) {
1.110     paf      2994:                                        char c=(char)(
1.84      paf      2995:                                                hex_value[(unsigned char)pc.source[1]]*0x10+
1.110     paf      2996:                                                hex_value[(unsigned char)pc.source[2]]);
1.84      paf      2997:                                        if(c==0) {
1.1       parser   2998:                                                result=BAD_HEX_LITERAL;
                   2999:                                                goto break2; // wrong hex value[no ^#00 chars allowed]: bail out
                   3000:                                        }
                   3001:                                        // append char(hex(HH))
1.84      paf      3002:                                        pc.string.append(c);
1.1       parser   3003:                                        // skip over ^#HH
1.84      paf      3004:                                        pc.source+=3;
                   3005:                                        pc.pos.col+=3;
1.1       parser   3006:                                        // reset piece 'begin' position & line
1.84      paf      3007:                                        begin=pc.source; // ->after ^#HH
                   3008:                                        begin_pos=pc.pos;
1.75      paf      3009:                                        // skip analysis = forced literal
1.1       parser   3010:                                        continue;
                   3011:                                }
1.121     misha    3012:                                // just escaped char
                   3013:                                // reset piece 'begin' position & line
                   3014:                                begin=pc.source;
                   3015:                                begin_pos=pc.pos;
                   3016:                                // skip over _ after ^
                   3017:                                pc.source++;  pc.pos.col++;
                   3018:                                // skip analysis = forced literal
                   3019:                                continue;
1.1       parser   3020:                        }
1.15      parser   3021:                        break;
1.75      paf      3022:                        }
1.15      parser   3023:                }
1.1       parser   3024:                // #comment  start skipping
1.84      paf      3025:                if(c=='#' && pc.pos.col==1) {
1.1       parser   3026:                        if(end!=begin) {
1.84      paf      3027:                                if(!pc.string_start)
                   3028:                                        pc.string_start=begin_pos;
1.1       parser   3029:                                // append piece till #
1.84      paf      3030:                                pc.string.append_strdup_know_length(begin, end-begin);
1.1       parser   3031:                        }
                   3032:                        // fall into COMMENT lexical state [wait for \n]
1.84      paf      3033:                        push_LS(pc, LS_USER_COMMENT);
1.31      paf      3034:                        continue;
1.1       parser   3035:                }
1.84      paf      3036:                switch(pc.ls) {
1.1       parser   3037: 
                   3038:                // USER'S = NOT OURS
                   3039:                case LS_USER:
1.84      paf      3040:                case LS_NAME_SQUARE_PART: // name.[here].xxx
                   3041:                        if(pc.trim_bof)
1.1       parser   3042:                                switch(c) {
                   3043:                                case '\n': case ' ': case '\t':
1.84      paf      3044:                                        begin=pc.source;
                   3045:                                        begin_pos=pc.pos;
1.1       parser   3046:                                        continue; // skip it
                   3047:                                default:
1.84      paf      3048:                                        pc.trim_bof=false;
1.1       parser   3049:                                }
                   3050:                        switch(c) {
                   3051:                        case '$':
1.84      paf      3052:                                push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1       parser   3053:                                RC;
                   3054:                        case '^':
1.84      paf      3055:                                push_LS(pc, LS_METHOD_NAME);
1.1       parser   3056:                                RC;
1.11      parser   3057:                        case ']':
1.84      paf      3058:                                if(pc.ls==LS_NAME_SQUARE_PART)
1.11      parser   3059:                                        if(--lexical_brackets_nestage==0) {// $name.[co<]?>de<]?>
1.84      paf      3060:                                                pop_LS(pc); // $name.[co<]>de<]!>
1.11      parser   3061:                                                RC;
                   3062:                                        }
1.3       parser   3063:                                break;
1.11      parser   3064:                        case '[': // $name.[co<[>de]
1.84      paf      3065:                                if(pc.ls==LS_NAME_SQUARE_PART)
1.11      parser   3066:                                        lexical_brackets_nestage++;
1.4       parser   3067:                                break;
1.1       parser   3068:                        }
1.97      paf      3069:                        if(pc.explicit_result && c)
                   3070:                                switch(c) {
1.168     moko     3071:                                default:
                   3072:                                        pc.string.append(c);
1.97      paf      3073:                                case '\n': case ' ': case '\t':
                   3074:                                        begin=pc.source;
                   3075:                                        begin_pos=pc.pos;
1.168     moko     3076:                                        continue;
1.97      paf      3077:                                }
1.1       parser   3078:                        break;
                   3079:                        
                   3080:                // #COMMENT
1.66      paf      3081:                case LS_USER_COMMENT:
1.1       parser   3082:                        if(c=='\n') {
                   3083:                                // skip comment
1.84      paf      3084:                                begin=pc.source;
                   3085:                                begin_pos=pc.pos;
1.1       parser   3086: 
1.84      paf      3087:                                pop_LS(pc);
1.1       parser   3088:                                continue;
                   3089:                        }
                   3090:                        break;
                   3091:                        
                   3092:                // STRING IN EXPRESSION
                   3093:                case LS_EXPRESSION_STRING_QUOTED:
                   3094:                case LS_EXPRESSION_STRING_APOSTROFED:
                   3095:                        switch(c) {
                   3096:                        case '"':
                   3097:                        case '\'':
                   3098:                                if(
1.162     moko     3099:                                        (pc.ls == LS_EXPRESSION_STRING_QUOTED && c=='"') ||
                   3100:                                        (pc.ls == LS_EXPRESSION_STRING_APOSTROFED && c=='\'') ) {
1.84      paf      3101:                                        pop_LS(pc); //"abc". | 'abc'.
1.1       parser   3102:                                        RC;
                   3103:                                }
                   3104:                                break;
                   3105:                        case '$':
1.84      paf      3106:                                push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1       parser   3107:                                RC;
                   3108:                        case '^':
1.84      paf      3109:                                push_LS(pc, LS_METHOD_NAME);
1.1       parser   3110:                                RC;
                   3111:                        }
                   3112:                        break;
                   3113: 
                   3114:                // METHOD DEFINITION
                   3115:                case LS_DEF_NAME:
                   3116:                        switch(c) {
                   3117:                        case '[':
1.84      paf      3118:                                pc.ls=LS_DEF_PARAMS;
1.1       parser   3119:                                RC;
                   3120:                        case '\n':
1.84      paf      3121:                                pc.ls=LS_DEF_SPECIAL_BODY;
1.1       parser   3122:                                RC;
                   3123:                        }
                   3124:                        break;
                   3125: 
                   3126:                case LS_DEF_PARAMS:
                   3127:                        switch(c) {
1.64      paf      3128:                        case '$': // common error
1.65      paf      3129:                                result=BAD_METHOD_PARAMETER_NAME_CHARACTER;
                   3130:                                goto break2;
1.1       parser   3131:                        case ';':
                   3132:                                RC;
                   3133:                        case ']':
1.84      paf      3134:                                pc.ls=*pc.source=='['?LS_DEF_LOCALS:LS_DEF_COMMENT;
1.1       parser   3135:                                RC;
                   3136:                        case '\n': // wrong. bailing out
1.84      paf      3137:                                pop_LS(pc);
1.1       parser   3138:                                RC;
                   3139:                        }
                   3140:                        break;
                   3141: 
                   3142:                case LS_DEF_LOCALS:
                   3143:                        switch(c) {
                   3144:                        case '[':
                   3145:                        case ';':
                   3146:                                RC;
                   3147:                        case ']':
1.84      paf      3148:                                pc.ls=LS_DEF_COMMENT;
1.1       parser   3149:                                RC;
                   3150:                        case '\n': // wrong. bailing out
1.84      paf      3151:                                pop_LS(pc);
1.1       parser   3152:                                RC;
                   3153:                        }
                   3154:                        break;
                   3155: 
                   3156:                case LS_DEF_COMMENT:
                   3157:                        if(c=='\n') {
1.84      paf      3158:                                pop_LS(pc);
1.1       parser   3159:                                RC;
                   3160:                        }
                   3161:                        break;
                   3162: 
                   3163:                case LS_DEF_SPECIAL_BODY:
1.31      paf      3164:                        if(c=='\n')
1.1       parser   3165:                                RC;
                   3166:                        break;
                   3167: 
                   3168:                // (EXPRESSION)
                   3169:                case LS_VAR_ROUND:
                   3170:                case LS_METHOD_ROUND:
                   3171:                        switch(c) {
                   3172:                        case ')':
1.162     moko     3173:                                if(--lexical_brackets_nestage==0) {
1.84      paf      3174:                                        if(pc.ls==LS_METHOD_ROUND) // method round param ended
                   3175:                                                pc.ls=LS_METHOD_AFTER; // look for method end
                   3176:                                        else // pc.ls==LS_VAR_ROUND // variable constructor ended
                   3177:                                                pop_LS(pc); // return to normal life
1.162     moko     3178:                                }
1.1       parser   3179:                                RC;
1.66      paf      3180:                        case '#': // comment start skipping
                   3181:                                if(end!=begin) {
1.84      paf      3182:                                        if(!pc.string_start)
                   3183:                                                pc.string_start=begin_pos;
1.66      paf      3184:                                        // append piece till #
1.84      paf      3185:                                        pc.string.append_strdup_know_length(begin, end-begin);
1.66      paf      3186:                                }
                   3187:                                // fall into COMMENT lexical state [wait for \n]
1.84      paf      3188:                                push_LS(pc, LS_EXPRESSION_COMMENT);
1.66      paf      3189:                                lexical_brackets_nestage=1;
                   3190:                                continue;
1.1       parser   3191:                        case '$':
1.84      paf      3192:                                push_LS(pc, LS_EXPRESSION_VAR_NAME_WITH_COLON);                         
1.1       parser   3193:                                RC;
                   3194:                        case '^':
1.84      paf      3195:                                push_LS(pc, LS_METHOD_NAME);
1.1       parser   3196:                                RC;
                   3197:                        case '(':
                   3198:                                lexical_brackets_nestage++;
                   3199:                                RC;
                   3200:                        case '-':
1.84      paf      3201:                                switch(*pc.source) {
1.1       parser   3202:                                case 'f': // -f
                   3203:                                        skip_analized=1;
                   3204:                                        result=FEXISTS;
                   3205:                                        goto break2;
                   3206:                                case 'd': // -d
                   3207:                                        skip_analized=1;
                   3208:                                        result=DEXISTS;
                   3209:                                        goto break2;
1.63      paf      3210:                                default: // minus
1.1       parser   3211:                                        result=c;
                   3212:                                        goto break2;
                   3213:                                }
                   3214:                                goto break2;
1.25      paf      3215:                        case '+': case '*': case '/': case '%': case '\\':
1.1       parser   3216:                        case '~':
                   3217:                        case ';':
                   3218:                                RC;
1.65      paf      3219:                        case '&': case '|':
1.84      paf      3220:                                if(*pc.source==c) { // && ||
1.65      paf      3221:                                        result=c=='&'?LAND:LOR;
1.1       parser   3222:                                        skip_analized=1;
                   3223:                                } else
                   3224:                                        result=c;
                   3225:                                goto break2;
1.65      paf      3226:                        case '!':
1.84      paf      3227:                                switch(pc.source[0]) { 
1.65      paf      3228:                                case '|': // !| !||
                   3229:                                        skip_analized=1;
1.84      paf      3230:                                        if(pc.source[1]=='|') {
1.65      paf      3231:                                                skip_analized++;
                   3232:                                                result=LXOR;
                   3233:                                        } else
                   3234:                                                result=NXOR;
                   3235:                                        goto break2;
                   3236:                                case '=': // !=
                   3237:                                        skip_analized=1;
                   3238:                                        result=NNE; 
                   3239:                                        goto break2;
                   3240:                                }
                   3241:                                RC;
1.67      paf      3242: 
                   3243:                        case '<': // <<, <=, <
1.84      paf      3244:                                switch(*pc.source) {
1.67      paf      3245:                                case '<': // <[<]
                   3246:                                        skip_analized=1; result=NSL; break;
                   3247:                                case '=': // <[=]
                   3248:                                        skip_analized=1; result=NLE; break;
                   3249:                                default: // <[]
                   3250:                                        result=c; break;
                   3251:                                }
                   3252:                                goto break2;
                   3253:                        case '>': // >>, >=, >
1.84      paf      3254:                                switch(*pc.source) {
1.67      paf      3255:                                case '>': // >[>]
                   3256:                                        skip_analized=1; result=NSR; break;
                   3257:                                case '=': // >[=]
                   3258:                                        skip_analized=1; result=NGE; break;
                   3259:                                default: // >[]
                   3260:                                        result=c; break;
                   3261:                                }
                   3262:                                goto break2;
                   3263:                        case '=': // ==
1.84      paf      3264:                                switch(*pc.source) {
1.67      paf      3265:                                case '=': // =[=]
                   3266:                                        skip_analized=1; result=NEQ; break;
                   3267:                                default: // =[]
                   3268:                                        result=c; break; // not used now
                   3269:                                }
1.1       parser   3270:                                goto break2;
1.67      paf      3271: 
1.1       parser   3272:                        case '"':
1.84      paf      3273:                                push_LS(pc, LS_EXPRESSION_STRING_QUOTED);
1.1       parser   3274:                                RC;
                   3275:                        case '\'':
1.84      paf      3276:                                push_LS(pc, LS_EXPRESSION_STRING_APOSTROFED);
1.1       parser   3277:                                RC;
                   3278:                        case 'l': case 'g': case 'e': case 'n':
                   3279:                                if(end==begin) // right after whitespace
1.84      paf      3280:                                        if(isspace(pc.source[1])) {
                   3281:                                                switch(*pc.source) {
1.1       parser   3282:                                                        //                                      case '?': // ok [and bad cases, yacc would bark at them]
                   3283:                                                case 't': // lt gt [et nt]
                   3284:                                                        result=c=='l'?SLT:c=='g'?SGT:BAD_STRING_COMPARISON_OPERATOR;
                   3285:                                                        skip_analized=1;
                   3286:                                                        goto break2;
                   3287:                                                case 'e': // le ge ne [ee]
                   3288:                                                        result=c=='l'?SLE:c=='g'?SGE:c=='n'?SNE:BAD_STRING_COMPARISON_OPERATOR;
                   3289:                                                        skip_analized=1;
                   3290:                                                        goto break2;
                   3291:                                                case 'q': // eq [lq gq nq]
                   3292:                                                        result=c=='e'?SEQ:BAD_STRING_COMPARISON_OPERATOR;
                   3293:                                                        skip_analized=1;
                   3294:                                                        goto break2;
                   3295:                                                }
                   3296:                                        }
                   3297:                                break;
                   3298:                        case 'i':
                   3299:                                if(end==begin) // right after whitespace
1.84      paf      3300:                                        if(isspace(pc.source[1])) {
                   3301:                                                switch(pc.source[0]) {
1.1       parser   3302:                                                case 'n': // in
                   3303:                                                        skip_analized=1;
                   3304:                                                        result=IN;
                   3305:                                                        goto break2;
                   3306:                                                case 's': // is
                   3307:                                                        skip_analized=1;
                   3308:                                                        result=IS;
                   3309:                                                        goto break2;
                   3310:                                                }
                   3311:                                        }
                   3312:                                break;
                   3313:                        case 'd':
                   3314:                                if(end==begin) // right after whitespace
1.84      paf      3315:                                        if(pc.source[0]=='e' && pc.source[1]=='f') { // def
1.118     misha    3316:                                                switch(pc.source[2]){
                   3317:                                                case ' ': case '\t': case '\n': case '"': case '\'': case '^': case '$': // non-quoted string without whitespace after 'def' is not allowed
                   3318:                                                        skip_analized=2;
                   3319:                                                        result=DEF;
                   3320:                                                        goto break2;
                   3321:                                                }
                   3322:                                                // error: incorrect char after 'def'
1.1       parser   3323:                                        }
                   3324:                                break;
1.107     paf      3325:                        case 't':
                   3326:                                if(end==begin) // right after whitespace
1.118     misha    3327:                                        if(pc.source[0]=='r' && pc.source[1]=='u' && pc.source[2]=='e') { // true
1.107     paf      3328:                                                skip_analized=3;
                   3329:                                                result=LITERAL_TRUE;
                   3330:                                                goto break2;
                   3331:                                        }
                   3332:                                break;
                   3333:                        case 'f':
                   3334:                                if(end==begin) // right after whitespace
1.118     misha    3335:                                        if(pc.source[0]=='a' && pc.source[1]=='l' && pc.source[2]=='s' && pc.source[3]=='e') { // false
1.107     paf      3336:                                                skip_analized=4;
                   3337:                                                result=LITERAL_FALSE;
                   3338:                                                goto break2;
                   3339:                                        }
                   3340:                                break;
1.1       parser   3341:                        case ' ': case '\t': case '\n':
                   3342:                                if(end!=begin) { // there were a string after previous operator?
                   3343:                                        result=0; // return that string
                   3344:                                        goto break2;
                   3345:                                }
                   3346:                                // that's a leading|traling space or after-operator-space
                   3347:                                // ignoring it
                   3348:                                // reset piece 'begin' position & line
1.84      paf      3349:                                begin=pc.source; // after whitespace char
                   3350:                                begin_pos=pc.pos;
1.1       parser   3351:                                continue;
                   3352:                        }
                   3353:                        break;
1.66      paf      3354:                case LS_EXPRESSION_COMMENT:
                   3355:                        if(c=='(')
                   3356:                                lexical_brackets_nestage++;
                   3357:                        
1.84      paf      3358:                        switch(*pc.source) {
1.66      paf      3359:                        case '\n': case ')':
1.84      paf      3360:                                if(*pc.source==')')
1.66      paf      3361:                                        if(--lexical_brackets_nestage!=0)
                   3362:                                                continue;
                   3363: 
                   3364:                                // skip comment
1.84      paf      3365:                                begin=pc.source;
                   3366:                                begin_pos=pc.pos;
1.66      paf      3367: 
1.84      paf      3368:                                pop_LS(pc);
1.66      paf      3369:                                continue;
                   3370:                        }
                   3371:                        break;
1.1       parser   3372: 
                   3373:                // VARIABLE GET/PUT/WITH
1.11      parser   3374:                case LS_VAR_NAME_SIMPLE_WITH_COLON: 
                   3375:                case LS_VAR_NAME_SIMPLE_WITHOUT_COLON:
                   3376:                case LS_EXPRESSION_VAR_NAME_WITH_COLON: 
                   3377:                case LS_EXPRESSION_VAR_NAME_WITHOUT_COLON:
                   3378:                        if(
1.84      paf      3379:                                pc.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON ||
                   3380:                                pc.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.41      paf      3381:                                // name in expr ends also before 
1.1       parser   3382:                                switch(c) {
1.41      paf      3383:                                // expression minus
1.1       parser   3384:                                case '-': 
1.41      paf      3385:                                // expression integer division
                   3386:                                case '\\':
1.84      paf      3387:                                        pop_LS(pc);
                   3388:                                        pc.ungetc();
1.1       parser   3389:                                        result=EON;
                   3390:                                        goto break2;
                   3391:                                }
                   3392:                        }
1.11      parser   3393:                        if(
1.84      paf      3394:                                pc.ls==LS_VAR_NAME_SIMPLE_WITHOUT_COLON ||
                   3395:                                pc.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.1       parser   3396:                                // name already has ':', stop before next 
                   3397:                                switch(c) {
                   3398:                                case ':': 
1.84      paf      3399:                                        pop_LS(pc);
                   3400:                                        pc.ungetc();
1.1       parser   3401:                                        result=EON;
                   3402:                                        goto break2;
                   3403:                                }
                   3404:                        }
                   3405:                        switch(c) {
                   3406:                        case 0:
                   3407:                        case ' ': case '\t': case '\n':
                   3408:                        case ';':
                   3409:                        case ']': case '}': case ')': 
                   3410:                        case '"': case '\'':
                   3411:                        case '<': case '>':  // these stand for HTML brackets AND expression binary ops
1.146     misha    3412:                        case '+': case '*': case '/': case '\\': case '%': 
1.1       parser   3413:                        case '&': case '|': 
                   3414:                        case '=': case '!':
                   3415:                        // common delimiters
1.62      paf      3416:                        case ',': case '?': case '#':
1.113     paf      3417:                        // mysql column separators
                   3418:                        case '`':
1.1       parser   3419:                        // before call
                   3420:                        case '^': 
1.84      paf      3421:                                pop_LS(pc);
                   3422:                                pc.ungetc();
1.1       parser   3423:                                result=EON;
                   3424:                                goto break2;
                   3425:                        case '[':
1.5       parser   3426:                                // $name.<[>code]
1.84      paf      3427:                                if(pc.pos.col>1/*not first column*/ && (
1.6       parser   3428:                                        end[-1]=='$'/*was start of get*/ ||
                   3429:                                        end[-1]==':'/*was class name delim */ ||
                   3430:                                        end[-1]=='.'/*was name delim */
1.5       parser   3431:                                        )) {
1.84      paf      3432:                                        push_LS(pc, LS_NAME_SQUARE_PART);
1.5       parser   3433:                                        lexical_brackets_nestage=1;
                   3434:                                        RC;
                   3435:                                }
1.84      paf      3436:                                pc.ls=LS_VAR_SQUARE;
1.1       parser   3437:                                lexical_brackets_nestage=1;
                   3438:                                RC;
                   3439:                        case '{':
                   3440:                                if(begin==end) { // ${name}, no need of EON, switching LS
1.84      paf      3441:                                        pc.ls=LS_VAR_NAME_CURLY; 
1.1       parser   3442:                                } else {
1.84      paf      3443:                                        pc.ls=LS_VAR_CURLY;
1.1       parser   3444:                                        lexical_brackets_nestage=1;
                   3445:                                }
                   3446: 
                   3447:                                RC;
                   3448:                        case '(':
1.84      paf      3449:                                pc.ls=LS_VAR_ROUND;
1.1       parser   3450:                                lexical_brackets_nestage=1;
                   3451:                                RC;
                   3452:                        case '.': // name part delim
                   3453:                        case '$': // name part subvar
1.3       parser   3454:                        case ':': // class<:>name
1.11      parser   3455:                                // go to _WITHOUT_COLON state variant...
1.84      paf      3456:                                if(pc.ls==LS_VAR_NAME_SIMPLE_WITH_COLON)
                   3457:                                        pc.ls=LS_VAR_NAME_SIMPLE_WITHOUT_COLON;
                   3458:                                else if(pc.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON)
                   3459:                                        pc.ls=LS_EXPRESSION_VAR_NAME_WITHOUT_COLON;
1.11      parser   3460:                                // ...stop before next ':'
1.1       parser   3461:                                RC;
                   3462:                        }
                   3463:                        break;
                   3464: 
                   3465:                case LS_VAR_NAME_CURLY:
                   3466:                        switch(c) {
1.5       parser   3467:                        case '[':
1.11      parser   3468:                                // ${name.<[>code]}
1.84      paf      3469:                                push_LS(pc, LS_NAME_SQUARE_PART);
1.3       parser   3470:                                lexical_brackets_nestage=1;
                   3471:                                RC;
1.1       parser   3472:                        case '}': // ${name} finished, restoring LS
1.84      paf      3473:                                pop_LS(pc);
1.1       parser   3474:                                RC;
                   3475:                        case '.': // name part delim
                   3476:                        case '$': // name part subvar
                   3477:                        case ':': // ':name' or 'class:name'
                   3478:                                RC;
                   3479:                        }
                   3480:                        break;
                   3481: 
                   3482:                case LS_VAR_SQUARE:
                   3483:                        switch(c) {
                   3484:                        case '$':
1.84      paf      3485:                                push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1       parser   3486:                                RC;
                   3487:                        case '^':
1.84      paf      3488:                                push_LS(pc, LS_METHOD_NAME);
1.1       parser   3489:                                RC;
                   3490:                        case ']':
                   3491:                                if(--lexical_brackets_nestage==0) {
1.84      paf      3492:                                        pop_LS(pc);
1.1       parser   3493:                                        RC;
                   3494:                                }
                   3495:                                break;
                   3496:                        case ';': // operator_or_fmt;value delim
                   3497:                                RC;
                   3498:                        case '[':
                   3499:                                lexical_brackets_nestage++;
                   3500:                                break;
                   3501:                        }
                   3502:                        break;
                   3503: 
                   3504:                case LS_VAR_CURLY:
                   3505:                        switch(c) {
                   3506:                        case '$':
1.84      paf      3507:                                push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1       parser   3508:                                RC;
                   3509:                        case '^':
1.84      paf      3510:                                push_LS(pc, LS_METHOD_NAME);
1.1       parser   3511:                                RC;
                   3512:                        case '}':
                   3513:                                if(--lexical_brackets_nestage==0) {
1.84      paf      3514:                                        pop_LS(pc);
1.1       parser   3515:                                        RC;
                   3516:                                }
                   3517:                                break;
                   3518:                        case '{':
                   3519:                                lexical_brackets_nestage++;
                   3520:                                break;
                   3521:                        }
                   3522:                        break;
                   3523: 
                   3524:                // METHOD CALL
                   3525:                case LS_METHOD_NAME:
                   3526:                        switch(c) {
                   3527:                        case '[':
1.11      parser   3528:                                // ^name.<[>code].xxx
1.84      paf      3529:                                if(pc.pos.col>1/*not first column*/ && (
1.6       parser   3530:                                        end[-1]=='^'/*was start of call*/ || // never, ^[ is literal...
                   3531:                                        end[-1]==':'/*was class name delim */ ||
                   3532:                                        end[-1]=='.'/*was name delim */
1.5       parser   3533:                                        )) {
1.84      paf      3534:                                        push_LS(pc, LS_NAME_SQUARE_PART);
1.5       parser   3535:                                        lexical_brackets_nestage=1;
                   3536:                                        RC;
                   3537:                                }
1.84      paf      3538:                                pc.ls=LS_METHOD_SQUARE;
1.1       parser   3539:                                lexical_brackets_nestage=1;
                   3540:                                RC;
                   3541:                        case '{':
1.84      paf      3542:                                pc.ls=LS_METHOD_CURLY;
1.1       parser   3543:                                lexical_brackets_nestage=1;
                   3544:                                RC;
                   3545:                        case '(':
1.84      paf      3546:                                pc.ls=LS_METHOD_ROUND;
1.1       parser   3547:                                lexical_brackets_nestage=1;
                   3548:                                RC;
                   3549:                        case '.': // name part delim 
                   3550:                        case '$': // name part subvar
                   3551:                        case ':': // ':name' or 'class:name'
1.19      parser   3552:                        case '^': // ^abc^xxx wrong. bailing out
                   3553:                        case ']': case '}': case ')': // ^abc]}) wrong. bailing out
1.90      paf      3554:                        case ' ': // ^if ( wrong. bailing out
1.1       parser   3555:                                RC;
                   3556:                        }
                   3557:                        break;
                   3558: 
                   3559:                case LS_METHOD_SQUARE:
                   3560:                        switch(c) {
                   3561:                        case '$':
1.84      paf      3562:                                push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1       parser   3563:                                RC;
                   3564:                        case '^':
1.84      paf      3565:                                push_LS(pc, LS_METHOD_NAME);
1.1       parser   3566:                                RC;
                   3567:                        case ';': // param delim
                   3568:                                RC;
                   3569:                        case ']':
                   3570:                                if(--lexical_brackets_nestage==0) {
1.84      paf      3571:                                        pc.ls=LS_METHOD_AFTER;
1.1       parser   3572:                                        RC;
                   3573:                                }
                   3574:                                break;
                   3575:                        case '[':
                   3576:                                lexical_brackets_nestage++;
                   3577:                                break;
                   3578:                        }
                   3579:                        break;
                   3580: 
                   3581:                case LS_METHOD_CURLY:
                   3582:                        switch(c) {
                   3583:                        case '$':
1.84      paf      3584:                                push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1       parser   3585:                                RC;
                   3586:                        case '^':
1.84      paf      3587:                                push_LS(pc, LS_METHOD_NAME);
1.1       parser   3588:                                RC;
                   3589:                        case ';': // param delim
                   3590:                                RC;
                   3591:                        case '}':
                   3592:                                if(--lexical_brackets_nestage==0) {
1.84      paf      3593:                                        pc.ls=LS_METHOD_AFTER;
1.1       parser   3594:                                        RC;
                   3595:                                }
                   3596:                                break;
                   3597:                        case '{':
                   3598:                                lexical_brackets_nestage++;
                   3599:                                break;
                   3600:                        }
1.97      paf      3601:                        if(pc.explicit_result && c)
                   3602:                                switch(c) {
1.168     moko     3603:                                default:
                   3604:                                        pc.string.append(c);
1.97      paf      3605:                                case '\n': case ' ': case '\t':
                   3606:                                        begin=pc.source;
                   3607:                                        begin_pos=pc.pos;
1.168     moko     3608:                                        continue;
1.97      paf      3609:                                }
1.1       parser   3610:                        break;
                   3611: 
                   3612:                case LS_METHOD_AFTER:
                   3613:                        if(c=='[') {/* ][ }[ )[ */
1.84      paf      3614:                                pc.ls=LS_METHOD_SQUARE;
1.1       parser   3615:                                lexical_brackets_nestage=1;
                   3616:                                RC;
1.171     moko     3617:                        }
1.1       parser   3618:                        if(c=='{') {/* ]{ }{ ){ */
1.84      paf      3619:                                pc.ls=LS_METHOD_CURLY;
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_ROUND;
1.1       parser   3625:                                lexical_brackets_nestage=1;
                   3626:                                RC;
1.171     moko     3627:                        }
1.84      paf      3628:                        pop_LS(pc);
                   3629:                        pc.ungetc();
1.1       parser   3630:                        result=EON;
                   3631:                        goto break2;
                   3632:                }
                   3633:                if(c==0) {
                   3634:                        result=-1;
                   3635:                        break;
                   3636:                }
                   3637:        }
                   3638: 
                   3639: break2:
                   3640:        if(end!=begin) { // there is last piece?
1.150     misha    3641:                if(c=='@' || c==0) // we are before LS_DEF_NAME or EOF?
                   3642:                        while(end!=begin && end[-1]=='\n') // trim all empty lines before LS_DEF_NAME and EOF
1.1       parser   3643:                                end--;
1.84      paf      3644:                if(end!=begin && pc.ls!=LS_USER_COMMENT) { // last piece still alive and not comment?
                   3645:                        if(!pc.string_start)
                   3646:                                pc.string_start=begin_pos;
1.1       parser   3647:                        // append it
1.84      paf      3648:                        pc.string.append_strdup_know_length(begin, end-begin);
1.1       parser   3649:                }
                   3650:        }
1.84      paf      3651:        if(!pc.string.is_empty()) { // something accumulated?
                   3652:                // create STRING value: array of OP_VALUE+origin+vstring
1.170     moko     3653: #ifdef SYMBOLS_CACHING
                   3654:                Value *lookup=symbols->get(pc.string);
                   3655: #else
                   3656:                Value *lookup=0;
                   3657: #endif
1.171     moko     3658:                *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   3659:                // new pieces storage
1.84      paf      3660:                pc.string.clear();
                   3661:                pc.string_start.clear();
1.1       parser   3662:                // make current result be pending for next call, return STRING for now
1.84      paf      3663:                pc.pending_state=result;  result=STRING;
1.1       parser   3664:        }
                   3665:        if(skip_analized) {
1.84      paf      3666:                pc.source+=skip_analized;  pc.pos.col+=skip_analized;
1.1       parser   3667:        }
                   3668:        return result;
                   3669: }
                   3670: 
1.156     moko     3671: static int real_yyerror(Parse_control *pc, const char *s) {  // Called by yyparse on error
1.171     moko     3672:        strncpy(PC.error, s, MAX_STRING);
                   3673:        return 1;
1.1       parser   3674: }
                   3675: 
                   3676: static void yyprint(FILE *file, int type, YYSTYPE value) {
                   3677:        if(type==STRING)
1.84      paf      3678:                fprintf(file, " \"%s\"", LA2S(*value)->cstr());
1.1       parser   3679: }

E-mail: