Annotation of parser3/src/main/compile.tab.C, revision 1.160
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.159 misha 80: volatile const char * IDENT_COMPILE_Y = "$Id: compile.y,v 1.267 2015/03/16 09:47:34 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,
1.159 misha 576: 328, 328, 329, 329, 330, 330, 330, 334, 382, 383,
577: 383, 384, 386, 387, 388, 441, 442, 442, 446, 459,
578: 460, 461, 462, 488, 493, 496, 497, 498, 500, 503,
579: 500, 511, 519, 526, 527, 528, 530, 536, 537, 537,
580: 541, 554, 557, 554, 602, 604, 604, 606, 607, 608,
581: 610, 613, 610, 616, 617, 619, 620, 623, 624, 627,
582: 628, 630, 633, 647, 652, 653, 654, 659, 659, 661,
583: 661, 662, 663, 675, 684, 687, 688, 689, 690, 692,
584: 696, 705, 708, 705, 721, 726, 726, 727, 733, 734,
585: 736, 749, 761, 763, 764, 765, 766, 767, 768, 769,
586: 770, 772, 773, 774, 775, 776, 777, 778, 779, 781,
587: 782, 783, 784, 785, 786, 787, 788, 789, 790, 791,
588: 792, 793, 794, 795, 796, 797, 798, 799, 800, 801,
589: 802, 803, 804, 805, 806, 807, 810, 815, 836, 841,
590: 842, 843, 845
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.160 ! moko 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) {
1.160 ! moko 1835: strcpy(PC.error, "@" CLASS_NAME " equals @" BASE_NAME);
1.84 paf 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());
1.160 ! moko 1841: strcat(PC.error, ": you can not derive from this class in @" BASE_NAME);
1.84 paf 1842: YYERROR;
1843: }
1844: } else {
1.1 parser 1845: strcpy(PC.error, base_name.cstr());
1.160 ! moko 1846: strcat(PC.error, ": undefined class in @" BASE_NAME);
1.1 parser 1847: YYERROR;
1848: }
1849: } else {
1.160 ! moko 1850: strcpy(PC.error, "@" BASE_NAME " must contain sole name");
1.1 parser 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 {
1.160 ! moko 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.160 ! moko 1883: "'" OPTION_PARTIAL_CLASS "', '" OPTION_ALL_VARS_LOCAL_NAME "'"
! 1884: ", '" METHOD_CALL_TYPE_STATIC "' and '" METHOD_CALL_TYPE_DYNAMIC "'"
1.149 misha 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.160 ! moko 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
1.159 misha 1999: || !change_first(*code, OP::OP_VALUE__GET_ELEMENT, /*=>*/OP::OP_VALUE__GET_ELEMENT__WRITE)
1.140 misha 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
1.159 misha 2006: || !change_first(*code, OP::OP_WITH_SELF__VALUE__GET_ELEMENT, /*=>*/OP::OP_WITH_SELF__VALUE__GET_ELEMENT__WRITE)
1.140 misha 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
1.159 misha 2013: || !change_first(*code, OP::OP_GET_OBJECT_ELEMENT, /*=>*/OP::OP_GET_OBJECT_ELEMENT__WRITE)
1.140 misha 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
1.159 misha 2020: || !change_first(*code, OP::OP_GET_OBJECT_VAR_ELEMENT, /*=>*/OP::OP_GET_OBJECT_VAR_ELEMENT__WRITE)
1.140 misha 2021: )
1.131 misha 2022: #endif
1.159 misha 2023:
2024: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
2025: if(
2026: !change(*code, count-1/* last */, OP::OP_GET_ELEMENT__SPECIAL, /*=>*/OP::OP_GET_ELEMENT__SPECIAL__WRITE)
2027: )
2028: #endif
2029:
1.140 misha 2030: {
1.159 misha 2031: change_or_append(*code, count-1 /* last */,
2032: OP::OP_GET_ELEMENT, /*=>*/OP::OP_GET_ELEMENT__WRITE,
1.140 misha 2033: /*or */OP::OP_WRITE_VALUE
2034: ); /* value=pop; wcontext.write(value) */
1.139 misha 2035: }
1.140 misha 2036:
1.156 moko 2037: P(*(yyval), *code);
1.158 misha 2038: }
1.112 paf 2039: break;
2040:
1.115 misha 2041: case 38:
1.156 moko 2042:
1.158 misha 2043: /* Line 1806 of yacc.c */
1.159 misha 2044: #line 382 "compile.y"
1.158 misha 2045: { (yyval)=(yyvsp[(2) - (2)]); }
1.112 paf 2046: break;
2047:
1.115 misha 2048: case 41:
1.156 moko 2049:
1.158 misha 2050: /* Line 1806 of yacc.c */
1.159 misha 2051: #line 384 "compile.y"
1.158 misha 2052: { (yyval)=(yyvsp[(2) - (3)]); }
1.112 paf 2053: break;
2054:
1.115 misha 2055: case 44:
1.156 moko 2056:
1.158 misha 2057: /* Line 1806 of yacc.c */
1.159 misha 2058: #line 388 "compile.y"
1.112 paf 2059: {
1.156 moko 2060: (yyval)=N();
2061: YYSTYPE diving_code=(yyvsp[(1) - (1)]);
1.132 misha 2062: size_t count=diving_code->count();
1.140 misha 2063:
1.156 moko 2064: if(maybe_make_self(*(yyval), *diving_code, count)) {
1.140 misha 2065: // $self.
2066: } else
1.132 misha 2067:
2068: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_ELEMENT
1.156 moko 2069: if(maybe_make_get_object_element(*(yyval), *diving_code, count)){
1.138 misha 2070: // optimization for $object.field + ^object.method[
1.140 misha 2071: } else
1.131 misha 2072: #endif
1.132 misha 2073:
2074: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_VAR_ELEMENT
1.156 moko 2075: if(maybe_make_get_object_var_element(*(yyval), *diving_code, count)){
1.138 misha 2076: // optimization for $object.$var
1.140 misha 2077: } else
1.131 misha 2078: #endif
1.132 misha 2079:
2080: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
1.141 misha 2081: if(
2082: count>=4
2083: && (*diving_code)[0].code==OP::OP_VALUE
2084: && (*diving_code)[3].code==OP::OP_GET_ELEMENT
2085: ){
2086: // optimization
1.156 moko 2087: O(*(yyval),
1.140 misha 2088: (PC.in_call_value && count==4)
1.132 misha 2089: ? OP::OP_VALUE__GET_ELEMENT_OR_OPERATOR // ^object[ : OP_VALUE+origin+string+OP_GET_ELEMENT => OP_VALUE__GET_ELEMENT_OR_OPERATOR+origin+string
2090: : OP::OP_VALUE__GET_ELEMENT // $object : OP_VALUE+origin+string+OP_GET_ELEMENT => OP_VALUE__GET_ELEMENT+origin+string
2091: );
1.156 moko 2092: P(*(yyval), *diving_code, 1/*offset*/, 2/*limit*/); // copy origin+value
1.140 misha 2093: if(count>4)
1.156 moko 2094: P(*(yyval), *diving_code, 4); // copy tail
1.132 misha 2095: } else {
1.156 moko 2096: O(*(yyval), OP::OP_WITH_READ); /* stack: starting context */
2097: P(*(yyval), *diving_code);
1.132 misha 2098: }
1.126 misha 2099: #else
1.140 misha 2100: {
1.156 moko 2101: O(*(yyval), OP::OP_WITH_READ); /* stack: starting context */
1.37 paf 2102:
1.131 misha 2103: // ^if OP_ELEMENT => ^if OP_ELEMENT_OR_OPERATOR
2104: // optimized OP_VALUE+origin+string+OP_GET_ELEMENT. => OP_VALUE+origin+string+OP_GET_ELEMENT_OR_OPERATOR.
1.132 misha 2105: if(PC.in_call_value && count==4)
2106: diving_code->put(count-1, OP::OP_GET_ELEMENT_OR_OPERATOR);
1.156 moko 2107: P(*(yyval), *diving_code);
1.132 misha 2108: }
1.126 misha 2109: #endif
1.1 parser 2110: /* diving code; stack: current context */
1.158 misha 2111: }
1.112 paf 2112: break;
2113:
1.115 misha 2114: case 45:
1.156 moko 2115:
1.158 misha 2116: /* Line 1806 of yacc.c */
1.159 misha 2117: #line 441 "compile.y"
1.158 misha 2118: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); }
1.112 paf 2119: break;
2120:
1.115 misha 2121: case 47:
1.156 moko 2122:
1.158 misha 2123: /* Line 1806 of yacc.c */
1.159 misha 2124: #line 442 "compile.y"
1.158 misha 2125: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); }
1.112 paf 2126: break;
2127:
1.115 misha 2128: case 48:
1.156 moko 2129:
1.158 misha 2130: /* Line 1806 of yacc.c */
1.159 misha 2131: #line 446 "compile.y"
1.112 paf 2132: {
1.156 moko 2133: (yyval)=N();
1.137 misha 2134: #ifdef OPTIMIZE_BYTECODE_CONSTRUCT
1.156 moko 2135: if(maybe_optimize_construct(*(yyval), *(yyvsp[(2) - (3)]), *(yyvsp[(3) - (3)]))){
1.139 misha 2136: // $a(expr), $.a(expr), $a[value], $.a[value], $self.a[value], $self.a(expr)
1.134 misha 2137: } else
2138: #endif
2139: {
1.156 moko 2140: P(*(yyval), *(yyvsp[(2) - (3)])); /* stack: context,name */
2141: P(*(yyval), *(yyvsp[(3) - (3)])); /* stack: context,name,constructor_value */
1.134 misha 2142: }
1.158 misha 2143: }
1.112 paf 2144: break;
2145:
1.115 misha 2146: case 52:
1.156 moko 2147:
1.158 misha 2148: /* Line 1806 of yacc.c */
1.159 misha 2149: #line 462 "compile.y"
1.112 paf 2150: {
1.156 moko 2151: (yyval)=N();
2152: YYSTYPE diving_code=(yyvsp[(1) - (1)]);
1.140 misha 2153: size_t count=diving_code->count();
2154:
1.156 moko 2155: if(maybe_make_self(*(yyval), *diving_code, count)) {
1.140 misha 2156: // $self.
2157: } else
2158: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
2159: if(
2160: count>=4
2161: && (*diving_code)[0].code==OP::OP_VALUE
2162: && (*diving_code)[3].code==OP::OP_GET_ELEMENT
2163: ){
1.156 moko 2164: O(*(yyval), OP::OP_WITH_ROOT__VALUE__GET_ELEMENT);
2165: P(*(yyval), *diving_code, 1/*offset*/, 2/*limit*/); // copy origin+value
1.140 misha 2166: if(count>4)
1.156 moko 2167: P(*(yyval), *diving_code, 4); // tail
1.140 misha 2168: } else
2169: #endif
2170: {
1.156 moko 2171: O(*(yyval), OP::OP_WITH_ROOT); /* stack: starting context */
2172: P(*(yyval), *diving_code);
1.1 parser 2173: }
2174: /* diving code; stack: current context */
1.158 misha 2175: }
1.112 paf 2176: break;
2177:
1.115 misha 2178: case 53:
1.156 moko 2179:
1.158 misha 2180: /* Line 1806 of yacc.c */
1.159 misha 2181: #line 488 "compile.y"
1.112 paf 2182: {
1.156 moko 2183: (yyval)=N();
2184: O(*(yyval), OP::OP_WITH_WRITE); /* stack: starting context */
2185: P(*(yyval), *(yyvsp[(2) - (2)])); /* diving code; stack: context,name */
1.158 misha 2186: }
1.112 paf 2187: break;
2188:
1.115 misha 2189: case 54:
1.156 moko 2190:
1.158 misha 2191: /* Line 1806 of yacc.c */
1.159 misha 2192: #line 493 "compile.y"
1.158 misha 2193: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); }
1.112 paf 2194: break;
2195:
1.115 misha 2196: case 58:
1.156 moko 2197:
1.158 misha 2198: /* Line 1806 of yacc.c */
1.159 misha 2199: #line 500 "compile.y"
1.112 paf 2200: {
1.100 paf 2201: // allow $result_or_other_variable[ letters here any time ]
1.156 moko 2202: *reinterpret_cast<bool*>(&(yyval))=PC.explicit_result; PC.explicit_result=false;
1.158 misha 2203: }
1.112 paf 2204: break;
2205:
1.115 misha 2206: case 59:
1.156 moko 2207:
1.158 misha 2208: /* Line 1806 of yacc.c */
1.159 misha 2209: #line 503 "compile.y"
1.112 paf 2210: {
1.156 moko 2211: PC.explicit_result=*reinterpret_cast<bool*>(&(yyvsp[(2) - (3)]));
1.158 misha 2212: }
1.112 paf 2213: break;
2214:
1.115 misha 2215: case 60:
1.156 moko 2216:
1.158 misha 2217: /* Line 1806 of yacc.c */
1.159 misha 2218: #line 505 "compile.y"
1.112 paf 2219: {
1.1 parser 2220: // stack: context, name
1.156 moko 2221: (yyval)=(yyvsp[(3) - (5)]); // stack: context, name, value
2222: O(*(yyval), OP::OP_CONSTRUCT_VALUE); /* value=pop; name=pop; context=pop; construct(context,name,value) */
1.158 misha 2223: }
1.112 paf 2224: break;
2225:
1.115 misha 2226: case 61:
1.156 moko 2227:
1.158 misha 2228: /* Line 1806 of yacc.c */
1.159 misha 2229: #line 511 "compile.y"
1.112 paf 2230: {
1.156 moko 2231: (yyval)=N();
2232: O(*(yyval), OP::OP_PREPARE_TO_EXPRESSION);
1.1 parser 2233: // stack: context, name
1.156 moko 2234: P(*(yyval), *(yyvsp[(2) - (3)])); // stack: context, name, value
2235: O(*(yyval), OP::OP_CONSTRUCT_EXPR); /* value=pop->as_expr_result; name=pop; context=pop; construct(context,name,value) */
1.158 misha 2236: }
1.112 paf 2237: break;
2238:
1.115 misha 2239: case 62:
1.156 moko 2240:
1.158 misha 2241: /* Line 1806 of yacc.c */
1.159 misha 2242: #line 519 "compile.y"
1.112 paf 2243: {
1.1 parser 2244: // stack: context, name
1.156 moko 2245: (yyval)=N();
2246: OA(*(yyval), OP::OP_CURLY_CODE__CONSTRUCT, (yyvsp[(2) - (3)])); /* code=pop; name=pop; context=pop; construct(context,name,junction(code)) */
1.158 misha 2247: }
1.112 paf 2248: break;
2249:
1.115 misha 2250: case 66:
1.156 moko 2251:
1.158 misha 2252: /* Line 1806 of yacc.c */
1.159 misha 2253: #line 530 "compile.y"
1.112 paf 2254: {
1.156 moko 2255: (yyval)=N();
2256: OA(*(yyval), OP::OP_OBJECT_POOL, (yyvsp[(1) - (1)])); /* stack: empty write context */
1.47 paf 2257: /* some code that writes to that context */
2258: /* context=pop; stack: context.value() */
1.158 misha 2259: }
1.112 paf 2260: break;
2261:
1.115 misha 2262: case 69:
1.156 moko 2263:
1.158 misha 2264: /* Line 1806 of yacc.c */
1.159 misha 2265: #line 537 "compile.y"
1.158 misha 2266: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); }
1.112 paf 2267: break;
2268:
1.115 misha 2269: case 70:
1.156 moko 2270:
1.158 misha 2271: /* Line 1806 of yacc.c */
1.159 misha 2272: #line 541 "compile.y"
1.112 paf 2273: {
1.159 misha 2274: size_t count=(yyvsp[(1) - (1)])->count();
1.131 misha 2275: #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR
1.159 misha 2276: if(count)
1.131 misha 2277: #endif
2278: {
1.156 moko 2279: (yyval)=(yyvsp[(1) - (1)]); /* stack: value */
1.159 misha 2280: if(!change_first(*(yyval), OP::OP_CONSTRUCT_OBJECT, /*=>*/OP::OP_CONSTRUCT_OBJECT__WRITE))
2281: change_or_append(*(yyval), count-2 /* second last */,
2282: OP::OP_CALL, /*=>*/ OP::OP_CALL__WRITE,
1.142 misha 2283: /*or */OP::OP_WRITE_VALUE); /* value=pop; wcontext.write(value) */
1.131 misha 2284: }
1.158 misha 2285: }
1.112 paf 2286: break;
2287:
1.115 misha 2288: case 71:
1.156 moko 2289:
1.158 misha 2290: /* Line 1806 of yacc.c */
1.159 misha 2291: #line 554 "compile.y"
1.112 paf 2292: {
1.39 paf 2293: PC.in_call_value=true;
1.158 misha 2294: }
1.112 paf 2295: break;
2296:
1.115 misha 2297: case 72:
1.156 moko 2298:
1.158 misha 2299: /* Line 1806 of yacc.c */
1.159 misha 2300: #line 557 "compile.y"
1.112 paf 2301: {
1.39 paf 2302: PC.in_call_value=false;
1.158 misha 2303: }
1.112 paf 2304: break;
2305:
1.115 misha 2306: case 73:
1.156 moko 2307:
1.158 misha 2308: /* Line 1806 of yacc.c */
1.159 misha 2309: #line 560 "compile.y"
1.112 paf 2310: { /* ^field.$method{vasya} */
1.131 misha 2311: #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR
1.135 misha 2312: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
1.156 moko 2313: const String* operator_name=LA2S(*(yyvsp[(3) - (6)]), 0, OP::OP_VALUE__GET_ELEMENT_OR_OPERATOR);
1.135 misha 2314: #else
1.156 moko 2315: const String* operator_name=LA2S(*(yyvsp[(3) - (6)]), 1);
1.135 misha 2316: #endif
1.142 misha 2317: if(operator_name && *operator_name==REM_OPERATOR_NAME){
1.156 moko 2318: (yyval)=N();
1.131 misha 2319: } else
2320: #endif
2321: {
1.156 moko 2322: YYSTYPE params_code=(yyvsp[(5) - (6)]);
1.131 misha 2323: if(params_code->count()==3) { // probably [] case. [OP::OP_VALUE+origin+Void]
2324: if(Value* value=LA2V(*params_code)) // it is OP_VALUE+origin+value?
1.153 moko 2325: if(const String * string=value->get_string())
2326: if(string->is_empty()) // value is empty string?
2327: params_code=0; // ^zzz[] case. don't append lone empty param.
1.131 misha 2328: }
2329: /* stack: context, method_junction */
1.142 misha 2330:
1.156 moko 2331: YYSTYPE var_code=(yyvsp[(3) - (6)]);
1.142 misha 2332: if(
2333: var_code->count()==8
2334: && (*var_code)[0].code==OP::OP_VALUE__GET_CLASS
2335: && (*var_code)[3].code==OP::OP_PREPARE_TO_CONSTRUCT_OBJECT
2336: && (*var_code)[4].code==OP::OP_VALUE
2337: && (*var_code)[7].code==OP::OP_GET_ELEMENT
2338: ){
1.159 misha 2339: (yyval)=N();
1.156 moko 2340: O(*(yyval), OP::OP_CONSTRUCT_OBJECT);
2341: P(*(yyval), *var_code, 1/*offset*/, 2/*limit*/); // class name
2342: P(*(yyval), *var_code, 5/*offset*/, 2/*limit*/); // constructor name
2343: OA(*(yyval), params_code);
1.142 misha 2344: } else
2345: {
1.156 moko 2346: (yyval)=var_code; /* with_xxx,diving code; stack: context,method_junction */
2347: OA(*(yyval), OP::OP_CALL, params_code); // method_frame=make frame(pop junction); ncontext=pop; call(ncontext,method_frame) stack: value
1.142 misha 2348: }
1.131 misha 2349: }
1.158 misha 2350: }
1.112 paf 2351: break;
2352:
1.115 misha 2353: case 76:
1.156 moko 2354:
1.158 misha 2355: /* Line 1806 of yacc.c */
1.159 misha 2356: #line 604 "compile.y"
1.158 misha 2357: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); }
1.112 paf 2358: break;
2359:
1.115 misha 2360: case 80:
1.156 moko 2361:
1.158 misha 2362: /* Line 1806 of yacc.c */
1.159 misha 2363: #line 610 "compile.y"
1.112 paf 2364: {
1.100 paf 2365: // allow ^call[ letters here any time ]
1.156 moko 2366: *reinterpret_cast<bool*>(&(yyval))=PC.explicit_result; PC.explicit_result=false;
1.158 misha 2367: }
1.112 paf 2368: break;
2369:
1.115 misha 2370: case 81:
1.156 moko 2371:
1.158 misha 2372: /* Line 1806 of yacc.c */
1.159 misha 2373: #line 613 "compile.y"
1.112 paf 2374: {
1.156 moko 2375: PC.explicit_result=*reinterpret_cast<bool*>(&(yyvsp[(2) - (3)]));
1.158 misha 2376: }
1.112 paf 2377: break;
2378:
1.115 misha 2379: case 82:
1.156 moko 2380:
1.158 misha 2381: /* Line 1806 of yacc.c */
1.159 misha 2382: #line 615 "compile.y"
1.158 misha 2383: {(yyval)=(yyvsp[(3) - (5)]);}
1.112 paf 2384: break;
2385:
1.115 misha 2386: case 83:
1.156 moko 2387:
1.158 misha 2388: /* Line 1806 of yacc.c */
1.159 misha 2389: #line 616 "compile.y"
1.158 misha 2390: {(yyval)=(yyvsp[(2) - (3)]);}
1.112 paf 2391: break;
2392:
1.115 misha 2393: case 84:
1.156 moko 2394:
1.158 misha 2395: /* Line 1806 of yacc.c */
1.159 misha 2396: #line 617 "compile.y"
1.158 misha 2397: {(yyval)=(yyvsp[(2) - (3)]);}
1.112 paf 2398: break;
2399:
1.115 misha 2400: case 86:
1.156 moko 2401:
1.158 misha 2402: /* Line 1806 of yacc.c */
1.159 misha 2403: #line 620 "compile.y"
1.158 misha 2404: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); }
1.112 paf 2405: break;
2406:
1.115 misha 2407: case 88:
1.156 moko 2408:
1.158 misha 2409: /* Line 1806 of yacc.c */
1.159 misha 2410: #line 624 "compile.y"
1.158 misha 2411: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); }
1.112 paf 2412: break;
2413:
1.115 misha 2414: case 90:
1.156 moko 2415:
1.158 misha 2416: /* Line 1806 of yacc.c */
1.159 misha 2417: #line 628 "compile.y"
1.158 misha 2418: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); }
1.112 paf 2419: break;
2420:
1.115 misha 2421: case 91:
1.156 moko 2422:
1.158 misha 2423: /* Line 1806 of yacc.c */
1.159 misha 2424: #line 630 "compile.y"
1.112 paf 2425: {
1.156 moko 2426: (yyval)=(yyvsp[(1) - (1)]);
1.158 misha 2427: }
1.112 paf 2428: break;
2429:
1.115 misha 2430: case 92:
1.156 moko 2431:
1.158 misha 2432: /* Line 1806 of yacc.c */
1.159 misha 2433: #line 633 "compile.y"
1.112 paf 2434: {
1.156 moko 2435: YYSTYPE expr_code=(yyvsp[(1) - (1)]);
1.106 paf 2436: if(expr_code->count()==3
1.127 misha 2437: && (*expr_code)[0].code==OP::OP_VALUE) { // optimizing (double/bool/incidently 'string' too) case. [OP::OP_VALUE+origin+Double]. no evaluating
1.156 moko 2438: (yyval)=expr_code;
1.104 paf 2439: } else {
1.131 misha 2440: YYSTYPE code=N();
1.122 misha 2441: O(*code, OP::OP_PREPARE_TO_EXPRESSION);
1.104 paf 2442: P(*code, *expr_code);
1.122 misha 2443: O(*code, OP::OP_WRITE_EXPR_RESULT);
1.156 moko 2444: (yyval)=N();
2445: OA(*(yyval), OP::OP_EXPR_CODE__STORE_PARAM, code);
1.104 paf 2446: }
1.158 misha 2447: }
1.112 paf 2448: break;
2449:
1.115 misha 2450: case 93:
1.156 moko 2451:
1.158 misha 2452: /* Line 1806 of yacc.c */
1.159 misha 2453: #line 647 "compile.y"
1.112 paf 2454: {
1.156 moko 2455: (yyval)=N();
2456: OA(*(yyval), OP::OP_CURLY_CODE__STORE_PARAM, (yyvsp[(1) - (1)]));
1.158 misha 2457: }
1.112 paf 2458: break;
2459:
1.115 misha 2460: case 98:
1.156 moko 2461:
1.158 misha 2462: /* Line 1806 of yacc.c */
1.159 misha 2463: #line 659 "compile.y"
1.158 misha 2464: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); }
1.112 paf 2465: break;
2466:
1.115 misha 2467: case 100:
1.156 moko 2468:
1.158 misha 2469: /* Line 1806 of yacc.c */
1.159 misha 2470: #line 661 "compile.y"
1.158 misha 2471: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); }
1.112 paf 2472: break;
2473:
1.115 misha 2474: case 102:
1.156 moko 2475:
1.158 misha 2476: /* Line 1806 of yacc.c */
1.159 misha 2477: #line 663 "compile.y"
1.112 paf 2478: {
1.33 paf 2479: // we know that name_advance1 not called from ^xxx context
2480: // so we'll not check for operator call possibility as we do in name_advance2
2481:
1.1 parser 2482: /* stack: context */
1.156 moko 2483: (yyval)=(yyvsp[(1) - (1)]); /* stack: context,name */
1.159 misha 2484: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
2485: O(*(yyval), is_special_element(*(yyval)) ? OP::OP_GET_ELEMENT__SPECIAL : OP::OP_GET_ELEMENT);
2486: #else
1.156 moko 2487: O(*(yyval), OP::OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.159 misha 2488: #endif
1.158 misha 2489: }
1.112 paf 2490: break;
2491:
1.115 misha 2492: case 103:
1.156 moko 2493:
1.158 misha 2494: /* Line 1806 of yacc.c */
1.159 misha 2495: #line 675 "compile.y"
1.112 paf 2496: {
1.1 parser 2497: /* stack: context */
1.156 moko 2498: (yyval)=(yyvsp[(1) - (1)]); /* stack: context,name */
1.159 misha 2499: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
2500: O(*(yyval), is_special_element(*(yyval)) ? OP::OP_GET_ELEMENT__SPECIAL : OP::OP_GET_ELEMENT);
2501: #else
1.156 moko 2502: O(*(yyval), OP::OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.159 misha 2503: #endif
1.158 misha 2504: }
1.112 paf 2505: break;
2506:
1.115 misha 2507: case 109:
1.156 moko 2508:
1.158 misha 2509: /* Line 1806 of yacc.c */
1.159 misha 2510: #line 692 "compile.y"
1.112 paf 2511: {
1.156 moko 2512: (yyval)=(yyvsp[(2) - (2)]);
2513: O(*(yyval), OP::OP_GET_ELEMENT);
1.158 misha 2514: }
1.112 paf 2515: break;
2516:
1.115 misha 2517: case 110:
1.156 moko 2518:
1.158 misha 2519: /* Line 1806 of yacc.c */
1.159 misha 2520: #line 696 "compile.y"
1.112 paf 2521: {
1.131 misha 2522: YYSTYPE code;
1.47 paf 2523: {
1.156 moko 2524: change_string_literal_to_write_string_literal(*(code=(yyvsp[(1) - (2)])));
2525: P(*code, *(yyvsp[(2) - (2)]));
1.47 paf 2526: }
1.156 moko 2527: (yyval)=N();
2528: OA(*(yyval), OP::OP_STRING_POOL, code);
1.158 misha 2529: }
1.112 paf 2530: break;
2531:
1.115 misha 2532: case 111:
1.156 moko 2533:
1.158 misha 2534: /* Line 1806 of yacc.c */
1.159 misha 2535: #line 705 "compile.y"
1.112 paf 2536: {
1.100 paf 2537: // allow $result_or_other_variable[ letters here any time ]
1.156 moko 2538: *reinterpret_cast<bool*>(&(yyval))=PC.explicit_result; PC.explicit_result=false;
1.158 misha 2539: }
1.112 paf 2540: break;
2541:
1.115 misha 2542: case 112:
1.156 moko 2543:
1.158 misha 2544: /* Line 1806 of yacc.c */
1.159 misha 2545: #line 708 "compile.y"
1.112 paf 2546: {
1.156 moko 2547: PC.explicit_result=*reinterpret_cast<bool*>(&(yyvsp[(2) - (3)]));
1.158 misha 2548: }
1.112 paf 2549: break;
2550:
1.115 misha 2551: case 113:
1.156 moko 2552:
1.158 misha 2553: /* Line 1806 of yacc.c */
1.159 misha 2554: #line 710 "compile.y"
1.112 paf 2555: {
1.156 moko 2556: (yyval)=N();
1.159 misha 2557: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
2558: if(!maybe_append_simple_diving_code(*(yyval), *(yyvsp[(3) - (5)])))
2559: #endif
2560: {
1.156 moko 2561: OA(*(yyval), OP::OP_OBJECT_POOL, (yyvsp[(3) - (5)])); /* stack: empty write context */
1.47 paf 2562: /* some code that writes to that context */
2563: /* context=pop; stack: context.value() */
1.159 misha 2564: }
1.158 misha 2565: }
1.112 paf 2566: break;
2567:
1.115 misha 2568: case 114:
1.156 moko 2569:
1.158 misha 2570: /* Line 1806 of yacc.c */
1.159 misha 2571: #line 721 "compile.y"
1.112 paf 2572: {
1.156 moko 2573: (yyval)=N();
2574: O(*(yyval), OP::OP_WITH_READ);
2575: P(*(yyval), *(yyvsp[(1) - (1)]));
1.158 misha 2576: }
1.112 paf 2577: break;
2578:
1.115 misha 2579: case 116:
1.156 moko 2580:
1.158 misha 2581: /* Line 1806 of yacc.c */
1.159 misha 2582: #line 726 "compile.y"
1.158 misha 2583: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); }
1.112 paf 2584: break;
2585:
1.115 misha 2586: case 117:
1.156 moko 2587:
1.158 misha 2588: /* Line 1806 of yacc.c */
1.159 misha 2589: #line 727 "compile.y"
1.112 paf 2590: {
1.156 moko 2591: (yyval)=(yyvsp[(2) - (2)]);
2592: O(*(yyval), OP::OP_GET_ELEMENT__WRITE);
1.158 misha 2593: }
1.112 paf 2594: break;
2595:
1.115 misha 2596: case 120:
1.156 moko 2597:
1.158 misha 2598: /* Line 1806 of yacc.c */
1.159 misha 2599: #line 736 "compile.y"
1.112 paf 2600: {
1.156 moko 2601: (yyval)=(yyvsp[(1) - (2)]); // stack: class name string
2602: if(*LA2S(*(yyval)) == BASE_NAME) { // pseudo BASE class
1.84 paf 2603: if(VStateless_class* base=PC.cclass->base_class()) {
1.156 moko 2604: change_string_literal_value(*(yyval), base->name());
1.61 paf 2605: } else {
2606: strcpy(PC.error, "no base class declared");
2607: YYERROR;
2608: }
2609: }
1.131 misha 2610: // optimized OP_VALUE+origin+string+OP_GET_CLASS => OP_VALUE__GET_CLASS+origin+string
1.159 misha 2611: change_first(*(yyval), OP::OP_VALUE, OP::OP_VALUE__GET_CLASS);
1.158 misha 2612: }
1.112 paf 2613: break;
2614:
1.115 misha 2615: case 121:
1.156 moko 2616:
1.158 misha 2617: /* Line 1806 of yacc.c */
1.159 misha 2618: #line 749 "compile.y"
1.112 paf 2619: {
1.156 moko 2620: (yyval)=(yyvsp[(1) - (2)]);
1.39 paf 2621: if(!PC.in_call_value) {
1.1 parser 2622: strcpy(PC.error, ":: not allowed here");
2623: YYERROR;
2624: }
1.156 moko 2625: O(*(yyval), OP::OP_PREPARE_TO_CONSTRUCT_OBJECT);
1.158 misha 2626: }
1.112 paf 2627: break;
2628:
1.115 misha 2629: case 128:
1.156 moko 2630:
1.158 misha 2631: /* Line 1806 of yacc.c */
1.159 misha 2632: #line 768 "compile.y"
1.158 misha 2633: { (yyval) = (yyvsp[(2) - (3)]); }
1.114 misha 2634: break;
2635:
1.115 misha 2636: case 129:
1.156 moko 2637:
1.158 misha 2638: /* Line 1806 of yacc.c */
1.159 misha 2639: #line 769 "compile.y"
1.158 misha 2640: { (yyval) = (yyvsp[(2) - (3)]); }
1.112 paf 2641: break;
2642:
1.115 misha 2643: case 130:
1.156 moko 2644:
1.158 misha 2645: /* Line 1806 of yacc.c */
1.159 misha 2646: #line 770 "compile.y"
1.158 misha 2647: { (yyval) = (yyvsp[(2) - (3)]); }
1.112 paf 2648: break;
2649:
1.115 misha 2650: case 131:
1.156 moko 2651:
1.158 misha 2652: /* Line 1806 of yacc.c */
1.159 misha 2653: #line 772 "compile.y"
1.158 misha 2654: { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_NEG); }
1.112 paf 2655: break;
2656:
1.115 misha 2657: case 132:
1.156 moko 2658:
1.158 misha 2659: /* Line 1806 of yacc.c */
1.159 misha 2660: #line 773 "compile.y"
1.158 misha 2661: { (yyval)=(yyvsp[(2) - (2)]); }
1.112 paf 2662: break;
2663:
1.115 misha 2664: case 133:
1.156 moko 2665:
1.158 misha 2666: /* Line 1806 of yacc.c */
1.159 misha 2667: #line 774 "compile.y"
1.158 misha 2668: { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_INV); }
1.112 paf 2669: break;
2670:
1.115 misha 2671: case 134:
1.156 moko 2672:
1.158 misha 2673: /* Line 1806 of yacc.c */
1.159 misha 2674: #line 775 "compile.y"
1.158 misha 2675: { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_NOT); }
1.112 paf 2676: break;
2677:
1.115 misha 2678: case 135:
1.156 moko 2679:
1.158 misha 2680: /* Line 1806 of yacc.c */
1.159 misha 2681: #line 776 "compile.y"
1.158 misha 2682: { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_DEF); }
1.112 paf 2683: break;
2684:
1.115 misha 2685: case 136:
1.156 moko 2686:
1.158 misha 2687: /* Line 1806 of yacc.c */
1.159 misha 2688: #line 777 "compile.y"
1.158 misha 2689: { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_IN); }
1.112 paf 2690: break;
2691:
1.115 misha 2692: case 137:
1.156 moko 2693:
1.158 misha 2694: /* Line 1806 of yacc.c */
1.159 misha 2695: #line 778 "compile.y"
1.158 misha 2696: { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_FEXISTS); }
1.112 paf 2697: break;
2698:
1.115 misha 2699: case 138:
1.156 moko 2700:
1.158 misha 2701: /* Line 1806 of yacc.c */
1.159 misha 2702: #line 779 "compile.y"
1.158 misha 2703: { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_DEXISTS); }
1.112 paf 2704: break;
2705:
1.115 misha 2706: case 139:
1.156 moko 2707:
1.158 misha 2708: /* Line 1806 of yacc.c */
1.159 misha 2709: #line 781 "compile.y"
1.158 misha 2710: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_SUB); }
1.112 paf 2711: break;
2712:
1.115 misha 2713: case 140:
1.156 moko 2714:
1.158 misha 2715: /* Line 1806 of yacc.c */
1.159 misha 2716: #line 782 "compile.y"
1.158 misha 2717: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_ADD); }
1.112 paf 2718: break;
2719:
1.115 misha 2720: case 141:
1.156 moko 2721:
1.158 misha 2722: /* Line 1806 of yacc.c */
1.159 misha 2723: #line 783 "compile.y"
1.158 misha 2724: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_MUL); }
1.112 paf 2725: break;
2726:
1.115 misha 2727: case 142:
1.156 moko 2728:
1.158 misha 2729: /* Line 1806 of yacc.c */
1.159 misha 2730: #line 784 "compile.y"
1.158 misha 2731: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_DIV); }
1.112 paf 2732: break;
2733:
1.115 misha 2734: case 143:
1.156 moko 2735:
1.158 misha 2736: /* Line 1806 of yacc.c */
1.159 misha 2737: #line 785 "compile.y"
1.158 misha 2738: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_MOD); }
1.112 paf 2739: break;
2740:
1.115 misha 2741: case 144:
1.156 moko 2742:
1.158 misha 2743: /* Line 1806 of yacc.c */
1.159 misha 2744: #line 786 "compile.y"
1.158 misha 2745: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_INTDIV); }
1.112 paf 2746: break;
2747:
1.115 misha 2748: case 145:
1.156 moko 2749:
1.158 misha 2750: /* Line 1806 of yacc.c */
1.159 misha 2751: #line 787 "compile.y"
1.158 misha 2752: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_SL); }
1.112 paf 2753: break;
2754:
1.115 misha 2755: case 146:
1.156 moko 2756:
1.158 misha 2757: /* Line 1806 of yacc.c */
1.159 misha 2758: #line 788 "compile.y"
1.158 misha 2759: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_SR); }
1.112 paf 2760: break;
2761:
1.115 misha 2762: case 147:
1.156 moko 2763:
1.158 misha 2764: /* Line 1806 of yacc.c */
1.159 misha 2765: #line 789 "compile.y"
1.158 misha 2766: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_AND); }
1.112 paf 2767: break;
2768:
1.115 misha 2769: case 148:
1.156 moko 2770:
1.158 misha 2771: /* Line 1806 of yacc.c */
1.159 misha 2772: #line 790 "compile.y"
1.158 misha 2773: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_OR); }
1.112 paf 2774: break;
2775:
1.115 misha 2776: case 149:
1.156 moko 2777:
1.158 misha 2778: /* Line 1806 of yacc.c */
1.159 misha 2779: #line 791 "compile.y"
1.158 misha 2780: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_XOR); }
1.112 paf 2781: break;
2782:
1.115 misha 2783: case 150:
1.156 moko 2784:
1.158 misha 2785: /* Line 1806 of yacc.c */
1.159 misha 2786: #line 792 "compile.y"
1.158 misha 2787: { (yyval)=(yyvsp[(1) - (3)]); OA(*(yyval), OP::OP_NESTED_CODE, (yyvsp[(3) - (3)])); O(*(yyval), OP::OP_LOG_AND); }
1.112 paf 2788: break;
2789:
1.115 misha 2790: case 151:
1.156 moko 2791:
1.158 misha 2792: /* Line 1806 of yacc.c */
1.159 misha 2793: #line 793 "compile.y"
1.158 misha 2794: { (yyval)=(yyvsp[(1) - (3)]); OA(*(yyval), OP::OP_NESTED_CODE, (yyvsp[(3) - (3)])); O(*(yyval), OP::OP_LOG_OR); }
1.112 paf 2795: break;
2796:
1.115 misha 2797: case 152:
1.156 moko 2798:
1.158 misha 2799: /* Line 1806 of yacc.c */
1.159 misha 2800: #line 794 "compile.y"
1.158 misha 2801: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_LOG_XOR); }
1.112 paf 2802: break;
2803:
1.115 misha 2804: case 153:
1.156 moko 2805:
1.158 misha 2806: /* Line 1806 of yacc.c */
1.159 misha 2807: #line 795 "compile.y"
1.158 misha 2808: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_LT); }
1.112 paf 2809: break;
2810:
1.115 misha 2811: case 154:
1.156 moko 2812:
1.158 misha 2813: /* Line 1806 of yacc.c */
1.159 misha 2814: #line 796 "compile.y"
1.158 misha 2815: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_GT); }
1.112 paf 2816: break;
2817:
1.115 misha 2818: case 155:
1.156 moko 2819:
1.158 misha 2820: /* Line 1806 of yacc.c */
1.159 misha 2821: #line 797 "compile.y"
1.158 misha 2822: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_LE); }
1.112 paf 2823: break;
2824:
1.115 misha 2825: case 156:
1.156 moko 2826:
1.158 misha 2827: /* Line 1806 of yacc.c */
1.159 misha 2828: #line 798 "compile.y"
1.158 misha 2829: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_GE); }
1.112 paf 2830: break;
2831:
1.115 misha 2832: case 157:
1.156 moko 2833:
1.158 misha 2834: /* Line 1806 of yacc.c */
1.159 misha 2835: #line 799 "compile.y"
1.158 misha 2836: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_EQ); }
1.112 paf 2837: break;
2838:
1.115 misha 2839: case 158:
1.156 moko 2840:
1.158 misha 2841: /* Line 1806 of yacc.c */
1.159 misha 2842: #line 800 "compile.y"
1.158 misha 2843: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_NE); }
1.112 paf 2844: break;
2845:
1.115 misha 2846: case 159:
1.156 moko 2847:
1.158 misha 2848: /* Line 1806 of yacc.c */
1.159 misha 2849: #line 801 "compile.y"
1.158 misha 2850: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_LT); }
1.112 paf 2851: break;
2852:
1.115 misha 2853: case 160:
1.156 moko 2854:
1.158 misha 2855: /* Line 1806 of yacc.c */
1.159 misha 2856: #line 802 "compile.y"
1.158 misha 2857: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_GT); }
1.112 paf 2858: break;
2859:
1.115 misha 2860: case 161:
1.156 moko 2861:
1.158 misha 2862: /* Line 1806 of yacc.c */
1.159 misha 2863: #line 803 "compile.y"
1.158 misha 2864: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_LE); }
1.112 paf 2865: break;
2866:
1.115 misha 2867: case 162:
1.156 moko 2868:
1.158 misha 2869: /* Line 1806 of yacc.c */
1.159 misha 2870: #line 804 "compile.y"
1.158 misha 2871: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_GE); }
1.112 paf 2872: break;
2873:
1.115 misha 2874: case 163:
1.156 moko 2875:
1.158 misha 2876: /* Line 1806 of yacc.c */
1.159 misha 2877: #line 805 "compile.y"
1.158 misha 2878: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_EQ); }
1.112 paf 2879: break;
2880:
1.115 misha 2881: case 164:
1.156 moko 2882:
1.158 misha 2883: /* Line 1806 of yacc.c */
1.159 misha 2884: #line 806 "compile.y"
1.158 misha 2885: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_NE); }
1.112 paf 2886: break;
2887:
1.115 misha 2888: case 165:
1.156 moko 2889:
1.158 misha 2890: /* Line 1806 of yacc.c */
1.159 misha 2891: #line 807 "compile.y"
1.158 misha 2892: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_IS); }
1.112 paf 2893: break;
2894:
1.115 misha 2895: case 166:
1.156 moko 2896:
1.158 misha 2897: /* Line 1806 of yacc.c */
1.159 misha 2898: #line 810 "compile.y"
1.112 paf 2899: {
1.131 misha 2900: // optimized OP_STRING => OP_VALUE for doubles
1.156 moko 2901: maybe_change_string_literal_to_double_literal(*((yyval)=(yyvsp[(1) - (1)])));
1.158 misha 2902: }
1.112 paf 2903: break;
2904:
1.115 misha 2905: case 167:
1.156 moko 2906:
1.158 misha 2907: /* Line 1806 of yacc.c */
1.159 misha 2908: #line 815 "compile.y"
1.112 paf 2909: {
1.131 misha 2910: #ifdef OPTIMIZE_BYTECODE_STRING_POOL
2911: // it brakes ^if(" 09 "){...}
1.156 moko 2912: YYSTYPE code=(yyvsp[(1) - (1)]);
2913: (yyval)=N();
1.159 misha 2914: if(code->count()==3 && change_first(*code, OP::OP_STRING__WRITE, OP::OP_VALUE)){
1.131 misha 2915: // optimized OP_STRING__WRITE+origin+value => OP_VALUE+origin+value without starting OP_STRING_POOL
1.156 moko 2916: P(*(yyval), *code);
1.131 misha 2917: } else {
1.156 moko 2918: OA(*(yyval), OP::OP_STRING_POOL, code); /* stack: empty write context */
1.131 misha 2919: }
2920: #else
1.156 moko 2921: (yyval)=N();
2922: OA(*(yyval), OP::OP_STRING_POOL, (yyvsp[(1) - (1)])); /* stack: empty write context */
1.131 misha 2923: #endif
1.47 paf 2924: /* some code that writes to that context */
2925: /* context=pop; stack: context.get_string() */
1.158 misha 2926: }
1.112 paf 2927: break;
2928:
1.115 misha 2929: case 168:
1.156 moko 2930:
1.158 misha 2931: /* Line 1806 of yacc.c */
1.159 misha 2932: #line 836 "compile.y"
1.112 paf 2933: {
1.131 misha 2934: // optimized OP_STRING+OP_WRITE_VALUE => OP_STRING__WRITE
1.156 moko 2935: change_string_literal_to_write_string_literal(*((yyval)=(yyvsp[(1) - (1)])));
1.158 misha 2936: }
1.112 paf 2937: break;
2938:
1.115 misha 2939: case 169:
1.156 moko 2940:
1.158 misha 2941: /* Line 1806 of yacc.c */
1.159 misha 2942: #line 841 "compile.y"
1.158 misha 2943: { (yyval)=VL(/*we know that we will not change it*/const_cast<VString*>(&vempty), 0, 0, 0); }
1.112 paf 2944: break;
2945:
1.115 misha 2946: case 170:
1.156 moko 2947:
1.158 misha 2948: /* Line 1806 of yacc.c */
1.159 misha 2949: #line 842 "compile.y"
1.158 misha 2950: { (yyval) = VL(/*we know that we will not change it*/const_cast<VBool*>(&vtrue), 0, 0, 0); }
1.112 paf 2951: break;
2952:
1.115 misha 2953: case 171:
1.156 moko 2954:
1.158 misha 2955: /* Line 1806 of yacc.c */
1.159 misha 2956: #line 843 "compile.y"
1.158 misha 2957: { (yyval) = VL(/*we know that we will not change it*/const_cast<VBool*>(&vfalse), 0, 0, 0); }
1.112 paf 2958: break;
2959:
1.115 misha 2960: case 172:
1.156 moko 2961:
1.158 misha 2962: /* Line 1806 of yacc.c */
1.159 misha 2963: #line 845 "compile.y"
1.158 misha 2964: { (yyval)=N(); }
1.155 misha 2965: break;
1.154 moko 2966:
1.112 paf 2967:
1.156 moko 2968:
1.158 misha 2969: /* Line 1806 of yacc.c */
1.159 misha 2970: #line 2971 "compile.tab.C"
1.156 moko 2971: default: break;
1.155 misha 2972: }
1.158 misha 2973: /* User semantic actions sometimes alter yychar, and that requires
2974: that yytoken be updated with the new translation. We take the
2975: approach of translating immediately before every use of yytoken.
2976: One alternative is translating here after every semantic action,
2977: but that translation would be missed if the semantic action invokes
2978: YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2979: if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2980: incorrect destructor might then be invoked immediately. In the
2981: case of YYERROR or YYBACKUP, subsequent parser actions might lead
2982: to an incorrect destructor call or verbose syntax error message
2983: before the lookahead is translated. */
1.156 moko 2984: YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1.112 paf 2985:
1.156 moko 2986: YYPOPSTACK (yylen);
2987: yylen = 0;
1.112 paf 2988: YY_STACK_PRINT (yyss, yyssp);
1.1 parser 2989:
2990: *++yyvsp = yyval;
2991:
1.112 paf 2992: /* Now `shift' the result of the reduction. Determine what state
2993: that goes to, based on the state we popped back to and the rule
2994: number reduced by. */
1.1 parser 2995:
2996: yyn = yyr1[yyn];
2997:
1.112 paf 2998: yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2999: if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1.1 parser 3000: yystate = yytable[yystate];
3001: else
1.112 paf 3002: yystate = yydefgoto[yyn - YYNTOKENS];
1.1 parser 3003:
3004: goto yynewstate;
3005:
3006:
1.112 paf 3007: /*------------------------------------.
3008: | yyerrlab -- here on detecting error |
3009: `------------------------------------*/
3010: yyerrlab:
1.158 misha 3011: /* Make sure we have latest lookahead translation. See comments at
3012: user semantic actions for why this is necessary. */
3013: yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
3014:
1.112 paf 3015: /* If not already recovering from an error, report this error. */
3016: if (!yyerrstatus)
1.1 parser 3017: {
3018: ++yynerrs;
1.156 moko 3019: #if ! YYERROR_VERBOSE
3020: yyerror (YY_("syntax error"));
3021: #else
1.158 misha 3022: # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
3023: yyssp, yytoken)
1.156 moko 3024: {
1.158 misha 3025: char const *yymsgp = YY_("syntax error");
3026: int yysyntax_error_status;
3027: yysyntax_error_status = YYSYNTAX_ERROR;
3028: if (yysyntax_error_status == 0)
3029: yymsgp = yymsg;
3030: else if (yysyntax_error_status == 1)
3031: {
3032: if (yymsg != yymsgbuf)
3033: YYSTACK_FREE (yymsg);
3034: yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
3035: if (!yymsg)
3036: {
3037: yymsg = yymsgbuf;
3038: yymsg_alloc = sizeof yymsgbuf;
3039: yysyntax_error_status = 2;
3040: }
3041: else
3042: {
3043: yysyntax_error_status = YYSYNTAX_ERROR;
3044: yymsgp = yymsg;
3045: }
3046: }
3047: yyerror (yymsgp);
3048: if (yysyntax_error_status == 2)
3049: goto yyexhaustedlab;
1.156 moko 3050: }
1.158 misha 3051: # undef YYSYNTAX_ERROR
1.156 moko 3052: #endif
1.1 parser 3053: }
3054:
1.112 paf 3055:
1.1 parser 3056:
3057: if (yyerrstatus == 3)
3058: {
1.112 paf 3059: /* If just tried and failed to reuse lookahead token after an
3060: error, discard it. */
1.109 paf 3061:
1.113 paf 3062: if (yychar <= YYEOF)
1.156 moko 3063: {
3064: /* Return failure if at end of input. */
1.113 paf 3065: if (yychar == YYEOF)
1.156 moko 3066: YYABORT;
3067: }
1.113 paf 3068: else
3069: {
1.156 moko 3070: yydestruct ("Error: discarding",
3071: yytoken, &yylval);
1.113 paf 3072: yychar = YYEMPTY;
3073: }
1.106 paf 3074: }
1.1 parser 3075:
1.112 paf 3076: /* Else will try to reuse lookahead token after shifting the error
3077: token. */
3078: goto yyerrlab1;
1.109 paf 3079:
1.1 parser 3080:
1.113 paf 3081: /*---------------------------------------------------.
3082: | yyerrorlab -- error raised explicitly by YYERROR. |
3083: `---------------------------------------------------*/
3084: yyerrorlab:
3085:
1.156 moko 3086: /* Pacify compilers like GCC when the user code never invokes
3087: YYERROR and the label yyerrorlab therefore never appears in user
3088: code. */
3089: if (/*CONSTCOND*/ 0)
1.113 paf 3090: goto yyerrorlab;
3091:
1.156 moko 3092: /* Do not reclaim the symbols of the rule which action triggered
3093: this YYERROR. */
3094: YYPOPSTACK (yylen);
3095: yylen = 0;
3096: YY_STACK_PRINT (yyss, yyssp);
1.113 paf 3097: yystate = *yyssp;
3098: goto yyerrlab1;
3099:
3100:
3101: /*-------------------------------------------------------------.
3102: | yyerrlab1 -- common code for both syntax error and YYERROR. |
3103: `-------------------------------------------------------------*/
1.112 paf 3104: yyerrlab1:
3105: yyerrstatus = 3; /* Each real token shifted decrements this. */
1.1 parser 3106:
1.112 paf 3107: for (;;)
1.109 paf 3108: {
1.112 paf 3109: yyn = yypact[yystate];
1.158 misha 3110: if (!yypact_value_is_default (yyn))
1.112 paf 3111: {
3112: yyn += YYTERROR;
3113: if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3114: {
3115: yyn = yytable[yyn];
3116: if (0 < yyn)
3117: break;
3118: }
3119: }
1.1 parser 3120:
1.112 paf 3121: /* Pop the current state because it cannot handle the error token. */
3122: if (yyssp == yyss)
3123: YYABORT;
1.1 parser 3124:
1.156 moko 3125:
3126: yydestruct ("Error: popping",
3127: yystos[yystate], yyvsp);
3128: YYPOPSTACK (1);
1.113 paf 3129: yystate = *yyssp;
1.112 paf 3130: YY_STACK_PRINT (yyss, yyssp);
1.1 parser 3131: }
3132:
1.156 moko 3133: *++yyvsp = yylval;
1.155 misha 3134:
1.1 parser 3135:
1.156 moko 3136: /* Shift the error token. */
3137: YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1.112 paf 3138:
1.1 parser 3139: yystate = yyn;
3140: goto yynewstate;
3141:
3142:
1.112 paf 3143: /*-------------------------------------.
3144: | yyacceptlab -- YYACCEPT comes here. |
3145: `-------------------------------------*/
3146: yyacceptlab:
3147: yyresult = 0;
3148: goto yyreturn;
3149:
3150: /*-----------------------------------.
3151: | yyabortlab -- YYABORT comes here. |
3152: `-----------------------------------*/
3153: yyabortlab:
3154: yyresult = 1;
3155: goto yyreturn;
3156:
1.156 moko 3157: #if !defined(yyoverflow) || YYERROR_VERBOSE
3158: /*-------------------------------------------------.
3159: | yyexhaustedlab -- memory exhaustion comes here. |
3160: `-------------------------------------------------*/
3161: yyexhaustedlab:
3162: yyerror (YY_("memory exhausted"));
1.112 paf 3163: yyresult = 2;
3164: /* Fall through. */
3165: #endif
3166:
3167: yyreturn:
1.156 moko 3168: if (yychar != YYEMPTY)
1.158 misha 3169: {
3170: /* Make sure we have latest lookahead translation. See comments at
3171: user semantic actions for why this is necessary. */
3172: yytoken = YYTRANSLATE (yychar);
3173: yydestruct ("Cleanup: discarding lookahead",
3174: yytoken, &yylval);
3175: }
1.156 moko 3176: /* Do not reclaim the symbols of the rule which action triggered
3177: this YYABORT or YYACCEPT. */
3178: YYPOPSTACK (yylen);
3179: YY_STACK_PRINT (yyss, yyssp);
3180: while (yyssp != yyss)
3181: {
3182: yydestruct ("Cleanup: popping",
3183: yystos[*yyssp], yyvsp);
3184: YYPOPSTACK (1);
3185: }
1.112 paf 3186: #ifndef yyoverflow
3187: if (yyss != yyssa)
3188: YYSTACK_FREE (yyss);
1.1 parser 3189: #endif
1.156 moko 3190: #if YYERROR_VERBOSE
3191: if (yymsg != yymsgbuf)
3192: YYSTACK_FREE (yymsg);
3193: #endif
3194: /* Make sure YYID is used. */
3195: return YYID (yyresult);
1.1 parser 3196: }
1.112 paf 3197:
3198:
1.156 moko 3199:
1.158 misha 3200: /* Line 2067 of yacc.c */
1.159 misha 3201: #line 847 "compile.y"
1.1 parser 3202:
3203: #endif
3204:
3205: /*
3206: 000$111(2222)00
3207: 000$111{3333}00
3208: $,^: push,=0
3209: 1:( { break=pop
3210: 2:( ) pop
3211: 3:{ } pop
3212:
3213: 000^111(2222)4444{33333}4000
3214: $,^: push,=0
3215: 1:( { break=pop
3216: 2:( )=4
3217: 3:{ }=4
3218: 4:[^({]=pop
3219: */
3220:
1.84 paf 3221: inline void ungetc(Parse_control& pc, uint last_line_end_col) {
3222: pc.source--;
3223: if(pc.pos.col==0) {
3224: --pc.pos.line; pc.pos.col=last_line_end_col;
3225: } else
3226: --pc.pos.col;
3227:
3228: }
3229: static int yylex(YYSTYPE *lvalp, void *apc) {
3230: register Parse_control& pc=*static_cast<Parse_control*>(apc);
3231:
3232: #define lexical_brackets_nestage pc.brackets_nestages[pc.ls_sp]
1.1 parser 3233: #define RC {result=c; goto break2; }
3234:
1.84 paf 3235: register int c;
3236: int result;
1.1 parser 3237:
1.84 paf 3238: if(pc.pending_state) {
3239: result=pc.pending_state;
3240: pc.pending_state=0;
1.1 parser 3241: return result;
3242: }
3243:
1.84 paf 3244: const char *begin=pc.source;
3245: Pos begin_pos=pc.pos;
1.1 parser 3246: const char *end;
3247: int skip_analized=0;
3248: while(true) {
1.84 paf 3249: c=*(end=(pc.source++));
3250: // fprintf(stderr, "\nchar: %c %02X; nestage: %d, sp=%d", c, c, lexical_brackets_nestage, pc.sp);
1.1 parser 3251:
1.96 paf 3252: if(c=='\n')
1.84 paf 3253: pc.pos_next_line();
1.96 paf 3254: else
1.84 paf 3255: pc.pos_next_c(c);
1.96 paf 3256: // fprintf(stderr, "\nchar: %c file(%d:%d)", c, pc.pos.line, pc.pos.col);
1.1 parser 3257:
1.96 paf 3258: if(pc.pos.col==0+1 && c=='@') {
1.84 paf 3259: if(pc.ls==LS_DEF_SPECIAL_BODY) {
1.31 paf 3260: // @SPECIAL
3261: // ...
3262: // @<here =
1.84 paf 3263: pop_LS(pc); // exiting from LS_DEF_SPECIAL_BODY state
1.31 paf 3264: } // continuing checks
1.84 paf 3265: if(pc.ls==LS_USER) {
3266: push_LS(pc, LS_DEF_NAME);
1.20 parser 3267: RC;
1.31 paf 3268: } else // @ in first column inside some code [when could that be?]
1.20 parser 3269: result=BAD_METHOD_DECL_START;
3270: goto break2;
1.97 paf 3271: }
3272: if(c=='^') {
1.84 paf 3273: if(pc.ls==LS_METHOD_AFTER) {
1.75 paf 3274: // handle after-method situation
1.84 paf 3275: pop_LS(pc);
1.75 paf 3276: result=EON;
3277: skip_analized=-1; // return to punctuation afterwards to assure it's literality
3278: goto break2;
3279: }
1.84 paf 3280: switch(pc.ls) {
1.15 parser 3281: case LS_EXPRESSION_VAR_NAME_WITH_COLON:
3282: case LS_EXPRESSION_VAR_NAME_WITHOUT_COLON:
3283: case LS_VAR_NAME_SIMPLE_WITH_COLON:
3284: case LS_VAR_NAME_SIMPLE_WITHOUT_COLON:
3285: case LS_VAR_NAME_CURLY:
3286: case LS_METHOD_NAME:
1.66 paf 3287: case LS_USER_COMMENT:
1.15 parser 3288: case LS_DEF_COMMENT:
3289: // no literals in names, please
3290: break;
3291: default:
1.84 paf 3292: switch(*pc.source) {
1.10 parser 3293: // ^escaping some punctuators
1.121 misha 3294: case '^': case '$': case ';': case '@':
1.1 parser 3295: case '(': case ')':
3296: case '[': case ']':
3297: case '{': case '}':
1.23 parser 3298: case '"': case ':':
1.1 parser 3299: if(end!=begin) {
1.84 paf 3300: if(!pc.string_start)
3301: pc.string_start=begin_pos;
1.1 parser 3302: // append piece till ^
1.84 paf 3303: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 3304: }
3305: // reset piece 'begin' position & line
1.84 paf 3306: begin=pc.source; // ->punctuation
3307: begin_pos=pc.pos;
1.75 paf 3308: // skip over _ after ^
1.84 paf 3309: pc.source++; pc.pos.col++;
1.75 paf 3310: // skip analysis = forced literal
3311: continue;
1.1 parser 3312:
3313: // converting ^#HH into char(hex(HH))
3314: case '#':
3315: if(end!=begin) {
1.84 paf 3316: if(!pc.string_start)
3317: pc.string_start=begin_pos;
1.1 parser 3318: // append piece till ^
1.84 paf 3319: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 3320: }
3321: // #HH ?
1.121 misha 3322: if(pc.source[1] && isxdigit(pc.source[1]) && pc.source[2] && isxdigit(pc.source[2])) {
1.110 paf 3323: char c=(char)(
1.84 paf 3324: hex_value[(unsigned char)pc.source[1]]*0x10+
1.110 paf 3325: hex_value[(unsigned char)pc.source[2]]);
1.84 paf 3326: if(c==0) {
1.1 parser 3327: result=BAD_HEX_LITERAL;
3328: goto break2; // wrong hex value[no ^#00 chars allowed]: bail out
3329: }
3330: // append char(hex(HH))
1.84 paf 3331: pc.string.append(c);
1.1 parser 3332: // skip over ^#HH
1.84 paf 3333: pc.source+=3;
3334: pc.pos.col+=3;
1.1 parser 3335: // reset piece 'begin' position & line
1.84 paf 3336: begin=pc.source; // ->after ^#HH
3337: begin_pos=pc.pos;
1.75 paf 3338: // skip analysis = forced literal
1.1 parser 3339: continue;
3340: }
1.121 misha 3341: // just escaped char
3342: // reset piece 'begin' position & line
3343: begin=pc.source;
3344: begin_pos=pc.pos;
3345: // skip over _ after ^
3346: pc.source++; pc.pos.col++;
3347: // skip analysis = forced literal
3348: continue;
1.1 parser 3349: }
1.15 parser 3350: break;
1.75 paf 3351: }
1.15 parser 3352: }
1.1 parser 3353: // #comment start skipping
1.84 paf 3354: if(c=='#' && pc.pos.col==1) {
1.1 parser 3355: if(end!=begin) {
1.84 paf 3356: if(!pc.string_start)
3357: pc.string_start=begin_pos;
1.1 parser 3358: // append piece till #
1.84 paf 3359: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 3360: }
3361: // fall into COMMENT lexical state [wait for \n]
1.84 paf 3362: push_LS(pc, LS_USER_COMMENT);
1.31 paf 3363: continue;
1.1 parser 3364: }
1.84 paf 3365: switch(pc.ls) {
1.1 parser 3366:
3367: // USER'S = NOT OURS
3368: case LS_USER:
1.84 paf 3369: case LS_NAME_SQUARE_PART: // name.[here].xxx
3370: if(pc.trim_bof)
1.1 parser 3371: switch(c) {
3372: case '\n': case ' ': case '\t':
1.84 paf 3373: begin=pc.source;
3374: begin_pos=pc.pos;
1.1 parser 3375: continue; // skip it
3376: default:
1.84 paf 3377: pc.trim_bof=false;
1.1 parser 3378: }
3379: switch(c) {
3380: case '$':
1.84 paf 3381: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3382: RC;
3383: case '^':
1.84 paf 3384: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3385: RC;
1.11 parser 3386: case ']':
1.84 paf 3387: if(pc.ls==LS_NAME_SQUARE_PART)
1.11 parser 3388: if(--lexical_brackets_nestage==0) {// $name.[co<]?>de<]?>
1.84 paf 3389: pop_LS(pc); // $name.[co<]>de<]!>
1.11 parser 3390: RC;
3391: }
1.3 parser 3392: break;
1.11 parser 3393: case '[': // $name.[co<[>de]
1.84 paf 3394: if(pc.ls==LS_NAME_SQUARE_PART)
1.11 parser 3395: lexical_brackets_nestage++;
1.4 parser 3396: break;
1.1 parser 3397: }
1.97 paf 3398: if(pc.explicit_result && c)
3399: switch(c) {
3400: case '\n': case ' ': case '\t':
3401: begin=pc.source;
3402: begin_pos=pc.pos;
3403: continue; // skip it
3404: default:
3405: result=BAD_NONWHITESPACE_CHARACTER_IN_EXPLICIT_RESULT_MODE;
3406: goto break2;
3407: }
1.1 parser 3408: break;
3409:
3410: // #COMMENT
1.66 paf 3411: case LS_USER_COMMENT:
1.1 parser 3412: if(c=='\n') {
3413: // skip comment
1.84 paf 3414: begin=pc.source;
3415: begin_pos=pc.pos;
1.1 parser 3416:
1.84 paf 3417: pop_LS(pc);
1.1 parser 3418: continue;
3419: }
3420: break;
3421:
3422: // STRING IN EXPRESSION
3423: case LS_EXPRESSION_STRING_QUOTED:
3424: case LS_EXPRESSION_STRING_APOSTROFED:
3425: switch(c) {
3426: case '"':
3427: case '\'':
3428: if(
1.84 paf 3429: pc.ls == LS_EXPRESSION_STRING_QUOTED && c=='"' ||
3430: pc.ls == LS_EXPRESSION_STRING_APOSTROFED && c=='\'') {
3431: pop_LS(pc); //"abc". | 'abc'.
1.1 parser 3432: RC;
3433: }
3434: break;
3435: case '$':
1.84 paf 3436: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3437: RC;
3438: case '^':
1.84 paf 3439: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3440: RC;
3441: }
3442: break;
3443:
3444: // METHOD DEFINITION
3445: case LS_DEF_NAME:
3446: switch(c) {
3447: case '[':
1.84 paf 3448: pc.ls=LS_DEF_PARAMS;
1.1 parser 3449: RC;
3450: case '\n':
1.84 paf 3451: pc.ls=LS_DEF_SPECIAL_BODY;
1.1 parser 3452: RC;
3453: }
3454: break;
3455:
3456: case LS_DEF_PARAMS:
3457: switch(c) {
1.64 paf 3458: case '$': // common error
1.65 paf 3459: result=BAD_METHOD_PARAMETER_NAME_CHARACTER;
3460: goto break2;
1.1 parser 3461: case ';':
3462: RC;
3463: case ']':
1.84 paf 3464: pc.ls=*pc.source=='['?LS_DEF_LOCALS:LS_DEF_COMMENT;
1.1 parser 3465: RC;
3466: case '\n': // wrong. bailing out
1.84 paf 3467: pop_LS(pc);
1.1 parser 3468: RC;
3469: }
3470: break;
3471:
3472: case LS_DEF_LOCALS:
3473: switch(c) {
3474: case '[':
3475: case ';':
3476: RC;
3477: case ']':
1.84 paf 3478: pc.ls=LS_DEF_COMMENT;
1.1 parser 3479: RC;
3480: case '\n': // wrong. bailing out
1.84 paf 3481: pop_LS(pc);
1.1 parser 3482: RC;
3483: }
3484: break;
3485:
3486: case LS_DEF_COMMENT:
3487: if(c=='\n') {
1.84 paf 3488: pop_LS(pc);
1.1 parser 3489: RC;
3490: }
3491: break;
3492:
3493: case LS_DEF_SPECIAL_BODY:
1.31 paf 3494: if(c=='\n')
1.1 parser 3495: RC;
3496: break;
3497:
3498: // (EXPRESSION)
3499: case LS_VAR_ROUND:
3500: case LS_METHOD_ROUND:
3501: switch(c) {
3502: case ')':
3503: if(--lexical_brackets_nestage==0)
1.84 paf 3504: if(pc.ls==LS_METHOD_ROUND) // method round param ended
3505: pc.ls=LS_METHOD_AFTER; // look for method end
3506: else // pc.ls==LS_VAR_ROUND // variable constructor ended
3507: pop_LS(pc); // return to normal life
1.1 parser 3508: RC;
1.66 paf 3509: case '#': // comment start skipping
3510: if(end!=begin) {
1.84 paf 3511: if(!pc.string_start)
3512: pc.string_start=begin_pos;
1.66 paf 3513: // append piece till #
1.84 paf 3514: pc.string.append_strdup_know_length(begin, end-begin);
1.66 paf 3515: }
3516: // fall into COMMENT lexical state [wait for \n]
1.84 paf 3517: push_LS(pc, LS_EXPRESSION_COMMENT);
1.66 paf 3518: lexical_brackets_nestage=1;
3519: continue;
1.1 parser 3520: case '$':
1.84 paf 3521: push_LS(pc, LS_EXPRESSION_VAR_NAME_WITH_COLON);
1.1 parser 3522: RC;
3523: case '^':
1.84 paf 3524: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3525: RC;
3526: case '(':
3527: lexical_brackets_nestage++;
3528: RC;
3529: case '-':
1.84 paf 3530: switch(*pc.source) {
1.1 parser 3531: case 'f': // -f
3532: skip_analized=1;
3533: result=FEXISTS;
3534: goto break2;
3535: case 'd': // -d
3536: skip_analized=1;
3537: result=DEXISTS;
3538: goto break2;
1.63 paf 3539: default: // minus
1.1 parser 3540: result=c;
3541: goto break2;
3542: }
3543: goto break2;
1.25 paf 3544: case '+': case '*': case '/': case '%': case '\\':
1.1 parser 3545: case '~':
3546: case ';':
3547: RC;
1.65 paf 3548: case '&': case '|':
1.84 paf 3549: if(*pc.source==c) { // && ||
1.65 paf 3550: result=c=='&'?LAND:LOR;
1.1 parser 3551: skip_analized=1;
3552: } else
3553: result=c;
3554: goto break2;
1.65 paf 3555: case '!':
1.84 paf 3556: switch(pc.source[0]) {
1.65 paf 3557: case '|': // !| !||
3558: skip_analized=1;
1.84 paf 3559: if(pc.source[1]=='|') {
1.65 paf 3560: skip_analized++;
3561: result=LXOR;
3562: } else
3563: result=NXOR;
3564: goto break2;
3565: case '=': // !=
3566: skip_analized=1;
3567: result=NNE;
3568: goto break2;
3569: }
3570: RC;
1.67 paf 3571:
3572: case '<': // <<, <=, <
1.84 paf 3573: switch(*pc.source) {
1.67 paf 3574: case '<': // <[<]
3575: skip_analized=1; result=NSL; break;
3576: case '=': // <[=]
3577: skip_analized=1; result=NLE; break;
3578: default: // <[]
3579: result=c; break;
3580: }
3581: goto break2;
3582: case '>': // >>, >=, >
1.84 paf 3583: switch(*pc.source) {
1.67 paf 3584: case '>': // >[>]
3585: skip_analized=1; result=NSR; break;
3586: case '=': // >[=]
3587: skip_analized=1; result=NGE; break;
3588: default: // >[]
3589: result=c; break;
3590: }
3591: goto break2;
3592: case '=': // ==
1.84 paf 3593: switch(*pc.source) {
1.67 paf 3594: case '=': // =[=]
3595: skip_analized=1; result=NEQ; break;
3596: default: // =[]
3597: result=c; break; // not used now
3598: }
1.1 parser 3599: goto break2;
1.67 paf 3600:
1.1 parser 3601: case '"':
1.84 paf 3602: push_LS(pc, LS_EXPRESSION_STRING_QUOTED);
1.1 parser 3603: RC;
3604: case '\'':
1.84 paf 3605: push_LS(pc, LS_EXPRESSION_STRING_APOSTROFED);
1.1 parser 3606: RC;
3607: case 'l': case 'g': case 'e': case 'n':
3608: if(end==begin) // right after whitespace
1.84 paf 3609: if(isspace(pc.source[1])) {
3610: switch(*pc.source) {
1.1 parser 3611: // case '?': // ok [and bad cases, yacc would bark at them]
3612: case 't': // lt gt [et nt]
3613: result=c=='l'?SLT:c=='g'?SGT:BAD_STRING_COMPARISON_OPERATOR;
3614: skip_analized=1;
3615: goto break2;
3616: case 'e': // le ge ne [ee]
3617: result=c=='l'?SLE:c=='g'?SGE:c=='n'?SNE:BAD_STRING_COMPARISON_OPERATOR;
3618: skip_analized=1;
3619: goto break2;
3620: case 'q': // eq [lq gq nq]
3621: result=c=='e'?SEQ:BAD_STRING_COMPARISON_OPERATOR;
3622: skip_analized=1;
3623: goto break2;
3624: }
3625: }
3626: break;
3627: case 'i':
3628: if(end==begin) // right after whitespace
1.84 paf 3629: if(isspace(pc.source[1])) {
3630: switch(pc.source[0]) {
1.1 parser 3631: case 'n': // in
3632: skip_analized=1;
3633: result=IN;
3634: goto break2;
3635: case 's': // is
3636: skip_analized=1;
3637: result=IS;
3638: goto break2;
3639: }
3640: }
3641: break;
3642: case 'd':
3643: if(end==begin) // right after whitespace
1.84 paf 3644: if(pc.source[0]=='e' && pc.source[1]=='f') { // def
1.118 misha 3645: switch(pc.source[2]){
3646: case ' ': case '\t': case '\n': case '"': case '\'': case '^': case '$': // non-quoted string without whitespace after 'def' is not allowed
3647: skip_analized=2;
3648: result=DEF;
3649: goto break2;
3650: }
3651: // error: incorrect char after 'def'
1.1 parser 3652: }
3653: break;
1.107 paf 3654: case 't':
3655: if(end==begin) // right after whitespace
1.118 misha 3656: if(pc.source[0]=='r' && pc.source[1]=='u' && pc.source[2]=='e') { // true
1.107 paf 3657: skip_analized=3;
3658: result=LITERAL_TRUE;
3659: goto break2;
3660: }
3661: break;
3662: case 'f':
3663: if(end==begin) // right after whitespace
1.118 misha 3664: if(pc.source[0]=='a' && pc.source[1]=='l' && pc.source[2]=='s' && pc.source[3]=='e') { // false
1.107 paf 3665: skip_analized=4;
3666: result=LITERAL_FALSE;
3667: goto break2;
3668: }
3669: break;
1.1 parser 3670: case ' ': case '\t': case '\n':
3671: if(end!=begin) { // there were a string after previous operator?
3672: result=0; // return that string
3673: goto break2;
3674: }
3675: // that's a leading|traling space or after-operator-space
3676: // ignoring it
3677: // reset piece 'begin' position & line
1.84 paf 3678: begin=pc.source; // after whitespace char
3679: begin_pos=pc.pos;
1.1 parser 3680: continue;
3681: }
3682: break;
1.66 paf 3683: case LS_EXPRESSION_COMMENT:
3684: if(c=='(')
3685: lexical_brackets_nestage++;
3686:
1.84 paf 3687: switch(*pc.source) {
1.66 paf 3688: case '\n': case ')':
1.84 paf 3689: if(*pc.source==')')
1.66 paf 3690: if(--lexical_brackets_nestage!=0)
3691: continue;
3692:
3693: // skip comment
1.84 paf 3694: begin=pc.source;
3695: begin_pos=pc.pos;
1.66 paf 3696:
1.84 paf 3697: pop_LS(pc);
1.66 paf 3698: continue;
3699: }
3700: break;
1.1 parser 3701:
3702: // VARIABLE GET/PUT/WITH
1.11 parser 3703: case LS_VAR_NAME_SIMPLE_WITH_COLON:
3704: case LS_VAR_NAME_SIMPLE_WITHOUT_COLON:
3705: case LS_EXPRESSION_VAR_NAME_WITH_COLON:
3706: case LS_EXPRESSION_VAR_NAME_WITHOUT_COLON:
3707: if(
1.84 paf 3708: pc.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON ||
3709: pc.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.41 paf 3710: // name in expr ends also before
1.1 parser 3711: switch(c) {
1.41 paf 3712: // expression minus
1.1 parser 3713: case '-':
1.41 paf 3714: // expression integer division
3715: case '\\':
1.84 paf 3716: pop_LS(pc);
3717: pc.ungetc();
1.1 parser 3718: result=EON;
3719: goto break2;
3720: }
3721: }
1.11 parser 3722: if(
1.84 paf 3723: pc.ls==LS_VAR_NAME_SIMPLE_WITHOUT_COLON ||
3724: pc.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.1 parser 3725: // name already has ':', stop before next
3726: switch(c) {
3727: case ':':
1.84 paf 3728: pop_LS(pc);
3729: pc.ungetc();
1.1 parser 3730: result=EON;
3731: goto break2;
3732: }
3733: }
3734: switch(c) {
3735: case 0:
3736: case ' ': case '\t': case '\n':
3737: case ';':
3738: case ']': case '}': case ')':
3739: case '"': case '\'':
3740: case '<': case '>': // these stand for HTML brackets AND expression binary ops
1.146 misha 3741: case '+': case '*': case '/': case '\\': case '%':
1.1 parser 3742: case '&': case '|':
3743: case '=': case '!':
3744: // common delimiters
1.62 paf 3745: case ',': case '?': case '#':
1.113 paf 3746: // mysql column separators
3747: case '`':
1.1 parser 3748: // before call
3749: case '^':
1.84 paf 3750: pop_LS(pc);
3751: pc.ungetc();
1.1 parser 3752: result=EON;
3753: goto break2;
3754: case '[':
1.5 parser 3755: // $name.<[>code]
1.84 paf 3756: if(pc.pos.col>1/*not first column*/ && (
1.6 parser 3757: end[-1]=='$'/*was start of get*/ ||
3758: end[-1]==':'/*was class name delim */ ||
3759: end[-1]=='.'/*was name delim */
1.5 parser 3760: )) {
1.84 paf 3761: push_LS(pc, LS_NAME_SQUARE_PART);
1.5 parser 3762: lexical_brackets_nestage=1;
3763: RC;
3764: }
1.84 paf 3765: pc.ls=LS_VAR_SQUARE;
1.1 parser 3766: lexical_brackets_nestage=1;
3767: RC;
3768: case '{':
3769: if(begin==end) { // ${name}, no need of EON, switching LS
1.84 paf 3770: pc.ls=LS_VAR_NAME_CURLY;
1.1 parser 3771: } else {
1.84 paf 3772: pc.ls=LS_VAR_CURLY;
1.1 parser 3773: lexical_brackets_nestage=1;
3774: }
3775:
3776: RC;
3777: case '(':
1.84 paf 3778: pc.ls=LS_VAR_ROUND;
1.1 parser 3779: lexical_brackets_nestage=1;
3780: RC;
3781: case '.': // name part delim
3782: case '$': // name part subvar
1.3 parser 3783: case ':': // class<:>name
1.11 parser 3784: // go to _WITHOUT_COLON state variant...
1.84 paf 3785: if(pc.ls==LS_VAR_NAME_SIMPLE_WITH_COLON)
3786: pc.ls=LS_VAR_NAME_SIMPLE_WITHOUT_COLON;
3787: else if(pc.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON)
3788: pc.ls=LS_EXPRESSION_VAR_NAME_WITHOUT_COLON;
1.11 parser 3789: // ...stop before next ':'
1.1 parser 3790: RC;
3791: }
3792: break;
3793:
3794: case LS_VAR_NAME_CURLY:
3795: switch(c) {
1.5 parser 3796: case '[':
1.11 parser 3797: // ${name.<[>code]}
1.84 paf 3798: push_LS(pc, LS_NAME_SQUARE_PART);
1.3 parser 3799: lexical_brackets_nestage=1;
3800: RC;
1.1 parser 3801: case '}': // ${name} finished, restoring LS
1.84 paf 3802: pop_LS(pc);
1.1 parser 3803: RC;
3804: case '.': // name part delim
3805: case '$': // name part subvar
3806: case ':': // ':name' or 'class:name'
3807: RC;
3808: }
3809: break;
3810:
3811: case LS_VAR_SQUARE:
3812: switch(c) {
3813: case '$':
1.84 paf 3814: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3815: RC;
3816: case '^':
1.84 paf 3817: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3818: RC;
3819: case ']':
3820: if(--lexical_brackets_nestage==0) {
1.84 paf 3821: pop_LS(pc);
1.1 parser 3822: RC;
3823: }
3824: break;
3825: case ';': // operator_or_fmt;value delim
3826: RC;
3827: case '[':
3828: lexical_brackets_nestage++;
3829: break;
3830: }
3831: break;
3832:
3833: case LS_VAR_CURLY:
3834: switch(c) {
3835: case '$':
1.84 paf 3836: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3837: RC;
3838: case '^':
1.84 paf 3839: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3840: RC;
3841: case '}':
3842: if(--lexical_brackets_nestage==0) {
1.84 paf 3843: pop_LS(pc);
1.1 parser 3844: RC;
3845: }
3846: break;
3847: case '{':
3848: lexical_brackets_nestage++;
3849: break;
3850: }
3851: break;
3852:
3853: // METHOD CALL
3854: case LS_METHOD_NAME:
3855: switch(c) {
3856: case '[':
1.11 parser 3857: // ^name.<[>code].xxx
1.84 paf 3858: if(pc.pos.col>1/*not first column*/ && (
1.6 parser 3859: end[-1]=='^'/*was start of call*/ || // never, ^[ is literal...
3860: end[-1]==':'/*was class name delim */ ||
3861: end[-1]=='.'/*was name delim */
1.5 parser 3862: )) {
1.84 paf 3863: push_LS(pc, LS_NAME_SQUARE_PART);
1.5 parser 3864: lexical_brackets_nestage=1;
3865: RC;
3866: }
1.84 paf 3867: pc.ls=LS_METHOD_SQUARE;
1.1 parser 3868: lexical_brackets_nestage=1;
3869: RC;
3870: case '{':
1.84 paf 3871: pc.ls=LS_METHOD_CURLY;
1.1 parser 3872: lexical_brackets_nestage=1;
3873: RC;
3874: case '(':
1.84 paf 3875: pc.ls=LS_METHOD_ROUND;
1.1 parser 3876: lexical_brackets_nestage=1;
3877: RC;
3878: case '.': // name part delim
3879: case '$': // name part subvar
3880: case ':': // ':name' or 'class:name'
1.19 parser 3881: case '^': // ^abc^xxx wrong. bailing out
3882: case ']': case '}': case ')': // ^abc]}) wrong. bailing out
1.90 paf 3883: case ' ': // ^if ( wrong. bailing out
1.1 parser 3884: RC;
3885: }
3886: break;
3887:
3888: case LS_METHOD_SQUARE:
3889: switch(c) {
3890: case '$':
1.84 paf 3891: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3892: RC;
3893: case '^':
1.84 paf 3894: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3895: RC;
3896: case ';': // param delim
3897: RC;
3898: case ']':
3899: if(--lexical_brackets_nestage==0) {
1.84 paf 3900: pc.ls=LS_METHOD_AFTER;
1.1 parser 3901: RC;
3902: }
3903: break;
3904: case '[':
3905: lexical_brackets_nestage++;
3906: break;
3907: }
3908: break;
3909:
3910: case LS_METHOD_CURLY:
3911: switch(c) {
3912: case '$':
1.84 paf 3913: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3914: RC;
3915: case '^':
1.84 paf 3916: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3917: RC;
3918: case ';': // param delim
3919: RC;
3920: case '}':
3921: if(--lexical_brackets_nestage==0) {
1.84 paf 3922: pc.ls=LS_METHOD_AFTER;
1.1 parser 3923: RC;
3924: }
3925: break;
3926: case '{':
3927: lexical_brackets_nestage++;
3928: break;
3929: }
1.97 paf 3930: if(pc.explicit_result && c)
3931: switch(c) {
3932: case '\n': case ' ': case '\t':
3933: begin=pc.source;
3934: begin_pos=pc.pos;
3935: continue; // skip it
3936: default:
3937: result=BAD_NONWHITESPACE_CHARACTER_IN_EXPLICIT_RESULT_MODE;
3938: goto break2;
3939: }
1.1 parser 3940: break;
3941:
3942: case LS_METHOD_AFTER:
3943: if(c=='[') {/* ][ }[ )[ */
1.84 paf 3944: pc.ls=LS_METHOD_SQUARE;
1.1 parser 3945: lexical_brackets_nestage=1;
3946: RC;
3947: }
3948: if(c=='{') {/* ]{ }{ ){ */
1.84 paf 3949: pc.ls=LS_METHOD_CURLY;
1.1 parser 3950: lexical_brackets_nestage=1;
3951: RC;
3952: }
3953: if(c=='(') {/* ]( }( )( */
1.84 paf 3954: pc.ls=LS_METHOD_ROUND;
1.1 parser 3955: lexical_brackets_nestage=1;
3956: RC;
3957: }
1.84 paf 3958: pop_LS(pc);
3959: pc.ungetc();
1.1 parser 3960: result=EON;
3961: goto break2;
3962: }
3963: if(c==0) {
3964: result=-1;
3965: break;
3966: }
3967: }
3968:
3969: break2:
3970: if(end!=begin) { // there is last piece?
1.150 misha 3971: if(c=='@' || c==0) // we are before LS_DEF_NAME or EOF?
3972: while(end!=begin && end[-1]=='\n') // trim all empty lines before LS_DEF_NAME and EOF
1.1 parser 3973: end--;
1.84 paf 3974: if(end!=begin && pc.ls!=LS_USER_COMMENT) { // last piece still alive and not comment?
3975: if(!pc.string_start)
3976: pc.string_start=begin_pos;
1.1 parser 3977: // append it
1.84 paf 3978: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 3979: }
3980: }
1.84 paf 3981: if(!pc.string.is_empty()) { // something accumulated?
3982: // create STRING value: array of OP_VALUE+origin+vstring
3983: *lvalp=VL(
3984: new VString(*new String(pc.string, String::L_CLEAN)),
3985: pc.file_no, pc.string_start.line, pc.string_start.col);
1.1 parser 3986: // new pieces storage
1.84 paf 3987: pc.string.clear();
3988: pc.string_start.clear();
1.1 parser 3989: // make current result be pending for next call, return STRING for now
1.84 paf 3990: pc.pending_state=result; result=STRING;
1.1 parser 3991: }
3992: if(skip_analized) {
1.84 paf 3993: pc.source+=skip_analized; pc.pos.col+=skip_analized;
1.1 parser 3994: }
3995: return result;
3996: }
3997:
1.156 moko 3998: static int real_yyerror(Parse_control *pc, const char *s) { // Called by yyparse on error
1.10 parser 3999: strncpy(PC.error, s, MAX_STRING);
1.1 parser 4000: return 1;
4001: }
4002:
4003: static void yyprint(FILE *file, int type, YYSTYPE value) {
4004: if(type==STRING)
1.84 paf 4005: fprintf(file, " \"%s\"", LA2S(*value)->cstr());
1.1 parser 4006: }
1.112 paf 4007:
E-mail: