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