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