support older python versions
This commit is contained in:
3
error.py
3
error.py
@@ -1,8 +1,9 @@
|
|||||||
from console import console
|
from console import console
|
||||||
from sys import exit
|
from sys import exit
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
def traceback(code: str, error_type: str, error_message: str, line: int | None = None, start_column: int | None = None, end_column: int | None = None):
|
def traceback(code: str, error_type: str, error_message: str, line: Union[int, None] = None, start_column: Union[int, None] = None, end_column: Union[int, None] = None):
|
||||||
if line != None:
|
if line != None:
|
||||||
console.print(f"[bold red]{error_type} on line {line}: [/]{error_message}\n")
|
console.print(f"[bold red]{error_type} on line {line}: [/]{error_message}\n")
|
||||||
lines = code.split("\n")[line-1:line+2]
|
lines = code.split("\n")[line-1:line+2]
|
||||||
|
2
main.py
2
main.py
@@ -31,7 +31,7 @@ def main():
|
|||||||
print(f"Compiled in {round(compile_time, 1)} seconds.")
|
print(f"Compiled in {round(compile_time, 1)} seconds.")
|
||||||
|
|
||||||
system(f"nasm -felf64 {out_path}.asm")
|
system(f"nasm -felf64 {out_path}.asm")
|
||||||
system(f"ld -o {out_path} {out_path}.o -m elf_{arch}")
|
system(f"ld -arch elf_{arch} -o {out_path} {out_path}.o")
|
||||||
remove(out_path + ".o")
|
remove(out_path + ".o")
|
||||||
#remove(out_path + ".asm")
|
#remove(out_path + ".asm")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user