-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMojinterpreter.py
More file actions
103 lines (93 loc) · 2.57 KB
/
Copy pathMojinterpreter.py
File metadata and controls
103 lines (93 loc) · 2.57 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
# MojiPy program. Written by Darcy from @RedAntsSec(Github), @RedAntsS3c(Telegram)
# Emojies dictionary
keys = {
"🖨": "print",
"🌜": "(",
"🌛": ")",
"🕸": "\"",
"🌀": "for",
"⏩": ">",
"⏪": "<",
"⏭": ">=",
"⏮": "<=",
"🍆": "in",
"🕯": "while",
"🧨": "break",
"💣": "exit()",
"⚖️" : "if",
"💤": "sleep",
"❌": "not",
"⛔️": "!",
"✅": "=",
"❇️" : "is",
"➡️" : "elif",
"🛑": "else",
"🇮🇷": "def",
"🛂": "pass",
"🚶♂️": "return",
"📈": "range",
"💁♂️": "try",
"🤦♂️": "except",
"😫": "and",
"😮": "or",
"🤬": "raise",
"👫": "with",
"🤥": "False",
"🤐": "True",
"👽": "global",
"👩🏫": "class"
}
# Converts python keywords to emojies.
def pytoemoji(string):
string = string.strip()
x = 0
for count in range(65,91):
if chr(count) in string or chr(count).lower() in string:
x = 1
break
if x == 0:
return "NotMoji"
result = ""
x = 0
# Proccess quote detecting and splitting
if "\'" in string:
x += 1
ans = string.split("\'")
for part in ans:
index = ans.index(part)
if index % 2 == 0:
for keychar, valchar in keys.items():
part = part.replace(valchar,keychar)
result += part
else:
result += "🕸" + part + "🕸"
if '\"' in string:
x += 1
ans = string.split("\"")
for part in ans:
if ans.index(part) % 2 == 0:
for keychar, valchar in keys.items():
part = part.replace(valchar,keychar)
result += part
else:
result += "🕸" + part + "🕸"
# if didn't find any quote in the code:
if x == 0:
for keychar, valchar in keys.items():
string = string.replace(valchar,keychar)
return string
else:
return result
# Converts emojies to python keywords
def emojitopy(string):
string = string.strip()
x = 0
for char in keys.keys():
if char in string:
x = 1
break
if x == 0:
return "NotMoji"
for keychar , valchar in keys.items():
string = string.replace(keychar , valchar)
return string