Bash++
Bash++ compiler internal documentation
PointerDeclaration.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2025 Andrew S. Rightenburg
3 * Bash++: Bash with classes
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7#pragma once
8
9#include <AST/ASTNode.h>
10
11namespace AST {
12
14 protected:
17 public:
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, size_t indentation_level = 0) const override {
37 std::string indent(indentation_level * PRETTYPRINT_INDENTATION_AMOUNT, ' ');
38 os << indent << "(PointerDeclaration\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:32
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:20
std::ostream & prettyPrint(std::ostream &os, size_t indentation_level=0) const override
Definition PointerDeclaration.h:36
constexpr PointerDeclaration()
Definition PointerDeclaration.h:18
const AST::Token< std::string > & TYPE() const
Definition PointerDeclaration.h:24
AST::Token< std::string > m_TYPE
Definition PointerDeclaration.h:15
void setIdentifier(const AST::Token< std::string > &identifier)
Definition PointerDeclaration.h:28
const AST::Token< std::string > & IDENTIFIER() const
Definition PointerDeclaration.h:32
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:10
NodeType
Definition NodeTypes.h:12