org.petitparser.parser.repeating.GreedyRepeatingParser Maven / Gradle / Ivy
package org.petitparser.parser.repeating;
import org.petitparser.context.Context;
import org.petitparser.context.Result;
import org.petitparser.parser.Parser;
import java.util.ArrayList;
import java.util.List;
/**
* A greedy repeating parser, commonly seen in regular expression
* implementations. It aggressively consumes as much input as possible and then
* backtracks to meet the 'limit' condition.
*/
public class GreedyRepeatingParser extends LimitedRepeatingParser {
public GreedyRepeatingParser(
Parser delegate, Parser limit, int min, int max) {
super(delegate, limit, min, max);
}
@Override
public Result parseOn(Context context) {
Context current = context;
List