Skip to content

Commit

Permalink
reverted a few changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ze7111 committed Mar 26, 2024
2 parents 9872421 + 287b0a3 commit bc455ae
Show file tree
Hide file tree
Showing 60 changed files with 16,617 additions and 628 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# --------------------------------------------------------------------------------
# GENERATED FILE
# --------------------------------------------------------------------------------
# Filename: test_case1.hlx
# Generation Date: 2024-03-09 21:43:31
# Filename: cappy.hlx
# Generation Date: 2024-03-24 19:54:53
# Generator: Helix Transpiler
# --------------------------------------------------------------------------------
# WARNING: This file is AUTO-GENERATED by the Helix Transpiler. Any modifications
Expand All @@ -17,7 +17,7 @@
#
# By using this file, you agree to the Terms and Conditions of the License.
# --------------------------------------------------------------------------------
# Helix Version: 0.1.0-alpha.a
# Helix Version: 0.10.0-alpha.a
# Repository: https://github.com/kneorain/helix
# Documentation: https://kneorain.github.io/helix/
# For further assistance, contact the development team or refer to project documentation.
Expand All @@ -29,18 +29,19 @@
import os # type: ignore
import sys # type: ignore
import types # type: ignore
sys.path.append(os.path.dirname(os.path.realpath("c:\\Users\\dhruv\\Documents\\Projects\\helix\\helix.py")) + os.sep + ".helix") # type: ignore
sys.path.append(os.path.dirname(os.path.realpath("c:\\Users\\dhruv\\Documents\\Projects\\helix\\helix.py"))) # type: ignore
sys.path.append(os.path.dirname(os.path.realpath("helix.py")) + os.sep + ".helix") # type: ignore
sys.path.append(os.path.dirname(os.path.realpath("helix.py"))) # type: ignore
sys.path.append(os.path.dirname(os.path.realpath(os.getcwd()))) # type: ignore
# trunk-ignore(ruff/F401)
from include.core import ABC, Any, C_For, Callable, DEFAULT_VALUE, DispatchError, Enum, FastMap, FunctionType, Iterator, Literal, NoReturn, NoneType, Optional, Self, Thread, Type, TypeVar, UnionType, __import_c__, __import_cpp__, __import_py__, __import_rs__, annotations, array, auto, dataclass, double, getcontext, hx__abstract_method, hx__async, hx__multi_method, hx_array, hx_bool, hx_bytes, hx_char, hx_double, hx_float, hx_int, hx_list, hx_map, hx_set, hx_string, hx_tuple, hx_unknown, hx_void, inspect, multimeta, panic, printf, ref, replace_primitives, scanf, sleep, std, string, subtype, unknown, void, wraps # type: ignore
from include.core import ABC, Any, BuiltinFunctionType, C_For, Callable, DEFAULT_VALUE, DispatchError, Enum, FastMap, FunctionType, Infix, Iterator, Literal, NoReturn, NoneType, Optional, Self, T, Thread, Type, TypeVar, UnionType, __import_c__, __import_cpp__, __import_py__, __import_rs__, annotations, array, auto, beartype, class_type_check_decorator, dataclass, double, getcontext, hx__abstract_method, hx__async, hx__multi_method, hx_array, hx_bool, hx_bytes, hx_char, hx_double, hx_float, hx_int, hx_list, hx_map, hx_set, hx_string, hx_tuple, hx_unknown, hx_void, inspect, multimeta, panic, partial, printf, ref, replace_primitives, scanf, sleep, std, string, subtype, unknown, void, wraps # type: ignore
# trunk-ignore(ruff/F401)
# trunk-ignore(ruff/F811)
from include.core import __import_c__, __import_cpp__, __import_py__, __import_rs__ # type: ignore
import threading # type: ignore
import functools # type: ignore
__lock = threading.Lock()
__file__ = "C:\\Users\\dhruv\\Documents\\Projects\\helix\\syntax\\test_case1.hlx"
__exit__ = sys.exit
_lock = threading.Lock()
__file__ = "Z:\\devolopment\\helix\\helix-lang\\syntax\\cappy.hlx"
# trunk-ignore(ruff/F821)
def exception_handler(exception_type: type[BaseException] | threading.ExceptHookArgs, exception: Optional[Exception] = None, tb: Optional[types.TracebackType] = None, debug_hook: bool = False, thread_error: bool = False):
import traceback
Expand All @@ -60,21 +61,45 @@ def exception_handler(exception_type: type[BaseException] | threading.ExceptHook
exception = TypeError(str(exception).replace("type hint", "type")) if isinstance(exception, BeartypeException) else exception
current_exception = exception
relevant_frames = []
early_replacements = dict((v, k) for k, v in {'...': 'None', 'true': 'True', 'false': 'False', 'null': 'None', 'none': 'None', '&&': 'and', '||': 'or', '!': 'not', '===': 'is', '!==': 'is not', 'stop': 'break', '::': '.', 'new': '__init__', 'delete': '__del__', 'enter': '__enter__', 'exit': '__exit__', 'u8': 'hx_u8', 'u16': 'hx_u16', 'u32': 'hx_u32', 'u64': 'hx_u64', 'u128': 'hx_u128', 'i8': 'hx_i8', 'i16': 'hx_i16', 'i32': 'hx_i32', 'i64': 'hx_i64', 'i128': 'hx_i128', 'f32': 'hx_f32', 'f64': 'hx_f64', 'f128': 'hx_f128'}.items())
early_replacements = dict((v, k) for k, v in {'...': 'None', '??': 'if', '|:': 'else', 'true': 'True', 'false': 'False', 'null': 'None', 'none': 'None', 'await': '_await', '&&': 'and', '||': 'or', '!': 'not', '===': 'is', '!==': 'is not', 'stop': 'break', '::': '.', 'new': '__init__', 'delete': '__del__', 'enter': '__enter__', 'exit': '__exit__', 'u8': 'hx_u8', 'u16': 'hx_u16', 'u32': 'hx_u32', 'u64': 'hx_u64', 'u128': 'hx_u128', 'i8': 'hx_i8', 'i16': 'hx_i16', 'i32': 'hx_i32', 'i64': 'hx_i64', 'i128': 'hx_i128', 'f32': 'hx_f32', 'f64': 'hx_f64', 'f128': 'hx_f128'}.items())
# First loop: filter out irrelevant frames
index = 0
for frame in stack:
filename = frame.filename
line_no = frame.lineno
if "_hlx" in os.path.basename(filename):
filename = __file__
line_no = int(open(frame.filename + ".lines", "r").readlines()[line_no-1]) # type: ignore
try:
line_no = int(open(frame.filename + ".lines", "r").readlines()[line_no-1]) # type: ignore
except IndexError:
print("TODO: approximate corresponding line number in .hlx file")
panic(
LookupError(f"Could not find the corresponding line number in the .hlx file for the line {frame.lineno} in the generated file {frame.filename}. Please report this issue."
+ f"line={frame.lineno}, file={frame.filename}"
+ f"linecache.getline({frame.filename}, {frame.lineno})"),
line_no=1, # type: ignore
replacements=early_replacements,
thread_name=thread_name,
no_lines=True,
multi_frame=True,
lang="py"
)
continue
except FileNotFoundError:
panic(
FileNotFoundError(f"The file {frame.filename} was not found. Please ensure that the file exists and is accessible."
"You should never see this error. If you do, something went really wrong."),
line_no=1, # type: ignore
replacements=early_replacements,
thread_name=thread_name,
no_lines=True,
lang="py"
)
if line_no == -1:
continue
# Check specific conditions to skip
if (
f"plum{os.sep}plum" in filename
):
if line_no == -1:
continue
if ";#\"\"\"REMOVE-STACK\"\"\"#" in linecache.getline(filename, line_no).strip():
continue
if (
linecache.getline(filename, line_no-1).strip() == "def hx_internal_multi_method_decorator(*args, **kwargs):" # type: ignore
Expand All @@ -85,7 +110,7 @@ def exception_handler(exception_type: type[BaseException] | threading.ExceptHook
relevant_frames.append((index, frame))
index += 1
if len(relevant_frames) > 1:
__lock.acquire(blocking=True, timeout=1.2)
_lock.acquire(blocking=True, timeout=1.2)
for frame_info in relevant_frames:
index, frame = frame_info
filename = frame.filename
Expand Down Expand Up @@ -129,10 +154,10 @@ def exception_handler(exception_type: type[BaseException] | threading.ExceptHook
)
current_exception = current_exception.__cause__ if current_exception.__cause__ else current_exception # type: ignore
else:
__lock.release()
_lock.release()
exit(1)
else:
__lock.acquire(blocking=True, timeout=0.1)
_lock.acquire(blocking=True, timeout=0.1)
index, frame = relevant_frames[0]
filename = frame.filename
line_no = frame.lineno
Expand Down Expand Up @@ -169,35 +194,56 @@ def exception_handler(exception_type: type[BaseException] | threading.ExceptHook
thread_name=thread_name,
lang=file_ext
)
__lock.release()
_lock.release()
exit(1)
sys.excepthook = exception_handler # type: ignore
threading.excepthook = functools.partial(exception_handler, thread_error=True)
sys.argv = ["C:\\Users\\dhruv\\Documents\\Projects\\helix\\helix.py", "C:\\Users\\dhruv\\Documents\\Projects\\helix\\syntax\\test_case1.hlx"] + list(sys.argv)[2:]
sys.argv = ["Z:\\devolopment\\helix\\helix-lang\\helix.py", "Z:\\devolopment\\helix\\helix-lang\\syntax\\cappy.hlx"] + list(sys.argv)[2:]
del os, threading, functools
overload_with_type_check = beartype(conf=BeartypeConf(is_color=False)) # type: ignore
import os
import time
import math
@overload_with_type_check
def main():
print ( "This should be printed to the console." )
class Test():
def __init__(self: Any, __val: 'Test'):
raise NotImplementedError("Define an __init__ method for this class with the function signature new(self: Any, inst_class: 'Test')")
@overload_with_type_check
def __lshift__(self: Any, s: str | hx_string):
print ( s )
class MessageEmitter(ABC, ):
def __init__(self: Any, __val: 'MessageEmitter'):
raise NotImplementedError("Define an __init__ method for this class with the function signature new(self: Any, inst_class: 'MessageEmitter')")
@overload_with_type_check
@hx__abstract_method
def message_handle(self: Any) -> MessageHandle:
None
class MessageHandle():
def __init__(self: Any, __val: 'MessageHandle'):
raise NotImplementedError("Define an __init__ method for this class with the function signature new(self: Any, inst_class: 'MessageHandle')")
@overload_with_type_check
def subscribe(self: Any):
pass
A: float | hx_float = float(0.0)
B: float | hx_float = float(0.0)
while True :
z: list[float | hx_float] | hx_list[float | hx_float] = list([ 0.0 ] * 1760)
b: list[str | hx_string] | hx_list[str | hx_string] = list([ " " ] * 1760)
for j in range ( 0 , 628 , 7 ):
for i in range ( 0 , 628 , 2 ):
c: float | hx_float = float(math . sin ( i ))
d: float | hx_float = float(math . cos ( j ))
e: float | hx_float = float(math . sin ( A ))
f: float | hx_float = float(math . sin ( j ))
g: float | hx_float = float(math . cos ( A ))
h: float | hx_float = float(d + 2)
D: float | hx_float = float(1 / ( c * h * e + f * g + 5 ))
l: float | hx_float = float(math . cos ( i ))
m: float | hx_float = float(math . cos ( B ))
n: float | hx_float = float(math . sin ( B ))
t: float | hx_float = float(c * h * g - f * e)
x: int | hx_int = (int ( 40 + 30 * D * ( l * h * m - t * n ) ))
y: int | hx_int = (int ( 12 + 15 * D * ( l * h * n + t * m ) ))
o: int | hx_int = (int ( x + 80 * y ))
N: int | hx_int = (int ( 8 * ( ( f * e - c * d * g ) * m - c * d * e - f * g - l * d * n ) ))
if (0 <= y < 22 and 0 <= x < 80 and D > z [ o ]):
z [ o ] = D
if (N > 0):
charIndex: int | hx_int = int(N)
else:
charIndex: int | hx_int = int(0)
b [ o ] = ".,-~:;=!*#$@" [ charIndex ]
os . system ( "cls" )
for k in C_For(k = int(0)).set_con('k < 1760').set_inc('k ++'):
if (k % 80 == 0):
print ( '\n' , end = '' )
else:
print ( b [ k ] , end = '' )
A += 0.04
B += 0.02
time . sleep ( 0.03 )
if __name__ == "__main__":
try:
main() # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,28 +176,111 @@
-1
-1
-1
<<<<<<< HEAD:.helix/cache/build_cache/test_hlx.py.lines
79
79
79
80
80
81
85
85
86
88
89
91
92
93
92
95
96
97
100
100
101
102
105
105
106
110
110
111
112
111
117
117
117
117
=======
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1
1
1
2
2
2
2
3
3
4
4
5
5
5
6
6
6
7
7
61
61
61
62
62
62
62
65
65
65
66
66
66
8
9
9
10
10
11
12
13
14
14
14
15
15
15
16
16
17
18
18
18
19
20
20
21
>>>>>>> 5b3e87180733de6321e2707e5feed733434b5ce5:.helix/cache/build_cache/cappy_hlx.hir.lines
-1
-1
-1
Expand Down
Loading

0 comments on commit bc455ae

Please sign in to comment.