Added netcore45 and portable-net45 (Profile 78) assemblies

This commit is contained in:
Sam Harwell 2014-04-27 21:31:27 -05:00
parent 4ef578ec4d
commit 7dd8996d41
13 changed files with 1244 additions and 5 deletions

View File

@ -48,6 +48,14 @@
<file src="..\runtime\CSharp\Antlr4.Runtime\bin\portable-net40\$Configuration$\Antlr4.Runtime.portable-net40.pdb" target="lib\portable-net40+sl50+wp80+win"/>
<file src="..\runtime\CSharp\Antlr4.Runtime\bin\portable-net40\$Configuration$\Antlr4.Runtime.portable-net40.xml" target="lib\portable-net40+sl50+wp80+win"/>
<file src="..\runtime\CSharp\Antlr4.Runtime\bin\portable-net45\$Configuration$\Antlr4.Runtime.portable-net45.dll" target="lib\portable-net45+wp80+win"/>
<file src="..\runtime\CSharp\Antlr4.Runtime\bin\portable-net45\$Configuration$\Antlr4.Runtime.portable-net45.pdb" target="lib\portable-net45+wp80+win"/>
<file src="..\runtime\CSharp\Antlr4.Runtime\bin\portable-net45\$Configuration$\Antlr4.Runtime.portable-net45.xml" target="lib\portable-net45+wp80+win"/>
<file src="..\runtime\CSharp\Antlr4.Runtime\bin\netcore45\$Configuration$\Antlr4.Runtime.netcore45.dll" target="lib\netcore45"/>
<file src="..\runtime\CSharp\Antlr4.Runtime\bin\netcore45\$Configuration$\Antlr4.Runtime.netcore45.pdb" target="lib\netcore45"/>
<file src="..\runtime\CSharp\Antlr4.Runtime\bin\netcore45\$Configuration$\Antlr4.Runtime.netcore45.xml" target="lib\netcore45"/>
<!-- Source Code -->
<file exclude="..\runtime\CSharp\Antlr4.Runtime\obj\**\*.cs" src="..\runtime\CSharp\Antlr4.Runtime\**\*.cs" target="src"/>

