Skip to content
This repository was archived by the owner on Nov 16, 2021. It is now read-only.

Commit f5dbcef

Browse files
author
Glitch
committed
Added style.css and printing functions
1 parent 8a13ba9 commit f5dbcef

File tree

3 files changed

+202
-116
lines changed

3 files changed

+202
-116
lines changed

index.pys

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ console.input(jb);
66

77
time.sleep(2);
88

9-
window.alert('{{jb}}');
9+
window.alert('{{jb}}');
10+
time.time();
11+
window.alert("{{time.time();}}");
12+

main.py

Lines changed: 190 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -52,56 +52,91 @@ class Error(Exception):
5252
input2 = "Undefined input"
5353
input3 = "Undefined input"
5454

55+
56+
def timeTIME():
57+
if time_module == 1:
58+
wrd = "time.time("
59+
res = lines.partition(wrd)[2]
60+
res = res.replace(");","")
61+
print(res)
62+
63+
if type(res) == str:
64+
if res == " " or res == "":
65+
time.time()#this won't do anything of course, unless you print it ;)
66+
else:
67+
raise InvalidStringIntError("'time.time' must be empty!")
68+
else:
69+
raise InvalidStringIntError("'time.time' must be empty!")
70+
else:
71+
raise InvalidModuleError("The 'time' module isn't imported or it doesn't exist!")
72+
5573
'''
56-
Note that ascii characters are used like this:
74+
Note that ascii characters are used like this in pyscript:
5775
/1234 or /u1243
5876
Of course, those are examples ;) Another thing I should mention is that not all characters have been made yet ;)
5977
'''
6078

