diff --git a/build/Antlr4.Runtime.nuspec b/build/Antlr4.Runtime.nuspec
index 2f463734a..d619ba068 100644
--- a/build/Antlr4.Runtime.nuspec
+++ b/build/Antlr4.Runtime.nuspec
@@ -44,9 +44,9 @@
-
-
-
+
+
+
diff --git a/runtime/CSharp/Antlr4.Runtime.Test/Antlr4.Runtime.Test.Portable.csproj b/runtime/CSharp/Antlr4.Runtime.Test/Antlr4.Runtime.Test.portable-net40.csproj
similarity index 94%
rename from runtime/CSharp/Antlr4.Runtime.Test/Antlr4.Runtime.Test.Portable.csproj
rename to runtime/CSharp/Antlr4.Runtime.Test/Antlr4.Runtime.Test.portable-net40.csproj
index 9b90fb1ce..e944ac762 100644
--- a/runtime/CSharp/Antlr4.Runtime.Test/Antlr4.Runtime.Test.Portable.csproj
+++ b/runtime/CSharp/Antlr4.Runtime.Test/Antlr4.Runtime.Test.portable-net40.csproj
@@ -17,7 +17,7 @@
$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
False
UnitTest
- obj\Portable\
+ obj\portable-net40\
..\
true
@@ -25,7 +25,7 @@
true
full
false
- bin\Portable\Debug\
+ bin\portable-net40\Debug\
DEBUG;TRACE;PORTABLE;NET40;NET40PLUS;NET35PLUS;NET30PLUS;NET20PLUS
prompt
4
@@ -34,7 +34,7 @@
pdbonly
true
- bin\Portable\Release\
+ bin\portable-net40\Release\
TRACE;PORTABLE;NET40;NET40PLUS;NET35PLUS;NET30PLUS;NET20PLUS
prompt
4
@@ -68,9 +68,9 @@
-
+
{06c182c5-095c-4d43-9c33-c87e305c6bc2}
- Antlr4.Runtime.Portable
+ Antlr4.Runtime.portable-net40
@@ -79,7 +79,7 @@
-
+
diff --git a/runtime/CSharp/Antlr4.Runtime.Test/packages.Antlr4.Runtime.Test.Portable.config b/runtime/CSharp/Antlr4.Runtime.Test/packages.Antlr4.Runtime.Test.portable-net40.config
similarity index 67%
rename from runtime/CSharp/Antlr4.Runtime.Test/packages.Antlr4.Runtime.Test.Portable.config
rename to runtime/CSharp/Antlr4.Runtime.Test/packages.Antlr4.Runtime.Test.portable-net40.config
index 4e276686b..b1bbfa942 100644
--- a/runtime/CSharp/Antlr4.Runtime.Test/packages.Antlr4.Runtime.Test.Portable.config
+++ b/runtime/CSharp/Antlr4.Runtime.Test/packages.Antlr4.Runtime.Test.portable-net40.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/runtime/CSharp/Antlr4.Runtime/Antlr4.Runtime.Portable.csproj b/runtime/CSharp/Antlr4.Runtime/Antlr4.Runtime.portable-net40.csproj
similarity index 94%
rename from runtime/CSharp/Antlr4.Runtime/Antlr4.Runtime.Portable.csproj
rename to runtime/CSharp/Antlr4.Runtime/Antlr4.Runtime.portable-net40.csproj
index beadd130e..31c21f958 100644
--- a/runtime/CSharp/Antlr4.Runtime/Antlr4.Runtime.Portable.csproj
+++ b/runtime/CSharp/Antlr4.Runtime/Antlr4.Runtime.portable-net40.csproj
@@ -10,11 +10,11 @@
Library
Properties
Antlr4.Runtime
- Antlr4.Runtime.Portable
+ Antlr4.Runtime.portable-net40
v4.0
- Profile5
+ Profile136
512
- obj\Portable\
+ obj\portable-net40\
{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
..\
true
@@ -23,9 +23,9 @@
true
full
false
- bin\Portable\Debug\
+ bin\portable-net40\Debug\
$(OutputPath)$(AssemblyName).xml
- TRACE;DEBUG;NET_2_0;NET_3_0;NET_3_5;NET_4_0;PORTABLE
+ TRACE;DEBUG;PORTABLE;NET40;NET40PLUS;NET35PLUS;NET30PLUS;NET20PLUS
prompt
4
1591
@@ -33,9 +33,9 @@
pdbonly
true
- bin\Portable\Release\
+ bin\portable-net40\Release\
$(OutputPath)$(AssemblyName).xml
- TRACE;NET_2_0;NET_3_0;NET_3_5;NET_4_0;PORTABLE
+ TRACE;PORTABLE;NET40;NET40PLUS;NET35PLUS;NET30PLUS;NET20PLUS
prompt
4
1591
@@ -46,9 +46,6 @@
..\..\..\..\..\..\keys\antlr\Key.snk
-
-
-
@@ -194,6 +191,9 @@
+
+
+
@@ -233,7 +233,7 @@
-
+
MSBuild:Compile
Antlr4.Runtime.Tree.Xpath
diff --git a/runtime/CSharp/Antlr4.Runtime/Atn/DecisionInfo.cs b/runtime/CSharp/Antlr4.Runtime/Atn/DecisionInfo.cs
index 9fabecd81..2529a0054 100644
--- a/runtime/CSharp/Antlr4.Runtime/Atn/DecisionInfo.cs
+++ b/runtime/CSharp/Antlr4.Runtime/Atn/DecisionInfo.cs
@@ -31,7 +31,9 @@ using System.Collections.Generic;
using Antlr4.Runtime.Atn;
using Antlr4.Runtime.Dfa;
using Antlr4.Runtime.Sharpen;
+#if !PORTABLE || NET45PLUS
using Stopwatch = System.Diagnostics.Stopwatch;
+#endif
namespace Antlr4.Runtime.Atn
{
@@ -64,6 +66,7 @@ namespace Antlr4.Runtime.Atn
///
public long invocations;
+#if !PORTABLE || NET45PLUS
///
/// The total time spent in
///
@@ -79,6 +82,7 @@ namespace Antlr4.Runtime.Atn
/// state before starting the profiling measurement pass.
///
public long timeInPrediction;
+#endif
/// The sum of the lookahead required for SLL prediction for this decision.
///
diff --git a/runtime/CSharp/Antlr4.Runtime/Atn/ParseInfo.cs b/runtime/CSharp/Antlr4.Runtime/Atn/ParseInfo.cs
index 011ebd28a..46ef6ea0c 100644
--- a/runtime/CSharp/Antlr4.Runtime/Atn/ParseInfo.cs
+++ b/runtime/CSharp/Antlr4.Runtime/Atn/ParseInfo.cs
@@ -104,6 +104,7 @@ namespace Antlr4.Runtime.Atn
return Ll;
}
+#if !PORTABLE || NET45PLUS
///
/// Gets the total time spent during prediction across all decisions made
/// during parsing.
@@ -124,6 +125,7 @@ namespace Antlr4.Runtime.Atn
}
return t;
}
+#endif
///
/// Gets the total number of SLL lookahead operations across all decisions
diff --git a/runtime/CSharp/Antlr4.Runtime/Atn/ProfilingATNSimulator.cs b/runtime/CSharp/Antlr4.Runtime/Atn/ProfilingATNSimulator.cs
index 142433e99..1d827fcbb 100644
--- a/runtime/CSharp/Antlr4.Runtime/Atn/ProfilingATNSimulator.cs
+++ b/runtime/CSharp/Antlr4.Runtime/Atn/ProfilingATNSimulator.cs
@@ -32,7 +32,9 @@ using Antlr4.Runtime;
using Antlr4.Runtime.Atn;
using Antlr4.Runtime.Dfa;
using Antlr4.Runtime.Sharpen;
+#if !PORTABLE || NET45PLUS
using Stopwatch = System.Diagnostics.Stopwatch;
+#endif
namespace Antlr4.Runtime.Atn
{
@@ -97,10 +99,14 @@ namespace Antlr4.Runtime.Atn
this.currentDecision = decision;
this.currentState = null;
this.conflictingAltResolvedBySLL = ATN.InvalidAltNumber;
+#if !PORTABLE || NET45PLUS
Stopwatch stopwatch = Stopwatch.StartNew();
+#endif
// expensive but useful info
int alt = base.AdaptivePredict(input, decision, outerContext);
+#if !PORTABLE || NET45PLUS
decisions[decision].timeInPrediction += stopwatch.ElapsedTicks * 100;
+#endif
decisions[decision].invocations++;
int SLL_k = _sllStopIndex - _startIndex + 1;
decisions[decision].SLL_TotalLook += SLL_k;
diff --git a/runtime/CSharp/Antlr4.Runtime/Dfa/ArrayEdgeMap`1.cs b/runtime/CSharp/Antlr4.Runtime/Dfa/ArrayEdgeMap`1.cs
index 74f5d437e..0b41dc192 100644
--- a/runtime/CSharp/Antlr4.Runtime/Dfa/ArrayEdgeMap`1.cs
+++ b/runtime/CSharp/Antlr4.Runtime/Dfa/ArrayEdgeMap`1.cs
@@ -180,6 +180,8 @@ namespace Antlr4.Runtime.Dfa
#if COMPACT
IDictionary result = new SortedList();
+#elif PORTABLE && !NET45PLUS
+ IDictionary result = new Dictionary();
#else
IDictionary result = new SortedDictionary();
#endif
diff --git a/runtime/CSharp/Antlr4.Runtime/Dfa/DFAState.cs b/runtime/CSharp/Antlr4.Runtime/Dfa/DFAState.cs
index 388f737c8..4cfc1863d 100644
--- a/runtime/CSharp/Antlr4.Runtime/Dfa/DFAState.cs
+++ b/runtime/CSharp/Antlr4.Runtime/Dfa/DFAState.cs
@@ -288,6 +288,8 @@ namespace Antlr4.Runtime.Dfa
map = new ReadOnlyDictionary(new SortedDictionary(result));
#elif COMPACT
map = new SortedList(result);
+#elif PORTABLE && !NET45PLUS
+ map = new Dictionary(result);
#else
map = new SortedDictionary(result);
#endif
diff --git a/runtime/CSharp/Antlr4.Runtime/Dfa/SparseEdgeMap`1.cs b/runtime/CSharp/Antlr4.Runtime/Dfa/SparseEdgeMap`1.cs
index 2e0d113b2..295cc4849 100644
--- a/runtime/CSharp/Antlr4.Runtime/Dfa/SparseEdgeMap`1.cs
+++ b/runtime/CSharp/Antlr4.Runtime/Dfa/SparseEdgeMap`1.cs
@@ -218,6 +218,8 @@ namespace Antlr4.Runtime.Dfa
#if COMPACT
IDictionary result = new SortedList();
+#elif PORTABLE && !NET45PLUS
+ IDictionary result = new Dictionary();
#else
IDictionary result = new SortedDictionary();
#endif
diff --git a/runtime/CSharp/Antlr4.Runtime/Properties/AssemblyInfo.cs b/runtime/CSharp/Antlr4.Runtime/Properties/AssemblyInfo.cs
index 0e7801156..cf1f27685 100644
--- a/runtime/CSharp/Antlr4.Runtime/Properties/AssemblyInfo.cs
+++ b/runtime/CSharp/Antlr4.Runtime/Properties/AssemblyInfo.cs
@@ -57,15 +57,17 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("Copyright © Sam Harwell 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: CLSCompliant(false)]
+#if !PORTABLE || NET45PLUS
// 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)]
-[assembly: CLSCompliant(false)]
// 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
// Version information for an assembly consists of the following four values:
//
diff --git a/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/CollectionDebuggerView`2.cs b/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/CollectionDebuggerView`2.cs
index ad3aaf5c6..9451e12b7 100644
--- a/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/CollectionDebuggerView`2.cs
+++ b/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/CollectionDebuggerView`2.cs
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if !NET40PLUS
+#if !NET40PLUS || (PORTABLE && !NET45PLUS)
using System;
using System.Collections.Generic;
diff --git a/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/ConcurrentDictionary`2.cs b/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/ConcurrentDictionary`2.cs
index 9ad47a83b..ec1c2bfdd 100644
--- a/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/ConcurrentDictionary`2.cs
+++ b/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/ConcurrentDictionary`2.cs
@@ -22,12 +22,13 @@
//
//
-#if !NET40PLUS
+#if !NET40PLUS || (PORTABLE && !NET45PLUS)
using System;
using System.Threading;
using System.Collections;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using System.Diagnostics;
@@ -340,7 +341,7 @@ namespace Antlr4.Runtime.Sharpen
foreach (KeyValuePair kvp in this)
temp.Add (extractor (kvp));
- return temp.AsReadOnly ();
+ return new ReadOnlyCollection(temp);
}
void ICollection.CopyTo (Array array, int startIndex)
diff --git a/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/SplitOrderedList`2.cs b/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/SplitOrderedList`2.cs
index 6a0a80b47..e11451c12 100644
--- a/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/SplitOrderedList`2.cs
+++ b/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/SplitOrderedList`2.cs
@@ -22,7 +22,7 @@
//
//
-#if !NET40PLUS
+#if !NET40PLUS || (PORTABLE && !NET45PLUS)
using System;
using System.Threading;
@@ -533,15 +533,16 @@ namespace Antlr4.Runtime.Sharpen
#if COMPACT
Thread.Sleep(0);
#else
+ ManualResetEvent mre = new ManualResetEvent (false);
if (isSingleCpu) {
// On a single-CPU system, spinning does no good
- Thread.Sleep (0);
+ mre.WaitOne (0);
} else {
if (ntime % step == 0)
- Thread.Sleep (0);
+ mre.WaitOne (0);
else
// Multi-CPU system might be hyper-threaded, let other thread run
- Thread.SpinWait (Math.Min (ntime, maxTime) << 1);
+ mre.WaitOne (Math.Min (ntime, maxTime) << 1);
}
#endif
}
diff --git a/runtime/CSharp/Antlr4.Runtime/packages.Antlr4.Runtime.Portable.config b/runtime/CSharp/Antlr4.Runtime/packages.Antlr4.Runtime.portable-net40.config
similarity index 67%
rename from runtime/CSharp/Antlr4.Runtime/packages.Antlr4.Runtime.Portable.config
rename to runtime/CSharp/Antlr4.Runtime/packages.Antlr4.Runtime.portable-net40.config
index 4e276686b..a1b5b3a7f 100644
--- a/runtime/CSharp/Antlr4.Runtime/packages.Antlr4.Runtime.Portable.config
+++ b/runtime/CSharp/Antlr4.Runtime/packages.Antlr4.Runtime.portable-net40.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/runtime/CSharp/Antlr4.sln b/runtime/CSharp/Antlr4.sln
index 7c7d23e45..5c79d77d3 100644
--- a/runtime/CSharp/Antlr4.sln
+++ b/runtime/CSharp/Antlr4.sln
@@ -36,9 +36,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Antlr4.Runtime.Test.net30",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Antlr4.Runtime.Test.net20", "Antlr4.Runtime.Test\Antlr4.Runtime.Test.net20.csproj", "{0A4681C4-1248-4ACD-B59F-D6CC17CC2B4C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Antlr4.Runtime.Portable", "Antlr4.Runtime\Antlr4.Runtime.Portable.csproj", "{06C182C5-095C-4D43-9C33-C87E305C6BC2}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Antlr4.Runtime.portable-net40", "Antlr4.Runtime\Antlr4.Runtime.portable-net40.csproj", "{06C182C5-095C-4D43-9C33-C87E305C6BC2}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Antlr4.Runtime.Test.Portable", "Antlr4.Runtime.Test\Antlr4.Runtime.Test.Portable.csproj", "{97C32E42-51B2-4A29-B005-769B63CFEFCA}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Antlr4.Runtime.Test.portable-net40", "Antlr4.Runtime.Test\Antlr4.Runtime.Test.portable-net40.csproj", "{97C32E42-51B2-4A29-B005-769B63CFEFCA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Antlr4BuildTasks.net35", "Antlr4BuildTasks\Antlr4BuildTasks.net35.csproj", "{0D3D20E9-3341-4449-80E7-76A4534F0E55}"
EndProject