Revision 1070
Added by Aaron Marcuse-Kubitza almost 13 years ago
lib/xpath.py | ||
---|---|---|
72 | 72 |
|
73 | 73 |
def is_id(path): return path[0].is_attr and path[0].name == 'id' |
74 | 74 |
|
75 |
def is_instance(elem): return elem.keys != [] and is_id(elem.keys[0])
|
|
75 |
def is_instance(elem): return elem.keys != [] and is_id(elem.keys[0]) |
|
76 | 76 |
|
77 | 77 |
##### Parsing |
78 | 78 |
|
... | ... | |
96 | 96 |
while True: |
97 | 97 |
# Split path |
98 | 98 |
if parser.str_('{'): |
99 |
tree[-1].other_branches = _paths() |
|
99 |
last = tree[-1] |
|
100 |
last.other_branches = _paths() |
|
100 | 101 |
parser.str_('}', required=True) |
101 |
tree += tree[-1].other_branches.pop(0) # use first path for now |
|
102 |
break # nothing allowed after split path |
|
102 |
if parser.str_('/'): # common subpath after {} |
|
103 |
subpath = _path() |
|
104 |
for branch in last.other_branches: branch += subpath |
|
105 |
tree += last.other_branches.pop(0) # use first path for now |
|
106 |
break # anything after split path has already been parsed |
|
103 | 107 |
|
104 | 108 |
elem = XpathElem(is_attr=parser.str_('@'), name=_value()) |
105 | 109 |
|
Also available in: Unified diff
xpath.py: Added support for common subpath after split path's {}