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