Fixed some bugs

This commit is contained in:
2020-08-27 18:54:28 +02:00
parent 351c16f946
commit 37cd3ed757
27 changed files with 685 additions and 189 deletions
+29 -1
View File
@@ -5,8 +5,22 @@ import re
from core.tokenizer import TokenKind
default_debug_name = "*default*"
debug_activated = set()
def my_debug(*args, check_started=None):
if check_started and default_debug_name not in debug_activated:
return
if isinstance(check_started, str) and check_started not in debug_activated:
return
if isinstance(check_started, list):
for debug_name in check_started:
if debug_name not in debug_activated:
return
def my_debug(*args):
with open("debug.txt", "a") as f:
for arg in args:
if isinstance(arg, list):
@@ -16,6 +30,20 @@ def my_debug(*args):
f.write(f"{arg}\n")
def start_debug(msg=None, debug_name=default_debug_name):
debug_activated.add(debug_name)
if msg:
with open("debug.txt", "a") as f:
f.write(f"{msg}\n")
def stop_debug(msg=None, debug_name=default_debug_name):
if msg:
with open("debug.txt", "a") as f:
f.write(f"{msg}\n")
debug_activated.remove(debug_name)
def sysarg_to_string(argv):
"""
Transform a list of strings into a single string