public ContextPossibilityMatchContainer(ContextEntry contextEntry, GeneroAst parentTree) { _parentTree = parentTree; _matchingRound = 0; _flatMatchingSet = new Dictionary <object, List <BackwardTokenSearchItem> >(); _flatNonMatchingSet = new HashSet <object>(); _possibilitiesWithNoBackwardSearch = new List <ContextPossibility>(); InitializeQueues(contextEntry); }
private void InitializeQueues(ContextEntry contextEntry) { foreach (var possibility in contextEntry.ContextPossibilities) { if (possibility.BackwardSearchItems.Length > 0) { foreach (var searchItem in possibility.BackwardSearchItems) { searchItem.ParentContext = possibility; object key = TokenKind.EndOfFile; if (searchItem.TokenSet == null) { key = searchItem.SingleToken; } else { key = searchItem.TokenSet.Set[0].Token; } if (_flatMatchingSet.ContainsKey(key)) { _flatMatchingSet[key].Add(searchItem); } else { _flatMatchingSet.Add(key, new List <BackwardTokenSearchItem> { searchItem }); } if (!searchItem.Match) { _flatNonMatchingSet.Add(key); } } } else { _possibilitiesWithNoBackwardSearch.Add(possibility); } } }
internal bool TryGetValue(object key, out ContextEntry value) { return(_contextMap.TryGetValue(key, out value)); }
internal void Add(object key, ContextEntry contextEntry) { _contextMap.Add(key, contextEntry); }