private JCArrayTypeTree bracketsOptCont(JCExpression t, int pos) { accept(RBRACKET); t = bracketsOpt(t); return toP(F.at(pos).TypeArray(t)); }
/** ArrayCreatorRest = "[" ( "]" BracketsOpt ArrayInitializer * | Expression "]" {"[" Expression "]"} BracketsOpt ) */ JCExpression arrayCreatorRest(int newpos, JCExpression elemtype) { accept(LBRACKET); if (S.token() == RBRACKET) { accept(RBRACKET); elemtype = bracketsOpt(elemtype); if (S.token() == LBRACE) { return arrayInitializer(newpos, elemtype); } else { return syntaxError(S.pos(), "array.dimension.missing"); } } else { ListBuffer<JCExpression> dims = new ListBuffer<JCExpression>(); dims.append(expression()); accept(RBRACKET); while (S.token() == LBRACKET) { int pos = S.pos(); S.nextToken(); if (S.token() == RBRACKET) { elemtype = bracketsOptCont(elemtype, pos); } else { dims.append(expression()); accept(RBRACKET); } } return toP(F.at(newpos).NewArray(elemtype, dims.toList(), null)); } }
private JCArrayTypeTree bracketsOptCont(JCExpression t, int pos) { accept(RBRACKET); t = bracketsOpt(t); return toP(F.at(pos).TypeArray(t)); }
/** ArrayCreatorRest = "[" ( "]" BracketsOpt ArrayInitializer * | Expression "]" {"[" Expression "]"} BracketsOpt ) */ JCExpression arrayCreatorRest(int newpos, JCExpression elemtype) { accept(LBRACKET); if (S.token() == RBRACKET) { accept(RBRACKET); elemtype = bracketsOpt(elemtype); if (S.token() == LBRACE) { return arrayInitializer(newpos, elemtype); } else { return syntaxError(S.pos(), "array.dimension.missing"); } } else { ListBuffer<JCExpression> dims = new ListBuffer<JCExpression>(); dims.append(expression()); accept(RBRACKET); while (S.token() == LBRACKET) { int pos = S.pos(); S.nextToken(); if (S.token() == RBRACKET) { elemtype = bracketsOptCont(elemtype, pos); } else { dims.append(expression()); accept(RBRACKET); } } return toP(F.at(newpos).NewArray(elemtype, dims.toList(), null)); } }
/** VariableDeclaratorId = Ident BracketsOpt */ JCVariableDecl variableDeclaratorId(JCModifiers mods, JCExpression type) { int pos = S.pos(); Name name = ident(); if ((mods.flags & Flags.VARARGS) == 0) type = bracketsOpt(type); return toP(F.at(pos).VarDef(mods, name, type, null)); }
/** VariableDeclaratorId = Ident BracketsOpt */ JCVariableDecl variableDeclaratorId(JCModifiers mods, JCExpression type) { int pos = S.pos(); Name name = ident(); if ((mods.flags & Flags.VARARGS) == 0) type = bracketsOpt(type); return toP(F.at(pos).VarDef(mods, name, type, null)); }
/** VariableDeclaratorRest = BracketsOpt ["=" VariableInitializer] * ConstantDeclaratorRest = BracketsOpt "=" VariableInitializer * * @param reqInit Is an initializer always required? * @param dc The documentation comment for the variable declarations, or null. */ JCVariableDecl variableDeclaratorRest(int pos, JCModifiers mods, JCExpression type, Name name, boolean reqInit, String dc) { type = bracketsOpt(type); JCExpression init = null; if (S.token() == EQ) { S.nextToken(); init = variableInitializer(); } else if (reqInit) syntaxError(S.pos(), "expected", keywords.token2string(EQ)); JCVariableDecl result = toP(F.at(pos).VarDef(mods, name, type, init)); attach(result, dc); return result; }
/** VariableDeclaratorRest = BracketsOpt ["=" VariableInitializer] * ConstantDeclaratorRest = BracketsOpt "=" VariableInitializer * * @param reqInit Is an initializer always required? * @param dc The documentation comment for the variable declarations, or null. */ JCVariableDecl variableDeclaratorRest(int pos, JCModifiers mods, JCExpression type, Name name, boolean reqInit, String dc) { type = bracketsOpt(type); JCExpression init = null; if (S.token() == EQ) { S.nextToken(); init = variableInitializer(); } else if (reqInit) syntaxError(S.pos(), "expected", keywords.token2string(EQ)); JCVariableDecl result = toP(F.at(pos).VarDef(mods, name, type, init)); attach(result, dc); return result; }
String dc) { List<JCVariableDecl> params = formalParameters(); if (!isVoid) type = bracketsOpt(type); List<JCExpression> thrown = List.nil(); if (S.token() == THROWS) {
String dc) { List<JCVariableDecl> params = formalParameters(); if (!isVoid) type = bracketsOpt(type); List<JCExpression> thrown = List.nil(); if (S.token() == THROWS) {
t = F.at(pos1).TypeApply(t, args.toList()); checkGenerics(); t = bracketsOpt(toP(t)); } else if ((mode & EXPR) != 0) { mode = EXPR; if (S.token() == RBRACKET) { S.nextToken(); t = bracketsOpt(t); t = toP(F.at(pos).TypeArray(t)); t = bracketsSuffix(t); case DOUBLE: case BOOLEAN: if (typeArgs != null) illegal(); t = bracketsSuffix(bracketsOpt(basicType())); break; case VOID: if (S.token() == RBRACKET) { S.nextToken(); t = bracketsOpt(t); t = toP(F.at(pos1).TypeArray(t)); return t;
t = F.at(pos1).TypeApply(t, args.toList()); checkGenerics(); t = bracketsOpt(toP(t)); } else if ((mode & EXPR) != 0) { mode = EXPR; if (S.token() == RBRACKET) { S.nextToken(); t = bracketsOpt(t); t = toP(F.at(pos).TypeArray(t)); t = bracketsSuffix(t); case DOUBLE: case BOOLEAN: if (typeArgs != null) illegal(); t = bracketsSuffix(bracketsOpt(basicType())); break; case VOID: if (S.token() == RBRACKET) { S.nextToken(); t = bracketsOpt(t); t = toP(F.at(pos1).TypeArray(t)); return t;