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