[csharp] able to compile with dotnet cli under Linux

1, moved xproj file into Antlr4.Runtime sub-folder to keep convention
2, removed two cs files that no longer needed
3, fill in missing using directives
This commit is contained in:
Dong Xie 2017-01-20 14:16:09 +00:00
parent 5d03880079
commit 9e590c08b7
9 changed files with 28 additions and 115 deletions

View File

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Antlr4.Runtime.DotNetCore", "Antlr4.Runtime.DotNetCore.xproj", "{12962409-846E-4B80-933A-BC484D264132}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Antlr4.Runtime.DotNetCore", "Antlr4.Runtime\Antlr4.Runtime.DotNetCore.xproj", "{12962409-846E-4B80-933A-BC484D264132}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -1,42 +0,0 @@
/* Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
using Antlr4.Runtime.Atn;
using Antlr4.Runtime.Sharpen;
namespace Antlr4.Runtime.Atn
{
/// <author>Sam Harwell</author>
public class OrderedATNConfigSet : ATNConfigSet
{
public OrderedATNConfigSet()
{
}
public OrderedATNConfigSet(ATNConfigSet set, bool @readonly)
: base(set, @readonly)
{
}
public override ATNConfigSet Clone(bool @readonly)
{
Antlr4.Runtime.Atn.OrderedATNConfigSet copy = new Antlr4.Runtime.Atn.OrderedATNConfigSet(this, @readonly);
if (!@readonly && this.IsReadOnly)
{
copy.AddAll(this);
}
return copy;
}
protected internal override long GetKey(ATNConfig e)
{
return e.GetHashCode();
}
protected internal override bool CanMerge(ATNConfig left, long leftKey, ATNConfig right)
{
return left.Equals(right);
}
}
}

View File

@ -4,6 +4,7 @@
*/
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Antlr4.Runtime.Sharpen;
namespace Antlr4.Runtime.Dfa

View File

@ -1,58 +0,0 @@
using System;
using System.Collections.Generic;
namespace Antlr4.Runtime.Misc
{
public class DoubleKeyMap<K1, K2, V>
{
Dictionary<K1, Dictionary<K2, V>> data = new Dictionary<K1, Dictionary<K2, V>>();
public V put(K1 k1, K2 k2, V v)
{
Dictionary<K2, V> data2 = data.get(k1);
V prev = null;
if (data2 == null)
{
data2 = new Dict<K2, V>();
data.put(k1, data2);
}
else {
prev = data2.get(k2);
}
data2.put(k2, v);
return prev;
}
public V get(K1 k1, K2 k2)
{
Dictionary<K2, V> data2 = data.get(k1);
if (data2 == null) return null;
return data2.get(k2);
}
public Dictionary<K2, V> get(K1 k1) { return data.get(k1); }
/** Get all values associated with primary key */
public ICollection<V> values(K1 k1)
{
Dictionary<K2, V> data2 = data.get(k1);
if (data2 == null) return null;
return data2.values();
}
/** get all primary keys */
public HashSet<K1> keySet()
{
return data.keySet();
}
/** get all secondary keys associated with a primary key */
public HashSet<K2> keySet(K1 k1)
{
Dictionary<K2, V> data2 = data.get(k1);
if (data2 == null) return null;
return data2.keySet();
}
}
}

View File

@ -2,6 +2,7 @@
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
using System;
using System.Collections.Generic;
using Antlr4.Runtime.Sharpen;

View File

@ -354,7 +354,7 @@ namespace Antlr4.Runtime.Misc
}
foreach (Transition transition in state.transitions)
{
if (transition.TransitionType != TransitionType.Rule)
if (transition.TransitionType != TransitionType.RULE)
{
continue;
}
@ -459,7 +459,7 @@ namespace Antlr4.Runtime.Misc
{
}
#if PORTABLE
#if PORTABLE || DOTNETCORE
public interface ICustomAttributeProvider
{
object[] GetCustomAttributes(Type attributeType, bool inherit);

View File

@ -2,7 +2,11 @@
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
#if NET40PLUS
using System.Collections.Concurrent;
#else
using Antlr4.Runtime.Sharpen;
#endif
namespace Antlr4.Runtime.Tree
{

View File

@ -1,16 +1,23 @@
{
"buildOptions": {
"define": [ "DEBUG", "TRACE", "DOTNETCORE", "NET40PLUS", "NET45PLUS" ],
"keyFile": "../Antlr4.snk",
"xmlDoc": true
},
"dependencies": {
"NETStandard.Library": "1.6.0"
},
"version": "4.5.3-*",
"frameworks": {
"netstandard1.5": {
"imports": "dnxcore50"
"netstandard1.3": {
"dependencies": {
"NETStandard.Library": "1.6.1"
}
}
},
"version": "4.5.3-*"
}
"dependencies": {},
"buildOptions": {
"xmlDoc": true,
"keyFile": "../Antlr4.snk",
"define": [
"DOTNETCORE",
"NET40PLUS",
"NET45PLUS"
],
"nowarn": [
"CS1591"
]
}
}