// parse(l, rule, consumeWS);
// }
//
// return result;
ResultNode concatOrResult = new ResultNode(NodeType.CONCAT_OR);
concatOrResult.remainingInput = l.copy();
concatOrResult.status = State.FORWARD;
Queue<CSSRule> rulesLeft = new LinkedList<>(r.getXors());
int maxTests = rulesLeft.size();
int testNo = 1;
while (!rulesLeft.isEmpty() && testNo <= maxTests) {
// pick rule
final CSSRule rule = rulesLeft.poll();
boolean match = false;
//try on all
for (ResultNode last : concatOrResult.findLast()) {
if (last.isValid()) {
ResultNode path = parse(last.remainingInput, rule, consumeWS);
for (ResultNode pathEnd : path.findLast()) {
if (pathEnd.isValid()) {
match = true;
}
}
last.next.add(path);
if (!rulesLeft.isEmpty()) {
// special skip node
ResultNode skippy = new ResultNode(NodeType.CONCAT_OR);
skippy.status = State.SKIP;
skippy.remainingInput = last.remainingInput.copy();
last.next.add(skippy);
}
}