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