The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 48920684 authored by eckhart's avatar eckhart
Browse files

- transformation.py: keep replace_by_single_child and content_from_single_child as an optimization

parent 6cba61bd
...@@ -77,7 +77,7 @@ from DHParser import logging, is_filename, load_if_file, \\ ...@@ -77,7 +77,7 @@ from DHParser import logging, is_filename, load_if_file, \\
last_value, counterpart, accumulate, PreprocessorFunc, \\ last_value, counterpart, accumulate, PreprocessorFunc, \\
Node, TransformationFunc, TransformationDict, \\ Node, TransformationFunc, TransformationDict, \\
traverse, remove_children_if, merge_children, is_anonymous, \\ traverse, remove_children_if, merge_children, is_anonymous, \\
content_from_child, replace_by_child, replace_or_reduce, remove_whitespace, \\ content_from_sinlge_child, replace_by_single_child, replace_or_reduce, remove_whitespace, \\
remove_expendables, remove_empty, remove_tokens, flatten, is_whitespace, \\ remove_expendables, remove_empty, remove_tokens, flatten, is_whitespace, \\
is_empty, is_expendable, collapse, replace_content, WHITESPACE_PTYPE, TOKEN_PTYPE, \\ is_empty, is_expendable, collapse, replace_content, WHITESPACE_PTYPE, TOKEN_PTYPE, \\
remove_nodes, remove_content, remove_brackets, replace_parser, \\ remove_nodes, remove_content, remove_brackets, replace_parser, \\
......
...@@ -27,7 +27,7 @@ from DHParser.parsers import Grammar, mixin_comment, nil_preprocessor, Forward, ...@@ -27,7 +27,7 @@ from DHParser.parsers import Grammar, mixin_comment, nil_preprocessor, Forward,
from DHParser.syntaxtree import Node, TransformationFunc, WHITESPACE_PTYPE, TOKEN_PTYPE from DHParser.syntaxtree import Node, TransformationFunc, WHITESPACE_PTYPE, TOKEN_PTYPE
from DHParser.toolkit import load_if_file, escape_re, md5, sane_parser_name, re, typing from DHParser.toolkit import load_if_file, escape_re, md5, sane_parser_name, re, typing
from DHParser.transform import traverse, remove_brackets, \ from DHParser.transform import traverse, remove_brackets, \
content_from_child, replace_by_child, remove_expendables, \ content_from_sinlge_child, replace_by_single_child, remove_expendables, \
remove_tokens, flatten, forbid, assert_content, remove_infix_operator remove_tokens, flatten, forbid, assert_content, remove_infix_operator
from DHParser.versionnumber import __version__ from DHParser.versionnumber import __version__
from typing import Callable, Dict, List, Set, Tuple from typing import Callable, Dict, List, Set, Tuple
...@@ -198,30 +198,30 @@ EBNF_AST_transformation_table = { ...@@ -198,30 +198,30 @@ EBNF_AST_transformation_table = {
"+": "+":
remove_expendables, remove_expendables,
"syntax": "syntax":
[], # otherwise '"*": replace_by_child' would be applied [], # otherwise '"*": replace_by_single_child' would be applied
"directive, definition": "directive, definition":
remove_tokens('@', '='), remove_tokens('@', '='),
"expression": "expression":
[replace_by_child, flatten, remove_tokens('|')], # remove_infix_operator], [replace_by_single_child, flatten, remove_tokens('|')], # remove_infix_operator],
"term": "term":
[replace_by_child, flatten], # supports both idioms: "{ factor }+" and "factor { factor }" [replace_by_single_child, flatten], # supports both idioms: "{ factor }+" and "factor { factor }"
"factor, flowmarker, retrieveop": "factor, flowmarker, retrieveop":
replace_by_child, replace_by_single_child,
"group": "group":
[remove_brackets, replace_by_child], [remove_brackets, replace_by_single_child],
"unordered": "unordered":
remove_brackets, remove_brackets,
"oneormore, repetition, option": "oneormore, repetition, option":
[content_from_child, remove_brackets, [content_from_sinlge_child, remove_brackets,
forbid('repetition', 'option', 'oneormore'), assert_content(r'(?!§)')], forbid('repetition', 'option', 'oneormore'), assert_content(r'(?!§)')],
"symbol, literal, regexp": "symbol, literal, regexp":
content_from_child, content_from_sinlge_child,
(TOKEN_PTYPE, WHITESPACE_PTYPE): (TOKEN_PTYPE, WHITESPACE_PTYPE):
content_from_child, content_from_sinlge_child,
"list_": "list_":
[flatten, remove_infix_operator], [flatten, remove_infix_operator],
"*": "*":
replace_by_child replace_by_single_child
} }
...@@ -438,10 +438,10 @@ class EBNFCompiler(Compiler): ...@@ -438,10 +438,10 @@ class EBNFCompiler(Compiler):
if rule.startswith('Alternative'): if rule.startswith('Alternative'):
transformations = '[replace_or_reduce]' transformations = '[replace_or_reduce]'
elif rule.startswith('Synonym'): elif rule.startswith('Synonym'):
transformations = '[content_from_child]' transformations = '[content_from_sinlge_child]'
transtable.append(' "' + name + '": %s,' % transformations) transtable.append(' "' + name + '": %s,' % transformations)
transtable.append(' ":Token, :RE": content_from_child,') transtable.append(' ":Token, :RE": content_from_sinlge_child,')
transtable += [' "*": replace_by_child', '}', ''] transtable += [' "*": replace_by_single_child', '}', '']
transtable += [TRANSFORMER_FACTORY.format(NAME=self.grammar_name)] transtable += [TRANSFORMER_FACTORY.format(NAME=self.grammar_name)]
return '\n'.join(transtable) return '\n'.join(transtable)
......
...@@ -36,8 +36,8 @@ __all__ = ('TransformationDict', ...@@ -36,8 +36,8 @@ __all__ = ('TransformationDict',
'key_tag_name', 'key_tag_name',
'traverse', 'traverse',
'is_named', 'is_named',
'replace_by_child', 'replace_by_single_child',
'content_from_child', 'content_from_sinlge_child',
'replace_or_reduce', 'replace_or_reduce',
'replace_parser', 'replace_parser',
'collapse', 'collapse',
...@@ -202,8 +202,8 @@ def traverse(root_node: Node, ...@@ -202,8 +202,8 @@ def traverse(root_node: Node,
key_func yields node.parser.name. key_func yields node.parser.name.
Example: Example:
table = { "term": [replace_by_child, flatten], table = { "term": [replace_by_single_child, flatten],
"factor, flowmarker, retrieveop": replace_by_child } "factor, flowmarker, retrieveop": replace_by_single_child }
traverse(node, table) traverse(node, table)
""" """
# Is this optimazation really needed? # Is this optimazation really needed?
...@@ -317,6 +317,8 @@ def replace_by_child(context: List[Node], criteria: CriteriaType=single_child): ...@@ -317,6 +317,8 @@ def replace_by_child(context: List[Node], criteria: CriteriaType=single_child):
a boolean-valued function on the context of the child. a boolean-valued function on the context of the child.
If no child matching the criteria is found, the node will If no child matching the criteria is found, the node will
not be replaced. not be replaced.
With the default value for `criteria` the same semantics is
the same that of `replace_by_single_child`.
""" """
child = pick_child(context, criteria) child = pick_child(context, criteria)
if child: if child:
...@@ -333,6 +335,8 @@ def content_from_child(context: List[None], criteria: CriteriaType=single_child) ...@@ -333,6 +335,8 @@ def content_from_child(context: List[None], criteria: CriteriaType=single_child)
name or a boolean-valued function on the context of the child. name or a boolean-valued function on the context of the child.
If no child matching the criteria is found, the node will If no child matching the criteria is found, the node will
not be replaced. not be replaced.
With the default value for `criteria` this has the same semantics
as `content_from_single_child`.
""" """
child = pick_child(context, criteria) child = pick_child(context, criteria)
if child: if child:
...@@ -340,26 +344,26 @@ def content_from_child(context: List[None], criteria: CriteriaType=single_child) ...@@ -340,26 +344,26 @@ def content_from_child(context: List[None], criteria: CriteriaType=single_child)
# def replace_by_child(context: List[Node]): def replace_by_single_child(context: List[Node]):
# """ """
# Remove single branch node, replacing it by its immediate descendant Remove single branch node, replacing it by its immediate descendant.
# if and only if the condition on the descendant is true. If there are more than one children, no replacement takes place.
# """ """
# node = context[-1] node = context[-1]
# if len(node.children) == 1: if len(node.children) == 1:
# replace_by(node, node.children[0]) replace_by(node, node.children[0])
#
#
# def content_from_child(context: List[Node]): def content_from_sinlge_child(context: List[Node]):
# """ """
# Reduce a single branch node, by transferring the result of its Reduce a single branch node by transferring the result of its
# immediate descendant to this node, but keeping this node's parser entry. immediate descendant to this node, but keeping this node's parser entry.
# If the condition evaluates to false on the descendant, it will not This will only be done if the last node in the context has is exactly
# be reduced. one child.
# """ """
# node = context[-1] node = context[-1]
# if len(node.children) == 1: if len(node.children) == 1:
# reduce_child(node, node.children[0]) reduce_child(node, node.children[0])
def is_named(context: List[Node]) -> bool: def is_named(context: List[Node]) -> bool:
......
...@@ -368,20 +368,20 @@ scroll down to the AST section, you'll see something like this: ...@@ -368,20 +368,20 @@ scroll down to the AST section, you'll see something like this:
"+": remove_empty, "+": remove_empty,
"bibliographisches": [remove_nodes('NZ'), remove_tokens], "bibliographisches": [remove_nodes('NZ'), remove_tokens],
"autor, werk, untertitel, ort": [], "autor, werk, untertitel, ort": [],
"jahr": [content_from_child], "jahr": [content_from_sinlge_child],
"wortfolge": [flatten(is_one_of('WORT'), recursive=False), remove_last(is_whitespace), collapse], "wortfolge": [flatten(is_one_of('WORT'), recursive=False), remove_last(is_whitespace), collapse],
"namenfolge": [flatten(is_one_of('NAME'), recursive=False), remove_last(is_whitespace), collapse], "namenfolge": [flatten(is_one_of('NAME'), recursive=False), remove_last(is_whitespace), collapse],
"verknüpfung": [remove_tokens('<', '>'), content_from_child], "verknüpfung": [remove_tokens('<', '>'), content_from_sinlge_child],
"ziel": content_from_child, "ziel": content_from_sinlge_child,
"gedicht, strophe, text": [flatten, remove_nodes('LEERZEILE'), remove_nodes('NZ')], "gedicht, strophe, text": [flatten, remove_nodes('LEERZEILE'), remove_nodes('NZ')],
"titel, serie": [flatten, remove_nodes('LEERZEILE'), remove_nodes('NZ'), collapse], "titel, serie": [flatten, remove_nodes('LEERZEILE'), remove_nodes('NZ'), collapse],
"vers": collapse, "vers": collapse,
"zeile": [], "zeile": [],
"ZEICHENFOLGE, NZ, JAHRESZAHL": content_from_child, "ZEICHENFOLGE, NZ, JAHRESZAHL": content_from_sinlge_child,
"WORT, NAME, LEERZEILE, ENDE": [], "WORT, NAME, LEERZEILE, ENDE": [],
":Whitespace": replace_content(lambda node : " "), ":Whitespace": replace_content(lambda node : " "),
":Token, :RE": content_from_child, ":Token, :RE": content_from_sinlge_child,
"*": replace_by_child "*": replace_by_single_child
} }
As you can see, AST-transformations a specified declaratively (with the As you can see, AST-transformations a specified declaratively (with the
......
...@@ -25,7 +25,7 @@ from DHParser import logging, is_filename, load_if_file, \ ...@@ -25,7 +25,7 @@ from DHParser import logging, is_filename, load_if_file, \
last_value, counterpart, accumulate, PreprocessorFunc, \ last_value, counterpart, accumulate, PreprocessorFunc, \
Node, TransformationFunc, TransformationDict, TRUE_CONDITION, \ Node, TransformationFunc, TransformationDict, TRUE_CONDITION, \
traverse, remove_children_if, merge_children, is_anonymous, \ traverse, remove_children_if, merge_children, is_anonymous, \
content_from_child, replace_by_child, replace_or_reduce, remove_whitespace, \ content_from_sinlge_child, replace_by_single_child, replace_or_reduce, remove_whitespace, \
remove_expendables, remove_empty, remove_tokens, flatten, is_whitespace, \ remove_expendables, remove_empty, remove_tokens, flatten, is_whitespace, \
is_empty, is_expendable, collapse, replace_content, remove_nodes, remove_content, remove_brackets, replace_parser, \ is_empty, is_expendable, collapse, replace_content, remove_nodes, remove_content, remove_brackets, replace_parser, \
keep_children, is_one_of, has_content, apply_if, remove_first, remove_last, \ keep_children, is_one_of, has_content, apply_if, remove_first, remove_last, \
...@@ -159,8 +159,8 @@ BibTeX_AST_transformation_table = { ...@@ -159,8 +159,8 @@ BibTeX_AST_transformation_table = {
"content": [replace_or_reduce], "content": [replace_or_reduce],
"plain_content": [], "plain_content": [],
"text": [], "text": [],
":Token, :RE": content_from_child, ":Token, :RE": content_from_sinlge_child,
"*": replace_by_child "*": replace_by_single_child
} }
......
...@@ -22,7 +22,7 @@ from DHParser import logging, is_filename, load_if_file, \ ...@@ -22,7 +22,7 @@ from DHParser import logging, is_filename, load_if_file, \
last_value, counterpart, accumulate, PreprocessorFunc, \ last_value, counterpart, accumulate, PreprocessorFunc, \
Node, TransformationFunc, TransformationDict, TRUE_CONDITION, \ Node, TransformationFunc, TransformationDict, TRUE_CONDITION, \
traverse, remove_children_if, merge_children, is_anonymous, \ traverse, remove_children_if, merge_children, is_anonymous, \
content_from_child, replace_by_child, replace_or_reduce, remove_whitespace, \ content_from_sinlge_child, replace_by_single_child, replace_or_reduce, remove_whitespace, \
remove_expendables, remove_empty, remove_tokens, flatten, is_whitespace, \ remove_expendables, remove_empty, remove_tokens, flatten, is_whitespace, \
is_empty, is_expendable, collapse, replace_content, WHITESPACE_PTYPE, TOKEN_PTYPE, \ is_empty, is_expendable, collapse, replace_content, WHITESPACE_PTYPE, TOKEN_PTYPE, \
remove_nodes, remove_content, remove_brackets, replace_parser, \ remove_nodes, remove_content, remove_brackets, replace_parser, \
...@@ -156,8 +156,8 @@ EBNF_AST_transformation_table = { ...@@ -156,8 +156,8 @@ EBNF_AST_transformation_table = {
"regexp": [], "regexp": [],
"list_": [], "list_": [],
"EOF": [], "EOF": [],
":Token, :RE": content_from_child, ":Token, :RE": content_from_sinlge_child,
"*": replace_by_child "*": replace_by_single_child
} }
......
...@@ -21,7 +21,7 @@ from DHParser import logging, is_filename, Grammar, Compiler, Lookbehind, Altern ...@@ -21,7 +21,7 @@ from DHParser import logging, is_filename, Grammar, Compiler, Lookbehind, Altern
ZeroOrMore, Forward, NegativeLookahead, mixin_comment, compile_source, \ ZeroOrMore, Forward, NegativeLookahead, mixin_comment, compile_source, \
PreprocessorFunc, TransformationDict, \ PreprocessorFunc, TransformationDict, \
Node, TransformationFunc, traverse, remove_children_if, is_anonymous, \ Node, TransformationFunc, traverse, remove_children_if, is_anonymous, \
content_from_child, replace_by_child, remove_whitespace, \ content_from_sinlge_child, replace_by_single_child, remove_whitespace, \
flatten, is_empty, collapse, replace_content, remove_brackets, is_one_of, remove_first, \ flatten, is_empty, collapse, replace_content, remove_brackets, is_one_of, remove_first, \
remove_tokens, remove_nodes, TOKEN_PTYPE remove_tokens, remove_nodes, TOKEN_PTYPE
...@@ -389,52 +389,52 @@ LaTeX_AST_transformation_table = { ...@@ -389,52 +389,52 @@ LaTeX_AST_transformation_table = {
"latexdoc": [], "latexdoc": [],
"preamble": [], "preamble": [],
"document": [flatten_structure], "document": [flatten_structure],
"frontpages": content_from_child, "frontpages": content_from_sinlge_child,
"Chapters, Sections, SubSections, SubSubSections, Paragraphs, SubParagraphs": [], "Chapters, Sections, SubSections, SubSubSections, Paragraphs, SubParagraphs": [],
"Chapter, Section, SubSection, SubSubSection, Paragraph, SubParagraph": [], "Chapter, Section, SubSection, SubSubSection, Paragraph, SubParagraph": [],
"heading": content_from_child, "heading": content_from_sinlge_child,
"Bibliography": [], "Bibliography": [],
"Index": [], "Index": [],
"block_environment": replace_by_child, "block_environment": replace_by_single_child,
"known_environment": replace_by_child, "known_environment": replace_by_single_child,
"generic_block": [], "generic_block": [],
"begin_generic_block, end_generic_block": [remove_nodes('NEW_LINE'), replace_by_child], "begin_generic_block, end_generic_block": [remove_nodes('NEW_LINE'), replace_by_single_child],
"itemize, enumerate": [remove_brackets, flatten], "itemize, enumerate": [remove_brackets, flatten],
"item": [], "item": [],
"figure": [], "figure": [],
"quotation": [content_from_child, remove_brackets], "quotation": [content_from_sinlge_child, remove_brackets],
"verbatim": [], "verbatim": [],
"tabular": [], "tabular": [],
"tabular_config, block_of_paragraphs": [remove_brackets, content_from_child], "tabular_config, block_of_paragraphs": [remove_brackets, content_from_sinlge_child],
"tabular_row": [flatten, remove_tokens('&', '\\')], "tabular_row": [flatten, remove_tokens('&', '\\')],
"tabular_cell": [flatten, remove_whitespace], "tabular_cell": [flatten, remove_whitespace],
"multicolumn": [remove_tokens('{', '}')], "multicolumn": [remove_tokens('{', '}')],
"hline": [remove_whitespace, content_from_child], "hline": [remove_whitespace, content_from_sinlge_child],
"sequence": [flatten], "sequence": [flatten],
"paragraph": [flatten], "paragraph": [flatten],
"text_element": replace_by_child, "text_element": replace_by_single_child,
"line_element": replace_by_child, "line_element": replace_by_single_child,
"inline_environment": replace_by_child, "inline_environment": replace_by_single_child,
"known_inline_env": replace_by_child, "known_inline_env": replace_by_single_child,
"generic_inline_env": [], "generic_inline_env": [],
"begin_inline_env, end_inline_env": [replace_by_child], "begin_inline_env, end_inline_env": [replace_by_single_child],
"begin_environment, end_environment": [remove_brackets, content_from_child], "begin_environment, end_environment": [remove_brackets, content_from_sinlge_child],
"inline_math": [remove_brackets, content_from_child], "inline_math": [remove_brackets, content_from_sinlge_child],
"command": replace_by_child, "command": replace_by_single_child,
"known_command": replace_by_child, "known_command": replace_by_single_child,
"text_command": [], "text_command": [],
"generic_command": [flatten], "generic_command": [flatten],
"footnote": [], "footnote": [],
"includegraphics": [], "includegraphics": [],
"caption": [], "caption": [],
"config": [remove_brackets, content_from_child], "config": [remove_brackets, content_from_sinlge_child],
"block": [remove_brackets, flatten, replace_by_child], "block": [remove_brackets, flatten, replace_by_single_child],
"text": collapse, "text": collapse,
"no_command, blockcmd": [], "no_command, blockcmd": [],
"structural": [], "structural": [],
"CMDNAME": [remove_whitespace, content_from_child], "CMDNAME": [remove_whitespace, content_from_sinlge_child],
"TXTCOMMAND": [remove_whitespace, content_from_child], "TXTCOMMAND": [remove_whitespace, content_from_sinlge_child],
"NAME": [content_from_child, remove_whitespace, content_from_child], "NAME": [content_from_sinlge_child, remove_whitespace, content_from_sinlge_child],
"ESCAPED": [replace_content(lambda node: str(node)[1:])], "ESCAPED": [replace_content(lambda node: str(node)[1:])],
"BRACKETS": [], "BRACKETS": [],
"TEXTCHUNK": [], "TEXTCHUNK": [],
...@@ -445,10 +445,10 @@ LaTeX_AST_transformation_table = { ...@@ -445,10 +445,10 @@ LaTeX_AST_transformation_table = {
"BACKSLASH": [], "BACKSLASH": [],
"EOF": [], "EOF": [],
":Token": ":Token":
[remove_whitespace, content_from_child], [remove_whitespace, content_from_sinlge_child],
":RE": replace_by_child, ":RE": replace_by_single_child,
":Whitespace": streamline_whitespace, ":Whitespace": streamline_whitespace,
"*": replace_by_child "*": replace_by_single_child
} }
......
...@@ -22,7 +22,7 @@ from DHParser import logging, is_filename, load_if_file, \ ...@@ -22,7 +22,7 @@ from DHParser import logging, is_filename, load_if_file, \
last_value, counterpart, accumulate, PreprocessorFunc, \ last_value, counterpart, accumulate, PreprocessorFunc, \
Node, TransformationFunc, TransformationDict, \ Node, TransformationFunc, TransformationDict, \
traverse, remove_children_if, merge_children, is_anonymous, \ traverse, remove_children_if, merge_children, is_anonymous, \
content_from_child, replace_by_child, replace_or_reduce, remove_whitespace, \ content_from_sinlge_child, replace_by_single_child, replace_or_reduce, remove_whitespace, \
remove_expendables, remove_empty, remove_tokens, flatten, is_whitespace, \ remove_expendables, remove_empty, remove_tokens, flatten, is_whitespace, \
is_empty, is_expendable, collapse, replace_content, remove_nodes, remove_content, remove_brackets, replace_parser, \ is_empty, is_expendable, collapse, replace_content, remove_nodes, remove_content, remove_brackets, replace_parser, \
keep_children, is_one_of, has_content, apply_if, remove_first, remove_last keep_children, is_one_of, has_content, apply_if, remove_first, remove_last
...@@ -471,7 +471,7 @@ def get_grammar() -> MLWGrammar: ...@@ -471,7 +471,7 @@ def get_grammar() -> MLWGrammar:
MLW_AST_transformation_table = { MLW_AST_transformation_table = {
# AST Transformations for the MLW-grammar # AST Transformations for the MLW-grammar
"+": remove_empty, "+": remove_empty,
"Autor": [content_from_child], "Autor": [content_from_sinlge_child],
"Artikel": [], "Artikel": [],
"LemmaPosition": [], "LemmaPosition": [],
"Lemma": [], "Lemma": [],
...@@ -490,11 +490,11 @@ MLW_AST_transformation_table = { ...@@ -490,11 +490,11 @@ MLW_AST_transformation_table = {
"EtymologiePosition": [], "EtymologiePosition": [],
"EtymologieVarianten": [], "EtymologieVarianten": [],
"EtymologieVariante": [], "EtymologieVariante": [],
"ArtikelKopf": [replace_by_child], "ArtikelKopf": [replace_by_single_child],
"SchreibweisenPosition": [], "SchreibweisenPosition": [],
"SWTyp": [replace_or_reduce], "SWTyp": [replace_or_reduce],
"SWVariante": [], "SWVariante": [],
"Schreibweise": [replace_by_child], "Schreibweise": [replace_by_single_child],
"BedeutungsPosition": [], "BedeutungsPosition": [],
"Bedeutung": [], "Bedeutung": [],
"Bedeutungskategorie": [], "Bedeutungskategorie": [],
...@@ -506,15 +506,15 @@ MLW_AST_transformation_table = { ...@@ -506,15 +506,15 @@ MLW_AST_transformation_table = {
"Zusatz": [], "Zusatz": [],
"ArtikelVerfasser": [], "ArtikelVerfasser": [],
"Name": [], "Name": [],
"Stelle": [content_from_child], "Stelle": [content_from_sinlge_child],
"SW_LAT": [replace_or_reduce], "SW_LAT": [replace_or_reduce],
"SW_DEU": [replace_or_reduce], "SW_DEU": [replace_or_reduce],
"SW_GRIECH": [replace_or_reduce], "SW_GRIECH": [replace_or_reduce],
"Beleg": [replace_by_child], "Beleg": [replace_by_single_child],
"Verweis": [], "Verweis": [],
"VerweisZiel": [], "VerweisZiel": [],
"Werk": [content_from_child], "Werk": [content_from_sinlge_child],
"ZielName": [replace_by_child], "ZielName": [replace_by_single_child],
"NAMENS_ABKÜRZUNG": [], "NAMENS_ABKÜRZUNG": [],
"NAME": [], "NAME": [],
"DEU_WORT": [], "DEU_WORT": [],
...@@ -539,8 +539,8 @@ MLW_AST_transformation_table = { ...@@ -539,8 +539,8 @@ MLW_AST_transformation_table = {
"KOMMENTARZEILEN": [], "KOMMENTARZEILEN": [],
"DATEI_ENDE": [], "DATEI_ENDE": [],
"NIEMALS": [], "NIEMALS": [],
":Token, :RE": content_from_child, ":Token, :RE": content_from_sinlge_child,
"*": replace_by_child "*": replace_by_single_child
} }
......
...@@ -22,7 +22,7 @@ from DHParser import logging, is_filename, load_if_file, \ ...@@ -22,7 +22,7 @@ from DHParser import logging, is_filename, load_if_file, \
last_value, counterpart, accumulate, PreprocessorFunc, \ last_value, counterpart, accumulate, PreprocessorFunc, \
Node, TransformationFunc, TransformationDict, TRUE_CONDITION, \ Node, TransformationFunc, TransformationDict, TRUE_CONDITION, \
traverse, remove_children_if, merge_children, is_anonymous, \ traverse, remove_children_if, merge_children, is_anonymous, \
content_from_child, replace_by_child, replace_or_reduce, remove_whitespace, \ content_from_sinlge_child, replace_by_single_child, replace_or_reduce, remove_whitespace, \
remove_expendables, remove_empty, remove_tokens, flatten, is_whitespace, \ remove_expendables, remove_empty, remove_tokens, flatten, is_whitespace, \
is_empty, is_expendable, collapse, replace_content, WHITESPACE_PTYPE, TOKEN_PTYPE, \ is_empty, is_expendable, collapse, replace_content, WHITESPACE_PTYPE, TOKEN_PTYPE, \
remove_nodes, remove_content, remove_brackets, replace_parser, \ remove_nodes, remove_content, remove_brackets, replace_parser, \
...@@ -312,11 +312,11 @@ MLW_AST_transformation_table = { ...@@ -312,11 +312,11 @@ MLW_AST_transformation_table = {
"EtymologiePosition": [], "EtymologiePosition": [],
"EtymologieVarianten": [], "EtymologieVarianten": [],
"EtymologieVariante": [], "EtymologieVariante": [],
"ArtikelKopf": [replace_by_child], "ArtikelKopf": [replace_by_single_child],
"SchreibweisenPosition": [], "SchreibweisenPosition": [],
"SWTyp": [replace_or_reduce], "SWTyp": [replace_or_reduce],
"SWVariante": [], "SWVariante": [],
"Schreibweise": [replace_by_child], "Schreibweise": [replace_by_single_child],
"BedeutungsPosition": [], "BedeutungsPosition": [],
"Bedeutung": [], "Bedeutung": [],
"Bedeutungskategorie": [], "Bedeutungskategorie": [],
...@@ -331,10 +331,10 @@ MLW_AST_transformation_table = { ...@@ -331,10 +331,10 @@ MLW_AST_transformation_table = {
"SW_LAT": [replace_or_reduce], "SW_LAT": [replace_or_reduce],
"SW_DEU": [replace_or_reduce], "SW_DEU": [replace_or_reduce],
"SW_GRIECH": [replace_or_reduce], "SW_GRIECH": [replace_or_reduce],
"Beleg": [replace_by_child], "Beleg": [replace_by_single_child],
"Verweis": [], "Verweis": [],
"VerweisZiel": [], "VerweisZiel": [],
"ZielName": [replace_by_child], "ZielName": [replace_by_single_child],
"NAMENS_ABKÜRZUNG": [], "NAMENS_ABKÜRZUNG": [],
"NAME": [], "NAME": [],
"DEU_WORT": [], "DEU_WORT": [],
...@@ -352,8 +352,8 @@ MLW_AST_transformation_table = { ...@@ -352,8 +352,8 @@ MLW_AST_transformation_table = {
"LZ": [], "LZ": [],
"DATEI_ENDE": [], "DATEI_ENDE": [],
"NIEMALS": [], "NIEMALS": [],
":Token, :RE": content_from_child, ":Token, :RE": content_from_sinlge_child,
"*": replace_by_child "*": replace_by_single_child
} }
......
...@@ -19,11 +19,11 @@ MLW_AST_transformation_table = { ...@@ -19,11 +19,11 @@ MLW_AST_transformation_table = {
"EtymologiePosition": [], "EtymologiePosition": [],
"EtymologieVarianten": [], "EtymologieVarianten": [],
"EtymologieVariante": [], "EtymologieVariante": [],
"ArtikelKopf": [replace_by_child], "ArtikelKopf": [replace_by_single_child],
"SchreibweisenPosition": [], "SchreibweisenPosition": [],
"SWTyp": [replace_or_reduce], "SWTyp": [replace_or_reduce],
"SWVariante": [], "SWVariante": [],
"Schreibweise": [replace_by_child], "Schreibweise": [replace_by_single_child],
"BedeutungsPosition": [], "BedeutungsPosition": [],
"Bedeutung": [],