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