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