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