View File

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.props" Condition="Exists('..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5844076E-3C92-4122-BB7A-0D745C3F5334}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Antlr4.Runtime.Test</RootNamespace>
<AssemblyName>Antlr4.Runtime.Test</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<BaseIntermediateOutputPath>obj\portable-net45\</BaseIntermediateOutputPath>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\portable-net45\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;PORTABLE;NET45;NET45PLUS;NET40PLUS;NET35PLUS;NET30PLUS;NET20PLUS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\portable-net45\Release\</OutputPath>
<DefineConstants>TRACE;PORTABLE;NET45;NET45PLUS;NET40PLUS;NET35PLUS;NET30PLUS;NET20PLUS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="BaseTest.cs" />
<Compile Include="JavaUnicodeInputStream.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sharpen\Checksum.cs" />
<Compile Include="Sharpen\CRC32.cs" />
<Compile Include="TaskSchedulers\QueuedTaskScheduler.cs" />
<Compile Include="TestBitSet.cs" />
<Compile Include="TestGraphNodes.cs" />
<Compile Include="TestIntervalSet.cs" />
<Compile Include="TestPerformance.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Antlr4.Runtime\Antlr4.Runtime.portable-net45.csproj">
<Project>{12269283-ee92-4faa-b849-53cd24f341fa}</Project>
<Name>Antlr4.Runtime.portable-net45</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Java-LR.g4" />
<EmbeddedResource Include="Java.g4" />
<Antlr4 Include="Java.g4" />
</ItemGroup>
<ItemGroup>
<None Include="packages.Antlr4.Runtime.Test.portable-net45.config" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.props'))" />
<Error Condition="!Exists('..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.targets'))" />
</Target>
<Import Project="..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.targets" Condition="Exists('..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.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,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Antlr4" version="4.2.1-alpha001" targetFramework="portable-net45+wp80+win" />
<package id="Antlr4.Runtime" version="4.2.1-alpha001" targetFramework="portable-net45+wp80+win" />
</packages>

View File

@ -0,0 +1,254 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.props" Condition="Exists('..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.props')" />
<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>{F3145DCA-EA26-4482-80D6-5232A79E2A3A}</ProjectGuid>
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Antlr4.Runtime</RootNamespace>
<AssemblyName>Antlr4.Runtime.netcore45</AssemblyName>
<FileAlignment>512</FileAlignment>
<BaseIntermediateOutputPath>obj\netcore45\</BaseIntermediateOutputPath>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\netcore45\Debug\</OutputPath>
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
<DefineConstants>TRACE;DEBUG;WINRT;PORTABLE;NET45;NET45PLUS;NET40PLUS;NET35PLUS;NET30PLUS;NET20PLUS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\netcore45\Release\</OutputPath>
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
<DefineConstants>TRACE;WINRT;PORTABLE;NET45;NET45PLUS;NET40PLUS;NET35PLUS;NET30PLUS;NET20PLUS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\..\..\..\..\keys\antlr\Key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="AntlrFileStream.cs" />
<Compile Include="AntlrInputStream.cs" />
<Compile Include="Atn\AbstractPredicateTransition.cs" />
<Compile Include="Atn\ActionTransition.cs" />
<Compile Include="Atn\AmbiguityInfo.cs" />
<Compile Include="Atn\ArrayPredictionContext.cs" />
<Compile Include="Atn\ATN.cs" />
<Compile Include="Atn\ATNConfig.cs" />
<Compile Include="Atn\ATNConfigSet.cs" />
<Compile Include="Atn\ATNDeserializationOptions.cs" />
<Compile Include="Atn\ATNDeserializer.cs" />
<None Include="Atn\ATNSerializer.cs" />
<Compile Include="Atn\ATNSimulator.cs" />
<Compile Include="Atn\ATNState.cs" />
<Compile Include="Atn\ATNType.cs" />
<Compile Include="Atn\AtomTransition.cs" />
<Compile Include="Atn\BasicBlockStartState.cs" />
<Compile Include="Atn\BasicState.cs" />
<Compile Include="Atn\BlockEndState.cs" />
<Compile Include="Atn\BlockStartState.cs" />
<Compile Include="Atn\ContextSensitivityInfo.cs" />
<Compile Include="Atn\DecisionEventInfo.cs" />
<Compile Include="Atn\DecisionInfo.cs" />
<Compile Include="Atn\DecisionState.cs" />
<Compile Include="Atn\EmptyPredictionContext.cs" />
<Compile Include="Atn\EpsilonTransition.cs" />
<Compile Include="Atn\ErrorInfo.cs" />
<Compile Include="Atn\ILexerAction.cs" />
<Compile Include="Atn\LexerActionExecutor.cs" />
<Compile Include="Atn\LexerActionType.cs" />
<Compile Include="Atn\LexerATNSimulator.cs" />
<Compile Include="Atn\LexerChannelAction.cs" />
<Compile Include="Atn\LexerCustomAction.cs" />
<Compile Include="Atn\LexerIndexedCustomAction.cs" />
<Compile Include="Atn\LexerModeAction.cs" />
<Compile Include="Atn\LexerMoreAction.cs" />
<Compile Include="Atn\LexerPopModeAction.cs" />
<Compile Include="Atn\LexerPushModeAction.cs" />
<Compile Include="Atn\LexerSkipAction.cs" />
<Compile Include="Atn\LexerTypeAction.cs" />
<Compile Include="Atn\LL1Analyzer.cs" />
<Compile Include="Atn\LookaheadEventInfo.cs" />
<Compile Include="Atn\LoopEndState.cs" />
<Compile Include="Atn\NotSetTransition.cs" />
<Compile Include="Atn\OrderedATNConfigSet.cs" />
<Compile Include="Atn\ParseInfo.cs" />
<Compile Include="Atn\ParserATNSimulator.cs" />
<Compile Include="Atn\PlusBlockStartState.cs" />
<Compile Include="Atn\PlusLoopbackState.cs" />
<Compile Include="Atn\PrecedencePredicateTransition.cs" />
<Compile Include="Atn\PredicateEvalInfo.cs" />
<Compile Include="Atn\PredicateTransition.cs" />
<Compile Include="Atn\PredictionContext.cs" />
<Compile Include="Atn\PredictionContextCache.cs" />
<Compile Include="Atn\PredictionMode.cs" />
<Compile Include="Atn\ProfilingATNSimulator.cs" />
<Compile Include="Atn\RangeTransition.cs" />
<Compile Include="Atn\RuleStartState.cs" />
<Compile Include="Atn\RuleStopState.cs" />
<Compile Include="Atn\RuleTransition.cs" />
<Compile Include="Atn\SemanticContext.cs" />
<Compile Include="Atn\SetTransition.cs" />
<Compile Include="Atn\SimulatorState.cs" />
<Compile Include="Atn\SingletonPredictionContext.cs" />
<Compile Include="Atn\StarBlockStartState.cs" />
<Compile Include="Atn\StarLoopbackState.cs" />
<Compile Include="Atn\StarLoopEntryState.cs" />
<Compile Include="Atn\StateType.cs" />
<Compile Include="Atn\TokensStartState.cs" />
<Compile Include="Atn\Transition.cs" />
<Compile Include="Atn\TransitionType.cs" />
<Compile Include="Atn\WildcardTransition.cs" />
<Compile Include="BailErrorStrategy.cs" />
<Compile Include="BaseErrorListener.cs" />
<Compile Include="BufferedTokenStream.cs" />
<Compile Include="CommonToken.cs" />
<Compile Include="CommonTokenFactory.cs" />
<Compile Include="CommonTokenStream.cs" />
<Compile Include="ConsoleErrorListener.cs" />
<Compile Include="DefaultErrorStrategy.cs" />
<Compile Include="Dependents.cs" />
<Compile Include="Dfa\AbstractEdgeMap`1.cs" />
<Compile Include="Dfa\ArrayEdgeMap`1.cs" />
<Compile Include="Dfa\DFA.cs" />
<Compile Include="Dfa\DFASerializer.cs" />
<Compile Include="Dfa\DFAState.cs" />
<Compile Include="Dfa\IEdgeMap`1.cs" />
<Compile Include="Dfa\LexerDFASerializer.cs" />
<Compile Include="Dfa\SingletonEdgeMap`1.cs" />
<Compile Include="Dfa\SparseEdgeMap`1.cs" />
<Compile Include="DiagnosticErrorListener.cs" />
<Compile Include="FailedPredicateException.cs" />
<Compile Include="IAntlrErrorListener`1.cs" />
<Compile Include="IAntlrErrorStrategy.cs" />
<Compile Include="ICharStream.cs" />
<Compile Include="IIntStream.cs" />
<Compile Include="InputMismatchException.cs" />
<Compile Include="InterpreterRuleContext.cs" />
<Compile Include="IParserErrorListener.cs" />
<Compile Include="IRecognizer.cs" />
<Compile Include="IToken.cs" />
<Compile Include="ITokenFactory.cs" />
<Compile Include="ITokenSource.cs" />
<Compile Include="ITokenStream.cs" />
<Compile Include="IWritableToken.cs" />
<Compile Include="Lexer.cs" />
<Compile Include="LexerInterpreter.cs" />
<Compile Include="LexerNoViableAltException.cs" />
<Compile Include="ListTokenSource.cs" />
<Compile Include="Misc\Args.cs" />
<None Include="..\..\..\..\..\..\keys\antlr\Key.snk">
<Link>Key.snk</Link>
</None>
<None Include="Misc\Array2DHashSet`1.cs" />
<Compile Include="Misc\NullableAttribute.cs" />
<None Include="Misc\DoubleKeyMap`3.cs" />
<Compile Include="Misc\IIntSet.cs" />
<Compile Include="Misc\Interval.cs" />
<Compile Include="Misc\IntervalSet.cs" />
<Compile Include="Misc\MultiMap`2.cs" />
<Compile Include="Misc\MurmurHash.cs" />
<Compile Include="Misc\NotNullAttribute.cs" />
<None Include="Misc\OrderedHashSet`1.cs" />
<Compile Include="Misc\ParseCanceledException.cs" />
<Compile Include="Misc\RuleDependencyChecker.cs" />
<None Include="Misc\RuleDependencyProcessor.cs" />
<None Include="Misc\TestRig.cs" />
<Compile Include="Misc\Utils.cs" />
<Compile Include="NoViableAltException.cs" />
<Compile Include="Parser.cs" />
<Compile Include="ParserInterpreter.cs" />
<Compile Include="ParserRuleContext.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ProxyErrorListener`1.cs" />
<Compile Include="ProxyParserErrorListener.cs" />
<Compile Include="RecognitionException.cs" />
<Compile Include="Recognizer`2.cs" />
<Compile Include="RuleContext.cs" />
<Compile Include="RuleDependencyAttribute.cs" />
<Compile Include="RuleVersionAttribute.cs" />
<Compile Include="Sharpen\Arrays.cs" />
<Compile Include="Sharpen\AtomicReference`1.cs" />
<Compile Include="Sharpen\BitSet.cs" />
<Compile Include="Sharpen\Collections.cs" />
<Compile Include="Sharpen\DictionaryExtensions.cs" />
<Compile Include="Sharpen\ListExtensions.cs" />
<Compile Include="Sharpen\Runtime.cs" />
<Compile Include="Sharpen\SequenceEqualityComparer`1.cs" />
<Compile Include="TokenStreamRewriter.cs" />
<Compile Include="TokenTypes.cs" />
<Compile Include="Tree\AbstractParseTreeVisitor`1.cs" />
<Compile Include="Tree\ErrorNodeImpl.cs" />
<Compile Include="Tree\IErrorNode.cs" />
<Compile Include="Tree\IParseTree.cs" />
<Compile Include="Tree\IParseTreeListener.cs" />
<Compile Include="Tree\IParseTreeVisitor`1.cs" />
<Compile Include="Tree\IRuleNode.cs" />
<Compile Include="Tree\ISyntaxTree.cs" />
<Compile Include="Tree\ITerminalNode.cs" />
<Compile Include="Tree\ITree.cs" />
<Compile Include="Tree\ParseTreeProperty`1.cs" />
<Compile Include="Tree\ParseTreeWalker.cs" />
<Compile Include="Tree\Pattern\Chunk.cs" />
<Compile Include="Tree\Pattern\ParseTreeMatch.cs" />
<Compile Include="Tree\Pattern\ParseTreePattern.cs" />
<Compile Include="Tree\Pattern\ParseTreePatternMatcher.cs" />
<Compile Include="Tree\Pattern\RuleTagToken.cs" />
<Compile Include="Tree\Pattern\TagChunk.cs" />
<Compile Include="Tree\Pattern\TextChunk.cs" />
<Compile Include="Tree\Pattern\TokenTagToken.cs" />
<Compile Include="Tree\TerminalNodeImpl.cs" />
<Compile Include="Tree\Trees.cs" />
<Compile Include="Tree\Xpath\XPath.cs" />
<Compile Include="Tree\Xpath\XPathElement.cs" />
<Compile Include="Tree\Xpath\XPathLexerErrorListener.cs" />
<Compile Include="Tree\Xpath\XPathRuleAnywhereElement.cs" />
<Compile Include="Tree\Xpath\XPathRuleElement.cs" />
<Compile Include="Tree\Xpath\XPathTokenAnywhereElement.cs" />
<Compile Include="Tree\Xpath\XPathTokenElement.cs" />
<Compile Include="Tree\Xpath\XPathWildcardAnywhereElement.cs" />
<Compile Include="Tree\Xpath\XPathWildcardElement.cs" />
<Compile Include="UnbufferedCharStream.cs" />
<Compile Include="UnbufferedTokenStream.cs" />
<None Include="packages.Antlr4.Runtime.netcore45.config" />
<Antlr4 Include="Tree\Xpath\XPathLexer.g4">
<Generator>MSBuild:Compile</Generator>
<CustomToolNamespace>Antlr4.Runtime.Tree.Xpath</CustomToolNamespace>
</Antlr4>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.props'))" />
<Error Condition="!Exists('..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.targets'))" />
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<Import Project="..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.targets" Condition="Exists('..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.targets')" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.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,260 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.props" Condition="Exists('..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{12269283-EE92-4FAA-B849-53CD24F341FA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Antlr4.Runtime</RootNamespace>
<AssemblyName>Antlr4.Runtime.portable-net45</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<BaseIntermediateOutputPath>obj\portable-net45\</BaseIntermediateOutputPath>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\portable-net45\Debug\</OutputPath>
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
<DefineConstants>TRACE;DEBUG;PORTABLE;NET45;NET45PLUS;NET40PLUS;NET35PLUS;NET30PLUS;NET20PLUS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\portable-net45\Release\</OutputPath>
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
<DefineConstants>TRACE;PORTABLE;NET45;NET45PLUS;NET40PLUS;NET35PLUS;NET30PLUS;NET20PLUS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\..\..\..\..\keys\antlr\Key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="AntlrFileStream.cs" />
<Compile Include="AntlrInputStream.cs" />
<Compile Include="Atn\AbstractPredicateTransition.cs" />
<Compile Include="Atn\ActionTransition.cs" />
<Compile Include="Atn\AmbiguityInfo.cs" />
<Compile Include="Atn\ArrayPredictionContext.cs" />
<Compile Include="Atn\ATN.cs" />
<Compile Include="Atn\ATNConfig.cs" />
<Compile Include="Atn\ATNConfigSet.cs" />
<Compile Include="Atn\ATNDeserializationOptions.cs" />
<Compile Include="Atn\ATNDeserializer.cs" />
<None Include="Atn\ATNSerializer.cs" />
<Compile Include="Atn\ATNSimulator.cs" />
<Compile Include="Atn\ATNState.cs" />
<Compile Include="Atn\ATNType.cs" />
<Compile Include="Atn\AtomTransition.cs" />
<Compile Include="Atn\BasicBlockStartState.cs" />
<Compile Include="Atn\BasicState.cs" />
<Compile Include="Atn\BlockEndState.cs" />
<Compile Include="Atn\BlockStartState.cs" />
<Compile Include="Atn\ContextSensitivityInfo.cs" />
<Compile Include="Atn\DecisionEventInfo.cs" />
<Compile Include="Atn\DecisionInfo.cs" />
<Compile Include="Atn\DecisionState.cs" />
<Compile Include="Atn\EmptyPredictionContext.cs" />
<Compile Include="Atn\EpsilonTransition.cs" />
<Compile Include="Atn\ErrorInfo.cs" />
<Compile Include="Atn\ILexerAction.cs" />
<Compile Include="Atn\LexerActionExecutor.cs" />
<Compile Include="Atn\LexerActionType.cs" />
<Compile Include="Atn\LexerATNSimulator.cs" />
<Compile Include="Atn\LexerChannelAction.cs" />
<Compile Include="Atn\LexerCustomAction.cs" />
<Compile Include="Atn\LexerIndexedCustomAction.cs" />
<Compile Include="Atn\LexerModeAction.cs" />
<Compile Include="Atn\LexerMoreAction.cs" />
<Compile Include="Atn\LexerPopModeAction.cs" />
<Compile Include="Atn\LexerPushModeAction.cs" />
<Compile Include="Atn\LexerSkipAction.cs" />
<Compile Include="Atn\LexerTypeAction.cs" />
<Compile Include="Atn\LL1Analyzer.cs" />
<Compile Include="Atn\LookaheadEventInfo.cs" />
<Compile Include="Atn\LoopEndState.cs" />
<Compile Include="Atn\NotSetTransition.cs" />
<Compile Include="Atn\OrderedATNConfigSet.cs" />
<Compile Include="Atn\ParseInfo.cs" />
<Compile Include="Atn\ParserATNSimulator.cs" />
<Compile Include="Atn\PlusBlockStartState.cs" />
<Compile Include="Atn\PlusLoopbackState.cs" />
<Compile Include="Atn\PrecedencePredicateTransition.cs" />
<Compile Include="Atn\PredicateEvalInfo.cs" />
<Compile Include="Atn\PredicateTransition.cs" />
<Compile Include="Atn\PredictionContext.cs" />
<Compile Include="Atn\PredictionContextCache.cs" />
<Compile Include="Atn\PredictionMode.cs" />
<Compile Include="Atn\ProfilingATNSimulator.cs" />
<Compile Include="Atn\RangeTransition.cs" />
<Compile Include="Atn\RuleStartState.cs" />
<Compile Include="Atn\RuleStopState.cs" />
<Compile Include="Atn\RuleTransition.cs" />
<Compile Include="Atn\SemanticContext.cs" />
<Compile Include="Atn\SetTransition.cs" />
<Compile Include="Atn\SimulatorState.cs" />
<Compile Include="Atn\SingletonPredictionContext.cs" />
<Compile Include="Atn\StarBlockStartState.cs" />
<Compile Include="Atn\StarLoopbackState.cs" />
<Compile Include="Atn\StarLoopEntryState.cs" />
<Compile Include="Atn\StateType.cs" />
<Compile Include="Atn\TokensStartState.cs" />
<Compile Include="Atn\Transition.cs" />
<Compile Include="Atn\TransitionType.cs" />
<Compile Include="Atn\WildcardTransition.cs" />
<Compile Include="BailErrorStrategy.cs" />
<Compile Include="BaseErrorListener.cs" />
<Compile Include="BufferedTokenStream.cs" />
<Compile Include="CommonToken.cs" />
<Compile Include="CommonTokenFactory.cs" />
<Compile Include="CommonTokenStream.cs" />
<Compile Include="ConsoleErrorListener.cs" />
<Compile Include="DefaultErrorStrategy.cs" />
<Compile Include="Dependents.cs" />
<Compile Include="Dfa\AbstractEdgeMap`1.cs" />
<Compile Include="Dfa\ArrayEdgeMap`1.cs" />
<Compile Include="Dfa\DFA.cs" />
<Compile Include="Dfa\DFASerializer.cs" />
<Compile Include="Dfa\DFAState.cs" />
<Compile Include="Dfa\IEdgeMap`1.cs" />
<Compile Include="Dfa\LexerDFASerializer.cs" />
<Compile Include="Dfa\SingletonEdgeMap`1.cs" />
<Compile Include="Dfa\SparseEdgeMap`1.cs" />
<Compile Include="DiagnosticErrorListener.cs" />
<Compile Include="FailedPredicateException.cs" />
<Compile Include="IAntlrErrorListener`1.cs" />
<Compile Include="IAntlrErrorStrategy.cs" />
<Compile Include="ICharStream.cs" />
<Compile Include="IIntStream.cs" />
<Compile Include="InputMismatchException.cs" />
<Compile Include="InterpreterRuleContext.cs" />
<Compile Include="IParserErrorListener.cs" />
<Compile Include="IRecognizer.cs" />
<Compile Include="IToken.cs" />
<Compile Include="ITokenFactory.cs" />
<Compile Include="ITokenSource.cs" />
<Compile Include="ITokenStream.cs" />
<Compile Include="IWritableToken.cs" />
<Compile Include="Lexer.cs" />
<Compile Include="LexerInterpreter.cs" />
<Compile Include="LexerNoViableAltException.cs" />
<Compile Include="ListTokenSource.cs" />
<Compile Include="Misc\Args.cs" />
<None Include="..\..\..\..\..\..\keys\antlr\Key.snk">
<Link>Key.snk</Link>
</None>
<None Include="Misc\Array2DHashSet`1.cs" />
<Compile Include="Misc\MurmurHash.cs" />
<Compile Include="Misc\NullableAttribute.cs" />
<None Include="Misc\DoubleKeyMap`3.cs" />
<Compile Include="Misc\IIntSet.cs" />
<Compile Include="Misc\Interval.cs" />
<Compile Include="Misc\IntervalSet.cs" />
<Compile Include="Misc\MultiMap`2.cs" />
<Compile Include="Misc\NotNullAttribute.cs" />
<None Include="Misc\OrderedHashSet`1.cs" />
<Compile Include="Misc\ParseCanceledException.cs" />
<Compile Include="Misc\RuleDependencyChecker.cs" />
<None Include="Misc\RuleDependencyProcessor.cs" />
<None Include="Misc\TestRig.cs" />
<Compile Include="Misc\Utils.cs" />
<Compile Include="NoViableAltException.cs" />
<Compile Include="Parser.cs" />
<Compile Include="ParserInterpreter.cs" />
<Compile Include="ParserRuleContext.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ProxyErrorListener`1.cs" />
<Compile Include="ProxyParserErrorListener.cs" />
<Compile Include="RecognitionException.cs" />
<Compile Include="Recognizer`2.cs" />
<Compile Include="RuleContext.cs" />
<Compile Include="RuleDependencyAttribute.cs" />
<Compile Include="RuleVersionAttribute.cs" />
<Compile Include="Sharpen\Arrays.cs" />
<Compile Include="Sharpen\AtomicReference`1.cs" />
<Compile Include="Sharpen\BitSet.cs" />
<Compile Include="Sharpen\Collections.cs" />
<Compile Include="Sharpen\Compat\CollectionDebuggerView`2.cs" />
<Compile Include="Sharpen\Compat\ConcurrentDictionary`2.cs" />
<Compile Include="Sharpen\Compat\SplitOrderedList`2.cs" />
<Compile Include="Sharpen\DictionaryExtensions.cs" />
<Compile Include="Sharpen\ListExtensions.cs" />
<Compile Include="Sharpen\Runtime.cs" />
<Compile Include="Sharpen\SequenceEqualityComparer`1.cs" />
<Compile Include="TokenStreamRewriter.cs" />
<Compile Include="TokenTypes.cs" />
<Compile Include="Tree\AbstractParseTreeVisitor`1.cs" />
<Compile Include="Tree\ErrorNodeImpl.cs" />
<Compile Include="Tree\IErrorNode.cs" />
<Compile Include="Tree\IParseTree.cs" />
<Compile Include="Tree\IParseTreeListener.cs" />
<Compile Include="Tree\IParseTreeVisitor`1.cs" />
<Compile Include="Tree\IRuleNode.cs" />
<Compile Include="Tree\ISyntaxTree.cs" />
<Compile Include="Tree\ITerminalNode.cs" />
<Compile Include="Tree\ITree.cs" />
<Compile Include="Tree\ParseTreeProperty`1.cs" />
<Compile Include="Tree\ParseTreeWalker.cs" />
<Compile Include="Tree\Pattern\Chunk.cs" />
<Compile Include="Tree\Pattern\ParseTreeMatch.cs" />
<Compile Include="Tree\Pattern\ParseTreePattern.cs" />
<Compile Include="Tree\Pattern\ParseTreePatternMatcher.cs" />
<Compile Include="Tree\Pattern\RuleTagToken.cs" />
<Compile Include="Tree\Pattern\TagChunk.cs" />
<Compile Include="Tree\Pattern\TextChunk.cs" />
<Compile Include="Tree\Pattern\TokenTagToken.cs" />
<Compile Include="Tree\TerminalNodeImpl.cs" />
<Compile Include="Tree\Trees.cs" />
<Compile Include="Tree\Xpath\XPath.cs" />
<Compile Include="Tree\Xpath\XPathElement.cs" />
<Compile Include="Tree\Xpath\XPathLexerErrorListener.cs" />
<Compile Include="Tree\Xpath\XPathRuleAnywhereElement.cs" />
<Compile Include="Tree\Xpath\XPathRuleElement.cs" />
<Compile Include="Tree\Xpath\XPathTokenAnywhereElement.cs" />
<Compile Include="Tree\Xpath\XPathTokenElement.cs" />
<Compile Include="Tree\Xpath\XPathWildcardAnywhereElement.cs" />
<Compile Include="Tree\Xpath\XPathWildcardElement.cs" />
<Compile Include="UnbufferedCharStream.cs" />
<Compile Include="UnbufferedTokenStream.cs" />
<None Include="packages.Antlr4.Runtime.portable-net45.config" />
<Antlr4 Include="Tree\Xpath\XPathLexer.g4">
<Generator>MSBuild:Compile</Generator>
<CustomToolNamespace>Antlr4.Runtime.Tree.Xpath</CustomToolNamespace>
</Antlr4>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.props'))" />
<Error Condition="!Exists('..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.targets'))" />
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<Import Project="..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.targets" Condition="Exists('..\packages\Antlr4.4.2.1-alpha001\build\Antlr4.targets')" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.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

@ -27,6 +27,559 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#if NET45PLUS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Security;
using System.Text;
using Antlr4.Runtime;
using Antlr4.Runtime.Atn;
using Antlr4.Runtime.Misc;
using Antlr4.Runtime.Sharpen;
namespace Antlr4.Runtime.Misc
{
/// <author>Sam Harwell</author>
public class RuleDependencyChecker
{
private static readonly HashSet<string> checkedAssemblies = new HashSet<string>();
public static void CheckDependencies(Assembly assembly)
{
if (IsChecked(assembly))
{
return;
}
IEnumerable<TypeInfo> typesToCheck = GetTypesToCheck(assembly);
List<Tuple<RuleDependencyAttribute, ICustomAttributeProvider>> dependencies = new List<Tuple<RuleDependencyAttribute, ICustomAttributeProvider>>();
foreach (TypeInfo clazz in typesToCheck)
{
dependencies.AddRange(GetDependencies(clazz));
}
if (dependencies.Count > 0)
{
IDictionary<TypeInfo, IList<Tuple<RuleDependencyAttribute, ICustomAttributeProvider>>> recognizerDependencies = new Dictionary<TypeInfo, IList<Tuple<RuleDependencyAttribute, ICustomAttributeProvider>>>();
foreach (Tuple<RuleDependencyAttribute, ICustomAttributeProvider> dependency in dependencies)
{
TypeInfo recognizerType = dependency.Item1.Recognizer.GetTypeInfo();
IList<Tuple<RuleDependencyAttribute, ICustomAttributeProvider>> list;
if (!recognizerDependencies.TryGetValue(recognizerType, out list))
{
list = new List<Tuple<RuleDependencyAttribute, ICustomAttributeProvider>>();
recognizerDependencies[recognizerType] = list;
}
list.Add(dependency);
}
foreach (KeyValuePair<TypeInfo, IList<Tuple<RuleDependencyAttribute, ICustomAttributeProvider>>> entry in recognizerDependencies)
{
//processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, String.format("ANTLR 4: Validating {0} dependencies on rules in {1}.", entry.getValue().size(), entry.getKey().toString()));
CheckDependencies(entry.Value, entry.Key);
}
}
MarkChecked(assembly);
}
private static IEnumerable<TypeInfo> GetTypesToCheck(Assembly assembly)
{
return assembly.DefinedTypes;
}
private static bool IsChecked(Assembly assembly)
{
lock (checkedAssemblies)
{
return checkedAssemblies.Contains(assembly.FullName);
}
}
private static void MarkChecked(Assembly assembly)
{
lock (checkedAssemblies)
{
checkedAssemblies.Add(assembly.FullName);
}
}
private static void CheckDependencies(IList<Tuple<RuleDependencyAttribute, ICustomAttributeProvider>> dependencies, TypeInfo recognizerType)
{
string[] ruleNames = GetRuleNames(recognizerType);
int[] ruleVersions = GetRuleVersions(recognizerType, ruleNames);
RuleDependencyChecker.RuleRelations relations = ExtractRuleRelations(recognizerType);
StringBuilder errors = new StringBuilder();
foreach (Tuple<RuleDependencyAttribute, ICustomAttributeProvider> dependency in dependencies)
{
if (!dependency.Item1.Recognizer.GetTypeInfo().IsAssignableFrom(recognizerType))
{
continue;
}
// this is the rule in the dependency set with the highest version number
int effectiveRule = dependency.Item1.Rule;
if (effectiveRule < 0 || effectiveRule >= ruleVersions.Length)
{
string message = string.Format("Rule dependency on unknown rule {0}@{1} in {2}", dependency.Item1.Rule, dependency.Item1.Version, dependency.Item1.Recognizer.ToString());
errors.AppendLine(dependency.Item2.ToString());
errors.AppendLine(message);
continue;
}
Dependents dependents = Dependents.Self | dependency.Item1.Dependents;
ReportUnimplementedDependents(errors, dependency, dependents);
BitSet @checked = new BitSet();
int highestRequiredDependency = CheckDependencyVersion(errors, dependency, ruleNames, ruleVersions, effectiveRule, null);
if ((dependents & Dependents.Parents) != 0)
{
BitSet parents = relations.parents[dependency.Item1.Rule];
for (int parent = parents.NextSetBit(0); parent >= 0; parent = parents.NextSetBit(parent + 1))
{
if (parent < 0 || parent >= ruleVersions.Length || @checked.Get(parent))
{
continue;
}
@checked.Set(parent);
int required = CheckDependencyVersion(errors, dependency, ruleNames, ruleVersions, parent, "parent");
highestRequiredDependency = Math.Max(highestRequiredDependency, required);
}
}
if ((dependents & Dependents.Children) != 0)
{
BitSet children = relations.children[dependency.Item1.Rule];
for (int child = children.NextSetBit(0); child >= 0; child = children.NextSetBit(child + 1))
{
if (child < 0 || child >= ruleVersions.Length || @checked.Get(child))
{
continue;
}
@checked.Set(child);
int required = CheckDependencyVersion(errors, dependency, ruleNames, ruleVersions, child, "child");
highestRequiredDependency = Math.Max(highestRequiredDependency, required);
}
}
if ((dependents & Dependents.Ancestors) != 0)
{
BitSet ancestors = relations.GetAncestors(dependency.Item1.Rule);
for (int ancestor = ancestors.NextSetBit(0); ancestor >= 0; ancestor = ancestors.NextSetBit(ancestor + 1))
{
if (ancestor < 0 || ancestor >= ruleVersions.Length || @checked.Get(ancestor))
{
continue;
}
@checked.Set(ancestor);
int required = CheckDependencyVersion(errors, dependency, ruleNames, ruleVersions, ancestor, "ancestor");
highestRequiredDependency = Math.Max(highestRequiredDependency, required);
}
}
if ((dependents & Dependents.Descendants) != 0)
{
BitSet descendants = relations.GetDescendants(dependency.Item1.Rule);
for (int descendant = descendants.NextSetBit(0); descendant >= 0; descendant = descendants.NextSetBit(descendant + 1))
{
if (descendant < 0 || descendant >= ruleVersions.Length || @checked.Get(descendant))
{
continue;
}
@checked.Set(descendant);
int required = CheckDependencyVersion(errors, dependency, ruleNames, ruleVersions, descendant, "descendant");
highestRequiredDependency = Math.Max(highestRequiredDependency, required);
}
}
int declaredVersion = dependency.Item1.Version;
if (declaredVersion > highestRequiredDependency)
{
string message = string.Format("Rule dependency version mismatch: {0} has maximum dependency version {1} (expected {2}) in {3}", ruleNames[dependency.Item1.Rule], highestRequiredDependency, declaredVersion, dependency.Item1.Recognizer.ToString());
errors.AppendLine(dependency.Item2.ToString());
errors.AppendLine(message);
}
}
if (errors.Length > 0)
{
throw new InvalidOperationException(errors.ToString());
}
}
private static readonly Dependents ImplementedDependents = Dependents.Self | Dependents.Parents | Dependents.Children | Dependents.Ancestors | Dependents.Descendants;
private static void ReportUnimplementedDependents(StringBuilder errors, Tuple<RuleDependencyAttribute, ICustomAttributeProvider> dependency, Dependents dependents)
{
Dependents unimplemented = dependents;
unimplemented &= ~ImplementedDependents;
if (unimplemented != Dependents.None)
{
string message = string.Format("Cannot validate the following dependents of rule {0}: {1}", dependency.Item1.Rule, unimplemented);
errors.AppendLine(message);
}
}
private static int CheckDependencyVersion(StringBuilder errors, Tuple<RuleDependencyAttribute, ICustomAttributeProvider> dependency, string[] ruleNames, int[] ruleVersions, int relatedRule, string relation)
{
string ruleName = ruleNames[dependency.Item1.Rule];
string path;
if (relation == null)
{
path = ruleName;
}
else
{
string mismatchedRuleName = ruleNames[relatedRule];
path = string.Format("rule {0} ({1} of {2})", mismatchedRuleName, relation, ruleName);
}
int declaredVersion = dependency.Item1.Version;
int actualVersion = ruleVersions[relatedRule];
if (actualVersion > declaredVersion)
{
string message = string.Format("Rule dependency version mismatch: {0} has version {1} (expected <= {2}) in {3}", path, actualVersion, declaredVersion, dependency.Item1.Recognizer.ToString());
errors.AppendLine(dependency.Item2.ToString());
errors.AppendLine(message);
}
return actualVersion;
}
private static int[] GetRuleVersions(TypeInfo recognizerClass, string[] ruleNames)
{
int[] versions = new int[ruleNames.Length];
IEnumerable<FieldInfo> fields = recognizerClass.DeclaredFields;
foreach (FieldInfo field in fields)
{
bool isStatic = field.IsStatic;
bool isInteger = field.FieldType == typeof(int);
if (isStatic && isInteger && field.Name.StartsWith("RULE_"))
{
try
{
string name = field.Name.Substring("RULE_".Length);
if (name.Length == 0 || !System.Char.IsLower(name[0]))
{
continue;
}
int index = (int)field.GetValue(null);
if (index < 0 || index >= versions.Length)
{
object[] @params = new object[] { index, field.Name, recognizerClass.Name };
#if false
Logger.Log(Level.Warning, "Rule index {0} for rule ''{1}'' out of bounds for recognizer {2}.", @params);
#endif
continue;
}
MethodInfo ruleMethod = GetRuleMethod(recognizerClass, name);
if (ruleMethod == null)
{
object[] @params = new object[] { name, recognizerClass.Name };
#if false
Logger.Log(Level.Warning, "Could not find rule method for rule ''{0}'' in recognizer {1}.", @params);
#endif
continue;
}
RuleVersionAttribute ruleVersion = ruleMethod.GetCustomAttribute<RuleVersionAttribute>();
int version = ruleVersion != null ? ruleVersion.Version : 0;
versions[index] = version;
}
catch (ArgumentException)
{
#if false
Logger.Log(Level.Warning, null, ex);
#else
throw;
#endif
}
catch (MemberAccessException)
{
#if false
Logger.Log(Level.Warning, null, ex);
#else
throw;
#endif
}
}
}
return versions;
}
private static MethodInfo GetRuleMethod(TypeInfo recognizerClass, string name)
{
IEnumerable<MethodInfo> declaredMethods = recognizerClass.DeclaredMethods;
foreach (MethodInfo method in declaredMethods)
{
if (method.Name.Equals(name) && method.GetCustomAttribute<RuleVersionAttribute>() != null)
{
return method;
}
}
return null;
}
private static string[] GetRuleNames(TypeInfo recognizerClass)
{
FieldInfo ruleNames = recognizerClass.DeclaredFields.First(i => i.Name == "ruleNames");
return (string[])ruleNames.GetValue(null);
}
public static IList<Tuple<RuleDependencyAttribute, ICustomAttributeProvider>> GetDependencies(TypeInfo clazz)
{
IList<Tuple<RuleDependencyAttribute, ICustomAttributeProvider>> result = new List<Tuple<RuleDependencyAttribute, ICustomAttributeProvider>>();
GetElementDependencies(AsCustomAttributeProvider(clazz), result);
foreach (ConstructorInfo ctor in clazz.DeclaredConstructors)
{
GetElementDependencies(AsCustomAttributeProvider(ctor), result);
foreach (ParameterInfo parameter in ctor.GetParameters())
GetElementDependencies(AsCustomAttributeProvider(parameter), result);
}
foreach (FieldInfo field in clazz.DeclaredFields)
{
GetElementDependencies(AsCustomAttributeProvider(field), result);
}
foreach (MethodInfo method in clazz.DeclaredMethods)
{
GetElementDependencies(AsCustomAttributeProvider(method), result);
#if COMPACT
if (method.ReturnTypeCustomAttributes != null)
GetElementDependencies(AsCustomAttributeProvider(method.ReturnTypeCustomAttributes), result);
#else
if (method.ReturnParameter != null)
GetElementDependencies(AsCustomAttributeProvider(method.ReturnParameter), result);
#endif
foreach (ParameterInfo parameter in method.GetParameters())
GetElementDependencies(AsCustomAttributeProvider(parameter), result);
}
return result;
}
private static void GetElementDependencies(ICustomAttributeProvider annotatedElement, IList<Tuple<RuleDependencyAttribute, ICustomAttributeProvider>> result)
{
foreach (RuleDependencyAttribute dependency in annotatedElement.GetCustomAttributes(typeof(RuleDependencyAttribute), true))
{
result.Add(Tuple.Create(dependency, annotatedElement));
}
}
private static RuleDependencyChecker.RuleRelations ExtractRuleRelations(TypeInfo recognizer)
{
string serializedATN = GetSerializedATN(recognizer);
if (serializedATN == null)
{
return null;
}
ATN atn = new ATNDeserializer().Deserialize(serializedATN.ToCharArray());
RuleDependencyChecker.RuleRelations relations = new RuleDependencyChecker.RuleRelations(atn.ruleToStartState.Length);
foreach (ATNState state in atn.states)
{
if (!state.epsilonOnlyTransitions)
{
continue;
}
foreach (Transition transition in state.Transitions)
{
if (transition.TransitionType != TransitionType.Rule)
{
continue;
}
RuleTransition ruleTransition = (RuleTransition)transition;
relations.AddRuleInvocation(state.ruleIndex, ruleTransition.target.ruleIndex);
}
}
return relations;
}
private static string GetSerializedATN(TypeInfo recognizerClass)
{
FieldInfo serializedAtnField = recognizerClass.DeclaredFields.First(i => i.Name == "_serializedATN");
if (serializedAtnField != null)
return (string)serializedAtnField.GetValue(null);
if (recognizerClass.BaseType != null)
return GetSerializedATN(recognizerClass.BaseType.GetTypeInfo());
return null;
}
private sealed class RuleRelations
{
public readonly BitSet[] parents;
public readonly BitSet[] children;
public RuleRelations(int ruleCount)
{
parents = new BitSet[ruleCount];
for (int i = 0; i < ruleCount; i++)
{
parents[i] = new BitSet();
}
children = new BitSet[ruleCount];
for (int i_1 = 0; i_1 < ruleCount; i_1++)
{
children[i_1] = new BitSet();
}
}
public bool AddRuleInvocation(int caller, int callee)
{
if (caller < 0)
{
// tokens rule
return false;
}
if (children[caller].Get(callee))
{
// already added
return false;
}
children[caller].Set(callee);
parents[callee].Set(caller);
return true;
}
public BitSet GetAncestors(int rule)
{
BitSet ancestors = new BitSet();
ancestors.Or(parents[rule]);
while (true)
{
int cardinality = ancestors.Cardinality();
for (int i = ancestors.NextSetBit(0); i >= 0; i = ancestors.NextSetBit(i + 1))
{
ancestors.Or(parents[i]);
}
if (ancestors.Cardinality() == cardinality)
{
// nothing changed
break;
}
}
return ancestors;
}
public BitSet GetDescendants(int rule)
{
BitSet descendants = new BitSet();
descendants.Or(children[rule]);
while (true)
{
int cardinality = descendants.Cardinality();
for (int i = descendants.NextSetBit(0); i >= 0; i = descendants.NextSetBit(i + 1))
{
descendants.Or(children[i]);
}
if (descendants.Cardinality() == cardinality)
{
// nothing changed
break;
}
}
return descendants;
}
}
private RuleDependencyChecker()
{
}
#if PORTABLE
public interface ICustomAttributeProvider
{
object[] GetCustomAttributes(Type attributeType, bool inherit);
}
protected static ICustomAttributeProvider AsCustomAttributeProvider(TypeInfo type)
{
return new TypeCustomAttributeProvider(type);
}
protected static ICustomAttributeProvider AsCustomAttributeProvider(MethodBase method)
{
return new MethodBaseCustomAttributeProvider(method);
}
protected static ICustomAttributeProvider AsCustomAttributeProvider(ParameterInfo parameter)
{
return new ParameterInfoCustomAttributeProvider(parameter);
}
protected static ICustomAttributeProvider AsCustomAttributeProvider(FieldInfo field)
{
return new FieldInfoCustomAttributeProvider(field);
}
protected sealed class TypeCustomAttributeProvider : ICustomAttributeProvider
{
private readonly TypeInfo _provider;
public TypeCustomAttributeProvider(TypeInfo provider)
{
_provider = provider;
}
public object[] GetCustomAttributes(Type attributeType, bool inherit)
{
return _provider.GetCustomAttributes(attributeType, inherit).ToArray();
}
}
protected sealed class MethodBaseCustomAttributeProvider : ICustomAttributeProvider
{
private readonly MethodBase _provider;
public MethodBaseCustomAttributeProvider(MethodBase provider)
{
_provider = provider;
}
public object[] GetCustomAttributes(Type attributeType, bool inherit)
{
return _provider.GetCustomAttributes(attributeType, inherit).ToArray();
}
}
protected sealed class ParameterInfoCustomAttributeProvider : ICustomAttributeProvider
{
private readonly ParameterInfo _provider;
public ParameterInfoCustomAttributeProvider(ParameterInfo provider)
{
_provider = provider;
}
public object[] GetCustomAttributes(Type attributeType, bool inherit)
{
return _provider.GetCustomAttributes(attributeType, inherit).ToArray();
}
}
protected sealed class FieldInfoCustomAttributeProvider : ICustomAttributeProvider
{
private readonly FieldInfo _provider;
public FieldInfoCustomAttributeProvider(FieldInfo provider)
{
_provider = provider;
}
public object[] GetCustomAttributes(Type attributeType, bool inherit)
{
return _provider.GetCustomAttributes(attributeType, inherit).ToArray();
}
}
#else
protected static ICustomAttributeProvider AsCustomAttributeProvider(ICustomAttributeProvider obj)
{
return obj;
}
#endif
}
}
#else
using System;
using System.Collections.Generic;
using System.Reflection;
@ -579,3 +1132,5 @@ namespace Antlr4.Runtime.Misc
#endif
}
}
#endif

