private static void ReadPackage(JavaCodeParser parser, JavaFileInfo info) { parser.SkipSpaces(); parser.SkipReadAnnotationList(); parser.SkipSpaces(); info.Package = parser.ReadPackageDeclaration(); }
private void UpdateLocalData(JavaFileInfo info) { packages.Add(info.Package); foreach (Type type in info.Types) { UpdateLocalDataForType(type); } }
private static void ReadImportList(JavaCodeParser parser, JavaFileInfo info) { while (true) { parser.SkipSpaces(); Import?import = parser.ReadImportDeclaration(); if (!import.HasValue) { break; } info.Imports.Add(import.Value); } }
public JavaFileInfo Process(File file) { JavaFileInfo info = new JavaFileInfo(); fileInfo.Add(file, info); JavaCodeParser parser = new JavaCodeParser(JavaParseUtils.PrepareCodeFile(file.Contents)); parser.AnnotationCallback += IncrementAnnotation; parser.CodeBlockCallback += blockParser => ReadCodeBlock(blockParser, GlobalInfo); ReadPackage(parser, info); ReadImportList(parser, info); ReadTopLevelTypes(parser, info); UpdateLocalData(info); return info; }
public JavaFileInfo Process(File file) { JavaFileInfo info = new JavaFileInfo(); fileInfo.Add(file, info); JavaCodeParser parser = new JavaCodeParser(JavaParseUtils.PrepareCodeFile(file.Contents)); parser.AnnotationCallback += IncrementAnnotation; parser.CodeBlockCallback += blockParser => ReadCodeBlock(blockParser, GlobalInfo); ReadPackage(parser, info); ReadImportList(parser, info); ReadTopLevelTypes(parser, info); UpdateLocalData(info); return(info); }
private static void ReadTopLevelTypes(JavaCodeParser parser, JavaFileInfo info) { while (true) { parser.SkipSpaces(); if (parser.IsEOF) { break; } Type type = parser.ReadType(); if (type != null) { info.Types.Add(type); } else { break; } } }
private void UpdateLocalData(JavaFileInfo info) { packages.Add(info.Package); foreach(Type type in info.Types){ UpdateLocalDataForType(type); } }
private static void ReadTopLevelTypes(JavaCodeParser parser, JavaFileInfo info) { while(true){ parser.SkipSpaces(); if (parser.IsEOF)break; Type type = parser.ReadType(); if (type != null)info.Types.Add(type); else break; } }
private static void ReadPackage(JavaCodeParser parser, JavaFileInfo info) { parser.SkipSpaces(); parser.SkipReadAnnotationList(); parser.SkipSpaces(); info.Package = parser.ReadPackageDeclaration(); }
private static void ReadImportList(JavaCodeParser parser, JavaFileInfo info) { while(true){ parser.SkipSpaces(); Import? import = parser.ReadImportDeclaration(); if (!import.HasValue)break; info.Imports.Add(import.Value); } }
private static Node GenerateTreeViewDataForType(JavaFileInfo fileInfo, Type type) { Type.TypeData data = type.GetData(); Type.DataEnum dataEnum = data as Type.DataEnum; Node node = new Node(type.ToString()); if (fileInfo != null){ Node packageNode = new Node("[Package]"); packageNode.Add(fileInfo.Package); node.Add(packageNode); Node importNode = new Node("[Imports]"); importNode.AddRangeAsStrings(fileInfo.Imports); node.Add(importNode); } if (data.Fields.Count > 0){ Node fieldNode = new Node("[Fields]"); fieldNode.AddRangeAsStrings(data.Fields); node.Add(fieldNode); } if (data.Methods.Count > 0){ Node methodNode = new Node("[Methods]"); methodNode.AddRangeAsStrings(data.Methods); node.Add(methodNode); } if (type.NestedTypes.Count > 0){ Node nestedNode = new Node("[Nested Types]"); nestedNode.AddRange(type.NestedTypes.Select(nestedType => GenerateTreeViewDataForType(null, nestedType))); node.Add(nestedNode); } if (dataEnum != null){ Node enumNode = new Node("[Enum Values]"); enumNode.AddRange(dataEnum.EnumValues); node.Add(enumNode); } return node; }