Bash++
Bash++ compiler internal documentation
BashFunction.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <AST/ASTNode.h>
10
11namespace AST {
12
13class BashFunction : public ASTNode {
14 protected:
16 public:
18 constexpr AST::NodeType getType() const override { return static_type; }
19
21 return m_NAME;
22 }
23 void setName(const AST::Token<std::string>& name) {
24 m_NAME = name;
25 }
26
27 std::ostream& prettyPrint(std::ostream& os, int indentation_level = 0) const override {
28 std::string indent(indentation_level * PRETTYPRINT_INDENTATION_AMOUNT, ' ');
29 os << indent << "(BashFunction function " << m_NAME.getValue() << "()";
30 for (const auto& child : children) {
31 os << std::endl;
32 child->prettyPrint(os, indentation_level + 1);
33 }
34 os << ")" << std::flush;
35 return os;
36 }
37};
38
39} // 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 BashFunction.h:13
const AST::Token< std::string > & NAME() const
Definition BashFunction.h:20
void setName(const AST::Token< std::string > &name)
Definition BashFunction.h:23
constexpr AST::NodeType getType() const override
Definition BashFunction.h:18
std::ostream & prettyPrint(std::ostream &os, int indentation_level=0) const override
Definition BashFunction.h:27
static constexpr AST::NodeType static_type
Definition BashFunction.h:17
AST::Token< std::string > m_NAME
Definition BashFunction.h:15
A class representing a token in the Bash++ AST. Tokens store their value along with line and column i...
Definition Token.h:22
const T & getValue() const
Definition Token.h:30
Definition AccessModifier.h:9
NodeType
Definition NodeTypes.h:10