Commit 82de5cfa authored by Tom Niget's avatar Tom Niget

Support for complex number constants

parent a78aa3f6
......@@ -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
......@@ -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))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment