From 8f03f81fb475a338cf33ddfdec2b4eebcfa69f09 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= <hugo@lysator.liu.se>
Date: Sat, 16 Sep 2023 03:22:48 +0200
Subject: [PATCH] Clean up parser combinator.

---
 muppet/parser_combinator.py | 48 -------------------------------------
 1 file changed, 48 deletions(-)

diff --git a/muppet/parser_combinator.py b/muppet/parser_combinator.py
index fa7ca95..06ff8da 100644
--- a/muppet/parser_combinator.py
+++ b/muppet/parser_combinator.py
@@ -333,22 +333,6 @@ class name(ParseDirective):
         return f'{self.name}'
 
 
-# @dataclass
-# class optional(ParseDirective):
-#     """An optional parameter."""
-#
-#     form: 'Items'
-#
-#     def run(self, parser: 'ParserCombinator') -> list[MatchObject]:  # noqa: D102
-#         try:
-#             return parser.get(self.form)
-#         except ParseError:
-#             return []
-#
-#     def __repr__(self) -> str:
-#         return f'optional({repr(self.form)})'
-
-
 def optional(parser: ParseDirective) -> ParseDirective:
     """Optionally parse parameter."""
     return parser | nop
@@ -503,17 +487,6 @@ class count(ParseDirective):
         return f'count({repr(self.parser)}, {self.min}, {self.max})'
 
 
-# @dataclass
-# class discard(ParseDirective):
-#     """Run parser, but discard the result."""
-#
-#     parser: Items
-#
-#     def run(self, parser: 'ParserCombinator') -> list[MatchObject]:  # noqa: D102
-#         parser.get(self.parser)
-#         return []
-
-
 def discard(parser: Items) -> ParseDirective:
     """Run parser, but discard the result."""
     return s(parser) @ (lambda _: [])
@@ -645,27 +618,6 @@ class tag(ParseDirective):
         return [MatchCompound(type=self.tag, matched=result)]
 
 
-# @dataclass
-# class delimited(ParseDirective):
-#     """
-#     Read an infix delimited list of items.
-#
-#     If a optional trailing "comma" is wanted:
-#
-#     .. code-block:: python
-#
-#         and_(delimited(and_(ws, ',', ws),
-#                        ITEM),
-#             optional(ws, ','))
-#     """
-#
-#     delim: 'Items'
-#     parser: 'Items'
-#
-#     def run(self, parser: 'ParserCombinator') -> list[MatchObject]:  # noqa: D102
-#         return parser.get(and_(self.parser, many(and_(self.delim, self.parser))))
-
-
 def delimited(delim: Items, parser: Items) -> ParseDirective:
     """
     Read an infix delimited list of items.
-- 
GitLab