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