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