Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
DHParser
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
badw-it
DHParser
Commits
1cff022a
Commit
1cff022a
authored
Jan 16, 2018
by
eckhart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- MLW extended
parent
330a45e3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
10 deletions
+21
-10
DHParser/syntaxtree.py
DHParser/syntaxtree.py
+15
-4
examples/MLW/Beispiele/imperium/imperium.mlw
examples/MLW/Beispiele/imperium/imperium.mlw
+4
-4
examples/MLW/VSCode/mlwquelle/syntaxes/mlw.tmLanguage.json
examples/MLW/VSCode/mlwquelle/syntaxes/mlw.tmLanguage.json
+2
-2
No files found.
DHParser/syntaxtree.py
View file @
1cff022a
...
...
@@ -531,6 +531,14 @@ class Node(collections.abc.Sized):
return
self
.
_tree_repr
(
' '
,
opening
,
closing
,
pretty
,
density
=
density
)
@
property
def
xml_attr
(
self
):
"""Returns a dictionary of XML-Attributes attached to the Node."""
if
not
hasattr
(
self
,
'_xml_attr'
):
self
.
_xml_attr
=
dict
()
return
self
.
_xml_attr
def
as_xml
(
self
,
src
:
str
=
None
,
showerrors
:
bool
=
True
)
->
str
:
"""
Returns content as XML-tree.
...
...
@@ -543,13 +551,16 @@ class Node(collections.abc.Sized):
def
opening
(
node
)
->
str
:
"""Returns the opening string for the representation of `node`."""
txt
=
'<'
+
node
.
tag_name
txt
=
[
'<'
,
node
.
tag_name
]
# s += ' pos="%i"' % node.pos
if
hasattr
(
self
,
'_xml_attr'
):
txt
.
extend
(
' %s="%s"'
%
(
k
,
v
)
for
k
,
v
in
self
.
xml_attr
.
items
())
if
src
:
txt
+=
' line="%i" col="%i"'
%
line_col
(
line_breaks
,
node
.
pos
)
txt
.
append
(
' line="%i" col="%i"'
%
line_col
(
line_breaks
,
node
.
pos
)
)
if
showerrors
and
node
.
errors
:
txt
+=
' err="%s"'
%
''
.
join
(
str
(
err
).
replace
(
'"'
,
r'\"'
)
for
err
in
node
.
errors
)
return
txt
+
">
\n
"
txt
.
append
(
' err="%s"'
%
''
.
join
(
str
(
err
).
replace
(
'"'
,
r'\"'
)
for
err
in
node
.
errors
))
return
""
.
join
(
txt
+
[
">
\n
"
])
def
closing
(
node
):
"""Returns the closing string for the representation of `node`."""
...
...
examples/MLW/Beispiele/imperium/imperium.mlw
View file @
1cff022a
...
...
@@ -10,10 +10,10 @@ GRAMMATIK
SCHREIBWEISE
script.: // gibt es hier überhaupt andere Kategorien außer "script."?
hym-: {=> imperator37m_1}
em-: Chron.: Fred.; 2,35sqq. capit.; p. 43.; 2,36 p. 60,10.
ym-: Chart.: Sangall.; A 194.
impir-: {=> impoerator38m_1}
hym-: {=> imperator37m_1}
em-: Chron.: Fred.; 2,35sqq. capit.; p. 43.; 2,36 p. 60,10.
ym-: Chart.: Sangall.; A 194.
impir-: {=> impoerator38m_1}
STRUKTUR
form. sing.:
...
...
examples/MLW/VSCode/mlwquelle/syntaxes/mlw.tmLanguage.json
View file @
1cff022a
...
...
@@ -13,11 +13,11 @@
"keywords"
:
{
"patterns"
:
[{
"name"
:
"keyword.secondary.mlw"
,
"match"
:
"
\\
b(LATEINISCH|DEUTSCH|LAT|DEU
|VERWECHSELBAR|BELEGE|AUTOR
)
\\
b"
"match"
:
"
\\
b(LATEINISCH|DEUTSCH|LAT|DEU)
\\
b"
},
{
"name"
:
"keyword.mlw"
,
"match"
:
"
\\
b(LEMMA|GRAMMATIK|SCHREIBWEISE|STRUKTUR|VERWECHSELBAR|BEDEUTUNG|
BELEGE|AUTORIN|AUTOR
)
\\
b"
"match"
:
"
\\
b(LEMMA|GRAMMATIK|SCHREIBWEISE|STRUKTUR|VERWECHSELBAR|BEDEUTUNG|
UNTER_BEDEUTUNG|UNTER_UNTER_BEDEUTUNG|UNTER_UNTER_UNTER_BEDEUTUNG|U_BEDEUTUNG|UU_BEDEUTUNG|UUU_BEDEUTUNG|UUUU_BEDEUTUNG|UUUUU_BEDEUTUNG|UUUUUU_BEDEUTUNG|UUUUUUU_BEDEUTUNG|BELEGE|AUTORIN|AUTOR|STELLENVERZEICHNIS
)
\\
b"
}]
},
"strings"
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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