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