提交 d5a35fe2 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use Parser.readIfMore() in more places

上级 bd1e22b9
...@@ -1949,10 +1949,9 @@ public class Parser { ...@@ -1949,10 +1949,9 @@ public class Parser {
if (readIf("(")) { if (readIf("(")) {
for (int i = 0;; i++) { for (int i = 0;; i++) {
command.setExpression(i, readExpression()); command.setExpression(i, readExpression());
if (readIf(")")) { if (!readIfMore(true)) {
break; break;
} }
read(",");
} }
} }
return command; return command;
...@@ -2740,12 +2739,10 @@ public class Parser { ...@@ -2740,12 +2739,10 @@ public class Parser {
} }
Expression[] args; Expression[] args;
ArrayList<Expression> argList = Utils.newSmallArrayList(); ArrayList<Expression> argList = Utils.newSmallArrayList();
int numArgs = 0; if (!readIf(")")) {
while (!readIf(")")) { do {
if (numArgs++ > 0) {
read(",");
}
argList.add(readExpression()); argList.add(readExpression());
} while (readIfMore(true));
} }
args = argList.toArray(new Expression[0]); args = argList.toArray(new Expression[0]);
return new JavaFunction(functionAlias, args); return new JavaFunction(functionAlias, args);
...@@ -3300,12 +3297,10 @@ public class Parser { ...@@ -3300,12 +3297,10 @@ public class Parser {
if (readIfMore(true)) { if (readIfMore(true)) {
ArrayList<Expression> list = Utils.newSmallArrayList(); ArrayList<Expression> list = Utils.newSmallArrayList();
list.add(r); list.add(r);
while (!readIf(")")) { if (!readIf(")")) {
r = readExpression(); do {
list.add(r); list.add(readExpression());
if (!readIfMore(true)) { } while (readIfMore(false));
break;
}
} }
r = new ExpressionList(list.toArray(new Expression[0])); r = new ExpressionList(list.toArray(new Expression[0]));
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论