diff --git a/regexp.py b/regexp.py --- a/regexp.py +++ b/regexp.py @@ -21,6 +21,19 @@ class Token: pass +class Lambda(Token): + is_skippable = True + + def list_first(self): + yield from [] + + def list_last(self): + yield from [] + + def list_neighbours(self): + yield from [] + + class Symbol(Token): def __init__(self, position, value): self.position = position @@ -188,6 +201,9 @@ def parse(pattern, offset=0): is_alternative = True res.append(AlternativeSeparator()) i += 1 + elif c == "_": + res.append(Lambda()) + i += 1 else: res.append(Symbol(i+offset, c)) i += 1