Browse Source

Fixed docs. Added support for hashing ParserPuppet

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.10.0
Erez Sh 4 years ago
parent
commit
b87acedac4
2 changed files with 4 additions and 1 deletions
  1. +1
    -1
      docs/grammar.md
  2. +3
    -0
      lark/parsers/lalr_puppet.py

+ 1
- 1
docs/grammar.md View File

@@ -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


+ 3
- 0
lark/parsers/lalr_puppet.py View File

@@ -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:"]


Loading…
Cancel
Save