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

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

E-mail: