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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
42ea77b5
Commit
42ea77b5
authored
Sep 18, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support attribute value selection in TreePath
parent
5c5f0717
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
Cython/Compiler/Tests/TestTreePath.py
Cython/Compiler/Tests/TestTreePath.py
+5
-0
Cython/Compiler/TreePath.py
Cython/Compiler/TreePath.py
+7
-3
No files found.
Cython/Compiler/Tests/TestTreePath.py
View file @
42ea77b5
...
...
@@ -24,6 +24,11 @@ class TestTreePath(TransformTest):
self
.
assertEquals
(
1
,
len
(
find_all
(
t
,
"//ReturnStatNode"
)))
self
.
assertEquals
(
1
,
len
(
find_all
(
t
,
"//DefNode//ReturnStatNode"
)))
def
test_node_path_attribute
(
self
):
t
=
self
.
_build_tree
()
self
.
assertEquals
(
2
,
len
(
find_all
(
t
,
"//NameNode/@name"
)))
self
.
assertEquals
([
'fun'
,
'decorator'
],
find_all
(
t
,
"//NameNode/@name"
))
def
test_node_path_child
(
self
):
t
=
self
.
_build_tree
()
self
.
assertEquals
(
1
,
len
(
find_all
(
t
,
"//DefNode/ReturnStatNode/NameNode"
)))
...
...
Cython/Compiler/TreePath.py
View file @
42ea77b5
...
...
@@ -136,8 +136,12 @@ def handle_attribute(next, token):
if token[0]:
raise ValueError("
Expected
attribute
name
")
name = token[1]
token = next()
value = None
try:
token = next()
except StopIteration:
pass
else:
if token[0] == '=':
value = parse_path_value(next)
if value is None:
...
...
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