Commit fc40ef47 authored by Eckhart Arnold's avatar Eckhart Arnold
Browse files

Merge branch 'master' of

parents d3636965 43bc5127
......@@ -158,7 +158,7 @@ def transformation_factory(t1=None, t2=None, t3=None, t4=None, t5=None):
f = singledispatch(f)
if len(params) == 1 and issubclass(p1type, Container) \
and not issubclass(p1type, Text) and not issubclass(p1type, ByteString):
and not (issubclass(p1type, Text) or issubclass(p1type, ByteString)):
def gen_special(*args):
c = set(args) if issubclass(p1type, AbstractSet) else \
list(args) if issubclass(p1type, Sequence) else args
......@@ -241,8 +241,8 @@ def traverse(root_node: Node,
# Is this optimazation really needed?
if '__cache__' in processing_table:
# assume that processing table has already been expanded
table = processing_table
cache = processing_table['__cache__']
table = processing_table # type: ProcessingTableType
cache = processing_table['__cache__'] # type: Dictionary[str, List[Callable]]
# normalize processing_table entries by turning single values
# into lists with a single value
......@@ -261,6 +261,7 @@ def traverse(root_node: Node,
# cache = {} # type: Dict[str, List[Callable]]
def traverse_recursive(context):
nonlocal cache
node = context[-1]
if node.children:
for child in node.result:
......@@ -385,8 +386,7 @@ def is_token(context: List[Node], tokens: AbstractSet[str] = frozenset()) -> boo
"""Checks whether the last node in the context has `ptype == TOKEN_PTYPE`
and it's content matches one of the given tokens. Leading and trailing
whitespace-tokens will be ignored. In case an empty set of tokens is passed,
any token is a match. If only ":" is given all anonymous tokens but no other
tokens are a match.
any token is a match.
def stripped(nd: Node) -> str:
"""Removes leading and trailing whitespace-nodes from content."""
......@@ -54,7 +54,7 @@ def fail_on_error(src, result):
def tst_func():
with DHParser.log.logging(True):
with DHParser.log.logging(False):
if not os.path.exists('REPORT'):
files = os.listdir('testdata')
Supports Markdown
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