View File

@ -35,8 +35,14 @@ 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.
#if PORTABLE
[assembly: AssemblyTitle("Antlr4.Runtime.Portable")]
#if PORTABLE && NET45
#if WINRT
[assembly: AssemblyTitle("Antlr4.Runtime.netcore45")]
#else
[assembly: AssemblyTitle("Antlr4.Runtime.portable-net45")]
#endif
#elif PORTABLE && NET40
[assembly: AssemblyTitle("Antlr4.Runtime.portable-net40")]
#elif NET45
[assembly: AssemblyTitle("Antlr4.Runtime.net45")]
#elif NET40
@ -65,9 +71,11 @@ using System.Runtime.InteropServices;
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
#if !PORTABLE
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bc228eb9-e79c-4e5a-a1b9-0434ea566bab")]
#endif
#endif
// Version information for an assembly consists of the following four values:
//

View File

@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !NET40PLUS || (PORTABLE && !NET45PLUS)
#if !NET40PLUS || (PORTABLE && !WINRT)
using System;
using System.Collections.Generic;

View File

@ -22,7 +22,7 @@
//
//
#if !NET40PLUS || (PORTABLE && !NET45PLUS)
#if !NET40PLUS || (PORTABLE && !WINRT)
using System;
using System.Threading;

View File

