-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtagger.cpp
More file actions
57 lines (49 loc) · 966 Bytes
/
tagger.cpp
File metadata and controls
57 lines (49 loc) · 966 Bytes
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
//
#pragma once
#include<vector>
#include<map>
#include<string>
enum RoC{//Runtime or Comptime
Rt=1,
Ct=0
};
std::map<std::string,RoC> sym2roc={
{"input",Rt},
{"time",Rt},
{"rand",Rt},
};
std::map<std::string,std::vector<std::string> >deplist;
std::string noStr(std::string inputStr) {
/*
VIBE CODE
DONOT BELIEVE IT
*/
std::string result;
bool inQuotes = false;
for (char c : inputStr) {
if (c == '"') {
inQuotes = !inQuotes;
}
else if (!inQuotes) {
result += c;
}
}
return result;
}
RoC tagSym(std::string symn,std::string body){
using namespace std;
auto trueBody=noStr(body);
for (const auto &p:sym2roc){
auto key=p.first;auto value=p.second;
if((value==Rt)){
if((trueBody.find(key)!=string::npos)){
return sym2roc[symn]=Rt;
}
}else{
if((trueBody.find(key)!=string::npos)){
deplist[symn].push_back(key);
}
}
}
return sym2roc[symn]=Ct;
}