-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArguments.cpp
55 lines (49 loc) · 1.08 KB
/
Arguments.cpp
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
#include "Arguments.h"
#include "Tokenizer.h"
#include "Gen.h"
#include <iostream>
#include <thread>
int Arguments::Analize(std::list<std::string> args)
{
std::list<std::thread> thds;
for (auto it = args.begin(); it != args.end(); it++)
{
if (*it == "c")
{
auto next = std::next(it);
if (next != args.end())
{
/* parallel processing of files */
thds.push_back(std::thread(
[](std::list<std::string>::iterator it, std::list<std::string>::iterator end) {
Tokenizer toks(it, end);
for (auto& ls : toks.GetTokens()) {
Gen gen(ls);
}
},
it, args.end()
));
}
else
{
std::cout << "breeze compile: not files or aguments listed." << std::endl;
}
break;
}
else if (*it == "r")
{
//std::cout << "wanna compile & run" << std::endl;
}
else if (*it == "help")
{
std::cout << "help test." << std::endl;
}
else {
std::cerr << "breeze '" << *it << "': unknown argument." << std::endl;
}
}
for (auto& th : thds) {
th.join();
}
return 0;
}