Bash++
Bash++ compiler internal documentation
Connective.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <AST/ASTNode.h>
10
11namespace AST {
12
13class Connective : public ASTNode {
14 public:
15 enum class ConnectiveType {
16 AND,
17 OR
18 };
19 protected:
21 public:
23 constexpr AST::NodeType getType() const override { return static_type; }
24
26 return m_TYPE;
27 }
29 m_TYPE = type;
30 }
31
32 std::ostream& prettyPrint(std::ostream& os, int indentation_level = 0) const override {
33 std::string indent(indentation_level * PRETTYPRINT_INDENTATION_AMOUNT, ' ');
34 os << indent << "(Connective "
35 << (m_TYPE == ConnectiveType::AND ? "&&" : "||")
36 << ")";
37 return os;
38 }
39};
40
41} // 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
Definition Connective.h:13
void setType(ConnectiveType type)
Definition Connective.h:28
ConnectiveType TYPE() const
Definition Connective.h:25
constexpr AST::NodeType getType() const override
Definition Connective.h:23
ConnectiveType
Definition Connective.h:15
static constexpr AST::NodeType static_type
Definition Connective.h:22
ConnectiveType m_TYPE
Definition Connective.h:20
std::ostream & prettyPrint(std::ostream &os, int indentation_level=0) const override
Definition Connective.h:32
Definition AccessModifier.h:9
NodeType
Definition NodeTypes.h:10