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