-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
104 lines (88 loc) · 2.15 KB
/
test.cpp
File metadata and controls
104 lines (88 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
//
// Created by adi on 07/07/19.
//
#include <iostream>
#include <vector>
#include "parser.h"
int count(std::string l,std::string regex);
void testVector(std::string l);
point makePointT();
std::string replace(std::string newS, std::string oldS, std::string p);
parser p;
int main() {
// point* a;
// if(true)
// {
// point ap = makePointT();
// a = ≈
// }
// a->printInfo();
//std::string p = "vec => v{ 9 , 0, 9 }";
//p = replace(""," ", p);
//std::cout << p << std::endl;
p.addPoint("yeet=>pt{9,8,7}");
vec v = p.makeVectorTest("v{yeet,dv{0,1,8}}");
v.printInfo();
}
point makePointT()
{
return {1,0,0};
}
int count(std::string l, std::string regex) {
int x;
for(x = 0; l.find(regex) != std::string::npos; x++)
{
l = l.substr(l.find(regex) + regex.length());
}
return x;
}
void testVector(std::string l)
{
std::vector<std::string> args;
l = l.substr(l.find("v{") + 2); //line now is ####,#####,####}
l = l.substr(0,l.length()- 1);
int beginArg = 0;
bool ignore = false; //for ignoring parameters in pt and dv definitions
for(int x = 0; x < l.length(); x++)
{
// std::cout << x << " : " << beginArg << std::endl;
std::string current = l.substr(x,1);
if(current.compare("{") == 0)
{
ignore = true;
}
else if(current.compare("}") == 0)
{
ignore = false;
}
else if(current.compare(",") == 0 && !ignore)
{
args.push_back(l.substr(beginArg, x - beginArg));
beginArg = x;
//std::cout << "special" << x << " : " << beginArg << std::endl;
}
else
{
//basically any other character, we don't really care about them.
}
if(x == l.length() - 1)
{
args.push_back(l.substr(beginArg + 1,x - beginArg + 1));
//std::cout << x << " : " << beginArg << std::endl;
}
}
for(auto&& x: args)
{
std::cout << x << std::endl;
}
if(args.size() == 1)
{
//return {makeDirVec(args[0])};
}
else
{
for(auto& p : args)
{
}
}
}