private static void AppendCommonOptions(SyntaxItem item, StringBuilder firstLine) { if (item.IsContained) { firstLine.Append(" contained"); } if (item.IsTransparent) { firstLine.Append(" transparent"); } if (item is ContainerItem && (item as ContainerItem).Extend) { firstLine.Append(" extend"); } if (item is Region && (item as Region).IsOneLine) { firstLine.Append(" oneline"); } if (item is Region && (item as Region).KeepEnd) { firstLine.Append(" keepend"); } if (0 < item.ContainedIn.ContainedGroupsAndClusters.Count) { firstLine.AppendFormat(" containedin={0}", item.ContainedIn); } if (item is ContainerItem && 0 < (item as ContainerItem).Contains.ContainedGroupsAndClusters.Count) { firstLine.AppendFormat(" contains={0}", (item as ContainerItem).Contains); } if (0 < item.NextGroupCluster.ContainedGroupsAndClusters.Count) { firstLine.AppendFormat(" nextgroup={0}", item.NextGroupCluster); if (item.SkipEmptyLine) { firstLine.Append(" skipempty"); } if (item.SkipNewLine) { firstLine.Append(" skipnl"); } if (item.SkipWhite) { firstLine.Append(" skipwhite"); } } }
private SetOfSyntaxItems GetMemberItems(List <string> clustersBeingResolved) { if (this.m_cachedMemberItems != null) { // sometimes we get called after final membership was calculated and cached. This happens when CacheFinalSetMembership() is // being called for each cluster, and some have already have had their final memberships calculated, but others haven't. // Sometimes a cluster gets called later on, and then calls GetMemberItems() for a cluster that already has final cached // information available. If that's the case, we just return it. return(this.m_cachedMemberItems); } if (this.IsNamedCluster) { clustersBeingResolved.Add(this.m_clusterName); } IEnumerable <SyntaxItem> items; switch (this.ClusterType) { case ClusterType.ALL: items = this.SyntaxContext.AllItems; break; case ClusterType.ALLBUT: items = Extensions.Except(this.SyntaxContext.AllItems, this.GetItemsInMySets(clustersBeingResolved)); break; case ClusterType.CONTAINED: items = Extensions.Except(this.SyntaxContext.NonTopItems.Items, this.GetItemsInMySets(clustersBeingResolved)); break; case ClusterType.NONE: items = new SyntaxItem[0]; break; case ClusterType.NONMAGIC: items = this.GetItemsInMySets(clustersBeingResolved); break; case ClusterType.TOP: items = Extensions.Except(this.SyntaxContext.TopItems.Items, this.GetItemsInMySets(clustersBeingResolved)); break; default: throw new AssertionViolationException(StringExtensions.Fi("Unknown ClusterType {0}", this.ClusterType)); } clustersBeingResolved.Remove(this.m_clusterName); SetOfSyntaxItems myItems = new SetOfSyntaxItems(items); myItems.AddRange(this.m_directItems.Items); return(myItems); }
internal SyntaxItem Add(SyntaxItem item) { this.EnsureDefinitionTime(); int idxItem = this.m_itemsIncludedSoFar.BinarySearch(item); if (0 <= idxItem) { return(item); } this.m_itemsIncludedSoFar.Insert(~idxItem, item); this.m_items = null; return(item); }
internal void AddSyntaxItem(string groupName, SyntaxItem syntaxItem) { syntaxItem.PositionInSyntaxDefinition = this.m_cntAllSyntaxItems; syntaxItem.GroupName = groupName; syntaxItem.Context.AllItems.Add(syntaxItem); this.GetGroup(groupName).AddChildItem(syntaxItem); for (int i = 0; i < syntaxItem.Context.TopClusters.Count; i++) { syntaxItem.Context.TopClusters[i].AddDirectItem(syntaxItem); } this.m_cntAllSyntaxItems++; return; }
internal bool Remove(SyntaxItem item) { this.EnsureDefinitionTime(); int idxItem = this.m_itemsIncludedSoFar.BinarySearch(item); if (0 <= idxItem) { this.m_itemsIncludedSoFar.RemoveAt(idxItem); this.m_items = null; return(true); } else { return(false); } }
private void DoKeywordMatch(SyntaxItem matchedKeyword, int posAfterKeyword) { int posKeywordStart = this.Reader.PosCurrent; if (!matchedKeyword.IsTransparent) { this.TrimModesAtAndAfter(posKeywordStart); this.m_modes.Add(new KeyValuePair <int, HighlightMode>(posKeywordStart, matchedKeyword.HighlightMode)); this.BuildHighlightModes(posAfterKeyword); } if (this.TopScope.SyntaxItem is NextGroup) { this.PopScope(posAfterKeyword); } else { this.TopScope.TryClearStaleEnd(); } NextGroup.Instance.TryStartNextGroup(this, matchedKeyword, posAfterKeyword); return; }
internal void PushScope(Scope newScope) { SyntaxItem newTopItem = newScope.SyntaxItem; bool previouslyExtending = this.TopScope.Extend; bool previouslyWithinKeepEnd = this.TopScope.IsWithinKeepEnd; if (this.TopScope.SyntaxItem is NextGroup) { this.m_scopeStack[this.m_scopeStack.Count - 1] = newScope; } else { this.m_scopeStack.Add(newScope); } this.TopScope.Extend |= previouslyExtending && !previouslyWithinKeepEnd; this.TopScope.IsWithinKeepEnd |= !this.TopScope.Extend && previouslyWithinKeepEnd; if (!newTopItem.IsTransparent || newScope.IsRegionWithMatchGroupEnd) { this.BuildHighlightModes(newScope.PosHighlightStart); } }
internal void AddDirectItem(SyntaxItem syntaxItem) { this.m_directItems.Add(syntaxItem); }
internal bool Contains(SyntaxItem item) { this.EnsureDefinitionTime(); return(0 <= this.m_itemsIncludedSoFar.BinarySearch(item)); }
internal void AddChildItem(SyntaxItem syntaxItem) { ArgumentValidator.ThrowIfNull(syntaxItem, "syntaxItem"); this.Items.Add(syntaxItem); }