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