Bash++
Bash++ compiler internal documentation
ObjectInstantiation.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <AST/ASTNode.h>
9
10namespace AST {
11
13 protected:
16 public:
18 constexpr AST::NodeType getType() const override { return static_type; }
19
20 void setType(const AST::Token<std::string>& type) {
21 m_TYPE = type;
22 }
23
25 return m_TYPE;
26 }
27
28 void setIdentifier(const AST::Token<std::string>& identifier) {
29 m_IDENTIFIER = identifier;
30 }
31
33 return m_IDENTIFIER;
34 }
35
36 std::ostream& prettyPrint(std::ostream& os, int indentation_level = 0) const override {
37 std::string indent(indentation_level * PRETTYPRINT_INDENTATION_AMOUNT, ' ');
38 os << indent << "(ObjectInstantiation\n"
39 << indent << " @" << m_TYPE << " " << m_IDENTIFIER;
40 for (const auto& child : children) {
41 os << std::endl;
42 child->prettyPrint(os, indentation_level + 1);
43 }
44 os << ")" << std::flush;
45 return os;
46 }
47};
48
49} // namespace AST
#define PRETTYPRINT_INDENTATION_AMOUNT
Definition ASTNode.h:18
The base class for all non-terminal nodes in the Bash++ AST. Each ASTNode contains information about ...
Definition ASTNode.h:28
std::vector< std::shared_ptr< ASTNode > > children
Definition ASTNode.h:30
Definition ObjectInstantiation.h:12
constexpr AST::NodeType getType() const override
Definition ObjectInstantiation.h:18
const AST::Token< std::string > & TYPE() const
Definition ObjectInstantiation.h:24
static constexpr AST::NodeType static_type
Definition ObjectInstantiation.h:17
std::ostream & prettyPrint(std::ostream &os, int indentation_level=0) const override
Definition ObjectInstantiation.h:36
AST::Token< std::string > m_TYPE
Definition ObjectInstantiation.h:14
AST::Token< std::string > m_IDENTIFIER
Definition ObjectInstantiation.h:15
void setIdentifier(const AST::Token< std::string > &identifier)
Definition ObjectInstantiation.h:28
const AST::Token< std::string > & IDENTIFIER() const
Definition ObjectInstantiation.h:32
void setType(const AST::Token< std::string > &type)
Definition ObjectInstantiation.h:20
A class representing a token in the Bash++ AST. Tokens store their value along with line and column i...
Definition Token.h:21
Definition AccessModifier.h:8
NodeType
Definition NodeTypes.h:9