Example #1
0
 HighlightColor GetColor(HighlightRuleSet ruleSet, IDocument document, LineSegment currentSegment, int currentOffset, int currentLength)
 {
     if (ruleSet != null)
     {
         if (ruleSet.Reference != null)
         {
             return(ruleSet.Highlighter.GetColor(document, currentSegment, currentOffset, currentLength));
         }
         else
         {
             return((HighlightColor)ruleSet.KeyWords[document, currentSegment, currentOffset, currentLength]);
         }
     }
     return(null);
 }
Example #2
0
        void ResolveRuleSetReferences()
        {
            foreach (HighlightRuleSet ruleSet in Rules)
            {
                if (ruleSet.Name == null)
                {
                    defaultRuleSet = ruleSet;
                }

                foreach (Span aSpan in ruleSet.Spans)
                {
                    if (aSpan.Rule != null)
                    {
                        bool found = false;
                        foreach (HighlightRuleSet refSet in Rules)
                        {
                            if (refSet.Name == aSpan.Rule)
                            {
                                found         = true;
                                aSpan.RuleSet = refSet;
                                break;
                            }
                        }
                        if (!found)
                        {
                            MessageBox.Show("The RuleSet " + aSpan.Rule + " could not be found in mode definition " + this.Name, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                            aSpan.RuleSet = null;
                        }
                    }
                    else
                    {
                        aSpan.RuleSet = null;
                    }
                }
            }

            if (defaultRuleSet == null)
            {
                MessageBox.Show("No default RuleSet is defined for mode definition " + this.Name, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
            }
        }
Example #3
0
 void UpdateSpanStateVariables()
 {
     inSpan        = (currentSpanStack != null && currentSpanStack.Count > 0);
     activeSpan    = inSpan ? (Span)currentSpanStack.Peek() : null;
     activeRuleSet = GetRuleSet(activeSpan);
 }
Example #4
0
 public void AddRuleSet(HighlightRuleSet aRuleSet)
 {
     rules.Add(aRuleSet);
 }