Skip to content

Commit

Permalink
Probably friendlier to make this one a lookahead
Browse files Browse the repository at this point in the history
  • Loading branch information
eggrobin committed Jun 26, 2024
1 parent cde46bd commit 8620d05
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -713,9 +713,11 @@ private static String nextToken(ParsePosition pp, String text) {

private static void expectToken(String token, ParsePosition pp, String text)
throws ParseException {
if (!token.equals(nextToken(pp, text))) {
throw new BackwardParseException("Expected '" + token + "'", pp.getIndex());
ParsePosition next = new ParsePosition(pp.getIndex());
if (!token.equals(nextToken(next, text))) {
throw new ParseException("Expected '" + token + "'", pp.getIndex());
}
pp.setIndex(next.getIndex());
}

private static PropertyPredicate getPropertyPredicate(ParsePosition pp, String line)
Expand Down

0 comments on commit 8620d05

Please sign in to comment.