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
6a14734a
Commit
6a14734a
authored
Jul 09, 2018
by
eckhart
Browse files
- fixed doctest and syntaxtree.Node.__str__()
parent
37746fdc
Changes
4
Hide whitespace changes
Inline
Side-by-side
DHParser/syntaxtree.py
View file @
6a14734a
...
...
@@ -277,9 +277,7 @@ class Node(collections.abc.Sized):
def
__str__
(
self
):
# s = self._content if self._content is not None else \
# "".join(str(child) for child in self.children) if self.children else self.content
s
=
self
.
content
s
=
""
.
join
(
str
(
child
)
for
child
in
self
.
children
)
if
self
.
children
else
self
.
content
if
self
.
errors
:
return
' <<< Error on "%s" | %s >>> '
%
\
(
s
,
'; '
.
join
(
e
.
message
for
e
in
self
.
errors
))
...
...
@@ -838,7 +836,7 @@ def parse_sxpr(sxpr: str) -> Node:
Example:
>>> parse_sxpr("(a (b c))").as_sxpr()
'(a
\\
n
(b
\\
n
"c"
\\
n
)
\\
n)'
'(a
\\
n (b
\\
n "c"
\\
n )
\\
n)'
"""
sxpr
=
StringView
(
sxpr
).
strip
()
mock_parsers
=
dict
()
...
...
build_cython-modules.sh
View file @
6a14734a
#!/bin/sh
# CFLAGS="-O3 -march=native -mtune=native"
python3 setup.py build_ext
--inplace
python3
7
setup.py build_ext
--inplace
examples/LaTeX/LaTeXCompiler.py
View file @
6a14734a
...
...
@@ -237,7 +237,7 @@ class LaTeXGrammar(Grammar):
paragraph
=
Forward
()
tabular_config
=
Forward
()
text_element
=
Forward
()
source_hash__
=
"
79c6f2eaa821f7e92346e0ff24e7c5f8
"
source_hash__
=
"
1329c620430169c2cbeff23b05e049c3
"
parser_initialization__
=
"upon instantiation"
COMMENT__
=
r
'%.*'
WHITESPACE__
=
r
'[ \t]*(?:\n(?![ \t]*\n)[ \t]*)?'
...
...
test/run.py
View file @
6a14734a
#!/usr/bin/python
"""Runs the dhparser test-suite with several installed interpreters"""
if
__name__
==
"__main__"
:
import
os
...
...
@@ -8,14 +10,15 @@ if __name__ == "__main__":
# print("Running nosetests:")
# os.system("nosetests test")
interpreter
=
'python '
# interpreter = r'C:\Users\di68kap\AppData\Local\Programs\Python\Python37-32\python.exe '
interpreter
s
=
[
'python '
,
'pypy3 '
,
'python37 '
]
# interpreter
s
=
[
r'C:\Users\di68kap\AppData\Local\Programs\Python\Python37-32\python.exe '
]
os
.
system
(
interpreter
+
'--version'
)
for
interpreter
in
interpreters
:
os
.
system
(
interpreter
+
'--version'
)
assert
os
.
getcwd
().
endswith
(
'test'
)
files
=
os
.
listdir
()
for
filename
in
files
:
if
filename
.
startswith
(
'test_'
):
print
(
'
\n
TEST '
+
filename
)
os
.
system
(
interpreter
+
filename
)
assert
os
.
getcwd
().
endswith
(
'test'
)
files
=
os
.
listdir
()
for
filename
in
files
:
if
filename
.
startswith
(
'test_'
):
print
(
'
\n
TEST '
+
filename
)
os
.
system
(
interpreter
+
filename
)
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