souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions | Private Attributes | Friends
souffle::ast::Node Class Referenceabstract

Abstract class for syntactic elements in an input program. More...

#include <Node.h>

Inheritance diagram for souffle::ast::Node:
Inheritance graph
Collaboration diagram for souffle::ast::Node:
Collaboration graph

Public Member Functions

virtual void apply (const NodeMapper &)
 Apply the mapper to all child nodes. More...
 
virtual Nodeclone () const =0
 Create a clone (i.e. More...
 
std::string extloc () const
 Return source location of the syntactic element. More...
 
virtual std::vector< const Node * > getChildNodes () const
 Obtain a list of all embedded AST child nodes. More...
 
const SrcLocationgetSrcLoc () const
 Return source location of the Node. More...
 
 Node (SrcLocation loc={})
 
bool operator!= (const Node &other) const
 Inequality check for two AST nodes. More...
 
bool operator== (const Node &other) const
 Equivalence check for two AST nodes. More...
 
void setSrcLoc (SrcLocation l)
 Set source location for the Node. More...
 
virtual ~Node ()=default
 

Protected Member Functions

virtual bool equal (const Node &) const
 Abstract equality check for two AST nodes. More...
 
virtual void print (std::ostream &os) const =0
 Output to a given output stream. More...
 

Private Attributes

SrcLocation location
 Source location of a syntactic element. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const Node &node)
 Print node onto an output stream. More...
 

Detailed Description

Abstract class for syntactic elements in an input program.

Definition at line 40 of file Node.h.

Constructor & Destructor Documentation

◆ Node()

souffle::ast::Node::Node ( SrcLocation  loc = {})
inline

Definition at line 42 of file Node.h.

45 {

◆ ~Node()

virtual souffle::ast::Node::~Node ( )
virtualdefault

Member Function Documentation

◆ apply()

virtual void souffle::ast::Node::apply ( const NodeMapper )
inlinevirtual

◆ clone()

virtual Node* souffle::ast::Node::clone ( ) const
pure virtual

◆ equal()

virtual bool souffle::ast::Node::equal ( const Node ) const
inlineprotectedvirtual

◆ extloc()

std::string souffle::ast::Node::extloc ( ) const
inline

Return source location of the syntactic element.

Definition at line 56 of file Node.h.

56  {
57  return true;
58  } else if (typeid(*this) == typeid(*&other)) {

◆ getChildNodes()

virtual std::vector<const Node*> souffle::ast::Node::getChildNodes ( ) const
inlinevirtual

Obtain a list of all embedded AST child nodes.

Reimplemented in souffle::ast::Component, souffle::ast::Program, souffle::ast::Relation, souffle::ast::Clause, souffle::ast::Atom, souffle::ast::ExecutionPlan, souffle::ast::Aggregator, souffle::ast::ComponentInit, souffle::ast::Negation, souffle::ast::TypeCast, and souffle::ast::Term.

Definition at line 82 of file Node.h.

86  :
87  /** Output to a given output stream */

◆ getSrcLoc()

const SrcLocation& souffle::ast::Node::getSrcLoc ( ) const
inline

◆ operator!=()

bool souffle::ast::Node::operator!= ( const Node other) const
inline

Inequality check for two AST nodes.

Definition at line 71 of file Node.h.

73  {}

◆ operator==()

bool souffle::ast::Node::operator== ( const Node other) const
inline

Equivalence check for two AST nodes.

Definition at line 61 of file Node.h.

65  {
66  return !(*this == other);
67  }
68 

◆ print()

virtual void souffle::ast::Node::print ( std::ostream &  os) const
protectedpure virtual

◆ setSrcLoc()

void souffle::ast::Node::setSrcLoc ( SrcLocation  l)
inline

Set source location for the Node.

Definition at line 51 of file Node.h.

55  {

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const Node node 
)
friend

Print node onto an output stream.

Definition at line 87 of file Node.h.

91  {

Field Documentation

◆ location

SrcLocation souffle::ast::Node::location
private

Source location of a syntactic element.

Definition at line 103 of file Node.h.


The documentation for this class was generated from the following file: