1
0
mirror of https://github.com/chylex/Code-Statistics.git synced 2025-05-29 21:34:07 +02:00

Move Java handling to a separate project

This commit is contained in:
chylex 2016-06-24 14:22:05 +02:00
parent 8b49e30b41
commit 0838daaa26
27 changed files with 181 additions and 65 deletions

View File

@ -14,6 +14,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{7DF275DC-F
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{173BB629-3810-4862-9191-4EE4D1118C81}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LanguageJava", "LanguageJava\LanguageJava.csproj", "{BDC141F0-956D-441D-9711-16AF83909294}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -44,6 +46,14 @@ Global
{6E9BF33E-C035-4A44-AE11-6C2CFB029C0B}.Release|Any CPU.Build.0 = Release|Any CPU
{6E9BF33E-C035-4A44-AE11-6C2CFB029C0B}.Windows|Any CPU.ActiveCfg = Release|Any CPU
{6E9BF33E-C035-4A44-AE11-6C2CFB029C0B}.Windows|Any CPU.Build.0 = Release|Any CPU
{BDC141F0-956D-441D-9711-16AF83909294}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BDC141F0-956D-441D-9711-16AF83909294}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BDC141F0-956D-441D-9711-16AF83909294}.Mono|Any CPU.ActiveCfg = Release|Any CPU
{BDC141F0-956D-441D-9711-16AF83909294}.Mono|Any CPU.Build.0 = Release|Any CPU
{BDC141F0-956D-441D-9711-16AF83909294}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BDC141F0-956D-441D-9711-16AF83909294}.Release|Any CPU.Build.0 = Release|Any CPU
{BDC141F0-956D-441D-9711-16AF83909294}.Windows|Any CPU.ActiveCfg = Release|Any CPU
{BDC141F0-956D-441D-9711-16AF83909294}.Windows|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -52,5 +62,6 @@ Global
{B1BC156C-AAA8-40EB-B90B-AEE950870D62} = {7DF275DC-FB62-4FC3-B8FC-4BC3EDB870AD}
{BD148062-5858-49E7-B11B-20FC6E7114DD} = {173BB629-3810-4862-9191-4EE4D1118C81}
{6E9BF33E-C035-4A44-AE11-6C2CFB029C0B} = {7DF275DC-FB62-4FC3-B8FC-4BC3EDB870AD}
{BDC141F0-956D-441D-9711-16AF83909294} = {D767D50E-CD3A-42A5-A50A-FA0479AA8DAD}
EndGlobalSection
EndGlobal

View File

@ -88,25 +88,6 @@
<Compile Include="Handling\General\AssetHandler.cs" />
<Compile Include="Handling\General\FolderHandler.cs" />
<Compile Include="Handling\General\UnknownHandler.cs" />
<Compile Include="Handling\Languages\JavaHandler.cs" />
<Compile Include="Handling\Languages\Java\Elements\Annotation.cs" />
<Compile Include="Handling\Languages\Java\Elements\Field.cs" />
<Compile Include="Handling\Languages\Java\Elements\FlowStatement.cs" />
<Compile Include="Handling\Languages\Java\Elements\TypeIdentifier.cs" />
<Compile Include="Handling\Languages\Java\Elements\Import.cs" />
<Compile Include="Handling\Languages\Java\Elements\Member.cs" />
<Compile Include="Handling\Languages\Java\Elements\Method.cs" />
<Compile Include="Handling\Languages\Java\Elements\Modifiers.cs" />
<Compile Include="Handling\Languages\Java\Elements\Primitives.cs" />
<Compile Include="Handling\Languages\Java\Elements\Type.cs" />
<Compile Include="Handling\Languages\Java\Elements\TypeOf.cs" />
<Compile Include="Handling\Languages\Java\JavaCodeBlockParser.cs" />
<Compile Include="Handling\Languages\Java\JavaGlobalInfo.cs" />
<Compile Include="Handling\Languages\Java\Utils\JavaCharacters.cs" />
<Compile Include="Handling\Languages\Java\JavaCodeParser.cs" />
<Compile Include="Handling\Languages\Java\JavaFileInfo.cs" />
<Compile Include="Handling\Languages\Java\Utils\JavaParseUtils.cs" />
<Compile Include="Handling\Languages\Java\JavaState.cs" />
<Compile Include="Handling\HandlerList.cs" />
<Compile Include="Handling\Project.cs" />
<Compile Include="Input\FileSearch.cs" />
@ -190,6 +171,10 @@
<Project>{6e9bf33e-c035-4a44-ae11-6c2cfb029c0b}</Project>
<Name>CodeStatisticsCore</Name>
</ProjectReference>
<ProjectReference Include="..\LanguageJava\LanguageJava.csproj">
<Project>{bdc141f0-956d-441d-9711-16af83909294}</Project>
<Name>LanguageJava</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>

