use of suite.node.parser.FactorizeResult.FTerminal in project suite by stupidsing.
the class RecursiveFactorizerTest method transform.
private FNode transform(FNode fn0) {
FTerminal from = new FTerminal(To.chars("ic-compile-better-option"));
FTerminal to = new FTerminal(To.chars("ic-new-compile-better-option"));
Iterate<FNode> fun = fn_ -> fn_.equals(from) ? to : null;
return transform(fn0, fun);
}
use of suite.node.parser.FactorizeResult.FTerminal in project suite by stupidsing.
the class Ebnf method toFactorizeResult.
private FactorizeResult toFactorizeResult(char[] cs, int p0, int px, Ast ast) {
var children = ast.children;
var size = children.size();
if (0 < size) {
var frs = new ArrayList<FactorizeResult>();
var pos = p0;
for (var i = 0; i < size; i++) {
var child = children.get(i);
var pos0 = pos;
pos = i != size - 1 ? child.end : px;
frs.add(toFactorizeResult(cs, pos0, pos, child));
}
return FactorizeResult.merge(ast.entity, frs);
} else {
var pre = Chars.of(cs, p0, ast.start);
var mid = Chars.of(cs, ast.start, ast.end);
var post = Chars.of(cs, ast.end, px);
return new FactorizeResult(pre, new FTerminal(mid), post);
}
}
use of suite.node.parser.FactorizeResult.FTerminal in project suite by stupidsing.
the class RecursiveFactorizer method term.
private FactorizeResult term(Chars chars) {
var chars1 = chars.trim();
var p0 = reverser.reverse(chars.start);
var p1 = reverser.reverse(chars1.start);
var p2 = reverser.reverse(chars1.end);
var px = reverser.reverse(chars.end);
return new FactorizeResult(Chars.of(in.cs, p0, p1), new FTerminal(Chars.of(in.cs, p1, p2)), Chars.of(in.cs, p2, px));
}
Aggregations