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