Annotation of parser3/src/main/compile.tab.C, revision 1.103.8.4
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.103.8.2 paf 43: Copyright (c) 2001-2005 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.103.8.3 paf 46: $Id: compile.y,v 1.213.10.3 2005/08/05 14:13:41 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.103.8.2 paf 108: #define YYFINAL 259
1.1 parser 109: #define YYFLAG -32768
1.67 paf 110: #define YYNTBASE 60
1.1 parser 111:
1.103.8.2 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,
1.103.8.2 paf 157: 230, 232, 234, 236, 238, 240, 242, 245, 247, 250,
158: 253, 255, 257, 260, 262, 264, 266, 268, 271, 274,
159: 275, 276, 282, 284, 286, 289, 292, 294, 296, 299,
160: 302, 304, 306, 308, 310, 314, 318, 322, 325, 328,
161: 331, 334, 337, 340, 343, 346, 350, 354, 358, 362,
162: 366, 370, 374, 378, 382, 386, 390, 394, 398, 402,
163: 406, 410, 414, 418, 422, 426, 430, 434, 438, 442,
164: 446, 450, 454, 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.103.8.2 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.103.8.2 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.103.8.2 paf 178: 85, 0, 86, 0, 87, 0, 136, 87, 0, 126,
179: 0, 123, 126, 0, 50, 89, 93, 0, 90, 0,
180: 91, 0, 92, 0, 122, 0, 53, 122, 0, 136,
181: 122, 0, 94, 0, 97, 0, 98, 0, 0, 0,
182: 47, 95, 99, 96, 48, 0, 54, 139, 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,
1.103.8.2 paf 190: 0, 120, 0, 117, 49, 120, 0, 121, 0, 139,
191: 0, 76, 0, 144, 0, 4, 0, 100, 0, 127,
192: 0, 123, 127, 0, 124, 0, 123, 124, 0, 125,
193: 53, 0, 127, 0, 127, 0, 4, 5, 0, 4,
194: 0, 128, 0, 129, 0, 130, 0, 50, 133, 0,
195: 4, 134, 0, 0, 0, 47, 131, 77, 132, 48,
196: 0, 4, 0, 135, 0, 134, 135, 0, 50, 133,
197: 0, 137, 0, 138, 0, 4, 57, 0, 137, 57,
198: 0, 140, 0, 141, 0, 81, 0, 104, 0, 58,
199: 142, 58, 0, 59, 142, 59, 0, 54, 140, 55,
200: 0, 37, 140, 0, 36, 140, 0, 43, 140, 0,
201: 44, 140, 0, 27, 140, 0, 28, 140, 0, 29,
202: 140, 0, 30, 140, 0, 140, 37, 140, 0, 140,
203: 36, 140, 0, 140, 38, 140, 0, 140, 39, 140,
204: 0, 140, 41, 140, 0, 140, 40, 140, 0, 140,
205: 19, 140, 0, 140, 20, 140, 0, 140, 35, 140,
206: 0, 140, 34, 140, 0, 140, 14, 140, 0, 140,
207: 11, 140, 0, 140, 12, 140, 0, 140, 13, 140,
208: 0, 140, 32, 140, 0, 140, 33, 140, 0, 140,
209: 15, 140, 0, 140, 16, 140, 0, 140, 17, 140,
210: 0, 140, 18, 140, 0, 140, 21, 140, 0, 140,
211: 22, 140, 0, 140, 23, 140, 0, 140, 24, 140,
212: 0, 140, 25, 140, 0, 140, 26, 140, 0, 140,
213: 31, 140, 0, 4, 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,
1.103.8.4! paf 230: 444, 459, 463, 465, 466, 471, 471, 473, 473, 474,
! 231: 475, 483, 488, 490, 492, 493, 494, 496, 500, 509,
! 232: 512, 514, 520, 525, 525, 526, 531, 533, 535, 547,
! 233: 559, 560, 562, 563, 564, 565, 566, 568, 569, 570,
! 234: 571, 572, 573, 574, 575, 577, 578, 579, 580, 581,
! 235: 582, 583, 584, 585, 586, 587, 588, 589, 590, 591,
! 236: 592, 593, 594, 595, 596, 597, 598, 599, 600, 601,
! 237: 602, 603, 606, 611, 620, 625, 626
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",
1.103.8.2 paf 263: "code_param_value","name_expr_dive_code","name_path","name_step","name_advance1",
264: "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",
1.103.8.1 paf 267: "expr_value","expr","double_or_STRING","string_inside_quotes_value","write_string",
268: "void_value","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,
1.103.8.2 paf 282: 119, 120, 121, 121, 121, 122, 122, 123, 123, 124,
283: 125, 126, 126, 127, 127, 127, 127, 128, 129, 131,
284: 132, 130, 133, 134, 134, 135, 136, 136, 137, 138,
285: 139, 140, 140, 140, 140, 140, 140, 140, 140, 140,
286: 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
287: 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
288: 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
289: 140, 140, 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,
1.103.8.2 paf 302: 1, 1, 1, 1, 1, 1, 2, 1, 2, 2,
303: 1, 1, 2, 1, 1, 1, 1, 2, 2, 0,
304: 0, 5, 1, 1, 2, 2, 1, 1, 2, 2,
305: 1, 1, 1, 1, 3, 3, 3, 2, 2, 2,
306: 2, 2, 2, 2, 2, 3, 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.103.8.2 paf 309: 3, 3, 1, 1, 1, 0, 0
1.1 parser 310: };
311:
1.103.8.2 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.103.8.2 paf 315: 0, 104, 110, 0, 0, 0, 37, 39, 0, 41,
316: 42, 43, 0, 48, 49, 50, 51, 0, 98, 0,
317: 45, 96, 105, 106, 107, 0, 117, 118, 0, 4,
318: 30, 167, 167, 167, 103, 0, 119, 109, 114, 0,
319: 113, 108, 0, 0, 102, 0, 104, 52, 0, 96,
320: 38, 57, 167, 0, 47, 54, 55, 56, 104, 99,
321: 46, 97, 100, 44, 53, 120, 73, 71, 15, 8,
322: 10, 11, 0, 9, 23, 0, 22, 21, 167, 19,
323: 18, 116, 115, 111, 40, 97, 166, 0, 163, 0,
324: 0, 0, 0, 0, 0, 0, 0, 0, 0, 167,
325: 167, 123, 124, 0, 121, 122, 0, 12, 14, 13,
326: 20, 0, 26, 0, 25, 0, 165, 0, 32, 58,
327: 64, 65, 66, 62, 61, 132, 133, 134, 135, 129,
328: 128, 130, 131, 0, 164, 0, 0, 60, 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.103.8.2 paf 331: 0, 0, 0, 0, 0, 79, 167, 0, 0, 74,
332: 76, 77, 78, 24, 16, 112, 68, 0, 127, 125,
333: 126, 147, 148, 149, 146, 152, 153, 154, 155, 142,
334: 143, 156, 157, 158, 159, 160, 161, 162, 150, 151,
335: 145, 144, 137, 136, 138, 139, 141, 140, 166, 92,
336: 0, 88, 0, 86, 91, 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.103.8.2 paf 341: static const short yydefgoto[] = { 257,
342: 5, 6, 7, 8, 90, 91, 92, 93, 9, 238,
1.103.8.1 paf 343: 99, 54, 96, 97, 134, 155, 11, 12, 13, 14,
1.99 paf 344: 122, 27, 28, 29, 30, 31, 32, 16, 33, 34,
1.103.8.2 paf 345: 35, 36, 75, 76, 107, 198, 77, 78, 140, 241,
1.103.8.1 paf 346: 142, 143, 17, 123, 49, 127, 88, 189, 190, 191,
1.103.8.2 paf 347: 229, 252, 192, 193, 242, 233, 231, 243, 234, 232,
348: 244, 37, 64, 39, 40, 41, 65, 43, 44, 45,
349: 60, 136, 62, 58, 59, 66, 47, 48, 235, 125,
350: 126, 156, 19, 245, 20
1.1 parser 351: };
352:
1.103.8.1 paf 353: static const short yypact[] = { 5,
354: -32768, 22, 35,-32768, -13,-32768,-32768,-32768,-32768,-32768,
355: 8,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
356: -9, 9,-32768, 36, 20, 44,-32768,-32768, 40,-32768,
357: -32768,-32768, -29,-32768,-32768,-32768,-32768, 52,-32768, -8,
358: -32768, 4,-32768,-32768,-32768, 52, -3,-32768, 20,-32768,
359: -32768, 72, 120, 90,-32768, 36,-32768, 89,-32768, 8,
360: -32768,-32768, 92, 52, 88, 52, 89,-32768, 44, 88,
361: -32768,-32768, 8, 99,-32768,-32768,-32768,-32768, 18,-32768,
362: -32768, 4,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1.103.8.2 paf 363: 32,-32768, 100, 102,-32768, 97, 101,-32768, 147,-32768,
1.103.8.1 paf 364: -32768,-32768,-32768, 8,-32768, 88, 13, 121,-32768, 99,
365: 99, 99, 99, 99, 99, 99, 99, 42, 99, 8,
1.103.8.2 paf 366: 8,-32768,-32768, 117, 315,-32768, 54,-32768,-32768,-32768,
367: -32768, 148,-32768, 108,-32768, 150, 152, 8, 31,-32768,
368: -32768,-32768,-32768,-32768,-32768, 443, 443, 443, 443,-32768,
369: -32768,-32768,-32768, 270,-32768, 143, 144,-32768, 99, 99,
1.103.8.1 paf 370: 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
371: 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
372: 99, 99, 99, 99, 99,-32768, 8, 99, 30,-32768,
1.103.8.2 paf 373: -32768,-32768,-32768,-32768,-32768,-32768, 8, 154,-32768,-32768,
374: -32768, 374, 145, 346, 278, 402, 402, 415, 415, 179,
375: 179, 402, 402, 402, 402, 415, 415, 443, 402, 402,
1.103.8.1 paf 376: 76, 155, 93, 93,-32768,-32768,-32768,-32768, 15,-32768,
1.103.8.2 paf 377: -21,-32768, -28,-32768,-32768,-32768,-32768, 8,-32768, 70,
378: -32768, 164,-32768,-32768,-32768, 8,-32768, 99,-32768,-32768,
379: 15, 156,-32768,-32768,-32768,-32768, 221, 223,-32768
1.1 parser 380: };
381:
382: static const short yypgoto[] = {-32768,
1.103.8.1 paf 383: -32768,-32768, 219,-32768,-32768,-32768, 134,-32768,-32768,-32768,
1.103.8.2 paf 384: -32768, 172,-32768,-32768,-32768, 1, -55, -7, -104,-32768,
1.103.8.1 paf 385: 0,-32768,-32768, -5,-32768,-32768, -36,-32768,-32768,-32768,
1.103.8.2 paf 386: -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 123,
387: -32768,-32768,-32768, 2,-32768,-32768,-32768,-32768, 38,-32768,
388: -32768,-32768,-32768,-32768,-32768,-32768,-32768, -23, -16, -12,
389: -32768, -11, 84, -22,-32768, -30, 3,-32768,-32768,-32768,
390: -32768,-32768, 177,-32768, 178, 232,-32768,-32768, 163, 95,
391: -32768, 122,-32768, 135, -1
1.1 parser 392: };
393:
394:
1.103.8.2 paf 395: #define YYLAST 484
1.1 parser 396:
397:
1.97 paf 398: static const short yytable[] = { 15,
1.103.8.2 paf 399: 10, 18, 139, 51, 104, 42, -102, 81, 1, 84,
400: 15, 1, 18, 55, 68, 80, 137, 72, 240, 63,
401: 248, 73, 55, 22, 74, 21, 249, 246, 70, 84,
402: 247, 2, 236, 81, 85, 89, 52, 53, 22, 61,
1.103.8.1 paf 403: 82, 80, 71, 87, 83, 22, 80, 67, 42, 2,
1.103.8.2 paf 404: 94, 98, 101, 86, 3, 79, -101, 3, 56, 15,
1.103.8.1 paf 405: 4, 18, 3, 4, 3, 57, 23, 56, 4, 24,
1.103.8.2 paf 406: 4, 106, 15, 108, 18, 89, 186, -167, -67, -67,
1.103.8.1 paf 407: 187, 23, 197, 188, 24, 25, 38, 26, 23, 129,
408: 23, 24, 25, 24, 167, 168, 51, 135, 23, 138,
409: 186, 24, 109, 15, 187, 18, 15, 188, 18, 69,
410: 179, 180, 181, 182, 183, 184, 185, -94, -94, 15,
411: 15, 18, 18, 95, 139, 110, 111, 112, 113, 38,
412: 182, 183, 184, 185, 114, 115, 53, 15, 56, 18,
1.103.8.2 paf 413: -101, 116, 117, 105, 131, 130, 139, -14, 118, 132,
414: 133, 194, 119, 195, 4, 159, 120, 121, 162, 163,
1.103.8.1 paf 415: 164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
416: 174, 158, 145, 167, 168, 175, 176, 177, 178, 179,
417: 180, 181, 182, 183, 184, 185, 15, 230, 18, 51,
1.103.8.2 paf 418: 180, 181, 182, 183, 184, 185, 15, 196, 18, -63,
419: 200, 239, 201, 256, 146, 147, 148, 149, 150, 151,
420: 152, 153, 251, 154, 180, 181, 182, 183, 184, 185,
421: 258, 138, 259, 50, 128, 100, 237, 255, 15, 141,
422: 18, 254, 102, 253, 46, 103, 124, 15, 250, 18,
423: 0, 144, 157, 138, 0, 15, 230, 18, 0, 0,
424: 15, 0, 18, 202, 203, 204, 205, 206, 207, 208,
425: 209, 210, 211, 212, 213, 214, 215, 216, 217, 218,
426: 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
427: 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
428: 169, 170, 171, 172, 173, 174, 167, 168, 0, 0,
429: 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
430: 185, 178, 179, 180, 181, 182, 183, 184, 185, 0,
431: 0, 0, 0, 0, 199, 159, 160, 161, 162, 163,
1.103.8.1 paf 432: 164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
433: 174, 0, 0, 0, 0, 175, 176, 177, 178, 179,
1.103.8.2 paf 434: 180, 181, 182, 183, 184, 185, 159, 160, 0, 162,
435: 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
436: 173, 174, 0, 0, 0, 0, 175, 176, 177, 178,
437: 179, 180, 181, 182, 183, 184, 185, 162, 163, 164,
438: 165, 166, 167, 168, 169, 170, 171, 172, 173, 174,
439: 0, 0, 0, 0, 175, 176, 177, 178, 179, 180,
440: 181, 182, 183, 184, 185, 162, 0, 0, 165, 166,
441: 167, 168, 0, 0, 0, 0, 173, 174, 162, 0,
442: 0, 0, 175, 167, 168, 178, 179, 180, 181, 182,
443: 183, 184, 185, 0, 0, 175, 0, 0, 178, 179,
444: 180, 181, 182, 183, 184, 185, 162, 0, 0, 0,
445: 0, 167, 168, 0, 0, 0, 0, 0, 0, 0,
446: 0, 0, 0, 0, 0, 0, 178, 179, 180, 181,
447: 182, 183, 184, 185
1.1 parser 448: };
449:
450: static const short yycheck[] = { 0,
1.103.8.1 paf 451: 0, 0, 107, 11, 60, 3, 3, 38, 4, 46,
452: 11, 4, 11, 5, 26, 38, 4, 47, 4, 25,
453: 49, 51, 5, 4, 54, 4, 55, 49, 26, 66,
454: 52, 45, 3, 64, 46, 4, 46, 47, 4, 4,
455: 38, 64, 3, 49, 53, 4, 69, 4, 46, 45,
456: 52, 53, 54, 57, 50, 4, 53, 50, 50, 60,
457: 56, 60, 50, 56, 50, 57, 47, 50, 56, 50,
458: 56, 69, 73, 73, 73, 4, 47, 46, 48, 49,
459: 51, 47, 138, 54, 50, 51, 3, 53, 47, 91,
460: 47, 50, 51, 50, 19, 20, 104, 99, 47, 107,
461: 47, 50, 4, 104, 51, 104, 107, 54, 107, 26,
462: 35, 36, 37, 38, 39, 40, 41, 48, 49, 120,
463: 121, 120, 121, 4, 229, 27, 28, 29, 30, 46,
464: 38, 39, 40, 41, 36, 37, 47, 138, 50, 138,
1.103.8.2 paf 465: 53, 43, 44, 52, 48, 46, 251, 46, 50, 49,
466: 4, 4, 54, 46, 56, 11, 58, 59, 14, 15,
1.103.8.1 paf 467: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
468: 26, 55, 52, 19, 20, 31, 32, 33, 34, 35,
469: 36, 37, 38, 39, 40, 41, 187, 187, 187, 197,
1.103.8.2 paf 470: 36, 37, 38, 39, 40, 41, 197, 48, 197, 48,
471: 58, 48, 59, 48, 110, 111, 112, 113, 114, 115,
472: 116, 117, 49, 119, 36, 37, 38, 39, 40, 41,
473: 0, 229, 0, 5, 91, 54, 189, 251, 229, 107,
474: 229, 248, 56, 246, 3, 58, 74, 238, 238, 238,
475: -1, 107, 121, 251, -1, 246, 246, 246, -1, -1,
476: 251, -1, 251, 159, 160, 161, 162, 163, 164, 165,
477: 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
478: 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
479: 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
480: 21, 22, 23, 24, 25, 26, 19, 20, -1, -1,
481: 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
482: 41, 34, 35, 36, 37, 38, 39, 40, 41, -1,
483: -1, -1, -1, -1, 55, 11, 12, 13, 14, 15,
1.100 paf 484: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
485: 26, -1, -1, -1, -1, 31, 32, 33, 34, 35,
1.103.8.2 paf 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, 14, 15, 16,
490: 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
491: -1, -1, -1, -1, 31, 32, 33, 34, 35, 36,
492: 37, 38, 39, 40, 41, 14, -1, -1, 17, 18,
493: 19, 20, -1, -1, -1, -1, 25, 26, 14, -1,
494: -1, -1, 31, 19, 20, 34, 35, 36, 37, 38,
495: 39, 40, 41, -1, -1, 31, -1, -1, 34, 35,
496: 36, 37, 38, 39, 40, 41, 14, -1, -1, -1,
497: -1, 19, 20, -1, -1, -1, -1, -1, -1, -1,
498: -1, -1, -1, -1, -1, -1, 34, 35, 36, 37,
499: 38, 39, 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.103.8.2 paf 1421: YYSTYPE expr_code=yyvsp[0];
1.103.8.4! paf 1422: if(expr_code->count()==3
! 1423: && (*expr_code)[0].code==OP_VALUE) { // optimizing (double) case. [OP_VALUE+origin+Double]
1.103.8.2 paf 1424: yyval=expr_code;
1425: O(*yyval, OP_STORE_PARAM); // no evaluating
1426: } else {
1427: ArrayOperation* code=N();
1428: O(*code, OP_PREPARE_TO_EXPRESSION);
1429: P(*code, *expr_code);
1430: O(*code, OP_WRITE_EXPR_RESULT);
1431: yyval=N();
1432: OA(*yyval, OP_EXPR_CODE__STORE_PARAM, code);
1433: }
1.1 parser 1434: ;
1435: break;}
1.99 paf 1436: case 92:
1.103.8.4! paf 1437: #line 459 "compile.y"
1.1 parser 1438: {
1.84 paf 1439: yyval=N();
1440: OA(*yyval, OP_CURLY_CODE__STORE_PARAM, yyvsp[0]);
1.1 parser 1441: ;
1442: break;}
1.103.8.2 paf 1443: case 97:
1.103.8.4! paf 1444: #line 471 "compile.y"
1.97 paf 1445: { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;
1446: break;}
1.103.8.2 paf 1447: case 99:
1.103.8.4! paf 1448: #line 473 "compile.y"
1.84 paf 1449: { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;
1.1 parser 1450: break;}
1.103.8.2 paf 1451: case 101:
1.103.8.4! paf 1452: #line 475 "compile.y"
1.1 parser 1453: {
1.33 paf 1454: // we know that name_advance1 not called from ^xxx context
1455: // so we'll not check for operator call possibility as we do in name_advance2
1456:
1.1 parser 1457: /* stack: context */
1458: yyval=yyvsp[0]; /* stack: context,name */
1.84 paf 1459: O(*yyval, OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.1 parser 1460: ;
1461: break;}
1.103.8.2 paf 1462: case 102:
1.103.8.4! paf 1463: #line 483 "compile.y"
1.1 parser 1464: {
1465: /* stack: context */
1466: yyval=yyvsp[0]; /* stack: context,name */
1.84 paf 1467: O(*yyval, OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.1 parser 1468: ;
1469: break;}
1.103.8.2 paf 1470: case 108:
1.103.8.4! paf 1471: #line 496 "compile.y"
1.1 parser 1472: {
1473: yyval=yyvsp[0];
1.84 paf 1474: O(*yyval, OP_GET_ELEMENT);
1.1 parser 1475: ;
1476: break;}
1.103.8.2 paf 1477: case 109:
1.103.8.4! paf 1478: #line 500 "compile.y"
1.1 parser 1479: {
1.84 paf 1480: ArrayOperation* code;
1.47 paf 1481: {
1.84 paf 1482: change_string_literal_to_write_string_literal(*(code=yyvsp[-1]));
1483: P(*code, *yyvsp[0]);
1.47 paf 1484: }
1.84 paf 1485: yyval=N();
1486: OA(*yyval, OP_STRING_POOL, code);
1.1 parser 1487: ;
1488: break;}
1.103.8.2 paf 1489: case 110:
1.103.8.4! paf 1490: #line 509 "compile.y"
1.3 parser 1491: {
1.100 paf 1492: // allow $result_or_other_variable[ letters here any time ]
1493: *reinterpret_cast<bool*>(&yyval)=PC.explicit_result; PC.explicit_result=false;
1494: ;
1495: break;}
1.103.8.2 paf 1496: case 111:
1.103.8.4! paf 1497: #line 512 "compile.y"
1.100 paf 1498: {
1.101 paf 1499: PC.explicit_result=*reinterpret_cast<bool*>(&yyvsp[-1]);
1.100 paf 1500: ;
1501: break;}
1.103.8.2 paf 1502: case 112:
1.103.8.4! paf 1503: #line 514 "compile.y"
1.100 paf 1504: {
1.84 paf 1505: yyval=N();
1.100 paf 1506: OA(*yyval, OP_OBJECT_POOL, yyvsp[-2]); /* stack: empty write context */
1.47 paf 1507: /* some code that writes to that context */
1508: /* context=pop; stack: context.value() */
1.3 parser 1509: ;
1510: break;}
1.103.8.2 paf 1511: case 113:
1.103.8.4! paf 1512: #line 520 "compile.y"
1.1 parser 1513: {
1.84 paf 1514: yyval=N();
1515: O(*yyval, OP_WITH_READ);
1516: P(*yyval, *yyvsp[0]);
1.1 parser 1517: ;
1518: break;}
1.103.8.2 paf 1519: case 115:
1.103.8.4! paf 1520: #line 525 "compile.y"
1.84 paf 1521: { yyval=yyvsp[-1]; P(*yyval, *yyvsp[0]) ;
1.1 parser 1522: break;}
1.103.8.2 paf 1523: case 116:
1.103.8.4! paf 1524: #line 526 "compile.y"
1.1 parser 1525: {
1526: yyval=yyvsp[0];
1.84 paf 1527: O(*yyval, OP_GET_ELEMENT__WRITE);
1.1 parser 1528: ;
1529: break;}
1.103.8.2 paf 1530: case 119:
1.103.8.4! paf 1531: #line 535 "compile.y"
1.1 parser 1532: {
1533: yyval=yyvsp[-1]; // stack: class name string
1.84 paf 1534: if(*LA2S(*yyval) == BASE_NAME) { // pseudo BASE class
1535: if(VStateless_class* base=PC.cclass->base_class()) {
1536: change_string_literal_value(*yyval, base->name());
1.61 paf 1537: } else {
1538: strcpy(PC.error, "no base class declared");
1539: YYERROR;
1540: }
1541: }
1.84 paf 1542: O(*yyval, OP_GET_CLASS);
1.1 parser 1543: ;
1544: break;}
1.103.8.2 paf 1545: case 120:
1.103.8.4! paf 1546: #line 547 "compile.y"
1.1 parser 1547: {
1548: yyval=yyvsp[-1];
1.39 paf 1549: if(!PC.in_call_value) {
1.1 parser 1550: strcpy(PC.error, ":: not allowed here");
1551: YYERROR;
1552: }
1.84 paf 1553: O(*yyval, OP_PREPARE_TO_CONSTRUCT_OBJECT);
1.1 parser 1554: ;
1555: break;}
1.103.8.2 paf 1556: case 125:
1.103.8.4! paf 1557: #line 564 "compile.y"
1.103.8.2 paf 1558: { yyval = yyvsp[-1]; ;
1559: break;}
1.100 paf 1560: case 126:
1.103.8.4! paf 1561: #line 565 "compile.y"
1.1 parser 1562: { yyval = yyvsp[-1]; ;
1563: break;}
1.100 paf 1564: case 127:
1.103.8.4! paf 1565: #line 566 "compile.y"
1.1 parser 1566: { yyval = yyvsp[-1]; ;
1567: break;}
1.100 paf 1568: case 128:
1.103.8.4! paf 1569: #line 568 "compile.y"
1.84 paf 1570: { yyval=yyvsp[0]; O(*yyval, OP_NEG) ;
1.1 parser 1571: break;}
1.103.8.2 paf 1572: case 129:
1.103.8.4! paf 1573: #line 569 "compile.y"
1.11 parser 1574: { yyval=yyvsp[0] ;
1.1 parser 1575: break;}
1.103.8.2 paf 1576: case 130:
1.103.8.4! paf 1577: #line 570 "compile.y"
1.84 paf 1578: { yyval=yyvsp[0]; O(*yyval, OP_INV) ;
1.1 parser 1579: break;}
1.103.8.2 paf 1580: case 131:
1.103.8.4! paf 1581: #line 571 "compile.y"
1.84 paf 1582: { yyval=yyvsp[0]; O(*yyval, OP_NOT) ;
1.1 parser 1583: break;}
1.103.8.2 paf 1584: case 132:
1.103.8.4! paf 1585: #line 572 "compile.y"
1.84 paf 1586: { yyval=yyvsp[0]; O(*yyval, OP_DEF) ;
1.1 parser 1587: break;}
1.103.8.2 paf 1588: case 133:
1.103.8.4! paf 1589: #line 573 "compile.y"
1.84 paf 1590: { yyval=yyvsp[0]; O(*yyval, OP_IN) ;
1.1 parser 1591: break;}
1.103.8.2 paf 1592: case 134:
1.103.8.4! paf 1593: #line 574 "compile.y"
1.84 paf 1594: { yyval=yyvsp[0]; O(*yyval, OP_FEXISTS) ;
1.1 parser 1595: break;}
1.103.8.2 paf 1596: case 135:
1.103.8.4! paf 1597: #line 575 "compile.y"
1.84 paf 1598: { yyval=yyvsp[0]; O(*yyval, OP_DEXISTS) ;
1.1 parser 1599: break;}
1.103.8.2 paf 1600: case 136:
1.103.8.4! paf 1601: #line 577 "compile.y"
1.84 paf 1602: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_SUB) ;
1.1 parser 1603: break;}
1.103.8.2 paf 1604: case 137:
1.103.8.4! paf 1605: #line 578 "compile.y"
1.84 paf 1606: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_ADD) ;
1.1 parser 1607: break;}
1.103.8.2 paf 1608: case 138:
1.103.8.4! paf 1609: #line 579 "compile.y"
1.84 paf 1610: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_MUL) ;
1.1 parser 1611: break;}
1.103.8.2 paf 1612: case 139:
1.103.8.4! paf 1613: #line 580 "compile.y"
1.84 paf 1614: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_DIV) ;
1.1 parser 1615: break;}
1.103.8.2 paf 1616: case 140:
1.103.8.4! paf 1617: #line 581 "compile.y"
1.84 paf 1618: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_MOD) ;
1.1 parser 1619: break;}
1.103.8.2 paf 1620: case 141:
1.103.8.4! paf 1621: #line 582 "compile.y"
1.84 paf 1622: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_INTDIV) ;
1.1 parser 1623: break;}
1.103.8.2 paf 1624: case 142:
1.103.8.4! paf 1625: #line 583 "compile.y"
1.84 paf 1626: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_SL) ;
1.67 paf 1627: break;}
1.103.8.2 paf 1628: case 143:
1.103.8.4! paf 1629: #line 584 "compile.y"
1.84 paf 1630: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_SR) ;
1.67 paf 1631: break;}
1.103.8.2 paf 1632: case 144:
1.103.8.4! paf 1633: #line 585 "compile.y"
1.84 paf 1634: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_AND) ;
1.1 parser 1635: break;}
1.103.8.2 paf 1636: case 145:
1.103.8.4! paf 1637: #line 586 "compile.y"
1.84 paf 1638: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_OR) ;
1.1 parser 1639: break;}
1.103.8.2 paf 1640: case 146:
1.103.8.4! paf 1641: #line 587 "compile.y"
1.84 paf 1642: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_BIN_XOR) ;
1.1 parser 1643: break;}
1.103.8.2 paf 1644: case 147:
1.103.8.4! paf 1645: #line 588 "compile.y"
1.84 paf 1646: { yyval=yyvsp[-2]; OA(*yyval, OP_NESTED_CODE, yyvsp[0]); O(*yyval, OP_LOG_AND) ;
1.1 parser 1647: break;}
1.103.8.2 paf 1648: case 148:
1.103.8.4! paf 1649: #line 589 "compile.y"
1.84 paf 1650: { yyval=yyvsp[-2]; OA(*yyval, OP_NESTED_CODE, yyvsp[0]); O(*yyval, OP_LOG_OR) ;
1.1 parser 1651: break;}
1.103.8.2 paf 1652: case 149:
1.103.8.4! paf 1653: #line 590 "compile.y"
1.84 paf 1654: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_LOG_XOR) ;
1.1 parser 1655: break;}
1.103.8.2 paf 1656: case 150:
1.103.8.4! paf 1657: #line 591 "compile.y"
1.84 paf 1658: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_LT) ;
1.1 parser 1659: break;}
1.103.8.2 paf 1660: case 151:
1.103.8.4! paf 1661: #line 592 "compile.y"
1.84 paf 1662: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_GT) ;
1.1 parser 1663: break;}
1.103.8.2 paf 1664: case 152:
1.103.8.4! paf 1665: #line 593 "compile.y"
1.84 paf 1666: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_LE) ;
1.1 parser 1667: break;}
1.103.8.2 paf 1668: case 153:
1.103.8.4! paf 1669: #line 594 "compile.y"
1.84 paf 1670: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_GE) ;
1.1 parser 1671: break;}
1.103.8.2 paf 1672: case 154:
1.103.8.4! paf 1673: #line 595 "compile.y"
1.84 paf 1674: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_EQ) ;
1.1 parser 1675: break;}
1.103.8.2 paf 1676: case 155:
1.103.8.4! paf 1677: #line 596 "compile.y"
1.84 paf 1678: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_NUM_NE) ;
1.1 parser 1679: break;}
1.103.8.2 paf 1680: case 156:
1.103.8.4! paf 1681: #line 597 "compile.y"
1.84 paf 1682: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_LT) ;
1.1 parser 1683: break;}
1.103.8.2 paf 1684: case 157:
1.103.8.4! paf 1685: #line 598 "compile.y"
1.84 paf 1686: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_GT) ;
1.1 parser 1687: break;}
1.103.8.2 paf 1688: case 158:
1.103.8.4! paf 1689: #line 599 "compile.y"
1.84 paf 1690: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_LE) ;
1.1 parser 1691: break;}
1.103.8.2 paf 1692: case 159:
1.103.8.4! paf 1693: #line 600 "compile.y"
1.84 paf 1694: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_GE) ;
1.1 parser 1695: break;}
1.103.8.2 paf 1696: case 160:
1.103.8.4! paf 1697: #line 601 "compile.y"
1.84 paf 1698: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_EQ) ;
1.11 parser 1699: break;}
1.103.8.2 paf 1700: case 161:
1.103.8.4! paf 1701: #line 602 "compile.y"
1.84 paf 1702: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_STR_NE) ;
1.25 paf 1703: break;}
1.103.8.2 paf 1704: case 162:
1.103.8.4! paf 1705: #line 603 "compile.y"
1.84 paf 1706: { yyval=yyvsp[-2]; P(*yyval, *yyvsp[0]); O(*yyval, OP_IS) ;
1.1 parser 1707: break;}
1.103.8.2 paf 1708: case 163:
1.103.8.4! paf 1709: #line 606 "compile.y"
1.103.8.1 paf 1710: {
1711: // optimized from OP_STRING->OP_VALUE for doubles
1712: maybe_change_string_literal_to_double_literal(*(yyval=yyvsp[0]));
1713: ;
1714: break;}
1.103.8.2 paf 1715: case 164:
1.103.8.4! paf 1716: #line 611 "compile.y"
1.1 parser 1717: {
1.84 paf 1718: yyval=N();
1719: OA(*yyval, OP_STRING_POOL, yyvsp[0]); /* stack: empty write context */
1.47 paf 1720: /* some code that writes to that context */
1721: /* context=pop; stack: context.get_string() */
1.1 parser 1722: ;
1723: break;}
1.103.8.2 paf 1724: case 165:
1.103.8.4! paf 1725: #line 620 "compile.y"
1.1 parser 1726: {
1.97 paf 1727: // optimized from OP_STRING+OP_WRITE_VALUE to OP_STRING__WRITE
1728: change_string_literal_to_write_string_literal(*(yyval=yyvsp[0]))
1.1 parser 1729: ;
1730: break;}
1.103.8.2 paf 1731: case 166:
1.103.8.4! paf 1732: #line 625 "compile.y"
1.103.8.1 paf 1733: { yyval=VL(new VVoid(), 0, 0, 0) ;
1734: break;}
1.103.8.2 paf 1735: case 167:
1.103.8.4! paf 1736: #line 626 "compile.y"
1.84 paf 1737: { yyval=N() ;
1.1 parser 1738: break;}
1739: }
1740: /* the action file gets copied in in place of this dollarsign */
1.15 parser 1741: #line 543 "/usr/share/bison.simple"
1.1 parser 1742:
1743: yyvsp -= yylen;
1744: yyssp -= yylen;
1745: #ifdef YYLSP_NEEDED
1746: yylsp -= yylen;
1747: #endif
1748:
1749: #if YYDEBUG != 0
1750: if (yydebug)
1751: {
1752: short *ssp1 = yyss - 1;
1753: fprintf (stderr, "state stack now");
1754: while (ssp1 != yyssp)
1755: fprintf (stderr, " %d", *++ssp1);
1756: fprintf (stderr, "\n");
1757: }
1758: #endif
1759:
1760: *++yyvsp = yyval;
1761:
1762: #ifdef YYLSP_NEEDED
1763: yylsp++;
1764: if (yylen == 0)
1765: {
1766: yylsp->first_line = yylloc.first_line;
1767: yylsp->first_column = yylloc.first_column;
1768: yylsp->last_line = (yylsp-1)->last_line;
1769: yylsp->last_column = (yylsp-1)->last_column;
1770: yylsp->text = 0;
1771: }
1772: else
1773: {
1774: yylsp->last_line = (yylsp+yylen-1)->last_line;
1775: yylsp->last_column = (yylsp+yylen-1)->last_column;
1776: }
1777: #endif
1778:
1779: /* Now "shift" the result of the reduction.
1780: Determine what state that goes to,
1781: based on the state we popped back to
1782: and the rule number reduced by. */
1783:
1784: yyn = yyr1[yyn];
1785:
1786: yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1787: if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1788: yystate = yytable[yystate];
1789: else
1790: yystate = yydefgoto[yyn - YYNTBASE];
1791:
1792: goto yynewstate;
1793:
1794: yyerrlab: /* here on detecting error */
1795:
1796: if (! yyerrstatus)
1797: /* If not already recovering from an error, report this error. */
1798: {
1799: ++yynerrs;
1800:
1801: #ifdef YYERROR_VERBOSE
1802: yyn = yypact[yystate];
1803:
1804: if (yyn > YYFLAG && yyn < YYLAST)
1805: {
1806: int size = 0;
1807: char *msg;
1808: int x, count;
1809:
1810: count = 0;
1811: /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1812: for (x = (yyn < 0 ? -yyn : 0);
1813: x < (sizeof(yytname) / sizeof(char *)); x++)
1814: if (yycheck[x + yyn] == x)
1815: size += strlen(yytname[x]) + 15, count++;
1816: msg = (char *) malloc(size + 15);
1817: if (msg != 0)
1818: {
1819: strcpy(msg, "parse error");
1820:
1821: if (count < 5)
1822: {
1823: count = 0;
1824: for (x = (yyn < 0 ? -yyn : 0);
1825: x < (sizeof(yytname) / sizeof(char *)); x++)
1826: if (yycheck[x + yyn] == x)
1827: {
1828: strcat(msg, count == 0 ? ", expecting `" : " or `");
1829: strcat(msg, yytname[x]);
1830: strcat(msg, "'");
1831: count++;
1832: }
1833: }
1834: yyerror(msg);
1835: free(msg);
1836: }
1837: else
1838: yyerror ("parse error; also virtual memory exceeded");
1839: }
1840: else
1841: #endif /* YYERROR_VERBOSE */
1842: yyerror("parse error");
1843: }
1844:
1845: goto yyerrlab1;
1846: yyerrlab1: /* here on error raised explicitly by an action */
1847:
1848: if (yyerrstatus == 3)
1849: {
1850: /* if just tried and failed to reuse lookahead token after an error, discard it. */
1851:
1852: /* return failure if at end of input */
1853: if (yychar == YYEOF)
1854: YYABORT;
1855:
1856: #if YYDEBUG != 0
1857: if (yydebug)
1858: fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1859: #endif
1860:
1861: yychar = YYEMPTY;
1862: }
1863:
1864: /* Else will try to reuse lookahead token
1865: after shifting the error token. */
1866:
1867: yyerrstatus = 3; /* Each real token shifted decrements this */
1868:
1869: goto yyerrhandle;
1870:
1871: yyerrdefault: /* current state does not do anything special for the error token. */
1872:
1873: #if 0
1874: /* This is wrong; only states that explicitly want error tokens
1875: should shift them. */
1876: yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1877: if (yyn) goto yydefault;
1878: #endif
1879:
1880: yyerrpop: /* pop the current state because it cannot handle the error token */
1881:
1882: if (yyssp == yyss) YYABORT;
1883: yyvsp--;
1884: yystate = *--yyssp;
1885: #ifdef YYLSP_NEEDED
1886: yylsp--;
1887: #endif
1888:
1889: #if YYDEBUG != 0
1890: if (yydebug)
1891: {
1892: short *ssp1 = yyss - 1;
1893: fprintf (stderr, "Error: state stack now");
1894: while (ssp1 != yyssp)
1895: fprintf (stderr, " %d", *++ssp1);
1896: fprintf (stderr, "\n");
1897: }
1898: #endif
1899:
1900: yyerrhandle:
1901:
1902: yyn = yypact[yystate];
1903: if (yyn == YYFLAG)
1904: goto yyerrdefault;
1905:
1906: yyn += YYTERROR;
1907: if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1908: goto yyerrdefault;
1909:
1910: yyn = yytable[yyn];
1911: if (yyn < 0)
1912: {
1913: if (yyn == YYFLAG)
1914: goto yyerrpop;
1915: yyn = -yyn;
1916: goto yyreduce;
1917: }
1918: else if (yyn == 0)
1919: goto yyerrpop;
1920:
1921: if (yyn == YYFINAL)
1922: YYACCEPT;
1923:
1924: #if YYDEBUG != 0
1925: if (yydebug)
1926: fprintf(stderr, "Shifting error token, ");
1927: #endif
1928:
1929: *++yyvsp = yylval;
1930: #ifdef YYLSP_NEEDED
1931: *++yylsp = yylloc;
1932: #endif
1933:
1934: yystate = yyn;
1935: goto yynewstate;
1936:
1937: yyacceptlab:
1938: /* YYACCEPT comes here. */
1939: if (yyfree_stacks)
1940: {
1941: free (yyss);
1942: free (yyvs);
1943: #ifdef YYLSP_NEEDED
1944: free (yyls);
1945: #endif
1946: }
1947: return 0;
1948:
1949: yyabortlab:
1950: /* YYABORT comes here. */
1951: if (yyfree_stacks)
1952: {
1953: free (yyss);
1954: free (yyvs);
1955: #ifdef YYLSP_NEEDED
1956: free (yyls);
1957: #endif
1958: }
1959: return 1;
1960: }
1.103.8.4! paf 1961: #line 628 "compile.y"
1.1 parser 1962:
1963: #endif
1964:
1965: /*
1966: 000$111(2222)00
1967: 000$111{3333}00
1968: $,^: push,=0
1969: 1:( { break=pop
1970: 2:( ) pop
1971: 3:{ } pop
1972:
1973: 000^111(2222)4444{33333}4000
1974: $,^: push,=0
1975: 1:( { break=pop
1976: 2:( )=4
1977: 3:{ }=4
1978: 4:[^({]=pop
1979: */
1980:
1.84 paf 1981: inline void ungetc(Parse_control& pc, uint last_line_end_col) {
1982: pc.source--;
1983: if(pc.pos.col==0) {
1984: --pc.pos.line; pc.pos.col=last_line_end_col;
1985: } else
1986: --pc.pos.col;
1987:
1988: }
1989: static int yylex(YYSTYPE *lvalp, void *apc) {
1990: register Parse_control& pc=*static_cast<Parse_control*>(apc);
1991:
1992: #define lexical_brackets_nestage pc.brackets_nestages[pc.ls_sp]
1.1 parser 1993: #define RC {result=c; goto break2; }
1994:
1.84 paf 1995: register int c;
1996: int result;
1.1 parser 1997:
1.84 paf 1998: if(pc.pending_state) {
1999: result=pc.pending_state;
2000: pc.pending_state=0;
1.1 parser 2001: return result;
2002: }
2003:
1.84 paf 2004: const char *begin=pc.source;
2005: Pos begin_pos=pc.pos;
1.1 parser 2006: const char *end;
2007: int skip_analized=0;
2008: while(true) {
1.84 paf 2009: c=*(end=(pc.source++));
2010: // fprintf(stderr, "\nchar: %c %02X; nestage: %d, sp=%d", c, c, lexical_brackets_nestage, pc.sp);
1.1 parser 2011:
1.96 paf 2012: if(c=='\n')
1.84 paf 2013: pc.pos_next_line();
1.96 paf 2014: else
1.84 paf 2015: pc.pos_next_c(c);
1.96 paf 2016: // fprintf(stderr, "\nchar: %c file(%d:%d)", c, pc.pos.line, pc.pos.col);
1.1 parser 2017:
1.96 paf 2018: if(pc.pos.col==0+1 && c=='@') {
1.84 paf 2019: if(pc.ls==LS_DEF_SPECIAL_BODY) {
1.31 paf 2020: // @SPECIAL
2021: // ...
2022: // @<here =
1.84 paf 2023: pop_LS(pc); // exiting from LS_DEF_SPECIAL_BODY state
1.31 paf 2024: } // continuing checks
1.84 paf 2025: if(pc.ls==LS_USER) {
2026: push_LS(pc, LS_DEF_NAME);
1.20 parser 2027: RC;
1.31 paf 2028: } else // @ in first column inside some code [when could that be?]
1.20 parser 2029: result=BAD_METHOD_DECL_START;
2030: goto break2;
1.97 paf 2031: }
2032: if(c=='^') {
1.84 paf 2033: if(pc.ls==LS_METHOD_AFTER) {
1.75 paf 2034: // handle after-method situation
1.84 paf 2035: pop_LS(pc);
1.75 paf 2036: result=EON;
2037: skip_analized=-1; // return to punctuation afterwards to assure it's literality
2038: goto break2;
2039: }
1.84 paf 2040: switch(pc.ls) {
1.15 parser 2041: case LS_EXPRESSION_VAR_NAME_WITH_COLON:
2042: case LS_EXPRESSION_VAR_NAME_WITHOUT_COLON:
2043: case LS_VAR_NAME_SIMPLE_WITH_COLON:
2044: case LS_VAR_NAME_SIMPLE_WITHOUT_COLON:
2045: case LS_VAR_NAME_CURLY:
2046: case LS_METHOD_NAME:
1.66 paf 2047: case LS_USER_COMMENT:
1.15 parser 2048: case LS_DEF_COMMENT:
2049: // no literals in names, please
2050: break;
2051: default:
1.84 paf 2052: switch(*pc.source) {
1.10 parser 2053: // ^escaping some punctuators
1.1 parser 2054: case '^': case '$': case ';':
2055: case '(': case ')':
2056: case '[': case ']':
2057: case '{': case '}':
1.23 parser 2058: case '"': case ':':
1.1 parser 2059: if(end!=begin) {
1.84 paf 2060: if(!pc.string_start)
2061: pc.string_start=begin_pos;
1.1 parser 2062: // append piece till ^
1.84 paf 2063: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 2064: }
2065: // reset piece 'begin' position & line
1.84 paf 2066: begin=pc.source; // ->punctuation
2067: begin_pos=pc.pos;
1.75 paf 2068: // skip over _ after ^
1.84 paf 2069: pc.source++; pc.pos.col++;
1.75 paf 2070: // skip analysis = forced literal
2071: continue;
1.1 parser 2072:
2073: // converting ^#HH into char(hex(HH))
2074: case '#':
2075: if(end!=begin) {
1.84 paf 2076: if(!pc.string_start)
2077: pc.string_start=begin_pos;
1.1 parser 2078: // append piece till ^
1.84 paf 2079: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 2080: }
2081: // #HH ?
1.84 paf 2082: if(pc.source[0]=='#' && pc.source[1] && pc.source[2]) {
2083: char c=
2084: hex_value[(unsigned char)pc.source[1]]*0x10+
2085: hex_value[(unsigned char)pc.source[2]];
2086: if(c==0) {
1.1 parser 2087: result=BAD_HEX_LITERAL;
2088: goto break2; // wrong hex value[no ^#00 chars allowed]: bail out
2089: }
2090: // append char(hex(HH))
1.84 paf 2091: pc.string.append(c);
1.1 parser 2092: // skip over ^#HH
1.84 paf 2093: pc.source+=3;
2094: pc.pos.col+=3;
1.1 parser 2095: // reset piece 'begin' position & line
1.84 paf 2096: begin=pc.source; // ->after ^#HH
2097: begin_pos=pc.pos;
1.75 paf 2098: // skip analysis = forced literal
1.1 parser 2099: continue;
2100: }
2101: break;
2102: }
1.15 parser 2103: break;
1.75 paf 2104: }
1.15 parser 2105: }
1.1 parser 2106: // #comment start skipping
1.84 paf 2107: if(c=='#' && pc.pos.col==1) {
1.1 parser 2108: if(end!=begin) {
1.84 paf 2109: if(!pc.string_start)
2110: pc.string_start=begin_pos;
1.1 parser 2111: // append piece till #
1.84 paf 2112: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 2113: }
2114: // fall into COMMENT lexical state [wait for \n]
1.84 paf 2115: push_LS(pc, LS_USER_COMMENT);
1.31 paf 2116: continue;
1.1 parser 2117: }
1.84 paf 2118: switch(pc.ls) {
1.1 parser 2119:
2120: // USER'S = NOT OURS
2121: case LS_USER:
1.84 paf 2122: case LS_NAME_SQUARE_PART: // name.[here].xxx
2123: if(pc.trim_bof)
1.1 parser 2124: switch(c) {
2125: case '\n': case ' ': case '\t':
1.84 paf 2126: begin=pc.source;
2127: begin_pos=pc.pos;
1.1 parser 2128: continue; // skip it
2129: default:
1.84 paf 2130: pc.trim_bof=false;
1.1 parser 2131: }
2132: switch(c) {
2133: case '$':
1.84 paf 2134: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 2135: RC;
2136: case '^':
1.84 paf 2137: push_LS(pc, LS_METHOD_NAME);
1.1 parser 2138: RC;
1.11 parser 2139: case ']':
1.84 paf 2140: if(pc.ls==LS_NAME_SQUARE_PART)
1.11 parser 2141: if(--lexical_brackets_nestage==0) {// $name.[co<]?>de<]?>
1.84 paf 2142: pop_LS(pc); // $name.[co<]>de<]!>
1.11 parser 2143: RC;
2144: }
1.3 parser 2145: break;
1.11 parser 2146: case '[': // $name.[co<[>de]
1.84 paf 2147: if(pc.ls==LS_NAME_SQUARE_PART)
1.11 parser 2148: lexical_brackets_nestage++;
1.4 parser 2149: break;
1.1 parser 2150: }
1.97 paf 2151: if(pc.explicit_result && c)
2152: switch(c) {
2153: case '\n': case ' ': case '\t':
2154: begin=pc.source;
2155: begin_pos=pc.pos;
2156: continue; // skip it
2157: default:
2158: result=BAD_NONWHITESPACE_CHARACTER_IN_EXPLICIT_RESULT_MODE;
2159: goto break2;
2160: }
1.1 parser 2161: break;
2162:
2163: // #COMMENT
1.66 paf 2164: case LS_USER_COMMENT:
1.1 parser 2165: if(c=='\n') {
2166: // skip comment
1.84 paf 2167: begin=pc.source;
2168: begin_pos=pc.pos;
1.1 parser 2169:
1.84 paf 2170: pop_LS(pc);
1.1 parser 2171: continue;
2172: }
2173: break;
2174:
2175: // STRING IN EXPRESSION
2176: case LS_EXPRESSION_STRING_QUOTED:
2177: case LS_EXPRESSION_STRING_APOSTROFED:
2178: switch(c) {
2179: case '"':
2180: case '\'':
2181: if(
1.84 paf 2182: pc.ls == LS_EXPRESSION_STRING_QUOTED && c=='"' ||
2183: pc.ls == LS_EXPRESSION_STRING_APOSTROFED && c=='\'') {
2184: pop_LS(pc); //"abc". | 'abc'.
1.1 parser 2185: RC;
2186: }
2187: break;
2188: case '$':
1.84 paf 2189: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 2190: RC;
2191: case '^':
1.84 paf 2192: push_LS(pc, LS_METHOD_NAME);
1.1 parser 2193: RC;
2194: }
2195: break;
2196:
2197: // METHOD DEFINITION
2198: case LS_DEF_NAME:
2199: switch(c) {
2200: case '[':
1.84 paf 2201: pc.ls=LS_DEF_PARAMS;
1.1 parser 2202: RC;
2203: case '\n':
1.84 paf 2204: pc.ls=LS_DEF_SPECIAL_BODY;
1.1 parser 2205: RC;
2206: }
2207: break;
2208:
2209: case LS_DEF_PARAMS:
2210: switch(c) {
1.64 paf 2211: case '$': // common error
1.65 paf 2212: result=BAD_METHOD_PARAMETER_NAME_CHARACTER;
2213: goto break2;
1.1 parser 2214: case ';':
2215: RC;
2216: case ']':
1.84 paf 2217: pc.ls=*pc.source=='['?LS_DEF_LOCALS:LS_DEF_COMMENT;
1.1 parser 2218: RC;
2219: case '\n': // wrong. bailing out
1.84 paf 2220: pop_LS(pc);
1.1 parser 2221: RC;
2222: }
2223: break;
2224:
2225: case LS_DEF_LOCALS:
2226: switch(c) {
2227: case '[':
2228: case ';':
2229: RC;
2230: case ']':
1.84 paf 2231: pc.ls=LS_DEF_COMMENT;
1.1 parser 2232: RC;
2233: case '\n': // wrong. bailing out
1.84 paf 2234: pop_LS(pc);
1.1 parser 2235: RC;
2236: }
2237: break;
2238:
2239: case LS_DEF_COMMENT:
2240: if(c=='\n') {
1.84 paf 2241: pop_LS(pc);
1.1 parser 2242: RC;
2243: }
2244: break;
2245:
2246: case LS_DEF_SPECIAL_BODY:
1.31 paf 2247: if(c=='\n')
1.1 parser 2248: RC;
2249: break;
2250:
2251: // (EXPRESSION)
2252: case LS_VAR_ROUND:
2253: case LS_METHOD_ROUND:
2254: switch(c) {
2255: case ')':
2256: if(--lexical_brackets_nestage==0)
1.84 paf 2257: if(pc.ls==LS_METHOD_ROUND) // method round param ended
2258: pc.ls=LS_METHOD_AFTER; // look for method end
2259: else // pc.ls==LS_VAR_ROUND // variable constructor ended
2260: pop_LS(pc); // return to normal life
1.1 parser 2261: RC;
1.66 paf 2262: case '#': // comment start skipping
2263: if(end!=begin) {
1.84 paf 2264: if(!pc.string_start)
2265: pc.string_start=begin_pos;
1.66 paf 2266: // append piece till #
1.84 paf 2267: pc.string.append_strdup_know_length(begin, end-begin);
1.66 paf 2268: }
2269: // fall into COMMENT lexical state [wait for \n]
1.84 paf 2270: push_LS(pc, LS_EXPRESSION_COMMENT);
1.66 paf 2271: lexical_brackets_nestage=1;
2272: continue;
1.1 parser 2273: case '$':
1.84 paf 2274: push_LS(pc, LS_EXPRESSION_VAR_NAME_WITH_COLON);
1.1 parser 2275: RC;
2276: case '^':
1.84 paf 2277: push_LS(pc, LS_METHOD_NAME);
1.1 parser 2278: RC;
2279: case '(':
2280: lexical_brackets_nestage++;
2281: RC;
2282: case '-':
1.84 paf 2283: switch(*pc.source) {
1.1 parser 2284: case 'f': // -f
2285: skip_analized=1;
2286: result=FEXISTS;
2287: goto break2;
2288: case 'd': // -d
2289: skip_analized=1;
2290: result=DEXISTS;
2291: goto break2;
1.63 paf 2292: default: // minus
1.1 parser 2293: result=c;
2294: goto break2;
2295: }
2296: goto break2;
1.25 paf 2297: case '+': case '*': case '/': case '%': case '\\':
1.1 parser 2298: case '~':
2299: case ';':
2300: RC;
1.65 paf 2301: case '&': case '|':
1.84 paf 2302: if(*pc.source==c) { // && ||
1.65 paf 2303: result=c=='&'?LAND:LOR;
1.1 parser 2304: skip_analized=1;
2305: } else
2306: result=c;
2307: goto break2;
1.65 paf 2308: case '!':
1.84 paf 2309: switch(pc.source[0]) {
1.65 paf 2310: case '|': // !| !||
2311: skip_analized=1;
1.84 paf 2312: if(pc.source[1]=='|') {
1.65 paf 2313: skip_analized++;
2314: result=LXOR;
2315: } else
2316: result=NXOR;
2317: goto break2;
2318: case '=': // !=
2319: skip_analized=1;
2320: result=NNE;
2321: goto break2;
2322: }
2323: RC;
1.67 paf 2324:
2325: case '<': // <<, <=, <
1.84 paf 2326: switch(*pc.source) {
1.67 paf 2327: case '<': // <[<]
2328: skip_analized=1; result=NSL; break;
2329: case '=': // <[=]
2330: skip_analized=1; result=NLE; break;
2331: default: // <[]
2332: result=c; break;
2333: }
2334: goto break2;
2335: case '>': // >>, >=, >
1.84 paf 2336: switch(*pc.source) {
1.67 paf 2337: case '>': // >[>]
2338: skip_analized=1; result=NSR; break;
2339: case '=': // >[=]
2340: skip_analized=1; result=NGE; break;
2341: default: // >[]
2342: result=c; break;
2343: }
2344: goto break2;
2345: case '=': // ==
1.84 paf 2346: switch(*pc.source) {
1.67 paf 2347: case '=': // =[=]
2348: skip_analized=1; result=NEQ; break;
2349: default: // =[]
2350: result=c; break; // not used now
2351: }
1.1 parser 2352: goto break2;
1.67 paf 2353:
1.1 parser 2354: case '"':
1.84 paf 2355: push_LS(pc, LS_EXPRESSION_STRING_QUOTED);
1.1 parser 2356: RC;
2357: case '\'':
1.84 paf 2358: push_LS(pc, LS_EXPRESSION_STRING_APOSTROFED);
1.1 parser 2359: RC;
2360: case 'l': case 'g': case 'e': case 'n':
2361: if(end==begin) // right after whitespace
1.84 paf 2362: if(isspace(pc.source[1])) {
2363: switch(*pc.source) {
1.1 parser 2364: // case '?': // ok [and bad cases, yacc would bark at them]
2365: case 't': // lt gt [et nt]
2366: result=c=='l'?SLT:c=='g'?SGT:BAD_STRING_COMPARISON_OPERATOR;
2367: skip_analized=1;
2368: goto break2;
2369: case 'e': // le ge ne [ee]
2370: result=c=='l'?SLE:c=='g'?SGE:c=='n'?SNE:BAD_STRING_COMPARISON_OPERATOR;
2371: skip_analized=1;
2372: goto break2;
2373: case 'q': // eq [lq gq nq]
2374: result=c=='e'?SEQ:BAD_STRING_COMPARISON_OPERATOR;
2375: skip_analized=1;
2376: goto break2;
2377: }
2378: }
2379: break;
2380: case 'i':
2381: if(end==begin) // right after whitespace
1.84 paf 2382: if(isspace(pc.source[1])) {
2383: switch(pc.source[0]) {
1.1 parser 2384: case 'n': // in
2385: skip_analized=1;
2386: result=IN;
2387: goto break2;
2388: case 's': // is
2389: skip_analized=1;
2390: result=IS;
2391: goto break2;
2392: }
2393: }
2394: break;
2395: case 'd':
2396: if(end==begin) // right after whitespace
1.84 paf 2397: if(pc.source[0]=='e' && pc.source[1]=='f') { // def
1.1 parser 2398: skip_analized=2;
2399: result=DEF;
2400: goto break2;
2401: }
2402: break;
2403: case ' ': case '\t': case '\n':
2404: if(end!=begin) { // there were a string after previous operator?
2405: result=0; // return that string
2406: goto break2;
2407: }
2408: // that's a leading|traling space or after-operator-space
2409: // ignoring it
2410: // reset piece 'begin' position & line
1.84 paf 2411: begin=pc.source; // after whitespace char
2412: begin_pos=pc.pos;
1.1 parser 2413: continue;
2414: }
2415: break;
1.66 paf 2416: case LS_EXPRESSION_COMMENT:
2417: if(c=='(')
2418: lexical_brackets_nestage++;
2419:
1.84 paf 2420: switch(*pc.source) {
1.66 paf 2421: case '\n': case ')':
1.84 paf 2422: if(*pc.source==')')
1.66 paf 2423: if(--lexical_brackets_nestage!=0)
2424: continue;
2425:
2426: // skip comment
1.84 paf 2427: begin=pc.source;
2428: begin_pos=pc.pos;
1.66 paf 2429:
1.84 paf 2430: pop_LS(pc);
1.66 paf 2431: continue;
2432: }
2433: break;
1.1 parser 2434:
2435: // VARIABLE GET/PUT/WITH
1.11 parser 2436: case LS_VAR_NAME_SIMPLE_WITH_COLON:
2437: case LS_VAR_NAME_SIMPLE_WITHOUT_COLON:
2438: case LS_EXPRESSION_VAR_NAME_WITH_COLON:
2439: case LS_EXPRESSION_VAR_NAME_WITHOUT_COLON:
2440: if(
1.84 paf 2441: pc.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON ||
2442: pc.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.41 paf 2443: // name in expr ends also before
1.1 parser 2444: switch(c) {
1.41 paf 2445: // expression minus
1.1 parser 2446: case '-':
1.41 paf 2447: // expression integer division
2448: case '\\':
1.84 paf 2449: pop_LS(pc);
2450: pc.ungetc();
1.1 parser 2451: result=EON;
2452: goto break2;
2453: }
2454: }
1.11 parser 2455: if(
1.84 paf 2456: pc.ls==LS_VAR_NAME_SIMPLE_WITHOUT_COLON ||
2457: pc.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.1 parser 2458: // name already has ':', stop before next
2459: switch(c) {
2460: case ':':
1.84 paf 2461: pop_LS(pc);
2462: pc.ungetc();
1.1 parser 2463: result=EON;
2464: goto break2;
2465: }
2466: }
2467: switch(c) {
2468: case 0:
2469: case ' ': case '\t': case '\n':
2470: case ';':
2471: case ']': case '}': case ')':
2472: case '"': case '\'':
2473: case '<': case '>': // these stand for HTML brackets AND expression binary ops
2474: case '+': case '*': case '/': case '%':
2475: case '&': case '|':
2476: case '=': case '!':
2477: // common delimiters
1.62 paf 2478: case ',': case '?': case '#':
1.1 parser 2479: // before call
2480: case '^':
1.84 paf 2481: pop_LS(pc);
2482: pc.ungetc();
1.1 parser 2483: result=EON;
2484: goto break2;
2485: case '[':
1.5 parser 2486: // $name.<[>code]
1.84 paf 2487: if(pc.pos.col>1/*not first column*/ && (
1.6 parser 2488: end[-1]=='$'/*was start of get*/ ||
2489: end[-1]==':'/*was class name delim */ ||
2490: end[-1]=='.'/*was name delim */
1.5 parser 2491: )) {
1.84 paf 2492: push_LS(pc, LS_NAME_SQUARE_PART);
1.5 parser 2493: lexical_brackets_nestage=1;
2494: RC;
2495: }
1.84 paf 2496: pc.ls=LS_VAR_SQUARE;
1.1 parser 2497: lexical_brackets_nestage=1;
2498: RC;
2499: case '{':
2500: if(begin==end) { // ${name}, no need of EON, switching LS
1.84 paf 2501: pc.ls=LS_VAR_NAME_CURLY;
1.1 parser 2502: } else {
1.84 paf 2503: pc.ls=LS_VAR_CURLY;
1.1 parser 2504: lexical_brackets_nestage=1;
2505: }
2506:
2507: RC;
2508: case '(':
1.84 paf 2509: pc.ls=LS_VAR_ROUND;
1.1 parser 2510: lexical_brackets_nestage=1;
2511: RC;
2512: case '.': // name part delim
2513: case '$': // name part subvar
1.3 parser 2514: case ':': // class<:>name
1.11 parser 2515: // go to _WITHOUT_COLON state variant...
1.84 paf 2516: if(pc.ls==LS_VAR_NAME_SIMPLE_WITH_COLON)
2517: pc.ls=LS_VAR_NAME_SIMPLE_WITHOUT_COLON;
2518: else if(pc.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON)
2519: pc.ls=LS_EXPRESSION_VAR_NAME_WITHOUT_COLON;
1.11 parser 2520: // ...stop before next ':'
1.1 parser 2521: RC;
2522: }
2523: break;
2524:
2525: case LS_VAR_NAME_CURLY:
2526: switch(c) {
1.5 parser 2527: case '[':
1.11 parser 2528: // ${name.<[>code]}
1.84 paf 2529: push_LS(pc, LS_NAME_SQUARE_PART);
1.3 parser 2530: lexical_brackets_nestage=1;
2531: RC;
1.1 parser 2532: case '}': // ${name} finished, restoring LS
1.84 paf 2533: pop_LS(pc);
1.1 parser 2534: RC;
2535: case '.': // name part delim
2536: case '$': // name part subvar
2537: case ':': // ':name' or 'class:name'
2538: RC;
2539: }
2540: break;
2541:
2542: case LS_VAR_SQUARE:
2543: switch(c) {
2544: case '$':
1.84 paf 2545: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 2546: RC;
2547: case '^':
1.84 paf 2548: push_LS(pc, LS_METHOD_NAME);
1.1 parser 2549: RC;
2550: case ']':
2551: if(--lexical_brackets_nestage==0) {
1.84 paf 2552: pop_LS(pc);
1.1 parser 2553: RC;
2554: }
2555: break;
2556: case ';': // operator_or_fmt;value delim
2557: RC;
2558: case '[':
2559: lexical_brackets_nestage++;
2560: break;
2561: }
2562: break;
2563:
2564: case LS_VAR_CURLY:
2565: switch(c) {
2566: case '$':
1.84 paf 2567: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 2568: RC;
2569: case '^':
1.84 paf 2570: push_LS(pc, LS_METHOD_NAME);
1.1 parser 2571: RC;
2572: case '}':
2573: if(--lexical_brackets_nestage==0) {
1.84 paf 2574: pop_LS(pc);
1.1 parser 2575: RC;
2576: }
2577: break;
2578: case '{':
2579: lexical_brackets_nestage++;
2580: break;
2581: }
2582: break;
2583:
2584: // METHOD CALL
2585: case LS_METHOD_NAME:
2586: switch(c) {
2587: case '[':
1.11 parser 2588: // ^name.<[>code].xxx
1.84 paf 2589: if(pc.pos.col>1/*not first column*/ && (
1.6 parser 2590: end[-1]=='^'/*was start of call*/ || // never, ^[ is literal...
2591: end[-1]==':'/*was class name delim */ ||
2592: end[-1]=='.'/*was name delim */
1.5 parser 2593: )) {
1.84 paf 2594: push_LS(pc, LS_NAME_SQUARE_PART);
1.5 parser 2595: lexical_brackets_nestage=1;
2596: RC;
2597: }
1.84 paf 2598: pc.ls=LS_METHOD_SQUARE;
1.1 parser 2599: lexical_brackets_nestage=1;
2600: RC;
2601: case '{':
1.84 paf 2602: pc.ls=LS_METHOD_CURLY;
1.1 parser 2603: lexical_brackets_nestage=1;
2604: RC;
2605: case '(':
1.84 paf 2606: pc.ls=LS_METHOD_ROUND;
1.1 parser 2607: lexical_brackets_nestage=1;
2608: RC;
2609: case '.': // name part delim
2610: case '$': // name part subvar
2611: case ':': // ':name' or 'class:name'
1.19 parser 2612: case '^': // ^abc^xxx wrong. bailing out
2613: case ']': case '}': case ')': // ^abc]}) wrong. bailing out
1.90 paf 2614: case ' ': // ^if ( wrong. bailing out
1.1 parser 2615: RC;
2616: }
2617: break;
2618:
2619: case LS_METHOD_SQUARE:
2620: switch(c) {
2621: case '$':
1.84 paf 2622: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 2623: RC;
2624: case '^':
1.84 paf 2625: push_LS(pc, LS_METHOD_NAME);
1.1 parser 2626: RC;
2627: case ';': // param delim
2628: RC;
2629: case ']':
2630: if(--lexical_brackets_nestage==0) {
1.84 paf 2631: pc.ls=LS_METHOD_AFTER;
1.1 parser 2632: RC;
2633: }
2634: break;
2635: case '[':
2636: lexical_brackets_nestage++;
2637: break;
2638: }
2639: break;
2640:
2641: case LS_METHOD_CURLY:
2642: switch(c) {
2643: case '$':
1.84 paf 2644: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 2645: RC;
2646: case '^':
1.84 paf 2647: push_LS(pc, LS_METHOD_NAME);
1.1 parser 2648: RC;
2649: case ';': // param delim
2650: RC;
2651: case '}':
2652: if(--lexical_brackets_nestage==0) {
1.84 paf 2653: pc.ls=LS_METHOD_AFTER;
1.1 parser 2654: RC;
2655: }
2656: break;
2657: case '{':
2658: lexical_brackets_nestage++;
2659: break;
2660: }
1.97 paf 2661: if(pc.explicit_result && c)
2662: switch(c) {
2663: case '\n': case ' ': case '\t':
2664: begin=pc.source;
2665: begin_pos=pc.pos;
2666: continue; // skip it
2667: default:
2668: result=BAD_NONWHITESPACE_CHARACTER_IN_EXPLICIT_RESULT_MODE;
2669: goto break2;
2670: }
1.1 parser 2671: break;
2672:
2673: case LS_METHOD_AFTER:
2674: if(c=='[') {/* ][ }[ )[ */
1.84 paf 2675: pc.ls=LS_METHOD_SQUARE;
1.1 parser 2676: lexical_brackets_nestage=1;
2677: RC;
2678: }
2679: if(c=='{') {/* ]{ }{ ){ */
1.84 paf 2680: pc.ls=LS_METHOD_CURLY;
1.1 parser 2681: lexical_brackets_nestage=1;
2682: RC;
2683: }
2684: if(c=='(') {/* ]( }( )( */
1.84 paf 2685: pc.ls=LS_METHOD_ROUND;
1.1 parser 2686: lexical_brackets_nestage=1;
2687: RC;
2688: }
1.84 paf 2689: pop_LS(pc);
2690: pc.ungetc();
1.1 parser 2691: result=EON;
2692: goto break2;
2693: }
2694: if(c==0) {
2695: result=-1;
2696: break;
2697: }
2698: }
2699:
2700: break2:
2701: if(end!=begin) { // there is last piece?
2702: if((c=='@' || c==0) && end[-1]=='\n') { // we are before LS_DEF_NAME or EOF?
2703: // strip last \n
2704: end--;
2705: if(end!=begin && end[-1]=='\n') // allow one empty line before LS_DEF_NAME
2706: end--;
2707: }
1.84 paf 2708: if(end!=begin && pc.ls!=LS_USER_COMMENT) { // last piece still alive and not comment?
2709: if(!pc.string_start)
2710: pc.string_start=begin_pos;
1.1 parser 2711: // append it
1.84 paf 2712: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 2713: }
2714: }
1.84 paf 2715: if(!pc.string.is_empty()) { // something accumulated?
2716: // create STRING value: array of OP_VALUE+origin+vstring
2717: *lvalp=VL(
2718: new VString(*new String(pc.string, String::L_CLEAN)),
2719: pc.file_no, pc.string_start.line, pc.string_start.col);
1.1 parser 2720: // new pieces storage
1.84 paf 2721: pc.string.clear();
2722: pc.string_start.clear();
1.1 parser 2723: // make current result be pending for next call, return STRING for now
1.84 paf 2724: pc.pending_state=result; result=STRING;
1.1 parser 2725: }
2726: if(skip_analized) {
1.84 paf 2727: pc.source+=skip_analized; pc.pos.col+=skip_analized;
1.1 parser 2728: }
2729: return result;
2730: }
2731:
1.84 paf 2732: static int real_yyerror(Parse_control *pc, char *s) { // Called by yyparse on error
1.10 parser 2733: strncpy(PC.error, s, MAX_STRING);
1.1 parser 2734: return 1;
2735: }
2736:
2737: static void yyprint(FILE *file, int type, YYSTYPE value) {
2738: if(type==STRING)
1.84 paf 2739: fprintf(file, " \"%s\"", LA2S(*value)->cstr());
1.1 parser 2740: }
E-mail: