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
10c52b21
Commit
10c52b21
authored
Nov 21, 2017
by
di68kap
Browse files
- stringview.StringView.replace method added
- changes to MLW.ebnf
parent
7fdfefd8
Changes
10
Hide whitespace changes
Inline
Side-by-side
DHParser/parser.py
View file @
10c52b21
...
...
@@ -1431,7 +1431,8 @@ class Series(NaryOperator):
match
=
text
.
search
(
Series
.
RX_ARGUMENT
)
i
=
max
(
1
,
text
.
index
(
match
.
regs
[
1
][
0
]))
if
match
else
1
node
=
Node
(
self
,
text_
[:
i
])
node
.
add_error
(
'%s expected; "%s" found!'
%
(
str
(
parser
),
text_
[:
10
]),
node
.
add_error
(
'%s expected; "%s" found!'
%
(
str
(
parser
),
text_
[:
10
].
replace
(
'
\n
'
,
'
\\
n '
)),
code
=
Error
.
MANDATORY_CONTINUATION
)
text_
=
text_
[
i
:]
results
+=
(
node
,)
...
...
DHParser/stringview.py
View file @
10c52b21
...
...
@@ -256,5 +256,9 @@ class StringView(collections.abc.Sized):
pieces
.
append
(
self
.
text
[
self
.
begin
+
k
:
self
.
end
])
return
pieces
def
replace
(
self
,
old
,
new
):
"""Returns a string where `old` is replaced by `new`."""
return
str
(
self
).
replace
(
old
,
new
)
EMPTY_STRING_VIEW
=
StringView
(
''
)
Introduction.md
View file @
10c52b21
...
...
@@ -333,7 +333,7 @@ strictly separated steps:
what you like.
DHParser automatically only generates a parser for the very first step.
The other steps have to be programmed by hand, though DHParser
makes
The other steps have to be programmed by hand, though DHParser
tries to make those parts as easy as possible. What you have just seen
in your editor is a Pseudo-XML-representation of the concrete syntax
tree. (The output of a parser is always a tree structure, just like
...
...
examples/MLW/Beispiele/facitergula/fascitergula.mlw
View file @
10c52b21
...
...
@@ -17,7 +17,7 @@ GRAMMATIK
SCHREIBWEISE
script.:
vizreg-: ->
ID_0023
vizreg-: ->
Verweis_1
festregel(a): -> v. ibi
fezdregl(a): -> v. ibi
...
...
@@ -34,7 +34,7 @@ BELEGE
* Catal.: thes. Germ.; 18,7 "-eterculi viginti quatuor".
* Libri: confrat. I; app. A 6 p. 137,30 "pulpitum ... -a cocco imaginata
circumdari iussit pontifex."
* {ID
:
0023} Catal.: thes. Germ.; 76,15 "-rulae II"; 40,5 VI "vizregule"; 129a,5 "-sterculas
* {ID
0023} Catal.: thes. Germ.; 76,15 "-rulae II"; 40,5 VI "vizregule"; 129a,5 "-sterculas
II."; 24,8 "-itella X"; 114,8 VIII "fezdreglę"; 6,24 "fasciutercule VII";
92,6 "fascerculę tres"; 21,20 IIII "festregelę"
ZUSATZ saepe.
...
...
examples/MLW/MLW.ebnf
View file @
10c52b21
...
...
@@ -38,7 +38,7 @@ LemmaVarianten = [LZ]
{ LemmaVariante §TR }+
[Zusatz §ABS]
LemmaVariante = LAT_WORT
_TEIL { "-" LAT_WORT_TEIL }
LemmaVariante = LAT_WORT
## GRAMMATIK-POSITION ##
...
...
@@ -62,7 +62,7 @@ genus = "maskulinum" | "m."
| "femininum" | "f."
| "neutrum" | "n."
GrammatikVariante = [wortart ABS] flexion [genus] DPP
{
Beleg }
+
# Beleg { SEM Beleg }
GrammatikVariante = [wortart ABS] flexion [genus] DPP
Beleg { FORTSETZUNG
Beleg } # Beleg { SEM Beleg }
...
...
@@ -91,7 +91,7 @@ VerwechselungPosition = "VERWECHSELBAR" Position
## ARTIKELKOPF POSITIONEN ##
Position = [LZ] §{ Kategorie }+
Kategorie = Besonderheit §DPP [LZ] ( Varianten | { Kategorie }+ )
[LZ]
Kategorie = Besonderheit §DPP [LZ] ( Varianten | { Kategorie }+ )
ZWW
Besonderheit = FREITEXT
Varianten = Variante { ABS Variante }
Variante = !KATEGORIENZEILE Gegenstand DPP Beleg
...
...
@@ -100,15 +100,20 @@ Gegenstand = ZEICHENFOLGE
#### BEDEUTUNGS-POSITION #####################################################
BedeutungsPosition = { "BEDEUTUNG" [LZ] §Bedeutung }+
BedeutungsPosition
= { "BEDEUTUNG" [LZ] §Bedeutung }+
Bedeutung = (Interpretamente | Bedeutungskategorie) [Belege]
Bedeutungskategorie = /(?:(?![A-ZÄÖÜ][A-ZÄÖÜ]).)+/~ [LZ]
Interpretamente = LateinischeBedeutung [LZ] §DeutscheBedeutung [LZ]
LateinischeBedeutung = LAT
/(?:(?![A-ZÄÖÜ][A-ZÄÖÜ]).)+/~
DeutscheBedeutung = DEU
/(?:(?![A-ZÄÖÜ][A-ZÄÖÜ]).)+/~
Bedeutung
= (Interpretamente | Bedeutungskategorie) [Belege]
Bedeutungskategorie
= /(?:(?![A-ZÄÖÜ][A-ZÄÖÜ]).)+/~ [LZ]
Interpretamente
= LateinischeBedeutung [LZ] §DeutscheBedeutung [LZ]
LateinischeBedeutung = LAT
[LZ] LateinischerAusdruck { <","|ZW> LateinischerAusdruck }
DeutscheBedeutung
= DEU
[LZ] DeutscherAusdruck { <","|ZW> DeutscherAusdruck }
Belege = "BELEGE" { ZWW "*" Beleg }+ ABS
LateinischerAusdruck = LAT_WORT { //~ LAT_WORT } [/\s*/ BedeutungsQualifikation]
DeutscherAusdruck = DEU_WORT { //~ DEU_WORT } [/\s*/ BedeutungsQualifikation]
BedeutungsQualifikation = "[" EINZEILER { <SEM|ZW> EINZEILER } §"]"
Belege = "BELEGE" { ZWW "*" Beleg }+ ABS
#### VERWEIS-POSITION #####################################################
...
...
@@ -150,11 +155,11 @@ Zusatz = "ZUSATZ" §{ [TR] zusatz_typ ["."] }+
Beleg = Verweis | Zitat
Zitat = BelegQuelle { SEM Stelle BelegText } [[TR] Zusatz]
BelegQuelle = Autor DPP Werk
BelegText = ~/"/ FREITEXT /"/~ ["."]
BelegText = ~/"/ FREITEXT
§
/"/~ ["."]
Verweis = "->" ZielName
Verweis = "->"
§
ZielName
VerweisZiel = "{" ZielName "}"
ZielName =
BUCHSTABENFOLGE
ZielName =
EINZEILER
Autor = FREITEXT
Werk = FREITEXT
...
...
@@ -169,23 +174,22 @@ NAMENS_ABKÜRZUNG = /[A-ZÄÖÜÁÀÂÓÒÔÚÙÛ]\./~
NAME = /[A-ZÄÖÜÁÀÓÒÚÙÂÔÛ][a-zäöüßáàâóòôúùû]+/~
DEU_WORT = DEU_GROSS | DEU_KLEIN | GROSSBUCHSTABE
DEU_GROSS = /[A-ZÄÖÜ][a-zäöüßę]+/~
GROSSBUCHSTABE = /[A-ZÄÖÜ](?=[ \t\n])/~
DEU_KLEIN = /[a-zäöüßę]+/~
LAT_WORT = /[a-z]+/~
LAT_WORT_TEIL = /[a-z]+/
GROSSSCHRIFT = /[A-ZÄÖÜ]+/~
DEU_GROSS = /[A-ZÄÖÜ][a-zäöüßę\-]+/
GROSSBUCHSTABE = /[A-ZÄÖÜ](?=[ \t\n])/
DEU_KLEIN = /[a-zäöüßę\-]+/
LAT_WORT = /[a-z|\-]+/
GROSSSCHRIFT = /[A-ZÄÖÜ]+/
ZAHL = /\d+/~
ROEMISCHE_ZAHL = /(?=[MDCLXVI])M*(C[MD]|D?C*)(X[CL]|L?X*)(I[XV]|V?I*)/~
SATZZEICHEN = /(?:,(?!,))|(?:;(?!;))|(?::(?!:))|[.()\[\]\-]+/~ # div. Satzzeichen, aber keine doppelten ,, ;; oder ::
TEXTELEMENT = DEU_WORT | ZAHL | ROEMISCHE_ZAHL
FREITEXT = !ZEILENSPRUNG { TEXTELEMENT | /[.()\[\]\-\s]+/ | /,(?!,)\s*/ }+
ERW_FREITEXT = !ZEILENSPRUNG { TEXTELEMENT | SATZZEICHEN | /\s+/ }+
BUCHSTABENFOLGE = /\w+/~
ZEICHENFOLGE = /[\w()-]+/~
EINZEILER = /[\w()-. \t]+/~
TEXTELEMENT = (DEU_WORT //~) | ZAHL | ROEMISCHE_ZAHL
FREITEXT = { TEXTELEMENT | /[.()\[\]\-\s]+/ | /,(?!,)\s*/ }+
ERW_FREITEXT = { TEXTELEMENT | SATZZEICHEN | /\s+/ }+
TR = ABS | LZ # (beliebiger) Trenner
ABS = /\s*;;?\s*/ | { ZWW }+ # Abschluss (durch Semikolon oder Zeilenwechsel)
...
...
@@ -204,6 +208,7 @@ RZS = /\s*?\n|$/ # Rückwärtiger Zeilensprung oder T
ZEILENSPRUNG = /[ \t]*\n/~
KOMMENTARZEILEN = { /[ \t]*\n?[ \t]*/ COMMENT__ } # echte Kommentarzeilen
KATEGORIENZEILE = /[^:\n]+[:][ \t]*\n/ # Kategorienzeilen enthalten genau einen Doppelpunkt am Ende der Zeile
FORTSETZUNG = !(ZWW /[^:\n]+[:]/)
DATEI_ENDE = !/./
NIEMALS = /(?!.)/
...
...
examples/MLW/MLWCompiler.py
View file @
10c52b21
...
...
@@ -90,7 +90,7 @@ class MLWGrammar(Grammar):
{ LemmaVariante §TR }+
[Zusatz §ABS]
LemmaVariante = LAT_WORT
_TEIL { "-" LAT_WORT_TEIL }
LemmaVariante = LAT_WORT
## GRAMMATIK-POSITION ##
...
...
@@ -114,7 +114,7 @@ class MLWGrammar(Grammar):
| "femininum" | "f."
| "neutrum" | "n."
GrammatikVariante = [wortart ABS] flexion [genus] DPP
{
Beleg }
+
# Beleg { SEM Beleg }
GrammatikVariante = [wortart ABS] flexion [genus] DPP
Beleg { FORTSETZUNG
Beleg } # Beleg { SEM Beleg }
...
...
@@ -143,7 +143,7 @@ class MLWGrammar(Grammar):
## ARTIKELKOPF POSITIONEN ##
Position = [LZ] §{ Kategorie }+
Kategorie = Besonderheit §DPP [LZ] ( Varianten | { Kategorie }+ )
[LZ]
Kategorie = Besonderheit §DPP [LZ] ( Varianten | { Kategorie }+ )
ZWW
Besonderheit = FREITEXT
Varianten = Variante { ABS Variante }
Variante = !KATEGORIENZEILE Gegenstand DPP Beleg
...
...
@@ -152,15 +152,20 @@ class MLWGrammar(Grammar):
#### BEDEUTUNGS-POSITION #####################################################
BedeutungsPosition = { "BEDEUTUNG" [LZ] §Bedeutung }+
BedeutungsPosition
= { "BEDEUTUNG" [LZ] §Bedeutung }+
Bedeutung = (Interpretamente | Bedeutungskategorie) [Belege]
Bedeutungskategorie = /(?:(?![A-ZÄÖÜ][A-ZÄÖÜ]).)+/~ [LZ]
Interpretamente = LateinischeBedeutung [LZ] §DeutscheBedeutung [LZ]
LateinischeBedeutung = LAT
/(?:(?![A-ZÄÖÜ][A-ZÄÖÜ]).)+/~
DeutscheBedeutung = DEU
/(?:(?![A-ZÄÖÜ][A-ZÄÖÜ]).)+/~
Bedeutung
= (Interpretamente | Bedeutungskategorie) [Belege]
Bedeutungskategorie
= /(?:(?![A-ZÄÖÜ][A-ZÄÖÜ]).)+/~ [LZ]
Interpretamente
= LateinischeBedeutung [LZ] §DeutscheBedeutung [LZ]
LateinischeBedeutung = LAT
[LZ] LateinischerAusdruck { <","|ZW> LateinischerAusdruck }
DeutscheBedeutung
= DEU
[LZ] DeutscherAusdruck { <","|ZW> DeutscherAusdruck }
Belege = "BELEGE" { ZWW "*" Beleg }+ ABS
LateinischerAusdruck = LAT_WORT { //~ LAT_WORT } [/\s*/ BedeutungsQualifikation]
DeutscherAusdruck = DEU_WORT { //~ DEU_WORT } [/\s*/ BedeutungsQualifikation]
BedeutungsQualifikation = "[" EINZEILER { <SEM|ZW> EINZEILER } §"]"
Belege = "BELEGE" { ZWW "*" Beleg }+ ABS
#### VERWEIS-POSITION #####################################################
...
...
@@ -202,11 +207,11 @@ class MLWGrammar(Grammar):
Beleg = Verweis | Zitat
Zitat = BelegQuelle { SEM Stelle BelegText } [[TR] Zusatz]
BelegQuelle = Autor DPP Werk
BelegText = ~/"/ FREITEXT /"/~ ["."]
BelegText = ~/"/ FREITEXT
§
/"/~ ["."]
Verweis = "->" ZielName
Verweis = "->"
§
ZielName
VerweisZiel = "{" ZielName "}"
ZielName =
BUCHSTABENFOLGE
ZielName =
EINZEILER
Autor = FREITEXT
Werk = FREITEXT
...
...
@@ -221,23 +226,22 @@ class MLWGrammar(Grammar):
NAME = /[A-ZÄÖÜÁÀÓÒÚÙÂÔÛ][a-zäöüßáàâóòôúùû]+/~
DEU_WORT = DEU_GROSS | DEU_KLEIN | GROSSBUCHSTABE
DEU_GROSS = /[A-ZÄÖÜ][a-zäöüßę]+/~
GROSSBUCHSTABE = /[A-ZÄÖÜ](?=[ \t\n])/~
DEU_KLEIN = /[a-zäöüßę]+/~
LAT_WORT = /[a-z]+/~
LAT_WORT_TEIL = /[a-z]+/
GROSSSCHRIFT = /[A-ZÄÖÜ]+/~
DEU_GROSS = /[A-ZÄÖÜ][a-zäöüßę\-]+/
GROSSBUCHSTABE = /[A-ZÄÖÜ](?=[ \t\n])/
DEU_KLEIN = /[a-zäöüßę\-]+/
LAT_WORT = /[a-z|\-]+/
GROSSSCHRIFT = /[A-ZÄÖÜ]+/
ZAHL = /\d+/~
ROEMISCHE_ZAHL = /(?=[MDCLXVI])M*(C[MD]|D?C*)(X[CL]|L?X*)(I[XV]|V?I*)/~
SATZZEICHEN = /(?:,(?!,))|(?:;(?!;))|(?::(?!:))|[.()\[\]\-]+/~ # div. Satzzeichen, aber keine doppelten ,, ;; oder ::
TEXTELEMENT = DEU_WORT | ZAHL | ROEMISCHE_ZAHL
FREITEXT = !ZEILENSPRUNG { TEXTELEMENT | /[.()\[\]\-\s]+/ | /,(?!,)\s*/ }+
ERW_FREITEXT = !ZEILENSPRUNG { TEXTELEMENT | SATZZEICHEN | /\s+/ }+
BUCHSTABENFOLGE = /\w+/~
ZEICHENFOLGE = /[\w()-]+/~
EINZEILER = /[\w()-. \t]+/~
TEXTELEMENT = (DEU_WORT //~) | ZAHL | ROEMISCHE_ZAHL
FREITEXT = { TEXTELEMENT | /[.()\[\]\-\s]+/ | /,(?!,)\s*/ }+
ERW_FREITEXT = { TEXTELEMENT | SATZZEICHEN | /\s+/ }+
TR = ABS | LZ # (beliebiger) Trenner
ABS = /\s*;;?\s*/ | { ZWW }+ # Abschluss (durch Semikolon oder Zeilenwechsel)
...
...
@@ -256,6 +260,7 @@ class MLWGrammar(Grammar):
ZEILENSPRUNG = /[ \t]*\n/~
KOMMENTARZEILEN = { /[ \t]*\n?[ \t]*/ COMMENT__ } # echte Kommentarzeilen
KATEGORIENZEILE = /[^:\n]+[:][ \t]*\n/ # Kategorienzeilen enthalten genau einen Doppelpunkt am Ende der Zeile
FORTSETZUNG = !(ZWW /[^:\n]+[:]/)
DATEI_ENDE = !/./
NIEMALS = /(?!.)/
...
...
@@ -268,11 +273,12 @@ class MLWGrammar(Grammar):
SATZZEICHEN
=
Forward
()
TEXTELEMENT
=
Forward
()
ZAHL
=
Forward
()
ZWW
=
Forward
()
Zusatz
=
Forward
()
flexion
=
Forward
()
genus
=
Forward
()
wortart
=
Forward
()
source_hash__
=
"
3e563592ce262f34a151a9f65f997b6b
"
source_hash__
=
"
1d6f8c60413469e9350a45b956fcd9fd
"
parser_initialization__
=
"upon instantiation"
COMMENT__
=
r
'#.*'
WHITESPACE__
=
r
'[\t ]*'
...
...
@@ -282,6 +288,7 @@ class MLWGrammar(Grammar):
DUMMY
=
Token
(
"EBNF-Grammatik an dieser Stelle noch nicht definiert!"
)
NIEMALS
=
RegExp
(
'(?!.)'
)
DATEI_ENDE
=
NegativeLookahead
(
RegExp
(
'.'
))
FORTSETZUNG
=
NegativeLookahead
(
Series
(
ZWW
,
RegExp
(
'[^:
\\
n]+[:]'
)))
KATEGORIENZEILE
=
RegExp
(
'[^:
\\
n]+[:][
\\
t]*
\\
n'
)
KOMMENTARZEILEN
=
ZeroOrMore
(
Series
(
RegExp
(
'[
\\
t]*
\\
n?[
\\
t]*'
),
RegExp
(
COMMENT__
)))
ZEILENSPRUNG
=
RE
(
'[
\\
t]*
\\
n'
)
...
...
@@ -289,27 +296,27 @@ class MLWGrammar(Grammar):
LEERZEILE
=
Series
(
RegExp
(
'[
\\
t]*(?:
\\
n[
\\
t]*)+
\\
n'
),
RE
(
'
\\
n?'
,
wR
=
''
,
wL
=
WSP__
))
LEERRAUM
=
OneOrMore
(
Alternative
(
RegExp
(
COMMENT__
),
RegExp
(
'
\\
s+'
)))
LÜCKE
=
Series
(
KOMMENTARZEILEN
,
LEERZEILE
,
Option
(
LEERRAUM
))
ZWW
=
Series
(
ZEILENSPRUNG
,
Option
(
LEERRAUM
))
ZWW
.
set
(
Series
(
ZEILENSPRUNG
,
Option
(
LEERRAUM
))
)
ZW
=
Series
(
NegativeLookahead
(
LÜCKE
),
ZEILENSPRUNG
)
SEM
=
RE
(
';;?'
)
DPP
=
RE
(
'::?'
)
LZ
=
RegExp
(
'
\\
s+'
)
ABS
=
Alternative
(
RegExp
(
'
\\
s*;;?
\\
s*'
),
OneOrMore
(
ZWW
))
TR
=
Alternative
(
ABS
,
LZ
)
ERW_FREITEXT
=
OneOrMore
(
Alternative
(
TEXTELEMENT
,
SATZZEICHEN
,
RegExp
(
'
\\
s+'
)))
FREITEXT
=
OneOrMore
(
Alternative
(
TEXTELEMENT
,
RegExp
(
'[.()
\\
[
\\
]
\\
-
\\
s]+'
),
RegExp
(
',(?!,)
\\
s*'
)))
TEXTELEMENT
.
set
(
Alternative
(
Series
(
DEU_WORT
,
RE
(
''
)),
ZAHL
,
ROEMISCHE_ZAHL
))
EINZEILER
=
RE
(
'[
\\
w()-.
\\
t]+'
)
ZEICHENFOLGE
=
RE
(
'[
\\
w()-]+'
)
BUCHSTABENFOLGE
=
RE
(
'
\\
w+'
)
ERW_FREITEXT
=
Series
(
NegativeLookahead
(
ZEILENSPRUNG
),
OneOrMore
(
Alternative
(
TEXTELEMENT
,
SATZZEICHEN
,
RegExp
(
'
\\
s+'
))))
FREITEXT
=
Series
(
NegativeLookahead
(
ZEILENSPRUNG
),
OneOrMore
(
Alternative
(
TEXTELEMENT
,
RegExp
(
'[.()
\\
[
\\
]
\\
-
\\
s]+'
),
RegExp
(
',(?!,)
\\
s*'
))))
TEXTELEMENT
.
set
(
Alternative
(
DEU_WORT
,
ZAHL
,
ROEMISCHE_ZAHL
))
SATZZEICHEN
.
set
(
RE
(
'(?:,(?!,))|(?:;(?!;))|(?::(?!:))|[.()
\\
[
\\
]
\\
-]+'
))
ROEMISCHE_ZAHL
.
set
(
RE
(
'(?=[MDCLXVI])M*(C[MD]|D?C*)(X[CL]|L?X*)(I[XV]|V?I*)'
))
ZAHL
.
set
(
RE
(
'
\\
d+'
))
GROSSSCHRIFT
=
RE
(
'[A-ZÄÖÜ]+'
)
LAT_WORT_TEIL
=
RegExp
(
'[a-z]+'
)
LAT_WORT
=
RE
(
'[a-z]+'
)
DEU_KLEIN
=
RE
(
'[a-zäöüßę]+'
)
GROSSBUCHSTABE
=
RE
(
'[A-ZÄÖÜ](?=[
\\
t
\\
n])'
)
DEU_GROSS
=
RE
(
'[A-ZÄÖÜ][a-zäöüßę]+'
)
GROSSSCHRIFT
=
RegExp
(
'[A-ZÄÖÜ]+'
)
LAT_WORT
=
RegExp
(
'[a-z|
\\
-]+'
)
DEU_KLEIN
=
RegExp
(
'[a-zäöüßę
\\
-]+'
)
GROSSBUCHSTABE
=
RegExp
(
'[A-ZÄÖÜ](?=[
\\
t
\\
n])'
)
DEU_GROSS
=
RegExp
(
'[A-ZÄÖÜ][a-zäöüßę
\\
-]+'
)
DEU_WORT
.
set
(
Alternative
(
DEU_GROSS
,
DEU_KLEIN
,
GROSSBUCHSTABE
))
NAME
=
RE
(
'[A-ZÄÖÜÁÀÓÒÚÙÂÔÛ][a-zäöüßáàâóòôúùû]+'
)
NAMENS_ABKÜRZUNG
=
RE
(
'[A-ZÄÖÜÁÀÂÓÒÔÚÙÛ]
\\
.'
)
...
...
@@ -318,10 +325,10 @@ class MLWGrammar(Grammar):
Stelle
=
Synonym
(
FREITEXT
)
Werk
=
Synonym
(
FREITEXT
)
Autor
=
Synonym
(
FREITEXT
)
ZielName
=
Synonym
(
BUCHSTABENFOLGE
)
ZielName
=
Synonym
(
EINZEILER
)
VerweisZiel
=
Series
(
Token
(
"{"
),
ZielName
,
Token
(
"}"
))
Verweis
=
Series
(
Token
(
"->"
),
ZielName
)
BelegText
=
Series
(
RE
(
'"'
,
wR
=
''
,
wL
=
WSP__
),
FREITEXT
,
RE
(
'"'
),
Option
(
Token
(
"."
)))
Verweis
=
Series
(
Token
(
"->"
),
ZielName
,
mandatory
=
1
)
BelegText
=
Series
(
RE
(
'"'
,
wR
=
''
,
wL
=
WSP__
),
FREITEXT
,
RE
(
'"'
),
Option
(
Token
(
"."
))
,
mandatory
=
2
)
BelegQuelle
=
Series
(
Autor
,
DPP
,
Werk
)
Zitat
=
Series
(
BelegQuelle
,
ZeroOrMore
(
Series
(
SEM
,
Stelle
,
BelegText
)),
Option
(
Series
(
Option
(
TR
),
Zusatz
)))
Beleg
=
Alternative
(
Verweis
,
Zitat
)
...
...
@@ -336,8 +343,11 @@ class MLWGrammar(Grammar):
UnterArtikel
=
Token
(
"UNTER-ARTIKEL"
)
VerweisPosition
=
Token
(
"VERWEISE"
)
Belege
=
Series
(
Token
(
"BELEGE"
),
OneOrMore
(
Series
(
ZWW
,
Token
(
"*"
),
Beleg
)),
ABS
)
DeutscheBedeutung
=
Series
(
DEU
,
RE
(
'(?:(?![A-ZÄÖÜ][A-ZÄÖÜ]).)+'
))
LateinischeBedeutung
=
Series
(
LAT
,
RE
(
'(?:(?![A-ZÄÖÜ][A-ZÄÖÜ]).)+'
))
BedeutungsQualifikation
=
Series
(
Token
(
"["
),
EINZEILER
,
ZeroOrMore
(
Series
(
SomeOf
(
SEM
,
ZW
),
EINZEILER
)),
Token
(
"]"
),
mandatory
=
3
)
DeutscherAusdruck
=
Series
(
DEU_WORT
,
ZeroOrMore
(
Series
(
RE
(
''
),
DEU_WORT
)),
Option
(
Series
(
RegExp
(
'
\\
s*'
),
BedeutungsQualifikation
)))
LateinischerAusdruck
=
Series
(
LAT_WORT
,
ZeroOrMore
(
Series
(
RE
(
''
),
LAT_WORT
)),
Option
(
Series
(
RegExp
(
'
\\
s*'
),
BedeutungsQualifikation
)))
DeutscheBedeutung
=
Series
(
DEU
,
Option
(
LZ
),
DeutscherAusdruck
,
ZeroOrMore
(
Series
(
SomeOf
(
Token
(
","
),
ZW
),
DeutscherAusdruck
)))
LateinischeBedeutung
=
Series
(
LAT
,
Option
(
LZ
),
LateinischerAusdruck
,
ZeroOrMore
(
Series
(
SomeOf
(
Token
(
","
),
ZW
),
LateinischerAusdruck
)))
Interpretamente
=
Series
(
LateinischeBedeutung
,
Option
(
LZ
),
DeutscheBedeutung
,
Option
(
LZ
),
mandatory
=
2
)
Bedeutungskategorie
=
Series
(
RE
(
'(?:(?![A-ZÄÖÜ][A-ZÄÖÜ]).)+'
),
Option
(
LZ
))
Bedeutung
=
Series
(
Alternative
(
Interpretamente
,
Bedeutungskategorie
),
Option
(
Belege
))
...
...
@@ -346,7 +356,7 @@ class MLWGrammar(Grammar):
Variante
=
Series
(
NegativeLookahead
(
KATEGORIENZEILE
),
Gegenstand
,
DPP
,
Beleg
)
Varianten
=
Series
(
Variante
,
ZeroOrMore
(
Series
(
ABS
,
Variante
)))
Besonderheit
=
Synonym
(
FREITEXT
)
Kategorie
.
set
(
Series
(
Besonderheit
,
DPP
,
Option
(
LZ
),
Alternative
(
Varianten
,
OneOrMore
(
Kategorie
)),
Option
(
LZ
)
,
mandatory
=
1
))
Kategorie
.
set
(
Series
(
Besonderheit
,
DPP
,
Option
(
LZ
),
Alternative
(
Varianten
,
OneOrMore
(
Kategorie
)),
ZWW
,
mandatory
=
1
))
Position
=
Series
(
Option
(
LZ
),
OneOrMore
(
Kategorie
),
mandatory
=
1
)
VerwechselungPosition
=
Series
(
Token
(
"VERWECHSELBAR"
),
Position
)
MetrikPosition
=
Series
(
Token
(
"METRIK"
),
Position
)
...
...
@@ -358,7 +368,7 @@ class MLWGrammar(Grammar):
EtymologieBesonderheit
=
Synonym
(
FREITEXT
)
EtymologieVariante
=
Alternative
(
LAT
,
Series
(
GRI
,
Option
(
EtymologieBesonderheit
),
Option
(
Series
(
Token
(
"ETYM"
),
Etymologie
)),
DPP
,
Beleg
))
EtymologiePosition
=
Series
(
Token
(
"ETYMOLOGIE"
),
Option
(
LZ
),
OneOrMore
(
EtymologieVariante
))
GrammatikVariante
=
Series
(
Option
(
Series
(
wortart
,
ABS
)),
flexion
,
Option
(
genus
),
DPP
,
OneOrMore
(
Beleg
))
GrammatikVariante
=
Series
(
Option
(
Series
(
wortart
,
ABS
)),
flexion
,
Option
(
genus
),
DPP
,
Beleg
,
ZeroOrMore
(
Series
(
FORTSETZUNG
,
Beleg
))
)
genus
.
set
(
Alternative
(
Token
(
"maskulinum"
),
Token
(
"m."
),
Token
(
"femininum"
),
Token
(
"f."
),
Token
(
"neutrum"
),
Token
(
"n."
)))
FLEX
=
RE
(
'-?[a-z]+'
)
konjugation
=
Synonym
(
FLEX
)
...
...
@@ -367,7 +377,7 @@ class MLWGrammar(Grammar):
wortart
.
set
(
Alternative
(
Token
(
"nomen"
),
Token
(
"n."
),
Token
(
"verb"
),
Token
(
"v."
),
Token
(
"adverb"
),
Token
(
"adv."
),
Token
(
"adjektiv"
),
Token
(
"adj."
),
Token
(
"praeposition"
),
Token
(
"praep."
)))
Grammatik
=
Series
(
wortart
,
ABS
,
flexion
,
Option
(
genus
),
mandatory
=
1
)
GrammatikPosition
=
Series
(
Token
(
"GRAMMATIK"
),
Option
(
LZ
),
Grammatik
,
ABS
,
ZeroOrMore
(
Series
(
GrammatikVariante
,
ABS
,
mandatory
=
1
)),
mandatory
=
2
)
LemmaVariante
=
S
eries
(
LAT_WORT_TEIL
,
ZeroOrMore
(
Series
(
Token
(
"-"
),
LAT_WORT
_TEIL
))
)
LemmaVariante
=
S
ynonym
(
LAT_WORT
)
LemmaVarianten
=
Series
(
Option
(
LZ
),
OneOrMore
(
Series
(
LemmaVariante
,
TR
,
mandatory
=
1
)),
Option
(
Series
(
Zusatz
,
ABS
,
mandatory
=
1
)))
LemmaWort
=
Synonym
(
LAT_WORT
)
gesichert
=
Token
(
"$"
)
...
...
examples/MLW/MLW_ebnf_ERRORS.txt
View file @
10c52b21
line: 137, column: 1, Warning: Rule "SCHLUESSELWORT" is not connected to parser root "Artikel" !
line: 156, column: 1, Warning: Rule "VerweisZiel" is not connected to parser root "Artikel" !
line: 162, column: 1, Warning: Rule "Datierung" is not connected to parser root "Artikel" !
line: 163, column: 1, Warning: Rule "Edition" is not connected to parser root "Artikel" !
line: 177, column: 1, Warning: Rule "GROSSSCHRIFT" is not connected to parser root "Artikel" !
line: 181, column: 1, Warning: Rule "SATZZEICHEN" is not connected to parser root "Artikel" !
line: 185, column: 1, Warning: Rule "ERW_FREITEXT" is not connected to parser root "Artikel" !
line: 197, column: 1, Warning: Rule "ZW" is not connected to parser root "Artikel" !
line: 199, column: 1, Warning: Rule "LÜCKE" is not connected to parser root "Artikel" !
line: 201, column: 1, Warning: Rule "LEERZEILE" is not connected to parser root "Artikel" !
line: 202, column: 1, Warning: Rule "RZS" is not connected to parser root "Artikel" !
line: 205, column: 1, Warning: Rule "KOMMENTARZEILEN" is not connected to parser root "Artikel" !
line: 209, column: 1, Warning: Rule "NIEMALS" is not connected to parser root "Artikel" !
line: 211, column: 1, Warning: Rule "DUMMY" is not connected to parser root "Artikel" !
line: 142, column: 1, Warning: Rule "SCHLUESSELWORT" is not connected to parser root "Artikel" !
line: 161, column: 1, Warning: Rule "VerweisZiel" is not connected to parser root "Artikel" !
line: 167, column: 1, Warning: Rule "Datierung" is not connected to parser root "Artikel" !
line: 168, column: 1, Warning: Rule "Edition" is not connected to parser root "Artikel" !
line: 181, column: 1, Warning: Rule "GROSSSCHRIFT" is not connected to parser root "Artikel" !
line: 185, column: 1, Warning: Rule "SATZZEICHEN" is not connected to parser root "Artikel" !
line: 187, column: 1, Warning: Rule "BUCHSTABENFOLGE" is not connected to parser root "Artikel" !
line: 192, column: 1, Warning: Rule "ERW_FREITEXT" is not connected to parser root "Artikel" !
line: 206, column: 1, Warning: Rule "RZS" is not connected to parser root "Artikel" !
line: 214, column: 1, Warning: Rule "NIEMALS" is not connected to parser root "Artikel" !
line: 216, column: 1, Warning: Rule "DUMMY" is not connected to parser root "Artikel" !
examples/MLW/grammar_tests/04_test_schreibweise.ini
View file @
10c52b21
...
...
@@ -6,6 +6,13 @@
fezdregl(a):
->
Verweis_005
"""
2:
"""SCHREIBWEISE
script.:
vizreg-:
->
ID_0023
festregel(a):
->
v.
ibi
fezdregl(a):
->
v.
ibi
"""
[match:Besonderheit]
1:
"""script."""
2:
"""script.
fat-"""
...
...
examples/MLW/grammar_tests/05_test_bedeutung.ini
View file @
10c52b21
...
...
@@ -25,7 +25,8 @@ M1: """LAT pannus, faciale, sudarium"""
M2:
"""LAT
capital,
rica"""
[match:DeutscheBedeutung]
M1:
"""DEU
Gesichts-,
Schweißtuch
[usu liturg.; de re v. p. 32, 63]
"""
M1:
"""DEU
Gesichts-,
Schweißtuch
[usu liturg.; de re v. p. 32, 63]
"""
M2:
"""DEU
Kopftuch"""
[match:Belege]
...
...
examples/MLW/grammar_tests/REPORT/02_test_lemmaposition.md
View file @
10c52b21
...
...
@@ -14,9 +14,7 @@ Match-test "1"
(Lemma
(LemmaWort
(LAT_WORT
(:RegExp
"facitergula"
)
"facitergula"
)
)
)
...
...
@@ -51,7 +49,7 @@ Match-test "1"
)
(:OneOrMore
(:Series
(LAT_WORT
_TEIL
(LAT_WORT
"fascitergula"
)
(ZWW
...
...
@@ -64,7 +62,7 @@ Match-test "1"
)
)
(:Series
(LAT_WORT
_TEIL
(LAT_WORT
"facietergula"
)
(ZWW
...
...
@@ -77,7 +75,7 @@ Match-test "1"
)
)
(:Series
(LAT_WORT
_TEIL
(LAT_WORT
"facistergula"
)
(ZWW
...
...
@@ -90,7 +88,7 @@ Match-test "1"
)
)
(:Series
(LAT_WORT
_TEIL
(LAT_WORT
"farcutergula"
)
(ZWW
...
...
@@ -117,7 +115,7 @@ Match-test "2"
" "
)
(:Series
(LAT_WORT
_TEIL
(LAT_WORT
"fascitergula"
)
(ABS
...
...
@@ -140,7 +138,7 @@ Match-test "3"
)
(:OneOrMore
(:Series
(LAT_WORT
_TEIL
(LAT_WORT
"fascitergula"
)
(LZ
...
...
@@ -148,7 +146,7 @@ Match-test "3"
)
)
(:Series
(LAT_WORT
_TEIL
(LAT_WORT
"facietergula"
)
(LZ
...
...
@@ -222,9 +220,7 @@ Match-test "1"
(Lemma
(LemmaWort
(LAT_WORT
(:RegExp
"facitergula"
)
"facitergula"
)
)
)
...
...
@@ -245,7 +241,7 @@ Match-test "1"
(LemmaVarianten
(:OneOrMore
(:Series
(LAT_WORT
_TEIL
(LAT_WORT
"fascitergula"
)
(ZWW
...
...
@@ -258,7 +254,7 @@ Match-test "1"
)
)
(:Series
(LAT_WORT
_TEIL
(LAT_WORT
"facietergula"
)
(ZWW
...
...
@@ -271,7 +267,7 @@ Match-test "1"
)
)
(:Series
(LAT_WORT
_TEIL
(LAT_WORT
"facistergula"
)
(ZWW
...
...
@@ -284,7 +280,7 @@ Match-test "1"
)
)
(:Series
(LAT_WORT
_TEIL
(LAT_WORT
"fascitercula"
)
(ZWW
...
...
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