@ -22,7 +22,7 @@
//
//
#if !NET40PLUS || (PORTABLE && !NET45PLUS)
#if !NET40PLUS || (PORTABLE && !WINRT)
using System;
using System.Threading;

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Antlr4" version="4.2.1-alpha001" targetFramework="netcore45" />
<package id="Antlr4.Runtime" version="4.2.1-alpha001" targetFramework="netcore45" />
</packages>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Antlr4" version="4.2.1-alpha001" targetFramework="portable-net45+wp80+win" />
<package id="Antlr4.Runtime" version="4.2.1-alpha001" targetFramework="portable-net45+wp80+win" />
</packages>

View File

@ -52,6 +52,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{4CE79A54
..\..\build\version.ps1 = ..\..\build\version.ps1
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Antlr4.Runtime.portable-net45", "Antlr4.Runtime\Antlr4.Runtime.portable-net45.csproj", "{12269283-EE92-4FAA-B849-53CD24F341FA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Antlr4.Runtime.Test.portable-net45", "Antlr4.Runtime.Test\Antlr4.Runtime.Test.portable-net45.csproj", "{5844076E-3C92-4122-BB7A-0D745C3F5334}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Antlr4.Runtime.netcore45", "Antlr4.Runtime\Antlr4.Runtime.netcore45.csproj", "{F3145DCA-EA26-4482-80D6-5232A79E2A3A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -114,6 +120,18 @@ Global
{0D3D20E9-3341-4449-80E7-76A4534F0E55}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D3D20E9-3341-4449-80E7-76A4534F0E55}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D3D20E9-3341-4449-80E7-76A4534F0E55}.Release|Any CPU.Build.0 = Release|Any CPU
{12269283-EE92-4FAA-B849-53CD24F341FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12269283-EE92-4FAA-B849-53CD24F341FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12269283-EE92-4FAA-B849-53CD24F341FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{12269283-EE92-4FAA-B849-53CD24F341FA}.Release|Any CPU.Build.0 = Release|Any CPU
{5844076E-3C92-4122-BB7A-0D745C3F5334}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5844076E-3C92-4122-BB7A-0D745C3F5334}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5844076E-3C92-4122-BB7A-0D745C3F5334}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5844076E-3C92-4122-BB7A-0D745C3F5334}.Release|Any CPU.Build.0 = Release|Any CPU
{F3145DCA-EA26-4482-80D6-5232A79E2A3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F3145DCA-EA26-4482-80D6-5232A79E2A3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F3145DCA-EA26-4482-80D6-5232A79E2A3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F3145DCA-EA26-4482-80D6-5232A79E2A3A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE