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