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
0e3c66da
Commit
0e3c66da
authored
Nov 03, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow calling join() with strs
parent
27378412
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
typon/trans/transpiler/phases/emit_cpp/__init__.py
typon/trans/transpiler/phases/emit_cpp/__init__.py
+16
-4
No files found.
typon/trans/transpiler/phases/emit_cpp/__init__.py
View file @
0e3c66da
...
...
@@ -17,7 +17,7 @@ class UniversalVisitor:
def
visit
(
self
,
node
):
"""Visit a node."""
TB
=
f"emitting C++ code for
{
highlight
(
node
)
}
"
#TB_SKIP = True
#
TB_SKIP = True
if
type
(
node
)
==
list
:
for
n
in
node
:
...
...
@@ -113,6 +113,7 @@ class NodeVisitor(UniversalVisitor):
else
:
raise
NotImplementedError
(
node
)
class
CoroutineMode
(
Flag
):
SYNC
=
1
FAKE
=
2
|
SYNC
...
...
@@ -121,21 +122,32 @@ class CoroutineMode(Flag):
TASK
=
16
|
ASYNC
JOIN
=
32
|
ASYNC
class
FunctionEmissionKind
(
enum
.
Enum
):
DECLARATION
=
enum
.
auto
()
DEFINITION
=
enum
.
auto
()
METHOD
=
enum
.
auto
()
LAMBDA
=
enum
.
auto
()
def
join
(
sep
:
str
,
items
:
Iterable
[
Iterable
[
str
]])
->
Iterable
[
str
]:
items
=
iter
(
items
)
try
:
yield
from
next
(
items
)
it
=
next
(
items
)
if
type
(
it
)
is
str
:
yield
it
else
:
yield
from
it
for
item
in
items
:
yield
sep
yield
from
item
it
=
item
if
type
(
it
)
is
str
:
yield
it
else
:
yield
from
it
except
StopIteration
:
return
def
flatmap
(
f
,
items
):
return
chain
.
from_iterable
(
map
(
f
,
items
))
\ No newline at end of file
return
chain
.
from_iterable
(
map
(
f
,
items
))
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