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