Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
typon
typon-compiler
Commits
aec0e5c2
Commit
aec0e5c2
authored
Aug 13, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add proper display for ICEs
parent
13764aba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
trans/transpiler/__init__.py
trans/transpiler/__init__.py
+15
-2
No files found.
trans/transpiler/__init__.py
View file @
aec0e5c2
...
@@ -5,8 +5,13 @@ import importlib
...
@@ -5,8 +5,13 @@ import importlib
import
inspect
import
inspect
import
os
import
os
import
traceback
#os.environ["TERM"] = "xterm-256"
#os.environ["TERM"] = "xterm-256"
import
colorama
import
colorama
from
transpiler.phases.desugar_compare
import
DesugarCompare
colorama
.
init
()
colorama
.
init
()
from
transpiler.consts
import
MAPPINGS
from
transpiler.consts
import
MAPPINGS
...
@@ -32,6 +37,8 @@ def exception_hook(exc_type, exc_value, tb):
...
@@ -32,6 +37,8 @@ def exception_hook(exc_type, exc_value, tb):
last_node
=
None
last_node
=
None
last_file
=
None
last_file
=
None
orig_tb
=
tb
while
tb
:
while
tb
:
local_vars
=
tb
.
tb_frame
.
f_locals
local_vars
=
tb
.
tb_frame
.
f_locals
name
=
tb
.
tb_frame
.
f_code
.
co_name
name
=
tb
.
tb_frame
.
f_code
.
co_name
...
@@ -103,12 +110,17 @@ def exception_hook(exc_type, exc_value, tb):
...
@@ -103,12 +110,17 @@ def exception_hook(exc_type, exc_value, tb):
print
(
disp
)
print
(
disp
)
# print(repr(disp))
# print(repr(disp))
print
()
print
()
print
(
cf
.
red
(
"Error:"
),
exc_value
)
if
isinstance
(
exc_value
,
CompileError
):
if
isinstance
(
exc_value
,
CompileError
):
print
(
cf
.
red
(
"Error:"
),
exc_value
)
detail
=
inspect
.
cleandoc
(
exc_value
.
detail
(
last_node
))
detail
=
inspect
.
cleandoc
(
exc_value
.
detail
(
last_node
))
if
detail
:
if
detail
:
print
()
print
()
print
(
detail
)
print
(
detail
)
else
:
print
(
cf
.
red
(
"Internal Compiler Error:"
),
exc_value
)
print
()
print
(
"Please report this error to the Typon maintainers."
)
traceback
.
print_tb
(
orig_tb
,
limit
=-
1
)
print
()
print
()
def
find_indices
(
s
,
indices
:
list
[
int
])
->
list
[
int
]:
def
find_indices
(
s
,
indices
:
list
[
int
])
->
list
[
int
]:
...
@@ -162,8 +174,9 @@ def transpile(source, name="<module>", path=None):
...
@@ -162,8 +174,9 @@ def transpile(source, name="<module>", path=None):
res
=
ast
.
parse
(
source
,
type_comments
=
True
)
res
=
ast
.
parse
(
source
,
type_comments
=
True
)
# res = initial_pytype.run(source, res)
# res = initial_pytype.run(source, res)
res
=
DesugarWith
().
visit
(
res
)
IfMainVisitor
().
visit
(
res
)
IfMainVisitor
().
visit
(
res
)
res
=
DesugarWith
().
visit
(
res
)
res
=
DesugarCompare
().
visit
(
res
)
ScoperBlockVisitor
().
visit
(
res
)
ScoperBlockVisitor
().
visit
(
res
)
# print(res.scope)
# print(res.scope)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment