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