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
a32d1de2
Commit
a32d1de2
authored
Nov 12, 2017
by
eckhart
Browse files
further cleanups
parent
1fc8788d
Changes
2
Hide whitespace changes
Inline
Side-by-side
DHParser/parser.py
View file @
a32d1de2
...
...
@@ -956,7 +956,7 @@ def dsl_error_msg(parser: Parser, error_str: str) -> str:
########################################################################
RX_PREPROCESSOR_TOKEN
=
re
.
compile
(
'\w+'
)
RX_PREPROCESSOR_TOKEN
=
re
.
compile
(
r
'\w+'
)
BEGIN_TOKEN
=
'
\x1b
'
END_TOKEN
=
'
\x1c
'
...
...
@@ -977,6 +977,7 @@ def make_token(token: str, argument: str = '') -> str:
def
nil_preprocessor
(
text
:
str
)
->
str
:
"""A preprocessor that does nothing, i.e. just returns the input."""
return
text
...
...
@@ -1065,6 +1066,7 @@ class RegExp(Parser):
class
Whitespace
(
RegExp
):
"""A parser class for plain whitespace."""
assert
WHITESPACE_PTYPE
==
":Whitespace"
...
...
DHParser/syntaxtree.py
View file @
a32d1de2
...
...
@@ -88,15 +88,15 @@ class ParserBase:
"""Resets any parser variables. (Should be overridden.)"""
pass
def
grammar
(
self
)
->
Optional
[
'Grammar'
]:
def
grammar
(
self
)
->
Optional
[
object
]:
"""Returns the Grammar object to which the parser belongs. If not
yet connected to any Grammar object, None is returned."""
return
None
def
apply
(
self
,
func
:
Callable
)
->
bool
:
"""Applies the function `func` to the parser. Returns False, if
"""Applies the function `func` to the parser. Returns False, if
- for whatever reason - the functions has not been applied, True
otherwise."""
otherwise."""
return
False
...
...
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