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