unlogic
Loading...
Searching...
No Matches
DebugPrinter.cpp
Go to the documentation of this file.
1
//
2
// Created by Nathan on 12/1/2024.
3
//
4
5
#include "
DebugPrinter.h
"
6
#include <format>
7
8
std::string
unlogic::DebugPrinter::operator()
(std::monostate &node)
9
{
10
throw
std::runtime_error(
"unexpected empty node"
);
11
}
12
13
std::string
unlogic::DebugPrinter::operator()
(
NumericLiteralNode
&node)
14
{
15
return
std::format(
"{}"
, node.
value
);
16
}
17
18
std::string
unlogic::DebugPrinter::operator()
(
StringLiteralNode
&node)
19
{
20
return
std::format(
"\"{}\""
, node.
value
);
21
}
22
23
std::string
unlogic::DebugPrinter::operator()
(
DivisionNode
&node)
24
{
25
auto
lhs = std::visit(*
this
, *node.
lhs
);
26
auto
rhs = std::visit(*
this
, *node.
rhs
);
27
28
return
std::format(
"({} / {})"
, lhs, rhs);
29
}
30
31
std::string
unlogic::DebugPrinter::operator()
(
ScopedBlockNode
&node)
32
{
33
return
""
;
34
}
35
36
std::string
unlogic::DebugPrinter::operator()
(
VariableNode
&node)
37
{
38
return
node.
identifier
;
39
}
40
41
std::string
unlogic::DebugPrinter::operator()
(
CallNode
&node)
42
{
43
return
""
;
44
}
45
46
std::string
unlogic::DebugPrinter::operator()
(
AdditionNode
&node)
47
{
48
return
""
;
49
}
50
51
std::string
unlogic::DebugPrinter::operator()
(
SubtractionNode
&node)
52
{
53
return
""
;
54
}
55
56
std::string
unlogic::DebugPrinter::operator()
(
MultiplicationNode
&node)
57
{
58
return
""
;
59
}
60
61
std::string
unlogic::DebugPrinter::operator()
(
PotentiationNode
&node)
62
{
63
return
""
;
64
}
65
66
std::string
unlogic::DebugPrinter::operator()
(
FunctionDefinitionNode
&node)
67
{
68
return
""
;
69
}
70
71
std::string
unlogic::DebugPrinter::operator()
(
PlotCommandNode
&node)
72
{
73
return
""
;
74
}
75
76
std::string
unlogic::DebugPrinter::operator()
(
ProgramEntryNode
&node)
77
{
78
return
""
;
79
}
DebugPrinter.h
unlogic::AdditionNode
Definition
Node.h:80
unlogic::BinaryNode::rhs
UniqueNode rhs
Definition
Node.h:73
unlogic::BinaryNode::lhs
UniqueNode lhs
Definition
Node.h:73
unlogic::CallNode
Definition
Node.h:63
unlogic::DebugPrinter::operator()
std::string operator()(std::monostate &node)
Definition
DebugPrinter.cpp:8
unlogic::DivisionNode
Definition
Node.h:98
unlogic::FunctionDefinitionNode
Definition
Node.h:110
unlogic::Literal::value
T value
Definition
Node.h:36
unlogic::MultiplicationNode
Definition
Node.h:92
unlogic::NumericLiteralNode
Definition
Node.h:43
unlogic::PlotCommandNode
Definition
Node.h:121
unlogic::PotentiationNode
Definition
Node.h:104
unlogic::ProgramEntryNode
Definition
Node.h:137
unlogic::ScopedBlockNode
Definition
Node.h:129
unlogic::StringLiteralNode
Definition
Node.h:49
unlogic::SubtractionNode
Definition
Node.h:86
unlogic::VariableNode
Definition
Node.h:55
unlogic::VariableNode::identifier
std::string identifier
Definition
Node.h:56
unlogic
src
compiler
transformer
debug
DebugPrinter.cpp
Generated by
1.9.8