View File

@ -1,10 +1,10 @@
using CodeStatistics.Handling.General;
using CodeStatistics.Handling.Languages;
using CodeStatistics.Input;
using System.Collections.Generic;
using System.Linq;
using CodeStatisticsCore.Handling;
using CodeStatisticsCore.Input;
using LanguageJava;
namespace CodeStatistics.Handling{
static class HandlerList{

View File

@ -83,6 +83,10 @@
<Project>{b1bc156c-aaa8-40eb-b90b-aee950870d62}</Project>
<Name>CodeStatistics</Name>
</ProjectReference>
<ProjectReference Include="..\LanguageJava\LanguageJava.csproj">
<Project>{BDC141F0-956D-441D-9711-16AF83909294}</Project>
<Name>LanguageJava</Name>
</ProjectReference>
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">

View File

@ -1,5 +1,5 @@
using CodeStatistics.Handling.Languages.Java;
using CodeStatistics.Handling.Languages.Java.Elements;
using LanguageJava.Elements;
using LanguageJava.Handling;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CodeStatisticsTests.Languages.Java{

View File

@ -1,5 +1,5 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using CodeStatistics.Handling.Languages.Java.Utils;
using LanguageJava.Utils;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CodeStatisticsTests.Languages.Java{
[TestClass]

View File

@ -1,4 +1,4 @@
namespace CodeStatistics.Handling.Languages.Java.Elements{
namespace LanguageJava.Elements{
public struct Annotation{
public static bool operator ==(Annotation obj1, Annotation obj2){
return obj1.Equals(obj2);

View File

@ -1,4 +1,4 @@
namespace CodeStatistics.Handling.Languages.Java.Elements{
namespace LanguageJava.Elements{
public class Field : Member{
public readonly string Identifier;
public readonly TypeOf Type;

View File

@ -1,5 +1,5 @@
namespace CodeStatistics.Handling.Languages.Java.Elements{
enum FlowStatement{
namespace LanguageJava.Elements{
public enum FlowStatement{
If, Else, For, EnhancedFor, While, DoWhile, Switch, SwitchCase, SwitchDefault, TryCatch, TryWithResources, Try, Catch, Finally, Return, Break, Continue
}
}

View File

@ -1,4 +1,4 @@
namespace CodeStatistics.Handling.Languages.Java.Elements{
namespace LanguageJava.Elements{
public struct Import{
public static bool operator ==(Import obj1, Import obj2){
return obj1.Equals(obj2);

View File

@ -2,7 +2,7 @@
using System.Collections.ObjectModel;
using System.Linq;
namespace CodeStatistics.Handling.Languages.Java.Elements{
namespace LanguageJava.Elements{
public class Member{
public readonly ReadOnlyCollection<Annotation> Annotations;
public readonly Modifiers Modifiers;

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace CodeStatistics.Handling.Languages.Java.Elements{
namespace LanguageJava.Elements{
public class Method : Member{
public const string ConstructorIdentifier = "<explinit>"; // explicit constructor

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using CodeStatisticsCore.Collections;
namespace CodeStatistics.Handling.Languages.Java.Elements{
namespace LanguageJava.Elements{
[Flags]
public enum Modifiers{
None = 0x0,

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using CodeStatisticsCore.Collections;
namespace CodeStatistics.Handling.Languages.Java.Elements{
namespace LanguageJava.Elements{
public enum Primitives{
Boolean,
Byte,

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace CodeStatistics.Handling.Languages.Java.Elements{
namespace LanguageJava.Elements{
public class Type : Member{
public enum DeclarationType{
Class, Interface, Enum, Annotation

View File

@ -1,5 +1,5 @@
namespace CodeStatistics.Handling.Languages.Java.Elements{
struct TypeIdentifier{
namespace LanguageJava.Elements{
public struct TypeIdentifier{
public static bool operator ==(TypeIdentifier obj1, TypeIdentifier obj2){
return obj1.Equals(obj2);
}

View File

@ -1,9 +1,9 @@
using CodeStatistics.Handling.Languages.Java.Utils;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.Contracts;
using LanguageJava.Utils;
namespace CodeStatistics.Handling.Languages.Java.Elements{
namespace LanguageJava.Elements{
public struct TypeOf{
private static readonly ReadOnlyCollection<TypeOf> EmptyCollection = new List<TypeOf>().AsReadOnly();

View File

@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using CodeStatistics.Handling.Languages.Java.Utils;
using System.Linq;
using CodeStatisticsCore.Handling.Utils;
using LanguageJava.Utils;
namespace CodeStatistics.Handling.Languages.Java{
namespace LanguageJava.Handling{
public class JavaCodeBlockParser : CodeParser{
private static readonly string[] ParsedKeywords = {
"if", "else", "for", "while", "do", "switch", "case", "default", "try", "catch", "finally", "return", "break", "continue"

View File

@ -1,10 +1,10 @@
using System.Collections.Generic;
using CodeStatistics.Handling.Languages.Java.Elements;
using System.Text;
using CodeStatistics.Handling.Languages.Java.Utils;
using CodeStatisticsCore.Handling.Utils;
using LanguageJava.Elements;
using LanguageJava.Utils;
namespace CodeStatistics.Handling.Languages.Java{
namespace LanguageJava.Handling{
public class JavaCodeParser : CodeParser{
public delegate void OnAnnotationRead(Annotation annotation);
public delegate void OnCodeBlockRead(JavaCodeBlockParser blockParser);

View File

@ -1,8 +1,8 @@
using System.Collections.Generic;
using CodeStatistics.Handling.Languages.Java.Elements;
using LanguageJava.Elements;
namespace CodeStatistics.Handling.Languages.Java{
class JavaFileInfo{
namespace LanguageJava.Handling{
public class JavaFileInfo{
public string Package;
public readonly HashSet<Import> Imports;
public readonly List<Type> Types;

View File

@ -1,9 +1,9 @@
using System.Collections.Generic;
using CodeStatistics.Handling.Languages.Java.Elements;
using CodeStatisticsCore.Collections;
using LanguageJava.Elements;
namespace CodeStatistics.Handling.Languages.Java{
class JavaGlobalInfo{
namespace LanguageJava.Handling{
public class JavaGlobalInfo{
public readonly CounterDictionary<string> AnnotationUses = new CounterDictionary<string>(8);
public readonly CounterDictionary<string> FieldTypes = new CounterDictionary<string>(10);
public readonly CounterDictionary<string> MethodReturnTypes = new CounterDictionary<string>(10);

View File

@ -1,10 +1,10 @@
using System.Collections.Generic;
using CodeStatistics.Handling.Languages.Java.Elements;
using CodeStatistics.Handling.Languages.Java.Utils;
using CodeStatisticsCore.Input;
using LanguageJava.Elements;
using LanguageJava.Utils;
namespace CodeStatistics.Handling.Languages.Java{
class JavaState{
namespace LanguageJava.Handling{
public class JavaState{
private readonly Dictionary<File,JavaFileInfo> fileInfo = new Dictionary<File,JavaFileInfo>();
private readonly HashSet<string> packages = new HashSet<string>();

View File

@ -1,19 +1,19 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using File = CodeStatisticsCore.Input.File;
using CodeStatistics.Handling.Languages.Java;
using CodeStatistics.Handling.Languages.Java.Utils;
using Type = CodeStatistics.Handling.Languages.Java.Elements.Type;
using CodeStatistics.Handling.Languages.Java.Elements;
using System.Collections.Generic;
using System.Windows.Forms;
using CodeStatisticsCore.Handling;
using CodeStatisticsCore.Handling.Utils;
using CodeStatisticsCore.Handling.Files;
using CodeStatisticsCore.Handling.Utils;
using LanguageJava.Elements;
using LanguageJava.Handling;
using LanguageJava.Utils;
using File = CodeStatisticsCore.Input.File;
using Type = LanguageJava.Elements.Type;
namespace CodeStatistics.Handling.Languages{
class JavaHandler : AbstractLanguageFileHandler{
namespace LanguageJava{
public class JavaHandler : AbstractLanguageFileHandler{
public override int Weight{
get { return 50; }
}

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BDC141F0-956D-441D-9711-16AF83909294}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LanguageJava</RootNamespace>
<AssemblyName>Language.Java</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<RegisterForComInterop>false</RegisterForComInterop>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="Elements\Annotation.cs" />
<Compile Include="Elements\Field.cs" />
<Compile Include="Elements\FlowStatement.cs" />
<Compile Include="Elements\Import.cs" />
<Compile Include="Elements\Member.cs" />
<Compile Include="Elements\Method.cs" />
<Compile Include="Elements\Modifiers.cs" />
<Compile Include="Elements\Primitives.cs" />
<Compile Include="Elements\Type.cs" />
<Compile Include="Elements\TypeIdentifier.cs" />
<Compile Include="Elements\TypeOf.cs" />
<Compile Include="Handling\JavaCodeBlockParser.cs" />
<Compile Include="Handling\JavaCodeParser.cs" />
<Compile Include="Handling\JavaFileInfo.cs" />
<Compile Include="Handling\JavaGlobalInfo.cs" />
<Compile Include="Handling\JavaState.cs" />
<Compile Include="JavaHandler.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\JavaCharacters.cs" />
<Compile Include="Utils\JavaParseUtils.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CodeStatisticsCore\CodeStatisticsCore.csproj">
<Project>{6e9bf33e-c035-4a44-ae11-6c2cfb029c0b}</Project>
<Name>CodeStatisticsCore</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,38 @@
using System;
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Code Statistics Java")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("chylex")]
[assembly: AssemblyProduct("Code Statistics Java")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("105beeac-991f-4dc1-862a-71dbc58ef9b8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: CLSCompliant(true)]

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using CodeStatisticsCore.Collections;
namespace CodeStatistics.Handling.Languages.Java.Utils{
namespace LanguageJava.Utils{
static class JavaCharacters{
private static readonly CharacterRangeSet ValidIdentiferStarts = new CharacterRangeSet{
{ 36, 36 }, { 65, 90 }, { 95, 95 }, { 97, 122 }, { 162, 165 }, { 170, 170 }, { 181, 181 }, { 186, 186 }, { 192, 214 }, { 216, 246 }, { 248, 705 }, { 710, 721 },

View File

@ -1,7 +1,8 @@
using System.Collections.Generic;
using System.Text.RegularExpressions;
using LanguageJava.Handling;
namespace CodeStatistics.Handling.Languages.Java.Utils{
namespace LanguageJava.Utils{
public static class JavaParseUtils{
// verbatim strings with quotes need "" for literal
private static readonly Regex RegexString = new Regex(@"([""'])(?:\\[\\'""btnfru0-7]|[^\\""])*?(?:\1|$|(?=\*/))",RegexOptions.Compiled | RegexOptions.Multiline);