Exemple #1
0
 private HighlightColor GetColor(HighlightRuleSet ruleSet, IDocument document, LineSegment currentSegment, int currentOffset, int currentLength)
 {
     if (ruleSet == null)
     {
         return(null);
     }
     if (ruleSet.Reference != null)
     {
         return(ruleSet.Highlighter.GetColor(document, currentSegment, currentOffset, currentLength));
     }
     return((HighlightColor)ruleSet.KeyWords[document, currentSegment, currentOffset, currentLength]);
 }
Exemple #2
0
 private void ResolveRuleSetReferences()
 {
     foreach (HighlightRuleSet highlightRuleSet in this.Rules)
     {
         if (highlightRuleSet.Name == null)
         {
             this.defaultRuleSet = highlightRuleSet;
         }
         foreach (Span span in highlightRuleSet.Spans)
         {
             if (span.Rule != null)
             {
                 bool flag = false;
                 foreach (HighlightRuleSet highlightRuleSet2 in this.Rules)
                 {
                     if (highlightRuleSet2.Name == span.Rule)
                     {
                         flag         = true;
                         span.RuleSet = highlightRuleSet2;
                         break;
                     }
                 }
                 if (!flag)
                 {
                     MessageBox.Show("The RuleSet " + span.Rule + " could not be found in mode definition " + this.Name, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                     span.RuleSet = null;
                 }
             }
             else
             {
                 span.RuleSet = null;
             }
         }
     }
     if (this.defaultRuleSet == null)
     {
         MessageBox.Show("No default RuleSet is defined for mode definition " + this.Name, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
     }
 }
Exemple #3
0
 private void UpdateSpanStateVariables()
 {
     this.inSpan        = (this.currentSpanStack != null && this.currentSpanStack.Count > 0);
     this.activeSpan    = (this.inSpan ? ((Span)this.currentSpanStack.Peek()) : null);
     this.activeRuleSet = this.GetRuleSet(this.activeSpan);
 }
Exemple #4
0
 public void AddRuleSet(HighlightRuleSet aRuleSet)
 {
     this.rules.Add(aRuleSet);
 }