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