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