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