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