support older python versions

This commit is contained in:
2025-09-02 15:55:21 +10:00
parent b5852cde02
commit 91fa1577ab
2 changed files with 42 additions and 41 deletions

View File

@@ -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]

View File

@@ -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")