Annotation of parser3/src/main/compile.tab.C, revision 1.156
1.156 ! moko 1: /* A Bison parser, made by GNU Bison 2.4.3. */
1.112 paf 2:
1.156 ! moko 3: /* Skeleton implementation for Bison's Yacc-like parsers in C
! 4:
! 5: Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
! 6: 2009, 2010 Free Software Foundation, Inc.
! 7:
! 8: This program is free software: you can redistribute it and/or modify
1.112 paf 9: it under the terms of the GNU General Public License as published by
1.156 ! moko 10: the Free Software Foundation, either version 3 of the License, or
! 11: (at your option) any later version.
! 12:
1.112 paf 13: This program is distributed in the hope that it will be useful,
14: but WITHOUT ANY WARRANTY; without even the implied warranty of
15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: GNU General Public License for more details.
1.156 ! moko 17:
! 18: You should have received a copy of the GNU General Public License
! 19: along with this program. If not, see <http://www.gnu.org/licenses/>. */
1.155 misha 20:
1.156 ! moko 21: /* As a special exception, you may create a larger work that contains
! 22: part or all of the Bison parser skeleton and distribute that work
! 23: under terms of your choice, so long as that work isn't itself a
! 24: parser generator using the skeleton or a modified version thereof
! 25: as a parser skeleton. Alternatively, if you modify or redistribute
! 26: the parser skeleton itself, you may (at your option) remove this
! 27: special exception, which will cause the skeleton and the resulting
! 28: Bison output files to be licensed under the GNU General Public
! 29: License without this special exception.
! 30:
! 31: This special exception was added by the Free Software Foundation in
! 32: version 2.2 of Bison. */
1.112 paf 33:
1.156 ! moko 34: /* C LALR(1) parser skeleton written by Richard Stallman, by
! 35: simplifying the original so-called "semantic" parser. */
1.112 paf 36:
37: /* All symbols defined below should begin with yy or YY, to avoid
38: infringing on user name space. This should be done even for local
39: variables, as they might otherwise be expanded by user macros.
40: There are some unavoidable exceptions within include files to
41: define necessary library symbols; they are noted "INFRINGES ON
42: USER NAME SPACE" below. */
43:
44: /* Identify Bison output. */
45: #define YYBISON 1
46:
1.156 ! moko 47: /* Bison version. */
! 48: #define YYBISON_VERSION "2.4.3"
! 49:
1.112 paf 50: /* Skeleton name. */
1.113 paf 51: #define YYSKELETON_NAME "yacc.c"
1.112 paf 52:
53: /* Pure parsers. */
54: #define YYPURE 1
55:
1.156 ! moko 56: /* Push parsers. */
! 57: #define YYPUSH 0
! 58:
! 59: /* Pull parsers. */
! 60: #define YYPULL 1
! 61:
1.155 misha 62: /* Using locations. */
63: #define YYLSP_NEEDED 0
64:
65:
1.154 moko 66:
1.156 ! moko 67: /* Copy the first part of user declarations. */
1.105 paf 68:
1.156 ! moko 69: /* Line 189 of yacc.c */
1.14 parser 70: #line 1 "compile.y"
1.1 parser 71:
1.14 parser 72: /** @file
73: Parser: compiler(lexical parser and grammar).
74:
1.154 moko 75: Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com)
1.27 paf 76: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.109 paf 77:
1.154 moko 78:
1.14 parser 79: */
1.1 parser 80:
1.156 ! moko 81: volatile const char * IDENT_COMPILE_Y = "$Id: compile.y,v 1.264 2013/07/16 15:10:03 moko Exp $";
1.154 moko 82:
1.1 parser 83: /**
84: @todo parser4:
85: - cache compiled code from request to request. to do that...
86: -#: make method definitions, @CLASS, @BASE, @USE instructions,
87: which would be executed afterwards, and actions
88: now performed at compile time would be delayed to run time.
89: -#: make cache expiration on time and on disk-change of class source
90: -#: in apache use subpools for compiled class storage
91: -#: in iis make up specialized Pool object for that
92: */
93:
1.84 paf 94: #define YYSTYPE ArrayOperation*
1.1 parser 95: #define YYPARSE_PARAM pc
96: #define YYLEX_PARAM pc
97: #define YYDEBUG 1
98: #define YYERROR_VERBOSE 1
1.84 paf 99: #define yyerror(msg) real_yyerror((Parse_control *)pc, msg)
1.1 parser 100: #define YYPRINT(file, type, value) yyprint(file, type, value)
101:
1.84 paf 102: // includes
103:
1.1 parser 104: #include "compile_tools.h"
105: #include "pa_value.h"
106: #include "pa_request.h"
107: #include "pa_vobject.h"
108: #include "pa_vdouble.h"
109: #include "pa_globals.h"
1.72 paf 110: #include "pa_vmethod_frame.h"
1.1 parser 111:
1.84 paf 112: // defines
113:
1.1 parser 114: #define USE_CONTROL_METHOD_NAME "USE"
1.119 misha 115: #define OPTIONS_CONTROL_METHOD_NAME "OPTIONS"
116: #define OPTION_ALL_VARS_LOCAL_NAME "locals"
1.123 misha 117: #define OPTION_PARTIAL_CLASS "partial"
1.131 misha 118: #define REM_OPERATOR_NAME "rem"
1.1 parser 119:
1.84 paf 120: // forwards
121:
1.156 ! moko 122: static int real_yyerror(Parse_control* pc, const char* s);
1.84 paf 123: static void yyprint(FILE* file, int type, YYSTYPE value);
124: static int yylex(YYSTYPE* lvalp, void* pc);
1.1 parser 125:
1.107 paf 126: static const VBool vfalse(false);
127: static const VBool vtrue(true);
1.153 moko 128: static const VString vempty;
1.107 paf 129:
1.1 parser 130: // local convinient inplace typecast & var
1.83 paf 131: #undef PC
1.84 paf 132: #define PC (*(Parse_control *)pc)
133: #undef POOL
1.1 parser 134: #define POOL (*PC.pool)
135: #ifndef DOXYGEN
1.112 paf 136:
137:
1.156 ! moko 138: /* Line 189 of yacc.c */
! 139: #line 140 "compile.tab.C"
! 140:
1.112 paf 141: /* Enabling traces. */
142: #ifndef YYDEBUG
143: # define YYDEBUG 0
1.109 paf 144: #endif
1.108 paf 145:
1.112 paf 146: /* Enabling verbose error messages. */
147: #ifdef YYERROR_VERBOSE
148: # undef YYERROR_VERBOSE
149: # define YYERROR_VERBOSE 1
150: #else
151: # define YYERROR_VERBOSE 0
1.106 paf 152: #endif
1.112 paf 153:
1.156 ! moko 154: /* Enabling the token table. */
! 155: #ifndef YYTOKEN_TABLE
! 156: # define YYTOKEN_TABLE 0
! 157: #endif
! 158:
! 159:
! 160: /* Tokens. */
! 161: #ifndef YYTOKENTYPE
! 162: # define YYTOKENTYPE
! 163: /* Put the tokens into the symbol table, so that GDB and other debuggers
! 164: know about them. */
! 165: enum yytokentype {
! 166: EON = 258,
! 167: STRING = 259,
! 168: BOGUS = 260,
! 169: BAD_STRING_COMPARISON_OPERATOR = 261,
! 170: BAD_HEX_LITERAL = 262,
! 171: BAD_METHOD_DECL_START = 263,
! 172: BAD_METHOD_PARAMETER_NAME_CHARACTER = 264,
! 173: BAD_NONWHITESPACE_CHARACTER_IN_EXPLICIT_RESULT_MODE = 265,
! 174: LAND = 266,
! 175: LOR = 267,
! 176: LXOR = 268,
! 177: NXOR = 269,
! 178: NLE = 270,
! 179: NGE = 271,
! 180: NEQ = 272,
! 181: NNE = 273,
! 182: NSL = 274,
! 183: NSR = 275,
! 184: SLT = 276,
! 185: SGT = 277,
! 186: SLE = 278,
! 187: SGE = 279,
! 188: SEQ = 280,
! 189: SNE = 281,
! 190: DEF = 282,
! 191: IN = 283,
! 192: FEXISTS = 284,
! 193: DEXISTS = 285,
! 194: IS = 286,
! 195: LITERAL_TRUE = 287,
! 196: LITERAL_FALSE = 288,
! 197: NUNARY = 289
! 198: };
! 199: #endif
! 200:
! 201:
! 202:
! 203: #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1.112 paf 204: typedef int YYSTYPE;
1.156 ! moko 205: # define YYSTYPE_IS_TRIVIAL 1
1.112 paf 206: # define yystype YYSTYPE /* obsolescent; will be withdrawn */
207: # define YYSTYPE_IS_DECLARED 1
208: #endif
209:
210:
1.156 ! moko 211: /* Copy the second part of user declarations. */
! 212:
! 213:
! 214: /* Line 264 of yacc.c */
! 215: #line 216 "compile.tab.C"
! 216:
! 217: #ifdef short
! 218: # undef short
! 219: #endif
! 220:
! 221: #ifdef YYTYPE_UINT8
! 222: typedef YYTYPE_UINT8 yytype_uint8;
! 223: #else
! 224: typedef unsigned char yytype_uint8;
! 225: #endif
! 226:
! 227: #ifdef YYTYPE_INT8
! 228: typedef YYTYPE_INT8 yytype_int8;
! 229: #elif (defined __STDC__ || defined __C99__FUNC__ \
! 230: || defined __cplusplus || defined _MSC_VER)
! 231: typedef signed char yytype_int8;
! 232: #else
! 233: typedef short int yytype_int8;
! 234: #endif
1.155 misha 235:
1.156 ! moko 236: #ifdef YYTYPE_UINT16
! 237: typedef YYTYPE_UINT16 yytype_uint16;
! 238: #else
! 239: typedef unsigned short int yytype_uint16;
! 240: #endif
1.154 moko 241:
1.156 ! moko 242: #ifdef YYTYPE_INT16
! 243: typedef YYTYPE_INT16 yytype_int16;
! 244: #else
! 245: typedef short int yytype_int16;
! 246: #endif
1.154 moko 247:
1.156 ! moko 248: #ifndef YYSIZE_T
! 249: # ifdef __SIZE_TYPE__
! 250: # define YYSIZE_T __SIZE_TYPE__
! 251: # elif defined size_t
! 252: # define YYSIZE_T size_t
! 253: # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
! 254: || defined __cplusplus || defined _MSC_VER)
! 255: # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
! 256: # define YYSIZE_T size_t
! 257: # else
! 258: # define YYSIZE_T unsigned int
! 259: # endif
! 260: #endif
1.112 paf 261:
1.156 ! moko 262: #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1.112 paf 263:
1.156 ! moko 264: #ifndef YY_
! 265: # if defined YYENABLE_NLS && YYENABLE_NLS
! 266: # if ENABLE_NLS
! 267: # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
! 268: # define YY_(msgid) dgettext ("bison-runtime", msgid)
! 269: # endif
1.114 misha 270: # endif
1.156 ! moko 271: # ifndef YY_
! 272: # define YY_(msgid) msgid
1.114 misha 273: # endif
1.156 ! moko 274: #endif
! 275:
! 276: /* Suppress unused-variable warnings by "using" E. */
! 277: #if ! defined lint || defined __GNUC__
! 278: # define YYUSE(e) ((void) (e))
! 279: #else
! 280: # define YYUSE(e) /* empty */
! 281: #endif
! 282:
! 283: /* Identity function, used to suppress warnings about constant conditions. */
! 284: #ifndef lint
! 285: # define YYID(n) (n)
! 286: #else
! 287: #if (defined __STDC__ || defined __C99__FUNC__ \
! 288: || defined __cplusplus || defined _MSC_VER)
! 289: static int
! 290: YYID (int yyi)
! 291: #else
! 292: static int
! 293: YYID (yyi)
! 294: int yyi;
! 295: #endif
! 296: {
! 297: return yyi;
! 298: }
! 299: #endif
! 300:
! 301: #if ! defined yyoverflow || YYERROR_VERBOSE
1.114 misha 302:
1.112 paf 303: /* The parser invokes alloca or malloc; define the necessary symbols. */
304:
1.113 paf 305: # ifdef YYSTACK_USE_ALLOCA
306: # if YYSTACK_USE_ALLOCA
307: # ifdef __GNUC__
308: # define YYSTACK_ALLOC __builtin_alloca
1.156 ! moko 309: # elif defined __BUILTIN_VA_ARG_INCR
! 310: # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
! 311: # elif defined _AIX
! 312: # define YYSTACK_ALLOC __alloca
! 313: # elif defined _MSC_VER
! 314: # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
! 315: # define alloca _alloca
! 316: # else
! 317: # define YYSTACK_ALLOC alloca
! 318: # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
! 319: || defined __cplusplus || defined _MSC_VER)
! 320: # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
! 321: # ifndef _STDLIB_H
! 322: # define _STDLIB_H 1
! 323: # endif
! 324: # endif
1.112 paf 325: # endif
326: # endif
327: # endif
328:
329: # ifdef YYSTACK_ALLOC
1.156 ! moko 330: /* Pacify GCC's `empty if-body' warning. */
! 331: # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
! 332: # ifndef YYSTACK_ALLOC_MAXIMUM
! 333: /* The OS might guarantee only one guard page at the bottom of the stack,
! 334: and a page size can be as small as 4096 bytes. So we cannot safely
! 335: invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
! 336: to allow for a few compiler-allocated temporary stack slots. */
! 337: # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
! 338: # endif
1.155 misha 339: # else
1.156 ! moko 340: # define YYSTACK_ALLOC YYMALLOC
! 341: # define YYSTACK_FREE YYFREE
! 342: # ifndef YYSTACK_ALLOC_MAXIMUM
! 343: # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
! 344: # endif
! 345: # if (defined __cplusplus && ! defined _STDLIB_H \
! 346: && ! ((defined YYMALLOC || defined malloc) \
! 347: && (defined YYFREE || defined free)))
1.155 misha 348: # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1.156 ! moko 349: # ifndef _STDLIB_H
! 350: # define _STDLIB_H 1
! 351: # endif
! 352: # endif
! 353: # ifndef YYMALLOC
! 354: # define YYMALLOC malloc
! 355: # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
! 356: || defined __cplusplus || defined _MSC_VER)
! 357: void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
! 358: # endif
! 359: # endif
! 360: # ifndef YYFREE
! 361: # define YYFREE free
! 362: # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
! 363: || defined __cplusplus || defined _MSC_VER)
! 364: void free (void *); /* INFRINGES ON USER NAME SPACE */
! 365: # endif
1.154 moko 366: # endif
1.112 paf 367: # endif
1.156 ! moko 368: #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1.112 paf 369:
370:
1.156 ! moko 371: #if (! defined yyoverflow \
! 372: && (! defined __cplusplus \
! 373: || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1.112 paf 374:
375: /* A type that is properly aligned for any stack member. */
376: union yyalloc
377: {
1.156 ! moko 378: yytype_int16 yyss_alloc;
! 379: YYSTYPE yyvs_alloc;
! 380: };
1.112 paf 381:
382: /* The size of the maximum gap between one aligned stack and the next. */
383: # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
384:
385: /* The size of an array large to enough to hold all stacks, each with
386: N elements. */
387: # define YYSTACK_BYTES(N) \
1.156 ! moko 388: ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1.112 paf 389: + YYSTACK_GAP_MAXIMUM)
390:
391: /* Copy COUNT objects from FROM to TO. The source and destination do
392: not overlap. */
393: # ifndef YYCOPY
1.156 ! moko 394: # if defined __GNUC__ && 1 < __GNUC__
1.112 paf 395: # define YYCOPY(To, From, Count) \
396: __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
397: # else
398: # define YYCOPY(To, From, Count) \
399: do \
400: { \
1.156 ! moko 401: YYSIZE_T yyi; \
1.112 paf 402: for (yyi = 0; yyi < (Count); yyi++) \
403: (To)[yyi] = (From)[yyi]; \
404: } \
1.156 ! moko 405: while (YYID (0))
1.112 paf 406: # endif
407: # endif
408:
409: /* Relocate STACK from its old location to the new one. The
410: local variables YYSIZE and YYSTACKSIZE give the old and new number of
411: elements in the stack, and YYPTR gives the new location of the
412: stack. Advance YYPTR to a properly aligned location for the next
413: stack. */
1.156 ! moko 414: # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
1.112 paf 415: do \
416: { \
417: YYSIZE_T yynewbytes; \
1.156 ! moko 418: YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
! 419: Stack = &yyptr->Stack_alloc; \
1.112 paf 420: yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
421: yyptr += yynewbytes / sizeof (*yyptr); \
422: } \
1.156 ! moko 423: while (YYID (0))
1.108 paf 424:
1.155 misha 425: #endif
426:
1.156 ! moko 427: /* YYFINAL -- State number of the termination state. */
1.112 paf 428: #define YYFINAL 51
429: /* YYLAST -- Last index in YYTABLE. */
1.115 misha 430: #define YYLAST 470
1.112 paf 431:
1.156 ! moko 432: /* YYNTOKENS -- Number of terminals. */
1.112 paf 433: #define YYNTOKENS 62
1.156 ! moko 434: /* YYNNTS -- Number of nonterminals. */
1.115 misha 435: #define YYNNTS 89
1.156 ! moko 436: /* YYNRULES -- Number of rules. */
1.115 misha 437: #define YYNRULES 172
1.156 ! moko 438: /* YYNRULES -- Number of states. */
1.115 misha 439: #define YYNSTATES 263
1.112 paf 440:
441: /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
442: #define YYUNDEFTOK 2
443: #define YYMAXUTOK 289
444:
1.156 ! moko 445: #define YYTRANSLATE(YYX) \
1.112 paf 446: ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
447:
448: /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1.156 ! moko 449: static const yytype_uint8 yytranslate[] =
1.112 paf 450: {
451: 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452: 48, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454: 2, 2, 2, 46, 60, 2, 52, 43, 37, 61,
455: 56, 57, 40, 38, 2, 39, 55, 41, 2, 2,
456: 2, 2, 2, 2, 2, 2, 2, 2, 59, 51,
457: 34, 2, 35, 2, 47, 2, 2, 2, 2, 2,
458: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460: 2, 49, 42, 50, 58, 2, 2, 2, 2, 2,
461: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463: 2, 2, 2, 53, 36, 54, 45, 2, 2, 2,
464: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
472: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
473: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
474: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
475: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
476: 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
477: 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
478: 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
479: 25, 26, 27, 28, 29, 30, 31, 32, 33, 44
480: };
1.105 paf 481:
1.112 paf 482: #if YYDEBUG
483: /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
484: YYRHS. */
1.156 ! moko 485: static const yytype_uint16 yyprhs[] =
1.112 paf 486: {
487: 0, 0, 3, 5, 7, 9, 12, 14, 16, 18,
1.115 misha 488: 23, 25, 27, 29, 32, 35, 37, 39, 40, 49,
489: 51, 53, 57, 59, 61, 63, 67, 69, 71, 73,
490: 75, 77, 80, 82, 84, 86, 88, 90, 92, 95,
491: 98, 100, 104, 106, 108, 110, 113, 115, 118, 122,
492: 124, 126, 128, 130, 133, 136, 138, 140, 142, 143,
493: 144, 150, 154, 158, 160, 162, 164, 166, 168, 170,
494: 173, 175, 176, 177, 184, 186, 188, 191, 193, 195,
495: 197, 198, 199, 205, 209, 213, 215, 219, 221, 225,
496: 227, 231, 233, 235, 237, 239, 241, 243, 245, 248,
497: 250, 253, 256, 258, 260, 263, 265, 267, 269, 271,
498: 274, 277, 278, 279, 285, 287, 289, 292, 295, 297,
499: 299, 302, 305, 307, 309, 311, 313, 315, 317, 321,
500: 325, 329, 332, 335, 338, 341, 344, 347, 350, 353,
501: 357, 361, 365, 369, 373, 377, 381, 385, 389, 393,
502: 397, 401, 405, 409, 413, 417, 421, 425, 429, 433,
503: 437, 441, 445, 449, 453, 457, 461, 463, 465, 467,
504: 468, 470, 472
1.109 paf 505: };
1.105 paf 506:
1.156 ! moko 507: /* YYRHS -- A `-1'-separated list of the rules' RHS. */
! 508: static const yytype_int16 yyrhs[] =
1.112 paf 509: {
510: 63, 0, -1, 65, -1, 64, -1, 66, -1, 64,
1.115 misha 511: 66, -1, 79, -1, 67, -1, 72, -1, 47, 4,
512: 48, 68, -1, 150, -1, 69, -1, 70, -1, 69,
513: 70, -1, 71, 48, -1, 150, -1, 4, -1, -1,
514: 47, 4, 75, 74, 78, 48, 73, 79, -1, 150,
515: -1, 75, -1, 49, 76, 50, -1, 150, -1, 77,
516: -1, 4, -1, 77, 51, 4, -1, 150, -1, 4,
517: -1, 150, -1, 80, -1, 81, -1, 80, 81, -1,
518: 146, -1, 82, -1, 83, -1, 91, -1, 106, -1,
519: 84, -1, 52, 85, -1, 87, 3, -1, 86, -1,
520: 53, 87, 54, -1, 88, -1, 89, -1, 90, -1,
521: 139, 90, -1, 129, -1, 126, 129, -1, 52, 92,
522: 96, -1, 93, -1, 94, -1, 95, -1, 125, -1,
523: 55, 125, -1, 139, 125, -1, 97, -1, 100, -1,
524: 101, -1, -1, -1, 49, 98, 102, 99, 50, -1,
525: 56, 142, 57, -1, 53, 79, 54, -1, 147, -1,
526: 4, -1, 103, -1, 104, -1, 105, -1, 82, -1,
527: 81, 80, -1, 107, -1, -1, -1, 58, 108, 110,
528: 109, 111, 3, -1, 87, -1, 112, -1, 111, 112,
529: -1, 113, -1, 116, -1, 117, -1, -1, -1, 49,
530: 114, 118, 115, 50, -1, 56, 119, 57, -1, 53,
531: 120, 54, -1, 121, -1, 118, 51, 121, -1, 122,
532: -1, 119, 51, 122, -1, 123, -1, 120, 51, 123,
533: -1, 124, -1, 142, -1, 79, -1, 147, -1, 4,
534: -1, 103, -1, 130, -1, 126, 130, -1, 127, -1,
535: 126, 127, -1, 128, 55, -1, 130, -1, 130, -1,
536: 4, 5, -1, 4, -1, 131, -1, 132, -1, 133,
537: -1, 52, 136, -1, 4, 137, -1, -1, -1, 49,
538: 134, 80, 135, 50, -1, 4, -1, 138, -1, 137,
539: 138, -1, 52, 136, -1, 140, -1, 141, -1, 4,
540: 59, -1, 140, 59, -1, 143, -1, 144, -1, 148,
541: -1, 149, -1, 84, -1, 107, -1, 60, 145, 60,
542: -1, 61, 145, 61, -1, 56, 143, 57, -1, 39,
543: 143, -1, 38, 143, -1, 45, 143, -1, 46, 143,
544: -1, 27, 143, -1, 28, 143, -1, 29, 143, -1,
545: 30, 143, -1, 143, 39, 143, -1, 143, 38, 143,
546: -1, 143, 40, 143, -1, 143, 41, 143, -1, 143,
547: 43, 143, -1, 143, 42, 143, -1, 143, 19, 143,
548: -1, 143, 20, 143, -1, 143, 37, 143, -1, 143,
549: 36, 143, -1, 143, 14, 143, -1, 143, 11, 143,
550: -1, 143, 12, 143, -1, 143, 13, 143, -1, 143,
551: 34, 143, -1, 143, 35, 143, -1, 143, 15, 143,
552: -1, 143, 16, 143, -1, 143, 17, 143, -1, 143,
553: 18, 143, -1, 143, 21, 143, -1, 143, 22, 143,
554: -1, 143, 23, 143, -1, 143, 24, 143, -1, 143,
555: 25, 143, -1, 143, 26, 143, -1, 143, 31, 143,
556: -1, 4, -1, 79, -1, 4, -1, -1, 32, -1,
557: 33, -1, -1
1.108 paf 558: };
1.1 parser 559:
1.112 paf 560: /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1.156 ! moko 561: static const yytype_uint16 yyrline[] =
1.112 paf 562: {
1.154 moko 563: 0, 133, 133, 140, 142, 142, 143, 145, 145, 147,
1.155 misha 564: 256, 256, 257, 257, 258, 259, 259, 261, 261, 309,
565: 309, 310, 311, 311, 312, 312, 314, 314, 318, 318,
566: 320, 320, 321, 321, 322, 322, 322, 326, 367, 368,
567: 368, 369, 371, 372, 373, 426, 427, 427, 431, 444,
568: 445, 446, 447, 473, 478, 481, 482, 483, 485, 488,
569: 485, 496, 504, 511, 512, 513, 515, 521, 522, 522,
570: 526, 538, 541, 538, 586, 588, 588, 590, 591, 592,
571: 594, 597, 594, 600, 601, 603, 604, 607, 608, 611,
572: 612, 614, 617, 631, 636, 637, 638, 643, 643, 645,
573: 645, 646, 647, 655, 660, 663, 664, 665, 666, 668,
574: 672, 681, 684, 681, 692, 697, 697, 698, 704, 705,
575: 707, 720, 732, 734, 735, 736, 737, 738, 739, 740,
576: 741, 743, 744, 745, 746, 747, 748, 749, 750, 752,
577: 753, 754, 755, 756, 757, 758, 759, 760, 761, 762,
578: 763, 764, 765, 766, 767, 768, 769, 770, 771, 772,
579: 773, 774, 775, 776, 777, 778, 781, 786, 807, 812,
580: 813, 814, 816
1.106 paf 581: };
1.109 paf 582: #endif
1.1 parser 583:
1.156 ! moko 584: #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
! 585: /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
! 586: First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1.112 paf 587: static const char *const yytname[] =
588: {
1.113 paf 589: "$end", "error", "$undefined", "EON", "STRING", "BOGUS",
590: "BAD_STRING_COMPARISON_OPERATOR", "BAD_HEX_LITERAL",
591: "BAD_METHOD_DECL_START", "BAD_METHOD_PARAMETER_NAME_CHARACTER",
592: "BAD_NONWHITESPACE_CHARACTER_IN_EXPLICIT_RESULT_MODE", "\"&&\"",
593: "\"||\"", "\"!||\"", "\"!|\"", "\"<=\"", "\">=\"", "\"==\"", "\"!=\"",
594: "\"<<\"", "\">>\"", "\"lt\"", "\"gt\"", "\"le\"", "\"ge\"", "\"eq\"",
595: "\"ne\"", "\"def\"", "\"in\"", "\"-f\"", "\"-d\"", "\"is\"", "\"true\"",
596: "\"false\"", "'<'", "'>'", "'|'", "'&'", "'+'", "'-'", "'*'", "'/'",
597: "'\\\\'", "'%'", "NUNARY", "'~'", "'!'", "'@'", "'\\n'", "'['", "']'",
598: "';'", "'$'", "'{'", "'}'", "'.'", "'('", "')'", "'^'", "':'", "'\"'",
1.156 ! moko 599: "'\\''", "$accept", "all", "methods", "one_big_piece", "method",
1.113 paf 600: "control_method", "maybe_control_strings", "control_strings",
1.115 misha 601: "control_string", "maybe_string", "code_method", "@1",
1.113 paf 602: "maybe_bracketed_strings", "bracketed_maybe_strings", "maybe_strings",
603: "strings", "maybe_comment", "maybe_codes", "codes", "code", "action",
604: "get", "get_value", "get_name_value", "name_in_curly_rdive",
605: "name_without_curly_rdive", "name_without_curly_rdive_read",
606: "name_without_curly_rdive_class", "name_without_curly_rdive_code", "put",
607: "name_expr_wdive", "name_expr_wdive_root", "name_expr_wdive_write",
1.156 ! moko 608: "name_expr_wdive_class", "construct", "construct_square", "@2", "$@3",
1.113 paf 609: "construct_round", "construct_curly", "any_constructor_code_value",
610: "constructor_code_value", "constructor_code",
1.156 ! moko 611: "codes__excluding_sole_str_literal", "call", "call_value", "$@4", "$@5",
1.115 misha 612: "call_name", "store_params", "store_param", "store_square_param", "@6",
1.156 ! moko 613: "$@7", "store_round_param", "store_curly_param",
! 614: "store_code_param_parts", "store_expr_param_parts",
! 615: "store_curly_param_parts", "store_code_param_part",
! 616: "store_expr_param_part", "store_curly_param_part", "code_param_value",
! 617: "name_expr_dive_code", "name_path", "name_step", "name_advance1",
! 618: "name_advance2", "name_expr_value", "name_expr_subvar_value",
! 619: "name_expr_with_subvar_value", "name_square_code_value", "@8", "$@9",
1.113 paf 620: "subvar_ref_name_rdive", "subvar_get_writes", "subvar__get_write",
621: "class_prefix", "class_static_prefix", "class_constructor_prefix",
622: "expr_value", "expr", "double_or_STRING", "string_inside_quotes_value",
1.153 moko 623: "write_string", "empty_value", "true_value", "false_value", "empty", 0
1.1 parser 624: };
1.106 paf 625: #endif
1.1 parser 626:
1.112 paf 627: # ifdef YYPRINT
628: /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
629: token YYLEX-NUM. */
1.156 ! moko 630: static const yytype_uint16 yytoknum[] =
1.112 paf 631: {
632: 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
633: 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
634: 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
635: 285, 286, 287, 288, 60, 62, 124, 38, 43, 45,
636: 42, 47, 92, 37, 289, 126, 33, 64, 10, 91,
637: 93, 59, 36, 123, 125, 46, 40, 41, 94, 58,
638: 34, 39
639: };
640: # endif
1.109 paf 641:
1.112 paf 642: /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1.156 ! moko 643: static const yytype_uint8 yyr1[] =
1.112 paf 644: {
645: 0, 62, 63, 63, 64, 64, 65, 66, 66, 67,
1.115 misha 646: 68, 68, 69, 69, 70, 71, 71, 73, 72, 74,
647: 74, 75, 76, 76, 77, 77, 78, 78, 79, 79,
648: 80, 80, 81, 81, 82, 82, 82, 83, 84, 85,
649: 85, 86, 87, 87, 88, 89, 90, 90, 91, 92,
650: 92, 92, 93, 94, 95, 96, 96, 96, 98, 99,
651: 97, 100, 101, 102, 102, 102, 103, 104, 105, 105,
652: 106, 108, 109, 107, 110, 111, 111, 112, 112, 112,
653: 114, 115, 113, 116, 117, 118, 118, 119, 119, 120,
654: 120, 121, 122, 123, 124, 124, 124, 125, 125, 126,
655: 126, 127, 128, 129, 129, 130, 130, 130, 130, 131,
656: 132, 134, 135, 133, 136, 137, 137, 138, 139, 139,
657: 140, 141, 142, 143, 143, 143, 143, 143, 143, 143,
658: 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
659: 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
660: 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
661: 143, 143, 143, 143, 143, 143, 144, 145, 146, 147,
662: 148, 149, 150
1.1 parser 663: };
664:
1.112 paf 665: /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1.156 ! moko 666: static const yytype_uint8 yyr2[] =
1.112 paf 667: {
668: 0, 2, 1, 1, 1, 2, 1, 1, 1, 4,
1.115 misha 669: 1, 1, 1, 2, 2, 1, 1, 0, 8, 1,
670: 1, 3, 1, 1, 1, 3, 1, 1, 1, 1,
671: 1, 2, 1, 1, 1, 1, 1, 1, 2, 2,
672: 1, 3, 1, 1, 1, 2, 1, 2, 3, 1,
673: 1, 1, 1, 2, 2, 1, 1, 1, 0, 0,
674: 5, 3, 3, 1, 1, 1, 1, 1, 1, 2,
675: 1, 0, 0, 6, 1, 1, 2, 1, 1, 1,
676: 0, 0, 5, 3, 3, 1, 3, 1, 3, 1,
677: 3, 1, 1, 1, 1, 1, 1, 1, 2, 1,
678: 2, 2, 1, 1, 2, 1, 1, 1, 1, 2,
679: 2, 0, 0, 5, 1, 1, 2, 2, 1, 1,
680: 2, 2, 1, 1, 1, 1, 1, 1, 3, 3,
681: 3, 2, 2, 2, 2, 2, 2, 2, 2, 3,
1.112 paf 682: 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
683: 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1.115 misha 684: 3, 3, 3, 3, 3, 3, 1, 1, 1, 0,
685: 1, 1, 0
1.108 paf 686: };
1.106 paf 687:
1.112 paf 688: /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
689: STATE-NUM when YYTABLE doesn't specify something else to do. Zero
690: means the default is an error. */
1.156 ! moko 691: static const yytype_uint8 yydefact[] =
1.112 paf 692: {
1.115 misha 693: 172, 168, 0, 0, 71, 0, 3, 2, 4, 7,
694: 8, 6, 29, 30, 33, 34, 37, 35, 36, 70,
695: 32, 28, 0, 105, 111, 0, 0, 0, 38, 40,
696: 0, 42, 43, 44, 0, 49, 50, 51, 52, 0,
697: 99, 0, 46, 97, 106, 107, 108, 0, 118, 119,
698: 0, 1, 5, 31, 172, 172, 172, 104, 0, 120,
699: 110, 115, 0, 114, 109, 0, 0, 103, 0, 105,
700: 53, 0, 97, 39, 58, 172, 0, 48, 55, 56,
701: 57, 105, 100, 47, 98, 101, 45, 54, 121, 74,
702: 72, 16, 9, 11, 12, 0, 10, 24, 0, 23,
703: 22, 172, 20, 19, 117, 116, 112, 41, 98, 169,
704: 0, 166, 0, 0, 0, 0, 170, 171, 0, 0,
705: 0, 0, 0, 0, 172, 172, 126, 127, 0, 122,
706: 123, 124, 125, 0, 13, 15, 14, 21, 0, 27,
707: 0, 26, 0, 168, 0, 33, 59, 65, 66, 67,
708: 63, 62, 135, 136, 137, 138, 132, 131, 133, 134,
709: 0, 167, 0, 0, 61, 0, 0, 0, 0, 0,
1.112 paf 710: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
711: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1.115 misha 712: 0, 0, 80, 172, 0, 0, 75, 77, 78, 79,
713: 25, 17, 113, 69, 0, 130, 128, 129, 150, 151,
714: 152, 149, 155, 156, 157, 158, 145, 146, 159, 160,
715: 161, 162, 163, 164, 165, 153, 154, 148, 147, 140,
716: 139, 141, 142, 144, 143, 169, 93, 0, 89, 0,
717: 87, 92, 73, 76, 172, 60, 168, 96, 81, 85,
718: 91, 94, 172, 84, 0, 83, 18, 169, 0, 90,
719: 88, 86, 82
1.1 parser 720: };
721:
1.156 ! moko 722: /* YYDEFGOTO[NTERM-NUM]. */
! 723: static const yytype_int16 yydefgoto[] =
1.112 paf 724: {
725: -1, 5, 6, 7, 8, 9, 92, 93, 94, 95,
1.115 misha 726: 10, 244, 101, 56, 98, 99, 140, 161, 12, 13,
727: 14, 15, 126, 28, 29, 30, 31, 32, 33, 17,
728: 34, 35, 36, 37, 77, 78, 109, 204, 79, 80,
729: 146, 247, 148, 149, 18, 127, 50, 133, 90, 195,
730: 196, 197, 235, 258, 198, 199, 248, 239, 237, 249,
731: 240, 238, 250, 38, 66, 40, 41, 42, 67, 44,
732: 45, 46, 62, 142, 64, 60, 61, 68, 48, 49,
733: 241, 129, 130, 162, 20, 251, 131, 132, 21
1.105 paf 734: };
1.1 parser 735:
1.112 paf 736: /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
737: STATE-NUM. */
1.115 misha 738: #define YYPACT_NINF -107
1.156 ! moko 739: static const yytype_int16 yypact[] =
1.112 paf 740: {
1.115 misha 741: 14, -107, 13, 45, -107, 28, -15, -107, -107, -107,
742: -107, -107, 21, -107, -107, -107, -107, -107, -107, -107,
743: -107, -107, 73, 19, -107, 50, 6, 44, -107, -107,
744: 87, -107, -107, -107, -34, -107, -107, -107, -107, 65,
745: -107, 48, -107, 5, -107, -107, -107, 65, 24, -107,
746: 6, -107, -107, -107, 88, 109, 74, -107, 50, -107,
747: 76, -107, 21, -107, -107, 86, 65, 101, 65, 76,
748: -107, 44, 101, -107, -107, 21, 7, -107, -107, -107,
749: -107, 18, -107, -107, 5, -107, -107, -107, -107, -107,
750: -107, -107, -107, 9, -107, 94, 99, -107, 93, 112,
751: -107, 146, -107, -107, -107, -107, 21, -107, 101, 29,
752: 110, -107, 7, 7, 7, 7, -107, -107, 7, 7,
753: 7, 7, 52, 7, 21, 21, -107, -107, 113, 323,
754: -107, -107, -107, 92, -107, -107, -107, -107, 165, -107,
755: 144, -107, 147, 149, 21, 80, -107, -107, -107, -107,
756: -107, -107, 96, 96, 96, 96, -107, -107, -107, -107,
757: 276, -107, 138, 139, -107, 7, 7, 7, 7, 7,
758: 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
759: 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
760: 7, 7, -107, 21, 7, 35, -107, -107, -107, -107,
761: -107, -107, -107, 21, 154, -107, -107, -107, 419, 389,
762: 356, 284, 135, 135, 148, 148, 191, 191, 135, 135,
763: 135, 135, 148, 148, 96, 135, 135, 182, 427, 140,
764: 140, -107, -107, -107, -107, 37, -107, 31, -107, -30,
765: -107, -107, -107, -107, 21, -107, 108, -107, 155, -107,
766: -107, -107, 21, -107, 7, -107, -107, 37, 161, -107,
767: -107, -107, -107
1.1 parser 768: };
769:
1.112 paf 770: /* YYPGOTO[NTERM-NUM]. */
1.156 ! moko 771: static const yytype_int16 yypgoto[] =
1.112 paf 772: {
1.115 misha 773: -107, -107, -107, -107, 206, -107, -107, -107, 124, -107,
774: -107, -107, -107, 170, -107, -107, -107, 1, -58, -7,
775: -106, -107, 0, -107, -107, -6, -107, -107, -21, -107,
776: -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,
777: -107, 118, -107, -107, -107, 2, -107, -107, -107, -107,
778: 43, -107, -107, -107, -107, -107, -107, -107, -107, -17,
779: -13, -16, -107, -18, 4, 41, -107, -23, 3, -107,
780: -107, -107, -107, -107, 181, -107, 183, 239, -107, -107,
781: 171, 95, -107, 123, -107, 142, -107, -107, 64
1.1 parser 782: };
783:
1.112 paf 784: /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
785: positive, shift that token. If negative, reduce the rule which
786: number is the opposite. If zero, do what YYDEFACT says.
787: If YYTABLE_NINF, syntax error. */
1.115 misha 788: #define YYTABLE_NINF -173
1.156 ! moko 789: static const yytype_int16 yytable[] =
1.112 paf 790: {
1.115 misha 791: 16, 11, 19, 145, 106, 53, 43, 39, -103, 70,
792: 23, 111, 16, 91, 19, 74, 83, 22, 1, 75,
793: 65, 254, 76, 57, 57, 1, 86, 255, 51, 87,
794: 72, 71, 2, 143, 112, 113, 114, 115, 242, 116,
795: 117, 246, 84, 83, 89, 118, 119, 86, 69, 23,
796: 43, 39, 120, 121, 63, 24, 23, -172, 25, 122,
797: -102, 2, 16, 123, 19, 4, 3, 124, 125, 81,
798: 58, 58, 4, 3, 108, 16, 110, 19, 59, 4,
799: 82, 3, 252, 88, 192, 253, 203, 4, 193, 3,
800: 73, 194, 91, 24, 24, 4, 25, 25, 26, 53,
801: 27, 24, 144, 85, 25, 26, 16, 82, 19, 16,
802: 168, 19, 82, 97, 24, 173, 174, 25, 96, 100,
803: 103, 54, 55, 55, 16, 16, 19, 19, 58, 145,
804: -68, -68, 184, 185, 186, 187, 188, 189, 190, 191,
805: 107, 192, 136, 137, 16, 193, 19, -15, 194, 168,
806: 139, 145, 171, 172, 173, 174, -102, 135, -95, -95,
807: 179, 180, 168, 138, 151, 141, 181, 173, 174, 200,
808: 164, 184, 185, 186, 187, 188, 189, 190, 191, 181,
809: 188, 189, 190, 191, 184, 185, 186, 187, 188, 189,
810: 190, 191, 201, 16, 236, 19, 53, 202, 206, -64,
811: 207, 173, 174, 16, 245, 19, 257, 152, 153, 154,
812: 155, 262, 52, 156, 157, 158, 159, 134, 160, 185,
813: 186, 187, 188, 189, 190, 191, 102, 147, 144, 186,
814: 187, 188, 189, 190, 191, 16, 259, 19, 243, 104,
815: 261, 260, 47, 105, 16, 256, 19, 128, 163, 0,
816: 144, 150, 16, 236, 19, 0, 0, 16, 0, 19,
817: 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
818: 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
819: 228, 229, 230, 231, 232, 233, 234, 165, 166, 167,
820: 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
821: 178, 179, 180, 173, 174, 0, 0, 181, 0, 0,
822: 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
823: 184, 185, 186, 187, 188, 189, 190, 191, 0, 0,
824: 0, 0, 0, 205, 165, 166, 167, 168, 169, 170,
825: 171, 172, 173, 174, 175, 176, 177, 178, 179, 180,
826: 0, 0, 0, 0, 181, 0, 0, 182, 183, 184,
827: 185, 186, 187, 188, 189, 190, 191, 165, 166, 0,
828: 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
829: 178, 179, 180, 0, 0, 0, 0, 181, 0, 0,
830: 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
831: 165, 0, 0, 168, 169, 170, 171, 172, 173, 174,
832: 175, 176, 177, 178, 179, 180, 0, 0, 0, 0,
833: 181, 0, 0, 182, 183, 184, 185, 186, 187, 188,
834: 189, 190, 191, 168, 169, 170, 171, 172, 173, 174,
835: 175, 176, 177, 178, 179, 180, 173, 174, 0, 0,
836: 181, 0, 0, 182, 183, 184, 185, 186, 187, 188,
837: 189, 190, 191, 0, 0, 186, 187, 188, 189, 190,
1.112 paf 838: 191
1.1 parser 839: };
840:
1.156 ! moko 841: static const yytype_int16 yycheck[] =
1.112 paf 842: {
1.115 misha 843: 0, 0, 0, 109, 62, 12, 3, 3, 3, 27,
844: 4, 4, 12, 4, 12, 49, 39, 4, 4, 53,
845: 26, 51, 56, 5, 5, 4, 47, 57, 0, 47,
846: 27, 27, 47, 4, 27, 28, 29, 30, 3, 32,
847: 33, 4, 39, 66, 50, 38, 39, 68, 4, 4,
848: 47, 47, 45, 46, 4, 49, 4, 48, 52, 52,
849: 55, 47, 62, 56, 62, 58, 52, 60, 61, 4,
850: 52, 52, 58, 52, 71, 75, 75, 75, 59, 58,
851: 39, 52, 51, 59, 49, 54, 144, 58, 53, 52,
852: 3, 56, 4, 49, 49, 58, 52, 52, 53, 106,
853: 55, 49, 109, 55, 52, 53, 106, 66, 106, 109,
854: 14, 109, 71, 4, 49, 19, 20, 52, 54, 55,
855: 56, 48, 49, 49, 124, 125, 124, 125, 52, 235,
856: 50, 51, 36, 37, 38, 39, 40, 41, 42, 43,
857: 54, 49, 48, 50, 144, 53, 144, 48, 56, 14,
858: 4, 257, 17, 18, 19, 20, 55, 93, 50, 51,
859: 25, 26, 14, 51, 54, 101, 31, 19, 20, 4,
860: 57, 36, 37, 38, 39, 40, 41, 42, 43, 31,
861: 40, 41, 42, 43, 36, 37, 38, 39, 40, 41,
862: 42, 43, 48, 193, 193, 193, 203, 50, 60, 50,
863: 61, 19, 20, 203, 50, 203, 51, 112, 113, 114,
864: 115, 50, 6, 118, 119, 120, 121, 93, 123, 37,
865: 38, 39, 40, 41, 42, 43, 56, 109, 235, 38,
866: 39, 40, 41, 42, 43, 235, 252, 235, 195, 58,
867: 257, 254, 3, 60, 244, 244, 244, 76, 125, -1,
868: 257, 109, 252, 252, 252, -1, -1, 257, -1, 257,
869: 165, 166, 167, 168, 169, 170, 171, 172, 173, 174,
870: 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
871: 185, 186, 187, 188, 189, 190, 191, 11, 12, 13,
872: 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
873: 24, 25, 26, 19, 20, -1, -1, 31, -1, -1,
874: 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
875: 36, 37, 38, 39, 40, 41, 42, 43, -1, -1,
876: -1, -1, -1, 57, 11, 12, 13, 14, 15, 16,
877: 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
878: -1, -1, -1, -1, 31, -1, -1, 34, 35, 36,
879: 37, 38, 39, 40, 41, 42, 43, 11, 12, -1,
880: 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
881: 24, 25, 26, -1, -1, -1, -1, 31, -1, -1,
882: 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
883: 11, -1, -1, 14, 15, 16, 17, 18, 19, 20,
884: 21, 22, 23, 24, 25, 26, -1, -1, -1, -1,
885: 31, -1, -1, 34, 35, 36, 37, 38, 39, 40,
886: 41, 42, 43, 14, 15, 16, 17, 18, 19, 20,
887: 21, 22, 23, 24, 25, 26, 19, 20, -1, -1,
888: 31, -1, -1, 34, 35, 36, 37, 38, 39, 40,
889: 41, 42, 43, -1, -1, 38, 39, 40, 41, 42,
1.112 paf 890: 43
1.1 parser 891: };
892:
1.112 paf 893: /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
894: symbol of state STATE-NUM. */
1.156 ! moko 895: static const yytype_uint8 yystos[] =
1.112 paf 896: {
897: 0, 4, 47, 52, 58, 63, 64, 65, 66, 67,
1.115 misha 898: 72, 79, 80, 81, 82, 83, 84, 91, 106, 107,
899: 146, 150, 4, 4, 49, 52, 53, 55, 85, 86,
900: 87, 88, 89, 90, 92, 93, 94, 95, 125, 126,
901: 127, 128, 129, 130, 131, 132, 133, 139, 140, 141,
902: 108, 0, 66, 81, 48, 49, 75, 5, 52, 59,
903: 137, 138, 134, 4, 136, 87, 126, 130, 139, 4,
904: 125, 126, 130, 3, 49, 53, 56, 96, 97, 100,
905: 101, 4, 127, 129, 130, 55, 90, 125, 59, 87,
906: 110, 4, 68, 69, 70, 71, 150, 4, 76, 77,
907: 150, 74, 75, 150, 136, 138, 80, 54, 130, 98,
908: 79, 4, 27, 28, 29, 30, 32, 33, 38, 39,
909: 45, 46, 52, 56, 60, 61, 84, 107, 142, 143,
910: 144, 148, 149, 109, 70, 150, 48, 50, 51, 4,
911: 78, 150, 135, 4, 81, 82, 102, 103, 104, 105,
912: 147, 54, 143, 143, 143, 143, 143, 143, 143, 143,
913: 143, 79, 145, 145, 57, 11, 12, 13, 14, 15,
1.112 paf 914: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
915: 26, 31, 34, 35, 36, 37, 38, 39, 40, 41,
1.115 misha 916: 42, 43, 49, 53, 56, 111, 112, 113, 116, 117,
917: 4, 48, 50, 80, 99, 57, 60, 61, 143, 143,
918: 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
919: 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
920: 143, 143, 143, 143, 143, 114, 79, 120, 123, 119,
921: 122, 142, 3, 112, 73, 50, 4, 103, 118, 121,
922: 124, 147, 51, 54, 51, 57, 79, 51, 115, 123,
923: 122, 121, 50
1.1 parser 924: };
1.109 paf 925:
1.1 parser 926: #define yyerrok (yyerrstatus = 0)
927: #define yyclearin (yychar = YYEMPTY)
1.112 paf 928: #define YYEMPTY (-2)
1.1 parser 929: #define YYEOF 0
1.112 paf 930:
1.1 parser 931: #define YYACCEPT goto yyacceptlab
1.112 paf 932: #define YYABORT goto yyabortlab
1.113 paf 933: #define YYERROR goto yyerrorlab
1.112 paf 934:
935:
936: /* Like YYERROR except do call yyerror. This remains here temporarily
937: to ease the transition to the new meaning of YYERROR, for GCC.
1.156 ! moko 938: Once GCC version 2 has supplanted version 1, this can go. However,
! 939: YYFAIL appears to be in use. Nevertheless, it is formally deprecated
! 940: in Bison 2.4.2's NEWS entry, where a plan to phase it out is
! 941: discussed. */
1.112 paf 942:
1.1 parser 943: #define YYFAIL goto yyerrlab
1.156 ! moko 944: #if defined YYFAIL
! 945: /* This is here to suppress warnings from the GCC cpp's
! 946: -Wunused-macros. Normally we don't worry about that warning, but
! 947: some users do, and we want to make it easy for users to remove
! 948: YYFAIL uses, which will produce warnings from Bison 2.5. */
! 949: #endif
1.112 paf 950:
1.1 parser 951: #define YYRECOVERING() (!!yyerrstatus)
1.112 paf 952:
953: #define YYBACKUP(Token, Value) \
1.1 parser 954: do \
955: if (yychar == YYEMPTY && yylen == 1) \
1.112 paf 956: { \
957: yychar = (Token); \
958: yylval = (Value); \
959: yytoken = YYTRANSLATE (yychar); \
1.156 ! moko 960: YYPOPSTACK (1); \
1.1 parser 961: goto yybackup; \
962: } \
963: else \
1.156 ! moko 964: { \
! 965: yyerror (YY_("syntax error: cannot back up")); \
1.112 paf 966: YYERROR; \
967: } \
1.156 ! moko 968: while (YYID (0))
! 969:
1.1 parser 970:
971: #define YYTERROR 1
972: #define YYERRCODE 256
973:
1.112 paf 974:
1.156 ! moko 975: /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
! 976: If N is 0, then set CURRENT to the empty location which ends
! 977: the previous symbol: RHS[0] (always defined). */
! 978:
! 979: #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1.112 paf 980: #ifndef YYLLOC_DEFAULT
1.156 ! moko 981: # define YYLLOC_DEFAULT(Current, Rhs, N) \
! 982: do \
! 983: if (YYID (N)) \
! 984: { \
! 985: (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
! 986: (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
! 987: (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
! 988: (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
! 989: } \
! 990: else \
! 991: { \
! 992: (Current).first_line = (Current).last_line = \
! 993: YYRHSLOC (Rhs, 0).last_line; \
! 994: (Current).first_column = (Current).last_column = \
! 995: YYRHSLOC (Rhs, 0).last_column; \
! 996: } \
! 997: while (YYID (0))
! 998: #endif
! 999:
! 1000:
! 1001: /* YY_LOCATION_PRINT -- Print the location on the stream.
! 1002: This macro was not mandated originally: define only if we know
! 1003: we won't break user code: when these are the locations we know. */
! 1004:
! 1005: #ifndef YY_LOCATION_PRINT
! 1006: # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
! 1007: # define YY_LOCATION_PRINT(File, Loc) \
! 1008: fprintf (File, "%d.%d-%d.%d", \
! 1009: (Loc).first_line, (Loc).first_column, \
! 1010: (Loc).last_line, (Loc).last_column)
! 1011: # else
! 1012: # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
! 1013: # endif
1.109 paf 1014: #endif
1.108 paf 1015:
1.156 ! moko 1016:
1.112 paf 1017: /* YYLEX -- calling `yylex' with the right arguments. */
1018:
1.109 paf 1019: #ifdef YYLEX_PARAM
1.112 paf 1020: # define YYLEX yylex (&yylval, YYLEX_PARAM)
1.109 paf 1021: #else
1.112 paf 1022: # define YYLEX yylex (&yylval)
1.106 paf 1023: #endif
1.112 paf 1024:
1025: /* Enable debugging if requested. */
1026: #if YYDEBUG
1027:
1028: # ifndef YYFPRINTF
1029: # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1030: # define YYFPRINTF fprintf
1031: # endif
1032:
1033: # define YYDPRINTF(Args) \
1034: do { \
1035: if (yydebug) \
1036: YYFPRINTF Args; \
1.156 ! moko 1037: } while (YYID (0))
! 1038:
! 1039: # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
! 1040: do { \
! 1041: if (yydebug) \
! 1042: { \
! 1043: YYFPRINTF (stderr, "%s ", Title); \
! 1044: yy_symbol_print (stderr, \
! 1045: Type, Value); \
! 1046: YYFPRINTF (stderr, "\n"); \
! 1047: } \
! 1048: } while (YYID (0))
! 1049:
1.154 moko 1050:
1.156 ! moko 1051: /*--------------------------------.
! 1052: | Print this symbol on YYOUTPUT. |
! 1053: `--------------------------------*/
! 1054:
! 1055: /*ARGSUSED*/
! 1056: #if (defined __STDC__ || defined __C99__FUNC__ \
! 1057: || defined __cplusplus || defined _MSC_VER)
! 1058: static void
! 1059: yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
! 1060: #else
! 1061: static void
! 1062: yy_symbol_value_print (yyoutput, yytype, yyvaluep)
! 1063: FILE *yyoutput;
! 1064: int yytype;
! 1065: YYSTYPE const * const yyvaluep;
! 1066: #endif
! 1067: {
! 1068: if (!yyvaluep)
! 1069: return;
! 1070: # ifdef YYPRINT
! 1071: if (yytype < YYNTOKENS)
! 1072: YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
! 1073: # else
! 1074: YYUSE (yyoutput);
! 1075: # endif
! 1076: switch (yytype)
! 1077: {
! 1078: default:
! 1079: break;
! 1080: }
! 1081: }
! 1082:
! 1083:
! 1084: /*--------------------------------.
! 1085: | Print this symbol on YYOUTPUT. |
! 1086: `--------------------------------*/
! 1087:
! 1088: #if (defined __STDC__ || defined __C99__FUNC__ \
! 1089: || defined __cplusplus || defined _MSC_VER)
! 1090: static void
! 1091: yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
! 1092: #else
! 1093: static void
! 1094: yy_symbol_print (yyoutput, yytype, yyvaluep)
! 1095: FILE *yyoutput;
! 1096: int yytype;
! 1097: YYSTYPE const * const yyvaluep;
! 1098: #endif
! 1099: {
! 1100: if (yytype < YYNTOKENS)
! 1101: YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
! 1102: else
! 1103: YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1.154 moko 1104:
1.156 ! moko 1105: yy_symbol_value_print (yyoutput, yytype, yyvaluep);
! 1106: YYFPRINTF (yyoutput, ")");
! 1107: }
1.112 paf 1108:
1109: /*------------------------------------------------------------------.
1110: | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1.113 paf 1111: | TOP (included). |
1.112 paf 1112: `------------------------------------------------------------------*/
1113:
1.156 ! moko 1114: #if (defined __STDC__ || defined __C99__FUNC__ \
! 1115: || defined __cplusplus || defined _MSC_VER)
1.112 paf 1116: static void
1.156 ! moko 1117: yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1.106 paf 1118: #else
1.112 paf 1119: static void
1.156 ! moko 1120: yy_stack_print (yybottom, yytop)
! 1121: yytype_int16 *yybottom;
! 1122: yytype_int16 *yytop;
1.1 parser 1123: #endif
1.112 paf 1124: {
1125: YYFPRINTF (stderr, "Stack now");
1.156 ! moko 1126: for (; yybottom <= yytop; yybottom++)
! 1127: {
! 1128: int yybot = *yybottom;
! 1129: YYFPRINTF (stderr, " %d", yybot);
! 1130: }
1.112 paf 1131: YYFPRINTF (stderr, "\n");
1132: }
1.108 paf 1133:
1.112 paf 1134: # define YY_STACK_PRINT(Bottom, Top) \
1135: do { \
1136: if (yydebug) \
1137: yy_stack_print ((Bottom), (Top)); \
1.156 ! moko 1138: } while (YYID (0))
1.108 paf 1139:
1140:
1.112 paf 1141: /*------------------------------------------------.
1142: | Report that the YYRULE is going to be reduced. |
1143: `------------------------------------------------*/
1.108 paf 1144:
1.156 ! moko 1145: #if (defined __STDC__ || defined __C99__FUNC__ \
! 1146: || defined __cplusplus || defined _MSC_VER)
1.112 paf 1147: static void
1.156 ! moko 1148: yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1.112 paf 1149: #else
1150: static void
1.156 ! moko 1151: yy_reduce_print (yyvsp, yyrule)
! 1152: YYSTYPE *yyvsp;
1.112 paf 1153: int yyrule;
1.1 parser 1154: #endif
1.112 paf 1155: {
1.156 ! moko 1156: int yynrhs = yyr2[yyrule];
1.112 paf 1157: int yyi;
1.156 ! moko 1158: unsigned long int yylno = yyrline[yyrule];
! 1159: YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
! 1160: yyrule - 1, yylno);
! 1161: /* The symbols being reduced. */
! 1162: for (yyi = 0; yyi < yynrhs; yyi++)
! 1163: {
! 1164: YYFPRINTF (stderr, " $%d = ", yyi + 1);
! 1165: yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
! 1166: &(yyvsp[(yyi + 1) - (yynrhs)])
! 1167: );
! 1168: YYFPRINTF (stderr, "\n");
! 1169: }
1.112 paf 1170: }
1.105 paf 1171:
1.112 paf 1172: # define YY_REDUCE_PRINT(Rule) \
1173: do { \
1174: if (yydebug) \
1.156 ! moko 1175: yy_reduce_print (yyvsp, Rule); \
! 1176: } while (YYID (0))
1.112 paf 1177:
1178: /* Nonzero means print parse trace. It is left uninitialized so that
1179: multiple parsers can coexist. */
1180: int yydebug;
1181: #else /* !YYDEBUG */
1182: # define YYDPRINTF(Args)
1.156 ! moko 1183: # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1.112 paf 1184: # define YY_STACK_PRINT(Bottom, Top)
1185: # define YY_REDUCE_PRINT(Rule)
1186: #endif /* !YYDEBUG */
1.1 parser 1187:
1188:
1.112 paf 1189: /* YYINITDEPTH -- initial size of the parser's stacks. */
1.1 parser 1190: #ifndef YYINITDEPTH
1.112 paf 1191: # define YYINITDEPTH 200
1.1 parser 1192: #endif
1193:
1.112 paf 1194: /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1195: if the built-in stack extension method is used).
1196:
1197: Do not make this value too large; the results are undefined if
1.156 ! moko 1198: YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1.112 paf 1199: evaluated with infinite-precision integer arithmetic. */
1.1 parser 1200:
1201: #ifndef YYMAXDEPTH
1.112 paf 1202: # define YYMAXDEPTH 10000
1.1 parser 1203: #endif
1.112 paf 1204:
1.1 parser 1205:
1206:
1.112 paf 1207: #if YYERROR_VERBOSE
1208:
1209: # ifndef yystrlen
1.156 ! moko 1210: # if defined __GLIBC__ && defined _STRING_H
1.112 paf 1211: # define yystrlen strlen
1212: # else
1213: /* Return the length of YYSTR. */
1.156 ! moko 1214: #if (defined __STDC__ || defined __C99__FUNC__ \
! 1215: || defined __cplusplus || defined _MSC_VER)
1.112 paf 1216: static YYSIZE_T
1217: yystrlen (const char *yystr)
1.156 ! moko 1218: #else
! 1219: static YYSIZE_T
1.112 paf 1220: yystrlen (yystr)
1.156 ! moko 1221: const char *yystr;
! 1222: #endif
1.112 paf 1223: {
1.156 ! moko 1224: YYSIZE_T yylen;
! 1225: for (yylen = 0; yystr[yylen]; yylen++)
1.112 paf 1226: continue;
1.156 ! moko 1227: return yylen;
1.112 paf 1228: }
1229: # endif
1230: # endif
1231:
1232: # ifndef yystpcpy
1.156 ! moko 1233: # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1.112 paf 1234: # define yystpcpy stpcpy
1235: # else
1236: /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1237: YYDEST. */
1.156 ! moko 1238: #if (defined __STDC__ || defined __C99__FUNC__ \
! 1239: || defined __cplusplus || defined _MSC_VER)
1.112 paf 1240: static char *
1241: yystpcpy (char *yydest, const char *yysrc)
1.156 ! moko 1242: #else
! 1243: static char *
1.112 paf 1244: yystpcpy (yydest, yysrc)
1.156 ! moko 1245: char *yydest;
! 1246: const char *yysrc;
! 1247: #endif
1.112 paf 1248: {
1.156 ! moko 1249: char *yyd = yydest;
! 1250: const char *yys = yysrc;
1.112 paf 1251:
1252: while ((*yyd++ = *yys++) != '\0')
1253: continue;
1.105 paf 1254:
1.112 paf 1255: return yyd - 1;
1.105 paf 1256: }
1.112 paf 1257: # endif
1258: # endif
1259:
1.156 ! moko 1260: # ifndef yytnamerr
! 1261: /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
! 1262: quotes and backslashes, so that it's suitable for yyerror. The
! 1263: heuristic is that double-quoting is unnecessary unless the string
! 1264: contains an apostrophe, a comma, or backslash (other than
! 1265: backslash-backslash). YYSTR is taken from yytname. If YYRES is
! 1266: null, do not copy; instead, return the length of what the result
! 1267: would have been. */
! 1268: static YYSIZE_T
! 1269: yytnamerr (char *yyres, const char *yystr)
! 1270: {
! 1271: if (*yystr == '"')
! 1272: {
! 1273: YYSIZE_T yyn = 0;
! 1274: char const *yyp = yystr;
1.154 moko 1275:
1.156 ! moko 1276: for (;;)
! 1277: switch (*++yyp)
! 1278: {
! 1279: case '\'':
! 1280: case ',':
! 1281: goto do_not_strip_quotes;
! 1282:
! 1283: case '\\':
! 1284: if (*++yyp != '\\')
! 1285: goto do_not_strip_quotes;
! 1286: /* Fall through. */
! 1287: default:
! 1288: if (yyres)
! 1289: yyres[yyn] = *yyp;
! 1290: yyn++;
! 1291: break;
! 1292:
! 1293: case '"':
! 1294: if (yyres)
! 1295: yyres[yyn] = '\0';
! 1296: return yyn;
! 1297: }
! 1298: do_not_strip_quotes: ;
! 1299: }
! 1300:
! 1301: if (! yyres)
! 1302: return yystrlen (yystr);
1.112 paf 1303:
1.156 ! moko 1304: return yystpcpy (yyres, yystr) - yyres;
! 1305: }
! 1306: # endif
1.105 paf 1307:
1.156 ! moko 1308: /* Copy into YYRESULT an error message about the unexpected token
! 1309: YYCHAR while in state YYSTATE. Return the number of bytes copied,
! 1310: including the terminating null byte. If YYRESULT is null, do not
! 1311: copy anything; just return the number of bytes that would be
! 1312: copied. As a special case, return 0 if an ordinary "syntax error"
! 1313: message will do. Return YYSIZE_MAXIMUM if overflow occurs during
! 1314: size calculation. */
! 1315: static YYSIZE_T
! 1316: yysyntax_error (char *yyresult, int yystate, int yychar)
1.1 parser 1317: {
1.156 ! moko 1318: int yyn = yypact[yystate];
1.112 paf 1319:
1.156 ! moko 1320: if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
! 1321: return 0;
! 1322: else
1.112 paf 1323: {
1.156 ! moko 1324: int yytype = YYTRANSLATE (yychar);
! 1325: YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
! 1326: YYSIZE_T yysize = yysize0;
! 1327: YYSIZE_T yysize1;
! 1328: int yysize_overflow = 0;
! 1329: enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
! 1330: char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
! 1331: int yyx;
! 1332:
! 1333: # if 0
! 1334: /* This is so xgettext sees the translatable formats that are
! 1335: constructed on the fly. */
! 1336: YY_("syntax error, unexpected %s");
! 1337: YY_("syntax error, unexpected %s, expecting %s");
! 1338: YY_("syntax error, unexpected %s, expecting %s or %s");
! 1339: YY_("syntax error, unexpected %s, expecting %s or %s or %s");
! 1340: YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1.112 paf 1341: # endif
1.156 ! moko 1342: char *yyfmt;
! 1343: char const *yyf;
! 1344: static char const yyunexpected[] = "syntax error, unexpected %s";
! 1345: static char const yyexpecting[] = ", expecting %s";
! 1346: static char const yyor[] = " or %s";
! 1347: char yyformat[sizeof yyunexpected
! 1348: + sizeof yyexpecting - 1
! 1349: + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
! 1350: * (sizeof yyor - 1))];
! 1351: char const *yyprefix = yyexpecting;
! 1352:
! 1353: /* Start YYX at -YYN if negative to avoid negative indexes in
! 1354: YYCHECK. */
! 1355: int yyxbegin = yyn < 0 ? -yyn : 0;
! 1356:
! 1357: /* Stay within bounds of both yycheck and yytname. */
! 1358: int yychecklim = YYLAST - yyn + 1;
! 1359: int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
! 1360: int yycount = 1;
! 1361:
! 1362: yyarg[0] = yytname[yytype];
! 1363: yyfmt = yystpcpy (yyformat, yyunexpected);
! 1364:
! 1365: for (yyx = yyxbegin; yyx < yyxend; ++yyx)
! 1366: if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
! 1367: {
! 1368: if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
! 1369: {
! 1370: yycount = 1;
! 1371: yysize = yysize0;
! 1372: yyformat[sizeof yyunexpected - 1] = '\0';
! 1373: break;
! 1374: }
! 1375: yyarg[yycount++] = yytname[yyx];
! 1376: yysize1 = yysize + yytnamerr (0, yytname[yyx]);
! 1377: yysize_overflow |= (yysize1 < yysize);
! 1378: yysize = yysize1;
! 1379: yyfmt = yystpcpy (yyfmt, yyprefix);
! 1380: yyprefix = yyor;
! 1381: }
! 1382:
! 1383: yyf = YY_(yyformat);
! 1384: yysize1 = yysize + yystrlen (yyf);
! 1385: yysize_overflow |= (yysize1 < yysize);
! 1386: yysize = yysize1;
! 1387:
! 1388: if (yysize_overflow)
! 1389: return YYSIZE_MAXIMUM;
1.154 moko 1390:
1.156 ! moko 1391: if (yyresult)
! 1392: {
! 1393: /* Avoid sprintf, as that infringes on the user's name space.
! 1394: Don't have undefined behavior even if the translation
! 1395: produced a string with the wrong number of "%s"s. */
! 1396: char *yyp = yyresult;
! 1397: int yyi = 0;
! 1398: while ((*yyp = *yyf) != '\0')
! 1399: {
! 1400: if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
! 1401: {
! 1402: yyp += yytnamerr (yyp, yyarg[yyi++]);
! 1403: yyf += 2;
! 1404: }
! 1405: else
! 1406: {
! 1407: yyp++;
! 1408: yyf++;
! 1409: }
! 1410: }
! 1411: }
! 1412: return yysize;
1.112 paf 1413: }
1.1 parser 1414: }
1.156 ! moko 1415: #endif /* YYERROR_VERBOSE */
! 1416:
1.1 parser 1417:
1.112 paf 1418: /*-----------------------------------------------.
1419: | Release the memory associated to this symbol. |
1420: `-----------------------------------------------*/
1421:
1.156 ! moko 1422: /*ARGSUSED*/
! 1423: #if (defined __STDC__ || defined __C99__FUNC__ \
! 1424: || defined __cplusplus || defined _MSC_VER)
1.112 paf 1425: static void
1.156 ! moko 1426: yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1.112 paf 1427: #else
1428: static void
1.156 ! moko 1429: yydestruct (yymsg, yytype, yyvaluep)
! 1430: const char *yymsg;
1.112 paf 1431: int yytype;
1432: YYSTYPE *yyvaluep;
1.1 parser 1433: #endif
1.112 paf 1434: {
1.156 ! moko 1435: YYUSE (yyvaluep);
! 1436:
! 1437: if (!yymsg)
! 1438: yymsg = "Deleting";
! 1439: YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1.112 paf 1440:
1441: switch (yytype)
1442: {
1443:
1444: default:
1.156 ! moko 1445: break;
1.112 paf 1446: }
1447: }
1.1 parser 1448:
1.112 paf 1449: /* Prevent warnings from -Wmissing-prototypes. */
1.1 parser 1450: #ifdef YYPARSE_PARAM
1.156 ! moko 1451: #if defined __STDC__ || defined __cplusplus
1.112 paf 1452: int yyparse (void *YYPARSE_PARAM);
1.156 ! moko 1453: #else
1.112 paf 1454: int yyparse ();
1.156 ! moko 1455: #endif
1.112 paf 1456: #else /* ! YYPARSE_PARAM */
1.156 ! moko 1457: #if defined __STDC__ || defined __cplusplus
1.112 paf 1458: int yyparse (void);
1459: #else
1460: int yyparse ();
1461: #endif
1462: #endif /* ! YYPARSE_PARAM */
1463:
1464:
1465:
1466:
1467:
1.156 ! moko 1468: /*-------------------------.
! 1469: | yyparse or yypush_parse. |
! 1470: `-------------------------*/
1.1 parser 1471:
1472: #ifdef YYPARSE_PARAM
1.156 ! moko 1473: #if (defined __STDC__ || defined __C99__FUNC__ \
! 1474: || defined __cplusplus || defined _MSC_VER)
! 1475: int
! 1476: yyparse (void *YYPARSE_PARAM)
! 1477: #else
! 1478: int
! 1479: yyparse (YYPARSE_PARAM)
! 1480: void *YYPARSE_PARAM;
! 1481: #endif
1.112 paf 1482: #else /* ! YYPARSE_PARAM */
1.156 ! moko 1483: #if (defined __STDC__ || defined __C99__FUNC__ \
! 1484: || defined __cplusplus || defined _MSC_VER)
1.112 paf 1485: int
1486: yyparse (void)
1.1 parser 1487: #else
1.112 paf 1488: int
1489: yyparse ()
1490:
1.1 parser 1491: #endif
1492: #endif
1.112 paf 1493: {
1.156 ! moko 1494: /* The lookahead symbol. */
1.112 paf 1495: int yychar;
1496:
1497: /* The semantic value of the lookahead symbol. */
1498: YYSTYPE yylval;
1499:
1.156 ! moko 1500: /* Number of syntax errors so far. */
! 1501: int yynerrs;
1.155 misha 1502:
1.156 ! moko 1503: int yystate;
! 1504: /* Number of tokens to shift before error messages enabled. */
! 1505: int yyerrstatus;
1.155 misha 1506:
1.156 ! moko 1507: /* The stacks and their tools:
! 1508: `yyss': related to states.
! 1509: `yyvs': related to semantic values.
1.109 paf 1510:
1.156 ! moko 1511: Refer to the stacks thru separate pointers, to allow yyoverflow
! 1512: to reallocate them elsewhere. */
1.112 paf 1513:
1.156 ! moko 1514: /* The state stack. */
! 1515: yytype_int16 yyssa[YYINITDEPTH];
! 1516: yytype_int16 *yyss;
! 1517: yytype_int16 *yyssp;
1.112 paf 1518:
1.156 ! moko 1519: /* The semantic value stack. */
! 1520: YYSTYPE yyvsa[YYINITDEPTH];
! 1521: YYSTYPE *yyvs;
! 1522: YYSTYPE *yyvsp;
1.112 paf 1523:
1.156 ! moko 1524: YYSIZE_T yystacksize;
1.112 paf 1525:
1.156 ! moko 1526: int yyn;
! 1527: int yyresult;
! 1528: /* Lookahead token as an internal (translated) token number. */
! 1529: int yytoken;
1.112 paf 1530: /* The variables used to return semantic value and location from the
1531: action routines. */
1532: YYSTYPE yyval;
1.1 parser 1533:
1.156 ! moko 1534: #if YYERROR_VERBOSE
! 1535: /* Buffer for error messages, and its allocated size. */
! 1536: char yymsgbuf[128];
! 1537: char *yymsg = yymsgbuf;
! 1538: YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
! 1539: #endif
! 1540:
! 1541: #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
! 1542:
! 1543: /* The number of symbols on the RHS of the reduced rule.
! 1544: Keep to zero when no symbol should be popped. */
! 1545: int yylen = 0;
! 1546:
! 1547: yytoken = 0;
! 1548: yyss = yyssa;
! 1549: yyvs = yyvsa;
! 1550: yystacksize = YYINITDEPTH;
1.1 parser 1551:
1.112 paf 1552: YYDPRINTF ((stderr, "Starting parse\n"));
1.1 parser 1553:
1554: yystate = 0;
1555: yyerrstatus = 0;
1556: yynerrs = 0;
1.156 ! moko 1557: yychar = YYEMPTY; /* Cause a token to be read. */
1.1 parser 1558:
1559: /* Initialize stack pointers.
1560: Waste one element of value and location stack
1561: so that they stay on the same level as the state stack.
1562: The wasted elements are never initialized. */
1.112 paf 1563: yyssp = yyss;
1.1 parser 1564: yyvsp = yyvs;
1565:
1.112 paf 1566: goto yysetstate;
1567:
1568: /*------------------------------------------------------------.
1569: | yynewstate -- Push a new state, which is found in yystate. |
1570: `------------------------------------------------------------*/
1571: yynewstate:
1572: /* In all cases, when you get here, the value and location stacks
1.156 ! moko 1573: have just been pushed. So pushing a state here evens the stacks. */
1.112 paf 1574: yyssp++;
1.105 paf 1575:
1.112 paf 1576: yysetstate:
1577: *yyssp = yystate;
1.108 paf 1578:
1.112 paf 1579: if (yyss + yystacksize - 1 <= yyssp)
1.109 paf 1580: {
1.1 parser 1581: /* Get the current used size of the three stacks, in elements. */
1.112 paf 1582: YYSIZE_T yysize = yyssp - yyss + 1;
1.1 parser 1583:
1584: #ifdef yyoverflow
1.112 paf 1585: {
1.156 ! moko 1586: /* Give user a chance to reallocate the stack. Use copies of
1.112 paf 1587: these so that the &'s don't force the real ones into
1588: memory. */
1589: YYSTYPE *yyvs1 = yyvs;
1.156 ! moko 1590: yytype_int16 *yyss1 = yyss;
1.112 paf 1591:
1592: /* Each stack pointer address is followed by the size of the
1593: data in use in that stack, in bytes. This used to be a
1594: conditional around just the two extra args, but that might
1595: be undefined if yyoverflow is a macro. */
1.156 ! moko 1596: yyoverflow (YY_("memory exhausted"),
1.112 paf 1597: &yyss1, yysize * sizeof (*yyssp),
1598: &yyvs1, yysize * sizeof (*yyvsp),
1599: &yystacksize);
1600:
1601: yyss = yyss1;
1602: yyvs = yyvs1;
1603: }
1.1 parser 1604: #else /* no yyoverflow */
1.112 paf 1605: # ifndef YYSTACK_RELOCATE
1.156 ! moko 1606: goto yyexhaustedlab;
1.112 paf 1607: # else
1.1 parser 1608: /* Extend the stack our own way. */
1.112 paf 1609: if (YYMAXDEPTH <= yystacksize)
1.156 ! moko 1610: goto yyexhaustedlab;
1.1 parser 1611: yystacksize *= 2;
1.112 paf 1612: if (YYMAXDEPTH < yystacksize)
1.1 parser 1613: yystacksize = YYMAXDEPTH;
1.112 paf 1614:
1615: {
1.156 ! moko 1616: yytype_int16 *yyss1 = yyss;
1.112 paf 1617: union yyalloc *yyptr =
1618: (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1619: if (! yyptr)
1.156 ! moko 1620: goto yyexhaustedlab;
! 1621: YYSTACK_RELOCATE (yyss_alloc, yyss);
! 1622: YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1.112 paf 1623: # undef YYSTACK_RELOCATE
1624: if (yyss1 != yyssa)
1625: YYSTACK_FREE (yyss1);
1626: }
1627: # endif
1.1 parser 1628: #endif /* no yyoverflow */
1629:
1.112 paf 1630: yyssp = yyss + yysize - 1;
1631: yyvsp = yyvs + yysize - 1;
1632:
1633: YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1634: (unsigned long int) yystacksize));
1.105 paf 1635:
1.112 paf 1636: if (yyss + yystacksize - 1 <= yyssp)
1.1 parser 1637: YYABORT;
1638: }
1639:
1.112 paf 1640: YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1.1 parser 1641:
1.156 ! moko 1642: if (yystate == YYFINAL)
! 1643: YYACCEPT;
! 1644:
1.1 parser 1645: goto yybackup;
1.112 paf 1646:
1647: /*-----------.
1648: | yybackup. |
1649: `-----------*/
1650: yybackup:
1.1 parser 1651:
1.156 ! moko 1652: /* Do appropriate processing given the current state. Read a
! 1653: lookahead token if we need one and don't already have one. */
1.1 parser 1654:
1655: /* First try to decide what to do without reference to lookahead token. */
1656: yyn = yypact[yystate];
1.112 paf 1657: if (yyn == YYPACT_NINF)
1.1 parser 1658: goto yydefault;
1659:
1660: /* Not known => get a lookahead token if don't already have one. */
1661:
1.112 paf 1662: /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1.1 parser 1663: if (yychar == YYEMPTY)
1664: {
1.112 paf 1665: YYDPRINTF ((stderr, "Reading a token: "));
1.1 parser 1666: yychar = YYLEX;
1667: }
1668:
1.112 paf 1669: if (yychar <= YYEOF)
1.1 parser 1670: {
1.112 paf 1671: yychar = yytoken = YYEOF;
1672: YYDPRINTF ((stderr, "Now at end of input.\n"));
1.1 parser 1673: }
1674: else
1675: {
1.112 paf 1676: yytoken = YYTRANSLATE (yychar);
1.156 ! moko 1677: YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1.1 parser 1678: }
1679:
1.112 paf 1680: /* If the proper action on seeing token YYTOKEN is to reduce or to
1681: detect an error, take that action. */
1682: yyn += yytoken;
1683: if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1.1 parser 1684: goto yydefault;
1685: yyn = yytable[yyn];
1.112 paf 1686: if (yyn <= 0)
1.1 parser 1687: {
1.112 paf 1688: if (yyn == 0 || yyn == YYTABLE_NINF)
1.1 parser 1689: goto yyerrlab;
1690: yyn = -yyn;
1691: goto yyreduce;
1692: }
1693:
1.156 ! moko 1694: /* Count tokens shifted since error; after three, turn off error
! 1695: status. */
! 1696: if (yyerrstatus)
! 1697: yyerrstatus--;
1.155 misha 1698:
1699: /* Shift the lookahead token. */
1.156 ! moko 1700: YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1.155 misha 1701:
1.156 ! moko 1702: /* Discard the shifted token. */
! 1703: yychar = YYEMPTY;
1.155 misha 1704:
1.156 ! moko 1705: yystate = yyn;
1.155 misha 1706: *++yyvsp = yylval;
1707:
1.1 parser 1708: goto yynewstate;
1709:
1.112 paf 1710:
1711: /*-----------------------------------------------------------.
1712: | yydefault -- do the default action for the current state. |
1713: `-----------------------------------------------------------*/
1.109 paf 1714: yydefault:
1.1 parser 1715: yyn = yydefact[yystate];
1716: if (yyn == 0)
1717: goto yyerrlab;
1.112 paf 1718: goto yyreduce;
1719:
1.105 paf 1720:
1.112 paf 1721: /*-----------------------------.
1722: | yyreduce -- Do a reduction. |
1723: `-----------------------------*/
1.1 parser 1724: yyreduce:
1.112 paf 1725: /* yyn is the number of a rule to reduce with. */
1.1 parser 1726: yylen = yyr2[yyn];
1.109 paf 1727:
1.112 paf 1728: /* If YYLEN is nonzero, implement the default value of the action:
1729: `$$ = $1'.
1.109 paf 1730:
1.112 paf 1731: Otherwise, the following line sets YYVAL to garbage.
1732: This behavior is undocumented and Bison
1733: users should not rely upon it. Assigning to YYVAL
1734: unconditionally makes the parser a bit smaller, and it avoids a
1735: GCC warning that YYVAL may be used uninitialized. */
1736: yyval = yyvsp[1-yylen];
1.106 paf 1737:
1.1 parser 1738:
1.112 paf 1739: YY_REDUCE_PRINT (yyn);
1740: switch (yyn)
1741: {
1742: case 2:
1.156 ! moko 1743:
! 1744: /* Line 1464 of yacc.c */
1.154 moko 1745: #line 133 "compile.y"
1.112 paf 1746: {
1.144 misha 1747: Method* method=new Method(Method::CT_ANY,
1.1 parser 1748: 0, 0, /*min, max numbered_params_count*/
1749: 0/*param_names*/, 0/*local_names*/,
1.156 ! moko 1750: (yyvsp[(1) - (1)])/*parser_code*/, 0/*native_code*/);
1.144 misha 1751: PC.cclass->set_method(PC.alias_method(main_method_name), method);
1.112 paf 1752: ;}
1753: break;
1754:
1755: case 9:
1.156 ! moko 1756:
! 1757: /* Line 1464 of yacc.c */
1.154 moko 1758: #line 148 "compile.y"
1.112 paf 1759: {
1.156 ! moko 1760: const String& command=LA2S(*(yyvsp[(2) - (4)]))->trim(String::TRIM_END);
! 1761: YYSTYPE strings_code=(yyvsp[(4) - (4)]);
1.84 paf 1762: if(strings_code->count()<1*OPERATIONS_PER_OPVALUE) {
1.1 parser 1763: strcpy(PC.error, "@");
1764: strcat(PC.error, command.cstr());
1765: strcat(PC.error, " is empty");
1766: YYERROR;
1767: }
1768: if(command==CLASS_NAME) {
1.84 paf 1769: if(strings_code->count()==1*OPERATIONS_PER_OPVALUE) {
1.155 misha 1770: PC.class_add();
1.1 parser 1771: // new class' name
1.152 misha 1772: const String& name=LA2S(*strings_code)->trim(String::TRIM_END);
1.1 parser 1773: // creating the class
1.84 paf 1774: VStateless_class* cclass=new VClass;
1.119 misha 1775: PC.cclass_new=cclass;
1776: PC.cclass_new->set_name(name);
1.1 parser 1777: } else {
1.84 paf 1778: strcpy(PC.error, "@"CLASS_NAME" must contain only one line with class name (contains more then one)");
1.1 parser 1779: YYERROR;
1780: }
1781: } else if(command==USE_CONTROL_METHOD_NAME) {
1.155 misha 1782: PC.class_add();
1.84 paf 1783: for(size_t i=0; i<strings_code->count(); i+=OPERATIONS_PER_OPVALUE)
1.152 misha 1784: PC.request.use_file(PC.request.main_class, LA2S(*strings_code, i)->trim(String::TRIM_END), PC.request.get_used_filename(PC.file_no));
1.1 parser 1785: } else if(command==BASE_NAME) {
1.119 misha 1786: if(PC.append){
1787: strcpy(PC.error, "can't set base while appending methods to class '");
1788: strncat(PC.error, PC.cclass->name().cstr(), MAX_STRING/2);
1789: strcat(PC.error, "'");
1790: YYERROR;
1791: }
1792: PC.class_add();
1.59 paf 1793: if(PC.cclass->base_class()) { // already changed from default?
1.1 parser 1794: strcpy(PC.error, "class already have a base '");
1.119 misha 1795: strncat(PC.error, PC.cclass->base_class()->name().cstr(), MAX_STRING/2);
1.1 parser 1796: strcat(PC.error, "'");
1797: YYERROR;
1798: }
1.84 paf 1799: if(strings_code->count()==1*OPERATIONS_PER_OPVALUE) {
1.152 misha 1800: const String& base_name=LA2S(*strings_code)->trim(String::TRIM_END);
1.145 misha 1801: if(Value* base_class_value=PC.request.get_class(base_name)) {
1.84 paf 1802: // @CLASS == @BASE sanity check
1803: if(VStateless_class *base_class=base_class_value->get_class()) {
1804: if(PC.cclass==base_class) {
1805: strcpy(PC.error, "@"CLASS_NAME" equals @"BASE_NAME);
1806: YYERROR;
1807: }
1808: PC.cclass->get_class()->set_base(base_class);
1809: } else { // they asked to derive from a class without methods ['env' & co]
1810: strcpy(PC.error, base_name.cstr());
1811: strcat(PC.error, ": you can not derive from this class in @"BASE_NAME);
1812: YYERROR;
1813: }
1814: } else {
1.1 parser 1815: strcpy(PC.error, base_name.cstr());
1816: strcat(PC.error, ": undefined class in @"BASE_NAME);
1817: YYERROR;
1818: }
1819: } else {
1820: strcpy(PC.error, "@"BASE_NAME" must contain sole name");
1821: YYERROR;
1822: }
1.116 misha 1823: } else if(command==OPTIONS_CONTROL_METHOD_NAME) {
1.118 misha 1824: for(size_t i=0; i<strings_code->count(); i+=OPERATIONS_PER_OPVALUE) {
1.152 misha 1825: const String& option=LA2S(*strings_code, i)->trim(String::TRIM_END);
1.119 misha 1826: if(option==OPTION_ALL_VARS_LOCAL_NAME){
1827: PC.set_all_vars_local();
1.123 misha 1828: } else if(option==OPTION_PARTIAL_CLASS){
1829: if(PC.cclass_new){
1830: if(VStateless_class* existed=PC.get_existed_class(PC.cclass_new)){
1831: if(!PC.reuse_existed_class(existed)){
1832: strcpy(PC.error, "can't append methods to '");
1833: strncat(PC.error, PC.cclass_new->name().cstr(), MAX_STRING/2);
1834: strcat(PC.error, "' - the class wasn't marked as partial");
1835: YYERROR;
1836: }
1.119 misha 1837: } else {
1.149 misha 1838: // marks the new class as partial. we will be able to add methods here later.
1.123 misha 1839: PC.cclass_new->set_partial();
1.119 misha 1840: }
1.123 misha 1841: } else {
1842: strcpy(PC.error, "'"OPTION_PARTIAL_CLASS"' option should be used straight after @"CLASS_NAME);
1.119 misha 1843: YYERROR;
1844: }
1.149 misha 1845: } else if(option==method_call_type_static){
1846: PC.set_methods_call_type(Method::CT_STATIC);
1847: } else if(option==method_call_type_dynamic){
1848: PC.set_methods_call_type(Method::CT_DYNAMIC);
1.118 misha 1849: } else {
1.119 misha 1850: strcpy(PC.error, "'");
1851: strncat(PC.error, option.cstr(), MAX_STRING/2);
1852: strcat(PC.error, "' invalid option. valid options are "
1.149 misha 1853: "'"OPTION_PARTIAL_CLASS"', '"OPTION_ALL_VARS_LOCAL_NAME"'"
1854: ", '"METHOD_CALL_TYPE_STATIC"' and '"METHOD_CALL_TYPE_DYNAMIC"'"
1855: );
1.118 misha 1856: YYERROR;
1.116 misha 1857: }
1858: }
1.1 parser 1859: } else {
1860: strcpy(PC.error, "'");
1861: strncat(PC.error, command.cstr(), MAX_STRING/2);
1862: strcat(PC.error, "' invalid special name. valid names are "
1.116 misha 1863: "'"CLASS_NAME"', '"USE_CONTROL_METHOD_NAME"', '"BASE_NAME"' and '"OPTIONS_CONTROL_METHOD_NAME"'.");
1.1 parser 1864: YYERROR;
1865: }
1.112 paf 1866: ;}
1867: break;
1868:
1869: case 13:
1.156 ! moko 1870:
! 1871: /* Line 1464 of yacc.c */
1.155 misha 1872: #line 257 "compile.y"
1.156 ! moko 1873: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;}
1.112 paf 1874: break;
1875:
1876: case 17:
1.156 ! moko 1877:
! 1878: /* Line 1464 of yacc.c */
1.155 misha 1879: #line 261 "compile.y"
1.112 paf 1880: {
1.119 misha 1881: PC.class_add();
1.96 paf 1882: PC.explicit_result=false;
1.1 parser 1883:
1.156 ! moko 1884: YYSTYPE params_names_code=(yyvsp[(3) - (6)]);
1.84 paf 1885: ArrayString* params_names=0;
1886: if(int size=params_names_code->count()) {
1887: params_names=new ArrayString;
1888: for(int i=0; i<size; i+=OPERATIONS_PER_OPVALUE)
1889: *params_names+=LA2S(*params_names_code, i);
1.1 parser 1890: }
1891:
1.156 ! moko 1892: YYSTYPE locals_names_code=(yyvsp[(4) - (6)]);
1.84 paf 1893: ArrayString* locals_names=0;
1.116 misha 1894: bool all_vars_local=false;
1.84 paf 1895: if(int size=locals_names_code->count()) {
1896: locals_names=new ArrayString;
1.96 paf 1897: for(int i=0; i<size; i+=OPERATIONS_PER_OPVALUE) {
1898: const String* local_name=LA2S(*locals_names_code, i);
1899: if(*local_name==RESULT_VAR_NAME)
1900: PC.explicit_result=true;
1.119 misha 1901: else if(*local_name==OPTION_ALL_VARS_LOCAL_NAME)
1.116 misha 1902: all_vars_local=true;
1.96 paf 1903: else
1904: *locals_names+=local_name;
1905: }
1.1 parser 1906: }
1.124 misha 1907: if(!all_vars_local && PC.cclass && PC.cclass->is_vars_local())
1.116 misha 1908: all_vars_local=true;
1.1 parser 1909:
1.96 paf 1910: Method* method=new Method(
1.84 paf 1911: //name,
1.156 ! moko 1912: GetMethodCallType(PC, *(yyvsp[(2) - (6)])),
1.1 parser 1913: 0, 0/*min,max numbered_params_count*/,
1914: params_names, locals_names,
1.116 misha 1915: 0/*to be filled later in next {} */, 0, all_vars_local);
1.114 misha 1916:
1.156 ! moko 1917: *reinterpret_cast<Method**>(&(yyval))=method;
1.112 paf 1918: ;}
1919: break;
1920:
1.115 misha 1921: case 18:
1.156 ! moko 1922:
! 1923: /* Line 1464 of yacc.c */
1.155 misha 1924: #line 299 "compile.y"
1.115 misha 1925: {
1.156 ! moko 1926: Method* method=reinterpret_cast<Method*>((yyvsp[(7) - (8)]));
1.124 misha 1927: // fill in the code
1.156 ! moko 1928: method->parser_code=(yyvsp[(8) - (8)]);
1.124 misha 1929:
1930: // register in class
1.156 ! moko 1931: const String& name=*LA2S(*(yyvsp[(2) - (8)]));
1.144 misha 1932: PC.cclass->set_method(PC.alias_method(name), method);
1.115 misha 1933: ;}
1934: break;
1935:
1936: case 21:
1.156 ! moko 1937:
! 1938: /* Line 1464 of yacc.c */
1.155 misha 1939: #line 310 "compile.y"
1.156 ! moko 1940: {(yyval)=(yyvsp[(2) - (3)]);;}
1.112 paf 1941: break;
1942:
1.115 misha 1943: case 25:
1.156 ! moko 1944:
! 1945: /* Line 1464 of yacc.c */
1.155 misha 1946: #line 312 "compile.y"
1.156 ! moko 1947: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); ;}
1.112 paf 1948: break;
1949:
1.115 misha 1950: case 31:
1.156 ! moko 1951:
! 1952: /* Line 1464 of yacc.c */
1.155 misha 1953: #line 320 "compile.y"
1.156 ! moko 1954: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;}
1.112 paf 1955: break;
1956:
1.115 misha 1957: case 37:
1.156 ! moko 1958:
! 1959: /* Line 1464 of yacc.c */
1.155 misha 1960: #line 326 "compile.y"
1.112 paf 1961: {
1.156 ! moko 1962: (yyval)=N();
! 1963: YYSTYPE code=(yyvsp[(1) - (1)]);
1.140 misha 1964: size_t count=code->count();
1.138 misha 1965:
1.128 misha 1966: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
1.140 misha 1967: if(
1968: count!=3
1969: || !maybe_change_first_opcode(*code, OP::OP_VALUE__GET_ELEMENT, /*=>*/OP::OP_VALUE__GET_ELEMENT__WRITE)
1970: )
1.131 misha 1971: #endif
1.140 misha 1972:
1.138 misha 1973: #ifdef OPTIMIZE_BYTECODE_GET_SELF_ELEMENT
1.140 misha 1974: if(
1975: count!=3
1976: || !maybe_change_first_opcode(*code, OP::OP_WITH_SELF__VALUE__GET_ELEMENT, /*=>*/OP::OP_WITH_SELF__VALUE__GET_ELEMENT__WRITE)
1977: )
1.138 misha 1978: #endif
1979:
1.132 misha 1980: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_ELEMENT
1.140 misha 1981: if(
1982: count!=5
1983: || !maybe_change_first_opcode(*code, OP::OP_GET_OBJECT_ELEMENT, /*=>*/OP::OP_GET_OBJECT_ELEMENT__WRITE)
1984: )
1.128 misha 1985: #endif
1.132 misha 1986:
1987: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_VAR_ELEMENT
1.140 misha 1988: if(
1989: count!=5
1990: || !maybe_change_first_opcode(*code, OP::OP_GET_OBJECT_VAR_ELEMENT, /*=>*/OP::OP_GET_OBJECT_VAR_ELEMENT__WRITE)
1991: )
1.131 misha 1992: #endif
1.140 misha 1993: {
1994: changetail_or_append(*code,
1995: OP::OP_GET_ELEMENT, false, /*=>*/OP::OP_GET_ELEMENT__WRITE,
1996: /*or */OP::OP_WRITE_VALUE
1997: ); /* value=pop; wcontext.write(value) */
1.139 misha 1998: }
1.140 misha 1999:
1.156 ! moko 2000: P(*(yyval), *code);
1.112 paf 2001: ;}
2002: break;
2003:
1.115 misha 2004: case 38:
1.156 ! moko 2005:
! 2006: /* Line 1464 of yacc.c */
1.155 misha 2007: #line 367 "compile.y"
1.156 ! moko 2008: { (yyval)=(yyvsp[(2) - (2)]); ;}
1.112 paf 2009: break;
2010:
1.115 misha 2011: case 41:
1.156 ! moko 2012:
! 2013: /* Line 1464 of yacc.c */
1.155 misha 2014: #line 369 "compile.y"
1.156 ! moko 2015: { (yyval)=(yyvsp[(2) - (3)]); ;}
1.112 paf 2016: break;
2017:
1.115 misha 2018: case 44:
1.156 ! moko 2019:
! 2020: /* Line 1464 of yacc.c */
1.155 misha 2021: #line 373 "compile.y"
1.112 paf 2022: {
1.156 ! moko 2023: (yyval)=N();
! 2024: YYSTYPE diving_code=(yyvsp[(1) - (1)]);
1.132 misha 2025: size_t count=diving_code->count();
1.140 misha 2026:
1.156 ! moko 2027: if(maybe_make_self(*(yyval), *diving_code, count)) {
1.140 misha 2028: // $self.
2029: } else
1.132 misha 2030:
2031: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_ELEMENT
1.156 ! moko 2032: if(maybe_make_get_object_element(*(yyval), *diving_code, count)){
1.138 misha 2033: // optimization for $object.field + ^object.method[
1.140 misha 2034: } else
1.131 misha 2035: #endif
1.132 misha 2036:
2037: #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_VAR_ELEMENT
1.156 ! moko 2038: if(maybe_make_get_object_var_element(*(yyval), *diving_code, count)){
1.138 misha 2039: // optimization for $object.$var
1.140 misha 2040: } else
1.131 misha 2041: #endif
1.132 misha 2042:
2043: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
1.141 misha 2044: if(
2045: count>=4
2046: && (*diving_code)[0].code==OP::OP_VALUE
2047: && (*diving_code)[3].code==OP::OP_GET_ELEMENT
2048: ){
2049: // optimization
1.156 ! moko 2050: O(*(yyval),
1.140 misha 2051: (PC.in_call_value && count==4)
1.132 misha 2052: ? OP::OP_VALUE__GET_ELEMENT_OR_OPERATOR // ^object[ : OP_VALUE+origin+string+OP_GET_ELEMENT => OP_VALUE__GET_ELEMENT_OR_OPERATOR+origin+string
2053: : OP::OP_VALUE__GET_ELEMENT // $object : OP_VALUE+origin+string+OP_GET_ELEMENT => OP_VALUE__GET_ELEMENT+origin+string
2054: );
1.156 ! moko 2055: P(*(yyval), *diving_code, 1/*offset*/, 2/*limit*/); // copy origin+value
1.140 misha 2056: if(count>4)
1.156 ! moko 2057: P(*(yyval), *diving_code, 4); // copy tail
1.132 misha 2058: } else {
1.156 ! moko 2059: O(*(yyval), OP::OP_WITH_READ); /* stack: starting context */
! 2060: P(*(yyval), *diving_code);
1.132 misha 2061: }
1.126 misha 2062: #else
1.140 misha 2063: {
1.156 ! moko 2064: O(*(yyval), OP::OP_WITH_READ); /* stack: starting context */
1.37 paf 2065:
1.131 misha 2066: // ^if OP_ELEMENT => ^if OP_ELEMENT_OR_OPERATOR
2067: // optimized OP_VALUE+origin+string+OP_GET_ELEMENT. => OP_VALUE+origin+string+OP_GET_ELEMENT_OR_OPERATOR.
1.132 misha 2068: if(PC.in_call_value && count==4)
2069: diving_code->put(count-1, OP::OP_GET_ELEMENT_OR_OPERATOR);
1.156 ! moko 2070: P(*(yyval), *diving_code);
1.132 misha 2071: }
1.126 misha 2072: #endif
1.1 parser 2073: /* diving code; stack: current context */
1.112 paf 2074: ;}
2075: break;
2076:
1.115 misha 2077: case 45:
1.156 ! moko 2078:
! 2079: /* Line 1464 of yacc.c */
1.155 misha 2080: #line 426 "compile.y"
1.156 ! moko 2081: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;}
1.112 paf 2082: break;
2083:
1.115 misha 2084: case 47:
1.156 ! moko 2085:
! 2086: /* Line 1464 of yacc.c */
1.155 misha 2087: #line 427 "compile.y"
1.156 ! moko 2088: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;}
1.112 paf 2089: break;
2090:
1.115 misha 2091: case 48:
1.156 ! moko 2092:
! 2093: /* Line 1464 of yacc.c */
1.155 misha 2094: #line 431 "compile.y"
1.112 paf 2095: {
1.156 ! moko 2096: (yyval)=N();
1.137 misha 2097: #ifdef OPTIMIZE_BYTECODE_CONSTRUCT
1.156 ! moko 2098: if(maybe_optimize_construct(*(yyval), *(yyvsp[(2) - (3)]), *(yyvsp[(3) - (3)]))){
1.139 misha 2099: // $a(expr), $.a(expr), $a[value], $.a[value], $self.a[value], $self.a(expr)
1.134 misha 2100: } else
2101: #endif
2102: {
1.156 ! moko 2103: P(*(yyval), *(yyvsp[(2) - (3)])); /* stack: context,name */
! 2104: P(*(yyval), *(yyvsp[(3) - (3)])); /* stack: context,name,constructor_value */
1.134 misha 2105: }
1.112 paf 2106: ;}
2107: break;
2108:
1.115 misha 2109: case 52:
1.156 ! moko 2110:
! 2111: /* Line 1464 of yacc.c */
1.155 misha 2112: #line 447 "compile.y"
1.112 paf 2113: {
1.156 ! moko 2114: (yyval)=N();
! 2115: YYSTYPE diving_code=(yyvsp[(1) - (1)]);
1.140 misha 2116: size_t count=diving_code->count();
2117:
1.156 ! moko 2118: if(maybe_make_self(*(yyval), *diving_code, count)) {
1.140 misha 2119: // $self.
2120: } else
2121: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
2122: if(
2123: count>=4
2124: && (*diving_code)[0].code==OP::OP_VALUE
2125: && (*diving_code)[3].code==OP::OP_GET_ELEMENT
2126: ){
1.156 ! moko 2127: O(*(yyval), OP::OP_WITH_ROOT__VALUE__GET_ELEMENT);
! 2128: P(*(yyval), *diving_code, 1/*offset*/, 2/*limit*/); // copy origin+value
1.140 misha 2129: if(count>4)
1.156 ! moko 2130: P(*(yyval), *diving_code, 4); // tail
1.140 misha 2131: } else
2132: #endif
2133: {
1.156 ! moko 2134: O(*(yyval), OP::OP_WITH_ROOT); /* stack: starting context */
! 2135: P(*(yyval), *diving_code);
1.1 parser 2136: }
2137: /* diving code; stack: current context */
1.112 paf 2138: ;}
2139: break;
2140:
1.115 misha 2141: case 53:
1.156 ! moko 2142:
! 2143: /* Line 1464 of yacc.c */
1.155 misha 2144: #line 473 "compile.y"
1.112 paf 2145: {
1.156 ! moko 2146: (yyval)=N();
! 2147: O(*(yyval), OP::OP_WITH_WRITE); /* stack: starting context */
! 2148: P(*(yyval), *(yyvsp[(2) - (2)])); /* diving code; stack: context,name */
1.112 paf 2149: ;}
2150: break;
2151:
1.115 misha 2152: case 54:
1.156 ! moko 2153:
! 2154: /* Line 1464 of yacc.c */
1.155 misha 2155: #line 478 "compile.y"
1.156 ! moko 2156: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;}
1.112 paf 2157: break;
2158:
1.115 misha 2159: case 58:
1.156 ! moko 2160:
! 2161: /* Line 1464 of yacc.c */
1.155 misha 2162: #line 485 "compile.y"
1.112 paf 2163: {
1.100 paf 2164: // allow $result_or_other_variable[ letters here any time ]
1.156 ! moko 2165: *reinterpret_cast<bool*>(&(yyval))=PC.explicit_result; PC.explicit_result=false;
1.112 paf 2166: ;}
2167: break;
2168:
1.115 misha 2169: case 59:
1.156 ! moko 2170:
! 2171: /* Line 1464 of yacc.c */
1.155 misha 2172: #line 488 "compile.y"
1.112 paf 2173: {
1.156 ! moko 2174: PC.explicit_result=*reinterpret_cast<bool*>(&(yyvsp[(2) - (3)]));
1.112 paf 2175: ;}
2176: break;
2177:
1.115 misha 2178: case 60:
1.156 ! moko 2179:
! 2180: /* Line 1464 of yacc.c */
1.155 misha 2181: #line 490 "compile.y"
1.112 paf 2182: {
1.1 parser 2183: // stack: context, name
1.156 ! moko 2184: (yyval)=(yyvsp[(3) - (5)]); // stack: context, name, value
! 2185: O(*(yyval), OP::OP_CONSTRUCT_VALUE); /* value=pop; name=pop; context=pop; construct(context,name,value) */
1.112 paf 2186: ;}
2187: break;
2188:
1.115 misha 2189: case 61:
1.156 ! moko 2190:
! 2191: /* Line 1464 of yacc.c */
1.155 misha 2192: #line 496 "compile.y"
1.112 paf 2193: {
1.156 ! moko 2194: (yyval)=N();
! 2195: O(*(yyval), OP::OP_PREPARE_TO_EXPRESSION);
1.1 parser 2196: // stack: context, name
1.156 ! moko 2197: P(*(yyval), *(yyvsp[(2) - (3)])); // stack: context, name, value
! 2198: O(*(yyval), OP::OP_CONSTRUCT_EXPR); /* value=pop->as_expr_result; name=pop; context=pop; construct(context,name,value) */
1.112 paf 2199: ;}
2200: break;
2201:
1.115 misha 2202: case 62:
1.156 ! moko 2203:
! 2204: /* Line 1464 of yacc.c */
1.155 misha 2205: #line 504 "compile.y"
1.112 paf 2206: {
1.1 parser 2207: // stack: context, name
1.156 ! moko 2208: (yyval)=N();
! 2209: OA(*(yyval), OP::OP_CURLY_CODE__CONSTRUCT, (yyvsp[(2) - (3)])); /* code=pop; name=pop; context=pop; construct(context,name,junction(code)) */
1.112 paf 2210: ;}
2211: break;
2212:
1.115 misha 2213: case 66:
1.156 ! moko 2214:
! 2215: /* Line 1464 of yacc.c */
1.155 misha 2216: #line 515 "compile.y"
1.112 paf 2217: {
1.156 ! moko 2218: (yyval)=N();
! 2219: OA(*(yyval), OP::OP_OBJECT_POOL, (yyvsp[(1) - (1)])); /* stack: empty write context */
1.47 paf 2220: /* some code that writes to that context */
2221: /* context=pop; stack: context.value() */
1.112 paf 2222: ;}
2223: break;
2224:
1.115 misha 2225: case 69:
1.156 ! moko 2226:
! 2227: /* Line 1464 of yacc.c */
1.155 misha 2228: #line 522 "compile.y"
1.156 ! moko 2229: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;}
1.112 paf 2230: break;
2231:
1.115 misha 2232: case 70:
1.156 ! moko 2233:
! 2234: /* Line 1464 of yacc.c */
1.155 misha 2235: #line 526 "compile.y"
1.112 paf 2236: {
1.131 misha 2237: #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR
1.156 ! moko 2238: if((*(yyvsp[(1) - (1)])).count())
1.131 misha 2239: #endif
2240: {
1.156 ! moko 2241: (yyval)=(yyvsp[(1) - (1)]); /* stack: value */
! 2242: if(!maybe_change_first_opcode(*(yyval), OP::OP_CONSTRUCT_OBJECT, /*=>*/OP::OP_CONSTRUCT_OBJECT__WRITE))
! 2243: changetail_or_append(*(yyval),
1.142 misha 2244: OP::OP_CALL, true, /*=>*/ OP::OP_CALL__WRITE,
2245: /*or */OP::OP_WRITE_VALUE); /* value=pop; wcontext.write(value) */
1.131 misha 2246: }
1.112 paf 2247: ;}
2248: break;
2249:
1.115 misha 2250: case 71:
1.156 ! moko 2251:
! 2252: /* Line 1464 of yacc.c */
1.155 misha 2253: #line 538 "compile.y"
1.112 paf 2254: {
1.39 paf 2255: PC.in_call_value=true;
1.112 paf 2256: ;}
2257: break;
2258:
1.115 misha 2259: case 72:
1.156 ! moko 2260:
! 2261: /* Line 1464 of yacc.c */
1.155 misha 2262: #line 541 "compile.y"
1.112 paf 2263: {
1.39 paf 2264: PC.in_call_value=false;
1.112 paf 2265: ;}
2266: break;
2267:
1.115 misha 2268: case 73:
1.156 ! moko 2269:
! 2270: /* Line 1464 of yacc.c */
1.155 misha 2271: #line 544 "compile.y"
1.112 paf 2272: { /* ^field.$method{vasya} */
1.131 misha 2273: #ifdef OPTIMIZE_BYTECODE_CUT_REM_OPERATOR
1.135 misha 2274: #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT
1.156 ! moko 2275: const String* operator_name=LA2S(*(yyvsp[(3) - (6)]), 0, OP::OP_VALUE__GET_ELEMENT_OR_OPERATOR);
1.135 misha 2276: #else
1.156 ! moko 2277: const String* operator_name=LA2S(*(yyvsp[(3) - (6)]), 1);
1.135 misha 2278: #endif
1.142 misha 2279: if(operator_name && *operator_name==REM_OPERATOR_NAME){
1.156 ! moko 2280: (yyval)=N();
1.131 misha 2281: } else
2282: #endif
2283: {
1.156 ! moko 2284: YYSTYPE params_code=(yyvsp[(5) - (6)]);
1.131 misha 2285: if(params_code->count()==3) { // probably [] case. [OP::OP_VALUE+origin+Void]
2286: if(Value* value=LA2V(*params_code)) // it is OP_VALUE+origin+value?
1.153 moko 2287: if(const String * string=value->get_string())
2288: if(string->is_empty()) // value is empty string?
2289: params_code=0; // ^zzz[] case. don't append lone empty param.
1.131 misha 2290: }
2291: /* stack: context, method_junction */
1.142 misha 2292:
1.156 ! moko 2293: YYSTYPE var_code=(yyvsp[(3) - (6)]);
1.142 misha 2294: if(
2295: var_code->count()==8
2296: && (*var_code)[0].code==OP::OP_VALUE__GET_CLASS
2297: && (*var_code)[3].code==OP::OP_PREPARE_TO_CONSTRUCT_OBJECT
2298: && (*var_code)[4].code==OP::OP_VALUE
2299: && (*var_code)[7].code==OP::OP_GET_ELEMENT
2300: ){
2301: yyval=N();
1.156 ! moko 2302: O(*(yyval), OP::OP_CONSTRUCT_OBJECT);
! 2303: P(*(yyval), *var_code, 1/*offset*/, 2/*limit*/); // class name
! 2304: P(*(yyval), *var_code, 5/*offset*/, 2/*limit*/); // constructor name
! 2305: OA(*(yyval), params_code);
1.142 misha 2306: } else
2307: {
1.156 ! moko 2308: (yyval)=var_code; /* with_xxx,diving code; stack: context,method_junction */
! 2309: OA(*(yyval), OP::OP_CALL, params_code); // method_frame=make frame(pop junction); ncontext=pop; call(ncontext,method_frame) stack: value
1.142 misha 2310: }
1.131 misha 2311: }
1.112 paf 2312: ;}
2313: break;
2314:
1.115 misha 2315: case 76:
1.156 ! moko 2316:
! 2317: /* Line 1464 of yacc.c */
1.155 misha 2318: #line 588 "compile.y"
1.156 ! moko 2319: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;}
1.112 paf 2320: break;
2321:
1.115 misha 2322: case 80:
1.156 ! moko 2323:
! 2324: /* Line 1464 of yacc.c */
1.155 misha 2325: #line 594 "compile.y"
1.112 paf 2326: {
1.100 paf 2327: // allow ^call[ letters here any time ]
1.156 ! moko 2328: *reinterpret_cast<bool*>(&(yyval))=PC.explicit_result; PC.explicit_result=false;
1.112 paf 2329: ;}
2330: break;
2331:
1.115 misha 2332: case 81:
1.156 ! moko 2333:
! 2334: /* Line 1464 of yacc.c */
1.155 misha 2335: #line 597 "compile.y"
1.112 paf 2336: {
1.156 ! moko 2337: PC.explicit_result=*reinterpret_cast<bool*>(&(yyvsp[(2) - (3)]));
1.112 paf 2338: ;}
2339: break;
2340:
1.115 misha 2341: case 82:
1.156 ! moko 2342:
! 2343: /* Line 1464 of yacc.c */
1.155 misha 2344: #line 599 "compile.y"
1.156 ! moko 2345: {(yyval)=(yyvsp[(3) - (5)]);;}
1.112 paf 2346: break;
2347:
1.115 misha 2348: case 83:
1.156 ! moko 2349:
! 2350: /* Line 1464 of yacc.c */
1.155 misha 2351: #line 600 "compile.y"
1.156 ! moko 2352: {(yyval)=(yyvsp[(2) - (3)]);;}
1.112 paf 2353: break;
2354:
1.115 misha 2355: case 84:
1.156 ! moko 2356:
! 2357: /* Line 1464 of yacc.c */
1.155 misha 2358: #line 601 "compile.y"
1.156 ! moko 2359: {(yyval)=(yyvsp[(2) - (3)]);;}
1.112 paf 2360: break;
2361:
1.115 misha 2362: case 86:
1.156 ! moko 2363:
! 2364: /* Line 1464 of yacc.c */
1.155 misha 2365: #line 604 "compile.y"
1.156 ! moko 2366: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); ;}
1.112 paf 2367: break;
2368:
1.115 misha 2369: case 88:
1.156 ! moko 2370:
! 2371: /* Line 1464 of yacc.c */
1.155 misha 2372: #line 608 "compile.y"
1.156 ! moko 2373: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); ;}
1.112 paf 2374: break;
2375:
1.115 misha 2376: case 90:
1.156 ! moko 2377:
! 2378: /* Line 1464 of yacc.c */
1.155 misha 2379: #line 612 "compile.y"
1.156 ! moko 2380: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); ;}
1.112 paf 2381: break;
2382:
1.115 misha 2383: case 91:
1.156 ! moko 2384:
! 2385: /* Line 1464 of yacc.c */
1.155 misha 2386: #line 614 "compile.y"
1.112 paf 2387: {
1.156 ! moko 2388: (yyval)=(yyvsp[(1) - (1)]);
1.112 paf 2389: ;}
2390: break;
2391:
1.115 misha 2392: case 92:
1.156 ! moko 2393:
! 2394: /* Line 1464 of yacc.c */
1.155 misha 2395: #line 617 "compile.y"
1.112 paf 2396: {
1.156 ! moko 2397: YYSTYPE expr_code=(yyvsp[(1) - (1)]);
1.106 paf 2398: if(expr_code->count()==3
1.127 misha 2399: && (*expr_code)[0].code==OP::OP_VALUE) { // optimizing (double/bool/incidently 'string' too) case. [OP::OP_VALUE+origin+Double]. no evaluating
1.156 ! moko 2400: (yyval)=expr_code;
1.104 paf 2401: } else {
1.131 misha 2402: YYSTYPE code=N();
1.122 misha 2403: O(*code, OP::OP_PREPARE_TO_EXPRESSION);
1.104 paf 2404: P(*code, *expr_code);
1.122 misha 2405: O(*code, OP::OP_WRITE_EXPR_RESULT);
1.156 ! moko 2406: (yyval)=N();
! 2407: OA(*(yyval), OP::OP_EXPR_CODE__STORE_PARAM, code);
1.104 paf 2408: }
1.112 paf 2409: ;}
2410: break;
2411:
1.115 misha 2412: case 93:
1.156 ! moko 2413:
! 2414: /* Line 1464 of yacc.c */
1.155 misha 2415: #line 631 "compile.y"
1.112 paf 2416: {
1.156 ! moko 2417: (yyval)=N();
! 2418: OA(*(yyval), OP::OP_CURLY_CODE__STORE_PARAM, (yyvsp[(1) - (1)]));
1.112 paf 2419: ;}
2420: break;
2421:
1.115 misha 2422: case 98:
1.156 ! moko 2423:
! 2424: /* Line 1464 of yacc.c */
1.155 misha 2425: #line 643 "compile.y"
1.156 ! moko 2426: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;}
1.112 paf 2427: break;
2428:
1.115 misha 2429: case 100:
1.156 ! moko 2430:
! 2431: /* Line 1464 of yacc.c */
1.155 misha 2432: #line 645 "compile.y"
1.156 ! moko 2433: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;}
1.112 paf 2434: break;
2435:
1.115 misha 2436: case 102:
1.156 ! moko 2437:
! 2438: /* Line 1464 of yacc.c */
1.155 misha 2439: #line 647 "compile.y"
1.112 paf 2440: {
1.33 paf 2441: // we know that name_advance1 not called from ^xxx context
2442: // so we'll not check for operator call possibility as we do in name_advance2
2443:
1.1 parser 2444: /* stack: context */
1.156 ! moko 2445: (yyval)=(yyvsp[(1) - (1)]); /* stack: context,name */
! 2446: O(*(yyval), OP::OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.112 paf 2447: ;}
2448: break;
2449:
1.115 misha 2450: case 103:
1.156 ! moko 2451:
! 2452: /* Line 1464 of yacc.c */
1.155 misha 2453: #line 655 "compile.y"
1.112 paf 2454: {
1.1 parser 2455: /* stack: context */
1.156 ! moko 2456: (yyval)=(yyvsp[(1) - (1)]); /* stack: context,name */
! 2457: O(*(yyval), OP::OP_GET_ELEMENT); /* name=pop; context=pop; stack: context.get_element(name) */
1.112 paf 2458: ;}
2459: break;
2460:
1.115 misha 2461: case 109:
1.156 ! moko 2462:
! 2463: /* Line 1464 of yacc.c */
1.155 misha 2464: #line 668 "compile.y"
1.112 paf 2465: {
1.156 ! moko 2466: (yyval)=(yyvsp[(2) - (2)]);
! 2467: O(*(yyval), OP::OP_GET_ELEMENT);
1.112 paf 2468: ;}
2469: break;
2470:
1.115 misha 2471: case 110:
1.156 ! moko 2472:
! 2473: /* Line 1464 of yacc.c */
1.155 misha 2474: #line 672 "compile.y"
1.112 paf 2475: {
1.131 misha 2476: YYSTYPE code;
1.47 paf 2477: {
1.156 ! moko 2478: change_string_literal_to_write_string_literal(*(code=(yyvsp[(1) - (2)])));
! 2479: P(*code, *(yyvsp[(2) - (2)]));
1.47 paf 2480: }
1.156 ! moko 2481: (yyval)=N();
! 2482: OA(*(yyval), OP::OP_STRING_POOL, code);
1.112 paf 2483: ;}
2484: break;
2485:
1.115 misha 2486: case 111:
1.156 ! moko 2487:
! 2488: /* Line 1464 of yacc.c */
1.155 misha 2489: #line 681 "compile.y"
1.112 paf 2490: {
1.100 paf 2491: // allow $result_or_other_variable[ letters here any time ]
1.156 ! moko 2492: *reinterpret_cast<bool*>(&(yyval))=PC.explicit_result; PC.explicit_result=false;
1.112 paf 2493: ;}
2494: break;
2495:
1.115 misha 2496: case 112:
1.156 ! moko 2497:
! 2498: /* Line 1464 of yacc.c */
1.155 misha 2499: #line 684 "compile.y"
1.112 paf 2500: {
1.156 ! moko 2501: PC.explicit_result=*reinterpret_cast<bool*>(&(yyvsp[(2) - (3)]));
1.112 paf 2502: ;}
2503: break;
2504:
1.115 misha 2505: case 113:
1.156 ! moko 2506:
! 2507: /* Line 1464 of yacc.c */
1.155 misha 2508: #line 686 "compile.y"
1.112 paf 2509: {
1.156 ! moko 2510: (yyval)=N();
! 2511: OA(*(yyval), OP::OP_OBJECT_POOL, (yyvsp[(3) - (5)])); /* stack: empty write context */
1.47 paf 2512: /* some code that writes to that context */
2513: /* context=pop; stack: context.value() */
1.112 paf 2514: ;}
2515: break;
2516:
1.115 misha 2517: case 114:
1.156 ! moko 2518:
! 2519: /* Line 1464 of yacc.c */
1.155 misha 2520: #line 692 "compile.y"
1.112 paf 2521: {
1.156 ! moko 2522: (yyval)=N();
! 2523: O(*(yyval), OP::OP_WITH_READ);
! 2524: P(*(yyval), *(yyvsp[(1) - (1)]));
1.112 paf 2525: ;}
2526: break;
2527:
1.115 misha 2528: case 116:
1.156 ! moko 2529:
! 2530: /* Line 1464 of yacc.c */
1.155 misha 2531: #line 697 "compile.y"
1.156 ! moko 2532: { (yyval)=(yyvsp[(1) - (2)]); P(*(yyval), *(yyvsp[(2) - (2)])); ;}
1.112 paf 2533: break;
2534:
1.115 misha 2535: case 117:
1.156 ! moko 2536:
! 2537: /* Line 1464 of yacc.c */
1.155 misha 2538: #line 698 "compile.y"
1.112 paf 2539: {
1.156 ! moko 2540: (yyval)=(yyvsp[(2) - (2)]);
! 2541: O(*(yyval), OP::OP_GET_ELEMENT__WRITE);
1.112 paf 2542: ;}
2543: break;
2544:
1.115 misha 2545: case 120:
1.156 ! moko 2546:
! 2547: /* Line 1464 of yacc.c */
1.155 misha 2548: #line 707 "compile.y"
1.112 paf 2549: {
1.156 ! moko 2550: (yyval)=(yyvsp[(1) - (2)]); // stack: class name string
! 2551: if(*LA2S(*(yyval)) == BASE_NAME) { // pseudo BASE class
1.84 paf 2552: if(VStateless_class* base=PC.cclass->base_class()) {
1.156 ! moko 2553: change_string_literal_value(*(yyval), base->name());
1.61 paf 2554: } else {
2555: strcpy(PC.error, "no base class declared");
2556: YYERROR;
2557: }
2558: }
1.131 misha 2559: // optimized OP_VALUE+origin+string+OP_GET_CLASS => OP_VALUE__GET_CLASS+origin+string
1.156 ! moko 2560: maybe_change_first_opcode(*(yyval), OP::OP_VALUE, OP::OP_VALUE__GET_CLASS);
1.112 paf 2561: ;}
2562: break;
2563:
1.115 misha 2564: case 121:
1.156 ! moko 2565:
! 2566: /* Line 1464 of yacc.c */
1.155 misha 2567: #line 720 "compile.y"
1.112 paf 2568: {
1.156 ! moko 2569: (yyval)=(yyvsp[(1) - (2)]);
1.39 paf 2570: if(!PC.in_call_value) {
1.1 parser 2571: strcpy(PC.error, ":: not allowed here");
2572: YYERROR;
2573: }
1.156 ! moko 2574: O(*(yyval), OP::OP_PREPARE_TO_CONSTRUCT_OBJECT);
1.112 paf 2575: ;}
2576: break;
2577:
1.115 misha 2578: case 128:
1.156 ! moko 2579:
! 2580: /* Line 1464 of yacc.c */
1.155 misha 2581: #line 739 "compile.y"
1.156 ! moko 2582: { (yyval) = (yyvsp[(2) - (3)]); ;}
1.114 misha 2583: break;
2584:
1.115 misha 2585: case 129:
1.156 ! moko 2586:
! 2587: /* Line 1464 of yacc.c */
1.155 misha 2588: #line 740 "compile.y"
1.156 ! moko 2589: { (yyval) = (yyvsp[(2) - (3)]); ;}
1.112 paf 2590: break;
2591:
1.115 misha 2592: case 130:
1.156 ! moko 2593:
! 2594: /* Line 1464 of yacc.c */
1.155 misha 2595: #line 741 "compile.y"
1.156 ! moko 2596: { (yyval) = (yyvsp[(2) - (3)]); ;}
1.112 paf 2597: break;
2598:
1.115 misha 2599: case 131:
1.156 ! moko 2600:
! 2601: /* Line 1464 of yacc.c */
1.155 misha 2602: #line 743 "compile.y"
1.156 ! moko 2603: { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_NEG); ;}
1.112 paf 2604: break;
2605:
1.115 misha 2606: case 132:
1.156 ! moko 2607:
! 2608: /* Line 1464 of yacc.c */
1.155 misha 2609: #line 744 "compile.y"
1.156 ! moko 2610: { (yyval)=(yyvsp[(2) - (2)]); ;}
1.112 paf 2611: break;
2612:
1.115 misha 2613: case 133:
1.156 ! moko 2614:
! 2615: /* Line 1464 of yacc.c */
1.155 misha 2616: #line 745 "compile.y"
1.156 ! moko 2617: { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_INV); ;}
1.112 paf 2618: break;
2619:
1.115 misha 2620: case 134:
1.156 ! moko 2621:
! 2622: /* Line 1464 of yacc.c */
1.155 misha 2623: #line 746 "compile.y"
1.156 ! moko 2624: { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_NOT); ;}
1.112 paf 2625: break;
2626:
1.115 misha 2627: case 135:
1.156 ! moko 2628:
! 2629: /* Line 1464 of yacc.c */
1.155 misha 2630: #line 747 "compile.y"
1.156 ! moko 2631: { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_DEF); ;}
1.112 paf 2632: break;
2633:
1.115 misha 2634: case 136:
1.156 ! moko 2635:
! 2636: /* Line 1464 of yacc.c */
1.155 misha 2637: #line 748 "compile.y"
1.156 ! moko 2638: { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_IN); ;}
1.112 paf 2639: break;
2640:
1.115 misha 2641: case 137:
1.156 ! moko 2642:
! 2643: /* Line 1464 of yacc.c */
1.155 misha 2644: #line 749 "compile.y"
1.156 ! moko 2645: { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_FEXISTS); ;}
1.112 paf 2646: break;
2647:
1.115 misha 2648: case 138:
1.156 ! moko 2649:
! 2650: /* Line 1464 of yacc.c */
1.155 misha 2651: #line 750 "compile.y"
1.156 ! moko 2652: { (yyval)=(yyvsp[(2) - (2)]); O(*(yyval), OP::OP_DEXISTS); ;}
1.112 paf 2653: break;
2654:
1.115 misha 2655: case 139:
1.156 ! moko 2656:
! 2657: /* Line 1464 of yacc.c */
1.155 misha 2658: #line 752 "compile.y"
1.156 ! moko 2659: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_SUB); ;}
1.112 paf 2660: break;
2661:
1.115 misha 2662: case 140:
1.156 ! moko 2663:
! 2664: /* Line 1464 of yacc.c */
1.155 misha 2665: #line 753 "compile.y"
1.156 ! moko 2666: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_ADD); ;}
1.112 paf 2667: break;
2668:
1.115 misha 2669: case 141:
1.156 ! moko 2670:
! 2671: /* Line 1464 of yacc.c */
1.155 misha 2672: #line 754 "compile.y"
1.156 ! moko 2673: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_MUL); ;}
1.112 paf 2674: break;
2675:
1.115 misha 2676: case 142:
1.156 ! moko 2677:
! 2678: /* Line 1464 of yacc.c */
1.155 misha 2679: #line 755 "compile.y"
1.156 ! moko 2680: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_DIV); ;}
1.112 paf 2681: break;
2682:
1.115 misha 2683: case 143:
1.156 ! moko 2684:
! 2685: /* Line 1464 of yacc.c */
1.155 misha 2686: #line 756 "compile.y"
1.156 ! moko 2687: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_MOD); ;}
1.112 paf 2688: break;
2689:
1.115 misha 2690: case 144:
1.156 ! moko 2691:
! 2692: /* Line 1464 of yacc.c */
1.155 misha 2693: #line 757 "compile.y"
1.156 ! moko 2694: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_INTDIV); ;}
1.112 paf 2695: break;
2696:
1.115 misha 2697: case 145:
1.156 ! moko 2698:
! 2699: /* Line 1464 of yacc.c */
1.155 misha 2700: #line 758 "compile.y"
1.156 ! moko 2701: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_SL); ;}
1.112 paf 2702: break;
2703:
1.115 misha 2704: case 146:
1.156 ! moko 2705:
! 2706: /* Line 1464 of yacc.c */
1.155 misha 2707: #line 759 "compile.y"
1.156 ! moko 2708: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_SR); ;}
1.112 paf 2709: break;
2710:
1.115 misha 2711: case 147:
1.156 ! moko 2712:
! 2713: /* Line 1464 of yacc.c */
1.155 misha 2714: #line 760 "compile.y"
1.156 ! moko 2715: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_AND); ;}
1.112 paf 2716: break;
2717:
1.115 misha 2718: case 148:
1.156 ! moko 2719:
! 2720: /* Line 1464 of yacc.c */
1.155 misha 2721: #line 761 "compile.y"
1.156 ! moko 2722: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_OR); ;}
1.112 paf 2723: break;
2724:
1.115 misha 2725: case 149:
1.156 ! moko 2726:
! 2727: /* Line 1464 of yacc.c */
1.155 misha 2728: #line 762 "compile.y"
1.156 ! moko 2729: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_BIN_XOR); ;}
1.112 paf 2730: break;
2731:
1.115 misha 2732: case 150:
1.156 ! moko 2733:
! 2734: /* Line 1464 of yacc.c */
1.155 misha 2735: #line 763 "compile.y"
1.156 ! moko 2736: { (yyval)=(yyvsp[(1) - (3)]); OA(*(yyval), OP::OP_NESTED_CODE, (yyvsp[(3) - (3)])); O(*(yyval), OP::OP_LOG_AND); ;}
1.112 paf 2737: break;
2738:
1.115 misha 2739: case 151:
1.156 ! moko 2740:
! 2741: /* Line 1464 of yacc.c */
1.155 misha 2742: #line 764 "compile.y"
1.156 ! moko 2743: { (yyval)=(yyvsp[(1) - (3)]); OA(*(yyval), OP::OP_NESTED_CODE, (yyvsp[(3) - (3)])); O(*(yyval), OP::OP_LOG_OR); ;}
1.112 paf 2744: break;
2745:
1.115 misha 2746: case 152:
1.156 ! moko 2747:
! 2748: /* Line 1464 of yacc.c */
1.155 misha 2749: #line 765 "compile.y"
1.156 ! moko 2750: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_LOG_XOR); ;}
1.112 paf 2751: break;
2752:
1.115 misha 2753: case 153:
1.156 ! moko 2754:
! 2755: /* Line 1464 of yacc.c */
1.155 misha 2756: #line 766 "compile.y"
1.156 ! moko 2757: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_LT); ;}
1.112 paf 2758: break;
2759:
1.115 misha 2760: case 154:
1.156 ! moko 2761:
! 2762: /* Line 1464 of yacc.c */
1.155 misha 2763: #line 767 "compile.y"
1.156 ! moko 2764: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_GT); ;}
1.112 paf 2765: break;
2766:
1.115 misha 2767: case 155:
1.156 ! moko 2768:
! 2769: /* Line 1464 of yacc.c */
1.155 misha 2770: #line 768 "compile.y"
1.156 ! moko 2771: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_LE); ;}
1.112 paf 2772: break;
2773:
1.115 misha 2774: case 156:
1.156 ! moko 2775:
! 2776: /* Line 1464 of yacc.c */
1.155 misha 2777: #line 769 "compile.y"
1.156 ! moko 2778: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_GE); ;}
1.112 paf 2779: break;
2780:
1.115 misha 2781: case 157:
1.156 ! moko 2782:
! 2783: /* Line 1464 of yacc.c */
1.155 misha 2784: #line 770 "compile.y"
1.156 ! moko 2785: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_EQ); ;}
1.112 paf 2786: break;
2787:
1.115 misha 2788: case 158:
1.156 ! moko 2789:
! 2790: /* Line 1464 of yacc.c */
1.155 misha 2791: #line 771 "compile.y"
1.156 ! moko 2792: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_NUM_NE); ;}
1.112 paf 2793: break;
2794:
1.115 misha 2795: case 159:
1.156 ! moko 2796:
! 2797: /* Line 1464 of yacc.c */
1.155 misha 2798: #line 772 "compile.y"
1.156 ! moko 2799: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_LT); ;}
1.112 paf 2800: break;
2801:
1.115 misha 2802: case 160:
1.156 ! moko 2803:
! 2804: /* Line 1464 of yacc.c */
1.155 misha 2805: #line 773 "compile.y"
1.156 ! moko 2806: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_GT); ;}
1.112 paf 2807: break;
2808:
1.115 misha 2809: case 161:
1.156 ! moko 2810:
! 2811: /* Line 1464 of yacc.c */
1.155 misha 2812: #line 774 "compile.y"
1.156 ! moko 2813: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_LE); ;}
1.112 paf 2814: break;
2815:
1.115 misha 2816: case 162:
1.156 ! moko 2817:
! 2818: /* Line 1464 of yacc.c */
1.155 misha 2819: #line 775 "compile.y"
1.156 ! moko 2820: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_GE); ;}
1.112 paf 2821: break;
2822:
1.115 misha 2823: case 163:
1.156 ! moko 2824:
! 2825: /* Line 1464 of yacc.c */
1.155 misha 2826: #line 776 "compile.y"
1.156 ! moko 2827: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_EQ); ;}
1.112 paf 2828: break;
2829:
1.115 misha 2830: case 164:
1.156 ! moko 2831:
! 2832: /* Line 1464 of yacc.c */
1.155 misha 2833: #line 777 "compile.y"
1.156 ! moko 2834: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_STR_NE); ;}
1.112 paf 2835: break;
2836:
1.115 misha 2837: case 165:
1.156 ! moko 2838:
! 2839: /* Line 1464 of yacc.c */
1.155 misha 2840: #line 778 "compile.y"
1.156 ! moko 2841: { (yyval)=(yyvsp[(1) - (3)]); P(*(yyval), *(yyvsp[(3) - (3)])); O(*(yyval), OP::OP_IS); ;}
1.112 paf 2842: break;
2843:
1.115 misha 2844: case 166:
1.156 ! moko 2845:
! 2846: /* Line 1464 of yacc.c */
1.155 misha 2847: #line 781 "compile.y"
1.112 paf 2848: {
1.131 misha 2849: // optimized OP_STRING => OP_VALUE for doubles
1.156 ! moko 2850: maybe_change_string_literal_to_double_literal(*((yyval)=(yyvsp[(1) - (1)])));
1.112 paf 2851: ;}
2852: break;
2853:
1.115 misha 2854: case 167:
1.156 ! moko 2855:
! 2856: /* Line 1464 of yacc.c */
1.155 misha 2857: #line 786 "compile.y"
1.112 paf 2858: {
1.131 misha 2859: #ifdef OPTIMIZE_BYTECODE_STRING_POOL
2860: // it brakes ^if(" 09 "){...}
1.156 ! moko 2861: YYSTYPE code=(yyvsp[(1) - (1)]);
! 2862: (yyval)=N();
1.132 misha 2863: if(code->count()==3 && maybe_change_first_opcode(*code, OP::OP_STRING__WRITE, OP::OP_VALUE)){
1.131 misha 2864: // optimized OP_STRING__WRITE+origin+value => OP_VALUE+origin+value without starting OP_STRING_POOL
1.156 ! moko 2865: P(*(yyval), *code);
1.131 misha 2866: } else {
1.156 ! moko 2867: OA(*(yyval), OP::OP_STRING_POOL, code); /* stack: empty write context */
1.131 misha 2868: }
2869: #else
1.156 ! moko 2870: (yyval)=N();
! 2871: OA(*(yyval), OP::OP_STRING_POOL, (yyvsp[(1) - (1)])); /* stack: empty write context */
1.131 misha 2872: #endif
1.47 paf 2873: /* some code that writes to that context */
2874: /* context=pop; stack: context.get_string() */
1.112 paf 2875: ;}
2876: break;
2877:
1.115 misha 2878: case 168:
1.156 ! moko 2879:
! 2880: /* Line 1464 of yacc.c */
1.155 misha 2881: #line 807 "compile.y"
1.112 paf 2882: {
1.131 misha 2883: // optimized OP_STRING+OP_WRITE_VALUE => OP_STRING__WRITE
1.156 ! moko 2884: change_string_literal_to_write_string_literal(*((yyval)=(yyvsp[(1) - (1)])));
1.112 paf 2885: ;}
2886: break;
2887:
1.115 misha 2888: case 169:
1.156 ! moko 2889:
! 2890: /* Line 1464 of yacc.c */
1.155 misha 2891: #line 812 "compile.y"
1.156 ! moko 2892: { (yyval)=VL(/*we know that we will not change it*/const_cast<VString*>(&vempty), 0, 0, 0); ;}
1.112 paf 2893: break;
2894:
1.115 misha 2895: case 170:
1.156 ! moko 2896:
! 2897: /* Line 1464 of yacc.c */
1.155 misha 2898: #line 813 "compile.y"
1.156 ! moko 2899: { (yyval) = VL(/*we know that we will not change it*/const_cast<VBool*>(&vtrue), 0, 0, 0); ;}
1.112 paf 2900: break;
2901:
1.115 misha 2902: case 171:
1.156 ! moko 2903:
! 2904: /* Line 1464 of yacc.c */
1.155 misha 2905: #line 814 "compile.y"
1.156 ! moko 2906: { (yyval) = VL(/*we know that we will not change it*/const_cast<VBool*>(&vfalse), 0, 0, 0); ;}
1.112 paf 2907: break;
2908:
1.115 misha 2909: case 172:
1.156 ! moko 2910:
! 2911: /* Line 1464 of yacc.c */
1.155 misha 2912: #line 816 "compile.y"
1.156 ! moko 2913: { (yyval)=N(); ;}
1.155 misha 2914: break;
1.154 moko 2915:
1.112 paf 2916:
1.156 ! moko 2917:
! 2918: /* Line 1464 of yacc.c */
! 2919: #line 2920 "compile.tab.C"
! 2920: default: break;
1.155 misha 2921: }
1.156 ! moko 2922: YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1.112 paf 2923:
1.156 ! moko 2924: YYPOPSTACK (yylen);
! 2925: yylen = 0;
1.112 paf 2926: YY_STACK_PRINT (yyss, yyssp);
1.1 parser 2927:
2928: *++yyvsp = yyval;
2929:
1.112 paf 2930: /* Now `shift' the result of the reduction. Determine what state
2931: that goes to, based on the state we popped back to and the rule
2932: number reduced by. */
1.1 parser 2933:
2934: yyn = yyr1[yyn];
2935:
1.112 paf 2936: yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2937: if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1.1 parser 2938: yystate = yytable[yystate];
2939: else
1.112 paf 2940: yystate = yydefgoto[yyn - YYNTOKENS];
1.1 parser 2941:
2942: goto yynewstate;
2943:
2944:
1.112 paf 2945: /*------------------------------------.
2946: | yyerrlab -- here on detecting error |
2947: `------------------------------------*/
2948: yyerrlab:
2949: /* If not already recovering from an error, report this error. */
2950: if (!yyerrstatus)
1.1 parser 2951: {
2952: ++yynerrs;
1.156 ! moko 2953: #if ! YYERROR_VERBOSE
! 2954: yyerror (YY_("syntax error"));
! 2955: #else
! 2956: {
! 2957: YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
! 2958: if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
! 2959: {
! 2960: YYSIZE_T yyalloc = 2 * yysize;
! 2961: if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
! 2962: yyalloc = YYSTACK_ALLOC_MAXIMUM;
! 2963: if (yymsg != yymsgbuf)
! 2964: YYSTACK_FREE (yymsg);
! 2965: yymsg = (char *) YYSTACK_ALLOC (yyalloc);
! 2966: if (yymsg)
! 2967: yymsg_alloc = yyalloc;
! 2968: else
1.112 paf 2969: {
1.156 ! moko 2970: yymsg = yymsgbuf;
! 2971: yymsg_alloc = sizeof yymsgbuf;
1.112 paf 2972: }
1.156 ! moko 2973: }
1.1 parser 2974:
1.156 ! moko 2975: if (0 < yysize && yysize <= yymsg_alloc)
! 2976: {
! 2977: (void) yysyntax_error (yymsg, yystate, yychar);
! 2978: yyerror (yymsg);
! 2979: }
! 2980: else
! 2981: {
! 2982: yyerror (YY_("syntax error"));
! 2983: if (yysize != 0)
! 2984: goto yyexhaustedlab;
! 2985: }
! 2986: }
! 2987: #endif
1.1 parser 2988: }
2989:
1.112 paf 2990:
1.1 parser 2991:
2992: if (yyerrstatus == 3)
2993: {
1.112 paf 2994: /* If just tried and failed to reuse lookahead token after an
2995: error, discard it. */
1.109 paf 2996:
1.113 paf 2997: if (yychar <= YYEOF)
1.156 ! moko 2998: {
! 2999: /* Return failure if at end of input. */
1.113 paf 3000: if (yychar == YYEOF)
1.156 ! moko 3001: YYABORT;
! 3002: }
1.113 paf 3003: else
3004: {
1.156 ! moko 3005: yydestruct ("Error: discarding",
! 3006: yytoken, &yylval);
1.113 paf 3007: yychar = YYEMPTY;
3008: }
1.106 paf 3009: }
1.1 parser 3010:
1.112 paf 3011: /* Else will try to reuse lookahead token after shifting the error
3012: token. */
3013: goto yyerrlab1;
1.109 paf 3014:
1.1 parser 3015:
1.113 paf 3016: /*---------------------------------------------------.
3017: | yyerrorlab -- error raised explicitly by YYERROR. |
3018: `---------------------------------------------------*/
3019: yyerrorlab:
3020:
1.156 ! moko 3021: /* Pacify compilers like GCC when the user code never invokes
! 3022: YYERROR and the label yyerrorlab therefore never appears in user
! 3023: code. */
! 3024: if (/*CONSTCOND*/ 0)
1.113 paf 3025: goto yyerrorlab;
3026:
1.156 ! moko 3027: /* Do not reclaim the symbols of the rule which action triggered
! 3028: this YYERROR. */
! 3029: YYPOPSTACK (yylen);
! 3030: yylen = 0;
! 3031: YY_STACK_PRINT (yyss, yyssp);
1.113 paf 3032: yystate = *yyssp;
3033: goto yyerrlab1;
3034:
3035:
3036: /*-------------------------------------------------------------.
3037: | yyerrlab1 -- common code for both syntax error and YYERROR. |
3038: `-------------------------------------------------------------*/
1.112 paf 3039: yyerrlab1:
3040: yyerrstatus = 3; /* Each real token shifted decrements this. */
1.1 parser 3041:
1.112 paf 3042: for (;;)
1.109 paf 3043: {
1.112 paf 3044: yyn = yypact[yystate];
3045: if (yyn != YYPACT_NINF)
3046: {
3047: yyn += YYTERROR;
3048: if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3049: {
3050: yyn = yytable[yyn];
3051: if (0 < yyn)
3052: break;
3053: }
3054: }
1.1 parser 3055:
1.112 paf 3056: /* Pop the current state because it cannot handle the error token. */
3057: if (yyssp == yyss)
3058: YYABORT;
1.1 parser 3059:
1.156 ! moko 3060:
! 3061: yydestruct ("Error: popping",
! 3062: yystos[yystate], yyvsp);
! 3063: YYPOPSTACK (1);
1.113 paf 3064: yystate = *yyssp;
1.112 paf 3065: YY_STACK_PRINT (yyss, yyssp);
1.1 parser 3066: }
3067:
1.156 ! moko 3068: *++yyvsp = yylval;
1.155 misha 3069:
1.1 parser 3070:
1.156 ! moko 3071: /* Shift the error token. */
! 3072: YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1.112 paf 3073:
1.1 parser 3074: yystate = yyn;
3075: goto yynewstate;
3076:
3077:
1.112 paf 3078: /*-------------------------------------.
3079: | yyacceptlab -- YYACCEPT comes here. |
3080: `-------------------------------------*/
3081: yyacceptlab:
3082: yyresult = 0;
3083: goto yyreturn;
3084:
3085: /*-----------------------------------.
3086: | yyabortlab -- YYABORT comes here. |
3087: `-----------------------------------*/
3088: yyabortlab:
3089: yyresult = 1;
3090: goto yyreturn;
3091:
1.156 ! moko 3092: #if !defined(yyoverflow) || YYERROR_VERBOSE
! 3093: /*-------------------------------------------------.
! 3094: | yyexhaustedlab -- memory exhaustion comes here. |
! 3095: `-------------------------------------------------*/
! 3096: yyexhaustedlab:
! 3097: yyerror (YY_("memory exhausted"));
1.112 paf 3098: yyresult = 2;
3099: /* Fall through. */
3100: #endif
3101:
3102: yyreturn:
1.156 ! moko 3103: if (yychar != YYEMPTY)
! 3104: yydestruct ("Cleanup: discarding lookahead",
! 3105: yytoken, &yylval);
! 3106: /* Do not reclaim the symbols of the rule which action triggered
! 3107: this YYABORT or YYACCEPT. */
! 3108: YYPOPSTACK (yylen);
! 3109: YY_STACK_PRINT (yyss, yyssp);
! 3110: while (yyssp != yyss)
! 3111: {
! 3112: yydestruct ("Cleanup: popping",
! 3113: yystos[*yyssp], yyvsp);
! 3114: YYPOPSTACK (1);
! 3115: }
1.112 paf 3116: #ifndef yyoverflow
3117: if (yyss != yyssa)
3118: YYSTACK_FREE (yyss);
1.1 parser 3119: #endif
1.156 ! moko 3120: #if YYERROR_VERBOSE
! 3121: if (yymsg != yymsgbuf)
! 3122: YYSTACK_FREE (yymsg);
! 3123: #endif
! 3124: /* Make sure YYID is used. */
! 3125: return YYID (yyresult);
1.1 parser 3126: }
1.112 paf 3127:
3128:
1.156 ! moko 3129:
! 3130: /* Line 1684 of yacc.c */
1.155 misha 3131: #line 818 "compile.y"
1.1 parser 3132:
3133: #endif
3134:
3135: /*
3136: 000$111(2222)00
3137: 000$111{3333}00
3138: $,^: push,=0
3139: 1:( { break=pop
3140: 2:( ) pop
3141: 3:{ } pop
3142:
3143: 000^111(2222)4444{33333}4000
3144: $,^: push,=0
3145: 1:( { break=pop
3146: 2:( )=4
3147: 3:{ }=4
3148: 4:[^({]=pop
3149: */
3150:
1.84 paf 3151: inline void ungetc(Parse_control& pc, uint last_line_end_col) {
3152: pc.source--;
3153: if(pc.pos.col==0) {
3154: --pc.pos.line; pc.pos.col=last_line_end_col;
3155: } else
3156: --pc.pos.col;
3157:
3158: }
3159: static int yylex(YYSTYPE *lvalp, void *apc) {
3160: register Parse_control& pc=*static_cast<Parse_control*>(apc);
3161:
3162: #define lexical_brackets_nestage pc.brackets_nestages[pc.ls_sp]
1.1 parser 3163: #define RC {result=c; goto break2; }
3164:
1.84 paf 3165: register int c;
3166: int result;
1.1 parser 3167:
1.84 paf 3168: if(pc.pending_state) {
3169: result=pc.pending_state;
3170: pc.pending_state=0;
1.1 parser 3171: return result;
3172: }
3173:
1.84 paf 3174: const char *begin=pc.source;
3175: Pos begin_pos=pc.pos;
1.1 parser 3176: const char *end;
3177: int skip_analized=0;
3178: while(true) {
1.84 paf 3179: c=*(end=(pc.source++));
3180: // fprintf(stderr, "\nchar: %c %02X; nestage: %d, sp=%d", c, c, lexical_brackets_nestage, pc.sp);
1.1 parser 3181:
1.96 paf 3182: if(c=='\n')
1.84 paf 3183: pc.pos_next_line();
1.96 paf 3184: else
1.84 paf 3185: pc.pos_next_c(c);
1.96 paf 3186: // fprintf(stderr, "\nchar: %c file(%d:%d)", c, pc.pos.line, pc.pos.col);
1.1 parser 3187:
1.96 paf 3188: if(pc.pos.col==0+1 && c=='@') {
1.84 paf 3189: if(pc.ls==LS_DEF_SPECIAL_BODY) {
1.31 paf 3190: // @SPECIAL
3191: // ...
3192: // @<here =
1.84 paf 3193: pop_LS(pc); // exiting from LS_DEF_SPECIAL_BODY state
1.31 paf 3194: } // continuing checks
1.84 paf 3195: if(pc.ls==LS_USER) {
3196: push_LS(pc, LS_DEF_NAME);
1.20 parser 3197: RC;
1.31 paf 3198: } else // @ in first column inside some code [when could that be?]
1.20 parser 3199: result=BAD_METHOD_DECL_START;
3200: goto break2;
1.97 paf 3201: }
3202: if(c=='^') {
1.84 paf 3203: if(pc.ls==LS_METHOD_AFTER) {
1.75 paf 3204: // handle after-method situation
1.84 paf 3205: pop_LS(pc);
1.75 paf 3206: result=EON;
3207: skip_analized=-1; // return to punctuation afterwards to assure it's literality
3208: goto break2;
3209: }
1.84 paf 3210: switch(pc.ls) {
1.15 parser 3211: case LS_EXPRESSION_VAR_NAME_WITH_COLON:
3212: case LS_EXPRESSION_VAR_NAME_WITHOUT_COLON:
3213: case LS_VAR_NAME_SIMPLE_WITH_COLON:
3214: case LS_VAR_NAME_SIMPLE_WITHOUT_COLON:
3215: case LS_VAR_NAME_CURLY:
3216: case LS_METHOD_NAME:
1.66 paf 3217: case LS_USER_COMMENT:
1.15 parser 3218: case LS_DEF_COMMENT:
3219: // no literals in names, please
3220: break;
3221: default:
1.84 paf 3222: switch(*pc.source) {
1.10 parser 3223: // ^escaping some punctuators
1.121 misha 3224: case '^': case '$': case ';': case '@':
1.1 parser 3225: case '(': case ')':
3226: case '[': case ']':
3227: case '{': case '}':
1.23 parser 3228: case '"': case ':':
1.1 parser 3229: if(end!=begin) {
1.84 paf 3230: if(!pc.string_start)
3231: pc.string_start=begin_pos;
1.1 parser 3232: // append piece till ^
1.84 paf 3233: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 3234: }
3235: // reset piece 'begin' position & line
1.84 paf 3236: begin=pc.source; // ->punctuation
3237: begin_pos=pc.pos;
1.75 paf 3238: // skip over _ after ^
1.84 paf 3239: pc.source++; pc.pos.col++;
1.75 paf 3240: // skip analysis = forced literal
3241: continue;
1.1 parser 3242:
3243: // converting ^#HH into char(hex(HH))
3244: case '#':
3245: if(end!=begin) {
1.84 paf 3246: if(!pc.string_start)
3247: pc.string_start=begin_pos;
1.1 parser 3248: // append piece till ^
1.84 paf 3249: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 3250: }
3251: // #HH ?
1.121 misha 3252: if(pc.source[1] && isxdigit(pc.source[1]) && pc.source[2] && isxdigit(pc.source[2])) {
1.110 paf 3253: char c=(char)(
1.84 paf 3254: hex_value[(unsigned char)pc.source[1]]*0x10+
1.110 paf 3255: hex_value[(unsigned char)pc.source[2]]);
1.84 paf 3256: if(c==0) {
1.1 parser 3257: result=BAD_HEX_LITERAL;
3258: goto break2; // wrong hex value[no ^#00 chars allowed]: bail out
3259: }
3260: // append char(hex(HH))
1.84 paf 3261: pc.string.append(c);
1.1 parser 3262: // skip over ^#HH
1.84 paf 3263: pc.source+=3;
3264: pc.pos.col+=3;
1.1 parser 3265: // reset piece 'begin' position & line
1.84 paf 3266: begin=pc.source; // ->after ^#HH
3267: begin_pos=pc.pos;
1.75 paf 3268: // skip analysis = forced literal
1.1 parser 3269: continue;
3270: }
1.121 misha 3271: // just escaped char
3272: // reset piece 'begin' position & line
3273: begin=pc.source;
3274: begin_pos=pc.pos;
3275: // skip over _ after ^
3276: pc.source++; pc.pos.col++;
3277: // skip analysis = forced literal
3278: continue;
1.1 parser 3279: }
1.15 parser 3280: break;
1.75 paf 3281: }
1.15 parser 3282: }
1.1 parser 3283: // #comment start skipping
1.84 paf 3284: if(c=='#' && pc.pos.col==1) {
1.1 parser 3285: if(end!=begin) {
1.84 paf 3286: if(!pc.string_start)
3287: pc.string_start=begin_pos;
1.1 parser 3288: // append piece till #
1.84 paf 3289: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 3290: }
3291: // fall into COMMENT lexical state [wait for \n]
1.84 paf 3292: push_LS(pc, LS_USER_COMMENT);
1.31 paf 3293: continue;
1.1 parser 3294: }
1.84 paf 3295: switch(pc.ls) {
1.1 parser 3296:
3297: // USER'S = NOT OURS
3298: case LS_USER:
1.84 paf 3299: case LS_NAME_SQUARE_PART: // name.[here].xxx
3300: if(pc.trim_bof)
1.1 parser 3301: switch(c) {
3302: case '\n': case ' ': case '\t':
1.84 paf 3303: begin=pc.source;
3304: begin_pos=pc.pos;
1.1 parser 3305: continue; // skip it
3306: default:
1.84 paf 3307: pc.trim_bof=false;
1.1 parser 3308: }
3309: switch(c) {
3310: case '$':
1.84 paf 3311: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3312: RC;
3313: case '^':
1.84 paf 3314: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3315: RC;
1.11 parser 3316: case ']':
1.84 paf 3317: if(pc.ls==LS_NAME_SQUARE_PART)
1.11 parser 3318: if(--lexical_brackets_nestage==0) {// $name.[co<]?>de<]?>
1.84 paf 3319: pop_LS(pc); // $name.[co<]>de<]!>
1.11 parser 3320: RC;
3321: }
1.3 parser 3322: break;
1.11 parser 3323: case '[': // $name.[co<[>de]
1.84 paf 3324: if(pc.ls==LS_NAME_SQUARE_PART)
1.11 parser 3325: lexical_brackets_nestage++;
1.4 parser 3326: break;
1.1 parser 3327: }
1.97 paf 3328: if(pc.explicit_result && c)
3329: switch(c) {
3330: case '\n': case ' ': case '\t':
3331: begin=pc.source;
3332: begin_pos=pc.pos;
3333: continue; // skip it
3334: default:
3335: result=BAD_NONWHITESPACE_CHARACTER_IN_EXPLICIT_RESULT_MODE;
3336: goto break2;
3337: }
1.1 parser 3338: break;
3339:
3340: // #COMMENT
1.66 paf 3341: case LS_USER_COMMENT:
1.1 parser 3342: if(c=='\n') {
3343: // skip comment
1.84 paf 3344: begin=pc.source;
3345: begin_pos=pc.pos;
1.1 parser 3346:
1.84 paf 3347: pop_LS(pc);
1.1 parser 3348: continue;
3349: }
3350: break;
3351:
3352: // STRING IN EXPRESSION
3353: case LS_EXPRESSION_STRING_QUOTED:
3354: case LS_EXPRESSION_STRING_APOSTROFED:
3355: switch(c) {
3356: case '"':
3357: case '\'':
3358: if(
1.84 paf 3359: pc.ls == LS_EXPRESSION_STRING_QUOTED && c=='"' ||
3360: pc.ls == LS_EXPRESSION_STRING_APOSTROFED && c=='\'') {
3361: pop_LS(pc); //"abc". | 'abc'.
1.1 parser 3362: RC;
3363: }
3364: break;
3365: case '$':
1.84 paf 3366: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3367: RC;
3368: case '^':
1.84 paf 3369: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3370: RC;
3371: }
3372: break;
3373:
3374: // METHOD DEFINITION
3375: case LS_DEF_NAME:
3376: switch(c) {
3377: case '[':
1.84 paf 3378: pc.ls=LS_DEF_PARAMS;
1.1 parser 3379: RC;
3380: case '\n':
1.84 paf 3381: pc.ls=LS_DEF_SPECIAL_BODY;
1.1 parser 3382: RC;
3383: }
3384: break;
3385:
3386: case LS_DEF_PARAMS:
3387: switch(c) {
1.64 paf 3388: case '$': // common error
1.65 paf 3389: result=BAD_METHOD_PARAMETER_NAME_CHARACTER;
3390: goto break2;
1.1 parser 3391: case ';':
3392: RC;
3393: case ']':
1.84 paf 3394: pc.ls=*pc.source=='['?LS_DEF_LOCALS:LS_DEF_COMMENT;
1.1 parser 3395: RC;
3396: case '\n': // wrong. bailing out
1.84 paf 3397: pop_LS(pc);
1.1 parser 3398: RC;
3399: }
3400: break;
3401:
3402: case LS_DEF_LOCALS:
3403: switch(c) {
3404: case '[':
3405: case ';':
3406: RC;
3407: case ']':
1.84 paf 3408: pc.ls=LS_DEF_COMMENT;
1.1 parser 3409: RC;
3410: case '\n': // wrong. bailing out
1.84 paf 3411: pop_LS(pc);
1.1 parser 3412: RC;
3413: }
3414: break;
3415:
3416: case LS_DEF_COMMENT:
3417: if(c=='\n') {
1.84 paf 3418: pop_LS(pc);
1.1 parser 3419: RC;
3420: }
3421: break;
3422:
3423: case LS_DEF_SPECIAL_BODY:
1.31 paf 3424: if(c=='\n')
1.1 parser 3425: RC;
3426: break;
3427:
3428: // (EXPRESSION)
3429: case LS_VAR_ROUND:
3430: case LS_METHOD_ROUND:
3431: switch(c) {
3432: case ')':
3433: if(--lexical_brackets_nestage==0)
1.84 paf 3434: if(pc.ls==LS_METHOD_ROUND) // method round param ended
3435: pc.ls=LS_METHOD_AFTER; // look for method end
3436: else // pc.ls==LS_VAR_ROUND // variable constructor ended
3437: pop_LS(pc); // return to normal life
1.1 parser 3438: RC;
1.66 paf 3439: case '#': // comment start skipping
3440: if(end!=begin) {
1.84 paf 3441: if(!pc.string_start)
3442: pc.string_start=begin_pos;
1.66 paf 3443: // append piece till #
1.84 paf 3444: pc.string.append_strdup_know_length(begin, end-begin);
1.66 paf 3445: }
3446: // fall into COMMENT lexical state [wait for \n]
1.84 paf 3447: push_LS(pc, LS_EXPRESSION_COMMENT);
1.66 paf 3448: lexical_brackets_nestage=1;
3449: continue;
1.1 parser 3450: case '$':
1.84 paf 3451: push_LS(pc, LS_EXPRESSION_VAR_NAME_WITH_COLON);
1.1 parser 3452: RC;
3453: case '^':
1.84 paf 3454: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3455: RC;
3456: case '(':
3457: lexical_brackets_nestage++;
3458: RC;
3459: case '-':
1.84 paf 3460: switch(*pc.source) {
1.1 parser 3461: case 'f': // -f
3462: skip_analized=1;
3463: result=FEXISTS;
3464: goto break2;
3465: case 'd': // -d
3466: skip_analized=1;
3467: result=DEXISTS;
3468: goto break2;
1.63 paf 3469: default: // minus
1.1 parser 3470: result=c;
3471: goto break2;
3472: }
3473: goto break2;
1.25 paf 3474: case '+': case '*': case '/': case '%': case '\\':
1.1 parser 3475: case '~':
3476: case ';':
3477: RC;
1.65 paf 3478: case '&': case '|':
1.84 paf 3479: if(*pc.source==c) { // && ||
1.65 paf 3480: result=c=='&'?LAND:LOR;
1.1 parser 3481: skip_analized=1;
3482: } else
3483: result=c;
3484: goto break2;
1.65 paf 3485: case '!':
1.84 paf 3486: switch(pc.source[0]) {
1.65 paf 3487: case '|': // !| !||
3488: skip_analized=1;
1.84 paf 3489: if(pc.source[1]=='|') {
1.65 paf 3490: skip_analized++;
3491: result=LXOR;
3492: } else
3493: result=NXOR;
3494: goto break2;
3495: case '=': // !=
3496: skip_analized=1;
3497: result=NNE;
3498: goto break2;
3499: }
3500: RC;
1.67 paf 3501:
3502: case '<': // <<, <=, <
1.84 paf 3503: switch(*pc.source) {
1.67 paf 3504: case '<': // <[<]
3505: skip_analized=1; result=NSL; break;
3506: case '=': // <[=]
3507: skip_analized=1; result=NLE; break;
3508: default: // <[]
3509: result=c; break;
3510: }
3511: goto break2;
3512: case '>': // >>, >=, >
1.84 paf 3513: switch(*pc.source) {
1.67 paf 3514: case '>': // >[>]
3515: skip_analized=1; result=NSR; break;
3516: case '=': // >[=]
3517: skip_analized=1; result=NGE; break;
3518: default: // >[]
3519: result=c; break;
3520: }
3521: goto break2;
3522: case '=': // ==
1.84 paf 3523: switch(*pc.source) {
1.67 paf 3524: case '=': // =[=]
3525: skip_analized=1; result=NEQ; break;
3526: default: // =[]
3527: result=c; break; // not used now
3528: }
1.1 parser 3529: goto break2;
1.67 paf 3530:
1.1 parser 3531: case '"':
1.84 paf 3532: push_LS(pc, LS_EXPRESSION_STRING_QUOTED);
1.1 parser 3533: RC;
3534: case '\'':
1.84 paf 3535: push_LS(pc, LS_EXPRESSION_STRING_APOSTROFED);
1.1 parser 3536: RC;
3537: case 'l': case 'g': case 'e': case 'n':
3538: if(end==begin) // right after whitespace
1.84 paf 3539: if(isspace(pc.source[1])) {
3540: switch(*pc.source) {
1.1 parser 3541: // case '?': // ok [and bad cases, yacc would bark at them]
3542: case 't': // lt gt [et nt]
3543: result=c=='l'?SLT:c=='g'?SGT:BAD_STRING_COMPARISON_OPERATOR;
3544: skip_analized=1;
3545: goto break2;
3546: case 'e': // le ge ne [ee]
3547: result=c=='l'?SLE:c=='g'?SGE:c=='n'?SNE:BAD_STRING_COMPARISON_OPERATOR;
3548: skip_analized=1;
3549: goto break2;
3550: case 'q': // eq [lq gq nq]
3551: result=c=='e'?SEQ:BAD_STRING_COMPARISON_OPERATOR;
3552: skip_analized=1;
3553: goto break2;
3554: }
3555: }
3556: break;
3557: case 'i':
3558: if(end==begin) // right after whitespace
1.84 paf 3559: if(isspace(pc.source[1])) {
3560: switch(pc.source[0]) {
1.1 parser 3561: case 'n': // in
3562: skip_analized=1;
3563: result=IN;
3564: goto break2;
3565: case 's': // is
3566: skip_analized=1;
3567: result=IS;
3568: goto break2;
3569: }
3570: }
3571: break;
3572: case 'd':
3573: if(end==begin) // right after whitespace
1.84 paf 3574: if(pc.source[0]=='e' && pc.source[1]=='f') { // def
1.118 misha 3575: switch(pc.source[2]){
3576: case ' ': case '\t': case '\n': case '"': case '\'': case '^': case '$': // non-quoted string without whitespace after 'def' is not allowed
3577: skip_analized=2;
3578: result=DEF;
3579: goto break2;
3580: }
3581: // error: incorrect char after 'def'
1.1 parser 3582: }
3583: break;
1.107 paf 3584: case 't':
3585: if(end==begin) // right after whitespace
1.118 misha 3586: if(pc.source[0]=='r' && pc.source[1]=='u' && pc.source[2]=='e') { // true
1.107 paf 3587: skip_analized=3;
3588: result=LITERAL_TRUE;
3589: goto break2;
3590: }
3591: break;
3592: case 'f':
3593: if(end==begin) // right after whitespace
1.118 misha 3594: if(pc.source[0]=='a' && pc.source[1]=='l' && pc.source[2]=='s' && pc.source[3]=='e') { // false
1.107 paf 3595: skip_analized=4;
3596: result=LITERAL_FALSE;
3597: goto break2;
3598: }
3599: break;
1.1 parser 3600: case ' ': case '\t': case '\n':
3601: if(end!=begin) { // there were a string after previous operator?
3602: result=0; // return that string
3603: goto break2;
3604: }
3605: // that's a leading|traling space or after-operator-space
3606: // ignoring it
3607: // reset piece 'begin' position & line
1.84 paf 3608: begin=pc.source; // after whitespace char
3609: begin_pos=pc.pos;
1.1 parser 3610: continue;
3611: }
3612: break;
1.66 paf 3613: case LS_EXPRESSION_COMMENT:
3614: if(c=='(')
3615: lexical_brackets_nestage++;
3616:
1.84 paf 3617: switch(*pc.source) {
1.66 paf 3618: case '\n': case ')':
1.84 paf 3619: if(*pc.source==')')
1.66 paf 3620: if(--lexical_brackets_nestage!=0)
3621: continue;
3622:
3623: // skip comment
1.84 paf 3624: begin=pc.source;
3625: begin_pos=pc.pos;
1.66 paf 3626:
1.84 paf 3627: pop_LS(pc);
1.66 paf 3628: continue;
3629: }
3630: break;
1.1 parser 3631:
3632: // VARIABLE GET/PUT/WITH
1.11 parser 3633: case LS_VAR_NAME_SIMPLE_WITH_COLON:
3634: case LS_VAR_NAME_SIMPLE_WITHOUT_COLON:
3635: case LS_EXPRESSION_VAR_NAME_WITH_COLON:
3636: case LS_EXPRESSION_VAR_NAME_WITHOUT_COLON:
3637: if(
1.84 paf 3638: pc.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON ||
3639: pc.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.41 paf 3640: // name in expr ends also before
1.1 parser 3641: switch(c) {
1.41 paf 3642: // expression minus
1.1 parser 3643: case '-':
1.41 paf 3644: // expression integer division
3645: case '\\':
1.84 paf 3646: pop_LS(pc);
3647: pc.ungetc();
1.1 parser 3648: result=EON;
3649: goto break2;
3650: }
3651: }
1.11 parser 3652: if(
1.84 paf 3653: pc.ls==LS_VAR_NAME_SIMPLE_WITHOUT_COLON ||
3654: pc.ls==LS_EXPRESSION_VAR_NAME_WITHOUT_COLON) {
1.1 parser 3655: // name already has ':', stop before next
3656: switch(c) {
3657: case ':':
1.84 paf 3658: pop_LS(pc);
3659: pc.ungetc();
1.1 parser 3660: result=EON;
3661: goto break2;
3662: }
3663: }
3664: switch(c) {
3665: case 0:
3666: case ' ': case '\t': case '\n':
3667: case ';':
3668: case ']': case '}': case ')':
3669: case '"': case '\'':
3670: case '<': case '>': // these stand for HTML brackets AND expression binary ops
1.146 misha 3671: case '+': case '*': case '/': case '\\': case '%':
1.1 parser 3672: case '&': case '|':
3673: case '=': case '!':
3674: // common delimiters
1.62 paf 3675: case ',': case '?': case '#':
1.113 paf 3676: // mysql column separators
3677: case '`':
1.1 parser 3678: // before call
3679: case '^':
1.84 paf 3680: pop_LS(pc);
3681: pc.ungetc();
1.1 parser 3682: result=EON;
3683: goto break2;
3684: case '[':
1.5 parser 3685: // $name.<[>code]
1.84 paf 3686: if(pc.pos.col>1/*not first column*/ && (
1.6 parser 3687: end[-1]=='$'/*was start of get*/ ||
3688: end[-1]==':'/*was class name delim */ ||
3689: end[-1]=='.'/*was name delim */
1.5 parser 3690: )) {
1.84 paf 3691: push_LS(pc, LS_NAME_SQUARE_PART);
1.5 parser 3692: lexical_brackets_nestage=1;
3693: RC;
3694: }
1.84 paf 3695: pc.ls=LS_VAR_SQUARE;
1.1 parser 3696: lexical_brackets_nestage=1;
3697: RC;
3698: case '{':
3699: if(begin==end) { // ${name}, no need of EON, switching LS
1.84 paf 3700: pc.ls=LS_VAR_NAME_CURLY;
1.1 parser 3701: } else {
1.84 paf 3702: pc.ls=LS_VAR_CURLY;
1.1 parser 3703: lexical_brackets_nestage=1;
3704: }
3705:
3706: RC;
3707: case '(':
1.84 paf 3708: pc.ls=LS_VAR_ROUND;
1.1 parser 3709: lexical_brackets_nestage=1;
3710: RC;
3711: case '.': // name part delim
3712: case '$': // name part subvar
1.3 parser 3713: case ':': // class<:>name
1.11 parser 3714: // go to _WITHOUT_COLON state variant...
1.84 paf 3715: if(pc.ls==LS_VAR_NAME_SIMPLE_WITH_COLON)
3716: pc.ls=LS_VAR_NAME_SIMPLE_WITHOUT_COLON;
3717: else if(pc.ls==LS_EXPRESSION_VAR_NAME_WITH_COLON)
3718: pc.ls=LS_EXPRESSION_VAR_NAME_WITHOUT_COLON;
1.11 parser 3719: // ...stop before next ':'
1.1 parser 3720: RC;
3721: }
3722: break;
3723:
3724: case LS_VAR_NAME_CURLY:
3725: switch(c) {
1.5 parser 3726: case '[':
1.11 parser 3727: // ${name.<[>code]}
1.84 paf 3728: push_LS(pc, LS_NAME_SQUARE_PART);
1.3 parser 3729: lexical_brackets_nestage=1;
3730: RC;
1.1 parser 3731: case '}': // ${name} finished, restoring LS
1.84 paf 3732: pop_LS(pc);
1.1 parser 3733: RC;
3734: case '.': // name part delim
3735: case '$': // name part subvar
3736: case ':': // ':name' or 'class:name'
3737: RC;
3738: }
3739: break;
3740:
3741: case LS_VAR_SQUARE:
3742: switch(c) {
3743: case '$':
1.84 paf 3744: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3745: RC;
3746: case '^':
1.84 paf 3747: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3748: RC;
3749: case ']':
3750: if(--lexical_brackets_nestage==0) {
1.84 paf 3751: pop_LS(pc);
1.1 parser 3752: RC;
3753: }
3754: break;
3755: case ';': // operator_or_fmt;value delim
3756: RC;
3757: case '[':
3758: lexical_brackets_nestage++;
3759: break;
3760: }
3761: break;
3762:
3763: case LS_VAR_CURLY:
3764: switch(c) {
3765: case '$':
1.84 paf 3766: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3767: RC;
3768: case '^':
1.84 paf 3769: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3770: RC;
3771: case '}':
3772: if(--lexical_brackets_nestage==0) {
1.84 paf 3773: pop_LS(pc);
1.1 parser 3774: RC;
3775: }
3776: break;
3777: case '{':
3778: lexical_brackets_nestage++;
3779: break;
3780: }
3781: break;
3782:
3783: // METHOD CALL
3784: case LS_METHOD_NAME:
3785: switch(c) {
3786: case '[':
1.11 parser 3787: // ^name.<[>code].xxx
1.84 paf 3788: if(pc.pos.col>1/*not first column*/ && (
1.6 parser 3789: end[-1]=='^'/*was start of call*/ || // never, ^[ is literal...
3790: end[-1]==':'/*was class name delim */ ||
3791: end[-1]=='.'/*was name delim */
1.5 parser 3792: )) {
1.84 paf 3793: push_LS(pc, LS_NAME_SQUARE_PART);
1.5 parser 3794: lexical_brackets_nestage=1;
3795: RC;
3796: }
1.84 paf 3797: pc.ls=LS_METHOD_SQUARE;
1.1 parser 3798: lexical_brackets_nestage=1;
3799: RC;
3800: case '{':
1.84 paf 3801: pc.ls=LS_METHOD_CURLY;
1.1 parser 3802: lexical_brackets_nestage=1;
3803: RC;
3804: case '(':
1.84 paf 3805: pc.ls=LS_METHOD_ROUND;
1.1 parser 3806: lexical_brackets_nestage=1;
3807: RC;
3808: case '.': // name part delim
3809: case '$': // name part subvar
3810: case ':': // ':name' or 'class:name'
1.19 parser 3811: case '^': // ^abc^xxx wrong. bailing out
3812: case ']': case '}': case ')': // ^abc]}) wrong. bailing out
1.90 paf 3813: case ' ': // ^if ( wrong. bailing out
1.1 parser 3814: RC;
3815: }
3816: break;
3817:
3818: case LS_METHOD_SQUARE:
3819: switch(c) {
3820: case '$':
1.84 paf 3821: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3822: RC;
3823: case '^':
1.84 paf 3824: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3825: RC;
3826: case ';': // param delim
3827: RC;
3828: case ']':
3829: if(--lexical_brackets_nestage==0) {
1.84 paf 3830: pc.ls=LS_METHOD_AFTER;
1.1 parser 3831: RC;
3832: }
3833: break;
3834: case '[':
3835: lexical_brackets_nestage++;
3836: break;
3837: }
3838: break;
3839:
3840: case LS_METHOD_CURLY:
3841: switch(c) {
3842: case '$':
1.84 paf 3843: push_LS(pc, LS_VAR_NAME_SIMPLE_WITH_COLON);
1.1 parser 3844: RC;
3845: case '^':
1.84 paf 3846: push_LS(pc, LS_METHOD_NAME);
1.1 parser 3847: RC;
3848: case ';': // param delim
3849: RC;
3850: case '}':
3851: if(--lexical_brackets_nestage==0) {
1.84 paf 3852: pc.ls=LS_METHOD_AFTER;
1.1 parser 3853: RC;
3854: }
3855: break;
3856: case '{':
3857: lexical_brackets_nestage++;
3858: break;
3859: }
1.97 paf 3860: if(pc.explicit_result && c)
3861: switch(c) {
3862: case '\n': case ' ': case '\t':
3863: begin=pc.source;
3864: begin_pos=pc.pos;
3865: continue; // skip it
3866: default:
3867: result=BAD_NONWHITESPACE_CHARACTER_IN_EXPLICIT_RESULT_MODE;
3868: goto break2;
3869: }
1.1 parser 3870: break;
3871:
3872: case LS_METHOD_AFTER:
3873: if(c=='[') {/* ][ }[ )[ */
1.84 paf 3874: pc.ls=LS_METHOD_SQUARE;
1.1 parser 3875: lexical_brackets_nestage=1;
3876: RC;
3877: }
3878: if(c=='{') {/* ]{ }{ ){ */
1.84 paf 3879: pc.ls=LS_METHOD_CURLY;
1.1 parser 3880: lexical_brackets_nestage=1;
3881: RC;
3882: }
3883: if(c=='(') {/* ]( }( )( */
1.84 paf 3884: pc.ls=LS_METHOD_ROUND;
1.1 parser 3885: lexical_brackets_nestage=1;
3886: RC;
3887: }
1.84 paf 3888: pop_LS(pc);
3889: pc.ungetc();
1.1 parser 3890: result=EON;
3891: goto break2;
3892: }
3893: if(c==0) {
3894: result=-1;
3895: break;
3896: }
3897: }
3898:
3899: break2:
3900: if(end!=begin) { // there is last piece?
1.150 misha 3901: if(c=='@' || c==0) // we are before LS_DEF_NAME or EOF?
3902: while(end!=begin && end[-1]=='\n') // trim all empty lines before LS_DEF_NAME and EOF
1.1 parser 3903: end--;
1.84 paf 3904: if(end!=begin && pc.ls!=LS_USER_COMMENT) { // last piece still alive and not comment?
3905: if(!pc.string_start)
3906: pc.string_start=begin_pos;
1.1 parser 3907: // append it
1.84 paf 3908: pc.string.append_strdup_know_length(begin, end-begin);
1.1 parser 3909: }
3910: }
1.84 paf 3911: if(!pc.string.is_empty()) { // something accumulated?
3912: // create STRING value: array of OP_VALUE+origin+vstring
3913: *lvalp=VL(
3914: new VString(*new String(pc.string, String::L_CLEAN)),
3915: pc.file_no, pc.string_start.line, pc.string_start.col);
1.1 parser 3916: // new pieces storage
1.84 paf 3917: pc.string.clear();
3918: pc.string_start.clear();
1.1 parser 3919: // make current result be pending for next call, return STRING for now
1.84 paf 3920: pc.pending_state=result; result=STRING;
1.1 parser 3921: }
3922: if(skip_analized) {
1.84 paf 3923: pc.source+=skip_analized; pc.pos.col+=skip_analized;
1.1 parser 3924: }
3925: return result;
3926: }
3927:
1.156 ! moko 3928: static int real_yyerror(Parse_control *pc, const char *s) { // Called by yyparse on error
1.10 parser 3929: strncpy(PC.error, s, MAX_STRING);
1.1 parser 3930: return 1;
3931: }
3932:
3933: static void yyprint(FILE *file, int type, YYSTYPE value) {
3934: if(type==STRING)
1.84 paf 3935: fprintf(file, " \"%s\"", LA2S(*value)->cstr());
1.1 parser 3936: }
1.112 paf 3937:
E-mail: