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