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