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
82de5cfa
Commit
82de5cfa
authored
Mar 08, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for complex number constants
parent
a78aa3f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
1 deletion
+4
-1
trans/tests/builtins_test.py
trans/tests/builtins_test.py
+2
-1
trans/transpiler/__init__.py
trans/transpiler/__init__.py
+2
-0
No files found.
trans/tests/builtins_test.py
View file @
82de5cfa
...
...
@@ -5,5 +5,6 @@ from typon import is_cpp
if
__name__
==
"__main__"
:
# todo: 0x55 & 7 == 5
print
(
"C++ "
if
is_cpp
()
else
"Python"
,
"res="
,
5
,
"."
,
True
,
[
4
,
5
,
6
],
{
7
,
8
,
9
},
[
1
,
2
]
+
[
3
,
4
],
[
5
,
6
]
*
3
,
{
1
:
7
,
9
:
3
},
0x55
&
7
==
5
)
"res="
,
5
,
"."
,
True
,
[
4
,
5
,
6
],
{
7
,
8
,
9
},
[
1
,
2
]
+
[
3
,
4
],
[
5
,
6
]
*
3
,
{
1
:
7
,
9
:
3
},
0x55
&
7
==
5
,
2
+
3j
)
print
()
\ No newline at end of file
trans/transpiler/__init__.py
View file @
82de5cfa
...
...
@@ -142,6 +142,8 @@ class ExpressionVisitor(NodeVisitor):
elif
isinstance
(
node
.
value
,
int
):
# TODO: bigints
yield
str
(
node
.
value
)
elif
isinstance
(
node
.
value
,
complex
):
yield
f"PyComplex(
{
node
.
value
.
real
}
,
{
node
.
value
.
imag
}
)"
else
:
raise
NotImplementedError
(
node
,
type
(
node
))
...
...
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