argList method
Implementation
List<MathExpr> argList({TokenType? terminal, List<TokenType>? terminals}) {
assert(
(terminal != null) ^ (terminals != null),
'Expected a single terminal or list of terminals.',
);
if (terminal != null) {
terminals = [terminal];
}
// B/c of the steps above, it must be the case
// that the list is not null.
terminals!;
final List<MathExpr> args = [];
while (!eof() && !terminals.contains(peek().type)) {
try {
args.add(math());
} catch (e) {
addError(e.toString());
}
if (peek().type == TokenType.kComma) {
advance();
}
}
return args;
}