Skip to content

Commit

Permalink
Do not inform if the substring does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsbasjes committed Aug 28, 2017
1 parent e61cbec commit 007aa3f
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,17 @@ private void informSubstrings(ParserRuleContext ctx, String name, boolean fakeCh
if (ranges.size() > 4) { // Benchmarks showed this to be the breakeven point. (see below)
List<Pair<Integer, Integer>> splitList = splitter.createSplitList(text);
for (Range range : ranges) {
inform(ctx, ctx, name + "[" + range.getFirst() + "-" + range.getLast() + "]", splitter.getSplitRange(text, splitList, range), true);
String value = splitter.getSplitRange(text, splitList, range);
if (value != null) {
inform(ctx, ctx, name + "[" + range.getFirst() + "-" + range.getLast() + "]", value, true);
}
}
} else {
for (Range range : ranges) {
inform(ctx, ctx, name + "[" + range.getFirst() + "-" + range.getLast() + "]", splitter.getSplitRange(text, range), true);
String value = splitter.getSplitRange(text, range);
if (value != null) {
inform(ctx, ctx, name + "[" + range.getFirst() + "-" + range.getLast() + "]", value, true);
}
}
}
}
Expand Down

0 comments on commit 007aa3f

Please sign in to comment.