00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #define YYBISON 1
00048
00049
00050 #define YYBISON_VERSION "2.3"
00051
00052
00053 #define YYSKELETON_NAME "yacc.c"
00054
00055
00056 #define YYPURE 0
00057
00058
00059 #define YYLSP_NEEDED 0
00060
00061
00062
00063
00064 #ifndef YYTOKENTYPE
00065 # define YYTOKENTYPE
00066
00067
00068 enum yytokentype {
00069 tINTEGER = 258,
00070 tSTRING = 259,
00071 tID = 260,
00072 tNE = 261,
00073 tEQ = 262,
00074 tGT = 263,
00075 tLT = 264,
00076 tGE = 265,
00077 tLE = 266,
00078 tCOMPARE = 267,
00079 tUNARYMINUS = 268
00080 };
00081 #endif
00082
00083 #define tINTEGER 258
00084 #define tSTRING 259
00085 #define tID 260
00086 #define tNE 261
00087 #define tEQ 262
00088 #define tGT 263
00089 #define tLT 264
00090 #define tGE 265
00091 #define tLE 266
00092 #define tCOMPARE 267
00093 #define tUNARYMINUS 268
00094
00095
00096
00097
00098
00099 #line 3 "vParser.ypp"
00100
00101
00102
00103
00104
00105 #include <stdlib.h>
00106 #define YYINCLUDED_STDLIB_H // tell Bison we did that
00107
00108 #include <vector>
00109
00110 #include "tError.h"
00111 #include "values/vCore.h"
00112 #include "values/veComparison.h"
00113 #include "values/veMath.h"
00114 #include "values/vRegistry.h"
00115 #include "values/vParser.h"
00116 #include "tString.h"
00117
00118 int yylex(void);
00119 void yyerror(char const *s);
00120
00121 using namespace vValue;
00122
00123 Expr::Base *rv;
00124
00125
00126
00127 #ifndef YYDEBUG
00128 # define YYDEBUG 0
00129 #endif
00130
00131
00132 #ifdef YYERROR_VERBOSE
00133 # undef YYERROR_VERBOSE
00134 # define YYERROR_VERBOSE 1
00135 #else
00136 # define YYERROR_VERBOSE 0
00137 #endif
00138
00139
00140 #ifndef YYTOKEN_TABLE
00141 # define YYTOKEN_TABLE 0
00142 #endif
00143
00144 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
00145 typedef union YYSTYPE
00146 #line 30 "vParser.ypp"
00147 {
00148 int integer;
00149 tString *string;
00150 Expr::Base *expr;
00151 Type::arglist *arglist;
00152 }
00153
00154 #line 155 "vParser.cpp"
00155 YYSTYPE;
00156 # define yystype YYSTYPE
00157 # define YYSTYPE_IS_DECLARED 1
00158 # define YYSTYPE_IS_TRIVIAL 1
00159 #endif
00160
00161
00162
00163
00164
00165
00166
00167 #line 168 "vParser.cpp"
00168
00169 #ifdef short
00170 # undef short
00171 #endif
00172
00173 #ifdef YYTYPE_UINT8
00174 typedef YYTYPE_UINT8 yytype_uint8;
00175 #else
00176 typedef unsigned char yytype_uint8;
00177 #endif
00178
00179 #ifdef YYTYPE_INT8
00180 typedef YYTYPE_INT8 yytype_int8;
00181 #elif (defined __STDC__ || defined __C99__FUNC__ \
00182 || defined __cplusplus || defined _MSC_VER)
00183 typedef signed char yytype_int8;
00184 #else
00185 typedef short int yytype_int8;
00186 #endif
00187
00188 #ifdef YYTYPE_UINT16
00189 typedef YYTYPE_UINT16 yytype_uint16;
00190 #else
00191 typedef unsigned short int yytype_uint16;
00192 #endif
00193
00194 #ifdef YYTYPE_INT16
00195 typedef YYTYPE_INT16 yytype_int16;
00196 #else
00197 typedef short int yytype_int16;
00198 #endif
00199
00200 #ifndef YYSIZE_T
00201 # ifdef __SIZE_TYPE__
00202 # define YYSIZE_T __SIZE_TYPE__
00203 # elif defined size_t
00204 # define YYSIZE_T size_t
00205 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00206 || defined __cplusplus || defined _MSC_VER)
00207 # include <stddef.h>
00208 # define YYSIZE_T size_t
00209 # else
00210 # define YYSIZE_T unsigned int
00211 # endif
00212 #endif
00213
00214 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
00215
00216 #ifndef YY_
00217 # if YYENABLE_NLS
00218 # if ENABLE_NLS
00219 # include <libintl.h>
00220 # define YY_(msgid) dgettext ("bison-runtime", msgid)
00221 # endif
00222 # endif
00223 # ifndef YY_
00224 # define YY_(msgid) msgid
00225 # endif
00226 #endif
00227
00228
00229 #if ! defined lint || defined __GNUC__
00230 # define YYUSE(e) ((void) (e))
00231 #else
00232 # define YYUSE(e)
00233 #endif
00234
00235
00236 #ifndef lint
00237 # define YYID(n) (n)
00238 #else
00239 #if (defined __STDC__ || defined __C99__FUNC__ \
00240 || defined __cplusplus || defined _MSC_VER)
00241 static int
00242 YYID (int i)
00243 #else
00244 static int
00245 YYID (i)
00246 int i;
00247 #endif
00248 {
00249 return i;
00250 }
00251 #endif
00252
00253 #if ! defined yyoverflow || YYERROR_VERBOSE
00254
00255
00256
00257 # ifdef YYSTACK_USE_ALLOCA
00258 # if YYSTACK_USE_ALLOCA
00259 # ifdef __GNUC__
00260 # define YYSTACK_ALLOC __builtin_alloca
00261 # elif defined __BUILTIN_VA_ARG_INCR
00262 # include <alloca.h>
00263 # elif defined _AIX
00264 # define YYSTACK_ALLOC __alloca
00265 # elif defined _MSC_VER
00266 # include <malloc.h>
00267 # define alloca _alloca
00268 # else
00269 # define YYSTACK_ALLOC alloca
00270 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00271 || defined __cplusplus || defined _MSC_VER)
00272 # include <stdlib.h>
00273 # ifndef _STDLIB_H
00274 # define _STDLIB_H 1
00275 # endif
00276 # endif
00277 # endif
00278 # endif
00279 # endif
00280
00281 # ifdef YYSTACK_ALLOC
00282
00283 # define YYSTACK_FREE(Ptr) do { ; } while (YYID (0))
00284 # ifndef YYSTACK_ALLOC_MAXIMUM
00285
00286
00287
00288
00289 # define YYSTACK_ALLOC_MAXIMUM 4032
00290 # endif
00291 # else
00292 # define YYSTACK_ALLOC YYMALLOC
00293 # define YYSTACK_FREE YYFREE
00294 # ifndef YYSTACK_ALLOC_MAXIMUM
00295 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
00296 # endif
00297 # if (defined __cplusplus && ! defined _STDLIB_H \
00298 && ! ((defined YYMALLOC || defined malloc) \
00299 && (defined YYFREE || defined free)))
00300 # include <stdlib.h>
00301 # ifndef _STDLIB_H
00302 # define _STDLIB_H 1
00303 # endif
00304 # endif
00305 # ifndef YYMALLOC
00306 # define YYMALLOC malloc
00307 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00308 || defined __cplusplus || defined _MSC_VER)
00309 void *malloc (YYSIZE_T);
00310 # endif
00311 # endif
00312 # ifndef YYFREE
00313 # define YYFREE free
00314 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00315 || defined __cplusplus || defined _MSC_VER)
00316 void free (void *);
00317 # endif
00318 # endif
00319 # endif
00320 #endif
00321
00322
00323 #if (! defined yyoverflow \
00324 && (! defined __cplusplus \
00325 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00326
00327
00328 union yyalloc
00329 {
00330 yytype_int16 yyss;
00331 YYSTYPE yyvs;
00332 };
00333
00334
00335 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00336
00337
00338
00339 # define YYSTACK_BYTES(N) \
00340 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
00341 + YYSTACK_GAP_MAXIMUM)
00342
00343
00344
00345 # ifndef YYCOPY
00346 # if defined __GNUC__ && 1 < __GNUC__
00347 # define YYCOPY(To, From, Count) \
00348 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00349 # else
00350 # define YYCOPY(To, From, Count) \
00351 do \
00352 { \
00353 YYSIZE_T yyi; \
00354 for (yyi = 0; yyi < (Count); yyi++) \
00355 (To)[yyi] = (From)[yyi]; \
00356 } \
00357 while (YYID (0))
00358 # endif
00359 # endif
00360
00361
00362
00363
00364
00365
00366 # define YYSTACK_RELOCATE(Stack) \
00367 do \
00368 { \
00369 YYSIZE_T yynewbytes; \
00370 YYCOPY (&yyptr->Stack, Stack, yysize); \
00371 Stack = &yyptr->Stack; \
00372 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00373 yyptr += yynewbytes / sizeof (*yyptr); \
00374 } \
00375 while (YYID (0))
00376
00377 #endif
00378
00379
00380 #define YYFINAL 12
00381
00382 #define YYLAST 38
00383
00384
00385 #define YYNTOKENS 22
00386
00387 #define YYNNTS 5
00388
00389 #define YYNRULES 17
00390
00391 #define YYNSTATES 31
00392
00393
00394 #define YYUNDEFTOK 2
00395 #define YYMAXUTOK 268
00396
00397 #define YYTRANSLATE(YYX) \
00398 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00399
00400
00401 static const yytype_uint8 yytranslate[] =
00402 {
00403 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00404 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00407 19, 20, 8, 6, 21, 7, 18, 9, 2, 2,
00408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00428 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
00429 5, 10, 11, 12, 13, 14, 15, 16, 17
00430 };
00431
00432 #if YYDEBUG
00433
00434
00435 static const yytype_uint8 yyprhs[] =
00436 {
00437 0, 0, 3, 5, 7, 9, 11, 15, 19, 23,
00438 27, 31, 34, 38, 43, 47, 48, 50
00439 };
00440
00441
00442 static const yytype_int8 yyrhs[] =
00443 {
00444 23, 0, -1, 24, -1, 3, -1, 4, -1, 25,
00445 -1, 24, 6, 24, -1, 24, 7, 24, -1, 24,
00446 8, 24, -1, 24, 9, 24, -1, 24, 16, 24,
00447 -1, 7, 24, -1, 19, 24, 20, -1, 5, 19,
00448 26, 20, -1, 25, 18, 25, -1, -1, 24, -1,
00449 26, 21, 24, -1
00450 };
00451
00452
00453 static const yytype_uint8 yyrline[] =
00454 {
00455 0, 55, 55, 81, 86, 91, 92, 96, 100, 104,
00456 108, 112, 117, 125, 133, 137, 140, 145
00457 };
00458 #endif
00459
00460 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00461
00462
00463 static const char *const yytname[] =
00464 {
00465 "$end", "error", "$undefined", "tINTEGER", "tSTRING", "tID", "'+'",
00466 "'-'", "'*'", "'/'", "tNE", "tEQ", "tGT", "tLT", "tGE", "tLE",
00467 "tCOMPARE", "tUNARYMINUS", "'.'", "'('", "')'", "','", "$accept",
00468 "input", "expr", "function", "arglist", 0
00469 };
00470 #endif
00471
00472 # ifdef YYPRINT
00473
00474
00475 static const yytype_uint16 yytoknum[] =
00476 {
00477 0, 256, 257, 258, 259, 260, 43, 45, 42, 47,
00478 261, 262, 263, 264, 265, 266, 267, 268, 46, 40,
00479 41, 44
00480 };
00481 # endif
00482
00483
00484 static const yytype_uint8 yyr1[] =
00485 {
00486 0, 22, 23, 24, 24, 24, 24, 24, 24, 24,
00487 24, 24, 24, 25, 25, 26, 26, 26
00488 };
00489
00490
00491 static const yytype_uint8 yyr2[] =
00492 {
00493 0, 2, 1, 1, 1, 1, 3, 3, 3, 3,
00494 3, 2, 3, 4, 3, 0, 1, 3
00495 };
00496
00497
00498
00499
00500 static const yytype_uint8 yydefact[] =
00501 {
00502 0, 3, 4, 0, 0, 0, 0, 2, 5, 15,
00503 11, 0, 1, 0, 0, 0, 0, 0, 0, 16,
00504 0, 12, 6, 7, 8, 9, 10, 14, 13, 0,
00505 17
00506 };
00507
00508
00509 static const yytype_int8 yydefgoto[] =
00510 {
00511 -1, 6, 7, 8, 20
00512 };
00513
00514
00515
00516 #define YYPACT_NINF -14
00517 static const yytype_int8 yypact[] =
00518 {
00519 -1, -14, -14, 4, -1, -1, 30, 13, 14, -1,
00520 -14, 8, -14, -1, -1, -1, -1, -1, 26, 13,
00521 -13, -14, 18, 18, 17, 17, -14, 19, -14, -1,
00522 13
00523 };
00524
00525
00526 static const yytype_int8 yypgoto[] =
00527 {
00528 -14, -14, -4, 20, -14
00529 };
00530
00531
00532
00533
00534
00535 #define YYTABLE_NINF -1
00536 static const yytype_int8 yytable[] =
00537 {
00538 10, 11, 1, 2, 3, 19, 4, 28, 29, 22,
00539 23, 24, 25, 26, 13, 14, 15, 16, 5, 13,
00540 14, 15, 16, 9, 17, 30, 15, 16, 21, 17,
00541 12, 3, 18, 17, 17, 0, 0, -1, 27
00542 };
00543
00544 static const yytype_int8 yycheck[] =
00545 {
00546 4, 5, 3, 4, 5, 9, 7, 20, 21, 13,
00547 14, 15, 16, 17, 6, 7, 8, 9, 19, 6,
00548 7, 8, 9, 19, 16, 29, 8, 9, 20, 16,
00549 0, 5, 18, 16, 16, -1, -1, 18, 18
00550 };
00551
00552
00553
00554 static const yytype_uint8 yystos[] =
00555 {
00556 0, 3, 4, 5, 7, 19, 23, 24, 25, 19,
00557 24, 24, 0, 6, 7, 8, 9, 16, 18, 24,
00558 26, 20, 24, 24, 24, 24, 24, 25, 20, 21,
00559 24
00560 };
00561
00562 #define yyerrok (yyerrstatus = 0)
00563 #define yyclearin (yychar = YYEMPTY)
00564 #define YYEMPTY (-2)
00565 #define YYEOF 0
00566
00567 #define YYACCEPT goto yyacceptlab
00568 #define YYABORT goto yyabortlab
00569 #define YYERROR goto yyerrorlab
00570
00571
00572
00573
00574
00575
00576 #define YYFAIL goto yyerrlab
00577
00578 #define YYRECOVERING() (!!yyerrstatus)
00579
00580 #define YYBACKUP(Token, Value) \
00581 do \
00582 if (yychar == YYEMPTY && yylen == 1) \
00583 { \
00584 yychar = (Token); \
00585 yylval = (Value); \
00586 yytoken = YYTRANSLATE (yychar); \
00587 YYPOPSTACK (1); \
00588 goto yybackup; \
00589 } \
00590 else \
00591 { \
00592 yyerror (YY_("syntax error: cannot back up")); \
00593 YYERROR; \
00594 } \
00595 while (YYID (0))
00596
00597
00598 #define YYTERROR 1
00599 #define YYERRCODE 256
00600
00601
00602
00603
00604
00605
00606 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
00607 #ifndef YYLLOC_DEFAULT
00608 # define YYLLOC_DEFAULT(Current, Rhs, N) \
00609 do \
00610 if (YYID (N)) \
00611 { \
00612 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
00613 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
00614 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
00615 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
00616 } \
00617 else \
00618 { \
00619 (Current).first_line = (Current).last_line = \
00620 YYRHSLOC (Rhs, 0).last_line; \
00621 (Current).first_column = (Current).last_column = \
00622 YYRHSLOC (Rhs, 0).last_column; \
00623 } \
00624 while (YYID (0))
00625 #endif
00626
00627
00628
00629
00630
00631
00632 #ifndef YY_LOCATION_PRINT
00633 # if YYLTYPE_IS_TRIVIAL
00634 # define YY_LOCATION_PRINT(File, Loc) \
00635 fprintf (File, "%d.%d-%d.%d", \
00636 (Loc).first_line, (Loc).first_column, \
00637 (Loc).last_line, (Loc).last_column)
00638 # else
00639 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
00640 # endif
00641 #endif
00642
00643
00644
00645
00646 #ifdef YYLEX_PARAM
00647 # define YYLEX yylex (YYLEX_PARAM)
00648 #else
00649 # define YYLEX yylex ()
00650 #endif
00651
00652
00653 #if YYDEBUG
00654
00655 # ifndef YYFPRINTF
00656 # include <stdio.h>
00657 # define YYFPRINTF fprintf
00658 # endif
00659
00660 # define YYDPRINTF(Args) \
00661 do { \
00662 if (yydebug) \
00663 YYFPRINTF Args; \
00664 } while (YYID (0))
00665
00666 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
00667 do { \
00668 if (yydebug) \
00669 { \
00670 YYFPRINTF (stderr, "%s ", Title); \
00671 yy_symbol_print (stderr, \
00672 Type, Value); \
00673 YYFPRINTF (stderr, "\n"); \
00674 } \
00675 } while (YYID (0))
00676
00677
00678
00679
00680
00681
00682
00683 #if (defined __STDC__ || defined __C99__FUNC__ \
00684 || defined __cplusplus || defined _MSC_VER)
00685 static void
00686 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
00687 #else
00688 static void
00689 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
00690 FILE *yyoutput;
00691 int yytype;
00692 YYSTYPE const * const yyvaluep;
00693 #endif
00694 {
00695 if (!yyvaluep)
00696 return;
00697 # ifdef YYPRINT
00698 if (yytype < YYNTOKENS)
00699 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
00700 # else
00701 YYUSE (yyoutput);
00702 # endif
00703 switch (yytype)
00704 {
00705 default:
00706 break;
00707 }
00708 }
00709
00710
00711
00712
00713
00714
00715 #if (defined __STDC__ || defined __C99__FUNC__ \
00716 || defined __cplusplus || defined _MSC_VER)
00717 static void
00718 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
00719 #else
00720 static void
00721 yy_symbol_print (yyoutput, yytype, yyvaluep)
00722 FILE *yyoutput;
00723 int yytype;
00724 YYSTYPE const * const yyvaluep;
00725 #endif
00726 {
00727 if (yytype < YYNTOKENS)
00728 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
00729 else
00730 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
00731
00732 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
00733 YYFPRINTF (yyoutput, ")");
00734 }
00735
00736
00737
00738
00739
00740
00741 #if (defined __STDC__ || defined __C99__FUNC__ \
00742 || defined __cplusplus || defined _MSC_VER)
00743 static void
00744 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
00745 #else
00746 static void
00747 yy_stack_print (bottom, top)
00748 yytype_int16 *bottom;
00749 yytype_int16 *top;
00750 #endif
00751 {
00752 YYFPRINTF (stderr, "Stack now");
00753 for (; bottom <= top; ++bottom)
00754 YYFPRINTF (stderr, " %d", *bottom);
00755 YYFPRINTF (stderr, "\n");
00756 }
00757
00758 # define YY_STACK_PRINT(Bottom, Top) \
00759 do { \
00760 if (yydebug) \
00761 yy_stack_print ((Bottom), (Top)); \
00762 } while (YYID (0))
00763
00764
00765
00766
00767
00768
00769 #if (defined __STDC__ || defined __C99__FUNC__ \
00770 || defined __cplusplus || defined _MSC_VER)
00771 static void
00772 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
00773 #else
00774 static void
00775 yy_reduce_print (yyvsp, yyrule)
00776 YYSTYPE *yyvsp;
00777 int yyrule;
00778 #endif
00779 {
00780 int yynrhs = yyr2[yyrule];
00781 int yyi;
00782 unsigned long int yylno = yyrline[yyrule];
00783 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
00784 yyrule - 1, yylno);
00785
00786 for (yyi = 0; yyi < yynrhs; yyi++)
00787 {
00788 fprintf (stderr, " $%d = ", yyi + 1);
00789 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
00790 &(yyvsp[(yyi + 1) - (yynrhs)])
00791 );
00792 fprintf (stderr, "\n");
00793 }
00794 }
00795
00796 # define YY_REDUCE_PRINT(Rule) \
00797 do { \
00798 if (yydebug) \
00799 yy_reduce_print (yyvsp, Rule); \
00800 } while (YYID (0))
00801
00802
00803
00804 int yydebug;
00805 #else
00806 # define YYDPRINTF(Args)
00807 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
00808 # define YY_STACK_PRINT(Bottom, Top)
00809 # define YY_REDUCE_PRINT(Rule)
00810 #endif
00811
00812
00813
00814 #ifndef YYINITDEPTH
00815 # define YYINITDEPTH 200
00816 #endif
00817
00818
00819
00820
00821
00822
00823
00824
00825 #ifndef YYMAXDEPTH
00826 # define YYMAXDEPTH 10000
00827 #endif
00828
00829
00830
00831 #if YYERROR_VERBOSE
00832
00833 # ifndef yystrlen
00834 # if defined __GLIBC__ && defined _STRING_H
00835 # define yystrlen strlen
00836 # else
00837
00838 #if (defined __STDC__ || defined __C99__FUNC__ \
00839 || defined __cplusplus || defined _MSC_VER)
00840 static YYSIZE_T
00841 yystrlen (const char *yystr)
00842 #else
00843 static YYSIZE_T
00844 yystrlen (yystr)
00845 const char *yystr;
00846 #endif
00847 {
00848 YYSIZE_T yylen;
00849 for (yylen = 0; yystr[yylen]; yylen++)
00850 continue;
00851 return yylen;
00852 }
00853 # endif
00854 # endif
00855
00856 # ifndef yystpcpy
00857 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
00858 # define yystpcpy stpcpy
00859 # else
00860
00861
00862 #if (defined __STDC__ || defined __C99__FUNC__ \
00863 || defined __cplusplus || defined _MSC_VER)
00864 static char *
00865 yystpcpy (char *yydest, const char *yysrc)
00866 #else
00867 static char *
00868 yystpcpy (yydest, yysrc)
00869 char *yydest;
00870 const char *yysrc;
00871 #endif
00872 {
00873 char *yyd = yydest;
00874 const char *yys = yysrc;
00875
00876 while ((*yyd++ = *yys++) != '\0')
00877 continue;
00878
00879 return yyd - 1;
00880 }
00881 # endif
00882 # endif
00883
00884 # ifndef yytnamerr
00885
00886
00887
00888
00889
00890
00891
00892 static YYSIZE_T
00893 yytnamerr (char *yyres, const char *yystr)
00894 {
00895 if (*yystr == '"')
00896 {
00897 YYSIZE_T yyn = 0;
00898 char const *yyp = yystr;
00899
00900 for (;;)
00901 switch (*++yyp)
00902 {
00903 case '\'':
00904 case ',':
00905 goto do_not_strip_quotes;
00906
00907 case '\\':
00908 if (*++yyp != '\\')
00909 goto do_not_strip_quotes;
00910
00911 default:
00912 if (yyres)
00913 yyres[yyn] = *yyp;
00914 yyn++;
00915 break;
00916
00917 case '"':
00918 if (yyres)
00919 yyres[yyn] = '\0';
00920 return yyn;
00921 }
00922 do_not_strip_quotes: ;
00923 }
00924
00925 if (! yyres)
00926 return yystrlen (yystr);
00927
00928 return yystpcpy (yyres, yystr) - yyres;
00929 }
00930 # endif
00931
00932
00933
00934
00935
00936
00937
00938
00939 static YYSIZE_T
00940 yysyntax_error (char *yyresult, int yystate, int yychar)
00941 {
00942 int yyn = yypact[yystate];
00943
00944 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
00945 return 0;
00946 else
00947 {
00948 int yytype = YYTRANSLATE (yychar);
00949 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
00950 YYSIZE_T yysize = yysize0;
00951 YYSIZE_T yysize1;
00952 int yysize_overflow = 0;
00953 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
00954 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
00955 int yyx;
00956
00957 # if 0
00958
00959
00960 YY_("syntax error, unexpected %s");
00961 YY_("syntax error, unexpected %s, expecting %s");
00962 YY_("syntax error, unexpected %s, expecting %s or %s");
00963 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
00964 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
00965 # endif
00966 char *yyfmt;
00967 char const *yyf;
00968 static char const yyunexpected[] = "syntax error, unexpected %s";
00969 static char const yyexpecting[] = ", expecting %s";
00970 static char const yyor[] = " or %s";
00971 char yyformat[sizeof yyunexpected
00972 + sizeof yyexpecting - 1
00973 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
00974 * (sizeof yyor - 1))];
00975 char const *yyprefix = yyexpecting;
00976
00977
00978
00979 int yyxbegin = yyn < 0 ? -yyn : 0;
00980
00981
00982 int yychecklim = YYLAST - yyn + 1;
00983 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
00984 int yycount = 1;
00985
00986 yyarg[0] = yytname[yytype];
00987 yyfmt = yystpcpy (yyformat, yyunexpected);
00988
00989 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
00990 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
00991 {
00992 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
00993 {
00994 yycount = 1;
00995 yysize = yysize0;
00996 yyformat[sizeof yyunexpected - 1] = '\0';
00997 break;
00998 }
00999 yyarg[yycount++] = yytname[yyx];
01000 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
01001 yysize_overflow |= (yysize1 < yysize);
01002 yysize = yysize1;
01003 yyfmt = yystpcpy (yyfmt, yyprefix);
01004 yyprefix = yyor;
01005 }
01006
01007 yyf = YY_(yyformat);
01008 yysize1 = yysize + yystrlen (yyf);
01009 yysize_overflow |= (yysize1 < yysize);
01010 yysize = yysize1;
01011
01012 if (yysize_overflow)
01013 return YYSIZE_MAXIMUM;
01014
01015 if (yyresult)
01016 {
01017
01018
01019
01020 char *yyp = yyresult;
01021 int yyi = 0;
01022 while ((*yyp = *yyf) != '\0')
01023 {
01024 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
01025 {
01026 yyp += yytnamerr (yyp, yyarg[yyi++]);
01027 yyf += 2;
01028 }
01029 else
01030 {
01031 yyp++;
01032 yyf++;
01033 }
01034 }
01035 }
01036 return yysize;
01037 }
01038 }
01039 #endif
01040
01041
01042
01043
01044
01045
01046
01047 #if (defined __STDC__ || defined __C99__FUNC__ \
01048 || defined __cplusplus || defined _MSC_VER)
01049 static void
01050 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
01051 #else
01052 static void
01053 yydestruct (yymsg, yytype, yyvaluep)
01054 const char *yymsg;
01055 int yytype;
01056 YYSTYPE *yyvaluep;
01057 #endif
01058 {
01059 YYUSE (yyvaluep);
01060
01061 if (!yymsg)
01062 yymsg = "Deleting";
01063 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
01064
01065 switch (yytype)
01066 {
01067 case 4:
01068 #line 37 "vParser.ypp"
01069 {
01070 delete (yyvaluep->string);
01071 };
01072 #line 1073 "vParser.cpp"
01073 break;
01074 case 5:
01075 #line 37 "vParser.ypp"
01076 {
01077 delete (yyvaluep->string);
01078 };
01079 #line 1080 "vParser.cpp"
01080 break;
01081 case 24:
01082 #line 37 "vParser.ypp"
01083 {
01084 delete (yyvaluep->expr);
01085 };
01086 #line 1087 "vParser.cpp"
01087 break;
01088 case 25:
01089 #line 37 "vParser.ypp"
01090 {
01091 delete (yyvaluep->expr);
01092 };
01093 #line 1094 "vParser.cpp"
01094 break;
01095
01096 default:
01097 break;
01098 }
01099 }
01100
01101
01102
01103
01104 #ifdef YYPARSE_PARAM
01105 #if defined __STDC__ || defined __cplusplus
01106 int yyparse (void *YYPARSE_PARAM);
01107 #else
01108 int yyparse ();
01109 #endif
01110 #else
01111 #if defined __STDC__ || defined __cplusplus
01112 int yyparse (void);
01113 #else
01114 int yyparse ();
01115 #endif
01116 #endif
01117
01118
01119
01120
01121 int yychar;
01122
01123
01124 YYSTYPE yylval;
01125
01126
01127 int yynerrs;
01128
01129
01130
01131
01132
01133
01134
01135 #ifdef YYPARSE_PARAM
01136 #if (defined __STDC__ || defined __C99__FUNC__ \
01137 || defined __cplusplus || defined _MSC_VER)
01138 int
01139 yyparse (void *YYPARSE_PARAM)
01140 #else
01141 int
01142 yyparse (YYPARSE_PARAM)
01143 void *YYPARSE_PARAM;
01144 #endif
01145 #else
01146 #if (defined __STDC__ || defined __C99__FUNC__ \
01147 || defined __cplusplus || defined _MSC_VER)
01148 int
01149 yyparse (void)
01150 #else
01151 int
01152 yyparse ()
01153
01154 #endif
01155 #endif
01156 {
01157
01158 int yystate;
01159 int yyn;
01160 int yyresult;
01161
01162 int yyerrstatus;
01163
01164 int yytoken = 0;
01165 #if YYERROR_VERBOSE
01166
01167 char yymsgbuf[128];
01168 char *yymsg = yymsgbuf;
01169 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
01170 #endif
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181 yytype_int16 yyssa[YYINITDEPTH];
01182 yytype_int16 *yyss = yyssa;
01183 yytype_int16 *yyssp;
01184
01185
01186 YYSTYPE yyvsa[YYINITDEPTH];
01187 YYSTYPE *yyvs = yyvsa;
01188 YYSTYPE *yyvsp;
01189
01190
01191
01192 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
01193
01194 YYSIZE_T yystacksize = YYINITDEPTH;
01195
01196
01197
01198 YYSTYPE yyval;
01199
01200
01201
01202
01203 int yylen = 0;
01204
01205 YYDPRINTF ((stderr, "Starting parse\n"));
01206
01207 yystate = 0;
01208 yyerrstatus = 0;
01209 yynerrs = 0;
01210 yychar = YYEMPTY;
01211
01212
01213
01214
01215
01216
01217 yyssp = yyss;
01218 yyvsp = yyvs;
01219
01220 goto yysetstate;
01221
01222
01223
01224
01225 yynewstate:
01226
01227
01228 yyssp++;
01229
01230 yysetstate:
01231 *yyssp = yystate;
01232
01233 if (yyss + yystacksize - 1 <= yyssp)
01234 {
01235
01236 YYSIZE_T yysize = yyssp - yyss + 1;
01237
01238 #ifdef yyoverflow
01239 {
01240
01241
01242
01243 YYSTYPE *yyvs1 = yyvs;
01244 yytype_int16 *yyss1 = yyss;
01245
01246
01247
01248
01249
01250
01251 yyoverflow (YY_("memory exhausted"),
01252 &yyss1, yysize * sizeof (*yyssp),
01253 &yyvs1, yysize * sizeof (*yyvsp),
01254
01255 &yystacksize);
01256
01257 yyss = yyss1;
01258 yyvs = yyvs1;
01259 }
01260 #else
01261 # ifndef YYSTACK_RELOCATE
01262 goto yyexhaustedlab;
01263 # else
01264
01265 if (YYMAXDEPTH <= yystacksize)
01266 goto yyexhaustedlab;
01267 yystacksize *= 2;
01268 if (YYMAXDEPTH < yystacksize)
01269 yystacksize = YYMAXDEPTH;
01270
01271 {
01272 yytype_int16 *yyss1 = yyss;
01273 union yyalloc *yyptr =
01274 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01275 if (! yyptr)
01276 goto yyexhaustedlab;
01277 YYSTACK_RELOCATE (yyss);
01278 YYSTACK_RELOCATE (yyvs);
01279
01280 # undef YYSTACK_RELOCATE
01281 if (yyss1 != yyssa)
01282 YYSTACK_FREE (yyss1);
01283 }
01284 # endif
01285 #endif
01286
01287 yyssp = yyss + yysize - 1;
01288 yyvsp = yyvs + yysize - 1;
01289
01290
01291 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01292 (unsigned long int) yystacksize));
01293
01294 if (yyss + yystacksize - 1 <= yyssp)
01295 YYABORT;
01296 }
01297
01298 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01299
01300 goto yybackup;
01301
01302
01303
01304
01305 yybackup:
01306
01307
01308
01309
01310
01311 yyn = yypact[yystate];
01312 if (yyn == YYPACT_NINF)
01313 goto yydefault;
01314
01315
01316
01317
01318 if (yychar == YYEMPTY)
01319 {
01320 YYDPRINTF ((stderr, "Reading a token: "));
01321 yychar = YYLEX;
01322 }
01323
01324 if (yychar <= YYEOF)
01325 {
01326 yychar = yytoken = YYEOF;
01327 YYDPRINTF ((stderr, "Now at end of input.\n"));
01328 }
01329 else
01330 {
01331 yytoken = YYTRANSLATE (yychar);
01332 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
01333 }
01334
01335
01336
01337 yyn += yytoken;
01338 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01339 goto yydefault;
01340 yyn = yytable[yyn];
01341 if (yyn <= 0)
01342 {
01343 if (yyn == 0 || yyn == YYTABLE_NINF)
01344 goto yyerrlab;
01345 yyn = -yyn;
01346 goto yyreduce;
01347 }
01348
01349 if (yyn == YYFINAL)
01350 YYACCEPT;
01351
01352
01353
01354 if (yyerrstatus)
01355 yyerrstatus--;
01356
01357
01358 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
01359
01360
01361 if (yychar != YYEOF)
01362 yychar = YYEMPTY;
01363
01364 yystate = yyn;
01365 *++yyvsp = yylval;
01366
01367 goto yynewstate;
01368
01369
01370
01371
01372
01373 yydefault:
01374 yyn = yydefact[yystate];
01375 if (yyn == 0)
01376 goto yyerrlab;
01377 goto yyreduce;
01378
01379
01380
01381
01382
01383 yyreduce:
01384
01385 yylen = yyr2[yyn];
01386
01387
01388
01389
01390
01391
01392
01393
01394
01395 yyval = yyvsp[1-yylen];
01396
01397
01398 YY_REDUCE_PRINT (yyn);
01399 switch (yyn)
01400 {
01401 case 2:
01402 #line 56 "vParser.ypp"
01403 {
01404 rv = (yyvsp[(1) - (1)].expr);
01405 }
01406 break;
01407
01408 case 3:
01409 #line 82 "vParser.ypp"
01410 {
01411 (yyval.expr) = new Expr::Int((yyvsp[(1) - (1)].integer));
01412 }
01413 break;
01414
01415 case 4:
01416 #line 87 "vParser.ypp"
01417 {
01418 (yyval.expr) = new Expr::String(*(yyvsp[(1) - (1)].string));
01419 delete (yyvsp[(1) - (1)].string);
01420 }
01421 break;
01422
01423 case 6:
01424 #line 93 "vParser.ypp"
01425 {
01426 (yyval.expr) = new Expr::Math::Add(BasePtr((yyvsp[(1) - (3)].expr)), BasePtr((yyvsp[(3) - (3)].expr)));
01427 }
01428 break;
01429
01430 case 7:
01431 #line 97 "vParser.ypp"
01432 {
01433 (yyval.expr) = new Expr::Math::Subtract(BasePtr((yyvsp[(1) - (3)].expr)), BasePtr((yyvsp[(3) - (3)].expr)));
01434 }
01435 break;
01436
01437 case 8:
01438 #line 101 "vParser.ypp"
01439 {
01440 (yyval.expr) = new Expr::Math::Multiply(BasePtr((yyvsp[(1) - (3)].expr)), BasePtr((yyvsp[(3) - (3)].expr)));
01441 }
01442 break;
01443
01444 case 9:
01445 #line 105 "vParser.ypp"
01446 {
01447 (yyval.expr) = new Expr::Math::Divide(BasePtr((yyvsp[(1) - (3)].expr)), BasePtr((yyvsp[(3) - (3)].expr)));
01448 }
01449 break;
01450
01451 case 10:
01452 #line 109 "vParser.ypp"
01453 {
01454 (yyval.expr) = new Expr::Comparison::Compare(BasePtr((yyvsp[(1) - (3)].expr)), BasePtr((yyvsp[(3) - (3)].expr)));
01455 }
01456 break;
01457
01458 case 11:
01459 #line 113 "vParser.ypp"
01460 {
01461 static BasePtr zero(new Expr::Int(0));
01462 (yyval.expr) = new Expr::Math::Subtract(zero, BasePtr((yyvsp[(2) - (2)].expr)));
01463 }
01464 break;
01465
01466 case 12:
01467 #line 118 "vParser.ypp"
01468 {
01469 (yyval.expr) = (yyvsp[(2) - (3)].expr);
01470 }
01471 break;
01472
01473 case 13:
01474 #line 126 "vParser.ypp"
01475 {
01476 std::vector<tString> flags;
01477 flags.push_back(tString("func"));
01478 (yyval.expr) = Registry::Registry::theRegistry().create(flags, *(yyvsp[(1) - (4)].string), *(yyvsp[(3) - (4)].arglist));
01479 delete (yyvsp[(1) - (4)].string);
01480 delete (yyvsp[(3) - (4)].arglist);
01481 }
01482 break;
01483
01484 case 15:
01485 #line 137 "vParser.ypp"
01486 {
01487 (yyval.arglist) = new arglist();
01488 }
01489 break;
01490
01491 case 16:
01492 #line 141 "vParser.ypp"
01493 {
01494 (yyval.arglist) = new arglist();
01495 (yyval.arglist)->push_back(BasePtr((yyvsp[(1) - (1)].expr)));
01496 }
01497 break;
01498
01499 case 17:
01500 #line 146 "vParser.ypp"
01501 {
01502 (yyval.arglist) = (yyvsp[(1) - (3)].arglist);
01503 (yyval.arglist)->push_back(BasePtr((yyvsp[(3) - (3)].expr)));
01504 }
01505 break;
01506
01507
01508
01509 #line 1510 "vParser.cpp"
01510 default: break;
01511 }
01512 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
01513
01514 YYPOPSTACK (yylen);
01515 yylen = 0;
01516 YY_STACK_PRINT (yyss, yyssp);
01517
01518 *++yyvsp = yyval;
01519
01520
01521
01522
01523
01524
01525 yyn = yyr1[yyn];
01526
01527 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
01528 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01529 yystate = yytable[yystate];
01530 else
01531 yystate = yydefgoto[yyn - YYNTOKENS];
01532
01533 goto yynewstate;
01534
01535
01536
01537
01538
01539 yyerrlab:
01540
01541 if (!yyerrstatus)
01542 {
01543 ++yynerrs;
01544 #if ! YYERROR_VERBOSE
01545 yyerror (YY_("syntax error"));
01546 #else
01547 {
01548 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
01549 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
01550 {
01551 YYSIZE_T yyalloc = 2 * yysize;
01552 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
01553 yyalloc = YYSTACK_ALLOC_MAXIMUM;
01554 if (yymsg != yymsgbuf)
01555 YYSTACK_FREE (yymsg);
01556 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
01557 if (yymsg)
01558 yymsg_alloc = yyalloc;
01559 else
01560 {
01561 yymsg = yymsgbuf;
01562 yymsg_alloc = sizeof yymsgbuf;
01563 }
01564 }
01565
01566 if (0 < yysize && yysize <= yymsg_alloc)
01567 {
01568 (void) yysyntax_error (yymsg, yystate, yychar);
01569 yyerror (yymsg);
01570 }
01571 else
01572 {
01573 yyerror (YY_("syntax error"));
01574 if (yysize != 0)
01575 goto yyexhaustedlab;
01576 }
01577 }
01578 #endif
01579 }
01580
01581
01582
01583 if (yyerrstatus == 3)
01584 {
01585
01586
01587
01588 if (yychar <= YYEOF)
01589 {
01590
01591 if (yychar == YYEOF)
01592 YYABORT;
01593 }
01594 else
01595 {
01596 yydestruct ("Error: discarding",
01597 yytoken, &yylval);
01598 yychar = YYEMPTY;
01599 }
01600 }
01601
01602
01603
01604 goto yyerrlab1;
01605
01606
01607
01608
01609
01610 yyerrorlab:
01611
01612
01613
01614
01615 if ( 0)
01616 goto yyerrorlab;
01617
01618
01619
01620 YYPOPSTACK (yylen);
01621 yylen = 0;
01622 YY_STACK_PRINT (yyss, yyssp);
01623 yystate = *yyssp;
01624 goto yyerrlab1;
01625
01626
01627
01628
01629
01630 yyerrlab1:
01631 yyerrstatus = 3;
01632
01633 for (;;)
01634 {
01635 yyn = yypact[yystate];
01636 if (yyn != YYPACT_NINF)
01637 {
01638 yyn += YYTERROR;
01639 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
01640 {
01641 yyn = yytable[yyn];
01642 if (0 < yyn)
01643 break;
01644 }
01645 }
01646
01647
01648 if (yyssp == yyss)
01649 YYABORT;
01650
01651
01652 yydestruct ("Error: popping",
01653 yystos[yystate], yyvsp);
01654 YYPOPSTACK (1);
01655 yystate = *yyssp;
01656 YY_STACK_PRINT (yyss, yyssp);
01657 }
01658
01659 if (yyn == YYFINAL)
01660 YYACCEPT;
01661
01662 *++yyvsp = yylval;
01663
01664
01665
01666 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
01667
01668 yystate = yyn;
01669 goto yynewstate;
01670
01671
01672
01673
01674
01675 yyacceptlab:
01676 yyresult = 0;
01677 goto yyreturn;
01678
01679
01680
01681
01682 yyabortlab:
01683 yyresult = 1;
01684 goto yyreturn;
01685
01686 #ifndef yyoverflow
01687
01688
01689
01690 yyexhaustedlab:
01691 yyerror (YY_("memory exhausted"));
01692 yyresult = 2;
01693
01694 #endif
01695
01696 yyreturn:
01697 if (yychar != YYEOF && yychar != YYEMPTY)
01698 yydestruct ("Cleanup: discarding lookahead",
01699 yytoken, &yylval);
01700
01701
01702 YYPOPSTACK (yylen);
01703 YY_STACK_PRINT (yyss, yyssp);
01704 while (yyssp != yyss)
01705 {
01706 yydestruct ("Cleanup: popping",
01707 yystos[*yyssp], yyvsp);
01708 YYPOPSTACK (1);
01709 }
01710 #ifndef yyoverflow
01711 if (yyss != yyssa)
01712 YYSTACK_FREE (yyss);
01713 #endif
01714 #if YYERROR_VERBOSE
01715 if (yymsg != yymsgbuf)
01716 YYSTACK_FREE (yymsg);
01717 #endif
01718
01719 return YYID (yyresult);
01720 }
01721
01722
01723 #line 151 "vParser.ypp"
01724
01725
01726 #if tCodeParser_STANDALONE
01727 int
01728 main(void)
01729 {
01730 return yyparse();
01731 }
01732
01733 #define lex_getc getchar
01734 #define lex_ungetc(c) ungetc(c, stdin)
01735 #else
01736 tString in;
01737 int pos, buffer;
01738
01739 Expr::Base *
01740 vValue::Parser::parse(tString s)
01741 {
01742 pos = 0;
01743 buffer = -1;
01744 in = s;
01745 if (!yyparse())
01746 return rv;
01747 return NULL;
01748 }
01749
01750 int
01751 lex_getc(void)
01752 {
01753 if (buffer != -1)
01754 {
01755 int r = buffer;
01756 buffer = -1;
01757 return r;
01758 }
01759
01760 if ((unsigned int)pos >= in.size())
01761 return EOF;
01762 return in[pos++];
01763 }
01764
01765 static void
01766 lex_ungetc(int c)
01767 {
01768 assert(buffer == -1);
01769 buffer = c;
01770 }
01771 #endif
01772
01773 void
01774 yyerror(const char *s)
01775 {
01776
01777
01778 tString msg("vValue parse error: ");
01779 msg << s;
01780 tERR_ERROR(msg);
01781 }
01782
01783 static bool
01784 follow(int expect)
01785 {
01786 int c = lex_getc();
01787
01788 if (c == expect)
01789 return true;
01790 lex_ungetc(c);
01791 return false;
01792 }
01793
01794 int
01795 yylex(void)
01796 {
01797 int c;
01798
01799
01800 while (isspace(c = lex_getc()))
01801 #ifdef tCodeParser_STANDALONE
01802 if (c == '\n')
01803 return c;
01804 #endif
01805 ;
01806
01807 if (c == EOF)
01808 return 0;
01809
01810 if (isdigit(c))
01811 {
01812 int n = 0;
01813
01814 for ( ; isdigit(c); c = lex_getc())
01815 n = (n * 10) + (c - '0');
01816 lex_ungetc(c);
01817 yylval.integer = n;
01818 return tINTEGER;
01819 }
01820
01821 if (isalpha(c))
01822 {
01823 tString *s = new tString;
01824 for ( ; isalnum(c); c = lex_getc())
01825 *s += (char)c;
01826 lex_ungetc(c);
01827 yylval.string = s;
01828 return tID;
01829 }
01830
01831 if (c == '"')
01832 {
01833 tString *s = new tString;
01834 while ('"' != (c = lex_getc()))
01835 {
01836 switch (c) {
01837 case EOF:
01838 yyerror("Missing quote! wtf?");
01839 break;
01840 case '\\':
01841
01842
01843 c = lex_getc();
01844 break;
01845 }
01846 (*s) += (char)c;
01847 }
01848 yylval.string = s;
01849 return tSTRING;
01850 }
01851
01852 switch (c) {
01853 case '<':
01854 if (follow('='))
01855 {
01856 if (follow('>'))
01857 return tCOMPARE;
01858 else
01859 return tLE;
01860 }
01861 break;
01862 }
01863
01864 return c;
01865 }
01866