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
Boxiang Sun
cython
Commits
4d12bec3
Commit
4d12bec3
authored
Mar 29, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow restricting the output to certain interesting lines in PrintTree()
parent
45b7c136
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
Cython/Compiler/Visitor.py
Cython/Compiler/Visitor.py
+16
-9
No files found.
Cython/Compiler/Visitor.py
View file @
4d12bec3
...
@@ -709,12 +709,17 @@ class PrintTree(TreeVisitor):
...
@@ -709,12 +709,17 @@ class PrintTree(TreeVisitor):
"""Prints a representation of the tree to standard output.
"""Prints a representation of the tree to standard output.
Subclass and override repr_of to provide more information
Subclass and override repr_of to provide more information
about nodes. """
about nodes. """
def
__init__
(
self
):
def
__init__
(
self
,
start
=
None
,
end
=
None
):
TreeVisitor
.
__init__
(
self
)
TreeVisitor
.
__init__
(
self
)
self
.
_indent
=
""
self
.
_indent
=
""
if
start
is
not
None
or
end
is
not
None
:
self
.
_line_range
=
(
start
or
0
,
end
or
2
**
30
)
else
:
self
.
_line_range
=
None
def
indent
(
self
):
def
indent
(
self
):
self
.
_indent
+=
" "
self
.
_indent
+=
" "
def
unindent
(
self
):
def
unindent
(
self
):
self
.
_indent
=
self
.
_indent
[:
-
2
]
self
.
_indent
=
self
.
_indent
[:
-
2
]
...
@@ -728,6 +733,8 @@ class PrintTree(TreeVisitor):
...
@@ -728,6 +733,8 @@ class PrintTree(TreeVisitor):
# under the parent-node, not displaying the list itself in
# under the parent-node, not displaying the list itself in
# the hierarchy.
# the hierarchy.
def
visit_Node
(
self
,
node
):
def
visit_Node
(
self
,
node
):
line
=
node
.
pos
[
1
]
if
self
.
_line_range
is
None
or
self
.
_line_range
[
0
]
<=
line
<=
self
.
_line_range
[
1
]:
if
len
(
self
.
access_path
)
==
0
:
if
len
(
self
.
access_path
)
==
0
:
name
=
"(root)"
name
=
"(root)"
else
:
else
:
...
...
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