KDevelop API Documentation

ASTPair.hpp

Go to the documentation of this file.
00001 #ifndef INC_ASTPair_hpp__
00002 #define INC_ASTPair_hpp__
00003 
00004 /* ANTLR Translator Generator
00005  * Project led by Terence Parr at http://www.jGuru.com
00006  * Software rights: http://www.antlr.org/RIGHTS.html
00007  *
00008  * $Id: ASTPair.hpp,v 1.2 2003/05/02 00:36:19 okellogg Exp $
00009  */
00010 
00011 #include <antlr/config.hpp>
00012 #include <antlr/AST.hpp>
00013 
00014 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00015 namespace antlr {
00016 #endif
00017 
00026 class ANTLR_API ASTPair {
00027 public:
00028     RefAST root;        // current root of tree
00029     RefAST child;       // current child to which siblings are added
00030 
00032     void advanceChildToEnd() {
00033         if (child) {
00034             while (child->getNextSibling()) {
00035                 child = child->getNextSibling();
00036             }
00037         }
00038     }
00039 //  /** Copy an ASTPair.  Don't call it clone() because we want type-safety */
00040 //  ASTPair copy() {
00041 //      ASTPair tmp = new ASTPair();
00042 //      tmp.root = root;
00043 //      tmp.child = child;
00044 //      return tmp;
00045 //  }
00046     ANTLR_USE_NAMESPACE(std)string toString() const {
00047         ANTLR_USE_NAMESPACE(std)string r = !root ? ANTLR_USE_NAMESPACE(std)string("null") : root->getText();
00048         ANTLR_USE_NAMESPACE(std)string c = !child ? ANTLR_USE_NAMESPACE(std)string("null") : child->getText();
00049         return "["+r+","+c+"]";
00050     }
00051 };
00052 
00053 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00054 }
00055 #endif
00056 
00057 #endif //INC_ASTPair_hpp__
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:50 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003