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