Skip to content
Snippets Groups Projects
Commit f39f0a1f authored by Hugo Hörnquist's avatar Hugo Hörnquist
Browse files

Improve documentation and output for `name` and `tag` in parser combinator.

parent 71962647
No related branches found
No related tags found
No related merge requests found
......@@ -383,7 +383,7 @@ class name(ParseDirective):
return parser.get(self.form)
def __repr__(self) -> str:
return f'{self.name}'
return f'[{self.name}]'
def optional(parser: ParseDirective) -> ParseDirective:
......@@ -670,6 +670,9 @@ class tag(ParseDirective):
result = parser.get(self.parser)
return [MatchCompound(type=self.tag, matched=result)]
def __repr__(self) -> str:
return f'{self.tag}({self.parser!r})'
def delimited(delim: Items, parser: Items) -> ParseDirective:
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment