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

Generated on Thu Apr 18 02:43:56 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002