Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
badw-it
DHParser
Commits
e24c1ff6
Commit
e24c1ff6
authored
Dec 26, 2018
by
Eckhart Arnold
Browse files
- dead code removal
parent
3fbcf6cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
DHParser/parse.py
View file @
e24c1ff6
...
...
@@ -92,43 +92,6 @@ MAX_DROPOUTS = 3 # type: int
# stop trying to recover parsing after so many errors
class
ParserError
(
Exception
):
"""
A `ParserError` is thrown for those parser errors that allow the
controlled re-entrance of the parsion process after the error occured.
If a reentry-rule has been configured for the parser where the error
occured, the parser guard can resume the parsing process.
Currently, the only case when a `ParserError` is thrown (and not some
different kind of error like `UnknownParserError`, is when a `Series`-
detects a missing mandatory element.
"""
def
__init__
(
self
,
parser
:
ParserBase
,
node
:
Node
,
remaining
:
StringView
,
error
:
Error
):
self
.
parser
=
parser
# type: Parser
self
.
node
=
node
# type: Node
self
.
remaining
=
remaining
# type: StringView
self
.
error
=
error
# type: Error
@
property
def
location
(
self
):
return
self
.
parser
.
grammar
.
document_length__
-
len
(
self
.
remaining
)
# to be continued...
# class ReentryRule:
# """
# A rule for reentering the parsing process after a ParserError was thrown.
# """
# def __init__(self, parser: ParserBase, fast_forward_re: str):
# self.parser = parser # type: List[Parser]
# self.rules = # type: Sequence[Tuple[str, str]]
def
add_parser_guard
(
parser_func
):
"""
Add a wrapper function to a parser functions (i.e. Parser.__call__ method)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment