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