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