Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

AtomParser.C

Go to the documentation of this file.
00001 
00002 # line 2 "AtomParser.y"
00003 /***************************************************************************
00004  *cr                                                                       
00005  *cr            (C) Copyright 1995-2008 The Board of Trustees of the           
00006  *cr                        University of Illinois                       
00007  *cr                         All Rights Reserved                        
00008  *cr                                                                   
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  * RCS INFORMATION:
00013  *
00014  *      $RCSfile: AtomParser.C,v $
00015  *      $Author: johns $        $Locker:  $             $State: Exp $
00016  *      $Revision: 1.16 $       $Date: 2008/06/02 08:03:08 $
00017  *
00018  ***************************************************************************
00019  * DESCRIPTION:
00020  *  a parser for atom selections
00021  *
00022  ***************************************************************************/
00023 
00024 
00025 
00026 #include <stdio.h>
00027 #include <string.h>
00028 #include "AtomParser.h"
00029 #include "Inform.h"
00030 
00031 #if !defined(_MSC_VER)
00032 extern "C" int yyparse();
00033 #endif
00034 extern "C" void yyerror(const char *s);
00035 extern "C" int yylex();
00036 
00037 atomparser_node *atomparser_result;
00038 
00039 # line 39 "AtomParser.y"
00040 typedef union
00041 #ifdef __cplusplus
00042         YYSTYPE
00043 #endif
00044  {
00045         int ival;
00046         double dval;
00047         atomparser_node *node;
00048 } YYSTYPE;
00049 # define KEY 257
00050 # define WITHIN 258
00051 # define EXWITHIN 259
00052 # define PBWITHIN 260
00053 # define WHERE 261
00054 # define FUNC 262
00055 # define STRFCTN 263
00056 # define SAME 264
00057 # define SINGLE 265
00058 # define OF 266
00059 # define AS 267
00060 # define THROUGH 268
00061 # define ERROR 269
00062 # define RANGE 270
00063 # define FLOAT 271
00064 # define INT 272
00065 # define WORD 273
00066 # define COMPARE 274
00067 # define OR 275
00068 # define AND 276
00069 # define LT 277
00070 # define LE 278
00071 # define EQ 279
00072 # define GE 280
00073 # define GT 281
00074 # define NE 282
00075 # define NLT 283
00076 # define NLE 284
00077 # define NEQ 285
00078 # define NGE 286
00079 # define NGT 287
00080 # define NNE 288
00081 # define SLT 289
00082 # define SLE 290
00083 # define SEQ 291
00084 # define SGE 292
00085 # define SGT 293
00086 # define SNE 294
00087 # define MATCH 295
00088 # define ADD 296
00089 # define SUB 297
00090 # define MULT 298
00091 # define DIV 299
00092 # define MOD 300
00093 # define EXP 301
00094 # define nonassoc 302
00095 # define NOT 303
00096 # define UMINUS 304
00097 
00098 #if !defined(_MSC_VER) && !defined(ARCH_TRU64)
00099 #include <inttypes.h>
00100 #endif
00101 
00102 #if 1
00103 //#ifdef __STDC__
00104 #include <stdlib.h>
00105 #include <string.h>
00106 #define YYCONST const
00107 #else
00108 #include <malloc.h>
00109 #include <memory.h>
00110 #define YYCONST
00111 #endif
00112 
00113 #if !defined(_MSC_VER) && !defined(ARCH_MACOSX) && !defined(ARCH_MACOSXX86) && !defined(ARCH_MACOSXX86_64)
00114 #include <values.h>
00115 #endif
00116 
00117 #if defined(__cplusplus) || defined(__STDC__)
00118 
00119 #if defined(__cplusplus) && defined(__EXTERN_C__)
00120 extern "C" {
00121 #endif
00122 #ifndef yyerror
00123 #if defined(__cplusplus)
00124         void yyerror(YYCONST char *);
00125 #endif
00126 #endif
00127 #ifndef yylex
00128         int yylex(void);
00129 #endif
00130         int yyparse(void);
00131 #if defined(__cplusplus) && defined(__EXTERN_C__)
00132 }
00133 #endif
00134 
00135 #endif
00136 
00137 #define yyclearin yychar = -1
00138 #define yyerrok yyerrflag = 0
00139 extern int yychar;
00140 extern int yyerrflag;
00141 YYSTYPE yylval;
00142 YYSTYPE yyval;
00143 typedef int yytabelem;
00144 #ifndef YYMAXDEPTH
00145 #define YYMAXDEPTH 150
00146 #endif
00147 #if YYMAXDEPTH > 0
00148 int yy_yys[YYMAXDEPTH], *yys = yy_yys;
00149 YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv;
00150 #else   /* user does initial allocation */
00151 int *yys;
00152 YYSTYPE *yyv;
00153 #endif
00154 static int yymaxdepth = YYMAXDEPTH;
00155 # define YYERRCODE 256
00156 
00157 # line 263 "AtomParser.y"
00158 
00159 
00160 extern "C" void yyerror(const char *s) {
00161   msgErr << s << sendmsg;
00162 }
00163 
00164 // everything comes from a string, so there is no way to
00165 // reset "yyin" (or whatever) to the next input
00166 extern "C" int yywrap(void) {
00167   return 1;
00168 }
00169 
00170 static YYCONST yytabelem yyexca[] ={
00171 -1, 0,
00172         0, 1,
00173         -2, 0,
00174 -1, 1,
00175         0, -1,
00176         -2, 0,
00177         };
00178 # define YYNPROD 55
00179 # define YYLAST 332
00180 static YYCONST yytabelem yyact[]={
00181 
00182     69,    41,    42,    43,    44,    45,    46,    47,    48,    49,
00183     50,    51,    52,    53,    35,    36,    39,    40,    37,    38,
00184     35,    36,    39,    40,    37,    38,    39,    40,    37,    38,
00185     38,    23,    22,    22,    59,    58,    57,    68,    29,    30,
00186     82,    73,    72,    71,    70,     4,    33,    56,    13,    55,
00187      2,    65,    28,    25,    90,    24,    26,    27,     1,    54,
00188      8,     7,     4,    31,    32,    34,    62,     0,    61,    64,
00189      0,    69,     0,    66,    67,    60,     0,     0,     0,     0,
00190      0,     0,     0,    74,    75,    76,    77,    78,    79,    80,
00191      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00192      0,     0,     0,     0,    81,     0,     0,     0,     0,     0,
00193     81,    83,     0,     0,    84,     0,     0,     0,     0,     0,
00194      0,    85,    86,    87,    88,     0,     0,     0,     0,     0,
00195     89,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00196      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00197      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00198      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00199      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00200      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00201      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00202      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00203      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00204      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00205      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00206      0,     0,    41,    42,    43,    44,    45,    46,    47,    48,
00207     49,    50,    51,    52,    53,    35,    36,    39,    40,    37,
00208     38,     3,    14,     9,    10,    11,     0,    21,    15,    12,
00209      6,    23,    22,     0,     0,     0,    16,    17,    18,    14,
00210      9,    10,    11,    63,    21,    15,    12,     6,    21,     0,
00211      0,     0,     0,    16,    17,    18,     0,    16,    17,    18,
00212      0,    20,    19,     0,     0,     0,     0,     0,     5,    35,
00213     36,    39,    40,    37,    38,     0,     0,     0,    20,    19,
00214      0,     0,    20,    19,     0,     5,    35,    36,    39,    40,
00215     37,    38 };
00216 static YYCONST yytabelem yypact[]={
00217 
00218      5,-10000000,  -244,-10000000,    22,    22,    22,-10000000,-10000000,  -233,
00219   -233,  -233,  -211,  -282,  -237,  -237,-10000000,-10000000,-10000000,    26,
00220     26,    11,    22,    22,    -4,   -41,-10000000,  -244,  -222,-10000000,
00221 -10000000,  -223,  -224,  -226,    26,    26,    26,    26,    26,    26,
00222     26,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,
00223 -10000000,-10000000,-10000000,-10000000,  -237,-10000000,  -228,-10000000,-10000000,-10000000,
00224   -237,-10000000,    26,-10000000,-10000000,    26,-10000000,  -243,-10000000,-10000000,
00225     22,    22,    22,    22,  -276,  -272,  -272,  -271,-10000000,  -271,
00226   -271,-10000000,  -237,    30,    13,  -244,  -244,  -244,  -244,-10000000,
00227 -10000000 };
00228 static YYCONST yytabelem yypgo[]={
00229 
00230      0,    65,    50,    48,    61,    59,    47,    49,    60,    52,
00231     58 };
00232 static YYCONST yytabelem yyr1[]={
00233 
00234      0,    10,    10,    10,     2,     2,     2,     2,     2,     2,
00235      2,     2,     2,     2,     2,     2,     2,     4,     8,     6,
00236      6,     6,     7,     7,     5,     5,     9,     9,     3,     3,
00237      3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
00238      3,     3,     1,     1,     1,     1,     1,     1,     1,     1,
00239      1,     1,     1,     1,     1 };
00240 static YYCONST yytabelem yyr2[]={
00241 
00242      0,     1,     3,     3,     7,     5,     3,     5,     7,     7,
00243      3,     3,     9,     9,     9,     9,     7,     5,     5,     3,
00244      3,     3,     3,     7,     3,     5,     3,     3,     3,     3,
00245      3,     7,     7,     7,     5,     5,     7,     7,     7,     7,
00246      3,     9,     3,     3,     3,     3,     3,     3,     3,     3,
00247      3,     3,     3,     3,     3 };
00248 static YYCONST yytabelem yychk[]={
00249 
00250 -10000000,   -10,    -2,   256,    40,   303,   265,    -4,    -8,   258,
00251    259,   260,   264,    -3,   257,   263,   271,   272,   273,   297,
00252    296,   262,   276,   275,    -2,    -3,    -2,    -2,    -9,   271,
00253    272,    -9,    -9,   257,    -1,   296,   297,   300,   301,   298,
00254    299,   283,   284,   285,   286,   287,   288,   289,   290,   291,
00255    292,   293,   294,   295,    -5,    -7,    -6,   273,   272,   271,
00256     -5,    -3,    40,   257,    -3,    40,    -2,    -2,    41,    41,
00257    266,   266,   266,   267,    -3,    -3,    -3,    -3,    -3,    -3,
00258     -3,    -7,   268,    -3,    -3,    -2,    -2,    -2,    -2,    -6,
00259     41 };
00260 static YYCONST yytabelem yydef[]={
00261 
00262     -2,    -2,     2,     3,     0,     0,     6,    10,    11,     0,
00263      0,     0,     0,     0,    40,     0,    28,    29,    30,     0,
00264      0,     0,     0,     0,     0,     0,     5,     7,     0,    26,
00265     27,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00266      0,    42,    43,    44,    45,    46,    47,    48,    49,    50,
00267     51,    52,    53,    54,    17,    24,    22,    19,    20,    21,
00268     18,    34,     0,    40,    35,     0,     8,     9,     4,    31,
00269      0,     0,     0,     0,    16,    32,    33,    36,    37,    38,
00270     39,    25,     0,     0,     0,    12,    13,    14,    15,    23,
00271     41 };
00272 typedef struct
00273 #ifdef __cplusplus
00274         yytoktype
00275 #endif
00276 {
00277 #ifdef __cplusplus
00278 const
00279 #endif
00280 char *t_name; int t_val; } yytoktype;
00281 #ifndef YYDEBUG
00282 #       define YYDEBUG  0       /* don't allow debugging */
00283 #endif
00284 
00285 #if YYDEBUG
00286 
00287 yytoktype yytoks[] =
00288 {
00289         "KEY",  257,
00290         "WITHIN",       258,
00291         "EXWITHIN",     259,
00292         "PBWITHIN",     260,
00293         "WHERE",        261,
00294         "FUNC", 262,
00295         "STRFCTN",      263,
00296         "SAME", 264,
00297         "SINGLE",       265,
00298         "OF",   266,
00299         "AS",   267,
00300         "THROUGH",      268,
00301         "ERROR",        269,
00302         "RANGE",        270,
00303         "FLOAT",        271,
00304         "INT",  272,
00305         "WORD", 273,
00306         "COMPARE",      274,
00307         "OR",   275,
00308         "AND",  276,
00309         "LT",   277,
00310         "LE",   278,
00311         "EQ",   279,
00312         "GE",   280,
00313         "GT",   281,
00314         "NE",   282,
00315         "NLT",  283,
00316         "NLE",  284,
00317         "NEQ",  285,
00318         "NGE",  286,
00319         "NGT",  287,
00320         "NNE",  288,
00321         "SLT",  289,
00322         "SLE",  290,
00323         "SEQ",  291,
00324         "SGE",  292,
00325         "SGT",  293,
00326         "SNE",  294,
00327         "MATCH",        295,
00328         "ADD",  296,
00329         "SUB",  297,
00330         "MULT", 298,
00331         "DIV",  299,
00332         "MOD",  300,
00333         "EXP",  301,
00334         "nonassoc",     302,
00335         "NOT",  303,
00336         "UMINUS",       304,
00337         "-unknown-",    -1      /* ends search */
00338 };
00339 
00340 #ifdef __cplusplus
00341 const
00342 #endif
00343 char * yyreds[] =
00344 {
00345         "-no such reduction-",
00346         "selection_list : /* empty */",
00347         "selection_list : selection",
00348         "selection_list : error",
00349         "selection : '(' selection ')'",
00350         "selection : NOT selection",
00351         "selection : SINGLE",
00352         "selection : SINGLE selection",
00353         "selection : selection AND selection",
00354         "selection : selection OR selection",
00355         "selection : keyword_list",
00356         "selection : strfctn_list",
00357         "selection : WITHIN number OF selection",
00358         "selection : EXWITHIN number OF selection",
00359         "selection : PBWITHIN number OF selection",
00360         "selection : SAME KEY AS selection",
00361         "selection : expression compare expression",
00362         "keyword_list : KEY string_list",
00363         "strfctn_list : STRFCTN string_list",
00364         "word : WORD",
00365         "word : INT",
00366         "word : FLOAT",
00367         "string_list_ele : word",
00368         "string_list_ele : word THROUGH word",
00369         "string_list : string_list_ele",
00370         "string_list : string_list string_list_ele",
00371         "number : FLOAT",
00372         "number : INT",
00373         "expression : FLOAT",
00374         "expression : INT",
00375         "expression : WORD",
00376         "expression : '(' expression ')'",
00377         "expression : expression ADD expression",
00378         "expression : expression SUB expression",
00379         "expression : SUB expression",
00380         "expression : ADD expression",
00381         "expression : expression MOD expression",
00382         "expression : expression EXP expression",
00383         "expression : expression MULT expression",
00384         "expression : expression DIV expression",
00385         "expression : KEY",
00386         "expression : FUNC '(' expression ')'",
00387         "compare : NLT",
00388         "compare : NLE",
00389         "compare : NEQ",
00390         "compare : NGE",
00391         "compare : NGT",
00392         "compare : NNE",
00393         "compare : SLT",
00394         "compare : SLE",
00395         "compare : SEQ",
00396         "compare : SGE",
00397         "compare : SGT",
00398         "compare : SNE",
00399         "compare : MATCH",
00400 };
00401 #endif /* YYDEBUG */
00402 # line  1 "/usr/ccs/bin/yaccpar"
00403 /*
00404  * Copyright (c) 1993 by Sun Microsystems, Inc.
00405  */
00406 
00407 #pragma ident   "@(#)yaccpar    6.16    99/01/20 SMI"
00408 
00409 /*
00410 ** Skeleton parser driver for yacc output
00411 */
00412 
00413 /*
00414 ** yacc user known macros and defines
00415 */
00416 #define YYERROR         goto yyerrlab
00417 #define YYACCEPT        return(0)
00418 #define YYABORT         return(1)
00419 #define YYBACKUP( newtoken, newvalue )\
00420 {\
00421         if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
00422         {\
00423                 yyerror( "syntax error - cannot backup" );\
00424                 goto yyerrlab;\
00425         }\
00426         yychar = newtoken;\
00427         yystate = *yyps;\
00428         yylval = newvalue;\
00429         goto yynewstate;\
00430 }
00431 #define YYRECOVERING()  (!!yyerrflag)
00432 #define YYNEW(type)     malloc(sizeof(type) * yynewmax)
00433 #define YYCOPY(to, from, type) \
00434         (type *) memcpy(to, (char *) from, yymaxdepth * sizeof (type))
00435 #define YYENLARGE( from, type) \
00436         (type *) realloc((char *) from, yynewmax * sizeof(type))
00437 #ifndef YYDEBUG
00438 #       define YYDEBUG  1       /* make debugging available */
00439 #endif
00440 
00441 /*
00442 ** user known globals
00443 */
00444 int yydebug;                    /* set to 1 to get debugging */
00445 
00446 /*
00447 ** driver internal defines
00448 */
00449 #define YYFLAG          (-10000000)
00450 
00451 /*
00452 ** global variables used by the parser
00453 */
00454 YYSTYPE *yypv;                  /* top of value stack */
00455 int *yyps;                      /* top of state stack */
00456 
00457 int yystate;                    /* current state */
00458 int yytmp;                      /* extra var (lasts between blocks) */
00459 
00460 int yynerrs;                    /* number of errors */
00461 int yyerrflag;                  /* error recovery flag */
00462 int yychar;                     /* current input token number */
00463 
00464 
00465 
00466 #ifdef YYNMBCHARS
00467 #define YYLEX()         yycvtok(yylex())
00468 /*
00469 ** yycvtok - return a token if i is a wchar_t value that exceeds 255.
00470 **      If i<255, i itself is the token.  If i>255 but the neither 
00471 **      of the 30th or 31st bit is on, i is already a token.
00472 */
00473 #if defined(__STDC__) || defined(__cplusplus)
00474 int yycvtok(int i)
00475 #else
00476 int yycvtok(i) int i;
00477 #endif
00478 {
00479         int first = 0;
00480         int last = YYNMBCHARS - 1;
00481         int mid;
00482         wchar_t j;
00483 
00484         if(i&0x60000000){/*Must convert to a token. */
00485                 if( yymbchars[last].character < i ){
00486                         return i;/*Giving up*/
00487                 }
00488                 while ((last>=first)&&(first>=0)) {/*Binary search loop*/
00489                         mid = (first+last)/2;
00490                         j = yymbchars[mid].character;
00491                         if( j==i ){/*Found*/ 
00492                                 return yymbchars[mid].tvalue;
00493                         }else if( j<i ){
00494                                 first = mid + 1;
00495                         }else{
00496                                 last = mid -1;
00497                         }
00498                 }
00499                 /*No entry in the table.*/
00500                 return i;/* Giving up.*/
00501         }else{/* i is already a token. */
00502                 return i;
00503         }
00504 }
00505 #else
00506 #define YYLEX()         yylex()
00507 #endif
00509 /*
00510 ** yyparse - return 0 if worked, 1 if syntax error not recovered from
00511 */
00512 #if defined(__STDC__) || defined(__cplusplus)
00513 int yyparse(void)
00514 #else
00515 int yyparse()
00516 #endif
00517 {
00518         register YYSTYPE *yypvt = 0;    /* top of value stack for $vars */
00519 
00520 #if defined(__cplusplus) || defined(lint)
00521 /*
00522         hacks to please C++ and lint - goto's inside
00523         switch should never be executed
00524 */
00525         static int __yaccpar_lint_hack__ = 0;
00526         switch (__yaccpar_lint_hack__)
00527         {
00528                 case 1: goto yyerrlab;
00529                 case 2: goto yynewstate;
00530         }
00531 #endif
00532 
00533         /*
00534         ** Initialize externals - yyparse may be called more than once
00535         */
00536         yypv = &yyv[-1];
00537         yyps = &yys[-1];
00538         yystate = 0;
00539         yytmp = 0;
00540         yynerrs = 0;
00541         yyerrflag = 0;
00542         yychar = -1;
00543 
00544 #if YYMAXDEPTH <= 0
00545         if (yymaxdepth <= 0)
00546         {
00547                 if ((yymaxdepth = YYEXPAND(0)) <= 0)
00548                 {
00549                         yyerror("yacc initialization error");
00550                         YYABORT;
00551                 }
00552         }
00553 #endif
00554 
00555         {
00556                 register YYSTYPE *yy_pv;        /* top of value stack */
00557                 register int *yy_ps;            /* top of state stack */
00558                 register int yy_state;          /* current state */
00559                 register int  yy_n;             /* internal state number info */
00560         goto yystack;   /* moved from 6 lines above to here to please C++ */
00561 
00562                 /*
00563                 ** get globals into registers.
00564                 ** branch to here only if YYBACKUP was called.
00565                 */
00566         yynewstate:
00567                 yy_pv = yypv;
00568                 yy_ps = yyps;
00569                 yy_state = yystate;
00570                 goto yy_newstate;
00571 
00572                 /*
00573                 ** get globals into registers.
00574                 ** either we just started, or we just finished a reduction
00575                 */
00576         yystack:
00577                 yy_pv = yypv;
00578                 yy_ps = yyps;
00579                 yy_state = yystate;
00580 
00581                 /*
00582                 ** top of for (;;) loop while no reductions done
00583                 */
00584         yy_stack:
00585                 /*
00586                 ** put a state and value onto the stacks
00587                 */
00588 #if YYDEBUG
00589                 /*
00590                 ** if debugging, look up token value in list of value vs.
00591                 ** name pairs.  0 and negative (-1) are special values.
00592                 ** Note: linear search is used since time is not a real
00593                 ** consideration while debugging.
00594                 */
00595                 if ( yydebug )
00596                 {
00597                         register int yy_i;
00598 
00599                         printf( "State %d, token ", yy_state );
00600                         if ( yychar == 0 )
00601                                 printf( "end-of-file\n" );
00602                         else if ( yychar < 0 )
00603                                 printf( "-none-\n" );
00604                         else
00605                         {
00606                                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
00607                                         yy_i++ )
00608                                 {
00609                                         if ( yytoks[yy_i].t_val == yychar )
00610                                                 break;
00611                                 }
00612                                 printf( "%s\n", yytoks[yy_i].t_name );
00613                         }
00614                 }
00615 #endif /* YYDEBUG */
00616                 if ( ++yy_ps >= &yys[ yymaxdepth ] )    /* room on stack? */
00617                 {
00618                         /*
00619                         ** reallocate and recover.  Note that pointers
00620                         ** have to be reset, or bad things will happen
00621                         */
00622                         long yyps_index = (yy_ps - yys);
00623                         long yypv_index = (yy_pv - yyv);
00624                         long yypvt_index = (yypvt - yyv);
00625                         int yynewmax;
00626 #ifdef YYEXPAND
00627                         yynewmax = YYEXPAND(yymaxdepth);
00628 #else
00629                         yynewmax = 2 * yymaxdepth;      /* double table size */
00630                         if (yymaxdepth == YYMAXDEPTH)   /* first time growth */
00631                         {
00632                                 char *newyys = (char *)YYNEW(int);
00633                                 char *newyyv = (char *)YYNEW(YYSTYPE);
00634                                 if (newyys != 0 && newyyv != 0)
00635                                 {
00636                                         yys = YYCOPY(newyys, yys, int);
00637                                         yyv = YYCOPY(newyyv, yyv, YYSTYPE);
00638                                 }
00639                                 else
00640                                         yynewmax = 0;   /* failed */
00641                         }
00642                         else                            /* not first time */
00643                         {
00644                                 yys = YYENLARGE(yys, int);
00645                                 yyv = YYENLARGE(yyv, YYSTYPE);
00646                                 if (yys == 0 || yyv == 0)
00647                                         yynewmax = 0;   /* failed */
00648                         }
00649 #endif
00650                         if (yynewmax <= yymaxdepth)     /* tables not expanded */
00651                         {
00652                                 yyerror( "yacc stack overflow" );
00653                                 YYABORT;
00654                         }
00655                         yymaxdepth = yynewmax;
00656 
00657                         yy_ps = yys + yyps_index;
00658                         yy_pv = yyv + yypv_index;
00659                         yypvt = yyv + yypvt_index;
00660                 }
00661                 *yy_ps = yy_state;
00662                 *++yy_pv = yyval;
00663 
00664                 /*
00665                 ** we have a new state - find out what to do
00666                 */
00667         yy_newstate:
00668                 if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
00669                         goto yydefault;         /* simple state */
00670 #if YYDEBUG
00671                 /*
00672                 ** if debugging, need to mark whether new token grabbed
00673                 */
00674                 yytmp = yychar < 0;
00675 #endif
00676                 if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) )
00677                         yychar = 0;             /* reached EOF */
00678 #if YYDEBUG
00679                 if ( yydebug && yytmp )
00680                 {
00681                         register int yy_i;
00682 
00683                         printf( "Received token " );
00684                         if ( yychar == 0 )
00685                                 printf( "end-of-file\n" );
00686                         else if ( yychar < 0 )
00687                                 printf( "-none-\n" );
00688                         else
00689                         {
00690                                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
00691                                         yy_i++ )
00692                                 {
00693                                         if ( yytoks[yy_i].t_val == yychar )
00694                                                 break;
00695                                 }
00696                                 printf( "%s\n", yytoks[yy_i].t_name );
00697                         }
00698                 }
00699 #endif /* YYDEBUG */
00700                 if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
00701                         goto yydefault;
00702                 if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )  /*valid shift*/
00703                 {
00704                         yychar = -1;
00705                         yyval = yylval;
00706                         yy_state = yy_n;
00707                         if ( yyerrflag > 0 )
00708                                 yyerrflag--;
00709                         goto yy_stack;
00710                 }
00711 
00712         yydefault:
00713                 if ( ( yy_n = yydef[ yy_state ] ) == -2 )
00714                 {
00715 #if YYDEBUG
00716                         yytmp = yychar < 0;
00717 #endif
00718                         if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) )
00719                                 yychar = 0;             /* reached EOF */
00720 #if YYDEBUG
00721                         if ( yydebug && yytmp )
00722                         {
00723                                 register int yy_i;
00724 
00725                                 printf( "Received token " );
00726                                 if ( yychar == 0 )
00727                                         printf( "end-of-file\n" );
00728                                 else if ( yychar < 0 )
00729                                         printf( "-none-\n" );
00730                                 else
00731                                 {
00732                                         for ( yy_i = 0;
00733                                                 yytoks[yy_i].t_val >= 0;
00734                                                 yy_i++ )
00735                                         {
00736                                                 if ( yytoks[yy_i].t_val
00737                                                         == yychar )
00738                                                 {
00739                                                         break;
00740                                                 }
00741                                         }
00742                                         printf( "%s\n", yytoks[yy_i].t_name );
00743                                 }
00744                         }
00745 #endif /* YYDEBUG */
00746                         /*
00747                         ** look through exception table
00748                         */
00749                         {
00750                                 register YYCONST int *yyxi = yyexca;
00751 
00752                                 while ( ( *yyxi != -1 ) ||
00753                                         ( yyxi[1] != yy_state ) )
00754                                 {
00755                                         yyxi += 2;
00756                                 }
00757                                 while ( ( *(yyxi += 2) >= 0 ) &&
00758                                         ( *yyxi != yychar ) )
00759                                         ;
00760                                 if ( ( yy_n = yyxi[1] ) < 0 )
00761                                         YYACCEPT;
00762                         }
00763                 }
00764 
00765                 /*
00766                 ** check for syntax error
00767                 */
00768                 if ( yy_n == 0 )        /* have an error */
00769                 {
00770                         /* no worry about speed here! */
00771                         switch ( yyerrflag )
00772                         {
00773                         case 0:         /* new error */
00774                                 yyerror( "syntax error" );
00775                                 goto skip_init;
00776                         yyerrlab:
00777                                 /*
00778                                 ** get globals into registers.
00779                                 ** we have a user generated syntax type error
00780                                 */
00781                                 yy_pv = yypv;
00782                                 yy_ps = yyps;
00783                                 yy_state = yystate;
00784                         skip_init:
00785                                 yynerrs++;
00786                                 /* FALLTHRU */
00787                         case 1:
00788                         case 2:         /* incompletely recovered error */
00789                                         /* try again... */
00790                                 yyerrflag = 3;
00791                                 /*
00792                                 ** find state where "error" is a legal
00793                                 ** shift action
00794                                 */
00795                                 while ( yy_ps >= yys )
00796                                 {
00797                                         yy_n = yypact[ *yy_ps ] + YYERRCODE;
00798                                         if ( yy_n >= 0 && yy_n < YYLAST &&
00799                                                 yychk[yyact[yy_n]] == YYERRCODE)                                        {
00800                                                 /*
00801                                                 ** simulate shift of "error"
00802                                                 */
00803                                                 yy_state = yyact[ yy_n ];
00804                                                 goto yy_stack;
00805                                         }
00806                                         /*
00807                                         ** current state has no shift on
00808                                         ** "error", pop stack
00809                                         */
00810 #if YYDEBUG
00811 #       define _POP_ "Error recovery pops state %d, uncovers state %d\n"
00812                                         if ( yydebug )
00813                                                 printf( _POP_, *yy_ps,
00814                                                         yy_ps[-1] );
00815 #       undef _POP_
00816 #endif
00817                                         yy_ps--;
00818                                         yy_pv--;
00819                                 }
00820                                 /*
00821                                 ** there is no state on stack with "error" as
00822                                 ** a valid shift.  give up.
00823                                 */
00824                                 YYABORT;
00825                         case 3:         /* no shift yet; eat a token */
00826 #if YYDEBUG
00827                                 /*
00828                                 ** if debugging, look up token in list of
00829                                 ** pairs.  0 and negative shouldn't occur,
00830                                 ** but since timing doesn't matter when
00831                                 ** debugging, it doesn't hurt to leave the
00832                                 ** tests here.
00833                                 */
00834                                 if ( yydebug )
00835                                 {
00836                                         register int yy_i;
00837 
00838                                         printf( "Error recovery discards " );
00839                                         if ( yychar == 0 )
00840                                                 printf( "token end-of-file\n" );
00841                                         else if ( yychar < 0 )
00842                                                 printf( "token -none-\n" );
00843                                         else
00844                                         {
00845                                                 for ( yy_i = 0;
00846                                                         yytoks[yy_i].t_val >= 0;
00847                                                         yy_i++ )
00848                                                 {
00849                                                         if ( yytoks[yy_i].t_val
00850                                                                 == yychar )
00851                                                         {
00852                                                                 break;
00853                                                         }
00854                                                 }
00855                                                 printf( "token %s\n",
00856                                                         yytoks[yy_i].t_name );
00857                                         }
00858                                 }
00859 #endif /* YYDEBUG */
00860                                 if ( yychar == 0 )      /* reached EOF. quit */
00861                                         YYABORT;
00862                                 yychar = -1;
00863                                 goto yy_newstate;
00864                         }
00865                 }/* end if ( yy_n == 0 ) */
00866                 /*
00867                 ** reduction by production yy_n
00868                 ** put stack tops, etc. so things right after switch
00869                 */
00870 #if YYDEBUG
00871                 /*
00872                 ** if debugging, print the string that is the user's
00873                 ** specification of the reduction which is just about
00874                 ** to be done.
00875                 */
00876                 if ( yydebug )
00877                         printf( "Reduce by (%d) \"%s\"\n",
00878                                 yy_n, yyreds[ yy_n ] );
00879 #endif
00880                 yytmp = yy_n;                   /* value to switch over */
00881                 yypvt = yy_pv;                  /* $vars top of value stack */
00882                 /*
00883                 ** Look in goto table for next state
00884                 ** Sorry about using yy_state here as temporary
00885                 ** register variable, but why not, if it works...
00886                 ** If yyr2[ yy_n ] doesn't have the low order bit
00887                 ** set, then there is no action to be done for
00888                 ** this reduction.  So, no saving & unsaving of
00889                 ** registers done.  The only difference between the
00890                 ** code just after the if and the body of the if is
00891                 ** the goto yy_stack in the body.  This way the test
00892                 ** can be made before the choice of what to do is needed.
00893                 */
00894                 {
00895                         /* length of production doubled with extra bit */
00896                         register int yy_len = yyr2[ yy_n ];
00897 
00898                         if ( !( yy_len & 01 ) )
00899                         {
00900                                 yy_len >>= 1;
00901                                 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
00902                                 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
00903                                         *( yy_ps -= yy_len ) + 1;
00904                                 if ( yy_state >= YYLAST ||
00905                                         yychk[ yy_state =
00906                                         yyact[ yy_state ] ] != -yy_n )
00907                                 {
00908                                         yy_state = yyact[ yypgo[ yy_n ] ];
00909                                 }
00910                                 goto yy_stack;
00911                         }
00912                         yy_len >>= 1;
00913                         yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
00914                         yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
00915                                 *( yy_ps -= yy_len ) + 1;
00916                         if ( yy_state >= YYLAST ||
00917                                 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
00918                         {
00919                                 yy_state = yyact[ yypgo[ yy_n ] ];
00920                         }
00921                 }
00922                                         /* save until reenter driver code */
00923                 yystate = yy_state;
00924                 yyps = yy_ps;
00925                 yypv = yy_pv;
00926         }
00927         /*
00928         ** code supplied by user is placed in this switch
00929         */
00930         switch( yytmp )
00931         {
00932                 
00933 case 1:
00934 # line 76 "AtomParser.y"
00935 {// printf("Blank line.\n");
00936                                           atomparser_result =  NULL;
00937                                         } break;
00938 case 2:
00939 # line 79 "AtomParser.y"
00940 { //printf("Parsed a line\n");
00941                                           if (*atomparser_yystring != 0) {
00942     msgErr << "Selection terminated too early" << sendmsg;
00943     if (yypvt[-0].node) delete yypvt[-0].node;
00944     yypvt[-0].node = NULL;
00945                                           }
00946                                           atomparser_result = yypvt[-0].node;
00947                                         } break;
00948 case 3:
00949 # line 87 "AtomParser.y"
00950 { //printf("Error occured\n");
00951                                           atomparser_result = NULL;
00952 //                                        yyerrok;
00953                                         } break;
00954 case 4:
00955 # line 93 "AtomParser.y"
00956 { // printf("Parens\n");
00957                                           yyval.node = yypvt[-1].node;
00958                                         } break;
00959 case 5:
00960 # line 96 "AtomParser.y"
00961 { yyval.node = new atomparser_node(NOT);
00962                                           yyval.node->left = yypvt[-0].node;
00963                                         } break;
00964 case 6:
00965 # line 99 "AtomParser.y"
00966 { yyval.node = yypvt[-0].node; } break;
00967 case 7:
00968 # line 100 "AtomParser.y"
00969 { yyval.node = new atomparser_node(AND);
00970                                           yyval.node->left = yypvt[-1].node;
00971                                           yyval.node->right = yypvt[-0].node;
00972                                         } break;
00973 case 8:
00974 # line 104 "AtomParser.y"
00975 { //printf("AND\n");
00976                                           yyval.node = new atomparser_node(AND);
00977                                           yyval.node->left = yypvt[-2].node;
00978                                           yyval.node->right = yypvt[-0].node;
00979                                         } break;
00980 case 9:
00981 # line 109 "AtomParser.y"
00982 { //printf("OR\n");
00983                                           yyval.node = new atomparser_node(OR);
00984                                           yyval.node->left = yypvt[-2].node;
00985                                           yyval.node->right = yypvt[-0].node;
00986                                         } break;
00987 case 10:
00988 # line 114 "AtomParser.y"
00989 { yyval.node = yypvt[-0].node; } break;
00990 case 11:
00991 # line 115 "AtomParser.y"
00992 { yyval.node = yypvt[-0].node; } break;
00993 case 12:
00994 # line 116 "AtomParser.y"
00995 { yyval.node = new atomparser_node(WITHIN);
00996                                           yyval.node->left = yypvt[-0].node;
00997                                           yyval.node->dval = yypvt[-2].dval;
00998                                         } break;
00999 case 13:
01000 # line 120 "AtomParser.y"
01001 { yyval.node = new atomparser_node(EXWITHIN);
01002                                           yyval.node->left = yypvt[-0].node;
01003                                           yyval.node->dval = yypvt[-2].dval;
01004                                         } break;
01005 case 14:
01006 # line 124 "AtomParser.y"
01007 { yyval.node = new atomparser_node(PBWITHIN);
01008                                           yyval.node->left = yypvt[-0].node;
01009                                           yyval.node->dval = yypvt[-2].dval;
01010                                         } break;
01011 case 15:
01012 # line 128 "AtomParser.y"
01013 { yyval.node = yypvt[-2].node;
01014                                           yyval.node->node_type = SAME;
01015                                           yyval.node->left = yypvt[-0].node;
01016                                         } break;
01017 case 16:
01018 # line 132 "AtomParser.y"
01019 {yyval.node = new atomparser_node(COMPARE);
01020                                           yyval.node -> ival = yypvt[-1].ival;
01021                                           yyval.node -> left = yypvt[-2].node;
01022                                           yyval.node -> right = yypvt[-0].node;
01023                                         } break;
01024 case 17:
01025 # line 139 "AtomParser.y"
01026 {
01027                                           yypvt[-1].node -> left = yypvt[-0].node;
01028                                           yypvt[-0].node -> right = NULL;
01029                                           yyval.node = yypvt[-1].node;
01030                                         } break;
01031 case 18:
01032 # line 146 "AtomParser.y"
01033 {  yypvt[-1].node -> left = yypvt[-0].node;
01034                                            yypvt[-0].node -> right = NULL;
01035                                            yyval.node = yypvt[-1].node;
01036                                         } break;
01037 case 19:
01038 # line 152 "AtomParser.y"
01039 { 
01040                                           yyval.node = yypvt[-0].node;
01041                                           //printf("Single\n");
01042                                         } break;
01043 case 20:
01044 # line 156 "AtomParser.y"
01045 { yyval.node = new atomparser_node(WORD);
01046                                           //printf("converted int\n");
01047                                           char s[100];
01048                                           sprintf(s, "%ld", (long) yypvt[-0].ival);
01049                                           yyval.node -> sele.s = s;
01050                                           yyval.node -> sele.st = RAW_STRING;
01051                                         } break;
01052 case 21:
01053 # line 163 "AtomParser.y"
01054 { yyval.node = new atomparser_node(WORD);
01055                                           char s[100];
01056                                           sprintf(s, "%f", (double) yypvt[-0].dval);
01057                                           yyval.node -> sele.s = s;
01058                                           yyval.node -> sele.st = RAW_STRING;
01059                                         } break;
01060 case 22:
01061 # line 171 "AtomParser.y"
01062 { 
01063                                           yypvt[-0].node -> right = yypvt[-0].node;
01064                                           yyval.node = yypvt[-0].node; 
01065                                         } break;
01066 case 23:
01067 # line 175 "AtomParser.y"
01068 { yypvt[-2].node -> right = yypvt[-0].node;
01069                                           yypvt[-2].node -> left = yypvt[-0].node;
01070                                           yypvt[-2].node -> extra_type = 1;
01071                                           yyval.node = yypvt[-2].node;
01072                                           //printf("Using through\n");
01073                                         } break;
01074 case 24:
01075 # line 184 "AtomParser.y"
01076 { yyval.node = yypvt[-0].node; } break;
01077 case 25:
01078 # line 185 "AtomParser.y"
01079 { /* copy the new word on the list */
01080                /* like a linked list, with head's right pointed to the end */
01081                /* element and head's left pointed to the second element    */
01082                                           yypvt[-1].node -> right -> left = yypvt[-0].node;
01083                                           yypvt[-1].node -> right = yypvt[-0].node -> right;
01084                                           yypvt[-0].node -> right = NULL;
01085                                           // printf("Returning\n");
01086                                           yyval.node = yypvt[-1].node;
01087                                        } break;
01088 case 26:
01089 # line 196 "AtomParser.y"
01090 { yyval.dval = yypvt[-0].dval;// printf("## %lf\n", yyval.dval);
01091                                         } break;
01092 case 27:
01093 # line 198 "AtomParser.y"
01094 { yyval.dval = (double) yypvt[-0].ival; 
01095                                           // printf("# %lf\n", yyval.dval);
01096                                         } break;
01097 case 28:
01098 # line 203 "AtomParser.y"
01099 { yyval.node = new atomparser_node(FLOAT);
01100                                           yyval.node->dval = yypvt[-0].dval; 
01101                                         } break;
01102 case 29:
01103 # line 206 "AtomParser.y"
01104 { yyval.node = new atomparser_node(INT);
01105                                           yyval.node->ival = yypvt[-0].ival; 
01106                                         } break;
01107 case 30:
01108 # line 209 "AtomParser.y"
01109 { yyval.node = yypvt[-0].node; 
01110                                         } break;
01111 case 31:
01112 # line 211 "AtomParser.y"
01113 { yyval.node = yypvt[-1].node; } break;
01114 case 32:
01115 # line 212 "AtomParser.y"
01116 { yyval.node = new atomparser_node(ADD);
01117                                           yyval.node->left = yypvt[-2].node;
01118                                           yyval.node->right = yypvt[-0].node;
01119                                         } break;
01120 case 33:
01121 # line 216 "AtomParser.y"
01122 { yyval.node = new atomparser_node(SUB);
01123                                           yyval.node->left = yypvt[-2].node;
01124                                           yyval.node->right = yypvt[-0].node;
01125                                         } break;
01126 case 34:
01127 # line 220 "AtomParser.y"
01128 { yyval.node = new atomparser_node(UMINUS);
01129                                           yyval.node->left = yypvt[-0].node;
01130                                         } break;
01131 case 35:
01132 # line 223 "AtomParser.y"
01133 { yyval.node = yypvt[-0].node;
01134                                         } break;
01135 case 36:
01136 # line 225 "AtomParser.y"
01137 { yyval.node = new atomparser_node(MOD);
01138                                           yyval.node->left = yypvt[-2].node;
01139                                           yyval.node->right = yypvt[-0].node;
01140                                         } break;
01141 case 37:
01142 # line 229 "AtomParser.y"
01143 { yyval.node = new atomparser_node(EXP);
01144                                           yyval.node->left = yypvt[-2].node;
01145                                           yyval.node->right = yypvt[-0].node;
01146                                         } break;
01147 case 38:
01148 # line 233 "AtomParser.y"
01149 { yyval.node = new atomparser_node(MULT);
01150                                           yyval.node->left = yypvt[-2].node;
01151                                           yyval.node->right = yypvt[-0].node;
01152                                         } break;
01153 case 39:
01154 # line 237 "AtomParser.y"
01155 { yyval.node = new atomparser_node(DIV);
01156                                           yyval.node->left = yypvt[-2].node;
01157                                           yyval.node->right = yypvt[-0].node;
01158                                         } break;
01159 case 40:
01160 # line 241 "AtomParser.y"
01161 { yyval.node = yypvt[-0].node; } break;
01162 case 41:
01163 # line 242 "AtomParser.y"
01164 { yypvt[-3].node->left = yypvt[-1].node;
01165                                           yyval.node = yypvt[-3].node;
01166                                         } break;
01167 case 42:
01168 # line 247 "AtomParser.y"
01169 { yyval.ival = NLT; } break;
01170 case 43:
01171 # line 248 "AtomParser.y"
01172 { yyval.ival = NLE; } break;
01173 case 44:
01174 # line 249 "AtomParser.y"
01175 { yyval.ival = NEQ; } break;
01176 case 45:
01177 # line 250 "AtomParser.y"
01178 { yyval.ival = NGE; } break;
01179 case 46:
01180 # line 251 "AtomParser.y"
01181 { yyval.ival = NGT; } break;
01182 case 47:
01183 # line 252 "AtomParser.y"
01184 { yyval.ival = NNE; } break;
01185 case 48:
01186 # line 253 "AtomParser.y"
01187 { yyval.ival = SLT; } break;
01188 case 49:
01189 # line 254 "AtomParser.y"
01190 { yyval.ival = SLE; } break;
01191 case 50:
01192 # line 255 "AtomParser.y"
01193 { yyval.ival = SEQ; } break;
01194 case 51:
01195 # line 256 "AtomParser.y"
01196 { yyval.ival = SGE; } break;
01197 case 52:
01198 # line 257 "AtomParser.y"
01199 { yyval.ival = SGT; } break;
01200 case 53:
01201 # line 258 "AtomParser.y"
01202 { yyval.ival = SNE; } break;
01203 case 54:
01204 # line 259 "AtomParser.y"
01205 { yyval.ival = MATCH; } break;
01206 # line  531 "/usr/ccs/bin/yaccpar"
01207         }
01208         goto yystack;           /* reset registers in driver code */
01209 }
01210 

Generated on Sun Jul 6 01:27:17 2008 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002