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