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
std::string
unlogic::DebugPrinter::operator()
(
VariableNode
&node)
34
{
35
return
node.
identifier
;
36
}
37
38
std::string
unlogic::DebugPrinter::operator()
(
CallNode
&node) {}
39
40
std::string
unlogic::DebugPrinter::operator()
(
AdditionNode
&node) {}
41
std::string
unlogic::DebugPrinter::operator()
(
SubtractionNode
&node) {}
42
std::string
unlogic::DebugPrinter::operator()
(
MultiplicationNode
&node) {}
43
std::string
unlogic::DebugPrinter::operator()
(
PotentiationNode
&node) {}
44
std::string
unlogic::DebugPrinter::operator()
(
FunctionDefinitionNode
&node) {}
45
std::string
unlogic::DebugPrinter::operator()
(
PlotCommandNode
&node) {}
46
std::string
unlogic::DebugPrinter::operator()
(
ProgramEntryNode
&node) {}
DebugPrinter.h
unlogic::AdditionNode
Definition
Node.h:79
unlogic::BinaryNode::rhs
UniqueNode rhs
Definition
Node.h:72
unlogic::BinaryNode::lhs
UniqueNode lhs
Definition
Node.h:72
unlogic::CallNode
Definition
Node.h:62
unlogic::DebugPrinter::operator()
std::string operator()(std::monostate &node)
Definition
DebugPrinter.cpp:8
unlogic::DivisionNode
Definition
Node.h:97
unlogic::FunctionDefinitionNode
Definition
Node.h:109
unlogic::Literal::value
T value
Definition
Node.h:35
unlogic::MultiplicationNode
Definition
Node.h:91
unlogic::NumericLiteralNode
Definition
Node.h:42
unlogic::PlotCommandNode
Definition
Node.h:120
unlogic::PotentiationNode
Definition
Node.h:103
unlogic::ProgramEntryNode
Definition
Node.h:136
unlogic::ScopedBlockNode
Definition
Node.h:128
unlogic::StringLiteralNode
Definition
Node.h:48
unlogic::SubtractionNode
Definition
Node.h:85
unlogic::VariableNode
Definition
Node.h:54
unlogic::VariableNode::identifier
std::string identifier
Definition
Node.h:55
unlogic
src
compiler
transformer
debug
DebugPrinter.cpp
Generated by
1.9.8