1#ifndef INC_BaseAST_hpp__
2#define INC_BaseAST_hpp__
11#include <antlr/config.hpp>
12#include <antlr/AST.hpp>
16#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
20class ANTLR_API BaseAST;
21typedef ASTRefCount<BaseAST> RefBaseAST;
37 virtual const char*
typeName(
void )
const = 0;
43 virtual bool equals(
RefAST t)
const;
48 virtual bool equalsList(
RefAST t)
const;
52 virtual bool equalsListPartial(
RefAST t)
const;
57 virtual bool equalsTree(
RefAST t)
const;
62 virtual bool equalsTreePartial(
RefAST t)
const;
68 virtual ANTLR_USE_NAMESPACE(std)vector<RefAST> findAll(
RefAST t);
74 virtual ANTLR_USE_NAMESPACE(std)vector<RefAST> findAllPartial(
RefAST t);
97 virtual size_t getNumberOfChildren()
const;
111 virtual ANTLR_USE_NAMESPACE(std)
string getText()
const
124 down =
static_cast<BaseAST*
>(
static_cast<AST*
>(nullAST));
130 down =
static_cast<BaseAST*
>(
static_cast<AST*
>(c));
136 right =
static_cast<BaseAST*
>(
static_cast<AST*
>(n));
140 virtual void setText(
const ANTLR_USE_NAMESPACE(std)
string&)
149#ifdef ANTLR_SUPPORT_XML
154 virtual bool attributesToStream( ANTLR_USE_NAMESPACE(std)ostream& out )
const;
159 virtual void toStream( ANTLR_USE_NAMESPACE(std)ostream &out )
const;
163 virtual ANTLR_USE_NAMESPACE(std)
string toString()
const
169 virtual ANTLR_USE_NAMESPACE(std)
string toStringList()
const;
170 virtual ANTLR_USE_NAMESPACE(std)
string toStringTree()
const;
175 void doWorkForFindAll(ANTLR_USE_NAMESPACE(std)vector<RefAST>& v,
189#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
virtual int getType() const =0
Get the token type for this node.
virtual std::string getText() const =0
Get the token text for this node.
virtual std::string getText() const
Get the token text for this node.
virtual void setFirstChild(RefAST c)
Set the first child of a node.
virtual RefAST clone(void) const =0
Clone this AST node.
virtual void addChild(RefAST c)
Add a node to the end of the child list for this node.
virtual void setNextSibling(RefAST n)
Set the next sibling after this one.
virtual std::string toString() const
Return string representation for the AST.
virtual void removeChildren()
Remove all children.
virtual RefAST getFirstChild() const
Get the first child of this node; null if no children.
virtual int getType() const
Get the token type for this node.
virtual bool equals(RefAST t) const
Is node t equal to this in terms of token type and text?
virtual RefAST getNextSibling() const
Get the next sibling in line after this one.
virtual const char * typeName(void) const =0
Return the class name.
virtual void setText(const std ::string &)
Set the token text for this node.
virtual void setType(int)
Set the token type for this node.