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