-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from PositiveTechnologies/dev
TextSpan for reduced nodes and C# conversion fixes.
- Loading branch information
Showing
24 changed files
with
287 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
[submodule "Sources/AspxParser"] | ||
path = Sources/AspxParser | ||
url = https://github.com/PositiveTechnologies/AspxParser.git | ||
branch = master | ||
[submodule "Sources/antlr-grammars-v4"] | ||
path = Sources/antlr-grammars-v4 | ||
url = https://github.com/PositiveTechnologies/grammars-v4.git | ||
branch = master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace PT.PM.Common | ||
{ | ||
/// <summary> | ||
/// An alternative to .NET Dictionary class that allows duplicate keys, | ||
/// and is still mutable (unlike the Lookup class). | ||
/// </summary> | ||
/// <remarks> | ||
/// Inspired by http://stackoverflow.com/questions/146204/duplicate-keys-in-net-dictionaries | ||
/// </remarks> | ||
public class MultiMap<TKey, TValue> | ||
{ | ||
private readonly Dictionary<TKey, List<TValue>> storage = new Dictionary<TKey, List<TValue>>(); | ||
|
||
public IEnumerable<TKey> Keys => storage.Keys; | ||
|
||
public int Count => storage.Count; | ||
|
||
public MultiMap() | ||
{ | ||
} | ||
|
||
public MultiMap(IEnumerable<KeyValuePair<TKey, TValue>> data) | ||
{ | ||
foreach (KeyValuePair<TKey, TValue> pair in data) | ||
{ | ||
Add(pair.Key, pair.Value); | ||
} | ||
} | ||
|
||
public void Add(TKey key, TValue value) | ||
{ | ||
if (!storage.TryGetValue(key, out List<TValue> storageValue)) | ||
{ | ||
storageValue = new List<TValue>(); | ||
storage[key] = storageValue; | ||
} | ||
storageValue.Add(value); | ||
} | ||
|
||
public void Clear() | ||
{ | ||
storage.Clear(); | ||
} | ||
|
||
public bool ContainsKey(TKey key) | ||
{ | ||
return storage.ContainsKey(key); | ||
} | ||
|
||
public bool TryGetValue(TKey key, out List<TValue> value) => storage.TryGetValue(key, out value); | ||
|
||
public List<TValue> this[TKey key] => | ||
storage.TryGetValue(key, out List<TValue> storageValue) | ||
? storageValue | ||
: new List<TValue>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.