Commit 3f0c8240 authored by Eckhart Arnold's avatar Eckhart Arnold
Browse files

parser.py - sequeeze tight added

parent 9f2e21da
......@@ -618,7 +618,7 @@ class Parser:
assert proxy.__self__ == self
self._parse_proxy = cast(ParseFunc, proxy)
def with_pname(self, pname: str) -> 'Parser':
def name(self, pname: str) -> 'Parser':
"""Sets the parser name to `pname` and returns `self`."""
self.pname = pname
self.tag_name = pname or self.ptype
......@@ -2172,7 +2172,7 @@ def OutputOptimization(root_parser: Parser, level: int = CombinedParser.FLATTEN)
>>> print(tree.as_sxpr())
(root "AB")
>>> root = Text('A') + Text('B') + (Text('C').with_pname('important') | Text('D'))
>>> root = Text('A') + Text('B') + (Text('C').name('important') | Text('D'))
>>> grammar = Grammar(OutputOptimization(root, CombinedParser.NO_TREE_REDUCTION))
>>> tree = grammar('ABC')
>>> print(tree.as_sxpr())
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment