Annotation of parser3/src/main/compile.tab.C, revision 1.118
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.118 ! misha 135: $Id: compile.y,v 1.224 2008-06-10 14:06:00 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,
1.118 ! misha 457: 229, 229, 230, 230, 231, 232, 232, 234, 234, 283,
! 458: 283, 284, 285, 285, 286, 286, 288, 288, 292, 292,
! 459: 294, 294, 295, 295, 296, 296, 296, 300, 307, 308,
! 460: 308, 309, 311, 312, 313, 335, 336, 336, 340, 345,
! 461: 346, 347, 348, 365, 370, 373, 374, 375, 377, 380,
! 462: 377, 388, 396, 403, 404, 405, 407, 413, 414, 414,
! 463: 418, 424, 427, 424, 443, 445, 445, 447, 448, 449,
! 464: 451, 454, 451, 457, 458, 460, 461, 464, 465, 468,
! 465: 469, 471, 475, 490, 495, 496, 497, 502, 502, 504,
! 466: 504, 505, 506, 514, 519, 522, 523, 524, 525, 527,
! 467: 531, 540, 543, 540, 551, 556, 556, 557, 563, 564,
! 468: 566, 578, 590, 592, 593, 594, 595, 596, 597, 598,
! 469: 599, 601, 602, 603, 604, 605, 606, 607, 608, 610,
! 470: 611, 612, 613, 614, 615, 616, 617, 618, 619, 620,
! 471: 621, 622, 623, 624, 625, 626, 627, 628, 629, 630,
! 472: 631, 632, 633, 634, 635, 636, 639, 644, 653, 658,
! 473: 659, 660, 662
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.117 misha 1450: /*
1.59 paf 1451: if(PC.cclass->base_class()) { // already changed from default?
1.1 parser 1452: strcpy(PC.error, "class already have a name '");
1453: strncat(PC.error, PC.cclass->name().cstr(), 100);
1454: strcat(PC.error, "'");
1455: YYERROR;
1456: }
1.117 misha 1457: */
1.84 paf 1458: if(strings_code->count()==1*OPERATIONS_PER_OPVALUE) {
1.1 parser 1459: // new class' name
1.84 paf 1460: const String& name=*LA2S(*strings_code);
1.1 parser 1461: // creating the class
1.84 paf 1462: VStateless_class* cclass=new VClass;
1463: PC.cclass=cclass;
1464: PC.cclass->set_name(name);
1.1 parser 1465: // append to request's classes
1.84 paf 1466: PC.request.classes().put(name, cclass);
1.117 misha 1467: *PC.cclasses+=cclass;
1.1 parser 1468: } else {
1.84 paf 1469: strcpy(PC.error, "@"CLASS_NAME" must contain only one line with class name (contains more then one)");
1.1 parser 1470: YYERROR;
1471: }
1472: } else if(command==USE_CONTROL_METHOD_NAME) {
1.84 paf 1473: for(size_t i=0; i<strings_code->count(); i+=OPERATIONS_PER_OPVALUE)
1474: PC.request.use_file(PC.request.main_class, *LA2S(*strings_code, i));
1.1 parser 1475: } else if(command==BASE_NAME) {
1.59 paf 1476: if(PC.cclass->base_class()) { // already changed from default?
1.1 parser 1477: strcpy(PC.error, "class already have a base '");
1.59 paf 1478: strncat(PC.error, PC.cclass->base_class()->name().cstr(), 100);
1.1 parser 1479: strcat(PC.error, "'");
1480: YYERROR;
1481: }
1.84 paf 1482: if(strings_code->count()==1*OPERATIONS_PER_OPVALUE) {
1483: const String& base_name=*LA2S(*strings_code);
1484: if(Value* base_class_value=PC.request.classes().get(base_name)) {
1485: // @CLASS == @BASE sanity check
1486: if(VStateless_class *base_class=base_class_value->get_class()) {
1487: if(PC.cclass==base_class) {
1488: strcpy(PC.error, "@"CLASS_NAME" equals @"BASE_NAME);
1489: YYERROR;
1490: }
1491: PC.cclass->get_class()->set_base(base_class);
1492: } else { // they asked to derive from a class without methods ['env' & co]
1493: strcpy(PC.error, base_name.cstr());
1494: strcat(PC.error, ": you can not derive from this class in @"BASE_NAME);
1495: YYERROR;
1496: }
1497: } else {
1.1 parser 1498: strcpy(PC.error, base_name.cstr());
1499: strcat(PC.error, ": undefined class in @"BASE_NAME);
1500: YYERROR;
1501: }
1502: } else {
1503: strcpy(PC.error, "@"BASE_NAME" must contain sole name");
1504: YYERROR;
1505: }
1.116 misha 1506: } else if(command==OPTIONS_CONTROL_METHOD_NAME) {
1.118 ! misha 1507: for(size_t i=0; i<strings_code->count(); i+=OPERATIONS_PER_OPVALUE) {
! 1508: const String& option=*LA2S(*strings_code, i);
! 1509: if(option==ALL_VARS_LOCAL_NAME){
! 1510: PC.cclass->all_vars_local();
! 1511: } else {
! 1512: strcpy(PC.error, option.cstr());
! 1513: strcat(PC.error, ": unknown option in @"OPTIONS_CONTROL_METHOD_NAME" was specified.");
! 1514: YYERROR;
1.116 misha 1515: }
1516: }
1.1 parser 1517: } else {
1518: strcpy(PC.error, "'");
1519: strncat(PC.error, command.cstr(), MAX_STRING/2);
1520: strcat(PC.error, "' invalid special name. valid names are "
1.116 misha 1521: "'"CLASS_NAME"', '"USE_CONTROL_METHOD_NAME"', '"BASE_NAME"' and '"OPTIONS_CONTROL_METHOD_NAME"'.");
1.1 parser 1522: YYERROR;
1523: }
1.112 paf 1524: ;}
1525: break;
1526:
1527: case 13:
1.118 ! misha 1528: #line 230 "compile.y"
1.112 paf 1529: { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;}
1530: break;
1531:
1532: case 17:
1.118 ! misha 1533: #line 234 "compile.y"
1.112 paf 1534: {
1.96 paf 1535: PC.explicit_result=false;
1.1 parser 1536:
1.115 misha 1537: YYSTYPE params_names_code=yyvsp[-3];
1.84 paf 1538: ArrayString* params_names=0;
1539: if(int size=params_names_code->count()) {
1540: params_names=new ArrayString;
1541: for(int i=0; i<size; i+=OPERATIONS_PER_OPVALUE)
1542: *params_names+=LA2S(*params_names_code, i);
1.1 parser 1543: }
1544:
1.115 misha 1545: YYSTYPE locals_names_code=yyvsp[-2];
1.84 paf 1546: ArrayString* locals_names=0;
1.116 misha 1547: bool all_vars_local=false;
1.84 paf 1548: if(int size=locals_names_code->count()) {
1549: locals_names=new ArrayString;
1.96 paf 1550: for(int i=0; i<size; i+=OPERATIONS_PER_OPVALUE) {
1551: const String* local_name=LA2S(*locals_names_code, i);
1552: if(*local_name==RESULT_VAR_NAME)
1553: PC.explicit_result=true;
1.116 misha 1554: else if(*local_name==ALL_VARS_LOCAL_NAME)
1555: all_vars_local=true;
1.96 paf 1556: else
1557: *locals_names+=local_name;
1558: }
1.1 parser 1559: }
1.116 misha 1560: if(!all_vars_local && PC.cclass && PC.cclass->is_vars_local()){
1561: all_vars_local=true;
1562: }
1.1 parser 1563:
1.96 paf 1564: Method* method=new Method(
1.84 paf 1565: //name,
1.1 parser 1566: Method::CT_ANY,
1567: 0, 0/*min,max numbered_params_count*/,
1568: params_names, locals_names,
1.116 misha 1569: 0/*to be filled later in next {} */, 0, all_vars_local);
1.114 misha 1570:
1.96 paf 1571: *reinterpret_cast<Method**>(&yyval)=method;
1572:
1573: // todo: check [][;result;]
1.112 paf 1574: ;}
1575: break;
1576:
1.115 misha 1577: case 18:
1.118 ! misha 1578: #line 274 "compile.y"
1.115 misha 1579: {
1580: Method& method=*reinterpret_cast<Method*>(yyvsp[-1]);
1581: // fill in the code
1582: method.parser_code=yyvsp[0];
1583: // register in class
1584: const String& name=*LA2S(*yyvsp[-6]);
1585: PC.cclass->add_method(PC.alias_method(name), method);
1586: ;}
1587: break;
1588:
1589: case 21:
1.118 ! misha 1590: #line 284 "compile.y"
1.114 misha 1591: {yyval=yyvsp[-1];}
1.112 paf 1592: break;
1593:
1.115 misha 1594: case 25:
1.118 ! misha 1595: #line 286 "compile.y"
1.112 paf 1596: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;}
1597: break;
1598:
1.115 misha 1599: case 31:
1.118 ! misha 1600: #line 294 "compile.y"
1.112 paf 1601: { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;}
1602: break;
1603:
1.115 misha 1604: case 37:
1.118 ! misha 1605: #line 300 "compile.y"
1.112 paf 1606: {
1.48 paf 1607: yyval=yyvsp[0]; /* stack: resulting value */
1.84 paf 1608: changetail_or_append(*yyval,
1.51 paf 1609: OP_GET_ELEMENT, false, /*->*/OP_GET_ELEMENT__WRITE,
1610: /*or */OP_WRITE_VALUE
1.48 paf 1611: ); /* value=pop; wcontext.write(value) */
1.112 paf 1612: ;}
1613: break;
1614:
1.115 misha 1615: case 38:
1.118 ! misha 1616: #line 307 "compile.y"
1.112 paf 1617: { yyval=yyvsp[0] ;}
1618: break;
1619:
1.115 misha 1620: case 41:
1.118 ! misha 1621: #line 309 "compile.y"
1.112 paf 1622: { yyval=yyvsp[-1] ;}
1623: break;
1624:
1.115 misha 1625: case 44:
1.118 ! misha 1626: #line 313 "compile.y"
1.112 paf 1627: {
1.84 paf 1628: yyval=N();
1629: ArrayOperation* diving_code=yyvsp[0];
1630: const String* first_name=LA2S(*diving_code);
1.37 paf 1631: // self.xxx... -> xxx...
1.84 paf 1632: // OP_VALUE+origin+string+OP_GET_ELEMENT+... -> OP_WITH_SELF+...
1.1 parser 1633: if(first_name && *first_name==SELF_ELEMENT_NAME) {
1.84 paf 1634: O(*yyval, OP_WITH_SELF); /* stack: starting context */
1635: P(*yyval, *diving_code,
1.1 parser 1636: /* skip over... */
1.84 paf 1637: diving_code->count()>=4?4/*OP_VALUE+origin+string+OP_GET_ELEMENTx*/:3/*OP_+origin+string*/);
1.1 parser 1638: } else {
1.84 paf 1639: O(*yyval, OP_WITH_READ); /* stack: starting context */
1.37 paf 1640:
1.73 paf 1641: // ^if ELEMENT -> ^if ELEMENT_OR_OPERATOR
1.84 paf 1642: // OP_VALUE+origin+string+OP_GET_ELEMENT. -> OP_VALUE+origin+string+OP_GET_ELEMENT_OR_OPERATOR.
1643: if(PC.in_call_value && diving_code->count()==4)
1644: diving_code->put(4-1, OP_GET_ELEMENT_OR_OPERATOR);
1645: P(*yyval, *diving_code);
1.1 parser 1646: }
1647: /* diving code; stack: current context */
1.112 paf 1648: ;}
1649: break;
1650:
1.115 misha 1651: case 45:
1.118 ! misha 1652: #line 335 "compile.y"
1.112 paf 1653: { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;}
1654: break;
1655:
1.115 misha 1656: case 47:
1.118 ! misha 1657: #line 336 "compile.y"
1.112 paf 1658: { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;}
1659: break;
1660:
1.115 misha 1661: case 48:
1.118 ! misha 1662: #line 340 "compile.y"
1.112 paf 1663: {
1.1 parser 1664: yyval=yyvsp[-1]; /* stack: context,name */
1.84 paf 1665: P(*yyval, *yyvsp[0]); /* stack: context,name,constructor_value */
1.112 paf 1666: ;}
1667: break;
1668:
1.115 misha 1669: case 52:
1.118 ! misha 1670: #line 348 "compile.y"
1.112 paf 1671: {
1.84 paf 1672: yyval=N();
1673: ArrayOperation* diving_code=yyvsp[0];
1674: const String* first_name=LA2S(*diving_code);
1.37 paf 1675: // $self.xxx... -> $xxx...
1.84 paf 1676: // OP_VALUE+origin+string+OP_GET_ELEMENT+... -> OP_WITH_SELF+...
1.1 parser 1677: if(first_name && *first_name==SELF_ELEMENT_NAME) {
1.84 paf 1678: O(*yyval, OP_WITH_SELF); /* stack: starting context */
1679: P(*yyval, *diving_code,
1.1 parser 1680: /* skip over... */
1.84 paf 1681: diving_code->count()>=4?4/*OP_VALUE+origin+string+OP_GET_ELEMENTx*/:3/*OP_+origin+string*/);
1.1 parser 1682: } else {
1.84 paf 1683: O(*yyval, OP_WITH_ROOT); /* stack: starting context */
1684: P(*yyval, *diving_code);
1.1 parser 1685: }
1686: /* diving code; stack: current context */
1.112 paf 1687: ;}
1688: break;
1689:
1.115 misha 1690: case 53:
1.118 ! misha 1691: #line 365 "compile.y"
1.112 paf 1692: {
1.84 paf 1693: yyval=N();
1694: O(*yyval, OP_WITH_WRITE); /* stack: starting context */
1695: P(*yyval, *yyvsp[0]); /* diving code; stack: context,name */
1.112 paf 1696: ;}
1697: break;
1698:
1.115 misha 1699: case 54:
1.118 ! misha 1700: #line 370 "compile.y"
1.112 paf 1701: { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;}
1702: break;
1703:
1.115 misha 1704: case 58:
1.118 ! misha 1705: #line 377 "compile.y"
1.112 paf 1706: {
1.100 paf 1707: // allow $result_or_other_variable[ letters here any time ]
1.99 paf 1708: *reinterpret_cast<bool*>(&yyval)=PC.explicit_result; PC.explicit_result=false;
1.112 paf 1709: ;}
1710: break;
1711:
1.115 misha 1712: case 59:
1.118 ! misha 1713: #line 380 "compile.y"
1.112 paf 1714: {
1.106 paf 1715: PC.explicit_result=*reinterpret_cast<bool*>(&yyvsp[-1]);
1.112 paf 1716: ;}
1717: break;
1718:
1.115 misha 1719: case 60:
1.118 ! misha 1720: #line 382 "compile.y"
1.112 paf 1721: {
1.1 parser 1722: // stack: context, name
1.99 paf 1723: yyval=yyvsp[-2]; // stack: context, name, value
1.84 paf 1724: O(*yyval, OP_CONSTRUCT_VALUE); /* value=pop; name=pop; context=pop; construct(context,name,value) */
1.112 paf 1725: ;}
1726: break;
1727:
1.115 misha 1728: case 61:
1.118 ! misha 1729: #line 388 "compile.y"
1.112 paf 1730: {
1.84 paf 1731: yyval=N();
1732: O(*yyval, OP_PREPARE_TO_EXPRESSION);
1.1 parser 1733: // stack: context, name
1.84 paf 1734: P(*yyval, *yyvsp[-1]); // stack: context, name, value
1735: O(*yyval, OP_CONSTRUCT_EXPR); /* value=pop->as_expr_result; name=pop; context=pop; construct(context,name,value) */
1.112 paf 1736: ;}
1737: break;
1738:
1.115 misha 1739: case 62:
1.118 ! misha 1740: #line 396 "compile.y"
1.112 paf 1741: {
1.1 parser 1742: // stack: context, name
1.84 paf 1743: yyval=N();
1744: OA(*yyval, OP_CURLY_CODE__CONSTRUCT, yyvsp[-1]); /* code=pop; name=pop; context=pop; construct(context,name,junction(code)) */
1.112 paf 1745: ;}
1746: break;
1747:
1.115 misha 1748: case 66:
1.118 ! misha 1749: #line 407 "compile.y"
1.112 paf 1750: {
1.84 paf 1751: yyval=N();
1752: OA(*yyval, OP_OBJECT_POOL, yyvsp[0]); /* stack: empty write context */
1.47 paf 1753: /* some code that writes to that context */
1754: /* context=pop; stack: context.value() */
1.112 paf 1755: ;}
1756: break;
1757:
1.115 misha 1758: case 69:
1.118 ! misha 1759: #line 414 "compile.y"
1.112 paf 1760: { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;}
1761: break;
1762:
1.115 misha 1763: case 70:
1.118 ! misha 1764: #line 418 "compile.y"
1.112 paf 1765: {
1.1 parser 1766: yyval=yyvsp[0]; /* stack: value */
1.84 paf 1767: changetail_or_append(*yyval,
1.51 paf 1768: OP_CALL, true, /*->*/ OP_CALL__WRITE,
1769: /*or */OP_WRITE_VALUE); /* value=pop; wcontext.write(value) */
1.112 paf 1770: ;}
1771: break;
1772:
1.115 misha 1773: case 71:
1.118 ! misha 1774: #line 424 "compile.y"
1.112 paf 1775: {
1.39 paf 1776: PC.in_call_value=true;
1.112 paf 1777: ;}
1778: break;
1779:
1.115 misha 1780: case 72:
1.118 ! misha 1781: #line 427 "compile.y"
1.112 paf 1782: {
1.39 paf 1783: PC.in_call_value=false;
1.112 paf 1784: ;}
1785: break;
1786:
1.115 misha 1787: case 73:
1.118 ! misha 1788: #line 430 "compile.y"
1.112 paf 1789: { /* ^field.$method{vasya} */
1.1 parser 1790: yyval=yyvsp[-3]; /* with_xxx,diving code; stack: context,method_junction */
1791:
1792: YYSTYPE params_code=yyvsp[-1];
1.84 paf 1793: if(params_code->count()==4) { // probably [] case. [OP_VALUE+origin+Void+STORE_PARAM]
1794: if(Value* value=LA2V(*params_code)) // it is OP_VALUE+origin+value?
1.111 paf 1795: if(value->is_void()) // value is VVoid?
1.1 parser 1796: params_code=0; // ^zzz[] case. don't append lone empty param.
1.51 paf 1797: }
1798: /* stack: context, method_junction */
1.84 paf 1799: OA(*yyval, OP_CALL, params_code); // method_frame=make frame(pop junction); ncontext=pop; call(ncontext,method_frame) stack: value
1.112 paf 1800: ;}
1801: break;
1802:
1.115 misha 1803: case 76:
1.118 ! misha 1804: #line 445 "compile.y"
1.112 paf 1805: { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;}
1806: break;
1807:
1.115 misha 1808: case 80:
1.118 ! misha 1809: #line 451 "compile.y"
1.112 paf 1810: {
1.100 paf 1811: // allow ^call[ letters here any time ]
1.98 paf 1812: *reinterpret_cast<bool*>(&yyval)=PC.explicit_result; PC.explicit_result=false;
1.112 paf 1813: ;}
1814: break;
1815:
1.115 misha 1816: case 81:
1.118 ! misha 1817: #line 454 "compile.y"
1.112 paf 1818: {
1.106 paf 1819: PC.explicit_result=*reinterpret_cast<bool*>(&yyvsp[-1]);
1.112 paf 1820: ;}
1821: break;
1822:
1.115 misha 1823: case 82:
1.118 ! misha 1824: #line 456 "compile.y"
1.112 paf 1825: {yyval=yyvsp[-2];}
1826: break;
1827:
1.115 misha 1828: case 83:
1.118 ! misha 1829: #line 457 "compile.y"
1.112 paf 1830: {yyval=yyvsp[-1];}
1831: break;
1832:
1.115 misha 1833: case 84:
1.118 ! misha 1834: #line 458 "compile.y"
1.112 paf 1835: {yyval=yyvsp[-1];}
1836: break;
1837:
1.115 misha 1838: case 86:
1.118 ! misha 1839: #line 461 "compile.y"
1.112 paf 1840: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;}
1841: break;
1842:
1.115 misha 1843: case 88:
1.118 ! misha 1844: #line 465 "compile.y"
1.112 paf 1845: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;}
1846: break;
1847:
1.115 misha 1848: case 90:
1.118 ! misha 1849: #line 469 "compile.y"
1.112 paf 1850: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]) ;}
1851: break;
1852:
1.115 misha 1853: case 91:
1.118 ! misha 1854: #line 471 "compile.y"
1.112 paf 1855: {
1.1 parser 1856: yyval=yyvsp[0];
1.84 paf 1857: O(*yyval, OP_STORE_PARAM);
1.112 paf 1858: ;}
1859: break;
1860:
1.115 misha 1861: case 92:
1.118 ! misha 1862: #line 475 "compile.y"
1.112 paf 1863: {
1.104 paf 1864: YYSTYPE expr_code=yyvsp[0];
1.106 paf 1865: if(expr_code->count()==3
1.107 paf 1866: && (*expr_code)[0].code==OP_VALUE) { // optimizing (double/bool/incidently 'string' too) case. [OP_VALUE+origin+Double]
1.104 paf 1867: yyval=expr_code;
1868: O(*yyval, OP_STORE_PARAM); // no evaluating
1869: } else {
1870: ArrayOperation* code=N();
1871: O(*code, OP_PREPARE_TO_EXPRESSION);
1872: P(*code, *expr_code);
1873: O(*code, OP_WRITE_EXPR_RESULT);
1874: yyval=N();
1875: OA(*yyval, OP_EXPR_CODE__STORE_PARAM, code);
1876: }
1.112 paf 1877: ;}
1878: break;
1879:
1.115 misha 1880: case 93:
1.118 ! misha 1881: #line 490 "compile.y"
1.112 paf 1882: {
1.84 paf 1883: yyval=N();
1884: OA(*yyval, OP_CURLY_CODE__STORE_PARAM, yyvsp[0]);
1.112 paf 1885: ;}
1886: break;
1887:
1.115 misha 1888: case 98:
1.118 ! misha 1889: #line 502 "compile.y"
1.112 paf 1890: { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;}
1891: break;
1892:
1.115 misha 1893: case 100:
1.118 ! misha 1894: #line 504 "compile.y"
1.112 paf 1895: { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;}
1896: break;
1897:
1.115 misha 1898: case 102:
1.118 ! misha 1899: #line 506 "compile.y"
1.112 paf 1900: {
1.33 paf 1901: // we know that name_advance1 not called from ^xxx context
1902: // so we'll not check for operator call possibility as we do in name_advance2
1903:
1.1 parser 1904: /* stack: context */
1905: yyval=yyvsp[0]; /* stack: context,name */
1.84 paf 1906: O(*yyval, OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.112 paf 1907: ;}
1908: break;
1909:
1.115 misha 1910: case 103:
1.118 ! misha 1911: #line 514 "compile.y"
1.112 paf 1912: {
1.1 parser 1913: /* stack: context */
1914: yyval=yyvsp[0]; /* stack: context,name */
1.84 paf 1915: O(*yyval, OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.112 paf 1916: ;}
1917: break;
1918:
1.115 misha 1919: case 109:
1.118 ! misha 1920: #line 527 "compile.y"
1.112 paf 1921: {
1.1 parser 1922: yyval=yyvsp[0];
1.84 paf 1923: O(*yyval, OP_GET_ELEMENT);
1.112 paf 1924: ;}
1925: break;
1926:
1.115 misha 1927: case 110:
1.118 ! misha 1928: #line 531 "compile.y"
1.112 paf 1929: {
1.84 paf 1930: ArrayOperation* code;
1.47 paf 1931: {
1.84 paf 1932: change_string_literal_to_write_string_literal(*(code=yyvsp[-1]));
1933: P(*code, *yyvsp[0]);
1.47 paf 1934: }
1.84 paf 1935: yyval=N();
1936: OA(*yyval, OP_STRING_POOL, code);
1.112 paf 1937: ;}
1938: break;
1939:
1.115 misha 1940: case 111:
1.118 ! misha 1941: #line 540 "compile.y"
1.112 paf 1942: {
1.100 paf 1943: // allow $result_or_other_variable[ letters here any time ]
1944: *reinterpret_cast<bool*>(&yyval)=PC.explicit_result; PC.explicit_result=false;
1.112 paf 1945: ;}
1946: break;
1947:
1.115 misha 1948: case 112:
1.118 ! misha 1949: #line 543 "compile.y"
1.112 paf 1950: {
1.101 paf 1951: PC.explicit_result=*reinterpret_cast<bool*>(&yyvsp[-1]);
1.112 paf 1952: ;}
1953: break;
1954:
1.115 misha 1955: case 113:
1.118 ! misha 1956: #line 545 "compile.y"
1.112 paf 1957: {
1.84 paf 1958: yyval=N();
1.100 paf 1959: OA(*yyval, OP_OBJECT_POOL, yyvsp[-2]); /* stack: empty write context */
1.47 paf 1960: /* some code that writes to that context */
1961: /* context=pop; stack: context.value() */
1.112 paf 1962: ;}
1963: break;
1964:
1.115 misha 1965: case 114:
1.118 ! misha 1966: #line 551 "compile.y"
1.112 paf 1967: {
1.84 paf 1968: yyval=N();
1969: O(*yyval, OP_WITH_READ);
1970: P(*yyval, *yyvsp[0]);
1.112 paf 1971: ;}
1972: break;
1973:
1.115 misha 1974: case 116:
1.118 ! misha 1975: #line 556 "compile.y"
1.112 paf 1976: { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;}
1977: break;
1978:
1.115 misha 1979: case 117:
1.118 ! misha 1980: #line 557 "compile.y"
1.112 paf 1981: {
1.1 parser 1982: yyval=yyvsp[0];
1.84 paf 1983: O(*yyval, OP_GET_ELEMENT__WRITE);
1.112 paf 1984: ;}
1985: break;
1986:
1.115 misha 1987: case 120:
1.118 ! misha 1988: #line 566 "compile.y"
1.112 paf 1989: {
1.1 parser 1990: yyval=yyvsp[-1]; // stack: class name string
1.84 paf 1991: if(*LA2S(*yyval) == BASE_NAME) { // pseudo BASE class
1992: if(VStateless_class* base=PC.cclass->base_class()) {
1993: change_string_literal_value(*yyval, base->name());
1.61 paf 1994: } else {
1995: strcpy(PC.error, "no base class declared");
1996: YYERROR;
1997: }
1998: }
1.84 paf 1999: O(*yyval, OP_GET_CLASS);
1.112 paf 2000: ;}
2001: break;
2002:
1.115 misha 2003: case 121:
1.118 ! misha 2004: #line 578 "compile.y"
1.112 paf 2005: {
1.1 parser 2006: yyval=yyvsp[-1];
1.39 paf 2007: if(!PC.in_call_value) {
1.1 parser 2008: strcpy(PC.error, ":: not allowed here");
2009: YYERROR;
2010: }
1.84 paf 2011: O(*yyval, OP_PREPARE_TO_CONSTRUCT_OBJECT);
1.112 paf 2012: ;}
2013: break;
2014:
1.115 misha 2015: case 128:
1.118 ! misha 2016: #line 597 "compile.y"
1.114 misha 2017: { yyval = yyvsp[-1] ;}
2018: break;
2019:
1.115 misha 2020: case 129:
1.118 ! misha 2021: #line 598 "compile.y"
1.112 paf 2022: { yyval = yyvsp[-1] ;}
2023: break;
2024:
1.115 misha 2025: case 130:
1.118 ! misha 2026: #line 599 "compile.y"
1.114 misha 2027: { yyval = yyvsp[-1]; ;}
1.112 paf 2028: break;
2029:
1.115 misha 2030: case 131:
1.118 ! misha 2031: #line 601 "compile.y"
1.114 misha 2032: { yyval=yyvsp[0]; O(*yyval, OP_NEG) ;}
1.112 paf 2033: break;
2034:
1.115 misha 2035: case 132:
1.118 ! misha 2036: #line 602 "compile.y"
1.114 misha 2037: { yyval=yyvsp[0] ;}
1.112 paf 2038: break;
2039:
1.115 misha 2040: case 133:
1.118 ! misha 2041: #line 603 "compile.y"
1.114 misha 2042: { yyval=yyvsp[0]; O(*yyval, OP_INV) ;}
1.112 paf 2043: break;
2044:
1.115 misha 2045: case 134:
1.118 ! misha 2046: #line 604 "compile.y"
1.114 misha 2047: { yyval=yyvsp[0]; O(*yyval, OP_NOT) ;}
1.112 paf 2048: break;
2049:
1.115 misha 2050: case 135:
1.118 ! misha 2051: #line 605 "compile.y"
1.114 misha 2052: { yyval=yyvsp[0]; O(*yyval, OP_DEF) ;}
1.112 paf 2053: break;
2054:
1.115 misha 2055: case 136:
1.118 ! misha 2056: #line 606 "compile.y"
1.114 misha 2057: { yyval=yyvsp[0]; O(*yyval, OP_IN) ;}
1.112 paf 2058: break;
2059:
1.115 misha 2060: case 137:
1.118 ! misha 2061: #line 607 "compile.y"
1.114 misha 2062: { yyval=yyvsp[0]; O(*yyval, OP_FEXISTS) ;}
1.112 paf 2063: break;
2064:
1.115 misha 2065: case 138:
1.118 ! misha 2066: #line 608 "compile.y"
1.114 misha 2067: { yyval=yyvsp[0]; O(*yyval, OP_DEXISTS) ;}
1.112 paf 2068: break;
2069:
1.115 misha 2070: case 139:
1.118 ! misha 2071: #line 610 "compile.y"
1.114 misha 2072: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_SUB) ;}
1.112 paf 2073: break;
2074:
1.115 misha 2075: case 140:
1.118 ! misha 2076: #line 611 "compile.y"
1.114 misha 2077: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_ADD) ;}
1.112 paf 2078: break;
2079:
1.115 misha 2080: case 141:
1.118 ! misha 2081: #line 612 "compile.y"
1.114 misha 2082: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_MUL) ;}
1.112 paf 2083: break;
2084:
1.115 misha 2085: case 142:
1.118 ! misha 2086: #line 613 "compile.y"
1.114 misha 2087: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_DIV) ;}
1.112 paf 2088: break;
2089:
1.115 misha 2090: case 143:
1.118 ! misha 2091: #line 614 "compile.y"
1.114 misha 2092: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_MOD) ;}
1.112 paf 2093: break;
2094:
1.115 misha 2095: case 144:
1.118 ! misha 2096: #line 615 "compile.y"
1.114 misha 2097: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_INTDIV) ;}
1.112 paf 2098: break;
2099:
1.115 misha 2100: case 145:
1.118 ! misha 2101: #line 616 "compile.y"
1.114 misha 2102: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_SL) ;}
1.112 paf 2103: break;
2104:
1.115 misha 2105: case 146:
1.118 ! misha 2106: #line 617 "compile.y"
1.114 misha 2107: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_SR) ;}
1.112 paf 2108: break;
2109:
1.115 misha 2110: case 147:
1.118 ! misha 2111: #line 618 "compile.y"
1.114 misha 2112: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_AND) ;}
1.112 paf 2113: break;
2114:
1.115 misha 2115: case 148:
1.118 ! misha 2116: #line 619 "compile.y"
1.114 misha 2117: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_OR) ;}
1.112 paf 2118: break;
2119:
1.115 misha 2120: case 149:
1.118 ! misha 2121: #line 620 "compile.y"
1.114 misha 2122: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_XOR) ;}
1.112 paf 2123: break;
2124:
1.115 misha 2125: case 150:
1.118 ! misha 2126: #line 621 "compile.y"
1.114 misha 2127: { yyval=yyvsp[-2]; OA(*yyval, OP_NESTED_CODE, yyvsp[0]); O(*yyval, OP_LOG_AND) ;}
1.112 paf 2128: break;
2129:
1.115 misha 2130: case 151:
1.118 ! misha 2131: #line 622 "compile.y"
1.114 misha 2132: { yyval=yyvsp[-2]; OA(*yyval, OP_NESTED_CODE, yyvsp[0]); O(*yyval, OP_LOG_OR) ;}
1.112 paf 2133: break;
2134:
1.115 misha 2135: case 152:
1.118 ! misha 2136: #line 623 "compile.y"
1.114 misha 2137: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_LOG_XOR) ;}
1.112 paf 2138: break;
2139:
1.115 misha 2140: case 153:
1.118 ! misha 2141: #line 624 "compile.y"
1.114 misha 2142: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_LT) ;}
1.112 paf 2143: break;
2144:
1.115 misha 2145: case 154:
1.118 ! misha 2146: #line 625 "compile.y"
1.114 misha 2147: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_GT) ;}
1.112 paf 2148: break;
2149:
1.115 misha 2150: case 155:
1.118 ! misha 2151: #line 626 "compile.y"
1.114 misha 2152: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_LE) ;}
1.112 paf 2153: break;
2154:
1.115 misha 2155: case 156:
1.118 ! misha 2156: #line 627 "compile.y"
1.114 misha 2157: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_GE) ;}
1.112 paf 2158: break;
2159:
1.115 misha 2160: case 157:
1.118 ! misha 2161: #line 628 "compile.y"
1.114 misha 2162: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_EQ) ;}
1.112 paf 2163: break;
2164:
1.115 misha 2165: case 158:
1.118 ! misha 2166: #line 629 "compile.y"
1.114 misha 2167: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_NE) ;}
1.112 paf 2168: break;
2169:
1.115 misha 2170: case 159:
1.118 ! misha 2171: #line 630 "compile.y"
1.114 misha 2172: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_LT) ;}
1.112 paf 2173: break;
2174:
1.115 misha 2175: case 160:
1.118 ! misha 2176: #line 631 "compile.y"
1.114 misha 2177: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_GT) ;}
1.112 paf 2178: break;
2179:
1.115 misha 2180: case 161:
1.118 ! misha 2181: #line 632 "compile.y"
1.114 misha 2182: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_LE) ;}
1.112 paf 2183: break;
2184:
1.115 misha 2185: case 162:
1.118 ! misha 2186: #line 633 "compile.y"
1.114 misha 2187: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_GE) ;}
1.112 paf 2188: break;
2189:
1.115 misha 2190: case 163:
1.118 ! misha 2191: #line 634 "compile.y"
1.114 misha 2192: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_EQ) ;}
1.112 paf 2193: break;
2194:
1.115 misha 2195: case 164:
1.118 ! misha 2196: #line 635 "compile.y"
1.114 misha 2197: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_NE) ;}
1.112 paf 2198: break;
2199:
1.115 misha 2200: case 165:
1.118 ! misha 2201: #line 636 "compile.y"
1.114 misha 2202: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_IS) ;}
1.112 paf 2203: break;
2204:
1.115 misha 2205: case 166:
1.118 ! misha 2206: #line 639 "compile.y"
1.112 paf 2207: {
1.104 paf 2208: // optimized from OP_STRING->OP_VALUE for doubles
2209: maybe_change_string_literal_to_double_literal(*(yyval=yyvsp[0]));
1.112 paf 2210: ;}
2211: break;
2212:
1.115 misha 2213: case 167:
1.118 ! misha 2214: #line 644 "compile.y"
1.112 paf 2215: {
1.84 paf 2216: yyval=N();
2217: OA(*yyval, OP_STRING_POOL, yyvsp[0]); /* stack: empty write context */
1.47 paf 2218: /* some code that writes to that context */
2219: /* context=pop; stack: context.get_string() */
1.112 paf 2220: ;}
2221: break;
2222:
1.115 misha 2223: case 168:
1.118 ! misha 2224: #line 653 "compile.y"
1.112 paf 2225: {
1.97 paf 2226: // optimized from OP_STRING+OP_WRITE_VALUE to OP_STRING__WRITE
2227: change_string_literal_to_write_string_literal(*(yyval=yyvsp[0]))
1.112 paf 2228: ;}
2229: break;
2230:
1.115 misha 2231: case 169:
1.118 ! misha 2232: #line 658 "compile.y"
1.112 paf 2233: { yyval=VL(/*we know that we will not change it*/const_cast<VVoid*>(&vvoid), 0, 0, 0) ;}
2234: break;
2235:
1.115 misha 2236: case 170:
1.118 ! misha 2237: #line 659 "compile.y"
1.112 paf 2238: { yyval = VL(/*we know that we will not change it*/const_cast<VBool*>(&vtrue), 0, 0, 0) ;}
2239: break;
2240:
1.115 misha 2241: case 171:
1.118 ! misha 2242: #line 660 "compile.y"
1.112 paf 2243: { yyval = VL(/*we know that we will not change it*/const_cast<VBool*>(&vfalse), 0, 0, 0) ;}
2244: break;
2245:
1.115 misha 2246: case 172:
1.118 ! misha 2247: #line 662 "compile.y"
1.112 paf 2248: { yyval=N() ;}
2249: break;
2250:
2251:
2252: }
2253:
1.114 misha 2254: /* Line 1010 of yacc.c. */
1.118 ! misha 2255: #line 2256 "compile.tab.C"
1.1 parser 2256:
2257: yyvsp -= yylen;
2258: yyssp -= yylen;
2259:
1.112 paf 2260:
2261: YY_STACK_PRINT (yyss, yyssp);
1.1 parser 2262:
2263: *++yyvsp = yyval;
2264:
2265:
1.112 paf 2266: /* Now `shift' the result of the reduction. Determine what state
2267: that goes to, based on the state we popped back to and the rule
2268: number reduced by. */
1.1 parser 2269:
2270: yyn = yyr1[yyn];
2271:
1.112 paf 2272: yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2273: if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1.1 parser 2274: yystate = yytable[yystate];
2275: else
1.112 paf 2276: yystate = yydefgoto[yyn - YYNTOKENS];
1.1 parser 2277:
2278: goto yynewstate;
2279:
2280:
1.112 paf 2281: /*------------------------------------.
2282: | yyerrlab -- here on detecting error |
2283: `------------------------------------*/
2284: yyerrlab:
2285: /* If not already recovering from an error, report this error. */
2286: if (!yyerrstatus)
1.1 parser 2287: {
2288: ++yynerrs;
1.112 paf 2289: #if YYERROR_VERBOSE
1.1 parser 2290: yyn = yypact[yystate];
2291:
1.112 paf 2292: if (YYPACT_NINF < yyn && yyn < YYLAST)
1.1 parser 2293: {
1.112 paf 2294: YYSIZE_T yysize = 0;
2295: int yytype = YYTRANSLATE (yychar);
2296: const char* yyprefix;
2297: char *yymsg;
2298: int yyx;
2299:
2300: /* Start YYX at -YYN if negative to avoid negative indexes in
2301: YYCHECK. */
2302: int yyxbegin = yyn < 0 ? -yyn : 0;
2303:
2304: /* Stay within bounds of both yycheck and yytname. */
2305: int yychecklim = YYLAST - yyn;
2306: int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2307: int yycount = 0;
2308:
2309: yyprefix = ", expecting ";
2310: for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2311: if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2312: {
2313: yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
2314: yycount += 1;
2315: if (yycount == 5)
2316: {
2317: yysize = 0;
2318: break;
2319: }
2320: }
2321: yysize += (sizeof ("syntax error, unexpected ")
2322: + yystrlen (yytname[yytype]));
2323: yymsg = (char *) YYSTACK_ALLOC (yysize);
2324: if (yymsg != 0)
1.1 parser 2325: {
1.112 paf 2326: char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
2327: yyp = yystpcpy (yyp, yytname[yytype]);
1.1 parser 2328:
1.112 paf 2329: if (yycount < 5)
1.1 parser 2330: {
1.112 paf 2331: yyprefix = ", expecting ";
2332: for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2333: if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1.1 parser 2334: {
1.112 paf 2335: yyp = yystpcpy (yyp, yyprefix);
2336: yyp = yystpcpy (yyp, yytname[yyx]);
2337: yyprefix = " or ";
1.1 parser 2338: }
2339: }
1.112 paf 2340: yyerror (yymsg);
2341: YYSTACK_FREE (yymsg);
1.1 parser 2342: }
2343: else
1.112 paf 2344: yyerror ("syntax error; also virtual memory exhausted");
1.1 parser 2345: }
2346: else
2347: #endif /* YYERROR_VERBOSE */
1.112 paf 2348: yyerror ("syntax error");
1.1 parser 2349: }
2350:
1.112 paf 2351:
1.1 parser 2352:
2353: if (yyerrstatus == 3)
2354: {
1.112 paf 2355: /* If just tried and failed to reuse lookahead token after an
2356: error, discard it. */
1.109 paf 2357:
1.113 paf 2358: if (yychar <= YYEOF)
1.112 paf 2359: {
1.113 paf 2360: /* If at end of input, pop the error token,
2361: then the rest of the stack, then return failure. */
2362: if (yychar == YYEOF)
2363: for (;;)
2364: {
2365: YYPOPSTACK;
2366: if (yyssp == yyss)
2367: YYABORT;
2368: YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2369: yydestruct (yystos[*yyssp], yyvsp);
2370: }
1.112 paf 2371: }
1.113 paf 2372: else
2373: {
2374: YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
2375: yydestruct (yytoken, &yylval);
2376: yychar = YYEMPTY;
1.1 parser 2377:
1.113 paf 2378: }
1.106 paf 2379: }
1.1 parser 2380:
1.112 paf 2381: /* Else will try to reuse lookahead token after shifting the error
2382: token. */
2383: goto yyerrlab1;
1.109 paf 2384:
1.1 parser 2385:
1.113 paf 2386: /*---------------------------------------------------.
2387: | yyerrorlab -- error raised explicitly by YYERROR. |
2388: `---------------------------------------------------*/
2389: yyerrorlab:
2390:
2391: #ifdef __GNUC__
2392: /* Pacify GCC when the user code never invokes YYERROR and the label
2393: yyerrorlab therefore never appears in user code. */
2394: if (0)
2395: goto yyerrorlab;
2396: #endif
2397:
2398: yyvsp -= yylen;
2399: yyssp -= yylen;
2400: yystate = *yyssp;
2401: goto yyerrlab1;
2402:
2403:
2404: /*-------------------------------------------------------------.
2405: | yyerrlab1 -- common code for both syntax error and YYERROR. |
2406: `-------------------------------------------------------------*/
1.112 paf 2407: yyerrlab1:
2408: yyerrstatus = 3; /* Each real token shifted decrements this. */
1.1 parser 2409:
1.112 paf 2410: for (;;)
1.109 paf 2411: {
1.112 paf 2412: yyn = yypact[yystate];
2413: if (yyn != YYPACT_NINF)
2414: {
2415: yyn += YYTERROR;
2416: if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2417: {
2418: yyn = yytable[yyn];
2419: if (0 < yyn)
2420: break;
2421: }
2422: }
1.1 parser 2423:
1.112 paf 2424: /* Pop the current state because it cannot handle the error token. */
2425: if (yyssp == yyss)
2426: YYABORT;
1.1 parser 2427:
1.112 paf 2428: YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2429: yydestruct (yystos[yystate], yyvsp);
1.113 paf 2430: YYPOPSTACK;
2431: yystate = *yyssp;
1.112 paf 2432: YY_STACK_PRINT (yyss, yyssp);
1.1 parser 2433: }
2434:
2435: if (yyn == YYFINAL)
2436: YYACCEPT;
2437:
1.112 paf 2438: YYDPRINTF ((stderr, "Shifting error token, "));
1.1 parser 2439:
2440: *++yyvsp = yylval;
1.112 paf 2441:
1.1 parser 2442:
2443: yystate = yyn;
2444: goto yynewstate;
2445:
2446:
1.112 paf 2447: /*-------------------------------------.
2448: | yyacceptlab -- YYACCEPT comes here. |
2449: `-------------------------------------*/
2450: yyacceptlab:
2451: yyresult = 0;
2452: goto yyreturn;
2453:
2454: /*-----------------------------------.
2455: | yyabortlab -- YYABORT comes here. |
2456: `-----------------------------------*/
2457: yyabortlab:
2458: yyresult = 1;
2459: goto yyreturn;
2460:
2461: #ifndef yyoverflow
2462: /*----------------------------------------------.
2463: | yyoverflowlab -- parser overflow comes here. |
2464: `----------------------------------------------*/
2465: yyoverflowlab:
2466: yyerror ("parser stack overflow");
2467: yyresult = 2;
2468: /* Fall through. */
2469: #endif
2470:
2471: yyreturn:
2472: #ifndef yyoverflow
2473: if (yyss != yyssa)
2474: YYSTACK_FREE (yyss);
1.1 parser 2475: #endif
1.112 paf 2476: return yyresult;
1.1 parser 2477: }
1.112 paf 2478:
2479:
1.118 ! misha 2480: #line 664 "compile.y"
1.1 parser 2481:
2482: #endif
2483:
2484: /*
2485: 000$111(2222)00
2486: 000$111{3333}00
2487: $,^: push,=0
2488: 1:( { break=pop
2489: 2:( ) pop
2490: 3:{ } pop
2491:
2492: 000^111(2222)4444{33333}4000
2493: $,^: push,=0
2494: 1:( { break=pop
2495: 2:( )=4
2496: 3:{ }=4
2497: 4:[^({]=pop
2498: */
2499:
1.84 paf 2500: inline void ungetc(Parse_control& pc, uint last_line_end_col) {
2501: pc.source--;
2502: if(pc.pos.col==0) {
2503: --pc.pos.line; pc.pos.col=last_line_end_col;
2504: } else
2505: --pc.pos.col;
2506:
2507: }
2508: static int yylex(YYSTYPE *lvalp, void *apc) {
2509: register Parse_control& pc=*static_cast<Parse_control*>(apc);
2510:
2511: #define lexical_brackets_nestage pc.brackets_nestages[pc.ls_sp]
1.1 parser 2512: #define RC {result=c; goto break2; }
2513:
1.84 paf 2514: register int c;
2515: int result;
1.1 parser 2516:
1.84 paf 2517: if(pc.pending_state) {
2518: result=pc.pending_state;
2519: pc.pending_state=0;
1.1 parser 2520: return result;
2521: }
2522:
1.84 paf 2523: const char *begin=pc.source;
2524: Pos begin_pos=pc.pos;
1.1 parser 2525: const char *end;
2526: int skip_analized=0;
2527: while(true) {
1.84 paf 2528: c=*(end=(pc.source++));
2529: // fprintf(stderr, "\nchar: %c %02X; nestage: %d, sp=%d", c, c, lexical_brackets_nestage, pc.sp);
1.1 parser 2530:
1.96 paf 2531: if(c=='\n')
1.84 paf 2532: pc.pos_next_line();
1.96 paf 2533: else
1.84 paf 2534: pc.pos_next_c(c);
1.96 paf 2535: // fprintf(stderr, "\nchar: %c file(%d:%d)", c, pc.pos.line, pc.pos.col);
1.1 parser 2536:
1.96 paf 2537: if(pc.pos.col==0+1 && c=='@') {
1.84 paf 2538: if(pc.ls==LS_DEF_SPECIAL_BODY) {
1.31 paf 2539: // @SPECIAL
2540: // ...
2541: // @<here =
1.84 paf 2542: pop_LS(pc); // exiting from LS_DEF_SPECIAL_BODY state
1.31 paf 2543: } // continuing checks
1.84 paf 2544: if(pc.ls==LS_USER) {
2545: push_LS(pc, LS_DEF_NAME);
1.20 parser 2546: RC;
1.31 paf 2547: } else // @ in first column inside some code [when could that be?]
1.20 parser 2548: result=BAD_METHOD_DECL_START;
2549: goto break2;
1.97 paf 2550: }
2551: if(c=='^') {
1.84 paf 2552: if(pc.ls==LS_METHOD_AFTER) {
1.75 paf 2553: // handle after-method situation
1.84 paf 2554: pop_LS(pc);
1.75 paf 2555: result=EON;
2556: skip_analized=-1; // return to punctuation afterwards to assure it's literality
2557: goto break2;
2558: }
1.84 paf 2559: switch(pc.ls) {
1.15 parser 2560: case LS_EXPRESSION_VAR_NAME_WITH_COLON:
2561: case LS_EXPRESSION_VAR_NAME_WITHOUT_COLON:
2562: case LS_VAR_NAME_SIMPLE_WITH_COLON:
2563: case LS_VAR_NAME_SIMPLE_WITHOUT_COLON:
2564: case LS_VAR_NAME_CURLY:
2565: case LS_METHOD_NAME:
1.66 paf 2566: case LS_USER_COMMENT:
1.15 parser 2567: case LS_DEF_COMMENT:
2568: // no literals in names, please
2569: break;
2570: default:
1.84 paf 2571: switch(*pc.source) {
1.10 parser 2572: // ^escaping some punctuators
1.1 parser 2573: case '^': case '$': case ';':
2574: case '(': case ')':
2575: case '[': case ']':
2576: case '{': case '}':
1.23 parser 2577: case '"': case ':':
1.1 parser 2578: if(end!=begin) {
1.84 paf 2579: if(!pc.string_start)
2580: pc.string_start=begin_pos;
1.1 parser 2581: // append piece till ^
1.84 paf 2582: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 2583: }
2584: // reset piece 'begin' position & line
1.84 paf 2585: begin=pc.source; // ->punctuation
2586: begin_pos=pc.pos;
1.75 paf 2587: // skip over _ after ^
1.84 paf 2588: pc.source++; pc.pos.col++;
1.75 paf 2589: // skip analysis = forced literal
2590: continue;
1.1 parser 2591:
2592: // converting ^#HH into char(hex(HH))
2593: case '#':
2594: if(end!=begin) {
1.84 paf 2595: if(!pc.string_start)
2596: pc.string_start=begin_pos;
1.1 parser 2597: // append piece till ^
1.84 paf 2598: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 2599: }
2600: // #HH ?
1.84 paf 2601: if(pc.source[0]=='#' && pc.source[1] && pc.source[2]) {
1.110 paf 2602: char c=(char)(
1.84 paf 2603: hex_value[(unsigned char)pc.source[1]]*0x10+
1.110 paf 2604: hex_value[(unsigned char)pc.source[2]]);
1.84 paf 2605: if(c==0) {
1.1 parser 2606: result=BAD_HEX_LITERAL;
2607: goto break2; // wrong hex value[no ^#00 chars allowed]: bail out
2608: }
2609: // append char(hex(HH))
1.84 paf 2610: pc.string.append(c);
1.1 parser 2611: // skip over ^#HH
1.84 paf 2612: pc.source+=3;
2613: pc.pos.col+=3;
1.1 parser 2614: // reset piece 'begin' position & line
1.84 paf 2615: begin=pc.source; // ->after ^#HH
2616: begin_pos=pc.pos;
1.75 paf 2617: // skip analysis = forced literal
1.1 parser 2618: continue;
2619: }
2620: break;
2621: }
1.15 parser 2622: break;
1.75 paf 2623: }
1.15 parser 2624: }
1.1 parser 2625: // #comment start skipping
1.84 paf 2626: if(c=='#' && pc.pos.col==1) {
1.1 parser 2627: if(end!=begin) {
1.84 paf 2628: if(!pc.string_start)
2629: pc.string_start=begin_pos;
1.1 parser 2630: // append piece till #
1.84 paf 2631: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 2632: }
2633: // fall into COMMENT lexical state [wait for \n]
1.84 paf 2634: push_LS(pc, LS_USER_COMMENT);
1.31 paf 2635: continue;
1.1 parser 2636: }
1.84 paf 2637: switch(pc.ls) {
1.1 parser 2638:
2639: // USER'S = NOT OURS
2640: case LS_USER:
1.84 paf 2641: case LS_NAME_SQUARE_PART: // name.[here].xxx
2642: if(pc.trim_bof)
1.1 parser 2643: switch(c) {
2644: case '\n': case ' ': case '\t':
1.84 paf 2645: begin=pc.source;
2646: begin_pos=pc.pos;
1.1 parser 2647: continue; // skip it
2648: default:
1.84 paf 2649: pc.trim_bof=false;
1.1 parser 2650: }
2651: switch(c) {
2652: case '$':
1.84 paf 2653: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 2654: RC;
2655: case '^':
1.84 paf 2656: push_LS(pc, LS_METHOD_NAME);
1.1 parser 2657: RC;
1.11 parser 2658: case ']':
1.84 paf 2659: if(pc.ls==LS_NAME_SQUARE_PART)
1.11 parser 2660: if(--lexical_brackets_nestage==0) {// $name.[co<]?>de<]?>
1.84 paf 2661: pop_LS(pc); // $name.[co<]>de<]!>
1.11 parser 2662: RC;
2663: }
1.3 parser 2664: break;
1.11 parser 2665: case '[': // $name.[co<[>de]
1.84 paf 2666: if(pc.ls==LS_NAME_SQUARE_PART)
1.11 parser 2667: lexical_brackets_nestage++;
1.4 parser 2668: break;
1.1 parser 2669: }
1.97 paf 2670: if(pc.explicit_result && c)
2671: switch(c) {
2672: case '\n': case ' ': case '\t':
2673: begin=pc.source;
2674: begin_pos=pc.pos;
2675: continue; // skip it
2676: default:
2677: result=BAD_NONWHITESPACE_CHARACTER_IN_EXPLICIT_RESULT_MODE;
2678: goto break2;
2679: }
1.1 parser 2680: break;
2681:
2682: // #COMMENT
1.66 paf 2683: case LS_USER_COMMENT:
1.1 parser 2684: if(c=='\n') {
2685: // skip comment
1.84 paf 2686: begin=pc.source;
2687: begin_pos=pc.pos;
1.1 parser 2688:
1.84 paf 2689: pop_LS(pc);
1.1 parser 2690: continue;
2691: }
2692: break;
2693:
2694: // STRING IN EXPRESSION
2695: case LS_EXPRESSION_STRING_QUOTED:
2696: case LS_EXPRESSION_STRING_APOSTROFED:
2697: switch(c) {
2698: case '"':
2699: case '\'':
2700: if(
1.84 paf 2701: pc.ls == LS_EXPRESSION_STRING_QUOTED && c=='"' ||
2702: pc.ls == LS_EXPRESSION_STRING_APOSTROFED && c=='\'') {
2703: pop_LS(pc); //"abc". | 'abc'.
1.1 parser 2704: RC;
2705: }
2706: break;
2707: case '$':
1.84 paf 2708: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 2709: RC;
2710: case '^':
1.84 paf 2711: push_LS(pc, LS_METHOD_NAME);
1.1 parser 2712: RC;
2713: }
2714: break;
2715:
2716: // METHOD DEFINITION
2717: case LS_DEF_NAME:
2718: switch(c) {
2719: case '[':
1.84 paf 2720: pc.ls=LS_DEF_PARAMS;
1.1 parser 2721: RC;
2722: case '\n':
1.84 paf 2723: pc.ls=LS_DEF_SPECIAL_BODY;
1.1 parser 2724: RC;
2725: }
2726: break;
2727:
2728: case LS_DEF_PARAMS:
2729: switch(c) {
1.64 paf 2730: case '$': // common error
1.65 paf 2731: result=BAD_METHOD_PARAMETER_NAME_CHARACTER;
2732: goto break2;
1.1 parser 2733: case ';':
2734: RC;
2735: case ']':
1.84 paf 2736: pc.ls=*pc.source=='['?LS_DEF_LOCALS:LS_DEF_COMMENT;
1.1 parser 2737: RC;
2738: case '\n': // wrong. bailing out
1.84 paf 2739: pop_LS(pc);
1.1 parser 2740: RC;
2741: }
2742: break;
2743:
2744: case LS_DEF_LOCALS:
2745: switch(c) {
2746: case '[':
2747: case ';':
2748: RC;
2749: case ']':
1.84 paf 2750: pc.ls=LS_DEF_COMMENT;
1.1 parser 2751: RC;
2752: case '\n': // wrong. bailing out
1.84 paf 2753: pop_LS(pc);
1.1 parser 2754: RC;
2755: }
2756: break;
2757:
2758: case LS_DEF_COMMENT:
2759: if(c=='\n') {
1.84 paf 2760: pop_LS(pc);
1.1 parser 2761: RC;
2762: }
2763: break;
2764:
2765: case LS_DEF_SPECIAL_BODY:
1.31 paf 2766: if(c=='\n')
1.1 parser 2767: RC;
2768: break;
2769:
2770: // (EXPRESSION)
2771: case LS_VAR_ROUND:
2772: case LS_METHOD_ROUND:
2773: switch(c) {
2774: case ')':
2775: if(--lexical_brackets_nestage==0)
1.84 paf 2776: if(pc.ls==LS_METHOD_ROUND) // method round param ended
2777: pc.ls=LS_METHOD_AFTER; // look for method end
2778: else // pc.ls==LS_VAR_ROUND // variable constructor ended
2779: pop_LS(pc); // return to normal life
1.1 parser 2780: RC;
1.66 paf 2781: case '#': // comment start skipping
2782: if(end!=begin) {
1.84 paf 2783: if(!pc.string_start)
2784: pc.string_start=begin_pos;
1.66 paf 2785: // append piece till #
1.84 paf 2786: pc.string.append_strdup_know_length(begin, end-begin);
1.66 paf 2787: }
2788: // fall into COMMENT lexical state [wait for \n]
1.84 paf 2789: push_LS(pc, LS_EXPRESSION_COMMENT);
1.66 paf 2790: lexical_brackets_nestage=1;
2791: continue;
1.1 parser 2792: case '$':
1.84 paf 2793: push_LS(pc, LS_EXPRESSION_VAR_NAME_WITH_COLON);
1.1 parser 2794: RC;
2795: case '^':
1.84 paf 2796: push_LS(pc, LS_METHOD_NAME);
1.1 parser 2797: RC;
2798: case '(':
2799: lexical_brackets_nestage++;
2800: RC;
2801: case '-':
1.84 paf 2802: switch(*pc.source) {
1.1 parser 2803: case 'f': // -f
2804: skip_analized=1;
2805: result=FEXISTS;
2806: goto break2;
2807: case 'd': // -d
2808: skip_analized=1;
2809: result=DEXISTS;
2810: goto break2;
1.63 paf 2811: default: // minus
1.1 parser 2812: result=c;
2813: goto break2;
2814: }
2815: goto break2;
1.25 paf 2816: case '+': case '*': case '/': case '%': case '\\':
1.1 parser 2817: case '~':
2818: case ';':
2819: RC;
1.65 paf 2820: case '&': case '|':
1.84 paf 2821: if(*pc.source==c) { // && ||
1.65 paf 2822: result=c=='&'?LAND:LOR;
1.1 parser 2823: skip_analized=1;
2824: } else
2825: result=c;
2826: goto break2;
1.65 paf 2827: case '!':
1.84 paf 2828: switch(pc.source[0]) {
1.65 paf 2829: case '|': // !| !||
2830: skip_analized=1;
1.84 paf 2831: if(pc.source[1]=='|') {
1.65 paf 2832: skip_analized++;
2833: result=LXOR;
2834: } else
2835: result=NXOR;
2836: goto break2;
2837: case '=': // !=
2838: skip_analized=1;
2839: result=NNE;
2840: goto break2;
2841: }
2842: RC;
1.67 paf 2843:
2844: case '<': // <<, <=, <
1.84 paf 2845: switch(*pc.source) {
1.67 paf 2846: case '<': // <[<]
2847: skip_analized=1; result=NSL; break;
2848: case '=': // <[=]
2849: skip_analized=1; result=NLE; break;
2850: default: // <[]
2851: result=c; break;
2852: }
2853: goto break2;
2854: case '>': // >>, >=, >
1.84 paf 2855: switch(*pc.source) {
1.67 paf 2856: case '>': // >[>]
2857: skip_analized=1; result=NSR; break;
2858: case '=': // >[=]
2859: skip_analized=1; result=NGE; break;
2860: default: // >[]
2861: result=c; break;
2862: }
2863: goto break2;
2864: case '=': // ==
1.84 paf 2865: switch(*pc.source) {
1.67 paf 2866: case '=': // =[=]
2867: skip_analized=1; result=NEQ; break;
2868: default: // =[]
2869: result=c; break; // not used now
2870: }
1.1 parser 2871: goto break2;
1.67 paf 2872:
1.1 parser 2873: case '"':
1.84 paf 2874: push_LS(pc, LS_EXPRESSION_STRING_QUOTED);
1.1 parser 2875: RC;
2876: case '\'':
1.84 paf 2877: push_LS(pc, LS_EXPRESSION_STRING_APOSTROFED);
1.1 parser 2878: RC;
2879: case 'l': case 'g': case 'e': case 'n':
2880: if(end==begin) // right after whitespace
1.84 paf 2881: if(isspace(pc.source[1])) {
2882: switch(*pc.source) {
1.1 parser 2883: // case '?': // ok [and bad cases, yacc would bark at them]
2884: case 't': // lt gt [et nt]
2885: result=c=='l'?SLT:c=='g'?SGT:BAD_STRING_COMPARISON_OPERATOR;
2886: skip_analized=1;
2887: goto break2;
2888: case 'e': // le ge ne [ee]
2889: result=c=='l'?SLE:c=='g'?SGE:c=='n'?SNE:BAD_STRING_COMPARISON_OPERATOR;
2890: skip_analized=1;
2891: goto break2;
2892: case 'q': // eq [lq gq nq]
2893: result=c=='e'?SEQ:BAD_STRING_COMPARISON_OPERATOR;
2894: skip_analized=1;
2895: goto break2;
2896: }
2897: }
2898: break;
2899: case 'i':
2900: if(end==begin) // right after whitespace
1.84 paf 2901: if(isspace(pc.source[1])) {
2902: switch(pc.source[0]) {
1.1 parser 2903: case 'n': // in
2904: skip_analized=1;
2905: result=IN;
2906: goto break2;
2907: case 's': // is
2908: skip_analized=1;
2909: result=IS;
2910: goto break2;
2911: }
2912: }
2913: break;
2914: case 'd':
2915: if(end==begin) // right after whitespace
1.84 paf 2916: if(pc.source[0]=='e' && pc.source[1]=='f') { // def
1.118 ! misha 2917: switch(pc.source[2]){
! 2918: case ' ': case '\t': case '\n': case '"': case '\'': case '^': case '$': // non-quoted string without whitespace after 'def' is not allowed
! 2919: skip_analized=2;
! 2920: result=DEF;
! 2921: goto break2;
! 2922: }
! 2923: // error: incorrect char after 'def'
1.1 parser 2924: }
2925: break;
1.107 paf 2926: case 't':
2927: if(end==begin) // right after whitespace
1.118 ! misha 2928: if(pc.source[0]=='r' && pc.source[1]=='u' && pc.source[2]=='e') { // true
1.107 paf 2929: skip_analized=3;
2930: result=LITERAL_TRUE;
2931: goto break2;
2932: }
2933: break;
2934: case 'f':
2935: if(end==begin) // right after whitespace
1.118 ! misha 2936: if(pc.source[0]=='a' && pc.source[1]=='l' && pc.source[2]=='s' && pc.source[3]=='e') { // false
1.107 paf 2937: skip_analized=4;
2938: result=LITERAL_FALSE;
2939: goto break2;
2940: }
2941: break;
1.1 parser 2942: case ' ': case '\t': case '\n':
2943: if(end!=begin) { // there were a string after previous operator?
2944: result=0; // return that string
2945: goto break2;
2946: }
2947: // that's a leading|traling space or after-operator-space
2948: // ignoring it
2949: // reset piece 'begin' position & line
1.84 paf 2950: begin=pc.source; // after whitespace char
2951: begin_pos=pc.pos;
1.1 parser 2952: continue;
2953: }
2954: break;
1.66 paf 2955: case LS_EXPRESSION_COMMENT:
2956: if(c=='(')
2957: lexical_brackets_nestage++;
2958:
1.84 paf 2959: switch(*pc.source) {
1.66 paf 2960: case '\n': case ')':
1.84 paf 2961: if(*pc.source==')')
1.66 paf 2962: if(--lexical_brackets_nestage!=0)
2963: continue;
2964:
2965: // skip comment
1.84 paf 2966: begin=pc.source;
2967: begin_pos=pc.pos;
1.66 paf 2968:
1.84 paf 2969: pop_LS(pc);
1.66 paf 2970: continue;
2971: }
2972: break;
1.1 parser 2973:
2974: // VARIABLE GET/PUT/WITH
1.11 parser 2975: case LS_VAR_NAME_SIMPLE_WITH_COLON:
2976: case LS_VAR_NAME_SIMPLE_WITHOUT_COLON:
2977: case LS_EXPRESSION_VAR_NAME_WITH_COLON:
2978: case LS_EXPRESSION_VAR_NAME_WITHOUT_COLON:
2979: if(
1.84 paf 2980: pc.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON ||
2981: pc.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.41 paf 2982: // name in expr ends also before
1.1 parser 2983: switch(c) {
1.41 paf 2984: // expression minus
1.1 parser 2985: case '-':
1.41 paf 2986: // expression integer division
2987: case '\\':
1.84 paf 2988: pop_LS(pc);
2989: pc.ungetc();
1.1 parser 2990: result=EON;
2991: goto break2;
2992: }
2993: }
1.11 parser 2994: if(
1.84 paf 2995: pc.ls==LS_VAR_NAME_SIMPLE_WITHOUT_COLON ||
2996: pc.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.1 parser 2997: // name already has ':', stop before next
2998: switch(c) {
2999: case ':':
1.84 paf 3000: pop_LS(pc);
3001: pc.ungetc();
1.1 parser 3002: result=EON;
3003: goto break2;
3004: }
3005: }
3006: switch(c) {
3007: case 0:
3008: case ' ': case '\t': case '\n':
3009: case ';':
3010: case ']': case '}': case ')':
3011: case '"': case '\'':
3012: case '<': case '>': // these stand for HTML brackets AND expression binary ops
3013: case '+': case '*': case '/': case '%':
3014: case '&': case '|':
3015: case '=': case '!':
3016: // common delimiters
1.62 paf 3017: case ',': case '?': case '#':
1.113 paf 3018: // mysql column separators
3019: case '`':
1.1 parser 3020: // before call
3021: case '^':
1.84 paf 3022: pop_LS(pc);
3023: pc.ungetc();
1.1 parser 3024: result=EON;
3025: goto break2;
3026: case '[':
1.5 parser 3027: // $name.<[>code]
1.84 paf 3028: if(pc.pos.col>1/*not first column*/ && (
1.6 parser 3029: end[-1]=='$'/*was start of get*/ ||
3030: end[-1]==':'/*was class name delim */ ||
3031: end[-1]=='.'/*was name delim */
1.5 parser 3032: )) {
1.84 paf 3033: push_LS(pc, LS_NAME_SQUARE_PART);
1.5 parser 3034: lexical_brackets_nestage=1;
3035: RC;
3036: }
1.84 paf 3037: pc.ls=LS_VAR_SQUARE;
1.1 parser 3038: lexical_brackets_nestage=1;
3039: RC;
3040: case '{':
3041: if(begin==end) { // ${name}, no need of EON, switching LS
1.84 paf 3042: pc.ls=LS_VAR_NAME_CURLY;
1.1 parser 3043: } else {
1.84 paf 3044: pc.ls=LS_VAR_CURLY;
1.1 parser 3045: lexical_brackets_nestage=1;
3046: }
3047:
3048: RC;
3049: case '(':
1.84 paf 3050: pc.ls=LS_VAR_ROUND;
1.1 parser 3051: lexical_brackets_nestage=1;
3052: RC;
3053: case '.': // name part delim
3054: case '$': // name part subvar
1.3 parser 3055: case ':': // class<:>name
1.11 parser 3056: // go to _WITHOUT_COLON state variant...
1.84 paf 3057: if(pc.ls==LS_VAR_NAME_SIMPLE_WITH_COLON)
3058: pc.ls=LS_VAR_NAME_SIMPLE_WITHOUT_COLON;
3059: else if(pc.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON)
3060: pc.ls=LS_EXPRESSION_VAR_NAME_WITHOUT_COLON;
1.11 parser 3061: // ...stop before next ':'
1.1 parser 3062: RC;
3063: }
3064: break;
3065:
3066: case LS_VAR_NAME_CURLY:
3067: switch(c) {
1.5 parser 3068: case '[':
1.11 parser 3069: // ${name.<[>code]}
1.84 paf 3070: push_LS(pc, LS_NAME_SQUARE_PART);
1.3 parser 3071: lexical_brackets_nestage=1;
3072: RC;
1.1 parser 3073: case '}': // ${name} finished, restoring LS
1.84 paf 3074: pop_LS(pc);
1.1 parser 3075: RC;
3076: case '.': // name part delim
3077: case '$': // name part subvar
3078: case ':': // ':name' or 'class:name'
3079: RC;
3080: }
3081: break;
3082:
3083: case LS_VAR_SQUARE:
3084: switch(c) {
3085: case '$':
1.84 paf 3086: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3087: RC;
3088: case '^':
1.84 paf 3089: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3090: RC;
3091: case ']':
3092: if(--lexical_brackets_nestage==0) {
1.84 paf 3093: pop_LS(pc);
1.1 parser 3094: RC;
3095: }
3096: break;
3097: case ';': // operator_or_fmt;value delim
3098: RC;
3099: case '[':
3100: lexical_brackets_nestage++;
3101: break;
3102: }
3103: break;
3104:
3105: case LS_VAR_CURLY:
3106: switch(c) {
3107: case '$':
1.84 paf 3108: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3109: RC;
3110: case '^':
1.84 paf 3111: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3112: RC;
3113: case '}':
3114: if(--lexical_brackets_nestage==0) {
1.84 paf 3115: pop_LS(pc);
1.1 parser 3116: RC;
3117: }
3118: break;
3119: case '{':
3120: lexical_brackets_nestage++;
3121: break;
3122: }
3123: break;
3124:
3125: // METHOD CALL
3126: case LS_METHOD_NAME:
3127: switch(c) {
3128: case '[':
1.11 parser 3129: // ^name.<[>code].xxx
1.84 paf 3130: if(pc.pos.col>1/*not first column*/ && (
1.6 parser 3131: end[-1]=='^'/*was start of call*/ || // never, ^[ is literal...
3132: end[-1]==':'/*was class name delim */ ||
3133: end[-1]=='.'/*was name delim */
1.5 parser 3134: )) {
1.84 paf 3135: push_LS(pc, LS_NAME_SQUARE_PART);
1.5 parser 3136: lexical_brackets_nestage=1;
3137: RC;
3138: }
1.84 paf 3139: pc.ls=LS_METHOD_SQUARE;
1.1 parser 3140: lexical_brackets_nestage=1;
3141: RC;
3142: case '{':
1.84 paf 3143: pc.ls=LS_METHOD_CURLY;
1.1 parser 3144: lexical_brackets_nestage=1;
3145: RC;
3146: case '(':
1.84 paf 3147: pc.ls=LS_METHOD_ROUND;
1.1 parser 3148: lexical_brackets_nestage=1;
3149: RC;
3150: case '.': // name part delim
3151: case '$': // name part subvar
3152: case ':': // ':name' or 'class:name'
1.19 parser 3153: case '^': // ^abc^xxx wrong. bailing out
3154: case ']': case '}': case ')': // ^abc]}) wrong. bailing out
1.90 paf 3155: case ' ': // ^if ( wrong. bailing out
1.1 parser 3156: RC;
3157: }
3158: break;
3159:
3160: case LS_METHOD_SQUARE:
3161: switch(c) {
3162: case '$':
1.84 paf 3163: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3164: RC;
3165: case '^':
1.84 paf 3166: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3167: RC;
3168: case ';': // param delim
3169: RC;
3170: case ']':
3171: if(--lexical_brackets_nestage==0) {
1.84 paf 3172: pc.ls=LS_METHOD_AFTER;
1.1 parser 3173: RC;
3174: }
3175: break;
3176: case '[':
3177: lexical_brackets_nestage++;
3178: break;
3179: }
3180: break;
3181:
3182: case LS_METHOD_CURLY:
3183: switch(c) {
3184: case '$':
1.84 paf 3185: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3186: RC;
3187: case '^':
1.84 paf 3188: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3189: RC;
3190: case ';': // param delim
3191: RC;
3192: case '}':
3193: if(--lexical_brackets_nestage==0) {
1.84 paf 3194: pc.ls=LS_METHOD_AFTER;
1.1 parser 3195: RC;
3196: }
3197: break;
3198: case '{':
3199: lexical_brackets_nestage++;
3200: break;
3201: }
1.97 paf 3202: if(pc.explicit_result && c)
3203: switch(c) {
3204: case '\n': case ' ': case '\t':
3205: begin=pc.source;
3206: begin_pos=pc.pos;
3207: continue; // skip it
3208: default:
3209: result=BAD_NONWHITESPACE_CHARACTER_IN_EXPLICIT_RESULT_MODE;
3210: goto break2;
3211: }
1.1 parser 3212: break;
3213:
3214: case LS_METHOD_AFTER:
3215: if(c=='[') {/* ][ }[ )[ */
1.84 paf 3216: pc.ls=LS_METHOD_SQUARE;
1.1 parser 3217: lexical_brackets_nestage=1;
3218: RC;
3219: }
3220: if(c=='{') {/* ]{ }{ ){ */
1.84 paf 3221: pc.ls=LS_METHOD_CURLY;
1.1 parser 3222: lexical_brackets_nestage=1;
3223: RC;
3224: }
3225: if(c=='(') {/* ]( }( )( */
1.84 paf 3226: pc.ls=LS_METHOD_ROUND;
1.1 parser 3227: lexical_brackets_nestage=1;
3228: RC;
3229: }
1.84 paf 3230: pop_LS(pc);
3231: pc.ungetc();
1.1 parser 3232: result=EON;
3233: goto break2;
3234: }
3235: if(c==0) {
3236: result=-1;
3237: break;
3238: }
3239: }
3240:
3241: break2:
3242: if(end!=begin) { // there is last piece?
3243: if((c=='@' || c==0) && end[-1]=='\n') { // we are before LS_DEF_NAME or EOF?
3244: // strip last \n
3245: end--;
3246: if(end!=begin && end[-1]=='\n') // allow one empty line before LS_DEF_NAME
3247: end--;
3248: }
1.84 paf 3249: if(end!=begin && pc.ls!=LS_USER_COMMENT) { // last piece still alive and not comment?
3250: if(!pc.string_start)
3251: pc.string_start=begin_pos;
1.1 parser 3252: // append it
1.84 paf 3253: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 3254: }
3255: }
1.84 paf 3256: if(!pc.string.is_empty()) { // something accumulated?
3257: // create STRING value: array of OP_VALUE+origin+vstring
3258: *lvalp=VL(
3259: new VString(*new String(pc.string, String::L_CLEAN)),
3260: pc.file_no, pc.string_start.line, pc.string_start.col);
1.1 parser 3261: // new pieces storage
1.84 paf 3262: pc.string.clear();
3263: pc.string_start.clear();
1.1 parser 3264: // make current result be pending for next call, return STRING for now
1.84 paf 3265: pc.pending_state=result; result=STRING;
1.1 parser 3266: }
3267: if(skip_analized) {
1.84 paf 3268: pc.source+=skip_analized; pc.pos.col+=skip_analized;
1.1 parser 3269: }
3270: return result;
3271: }
3272:
1.84 paf 3273: static int real_yyerror(Parse_control *pc, char *s) { // Called by yyparse on error
1.10 parser 3274: strncpy(PC.error, s, MAX_STRING);
1.1 parser 3275: return 1;
3276: }
3277:
3278: static void yyprint(FILE *file, int type, YYSTYPE value) {
3279: if(type==STRING)
1.84 paf 3280: fprintf(file, " \"%s\"", LA2S(*value)->cstr());
1.1 parser 3281: }
1.112 paf 3282:
3283:
E-mail: