/
parser.py
49 lines (42 loc) · 1.11 KB
/
parser.py
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
import re
class Parser :
@staticmethod
def entities(i) :
return re.findall(r"{.*?}", i)
# regex = re.compile(r"{.*?}")
# if(regex.search(i) != None) :
# extract = regex.search(i).group().split(" ")
# return extract
# return None
@staticmethod
def entities_alt(i) :
return re.findall(r"{{.*?}}", i)
@staticmethod
def commands(i) :
regex = re.compile(r"<.*?>")
if(regex.search(i) != None) :
extract = regex.search(i).group().split(" ")
return extract
return None
@staticmethod
def actions(i) :
return re.findall(r"<<.*?>>", i)
@staticmethod
def profilers(i) :
return re.findall(r"\[.*?\]", i)
# regex = re.compile(r"\[.*?\]")
# if(regex.search(i) != None) :
# extract = regex.search(i).group().split(" ")
# return extract
# return None
@staticmethod
def modifiers(i) :
return re.findall(r"\(.*?\)", i)
# regex = re.compile(r"\(.*?\)")
# # regex = re.compile(r"(\((?:\(??[^\(]*?\)))")
# if(regex.search(i) != None) :
# extract = regex.search(i).group().split(" ")
# return extract
# return None
if __name__ == '__main__':
print(Parser.profilers("[yes][no]"))