61-
6279
def WINDOWalert():#add f'string
6380
try:
6481
if '");' in lines or "');" in lines or "`);" in lines:
6582
wrd = "window.alert("
6683
res = lines.partition(wrd)[2]
67-
res = res.replace("\");","")
68-
res = res.replace('`);',"")
69-
res = res.replace('\');',"")
70-
res = res.replace("/n", "\n")
71-
res = res.replace("/t", "\t")
72-
if "\"" in res:
73-
split_string = res.split("\");", -1)
74-
elif "'" in res:
75-
split_string = res.split("\');", -1)
76-
elif "`" in res:
77-
split_string = res.split("`);", -1)
84+
#print(res)
85+
if res[-3] == "\"" and res[0] == "\'" or res[-3] == "\"" and res[0] == "`" or res[-3] == "'" and res[0] == "\"" or res[-3] == "'" and res[0] == "`" or res[-3] == "`" and res[0] == "\"" or res[-3] == "`" and res[0] == "'":
86+
raise InvalidSyntaxError("The 'window.alert' starting quotations and ending quotations are different!")
7887
else:
79-
raise InvalidSyntaxError("The 'window.alert' statement is missing quotations!")
80-
res = split_string[0]
81-
res = res.replace("\");","")
82-
res = res.replace('`);',"")
83-
res = res.replace('\');',"")
84-
res = res.replace("/n", "\n")
85-
res = res.replace("/t", "\t")
86-
#colors: res = res.replace("{red}", red)
87-
res = res.replace('"', "")
88-
res = res.replace("'", "")
89-
res = res.replace("`", "")
90-
res = res.replace(");","")
91-
92-
if "{{" in res:
93-
if "}}" in res:
94-
start = "{{"
95-
end = "}}"
96-
check = res[res.find(start) + len(start):res.rfind(end)]
97-
if check in allvars:
98-
res = res.replace("{{", "")
99-
res = res.replace("}}", "")
100-
dffdfdfdf = allvars[check]
101-
res = res.replace(check, str(dffdfdfdf))
102-
else:
103-
raise InvalidVariableError(f"'{var}' variable does not exist!")
104-
print(res, end="")
88+
res = res.replace("\");","")
89+
res = res.replace('`);',"")
90+
res = res.replace('\');',"")
91+
res = res.replace("/n", "\n")
92+
res = res.replace("/t", "\t")
93+
if "\"" in res:
94+
split_string = res.split("\");", -1)
95+
elif "'" in res:
96+
split_string = res.split("\');", -1)
97+
elif "`" in res:
98+
split_string = res.split("`);", -1)
99+
else:
100+
raise InvalidSyntaxError("The 'window.alert' statement is missing quotations!")
101+
res = split_string[0]
102+
res = res.replace("\");","")
103+
res = res.replace('`);',"")
104+
res = res.replace('\');',"")
105+
res = res.replace("/n", "\n")
106+
res = res.replace("/t", "\t")
107+
#colors: res = res.replace("{red}", red)
108+
res = res.replace('"', "")
109+
res = res.replace("'", "")
110+
res = res.replace("`", "")
111+
res = res.replace(");","")
112+
113+
if "{{" in res:
114+
if "}}" in res:
115+
start = "{{"
116+
end = "}}"
117+
check = res[res.find(start) + len(start):res.rfind(end)]
118+
if check in allvars:
119+
res = res.replace("{{", "")
120+
res = res.replace("}}", "")
121+
dffdfdfdf = allvars[check]
122+
res = res.replace(check, str(dffdfdfdf))
123+
PASS = False
124+
else:
125+
if "time.time(" in check:
126+
if check[-1] == "(":
127+
print(time.time())
128+
PASS = True
129+
else:
130+
raise InvalidSyntaxError("'time.time' must be empty!")
131+
elif "time.strftime(" in check:
132+
#print(timeSTRFTIME())
133+
PASS = True
134+
else:
135+
raise InvalidVariableError(f"'{var}' variable does not exist!")
136+
if PASS:
137+
pass
138+
else:
139+
print(res, end="")
105140
else:
106141
raise InvalidSyntaxError("The 'window.alert' statement must have a closing ');!")
107142
except:
@@ -112,44 +147,60 @@ def alert():
112147
if '");' in lines or "');" in lines or "`);" in lines:
113148
wrd = "alert("
114149
res = lines.partition(wrd)[2]
115-
res = res.replace("\");","")
116-
res = res.replace('`);',"")
117-
res = res.replace('\');',"")
118-
res = res.replace("/n", "\n")
119-
res = res.replace("/t", "\t")
120-
if "\"" in res:
121-
split_string = res.split("\");", -1)
122-
elif "'" in res:
123-
split_string = res.split("\');", -1)
124-
elif "`" in res:
125-
split_string = res.split("`);", -1)
150+
if res[-3] == "\"" and res[0] == "\'" or res[-3] == "\"" and res[0] == "`" or res[-3] == "'" and res[0] == "\"" or res[-3] == "'" and res[0] == "`" or res[-3] == "`" and res[0] == "\"" or res[-3] == "`" and res[0] == "'":
151+
raise InvalidSyntaxError("The 'alert' starting quotations and ending quotations are different!")
126152
else:
127-
raise InvalidSyntaxError("The 'alert' statement is missing quotations!")
128-
res = split_string[0]
129-
res = res.replace("\");","")
130-
res = res.replace('`);',"")
131-
res = res.replace('\');',"")
132-
res = res.replace("/n", "\n")
133-
res = res.replace("/t", "\t")
134-
#colors: res = res.replace("{red}", red)
135-
res = res.replace('"', "")
136-
res = res.replace("'", "")
137-
res = res.replace("`", "")
138-
res = res.replace(");","")
139-
140-
if "{{" in res:
141-
if "}}" in res:
142-
start = "{{"
143-
end = "}}"
144-
check = res[res.find(start) + len(start):res.rfind(end)]
145-
if check in allvars:
146-
res = res.replace("{{", "")
147-
res = res.replace("}}", "")
148-
dffdfdfdf = allvars[check]
149-
res = res.replace(check, str(dffdfdfdf))
150-
else:
151-
raise InvalidVariableError(f"'{var}' variable does not exist!")
152-
print(res, end="")
153+
res = res.replace("\");","")
154+
res = res.replace('`);',"")
155+
res = res.replace('\');',"")
156+
res = res.replace("/n", "\n")
157+
res = res.replace("/t", "\t")
158+
if "\"" in res:
159+
split_string = res.split("\");", -1)
160+
elif "'" in res:
161+
split_string = res.split("\');", -1)
162+
elif "`" in res:
163+
split_string = res.split("`);", -1)
164+
else:
165+
raise InvalidSyntaxError("The 'alert' statement is missing quotations!")
166+
res = split_string[0]
167+
res = res.replace("\");","")
168+
res = res.replace('`);',"")
169+
res = res.replace('\');',"")
170+
res = res.replace("/n", "\n")
171+
res = res.replace("/t", "\t")
172+
#colors: res = res.replace("{red}", red)
173+
res = res.replace('"', "")
174+
res = res.replace("'", "")
175+
res = res.replace("`", "")
176+
res = res.replace(");","")
177+
178+
if "{{" in res:
179+
if "}}" in res:
180+
start = "{{"
181+
end = "}}"
182+
check = res[res.find(start) + len(start):res.rfind(end)]
183+
if check in allvars:
184+
res = res.replace("{{", "")
185+
res = res.replace("}}", "")
186+
dffdfdfdf = allvars[check]
187+
res = res.replace(check, str(dffdfdfdf))
188+
else:
189+
if "time.time(" in check:
190+
if check[-1] == "(":
191+
print(time.time())
192+
PASS = True
193+
else:
194+
raise InvalidSyntaxError("'time.time' must be empty!")
195+
elif "time.strftime(" in check:
196+
#print(timeSTRFTIME())
197+
PASS = True
198+
else:
199+
raise InvalidVariableError(f"'{var}' variable does not exist!")
200+
if PASS:
201+
pass
202+
else:
203+
print(res, end="")
153204
else:
154205
raise InvalidSyntaxError("The 'alert' statement must have a closing ');!")
155206
except:
@@ -158,46 +209,62 @@ def alert():
158209
def CONSOLEprint():
159210
try:
160211
if '");' in lines or "');" in lines or "`);" in lines:
161-
wrd = "window.alert("
212+
wrd = "console.print("
162213
res = lines.partition(wrd)[2]
163-
res = res.replace("\");","")
164-
res = res.replace('`);',"")
165-
res = res.replace('\');',"")
166-
res = res.replace("/n", "\n")
167-
res = res.replace("/t", "\t")
168-
if "\"" in res:
169-
split_string = res.split("\");", -1)
170-
elif "'" in res:
171-
split_string = res.split("\');", -1)
172-
elif "`" in res:
173-
split_string = res.split("`);", -1)
214+
if res[-3] == "\"" and res[0] == "\'" or res[-3] == "\"" and res[0] == "`" or res[-3] == "'" and res[0] == "\"" or res[-3] == "'" and res[0] == "`" or res[-3] == "`" and res[0] == "\"" or res[-3] == "`" and res[0] == "'":
215+
raise InvalidSyntaxError("The 'console.print' starting quotations and ending quotations are different!")
174216
else:
175-
raise InvalidSyntaxError("The 'console.print' statement is missing quotations!")
176-
res = split_string[0]
177-
res = res.replace("\");","")
178-
res = res.replace('`);',"")
179-
res = res.replace('\');',"")
180-
res = res.replace("/n", "\n")
181-
res = res.replace("/t", "\t")
182-
#colors: res = res.replace("{red}", red)
183-
res = res.replace('"', "")
184-
res = res.replace("'", "")
185-
res = res.replace("`", "")
186-
res = res.replace(");","")
187-
188-
if "{{" in res:
189-
if "}}" in res:
190-
start = "{{"
191-
end = "}}"
192-
check = res[res.find(start) + len(start):res.rfind(end)]
193-
if check in allvars:
194-
res = res.replace("{{", "")
195-
res = res.replace("}}", "")
196-
dffdfdfdf = allvars[check]
197-
res = res.replace(check, str(dffdfdfdf))
198-
else:
199-
raise InvalidVariableError(f"'{var}' variable does not exist!")
200-
print(res, end="")
217+
res = res.replace("\");","")
218+
res = res.replace('`);',"")
219+
res = res.replace('\');',"")
220+
res = res.replace("/n", "\n")
221+
res = res.replace("/t", "\t")
222+
if "\"" in res:
223+
split_string = res.split("\");", -1)
224+
elif "'" in res:
225+
split_string = res.split("\');", -1)
226+
elif "`" in res:
227+
split_string = res.split("`);", -1)
228+
else:
229+
raise InvalidSyntaxError("The 'console.print' statement is missing quotations!")
230+
res = split_string[0]
231+
res = res.replace("\");","")
232+
res = res.replace('`);',"")
233+
res = res.replace('\');',"")
234+
res = res.replace("/n", "\n")
235+
res = res.replace("/t", "\t")
236+
#colors: res = res.replace("{red}", red)
237+
res = res.replace('"', "")
238+
res = res.replace("'", "")
239+
res = res.replace("`", "")
240+
res = res.replace(");","")
241+
242+
if "{{" in res:
243+
if "}}" in res:
244+
start = "{{"
245+
end = "}}"
246+
check = res[res.find(start) + len(start):res.rfind(end)]
247+
if check in allvars:
248+
res = res.replace("{{", "")
249+
res = res.replace("}}", "")
250+
dffdfdfdf = allvars[check]
251+
res = res.replace(check, str(dffdfdfdf))
252+
else:
253+
if "time.time(" in check:
254+
if check[-1] == "(":
255+
print(time.time())
256+
PASS = True
257+
else:
258+
raise InvalidSyntaxError("'time.time' must be empty!")
259+
elif "time.strftime(" in check:
260+
#print(timeSTRFTIME())
261+
PASS = True
262+
else:
263+
raise InvalidVariableError(f"'{var}' variable does not exist!")
264+
if PASS:
265+
pass
266+
else:
267+
print(res, end="")
201268
else:
202269
raise InvalidSyntaxError("The 'console.print' statement must have a closing ');!")
203270
except:
@@ -394,6 +461,14 @@ def CONSOLEprint():
394461
raise InvalidSyntaxError("'time.sleep' is missing semi-colon!")
395462
else:
396463
raise InvalidModuleError("The 'time' module isn't imported or it doesn't exist!")
397-
464+
465+
elif "time.time(" in lines:#remember to NOT print. It only prints when you do print
466+
timeTIME()#this doesnt really do anything.
467+
468+
elif "time.strftime(" in lines:
469+
timeSTRFTIME()
470+
if time_module == 1:
471+
wrd = "time.strftime("
472+
398473
else:
399474
pass

style.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
* {
2+
margin: 0px
3+
}
4+
5+
body {
6+
color: white;
7+
background-color: black;
8+
}

0 commit comments

Comments
 (0)