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