return new ParserBase(ctx) {
/*
* parse @args {...}
*/
public Token go2(String s) {
Regex r = reg(dialect());
final List<F.T4<Integer, String, String, String>> ral = new ArrayList();
s = s.replaceAll("[\\n\\r]+", ",").replaceAll("[,]+", ",");
int line = ctx.currentLine();
while (r.search(s)) {
String type = r.stringMatched(2);
checkRestrictedClass(type);
String name = r.stringMatched(4);
String neu = r.stringMatched(6); // check the 'new' keyword
if (null == neu) neu = "";
String defVal = r.stringMatched(7);
if (null != defVal) defVal = neu + " " + defVal;
name = ExpressionParser.processPositionPlaceHolder(name);
ral.add(new F.T4(line, type, name, defVal));
}
return new Directive("", ctx()) {
@Override
public void call() {
for (F.T4<Integer, String, String, String> rd : ral) {
builder().addRenderArgs(rd._1, rd._2, rd._3, rd._4);
}
}
};
}
/*
* parse @args String s...
*/
public Token go() {
String remain = remain();
Regex r = new Regex(String.format("\\n?[ \\t\\x0B\\f]*%s%s(\\([ \t\f]*\\))?[ \t\f]*((?@{}))\\n?", a(), keyword()));
if (r.search(remain)) {
String matched = r.stringMatched();
if (matched.startsWith("\n") || matched.endsWith("\n")) {
ctx.getCodeBuilder().addBuilder(new Token.StringToken("\n", ctx));
}
String s = r.stringMatched(2);
s = S.strip(s, "{", "}");
step(matched.length());
return go2(s);
}
boolean startWithLineBreak = remain.startsWith("\n");
if (startWithLineBreak) {
remain = remain.substring(1);
}
String space = "";
Regex r0 = new Regex("^(\\s+).*");
if (r0.search(remain)) {
space = r0.stringMatched(1);
}
//space = startWithLineBreak ? "\n" + space : space;
step(space.length());
remain = remain.replaceFirst("^\\s+", "");
String key = String.format("%s%s ", a(), keyword());