Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: c05d105920
Fetching contributors…

Cannot retrieve contributors at this time

27 lines (19 sloc) 0.483 kb
import refo
def path_function(x):
def f(xs):
if x in xs:
return x * x
return None
return f
x = refo.Predicate(path_function(1))
y = refo.Predicate(path_function(2))
z = refo.Predicate(path_function(3))
seq = [[1, 2], # x and y
[1], # x
[1, 2, 3], # x, y and z
[3], # z
[0, 4, 5],
[]]
regex = refo.Star(y) + refo.Plus(x + z)
m = refo.match(regex, seq, keep_path=True)
print m.get_path()
Jump to Line
Something went wrong with that request. Please try again.