Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing 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 abb84c1c authored by Eckhart Arnold's avatar Eckhart Arnold
Browse files

sync-commit: work on MLW...

parent 82e16eb0
......@@ -1150,24 +1150,16 @@ def flatten(node):
node.result = tuple(new_result)
def remove_tokens(node, tokens):
def remove_tokens(node, tokens={}):
"""Reomoves any among a particular set of tokens from the immediate
descendants of a node.
"""
if node.children:
if tokens:
node.result = tuple(child for child in node.result
if child.parser.name != TOKEN_KEYWORD or
child.result not in tokens)
def remove_all_tokens(node):
"""Removes all tokens from the immediate descendants of a node.
:param node: the node from which children that represent tokens
shall be removed
:return: the node with all children that are tokens removed
"""
if node.children:
else:
node.result = tuple(child for child in node.result
if child.parser.name != TOKEN_KEYWORD)
......
......@@ -100,7 +100,7 @@ class MLWGrammar(ParserHeadquarter):
DATEI_ENDE = !/./
NIEMALS = /(?!.)/
"""
source_hash__ = "d7afa7bb0037ee25c0cabfa6e5a956c6"
source_hash__ = "2c3456ee74172407cbe1f15e3649b41f"
parser_initialization__ = "upon instatiation"
wsp__ = mixin_comment(whitespace=r'\s*', comment=r'#.*(?:\n|$)')
wspL__ = wsp__
......@@ -151,17 +151,26 @@ class MLWGrammar(ParserHeadquarter):
### DON'T EDIT OR REMOVE THIS LINE ###
def test(node):
if node.parser.name == "WORT_KLEIN":
assert False, node.as_sexpr()
node = remove_expendables(node)
node = reduce_single_child(node)
assert False, node.parser.name
return node
def test(node):
print(node.as_sexpr())
return node
def join_strings(node, delimiter='\n'):
new_result = []
n = 0
while n < len(node.result):
nd = node.result[n]
if not nd.children:
a = n
n += 1
while n < len(node.result) and not node.result[n].children:
n += 1
nd.result = delimiter.join((r.result for r in node.result[a:n]))
new_result.append(nd)
node.result = tuple(new_result)
print(node.as_sexpr())
MLWTransTable = {
# AST Transformations for the MLW-grammar
......@@ -174,7 +183,7 @@ MLWTransTable = {
"LemmaVarianten":
[partial(remove_tokens, tokens={'VARIANTEN'}), flatten,
partial(remove_tokens, tokens={',', ';'})],
"LVariante, LVZusatz, Schreibweise":
"LVariante, LVZusatz, Schreibweise, Name":
[remove_expendables, reduce_single_child],
"SWVariante":
[remove_expendables, partial(remove_tokens, tokens={':'})],
......@@ -197,10 +206,12 @@ MLWTransTable = {
"Bedeutung": no_transformation,
"Bedeutungskategorie": no_transformation,
"Interpretamente": no_transformation,
"LateinischeBedeutung": no_transformation,
"DeutscheBedeutung": no_transformation,
"Belege": no_transformation,
"EinBeleg": no_transformation,
"LateinischeBedeutung, DeutscheBedeutung":
[remove_expendables, remove_tokens, reduce_single_child],
"Belege":
[flatten, remove_tokens],
"EinBeleg":
[flatten], # remove_expendables], # join_strings],
"Beleg": no_transformation,
"VerweisZiel": no_transformation,
"WORT, WORT_KLEIN, WORT_GROSS, GROSSSCHRIFT":
......
......@@ -21,7 +21,7 @@ limitations under the License.
import os
import sys
sys.path.append(os.path.abspath('../'))
sys.path.append(os.path.abspath('../../'))
from ParserCombinators import run_compiler
errors = run_compiler("MLW.ebnf")
if errors:
......
......@@ -21,7 +21,7 @@ limitations under the License.
import os
import sys
sys.path.append(os.path.abspath('../'))
sys.path.append(os.path.abspath('../../../'))
import ParserCombinators
from ParserCombinators import run_compiler, has_source_changed
......
......@@ -110,40 +110,17 @@
<Bedeutung>
<Interpretamente>
<LateinischeBedeutung>
<token__>
LAT
</token__>
<RegExp>
pannus, faciale, sudarium
</RegExp>
</LateinischeBedeutung>
<DeutscheBedeutung>
<token__>
DEU
</token__>
<RegExp>
Gesichts-, Schweißtuch [usu liturg.; de re v. p. 32, 63]
</RegExp>
</DeutscheBedeutung>
<Belege>
<token__>
BELEGE
</token__>
<ZeroOrMore>
<Sequence>
<token__>
*
</token__>
<EinBeleg>
<RegExp>
Catal. thes. Germ. 28,11 (post 851) -um III.
</RegExp>
</EinBeleg>
</Sequence>
<Sequence>
<token__>
*
</token__>
<EinBeleg>
<OneOrMore>
<RegExp>
......@@ -154,21 +131,11 @@
</RegExp>
</OneOrMore>
</EinBeleg>
</Sequence>
<Sequence>
<token__>
*
</token__>
<EinBeleg>
<RegExp>
Catal. thes. Germ. 18,7 "-eterculi viginti quatuor".
</RegExp>
</EinBeleg>
</Sequence>
<Sequence>
<token__>
*
</token__>
<EinBeleg>
<OneOrMore>
<RegExp>
......@@ -179,11 +146,6 @@
</RegExp>
</OneOrMore>
</EinBeleg>
</Sequence>
<Sequence>
<token__>
*
</token__>
<EinBeleg>
<OneOrMore>
<RegExp>
......@@ -205,8 +167,6 @@
</RegExp>
</Zusatz>
</EinBeleg>
</Sequence>
</ZeroOrMore>
</Belege>
</Interpretamente>
</Bedeutung>
......@@ -218,40 +178,17 @@
<Bedeutung>
<Interpretamente>
<LateinischeBedeutung>
<token__>
LAT
</token__>
<RegExp>
capital, rica
</RegExp>
</LateinischeBedeutung>
<DeutscheBedeutung>
<token__>
DEU
</token__>
<RegExp>
Kopftuch
</RegExp>
</DeutscheBedeutung>
<Belege>
<token__>
BELEGE
</token__>
<ZeroOrMore>
<Sequence>
<token__>
*
</token__>
<EinBeleg>
<RegExp>
Transl. Libor. I 32 raptis feminarum -is (fa[s]citergiis var. l.).
</RegExp>
</EinBeleg>
</Sequence>
<Sequence>
<token__>
*
</token__>
<EinBeleg>
<OneOrMore>
<RegExp>
......@@ -262,8 +199,6 @@
</RegExp>
</OneOrMore>
</EinBeleg>
</Sequence>
</ZeroOrMore>
</Belege>
</Interpretamente>
</Bedeutung>
......@@ -274,9 +209,7 @@
AUTORIN
</token__>
<Name>
<WORT>
Weber
</WORT>
</Name>
</Autorinfo>
</Artikel>
\ No newline at end of file
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