|
|
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.3 ! parser 34: static char *RCSId="$Id: compile.y,v 1.159 2001/08/06 16:18:26 parser Exp $";
1.1 parser 35:
36: /**
37: @todo parser4:
38: - cache compiled code from request to request. to do that...
39: -#: make method definitions, @CLASS, @BASE, @USE instructions,
40: which would be executed afterwards, and actions
41: now performed at compile time would be delayed to run time.
42: -#: make cache expiration on time and on disk-change of class source
43: -#: in apache use subpools for compiled class storage
44: -#: in iis make up specialized Pool object for that
45: */
46:
47: #define YYSTYPE Array/*<Operation>*/ *
48: #define YYPARSE_PARAM pc
49: #define YYLEX_PARAM pc
50: #define YYDEBUG 1
51: #define YYERROR_VERBOSE 1
52: #define yyerror(msg) real_yyerror((parse_control *)pc, msg)
53: #define YYPRINT(file, type, value) yyprint(file, type, value)
54:
55: #include "compile_tools.h"
56: #include "pa_value.h"
57: #include "pa_request.h"
58: #include "pa_vobject.h"
59: #include "pa_vdouble.h"
60: #include "pa_globals.h"
61: #include "pa_vvoid.h"
62:
63: #define SELF_ELEMENT_NAME "self"
64: #define USE_CONTROL_METHOD_NAME "USE"
65:
66: static int real_yyerror(parse_control *pc, char *s);
67: static void yyprint(FILE *file, int type, YYSTYPE value);
68: static int yylex(YYSTYPE *lvalp, void *pc);
69:
70:
71: // local convinient inplace typecast & var
72: #define PC (*(parse_control *)pc)
73: #define POOL (*PC.pool)
74: #undef NEW
75: #define NEW new(POOL)
76: #ifndef DOXYGEN
77: #ifndef YYSTYPE
78: #define YYSTYPE int
79: #endif
80: #include <stdio.h>
81:
82: #ifndef __cplusplus
83: #ifndef __STDC__
84: #define const
85: #endif
86: #endif
87:
88:
89:
1.3 ! parser 90: #define YYFINAL 244
1.1 parser 91: #define YYFLAG -32768
92: #define YYNTBASE 54
93:
1.3 ! parser 94: #define YYTRANSLATE(x) ((unsigned)(x) <= 280 ? yytranslate[x] : 133)
1.1 parser 95:
96: static const char yytranslate[] = { 0,
97: 2, 2, 2, 2, 2, 2, 2, 2, 2, 40,
98: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
99: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
100: 2, 2, 28, 52, 29, 44, 37, 31, 53, 48,
101: 49, 35, 34, 2, 33, 47, 36, 2, 2, 2,
102: 2, 2, 2, 2, 2, 2, 2, 51, 43, 26,
103: 2, 27, 2, 39, 2, 2, 2, 2, 2, 2,
104: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
105: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
106: 41, 2, 42, 50, 2, 2, 2, 2, 2, 2,
107: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
108: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
109: 2, 2, 45, 30, 46, 32, 2, 2, 2, 2,
110: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
111: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
112: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
113: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
114: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
115: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
116: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
117: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
118: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
119: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
120: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
121: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
122: 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
123: 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
124: 17, 18, 19, 20, 21, 22, 23, 24, 25, 38
125: };
126:
127: #if YYDEBUG != 0
128: static const short yyprhs[] = { 0,
129: 0, 2, 4, 6, 9, 11, 13, 15, 20, 22,
130: 24, 26, 29, 32, 34, 36, 44, 46, 48, 52,
131: 54, 56, 58, 62, 64, 66, 68, 70, 72, 75,
132: 77, 79, 81, 83, 85, 87, 90, 93, 95, 99,
133: 101, 103, 105, 108, 110, 113, 117, 119, 121, 123,
134: 125, 128, 131, 133, 135, 137, 141, 145, 149, 151,
135: 153, 155, 157, 159, 161, 164, 166, 167, 168, 175,
136: 177, 179, 182, 184, 186, 188, 192, 196, 200, 202,
137: 206, 208, 212, 214, 218, 220, 222, 224, 226, 228,
138: 230, 232, 234, 237, 239, 242, 245, 247, 249, 252,
1.3 ! parser 139: 254, 256, 258, 260, 263, 266, 270, 272, 274, 277,
! 140: 280, 282, 284, 287, 290, 292, 294, 296, 298, 302,
! 141: 306, 310, 313, 316, 319, 322, 325, 328, 331, 335,
! 142: 339, 343, 347, 351, 355, 359, 363, 367, 371, 375,
! 143: 379, 383, 387, 391, 395, 399, 403, 407, 411, 415,
! 144: 419, 423, 427, 429, 431, 432
1.1 parser 145: };
146:
147: static const short yyrhs[] = { 56,
148: 0, 55, 0, 57, 0, 55, 57, 0, 69, 0,
1.3 ! parser 149: 58, 0, 63, 0, 39, 4, 40, 59, 0, 132,
1.1 parser 150: 0, 60, 0, 61, 0, 60, 61, 0, 62, 40,
1.3 ! parser 151: 0, 132, 0, 4, 0, 39, 4, 65, 64, 68,
! 152: 40, 69, 0, 132, 0, 65, 0, 41, 66, 42,
! 153: 0, 132, 0, 67, 0, 4, 0, 67, 43, 4,
! 154: 0, 132, 0, 4, 0, 132, 0, 70, 0, 71,
! 155: 0, 70, 71, 0, 130, 0, 72, 0, 73, 0,
1.1 parser 156: 81, 0, 94, 0, 74, 0, 44, 75, 0, 77,
157: 3, 0, 76, 0, 45, 77, 46, 0, 78, 0,
1.3 ! parser 158: 79, 0, 80, 0, 124, 80, 0, 116, 0, 113,
1.1 parser 159: 116, 0, 44, 82, 86, 0, 83, 0, 84, 0,
1.3 ! parser 160: 85, 0, 112, 0, 47, 112, 0, 124, 112, 0,
1.1 parser 161: 87, 0, 88, 0, 89, 0, 41, 90, 42, 0,
1.3 ! parser 162: 48, 127, 49, 0, 45, 69, 46, 0, 131, 0,
1.1 parser 163: 4, 0, 91, 0, 92, 0, 93, 0, 72, 0,
164: 71, 70, 0, 95, 0, 0, 0, 50, 96, 98,
165: 97, 99, 3, 0, 77, 0, 100, 0, 99, 100,
166: 0, 101, 0, 102, 0, 103, 0, 41, 104, 42,
167: 0, 48, 105, 49, 0, 45, 106, 46, 0, 107,
168: 0, 104, 43, 107, 0, 108, 0, 105, 43, 108,
169: 0, 109, 0, 106, 43, 109, 0, 110, 0, 111,
1.3 ! parser 170: 0, 69, 0, 131, 0, 4, 0, 91, 0, 127,
1.1 parser 171: 0, 117, 0, 113, 117, 0, 114, 0, 113, 114,
172: 0, 115, 47, 0, 117, 0, 117, 0, 4, 5,
1.3 ! parser 173: 0, 4, 0, 118, 0, 119, 0, 120, 0, 44,
! 174: 121, 0, 4, 122, 0, 48, 70, 49, 0, 4,
! 175: 0, 123, 0, 122, 123, 0, 44, 121, 0, 125,
! 176: 0, 126, 0, 4, 51, 0, 125, 51, 0, 128,
! 177: 0, 4, 0, 74, 0, 95, 0, 52, 129, 52,
! 178: 0, 53, 129, 53, 0, 48, 128, 49, 0, 33,
! 179: 128, 0, 32, 128, 0, 28, 128, 0, 21, 128,
! 180: 0, 22, 128, 0, 23, 128, 0, 24, 128, 0,
! 181: 128, 33, 128, 0, 128, 34, 128, 0, 128, 35,
! 182: 128, 0, 128, 36, 128, 0, 128, 37, 128, 0,
! 183: 128, 31, 128, 0, 128, 30, 128, 0, 128, 29,
! 184: 128, 0, 128, 8, 128, 0, 128, 9, 128, 0,
! 185: 128, 10, 128, 0, 128, 26, 128, 0, 128, 27,
! 186: 128, 0, 128, 11, 128, 0, 128, 12, 128, 0,
! 187: 128, 13, 128, 0, 128, 14, 128, 0, 128, 15,
! 188: 128, 0, 128, 16, 128, 0, 128, 17, 128, 0,
! 189: 128, 18, 128, 0, 128, 19, 128, 0, 128, 20,
! 190: 128, 0, 128, 25, 128, 0, 69, 0, 4, 0,
! 191: 0, 0
1.1 parser 192: };
193:
194: #endif
195:
196: #if YYDEBUG != 0
197: static const short yyrline[] = { 0,
1.2 parser 198: 106, 116, 118, 118, 119, 121, 121, 123, 189, 189,
199: 190, 190, 191, 192, 192, 194, 223, 223, 224, 225,
200: 225, 226, 226, 228, 228, 232, 232, 234, 234, 235,
201: 235, 236, 236, 236, 240, 244, 245, 245, 246, 247,
202: 249, 250, 265, 266, 266, 270, 274, 276, 277, 278,
203: 293, 298, 300, 301, 302, 305, 311, 317, 323, 325,
204: 326, 328, 334, 335, 335, 339, 343, 344, 345, 359,
205: 361, 361, 362, 364, 365, 367, 368, 369, 370, 372,
206: 374, 376, 378, 380, 382, 386, 390, 394, 396, 397,
207: 399, 406, 406, 408, 408, 409, 410, 415, 420, 422,
1.3 ! parser 208: 424, 425, 426, 428, 432, 440, 446, 451, 451, 452,
! 209: 457, 459, 461, 465, 477, 481, 483, 484, 485, 486,
! 210: 487, 489, 490, 491, 492, 493, 494, 495, 497, 498,
! 211: 499, 500, 501, 502, 503, 504, 505, 506, 507, 508,
! 212: 509, 510, 511, 512, 513, 514, 515, 516, 517, 518,
! 213: 519, 520, 523, 532, 537, 538
1.1 parser 214: };
215: #endif
216:
217:
218: #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
219:
220: static const char * const yytname[] = { "$","error","$undefined.","EON","STRING",
221: "BOGUS","BAD_STRING_COMPARISON_OPERATOR","BAD_HEX_LITERAL","\"&&\"","\"||\"",
222: "\"##\"","\"<=\"","\">=\"","\"==\"","\"!=\"","\"lt\"","\"gt\"","\"le\"","\"ge\"",
223: "\"eq\"","\"ne\"","\"def\"","\"in\"","\"-f\"","\"-d\"","\"is\"","'<'","'>'",
224: "'!'","'#'","'|'","'&'","'~'","'-'","'+'","'*'","'/'","'%'","NEG","'@'","'\\n'",
225: "'['","']'","';'","'$'","'{'","'}'","'.'","'('","')'","'^'","':'","'\\\"'","'\\''",
226: "all","methods","one_big_piece","method","control_method","maybe_control_strings",
227: "control_strings","control_string","maybe_string","code_method","maybe_bracketed_strings",
228: "bracketed_maybe_strings","maybe_strings","strings","maybe_comment","maybe_codes",
229: "codes","code","action","get","get_value","get_name_value","name_in_curly_rdive",
230: "name_without_curly_rdive","name_without_curly_rdive_read","name_without_curly_rdive_class",
231: "name_without_curly_rdive_code","put","name_expr_wdive","name_expr_wdive_root",
232: "name_expr_wdive_write","name_expr_wdive_class","construct","construct_square",
233: "construct_round","construct_curly","any_constructor_code_value","constructor_code_value",
234: "constructor_code","codes__excluding_sole_str_literal","call","call_value","@1",
235: "@2","call_name","store_params","store_param","store_square_param","store_round_param",
236: "store_curly_param","store_code_param_parts","store_expr_param_parts","store_curly_param_parts",
237: "store_code_param_part","store_expr_param_part","store_curly_param_part","code_param_value",
238: "write_expr_value","name_expr_dive_code","name_path","name_step","name_advance1",
239: "name_advance2","name_expr_value","name_expr_subvar_value","name_expr_with_subvar_value",
1.3 ! parser 240: "name_curly_code_value","subvar_ref_name_rdive","subvar_get_writes","subvar__get_write",
! 241: "class_prefix","class_static_prefix","class_constructor_prefix","expr_value",
! 242: "expr","string_inside_quotes_value","write_string","void_value","empty", NULL
1.1 parser 243: };
244: #endif
245:
246: static const short yyr1[] = { 0,
247: 54, 54, 55, 55, 56, 57, 57, 58, 59, 59,
248: 60, 60, 61, 62, 62, 63, 64, 64, 65, 66,
249: 66, 67, 67, 68, 68, 69, 69, 70, 70, 71,
250: 71, 72, 72, 72, 73, 74, 75, 75, 76, 77,
251: 77, 78, 79, 80, 80, 81, 82, 82, 82, 83,
252: 84, 85, 86, 86, 86, 87, 88, 89, 90, 90,
253: 90, 91, 92, 93, 93, 94, 96, 97, 95, 98,
254: 99, 99, 100, 100, 100, 101, 102, 103, 104, 104,
255: 105, 105, 106, 106, 107, 108, 109, 110, 110, 110,
256: 111, 112, 112, 113, 113, 114, 115, 116, 116, 117,
1.3 ! parser 257: 117, 117, 117, 118, 119, 120, 121, 122, 122, 123,
! 258: 124, 124, 125, 126, 127, 128, 128, 128, 128, 128,
! 259: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
! 260: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
! 261: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
! 262: 128, 128, 129, 130, 131, 132
1.1 parser 263: };
264:
265: static const short yyr2[] = { 0,
266: 1, 1, 1, 2, 1, 1, 1, 4, 1, 1,
267: 1, 2, 2, 1, 1, 7, 1, 1, 3, 1,
268: 1, 1, 3, 1, 1, 1, 1, 1, 2, 1,
269: 1, 1, 1, 1, 1, 2, 2, 1, 3, 1,
270: 1, 1, 2, 1, 2, 3, 1, 1, 1, 1,
271: 2, 2, 1, 1, 1, 3, 3, 3, 1, 1,
272: 1, 1, 1, 1, 2, 1, 0, 0, 6, 1,
273: 1, 2, 1, 1, 1, 3, 3, 3, 1, 3,
274: 1, 3, 1, 3, 1, 1, 1, 1, 1, 1,
275: 1, 1, 2, 1, 2, 2, 1, 1, 2, 1,
1.3 ! parser 276: 1, 1, 1, 2, 2, 3, 1, 1, 2, 2,
! 277: 1, 1, 2, 2, 1, 1, 1, 1, 3, 3,
! 278: 3, 2, 2, 2, 2, 2, 2, 2, 3, 3,
1.1 parser 279: 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
280: 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1.3 ! parser 281: 3, 3, 1, 1, 0, 0
1.1 parser 282: };
283:
1.3 ! parser 284: static const short yydefact[] = { 156,
! 285: 154, 0, 0, 67, 2, 1, 3, 6, 7, 5,
1.1 parser 286: 27, 28, 31, 32, 35, 33, 34, 66, 30, 26,
1.3 ! parser 287: 0, 100, 0, 0, 0, 0, 36, 38, 0, 40,
! 288: 41, 42, 0, 47, 48, 49, 50, 0, 94, 0,
! 289: 44, 92, 101, 102, 103, 0, 111, 112, 0, 4,
! 290: 29, 156, 156, 156, 99, 0, 113, 105, 108, 107,
! 291: 104, 0, 0, 98, 0, 100, 51, 0, 92, 0,
! 292: 37, 155, 156, 0, 46, 53, 54, 55, 100, 95,
! 293: 45, 93, 96, 43, 52, 114, 70, 68, 15, 8,
! 294: 10, 11, 0, 9, 22, 0, 21, 20, 156, 18,
! 295: 17, 110, 109, 39, 93, 106, 154, 0, 31, 0,
! 296: 61, 62, 63, 59, 0, 116, 0, 0, 0, 0,
! 297: 0, 0, 0, 0, 0, 156, 156, 117, 118, 0,
! 298: 115, 0, 12, 14, 13, 19, 0, 25, 0, 24,
! 299: 65, 56, 58, 125, 126, 127, 128, 124, 123, 122,
! 300: 0, 153, 0, 0, 57, 0, 0, 0, 0, 0,
1.1 parser 301: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1.3 ! parser 302: 0, 0, 0, 0, 0, 0, 0, 0, 0, 155,
! 303: 156, 0, 0, 71, 73, 74, 75, 23, 156, 121,
! 304: 119, 120, 137, 138, 139, 142, 143, 144, 145, 146,
! 305: 147, 148, 149, 150, 151, 152, 140, 141, 136, 135,
! 306: 134, 129, 130, 131, 132, 133, 154, 90, 0, 79,
! 307: 85, 88, 87, 0, 83, 0, 81, 86, 91, 69,
! 308: 72, 16, 76, 155, 156, 78, 0, 77, 80, 84,
! 309: 82, 0, 0, 0
1.1 parser 310: };
311:
1.3 ! parser 312: static const short yydefgoto[] = { 242,
! 313: 5, 6, 7, 8, 90, 91, 92, 93, 9, 99,
! 314: 54, 96, 97, 139, 152, 11, 12, 13, 14, 128,
! 315: 27, 28, 29, 30, 31, 32, 16, 33, 34, 35,
! 316: 36, 75, 76, 77, 78, 110, 218, 112, 113, 17,
! 317: 129, 49, 132, 88, 183, 184, 185, 186, 187, 219,
! 318: 226, 224, 220, 227, 225, 221, 228, 37, 63, 39,
! 319: 40, 41, 64, 43, 44, 45, 61, 58, 59, 65,
! 320: 47, 48, 229, 131, 153, 19, 222, 20
1.1 parser 321: };
322:
1.3 ! parser 323: static const short yypact[] = { 6,
! 324: -32768, 14, 57,-32768, -17,-32768,-32768,-32768,-32768,-32768,
! 325: 16,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
! 326: 73, 35, 23, 51, 76, 16,-32768,-32768, 80,-32768,
! 327: -32768,-32768, -24,-32768,-32768,-32768,-32768, 77,-32768, 47,
! 328: -32768, 22,-32768,-32768,-32768, 77, 46,-32768, 51,-32768,
! 329: -32768, 96, 107, 88,-32768, 23,-32768, 71,-32768,-32768,
! 330: -32768, 141, 77, 90, 77, 71,-32768, 76, 90, 8,
! 331: -32768, 38, 16, 15,-32768,-32768,-32768,-32768, 9,-32768,
! 332: -32768, 22,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
! 333: 94,-32768, 83, 142,-32768, 144, 145,-32768, 186,-32768,
! 334: -32768,-32768,-32768,-32768, 90,-32768, 150, 16, 123, 152,
! 335: -32768,-32768,-32768,-32768, 173,-32768, 15, 15, 15, 15,
! 336: 15, 15, 15, 74, 15, 16, 16,-32768,-32768, 171,
! 337: 274, 91,-32768,-32768,-32768,-32768, 217,-32768, 182,-32768,
! 338: 16,-32768,-32768, 140, 140, 140, 140, 140, 118,-32768,
! 339: 232,-32768, 180, 170,-32768, 15, 15, 15, 15, 15,
! 340: 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
! 341: 15, 15, 15, 15, 15, 15, 15, 15, 15, 40,
! 342: 16, 15, 48,-32768,-32768,-32768,-32768,-32768, 16,-32768,
! 343: -32768,-32768, 361, 334, 304, 386, 386, 113, 113, 386,
! 344: 386, 386, 386, 113, 113, 140, 386, 386, 194, 239,
! 345: 118, -4, -4,-32768,-32768,-32768, 125,-32768, 136,-32768,
! 346: -32768,-32768,-32768, 60,-32768, -20,-32768,-32768,-32768,-32768,
! 347: -32768,-32768,-32768, 40, 16,-32768, 15,-32768,-32768,-32768,
! 348: -32768, 233, 236,-32768
1.1 parser 349: };
350:
351: static const short yypgoto[] = {-32768,
1.3 ! parser 352: -32768,-32768, 248,-32768,-32768,-32768, 163,-32768,-32768,-32768,
! 353: 201,-32768,-32768,-32768, 2, -21, -8, -71,-32768, 0,
! 354: -32768,-32768, 67,-32768,-32768, -30,-32768,-32768,-32768,-32768,
! 355: -32768,-32768,-32768,-32768,-32768,-32768, 184,-32768,-32768,-32768,
! 356: 4,-32768,-32768,-32768,-32768, 81,-32768,-32768,-32768,-32768,
! 357: -32768,-32768, 26, 34, 42,-32768,-32768, -12, 82, 72,
! 358: -32768, 54, 3,-32768,-32768,-32768, 222,-32768, 221, 277,
! 359: -32768,-32768, 223, 39, 168,-32768, 224, -45
1.1 parser 360: };
361:
362:
1.3 ! parser 363: #define YYLAST 423
1.1 parser 364:
365:
366: static const short yytable[] = { 15,
1.3 ! parser 367: 109, 10, 51, 18, 70, 42, 94, 98, 101, 1,
! 368: 15, 1, 67, 55, 18, 84, 72, 21, 116, 1,
! 369: 73, 2, 237, 74, -98, 15, 60, 69, 238, 18,
! 370: 177, 178, 179, 85, 84, 117, 118, 119, 120, 55,
! 371: 82, 107, 121, 217, 2, 134, 122, 123, 42, 3,
! 372: 230, 3, 56, 140, 22, 4, 106, 4, 124, 3,
! 373: 22, 51, 125, 108, 4, 4, 126, 127, -97, 15,
! 374: 105, 15, 15, 18, 115, 18, 18, 22, 56, 66,
! 375: 79, 3, 71, 3, 38, 57, 141, 4, 180, 4,
! 376: 62, 81, 181, 83, 23, 182, 86, 89, 26, 89,
! 377: 23, 24, 235, 25, 26, 236, 68, 15, 109, 80,
! 378: 95, 18, 52, 53, 56, 87, 81, 23, 24, 23,
! 379: 23, 26, 135, 26, 26, 15, 15, 38, 53, 18,
! 380: 18, 180, 51, -156, 80, 181, -97, 169, 182, 80,
! 381: 15, 172, 173, 174, 18, 175, 176, 177, 178, 179,
! 382: 175, 176, 177, 178, 179, 144, 145, 146, 147, 148,
! 383: 149, 150, 109, 151, -64, -64, -89, -89, 172, 173,
! 384: 174, 108, 175, 176, 177, 178, 179, 233, 234, 15,
! 385: 15, -14, 223, 18, 18, 136, 104, 137, 15, 138,
! 386: 232, -60, 18, 142, 193, 194, 195, 196, 197, 198,
! 387: 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
! 388: 209, 210, 211, 212, 213, 214, 215, 216, 143, 155,
! 389: 188, 189, 192, 173, 174, 108, 175, 176, 177, 178,
! 390: 179, 191, 243, 15, 15, 244, 223, 18, 18, 156,
! 391: 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,
! 392: 167, 168, 50, 133, 100, 111, 169, 170, 171, 239,
! 393: 172, 173, 174, 231, 175, 176, 177, 178, 179, 174,
! 394: 241, 175, 176, 177, 178, 179, 240, 102, 103, 46,
! 395: 190, 156, 157, 158, 159, 160, 161, 162, 163, 164,
! 396: 165, 166, 167, 168, 154, 114, 130, 0, 169, 170,
! 397: 171, 0, 172, 173, 174, 0, 175, 176, 177, 178,
! 398: 179, 156, 157, 0, 159, 160, 161, 162, 163, 164,
! 399: 165, 166, 167, 168, 0, 0, 0, 0, 169, 170,
! 400: 171, 0, 172, 173, 174, 0, 175, 176, 177, 178,
! 401: 179, 156, 0, 0, 159, 160, 161, 162, 163, 164,
! 402: 165, 166, 167, 168, 0, 0, 0, 0, 169, 170,
! 403: 171, 0, 172, 173, 174, 0, 175, 176, 177, 178,
! 404: 179, 159, 160, 161, 162, 163, 164, 165, 166, 167,
! 405: 168, 0, 0, 0, 0, 169, 170, 171, 0, 172,
! 406: 173, 174, 0, 175, 176, 177, 178, 179, 161, 162,
! 407: 0, 0, 0, 0, 167, 168, 0, 0, 0, 0,
! 408: 169, 0, 0, 0, 172, 173, 174, 0, 175, 176,
! 409: 177, 178, 179
1.1 parser 410: };
411:
412: static const short yycheck[] = { 0,
1.3 ! parser 413: 72, 0, 11, 0, 26, 3, 52, 53, 54, 4,
! 414: 11, 4, 25, 5, 11, 46, 41, 4, 4, 4,
! 415: 45, 39, 43, 48, 3, 26, 4, 25, 49, 26,
! 416: 35, 36, 37, 46, 65, 21, 22, 23, 24, 5,
! 417: 38, 4, 28, 4, 39, 91, 32, 33, 46, 44,
! 418: 3, 44, 44, 99, 4, 50, 49, 50, 44, 44,
! 419: 4, 70, 48, 72, 50, 50, 52, 53, 47, 70,
! 420: 68, 72, 73, 70, 73, 72, 73, 4, 44, 4,
! 421: 4, 44, 3, 44, 3, 51, 108, 50, 41, 50,
! 422: 24, 38, 45, 47, 44, 48, 51, 4, 48, 4,
! 423: 44, 45, 43, 47, 48, 46, 25, 108, 180, 38,
! 424: 4, 108, 40, 41, 44, 49, 63, 44, 45, 44,
! 425: 44, 48, 40, 48, 48, 126, 127, 46, 41, 126,
! 426: 127, 41, 141, 40, 63, 45, 47, 25, 48, 68,
! 427: 141, 29, 30, 31, 141, 33, 34, 35, 36, 37,
! 428: 33, 34, 35, 36, 37, 117, 118, 119, 120, 121,
! 429: 122, 123, 234, 125, 42, 43, 42, 43, 29, 30,
! 430: 31, 180, 33, 34, 35, 36, 37, 42, 43, 180,
! 431: 181, 40, 181, 180, 181, 42, 46, 43, 189, 4,
! 432: 189, 42, 189, 42, 156, 157, 158, 159, 160, 161,
! 433: 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
! 434: 172, 173, 174, 175, 176, 177, 178, 179, 46, 49,
! 435: 4, 40, 53, 30, 31, 234, 33, 34, 35, 36,
! 436: 37, 52, 0, 234, 235, 0, 235, 234, 235, 8,
! 437: 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
! 438: 19, 20, 5, 91, 54, 72, 25, 26, 27, 234,
! 439: 29, 30, 31, 183, 33, 34, 35, 36, 37, 31,
! 440: 237, 33, 34, 35, 36, 37, 235, 56, 58, 3,
! 441: 49, 8, 9, 10, 11, 12, 13, 14, 15, 16,
! 442: 17, 18, 19, 20, 127, 72, 74, -1, 25, 26,
! 443: 27, -1, 29, 30, 31, -1, 33, 34, 35, 36,
! 444: 37, 8, 9, -1, 11, 12, 13, 14, 15, 16,
! 445: 17, 18, 19, 20, -1, -1, -1, -1, 25, 26,
! 446: 27, -1, 29, 30, 31, -1, 33, 34, 35, 36,
! 447: 37, 8, -1, -1, 11, 12, 13, 14, 15, 16,
! 448: 17, 18, 19, 20, -1, -1, -1, -1, 25, 26,
! 449: 27, -1, 29, 30, 31, -1, 33, 34, 35, 36,
! 450: 37, 11, 12, 13, 14, 15, 16, 17, 18, 19,
! 451: 20, -1, -1, -1, -1, 25, 26, 27, -1, 29,
! 452: 30, 31, -1, 33, 34, 35, 36, 37, 13, 14,
! 453: -1, -1, -1, -1, 19, 20, -1, -1, -1, -1,
! 454: 25, -1, -1, -1, 29, 30, 31, -1, 33, 34,
! 455: 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
1219: O(yyval, OP_CONSTRUCT_EXPR); /* value=pop; name=pop; context=pop; construct(context,name,value) */
1220: ;
1221: break;}
1222: case 58:
1.2 parser 1223: #line 317 "compile.y"
1.1 parser 1224: {
1225: // stack: context, name
1226: yyval=N(POOL);
1227: CCA(yyval, yyvsp[-1]); /* code=pop; name=pop; context=pop; construct(context,name,junction(code)) */
1228: ;
1229: break;}
1230: case 62:
1.2 parser 1231: #line 328 "compile.y"
1.1 parser 1232: {
1233: yyval=N(POOL);
1234: O(yyval, OP_CREATE_EWPOOL); /* stack: empty write context */
1235: P(yyval, yyvsp[0]); /* some code that writes to that context */
1236: O(yyval, OP_REDUCE_EWPOOL); /* context=pop; stack: context.value() */
1237: ;
1238: break;}
1239: case 65:
1.2 parser 1240: #line 335 "compile.y"
1.1 parser 1241: { yyval=yyvsp[-1]; P(yyval, yyvsp[0]) ;
1242: break;}
1243: case 66:
1.2 parser 1244: #line 339 "compile.y"
1.1 parser 1245: {
1246: yyval=yyvsp[0]; /* stack: value */
1247: O(yyval, OP_WRITE_VALUE); /* value=pop; wcontext.write(value) */
1248: ;
1249: break;}
1250: case 67:
1.2 parser 1251: #line 343 "compile.y"
1.1 parser 1252: { PC.object_constructor_allowed=true ;
1253: break;}
1254: case 68:
1.2 parser 1255: #line 344 "compile.y"
1.1 parser 1256: { PC.object_constructor_allowed=false ;
1257: break;}
1258: case 69:
1.2 parser 1259: #line 345 "compile.y"
1.1 parser 1260: { /* ^field.$method{vasya} */
1261: yyval=yyvsp[-3]; /* with_xxx,diving code; stack: context,method_junction */
1262: O(yyval, OP_GET_METHOD_FRAME); /* stack: context,method_frame */
1263:
1264: YYSTYPE params_code=yyvsp[-1];
1265: if(params_code->size()==3) // probably [] case. [OP_VALUE + Void + STORE_PARAM]
1266: if(Value *value=LA2V(params_code)) // it is OP_VALUE + value?
1267: if(!value->is_defined()) // value is VVoid?
1268: params_code=0; // ^zzz[] case. don't append lone empty param.
1269: if(params_code)
1270: P(yyval, params_code); // filling method_frame.store_params
1271: O(yyval, OP_CALL); // method_frame=pop; ncontext=pop; call(ncontext,method_frame) stack: value
1272: ;
1273: break;}
1274: case 72:
1.2 parser 1275: #line 361 "compile.y"
1.1 parser 1276: { yyval=yyvsp[-1]; P(yyval, yyvsp[0]) ;
1277: break;}
1278: case 76:
1.2 parser 1279: #line 367 "compile.y"
1.1 parser 1280: {yyval=yyvsp[-1];
1281: break;}
1282: case 77:
1.2 parser 1283: #line 368 "compile.y"
1.1 parser 1284: {yyval=yyvsp[-1];
1285: break;}
1286: case 78:
1.2 parser 1287: #line 369 "compile.y"
1.1 parser 1288: {yyval=yyvsp[-1];
1289: break;}
1290: case 80:
1.2 parser 1291: #line 372 "compile.y"
1.1 parser 1292: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]) ;
1293: break;}
1294: case 82:
1.2 parser 1295: #line 376 "compile.y"
1.1 parser 1296: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]) ;
1297: break;}
1298: case 84:
1.2 parser 1299: #line 380 "compile.y"
1.1 parser 1300: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]) ;
1301: break;}
1302: case 85:
1.2 parser 1303: #line 382 "compile.y"
1.1 parser 1304: {
1305: yyval=yyvsp[0];
1306: O(yyval, OP_STORE_PARAM);
1307: ;
1308: break;}
1309: case 86:
1.2 parser 1310: #line 386 "compile.y"
1.1 parser 1311: {
1312: yyval=N(POOL);
1313: PEA(yyval, yyvsp[0]);
1314: ;
1315: break;}
1316: case 87:
1.2 parser 1317: #line 390 "compile.y"
1.1 parser 1318: {
1319: yyval=N(POOL);
1320: PCA(yyval, yyvsp[0]);
1321: ;
1322: break;}
1323: case 91:
1.2 parser 1324: #line 399 "compile.y"
1.1 parser 1325: {
1326: yyval=yyvsp[0];
1327: O(yyval, OP_WRITE_EXPR_RESULT);
1328: ;
1329: break;}
1330: case 93:
1.2 parser 1331: #line 406 "compile.y"
1.1 parser 1332: { yyval=yyvsp[-1]; P(yyval, yyvsp[0]) ;
1333: break;}
1334: case 95:
1.2 parser 1335: #line 408 "compile.y"
1.1 parser 1336: { yyval=yyvsp[-1]; P(yyval, yyvsp[0]) ;
1337: break;}
1338: case 97:
1.2 parser 1339: #line 410 "compile.y"
1.1 parser 1340: {
1341: /* stack: context */
1342: yyval=yyvsp[0]; /* stack: context,name */
1343: O(yyval, OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1344: ;
1345: break;}
1346: case 98:
1.2 parser 1347: #line 415 "compile.y"
1.1 parser 1348: {
1349: /* stack: context */
1350: yyval=yyvsp[0]; /* stack: context,name */
1351: O(yyval, OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1352: ;
1353: break;}
1.3 ! parser 1354: case 104:
! 1355: #line 428 "compile.y"
1.1 parser 1356: {
1357: yyval=yyvsp[0];
1358: O(yyval, OP_GET_ELEMENT);
1359: ;
1360: break;}
1.3 ! parser 1361: case 105:
! 1362: #line 432 "compile.y"
1.1 parser 1363: {
1364: yyval=N(POOL);
1365: O(yyval, OP_CREATE_EWPOOL);
1366: P(yyval, yyvsp[-1]);
1367: O(yyval, OP_WRITE_VALUE);
1368: P(yyval, yyvsp[0]);
1369: O(yyval, OP_REDUCE_EWPOOL);
1370: ;
1371: break;}
1.3 ! parser 1372: case 106:
! 1373: #line 440 "compile.y"
! 1374: {
! 1375: yyval=N(POOL);
! 1376: O(yyval, OP_CREATE_EWPOOL);
! 1377: P(yyval, yyvsp[-1]);
! 1378: O(yyval, OP_REDUCE_EWPOOL);
! 1379: ;
! 1380: break;}
! 1381: case 107:
! 1382: #line 446 "compile.y"
1.1 parser 1383: {
1384: yyval=N(POOL);
1385: O(yyval, OP_WITH_READ);
1386: P(yyval, yyvsp[0]);
1387: ;
1388: break;}
1.3 ! parser 1389: case 109:
! 1390: #line 451 "compile.y"
1.1 parser 1391: { yyval=yyvsp[-1]; P(yyval, yyvsp[0]) ;
1392: break;}
1.3 ! parser 1393: case 110:
! 1394: #line 452 "compile.y"
1.1 parser 1395: {
1396: yyval=yyvsp[0];
1397: O(yyval, OP_GET_ELEMENT__WRITE);
1398: ;
1399: break;}
1.3 ! parser 1400: case 113:
! 1401: #line 461 "compile.y"
1.1 parser 1402: {
1403: yyval=yyvsp[-1]; // stack: class name string
1404: O(yyval, OP_GET_CLASS);
1405: ;
1406: break;}
1.3 ! parser 1407: case 114:
! 1408: #line 465 "compile.y"
1.1 parser 1409: {
1410: yyval=yyvsp[-1];
1411: if(!PC.object_constructor_allowed) {
1412: strcpy(PC.error, ":: not allowed here");
1413: YYERROR;
1414: }
1415: O(yyval, OP_PREPARE_TO_CONSTRUCT_OBJECT);
1416: ;
1417: break;}
1.3 ! parser 1418: case 115:
! 1419: #line 477 "compile.y"
1.1 parser 1420: {
1421: if((yyval=yyvsp[0])->size()==2) // only one string literal in there?
1422: change_string_literal_to_double_literal(yyval); // make that string literal Double
1423: ;
1424: break;}
1.3 ! parser 1425: case 119:
! 1426: #line 485 "compile.y"
1.1 parser 1427: { yyval = yyvsp[-1]; ;
1428: break;}
1.3 ! parser 1429: case 120:
! 1430: #line 486 "compile.y"
1.1 parser 1431: { yyval = yyvsp[-1]; ;
1432: break;}
1.3 ! parser 1433: case 121:
! 1434: #line 487 "compile.y"
1.1 parser 1435: { yyval = yyvsp[-1]; ;
1436: break;}
1.3 ! parser 1437: case 122:
! 1438: #line 489 "compile.y"
1.1 parser 1439: { yyval=yyvsp[0]; O(yyval, OP_NEG) ;
1440: break;}
1.3 ! parser 1441: case 123:
! 1442: #line 490 "compile.y"
1.1 parser 1443: { yyval=yyvsp[0]; O(yyval, OP_INV) ;
1444: break;}
1.3 ! parser 1445: case 124:
! 1446: #line 491 "compile.y"
1.1 parser 1447: { yyval=yyvsp[0]; O(yyval, OP_NOT) ;
1448: break;}
1.3 ! parser 1449: case 125:
! 1450: #line 492 "compile.y"
1.1 parser 1451: { yyval=yyvsp[0]; O(yyval, OP_DEF) ;
1452: break;}
1.3 ! parser 1453: case 126:
! 1454: #line 493 "compile.y"
1.1 parser 1455: { yyval=yyvsp[0]; O(yyval, OP_IN) ;
1456: break;}
1.3 ! parser 1457: case 127:
! 1458: #line 494 "compile.y"
1.1 parser 1459: { yyval=yyvsp[0]; O(yyval, OP_FEXISTS) ;
1460: break;}
1.3 ! parser 1461: case 128:
! 1462: #line 495 "compile.y"
1.1 parser 1463: { yyval=yyvsp[0]; O(yyval, OP_DEXISTS) ;
1464: break;}
1.3 ! parser 1465: case 129:
! 1466: #line 497 "compile.y"
1.1 parser 1467: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_SUB) ;
1468: break;}
1.3 ! parser 1469: case 130:
! 1470: #line 498 "compile.y"
1.1 parser 1471: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_ADD) ;
1472: break;}
1.3 ! parser 1473: case 131:
! 1474: #line 499 "compile.y"
1.1 parser 1475: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_MUL) ;
1476: break;}
1.3 ! parser 1477: case 132:
! 1478: #line 500 "compile.y"
1.1 parser 1479: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_DIV) ;
1480: break;}
1.3 ! parser 1481: case 133:
! 1482: #line 501 "compile.y"
1.1 parser 1483: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_MOD) ;
1484: break;}
1.3 ! parser 1485: case 134:
! 1486: #line 502 "compile.y"
1.1 parser 1487: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_BIN_AND) ;
1488: break;}
1.3 ! parser 1489: case 135:
! 1490: #line 503 "compile.y"
1.1 parser 1491: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_BIN_OR) ;
1492: break;}
1.3 ! parser 1493: case 136:
! 1494: #line 504 "compile.y"
1.1 parser 1495: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_BIN_XOR) ;
1496: break;}
1.3 ! parser 1497: case 137:
! 1498: #line 505 "compile.y"
1.1 parser 1499: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_LOG_AND) ;
1500: break;}
1.3 ! parser 1501: case 138:
! 1502: #line 506 "compile.y"
1.1 parser 1503: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_LOG_OR) ;
1504: break;}
1.3 ! parser 1505: case 139:
! 1506: #line 507 "compile.y"
1.1 parser 1507: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_LOG_XOR) ;
1508: break;}
1.3 ! parser 1509: case 140:
! 1510: #line 508 "compile.y"
1.1 parser 1511: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_NUM_LT) ;
1512: break;}
1.3 ! parser 1513: case 141:
! 1514: #line 509 "compile.y"
1.1 parser 1515: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_NUM_GT) ;
1516: break;}
1.3 ! parser 1517: case 142:
! 1518: #line 510 "compile.y"
1.1 parser 1519: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_NUM_LE) ;
1520: break;}
1.3 ! parser 1521: case 143:
! 1522: #line 511 "compile.y"
1.1 parser 1523: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_NUM_GE) ;
1524: break;}
1.3 ! parser 1525: case 144:
! 1526: #line 512 "compile.y"
1.1 parser 1527: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_NUM_EQ) ;
1528: break;}
1.3 ! parser 1529: case 145:
! 1530: #line 513 "compile.y"
1.1 parser 1531: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_NUM_NE) ;
1532: break;}
1.3 ! parser 1533: case 146:
! 1534: #line 514 "compile.y"
1.1 parser 1535: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_STR_LT) ;
1536: break;}
1.3 ! parser 1537: case 147:
! 1538: #line 515 "compile.y"
1.1 parser 1539: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_STR_GT) ;
1540: break;}
1.3 ! parser 1541: case 148:
! 1542: #line 516 "compile.y"
1.1 parser 1543: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_STR_LE) ;
1544: break;}
1.3 ! parser 1545: case 149:
! 1546: #line 517 "compile.y"
1.1 parser 1547: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_STR_GE) ;
1548: break;}
1.3 ! parser 1549: case 150:
! 1550: #line 518 "compile.y"
1.1 parser 1551: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_STR_EQ) ;
1552: break;}
1.3 ! parser 1553: case 151:
! 1554: #line 519 "compile.y"
1.1 parser 1555: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_STR_NE) ;
1556: break;}
1.3 ! parser 1557: case 152:
! 1558: #line 520 "compile.y"
1.1 parser 1559: { yyval=yyvsp[-2]; P(yyval, yyvsp[0]); O(yyval, OP_IS) ;
1560: break;}
1.3 ! parser 1561: case 153:
! 1562: #line 523 "compile.y"
1.1 parser 1563: {
1564: yyval=N(POOL);
1565: O(yyval, OP_CREATE_SWPOOL); /* stack: empty write context */
1566: P(yyval, yyvsp[0]); /* some code that writes to that context */
1567: O(yyval, OP_REDUCE_SWPOOL); /* context=pop; stack: context.get_string() */
1568: ;
1569: break;}
1.3 ! parser 1570: case 154:
! 1571: #line 532 "compile.y"
1.1 parser 1572: {
1573: // optimized from OP_STRING+OP_WRITE_VALUE to OP_STRING__WRITE
1574: change_string_literal_to_write_string_literal(yyval=yyvsp[0])
1575: ;
1576: break;}
1.3 ! parser 1577: case 155:
! 1578: #line 537 "compile.y"
1.1 parser 1579: { yyval=VL(NEW VVoid(POOL)) ;
1580: break;}
1.3 ! parser 1581: case 156:
! 1582: #line 538 "compile.y"
1.1 parser 1583: { yyval=N(POOL) ;
1584: break;}
1585: }
1586: /* the action file gets copied in in place of this dollarsign */
1587: #line 543 "D:/cygwin/usr/share/bison.simple"
1588:
1589: yyvsp -= yylen;
1590: yyssp -= yylen;
1591: #ifdef YYLSP_NEEDED
1592: yylsp -= yylen;
1593: #endif
1594:
1595: #if YYDEBUG != 0
1596: if (yydebug)
1597: {
1598: short *ssp1 = yyss - 1;
1599: fprintf (stderr, "state stack now");
1600: while (ssp1 != yyssp)
1601: fprintf (stderr, " %d", *++ssp1);
1602: fprintf (stderr, "\n");
1603: }
1604: #endif
1605:
1606: *++yyvsp = yyval;
1607:
1608: #ifdef YYLSP_NEEDED
1609: yylsp++;
1610: if (yylen == 0)
1611: {
1612: yylsp->first_line = yylloc.first_line;
1613: yylsp->first_column = yylloc.first_column;
1614: yylsp->last_line = (yylsp-1)->last_line;
1615: yylsp->last_column = (yylsp-1)->last_column;
1616: yylsp->text = 0;
1617: }
1618: else
1619: {
1620: yylsp->last_line = (yylsp+yylen-1)->last_line;
1621: yylsp->last_column = (yylsp+yylen-1)->last_column;
1622: }
1623: #endif
1624:
1625: /* Now "shift" the result of the reduction.
1626: Determine what state that goes to,
1627: based on the state we popped back to
1628: and the rule number reduced by. */
1629:
1630: yyn = yyr1[yyn];
1631:
1632: yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1633: if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1634: yystate = yytable[yystate];
1635: else
1636: yystate = yydefgoto[yyn - YYNTBASE];
1637:
1638: goto yynewstate;
1639:
1640: yyerrlab: /* here on detecting error */
1641:
1642: if (! yyerrstatus)
1643: /* If not already recovering from an error, report this error. */
1644: {
1645: ++yynerrs;
1646:
1647: #ifdef YYERROR_VERBOSE
1648: yyn = yypact[yystate];
1649:
1650: if (yyn > YYFLAG && yyn < YYLAST)
1651: {
1652: int size = 0;
1653: char *msg;
1654: int x, count;
1655:
1656: count = 0;
1657: /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1658: for (x = (yyn < 0 ? -yyn : 0);
1659: x < (sizeof(yytname) / sizeof(char *)); x++)
1660: if (yycheck[x + yyn] == x)
1661: size += strlen(yytname[x]) + 15, count++;
1662: msg = (char *) malloc(size + 15);
1663: if (msg != 0)
1664: {
1665: strcpy(msg, "parse error");
1666:
1667: if (count < 5)
1668: {
1669: count = 0;
1670: for (x = (yyn < 0 ? -yyn : 0);
1671: x < (sizeof(yytname) / sizeof(char *)); x++)
1672: if (yycheck[x + yyn] == x)
1673: {
1674: strcat(msg, count == 0 ? ", expecting `" : " or `");
1675: strcat(msg, yytname[x]);
1676: strcat(msg, "'");
1677: count++;
1678: }
1679: }
1680: yyerror(msg);
1681: free(msg);
1682: }
1683: else
1684: yyerror ("parse error; also virtual memory exceeded");
1685: }
1686: else
1687: #endif /* YYERROR_VERBOSE */
1688: yyerror("parse error");
1689: }
1690:
1691: goto yyerrlab1;
1692: yyerrlab1: /* here on error raised explicitly by an action */
1693:
1694: if (yyerrstatus == 3)
1695: {
1696: /* if just tried and failed to reuse lookahead token after an error, discard it. */
1697:
1698: /* return failure if at end of input */
1699: if (yychar == YYEOF)
1700: YYABORT;
1701:
1702: #if YYDEBUG != 0
1703: if (yydebug)
1704: fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1705: #endif
1706:
1707: yychar = YYEMPTY;
1708: }
1709:
1710: /* Else will try to reuse lookahead token
1711: after shifting the error token. */
1712:
1713: yyerrstatus = 3; /* Each real token shifted decrements this */
1714:
1715: goto yyerrhandle;
1716:
1717: yyerrdefault: /* current state does not do anything special for the error token. */
1718:
1719: #if 0
1720: /* This is wrong; only states that explicitly want error tokens
1721: should shift them. */
1722: yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1723: if (yyn) goto yydefault;
1724: #endif
1725:
1726: yyerrpop: /* pop the current state because it cannot handle the error token */
1727:
1728: if (yyssp == yyss) YYABORT;
1729: yyvsp--;
1730: yystate = *--yyssp;
1731: #ifdef YYLSP_NEEDED
1732: yylsp--;
1733: #endif
1734:
1735: #if YYDEBUG != 0
1736: if (yydebug)
1737: {
1738: short *ssp1 = yyss - 1;
1739: fprintf (stderr, "Error: state stack now");
1740: while (ssp1 != yyssp)
1741: fprintf (stderr, " %d", *++ssp1);
1742: fprintf (stderr, "\n");
1743: }
1744: #endif
1745:
1746: yyerrhandle:
1747:
1748: yyn = yypact[yystate];
1749: if (yyn == YYFLAG)
1750: goto yyerrdefault;
1751:
1752: yyn += YYTERROR;
1753: if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1754: goto yyerrdefault;
1755:
1756: yyn = yytable[yyn];
1757: if (yyn < 0)
1758: {
1759: if (yyn == YYFLAG)
1760: goto yyerrpop;
1761: yyn = -yyn;
1762: goto yyreduce;
1763: }
1764: else if (yyn == 0)
1765: goto yyerrpop;
1766:
1767: if (yyn == YYFINAL)
1768: YYACCEPT;
1769:
1770: #if YYDEBUG != 0
1771: if (yydebug)
1772: fprintf(stderr, "Shifting error token, ");
1773: #endif
1774:
1775: *++yyvsp = yylval;
1776: #ifdef YYLSP_NEEDED
1777: *++yylsp = yylloc;
1778: #endif
1779:
1780: yystate = yyn;
1781: goto yynewstate;
1782:
1783: yyacceptlab:
1784: /* YYACCEPT comes here. */
1785: if (yyfree_stacks)
1786: {
1787: free (yyss);
1788: free (yyvs);
1789: #ifdef YYLSP_NEEDED
1790: free (yyls);
1791: #endif
1792: }
1793: return 0;
1794:
1795: yyabortlab:
1796: /* YYABORT comes here. */
1797: if (yyfree_stacks)
1798: {
1799: free (yyss);
1800: free (yyvs);
1801: #ifdef YYLSP_NEEDED
1802: free (yyls);
1803: #endif
1804: }
1805: return 1;
1806: }
1.3 ! parser 1807: #line 540 "compile.y"
1.1 parser 1808:
1809: #endif
1810:
1811: /*
1812: 000$111(2222)00
1813: 000$111{3333}00
1814: $,^: push,=0
1815: 1:( { break=pop
1816: 2:( ) pop
1817: 3:{ } pop
1818:
1819: 000^111(2222)4444{33333}4000
1820: $,^: push,=0
1821: 1:( { break=pop
1822: 2:( )=4
1823: 3:{ }=4
1824: 4:[^({]=pop
1825: */
1826:
1827: static int yylex(YYSTYPE *lvalp, void *pc) {
1828: #define lexical_brackets_nestage PC.brackets_nestages[PC.sp]
1829: #define RC {result=c; goto break2; }
1830:
1831: register int c;
1832: int result;
1833:
1834: if(PC.pending_state) {
1835: result=PC.pending_state;
1836: PC.pending_state=0;
1837: return result;
1838: }
1839:
1840: const char *begin=PC.source;
1841: const char *end;
1842: int begin_line=PC.line;
1843: int skip_analized=0;
1844: while(true) {
1845: c=*(end=(PC.source++));
1846:
1847: if(c=='\n') {
1848: PC.line++;
1849: PC.col=0;
1850: } else
1851: PC.col++;
1852:
1853: if(c=='^' && PC.ls!=LS_COMMENT && PC.ls!=LS_DEF_COMMENT)
1854: switch(*PC.source) {
1855: // escaping: ^^ & co
1856: case '^': case '$': case ';':
1857: case '(': case ')':
1858: case '[': case ']':
1859: case '{': case '}':
1860: case '"':
1861: if(end!=begin) {
1862: // append piece till ^
1863: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line);
1864: }
1865: // reset piece 'begin' position & line
1866: begin=PC.source; // ^
1867: begin_line=PC.line;
1868: // skip over ^ and _
1869: PC.source++; PC.col++;
1870: // skip analysis = forced literal
1871: continue;
1872:
1873: // converting ^#HH into char(hex(HH))
1874: case '#':
1875: if(end!=begin) {
1876: // append piece till ^
1877: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line);
1878: }
1879: // #HH ?
1880: if(PC.source[0]=='#' && PC.source[1] && PC.source[2]) {
1881: char *hex=(char *)POOL.malloc(1);
1882: hex[0]=
1883: hex_value[(unsigned char)PC.source[1]]*0x10+
1884: hex_value[(unsigned char)PC.source[2]];
1885: if(hex[0]==0) {
1886: result=BAD_HEX_LITERAL;
1887: goto break2; // wrong hex value[no ^#00 chars allowed]: bail out
1888: }
1889: // append char(hex(HH))
1890: PC.string->APPEND_CLEAN(hex, 1, PC.file, begin_line);
1891: // skip over ^#HH
1892: PC.source+=3;
1893: PC.col+=3;
1894: // reset piece 'begin' position & line
1895: begin=PC.source; // ^
1896: begin_line=PC.line;
1897: continue;
1898: }
1899: break;
1900: }
1901: // #comment start skipping
1902: if(c=='#' && PC.col==1) {
1903: if(end!=begin) {
1904: // append piece till #
1905: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line);
1906: }
1907: // fall into COMMENT lexical state [wait for \n]
1908: push_LS(PC, LS_COMMENT);
1909: }
1910: switch(PC.ls) {
1911:
1912: // USER'S = NOT OURS
1913: case LS_USER:
1914: if(PC.trim_bof)
1915: switch(c) {
1916: case '\n': case ' ': case '\t':
1917: begin=PC.source;
1918: begin_line=PC.line;
1919: continue; // skip it
1920: default:
1921: PC.trim_bof=false;
1922: }
1923: switch(c) {
1924: case '$':
1925: push_LS(PC, LS_VAR_NAME_SIMPLE);
1926: RC;
1927: case '^':
1928: push_LS(PC, LS_METHOD_NAME);
1929: RC;
1930: case '@':
1931: if(PC.col==0+1) {
1932: push_LS(PC, LS_DEF_NAME);
1933: RC;
1934: }
1935: break;
1.3 ! parser 1936: case ')': // $name.(code<)>
! 1937: if(--lexical_brackets_nestage==0) {
! 1938: pop_LS(PC);
! 1939: RC;
! 1940: }
! 1941: break;
1.1 parser 1942: }
1943: break;
1944:
1945: // #COMMENT
1946: case LS_COMMENT:
1947: if(c=='\n') {
1948: // skip comment
1949: begin=PC.source;
1950: begin_line=PC.line;
1951:
1952: pop_LS(PC);
1953: continue;
1954: }
1955: break;
1956:
1957: // STRING IN EXPRESSION
1958: case LS_EXPRESSION_STRING_QUOTED:
1959: case LS_EXPRESSION_STRING_APOSTROFED:
1960: switch(c) {
1961: case '"':
1962: case '\'':
1963: if(
1964: PC.ls == LS_EXPRESSION_STRING_QUOTED && c=='"' ||
1965: PC.ls == LS_EXPRESSION_STRING_APOSTROFED && c=='\'') {
1966: pop_LS(PC); //"abc". | 'abc'.
1967: RC;
1968: }
1969: break;
1970: case '$':
1971: push_LS(PC, LS_VAR_NAME_SIMPLE);
1972: RC;
1973: case '^':
1974: push_LS(PC, LS_METHOD_NAME);
1975: RC;
1976: }
1977: break;
1978:
1979: // METHOD DEFINITION
1980: case LS_DEF_NAME:
1981: switch(c) {
1982: case '[':
1983: PC.ls=LS_DEF_PARAMS;
1984: RC;
1985: case '\n':
1986: PC.ls=LS_DEF_SPECIAL_BODY;
1987: RC;
1988: }
1989: break;
1990:
1991: case LS_DEF_PARAMS:
1992: switch(c) {
1993: case ';':
1994: RC;
1995: case ']':
1996: PC.ls=*PC.source=='['?LS_DEF_LOCALS:LS_DEF_COMMENT;
1997: RC;
1998: case '\n': // wrong. bailing out
1999: pop_LS(PC);
2000: RC;
2001: }
2002: break;
2003:
2004: case LS_DEF_LOCALS:
2005: switch(c) {
2006: case '[':
2007: case ';':
2008: RC;
2009: case ']':
2010: PC.ls=LS_DEF_COMMENT;
2011: RC;
2012: case '\n': // wrong. bailing out
2013: pop_LS(PC);
2014: RC;
2015: }
2016: break;
2017:
2018: case LS_DEF_COMMENT:
2019: if(c=='\n') {
2020: pop_LS(PC);
2021: RC;
2022: }
2023: break;
2024:
2025: case LS_DEF_SPECIAL_BODY:
2026: // @todo in case
2027: // ################
2028: // @next-method
2029: // we are here with c=='@'
2030: // which is wrong, and need action
2031: if(c=='\n') {
2032: switch(*PC.source) {
2033: case '@': case 0: // end of special_code
2034: pop_LS(PC);
2035: break;
2036: }
2037: RC;
2038: }
2039: break;
2040:
2041: // (EXPRESSION)
2042: case LS_VAR_ROUND:
2043: case LS_METHOD_ROUND:
2044: switch(c) {
2045: case ')':
2046: if(--lexical_brackets_nestage==0)
2047: if(PC.ls==LS_METHOD_ROUND) // method round param ended
2048: PC.ls=LS_METHOD_AFTER; // look for method end
2049: else // PC.ls==LS_VAR_ROUND // variable constructor ended
2050: pop_LS(PC); // return to normal life
2051: RC;
2052: case '$':
2053: push_LS(PC, LS_EXPRESSION_VAR_NAME);
2054: RC;
2055: case '^':
2056: push_LS(PC, LS_METHOD_NAME);
2057: RC;
2058: case '(':
2059: lexical_brackets_nestage++;
2060: RC;
2061: case '-':
2062: switch(*PC.source) {
2063: case 'f': // -f
2064: skip_analized=1;
2065: result=FEXISTS;
2066: goto break2;
2067: case 'd': // -d
2068: skip_analized=1;
2069: result=DEXISTS;
2070: goto break2;
2071: default:
2072: result=c;
2073: goto break2;
2074: }
2075: goto break2;
2076: case '+': case '*': case '/': case '%':
2077: case '~':
2078: case ';':
2079: RC;
2080: case '&': case '|': case '#':
2081: if(*PC.source==c) { // && ||
2082: result=c=='#'?LXOR:c=='&'?LAND:LOR;
2083: skip_analized=1;
2084: } else
2085: result=c;
2086: goto break2;
2087: case '<': case '>': case '=': case '!':
2088: if(*PC.source=='=') { // <= >= == !=
2089: skip_analized=1;
2090: switch(c) {
2091: case '<': result=NLE; break;
2092: case '>': result=NGE; break;
2093: case '=': result=NEQ; break;
2094: case '!': result=NNE; break;
2095: }
2096: } else
2097: result=c;
2098: goto break2;
2099: case '"':
2100: push_LS(PC, LS_EXPRESSION_STRING_QUOTED);
2101: RC;
2102: case '\'':
2103: push_LS(PC, LS_EXPRESSION_STRING_APOSTROFED);
2104: RC;
2105: case 'l': case 'g': case 'e': case 'n':
2106: if(end==begin) // right after whitespace
2107: if(isspace(PC.source[1])) {
2108: switch(*PC.source) {
2109: // case '?': // ok [and bad cases, yacc would bark at them]
2110: case 't': // lt gt [et nt]
2111: result=c=='l'?SLT:c=='g'?SGT:BAD_STRING_COMPARISON_OPERATOR;
2112: skip_analized=1;
2113: goto break2;
2114: case 'e': // le ge ne [ee]
2115: result=c=='l'?SLE:c=='g'?SGE:c=='n'?SNE:BAD_STRING_COMPARISON_OPERATOR;
2116: skip_analized=1;
2117: goto break2;
2118: case 'q': // eq [lq gq nq]
2119: result=c=='e'?SEQ:BAD_STRING_COMPARISON_OPERATOR;
2120: skip_analized=1;
2121: goto break2;
2122: }
2123: }
2124: break;
2125: case 'i':
2126: if(end==begin) // right after whitespace
2127: if(isspace(PC.source[1])) {
2128: switch(PC.source[0]) {
2129: case 'n': // in
2130: skip_analized=1;
2131: result=IN;
2132: goto break2;
2133: case 's': // is
2134: skip_analized=1;
2135: result=IS;
2136: goto break2;
2137: }
2138: }
2139: break;
2140: case 'd':
2141: if(end==begin) // right after whitespace
2142: if(PC.source[0]=='e' && PC.source[1]=='f') { // def
2143: skip_analized=2;
2144: result=DEF;
2145: goto break2;
2146: }
2147: break;
2148: case ' ': case '\t': case '\n':
2149: if(end!=begin) { // there were a string after previous operator?
2150: result=0; // return that string
2151: goto break2;
2152: }
2153: // that's a leading|traling space or after-operator-space
2154: // ignoring it
2155: // reset piece 'begin' position & line
2156: begin=PC.source; // after whitespace char
2157: begin_line=PC.line;
2158: continue;
2159: }
2160: break;
2161:
2162: // VARIABLE GET/PUT/WITH
2163: case LS_VAR_NAME_SIMPLE:
2164: case LS_EXPRESSION_VAR_NAME:
2165: case LS_VAR_NAME_NO_COLON:
2166: if(PC.ls==LS_EXPRESSION_VAR_NAME) {
2167: // name in expr ends also before binary operators
2168: switch(c) {
2169: case '-':
2170: pop_LS(PC);
2171: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
2172: result=EON;
2173: goto break2;
2174: }
2175: }
2176: if(PC.ls==LS_VAR_NAME_NO_COLON) {
2177: // name already has ':', stop before next
2178: switch(c) {
2179: case ':':
2180: pop_LS(PC);
2181: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
2182: result=EON;
2183: goto break2;
2184: }
2185: }
2186: switch(c) {
2187: case 0:
2188: case ' ': case '\t': case '\n':
2189: case ';':
2190: case ']': case '}': case ')':
2191: case '"': case '\'':
2192: case '<': case '>': // these stand for HTML brackets AND expression binary ops
2193: case '+': case '*': case '/': case '%':
2194: case '&': case '|':
2195: case '=': case '!':
2196: // common delimiters
2197: case ',': case '?':
2198: // before call
2199: case '^':
2200: pop_LS(PC);
2201: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
2202: result=EON;
2203: goto break2;
2204: case '[':
2205: PC.ls=LS_VAR_SQUARE;
2206: lexical_brackets_nestage=1;
2207: RC;
2208: case '{':
2209: if(begin==end) { // ${name}, no need of EON, switching LS
2210: PC.ls=LS_VAR_NAME_CURLY;
2211: } else {
2212: PC.ls=LS_VAR_CURLY;
2213: lexical_brackets_nestage=1;
2214: }
2215:
2216: RC;
2217: case '(':
1.3 ! parser 2218: // $name.<(>code)
! 2219: if(PC.col>1/*not first column*/ && end[-1]=='.'/*was dot */) {
! 2220: push_LS(PC, LS_USER);
! 2221: lexical_brackets_nestage=1;
! 2222: RC;
! 2223: }
1.1 parser 2224: PC.ls=LS_VAR_ROUND;
2225: lexical_brackets_nestage=1;
2226: RC;
2227: case '.': // name part delim
2228: case '$': // name part subvar
1.3 ! parser 2229: case ':': // class<:>name
1.1 parser 2230: PC.ls=LS_VAR_NAME_NO_COLON; // stop before next ':'
2231: RC;
2232: }
2233: break;
2234:
2235: case LS_VAR_NAME_CURLY:
2236: switch(c) {
1.3 ! parser 2237: case '(':
! 2238: // ${name.<(>code)}
! 2239: push_LS(PC, LS_USER);
! 2240: lexical_brackets_nestage=1;
! 2241: RC;
1.1 parser 2242: case '}': // ${name} finished, restoring LS
2243: pop_LS(PC);
2244: RC;
2245: case '.': // name part delim
2246: case '$': // name part subvar
2247: case ':': // ':name' or 'class:name'
2248: RC;
2249: }
2250: break;
2251:
2252: case LS_VAR_SQUARE:
2253: switch(c) {
2254: case '$':
2255: push_LS(PC, LS_VAR_NAME_SIMPLE);
2256: RC;
2257: case '^':
2258: push_LS(PC, LS_METHOD_NAME);
2259: RC;
2260: case ']':
2261: if(--lexical_brackets_nestage==0) {
2262: pop_LS(PC);
2263: RC;
2264: }
2265: break;
2266: case ';': // operator_or_fmt;value delim
2267: RC;
2268: case '[':
2269: lexical_brackets_nestage++;
2270: break;
2271: }
2272: break;
2273:
2274: case LS_VAR_CURLY:
2275: switch(c) {
2276: case '$':
2277: push_LS(PC, LS_VAR_NAME_SIMPLE);
2278: RC;
2279: case '^':
2280: push_LS(PC, LS_METHOD_NAME);
2281: RC;
2282: case '}':
2283: if(--lexical_brackets_nestage==0) {
2284: pop_LS(PC);
2285: RC;
2286: }
2287: break;
2288: case '{':
2289: lexical_brackets_nestage++;
2290: break;
2291: }
2292: break;
2293:
2294: // METHOD CALL
2295: case LS_METHOD_NAME:
2296: switch(c) {
2297: case '[':
2298: PC.ls=LS_METHOD_SQUARE;
2299: lexical_brackets_nestage=1;
2300: RC;
2301: case '{':
2302: PC.ls=LS_METHOD_CURLY;
2303: lexical_brackets_nestage=1;
2304: RC;
2305: case '(':
1.3 ! parser 2306: // $name.<(>code)
! 2307: if(PC.col>1/*not first column*/ && end[-1]=='.'/*was dot */) {
! 2308: push_LS(PC, LS_USER);
! 2309: lexical_brackets_nestage=1;
! 2310: RC;
! 2311: }
1.1 parser 2312: PC.ls=LS_METHOD_ROUND;
2313: lexical_brackets_nestage=1;
2314: RC;
2315: case '.': // name part delim
2316: case '$': // name part subvar
2317: case ':': // ':name' or 'class:name'
2318: RC;
2319: }
2320: break;
2321:
2322: case LS_METHOD_SQUARE:
2323: switch(c) {
2324: case '$':
2325: push_LS(PC, LS_VAR_NAME_SIMPLE);
2326: RC;
2327: case '^':
2328: push_LS(PC, LS_METHOD_NAME);
2329: RC;
2330: case ';': // param delim
2331: RC;
2332: case ']':
2333: if(--lexical_brackets_nestage==0) {
2334: PC.ls=LS_METHOD_AFTER;
2335: RC;
2336: }
2337: break;
2338: case '[':
2339: lexical_brackets_nestage++;
2340: break;
2341: }
2342: break;
2343:
2344: case LS_METHOD_CURLY:
2345: switch(c) {
2346: case '$':
2347: push_LS(PC, LS_VAR_NAME_SIMPLE);
2348: RC;
2349: case '^':
2350: push_LS(PC, LS_METHOD_NAME);
2351: RC;
2352: case ';': // param delim
2353: RC;
2354: case '}':
2355: if(--lexical_brackets_nestage==0) {
2356: PC.ls=LS_METHOD_AFTER;
2357: RC;
2358: }
2359: break;
2360: case '{':
2361: lexical_brackets_nestage++;
2362: break;
2363: }
2364: break;
2365:
2366: case LS_METHOD_AFTER:
2367: if(c=='[') {/* ][ }[ )[ */
2368: PC.ls=LS_METHOD_SQUARE;
2369: lexical_brackets_nestage=1;
2370: RC;
2371: }
2372: if(c=='{') {/* ]{ }{ ){ */
2373: PC.ls=LS_METHOD_CURLY;
2374: lexical_brackets_nestage=1;
2375: RC;
2376: }
2377: if(c=='(') {/* ]( }( )( */
2378: PC.ls=LS_METHOD_ROUND;
2379: lexical_brackets_nestage=1;
2380: RC;
2381: }
2382: pop_LS(PC);
2383: PC.source--; if(--PC.col<0) { PC.line--; PC.col=-1; }
2384: result=EON;
2385: goto break2;
2386: }
2387: if(c==0) {
2388: result=-1;
2389: break;
2390: }
2391: }
2392:
2393: break2:
2394: if(end!=begin) { // there is last piece?
2395: if((c=='@' || c==0) && end[-1]=='\n') { // we are before LS_DEF_NAME or EOF?
2396: // strip last \n
2397: end--;
2398: if(end!=begin && end[-1]=='\n') // allow one empty line before LS_DEF_NAME
2399: end--;
2400: }
2401: if(end!=begin && PC.ls!=LS_COMMENT) { // last piece still alive and not comment?
2402: // append it
2403: PC.string->APPEND_CLEAN(begin, end-begin, PC.file, begin_line/*, start_col*/);
2404: }
2405: }
2406: if(PC.string->size()) { // something accumulated?
2407: // create STRING value: array of OP_VALUE+vstring
2408: *lvalp=VL(NEW VString(*PC.string));
2409: // new pieces storage
2410: PC.string=NEW String(POOL);
2411: // make current result be pending for next call, return STRING for now
2412: PC.pending_state=result; result=STRING;
2413: }
2414: if(skip_analized) {
2415: PC.source+=skip_analized; PC.col+=skip_analized;
2416: }
2417: return result;
2418: }
2419:
2420: static int real_yyerror(parse_control *pc, char *s) { // Called by yyparse on error
2421: strncpy(PC.error, s, MAX_STRING);
2422: return 1;
2423: }
2424:
2425: static void yyprint(FILE *file, int type, YYSTYPE value) {
2426: if(type==STRING)
2427: fprintf(file, " \"%s\"", LA2S(value)->cstr());
2428: }