parseArrayLiteral method
Implementation
Expression parseArrayLiteral() {
int start = token?.startOffset??0;
Token? open = requireNext(Token.LBRACKET);
List<Expression?> expressions = <Expression>[];
while (token?.type != Token.RBRACKET) {
if (token?.type == Token.COMMA) {
next();
expressions.add(null);
} else if( token?.type == Token.DOT ) {
Token? tok = next();
if( tok?.type==Token.DOT && token?.type==Token.DOT ) {
tok = next();
if( tok?.type==Token.DOT && token?.type==Token.DOT ) {
next();
expressions.add(SpreadExpression(makeName(token)));
if( token?.type != Token.RBRACKET ) {
next();
}
}
}
} else {
final expr = parseAssignment();
expressions.add(expr);
if (token?.type != Token.RBRACKET) {
consume(Token.COMMA);
}
}
}
consume(Token.RBRACKET);
return new ArrayExpression(expressions)
..start = start??0
..end = endOffset??0
..line = open?.line??0;
}