use of com.github.javaparser.Position in project javaparser by javaparser.
the class ASTParser method EmptyImportDeclaration.
public final ImportDeclaration EmptyImportDeclaration() {
Position begin;
jj_consume_token(SEMICOLON);
begin = tokenBegin();
return ImportDeclaration.createEmptyDeclaration(range(begin, tokenEnd()));
}
use of com.github.javaparser.Position in project javaparser by javaparser.
the class ASTParser method DoStatement.
public final DoStmt DoStatement() {
Expression condition;
Statement body;
Position begin;
jj_consume_token(DO);
begin = tokenBegin();
body = Statement();
jj_consume_token(WHILE);
jj_consume_token(LPAREN);
condition = Expression();
jj_consume_token(RPAREN);
jj_consume_token(SEMICOLON);
return new DoStmt(range(begin, tokenEnd()), body, condition);
}
use of com.github.javaparser.Position in project javaparser by javaparser.
the class ASTParser method AllocationExpression.
public final Expression AllocationExpression(Expression scope) {
Expression ret;
Type type;
RangedList<Type<?>> typeArgs = new RangedList<Type<?>>(null);
List<BodyDeclaration<?>> anonymousBody = null;
List<Expression> args;
Position begin;
List<AnnotationExpr> annotations = null;
jj_consume_token(NEW);
if (scope == null) {
begin = tokenBegin();
} else {
begin = scope.getBegin();
}
annotations = Annotations();
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case FLOAT:
case INT:
case LONG:
case SHORT:
{
type = PrimitiveType();
type.setAnnotations(annotations);
ret = ArrayCreation(begin, type);
break;
}
case IDENTIFIER:
case AT:
case LT:
{
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case LT:
{
typeArgs = TypeArguments();
annotations = Annotations();
break;
}
default:
jj_la1[117] = jj_gen;
;
}
type = AnnotatedClassOrInterfaceType();
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case LBRACKET:
case AT:
{
ret = ArrayCreation(begin, type);
break;
}
case LPAREN:
{
args = Arguments();
if (jj_2_32(2)) {
anonymousBody = ClassOrInterfaceBody(false);
} else {
;
}
ret = new ObjectCreationExpr(range(begin, tokenEnd()), scope, (ClassOrInterfaceType) type, typeArgs.list, args, anonymousBody);
break;
}
default:
jj_la1[118] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
}
default:
jj_la1[119] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
return ret;
}
use of com.github.javaparser.Position in project javaparser by javaparser.
the class ASTParser method ClassOrInterfaceType.
public final ClassOrInterfaceType ClassOrInterfaceType() {
ClassOrInterfaceType ret;
String name;
RangedList<Type<?>> typeArgs = new RangedList<Type<?>>(null);
Position begin;
List<AnnotationExpr> annotations = null;
jj_consume_token(IDENTIFIER);
begin = tokenBegin();
name = token.image;
if (jj_2_14(2)) {
typeArgs = TypeArguments();
} else {
;
}
ret = new ClassOrInterfaceType(range(begin, tokenEnd()), null, name, typeArgs.list);
label_25: while (true) {
if (jj_2_15(2)) {
;
} else {
break label_25;
}
jj_consume_token(DOT);
annotations = Annotations();
jj_consume_token(IDENTIFIER);
name = token.image;
if (jj_2_16(2)) {
typeArgs = TypeArguments();
} else {
;
}
ret = new ClassOrInterfaceType(range(begin, tokenEnd()), ret, name, typeArgs.list);
ret.setAnnotations(annotations);
annotations = null;
}
return ret;
}
use of com.github.javaparser.Position in project javaparser by javaparser.
the class ASTParser method TypeParameter.
public final TypeParameter TypeParameter() {
String name;
List<ClassOrInterfaceType> typeBound = null;
Position begin;
jj_consume_token(IDENTIFIER);
name = token.image;
begin = tokenBegin();
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case EXTENDS:
{
typeBound = TypeBound();
break;
}
default:
jj_la1[24] = jj_gen;
;
}
return new TypeParameter(range(begin, tokenEnd()), name, typeBound);
}
Aggregations