public static AccessFlags GetAccessFlags(JavaParser.TypeDeclarationContext context) { ModifierListener modifierListener = new ModifierListener(); AccessFlags modifier = AccessFlags.None; foreach (JavaParser.ClassOrInterfaceModifierContext classOrInterfaceModifierContext in context.classOrInterfaceModifier()) { classOrInterfaceModifierContext.EnterRule(modifierListener); modifier |= modifierListener.flag; } return(modifier); }
public UstNode VisitTypeDeclaration(JavaParser.TypeDeclarationContext context) { var child0Terminal = context.GetChild(0) as ITerminalNode; if (child0Terminal != null) // ignore ';' { return(null); } // TODO: implement modifiers. var result = Visit(context.GetChild(context.ChildCount - 1)); return(result); }
public override void EnterTypeDeclaration(JavaParser.TypeDeclarationContext context) { AccessFlags modifier = GetAccessFlags(context); if (context.annotationTypeDeclaration() != null) { AnnotationTypeDeclarationListener annotationTypeDeclarationListener = new AnnotationTypeDeclarationListener(); context.annotationTypeDeclaration().EnterRule(annotationTypeDeclarationListener); } // this type could be a class, enum, or interface if (context.classDeclaration() != null) { ClassDeclarationListener classDeclarationListener = new ClassDeclarationListener(parentFilePath, packageFqn, modifier); context.classDeclaration().EnterRule(classDeclarationListener); OuterClassInfo = classDeclarationListener.ClassInfo; } if (context.interfaceDeclaration() != null) { InterfaceDeclarationListener interfaceDeclarationListener = new InterfaceDeclarationListener(parentFilePath, packageFqn, modifier); context.interfaceDeclaration().EnterRule(interfaceDeclarationListener); InterfaceInfo = interfaceDeclarationListener.InterfaceInfo; } if (context.enumDeclaration() != null) { EnumDeclarationListener enumDeclarationListener = new EnumDeclarationListener(parentFilePath, packageFqn, modifier); context.enumDeclaration().EnterRule(enumDeclarationListener); EnumInfo = enumDeclarationListener.EnumInfo; } }
public Ust VisitTypeDeclaration(JavaParser.TypeDeclarationContext context) { return(ProcessTypeDeclaration(context, context.classOrInterfaceModifier())); }