Commit 4b9b6c8a authored by di68kap's avatar di68kap
Browse files

- bugs fixed in parse.py

- LOGGING constant at the beginning of dhparser added
parent 25628e0b
......@@ -1252,10 +1252,7 @@ class Option(UnaryOperator):
super().__init__(parser)
# assert isinstance(parser, Parser)
assert not isinstance(parser, Option), \
"Redundant nesting of options: %s(%s)" % (str(name), str(parser.name))
# assert not isinstance(parser, Required), \
# "Nesting options with required elements is contradictory: " \
# "%s(%s)" % (str(name), str(parser.name))
"Redundant nesting of options: %s" % (str(self.ptype), str(parser.name))
def __call__(self, text: StringView) -> Tuple[Optional[Node], StringView]:
node, text = self.parser(text)
......@@ -1334,7 +1331,7 @@ class OneOrMore(UnaryOperator):
super().__init__(parser)
assert not isinstance(parser, Option), \
"Use ZeroOrMore instead of nesting OneOrMore and Option: " \
"%s(%s)" % (str(name), str(parser.name))
"%s(%s)" % (str(self.ptype), str(parser.name))
def __call__(self, text: StringView) -> Tuple[Optional[Node], StringView]:
results = () # type: Tuple[Node, ...]
......
......@@ -29,6 +29,8 @@ from DHParser.ebnf import get_ebnf_grammar, get_ebnf_transformer, get_ebnf_compi
from DHParser.log import logging
from DHParser.toolkit import re
LOGGING = True
dhparserdir = os.path.dirname(os.path.realpath(__file__))
EBNF_TEMPLATE = r"""-grammar
......@@ -325,7 +327,7 @@ def main():
print('File %s not found! Aborting.' % file_path)
sys.exit(1)
elif choice.strip() == '3':
with logging(False):
with logging(LOGGING):
if not cpu_profile(selftest, 1):
print("Selftest FAILED :-(\n")
sys.exit(1)
......
Markdown is supported
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