parseListType method

ListTypeContext? parseListType()

Implementation

ListTypeContext? parseListType() {
  if (next(TokenType.LBRACKET) && current != null) {
    var LBRACKET = current!;
    var type = parseType();
    if (type != null) {
      if (next(TokenType.RBRACKET)) {
        return ListTypeContext(LBRACKET, type, current!);
      } else {
        errors.add(SyntaxError('Missing "]" in list type.', type.span));
        return null;
      }
    } else {
      errors.add(SyntaxError('Missing type after "[".', LBRACKET.span));
      return null;
    }
  } else {
    return null;
  }
}