Revision 1350
Added by Aaron Marcuse-Kubitza almost 13 years ago
lib/xpath.py | ||
---|---|---|
47 | 47 |
|
48 | 48 |
##### Paths |
49 | 49 |
|
50 |
def path_is_empty(path): return path == [] or path == [empty_elem] |
|
51 |
|
|
50 | 52 |
def is_positive(path): return path[0].is_positive |
51 | 53 |
|
52 | 54 |
def is_rooted(path): return elem_is_empty(path[0]) |
... | ... | |
176 | 178 |
|
177 | 179 |
def _paths(): |
178 | 180 |
paths = [] |
179 |
while True: |
|
180 |
paths.append(_path()) |
|
181 |
if not parser.str_(','): break |
|
181 |
path = _path() |
|
182 |
if not path_is_empty(path): # not empty list |
|
183 |
paths.append(path) |
|
184 |
while parser.str_(','): paths.append(_path()) |
|
182 | 185 |
return paths |
183 | 186 |
|
184 | 187 |
path = _path() |
Also available in: Unified diff
xpath.py: parse() Fixed bug in _paths() where empty lists would be parsed as a list containing a single empty path, instead of as an empty list