##// END OF EJS Templates
refactoring, code cleanup
cin -
r158:130781364799 v2
parent child
Show More

The requested changes are too big and content was truncated. Show full diff

@@ -0,0 +1,45
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6 <ProductVersion>8.0.30703</ProductVersion>
7 <SchemaVersion>2.0</SchemaVersion>
8 <ProjectGuid>{4D364996-7ECD-4193-8F90-F223FFEA49DA}</ProjectGuid>
9 <OutputType>Library</OutputType>
10 <RootNamespace>Implab.Format.Test</RootNamespace>
11 <AssemblyName>Implab.Format.Test</AssemblyName>
12 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13 </PropertyGroup>
14 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
15 <DebugSymbols>true</DebugSymbols>
16 <DebugType>full</DebugType>
17 <Optimize>false</Optimize>
18 <OutputPath>bin\Debug</OutputPath>
19 <DefineConstants>DEBUG;</DefineConstants>
20 <ErrorReport>prompt</ErrorReport>
21 <WarningLevel>4</WarningLevel>
22 <ConsolePause>false</ConsolePause>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25 <DebugType>full</DebugType>
26 <Optimize>true</Optimize>
27 <OutputPath>bin\Release</OutputPath>
28 <ErrorReport>prompt</ErrorReport>
29 <WarningLevel>4</WarningLevel>
30 <ConsolePause>false</ConsolePause>
31 </PropertyGroup>
32 <ItemGroup>
33 <Reference Include="System" />
34 <Reference Include="nunit.framework">
35 <HintPath>..\..\packages\NUnit.3.0.1\lib\net45\nunit.framework.dll</HintPath>
36 </Reference>
37 </ItemGroup>
38 <ItemGroup>
39 <Compile Include="JsonTests.cs" />
40 </ItemGroup>
41 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
42 <ItemGroup>
43 <None Include="packages.config" />
44 </ItemGroup>
45 </Project> No newline at end of file
@@ -0,0 +1,12
1 using NUnit.Framework;
2 using System;
3
4 namespace Implab.Format.Test {
5 [TestFixture()]
6 public class JsonTests {
7 [Test()]
8 public void TestCase() {
9 }
10 }
11 }
12
@@ -0,0 +1,4
1 <?xml version="1.0" encoding="utf-8"?>
2 <packages>
3 <package id="NUnit" version="3.0.1" targetFramework="net45" />
4 </packages> No newline at end of file
@@ -0,0 +1,23
1 using Implab;
2 using System;
3 using System.Collections.Generic;
4 using System.Linq;
5 using System.Text;
6 using System.Threading.Tasks;
7
8 namespace Implab.Parsing {
9 public class CharAlphabet: IndexedAlphabetBase<char> {
10
11 public CharAlphabet()
12 : base(char.MaxValue + 1) {
13 }
14
15 public override int GetSymbolIndex(char symbol) {
16 return symbol;
17 }
18
19 public override IEnumerable<char> InputSymbols {
20 get { return Enumerable.Range(char.MinValue, char.MaxValue).Select(x => (char)x); }
21 }
22 }
23 }
@@ -0,0 +1,262
1 using Implab;
2 using System;
3 using System.Collections.Generic;
4 using System.Diagnostics;
5 using System.Linq;
6
7 namespace Implab.Parsing {
8 public class DFADefinition : IDFADefinition {
9 readonly List<DFAStateDescriptior> m_states;
10
11 public const int INITIAL_STATE = 1;
12 public const int UNREACHEBLE_STATE = 0;
13
14 DFAStateDescriptior[] m_statesArray;
15 readonly int m_alpabetSize;
16
17 public DFADefinition(int alphabetSize) {
18 m_states = new List<DFAStateDescriptior>();
19 m_alpabetSize = alphabetSize;
20
21 m_states.Add(new DFAStateDescriptior());
22 }
23
24 public DFAStateDescriptior[] States {
25 get {
26 if (m_statesArray == null)
27 m_statesArray = m_states.ToArray();
28 return m_statesArray;
29 }
30 }
31
32 public bool InitialStateIsFinal {
33 get {
34 return m_states[INITIAL_STATE].final;
35 }
36 }
37
38 public int AddState() {
39 var index = m_states.Count;
40 m_states.Add(new DFAStateDescriptior {
41 final = false,
42 transitions = new int[AlphabetSize]
43 });
44 m_statesArray = null;
45
46 return index;
47 }
48
49 public int AddState(int[] tag) {
50 var index = m_states.Count;
51 bool final = tag != null && tag.Length != 0;
52 m_states.Add(new DFAStateDescriptior {
53 final = final,
54 transitions = new int[AlphabetSize],
55 tag = final ? tag : null
56 });
57 m_statesArray = null;
58 return index;
59 }
60
61 public void DefineTransition(int s1,int s2, int symbol) {
62 Safe.ArgumentInRange(s1, 0, m_states.Count-1, "s1");
63 Safe.ArgumentInRange(s2, 0, m_states.Count-1, "s2");
64 Safe.ArgumentInRange(symbol, 0, AlphabetSize-1, "symbol");
65
66 m_states[s1].transitions[symbol] = s2;
67 }
68
69 public void Optimize<TA>(IDFADefinition minimalDFA,IAlphabet<TA> sourceAlphabet, IAlphabet<TA> minimalAlphabet) {
70 Safe.ArgumentNotNull(minimalDFA, "minimalDFA");
71 Safe.ArgumentNotNull(minimalAlphabet, "minimalAlphabet");
72
73 var setComparer = new CustomEqualityComparer<HashSet<int>>(
74 (x, y) => x.SetEquals(y),
75 (s) => s.Sum(x => x.GetHashCode())
76 );
77
78 var arrayComparer = new CustomEqualityComparer<int[]>(
79 (x,y) => (new HashSet<int>(x)).SetEquals(new HashSet<int>(y)),
80 (a) => a.Sum(x => x.GetHashCode())
81 );
82
83 var optimalStates = new HashSet<HashSet<int>>(setComparer);
84 var queue = new HashSet<HashSet<int>>(setComparer);
85
86 foreach (var g in Enumerable
87 .Range(INITIAL_STATE, m_states.Count-1)
88 .Select(i => new {
89 index = i,
90 descriptor = m_states[i]
91 })
92 .Where(x => x.descriptor.final)
93 .GroupBy(x => x.descriptor.tag, arrayComparer)
94 ) {
95 optimalStates.Add(new HashSet<int>(g.Select(x => x.index)));
96 }
97
98 var state = new HashSet<int>(
99 Enumerable
100 .Range(INITIAL_STATE, m_states.Count - 1)
101 .Where(i => !m_states[i].final)
102 );
103 optimalStates.Add(state);
104 queue.Add(state);
105
106 while (queue.Count > 0) {
107 var stateA = queue.First();
108 queue.Remove(stateA);
109
110 for (int c = 0; c < AlphabetSize; c++) {
111 var stateX = new HashSet<int>();
112
113 for(int s = 1; s < m_states.Count; s++) {
114 if (stateA.Contains(m_states[s].transitions[c]))
115 stateX.Add(s);
116 }
117
118 foreach (var stateY in optimalStates.ToArray()) {
119 if (stateX.Overlaps(stateY) && !stateY.IsSubsetOf(stateX)) {
120 var stateR1 = new HashSet<int>(stateY);
121 var stateR2 = new HashSet<int>(stateY);
122
123 stateR1.IntersectWith(stateX);
124 stateR2.ExceptWith(stateX);
125
126 optimalStates.Remove(stateY);
127 optimalStates.Add(stateR1);
128 optimalStates.Add(stateR2);
129
130 if (queue.Contains(stateY)) {
131 queue.Remove(stateY);
132 queue.Add(stateR1);
133 queue.Add(stateR2);
134 } else {
135 queue.Add(stateR1.Count <= stateR2.Count ? stateR1 : stateR2);
136 }
137 }
138 }
139 }
140 }
141
142 // строим карты соотвествия оптимальных состояний с оригинальными
143
144 var initialState = optimalStates.Single(x => x.Contains(INITIAL_STATE));
145
146 // карта получения оптимального состояния по соотвествующему ему простому состоянию
147 int[] reveseOptimalMap = new int[m_states.Count];
148 // карта с индексами оптимальных состояний
149 HashSet<int>[] optimalMap = new HashSet<int>[optimalStates.Count + 1];
150 {
151 optimalMap[0] = new HashSet<int>(); // unreachable state
152 optimalMap[1] = initialState; // initial state
153 foreach (var ss in initialState)
154 reveseOptimalMap[ss] = 1;
155
156 int i = 2;
157 foreach (var s in optimalStates) {
158 if (s.SetEquals(initialState))
159 continue;
160 optimalMap[i] = s;
161 foreach (var ss in s)
162 reveseOptimalMap[ss] = i;
163 i++;
164 }
165 }
166
167 // получаем минимальный алфавит
168
169 var minClasses = new HashSet<HashSet<int>>(setComparer);
170 var alphaQueue = new Queue<HashSet<int>>();
171 alphaQueue.Enqueue(new HashSet<int>(Enumerable.Range(0,AlphabetSize)));
172
173 for (int s = 1 ; s < optimalMap.Length; s++) {
174 var newQueue = new Queue<HashSet<int>>();
175
176 foreach (var A in alphaQueue) {
177 if (A.Count == 1) {
178 minClasses.Add(A);
179 continue;
180 }
181
182 // различаем классы символов, которые переводят в различные оптимальные состояния
183 // optimalState -> alphaClass
184 var classes = new Dictionary<int, HashSet<int>>();
185
186 foreach (var term in A) {
187 // ищем все переходы класса по символу term
188 var s2 = reveseOptimalMap[
189 optimalMap[s].Select(x => m_states[x].transitions[term]).FirstOrDefault(x => x != 0) // первое допустимое элементарное состояние, если есть
190 ];
191
192 HashSet<int> A2;
193 if (!classes.TryGetValue(s2, out A2)) {
194 A2 = new HashSet<int>();
195 newQueue.Enqueue(A2);
196 classes[s2] = A2;
197 }
198 A2.Add(term);
199 }
200 }
201
202 if (newQueue.Count == 0)
203 break;
204 alphaQueue = newQueue;
205 }
206
207 foreach (var A in alphaQueue)
208 minClasses.Add(A);
209
210 var alphabetMap = sourceAlphabet.Reclassify(minimalAlphabet, minClasses);
211
212 // построение автомата
213
214 var states = new int[ optimalMap.Length ];
215 states[0] = UNREACHEBLE_STATE;
216
217 for(var s = INITIAL_STATE; s < states.Length; s++) {
218 var tags = optimalMap[s].SelectMany(x => m_states[x].tag ?? Enumerable.Empty<int>()).Distinct().ToArray();
219 if (tags.Length > 0)
220 states[s] = minimalDFA.AddState(tags);
221 else
222 states[s] = minimalDFA.AddState();
223 }
224
225 Debug.Assert(states[INITIAL_STATE] == INITIAL_STATE);
226
227 for (int s1 = 1; s1 < m_states.Count; s1++) {
228 for (int c = 0; c < AlphabetSize; c++) {
229 var s2 = m_states[s1].transitions[c];
230 if (s2 != UNREACHEBLE_STATE) {
231 minimalDFA.DefineTransition(
232 reveseOptimalMap[s1],
233 reveseOptimalMap[s2],
234 alphabetMap[c]
235 );
236 }
237 }
238 }
239
240 }
241
242 public void PrintDFA<TA>(IAlphabet<TA> alphabet) {
243
244 var reverseMap = alphabet.CreateReverseMap();
245
246 for (int i = 1; i < reverseMap.Length; i++) {
247 Console.WriteLine("C{0}: {1}", i, String.Join(",", reverseMap[i]));
248 }
249
250 for (int i = 1; i < m_states.Count; i++) {
251 var s = m_states[i];
252 for (int c = 0; c < AlphabetSize; c++)
253 if (s.transitions[c] != UNREACHEBLE_STATE)
254 Console.WriteLine("S{0} -{1}-> S{2}{3}", i, String.Join(",", reverseMap[c]), s.transitions[c], m_states[s.transitions[c]].final ? "$" : "");
255 }
256 }
257
258 public int AlphabetSize {
259 get;
260 }
261 }
262 }
@@ -0,0 +1,107
1 using Implab;
2 using System;
3 using System.Collections.Generic;
4 using System.Diagnostics;
5 using System.Linq;
6 using System.Text;
7 using System.Threading.Tasks;
8
9 namespace Implab.Parsing {
10 /// <summary>
11 /// Indexed alphabet is the finite set of symbols where each symbol has a zero-based unique index.
12 /// </summary>
13 public abstract class IndexedAlphabetBase<T> : IAlphabet<T> {
14 public const int UNCLASSIFIED = 0;
15
16 int m_nextId = 1;
17 readonly int[] m_map;
18
19 public int Count {
20 get { return m_nextId; }
21 }
22
23 protected IndexedAlphabetBase(int mapSize) {
24 m_map = new int[mapSize];
25 }
26
27 protected IndexedAlphabetBase(int[] map) {
28 Debug.Assert(map != null);
29
30 m_map = map;
31 m_nextId = map.Max() + 1;
32 }
33
34 public int DefineSymbol(T symbol) {
35 var index = GetSymbolIndex(symbol);
36 if (m_map[index] == UNCLASSIFIED)
37 m_map[index] = m_nextId++;
38 return m_map[index];
39 }
40
41 public int DefineClass(IEnumerable<T> symbols) {
42 Safe.ArgumentNotNull(symbols, "symbols");
43 symbols = symbols.Distinct();
44
45 foreach (var symbol in symbols) {
46 var index = GetSymbolIndex(symbol);
47 if (m_map[index] == UNCLASSIFIED)
48 m_map[GetSymbolIndex(symbol)] = m_nextId;
49 else
50 throw new InvalidOperationException(String.Format("Symbol '{0}' already in use", symbol));
51 }
52 return m_nextId++;
53 }
54
55 public List<T>[] CreateReverseMap() {
56 return
57 Enumerable.Range(UNCLASSIFIED, Count)
58 .Select(
59 i => InputSymbols
60 .Where(x => i != UNCLASSIFIED && m_map[GetSymbolIndex(x)] == i)
61 .ToList()
62 )
63 .ToArray();
64 }
65
66 public int[] Reclassify(IAlphabet<T> newAlphabet, IEnumerable<ICollection<int>> classes) {
67 Safe.ArgumentNotNull(newAlphabet, "newAlphabet");
68 Safe.ArgumentNotNull(classes, "classes");
69 var reverseMap = CreateReverseMap();
70
71 int[] translationMap = new int[Count];
72
73 foreach (var scl in classes) {
74 // skip if the supper class contains the unclassified element
75 if (scl.Contains(UNCLASSIFIED))
76 continue;
77 var range = new List<T>();
78 foreach (var cl in scl) {
79 if (cl < 0 || cl >= reverseMap.Length)
80 throw new ArgumentOutOfRangeException(String.Format("Class {0} is not valid for the current alphabet", cl));
81 range.AddRange(reverseMap[cl]);
82 }
83 var newClass = newAlphabet.DefineClass(range);
84 foreach (var cl in scl)
85 translationMap[cl] = newClass;
86 }
87
88 return translationMap;
89 }
90
91 public virtual int Translate(T symbol) {
92 return m_map[GetSymbolIndex(symbol)];
93 }
94
95 public abstract int GetSymbolIndex(T symbol);
96
97 public abstract IEnumerable<T> InputSymbols { get; }
98
99 /// <summary>
100 /// Gets the translation map from the index of the symbol to it's class this is usefull for the optimized input symbols transtaion.
101 /// </summary>
102 /// <returns>The translation map.</returns>
103 public int[] GetTranslationMap() {
104 return m_map;
105 }
106 }
107 }
This diff has been collapsed as it changes many lines, (924 lines changed) Show them Hide them
@@ -0,0 +1,924
1 NUnit 3.0.1 - December 1, 2015
2
3 Console Runner
4
5 * The Nunit.Runners NuGet package was updated to become a meta-package that pulls in the NUnit.Console package
6 * Reinstated the --pause command line option that will display a message box allowing you to attach a debugger if the --debug option does not work
7
8 Issues Resolved
9
10 * 994 Add max number of Agents to the NUnit project file
11 * 1014 Ensure NUnit API assembly updates with MSI installs
12 * 1024 Added --pause flag to console runner
13 * 1030 Update Nunit.Runners package to 3.0
14 * 1033 "No arguments were provided" with Theory and Values combination
15 * 1035 Check null arguments
16 * 1037 Async tests not working on Windows 10 Universal
17 * 1041 NUnit2XmlResult Writer is reporting Sucess when test fails
18 * 1042 NUnit2 reports on 3.0 is different than 2.6.4
19 * 1046 FloatingPointNumerics.AreAlmostEqualUlps throws OverflowException
20 * 1049 Cannot select Generic tests from command line
21 * 1050 Do not expose System.Runtime.CompilerServices.ExtensionAttribute to public
22 * 1054 Create nuget feeds for CI builds on Appveyor
23 * 1055 nunit3 console runner --where option does not return error on invalid selection string
24 * 1060 Remove "Version 3" from NUnit Nuget Package
25 * 1061 Nunit30Settings.xml becomes corrupted
26 * 1062 Console.WriteLine statements in "OneTimeSetUp" and "OneTimeTearDown" annotated methods are not directed to the console when using nunit3-console.exe runner
27 * 1063 Error in Random Test
28
29 NUnit 3.0.0 Final Release - November 15, 2015
30
31 Issues Resolved
32
33 * 635 Mono 4.0 Support
34
35 NUnit 3.0.0 Release Candidate 3 - November 13, 2015
36
37 Engine
38
39 * The engine now only sets the config file for project.nunit to project.config if project.config exists. Otherwise, each assembly uses its own config, provided it is run in a separate AppDomain by itself.
40
41 NOTE: It is not possible for multiple assemblies in the same AppDomain to use different configs. This is not an NUnit limitation, it's just how configs work!
42
43 Issues Resolved
44
45 * 856 Extensions support for third party runners in NUnit 3.0
46 * 1003 Delete TeamCityEventHandler as it is not used
47 * 1015 Specifying .nunit project and --framework on command line causes crash
48 * 1017 Remove Assert.Multiple from framework
49
50 NUnit 3.0.0 Release Candidate 2 - November 8, 2015
51
52 Engine
53
54 * The IDriverFactory extensibility interface has been modified.
55
56 Issues Resolved
57
58 * 970 Define PARALLEL in CF build of nunitlite
59 * 978 It should be possible to determine version of NUnit using nunit console tool
60 * 983 Inconsistent return codes depending on ProcessModel
61 * 986 Update docs for parallel execution
62 * 988 Don't run portable tests from NUnit Console
63 * 990 V2 driver is passing invalid filter elements to NUnit
64 * 991 Mono.Options should not be exposed to public directly
65 * 993 Give error message when a regex filter is used with NUnit V2
66 * 997 Add missing XML Documentation
67 * 1008 NUnitLite namespace not updated in the NuGet Packages
68
69 NUnit 3.0.0 Release Candidate - November 1, 2015
70
71 Framework
72
73 * The portable build now supports ASP.NET 5 and the new Core CLR.
74
75 NOTE: The `nunit3-console` runner cannot run tests that reference the portable build.
76 You may run such tests using NUnitLite or a platform-specific runner.
77
78 * `TestCaseAttribute` and `TestCaseData` now allow modifying the test name without replacing it entirely.
79 * The Silverlight packages are now separate downloads.
80
81 NUnitLite
82
83 * The NUnitLite runner now produces the same output display and XML results as the console runner.
84
85 Engine
86
87 * The format of the XML result file has been finalized and documented.
88
89 Console Runner
90
91 * The console runner program is now called `nunit3-console`.
92 * Console runner output has been modified so that the summary comes at the end, to reduce the need for scrolling.
93
94 Issues Resolved
95
96 * 59 Length of generated test names should be limited
97 * 68 Customization of test case name generation
98 * 404 Split tests between nunitlite.runner and nunit.framework
99 * 575 Add support for ASP.NET 5 and the new Core CLR
100 * 783 Package separately for Silverlight
101 * 833 Intermittent failure of WorkItemQueueTests.StopQueue_WithWorkers
102 * 859 NUnit-Console output - move Test Run Summary to end
103 * 867 Remove Warnings from Ignored tests
104 * 868 Review skipped tests
105 * 887 Move environment and settings elements to the assembly suite in the result file
106 * 899 Colors for ColorConsole on grey background are too light
107 * 904 InternalPreserveStackTrace is not supported on all Portable platforms
108 * 914 Unclear error message from console runner when assembly has no tests
109 * 916 Console runner dies when test agent dies
110 * 918 Console runner --where parameter is case sensitive
111 * 920 Remove addins\nunit.engine.api.dll from NuGet package
112 * 929 Rename nunit-console.exe
113 * 931 Remove beta warnings from NuGet packages
114 * 936 Explicit skipped tests not displayed
115 * 939 Installer complains about .NET even if already installed
116 * 940 Confirm or modify list of packages for release
117 * 947 Breaking API change in ValueSourceAttribute
118 * 949 Update copyright in NUnit Console
119 * 954 NUnitLite XML output is not consistent with the engine's
120 * 955 NUnitLite does not display the where clause
121 * 959 Restore filter options for NUnitLite portable build
122 * 960 Intermittent failure of CategoryFilterTests
123 * 967 Run Settings Report is not being displayed.
124
125 NUnit 3.0.0 Beta 5 - October 16, 2015
126
127 Framework
128
129 * Parameterized test cases now support nullable arguments.
130 * The NUnit framework may now be built for the .NET Core framework. Note that this is only available through building the source code. A binary will be available in the next release.
131
132 Engine
133
134 * The engine now runs multiple test assemblies in parallel by default
135 * The output XML now includes more information about the test run, including the text of the command used, any engine settings and the filter used to select tests.
136 * Extensions may now specify data in an identifying attribute, for use by the engine in deciding whether to load that extension.
137
138
139 Console Runner
140
141 * The console now displays all settings used by the engine to run tests as well as the filter used to select tests.
142 * The console runner accepts a new option --maxagents. If multiple assemblies are run in separate processes, this value may be used to limit the number that are executed simultaneously in parallel.
143 * The console runner no longer accepts the --include and --exclude options. Instead, the new --where option provides a more general way to express which tests will be executed, such as --where "cat==Fast && Priority==High". See the docs for details of the syntax.
144 * The new --debug option causes NUnit to break in the debugger immediately before tests are run. This simplifies debugging, especially when the test is run in a separate process.
145
146 Issues Resolved
147
148 * 41 Check for zeroes in Assert messages
149 * 254 Finalize XML format for test results
150 * 275 NUnitEqualityComparer fails to compare IEquatable<T> where second object is derived from T
151 * 304 Run test Assemblies in parallel
152 * 374 New syntax for selecting tests to be run
153 * 515 OSPlatform.IsMacOSX doesn't work
154 * 573 nunit-console hangs on Mac OS X after all tests have run
155 * 669 TeamCity service message should have assembly name as a part of test name.
156 * 689 The TeamCity service message "testFinished" should have an integer value in the "duration" attribute
157 * 713 Include command information in XML
158 * 719 We have no way to configure tests for several assemblies using NUnit project file and the common installation from msi file
159 * 735 Workers number in xml report file cannot be found
160 * 784 Build Portable Framework on Linux
161 * 790 Allow Extensions to provide data through an attribute
162 * 794 Make it easier to debug tests as well as NUnit itself
163 * 801 NUnit calls Dispose multiple times
164 * 814 Support nullable types with TestCase
165 * 818 Possible error in Merge Pull Request #797
166 * 821 Wrapped method results in loss of result information
167 * 822 Test for Debugger in NUnitTestAssemblyRunner probably should not be in CF build
168 * 824 Remove unused System.Reflection using statements
169 * 826 Randomizer uniqueness tests fail randomly!
170 * 828 Merge pull request #827 (issue 826)
171 * 830 Add ability to report test results synchronously to test runners
172 * 837 Enumerators not disposed when comparing IEnumerables
173 * 840 Add missing copyright notices
174 * 844 Pull Request #835 (Issue #814) does not build in CF
175 * 847 Add new --process:inprocess and --inprocess options
176 * 850 Test runner fails if test name contains invalid xml characters
177 * 851 'Exclude' console option is not working in NUnit Lite
178 * 853 Cannot run NUnit Console from another directory
179 * 860 Use CDATA section for message, stack-trace and output elements of XML
180 * 863 Eliminate core engine
181 * 865 Intermittent failures of StopWatchTests
182 * 869 Tests that use directory separator char to determine platform misreport Linux on MaxOSX
183 * 870 NUnit Console Runtime Environment misreports on MacOSX
184 * 874 Add .NET Core Framework
185 * 878 Cannot exclude MacOSX or XBox platforms when running on CF
186 * 892 Fixed test runner returning early when executing more than one test run.
187 * 894 Give nunit.engine and nunit.engine.api assemblies strong names
188 * 896 NUnit 3.0 console runner not placing test result xml in --work directory
189
190 NUnit 3.0.0 Beta 4 - August 25, 2015
191
192 Framework
193
194 * A new RetryAttribute allows retrying of failing tests.
195 * New SupersetConstraint and Is.SupersetOf syntax complement SubsetConstraint.
196 * Tests skipped due to ExplicitAttribute are now reported as skipped.
197
198 Engine
199
200 * We now use Cecil to examine assemblies prior to loading them.
201 * Extensions are no longer based on Mono.Addins but use our own extension framework.
202
203 Issues Resolved
204
205 * 125 3rd-party dependencies should be downloaded on demand
206 * 283 What should we do when a user extension does something bad?
207 * 585 RetryAttribute
208 * 642 Restructure MSBuild script
209 * 649 Change how we zip packages
210 * 654 ReflectionOnlyLoad and ReflectionOnlyLoadFrom
211 * 664 Invalid "id" attribute in the report for case "test started"
212 * 685 In the some cases when tests cannot be started NUnit returns exit code "0"
213 * 728 Missing Assert.That overload
214 * 741 Explicit Tests get run when using --exclude
215 * 746 Framework should send events for all tests
216 * 747 NUnit should apply attributes even if test is non-runnable
217 * 749 Review Use of Mono.Addins for Engine Extensibility
218 * 750 Include Explicit Tests in Test Results
219 * 753 Feature request: Is.SupersetOf() assertion constraint
220 * 755 TimeOut attribute doesn't work with TestCaseSource Attribute
221 * 757 Implement some way to wait for execution to complete in ITestEngineRunner
222 * 760 Packaging targets do not run on Linux
223 * 766 Added overloads for True()/False() accepting booleans
224 * 778 Build and build.cmd scripts invoke nuget.exe improperly
225 * 780 Teamcity fix
226 * 782 No sources for 2.6.4
227
228 NUnit 3.0.0 Beta 3 - July 15, 2015
229
230 Framework
231
232 * The RangeAttribute has been extended to support more data types including
233 uint, long and ulong
234 * Added platform support for Windows 10 and fixed issues with Windows 8 and
235 8.1 support
236 * Added async support to the portable version of NUnit Framework
237 * The named members of the TestCaseSource and ValueSource attributes must now be
238 static.
239 * RandomAttribute has been extended to add support for new data types including
240 uint, long, ulong, short, ushort, float, byte and sbyte
241 * TestContext.Random has also been extended to add support for new data types including
242 uint, long, ulong, short, ushort, float, byte, sbyte and decimal
243 * Removed the dependency on Microsoft.Bcl.Async from the NUnit Framework assembly
244 targeting .NET 4.0. If you want to write async tests in .NET 4.0, you will need
245 to reference the NuGet package yourself.
246 * Added a new TestFixtureSource attribute which is the equivalent to TestCaseSource
247 but provides for instantiation of fixtures.
248 * Significant improvements have been made in how NUnit deduces the type arguments of
249 generic methods based on the arguments provided.
250
251 Engine
252
253 * If the target framework is not specified, test assemblies that are compiled
254 to target .NET 4.5 will no longer run in .NET 4.0 compatibility mode
255
256 Console
257
258 * If the console is run without arguments, it will now display help
259
260 Issues Resolved
261
262 * 47 Extensions to RangeAttribute
263 * 237 System.Uri .ctor works not properly under Nunit
264 * 244 NUnit should properly distinguish between .NET 4.0 and 4.5
265 * 310 Target framework not specified on the AppDomain when running against .Net 4.5
266 * 321 Rationalize how we count tests
267 * 472 Overflow exception and DivideByZero exception from the RangeAttribute
268 * 524 int and char do not compare correctly?
269 * 539 Truncation of string arguments
270 * 544 AsyncTestMethodTests for 4.5 Framework fails frequently on Travis CI
271 * 656 Unused parameter in Console.WriteLine found
272 * 670 Failing Tests in TeamCity Build
273 * 673 Ensure proper disposal of engine objects
274 * 674 Engine does not release test assemblies
275 * 679 Windows 10 Support
276 * 682 Add Async Support to Portable Framework
277 * 683 Make FrameworkController available in portable build
278 * 687 TestAgency does not launch agent process correctly if runtime type is not specified (i.e. v4.0)
279 * 692 PlatformAttribute_OperatingSystemBitNess fails when running in 32-bit process
280 * 693 Generic Test<T> Method cannot determine type arguments for fixture when passed as IEnumerable<T>
281 * 698 Require TestCaseSource and ValueSource named members to be static
282 * 703 TeamCity non-equal flowid for 'testStarted' and 'testFinished' messages
283 * 712 Extensions to RandomAttribute
284 * 715 Provide a data source attribute at TestFixture Level
285 * 718 RangeConstraint gives error with from and two args of differing types
286 * 723 Does nunit.nuspec require dependency on Microsoft.Bcl.Async?
287 * 724 Adds support for Nullable<bool> to Assert.IsTrue and Assert.IsFalse
288 * 734 Console without parameters doesn't show help
289
290 NUnit 3.0.0 Beta 2 - May 12, 2015
291
292 Framework
293
294 * The Compact Framework version of the framework is now packaged separately
295 and will be distributed as a ZIP file and as a NuGet package.
296 * The NUnit 2.x RepeatAttribute was added back into the framework.
297 * Added Throws.ArgumentNullException
298 * Added GetString methods to NUnit.Framework.Internal.RandomGenerator to
299 create repeatable random strings for testing
300 * When checking the equality of DateTimeOffset, you can now use the
301 WithSameOffset modifier
302 * Some classes intended for internal usage that were public for testing
303 have now been made internal. Additional classes will be made internal
304 for the final 3.0 release.
305
306 Engine
307
308 * Added a core engine which is a non-extensible, minimal engine for use by
309 devices and similar situations where reduced functionality is compensated
310 for by reduced size and simplicity of usage. See
311 https://github.com/nunit/dev/wiki/Core-Engine for more information.
312
313 Issues Resolved
314
315 * 22 Add OSArchitecture Attribute to Environment node in result xml
316 * 24 Assert on Dictionary Content
317 * 48 Explicit seems to conflict with Ignore
318 * 168 Create NUnit 3.0 documentation
319 * 196 Compare DateTimeOffsets including the offset in the comparison
320 * 217 New icon for the 3.0 release
321 * 316 NUnitLite TextUI Runner
322 * 320 No Tests found: Using parametrized Fixture and TestCaseSource
323 * 360 Better exception message when using non-BCL class in property
324 * 454 Rare registry configurations may cause NUnit to fail
325 * 478 RepeatAttribute
326 * 481 Testing multiple assemblies in nunitlite
327 * 538 Potential bug using TestContext in constructors
328 * 546 Enable Parallel in NUnitLite/CF (or more) builds
329 * 551 TextRunner not passing the NumWorkers option to the ITestAssemblyRunner
330 * 556 Executed tests should always return a non-zero duration
331 * 559 Fix text of NuGet packages
332 * 560 Fix PackageVersion property on wix install projects
333 * 562 Program.cs in NUnitLite NuGet package is incorrect
334 * 564 NUnitLite Nuget package is Beta 1a, Framework is Beta 1
335 * 565 NUnitLite Nuget package adds Program.cs to a VB Project
336 * 568 Isolate packaging from building
337 * 570 ThrowsConstraint failure message should include stack trace of actual exception
338 * 576 Throws.ArgumentNullException would be nice
339 * 577 Documentation on some members of Throws falsely claims that they return `TargetInvocationException` constraints
340 * 579 No documentation for recommended usage of TestCaseSourceAttribute
341 * 580 TeamCity Service Message Uses Incorrect Test Name with NUnit2Driver
342 * 582 Test Ids Are Not Unique
343 * 583 TeamCity service messages to support parallel test execution
344 * 584 Non-runnable assembly has incorrect ResultState
345 * 609 Add support for integration with TeamCity
346 * 611 Remove unused --teamcity option from CF build of NUnitLite
347 * 612 MaxTime doesn't work when used for TestCase
348 * 621 Core Engine
349 * 622 nunit-console fails when use --output
350 * 628 Modify IService interface and simplify ServiceContext
351 * 631 Separate packaging for the compact framework
352 * 646 ConfigurationManager.AppSettings Params Return Null under Beta 1
353 * 648 Passing 2 or more test assemblies targeting > .NET 2.0 to nunit-console fails
354
355 NUnit 3.0.0 Beta 1 - March 25, 2015
356
357 General
358
359 * There is now a master windows installer for the framework, engine and console runner.
360
361 Framework
362
363 * We no longer create a separate framework build for .NET 3.5. The 2.0 and
364 3.5 builds were essentially the same, so the former should now be used
365 under both runtimes.
366 * A new Constraint, DictionaryContainsKeyConstraint, may be used to test
367 that a specified key is present in a dictionary.
368 * LevelOfParallelizationAttribute has been renamed to LevelOfParallelismAttribute.
369 * The Silverlight runner now displays output in color and includes any
370 text output created by the tests.
371 * The class and method names of each test are included in the output xml
372 where applicable.
373 * String arguments used in test case names are now truncated to 40 rather
374 than 20 characters.
375
376 Engine
377
378 * The engine API has now been finalized. It permits specifying a minimum
379 version of the engine that a runner is able to use. The best installed
380 version of the engine will be loaded. Third-party runners may override
381 the selection process by including a copy of the engine in their
382 installation directory and specifying that it must be used.
383 * The V2 framework driver now uses the event listener and test listener
384 passed to it by the runner. This corrects several outstanding issues
385 caused by events not being received and allows selecting V2 tests to
386 be run from the command-line, in the same way that V3 tests are selected.
387
388 Console
389
390 * The console now defaults to not using shadowcopy. There is a new option
391 --shadowcopy to turn it on if needed.
392
393 Issues Resolved
394
395 * 224 Silverlight Support
396 * 318 TestActionAttribute: Retrieving the TestFixture
397 * 428 Add ExpectedExceptionAttribute to C# samples
398 * 440 Automatic selection of Test Engine to use
399 * 450 Create master install that includes the framework, engine and console installs
400 * 477 Assert does not work with ArraySegment
401 * 482 nunit-console has multiple errors related to -framework option
402 * 483 Adds constraint for asserting that a dictionary contains a particular key
403 * 484 Missing file in NUnit.Console nuget package
404 * 485 Can't run v2 tests with nunit-console 3.0
405 * 487 NUnitLite can't load assemblies by their file name
406 * 488 Async setup and teardown still don't work
407 * 497 Framework installer shold register the portable framework
408 * 504 Option --workers:0 is ignored
409 * 508 Travis builds with failure in engine tests show as successful
410 * 509 Under linux, not all mono profiles are listed as available
411 * 512 Drop the .NET 3.5 build
412 * 517 V2 FrameworkDriver does not make use of passed in TestEventListener
413 * 523 Provide an option to disable shadowcopy in NUnit v3
414 * 528 V2 FrameworkDriver does not make use of passed in TestFilter
415 * 530 Color display for Silverlight runner
416 * 531 Display text output from tests in Silverlight runner
417 * 534 Add classname and methodname to test result xml
418 * 541 Console help doesn't indicate defaults
419
420 NUnit 3.0.0 Alpha 5 - January 30, 2015
421
422 General
423
424 * A Windows installer is now included in the release packages.
425
426 Framework
427
428 * TestCaseAttribute now allows arguments with default values to be omitted. Additionaly, it accepts a Platform property to specify the platforms on which the test case should be run.
429 * TestFixture and TestCase attributes now enforce the requirement that a reason needs to be provided when ignoring a test.
430 * SetUp, TearDown, OneTimeSetUp and OneTimeTearDown methods may now be async.
431 * String arguments over 20 characters in length are truncated when used as part of a test name.
432
433 Engine
434
435 * The engine is now extensible using Mono.Addins. In this release, extension points are provided for FrameworkDrivers, ProjectLoaders and OutputWriters. The following addins are bundled as a part of NUnit:
436 * A FrameworkDriver that allows running NUnit V2 tests under NUnit 3.0.
437 * ProjectLoaders for NUnit and Visual Studio projects.
438 * An OutputWriter that creates XML output in NUnit V2 format.
439 * DomainUsage now defaults to Multiple if not specified by the runner
440
441 Console
442
443 * New options supported:
444 * --testlist provides a list of tests to run in a file
445 * --stoponerror indicates that the run should terminate when any test fails.
446
447 Issues Resolved
448
449 * 20 TestCaseAttribute needs Platform property.
450 * 60 NUnit should support async setup, teardown, fixture setup and fixture teardown.
451 * 257 TestCaseAttribute should not require parameters with default values to be specified.
452 * 266 Pluggable framework drivers.
453 * 368 Create addin model.
454 * 369 Project loader addins
455 * 370 OutputWriter addins
456 * 403 Move ConsoleOptions.cs and Options.cs to Common and share...
457 * 419 Create Windows Installer for NUnit.
458 * 427 [TestFixture(Ignore=true)] should not be allowed.
459 * 437 Errors in tests under Linux due to hard-coded paths.
460 * 441 NUnit-Console should support --testlist option
461 * 442 Add --stoponerror option back to nunit-console.
462 * 456 Fix memory leak in RuntimeFramework.
463 * 459 Remove the Mixed Platforms build configuration.
464 * 468 Change default domain usage to multiple.
465 * 469 Truncate string arguments in test names in order to limit the length.
466
467 NUnit 3.0.0 Alpha 4 - December 30, 2014
468
469 Framework
470
471 * ApartmentAttribute has been added, replacing STAAttribute and MTAAttribute.
472 * Unnecessary overloads of Assert.That and Assume.That have been removed.
473 * Multiple SetUpFixtures may be specified in a single namespace.
474 * Improvements to the Pairwise strategy test case generation algorithm.
475 * The new NUnitLite runner --testlist option, allows a list of tests to be kept in a file.
476
477 Engine
478
479 * A driver is now included, which allows running NUnit 2.x tests under NUnit 3.0.
480 * The engine can now load and run tests specified in a number of project formats:
481 * NUnit (.nunit)
482 * Visual Studio C# projects (.csproj)
483 * Visual Studio F# projects (.vjsproj)
484 * Visual Studio Visual Basic projects (.vbproj)
485 * Visual Studio solutions (.sln)
486 * Legacy C++ and Visual JScript projects (.csproj and .vjsproj) are also supported
487 * Support for the current C++ format (.csxproj) is not yet available
488 * Creation of output files like TestResult.xml in various formats is now a
489 service of the engine, available to any runner.
490
491 Console
492
493 * The command-line may now include any number of assemblies and/or supported projects.
494
495 Issues Resolved
496
497 * 37 Multiple SetUpFixtures should be permitted on same namespace
498 * 210 TestContext.WriteLine in an AppDomain causes an error
499 * 227 Add support for VS projects and solutions
500 * 231 Update C# samples to use NUnit 3.0
501 * 233 Update F# samples to use NUnit 3.0
502 * 234 Update C++ samples to use NUnit 3.0
503 * 265 Reorganize console reports for nunit-console and nunitlite
504 * 299 No full path to assembly in XML file under Compact Framework
505 * 301 Command-line length
506 * 363 Make Xml result output an engine service
507 * 377 CombiningStrategyAttributes don't work correctly on generic methods
508 * 388 Improvements to NUnitLite runner output
509 * 390 Specify exactly what happens when a test times out
510 * 396 ApartmentAttribute
511 * 397 CF nunitlite runner assembly has the wrong name
512 * 407 Assert.Pass() with ]]> in message crashes console runner
513 * 414 Simplify Assert overloads
514 * 416 NUnit 2.x Framework Driver
515 * 417 Complete work on NUnit projects
516 * 420 Create Settings file in proper location
517
518 NUnit 3.0.0 Alpha 3 - November 29, 2014
519
520 Breaking Changes
521
522 * NUnitLite tests must reference both the nunit.framework and nunitlite assemblies.
523
524 Framework
525
526 * The NUnit and NUnitLite frameworks have now been merged. There is no longer any distinction
527 between them in terms of features, although some features are not available on all platforms.
528 * The release includes two new framework builds: compact framework 3.5 and portable. The portable
529 library is compatible with .NET 4.5, Silverlight 5.0, Windows 8, Windows Phone 8.1,
530 Windows Phone Silverlight 8, Mono for Android and MonoTouch.
531 * A number of previously unsupported features are available for the Compact Framework:
532 - Generic methods as tests
533 - RegexConstraint
534 - TimeoutAttribute
535 - FileAssert, DirectoryAssert and file-related constraints
536
537 Engine
538
539 * The logic of runtime selection has now changed so that each assembly runs by default
540 in a separate process using the runtime for which it was built.
541 * On 64-bit systems, each test process is automatically created as 32-bit or 64-bit,
542 depending on the platform specified for the test assembly.
543
544 Console
545
546 * The console runner now runs tests in a separate process per assembly by default. They may
547 still be run in process or in a single separate process by use of command-line options.
548 * The console runner now starts in the highest version of the .NET runtime available, making
549 it simpler to debug tests by specifying that they should run in-process on the command-line.
550 * The -x86 command-line option is provided to force execution in a 32-bit process on a 64-bit system.
551 * A writeability check is performed for each output result file before trying to run the tests.
552 * The -teamcity option is now supported.
553
554 Issues Resolved
555
556 * 12 Compact framework should support generic methods
557 * 145 NUnit-console fails if test result message contains invalid xml characters
558 * 155 Create utility classes for platform-specific code
559 * 223 Common code for NUnitLite console runner and NUnit-Console
560 * 225 Compact Framework Support
561 * 238 Improvements to running 32 bit tests on a 64 bit system
562 * 261 Add portable nunitlite build
563 * 284 NUnitLite Unification
564 * 293 CF does not have a CurrentDirectory
565 * 306 Assure NUnit can write resultfile
566 * 308 Early disposal of runners
567 * 309 NUnit-Console should support incremental output under TeamCity
568 * 325 Add RegexConstraint to compact framework build
569 * 326 Add TimeoutAttribute to compact framework build
570 * 327 Allow generic test methods in the compact framework
571 * 328 Use .NET Stopwatch class for compact framework builds
572 * 331 Alpha 2 CF does not build
573 * 333 Add parallel execution to desktop builds of NUnitLite
574 * 334 Include File-related constraints and syntax in NUnitLite builds
575 * 335 Re-introduce 'Classic' NUnit syntax in NUnitLite
576 * 336 Document use of separate obj directories per build in our projects
577 * 337 Update Standard Defines page for .NET 3.0
578 * 341 Move the NUnitLite runners to separate assemblies
579 * 367 Refactor XML Escaping Tests
580 * 372 CF Build TestAssemblyRunnerTests
581 * 373 Minor CF Test Fixes
582 * 378 Correct documentation for PairwiseAttribute
583 * 386 Console Output Improvements
584
585 NUnit 3.0.0 Alpha 2 - November 2, 2014
586
587 Breaking Changes
588
589 * The console runner no longer displays test results in the debugger.
590 * The NUnitLite compact framework 2.0 build has been removed.
591 * All addin support has been removed from the framework. Documentation of NUnit 3.0 extensibility features will be published in time for the beta release. In the interim, please ask for support on the nunit-discuss list.
592
593 General
594
595 * A separate solution has been created for Linux
596 * We now have continuous integration builds under both Travis and Appveyor
597 * The compact framework 3.5 build is now working and will be supported in future releases.
598
599 New Features
600
601 * The console runner now automatically detects 32- versus 64-bit test assemblies.
602 * The NUnitLite report output has been standardized to match that of nunit-console.
603 * The NUnitLite command-line has been standardized to match that of nunit-console where they share the same options.
604 * Both nunit-console and NUnitLite now display output in color.
605 * ActionAttributes now allow specification of multiple targets on the attribute as designed. This didn't work in the first alpha.
606 * OneTimeSetUp and OneTimeTearDown failures are now shown on the test report. Individual test failures after OneTimeSetUp failure are no longer shown.
607 * The console runner refuses to run tests build with older versions of NUnit. A plugin will be available to run older tests in the future.
608
609 Issues Resolved
610
611 * 222 Color console for NUnitLite
612 * 229 Timing failures in tests
613 * 241 Remove reference to Microslft BCL packages
614 * 243 Create solution for Linux
615 * 245 Multiple targets on action attributes not implemented
616 * 246 C++ tests do not compile in VS2013
617 * 247 Eliminate trace display when running tests in debug
618 * 255 Add new result states for more precision in where failures occur
619 * 256 ContainsConstraint break when used with AndConstraint
620 * 264 Stacktrace displays too many entries
621 * 269 Add manifest to nunit-console and nunit-agent
622 * 270 OneTimeSetUp failure results in too much output
623 * 271 Invalid tests should be treated as errors
624 * 274 Command line options should be case insensitive
625 * 276 NUnit-console should not reference nunit.framework
626 * 278 New result states (ChildFailure and SetupFailure) break NUnit2XmlOutputWriter
627 * 282 Get tests for NUnit2XmlOutputWriter working
628 * 288 Set up Appveyor CI build
629 * 290 Stack trace still displays too many items
630 * 315 NUnit 3.0 alpha: Cannot run in console on my assembly
631 * 319 CI builds are not treating test failures as failures of the build
632 * 322 Remove Stopwatch tests where they test the real .NET Stopwatch
633
634 NUnit 3.0.0 Alpha 1 - September 22, 2014
635
636 Breaking Changes
637
638 * Legacy suites are no longer supported
639 * Assert.NullOrEmpty is no longer supported (Use Is.Null.Or.Empty)
640
641 General
642
643 * MsBuild is now used for the build rather than NAnt
644 * The framework test harness has been removed now that nunit-console is at a point where it can run the tests.
645
646 New Features
647
648 * Action Attributes have been added with the same features as in NUnit 2.6.3.
649 * TestContext now has a method that allows writing to the XML output.
650 * TestContext.CurrentContext.Result now provides the error message and stack trace during teardown.
651 * Does prefix operator supplies several added constraints.
652
653 Issues Resolved
654
655 * 6 Log4net not working with NUnit
656 * 13 Standardize commandline options for nunitlite runner
657 * 17 No allowance is currently made for nullable arguents in TestCase parameter conversions
658 * 33 TestCaseSource cannot refer to a parameterized test fixture
659 * 54 Store message and stack trace in TestContext for use in TearDown
660 * 111 Implement Changes to File, Directory and Path Assertions
661 * 112 Implement Action Attributes
662 * 156 Accessing multiple AppDomains within unit tests result in SerializationException
663 * 163 Add --trace option to NUnitLite
664 * 167 Create interim documentation for the alpha release
665 * 169 Design and implement distribution of NUnit packages
666 * 171 Assert.That should work with any lambda returning bool
667 * 175 Test Harness should return an error if any tests fail
668 * 180 Errors in Linux CI build
669 * 181 Replace NAnt with MsBuild / XBuild
670 * 183 Standardize commandline options for test harness
671 * 188 No output from NUnitLite when selected test is not found
672 * 189 Add string operators to Does prefix
673 * 193 TestWorkerTests.BusyExecutedIdleEventsCalledInSequence fails occasionally
674 * 197 Deprecate or remove Assert.NullOrEmpty
675 * 202 Eliminate legacy suites
676 * 203 Combine framework, engine and console runner in a single solution and repository
677 * 209 Make Ignore attribute's reason mandatory
678 * 215 Running 32-bit tests on a 64-bit OS
679 * 219 Teardown failures are not reported
680
681 Console Issues Resolved (Old nunit-console project, now combined with nunit)
682
683 * 2 Failure in TestFixtureSetUp is not reported correctly
684 * 5 CI Server for nunit-console
685 * 6 System.NullReferenceException on start nunit-console-x86
686 * 21 NUnitFrameworkDriverTests fail if not run from same directory
687 * 24 'Debug' value for /trace option is deprecated in 2.6.3
688 * 38 Confusing Excluded categories output
689
690 NUnit 2.9.7 - August 8, 2014
691
692 Breaking Changes
693
694 * NUnit no longer supports void async test methods. You should use a Task return Type instead.
695 * The ExpectedExceptionAttribute is no longer supported. Use Assert.Throws() or Assert.That(..., Throws) instead for a more precise specification of where the exception is expected to be thrown.
696
697 New Features
698
699 * Parallel test execution is supported down to the Fixture level. Use ParallelizableAttribute to indicate types that may be run in parallel.
700 * Async tests are supported for .NET 4.0 if the user has installed support for them.
701 * A new FileExistsConstraint has been added along with FileAssert.Exists and FileAssert.DoesNotExist
702 * ExpectedResult is now supported on simple (non-TestCase) tests.
703 * The Ignore attribute now takes a named parameter Until, which allows specifying a date after which the test is no longer ignored.
704 * The following new values are now recognized by PlatformAttribute: Win7, Win8, Win8.1, Win2012Server, Win2012ServerR2, NT6.1, NT6.2, 32-bit, 64-bit
705 * TimeoutAttribute is now supported under Silverlight
706 * ValuesAttribute may be used without any values on an enum or boolean argument. All possible values are used.
707 * You may now specify a tolerance using Within when testing equality of DateTimeOffset values.
708 * The XML output now includes a start and end time for each test.
709
710 Issues Resolved
711
712 * 8 [SetUpFixture] is not working as expected
713 * 14 CI Server for NUnit Framework
714 * 21 Is.InRange Constraint Ambiguity
715 * 27 Values attribute support for enum types
716 * 29 Specifying a tolerance with "Within" doesn't work for DateTimeOffset data types
717 * 31 Report start and end time of test execution
718 * 36 Make RequiresThread, RequiresSTA, RequiresMTA inheritable
719 * 45 Need of Enddate together with Ignore
720 * 55 Incorrect XML comments for CollectionAssert.IsSubsetOf
721 * 62 Matches(Constraint) does not work as expected
722 * 63 Async support should handle Task return type without state machine
723 * 64 AsyncStateMachineAttribute should only be checked by name
724 * 65 Update NUnit Wiki to show the new location of samples
725 * 66 Parallel Test Execution within test assemblies
726 * 67 Allow Expected Result on simple tests
727 * 70 EquivalentTo isn't compatible with IgnoreCase for dictioneries
728 * 75 Async tests should be supported for projects that target .NET 4.0
729 * 82 nunit-framework tests are timing out on Linux
730 * 83 Path-related tests fail on Linux
731 * 85 Culture-dependent NUnit tests fail on non-English machine
732 * 88 TestCaseSourceAttribute documentation
733 * 90 EquivalentTo isn't compatible with IgnoreCase for char
734 * 100 Changes to Tolerance definitions
735 * 110 Add new platforms to PlatformAttribute
736 * 113 Remove ExpectedException
737 * 118 Workarounds for missing InternalPreserveStackTrace in mono
738 * 121 Test harness does not honor the --worker option when set to zero
739 * 129 Standardize Timeout in the Silverlight build
740 * 130 Add FileAssert.Exists and FileAssert.DoesNotExist
741 * 132 Drop support for void async methods
742 * 153 Surprising behavior of DelayedConstraint pollingInterval
743 * 161 Update API to support stopping an ongoing test run
744
745 NOTE: Bug Fixes below this point refer to the number of the bug in Launchpad.
746
747 NUnit 2.9.6 - October 4, 2013
748
749 Main Features
750
751 * Separate projects for nunit-console and nunit.engine
752 * New builds for .NET 4.5 and Silverlight
753 * TestContext is now supported
754 * External API is now stable; internal interfaces are separate from API
755 * Tests may be run in parallel on separate threads
756 * Solutions and projects now use VS2012 (except for Compact framework)
757
758 Bug Fixes
759
760 * 463470 We should encapsulate references to pre-2.0 collections
761 * 498690 Assert.That() doesn't like properties with scoped setters
762 * 501784 Theory tests do not work correctly when using null parameters
763 * 531873 Feature: Extraction of unit tests from NUnit test assembly and calling appropriate one
764 * 611325 Allow Teardown to detect if last test failed
765 * 611938 Generic Test Instances disappear
766 * 655882 Make CategoryAttribute inherited
767 * 664081 Add Server2008 R2 and Windows 7 to PlatformAttribute
768 * 671432 Upgrade NAnt to Latest Release
769 * 676560 Assert.AreEqual does not support IEquatable<T>
770 * 691129 Add Category parameter to TestFixture
771 * 697069 Feature request: dynamic location for TestResult.xml
772 * 708173 NUnit's logic for comparing arrays - use Comparer<T[]> if it is provided
773 * 709062 "System.ArgumentException : Cannot compare" when the element is a list
774 * 712156 Tests cannot use AppDomain.SetPrincipalPolicy
775 * 719184 Platformdependency in src/ClientUtilities/util/Services/DomainManager.cs:40
776 * 719187 Using Path.GetTempPath() causes conflicts in shared temporary folders
777 * 735851 Add detection of 3.0, 3.5 and 4.0 frameworks to PlatformAttribute
778 * 736062 Deadlock when EventListener performs a Trace call + EventPump synchronisation
779 * 756843 Failing assertion does not show non-linear tolerance mode
780 * 766749 net-2.0\nunit-console-x86.exe.config should have a <startup /> element and also enable loadFromRemoteSources
781 * 770471 Assert.IsEmpty does not support IEnumerable
782 * 785460 Add Category parameter to TestCaseSourceAttribute
783 * 787106 EqualConstraint provides inadequate failure information for IEnumerables
784 * 792466 TestContext MethodName
785 * 794115 HashSet incorrectly reported
786 * 800089 Assert.Throws() hides details of inner AssertionException
787 * 848713 Feature request: Add switch for console to break on any test case error
788 * 878376 Add 'Exactly(n)' to the NUnit constraint syntax
789 * 882137 When no tests are run, higher level suites display as Inconclusive
790 * 882517 NUnit 2.5.10 doesn't recognize TestFixture if there are only TestCaseSource inside
791 * 885173 Tests are still executed after cancellation by user
792 * 885277 Exception when project calls for a runtime using only 2 digits
793 * 885604 Feature request: Explicit named parameter to TestCaseAttribute
794 * 890129 DelayedConstraint doesn't appear to poll properties of objects
795 * 892844 Not using Mono 4.0 profile under Windows
796 * 893919 DelayedConstraint fails polling properties on references which are initially null
797 * 896973 Console output lines are run together under Linux
798 * 897289 Is.Empty constraint has unclear failure message
799 * 898192 Feature Request: Is.Negative, Is.Positive
800 * 898256 IEnumerable<T> for Datapoints doesn't work
801 * 899178 Wrong failure message for parameterized tests that expect exceptions
802 * 904841 After exiting for timeout the teardown method is not executed
803 * 908829 TestCase attribute does not play well with variadic test functions
804 * 910218 NUnit should add a trailing separator to the ApplicationBase
805 * 920472 CollectionAssert.IsNotEmpty must dispose Enumerator
806 * 922455 Add Support for Windows 8 and Windows 2012 Server to PlatformAttribute
807 * 928246 Use assembly.Location instead of assembly.CodeBase
808 * 958766 For development work under TeamCity, we need to support nunit2 formatted output under direct-runner
809 * 1000181 Parameterized TestFixture with System.Type as constructor arguments fails
810 * 1000213 Inconclusive message Not in report output
811 * 1023084 Add Enum support to RandomAttribute
812 * 1028188 Add Support for Silverlight
813 * 1029785 Test loaded from remote folder failed to run with exception System.IODirectory
814 * 1037144 Add MonoTouch support to PlatformAttribute
815 * 1041365 Add MaxOsX and Xbox support to platform attribute
816 * 1057981 C#5 async tests are not supported
817 * 1060631 Add .NET 4.5 build
818 * 1064014 Simple async tests should not return Task<T>
819 * 1071164 Support async methods in usage scenarios of Throws constraints
820 * 1071343 Runner.Load fails on CF if the test assembly contains a generic method
821 * 1071861 Error in Path Constraints
822 * 1072379 Report test execution time at a higher resolution
823 * 1074568 Assert/Assume should support an async method for the ActualValueDelegate
824 * 1082330 Better Exception if SetCulture attribute is applied multiple times
825 * 1111834 Expose Random Object as part of the test context
826 * 1111838 Include Random Seed in Test Report
827 * 1172979 Add Category Support to nunitlite Runner
828 * 1203361 Randomizer uniqueness tests sometimes fail
829 * 1221712 When non-existing test method is specified in -test, result is still "Tests run: 1, Passed: 1"
830 * 1223294 System.NullReferenceException thrown when ExpectedExceptionAttribute is used in a static class
831 * 1225542 Standardize commandline options for test harness
832
833 Bug Fixes in 2.9.6 But Not Listed Here in the Release
834
835 * 541699 Silverlight Support
836 * 1222148 /framework switch does not recognize net-4.5
837 * 1228979 Theories with all test cases inconclusive are not reported as failures
838
839
840 NUnit 2.9.5 - July 30, 2010
841
842 Bug Fixes
843
844 * 483836 Allow non-public test fixtures consistently
845 * 487878 Tests in generic class without proper TestFixture attribute should be invalid
846 * 498656 TestCase should show array values in GUI
847 * 513989 Is.Empty should work for directories
848 * 519912 Thread.CurrentPrincipal Set In TestFixtureSetUp Not Maintained Between Tests
849 * 532488 constraints from ConstraintExpression/ConstraintBuilder are not reusable
850 * 590717 categorie contains dash or trail spaces is not selectable
851 * 590970 static TestFixtureSetUp/TestFixtureTearDown methods in base classes are not run
852 * 595683 NUnit console runner fails to load assemblies
853 * 600627 Assertion message formatted poorly by PropertyConstraint
854 * 601108 Duplicate test using abstract test fixtures
855 * 601645 Parametered test should try to convert data type from source to parameter
856 * 605432 ToString not working properly for some properties
857 * 606548 Deprecate Directory Assert in 2.5 and remove it in 3.0
858 * 608875 NUnit Equality Comparer incorrectly defines equality for Dictionary objects
859
860 NUnit 2.9.4 - May 4, 2010
861
862 Bug Fixes
863
864 * 419411 Fixture With No Tests Shows as Non-Runnable
865 * 459219 Changes to thread princpal cause failures under .NET 4.0
866 * 459224 Culture test failure under .NET 4.0
867 * 462019 Line endings needs to be better controlled in source
868 * 462418 Assume.That() fails if I specify a message
869 * 483845 TestCase expected return value cannot be null
870 * 488002 Should not report tests in abstract class as invalid
871 * 490679 Category in TestCaseData clashes with Category on ParameterizedMethodSuite
872 * 501352 VS2010 projects have not been updated for new directory structure
873 * 504018 Automatic Values For Theory Test Parameters Not Provided For bool And enum
874 * 505899 'Description' parameter in both TestAttribute and TestCaseAttribute is not allowed
875 * 523335 TestFixtureTearDown in static class not executed
876 * 556971 Datapoint(s)Attribute should work on IEnumerable<T> as well as on Arrays
877 * 561436 SetCulture broken with 2.5.4
878 * 563532 DatapointsAttribute should be allowed on properties and methods
879
880 NUnit 2.9.3 - October 26, 2009
881
882 Main Features
883
884 * Created new API for controlling framework
885 * New builds for .Net 3.5 and 4.0, compact framework 3.5
886 * Support for old style tests has been removed
887 * New adhoc runner for testing the framework
888
889 Bug Fixes
890
891 * 432805 Some Framework Tests don't run on Linux
892 * 440109 Full Framework does not support "Contains"
893
894 NUnit 2.9.2 - September 19, 2009
895
896 Main Features
897
898 * NUnitLite code is now merged with NUnit
899 * Added NUnitLite runner to the framework code
900 * Added Compact framework builds
901
902 Bug Fixes
903
904 * 430100 Assert.Catch<T> should return T
905 * 432566 NUnitLite shows empty string as argument
906 * 432573 Mono test should be at runtime
907
908 NUnit 2.9.1 - August 27, 2009
909
910 General
911
912 * Created a separate project for the framework and framework tests
913 * Changed license to MIT / X11
914 * Created Windows installer for the framework
915
916 Bug Fixes
917
918 * 400502 NUnitEqualityComparer.StreamsE­qual fails for same stream
919 * 400508 TestCaseSource attirbute is not working when Type is given
920 * 400510 TestCaseData variable length ctor drops values
921 * 417557 Add SetUICultureAttribute from NUnit 2.5.2
922 * 417559 Add Ignore to TestFixture, TestCase and TestCaseData
923 * 417560 Merge Assert.Throws and Assert.Catch changes from NUnit 2.5.2
924 * 417564 TimeoutAttribute on Assembly
@@ -0,0 +1,20
1 Copyright (c) 2015 Charlie Poole
2
3 Permission is hereby granted, free of charge, to any person obtaining a copy
4 of this software and associated documentation files (the "Software"), to deal
5 in the Software without restriction, including without limitation the rights
6 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 copies of the Software, and to permit persons to whom the Software is
8 furnished to do so, subject to the following conditions:
9
10 The above copyright notice and this permission notice shall be included in
11 all copies or substantial portions of the Software.
12
13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 THE SOFTWARE.
20
@@ -0,0 +1,5
1 NUnit 3.0 is based on earlier versions of NUnit, with Portions
2
3 Copyright (c) 2002-2014 Charlie Poole or
4 Copyright (c) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or
5 Copyright (c) 2000-2002 Philip A. Craig
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
The requested commit or file is too big and content was truncated. Show full diff
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
The requested commit or file is too big and content was truncated. Show full diff
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
The requested commit or file is too big and content was truncated. Show full diff
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
The requested commit or file is too big and content was truncated. Show full diff
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
The requested commit or file is too big and content was truncated. Show full diff
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
The requested commit or file is too big and content was truncated. Show full diff
@@ -1,88 +1,88
1 <?xml version="1.0" encoding="utf-8"?>
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
3 <PropertyGroup>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6 <ProductVersion>8.0.30703</ProductVersion>
6 <ProductVersion>8.0.30703</ProductVersion>
7 <SchemaVersion>2.0</SchemaVersion>
7 <SchemaVersion>2.0</SchemaVersion>
8 <ProjectGuid>{06E706F8-6881-43EB-927E-FFC503AF6ABC}</ProjectGuid>
8 <ProjectGuid>{06E706F8-6881-43EB-927E-FFC503AF6ABC}</ProjectGuid>
9 <OutputType>Library</OutputType>
9 <OutputType>Library</OutputType>
10 <AppDesignerFolder>Properties</AppDesignerFolder>
10 <AppDesignerFolder>Properties</AppDesignerFolder>
11 <RootNamespace>Implab.Fx</RootNamespace>
11 <RootNamespace>Implab.Fx</RootNamespace>
12 <AssemblyName>Implab.Fx</AssemblyName>
12 <AssemblyName>Implab.Fx</AssemblyName>
13 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
14 <FileAlignment>512</FileAlignment>
14 <FileAlignment>512</FileAlignment>
15 <ReleaseVersion>0.2</ReleaseVersion>
15 <ReleaseVersion>0.2</ReleaseVersion>
16 <TargetFrameworkProfile />
16 <TargetFrameworkProfile />
17 </PropertyGroup>
17 </PropertyGroup>
18 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19 <DebugSymbols>true</DebugSymbols>
19 <DebugSymbols>true</DebugSymbols>
20 <DebugType>full</DebugType>
20 <DebugType>full</DebugType>
21 <Optimize>false</Optimize>
21 <Optimize>false</Optimize>
22 <OutputPath>bin\Debug\</OutputPath>
22 <OutputPath>bin\Debug\</OutputPath>
23 <DefineConstants>DEBUG;TRACE</DefineConstants>
23 <DefineConstants>DEBUG;TRACE</DefineConstants>
24 <ErrorReport>prompt</ErrorReport>
24 <ErrorReport>prompt</ErrorReport>
25 <WarningLevel>4</WarningLevel>
25 <WarningLevel>4</WarningLevel>
26 <Prefer32Bit>false</Prefer32Bit>
26 <Prefer32Bit>false</Prefer32Bit>
27 </PropertyGroup>
27 </PropertyGroup>
28 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
28 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29 <DebugType>pdbonly</DebugType>
29 <DebugType>pdbonly</DebugType>
30 <Optimize>true</Optimize>
30 <Optimize>true</Optimize>
31 <OutputPath>bin\Release\</OutputPath>
31 <OutputPath>bin\Release\</OutputPath>
32 <DefineConstants>TRACE</DefineConstants>
32 <DefineConstants>TRACE</DefineConstants>
33 <ErrorReport>prompt</ErrorReport>
33 <ErrorReport>prompt</ErrorReport>
34 <WarningLevel>4</WarningLevel>
34 <WarningLevel>4</WarningLevel>
35 <Prefer32Bit>false</Prefer32Bit>
35 <Prefer32Bit>false</Prefer32Bit>
36 </PropertyGroup>
36 </PropertyGroup>
37 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.5|AnyCPU' ">
37 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.5|AnyCPU' ">
38 <DebugSymbols>true</DebugSymbols>
38 <DebugSymbols>true</DebugSymbols>
39 <DebugType>full</DebugType>
39 <DebugType>full</DebugType>
40 <Optimize>false</Optimize>
40 <Optimize>false</Optimize>
41 <OutputPath>bin\Debug\</OutputPath>
41 <OutputPath>bin\Debug\</OutputPath>
42 <DefineConstants>DEBUG;TRACE</DefineConstants>
42 <DefineConstants>DEBUG;TRACE</DefineConstants>
43 <ErrorReport>prompt</ErrorReport>
43 <ErrorReport>prompt</ErrorReport>
44 <WarningLevel>4</WarningLevel>
44 <WarningLevel>4</WarningLevel>
45 <Prefer32Bit>false</Prefer32Bit>
45 <Prefer32Bit>false</Prefer32Bit>
46 </PropertyGroup>
46 </PropertyGroup>
47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' ">
47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' ">
48 <DebugType>pdbonly</DebugType>
48 <DebugType>pdbonly</DebugType>
49 <Optimize>true</Optimize>
49 <Optimize>true</Optimize>
50 <OutputPath>bin\Release\</OutputPath>
50 <OutputPath>bin\Release\</OutputPath>
51 <DefineConstants>TRACE</DefineConstants>
51 <DefineConstants>TRACE</DefineConstants>
52 <ErrorReport>prompt</ErrorReport>
52 <ErrorReport>prompt</ErrorReport>
53 <WarningLevel>4</WarningLevel>
53 <WarningLevel>4</WarningLevel>
54 <Prefer32Bit>false</Prefer32Bit>
54 <Prefer32Bit>false</Prefer32Bit>
55 </PropertyGroup>
55 </PropertyGroup>
56 <ItemGroup>
56 <ItemGroup>
57 <Reference Include="System" />
57 <Reference Include="System" />
58 <Reference Include="System.Core" />
58 <Reference Include="System.Core" />
59 <Reference Include="System.Drawing" />
59 <Reference Include="System.Drawing" />
60 <Reference Include="System.Windows.Forms" />
60 <Reference Include="System.Windows.Forms" />
61 <Reference Include="System.Xml.Linq" />
61 <Reference Include="System.Xml.Linq" />
62 <Reference Include="System.Data.DataSetExtensions" />
62 <Reference Include="System.Data.DataSetExtensions" />
63 <Reference Include="Microsoft.CSharp" />
63 <Reference Include="Microsoft.CSharp" />
64 <Reference Include="System.Data" />
64 <Reference Include="System.Data" />
65 <Reference Include="System.Xml" />
65 <Reference Include="System.Xml" />
66 </ItemGroup>
66 </ItemGroup>
67 <ItemGroup>
67 <ItemGroup>
68 <Compile Include="Animation.cs" />
68 <Compile Include="Animation.cs" />
69 <Compile Include="AnimationHelpers.cs" />
69 <Compile Include="AnimationHelpers.cs" />
70 <Compile Include="PromiseHelpers.cs" />
70 <Compile Include="PromiseHelpers.cs" />
71 <Compile Include="Properties\AssemblyInfo.cs" />
71 <Compile Include="Properties\AssemblyInfo.cs" />
72 <Compile Include="ControlBoundPromise.cs" />
72 <Compile Include="ControlBoundPromise.cs" />
73 </ItemGroup>
73 </ItemGroup>
74 <ItemGroup>
74 <ItemGroup>
75 <ProjectReference Include="..\Implab\Implab.csproj">
75 <ProjectReference Include="..\Implab\Implab.csproj">
76 <Project>{f550f1f8-8746-4ad0-9614-855f4c4b7f05}</Project>
76 <Project>{F550F1F8-8746-4AD0-9614-855F4C4B7F05}</Project>
77 <Name>Implab</Name>
77 <Name>Implab</Name>
78 </ProjectReference>
78 </ProjectReference>
79 </ItemGroup>
79 </ItemGroup>
80 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
80 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
81 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
81 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
82 Other similar extension points exist, see Microsoft.Common.targets.
82 Other similar extension points exist, see Microsoft.Common.targets.
83 <Target Name="BeforeBuild">
83 <Target Name="BeforeBuild">
84 </Target>
84 </Target>
85 <Target Name="AfterBuild">
85 <Target Name="AfterBuild">
86 </Target>
86 </Target>
87 -->
87 -->
88 </Project> No newline at end of file
88 </Project>
@@ -1,290 +1,301
1 
1 
2 Microsoft Visual Studio Solution File, Format Version 11.00
2 Microsoft Visual Studio Solution File, Format Version 11.00
3 # Visual Studio 2010
3 # Visual Studio 2010
4 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab", "Implab\Implab.csproj", "{F550F1F8-8746-4AD0-9614-855F4C4B7F05}"
4 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab", "Implab\Implab.csproj", "{F550F1F8-8746-4AD0-9614-855F4C4B7F05}"
5 EndProject
5 EndProject
6 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CE8D8D18-437A-445C-B662-4C2CE79A76F6}"
6 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CE8D8D18-437A-445C-B662-4C2CE79A76F6}"
7 ProjectSection(SolutionItems) = preProject
7 ProjectSection(SolutionItems) = preProject
8 Implab.vsmdi = Implab.vsmdi
8 Implab.vsmdi = Implab.vsmdi
9 Local.testsettings = Local.testsettings
9 Local.testsettings = Local.testsettings
10 TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings
10 TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings
11 EndProjectSection
11 EndProjectSection
12 EndProject
12 EndProject
13 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Fx", "Implab.Fx\Implab.Fx.csproj", "{06E706F8-6881-43EB-927E-FFC503AF6ABC}"
13 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Fx", "Implab.Fx\Implab.Fx.csproj", "{06E706F8-6881-43EB-927E-FFC503AF6ABC}"
14 EndProject
14 EndProject
15 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{BCA337C3-BFDC-4825-BBDB-E6D467E4E452}"
15 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{BCA337C3-BFDC-4825-BBDB-E6D467E4E452}"
16 EndProject
16 EndProject
17 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Test.mono", "Implab.Test\Implab.Test.mono.csproj", "{2BD05F84-E067-4B87-9477-FDC2676A21C6}"
17 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Test.mono", "Implab.Test\Implab.Test.mono.csproj", "{2BD05F84-E067-4B87-9477-FDC2676A21C6}"
18 EndProject
18 EndProject
19 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Format.Test", "Implab.Test\Implab.Format.Test\Implab.Format.Test.csproj", "{4D364996-7ECD-4193-8F90-F223FFEA49DA}"
20 EndProject
19 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoPlay", "MonoPlay\MonoPlay.csproj", "{15DD7123-D504-4627-8B4F-D00C7F04D033}"
21 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoPlay", "MonoPlay\MonoPlay.csproj", "{15DD7123-D504-4627-8B4F-D00C7F04D033}"
20 EndProject
22 EndProject
21 Global
23 Global
22 GlobalSection(SolutionConfigurationPlatforms) = preSolution
24 GlobalSection(SolutionConfigurationPlatforms) = preSolution
23 Debug|Any CPU = Debug|Any CPU
25 Debug|Any CPU = Debug|Any CPU
24 Release|Any CPU = Release|Any CPU
26 Release|Any CPU = Release|Any CPU
25 Debug 4.5|Any CPU = Debug 4.5|Any CPU
27 Debug 4.5|Any CPU = Debug 4.5|Any CPU
26 Release 4.5|Any CPU = Release 4.5|Any CPU
28 Release 4.5|Any CPU = Release 4.5|Any CPU
27 EndGlobalSection
29 EndGlobalSection
28 GlobalSection(ProjectConfigurationPlatforms) = postSolution
30 GlobalSection(ProjectConfigurationPlatforms) = postSolution
29 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU
31 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU
30 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU
32 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU
31 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
32 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug|Any CPU.Build.0 = Debug|Any CPU
34 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug|Any CPU.Build.0 = Debug|Any CPU
33 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU
35 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU
34 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU
36 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU
35 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release|Any CPU.ActiveCfg = Release|Any CPU
37 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release|Any CPU.ActiveCfg = Release|Any CPU
36 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release|Any CPU.Build.0 = Release|Any CPU
38 {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release|Any CPU.Build.0 = Release|Any CPU
37 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Debug 4.5|Any CPU.ActiveCfg = Debug|Any CPU
39 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Debug 4.5|Any CPU.ActiveCfg = Debug|Any CPU
38 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Debug 4.5|Any CPU.Build.0 = Debug|Any CPU
40 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Debug 4.5|Any CPU.Build.0 = Debug|Any CPU
39 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
40 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Debug|Any CPU.Build.0 = Debug|Any CPU
42 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Debug|Any CPU.Build.0 = Debug|Any CPU
41 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Release 4.5|Any CPU.ActiveCfg = Release|Any CPU
43 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Release 4.5|Any CPU.ActiveCfg = Release|Any CPU
42 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Release 4.5|Any CPU.Build.0 = Release|Any CPU
44 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Release 4.5|Any CPU.Build.0 = Release|Any CPU
43 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Release|Any CPU.ActiveCfg = Release|Any CPU
45 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Release|Any CPU.ActiveCfg = Release|Any CPU
44 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Release|Any CPU.Build.0 = Release|Any CPU
46 {15DD7123-D504-4627-8B4F-D00C7F04D033}.Release|Any CPU.Build.0 = Release|Any CPU
45 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU
47 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU
46 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU
48 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU
47 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
49 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
48 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
50 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
49 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU
51 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU
50 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU
52 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU
51 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
53 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
52 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release|Any CPU.Build.0 = Release|Any CPU
54 {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release|Any CPU.Build.0 = Release|Any CPU
55 {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Debug 4.5|Any CPU.ActiveCfg = Debug|Any CPU
56 {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Debug 4.5|Any CPU.Build.0 = Debug|Any CPU
57 {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
58 {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
59 {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Release 4.5|Any CPU.ActiveCfg = Release|Any CPU
60 {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Release 4.5|Any CPU.Build.0 = Release|Any CPU
61 {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
62 {4D364996-7ECD-4193-8F90-F223FFEA49DA}.Release|Any CPU.Build.0 = Release|Any CPU
53 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU
63 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU
54 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU
64 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU
55 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
65 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
56 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug|Any CPU.Build.0 = Debug|Any CPU
66 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug|Any CPU.Build.0 = Debug|Any CPU
57 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU
67 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU
58 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU
68 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU
59 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release|Any CPU.ActiveCfg = Release|Any CPU
69 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release|Any CPU.ActiveCfg = Release|Any CPU
60 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release|Any CPU.Build.0 = Release|Any CPU
70 {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release|Any CPU.Build.0 = Release|Any CPU
61 {2F31E405-E267-4195-A05D-574093C21209}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU
71 {2F31E405-E267-4195-A05D-574093C21209}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU
62 {2F31E405-E267-4195-A05D-574093C21209}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU
72 {2F31E405-E267-4195-A05D-574093C21209}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU
63 {2F31E405-E267-4195-A05D-574093C21209}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
73 {2F31E405-E267-4195-A05D-574093C21209}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
64 {2F31E405-E267-4195-A05D-574093C21209}.Debug|Any CPU.Build.0 = Debug|Any CPU
74 {2F31E405-E267-4195-A05D-574093C21209}.Debug|Any CPU.Build.0 = Debug|Any CPU
65 {2F31E405-E267-4195-A05D-574093C21209}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU
75 {2F31E405-E267-4195-A05D-574093C21209}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU
66 {2F31E405-E267-4195-A05D-574093C21209}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU
76 {2F31E405-E267-4195-A05D-574093C21209}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU
67 {2F31E405-E267-4195-A05D-574093C21209}.Release|Any CPU.ActiveCfg = Release|Any CPU
77 {2F31E405-E267-4195-A05D-574093C21209}.Release|Any CPU.ActiveCfg = Release|Any CPU
68 {2F31E405-E267-4195-A05D-574093C21209}.Release|Any CPU.Build.0 = Release|Any CPU
78 {2F31E405-E267-4195-A05D-574093C21209}.Release|Any CPU.Build.0 = Release|Any CPU
69 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU
79 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU
70 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU
80 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU
71 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
81 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
72 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
82 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
73 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU
83 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU
74 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU
84 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU
75 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
85 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
76 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release|Any CPU.Build.0 = Release|Any CPU
86 {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release|Any CPU.Build.0 = Release|Any CPU
77 EndGlobalSection
87 EndGlobalSection
78 GlobalSection(NestedProjects) = preSolution
88 GlobalSection(NestedProjects) = preSolution
79 {2BD05F84-E067-4B87-9477-FDC2676A21C6} = {BCA337C3-BFDC-4825-BBDB-E6D467E4E452}
89 {2BD05F84-E067-4B87-9477-FDC2676A21C6} = {BCA337C3-BFDC-4825-BBDB-E6D467E4E452}
90 {4D364996-7ECD-4193-8F90-F223FFEA49DA} = {BCA337C3-BFDC-4825-BBDB-E6D467E4E452}
80 EndGlobalSection
91 EndGlobalSection
81 GlobalSection(MonoDevelopProperties) = preSolution
92 GlobalSection(MonoDevelopProperties) = preSolution
82 Policies = $0
93 Policies = $0
83 $0.CSharpFormattingPolicy = $1
94 $0.CSharpFormattingPolicy = $1
84 $1.IndentSwitchBody = True
95 $1.IndentSwitchBody = True
85 $1.NamespaceBraceStyle = EndOfLine
96 $1.NamespaceBraceStyle = EndOfLine
86 $1.ClassBraceStyle = EndOfLine
97 $1.ClassBraceStyle = EndOfLine
87 $1.InterfaceBraceStyle = EndOfLine
98 $1.InterfaceBraceStyle = EndOfLine
88 $1.StructBraceStyle = EndOfLine
99 $1.StructBraceStyle = EndOfLine
89 $1.EnumBraceStyle = EndOfLine
100 $1.EnumBraceStyle = EndOfLine
90 $1.MethodBraceStyle = EndOfLine
101 $1.MethodBraceStyle = EndOfLine
91 $1.ConstructorBraceStyle = EndOfLine
102 $1.ConstructorBraceStyle = EndOfLine
92 $1.DestructorBraceStyle = EndOfLine
103 $1.DestructorBraceStyle = EndOfLine
93 $1.BeforeMethodDeclarationParentheses = False
104 $1.BeforeMethodDeclarationParentheses = False
94 $1.BeforeMethodCallParentheses = False
105 $1.BeforeMethodCallParentheses = False
95 $1.BeforeConstructorDeclarationParentheses = False
106 $1.BeforeConstructorDeclarationParentheses = False
96 $1.NewLineBeforeConstructorInitializerColon = NewLine
107 $1.NewLineBeforeConstructorInitializerColon = NewLine
97 $1.NewLineAfterConstructorInitializerColon = SameLine
108 $1.NewLineAfterConstructorInitializerColon = SameLine
98 $1.BeforeIndexerDeclarationBracket = False
109 $1.BeforeIndexerDeclarationBracket = False
99 $1.BeforeDelegateDeclarationParentheses = False
110 $1.BeforeDelegateDeclarationParentheses = False
100 $1.NewParentheses = False
111 $1.NewParentheses = False
101 $1.SpacesBeforeBrackets = False
112 $1.SpacesBeforeBrackets = False
102 $1.inheritsSet = Mono
113 $1.inheritsSet = Mono
103 $1.inheritsScope = text/x-csharp
114 $1.inheritsScope = text/x-csharp
104 $1.scope = text/x-csharp
115 $1.scope = text/x-csharp
105 $0.TextStylePolicy = $2
116 $0.TextStylePolicy = $2
106 $2.FileWidth = 120
117 $2.FileWidth = 120
107 $2.EolMarker = Unix
118 $2.EolMarker = Unix
108 $2.inheritsSet = VisualStudio
119 $2.inheritsSet = VisualStudio
109 $2.inheritsScope = text/plain
120 $2.inheritsScope = text/plain
110 $2.scope = text/x-csharp
121 $2.scope = text/x-csharp
111 $0.DotNetNamingPolicy = $3
122 $0.DotNetNamingPolicy = $3
112 $3.DirectoryNamespaceAssociation = PrefixedHierarchical
123 $3.DirectoryNamespaceAssociation = PrefixedHierarchical
113 $3.ResourceNamePolicy = MSBuild
124 $3.ResourceNamePolicy = MSBuild
114 $0.TextStylePolicy = $4
125 $0.TextStylePolicy = $4
115 $4.FileWidth = 120
126 $4.FileWidth = 120
116 $4.TabsToSpaces = False
127 $4.TabsToSpaces = False
117 $4.inheritsSet = VisualStudio
128 $4.inheritsSet = VisualStudio
118 $4.inheritsScope = text/plain
129 $4.inheritsScope = text/plain
119 $4.scope = application/xml
130 $4.scope = application/xml
120 $0.XmlFormattingPolicy = $5
131 $0.XmlFormattingPolicy = $5
121 $5.inheritsSet = Mono
132 $5.inheritsSet = Mono
122 $5.inheritsScope = application/xml
133 $5.inheritsScope = application/xml
123 $5.scope = application/xml
134 $5.scope = application/xml
124 $0.TextStylePolicy = $6
135 $0.TextStylePolicy = $6
125 $6.FileWidth = 120
136 $6.FileWidth = 120
126 $6.TabsToSpaces = False
137 $6.TabsToSpaces = False
127 $6.inheritsSet = VisualStudio
138 $6.inheritsSet = VisualStudio
128 $6.inheritsScope = text/plain
139 $6.inheritsScope = text/plain
129 $6.scope = text/plain
140 $6.scope = text/plain
130 $0.NameConventionPolicy = $7
141 $0.NameConventionPolicy = $7
131 $7.Rules = $8
142 $7.Rules = $8
132 $8.NamingRule = $9
143 $8.NamingRule = $9
133 $9.Name = Namespaces
144 $9.Name = Namespaces
134 $9.AffectedEntity = Namespace
145 $9.AffectedEntity = Namespace
135 $9.VisibilityMask = VisibilityMask
146 $9.VisibilityMask = VisibilityMask
136 $9.NamingStyle = PascalCase
147 $9.NamingStyle = PascalCase
137 $9.IncludeInstanceMembers = True
148 $9.IncludeInstanceMembers = True
138 $9.IncludeStaticEntities = True
149 $9.IncludeStaticEntities = True
139 $8.NamingRule = $10
150 $8.NamingRule = $10
140 $10.Name = Types
151 $10.Name = Types
141 $10.AffectedEntity = Class, Struct, Enum, Delegate
152 $10.AffectedEntity = Class, Struct, Enum, Delegate
142 $10.VisibilityMask = VisibilityMask
153 $10.VisibilityMask = VisibilityMask
143 $10.NamingStyle = PascalCase
154 $10.NamingStyle = PascalCase
144 $10.IncludeInstanceMembers = True
155 $10.IncludeInstanceMembers = True
145 $10.IncludeStaticEntities = True
156 $10.IncludeStaticEntities = True
146 $8.NamingRule = $11
157 $8.NamingRule = $11
147 $11.Name = Interfaces
158 $11.Name = Interfaces
148 $11.RequiredPrefixes = $12
159 $11.RequiredPrefixes = $12
149 $12.String = I
160 $12.String = I
150 $11.AffectedEntity = Interface
161 $11.AffectedEntity = Interface
151 $11.VisibilityMask = VisibilityMask
162 $11.VisibilityMask = VisibilityMask
152 $11.NamingStyle = PascalCase
163 $11.NamingStyle = PascalCase
153 $11.IncludeInstanceMembers = True
164 $11.IncludeInstanceMembers = True
154 $11.IncludeStaticEntities = True
165 $11.IncludeStaticEntities = True
155 $8.NamingRule = $13
166 $8.NamingRule = $13
156 $13.Name = Attributes
167 $13.Name = Attributes
157 $13.RequiredSuffixes = $14
168 $13.RequiredSuffixes = $14
158 $14.String = Attribute
169 $14.String = Attribute
159 $13.AffectedEntity = CustomAttributes
170 $13.AffectedEntity = CustomAttributes
160 $13.VisibilityMask = VisibilityMask
171 $13.VisibilityMask = VisibilityMask
161 $13.NamingStyle = PascalCase
172 $13.NamingStyle = PascalCase
162 $13.IncludeInstanceMembers = True
173 $13.IncludeInstanceMembers = True
163 $13.IncludeStaticEntities = True
174 $13.IncludeStaticEntities = True
164 $8.NamingRule = $15
175 $8.NamingRule = $15
165 $15.Name = Event Arguments
176 $15.Name = Event Arguments
166 $15.RequiredSuffixes = $16
177 $15.RequiredSuffixes = $16
167 $16.String = EventArgs
178 $16.String = EventArgs
168 $15.AffectedEntity = CustomEventArgs
179 $15.AffectedEntity = CustomEventArgs
169 $15.VisibilityMask = VisibilityMask
180 $15.VisibilityMask = VisibilityMask
170 $15.NamingStyle = PascalCase
181 $15.NamingStyle = PascalCase
171 $15.IncludeInstanceMembers = True
182 $15.IncludeInstanceMembers = True
172 $15.IncludeStaticEntities = True
183 $15.IncludeStaticEntities = True
173 $8.NamingRule = $17
184 $8.NamingRule = $17
174 $17.Name = Exceptions
185 $17.Name = Exceptions
175 $17.RequiredSuffixes = $18
186 $17.RequiredSuffixes = $18
176 $18.String = Exception
187 $18.String = Exception
177 $17.AffectedEntity = CustomExceptions
188 $17.AffectedEntity = CustomExceptions
178 $17.VisibilityMask = VisibilityMask
189 $17.VisibilityMask = VisibilityMask
179 $17.NamingStyle = PascalCase
190 $17.NamingStyle = PascalCase
180 $17.IncludeInstanceMembers = True
191 $17.IncludeInstanceMembers = True
181 $17.IncludeStaticEntities = True
192 $17.IncludeStaticEntities = True
182 $8.NamingRule = $19
193 $8.NamingRule = $19
183 $19.Name = Methods
194 $19.Name = Methods
184 $19.AffectedEntity = Methods
195 $19.AffectedEntity = Methods
185 $19.VisibilityMask = VisibilityMask
196 $19.VisibilityMask = VisibilityMask
186 $19.NamingStyle = PascalCase
197 $19.NamingStyle = PascalCase
187 $19.IncludeInstanceMembers = True
198 $19.IncludeInstanceMembers = True
188 $19.IncludeStaticEntities = True
199 $19.IncludeStaticEntities = True
189 $8.NamingRule = $20
200 $8.NamingRule = $20
190 $20.Name = Static Readonly Fields
201 $20.Name = Static Readonly Fields
191 $20.AffectedEntity = ReadonlyField
202 $20.AffectedEntity = ReadonlyField
192 $20.VisibilityMask = Internal, Protected, Public
203 $20.VisibilityMask = Internal, Protected, Public
193 $20.NamingStyle = PascalCase
204 $20.NamingStyle = PascalCase
194 $20.IncludeInstanceMembers = False
205 $20.IncludeInstanceMembers = False
195 $20.IncludeStaticEntities = True
206 $20.IncludeStaticEntities = True
196 $8.NamingRule = $21
207 $8.NamingRule = $21
197 $21.Name = Fields (Non Private)
208 $21.Name = Fields (Non Private)
198 $21.AffectedEntity = Field
209 $21.AffectedEntity = Field
199 $21.VisibilityMask = Internal, Public
210 $21.VisibilityMask = Internal, Public
200 $21.NamingStyle = CamelCase
211 $21.NamingStyle = CamelCase
201 $21.IncludeInstanceMembers = True
212 $21.IncludeInstanceMembers = True
202 $21.IncludeStaticEntities = True
213 $21.IncludeStaticEntities = True
203 $8.NamingRule = $22
214 $8.NamingRule = $22
204 $22.Name = ReadOnly Fields (Non Private)
215 $22.Name = ReadOnly Fields (Non Private)
205 $22.AffectedEntity = ReadonlyField
216 $22.AffectedEntity = ReadonlyField
206 $22.VisibilityMask = Internal, Public
217 $22.VisibilityMask = Internal, Public
207 $22.NamingStyle = CamelCase
218 $22.NamingStyle = CamelCase
208 $22.IncludeInstanceMembers = True
219 $22.IncludeInstanceMembers = True
209 $22.IncludeStaticEntities = False
220 $22.IncludeStaticEntities = False
210 $8.NamingRule = $23
221 $8.NamingRule = $23
211 $23.Name = Fields (Private)
222 $23.Name = Fields (Private)
212 $23.RequiredPrefixes = $24
223 $23.RequiredPrefixes = $24
213 $24.String = m_
224 $24.String = m_
214 $23.AffectedEntity = Field, ReadonlyField
225 $23.AffectedEntity = Field, ReadonlyField
215 $23.VisibilityMask = Private, Protected
226 $23.VisibilityMask = Private, Protected
216 $23.NamingStyle = CamelCase
227 $23.NamingStyle = CamelCase
217 $23.IncludeInstanceMembers = True
228 $23.IncludeInstanceMembers = True
218 $23.IncludeStaticEntities = False
229 $23.IncludeStaticEntities = False
219 $8.NamingRule = $25
230 $8.NamingRule = $25
220 $25.Name = Static Fields (Private)
231 $25.Name = Static Fields (Private)
221 $25.RequiredPrefixes = $26
232 $25.RequiredPrefixes = $26
222 $26.String = _
233 $26.String = _
223 $25.AffectedEntity = Field
234 $25.AffectedEntity = Field
224 $25.VisibilityMask = Private
235 $25.VisibilityMask = Private
225 $25.NamingStyle = CamelCase
236 $25.NamingStyle = CamelCase
226 $25.IncludeInstanceMembers = False
237 $25.IncludeInstanceMembers = False
227 $25.IncludeStaticEntities = True
238 $25.IncludeStaticEntities = True
228 $8.NamingRule = $27
239 $8.NamingRule = $27
229 $27.Name = ReadOnly Fields (Private)
240 $27.Name = ReadOnly Fields (Private)
230 $27.RequiredPrefixes = $28
241 $27.RequiredPrefixes = $28
231 $28.String = m_
242 $28.String = m_
232 $27.AffectedEntity = ReadonlyField
243 $27.AffectedEntity = ReadonlyField
233 $27.VisibilityMask = Private, Protected
244 $27.VisibilityMask = Private, Protected
234 $27.NamingStyle = CamelCase
245 $27.NamingStyle = CamelCase
235 $27.IncludeInstanceMembers = True
246 $27.IncludeInstanceMembers = True
236 $27.IncludeStaticEntities = False
247 $27.IncludeStaticEntities = False
237 $8.NamingRule = $29
248 $8.NamingRule = $29
238 $29.Name = Constant Fields
249 $29.Name = Constant Fields
239 $29.AffectedEntity = ConstantField
250 $29.AffectedEntity = ConstantField
240 $29.VisibilityMask = VisibilityMask
251 $29.VisibilityMask = VisibilityMask
241 $29.NamingStyle = AllUpper
252 $29.NamingStyle = AllUpper
242 $29.IncludeInstanceMembers = True
253 $29.IncludeInstanceMembers = True
243 $29.IncludeStaticEntities = True
254 $29.IncludeStaticEntities = True
244 $8.NamingRule = $30
255 $8.NamingRule = $30
245 $30.Name = Properties
256 $30.Name = Properties
246 $30.AffectedEntity = Property
257 $30.AffectedEntity = Property
247 $30.VisibilityMask = VisibilityMask
258 $30.VisibilityMask = VisibilityMask
248 $30.NamingStyle = PascalCase
259 $30.NamingStyle = PascalCase
249 $30.IncludeInstanceMembers = True
260 $30.IncludeInstanceMembers = True
250 $30.IncludeStaticEntities = True
261 $30.IncludeStaticEntities = True
251 $8.NamingRule = $31
262 $8.NamingRule = $31
252 $31.Name = Events
263 $31.Name = Events
253 $31.AffectedEntity = Event
264 $31.AffectedEntity = Event
254 $31.VisibilityMask = VisibilityMask
265 $31.VisibilityMask = VisibilityMask
255 $31.NamingStyle = PascalCase
266 $31.NamingStyle = PascalCase
256 $31.IncludeInstanceMembers = True
267 $31.IncludeInstanceMembers = True
257 $31.IncludeStaticEntities = True
268 $31.IncludeStaticEntities = True
258 $8.NamingRule = $32
269 $8.NamingRule = $32
259 $32.Name = Enum Members
270 $32.Name = Enum Members
260 $32.AffectedEntity = EnumMember
271 $32.AffectedEntity = EnumMember
261 $32.VisibilityMask = VisibilityMask
272 $32.VisibilityMask = VisibilityMask
262 $32.NamingStyle = PascalCase
273 $32.NamingStyle = PascalCase
263 $32.IncludeInstanceMembers = True
274 $32.IncludeInstanceMembers = True
264 $32.IncludeStaticEntities = True
275 $32.IncludeStaticEntities = True
265 $8.NamingRule = $33
276 $8.NamingRule = $33
266 $33.Name = Parameters
277 $33.Name = Parameters
267 $33.AffectedEntity = Parameter, LocalVariable
278 $33.AffectedEntity = Parameter, LocalVariable
268 $33.VisibilityMask = VisibilityMask
279 $33.VisibilityMask = VisibilityMask
269 $33.NamingStyle = CamelCase
280 $33.NamingStyle = CamelCase
270 $33.IncludeInstanceMembers = True
281 $33.IncludeInstanceMembers = True
271 $33.IncludeStaticEntities = True
282 $33.IncludeStaticEntities = True
272 $8.NamingRule = $34
283 $8.NamingRule = $34
273 $34.Name = Type Parameters
284 $34.Name = Type Parameters
274 $34.RequiredPrefixes = $35
285 $34.RequiredPrefixes = $35
275 $35.String = T
286 $35.String = T
276 $34.AffectedEntity = TypeParameter
287 $34.AffectedEntity = TypeParameter
277 $34.VisibilityMask = VisibilityMask
288 $34.VisibilityMask = VisibilityMask
278 $34.NamingStyle = PascalCase
289 $34.NamingStyle = PascalCase
279 $34.IncludeInstanceMembers = True
290 $34.IncludeInstanceMembers = True
280 $34.IncludeStaticEntities = True
291 $34.IncludeStaticEntities = True
281 version = 0.2
292 version = 0.2
282 StartupItem = MonoPlay\MonoPlay.csproj
293 StartupItem = MonoPlay\MonoPlay.csproj
283 EndGlobalSection
294 EndGlobalSection
284 GlobalSection(TestCaseManagementSettings) = postSolution
295 GlobalSection(TestCaseManagementSettings) = postSolution
285 CategoryFile = Implab.vsmdi
296 CategoryFile = Implab.vsmdi
286 EndGlobalSection
297 EndGlobalSection
287 GlobalSection(SolutionProperties) = preSolution
298 GlobalSection(SolutionProperties) = preSolution
288 HideSolutionNode = FALSE
299 HideSolutionNode = FALSE
289 EndGlobalSection
300 EndGlobalSection
290 EndGlobal
301 EndGlobal
@@ -1,153 +1,58
1 using System;
1 using System;
2 using Implab.Parsing;
2 using Implab.Parsing;
3
3
4 namespace Implab.Components {
4 namespace Implab.Components {
5 public class RunnableComponent : Disposable, IRunnable, IInitializable {
5 public class RunnableComponent : Disposable, IRunnable, IInitializable {
6
6
7
7
8 class Automaton {
9 enum Operations {
10 Initialize,
11 Start,
12 Stop,
13 Fail,
14 Success,
15 Dispose
16 }
17
18 static readonly EDFADefinition<ExecutionState> _def = new EDFADefinition<ExecutionState>(EnumAlphabet<ExecutionState>.FullAlphabet);
19 static readonly DFAStateDescriptior[] _states;
20
21 static Automaton() {
22 var created = _def.AddState(); // initial state
23 var initializing = _def.AddState();
24 var ready = _def.AddState();
25 var starting = _def.AddState();
26 var running = _def.AddState();
27 var stopping = _def.AddState();
28 var error = _def.AddState();
29 var disposing = _def.AddState();
30 var disposed = _def.AddState(new int[] { 0 });
31
32 _def.DefineTransition(created,initializing,(int)Operations.Initialize);
33
34 _def.DefineTransition(initializing,ready,(int)Operations.Success);
35 _def.DefineTransition(initializing,error,(int)Operations.Fail);
36
37 _def.DefineTransition(ready, starting, (int)Operations.Start);
38 _def.DefineTransition(ready, disposing, (int)Operations.Dispose);
39
8
40
9
41 _def.DefineTransition(starting, running, (int)Operations.Success);
10
42 _def.DefineTransition(starting, error, (int)Operations.Fail);
43
44 _def.DefineTransition(running, stopping, (int)Operations.Stop);
45 _def.DefineTransition(running, error, (int)Operations.Fail);
46
47 _def.DefineTransition(stopping, ready, (int)Operations.Success);
48 _def.DefineTransition(stopping, error, (int)Operations.Fail);
49
50 _def.DefineTransition(disposing, disposed, (int)Operations.Success);
51
52 _states = _def.States;
53 }
54
55 int m_state;
56
57 public Automaton() {
58 m_state = DFADefinitionBase.INITIAL_STATE;
59 }
60
61 void Move(Operations op) {
62
63 }
64
65 public ExecutionState Current {
66 get {
67 return (ExecutionState)m_context.info;
68 }
69 }
70 }
71
72 readonly Automaton m_automaton = new Automaton();
73 IPromise m_pending;
11 IPromise m_pending;
74 Exception m_lastError;
12 Exception m_lastError;
75
13
76 protected RunnableComponent(bool initialized) {
14 protected RunnableComponent(bool initialized) {
77 if (initialized)
15
78 m_automaton.MoveTo(ExecutionState.Ready);
79 else
80 m_automaton.MoveTo(ExecutionState.Uninitialized);
81 }
16 }
82
17
83 #region IInitializable implementation
18 #region IInitializable implementation
84
19
85 public void Init() {
20 public void Init() {
86
21
87 }
22 }
88
23
89 #endregion
24 #endregion
90
25
91 #region IRunnable implementation
26 #region IRunnable implementation
92
27
93 public IPromise Start() {
28 public IPromise Start() {
94 return Safe.InvokePromise(() => {
29 throw new NotImplementedException();
95 Promise promise;
96 lock (m_automaton) {
97 if (m_automaton.Current == ExecutionState.Starting)
98 return m_pending;
99 m_automaton.MoveTo(ExecutionState.Starting);
100 m_pending = promise = new Promise();
101 }
102
103 var start = Safe.InvokePromise(OnStart);
104 promise.On(null, null, start.Cancel);
105 start.On(promise.Resolve, promise.Reject, promise.CancelOperation);
106
107 return promise.Then(() => {
108 lock(m_automaton) {
109 m_automaton.MoveTo(ExecutionState.Running);
110 m_pending = null;
111 }
112
113 Run();
114 }, err => {
115 if (BeginTransition(RUNNING_REQUIRE)) {
116 m_lastError = err;
117 CompleteTransition(FAILED_STATE);
118 throw new PromiseTransientException(err);
119 }
120 throw new OperationCanceledException();
121 }, reason => {
122 throw new OperationCanceledException("The operation was cancelled", reason);
123 });
124 });
125 }
30 }
126
31
127 protected virtual IPromise OnStart() {
32 protected virtual IPromise OnStart() {
128 return Promise.SUCCESS;
33 return Promise.SUCCESS;
129 }
34 }
130
35
131 protected virtual void Run() {
36 protected virtual void Run() {
132 }
37 }
133
38
134 public IPromise Stop() {
39 public IPromise Stop() {
135 throw new NotImplementedException();
40 throw new NotImplementedException();
136 }
41 }
137
42
138 public ExecutionState State {
43 public ExecutionState State {
139 get {
44 get {
140 throw new NotImplementedException();
45 throw new NotImplementedException();
141 }
46 }
142 }
47 }
143
48
144 public Exception LastError {
49 public Exception LastError {
145 get {
50 get {
146 throw new NotImplementedException();
51 throw new NotImplementedException();
147 }
52 }
148 }
53 }
149
54
150 #endregion
55 #endregion
151 }
56 }
152 }
57 }
153
58
@@ -1,262 +1,262
1 <?xml version="1.0" encoding="utf-8"?>
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
3 <PropertyGroup>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6 <ProjectGuid>{F550F1F8-8746-4AD0-9614-855F4C4B7F05}</ProjectGuid>
6 <ProjectGuid>{F550F1F8-8746-4AD0-9614-855F4C4B7F05}</ProjectGuid>
7 <OutputType>Library</OutputType>
7 <OutputType>Library</OutputType>
8 <RootNamespace>Implab</RootNamespace>
8 <RootNamespace>Implab</RootNamespace>
9 <AssemblyName>Implab</AssemblyName>
9 <AssemblyName>Implab</AssemblyName>
10 <ProductVersion>8.0.30703</ProductVersion>
10 <ProductVersion>8.0.30703</ProductVersion>
11 <SchemaVersion>2.0</SchemaVersion>
11 <SchemaVersion>2.0</SchemaVersion>
12 <ReleaseVersion>0.2</ReleaseVersion>
12 <ReleaseVersion>0.2</ReleaseVersion>
13 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
14 </PropertyGroup>
14 </PropertyGroup>
15 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
15 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16 <DebugSymbols>true</DebugSymbols>
16 <DebugSymbols>true</DebugSymbols>
17 <DebugType>full</DebugType>
17 <DebugType>full</DebugType>
18 <Optimize>false</Optimize>
18 <Optimize>false</Optimize>
19 <OutputPath>bin\Debug</OutputPath>
19 <OutputPath>bin\Debug</OutputPath>
20 <DefineConstants>TRACE;DEBUG;</DefineConstants>
20 <DefineConstants>TRACE;DEBUG;</DefineConstants>
21 <ErrorReport>prompt</ErrorReport>
21 <ErrorReport>prompt</ErrorReport>
22 <WarningLevel>4</WarningLevel>
22 <WarningLevel>4</WarningLevel>
23 <ConsolePause>false</ConsolePause>
23 <ConsolePause>false</ConsolePause>
24 <RunCodeAnalysis>true</RunCodeAnalysis>
24 <RunCodeAnalysis>true</RunCodeAnalysis>
25 </PropertyGroup>
25 </PropertyGroup>
26 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27 <DebugType>full</DebugType>
27 <DebugType>full</DebugType>
28 <Optimize>true</Optimize>
28 <Optimize>true</Optimize>
29 <OutputPath>bin\Release</OutputPath>
29 <OutputPath>bin\Release</OutputPath>
30 <ErrorReport>prompt</ErrorReport>
30 <ErrorReport>prompt</ErrorReport>
31 <WarningLevel>4</WarningLevel>
31 <WarningLevel>4</WarningLevel>
32 <ConsolePause>false</ConsolePause>
32 <ConsolePause>false</ConsolePause>
33 </PropertyGroup>
33 </PropertyGroup>
34 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.5|AnyCPU' ">
34 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.5|AnyCPU' ">
35 <DebugSymbols>true</DebugSymbols>
35 <DebugSymbols>true</DebugSymbols>
36 <DebugType>full</DebugType>
36 <DebugType>full</DebugType>
37 <Optimize>false</Optimize>
37 <Optimize>false</Optimize>
38 <OutputPath>bin\Debug</OutputPath>
38 <OutputPath>bin\Debug</OutputPath>
39 <DefineConstants>TRACE;DEBUG;NET_4_5</DefineConstants>
39 <DefineConstants>TRACE;DEBUG;NET_4_5</DefineConstants>
40 <ErrorReport>prompt</ErrorReport>
40 <ErrorReport>prompt</ErrorReport>
41 <WarningLevel>4</WarningLevel>
41 <WarningLevel>4</WarningLevel>
42 <RunCodeAnalysis>true</RunCodeAnalysis>
42 <RunCodeAnalysis>true</RunCodeAnalysis>
43 <ConsolePause>false</ConsolePause>
43 <ConsolePause>false</ConsolePause>
44 </PropertyGroup>
44 </PropertyGroup>
45 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' ">
45 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' ">
46 <Optimize>true</Optimize>
46 <Optimize>true</Optimize>
47 <OutputPath>bin\Release</OutputPath>
47 <OutputPath>bin\Release</OutputPath>
48 <ErrorReport>prompt</ErrorReport>
48 <ErrorReport>prompt</ErrorReport>
49 <WarningLevel>4</WarningLevel>
49 <WarningLevel>4</WarningLevel>
50 <ConsolePause>false</ConsolePause>
50 <ConsolePause>false</ConsolePause>
51 <DefineConstants>NET_4_5</DefineConstants>
51 <DefineConstants>NET_4_5</DefineConstants>
52 </PropertyGroup>
52 </PropertyGroup>
53 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugMono|AnyCPU' ">
53 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugMono|AnyCPU' ">
54 <DebugSymbols>true</DebugSymbols>
54 <DebugSymbols>true</DebugSymbols>
55 <DebugType>full</DebugType>
55 <DebugType>full</DebugType>
56 <Optimize>false</Optimize>
56 <Optimize>false</Optimize>
57 <OutputPath>bin\Debug</OutputPath>
57 <OutputPath>bin\Debug</OutputPath>
58 <DefineConstants>TRACE;DEBUG;NET_4_5;MONO</DefineConstants>
58 <DefineConstants>TRACE;DEBUG;NET_4_5;MONO</DefineConstants>
59 <ErrorReport>prompt</ErrorReport>
59 <ErrorReport>prompt</ErrorReport>
60 <WarningLevel>4</WarningLevel>
60 <WarningLevel>4</WarningLevel>
61 <RunCodeAnalysis>true</RunCodeAnalysis>
61 <RunCodeAnalysis>true</RunCodeAnalysis>
62 <ConsolePause>false</ConsolePause>
62 <ConsolePause>false</ConsolePause>
63 </PropertyGroup>
63 </PropertyGroup>
64 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseMono|AnyCPU' ">
64 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseMono|AnyCPU' ">
65 <Optimize>true</Optimize>
65 <Optimize>true</Optimize>
66 <OutputPath>bin\Release</OutputPath>
66 <OutputPath>bin\Release</OutputPath>
67 <DefineConstants>NET_4_5;MONO;</DefineConstants>
67 <DefineConstants>NET_4_5;MONO;</DefineConstants>
68 <ErrorReport>prompt</ErrorReport>
68 <ErrorReport>prompt</ErrorReport>
69 <WarningLevel>4</WarningLevel>
69 <WarningLevel>4</WarningLevel>
70 <ConsolePause>false</ConsolePause>
70 <ConsolePause>false</ConsolePause>
71 </PropertyGroup>
71 </PropertyGroup>
72 <ItemGroup>
72 <ItemGroup>
73 <Reference Include="System" />
73 <Reference Include="System" />
74 <Reference Include="System.Xml" />
74 <Reference Include="System.Xml" />
75 <Reference Include="mscorlib" />
75 <Reference Include="mscorlib" />
76 </ItemGroup>
76 </ItemGroup>
77 <ItemGroup>
77 <ItemGroup>
78 <Compile Include="CustomEqualityComparer.cs" />
78 <Compile Include="CustomEqualityComparer.cs" />
79 <Compile Include="Diagnostics\ConsoleTraceListener.cs" />
79 <Compile Include="Diagnostics\ConsoleTraceListener.cs" />
80 <Compile Include="Diagnostics\EventText.cs" />
80 <Compile Include="Diagnostics\EventText.cs" />
81 <Compile Include="Diagnostics\LogChannel.cs" />
81 <Compile Include="Diagnostics\LogChannel.cs" />
82 <Compile Include="Diagnostics\LogicalOperation.cs" />
82 <Compile Include="Diagnostics\LogicalOperation.cs" />
83 <Compile Include="Diagnostics\TextFileListener.cs" />
83 <Compile Include="Diagnostics\TextFileListener.cs" />
84 <Compile Include="Diagnostics\TraceLog.cs" />
84 <Compile Include="Diagnostics\TraceLog.cs" />
85 <Compile Include="Diagnostics\TraceEvent.cs" />
85 <Compile Include="Diagnostics\TraceEvent.cs" />
86 <Compile Include="Diagnostics\TraceEventType.cs" />
86 <Compile Include="Diagnostics\TraceEventType.cs" />
87 <Compile Include="ICancellable.cs" />
87 <Compile Include="ICancellable.cs" />
88 <Compile Include="IProgressHandler.cs" />
88 <Compile Include="IProgressHandler.cs" />
89 <Compile Include="IProgressNotifier.cs" />
89 <Compile Include="IProgressNotifier.cs" />
90 <Compile Include="IPromiseT.cs" />
90 <Compile Include="IPromiseT.cs" />
91 <Compile Include="IPromise.cs" />
91 <Compile Include="IPromise.cs" />
92 <Compile Include="IServiceLocator.cs" />
92 <Compile Include="IServiceLocator.cs" />
93 <Compile Include="ITaskController.cs" />
93 <Compile Include="ITaskController.cs" />
94 <Compile Include="JSON\JSONElementContext.cs" />
94 <Compile Include="JSON\JSONElementContext.cs" />
95 <Compile Include="JSON\JSONElementType.cs" />
95 <Compile Include="JSON\JSONElementType.cs" />
96 <Compile Include="JSON\JSONGrammar.cs" />
96 <Compile Include="JSON\JSONGrammar.cs" />
97 <Compile Include="JSON\JSONParser.cs" />
97 <Compile Include="JSON\JSONParser.cs" />
98 <Compile Include="JSON\JSONScanner.cs" />
98 <Compile Include="JSON\JSONScanner.cs" />
99 <Compile Include="JSON\JsonTokenType.cs" />
99 <Compile Include="JSON\JsonTokenType.cs" />
100 <Compile Include="JSON\JSONWriter.cs" />
100 <Compile Include="JSON\JSONWriter.cs" />
101 <Compile Include="JSON\JSONXmlReader.cs" />
101 <Compile Include="JSON\JSONXmlReader.cs" />
102 <Compile Include="JSON\JSONXmlReaderOptions.cs" />
102 <Compile Include="JSON\JSONXmlReaderOptions.cs" />
103 <Compile Include="JSON\StringTranslator.cs" />
103 <Compile Include="JSON\StringTranslator.cs" />
104 <Compile Include="Parallels\DispatchPool.cs" />
104 <Compile Include="Parallels\DispatchPool.cs" />
105 <Compile Include="Parallels\ArrayTraits.cs" />
105 <Compile Include="Parallels\ArrayTraits.cs" />
106 <Compile Include="Parallels\MTQueue.cs" />
106 <Compile Include="Parallels\MTQueue.cs" />
107 <Compile Include="Parallels\WorkerPool.cs" />
107 <Compile Include="Parallels\WorkerPool.cs" />
108 <Compile Include="Parsing\Alphabet.cs" />
109 <Compile Include="Parsing\AlphabetBase.cs" />
110 <Compile Include="Parsing\AltToken.cs" />
108 <Compile Include="Parsing\AltToken.cs" />
111 <Compile Include="Parsing\BinaryToken.cs" />
109 <Compile Include="Parsing\BinaryToken.cs" />
112 <Compile Include="Parsing\CatToken.cs" />
110 <Compile Include="Parsing\CatToken.cs" />
113 <Compile Include="Parsing\CDFADefinition.cs" />
111 <Compile Include="Parsing\CDFADefinition.cs" />
114 <Compile Include="Parsing\DFABuilder.cs" />
112 <Compile Include="Parsing\DFABuilder.cs" />
115 <Compile Include="Parsing\DFADefinitionBase.cs" />
116 <Compile Include="Parsing\DFAStateDescriptor.cs" />
113 <Compile Include="Parsing\DFAStateDescriptor.cs" />
117 <Compile Include="Parsing\DFAutomaton.cs" />
114 <Compile Include="Parsing\DFAutomaton.cs" />
118 <Compile Include="Parsing\EDFADefinition.cs" />
115 <Compile Include="Parsing\EDFADefinition.cs" />
119 <Compile Include="Parsing\EmptyToken.cs" />
116 <Compile Include="Parsing\EmptyToken.cs" />
120 <Compile Include="Parsing\EndToken.cs" />
117 <Compile Include="Parsing\EndToken.cs" />
121 <Compile Include="Parsing\EnumAlphabet.cs" />
118 <Compile Include="Parsing\EnumAlphabet.cs" />
122 <Compile Include="Parsing\Grammar.cs" />
119 <Compile Include="Parsing\Grammar.cs" />
123 <Compile Include="Parsing\IAlphabet.cs" />
120 <Compile Include="Parsing\IAlphabet.cs" />
124 <Compile Include="Parsing\IDFADefinition.cs" />
121 <Compile Include="Parsing\IDFADefinition.cs" />
125 <Compile Include="Parsing\IVisitor.cs" />
122 <Compile Include="Parsing\IVisitor.cs" />
126 <Compile Include="Parsing\ParserException.cs" />
123 <Compile Include="Parsing\ParserException.cs" />
127 <Compile Include="Parsing\Scanner.cs" />
124 <Compile Include="Parsing\Scanner.cs" />
128 <Compile Include="Parsing\StarToken.cs" />
125 <Compile Include="Parsing\StarToken.cs" />
129 <Compile Include="Parsing\SymbolToken.cs" />
126 <Compile Include="Parsing\SymbolToken.cs" />
130 <Compile Include="Parsing\Token.cs" />
127 <Compile Include="Parsing\Token.cs" />
131 <Compile Include="ProgressInitEventArgs.cs" />
128 <Compile Include="ProgressInitEventArgs.cs" />
132 <Compile Include="Properties\AssemblyInfo.cs" />
129 <Compile Include="Properties\AssemblyInfo.cs" />
133 <Compile Include="Parallels\AsyncPool.cs" />
130 <Compile Include="Parallels\AsyncPool.cs" />
134 <Compile Include="Safe.cs" />
131 <Compile Include="Safe.cs" />
135 <Compile Include="ValueEventArgs.cs" />
132 <Compile Include="ValueEventArgs.cs" />
136 <Compile Include="PromiseExtensions.cs" />
133 <Compile Include="PromiseExtensions.cs" />
137 <Compile Include="SyncContextPromise.cs" />
134 <Compile Include="SyncContextPromise.cs" />
138 <Compile Include="Diagnostics\OperationContext.cs" />
135 <Compile Include="Diagnostics\OperationContext.cs" />
139 <Compile Include="Diagnostics\TraceContext.cs" />
136 <Compile Include="Diagnostics\TraceContext.cs" />
140 <Compile Include="Diagnostics\LogEventArgs.cs" />
137 <Compile Include="Diagnostics\LogEventArgs.cs" />
141 <Compile Include="Diagnostics\LogEventArgsT.cs" />
138 <Compile Include="Diagnostics\LogEventArgsT.cs" />
142 <Compile Include="Diagnostics\Extensions.cs" />
139 <Compile Include="Diagnostics\Extensions.cs" />
143 <Compile Include="PromiseEventType.cs" />
140 <Compile Include="PromiseEventType.cs" />
144 <Compile Include="Parallels\AsyncQueue.cs" />
141 <Compile Include="Parallels\AsyncQueue.cs" />
145 <Compile Include="PromiseT.cs" />
142 <Compile Include="PromiseT.cs" />
146 <Compile Include="IDeferred.cs" />
143 <Compile Include="IDeferred.cs" />
147 <Compile Include="IDeferredT.cs" />
144 <Compile Include="IDeferredT.cs" />
148 <Compile Include="Promise.cs" />
145 <Compile Include="Promise.cs" />
149 <Compile Include="PromiseTransientException.cs" />
146 <Compile Include="PromiseTransientException.cs" />
150 <Compile Include="Parallels\Signal.cs" />
147 <Compile Include="Parallels\Signal.cs" />
151 <Compile Include="Parallels\SharedLock.cs" />
148 <Compile Include="Parallels\SharedLock.cs" />
152 <Compile Include="Diagnostics\ILogWriter.cs" />
149 <Compile Include="Diagnostics\ILogWriter.cs" />
153 <Compile Include="Diagnostics\ListenerBase.cs" />
150 <Compile Include="Diagnostics\ListenerBase.cs" />
154 <Compile Include="Parallels\BlockingQueue.cs" />
151 <Compile Include="Parallels\BlockingQueue.cs" />
155 <Compile Include="AbstractEvent.cs" />
152 <Compile Include="AbstractEvent.cs" />
156 <Compile Include="AbstractPromise.cs" />
153 <Compile Include="AbstractPromise.cs" />
157 <Compile Include="AbstractPromiseT.cs" />
154 <Compile Include="AbstractPromiseT.cs" />
158 <Compile Include="FuncTask.cs" />
155 <Compile Include="FuncTask.cs" />
159 <Compile Include="FuncTaskBase.cs" />
156 <Compile Include="FuncTaskBase.cs" />
160 <Compile Include="FuncTaskT.cs" />
157 <Compile Include="FuncTaskT.cs" />
161 <Compile Include="ActionChainTaskBase.cs" />
158 <Compile Include="ActionChainTaskBase.cs" />
162 <Compile Include="ActionChainTask.cs" />
159 <Compile Include="ActionChainTask.cs" />
163 <Compile Include="ActionChainTaskT.cs" />
160 <Compile Include="ActionChainTaskT.cs" />
164 <Compile Include="FuncChainTaskBase.cs" />
161 <Compile Include="FuncChainTaskBase.cs" />
165 <Compile Include="FuncChainTask.cs" />
162 <Compile Include="FuncChainTask.cs" />
166 <Compile Include="FuncChainTaskT.cs" />
163 <Compile Include="FuncChainTaskT.cs" />
167 <Compile Include="ActionTaskBase.cs" />
164 <Compile Include="ActionTaskBase.cs" />
168 <Compile Include="ActionTask.cs" />
165 <Compile Include="ActionTask.cs" />
169 <Compile Include="ActionTaskT.cs" />
166 <Compile Include="ActionTaskT.cs" />
170 <Compile Include="ICancellationToken.cs" />
167 <Compile Include="ICancellationToken.cs" />
171 <Compile Include="SuccessPromise.cs" />
168 <Compile Include="SuccessPromise.cs" />
172 <Compile Include="SuccessPromiseT.cs" />
169 <Compile Include="SuccessPromiseT.cs" />
173 <Compile Include="PromiseAwaiterT.cs" />
170 <Compile Include="PromiseAwaiterT.cs" />
174 <Compile Include="PromiseAwaiter.cs" />
171 <Compile Include="PromiseAwaiter.cs" />
175 <Compile Include="Components\ComponentContainer.cs" />
172 <Compile Include="Components\ComponentContainer.cs" />
176 <Compile Include="Components\Disposable.cs" />
173 <Compile Include="Components\Disposable.cs" />
177 <Compile Include="Components\DisposablePool.cs" />
174 <Compile Include="Components\DisposablePool.cs" />
178 <Compile Include="Components\ObjectPool.cs" />
175 <Compile Include="Components\ObjectPool.cs" />
179 <Compile Include="Components\ServiceLocator.cs" />
176 <Compile Include="Components\ServiceLocator.cs" />
180 <Compile Include="Components\IInitializable.cs" />
177 <Compile Include="Components\IInitializable.cs" />
181 <Compile Include="TaskController.cs" />
178 <Compile Include="TaskController.cs" />
182 <Compile Include="Components\App.cs" />
179 <Compile Include="Components\App.cs" />
183 <Compile Include="Components\IRunnable.cs" />
180 <Compile Include="Components\IRunnable.cs" />
184 <Compile Include="Components\ExecutionState.cs" />
181 <Compile Include="Components\ExecutionState.cs" />
185 <Compile Include="Components\RunnableComponent.cs" />
182 <Compile Include="Components\RunnableComponent.cs" />
186 <Compile Include="Components\IFactory.cs" />
183 <Compile Include="Components\IFactory.cs" />
184 <Compile Include="Parsing\DFADefinition.cs" />
185 <Compile Include="Parsing\IndexedAlphabetBase.cs" />
186 <Compile Include="Parsing\CharAlphabet.cs" />
187 </ItemGroup>
187 </ItemGroup>
188 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
188 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
189 <ItemGroup />
189 <ItemGroup />
190 <ProjectExtensions>
190 <ProjectExtensions>
191 <MonoDevelop>
191 <MonoDevelop>
192 <Properties>
192 <Properties>
193 <Policies>
193 <Policies>
194 <CSharpFormattingPolicy IndentSwitchBody="True" NamespaceBraceStyle="EndOfLine" ClassBraceStyle="EndOfLine" InterfaceBraceStyle="EndOfLine" StructBraceStyle="EndOfLine" EnumBraceStyle="EndOfLine" MethodBraceStyle="EndOfLine" ConstructorBraceStyle="EndOfLine" DestructorBraceStyle="EndOfLine" BeforeMethodDeclarationParentheses="False" BeforeMethodCallParentheses="False" BeforeConstructorDeclarationParentheses="False" NewLineBeforeConstructorInitializerColon="NewLine" NewLineAfterConstructorInitializerColon="SameLine" BeforeIndexerDeclarationBracket="False" BeforeDelegateDeclarationParentheses="False" NewParentheses="False" SpacesBeforeBrackets="False" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />
194 <CSharpFormattingPolicy IndentSwitchBody="True" NamespaceBraceStyle="EndOfLine" ClassBraceStyle="EndOfLine" InterfaceBraceStyle="EndOfLine" StructBraceStyle="EndOfLine" EnumBraceStyle="EndOfLine" MethodBraceStyle="EndOfLine" ConstructorBraceStyle="EndOfLine" DestructorBraceStyle="EndOfLine" BeforeMethodDeclarationParentheses="False" BeforeMethodCallParentheses="False" BeforeConstructorDeclarationParentheses="False" NewLineBeforeConstructorInitializerColon="NewLine" NewLineAfterConstructorInitializerColon="SameLine" BeforeIndexerDeclarationBracket="False" BeforeDelegateDeclarationParentheses="False" NewParentheses="False" SpacesBeforeBrackets="False" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />
195 <TextStylePolicy FileWidth="120" EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />
195 <TextStylePolicy FileWidth="120" EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />
196 <DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild" />
196 <DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild" />
197 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="application/xml" />
197 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="application/xml" />
198 <XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" />
198 <XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" />
199 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
199 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
200 <NameConventionPolicy>
200 <NameConventionPolicy>
201 <Rules>
201 <Rules>
202 <NamingRule Name="Namespaces" AffectedEntity="Namespace" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
202 <NamingRule Name="Namespaces" AffectedEntity="Namespace" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
203 <NamingRule Name="Types" AffectedEntity="Class, Struct, Enum, Delegate" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
203 <NamingRule Name="Types" AffectedEntity="Class, Struct, Enum, Delegate" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
204 <NamingRule Name="Interfaces" AffectedEntity="Interface" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
204 <NamingRule Name="Interfaces" AffectedEntity="Interface" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
205 <RequiredPrefixes>
205 <RequiredPrefixes>
206 <String>I</String>
206 <String>I</String>
207 </RequiredPrefixes>
207 </RequiredPrefixes>
208 </NamingRule>
208 </NamingRule>
209 <NamingRule Name="Attributes" AffectedEntity="CustomAttributes" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
209 <NamingRule Name="Attributes" AffectedEntity="CustomAttributes" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
210 <RequiredSuffixes>
210 <RequiredSuffixes>
211 <String>Attribute</String>
211 <String>Attribute</String>
212 </RequiredSuffixes>
212 </RequiredSuffixes>
213 </NamingRule>
213 </NamingRule>
214 <NamingRule Name="Event Arguments" AffectedEntity="CustomEventArgs" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
214 <NamingRule Name="Event Arguments" AffectedEntity="CustomEventArgs" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
215 <RequiredSuffixes>
215 <RequiredSuffixes>
216 <String>EventArgs</String>
216 <String>EventArgs</String>
217 </RequiredSuffixes>
217 </RequiredSuffixes>
218 </NamingRule>
218 </NamingRule>
219 <NamingRule Name="Exceptions" AffectedEntity="CustomExceptions" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
219 <NamingRule Name="Exceptions" AffectedEntity="CustomExceptions" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
220 <RequiredSuffixes>
220 <RequiredSuffixes>
221 <String>Exception</String>
221 <String>Exception</String>
222 </RequiredSuffixes>
222 </RequiredSuffixes>
223 </NamingRule>
223 </NamingRule>
224 <NamingRule Name="Methods" AffectedEntity="Methods" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
224 <NamingRule Name="Methods" AffectedEntity="Methods" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
225 <NamingRule Name="Static Readonly Fields" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" />
225 <NamingRule Name="Static Readonly Fields" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" />
226 <NamingRule Name="Fields (Non Private)" AffectedEntity="Field" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
226 <NamingRule Name="Fields (Non Private)" AffectedEntity="Field" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
227 <NamingRule Name="ReadOnly Fields (Non Private)" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False" />
227 <NamingRule Name="ReadOnly Fields (Non Private)" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False" />
228 <NamingRule Name="Fields (Private)" AffectedEntity="Field, ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
228 <NamingRule Name="Fields (Private)" AffectedEntity="Field, ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
229 <RequiredPrefixes>
229 <RequiredPrefixes>
230 <String>m_</String>
230 <String>m_</String>
231 </RequiredPrefixes>
231 </RequiredPrefixes>
232 </NamingRule>
232 </NamingRule>
233 <NamingRule Name="Static Fields (Private)" AffectedEntity="Field" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True">
233 <NamingRule Name="Static Fields (Private)" AffectedEntity="Field" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True">
234 <RequiredPrefixes>
234 <RequiredPrefixes>
235 <String>_</String>
235 <String>_</String>
236 </RequiredPrefixes>
236 </RequiredPrefixes>
237 </NamingRule>
237 </NamingRule>
238 <NamingRule Name="ReadOnly Fields (Private)" AffectedEntity="ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
238 <NamingRule Name="ReadOnly Fields (Private)" AffectedEntity="ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
239 <RequiredPrefixes>
239 <RequiredPrefixes>
240 <String>m_</String>
240 <String>m_</String>
241 </RequiredPrefixes>
241 </RequiredPrefixes>
242 </NamingRule>
242 </NamingRule>
243 <NamingRule Name="Constant Fields" AffectedEntity="ConstantField" VisibilityMask="VisibilityMask" NamingStyle="AllUpper" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
243 <NamingRule Name="Constant Fields" AffectedEntity="ConstantField" VisibilityMask="VisibilityMask" NamingStyle="AllUpper" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
244 <NamingRule Name="Properties" AffectedEntity="Property" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
244 <NamingRule Name="Properties" AffectedEntity="Property" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
245 <NamingRule Name="Events" AffectedEntity="Event" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
245 <NamingRule Name="Events" AffectedEntity="Event" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
246 <NamingRule Name="Enum Members" AffectedEntity="EnumMember" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
246 <NamingRule Name="Enum Members" AffectedEntity="EnumMember" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
247 <NamingRule Name="Parameters" AffectedEntity="Parameter, LocalVariable" VisibilityMask="VisibilityMask" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
247 <NamingRule Name="Parameters" AffectedEntity="Parameter, LocalVariable" VisibilityMask="VisibilityMask" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
248 <NamingRule Name="Type Parameters" AffectedEntity="TypeParameter" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
248 <NamingRule Name="Type Parameters" AffectedEntity="TypeParameter" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
249 <RequiredPrefixes>
249 <RequiredPrefixes>
250 <String>T</String>
250 <String>T</String>
251 </RequiredPrefixes>
251 </RequiredPrefixes>
252 </NamingRule>
252 </NamingRule>
253 </Rules>
253 </Rules>
254 </NameConventionPolicy>
254 </NameConventionPolicy>
255 </Policies>
255 </Policies>
256 </Properties>
256 </Properties>
257 </MonoDevelop>
257 </MonoDevelop>
258 </ProjectExtensions>
258 </ProjectExtensions>
259 <ItemGroup>
259 <ItemGroup>
260 <Folder Include="Components\" />
260 <Folder Include="Components\" />
261 </ItemGroup>
261 </ItemGroup>
262 </Project> No newline at end of file
262 </Project>
@@ -1,100 +1,100
1 using Implab.Parsing;
1 using Implab.Parsing;
2 using System;
2 using System;
3 using System.Collections.Generic;
3 using System.Collections.Generic;
4 using System.Globalization;
4 using System.Globalization;
5 using System.Linq;
5 using System.Linq;
6 using System.Text;
6 using System.Text;
7 using System.Threading.Tasks;
7 using System.Threading.Tasks;
8
8
9 namespace Implab.JSON {
9 namespace Implab.JSON {
10 /// <summary>
10 /// <summary>
11 /// Сканнер (лексер), разбивающий поток символов на токены JSON.
11 /// Сканнер (лексер), разбивающий поток символов на токены JSON.
12 /// </summary>
12 /// </summary>
13 public class JSONScanner : Scanner {
13 public class JSONScanner : Scanner {
14 char[] m_stringBuffer;
14 char[] m_stringBuffer;
15 DFAStateDescriptior[] m_stringDFA;
15 DFAStateDescriptior[] m_stringDFA;
16 int[] m_stringAlphabet;
16 int[] m_stringAlphabet;
17
17
18 /// <summary>
18 /// <summary>
19 /// Создает новый экземпляр сканнера
19 /// Создает новый экземпляр сканнера
20 /// </summary>
20 /// </summary>
21 public JSONScanner()
21 public JSONScanner()
22 : base(JSONGrammar.Instance.JsonDFA) {
22 : base(JSONGrammar.Instance.JsonDFA.States, JSONGrammar.Instance.JsonDFA.Alphabet.GetTranslationMap()) {
23 m_stringBuffer = new char[1024];
23 m_stringBuffer = new char[1024];
24 var dfa = JSONGrammar.Instance.JsonStringDFA;
24 var dfa = JSONGrammar.Instance.JsonStringDFA;
25 m_stringAlphabet = dfa.Alphabet.GetTranslationMap();
25 m_stringAlphabet = dfa.Alphabet.GetTranslationMap();
26 m_stringDFA = dfa.States;
26 m_stringDFA = dfa.States;
27 }
27 }
28
28
29 /// <summary>
29 /// <summary>
30 /// Читает следующий лексический элемент из входных данных.
30 /// Читает следующий лексический элемент из входных данных.
31 /// </summary>
31 /// </summary>
32 /// <param name="tokenValue">Возвращает значение прочитанного токена.</param>
32 /// <param name="tokenValue">Возвращает значение прочитанного токена.</param>
33 /// <param name="tokenType">Возвращает тип прочитанного токена.</param>
33 /// <param name="tokenType">Возвращает тип прочитанного токена.</param>
34 /// <returns><c>true</c> - чтение произведено успешно. <c>false</c> - достигнут конец входных данных</returns>
34 /// <returns><c>true</c> - чтение произведено успешно. <c>false</c> - достигнут конец входных данных</returns>
35 /// <remarks>В случе если токен не распознается, возникает исключение. Значения токенов обрабатываются, т.е.
35 /// <remarks>В случе если токен не распознается, возникает исключение. Значения токенов обрабатываются, т.е.
36 /// в строках обрабатываются экранированные символы, числа становтся типа double.</remarks>
36 /// в строках обрабатываются экранированные символы, числа становтся типа double.</remarks>
37 public bool ReadToken(out object tokenValue, out JsonTokenType tokenType) {
37 public bool ReadToken(out object tokenValue, out JsonTokenType tokenType) {
38 if (ReadTokenInternal()) {
38 if (ReadTokenInternal()) {
39 switch ((JSONGrammar.TokenType)m_currentState.tag[0]) {
39 switch ((JSONGrammar.TokenType)m_currentState.tag[0]) {
40 case JSONGrammar.TokenType.StringBound:
40 case JSONGrammar.TokenType.StringBound:
41 tokenValue = ReadString();
41 tokenValue = ReadString();
42 tokenType = JsonTokenType.String;
42 tokenType = JsonTokenType.String;
43 break;
43 break;
44 case JSONGrammar.TokenType.Number:
44 case JSONGrammar.TokenType.Number:
45 tokenValue = Double.Parse(new String(m_buffer, m_tokenOffset, m_tokenLen), CultureInfo.InvariantCulture);
45 tokenValue = Double.Parse(new String(m_buffer, m_tokenOffset, m_tokenLen), CultureInfo.InvariantCulture);
46 tokenType = JsonTokenType.Number;
46 tokenType = JsonTokenType.Number;
47 break;
47 break;
48 default:
48 default:
49 tokenType = (JsonTokenType)m_currentState.tag[0];
49 tokenType = (JsonTokenType)m_currentState.tag[0];
50 tokenValue = new String(m_buffer, m_tokenOffset, m_tokenLen);
50 tokenValue = new String(m_buffer, m_tokenOffset, m_tokenLen);
51 break;
51 break;
52 }
52 }
53 return true;
53 return true;
54 }
54 }
55 tokenValue = null;
55 tokenValue = null;
56 tokenType = JsonTokenType.None;
56 tokenType = JsonTokenType.None;
57 return false;
57 return false;
58 }
58 }
59
59
60 string ReadString() {
60 string ReadString() {
61 int pos = 0;
61 int pos = 0;
62 Switch(m_stringDFA, m_stringAlphabet);
62 Switch(m_stringDFA, m_stringAlphabet);
63 while (ReadTokenInternal()) {
63 while (ReadTokenInternal()) {
64 switch ((JSONGrammar.TokenType)m_currentState.tag[0]) {
64 switch ((JSONGrammar.TokenType)m_currentState.tag[0]) {
65 case JSONGrammar.TokenType.StringBound:
65 case JSONGrammar.TokenType.StringBound:
66 Restore();
66 Restore();
67 return new String(m_stringBuffer, 0, pos);
67 return new String(m_stringBuffer, 0, pos);
68 case JSONGrammar.TokenType.UnescapedChar:
68 case JSONGrammar.TokenType.UnescapedChar:
69 EnsureStringBufferSize(pos + m_tokenLen);
69 EnsureStringBufferSize(pos + m_tokenLen);
70 Array.Copy(m_buffer, m_tokenOffset, m_stringBuffer, pos, m_tokenLen);
70 Array.Copy(m_buffer, m_tokenOffset, m_stringBuffer, pos, m_tokenLen);
71 pos += m_tokenLen;
71 pos += m_tokenLen;
72 break;
72 break;
73 case JSONGrammar.TokenType.EscapedUnicode:
73 case JSONGrammar.TokenType.EscapedUnicode:
74 EnsureStringBufferSize(pos + 1);
74 EnsureStringBufferSize(pos + 1);
75 m_stringBuffer[pos] = StringTranslator.TranslateHexUnicode(m_buffer, m_tokenOffset + 2);
75 m_stringBuffer[pos] = StringTranslator.TranslateHexUnicode(m_buffer, m_tokenOffset + 2);
76 pos++;
76 pos++;
77 break;
77 break;
78 case JSONGrammar.TokenType.EscapedChar:
78 case JSONGrammar.TokenType.EscapedChar:
79 EnsureStringBufferSize(pos + 1);
79 EnsureStringBufferSize(pos + 1);
80 m_stringBuffer[pos] = StringTranslator.TranslateEscapedChar(m_buffer[m_tokenOffset + 1]);
80 m_stringBuffer[pos] = StringTranslator.TranslateEscapedChar(m_buffer[m_tokenOffset + 1]);
81 pos++;
81 pos++;
82 break;
82 break;
83 default:
83 default:
84 break;
84 break;
85 }
85 }
86
86
87 }
87 }
88
88
89 throw new ParserException("Unexpected end of data");
89 throw new ParserException("Unexpected end of data");
90 }
90 }
91
91
92 void EnsureStringBufferSize(int size) {
92 void EnsureStringBufferSize(int size) {
93 if (size > m_stringBuffer.Length) {
93 if (size > m_stringBuffer.Length) {
94 var newBuffer = new char[size];
94 var newBuffer = new char[size];
95 m_stringBuffer.CopyTo(newBuffer, 0);
95 m_stringBuffer.CopyTo(newBuffer, 0);
96 m_stringBuffer = newBuffer;
96 m_stringBuffer = newBuffer;
97 }
97 }
98 }
98 }
99 }
99 }
100 }
100 }
@@ -1,96 +1,96
1 using Implab;
1 using Implab;
2 using Implab.Parsing;
2 using Implab.Parsing;
3 using System;
3 using System;
4 using System.Collections.Generic;
4 using System.Collections.Generic;
5 using System.Diagnostics;
5 using System.Diagnostics;
6 using System.Linq;
6 using System.Linq;
7 using System.Text;
7 using System.Text;
8 using System.Threading.Tasks;
8 using System.Threading.Tasks;
9
9
10 namespace Implab.JSON {
10 namespace Implab.JSON {
11 /// <summary>
11 /// <summary>
12 /// Класс для преобразования экранированной строки JSON
12 /// Класс для преобразования экранированной строки JSON
13 /// </summary>
13 /// </summary>
14 public class StringTranslator : Scanner {
14 public class StringTranslator : Scanner {
15 static readonly char[] _escMap;
15 static readonly char[] _escMap;
16 static readonly int[] _hexMap;
16 static readonly int[] _hexMap;
17
17
18 static StringTranslator() {
18 static StringTranslator() {
19 var chars = new char[] { 'b', 'f', 't', 'r', 'n', '\\', '/' };
19 var chars = new char[] { 'b', 'f', 't', 'r', 'n', '\\', '/' };
20 var vals = new char[] { '\b', '\f', '\t', '\r', '\n', '\\', '/' };
20 var vals = new char[] { '\b', '\f', '\t', '\r', '\n', '\\', '/' };
21
21
22 _escMap = new char[chars.Max() + 1];
22 _escMap = new char[chars.Max() + 1];
23
23
24 for (int i = 0; i < chars.Length; i++)
24 for (int i = 0; i < chars.Length; i++)
25 _escMap[chars[i]] = vals[i];
25 _escMap[chars[i]] = vals[i];
26
26
27 var hexs = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F' };
27 var hexs = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F' };
28 var ints = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 10, 11, 12, 13, 14, 15 };
28 var ints = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 10, 11, 12, 13, 14, 15 };
29
29
30 _hexMap = new int[hexs.Max() + 1];
30 _hexMap = new int[hexs.Max() + 1];
31
31
32 for (int i = 0; i < hexs.Length; i++)
32 for (int i = 0; i < hexs.Length; i++)
33 _hexMap[hexs[i]] = ints[i];
33 _hexMap[hexs[i]] = ints[i];
34
34
35 }
35 }
36
36
37 public StringTranslator()
37 public StringTranslator()
38 : base(JSONGrammar.Instance.JsonStringDFA) {
38 : base(JSONGrammar.Instance.JsonStringDFA.States, JSONGrammar.Instance.JsonStringDFA.Alphabet.GetTranslationMap()) {
39 }
39 }
40
40
41 public string Translate(string data) {
41 public string Translate(string data) {
42 Safe.ArgumentNotNull(data, "data");
42 Safe.ArgumentNotNull(data, "data");
43 return Translate(data.ToCharArray());
43 return Translate(data.ToCharArray());
44 }
44 }
45
45
46 public string Translate(char[] data) {
46 public string Translate(char[] data) {
47 Safe.ArgumentNotNull(data, "data");
47 Safe.ArgumentNotNull(data, "data");
48 return Translate(data, data.Length);
48 return Translate(data, data.Length);
49 }
49 }
50
50
51 public string Translate(char[] data, int length) {
51 public string Translate(char[] data, int length) {
52 Safe.ArgumentNotNull(data, "data");
52 Safe.ArgumentNotNull(data, "data");
53 Safe.ArgumentInRange(length, 0, data.Length, "length");
53 Safe.ArgumentInRange(length, 0, data.Length, "length");
54
54
55 var translated = new char[length];
55 var translated = new char[length];
56
56
57 Feed(data,length);
57 Feed(data,length);
58
58
59 int pos = 0;
59 int pos = 0;
60
60
61 while (ReadTokenInternal()) {
61 while (ReadTokenInternal()) {
62 switch ((JSONGrammar.TokenType)TokenTags[0]) {
62 switch ((JSONGrammar.TokenType)TokenTags[0]) {
63 case JSONGrammar.TokenType.UnescapedChar:
63 case JSONGrammar.TokenType.UnescapedChar:
64 Array.Copy(m_buffer,m_tokenOffset,translated,pos,m_tokenLen);
64 Array.Copy(m_buffer,m_tokenOffset,translated,pos,m_tokenLen);
65 pos += m_tokenLen;
65 pos += m_tokenLen;
66 break;
66 break;
67 case JSONGrammar.TokenType.EscapedChar:
67 case JSONGrammar.TokenType.EscapedChar:
68 translated[pos] = _escMap[m_buffer[m_tokenOffset + 1]];
68 translated[pos] = _escMap[m_buffer[m_tokenOffset + 1]];
69 pos++;
69 pos++;
70 break;
70 break;
71 case JSONGrammar.TokenType.EscapedUnicode:
71 case JSONGrammar.TokenType.EscapedUnicode:
72 translated[pos] = TranslateHexUnicode(m_buffer,m_tokenOffset + 2);
72 translated[pos] = TranslateHexUnicode(m_buffer,m_tokenOffset + 2);
73 pos++;
73 pos++;
74 break;
74 break;
75 }
75 }
76 }
76 }
77
77
78 return new String(translated, 0, pos);
78 return new String(translated, 0, pos);
79 }
79 }
80
80
81 internal static char TranslateEscapedChar(char symbol) {
81 internal static char TranslateEscapedChar(char symbol) {
82 return _escMap[symbol];
82 return _escMap[symbol];
83 }
83 }
84
84
85 internal static char TranslateHexUnicode(char[] symbols, int offset) {
85 internal static char TranslateHexUnicode(char[] symbols, int offset) {
86 Debug.Assert(symbols != null);
86 Debug.Assert(symbols != null);
87 Debug.Assert(symbols.Length - offset >= 4);
87 Debug.Assert(symbols.Length - offset >= 4);
88
88
89 int value = (_hexMap[symbols[offset]] << 12)
89 int value = (_hexMap[symbols[offset]] << 12)
90 | (_hexMap[symbols[offset + 1]] << 8)
90 | (_hexMap[symbols[offset + 1]] << 8)
91 | (_hexMap[symbols[offset + 2]] << 4)
91 | (_hexMap[symbols[offset + 2]] << 4)
92 | (_hexMap[symbols[offset + 3]]);
92 | (_hexMap[symbols[offset + 3]]);
93 return (char)value;
93 return (char)value;
94 }
94 }
95 }
95 }
96 }
96 }
@@ -1,36 +1,24
1 using Implab;
1 namespace Implab.Parsing {
2 using System;
2 public class CDFADefinition : DFADefinition {
3 using System.Collections.Generic;
3 readonly CharAlphabet m_alphabet;
4 using System.Linq;
5 using System.Text;
6 using System.Threading.Tasks;
7
4
8 namespace Implab.Parsing {
5 public CharAlphabet Alphabet {
9 public class CDFADefinition : DFADefinitionBase {
10 readonly Alphabet m_alphabet;
11
12 public Alphabet Alphabet {
13 get { return m_alphabet; }
6 get { return m_alphabet; }
14 }
7 }
15
8
16 public override int AlphabetSize {
9 public CDFADefinition(CharAlphabet alphabet): base(alphabet.Count) {
17 get { return m_alphabet.Count; }
18 }
19
20 public CDFADefinition(Alphabet alphabet): base() {
21 Safe.ArgumentNotNull(alphabet, "alphabet");
22 m_alphabet = alphabet;
10 m_alphabet = alphabet;
23 }
11 }
24
12
25 public CDFADefinition Optimize() {
13 public CDFADefinition Optimize() {
26 var optimized = new CDFADefinition(new Alphabet());
14 var optimized = new CDFADefinition(new CharAlphabet());
27
15
28 Optimize(optimized, m_alphabet, optimized.Alphabet);
16 Optimize(optimized, m_alphabet, optimized.Alphabet);
29 return optimized;
17 return optimized;
30 }
18 }
31
19
32 public void PrintDFA() {
20 public void PrintDFA() {
33 PrintDFA(m_alphabet);
21 PrintDFA(m_alphabet);
34 }
22 }
35 }
23 }
36 }
24 }
@@ -1,182 +1,180
1 using Implab;
1 using Implab;
2 using System;
2 using System;
3 using System.Collections.Generic;
3 using System.Collections.Generic;
4 using System.Diagnostics;
4 using System.Diagnostics;
5 using System.Linq;
5 using System.Linq;
6 using System.Text;
7 using System.Threading.Tasks;
8
6
9 namespace Implab.Parsing {
7 namespace Implab.Parsing {
10 /// <summary>
8 /// <summary>
11 /// Используется для построения ДКА по регулярному выражению, сначала обходит
9 /// Используется для построения ДКА по регулярному выражению, сначала обходит
12 /// регулярное выражение и вычисляет followpos, затем используется метод
10 /// регулярное выражение и вычисляет followpos, затем используется метод
13 /// <see cref="BuildDFA(IDFADefinition)"/> для построения автомата.
11 /// <see cref="BuildDFA(IDFADefinition)"/> для построения автомата.
14 /// </summary>
12 /// </summary>
15 public class DFABuilder : IVisitor {
13 public class DFABuilder : IVisitor {
16 int m_idx = 0;
14 int m_idx = 0;
17 Token m_root;
15 Token m_root;
18 HashSet<int> m_firstpos;
16 HashSet<int> m_firstpos;
19 HashSet<int> m_lastpos;
17 HashSet<int> m_lastpos;
20
18
21 Dictionary<int, HashSet<int>> m_followpos = new Dictionary<int, HashSet<int>>();
19 Dictionary<int, HashSet<int>> m_followpos = new Dictionary<int, HashSet<int>>();
22 Dictionary<int, int> m_indexes = new Dictionary<int, int>();
20 Dictionary<int, int> m_indexes = new Dictionary<int, int>();
23 Dictionary<int, int> m_ends = new Dictionary<int, int>();
21 Dictionary<int, int> m_ends = new Dictionary<int, int>();
24
22
25 public Dictionary<int, HashSet<int>> FollowposMap {
23 public Dictionary<int, HashSet<int>> FollowposMap {
26 get { return m_followpos; }
24 get { return m_followpos; }
27 }
25 }
28
26
29 public HashSet<int> Followpos(int pos) {
27 public HashSet<int> Followpos(int pos) {
30 HashSet<int> set;
28 HashSet<int> set;
31 if (m_followpos.TryGetValue(pos, out set))
29 if (m_followpos.TryGetValue(pos, out set))
32 return set;
30 return set;
33 return m_followpos[pos] = new HashSet<int>();
31 return m_followpos[pos] = new HashSet<int>();
34 }
32 }
35
33
36 bool Nullable(object n) {
34 bool Nullable(object n) {
37 if (n is EmptyToken || n is StarToken)
35 if (n is EmptyToken || n is StarToken)
38 return true;
36 return true;
39 if (n is AltToken)
37 if (n is AltToken)
40 return Nullable(((AltToken)n).Left) || Nullable(((AltToken)n).Right);
38 return Nullable(((AltToken)n).Left) || Nullable(((AltToken)n).Right);
41 if (n is CatToken)
39 if (n is CatToken)
42 return Nullable(((CatToken)n).Left) && Nullable(((CatToken)n).Right);
40 return Nullable(((CatToken)n).Left) && Nullable(((CatToken)n).Right);
43 return false;
41 return false;
44 }
42 }
45
43
46
44
47 public void Visit(AltToken token) {
45 public void Visit(AltToken token) {
48 if (m_root == null)
46 if (m_root == null)
49 m_root = token;
47 m_root = token;
50 var firtspos = new HashSet<int>();
48 var firtspos = new HashSet<int>();
51 var lastpos = new HashSet<int>();
49 var lastpos = new HashSet<int>();
52
50
53 token.Left.Accept(this);
51 token.Left.Accept(this);
54 firtspos.UnionWith(m_firstpos);
52 firtspos.UnionWith(m_firstpos);
55 lastpos.UnionWith(m_lastpos);
53 lastpos.UnionWith(m_lastpos);
56
54
57 token.Right.Accept(this);
55 token.Right.Accept(this);
58 firtspos.UnionWith(m_firstpos);
56 firtspos.UnionWith(m_firstpos);
59 lastpos.UnionWith(m_lastpos);
57 lastpos.UnionWith(m_lastpos);
60
58
61 m_firstpos = firtspos;
59 m_firstpos = firtspos;
62 m_lastpos = lastpos;
60 m_lastpos = lastpos;
63 }
61 }
64
62
65 public void Visit(StarToken token) {
63 public void Visit(StarToken token) {
66 if (m_root == null)
64 if (m_root == null)
67 m_root = token;
65 m_root = token;
68 token.Token.Accept(this);
66 token.Token.Accept(this);
69
67
70 foreach (var i in m_lastpos)
68 foreach (var i in m_lastpos)
71 Followpos(i).UnionWith(m_firstpos);
69 Followpos(i).UnionWith(m_firstpos);
72 }
70 }
73
71
74 public void Visit(CatToken token) {
72 public void Visit(CatToken token) {
75 if (m_root == null)
73 if (m_root == null)
76 m_root = token;
74 m_root = token;
77
75
78 var firtspos = new HashSet<int>();
76 var firtspos = new HashSet<int>();
79 var lastpos = new HashSet<int>();
77 var lastpos = new HashSet<int>();
80 token.Left.Accept(this);
78 token.Left.Accept(this);
81 firtspos.UnionWith(m_firstpos);
79 firtspos.UnionWith(m_firstpos);
82 var leftLastpos = m_lastpos;
80 var leftLastpos = m_lastpos;
83
81
84 token.Right.Accept(this);
82 token.Right.Accept(this);
85 lastpos.UnionWith(m_lastpos);
83 lastpos.UnionWith(m_lastpos);
86 var rightFirstpos = m_firstpos;
84 var rightFirstpos = m_firstpos;
87
85
88 if (Nullable(token.Left))
86 if (Nullable(token.Left))
89 firtspos.UnionWith(rightFirstpos);
87 firtspos.UnionWith(rightFirstpos);
90
88
91 if (Nullable(token.Right))
89 if (Nullable(token.Right))
92 lastpos.UnionWith(leftLastpos);
90 lastpos.UnionWith(leftLastpos);
93
91
94 m_firstpos = firtspos;
92 m_firstpos = firtspos;
95 m_lastpos = lastpos;
93 m_lastpos = lastpos;
96
94
97 foreach (var i in leftLastpos)
95 foreach (var i in leftLastpos)
98 Followpos(i).UnionWith(rightFirstpos);
96 Followpos(i).UnionWith(rightFirstpos);
99
97
100 }
98 }
101
99
102 public void Visit(EmptyToken token) {
100 public void Visit(EmptyToken token) {
103 if (m_root == null)
101 if (m_root == null)
104 m_root = token;
102 m_root = token;
105 ;
103 ;
106 }
104 }
107
105
108 public void Visit(SymbolToken token) {
106 public void Visit(SymbolToken token) {
109 if (m_root == null)
107 if (m_root == null)
110 m_root = token;
108 m_root = token;
111 m_idx++;
109 m_idx++;
112 m_indexes[m_idx] = token.Value;
110 m_indexes[m_idx] = token.Value;
113 m_firstpos = new HashSet<int>(new[] { m_idx });
111 m_firstpos = new HashSet<int>(new[] { m_idx });
114 m_lastpos = new HashSet<int>(new[] { m_idx });
112 m_lastpos = new HashSet<int>(new[] { m_idx });
115 }
113 }
116
114
117 public void Visit(EndToken token) {
115 public void Visit(EndToken token) {
118 if (m_root == null)
116 if (m_root == null)
119 m_root = token;
117 m_root = token;
120 m_idx++;
118 m_idx++;
121 m_indexes[m_idx] = Alphabet.UNCLASSIFIED;
119 m_indexes[m_idx] = IndexedAlphabetBase<char>.UNCLASSIFIED;
122 m_firstpos = new HashSet<int>(new[] { m_idx });
120 m_firstpos = new HashSet<int>(new[] { m_idx });
123 m_lastpos = new HashSet<int>(new[] { m_idx });
121 m_lastpos = new HashSet<int>(new[] { m_idx });
124 Followpos(m_idx);
122 Followpos(m_idx);
125 m_ends.Add(m_idx, token.Tag);
123 m_ends.Add(m_idx, token.Tag);
126 }
124 }
127
125
128 public void BuildDFA(IDFADefinition dfa) {
126 public void BuildDFA(IDFADefinition dfa) {
129 Safe.ArgumentNotNull(dfa,"dfa");
127 Safe.ArgumentNotNull(dfa,"dfa");
130
128
131 var stateMap = new Dictionary<HashSet<int>, int>(new CustomEqualityComparer<HashSet<int>>(
129 var stateMap = new Dictionary<HashSet<int>, int>(new CustomEqualityComparer<HashSet<int>>(
132 (x, y) => x.SetEquals(y),
130 (x, y) => x.SetEquals(y),
133 (x) => x.Sum(n => n.GetHashCode())
131 (x) => x.Sum(n => n.GetHashCode())
134 ));
132 ));
135
133
136 stateMap[m_firstpos] = DefineState( dfa, m_firstpos);
134 stateMap[m_firstpos] = DefineState( dfa, m_firstpos);
137 Debug.Assert(stateMap[m_firstpos] == DFADefinitionBase.INITIAL_STATE);
135 Debug.Assert(stateMap[m_firstpos] == DFADefinition.INITIAL_STATE);
138
136
139 var queue = new Queue<HashSet<int>>();
137 var queue = new Queue<HashSet<int>>();
140
138
141 queue.Enqueue(m_firstpos);
139 queue.Enqueue(m_firstpos);
142
140
143 while (queue.Count > 0) {
141 while (queue.Count > 0) {
144 var state = queue.Dequeue();
142 var state = queue.Dequeue();
145 var s1 = stateMap[state];
143 var s1 = stateMap[state];
146
144
147 for (int a = 0; a < dfa.AlphabetSize; a++) {
145 for (int a = 0; a < dfa.AlphabetSize; a++) {
148 var next = new HashSet<int>();
146 var next = new HashSet<int>();
149 foreach (var p in state) {
147 foreach (var p in state) {
150 if (m_indexes[p] == a) {
148 if (m_indexes[p] == a) {
151 next.UnionWith(Followpos(p));
149 next.UnionWith(Followpos(p));
152 }
150 }
153 }
151 }
154 if (next.Count > 0) {
152 if (next.Count > 0) {
155 int s2;
153 int s2;
156 if (!stateMap.TryGetValue(next, out s2)) {
154 if (!stateMap.TryGetValue(next, out s2)) {
157 stateMap[next] = s2 = DefineState(dfa, next);
155 stateMap[next] = s2 = DefineState(dfa, next);
158 queue.Enqueue(next);
156 queue.Enqueue(next);
159 }
157 }
160 dfa.DefineTransition(s1, s2, a);
158 dfa.DefineTransition(s1, s2, a);
161 }
159 }
162 }
160 }
163
161
164 }
162 }
165 }
163 }
166
164
167 int[] GetStateTags(HashSet<int> state) {
165 int[] GetStateTags(HashSet<int> state) {
168 Debug.Assert(state != null);
166 Debug.Assert(state != null);
169 return state.Where(m_ends.ContainsKey).Select(pos => m_ends[pos]).ToArray();
167 return state.Where(m_ends.ContainsKey).Select(pos => m_ends[pos]).ToArray();
170 }
168 }
171
169
172 int DefineState(IDFADefinition automa, HashSet<int> state) {
170 int DefineState(IDFADefinition automa, HashSet<int> state) {
173 Debug.Assert(automa != null);
171 Debug.Assert(automa != null);
174 Debug.Assert(state != null);
172 Debug.Assert(state != null);
175
173
176 var tags = GetStateTags(state);
174 var tags = GetStateTags(state);
177
175
178 return tags.Length > 0 ? automa.AddState(tags) : automa.AddState();
176 return tags.Length > 0 ? automa.AddState(tags) : automa.AddState();
179 }
177 }
180
178
181 }
179 }
182 }
180 }
@@ -1,61 +1,61
1 using Implab;
1 using Implab;
2 using System;
2 using System;
3 using System.Collections.Generic;
3 using System.Collections.Generic;
4 using System.Diagnostics;
4 using System.Diagnostics;
5 using System.Linq;
5 using System.Linq;
6 using System.Text;
6 using System.Text;
7 using System.Threading.Tasks;
7 using System.Threading.Tasks;
8
8
9 namespace Implab.Parsing {
9 namespace Implab.Parsing {
10 public abstract class DFAutomaton<T> {
10 public abstract class DFAutomaton<T> {
11 protected struct ContextFrame {
11 protected struct ContextFrame {
12 public DFAStateDescriptior[] states;
12 public DFAStateDescriptior[] states;
13 public int current;
13 public int current;
14 public T info;
14 public T info;
15 }
15 }
16
16
17 public const int INITIAL_STATE = DFADefinitionBase.INITIAL_STATE;
17 public const int INITIAL_STATE = DFADefinition.INITIAL_STATE;
18 public const int UNREACHEBLE_STATE = DFADefinitionBase.UNREACHEBLE_STATE;
18 public const int UNREACHEBLE_STATE = DFADefinition.UNREACHEBLE_STATE;
19
19
20 protected ContextFrame m_context;
20 protected ContextFrame m_context;
21 Stack<ContextFrame> m_contextStack = new Stack<ContextFrame>();
21 Stack<ContextFrame> m_contextStack = new Stack<ContextFrame>();
22
22
23 protected int Level {
23 protected int Level {
24 get { return m_contextStack.Count; }
24 get { return m_contextStack.Count; }
25 }
25 }
26
26
27 protected DFAutomaton(DFAStateDescriptior[] states, int startState, T info) {
27 protected DFAutomaton(DFAStateDescriptior[] states, int startState, T info) {
28 Safe.ArgumentNotNull(states, "states");
28 Safe.ArgumentNotNull(states, "states");
29 Safe.ArgumentInRange(startState, 0, states.Length - 1, "startState");
29 Safe.ArgumentInRange(startState, 0, states.Length - 1, "startState");
30
30
31 m_context.states = states;
31 m_context.states = states;
32 m_context.current = startState;
32 m_context.current = startState;
33 m_context.info = info;
33 m_context.info = info;
34 }
34 }
35
35
36 protected void Switch(DFAStateDescriptior[] states, int current, T info) {
36 protected void Switch(DFAStateDescriptior[] states, int current, T info) {
37 Debug.Assert(states != null);
37 Debug.Assert(states != null);
38 Debug.Assert(current >= 0 && current < states.Length);
38 Debug.Assert(current >= 0 && current < states.Length);
39 m_contextStack.Push(m_context);
39 m_contextStack.Push(m_context);
40 m_context.states = states;
40 m_context.states = states;
41 m_context.current = current;
41 m_context.current = current;
42 m_context.info = info;
42 m_context.info = info;
43 }
43 }
44
44
45 protected void Restore() {
45 protected void Restore() {
46 Debug.Assert(m_contextStack.Count > 0);
46 Debug.Assert(m_contextStack.Count > 0);
47
47
48 m_context = m_contextStack.Pop();
48 m_context = m_contextStack.Pop();
49 }
49 }
50
50
51 protected void Move(int input) {
51 protected void Move(int input) {
52 Debug.Assert(input > 0 && input < m_context.states[m_context.current].transitions.Length);
52 Debug.Assert(input > 0 && input < m_context.states[m_context.current].transitions.Length);
53 m_context.current = m_context.states[m_context.current].transitions[input];
53 m_context.current = m_context.states[m_context.current].transitions[input];
54 }
54 }
55
55
56 protected bool CanMove(int input) {
56 protected bool CanMove(int input) {
57 Debug.Assert(input > 0 && input < m_context.states[m_context.current].transitions.Length);
57 Debug.Assert(input > 0 && input < m_context.states[m_context.current].transitions.Length);
58 return m_context.states[m_context.current].transitions[input] != UNREACHEBLE_STATE;
58 return m_context.states[m_context.current].transitions[input] != UNREACHEBLE_STATE;
59 }
59 }
60 }
60 }
61 }
61 }
@@ -1,36 +1,31
1 using Implab;
1 using Implab;
2 using System;
2 using System;
3
3
4 namespace Implab.Parsing {
4 namespace Implab.Parsing {
5 public class EDFADefinition<T> : DFADefinitionBase where T : struct, IConvertible {
5 public class EDFADefinition<T> : DFADefinition where T : struct, IConvertible {
6 readonly EnumAlphabet<T> m_alphabet;
6 readonly EnumAlphabet<T> m_alphabet;
7
7
8 public EnumAlphabet<T> Alphabet {
8 public EnumAlphabet<T> Alphabet {
9 get { return m_alphabet; }
9 get { return m_alphabet; }
10 }
10 }
11
11
12 public EDFADefinition(EnumAlphabet<T> alphabet) {
12 public EDFADefinition(EnumAlphabet<T> alphabet) : base(alphabet.Count) {
13 Safe.ArgumentNotNull(alphabet, "alphabet");
14 m_alphabet = alphabet;
13 m_alphabet = alphabet;
15 }
14 }
16
15
17 public override int AlphabetSize {
18 get { return m_alphabet.Count; }
19 }
20
21 public void DefineTransition(int s1, int s2, T input) {
16 public void DefineTransition(int s1, int s2, T input) {
22 DefineTransition(s1, s2, m_alphabet.Translate(input));
17 DefineTransition(s1, s2, m_alphabet.Translate(input));
23 }
18 }
24
19
25 public EDFADefinition<T> Optimize() {
20 public EDFADefinition<T> Optimize() {
26 var optimized = new EDFADefinition<T>(new EnumAlphabet<T>());
21 var optimized = new EDFADefinition<T>(new EnumAlphabet<T>());
27 Optimize(optimized, m_alphabet, optimized.Alphabet);
22 Optimize(optimized, m_alphabet, optimized.Alphabet);
28
23
29 return optimized;
24 return optimized;
30 }
25 }
31
26
32 public void PrintDFA() {
27 public void PrintDFA() {
33 PrintDFA(m_alphabet);
28 PrintDFA(m_alphabet);
34 }
29 }
35 }
30 }
36 }
31 }
@@ -1,67 +1,67
1 using System;
1 using System;
2 using System.Collections.Generic;
2 using System.Collections.Generic;
3 using System.Diagnostics;
3 using System.Diagnostics;
4 using System.Globalization;
4 using System.Globalization;
5 using System.Linq;
5 using System.Linq;
6 using System.Diagnostics.CodeAnalysis;
6 using System.Diagnostics.CodeAnalysis;
7
7
8 namespace Implab.Parsing {
8 namespace Implab.Parsing {
9 /// <summary>
9 /// <summary>
10 /// Алфавит символами которого являются элементы перечислений.
10 /// Алфавит символами которого являются элементы перечислений.
11 /// </summary>
11 /// </summary>
12 /// <typeparam name="T">Тип перечислений</typeparam>
12 /// <typeparam name="T">Тип перечислений</typeparam>
13 public class EnumAlphabet<T> : AlphabetBase<T> where T : struct, IConvertible {
13 public class EnumAlphabet<T> : IndexedAlphabetBase<T> where T : struct, IConvertible {
14 [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
14 [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
15 static readonly T[] _symbols;
15 static readonly T[] _symbols;
16 static readonly EnumAlphabet<T> _fullAlphabet;
16 static readonly EnumAlphabet<T> _fullAlphabet;
17
17
18 [SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
18 [SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
19 static EnumAlphabet() {
19 static EnumAlphabet() {
20 if (!typeof(T).IsEnum)
20 if (!typeof(T).IsEnum)
21 throw new InvalidOperationException("Invalid generic parameter, enumeration is required");
21 throw new InvalidOperationException("Invalid generic parameter, enumeration is required");
22
22
23 if (Enum.GetUnderlyingType(typeof(T)) != typeof(Int32))
23 if (Enum.GetUnderlyingType(typeof(T)) != typeof(Int32))
24 throw new InvalidOperationException("Only enums based on Int32 are supported");
24 throw new InvalidOperationException("Only enums based on Int32 are supported");
25
25
26 _symbols = ((T[])Enum.GetValues(typeof(T)))
26 _symbols = ((T[])Enum.GetValues(typeof(T)))
27 .OrderBy(x => x.ToInt32(CultureInfo.InvariantCulture))
27 .OrderBy(x => x.ToInt32(CultureInfo.InvariantCulture))
28 .ToArray();
28 .ToArray();
29
29
30 if (
30 if (
31 _symbols[_symbols.Length - 1].ToInt32(CultureInfo.InvariantCulture) >= _symbols.Length
31 _symbols[_symbols.Length - 1].ToInt32(CultureInfo.InvariantCulture) >= _symbols.Length
32 || _symbols[0].ToInt32(CultureInfo.InvariantCulture) != 0
32 || _symbols[0].ToInt32(CultureInfo.InvariantCulture) != 0
33 )
33 )
34 throw new InvalidOperationException("The specified enumeration must be zero-based and continuously numbered");
34 throw new InvalidOperationException("The specified enumeration must be zero-based and continuously numbered");
35
35
36 _fullAlphabet = new EnumAlphabet<T>(_symbols.Select(x => x.ToInt32(CultureInfo.InvariantCulture)).ToArray());
36 _fullAlphabet = new EnumAlphabet<T>(_symbols.Select(x => x.ToInt32(CultureInfo.InvariantCulture)).ToArray());
37 }
37 }
38
38
39
39
40
40
41 public static EnumAlphabet<T> FullAlphabet {
41 public static EnumAlphabet<T> FullAlphabet {
42 get {
42 get {
43 return _fullAlphabet;
43 return _fullAlphabet;
44 }
44 }
45 }
45 }
46
46
47
47
48 public EnumAlphabet()
48 public EnumAlphabet()
49 : base(_symbols.Length) {
49 : base(_symbols.Length) {
50 }
50 }
51
51
52 public EnumAlphabet(int[] map)
52 public EnumAlphabet(int[] map)
53 : base(map) {
53 : base(map) {
54 Debug.Assert(map.Length == _symbols.Length);
54 Debug.Assert(map.Length == _symbols.Length);
55 }
55 }
56
56
57
57
58 public override int GetSymbolIndex(T symbol) {
58 public override int GetSymbolIndex(T symbol) {
59 return symbol.ToInt32(CultureInfo.InvariantCulture);
59 return symbol.ToInt32(CultureInfo.InvariantCulture);
60 }
60 }
61
61
62 public override IEnumerable<T> InputSymbols {
62 public override IEnumerable<T> InputSymbols {
63 get { return _symbols; }
63 get { return _symbols; }
64 }
64 }
65
65
66 }
66 }
67 }
67 }
@@ -1,103 +1,108
1 using Implab;
1 using Implab;
2 using System;
2 using System;
3 using System.Collections.Generic;
3 using System.Collections.Generic;
4 using System.Linq;
4 using System.Linq;
5 using System.Text;
5 using System.Text;
6 using System.Threading.Tasks;
6 using System.Threading.Tasks;
7
7
8 namespace Implab.Parsing {
8 namespace Implab.Parsing {
9 /// <summary>
9 /// <summary>
10 /// Базовый абстрактный класс. Грамматика, позволяет формулировать выражения над алфавитом типа <c>char</c>.
10 /// Базовый абстрактный класс. Грамматика, позволяет формулировать выражения над алфавитом типа <c>char</c>.
11 /// </summary>
11 /// </summary>
12 /// <typeparam name="TGrammar"></typeparam>
12 /// <typeparam name="TGrammar"></typeparam>
13 public abstract class Grammar<TGrammar> where TGrammar: Grammar<TGrammar>, new() {
13 public abstract class Grammar<TGrammar> where TGrammar: Grammar<TGrammar>, new() {
14 Alphabet m_alphabet = new Alphabet();
15 static TGrammar _instance;
14 static TGrammar _instance;
16
15
17 public static TGrammar Instance{
16 public static TGrammar Instance{
18 get {
17 get {
19 if (_instance == null)
18 if (_instance == null)
20 _instance = new TGrammar();
19 _instance = new TGrammar();
21 return _instance;
20 return _instance;
22 }
21 }
23 }
22 }
24
23
24 readonly CharAlphabet m_alphabet = new CharAlphabet();
25
26 public CharAlphabet Alphabet {
27 get { return m_alphabet; }
28 }
29
25 public SymbolToken UnclassifiedToken() {
30 public SymbolToken UnclassifiedToken() {
26 return new SymbolToken(Alphabet.UNCLASSIFIED);
31 return new SymbolToken(CharAlphabet.UNCLASSIFIED);
27 }
32 }
28
33
29 public void DefineAlphabet(IEnumerable<char> alphabet) {
34 public void DefineAlphabet(IEnumerable<char> alphabet) {
30 Safe.ArgumentNotNull(alphabet, "alphabet");
35 Safe.ArgumentNotNull(alphabet, "alphabet");
31
36
32 foreach (var ch in alphabet)
37 foreach (var ch in alphabet)
33 m_alphabet.DefineSymbol(ch);
38 m_alphabet.DefineSymbol(ch);
34 }
39 }
35 public Token SymbolRangeToken(char start, char end) {
40 public Token SymbolRangeToken(char start, char end) {
36 return SymbolToken(Enumerable.Range(start, end - start + 1).Select(x => (char)x));
41 return SymbolToken(Enumerable.Range(start, end - start + 1).Select(x => (char)x));
37 }
42 }
38
43
39 public Token SymbolToken(char symbol) {
44 public Token SymbolToken(char symbol) {
40 return Token.New(TranslateOrAdd(symbol));
45 return Token.New(TranslateOrAdd(symbol));
41 }
46 }
42
47
43 public Token SymbolToken(IEnumerable<char> symbols) {
48 public Token SymbolToken(IEnumerable<char> symbols) {
44 Safe.ArgumentNotNull(symbols, "symbols");
49 Safe.ArgumentNotNull(symbols, "symbols");
45
50
46 return Token.New(TranslateOrAdd(symbols).ToArray());
51 return Token.New(TranslateOrAdd(symbols).ToArray());
47 }
52 }
48
53
49 public Token SymbolSetToken(params char[] set) {
54 public Token SymbolSetToken(params char[] set) {
50 return SymbolToken(set);
55 return SymbolToken(set);
51 }
56 }
52
57
53 int TranslateOrAdd(char ch) {
58 int TranslateOrAdd(char ch) {
54 var t = m_alphabet.Translate(ch);
59 var t = m_alphabet.Translate(ch);
55 if (t == Alphabet.UNCLASSIFIED)
60 if (t == CharAlphabet.UNCLASSIFIED)
56 t = m_alphabet.DefineSymbol(ch);
61 t = m_alphabet.DefineSymbol(ch);
57 return t;
62 return t;
58 }
63 }
59
64
60 IEnumerable<int> TranslateOrAdd(IEnumerable<char> symbols) {
65 IEnumerable<int> TranslateOrAdd(IEnumerable<char> symbols) {
61 return symbols.Distinct().Select(TranslateOrAdd);
66 return symbols.Distinct().Select(TranslateOrAdd);
62 }
67 }
63
68
64 int TranslateOrDie(char ch) {
69 int TranslateOrDie(char ch) {
65 var t = m_alphabet.Translate(ch);
70 var t = m_alphabet.Translate(ch);
66 if (t == Alphabet.UNCLASSIFIED)
71 if (t == CharAlphabet.UNCLASSIFIED)
67 throw new ApplicationException(String.Format("Symbol '{0}' is UNCLASSIFIED", ch));
72 throw new ApplicationException(String.Format("Symbol '{0}' is UNCLASSIFIED", ch));
68 return t;
73 return t;
69 }
74 }
70
75
71 IEnumerable<int> TranslateOrDie(IEnumerable<char> symbols) {
76 IEnumerable<int> TranslateOrDie(IEnumerable<char> symbols) {
72 return symbols.Distinct().Select(TranslateOrDie);
77 return symbols.Distinct().Select(TranslateOrDie);
73 }
78 }
74
79
75 public Token SymbolTokenExcept(IEnumerable<char> symbols) {
80 public Token SymbolTokenExcept(IEnumerable<char> symbols) {
76 Safe.ArgumentNotNull(symbols, "symbols");
81 Safe.ArgumentNotNull(symbols, "symbols");
77
82
78 return Token.New( Enumerable.Range(0, m_alphabet.Count).Except(TranslateOrDie(symbols)).ToArray());
83 return Token.New( Enumerable.Range(0, m_alphabet.Count).Except(TranslateOrDie(symbols)).ToArray());
79 }
84 }
80
85
81 protected CDFADefinition BuildDFA(Token lang) {
86 protected CDFADefinition BuildDFA(Token lang) {
82 Safe.ArgumentNotNull(lang, "lang");
87 Safe.ArgumentNotNull(lang, "lang");
83
88
84 var dfa = new CDFADefinition(m_alphabet);
89 var dfa = new CDFADefinition(m_alphabet);
85
90
86 var builder = new DFABuilder();
91 var builder = new DFABuilder();
87
92
88 lang.Accept( builder );
93 lang.Accept( builder );
89
94
90 builder.BuildDFA(dfa);
95 builder.BuildDFA(dfa);
91 if (dfa.InitialStateIsFinal)
96 if (dfa.InitialStateIsFinal)
92 throw new ApplicationException("The specified language contains empty token");
97 throw new ApplicationException("The specified language contains empty token");
93
98
94 return dfa.Optimize();
99 return dfa.Optimize();
95 }
100 }
96
101
97
102
98
103
99 //protected abstract TGrammar CreateInstance();
104 //protected abstract TGrammar CreateInstance();
100 }
105 }
101
106
102
107
103 }
108 }
@@ -1,56 +1,60
1 using System;
1 using System;
2 using System.Collections.Generic;
2 using System.Collections.Generic;
3 using System.Linq;
3 using System.Linq;
4 using System.Text;
4 using System.Text;
5 using System.Threading.Tasks;
5 using System.Threading.Tasks;
6
6
7 namespace Implab.Parsing {
7 namespace Implab.Parsing {
8 /// <summary>
8 /// <summary>
9 /// Алфавит. Множество символов, которые разбиты на классы, при этом классы имеют непрерывную нумерацию,
9 /// Алфавит. Множество символов, которые разбиты на классы, при этом классы имеют непрерывную нумерацию,
10 /// что позволяет использовать их в качестве индексов массивов.
10 /// что позволяет использовать их в качестве индексов массивов.
11 /// </summary>
11 /// </summary>
12 /// <remarks>Далее вимволами алфавита будем называть классы исходных символов.</remarks>
12 /// <remarks>
13 /// <para>Алфавит является сюрьективным отображением множества символов в множество индексов, это позволяет сократить размер таблицы переходов автомата
14 /// для входных символов, которые для него не различимы.</para>
15 /// <para>Далее символами алфавита будем называть классы исходных символов.</para>
16 /// </remarks>
13 /// <typeparam name="TSymbol">Тип символов.</typeparam>
17 /// <typeparam name="TSymbol">Тип символов.</typeparam>
14 public interface IAlphabet<TSymbol> {
18 public interface IAlphabet<TSymbol> {
15 /// <summary>
19 /// <summary>
16 /// Количество символов в алфавите.
20 /// Количество символов в алфавите.
17 /// </summary>
21 /// </summary>
18 int Count { get; }
22 int Count { get; }
19 /// <summary>
23 /// <summary>
20 /// Добавляет новый символ в алфавит, если символ уже был добавлен, то
24 /// Добавляет новый символ в алфавит, если символ уже был добавлен, то
21 /// возвращается ранее сопоставленный с символом класс.
25 /// возвращается ранее сопоставленный с символом класс.
22 /// </summary>
26 /// </summary>
23 /// <param name="symbol">Символ для добавления.</param>
27 /// <param name="symbol">Символ для добавления.</param>
24 /// <returns>Индекс класса, который попоставлен с символом.</returns>
28 /// <returns>Индекс класса, который попоставлен с символом.</returns>
25 int DefineSymbol(TSymbol symbol);
29 int DefineSymbol(TSymbol symbol);
26 /// <summary>
30 /// <summary>
27 /// Доабвляем класс символов. Множеству указанных исходных символов
31 /// Доабвляем класс символов. Множеству указанных исходных символов
28 /// будет сопоставлен символ в алфавите.
32 /// будет сопоставлен символ в алфавите.
29 /// </summary>
33 /// </summary>
30 /// <param name="symbols">Множестов исходных символов</param>
34 /// <param name="symbols">Множестов исходных символов</param>
31 /// <returns>Идентификатор символа алфавита.</returns>
35 /// <returns>Идентификатор символа алфавита.</returns>
32 int DefineClass(IEnumerable<TSymbol> symbols);
36 int DefineClass(IEnumerable<TSymbol> symbols);
33 /// <summary>
37 /// <summary>
34 /// Создает карту обратного сопоставления символа алфавита и сопоставленным
38 /// Создает карту обратного сопоставления символа алфавита и сопоставленным
35 /// ему исходным символам.
39 /// ему исходным символам.
36 /// </summary>
40 /// </summary>
37 /// <returns></returns>
41 /// <returns></returns>
38 List<TSymbol>[] CreateReverseMap();
42 List<TSymbol>[] CreateReverseMap();
39 /// <summary>
43 /// <summary>
40 /// Создает новый алфавит на основе текущего, горппируя его сиволы в более
44 /// Создает новый алфавит на основе текущего, горппируя его сиволы в более
41 /// крупные непересекающиеся классы символов.
45 /// крупные непересекающиеся классы символов.
42 /// </summary>
46 /// </summary>
43 /// <param name="newAlphabet">Новый, пустой алфавит, в котором быдут определены классы.</param>
47 /// <param name="newAlphabet">Новый, пустой алфавит, в котором быдут определены классы.</param>
44 /// <param name="classes">Множество классов символов текущего алфавита.</param>
48 /// <param name="classes">Множество классов символов текущего алфавита.</param>
45 /// <returns>Карта для перехода символов текущего
49 /// <returns>Карта для перехода символов текущего
46 /// алфавита к символам нового.</returns>
50 /// алфавита к символам нового.</returns>
47 int[] Reclassify(IAlphabet<TSymbol> newAlphabet, IEnumerable<ICollection<int>> classes);
51 int[] Reclassify(IAlphabet<TSymbol> newAlphabet, IEnumerable<ICollection<int>> classes);
48
52
49 /// <summary>
53 /// <summary>
50 /// Преобразует входной символ в индекс символа из алфавита.
54 /// Преобразует входной символ в индекс символа из алфавита.
51 /// </summary>
55 /// </summary>
52 /// <param name="symobl">Исходный символ</param>
56 /// <param name="symobl">Исходный символ</param>
53 /// <returns>Индекс в алфавите</returns>
57 /// <returns>Индекс в алфавите</returns>
54 int Translate(TSymbol symobl);
58 int Translate(TSymbol symobl);
55 }
59 }
56 }
60 }
@@ -1,36 +1,39
1 using System;
1 using System;
2 using System.Collections.Generic;
2 using System.Collections.Generic;
3 using System.Linq;
3 using System.Linq;
4 using System.Text;
4 using System.Text;
5 using System.Threading.Tasks;
5 using System.Threading.Tasks;
6
6
7 namespace Implab.Parsing {
7 namespace Implab.Parsing {
8 /// <summary>
8 /// <summary>
9 /// Интерфейс для определения ДКА, позволяет добавить состояния и определить переходы.
9 /// Интерфейс для определения ДКА, позволяет добавить состояния и определить переходы.
10 /// </summary>
10 /// </summary>
11 public interface IDFADefinition {
11 public interface IDFADefinition {
12 /// <summary>
12 /// <summary>
13 /// Добавляет состояние в автомат.
13 /// Добавляет состояние в автомат.
14 /// </summary>
14 /// </summary>
15 /// <returns>Индекс добавленного состояния.</returns>
15 /// <returns>Индекс добавленного состояния.</returns>
16 int AddState();
16 int AddState();
17 /// <summary>
17 /// <summary>
18 /// Добавляет конечное состояние с указанными метками, если метки не заданы, то
18 /// Добавляет конечное состояние с указанными метками, если метки не заданы, то
19 /// добавленное состояние не будет конечным.
19 /// добавленное состояние не будет конечным.
20 /// </summary>
20 /// </summary>
21 /// <param name="tags">Метки состояния.</param>
21 /// <param name="tags">Метки состояния.</param>
22 /// <returns>Индекс добавленного состояния.</returns>
22 /// <returns>Индекс добавленного состояния.</returns>
23 int AddState(int[] tags);
23 int AddState(int[] tags);
24 /// <summary>
24 /// <summary>
25 /// Определяет переход между состояниями.
25 /// Определяет переход между состояниями.
26 /// </summary>
26 /// </summary>
27 /// <param name="s1">Исходное состояние.</param>
27 /// <param name="s1">Исходное состояние.</param>
28 /// <param name="s2">Конечное состояние.</param>
28 /// <param name="s2">Конечное состояние.</param>
29 /// <param name="input">Входной символ.</param>
29 /// <param name="input">Входной символ.</param>
30 void DefineTransition(int s1, int s2, int input);
30 void DefineTransition(int s1, int s2, int input);
31 /// <summary>
31 /// <summary>
32 /// Размер входного алфавита.
32 /// Размер входного алфавита.
33 /// </summary>
33 /// </summary>
34 /// <remarks>
35 /// Размер входного алфавита определяет количество возможных выходов из одного состояния. <see cref="IAlphabet{TSymbol}.Count"/>
36 /// </remarks>
34 int AlphabetSize { get; }
37 int AlphabetSize { get; }
35 }
38 }
36 }
39 }
@@ -1,258 +1,259
1 using Implab;
1 using Implab;
2 using System;
2 using System;
3 using System.Collections.Generic;
3 using System.Collections.Generic;
4 using System.IO;
4 using System.IO;
5 using Implab.Components;
5 using Implab.Components;
6
6
7 namespace Implab.Parsing {
7 namespace Implab.Parsing {
8 /// <summary>
8 /// <summary>
9 /// Базовый класс для разбора потока входных символов на токены.
9 /// Базовый класс для разбора потока входных символов на токены.
10 /// </summary>
10 /// </summary>
11 /// <remarks>
11 /// <remarks>
12 /// Сканнер имеет внутри буффер с симолами входного текста, по которому перемещаются два
12 /// Сканнер имеет внутри буффер с симолами входного текста, по которому перемещаются два
13 /// указателя, начала и конца токена, при перемещении искользуется ДКА для определения
13 /// указателя, начала и конца токена, при перемещении искользуется ДКА для определения
14 /// конца токена и допустимости текущего символа.
14 /// конца токена и допустимости текущего символа.
15 /// </remarks>
15 /// </remarks>
16 public abstract class Scanner : Disposable {
16 public abstract class Scanner : Disposable {
17 struct ScannerConfig {
17 struct ScannerConfig {
18 public DFAStateDescriptior[] states;
18 public DFAStateDescriptior[] states;
19 public int[] alphabetMap;
19 public int[] alphabetMap;
20 }
20 }
21
21
22 Stack<ScannerConfig> m_defs = new Stack<ScannerConfig>();
22 Stack<ScannerConfig> m_defs = new Stack<ScannerConfig>();
23
23
24 DFAStateDescriptior[] m_states;
24 DFAStateDescriptior[] m_states;
25 int[] m_alphabetMap;
25 int[] m_alphabetMap;
26
26
27 protected DFAStateDescriptior m_currentState;
27 protected DFAStateDescriptior m_currentState;
28 int m_previewCode;
28 int m_previewCode;
29
29
30 protected int m_tokenLen = 0;
30 protected int m_tokenLen = 0;
31 protected int m_tokenOffset;
31 protected int m_tokenOffset;
32
32
33 protected char[] m_buffer;
33 protected char[] m_buffer;
34 protected int m_bufferSize;
34 protected int m_bufferSize;
35 protected int m_pointer;
35 protected int m_pointer;
36
36
37 TextReader m_reader;
37 TextReader m_reader;
38 bool m_disposeReader;
38 bool m_disposeReader;
39 int m_chunkSize = 1024; // 1k
39 int m_chunkSize = 1024; // 1k
40 int m_limit = 10 * 1024 * 1024; // 10Mb
40 int m_limit = 10 * 1024 * 1024; // 10Mb
41
41
42 protected Scanner(CDFADefinition definition) {
42 protected Scanner(DFAStateDescriptior[] states, int[] alphabet) {
43 Safe.ArgumentNotNull(definition, "definition");
43 Safe.ArgumentNotEmpty(states, "states");
44 Safe.ArgumentNotNull(alphabet, "alphabet");
44
45
45 m_states = definition.States;
46 m_states = states;
46 m_alphabetMap = definition.Alphabet.GetTranslationMap();
47 m_alphabetMap = alphabet;
47
48
48 Feed(new char[0]);
49 Feed(new char[0]);
49 }
50 }
50
51
51 /// <summary>
52 /// <summary>
52 /// Заполняет входными данными буффер.
53 /// Заполняет входными данными буффер.
53 /// </summary>
54 /// </summary>
54 /// <param name="data">Данные для обработки.</param>
55 /// <param name="data">Данные для обработки.</param>
55 /// <remarks>Копирование данных не происходит, переданный массив используется в
56 /// <remarks>Копирование данных не происходит, переданный массив используется в
56 /// качестве входного буффера.</remarks>
57 /// качестве входного буффера.</remarks>
57 public void Feed(char[] data) {
58 public void Feed(char[] data) {
58 Safe.ArgumentNotNull(data, "data");
59 Safe.ArgumentNotNull(data, "data");
59
60
60 Feed(data, data.Length);
61 Feed(data, data.Length);
61 }
62 }
62
63
63 /// <summary>
64 /// <summary>
64 /// Заполняет буффур чтения входными данными.
65 /// Заполняет буффур чтения входными данными.
65 /// </summary>
66 /// </summary>
66 /// <param name="data">Данные для обработки.</param>
67 /// <param name="data">Данные для обработки.</param>
67 /// <param name="length">Длина данных для обработки.</param>
68 /// <param name="length">Длина данных для обработки.</param>
68 /// <remarks>Копирование данных не происходит, переданный массив используется в
69 /// <remarks>Копирование данных не происходит, переданный массив используется в
69 /// качестве входного буффера.</remarks>
70 /// качестве входного буффера.</remarks>
70 public void Feed(char[] data, int length) {
71 public void Feed(char[] data, int length) {
71 Safe.ArgumentNotNull(data, "data");
72 Safe.ArgumentNotNull(data, "data");
72 Safe.ArgumentInRange(length, 0, data.Length, "length");
73 Safe.ArgumentInRange(length, 0, data.Length, "length");
73 AssertNotDisposed();
74 AssertNotDisposed();
74
75
75 m_pointer = -1;
76 m_pointer = -1;
76 m_buffer = data;
77 m_buffer = data;
77 m_bufferSize = length;
78 m_bufferSize = length;
78 Shift();
79 Shift();
79 }
80 }
80
81
81 public void Feed(TextReader reader, bool dispose) {
82 public void Feed(TextReader reader, bool dispose) {
82 Safe.ArgumentNotNull(reader, "reader");
83 Safe.ArgumentNotNull(reader, "reader");
83 AssertNotDisposed();
84 AssertNotDisposed();
84
85
85 if (m_reader != null && m_disposeReader)
86 if (m_reader != null && m_disposeReader)
86 m_reader.Dispose();
87 m_reader.Dispose();
87
88
88 m_reader = reader;
89 m_reader = reader;
89 m_disposeReader = dispose;
90 m_disposeReader = dispose;
90 m_pointer = -1;
91 m_pointer = -1;
91 m_buffer = new char[m_chunkSize];
92 m_buffer = new char[m_chunkSize];
92 m_bufferSize = 0;
93 m_bufferSize = 0;
93 Shift();
94 Shift();
94 }
95 }
95
96
96 /// <summary>
97 /// <summary>
97 /// Получает текущий токен в виде строки.
98 /// Получает текущий токен в виде строки.
98 /// </summary>
99 /// </summary>
99 /// <returns></returns>
100 /// <returns></returns>
100 protected string GetTokenValue() {
101 protected string GetTokenValue() {
101 return new String(m_buffer, m_tokenOffset, m_tokenLen);
102 return new String(m_buffer, m_tokenOffset, m_tokenLen);
102 }
103 }
103
104
104 /// <summary>
105 /// <summary>
105 /// Метки текущего токена, которые были назначены в регулярном выражении.
106 /// Метки текущего токена, которые были назначены в регулярном выражении.
106 /// </summary>
107 /// </summary>
107 protected int[] TokenTags {
108 protected int[] TokenTags {
108 get {
109 get {
109 return m_currentState.tag;
110 return m_currentState.tag;
110 }
111 }
111 }
112 }
112
113
113 /// <summary>
114 /// <summary>
114 /// Признак конца данных
115 /// Признак конца данных
115 /// </summary>
116 /// </summary>
116 public bool EOF {
117 public bool EOF {
117 get {
118 get {
118 return m_pointer >= m_bufferSize;
119 return m_pointer >= m_bufferSize;
119 }
120 }
120 }
121 }
121
122
122 /// <summary>
123 /// <summary>
123 /// Читает следующий токен, при этом <see cref="m_tokenOffset"/> указывает на начало токена,
124 /// Читает следующий токен, при этом <see cref="m_tokenOffset"/> указывает на начало токена,
124 /// <see cref="m_tokenLen"/> на длину токена, <see cref="m_buffer"/> - массив символов, в
125 /// <see cref="m_tokenLen"/> на длину токена, <see cref="m_buffer"/> - массив символов, в
125 /// котором находится токен.
126 /// котором находится токен.
126 /// </summary>
127 /// </summary>
127 /// <returns><c>false</c> - достигнут конец данных, токен не прочитан.</returns>
128 /// <returns><c>false</c> - достигнут конец данных, токен не прочитан.</returns>
128 protected bool ReadTokenInternal() {
129 protected bool ReadTokenInternal() {
129 if (m_pointer >= m_bufferSize)
130 if (m_pointer >= m_bufferSize)
130 return false;
131 return false;
131
132
132 m_currentState = m_states[CDFADefinition.INITIAL_STATE];
133 m_currentState = m_states[DFADefinition.INITIAL_STATE];
133 m_tokenLen = 0;
134 m_tokenLen = 0;
134 m_tokenOffset = m_pointer;
135 m_tokenOffset = m_pointer;
135 int nextState = CDFADefinition.UNREACHEBLE_STATE;
136 int nextState;
136 do {
137 do {
137 nextState = m_currentState.transitions[m_previewCode];
138 nextState = m_currentState.transitions[m_previewCode];
138 if (nextState == CDFADefinition.UNREACHEBLE_STATE) {
139 if (nextState == DFADefinition.UNREACHEBLE_STATE) {
139 if (m_currentState.final)
140 if (m_currentState.final)
140 return true;
141 return true;
141 else
142 else
142 throw new ParserException(
143 throw new ParserException(
143 String.Format(
144 String.Format(
144 "Unexpected symbol '{0}', at pos {1}",
145 "Unexpected symbol '{0}', at pos {1}",
145 m_buffer[m_pointer],
146 m_buffer[m_pointer],
146 Position
147 Position
147 )
148 )
148 );
149 );
149 } else {
150 } else {
150 m_currentState = m_states[nextState];
151 m_currentState = m_states[nextState];
151 m_tokenLen++;
152 m_tokenLen++;
152 }
153 }
153
154
154 } while (Shift());
155 } while (Shift());
155
156
156 // END OF DATA
157 // END OF DATA
157 if (!m_currentState.final)
158 if (!m_currentState.final)
158 throw new ParserException("Unexpected end of data");
159 throw new ParserException("Unexpected end of data");
159
160
160 return true;
161 return true;
161 }
162 }
162
163
163
164
164 bool Shift() {
165 bool Shift() {
165 m_pointer++;
166 m_pointer++;
166
167
167 if (m_pointer >= m_bufferSize) {
168 if (m_pointer >= m_bufferSize) {
168 if (!ReadNextChunk())
169 if (!ReadNextChunk())
169 return false;
170 return false;
170 }
171 }
171
172
172 m_previewCode = m_alphabetMap[m_buffer[m_pointer]];
173 m_previewCode = m_alphabetMap[m_buffer[m_pointer]];
173
174
174 return true;
175 return true;
175 }
176 }
176
177
177 bool ReadNextChunk() {
178 bool ReadNextChunk() {
178 if (m_reader == null)
179 if (m_reader == null)
179 return false;
180 return false;
180
181
181 // extend buffer if nesessary
182 // extend buffer if nesessary
182 if (m_pointer + m_chunkSize > m_buffer.Length) {
183 if (m_pointer + m_chunkSize > m_buffer.Length) {
183 // trim unused buffer head
184 // trim unused buffer head
184 var size = m_tokenLen + m_chunkSize;
185 var size = m_tokenLen + m_chunkSize;
185 if (size >= m_limit)
186 if (size >= m_limit)
186 throw new ParserException(String.Format("Input buffer {0} bytes limit exceeded", m_limit));
187 throw new ParserException(String.Format("Input buffer {0} bytes limit exceeded", m_limit));
187 var temp = new char[size];
188 var temp = new char[size];
188 Array.Copy(m_buffer, m_tokenOffset, temp, 0, m_tokenLen);
189 Array.Copy(m_buffer, m_tokenOffset, temp, 0, m_tokenLen);
189 m_pointer -= m_tokenOffset;
190 m_pointer -= m_tokenOffset;
190 m_bufferSize -= m_tokenOffset;
191 m_bufferSize -= m_tokenOffset;
191 m_tokenOffset = 0;
192 m_tokenOffset = 0;
192 m_buffer = temp;
193 m_buffer = temp;
193 }
194 }
194
195
195 var read = m_reader.Read(m_buffer, m_tokenLen, m_chunkSize);
196 var read = m_reader.Read(m_buffer, m_tokenLen, m_chunkSize);
196 if (read == 0)
197 if (read == 0)
197 return false;
198 return false;
198
199
199 m_bufferSize += read;
200 m_bufferSize += read;
200
201
201 return true;
202 return true;
202 }
203 }
203
204
204 /// <summary>
205 /// <summary>
205 /// Позиция сканнера во входном буфере
206 /// Позиция сканнера во входном буфере
206 /// </summary>
207 /// </summary>
207 public int Position {
208 public int Position {
208 get {
209 get {
209 return m_pointer + 1;
210 return m_pointer + 1;
210 }
211 }
211 }
212 }
212
213
213 /// <summary>
214 /// <summary>
214 /// Преключает внутренний ДКА на указанный, позволяет реализовать подобие захватывающей
215 /// Преключает внутренний ДКА на указанный, позволяет реализовать подобие захватывающей
215 /// группировки.
216 /// группировки.
216 /// </summary>
217 /// </summary>
217 /// <param name="states">Таблица состояний нового ДКА</param>
218 /// <param name="states">Таблица состояний нового ДКА</param>
218 /// <param name="alphabet">Таблица входных символов для нового ДКА</param>
219 /// <param name="alphabet">Таблица входных символов для нового ДКА</param>
219 protected void Switch(DFAStateDescriptior[] states, int[] alphabet) {
220 protected void Switch(DFAStateDescriptior[] states, int[] alphabet) {
220 Safe.ArgumentNotNull(states, "dfa");
221 Safe.ArgumentNotNull(states, "dfa");
221
222
222 m_defs.Push(new ScannerConfig {
223 m_defs.Push(new ScannerConfig {
223 states = m_states,
224 states = m_states,
224 alphabetMap = m_alphabetMap
225 alphabetMap = m_alphabetMap
225 });
226 });
226
227
227 m_states = states;
228 m_states = states;
228 m_alphabetMap = alphabet;
229 m_alphabetMap = alphabet;
229
230
230 m_previewCode = m_alphabetMap[m_buffer[m_pointer]];
231 m_previewCode = m_alphabetMap[m_buffer[m_pointer]];
231 }
232 }
232
233
233 /// <summary>
234 /// <summary>
234 /// Восстанавливает предыдущей ДКА сканнера.
235 /// Восстанавливает предыдущей ДКА сканнера.
235 /// </summary>
236 /// </summary>
236 protected void Restore() {
237 protected void Restore() {
237 if (m_defs.Count == 0)
238 if (m_defs.Count == 0)
238 throw new InvalidOperationException();
239 throw new InvalidOperationException();
239 var prev = m_defs.Pop();
240 var prev = m_defs.Pop();
240 m_states = prev.states;
241 m_states = prev.states;
241 m_alphabetMap = prev.alphabetMap;
242 m_alphabetMap = prev.alphabetMap;
242 m_previewCode = m_alphabetMap[m_buffer[m_pointer]];
243 m_previewCode = m_alphabetMap[m_buffer[m_pointer]];
243 }
244 }
244
245
245 protected override void Dispose(bool disposing) {
246 protected override void Dispose(bool disposing) {
246 if (disposing) {
247 if (disposing) {
247 if (m_reader != null && m_disposeReader)
248 if (m_reader != null && m_disposeReader)
248 m_reader.Dispose();
249 m_reader.Dispose();
249 m_buffer = null;
250 m_buffer = null;
250 m_bufferSize = 0;
251 m_bufferSize = 0;
251 m_pointer = 0;
252 m_pointer = 0;
252 m_tokenLen = 0;
253 m_tokenLen = 0;
253 m_tokenOffset = 0;
254 m_tokenOffset = 0;
254 }
255 }
255 base.Dispose(disposing);
256 base.Dispose(disposing);
256 }
257 }
257 }
258 }
258 }
259 }
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now