Merge branch 'codeanalysis'

This commit is contained in:
Sam Harwell 2013-03-25 10:24:35 -05:00
commit f9718aa62f
8 changed files with 83 additions and 15 deletions

View File

@ -430,15 +430,11 @@ namespace Antlr4.Runtime.Atn
throw new NotSupportedException("Not supported yet."); throw new NotSupportedException("Not supported yet.");
} }
public virtual bool ContainsAll<_T0>(ICollection<_T0> c) public virtual bool ContainsAll(IEnumerable<ATNConfig> c)
{ {
foreach (object o in c) foreach (ATNConfig o in c)
{ {
if (!(o is ATNConfig)) if (!Contains(o))
{
return false;
}
if (!Contains((ATNConfig)o))
{ {
return false; return false;
} }

View File

@ -49,17 +49,15 @@ namespace Antlr4.Runtime.Atn
/// <summary>Must distinguish between missing edge and edge we know leads nowhere</summary> /// <summary>Must distinguish between missing edge and edge we know leads nowhere</summary>
[NotNull] [NotNull]
public static readonly DFAState Error; public static readonly DFAState Error =
new DFAState(new ATNConfigSet(), 0, 0)
{
stateNumber = int.MaxValue
};
[NotNull] [NotNull]
public readonly ATN atn; public readonly ATN atn;
static ATNSimulator()
{
Error = new DFAState(new ATNConfigSet(), 0, 0);
Error.stateNumber = int.MaxValue;
}
public ATNSimulator(ATN atn) public ATNSimulator(ATN atn)
{ {
this.atn = atn; this.atn = atn;

View File

@ -42,7 +42,7 @@ namespace Antlr4.Runtime.Dfa
protected internal readonly int maxIndex; protected internal readonly int maxIndex;
public AbstractEdgeMap(int minIndex, int maxIndex) protected AbstractEdgeMap(int minIndex, int maxIndex)
{ {
// the allowed range (with minIndex and maxIndex inclusive) should be less than 2^32 // the allowed range (with minIndex and maxIndex inclusive) should be less than 2^32
System.Diagnostics.Debug.Assert(maxIndex - minIndex + 1 >= 0); System.Diagnostics.Debug.Assert(maxIndex - minIndex + 1 >= 0);

View File

@ -51,6 +51,7 @@
<Compile Include="Antlr4ClassGenerationTask.cs" /> <Compile Include="Antlr4ClassGenerationTask.cs" />
<Compile Include="Antlr4ClassGenerationTaskInternal.cs" /> <Compile Include="Antlr4ClassGenerationTaskInternal.cs" />
<Compile Include="BuildMessage.cs" /> <Compile Include="BuildMessage.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -62,6 +63,11 @@
<Link>Key.snk</Link> <Link>Key.snk</Link>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<CodeAnalysisDictionary Include="..\build\CustomDictionary.xml">
<Link>CustomDictionary.xml</Link>
</CodeAnalysisDictionary>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -31,6 +31,7 @@ namespace Antlr4.Build.Tasks
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Security; using System.Security;
@ -175,6 +176,7 @@ namespace Antlr4.Build.Tasks
} }
} }
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
public AppDomain GetAntlrTaskAppDomain() public AppDomain GetAntlrTaskAppDomain()
{ {
if (_sharedAppDomain != null) if (_sharedAppDomain != null)

Binary file not shown.

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Dictionary">
<xs:complexType>
<xs:sequence>
<xs:element name="Words" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Unrecognized" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Word" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Recognized" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Word" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Deprecated" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Term" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="PreferredAlternate" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Acronyms" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="CasingExceptions">
<xs:complexType>
<xs:sequence>
<xs:element name="Acronym" type="xs:string" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<Dictionary>
<Words>
<Recognized>
<Word>Antlr</Word>
<Word>Atn</Word>
</Recognized>
</Words>
</Dictionary>