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
c2875a32
Commit
c2875a32
authored
Mar 17, 2018
by
Eckhart Arnold
Browse files
- bugfix: regular expression RE_VALUE in testing incompatible with pypy3's re-engine
parent
70b905aa
Changes
4
Hide whitespace changes
Inline
Side-by-side
DHParser/testing.py
View file @
c2875a32
...
...
@@ -78,8 +78,12 @@ UNIT_STAGES = {'match', 'fail', 'ast', 'cst', '__ast__', '__cst__'}
# return unit
RX_SECTION
=
re
.
compile
(
'\s*\[(?P<stage>\w+):(?P<symbol>\w+)\]'
)
RE_VALUE
=
'(?:"""((?
s
:.*?)
)
""")|'
+
"(?:'''((?
s
:.*?)
)
''')|"
+
\
RE_VALUE
=
'(?:"""((?:.
|
\n
)
*?)""")|'
+
"(?:'''((?:.
|
\n
)
*?)''')|"
+
\
'(?:"(.*?)")|'
+
"(?:'(.*?)')|"
+
'(.*(?:
\n
(?:\s*
\n
)* .*)*)'
# the following does not work with pypy3, because pypy's re-engine does not
# support local flags, e.g. '(?s: )'
# RE_VALUE = '(?:"""((?s:.*?))""")|' + "(?:'''((?s:.*?))''')|" + \
# '(?:"(.*?)")|' + "(?:'(.*?)')|" + '(.*(?:\n(?:\s*\n)* .*)*)'
RX_ENTRY
=
re
.
compile
(
'\s*(\w+)\s*:\s*(?:{value})\s*'
.
format
(
value
=
RE_VALUE
))
RX_COMMENT
=
re
.
compile
(
'\s*#.*
\n
'
)
...
...
examples/LaTeX/tst_LaTeX_docs.py
View file @
c2875a32
...
...
@@ -25,11 +25,10 @@ import os
import
pstats
import
sys
import
DHParser.log
sys
.
path
.
extend
([
'../../'
,
'../'
,
'./'
])
import
DHParser.dsl
import
DHParser.log
from
DHParser.log
import
log_parsing_history
...
...
examples/LaTeX/tst_LaTeX_grammar.py
View file @
c2875a32
...
...
@@ -21,11 +21,10 @@ limitations under the License.
import
sys
import
DHParser.log
sys
.
path
.
extend
([
'../../'
,
'../'
,
'./'
])
from
DHParser
import
dsl
import
DHParser.log
from
DHParser
import
testing
# print(dir(dsl))
...
...
test/test_testing.py
View file @
c2875a32
...
...
@@ -100,7 +100,7 @@ class TestTestfiles:
def
test_unit_from_config_file
(
self
):
unit
=
unit_from_configfile
(
'configfile_test_1.ini'
)
assert
list
(
unit
.
keys
())
==
[
'ParserA'
]
assert
list
(
unit
[
'ParserA'
].
keys
())
==
[
'match'
,
'fail'
]
assert
list
(
unit
[
'ParserA'
].
keys
())
==
[
'match'
,
'fail'
]
,
str
(
list
(
unit
[
'ParserA'
].
keys
()))
assert
list
(
unit
[
'ParserA'
][
'match'
].
keys
())
==
[
'M1'
,
'M2'
,
'M3'
,
'M4'
]
assert
list
(
unit
[
'ParserA'
][
'fail'
].
keys
())
==
[
'F1'
]
testcase
=
unit
[
'ParserA'
][
'match'
][
'M4'
]
...
...
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