Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
badw-it
DHParser
Commits
efb7ef3d
Commit
efb7ef3d
authored
Dec 09, 2018
by
eckhart
Browse files
CHANGES.txt updated
parents
80c735ac
0410f0f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
CHANGES.txt
View file @
efb7ef3d
DHParser Version 0.8.4 (
pending
)
DHParser Version 0.8.4 (
27.11.2018
)
................................
................................
...
- lookahead parsers can now be unit-tested (experimental)
- lookahead parsers can now be unit-tested (experimental)
- customized (faster) deepcopy of syntax trees
- customized (faster) deepcopy of syntax trees
- better customization of XML-serialization of syntaxtrees
DHParser Version 0.8.3 (20.8.2018)
DHParser Version 0.8.3 (20.8.2018)
...
...
DHParser/transform.py
View file @
efb7ef3d
...
@@ -729,6 +729,27 @@ def normalize_whitespace(context):
...
@@ -729,6 +729,27 @@ def normalize_whitespace(context):
node
.
result
=
re
.
sub
(
r
'\s+'
,
' '
,
node
.
result
)
node
.
result
=
re
.
sub
(
r
'\s+'
,
' '
,
node
.
result
)
def
merge_whitespace
(
context
):
"""
Merges adjacent whitespace. UNTESTED!
"""
node
=
context
[
-
1
]
children
=
node
.
children
new_result
=
[]
i
=
0
L
=
len
(
children
)
while
i
<
L
:
if
children
[
i
].
parser
.
pytpe
==
WHITESPACE_PTYPE
:
k
=
i
while
i
<
L
and
children
[
k
].
parser
.
ptype
==
WHITESPACE_PTYPE
:
i
+=
1
if
i
>
k
:
children
[
k
].
result
=
sum
(
children
[
n
].
result
for
n
in
range
(
k
,
i
+
1
))
new_result
.
append
(
children
[
k
])
i
+=
1
node
.
result
=
tuple
(
new_result
)
def
move_whitespace
(
context
):
def
move_whitespace
(
context
):
"""
"""
Moves adjacent whitespace nodes to the parent node.
Moves adjacent whitespace nodes to the parent node.
...
...
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