Skip to content

Commit 6db988a

Browse files
committed
Remove extra spaces when printing update #13
Signed-off-by: Jono Yang <jyang@nexb.com>
1 parent 174f9c1 commit 6db988a

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/pygmars/parse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def parse(self, tree, trace=0):
514514
if after_parse != before_parse:
515515
# only update the tree and the trace if there have been changes from this parse
516516
if trace:
517-
updated = re.sub(r"\{[^\{]+\}", f" <{self.label}> ", after_parse)
517+
updated = re.sub(r"\{[^\{]+\}", f"<{self.label}>", after_parse)
518518
trace_elements.append("-------------------------------------")
519519
trace_elements.append(f"Rule.parse: applied rule: {self!r}")
520520
trace_elements.append(f" Rule regex: {self._regexp}")

tests/test_parse_doctest.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,39 +193,39 @@
193193
Input parsed to label: NP
194194
before : <DT><NN><VBD><IN><DT><NN><DT><NN><VBD>
195195
after : {<DT><NN>}<VBD><IN>{<DT><NN>}{<DT><NN>}<VBD>
196-
new : <NP> <VBD><IN> <NP> <NP> <VBD>
196+
new : <NP><VBD><IN><NP><NP><VBD>
197197
length : 9,6
198198
-------------------------------------
199199
Rule.parse: applied rule: <Rule: <IN> / P # Preposition>
200200
Rule regex: (?P<group>(?:<(?:IN)>))
201201
Input parsed to label: P
202202
before : <NP><VBD><IN><NP><NP><VBD>
203203
after : <NP><VBD>{<IN>}<NP><NP><VBD>
204-
new : <NP><VBD> <P> <NP><NP><VBD>
204+
new : <NP><VBD><P><NP><NP><VBD>
205205
length : 6,6
206206
-------------------------------------
207207
Rule.parse: applied rule: <Rule: <V.*> / V # Verb>
208208
Rule regex: (?P<group>(?:<(?:V[^\{\}<>]*)>))
209209
Input parsed to label: V
210210
before : <NP><VBD><P><NP><NP><VBD>
211211
after : <NP>{<VBD>}<P><NP><NP>{<VBD>}
212-
new : <NP> <V> <P><NP><NP> <V>
212+
new : <NP><V><P><NP><NP><V>
213213
length : 6,6
214214
-------------------------------------
215215
Rule.parse: applied rule: <Rule: <P> <NP> / PP # PP -> P NP>
216216
Rule regex: (?P<group>(?:<(?:P)>)(?:<(?:NP)>))
217217
Input parsed to label: PP
218218
before : <NP><V><P><NP><NP><V>
219219
after : <NP><V>{<P><NP>}<NP><V>
220-
new : <NP><V> <PP> <NP><V>
220+
new : <NP><V><PP><NP><V>
221221
length : 6,5
222222
-------------------------------------
223223
Rule.parse: applied rule: <Rule: <V> <NP|PP>* / VP # VP -> V (NP|PP)*>
224224
Rule regex: (?P<group>(?:<(?:V)>)(?:<(?:NP|PP)>)*)
225225
Input parsed to label: VP
226226
before : <NP><V><PP><NP><V>
227227
after : <NP>{<V><PP><NP>}{<V>}
228-
new : <NP> <VP> <VP>
228+
new : <NP><VP><VP>
229229
length : 5,3
230230
parse tree: (label='ROOT', children=(
231231
(label='NP', children=(

0 commit comments

Comments
 (0)