retdec
node.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_NODE_H
8 #define RETDEC_NODE_H
9 
10 #include <memory>
11 #include <string>
12 #include <vector>
13 
14 namespace retdec {
15 namespace demangler {
16 namespace borland {
17 
21 class Node
22 {
23 public:
24  enum class Kind
25  {
26  KFunction,
28  KName,
30  KNodeArray,
32  KTypeNode,
36  KCharType,
37  KFloatType,
41  KNamedType,
43  KArrayNode,
45  };
46 
47 public:
48  explicit Node(Kind kind, bool has_right_side = false);
49 
50  virtual ~Node() = default;
51 
52  void print(std::ostream &s) const;
53 
54  std::string str() const;
55 
56  Kind kind() const;
57 
58  virtual void printLeft(std::ostream &s) const = 0;
59 
60  virtual void printRight(std::ostream &s) const;
61 
62  bool hasRight();
63 
64 protected:
66  bool _has_right;
67 };
68 
69 }
70 }
71 }
72 
73 #endif //RETDEC_NODE_H
Base class for all nodes in AST.
Definition: node.h:22
std::string str() const
Definition: node.cpp:38
virtual void printLeft(std::ostream &s) const =0
bool _has_right
Definition: node.h:66
void print(std::ostream &s) const
Prints left side of node.
Definition: node.cpp:27
Kind kind() const
Definition: node.cpp:48
bool hasRight()
Definition: node.cpp:59
virtual void printRight(std::ostream &s) const
Some nodes need special trailing characters.
Definition: node.cpp:57
Kind _kind
Definition: node.h:65
Node(Kind kind, bool has_right_side=false)
Abstract constructor for base node.
Definition: node.cpp:20
llvm::itanium_demangle::Node::Kind Kind
Definition: itanium_ast_ctypes_parser.cpp:14
Definition: archive_wrapper.h:19