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