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