Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
105 lines (89 loc) · 2.15 KB
/
Copy pathmain.cpp
File metadata and controls
105 lines (89 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//
// Created by MorbidArk on 2023/2/19.
//
#include <iostream>
#include "cli.hpp"
#include "clipp/clipp.h"
using std::cout;
using std::endl;
using std::string;
[[maybe_unused]]
unsigned char flagDebug = 0;
enum class mode
{
runFileMode, runCliMode, helpMode
};
#include "Compiler.hpp"
int main()
{
VM *vm = new class vm();
buildCore(vm);
return 0;
}
#if 0
int main(int argc, char *argv[])
{
mode selected = mode::helpMode;
string input;
string dict, out;
bool progr = false;
auto out_debug =
(
(clipp::option("-o", "--output").set(progr) &
clipp::value("outfile", out)
) % "Output content write to file",
clipp::option("-d", "--debug")
.call([] { flagDebug = 1; })
.doc("debug mode on")
);
auto runFileMode =
(
clipp::command("make").set(selected, mode::runFileMode),
clipp::values("filePath", input),
out_debug
);
auto runCliMode =
(
clipp::command("cli").set(selected, mode::runCliMode),
out_debug
);
auto helpMode =
(
clipp::command("help")
.set(selected, mode::helpMode)
);
auto cli =
(
(runFileMode | runCliMode | helpMode),
clipp::option("-v", "--version")
.call([] {
cout << Cli::logoImg
<< "\t\t\t"
<< Cli::versionMsg;
})
.doc("show version")
);
if (argc == 1)
{
cout << clipp::usage_lines(cli, "Tiderip")
<< endl;
return 0;
}
if (parse(argc, argv, cli))
{
switch (selected)
{
case mode::runFileMode:
Cli::runFile(input.c_str());
break;
case mode::runCliMode:
Cli::runCli();
break;
case mode::helpMode:
cout << make_man_page(cli, "Tiderip");
break;
}
}
return 0;
}
#endif