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