Annotation of parser3/src/main/compile.tab.C, revision 1.14
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:
! 40: $Id: compile.y,v 1.168 2001/09/26 10:32:25 parser Exp $
! 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. */
467: #line 3 "D:/cygwin/usr/share/bison.simple"
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:
681: #line 217 "D:/cygwin/usr/share/bison.simple"
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 */
1598: #line 543 "D:/cygwin/usr/share/bison.simple"
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:
1865: if(c=='^' && PC.ls!=LS_COMMENT && PC.ls!=LS_DEF_COMMENT)
1866: switch(*PC.source) {
1.10 parser 1867: // ^escaping some punctuators
1.1 parser 1868: case '^': case '$': case ';':
1869: case '(': case ')':
1870: case '[': case ']':
1871: case '{': case '}':
1872: case '"':
1873: if(end!=begin) {
1874: // append piece till ^
1875: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line);
1876: }
1877: // reset piece 'begin' position & line
1.7 parser 1878: end=begin=PC.source; // ^
1.1 parser 1879: begin_line=PC.line;
1.7 parser 1880: if(PC.ls==LS_METHOD_AFTER) {
1881: pop_LS(PC);
1882: result=EON;
1.10 parser 1883: skip_analized=-1; // return to ^ afterwards to assure it's literality
1.7 parser 1884: goto break2;
1885: } else {
1886: // skip over _ after ^
1887: PC.source++; PC.col++;
1888: // skip analysis = forced literal
1889: continue;
1890: }
1.1 parser 1891:
1892: // converting ^#HH into char(hex(HH))
1893: case '#':
1894: if(end!=begin) {
1895: // append piece till ^
1896: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line);
1897: }
1898: // #HH ?
1899: if(PC.source[0]=='#' && PC.source[1] && PC.source[2]) {
1900: char *hex=(char *)POOL.malloc(1);
1901: hex[0]=
1902: hex_value[(unsigned char)PC.source[1]]*0x10+
1903: hex_value[(unsigned char)PC.source[2]];
1904: if(hex[0]==0) {
1905: result=BAD_HEX_LITERAL;
1906: goto break2; // wrong hex value[no ^#00 chars allowed]: bail out
1907: }
1908: // append char(hex(HH))
1909: PC.string->APPEND_CLEAN(hex, 1, PC.file, begin_line);
1910: // skip over ^#HH
1911: PC.source+=3;
1912: PC.col+=3;
1913: // reset piece 'begin' position & line
1914: begin=PC.source; // ^
1915: begin_line=PC.line;
1916: continue;
1917: }
1918: break;
1919: }
1920: // #comment start skipping
1921: if(c=='#' && PC.col==1) {
1922: if(end!=begin) {
1923: // append piece till #
1924: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line);
1925: }
1926: // fall into COMMENT lexical state [wait for \n]
1927: push_LS(PC, LS_COMMENT);
1928: }
1929: switch(PC.ls) {
1930:
1931: // USER'S = NOT OURS
1932: case LS_USER:
1.11 parser 1933: case LS_NAME_SQUARE_PART: // name.[here].xxx
1.1 parser 1934: if(PC.trim_bof)
1935: switch(c) {
1936: case '\n': case ' ': case '\t':
1937: begin=PC.source;
1938: begin_line=PC.line;
1939: continue; // skip it
1940: default:
1941: PC.trim_bof=false;
1942: }
1943: switch(c) {
1944: case '$':
1.11 parser 1945: push_LS(PC, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 1946: RC;
1947: case '^':
1948: push_LS(PC, LS_METHOD_NAME);
1949: RC;
1950: case '@':
1951: if(PC.col==0+1) {
1952: push_LS(PC, LS_DEF_NAME);
1953: RC;
1954: }
1955: break;
1.11 parser 1956: case ']':
1957: if(PC.ls==LS_NAME_SQUARE_PART)
1958: if(--lexical_brackets_nestage==0) {// $name.[co<]?>de<]?>
1959: pop_LS(PC); // $name.[co<]>de<]!>
1960: RC;
1961: }
1.3 parser 1962: break;
1.11 parser 1963: case '[': // $name.[co<[>de]
1964: if(PC.ls==LS_NAME_SQUARE_PART)
1965: lexical_brackets_nestage++;
1.4 parser 1966: break;
1.1 parser 1967: }
1968: break;
1969:
1970: // #COMMENT
1971: case LS_COMMENT:
1972: if(c=='\n') {
1973: // skip comment
1974: begin=PC.source;
1975: begin_line=PC.line;
1976:
1977: pop_LS(PC);
1978: continue;
1979: }
1980: break;
1981:
1982: // STRING IN EXPRESSION
1983: case LS_EXPRESSION_STRING_QUOTED:
1984: case LS_EXPRESSION_STRING_APOSTROFED:
1985: switch(c) {
1986: case '"':
1987: case '\'':
1988: if(
1989: PC.ls == LS_EXPRESSION_STRING_QUOTED && c=='"' ||
1990: PC.ls == LS_EXPRESSION_STRING_APOSTROFED && c=='\'') {
1991: pop_LS(PC); //"abc". | 'abc'.
1992: RC;
1993: }
1994: break;
1995: case '$':
1.11 parser 1996: push_LS(PC, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 1997: RC;
1998: case '^':
1999: push_LS(PC, LS_METHOD_NAME);
2000: RC;
2001: }
2002: break;
2003:
2004: // METHOD DEFINITION
2005: case LS_DEF_NAME:
2006: switch(c) {
2007: case '[':
2008: PC.ls=LS_DEF_PARAMS;
2009: RC;
2010: case '\n':
2011: PC.ls=LS_DEF_SPECIAL_BODY;
2012: RC;
2013: }
2014: break;
2015:
2016: case LS_DEF_PARAMS:
2017: switch(c) {
2018: case ';':
2019: RC;
2020: case ']':
2021: PC.ls=*PC.source=='['?LS_DEF_LOCALS:LS_DEF_COMMENT;
2022: RC;
2023: case '\n': // wrong. bailing out
2024: pop_LS(PC);
2025: RC;
2026: }
2027: break;
2028:
2029: case LS_DEF_LOCALS:
2030: switch(c) {
2031: case '[':
2032: case ';':
2033: RC;
2034: case ']':
2035: PC.ls=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_COMMENT:
2044: if(c=='\n') {
2045: pop_LS(PC);
2046: RC;
2047: }
2048: break;
2049:
2050: case LS_DEF_SPECIAL_BODY:
2051: // @todo in case
2052: // ################
2053: // @next-method
2054: // we are here with c=='@'
2055: // which is wrong, and need action
2056: if(c=='\n') {
2057: switch(*PC.source) {
2058: case '@': case 0: // end of special_code
2059: pop_LS(PC);
2060: break;
2061: }
2062: RC;
2063: }
2064: break;
2065:
2066: // (EXPRESSION)
2067: case LS_VAR_ROUND:
2068: case LS_METHOD_ROUND:
2069: switch(c) {
2070: case ')':
2071: if(--lexical_brackets_nestage==0)
2072: if(PC.ls==LS_METHOD_ROUND) // method round param ended
2073: PC.ls=LS_METHOD_AFTER; // look for method end
2074: else // PC.ls==LS_VAR_ROUND // variable constructor ended
2075: pop_LS(PC); // return to normal life
2076: RC;
2077: case '$':
1.11 parser 2078: push_LS(PC, LS_EXPRESSION_VAR_NAME_WITH_COLON);
1.1 parser 2079: RC;
2080: case '^':
2081: push_LS(PC, LS_METHOD_NAME);
2082: RC;
2083: case '(':
2084: lexical_brackets_nestage++;
2085: RC;
2086: case '-':
2087: switch(*PC.source) {
2088: case 'f': // -f
2089: skip_analized=1;
2090: result=FEXISTS;
2091: goto break2;
2092: case 'd': // -d
2093: skip_analized=1;
2094: result=DEXISTS;
2095: goto break2;
2096: default:
2097: result=c;
2098: goto break2;
2099: }
2100: goto break2;
2101: case '+': case '*': case '/': case '%':
2102: case '~':
2103: case ';':
2104: RC;
2105: case '&': case '|': case '#':
2106: if(*PC.source==c) { // && ||
2107: result=c=='#'?LXOR:c=='&'?LAND:LOR;
2108: skip_analized=1;
2109: } else
2110: result=c;
2111: goto break2;
2112: case '<': case '>': case '=': case '!':
2113: if(*PC.source=='=') { // <= >= == !=
2114: skip_analized=1;
2115: switch(c) {
2116: case '<': result=NLE; break;
2117: case '>': result=NGE; break;
2118: case '=': result=NEQ; break;
2119: case '!': result=NNE; break;
2120: }
2121: } else
2122: result=c;
2123: goto break2;
2124: case '"':
2125: push_LS(PC, LS_EXPRESSION_STRING_QUOTED);
2126: RC;
2127: case '\'':
2128: push_LS(PC, LS_EXPRESSION_STRING_APOSTROFED);
2129: RC;
2130: case 'l': case 'g': case 'e': case 'n':
2131: if(end==begin) // right after whitespace
2132: if(isspace(PC.source[1])) {
2133: switch(*PC.source) {
2134: // case '?': // ok [and bad cases, yacc would bark at them]
2135: case 't': // lt gt [et nt]
2136: result=c=='l'?SLT:c=='g'?SGT:BAD_STRING_COMPARISON_OPERATOR;
2137: skip_analized=1;
2138: goto break2;
2139: case 'e': // le ge ne [ee]
2140: result=c=='l'?SLE:c=='g'?SGE:c=='n'?SNE:BAD_STRING_COMPARISON_OPERATOR;
2141: skip_analized=1;
2142: goto break2;
2143: case 'q': // eq [lq gq nq]
2144: result=c=='e'?SEQ:BAD_STRING_COMPARISON_OPERATOR;
2145: skip_analized=1;
2146: goto break2;
2147: }
2148: }
2149: break;
2150: case 'i':
2151: if(end==begin) // right after whitespace
2152: if(isspace(PC.source[1])) {
2153: switch(PC.source[0]) {
2154: case 'n': // in
2155: skip_analized=1;
2156: result=IN;
2157: goto break2;
2158: case 's': // is
2159: skip_analized=1;
2160: result=IS;
2161: goto break2;
2162: }
2163: }
2164: break;
2165: case 'd':
2166: if(end==begin) // right after whitespace
2167: if(PC.source[0]=='e' && PC.source[1]=='f') { // def
2168: skip_analized=2;
2169: result=DEF;
2170: goto break2;
2171: }
2172: break;
2173: case ' ': case '\t': case '\n':
2174: if(end!=begin) { // there were a string after previous operator?
2175: result=0; // return that string
2176: goto break2;
2177: }
2178: // that's a leading|traling space or after-operator-space
2179: // ignoring it
2180: // reset piece 'begin' position & line
2181: begin=PC.source; // after whitespace char
2182: begin_line=PC.line;
2183: continue;
2184: }
2185: break;
2186:
2187: // VARIABLE GET/PUT/WITH
1.11 parser 2188: case LS_VAR_NAME_SIMPLE_WITH_COLON:
2189: case LS_VAR_NAME_SIMPLE_WITHOUT_COLON:
2190: case LS_EXPRESSION_VAR_NAME_WITH_COLON:
2191: case LS_EXPRESSION_VAR_NAME_WITHOUT_COLON:
2192: if(
2193: PC.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON ||
2194: PC.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.1 parser 2195: // name in expr ends also before binary operators
2196: switch(c) {
2197: case '-':
2198: pop_LS(PC);
2199: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
2200: result=EON;
2201: goto break2;
2202: }
2203: }
1.11 parser 2204: if(
2205: PC.ls==LS_VAR_NAME_SIMPLE_WITHOUT_COLON ||
2206: PC.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.1 parser 2207: // name already has ':', stop before next
2208: switch(c) {
2209: case ':':
2210: pop_LS(PC);
2211: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
2212: result=EON;
2213: goto break2;
2214: }
2215: }
2216: switch(c) {
2217: case 0:
2218: case ' ': case '\t': case '\n':
2219: case ';':
2220: case ']': case '}': case ')':
2221: case '"': case '\'':
2222: case '<': case '>': // these stand for HTML brackets AND expression binary ops
2223: case '+': case '*': case '/': case '%':
2224: case '&': case '|':
2225: case '=': case '!':
2226: // common delimiters
2227: case ',': case '?':
2228: // before call
2229: case '^':
2230: pop_LS(PC);
2231: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
2232: result=EON;
2233: goto break2;
2234: case '[':
1.5 parser 2235: // $name.<[>code]
2236: if(PC.col>1/*not first column*/ && (
1.6 parser 2237: end[-1]=='$'/*was start of get*/ ||
2238: end[-1]==':'/*was class name delim */ ||
2239: end[-1]=='.'/*was name delim */
1.5 parser 2240: )) {
1.11 parser 2241: push_LS(PC, LS_NAME_SQUARE_PART);
1.5 parser 2242: lexical_brackets_nestage=1;
2243: RC;
2244: }
1.1 parser 2245: PC.ls=LS_VAR_SQUARE;
2246: lexical_brackets_nestage=1;
2247: RC;
2248: case '{':
2249: if(begin==end) { // ${name}, no need of EON, switching LS
2250: PC.ls=LS_VAR_NAME_CURLY;
2251: } else {
2252: PC.ls=LS_VAR_CURLY;
2253: lexical_brackets_nestage=1;
2254: }
2255:
2256: RC;
2257: case '(':
2258: PC.ls=LS_VAR_ROUND;
2259: lexical_brackets_nestage=1;
2260: RC;
2261: case '.': // name part delim
2262: case '$': // name part subvar
1.3 parser 2263: case ':': // class<:>name
1.11 parser 2264: // go to _WITHOUT_COLON state variant...
2265: if(PC.ls==LS_VAR_NAME_SIMPLE_WITH_COLON)
2266: PC.ls=LS_VAR_NAME_SIMPLE_WITHOUT_COLON;
2267: else if(PC.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON)
2268: PC.ls=LS_EXPRESSION_VAR_NAME_WITHOUT_COLON;
2269: // ...stop before next ':'
1.1 parser 2270: RC;
2271: }
2272: break;
2273:
2274: case LS_VAR_NAME_CURLY:
2275: switch(c) {
1.5 parser 2276: case '[':
1.11 parser 2277: // ${name.<[>code]}
2278: push_LS(PC, LS_NAME_SQUARE_PART);
1.3 parser 2279: lexical_brackets_nestage=1;
2280: RC;
1.1 parser 2281: case '}': // ${name} finished, restoring LS
2282: pop_LS(PC);
2283: RC;
2284: case '.': // name part delim
2285: case '$': // name part subvar
2286: case ':': // ':name' or 'class:name'
2287: RC;
2288: }
2289: break;
2290:
2291: case LS_VAR_SQUARE:
2292: switch(c) {
2293: case '$':
1.11 parser 2294: push_LS(PC, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 2295: RC;
2296: case '^':
2297: push_LS(PC, LS_METHOD_NAME);
2298: RC;
2299: case ']':
2300: if(--lexical_brackets_nestage==0) {
2301: pop_LS(PC);
2302: RC;
2303: }
2304: break;
2305: case ';': // operator_or_fmt;value delim
2306: RC;
2307: case '[':
2308: lexical_brackets_nestage++;
2309: break;
2310: }
2311: break;
2312:
2313: case LS_VAR_CURLY:
2314: switch(c) {
2315: case '$':
1.11 parser 2316: push_LS(PC, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 2317: RC;
2318: case '^':
2319: push_LS(PC, LS_METHOD_NAME);
2320: RC;
2321: case '}':
2322: if(--lexical_brackets_nestage==0) {
2323: pop_LS(PC);
2324: RC;
2325: }
2326: break;
2327: case '{':
2328: lexical_brackets_nestage++;
2329: break;
2330: }
2331: break;
2332:
2333: // METHOD CALL
2334: case LS_METHOD_NAME:
2335: switch(c) {
2336: case '[':
1.11 parser 2337: // ^name.<[>code].xxx
1.5 parser 2338: if(PC.col>1/*not first column*/ && (
1.6 parser 2339: end[-1]=='^'/*was start of call*/ || // never, ^[ is literal...
2340: end[-1]==':'/*was class name delim */ ||
2341: end[-1]=='.'/*was name delim */
1.5 parser 2342: )) {
1.11 parser 2343: push_LS(PC, LS_NAME_SQUARE_PART);
1.5 parser 2344: lexical_brackets_nestage=1;
2345: RC;
2346: }
1.1 parser 2347: PC.ls=LS_METHOD_SQUARE;
2348: lexical_brackets_nestage=1;
2349: RC;
2350: case '{':
2351: PC.ls=LS_METHOD_CURLY;
2352: lexical_brackets_nestage=1;
2353: RC;
2354: case '(':
2355: PC.ls=LS_METHOD_ROUND;
2356: lexical_brackets_nestage=1;
2357: RC;
2358: case '.': // name part delim
2359: case '$': // name part subvar
2360: case ':': // ':name' or 'class:name'
2361: RC;
2362: }
2363: break;
2364:
2365: case LS_METHOD_SQUARE:
2366: switch(c) {
2367: case '$':
1.11 parser 2368: push_LS(PC, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 2369: RC;
2370: case '^':
2371: push_LS(PC, LS_METHOD_NAME);
2372: RC;
2373: case ';': // param delim
2374: RC;
2375: case ']':
2376: if(--lexical_brackets_nestage==0) {
2377: PC.ls=LS_METHOD_AFTER;
2378: RC;
2379: }
2380: break;
2381: case '[':
2382: lexical_brackets_nestage++;
2383: break;
2384: }
2385: break;
2386:
2387: case LS_METHOD_CURLY:
2388: switch(c) {
2389: case '$':
1.11 parser 2390: push_LS(PC, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 2391: RC;
2392: case '^':
2393: push_LS(PC, LS_METHOD_NAME);
2394: RC;
2395: case ';': // param delim
2396: RC;
2397: case '}':
2398: if(--lexical_brackets_nestage==0) {
2399: PC.ls=LS_METHOD_AFTER;
2400: RC;
2401: }
2402: break;
2403: case '{':
2404: lexical_brackets_nestage++;
2405: break;
2406: }
2407: break;
2408:
2409: case LS_METHOD_AFTER:
2410: if(c=='[') {/* ][ }[ )[ */
2411: PC.ls=LS_METHOD_SQUARE;
2412: lexical_brackets_nestage=1;
2413: RC;
2414: }
2415: if(c=='{') {/* ]{ }{ ){ */
2416: PC.ls=LS_METHOD_CURLY;
2417: lexical_brackets_nestage=1;
2418: RC;
2419: }
2420: if(c=='(') {/* ]( }( )( */
2421: PC.ls=LS_METHOD_ROUND;
2422: lexical_brackets_nestage=1;
2423: RC;
2424: }
2425: pop_LS(PC);
2426: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
2427: result=EON;
2428: goto break2;
2429: }
2430: if(c==0) {
2431: result=-1;
2432: break;
2433: }
2434: }
2435:
2436: break2:
2437: if(end!=begin) { // there is last piece?
2438: if((c=='@' || c==0) && end[-1]=='\n') { // we are before LS_DEF_NAME or EOF?
2439: // strip last \n
2440: end--;
2441: if(end!=begin && end[-1]=='\n') // allow one empty line before LS_DEF_NAME
2442: end--;
2443: }
2444: if(end!=begin && PC.ls!=LS_COMMENT) { // last piece still alive and not comment?
2445: // append it
2446: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line/*, start_col*/);
2447: }
2448: }
2449: if(PC.string->size()) { // something accumulated?
2450: // create STRING value: array of OP_VALUE+vstring
2451: *lvalp=VL(NEW VString(*PC.string));
2452: // new pieces storage
2453: PC.string=NEW String(POOL);
2454: // make current result be pending for next call, return STRING for now
2455: PC.pending_state=result; result=STRING;
2456: }
2457: if(skip_analized) {
2458: PC.source+=skip_analized; PC.col+=skip_analized;
2459: }
2460: return result;
2461: }
2462:
2463: static int real_yyerror(parse_control *pc, char *s) { // Called by yyparse on error
1.10 parser 2464: strncpy(PC.error, s, MAX_STRING);
1.1 parser 2465: return 1;
2466: }
2467:
2468: static void yyprint(FILE *file, int type, YYSTYPE value) {
2469: if(type==STRING)
2470: fprintf(file, " \"%s\"", LA2S(value)->cstr());
2471: }
E-mail: