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