Skip to content

Commit

Permalink
allow regexp match multiline entity (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximthomas authored Jun 28, 2022
1 parent 78985ac commit 246870e
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.NoSuchElementException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

/**
* Iterates through multiple regular expression matches within a character stream.
Expand Down Expand Up @@ -119,12 +120,9 @@ private void notClosed() throws IOException {

private void readahead() throws IOException {
notClosed();
while (matches == null || !matches.hasNext()) {
String line = input.readLine();
if (line == null) {
break;
}
matches = new StringPatternMatches(line, Arrays.asList(patterns), discard);
if (matches == null || !matches.hasNext()) {
String body = input.lines().collect(Collectors.joining("\n"));
matches = new StringPatternMatches(body, Arrays.asList(patterns), discard);
}
}
}

0 comments on commit 246870e

Please sign in to comment.