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