Annotation of parser3/src/main/compile.tab.C, revision 1.175
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.175 ! moko 76: volatile const char * IDENT_COMPILE_Y = "$Id: compile.y,v 1.285 2016/10/11 21:30:16 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,
1.175 ! moko 530: 455, 466, 473, 480, 481, 482, 484, 490, 491, 491,
! 531: 495, 506, 509, 506, 558, 574, 574, 576, 577, 578,
! 532: 580, 583, 580, 586, 587, 589, 590, 593, 594, 597,
! 533: 598, 600, 603, 616, 621, 622, 623, 628, 628, 630,
! 534: 630, 631, 632, 644, 653, 656, 657, 658, 659, 661,
! 535: 665, 674, 677, 674, 690, 695, 695, 696, 702, 703,
! 536: 705, 725, 737, 739, 740, 741, 742, 743, 744, 745,
! 537: 746, 748, 749, 750, 751, 752, 753, 754, 755, 757,
! 538: 758, 759, 760, 761, 762, 763, 764, 765, 766, 767,
! 539: 768, 769, 770, 771, 772, 773, 774, 775, 776, 777,
! 540: 778, 779, 780, 781, 782, 783, 786, 791, 812, 817,
! 541: 818, 819, 821
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();
1.1 parser 1960: // stack: context, name
1.163 moko 1961: P(*(yyval), *(yyvsp[-1])); // stack: context, name, value
1.156 moko 1962: O(*(yyval), OP::OP_CONSTRUCT_EXPR); /* value=pop->as_expr_result; name=pop; context=pop; construct(context,name,value) */
1.158 misha 1963: }
1.175 ! moko 1964: #line 1965 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 1965: break;
1966:
1.115 misha 1967: case 62:
1.175 ! moko 1968: #line 473 "compile.y" /* yacc.c:1646 */
1.112 paf 1969: {
1.1 parser 1970: // stack: context, name
1.156 moko 1971: (yyval)=N();
1.163 moko 1972: OA(*(yyval), OP::OP_CURLY_CODE__CONSTRUCT, (yyvsp[-1])); /* code=pop; name=pop; context=pop; construct(context,name,junction(code)) */
1.158 misha 1973: }
1.175 ! moko 1974: #line 1975 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 1975: break;
1976:
1.115 misha 1977: case 66:
1.175 ! moko 1978: #line 484 "compile.y" /* yacc.c:1646 */
1.112 paf 1979: {
1.156 moko 1980: (yyval)=N();
1.163 moko 1981: OA(*(yyval), OP::OP_OBJECT_POOL, (yyvsp[0])); /* stack: empty write context */
1.47 paf 1982: /* some code that writes to that context */
1983: /* context=pop; stack: context.value() */
1.158 misha 1984: }
1.175 ! moko 1985: #line 1986 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 1986: break;
1987:
1.115 misha 1988: case 69:
1.175 ! moko 1989: #line 491 "compile.y" /* yacc.c:1646 */
1.163 moko 1990: { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.175 ! moko 1991: #line 1992 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 1992: break;
1993:
1.115 misha 1994: case 70:
1.175 ! moko 1995: #line 495 "compile.y" /* yacc.c:1646 */
1.112 paf 1996: {
1.163 moko 1997: size_t count=(yyvsp[0])->count();
1.131 misha 1998: #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR
1.159 misha 1999: if(count)
1.131 misha 2000: #endif
2001: {
1.163 moko 2002: (yyval)=(yyvsp[0]); /* stack: value */
1.171 moko 2003: if(!change_first(*(yyval), OP::OP_CONSTRUCT_OBJECT, /*=>*/ OP::OP_CONSTRUCT_OBJECT__WRITE))
2004: 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 2005: }
1.158 misha 2006: }
1.175 ! moko 2007: #line 2008 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2008: break;
2009:
1.115 misha 2010: case 71:
1.175 ! moko 2011: #line 506 "compile.y" /* yacc.c:1646 */
1.112 paf 2012: {
1.171 moko 2013: PC.in_call_value=true;
2014: }
1.175 ! moko 2015: #line 2016 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2016: break;
2017:
1.115 misha 2018: case 72:
1.175 ! moko 2019: #line 509 "compile.y" /* yacc.c:1646 */
1.112 paf 2020: {
1.171 moko 2021: PC.in_call_value=false;
2022: }
1.175 ! moko 2023: #line 2024 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2024: break;
2025:
1.115 misha 2026: case 73:
1.175 ! moko 2027: #line 512 "compile.y" /* yacc.c:1646 */
1.112 paf 2028: { /* ^field.$method{vasya} */
1.131 misha 2029: #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR
1.135 misha 2030: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
1.163 moko 2031: const String* operator_name=LA2S(*(yyvsp[-3]), 0, OP::OP_VALUE__GET_ELEMENT_OR_OPERATOR);
1.135 misha 2032: #else
1.163 moko 2033: const String* operator_name=LA2S(*(yyvsp[-3]), 1);
1.135 misha 2034: #endif
1.170 moko 2035: if(operator_name && SYMBOLS_EQ(*operator_name,REM_SYMBOL)){
1.156 moko 2036: (yyval)=N();
1.131 misha 2037: } else
2038: #endif
2039: {
1.163 moko 2040: YYSTYPE params_code=(yyvsp[-1]);
1.131 misha 2041: if(params_code->count()==3) { // probably [] case. [OP::OP_VALUE+origin+Void]
2042: if(Value* value=LA2V(*params_code)) // it is OP_VALUE+origin+value?
1.153 moko 2043: if(const String * string=value->get_string())
2044: if(string->is_empty()) // value is empty string?
2045: params_code=0; // ^zzz[] case. don't append lone empty param.
1.131 misha 2046: }
2047: /* stack: context, method_junction */
1.142 misha 2048:
1.163 moko 2049: YYSTYPE var_code=(yyvsp[-3]);
1.142 misha 2050: if(
2051: var_code->count()==8
1.172 moko 2052: && ( (*var_code)[0].code==OP::OP_VALUE__GET_CLASS || (*var_code)[0].code==OP::OP_VALUE__GET_BASE_CLASS )
1.142 misha 2053: && (*var_code)[3].code==OP::OP_PREPARE_TO_CONSTRUCT_OBJECT
2054: && (*var_code)[4].code==OP::OP_VALUE
1.164 moko 2055: #ifdef FEATURE_GET_ELEMENT4CALL
2056: && (*var_code)[7].code==OP::OP_GET_ELEMENT4CALL
2057: #else
1.142 misha 2058: && (*var_code)[7].code==OP::OP_GET_ELEMENT
1.164 moko 2059: #endif
1.142 misha 2060: ){
1.159 misha 2061: (yyval)=N();
1.156 moko 2062: O(*(yyval), OP::OP_CONSTRUCT_OBJECT);
2063: P(*(yyval), *var_code, 1/*offset*/, 2/*limit*/); // class name
2064: P(*(yyval), *var_code, 5/*offset*/, 2/*limit*/); // constructor name
2065: OA(*(yyval), params_code);
1.142 misha 2066: } else
2067: {
1.156 moko 2068: (yyval)=var_code; /* with_xxx,diving code; stack: context,method_junction */
2069: OA(*(yyval), OP::OP_CALL, params_code); // method_frame=make frame(pop junction); ncontext=pop; call(ncontext,method_frame) stack: value
1.142 misha 2070: }
1.131 misha 2071: }
1.158 misha 2072: }
1.175 ! moko 2073: #line 2074 "compile.tab.C" /* yacc.c:1646 */
1.164 moko 2074: break;
2075:
2076: case 74:
1.175 ! moko 2077: #line 558 "compile.y" /* yacc.c:1646 */
1.164 moko 2078: {
2079: #ifdef FEATURE_GET_ELEMENT4CALL
2080: size_t count=(yyvsp[0])->count();
2081: if(count){
2082: (yyval)=(yyvsp[0]);
2083: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_ELEMENT
2084: !(count==5 && change_first(*(yyval), OP::OP_GET_OBJECT_ELEMENT, OP::OP_GET_OBJECT_ELEMENT4CALL)) &&
2085: #endif
2086: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_VAR_ELEMENT
2087: !(count==5 && change_first(*(yyval), OP::OP_GET_OBJECT_VAR_ELEMENT, OP::OP_GET_OBJECT_VAR_ELEMENT4CALL)) &&
2088: #endif
2089: !change(*(yyval), count-1, OP::OP_GET_ELEMENT, OP::OP_GET_ELEMENT4CALL);
2090: }
2091: #endif
2092: }
1.175 ! moko 2093: #line 2094 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2094: break;
2095:
1.115 misha 2096: case 76:
1.175 ! moko 2097: #line 574 "compile.y" /* yacc.c:1646 */
1.163 moko 2098: { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.175 ! moko 2099: #line 2100 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2100: break;
2101:
1.115 misha 2102: case 80:
1.175 ! moko 2103: #line 580 "compile.y" /* yacc.c:1646 */
1.112 paf 2104: {
1.100 paf 2105: // allow ^call[ letters here any time ]
1.156 moko 2106: *reinterpret_cast<bool*>(&(yyval))=PC.explicit_result; PC.explicit_result=false;
1.158 misha 2107: }
1.175 ! moko 2108: #line 2109 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2109: break;
2110:
1.115 misha 2111: case 81:
1.175 ! moko 2112: #line 583 "compile.y" /* yacc.c:1646 */
1.112 paf 2113: {
1.163 moko 2114: PC.explicit_result=*reinterpret_cast<bool*>(&(yyvsp[-1]));
1.158 misha 2115: }
1.175 ! moko 2116: #line 2117 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2117: break;
2118:
1.115 misha 2119: case 82:
1.175 ! moko 2120: #line 585 "compile.y" /* yacc.c:1646 */
1.163 moko 2121: {(yyval)=(yyvsp[-2]);}
1.175 ! moko 2122: #line 2123 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2123: break;
2124:
1.115 misha 2125: case 83:
1.175 ! moko 2126: #line 586 "compile.y" /* yacc.c:1646 */
1.163 moko 2127: {(yyval)=(yyvsp[-1]);}
1.175 ! moko 2128: #line 2129 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2129: break;
2130:
1.115 misha 2131: case 84:
1.175 ! moko 2132: #line 587 "compile.y" /* yacc.c:1646 */
1.163 moko 2133: {(yyval)=(yyvsp[-1]);}
1.175 ! moko 2134: #line 2135 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2135: break;
2136:
1.115 misha 2137: case 86:
1.175 ! moko 2138: #line 590 "compile.y" /* yacc.c:1646 */
1.163 moko 2139: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); }
1.175 ! moko 2140: #line 2141 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2141: break;
2142:
1.115 misha 2143: case 88:
1.175 ! moko 2144: #line 594 "compile.y" /* yacc.c:1646 */
1.163 moko 2145: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); }
1.175 ! moko 2146: #line 2147 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2147: break;
2148:
1.115 misha 2149: case 90:
1.175 ! moko 2150: #line 598 "compile.y" /* yacc.c:1646 */
1.163 moko 2151: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); }
1.175 ! moko 2152: #line 2153 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2153: break;
2154:
1.115 misha 2155: case 91:
1.175 ! moko 2156: #line 600 "compile.y" /* yacc.c:1646 */
1.112 paf 2157: {
1.163 moko 2158: (yyval)=(yyvsp[0]);
1.158 misha 2159: }
1.175 ! moko 2160: #line 2161 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2161: break;
2162:
1.115 misha 2163: case 92:
1.175 ! moko 2164: #line 603 "compile.y" /* yacc.c:1646 */
1.112 paf 2165: {
1.163 moko 2166: YYSTYPE expr_code=(yyvsp[0]);
1.106 paf 2167: if(expr_code->count()==3
1.127 misha 2168: && (*expr_code)[0].code==OP::OP_VALUE) { // optimizing (double/bool/incidently 'string' too) case. [OP::OP_VALUE+origin+Double]. no evaluating
1.156 moko 2169: (yyval)=expr_code;
1.104 paf 2170: } else {
1.131 misha 2171: YYSTYPE code=N();
1.104 paf 2172: P(*code, *expr_code);
1.122 misha 2173: O(*code, OP::OP_WRITE_EXPR_RESULT);
1.156 moko 2174: (yyval)=N();
2175: OA(*(yyval), OP::OP_EXPR_CODE__STORE_PARAM, code);
1.104 paf 2176: }
1.158 misha 2177: }
1.175 ! moko 2178: #line 2179 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2179: break;
2180:
1.115 misha 2181: case 93:
1.175 ! moko 2182: #line 616 "compile.y" /* yacc.c:1646 */
1.112 paf 2183: {
1.156 moko 2184: (yyval)=N();
1.163 moko 2185: OA(*(yyval), OP::OP_CURLY_CODE__STORE_PARAM, (yyvsp[0]));
1.158 misha 2186: }
1.175 ! moko 2187: #line 2188 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2188: break;
2189:
1.115 misha 2190: case 98:
1.175 ! moko 2191: #line 628 "compile.y" /* yacc.c:1646 */
1.163 moko 2192: { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.175 ! moko 2193: #line 2194 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2194: break;
2195:
1.115 misha 2196: case 100:
1.175 ! moko 2197: #line 630 "compile.y" /* yacc.c:1646 */
1.163 moko 2198: { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.175 ! moko 2199: #line 2200 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2200: break;
2201:
1.115 misha 2202: case 102:
1.175 ! moko 2203: #line 632 "compile.y" /* yacc.c:1646 */
1.112 paf 2204: {
1.33 paf 2205: // we know that name_advance1 not called from ^xxx context
2206: // so we'll not check for operator call possibility as we do in name_advance2
2207:
1.1 parser 2208: /* stack: context */
1.163 moko 2209: (yyval)=(yyvsp[0]); /* stack: context,name */
1.159 misha 2210: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
2211: O(*(yyval), is_special_element(*(yyval)) ? OP::OP_GET_ELEMENT__SPECIAL : OP::OP_GET_ELEMENT);
2212: #else
1.156 moko 2213: O(*(yyval), OP::OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.159 misha 2214: #endif
1.158 misha 2215: }
1.175 ! moko 2216: #line 2217 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2217: break;
2218:
1.115 misha 2219: case 103:
1.175 ! moko 2220: #line 644 "compile.y" /* yacc.c:1646 */
1.112 paf 2221: {
1.1 parser 2222: /* stack: context */
1.163 moko 2223: (yyval)=(yyvsp[0]); /* stack: context,name */
1.159 misha 2224: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
2225: O(*(yyval), is_special_element(*(yyval)) ? OP::OP_GET_ELEMENT__SPECIAL : OP::OP_GET_ELEMENT);
2226: #else
1.156 moko 2227: O(*(yyval), OP::OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.159 misha 2228: #endif
1.158 misha 2229: }
1.175 ! moko 2230: #line 2231 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2231: break;
2232:
1.115 misha 2233: case 109:
1.175 ! moko 2234: #line 661 "compile.y" /* yacc.c:1646 */
1.112 paf 2235: {
1.163 moko 2236: (yyval)=(yyvsp[0]);
1.156 moko 2237: O(*(yyval), OP::OP_GET_ELEMENT);
1.158 misha 2238: }
1.175 ! moko 2239: #line 2240 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2240: break;
2241:
1.115 misha 2242: case 110:
1.175 ! moko 2243: #line 665 "compile.y" /* yacc.c:1646 */
1.112 paf 2244: {
1.131 misha 2245: YYSTYPE code;
1.47 paf 2246: {
1.163 moko 2247: change_string_literal_to_write_string_literal(*(code=(yyvsp[-1])));
2248: P(*code, *(yyvsp[0]));
1.47 paf 2249: }
1.156 moko 2250: (yyval)=N();
2251: OA(*(yyval), OP::OP_STRING_POOL, code);
1.158 misha 2252: }
1.175 ! moko 2253: #line 2254 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2254: break;
2255:
1.115 misha 2256: case 111:
1.175 ! moko 2257: #line 674 "compile.y" /* yacc.c:1646 */
1.112 paf 2258: {
1.100 paf 2259: // allow $result_or_other_variable[ letters here any time ]
1.156 moko 2260: *reinterpret_cast<bool*>(&(yyval))=PC.explicit_result; PC.explicit_result=false;
1.158 misha 2261: }
1.175 ! moko 2262: #line 2263 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2263: break;
2264:
1.115 misha 2265: case 112:
1.175 ! moko 2266: #line 677 "compile.y" /* yacc.c:1646 */
1.112 paf 2267: {
1.163 moko 2268: PC.explicit_result=*reinterpret_cast<bool*>(&(yyvsp[-1]));
1.158 misha 2269: }
1.175 ! moko 2270: #line 2271 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2271: break;
2272:
1.115 misha 2273: case 113:
1.175 ! moko 2274: #line 679 "compile.y" /* yacc.c:1646 */
1.112 paf 2275: {
1.156 moko 2276: (yyval)=N();
1.159 misha 2277: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
1.163 moko 2278: if(!maybe_append_simple_diving_code(*(yyval), *(yyvsp[-2])))
1.159 misha 2279: #endif
2280: {
1.171 moko 2281: OA(*(yyval), OP::OP_OBJECT_POOL, (yyvsp[-2])); /* stack: empty write context */
2282: /* some code that writes to that context */
2283: /* context=pop; stack: context.value() */
1.159 misha 2284: }
1.158 misha 2285: }
1.175 ! moko 2286: #line 2287 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2287: break;
2288:
1.115 misha 2289: case 114:
1.175 ! moko 2290: #line 690 "compile.y" /* yacc.c:1646 */
1.112 paf 2291: {
1.156 moko 2292: (yyval)=N();
2293: O(*(yyval), OP::OP_WITH_READ);
1.163 moko 2294: P(*(yyval), *(yyvsp[0]));
1.158 misha 2295: }
1.175 ! moko 2296: #line 2297 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2297: break;
2298:
1.115 misha 2299: case 116:
1.175 ! moko 2300: #line 695 "compile.y" /* yacc.c:1646 */
1.163 moko 2301: { (yyval)=(yyvsp[-1]); P(*(yyval), *(yyvsp[0])); }
1.175 ! moko 2302: #line 2303 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2303: break;
2304:
1.115 misha 2305: case 117:
1.175 ! moko 2306: #line 696 "compile.y" /* yacc.c:1646 */
1.112 paf 2307: {
1.163 moko 2308: (yyval)=(yyvsp[0]);
1.156 moko 2309: O(*(yyval), OP::OP_GET_ELEMENT__WRITE);
1.158 misha 2310: }
1.175 ! moko 2311: #line 2312 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2312: break;
2313:
1.115 misha 2314: case 120:
1.175 ! moko 2315: #line 705 "compile.y" /* yacc.c:1646 */
1.112 paf 2316: {
1.163 moko 2317: (yyval)=(yyvsp[-1]); // stack: class name string
1.172 moko 2318: OP::OPCODE code = OP::OP_VALUE__GET_CLASS;
1.156 moko 2319: if(*LA2S(*(yyval)) == BASE_NAME) { // pseudo BASE class
1.84 paf 2320: if(VStateless_class* base=PC.cclass->base_class()) {
1.167 moko 2321: change_string_literal_value(*(yyval), *new String(base->type()));
1.61 paf 2322: } else {
2323: strcpy(PC.error, "no base class declared");
2324: YYERROR;
2325: }
1.172 moko 2326: code = OP::OP_VALUE__GET_BASE_CLASS;
2327: } else {
1.173 moko 2328: // can't use get_class because it will call @autouse[] if the class wasn't loaded
2329: VStateless_class* base=PC.request.classes().get(*LA2S(*(yyval)));
2330: if(base && PC.cclass->derived_from(*base))
1.172 moko 2331: code = OP::OP_VALUE__GET_BASE_CLASS;
1.61 paf 2332: }
1.131 misha 2333: // optimized OP_VALUE+origin+string+OP_GET_CLASS => OP_VALUE__GET_CLASS+origin+string
1.172 moko 2334: change_first(*(yyval), OP::OP_VALUE, code);
1.158 misha 2335: }
1.175 ! moko 2336: #line 2337 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2337: break;
2338:
1.115 misha 2339: case 121:
1.175 ! moko 2340: #line 725 "compile.y" /* yacc.c:1646 */
1.112 paf 2341: {
1.163 moko 2342: (yyval)=(yyvsp[-1]);
1.39 paf 2343: if(!PC.in_call_value) {
1.1 parser 2344: strcpy(PC.error, ":: not allowed here");
2345: YYERROR;
2346: }
1.156 moko 2347: O(*(yyval), OP::OP_PREPARE_TO_CONSTRUCT_OBJECT);
1.158 misha 2348: }
1.175 ! moko 2349: #line 2350 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2350: break;
2351:
1.115 misha 2352: case 128:
1.175 ! moko 2353: #line 744 "compile.y" /* yacc.c:1646 */
1.163 moko 2354: { (yyval) = (yyvsp[-1]); }
1.175 ! moko 2355: #line 2356 "compile.tab.C" /* yacc.c:1646 */
1.114 misha 2356: break;
2357:
1.115 misha 2358: case 129:
1.175 ! moko 2359: #line 745 "compile.y" /* yacc.c:1646 */
1.163 moko 2360: { (yyval) = (yyvsp[-1]); }
1.175 ! moko 2361: #line 2362 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2362: break;
2363:
1.115 misha 2364: case 130:
1.175 ! moko 2365: #line 746 "compile.y" /* yacc.c:1646 */
1.163 moko 2366: { (yyval) = (yyvsp[-1]); }
1.175 ! moko 2367: #line 2368 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2368: break;
2369:
1.115 misha 2370: case 131:
1.175 ! moko 2371: #line 748 "compile.y" /* yacc.c:1646 */
1.163 moko 2372: { (yyval)=(yyvsp[0]); O(*(yyval), OP::OP_NEG); }
1.175 ! moko 2373: #line 2374 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2374: break;
2375:
1.115 misha 2376: case 132:
1.175 ! moko 2377: #line 749 "compile.y" /* yacc.c:1646 */
1.163 moko 2378: { (yyval)=(yyvsp[0]); }
1.175 ! moko 2379: #line 2380 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2380: break;
2381:
1.115 misha 2382: case 133:
1.175 ! moko 2383: #line 750 "compile.y" /* yacc.c:1646 */
1.163 moko 2384: { (yyval)=(yyvsp[0]); O(*(yyval), OP::OP_INV); }
1.175 ! moko 2385: #line 2386 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2386: break;
2387:
1.115 misha 2388: case 134:
1.175 ! moko 2389: #line 751 "compile.y" /* yacc.c:1646 */
1.163 moko 2390: { (yyval)=(yyvsp[0]); O(*(yyval), OP::OP_NOT); }
1.175 ! moko 2391: #line 2392 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2392: break;
2393:
1.115 misha 2394: case 135:
1.175 ! moko 2395: #line 752 "compile.y" /* yacc.c:1646 */
1.163 moko 2396: { (yyval)=(yyvsp[0]); O(*(yyval), OP::OP_DEF); }
1.175 ! moko 2397: #line 2398 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2398: break;
2399:
1.115 misha 2400: case 136:
1.175 ! moko 2401: #line 753 "compile.y" /* yacc.c:1646 */
1.163 moko 2402: { (yyval)=(yyvsp[0]); O(*(yyval), OP::OP_IN); }
1.175 ! moko 2403: #line 2404 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2404: break;
2405:
1.115 misha 2406: case 137:
1.175 ! moko 2407: #line 754 "compile.y" /* yacc.c:1646 */
1.163 moko 2408: { (yyval)=(yyvsp[0]); O(*(yyval), OP::OP_FEXISTS); }
1.175 ! moko 2409: #line 2410 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2410: break;
2411:
1.115 misha 2412: case 138:
1.175 ! moko 2413: #line 755 "compile.y" /* yacc.c:1646 */
1.163 moko 2414: { (yyval)=(yyvsp[0]); O(*(yyval), OP::OP_DEXISTS); }
1.175 ! moko 2415: #line 2416 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2416: break;
2417:
1.115 misha 2418: case 139:
1.175 ! moko 2419: #line 757 "compile.y" /* yacc.c:1646 */
1.163 moko 2420: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_SUB); }
1.175 ! moko 2421: #line 2422 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2422: break;
2423:
1.115 misha 2424: case 140:
1.175 ! moko 2425: #line 758 "compile.y" /* yacc.c:1646 */
1.163 moko 2426: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_ADD); }
1.175 ! moko 2427: #line 2428 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2428: break;
2429:
1.115 misha 2430: case 141:
1.175 ! moko 2431: #line 759 "compile.y" /* yacc.c:1646 */
1.163 moko 2432: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_MUL); }
1.175 ! moko 2433: #line 2434 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2434: break;
2435:
1.115 misha 2436: case 142:
1.175 ! moko 2437: #line 760 "compile.y" /* yacc.c:1646 */
1.163 moko 2438: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_DIV); }
1.175 ! moko 2439: #line 2440 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2440: break;
2441:
1.115 misha 2442: case 143:
1.175 ! moko 2443: #line 761 "compile.y" /* yacc.c:1646 */
1.163 moko 2444: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_MOD); }
1.175 ! moko 2445: #line 2446 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2446: break;
2447:
1.115 misha 2448: case 144:
1.175 ! moko 2449: #line 762 "compile.y" /* yacc.c:1646 */
1.163 moko 2450: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_INTDIV); }
1.175 ! moko 2451: #line 2452 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2452: break;
2453:
1.115 misha 2454: case 145:
1.175 ! moko 2455: #line 763 "compile.y" /* yacc.c:1646 */
1.163 moko 2456: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_BIN_SL); }
1.175 ! moko 2457: #line 2458 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2458: break;
2459:
1.115 misha 2460: case 146:
1.175 ! moko 2461: #line 764 "compile.y" /* yacc.c:1646 */
1.163 moko 2462: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_BIN_SR); }
1.175 ! moko 2463: #line 2464 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2464: break;
2465:
1.115 misha 2466: case 147:
1.175 ! moko 2467: #line 765 "compile.y" /* yacc.c:1646 */
1.163 moko 2468: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_BIN_AND); }
1.175 ! moko 2469: #line 2470 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2470: break;
2471:
1.115 misha 2472: case 148:
1.175 ! moko 2473: #line 766 "compile.y" /* yacc.c:1646 */
1.163 moko 2474: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_BIN_OR); }
1.175 ! moko 2475: #line 2476 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2476: break;
2477:
1.115 misha 2478: case 149:
1.175 ! moko 2479: #line 767 "compile.y" /* yacc.c:1646 */
1.163 moko 2480: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_BIN_XOR); }
1.175 ! moko 2481: #line 2482 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2482: break;
2483:
1.115 misha 2484: case 150:
1.175 ! moko 2485: #line 768 "compile.y" /* yacc.c:1646 */
1.163 moko 2486: { (yyval)=(yyvsp[-2]); OA(*(yyval), OP::OP_NESTED_CODE, (yyvsp[0])); O(*(yyval), OP::OP_LOG_AND); }
1.175 ! moko 2487: #line 2488 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2488: break;
2489:
1.115 misha 2490: case 151:
1.175 ! moko 2491: #line 769 "compile.y" /* yacc.c:1646 */
1.163 moko 2492: { (yyval)=(yyvsp[-2]); OA(*(yyval), OP::OP_NESTED_CODE, (yyvsp[0])); O(*(yyval), OP::OP_LOG_OR); }
1.175 ! moko 2493: #line 2494 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2494: break;
2495:
1.115 misha 2496: case 152:
1.175 ! moko 2497: #line 770 "compile.y" /* yacc.c:1646 */
1.163 moko 2498: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_LOG_XOR); }
1.175 ! moko 2499: #line 2500 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2500: break;
2501:
1.115 misha 2502: case 153:
1.175 ! moko 2503: #line 771 "compile.y" /* yacc.c:1646 */
1.163 moko 2504: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_NUM_LT); }
1.175 ! moko 2505: #line 2506 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2506: break;
2507:
1.115 misha 2508: case 154:
1.175 ! moko 2509: #line 772 "compile.y" /* yacc.c:1646 */
1.163 moko 2510: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_NUM_GT); }
1.175 ! moko 2511: #line 2512 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2512: break;
2513:
1.115 misha 2514: case 155:
1.175 ! moko 2515: #line 773 "compile.y" /* yacc.c:1646 */
1.163 moko 2516: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_NUM_LE); }
1.175 ! moko 2517: #line 2518 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2518: break;
2519:
1.115 misha 2520: case 156:
1.175 ! moko 2521: #line 774 "compile.y" /* yacc.c:1646 */
1.163 moko 2522: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_NUM_GE); }
1.175 ! moko 2523: #line 2524 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2524: break;
2525:
1.115 misha 2526: case 157:
1.175 ! moko 2527: #line 775 "compile.y" /* yacc.c:1646 */
1.163 moko 2528: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_NUM_EQ); }
1.175 ! moko 2529: #line 2530 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2530: break;
2531:
1.115 misha 2532: case 158:
1.175 ! moko 2533: #line 776 "compile.y" /* yacc.c:1646 */
1.163 moko 2534: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_NUM_NE); }
1.175 ! moko 2535: #line 2536 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2536: break;
2537:
1.115 misha 2538: case 159:
1.175 ! moko 2539: #line 777 "compile.y" /* yacc.c:1646 */
1.163 moko 2540: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_STR_LT); }
1.175 ! moko 2541: #line 2542 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2542: break;
2543:
1.115 misha 2544: case 160:
1.175 ! moko 2545: #line 778 "compile.y" /* yacc.c:1646 */
1.163 moko 2546: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_STR_GT); }
1.175 ! moko 2547: #line 2548 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2548: break;
2549:
1.115 misha 2550: case 161:
1.175 ! moko 2551: #line 779 "compile.y" /* yacc.c:1646 */
1.163 moko 2552: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_STR_LE); }
1.175 ! moko 2553: #line 2554 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2554: break;
2555:
1.115 misha 2556: case 162:
1.175 ! moko 2557: #line 780 "compile.y" /* yacc.c:1646 */
1.163 moko 2558: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_STR_GE); }
1.175 ! moko 2559: #line 2560 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2560: break;
2561:
1.115 misha 2562: case 163:
1.175 ! moko 2563: #line 781 "compile.y" /* yacc.c:1646 */
1.163 moko 2564: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_STR_EQ); }
1.175 ! moko 2565: #line 2566 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2566: break;
2567:
1.115 misha 2568: case 164:
1.175 ! moko 2569: #line 782 "compile.y" /* yacc.c:1646 */
1.163 moko 2570: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_STR_NE); }
1.175 ! moko 2571: #line 2572 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2572: break;
2573:
1.115 misha 2574: case 165:
1.175 ! moko 2575: #line 783 "compile.y" /* yacc.c:1646 */
1.163 moko 2576: { (yyval)=(yyvsp[-2]); P(*(yyval), *(yyvsp[0])); O(*(yyval), OP::OP_IS); }
1.175 ! moko 2577: #line 2578 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2578: break;
2579:
1.115 misha 2580: case 166:
1.175 ! moko 2581: #line 786 "compile.y" /* yacc.c:1646 */
1.112 paf 2582: {
1.131 misha 2583: // optimized OP_STRING => OP_VALUE for doubles
1.163 moko 2584: maybe_change_string_literal_to_double_literal(*((yyval)=(yyvsp[0])));
1.158 misha 2585: }
1.175 ! moko 2586: #line 2587 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2587: break;
2588:
1.115 misha 2589: case 167:
1.175 ! moko 2590: #line 791 "compile.y" /* yacc.c:1646 */
1.112 paf 2591: {
1.131 misha 2592: #ifdef OPTIMIZE_BYTECODE_STRING_POOL
2593: // it brakes ^if(" 09 "){...}
1.163 moko 2594: YYSTYPE code=(yyvsp[0]);
1.156 moko 2595: (yyval)=N();
1.159 misha 2596: if(code->count()==3 && change_first(*code, OP::OP_STRING__WRITE, OP::OP_VALUE)){
1.131 misha 2597: // optimized OP_STRING__WRITE+origin+value => OP_VALUE+origin+value without starting OP_STRING_POOL
1.156 moko 2598: P(*(yyval), *code);
1.131 misha 2599: } else {
1.156 moko 2600: OA(*(yyval), OP::OP_STRING_POOL, code); /* stack: empty write context */
1.131 misha 2601: }
2602: #else
1.156 moko 2603: (yyval)=N();
1.163 moko 2604: OA(*(yyval), OP::OP_STRING_POOL, (yyvsp[0])); /* stack: empty write context */
1.131 misha 2605: #endif
1.47 paf 2606: /* some code that writes to that context */
2607: /* context=pop; stack: context.get_string() */
1.158 misha 2608: }
1.175 ! moko 2609: #line 2610 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2610: break;
2611:
1.115 misha 2612: case 168:
1.175 ! moko 2613: #line 812 "compile.y" /* yacc.c:1646 */
1.112 paf 2614: {
1.131 misha 2615: // optimized OP_STRING+OP_WRITE_VALUE => OP_STRING__WRITE
1.163 moko 2616: change_string_literal_to_write_string_literal(*((yyval)=(yyvsp[0])));
1.158 misha 2617: }
1.175 ! moko 2618: #line 2619 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2619: break;
2620:
1.115 misha 2621: case 169:
1.175 ! moko 2622: #line 817 "compile.y" /* yacc.c:1646 */
1.158 misha 2623: { (yyval)=VL(/*we know that we will not change it*/const_cast<VString*>(&vempty), 0, 0, 0); }
1.175 ! moko 2624: #line 2625 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2625: break;
2626:
1.115 misha 2627: case 170:
1.175 ! moko 2628: #line 818 "compile.y" /* yacc.c:1646 */
1.158 misha 2629: { (yyval) = VL(/*we know that we will not change it*/const_cast<VBool*>(&vtrue), 0, 0, 0); }
1.175 ! moko 2630: #line 2631 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2631: break;
2632:
1.115 misha 2633: case 171:
1.175 ! moko 2634: #line 819 "compile.y" /* yacc.c:1646 */
1.158 misha 2635: { (yyval) = VL(/*we know that we will not change it*/const_cast<VBool*>(&vfalse), 0, 0, 0); }
1.175 ! moko 2636: #line 2637 "compile.tab.C" /* yacc.c:1646 */
1.112 paf 2637: break;
2638:
1.115 misha 2639: case 172:
1.175 ! moko 2640: #line 821 "compile.y" /* yacc.c:1646 */
1.158 misha 2641: { (yyval)=N(); }
1.175 ! moko 2642: #line 2643 "compile.tab.C" /* yacc.c:1646 */
1.155 misha 2643: break;
1.154 moko 2644:
1.112 paf 2645:
1.175 ! moko 2646: #line 2647 "compile.tab.C" /* yacc.c:1646 */
1.156 moko 2647: default: break;
1.155 misha 2648: }
1.158 misha 2649: /* User semantic actions sometimes alter yychar, and that requires
2650: that yytoken be updated with the new translation. We take the
2651: approach of translating immediately before every use of yytoken.
2652: One alternative is translating here after every semantic action,
2653: but that translation would be missed if the semantic action invokes
2654: YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2655: if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2656: incorrect destructor might then be invoked immediately. In the
2657: case of YYERROR or YYBACKUP, subsequent parser actions might lead
2658: to an incorrect destructor call or verbose syntax error message
2659: before the lookahead is translated. */
1.156 moko 2660: YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1.112 paf 2661:
1.156 moko 2662: YYPOPSTACK (yylen);
2663: yylen = 0;
1.112 paf 2664: YY_STACK_PRINT (yyss, yyssp);
1.1 parser 2665:
2666: *++yyvsp = yyval;
2667:
1.163 moko 2668: /* Now 'shift' the result of the reduction. Determine what state
1.112 paf 2669: that goes to, based on the state we popped back to and the rule
2670: number reduced by. */
1.1 parser 2671:
2672: yyn = yyr1[yyn];
2673:
1.112 paf 2674: yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2675: if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1.1 parser 2676: yystate = yytable[yystate];
2677: else
1.112 paf 2678: yystate = yydefgoto[yyn - YYNTOKENS];
1.1 parser 2679:
2680: goto yynewstate;
2681:
2682:
1.163 moko 2683: /*--------------------------------------.
2684: | yyerrlab -- here on detecting error. |
2685: `--------------------------------------*/
1.112 paf 2686: yyerrlab:
1.158 misha 2687: /* Make sure we have latest lookahead translation. See comments at
2688: user semantic actions for why this is necessary. */
2689: yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2690:
1.112 paf 2691: /* If not already recovering from an error, report this error. */
2692: if (!yyerrstatus)
1.1 parser 2693: {
2694: ++yynerrs;
1.156 moko 2695: #if ! YYERROR_VERBOSE
1.163 moko 2696: yyerror (pc, YY_("syntax error"));
1.156 moko 2697: #else
1.158 misha 2698: # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2699: yyssp, yytoken)
1.156 moko 2700: {
1.158 misha 2701: char const *yymsgp = YY_("syntax error");
2702: int yysyntax_error_status;
2703: yysyntax_error_status = YYSYNTAX_ERROR;
2704: if (yysyntax_error_status == 0)
2705: yymsgp = yymsg;
2706: else if (yysyntax_error_status == 1)
2707: {
2708: if (yymsg != yymsgbuf)
2709: YYSTACK_FREE (yymsg);
2710: yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2711: if (!yymsg)
2712: {
2713: yymsg = yymsgbuf;
2714: yymsg_alloc = sizeof yymsgbuf;
2715: yysyntax_error_status = 2;
2716: }
2717: else
2718: {
2719: yysyntax_error_status = YYSYNTAX_ERROR;
2720: yymsgp = yymsg;
2721: }
2722: }
1.163 moko 2723: yyerror (pc, yymsgp);
1.158 misha 2724: if (yysyntax_error_status == 2)
2725: goto yyexhaustedlab;
1.156 moko 2726: }
1.158 misha 2727: # undef YYSYNTAX_ERROR
1.156 moko 2728: #endif
1.1 parser 2729: }
2730:
1.112 paf 2731:
1.1 parser 2732:
2733: if (yyerrstatus == 3)
2734: {
1.112 paf 2735: /* If just tried and failed to reuse lookahead token after an
1.163 moko 2736: error, discard it. */
1.109 paf 2737:
1.113 paf 2738: if (yychar <= YYEOF)
1.163 moko 2739: {
2740: /* Return failure if at end of input. */
2741: if (yychar == YYEOF)
2742: YYABORT;
2743: }
1.113 paf 2744: else
1.163 moko 2745: {
2746: yydestruct ("Error: discarding",
2747: yytoken, &yylval, pc);
2748: yychar = YYEMPTY;
2749: }
1.106 paf 2750: }
1.1 parser 2751:
1.112 paf 2752: /* Else will try to reuse lookahead token after shifting the error
2753: token. */
2754: goto yyerrlab1;
1.109 paf 2755:
1.1 parser 2756:
1.113 paf 2757: /*---------------------------------------------------.
2758: | yyerrorlab -- error raised explicitly by YYERROR. |
2759: `---------------------------------------------------*/
2760: yyerrorlab:
2761:
1.156 moko 2762: /* Pacify compilers like GCC when the user code never invokes
2763: YYERROR and the label yyerrorlab therefore never appears in user
2764: code. */
2765: if (/*CONSTCOND*/ 0)
1.113 paf 2766: goto yyerrorlab;
2767:
1.163 moko 2768: /* Do not reclaim the symbols of the rule whose action triggered
1.156 moko 2769: this YYERROR. */
2770: YYPOPSTACK (yylen);
2771: yylen = 0;
2772: YY_STACK_PRINT (yyss, yyssp);
1.113 paf 2773: yystate = *yyssp;
2774: goto yyerrlab1;
2775:
2776:
2777: /*-------------------------------------------------------------.
2778: | yyerrlab1 -- common code for both syntax error and YYERROR. |
2779: `-------------------------------------------------------------*/
1.112 paf 2780: yyerrlab1:
1.163 moko 2781: yyerrstatus = 3; /* Each real token shifted decrements this. */
1.1 parser 2782:
1.112 paf 2783: for (;;)
1.109 paf 2784: {
1.112 paf 2785: yyn = yypact[yystate];
1.158 misha 2786: if (!yypact_value_is_default (yyn))
1.163 moko 2787: {
2788: yyn += YYTERROR;
2789: if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2790: {
2791: yyn = yytable[yyn];
2792: if (0 < yyn)
2793: break;
2794: }
2795: }
1.1 parser 2796:
1.112 paf 2797: /* Pop the current state because it cannot handle the error token. */
2798: if (yyssp == yyss)
1.163 moko 2799: YYABORT;
1.1 parser 2800:
1.156 moko 2801:
2802: yydestruct ("Error: popping",
1.163 moko 2803: yystos[yystate], yyvsp, pc);
1.156 moko 2804: YYPOPSTACK (1);
1.113 paf 2805: yystate = *yyssp;
1.112 paf 2806: YY_STACK_PRINT (yyss, yyssp);
1.1 parser 2807: }
2808:
1.163 moko 2809: YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1.156 moko 2810: *++yyvsp = yylval;
1.163 moko 2811: YY_IGNORE_MAYBE_UNINITIALIZED_END
1.155 misha 2812:
1.1 parser 2813:
1.156 moko 2814: /* Shift the error token. */
2815: YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1.112 paf 2816:
1.1 parser 2817: yystate = yyn;
2818: goto yynewstate;
2819:
2820:
1.112 paf 2821: /*-------------------------------------.
2822: | yyacceptlab -- YYACCEPT comes here. |
2823: `-------------------------------------*/
2824: yyacceptlab:
2825: yyresult = 0;
2826: goto yyreturn;
2827:
2828: /*-----------------------------------.
2829: | yyabortlab -- YYABORT comes here. |
2830: `-----------------------------------*/
2831: yyabortlab:
2832: yyresult = 1;
2833: goto yyreturn;
2834:
1.163 moko 2835: #if !defined yyoverflow || YYERROR_VERBOSE
1.156 moko 2836: /*-------------------------------------------------.
2837: | yyexhaustedlab -- memory exhaustion comes here. |
2838: `-------------------------------------------------*/
2839: yyexhaustedlab:
1.163 moko 2840: yyerror (pc, YY_("memory exhausted"));
1.112 paf 2841: yyresult = 2;
2842: /* Fall through. */
2843: #endif
2844:
2845: yyreturn:
1.156 moko 2846: if (yychar != YYEMPTY)
1.158 misha 2847: {
2848: /* Make sure we have latest lookahead translation. See comments at
2849: user semantic actions for why this is necessary. */
2850: yytoken = YYTRANSLATE (yychar);
2851: yydestruct ("Cleanup: discarding lookahead",
1.163 moko 2852: yytoken, &yylval, pc);
1.158 misha 2853: }
1.163 moko 2854: /* Do not reclaim the symbols of the rule whose action triggered
1.156 moko 2855: this YYABORT or YYACCEPT. */
2856: YYPOPSTACK (yylen);
2857: YY_STACK_PRINT (yyss, yyssp);
2858: while (yyssp != yyss)
2859: {
2860: yydestruct ("Cleanup: popping",
1.163 moko 2861: yystos[*yyssp], yyvsp, pc);
1.156 moko 2862: YYPOPSTACK (1);
2863: }
1.112 paf 2864: #ifndef yyoverflow
2865: if (yyss != yyssa)
2866: YYSTACK_FREE (yyss);
1.1 parser 2867: #endif
1.156 moko 2868: #if YYERROR_VERBOSE
2869: if (yymsg != yymsgbuf)
2870: YYSTACK_FREE (yymsg);
2871: #endif
1.163 moko 2872: return yyresult;
1.1 parser 2873: }
1.175 ! moko 2874: #line 823 "compile.y" /* yacc.c:1906 */
1.1 parser 2875:
2876: #endif
2877:
2878: /*
2879: 000$111(2222)00
2880: 000$111{3333}00
2881: $,^: push,=0
2882: 1:( { break=pop
2883: 2:( ) pop
2884: 3:{ } pop
2885:
2886: 000^111(2222)4444{33333}4000
2887: $,^: push,=0
2888: 1:( { break=pop
2889: 2:( )=4
2890: 3:{ }=4
2891: 4:[^({]=pop
2892: */
2893:
1.84 paf 2894: inline void ungetc(Parse_control& pc, uint last_line_end_col) {
2895: pc.source--;
2896: if(pc.pos.col==0) {
2897: --pc.pos.line; pc.pos.col=last_line_end_col;
2898: } else
2899: --pc.pos.col;
2900:
2901: }
2902: static int yylex(YYSTYPE *lvalp, void *apc) {
2903: register Parse_control& pc=*static_cast<Parse_control*>(apc);
2904:
2905: #define lexical_brackets_nestage pc.brackets_nestages[pc.ls_sp]
1.1 parser 2906: #define RC {result=c; goto break2; }
2907:
1.84 paf 2908: register int c;
2909: int result;
1.1 parser 2910:
1.84 paf 2911: if(pc.pending_state) {
2912: result=pc.pending_state;
2913: pc.pending_state=0;
1.1 parser 2914: return result;
2915: }
2916:
1.84 paf 2917: const char *begin=pc.source;
2918: Pos begin_pos=pc.pos;
1.1 parser 2919: const char *end;
2920: int skip_analized=0;
2921: while(true) {
1.84 paf 2922: c=*(end=(pc.source++));
2923: // fprintf(stderr, "\nchar: %c %02X; nestage: %d, sp=%d", c, c, lexical_brackets_nestage, pc.sp);
1.1 parser 2924:
1.96 paf 2925: if(c=='\n')
1.84 paf 2926: pc.pos_next_line();
1.96 paf 2927: else
1.84 paf 2928: pc.pos_next_c(c);
1.96 paf 2929: // fprintf(stderr, "\nchar: %c file(%d:%d)", c, pc.pos.line, pc.pos.col);
1.1 parser 2930:
1.96 paf 2931: if(pc.pos.col==0+1 && c=='@') {
1.84 paf 2932: if(pc.ls==LS_DEF_SPECIAL_BODY) {
1.31 paf 2933: // @SPECIAL
2934: // ...
2935: // @<here =
1.84 paf 2936: pop_LS(pc); // exiting from LS_DEF_SPECIAL_BODY state
1.31 paf 2937: } // continuing checks
1.84 paf 2938: if(pc.ls==LS_USER) {
2939: push_LS(pc, LS_DEF_NAME);
1.20 parser 2940: RC;
1.31 paf 2941: } else // @ in first column inside some code [when could that be?]
1.20 parser 2942: result=BAD_METHOD_DECL_START;
2943: goto break2;
1.97 paf 2944: }
2945: if(c=='^') {
1.84 paf 2946: if(pc.ls==LS_METHOD_AFTER) {
1.75 paf 2947: // handle after-method situation
1.84 paf 2948: pop_LS(pc);
1.75 paf 2949: result=EON;
2950: skip_analized=-1; // return to punctuation afterwards to assure it's literality
2951: goto break2;
2952: }
1.84 paf 2953: switch(pc.ls) {
1.15 parser 2954: case LS_EXPRESSION_VAR_NAME_WITH_COLON:
2955: case LS_EXPRESSION_VAR_NAME_WITHOUT_COLON:
2956: case LS_VAR_NAME_SIMPLE_WITH_COLON:
2957: case LS_VAR_NAME_SIMPLE_WITHOUT_COLON:
2958: case LS_VAR_NAME_CURLY:
2959: case LS_METHOD_NAME:
1.66 paf 2960: case LS_USER_COMMENT:
1.15 parser 2961: case LS_DEF_COMMENT:
2962: // no literals in names, please
2963: break;
2964: default:
1.84 paf 2965: switch(*pc.source) {
1.10 parser 2966: // ^escaping some punctuators
1.121 misha 2967: case '^': case '$': case ';': case '@':
1.1 parser 2968: case '(': case ')':
2969: case '[': case ']':
2970: case '{': case '}':
1.23 parser 2971: case '"': case ':':
1.1 parser 2972: if(end!=begin) {
1.84 paf 2973: if(!pc.string_start)
2974: pc.string_start=begin_pos;
1.1 parser 2975: // append piece till ^
1.84 paf 2976: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 2977: }
2978: // reset piece 'begin' position & line
1.84 paf 2979: begin=pc.source; // ->punctuation
2980: begin_pos=pc.pos;
1.75 paf 2981: // skip over _ after ^
1.84 paf 2982: pc.source++; pc.pos.col++;
1.75 paf 2983: // skip analysis = forced literal
2984: continue;
1.1 parser 2985:
2986: // converting ^#HH into char(hex(HH))
2987: case '#':
2988: if(end!=begin) {
1.84 paf 2989: if(!pc.string_start)
2990: pc.string_start=begin_pos;
1.1 parser 2991: // append piece till ^
1.84 paf 2992: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 2993: }
2994: // #HH ?
1.121 misha 2995: if(pc.source[1] && isxdigit(pc.source[1]) && pc.source[2] && isxdigit(pc.source[2])) {
1.110 paf 2996: char c=(char)(
1.84 paf 2997: hex_value[(unsigned char)pc.source[1]]*0x10+
1.110 paf 2998: hex_value[(unsigned char)pc.source[2]]);
1.84 paf 2999: if(c==0) {
1.1 parser 3000: result=BAD_HEX_LITERAL;
3001: goto break2; // wrong hex value[no ^#00 chars allowed]: bail out
3002: }
3003: // append char(hex(HH))
1.84 paf 3004: pc.string.append(c);
1.1 parser 3005: // skip over ^#HH
1.84 paf 3006: pc.source+=3;
3007: pc.pos.col+=3;
1.1 parser 3008: // reset piece 'begin' position & line
1.84 paf 3009: begin=pc.source; // ->after ^#HH
3010: begin_pos=pc.pos;
1.75 paf 3011: // skip analysis = forced literal
1.1 parser 3012: continue;
3013: }
1.121 misha 3014: // just escaped char
3015: // reset piece 'begin' position & line
3016: begin=pc.source;
3017: begin_pos=pc.pos;
3018: // skip over _ after ^
3019: pc.source++; pc.pos.col++;
3020: // skip analysis = forced literal
3021: continue;
1.1 parser 3022: }
1.15 parser 3023: break;
1.75 paf 3024: }
1.15 parser 3025: }
1.1 parser 3026: // #comment start skipping
1.84 paf 3027: if(c=='#' && pc.pos.col==1) {
1.1 parser 3028: if(end!=begin) {
1.84 paf 3029: if(!pc.string_start)
3030: pc.string_start=begin_pos;
1.1 parser 3031: // append piece till #
1.84 paf 3032: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 3033: }
3034: // fall into COMMENT lexical state [wait for \n]
1.84 paf 3035: push_LS(pc, LS_USER_COMMENT);
1.31 paf 3036: continue;
1.1 parser 3037: }
1.84 paf 3038: switch(pc.ls) {
1.1 parser 3039:
3040: // USER'S = NOT OURS
3041: case LS_USER:
1.84 paf 3042: case LS_NAME_SQUARE_PART: // name.[here].xxx
3043: if(pc.trim_bof)
1.1 parser 3044: switch(c) {
3045: case '\n': case ' ': case '\t':
1.84 paf 3046: begin=pc.source;
3047: begin_pos=pc.pos;
1.1 parser 3048: continue; // skip it
3049: default:
1.84 paf 3050: pc.trim_bof=false;
1.1 parser 3051: }
3052: switch(c) {
3053: case '$':
1.84 paf 3054: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3055: RC;
3056: case '^':
1.84 paf 3057: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3058: RC;
1.11 parser 3059: case ']':
1.84 paf 3060: if(pc.ls==LS_NAME_SQUARE_PART)
1.11 parser 3061: if(--lexical_brackets_nestage==0) {// $name.[co<]?>de<]?>
1.84 paf 3062: pop_LS(pc); // $name.[co<]>de<]!>
1.11 parser 3063: RC;
3064: }
1.3 parser 3065: break;
1.11 parser 3066: case '[': // $name.[co<[>de]
1.84 paf 3067: if(pc.ls==LS_NAME_SQUARE_PART)
1.11 parser 3068: lexical_brackets_nestage++;
1.4 parser 3069: break;
1.1 parser 3070: }
1.97 paf 3071: if(pc.explicit_result && c)
3072: switch(c) {
1.168 moko 3073: default:
3074: pc.string.append(c);
1.97 paf 3075: case '\n': case ' ': case '\t':
3076: begin=pc.source;
3077: begin_pos=pc.pos;
1.168 moko 3078: continue;
1.97 paf 3079: }
1.1 parser 3080: break;
3081:
3082: // #COMMENT
1.66 paf 3083: case LS_USER_COMMENT:
1.1 parser 3084: if(c=='\n') {
3085: // skip comment
1.84 paf 3086: begin=pc.source;
3087: begin_pos=pc.pos;
1.1 parser 3088:
1.84 paf 3089: pop_LS(pc);
1.1 parser 3090: continue;
3091: }
3092: break;
3093:
3094: // STRING IN EXPRESSION
3095: case LS_EXPRESSION_STRING_QUOTED:
3096: case LS_EXPRESSION_STRING_APOSTROFED:
3097: switch(c) {
3098: case '"':
3099: case '\'':
3100: if(
1.162 moko 3101: (pc.ls == LS_EXPRESSION_STRING_QUOTED && c=='"') ||
3102: (pc.ls == LS_EXPRESSION_STRING_APOSTROFED && c=='\'') ) {
1.84 paf 3103: pop_LS(pc); //"abc". | 'abc'.
1.1 parser 3104: RC;
3105: }
3106: break;
3107: case '$':
1.84 paf 3108: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3109: RC;
3110: case '^':
1.84 paf 3111: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3112: RC;
3113: }
3114: break;
3115:
3116: // METHOD DEFINITION
3117: case LS_DEF_NAME:
3118: switch(c) {
3119: case '[':
1.84 paf 3120: pc.ls=LS_DEF_PARAMS;
1.1 parser 3121: RC;
3122: case '\n':
1.84 paf 3123: pc.ls=LS_DEF_SPECIAL_BODY;
1.1 parser 3124: RC;
3125: }
3126: break;
3127:
3128: case LS_DEF_PARAMS:
3129: switch(c) {
1.64 paf 3130: case '$': // common error
1.65 paf 3131: result=BAD_METHOD_PARAMETER_NAME_CHARACTER;
3132: goto break2;
1.1 parser 3133: case ';':
3134: RC;
3135: case ']':
1.84 paf 3136: pc.ls=*pc.source=='['?LS_DEF_LOCALS:LS_DEF_COMMENT;
1.1 parser 3137: RC;
3138: case '\n': // wrong. bailing out
1.84 paf 3139: pop_LS(pc);
1.1 parser 3140: RC;
3141: }
3142: break;
3143:
3144: case LS_DEF_LOCALS:
3145: switch(c) {
3146: case '[':
3147: case ';':
3148: RC;
3149: case ']':
1.84 paf 3150: pc.ls=LS_DEF_COMMENT;
1.1 parser 3151: RC;
3152: case '\n': // wrong. bailing out
1.84 paf 3153: pop_LS(pc);
1.1 parser 3154: RC;
3155: }
3156: break;
3157:
3158: case LS_DEF_COMMENT:
3159: if(c=='\n') {
1.84 paf 3160: pop_LS(pc);
1.1 parser 3161: RC;
3162: }
3163: break;
3164:
3165: case LS_DEF_SPECIAL_BODY:
1.31 paf 3166: if(c=='\n')
1.1 parser 3167: RC;
3168: break;
3169:
3170: // (EXPRESSION)
3171: case LS_VAR_ROUND:
3172: case LS_METHOD_ROUND:
3173: switch(c) {
3174: case ')':
1.162 moko 3175: if(--lexical_brackets_nestage==0) {
1.84 paf 3176: if(pc.ls==LS_METHOD_ROUND) // method round param ended
3177: pc.ls=LS_METHOD_AFTER; // look for method end
3178: else // pc.ls==LS_VAR_ROUND // variable constructor ended
3179: pop_LS(pc); // return to normal life
1.162 moko 3180: }
1.1 parser 3181: RC;
1.66 paf 3182: case '#': // comment start skipping
3183: if(end!=begin) {
1.84 paf 3184: if(!pc.string_start)
3185: pc.string_start=begin_pos;
1.66 paf 3186: // append piece till #
1.84 paf 3187: pc.string.append_strdup_know_length(begin, end-begin);
1.66 paf 3188: }
3189: // fall into COMMENT lexical state [wait for \n]
1.84 paf 3190: push_LS(pc, LS_EXPRESSION_COMMENT);
1.66 paf 3191: lexical_brackets_nestage=1;
3192: continue;
1.1 parser 3193: case '$':
1.84 paf 3194: push_LS(pc, LS_EXPRESSION_VAR_NAME_WITH_COLON);
1.1 parser 3195: RC;
3196: case '^':
1.84 paf 3197: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3198: RC;
3199: case '(':
3200: lexical_brackets_nestage++;
3201: RC;
3202: case '-':
1.84 paf 3203: switch(*pc.source) {
1.1 parser 3204: case 'f': // -f
3205: skip_analized=1;
3206: result=FEXISTS;
3207: goto break2;
3208: case 'd': // -d
3209: skip_analized=1;
3210: result=DEXISTS;
3211: goto break2;
1.63 paf 3212: default: // minus
1.1 parser 3213: result=c;
3214: goto break2;
3215: }
3216: goto break2;
1.25 paf 3217: case '+': case '*': case '/': case '%': case '\\':
1.1 parser 3218: case '~':
3219: case ';':
3220: RC;
1.65 paf 3221: case '&': case '|':
1.84 paf 3222: if(*pc.source==c) { // && ||
1.65 paf 3223: result=c=='&'?LAND:LOR;
1.1 parser 3224: skip_analized=1;
3225: } else
3226: result=c;
3227: goto break2;
1.65 paf 3228: case '!':
1.84 paf 3229: switch(pc.source[0]) {
1.65 paf 3230: case '|': // !| !||
3231: skip_analized=1;
1.84 paf 3232: if(pc.source[1]=='|') {
1.65 paf 3233: skip_analized++;
3234: result=LXOR;
3235: } else
3236: result=NXOR;
3237: goto break2;
3238: case '=': // !=
3239: skip_analized=1;
3240: result=NNE;
3241: goto break2;
3242: }
3243: RC;
1.67 paf 3244:
3245: case '<': // <<, <=, <
1.84 paf 3246: switch(*pc.source) {
1.67 paf 3247: case '<': // <[<]
3248: skip_analized=1; result=NSL; break;
3249: case '=': // <[=]
3250: skip_analized=1; result=NLE; break;
3251: default: // <[]
3252: result=c; break;
3253: }
3254: goto break2;
3255: case '>': // >>, >=, >
1.84 paf 3256: switch(*pc.source) {
1.67 paf 3257: case '>': // >[>]
3258: skip_analized=1; result=NSR; break;
3259: case '=': // >[=]
3260: skip_analized=1; result=NGE; break;
3261: default: // >[]
3262: result=c; break;
3263: }
3264: goto break2;
3265: case '=': // ==
1.84 paf 3266: switch(*pc.source) {
1.67 paf 3267: case '=': // =[=]
3268: skip_analized=1; result=NEQ; break;
3269: default: // =[]
3270: result=c; break; // not used now
3271: }
1.1 parser 3272: goto break2;
1.67 paf 3273:
1.1 parser 3274: case '"':
1.84 paf 3275: push_LS(pc, LS_EXPRESSION_STRING_QUOTED);
1.1 parser 3276: RC;
3277: case '\'':
1.84 paf 3278: push_LS(pc, LS_EXPRESSION_STRING_APOSTROFED);
1.1 parser 3279: RC;
3280: case 'l': case 'g': case 'e': case 'n':
3281: if(end==begin) // right after whitespace
1.84 paf 3282: if(isspace(pc.source[1])) {
3283: switch(*pc.source) {
1.1 parser 3284: // case '?': // ok [and bad cases, yacc would bark at them]
3285: case 't': // lt gt [et nt]
3286: result=c=='l'?SLT:c=='g'?SGT:BAD_STRING_COMPARISON_OPERATOR;
3287: skip_analized=1;
3288: goto break2;
3289: case 'e': // le ge ne [ee]
3290: result=c=='l'?SLE:c=='g'?SGE:c=='n'?SNE:BAD_STRING_COMPARISON_OPERATOR;
3291: skip_analized=1;
3292: goto break2;
3293: case 'q': // eq [lq gq nq]
3294: result=c=='e'?SEQ:BAD_STRING_COMPARISON_OPERATOR;
3295: skip_analized=1;
3296: goto break2;
3297: }
3298: }
3299: break;
3300: case 'i':
3301: if(end==begin) // right after whitespace
1.84 paf 3302: if(isspace(pc.source[1])) {
3303: switch(pc.source[0]) {
1.1 parser 3304: case 'n': // in
3305: skip_analized=1;
3306: result=IN;
3307: goto break2;
3308: case 's': // is
3309: skip_analized=1;
3310: result=IS;
3311: goto break2;
3312: }
3313: }
3314: break;
3315: case 'd':
3316: if(end==begin) // right after whitespace
1.84 paf 3317: if(pc.source[0]=='e' && pc.source[1]=='f') { // def
1.118 misha 3318: switch(pc.source[2]){
3319: case ' ': case '\t': case '\n': case '"': case '\'': case '^': case '$': // non-quoted string without whitespace after 'def' is not allowed
3320: skip_analized=2;
3321: result=DEF;
3322: goto break2;
3323: }
3324: // error: incorrect char after 'def'
1.1 parser 3325: }
3326: break;
1.107 paf 3327: case 't':
3328: if(end==begin) // right after whitespace
1.118 misha 3329: if(pc.source[0]=='r' && pc.source[1]=='u' && pc.source[2]=='e') { // true
1.107 paf 3330: skip_analized=3;
3331: result=LITERAL_TRUE;
3332: goto break2;
3333: }
3334: break;
3335: case 'f':
3336: if(end==begin) // right after whitespace
1.118 misha 3337: if(pc.source[0]=='a' && pc.source[1]=='l' && pc.source[2]=='s' && pc.source[3]=='e') { // false
1.107 paf 3338: skip_analized=4;
3339: result=LITERAL_FALSE;
3340: goto break2;
3341: }
3342: break;
1.1 parser 3343: case ' ': case '\t': case '\n':
3344: if(end!=begin) { // there were a string after previous operator?
3345: result=0; // return that string
3346: goto break2;
3347: }
3348: // that's a leading|traling space or after-operator-space
3349: // ignoring it
3350: // reset piece 'begin' position & line
1.84 paf 3351: begin=pc.source; // after whitespace char
3352: begin_pos=pc.pos;
1.1 parser 3353: continue;
3354: }
3355: break;
1.66 paf 3356: case LS_EXPRESSION_COMMENT:
3357: if(c=='(')
3358: lexical_brackets_nestage++;
3359:
1.84 paf 3360: switch(*pc.source) {
1.66 paf 3361: case '\n': case ')':
1.84 paf 3362: if(*pc.source==')')
1.66 paf 3363: if(--lexical_brackets_nestage!=0)
3364: continue;
3365:
3366: // skip comment
1.84 paf 3367: begin=pc.source;
3368: begin_pos=pc.pos;
1.66 paf 3369:
1.84 paf 3370: pop_LS(pc);
1.66 paf 3371: continue;
3372: }
3373: break;
1.1 parser 3374:
3375: // VARIABLE GET/PUT/WITH
1.11 parser 3376: case LS_VAR_NAME_SIMPLE_WITH_COLON:
3377: case LS_VAR_NAME_SIMPLE_WITHOUT_COLON:
3378: case LS_EXPRESSION_VAR_NAME_WITH_COLON:
3379: case LS_EXPRESSION_VAR_NAME_WITHOUT_COLON:
3380: if(
1.84 paf 3381: pc.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON ||
3382: pc.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.41 paf 3383: // name in expr ends also before
1.1 parser 3384: switch(c) {
1.41 paf 3385: // expression minus
1.1 parser 3386: case '-':
1.41 paf 3387: // expression integer division
3388: case '\\':
1.84 paf 3389: pop_LS(pc);
3390: pc.ungetc();
1.1 parser 3391: result=EON;
3392: goto break2;
3393: }
3394: }
1.11 parser 3395: if(
1.84 paf 3396: pc.ls==LS_VAR_NAME_SIMPLE_WITHOUT_COLON ||
3397: pc.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.1 parser 3398: // name already has ':', stop before next
3399: switch(c) {
3400: case ':':
1.84 paf 3401: pop_LS(pc);
3402: pc.ungetc();
1.1 parser 3403: result=EON;
3404: goto break2;
3405: }
3406: }
3407: switch(c) {
3408: case 0:
3409: case ' ': case '\t': case '\n':
3410: case ';':
3411: case ']': case '}': case ')':
3412: case '"': case '\'':
3413: case '<': case '>': // these stand for HTML brackets AND expression binary ops
1.146 misha 3414: case '+': case '*': case '/': case '\\': case '%':
1.1 parser 3415: case '&': case '|':
3416: case '=': case '!':
3417: // common delimiters
1.62 paf 3418: case ',': case '?': case '#':
1.113 paf 3419: // mysql column separators
3420: case '`':
1.1 parser 3421: // before call
3422: case '^':
1.84 paf 3423: pop_LS(pc);
3424: pc.ungetc();
1.1 parser 3425: result=EON;
3426: goto break2;
3427: case '[':
1.5 parser 3428: // $name.<[>code]
1.84 paf 3429: if(pc.pos.col>1/*not first column*/ && (
1.6 parser 3430: end[-1]=='$'/*was start of get*/ ||
3431: end[-1]==':'/*was class name delim */ ||
3432: end[-1]=='.'/*was name delim */
1.5 parser 3433: )) {
1.84 paf 3434: push_LS(pc, LS_NAME_SQUARE_PART);
1.5 parser 3435: lexical_brackets_nestage=1;
3436: RC;
3437: }
1.84 paf 3438: pc.ls=LS_VAR_SQUARE;
1.1 parser 3439: lexical_brackets_nestage=1;
3440: RC;
3441: case '{':
3442: if(begin==end) { // ${name}, no need of EON, switching LS
1.84 paf 3443: pc.ls=LS_VAR_NAME_CURLY;
1.1 parser 3444: } else {
1.84 paf 3445: pc.ls=LS_VAR_CURLY;
1.1 parser 3446: lexical_brackets_nestage=1;
3447: }
3448:
3449: RC;
3450: case '(':
1.84 paf 3451: pc.ls=LS_VAR_ROUND;
1.1 parser 3452: lexical_brackets_nestage=1;
3453: RC;
3454: case '.': // name part delim
3455: case '$': // name part subvar
1.3 parser 3456: case ':': // class<:>name
1.11 parser 3457: // go to _WITHOUT_COLON state variant...
1.84 paf 3458: if(pc.ls==LS_VAR_NAME_SIMPLE_WITH_COLON)
3459: pc.ls=LS_VAR_NAME_SIMPLE_WITHOUT_COLON;
3460: else if(pc.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON)
3461: pc.ls=LS_EXPRESSION_VAR_NAME_WITHOUT_COLON;
1.11 parser 3462: // ...stop before next ':'
1.1 parser 3463: RC;
3464: }
3465: break;
3466:
3467: case LS_VAR_NAME_CURLY:
3468: switch(c) {
1.5 parser 3469: case '[':
1.11 parser 3470: // ${name.<[>code]}
1.84 paf 3471: push_LS(pc, LS_NAME_SQUARE_PART);
1.3 parser 3472: lexical_brackets_nestage=1;
3473: RC;
1.1 parser 3474: case '}': // ${name} finished, restoring LS
1.84 paf 3475: pop_LS(pc);
1.1 parser 3476: RC;
3477: case '.': // name part delim
3478: case '$': // name part subvar
3479: case ':': // ':name' or 'class:name'
3480: RC;
3481: }
3482: break;
3483:
3484: case LS_VAR_SQUARE:
3485: switch(c) {
3486: case '$':
1.84 paf 3487: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3488: RC;
3489: case '^':
1.84 paf 3490: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3491: RC;
3492: case ']':
3493: if(--lexical_brackets_nestage==0) {
1.84 paf 3494: pop_LS(pc);
1.1 parser 3495: RC;
3496: }
3497: break;
3498: case ';': // operator_or_fmt;value delim
3499: RC;
3500: case '[':
3501: lexical_brackets_nestage++;
3502: break;
3503: }
3504: break;
3505:
3506: case LS_VAR_CURLY:
3507: switch(c) {
3508: case '$':
1.84 paf 3509: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3510: RC;
3511: case '^':
1.84 paf 3512: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3513: RC;
3514: case '}':
3515: if(--lexical_brackets_nestage==0) {
1.84 paf 3516: pop_LS(pc);
1.1 parser 3517: RC;
3518: }
3519: break;
3520: case '{':
3521: lexical_brackets_nestage++;
3522: break;
3523: }
3524: break;
3525:
3526: // METHOD CALL
3527: case LS_METHOD_NAME:
3528: switch(c) {
3529: case '[':
1.11 parser 3530: // ^name.<[>code].xxx
1.84 paf 3531: if(pc.pos.col>1/*not first column*/ && (
1.6 parser 3532: end[-1]=='^'/*was start of call*/ || // never, ^[ is literal...
3533: end[-1]==':'/*was class name delim */ ||
3534: end[-1]=='.'/*was name delim */
1.5 parser 3535: )) {
1.84 paf 3536: push_LS(pc, LS_NAME_SQUARE_PART);
1.5 parser 3537: lexical_brackets_nestage=1;
3538: RC;
3539: }
1.84 paf 3540: pc.ls=LS_METHOD_SQUARE;
1.1 parser 3541: lexical_brackets_nestage=1;
3542: RC;
3543: case '{':
1.84 paf 3544: pc.ls=LS_METHOD_CURLY;
1.1 parser 3545: lexical_brackets_nestage=1;
3546: RC;
3547: case '(':
1.84 paf 3548: pc.ls=LS_METHOD_ROUND;
1.1 parser 3549: lexical_brackets_nestage=1;
3550: RC;
3551: case '.': // name part delim
3552: case '$': // name part subvar
3553: case ':': // ':name' or 'class:name'
1.19 parser 3554: case '^': // ^abc^xxx wrong. bailing out
3555: case ']': case '}': case ')': // ^abc]}) wrong. bailing out
1.90 paf 3556: case ' ': // ^if ( wrong. bailing out
1.1 parser 3557: RC;
3558: }
3559: break;
3560:
3561: case LS_METHOD_SQUARE:
3562: switch(c) {
3563: case '$':
1.84 paf 3564: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3565: RC;
3566: case '^':
1.84 paf 3567: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3568: RC;
3569: case ';': // param delim
3570: RC;
3571: case ']':
3572: if(--lexical_brackets_nestage==0) {
1.84 paf 3573: pc.ls=LS_METHOD_AFTER;
1.1 parser 3574: RC;
3575: }
3576: break;
3577: case '[':
3578: lexical_brackets_nestage++;
3579: break;
3580: }
3581: break;
3582:
3583: case LS_METHOD_CURLY:
3584: switch(c) {
3585: case '$':
1.84 paf 3586: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3587: RC;
3588: case '^':
1.84 paf 3589: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3590: RC;
3591: case ';': // param delim
3592: RC;
3593: case '}':
3594: if(--lexical_brackets_nestage==0) {
1.84 paf 3595: pc.ls=LS_METHOD_AFTER;
1.1 parser 3596: RC;
3597: }
3598: break;
3599: case '{':
3600: lexical_brackets_nestage++;
3601: break;
3602: }
1.97 paf 3603: if(pc.explicit_result && c)
3604: switch(c) {
1.168 moko 3605: default:
3606: pc.string.append(c);
1.97 paf 3607: case '\n': case ' ': case '\t':
3608: begin=pc.source;
3609: begin_pos=pc.pos;
1.168 moko 3610: continue;
1.97 paf 3611: }
1.1 parser 3612: break;
3613:
3614: case LS_METHOD_AFTER:
3615: if(c=='[') {/* ][ }[ )[ */
1.84 paf 3616: pc.ls=LS_METHOD_SQUARE;
1.1 parser 3617: lexical_brackets_nestage=1;
3618: RC;
1.171 moko 3619: }
1.1 parser 3620: if(c=='{') {/* ]{ }{ ){ */
1.84 paf 3621: pc.ls=LS_METHOD_CURLY;
1.1 parser 3622: lexical_brackets_nestage=1;
3623: RC;
1.171 moko 3624: }
1.1 parser 3625: if(c=='(') {/* ]( }( )( */
1.84 paf 3626: pc.ls=LS_METHOD_ROUND;
1.1 parser 3627: lexical_brackets_nestage=1;
3628: RC;
1.171 moko 3629: }
1.84 paf 3630: pop_LS(pc);
3631: pc.ungetc();
1.1 parser 3632: result=EON;
3633: goto break2;
3634: }
3635: if(c==0) {
3636: result=-1;
3637: break;
3638: }
3639: }
3640:
3641: break2:
3642: if(end!=begin) { // there is last piece?
1.150 misha 3643: if(c=='@' || c==0) // we are before LS_DEF_NAME or EOF?
3644: while(end!=begin && end[-1]=='\n') // trim all empty lines before LS_DEF_NAME and EOF
1.1 parser 3645: end--;
1.84 paf 3646: if(end!=begin && pc.ls!=LS_USER_COMMENT) { // last piece still alive and not comment?
3647: if(!pc.string_start)
3648: pc.string_start=begin_pos;
1.1 parser 3649: // append it
1.84 paf 3650: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 3651: }
3652: }
1.84 paf 3653: if(!pc.string.is_empty()) { // something accumulated?
3654: // create STRING value: array of OP_VALUE+origin+vstring
1.170 moko 3655: #ifdef SYMBOLS_CACHING
3656: Value *lookup=symbols->get(pc.string);
3657: #else
3658: Value *lookup=0;
3659: #endif
1.171 moko 3660: *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 3661: // new pieces storage
1.84 paf 3662: pc.string.clear();
3663: pc.string_start.clear();
1.1 parser 3664: // make current result be pending for next call, return STRING for now
1.84 paf 3665: pc.pending_state=result; result=STRING;
1.1 parser 3666: }
3667: if(skip_analized) {
1.84 paf 3668: pc.source+=skip_analized; pc.pos.col+=skip_analized;
1.1 parser 3669: }
3670: return result;
3671: }
3672:
1.156 moko 3673: static int real_yyerror(Parse_control *pc, const char *s) { // Called by yyparse on error
1.171 moko 3674: strncpy(PC.error, s, MAX_STRING);
3675: return 1;
1.1 parser 3676: }
3677:
3678: static void yyprint(FILE *file, int type, YYSTYPE value) {
3679: if(type==STRING)
1.84 paf 3680: fprintf(file, " \"%s\"", LA2S(*value)->cstr());
1.1 parser 3681: }
E-mail: