File tree 2 files changed +7
-1
lines changed
src/edu/stanford/nlp/trees/tregex
test/src/edu/stanford/nlp/trees/tregex
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -58,12 +58,15 @@ public String toString() {
58
58
if (isNegated ()) {
59
59
sb .append ("!" );
60
60
}
61
+ if (isOptional ()) {
62
+ sb .append ("?" );
63
+ }
61
64
sb .append ('[' );
62
65
for (Iterator <TregexPattern > iter = children .iterator (); iter .hasNext ();) {
63
66
TregexPattern node = iter .next ();
64
67
sb .append (node .toString ());
65
68
if (iter .hasNext ()) {
66
- sb .append (" |" );
69
+ sb .append (" | " );
67
70
}
68
71
}
69
72
sb .append (']' );
Original file line number Diff line number Diff line change @@ -1566,6 +1566,9 @@ public void testOptionalToString() {
1566
1566
1567
1567
pattern = TregexPattern .compile ("A ?< B" );
1568
1568
assertEquals ("Root (A ?< B )" , pattern .toString ());
1569
+
1570
+ pattern = TregexPattern .compile ("A ?[< B | < C]" );
1571
+ assertEquals ("Root (A ?[< B | < C ])" , pattern .toString ());
1569
1572
}
1570
1573
1571
1574
/**
You can’t perform that action at this time.
0 commit comments