use of com.github.javaparser.Position in project javaparser by javaparser.
the class ASTParser method AnnotationTypeMemberDeclaration.
public final AnnotationMemberDeclaration AnnotationTypeMemberDeclaration(ModifierHolder modifier) {
Type type;
String name;
Expression defaultVal = null;
type = Type();
jj_consume_token(IDENTIFIER);
name = token.image;
jj_consume_token(LPAREN);
jj_consume_token(RPAREN);
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case _DEFAULT:
{
defaultVal = DefaultValue();
break;
}
default:
jj_la1[159] = jj_gen;
;
}
jj_consume_token(SEMICOLON);
Position begin = modifier.begin.orIfInvalid(tokenBegin());
return new AnnotationMemberDeclaration(range(begin, tokenEnd()), modifier.modifiers, modifier.annotations, type, name, defaultVal);
}
use of com.github.javaparser.Position in project javaparser by javaparser.
the class ASTParser method MarkerAnnotation.
public final MarkerAnnotationExpr MarkerAnnotation() {
NameExpr name;
Position begin;
jj_consume_token(AT);
begin = tokenBegin();
name = Name();
return new MarkerAnnotationExpr(range(begin, tokenEnd()), name);
}
use of com.github.javaparser.Position in project javaparser by javaparser.
the class ASTParser method EnumConstantDeclaration.
public final EnumConstantDeclaration EnumConstantDeclaration() {
List<AnnotationExpr> annotations = null;
AnnotationExpr ann;
String name;
List<Expression> args = null;
List<BodyDeclaration<?>> classBody = null;
Position begin = INVALID;
label_8: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case AT:
{
;
break;
}
default:
jj_la1[20] = jj_gen;
break label_8;
}
ann = Annotation();
annotations = add(annotations, ann);
begin = begin.orIfInvalid(ann.getBegin());
}
jj_consume_token(IDENTIFIER);
name = token.image;
begin = begin.orIfInvalid(tokenBegin());
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case LPAREN:
{
args = Arguments();
break;
}
default:
jj_la1[21] = jj_gen;
;
}
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case LBRACE:
{
classBody = ClassOrInterfaceBody(false);
break;
}
default:
jj_la1[22] = jj_gen;
;
}
return new EnumConstantDeclaration(range(begin, tokenEnd()), annotations, name, args, classBody);
}
use of com.github.javaparser.Position in project javaparser by javaparser.
the class ASTParser method ImportDeclaration.
public final ImportDeclaration ImportDeclaration() {
NameExpr name;
boolean isStatic = false;
boolean isAsterisk = false;
Position begin;
jj_consume_token(IMPORT);
begin = tokenBegin();
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case STATIC:
{
jj_consume_token(STATIC);
isStatic = true;
break;
}
default:
jj_la1[4] = jj_gen;
;
}
name = Name();
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case DOT:
{
jj_consume_token(DOT);
jj_consume_token(STAR);
isAsterisk = true;
break;
}
default:
jj_la1[5] = jj_gen;
;
}
jj_consume_token(SEMICOLON);
return new ImportDeclaration(range(begin, tokenEnd()), name, isStatic, isAsterisk);
}
use of com.github.javaparser.Position in project javaparser by javaparser.
the class ASTParser method Wildcard.
public final WildcardType Wildcard() {
ReferenceType ext = null;
ReferenceType sup = null;
Position begin;
List<AnnotationExpr> annotations = null;
jj_consume_token(HOOK);
begin = tokenBegin();
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case EXTENDS:
case SUPER:
{
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case EXTENDS:
{
jj_consume_token(EXTENDS);
annotations = Annotations();
ext = ReferenceType();
ext.setAnnotations(annotations);
break;
}
case SUPER:
{
jj_consume_token(SUPER);
annotations = Annotations();
sup = ReferenceType();
sup.setAnnotations(annotations);
break;
}
default:
jj_la1[61] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
}
default:
jj_la1[62] = jj_gen;
;
}
return new WildcardType(range(begin, tokenEnd()), ext, sup);
}
Aggregations