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

ParseTree.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2011 The Board of Trustees of the           
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: ParseTree.h,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.43 $       $Date: 2011/03/12 17:25:54 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *  Basic data types for the yacc/lex interface and for the parse tree
00019  *
00020  ***************************************************************************/
00021 #ifndef PARSETREE_H
00022 #define PARSETREE_H
00023 
00024 #include "SymbolTable.h"
00025 #include "AtomParser.h"
00026 
00029 class symbol_data {
00030  private:
00031    void make_space(void); 
00032    void free_space(void); 
00033 
00037    int free_sval;
00038 
00039  public:
00040    SymbolTableElement::symtype type;
00041    double *dval; 
00042    int *ival;    
00043    char **sval;  
00044    int num;      
00045 
00046    symbol_data(SymbolTableElement::symtype new_type, int new_num);
00047    ~symbol_data(void);
00048    void convert(SymbolTableElement::symtype totype);
00049 };
00050 
00051 
00053 class ParseTree {
00054 private:
00055    SymbolTable *table;
00056    atomparser_node *tree;
00057    int *selected_array;    
00058    int num_selected;
00059    void *context;
00060 
00061 public:
00062    ParseTree(/*const*/ SymbolTable *, atomparser_node *);
00063    ~ParseTree(void);
00064    void use_context(void *ctxt) { context = ctxt; }
00065    int evaluate(int num_atoms, int *flgs);  // sets an array of flags and returns 1, return 0 if bad
00066    int find_recursion(const char *head);
00067 
00068 private:
00069    void eval_compare(atomparser_node *node, int num, int *flgs);
00070    symbol_data *eval_mathop(atomparser_node *node, int num, int *flgs);
00071    symbol_data *eval_key( atomparser_node *node, int num, int *flgs);
00072    void eval_stringfctn( atomparser_node *node, int num, int *flgs);
00073    void eval_within(atomparser_node *node, int num, int *flgs);
00074    void eval_exwithin(atomparser_node *node, int num, int *flgs);
00075    void eval_pbwithin(atomparser_node *node, int num, int *flgs);
00076    void eval_single(atomparser_node *node, int num, int *flgs);
00077    void eval_same(atomparser_node *node, int num, int *flgs);
00078    void eval_within_bonds(atomparser_node *node, int num, int *flgs);
00079    void eval_k_nearest(atomparser_node *node, int num, int *flgs);
00080    void find_rings(int num, int *flgs, int *others, int minringsize, int maxringsize);
00081    void eval_maxringsize(atomparser_node *node, int num, int *flgs);
00082    void eval_ringsize(atomparser_node *node, int num, int *flgs);
00083    symbol_data *eval(atomparser_node *node, int num, int *flgs);
00084    void eval_find_recursion(atomparser_node *, int *, hash_t *);
00085 };
00086 
00087 #endif
00088 

Generated on Sat May 26 01:48:19 2012 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002