diff --git a/docs/grammar.md b/docs/grammar.md index e532297..1cd72dd 100644 --- a/docs/grammar.md +++ b/docs/grammar.md @@ -204,7 +204,7 @@ Each item is one of: * `TERMINAL` * `"string literal"` or `/regexp literal/` * `(item item ..)` - Group items -* `[item item ..]` - Maybe. Same as `(item item ..)?`, but generates `None` if there is no match +* `[item item ..]` - Maybe. Same as `(item item ..)?`, but when `maybe_placeholders=True`, generates `None` if there is no match. * `item?` - Zero or one instances of item ("maybe") * `item*` - Zero or more instances of item * `item+` - One or more instances of item diff --git a/lark/parsers/lalr_puppet.py b/lark/parsers/lalr_puppet.py index 40cc0c1..35b2250 100644 --- a/lark/parsers/lalr_puppet.py +++ b/lark/parsers/lalr_puppet.py @@ -88,6 +88,9 @@ class ParserPuppet(object): self._start == other._start ) + def __hash__(self): + return hash((tuple(self._state_stack), self._start)) + def pretty(self): """Print the output of ``choices()`` in a way that's easier to read.""" out = ["Puppet choices:"]