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

ParseTree.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2019 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.46 $       $Date: 2020/07/23 04:56:55 $
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    VMDApp *app;
00063    ParseTree(VMDApp *vmdapp, /*const*/ SymbolTable *, atomparser_node *);
00064    ~ParseTree(void);
00065    void use_context(void *ctxt) { context = ctxt; }
00066    int evaluate(int num_atoms, int *flgs);  // sets an array of flags and returns 1, return 0 if bad
00067    int find_recursion(const char *head);
00068 
00069 private:
00070    void eval_compare(atomparser_node *node, int num, int *flgs);
00071    symbol_data *eval_mathop(atomparser_node *node, int num, int *flgs);
00072    symbol_data *eval_key( atomparser_node *node, int num, int *flgs);
00073    void eval_stringfctn( atomparser_node *node, int num, int *flgs);
00074    void eval_within(atomparser_node *node, int num, int *flgs);
00075    void eval_exwithin(atomparser_node *node, int num, int *flgs);
00076    void eval_pbwithin(atomparser_node *node, int num, int *flgs);
00077    void eval_single(atomparser_node *node, int num, int *flgs);
00078    void eval_same(atomparser_node *node, int num, int *flgs);
00079    void eval_within_bonds(atomparser_node *node, int num, int *flgs);
00080    void eval_k_nearest(atomparser_node *node, int num, int *flgs);
00081    void find_rings(int num, int *flgs, int *others, int minringsize, int maxringsize);
00082    void eval_maxringsize(atomparser_node *node, int num, int *flgs);
00083    void eval_ringsize(atomparser_node *node, int num, int *flgs);
00084    symbol_data *eval(atomparser_node *node, int num, int *flgs);
00085    void eval_find_recursion(atomparser_node *, int *, hash_t *);
00086 };
00087 
00088 #endif
00089 

Generated on Mon May 6 04:26:50 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002