Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
a053e3e1
Commit
a053e3e1
authored
Jun 17, 2008
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More CodeWriter support
parent
10a5972a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
Cython/CodeWriter.py
Cython/CodeWriter.py
+25
-0
No files found.
Cython/CodeWriter.py
View file @
a053e3e1
from
Cython.Compiler.Visitor
import
TreeVisitor
from
Cython.Compiler.Nodes
import
*
from
Cython.Compiler.ExprNodes
import
*
from
Cython.Compiler.Symtab
import
TempName
"""
Serializes a Cython code tree to Cython code. This is primarily useful for
...
...
@@ -196,6 +198,18 @@ class CodeWriter(TreeVisitor):
self
.
comma_seperated_list
(
node
.
args
)
self
.
put
(
")"
)
def
visit_GeneralCallNode
(
self
,
node
):
self
.
visit
(
node
.
function
)
self
.
put
(
u"("
)
posarg
=
node
.
positional_args
if
isinstance
(
posarg
,
AsTupleNode
):
self
.
visit
(
posarg
.
arg
)
else
:
self
.
comma_seperated_list
(
posarg
)
if
node
.
keyword_args
is
not
None
or
node
.
starstar_arg
is
not
None
:
raise
Exception
(
"Not implemented yet"
)
self
.
put
(
u")"
)
def
visit_ExprStatNode
(
self
,
node
):
self
.
startline
()
self
.
visit
(
node
.
expr
)
...
...
@@ -260,6 +274,17 @@ class CodeWriter(TreeVisitor):
self
.
visit
(
node
.
body
)
self
.
dedent
()
def
visit_ReraiseStatNode
(
self
,
node
):
self
.
line
(
"raise"
)
def
visit_NoneNode
(
self
,
node
):
self
.
put
(
u"None"
)
def
visit_ImportNode
(
self
,
node
):
self
.
put
(
u"(import %s)"
%
node
.
module_name
.
value
)
def
visit_NotNode
(
self
,
node
):
self
.
put
(
u"(not "
)
self
.
visit
(
node
.
operand
)
self
.
put
(
u")"
)
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