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