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