private void ParseBlock(XmlNode node)
        {
            string Name = "", Style = "";
            bool IsMultiline = false;
            bool TerminateChildren = false;
            Color BackColor = Color.Transparent;
            foreach (XmlAttribute att in node.Attributes)
            {
                if (att.Name.ToLowerInvariant() == "name")
                    Name = att.Value;
                if (att.Name.ToLowerInvariant() == "style")
                    Style = att.Value;
                if (att.Name.ToLowerInvariant() == "ismultiline")
                    IsMultiline = bool.Parse(att.Value);
                if (att.Name.ToLowerInvariant() == "terminatechildren")
                    TerminateChildren = bool.Parse(att.Value);
                if (att.Name.ToLowerInvariant() == "backcolor")
                {
                    BackColor = Color.FromName(att.Value);
                    //Transparent =false;
                }
            }

            //create block object here
            SpanDefinition bl = GetBlock(Name);
            bl.BackColor = BackColor;
            bl.Name = Name;
            bl.MultiLine = IsMultiline;
            bl.Style = GetStyle(Style);
            bl.TerminateChildren = TerminateChildren;

            foreach (XmlNode n in node.ChildNodes)
            {
                if (n.NodeType == XmlNodeType.Element)
                {
                    if (n.Name.ToLowerInvariant() == "scope")
                    {
                        //bool IsComplex=false;
                        //bool IsSeparator=false;
                        string Start = "";
                        string End = "";
                        string style = "";
                        string text = "";
                        string EndIsSeparator = "";
                        string StartIsComplex = "false";
                        string EndIsComplex = "false";
                        string StartIsKeyword = "false";
                        string EndIsKeyword = "false";
                        string spawnStart = "";
                        string spawnEnd = "";
                        string EscapeChar = "";
                        string CauseIndent = "false";

                        bool expanded = true;

                        foreach (XmlAttribute att in n.Attributes)
                        {
                            switch (att.Name.ToLowerInvariant())
                            {
                                case "start":
                                    Start = att.Value;
                                    break;
                                case "escapechar":
                                    EscapeChar = att.Value;
                                    break;
                                case "end":
                                    End = att.Value;
                                    break;
                                case "style":
                                    style = att.Value;
                                    break;
                                case "text":
                                    text = att.Value;
                                    break;
                                case "defaultexpanded":
                                    expanded = bool.Parse(att.Value);
                                    break;
                                case "endisseparator":
                                    EndIsSeparator = att.Value;
                                    break;
                                case "startiskeyword":
                                    StartIsKeyword = att.Value;
                                    break;
                                case "startiscomplex":
                                    StartIsComplex = att.Value;
                                    break;
                                case "endiscomplex":
                                    EndIsComplex = att.Value;
                                    break;
                                case "endiskeyword":
                                    EndIsKeyword = att.Value;
                                    break;
                                case "spawnblockonstart":
                                    spawnStart = att.Value;
                                    break;
                                case "spawnblockonend":
                                    spawnEnd = att.Value;
                                    break;
                                case "causeindent":
                                    CauseIndent = att.Value;
                                    break;
                            }
                        }
                        if (Start != "")
                        {
                            //bl.StartPattern =new Pattern (Pattern,IsComplex,false,IsSeparator);
                            //bl.StartPatterns.Add (new Pattern (Pattern,IsComplex,IsSeparator,true));
                            bool blnStartIsComplex = bool.Parse(StartIsComplex);
                            bool blnEndIsComplex = bool.Parse(EndIsComplex);
                            bool blnCauseIndent = bool.Parse(CauseIndent);

                            var scope = new Scope {Style = GetStyle(style), ExpansionText = text, DefaultExpanded = expanded, CauseIndent = blnCauseIndent};

                            var StartP = new Pattern(Start, blnStartIsComplex, false, bool.Parse(StartIsKeyword));
                            Pattern endPattern = EscapeChar != "" ? new Pattern(End, false, bool.Parse(EndIsKeyword), EscapeChar) : new Pattern(End, blnEndIsComplex, false, bool.Parse(EndIsKeyword));

                            if (EndIsSeparator != "")
                                endPattern.IsSeparator = bool.Parse(EndIsSeparator);

                            scope.Start = StartP;
                            scope.EndPatterns.Add(endPattern);
                            bl.ScopePatterns.Add(scope);
                            if (spawnStart != "")
                            {
                                scope.spawnSpanOnStart = GetBlock(spawnStart);
                            }
                            if (spawnEnd != "")
                            {
                                scope.spawnSpanOnEnd = GetBlock(spawnEnd);
                            }
                        }
                    }
                    if (n.Name.ToLowerInvariant() == "bracket")
                    {
                        //bool IsComplex=false;
                        //bool IsSeparator=false;
                        string Start = "";
                        string End = "";
                        string style = "";

                        string StartIsComplex = "false";
                        string EndIsComplex = "false";

                        string StartIsKeyword = "false";
                        string EndIsKeyword = "false";
                        string IsMultiLineB = "true";

                        foreach (XmlAttribute att in n.Attributes)
                        {
                            switch (att.Name.ToLowerInvariant())
                            {
                                case "start":
                                    Start = att.Value;
                                    break;
                                case "end":
                                    End = att.Value;
                                    break;
                                case "style":
                                    style = att.Value;
                                    break;
                                case "endisseparator":
                                    if (att.Name.ToLowerInvariant() == "startisseparator")
                                        if (att.Name.ToLowerInvariant() == "startiskeyword")
                                            StartIsKeyword = att.Value;
                                    break;
                                case "startiscomplex":
                                    StartIsComplex = att.Value;
                                    break;
                                case "endiscomplex":
                                    EndIsComplex = att.Value;
                                    break;
                                case "endiskeyword":
                                    EndIsKeyword = att.Value;
                                    break;
                                case "ismultiline":
                                    IsMultiLineB = att.Value;
                                    break;
                            }
                        }
                        if (Start != "")
                        {
                            var pl = new PatternList {Style = GetStyle(style)};

                            bool blnStartIsComplex = bool.Parse(StartIsComplex);
                            bool blnEndIsComplex = bool.Parse(EndIsComplex);
                            bool blnIsMultiLineB = bool.Parse(IsMultiLineB);

                            var StartP = new Pattern(Start, blnStartIsComplex, false, bool.Parse(StartIsKeyword));
                            var EndP = new Pattern(End, blnEndIsComplex, false, bool.Parse(EndIsKeyword));

                            StartP.MatchingBracket = EndP;
                            EndP.MatchingBracket = StartP;
                            StartP.BracketType = BracketType.StartBracket;
                            EndP.BracketType = BracketType.EndBracket;
                            StartP.IsMultiLineBracket = EndP.IsMultiLineBracket = blnIsMultiLineB;

                            pl.Add(StartP);
                            pl.Add(EndP);
                            bl.OperatorsList.Add(pl);
                        }
                    }
                }

                if (n.Name.ToLowerInvariant() == "keywords")
                    foreach (XmlNode cn in n.ChildNodes)
                    {
                        if (cn.Name.ToLowerInvariant() == "patterngroup")
                        {
                            var pl = new PatternList();
                            bl.KeywordsList.Add(pl);
                            foreach (XmlAttribute att in cn.Attributes)
                            {
                                switch (att.Name.ToLowerInvariant())
                                {
                                    case "style":
                                        pl.Style = GetStyle(att.Value);
                                        break;
                                    case "name":
                                        pl.Name = att.Value;
                                        break;
                                    case "normalizecase":
                                        pl.NormalizeCase = bool.Parse(att.Value);
                                        break;
                                    case "casesensitive":
                                        pl.CaseSensitive = bool.Parse(att.Value);
                                        break;
                                }
                            }
                            foreach (XmlNode pt in cn.ChildNodes)
                            {
                                if (pt.Name.ToLowerInvariant() == "pattern")
                                {
                                    bool IsComplex = false;
                                    bool IsSeparator = false;
                                    string Category = null;
                                    string Pattern = "";
                                    if (pt.Attributes != null)
                                    {
                                        foreach (XmlAttribute att in pt.Attributes)
                                        {
                                            switch (att.Name.ToLowerInvariant())
                                            {
                                                case "text":
                                                    Pattern = att.Value;
                                                    break;
                                                case "iscomplex":
                                                    IsComplex = bool.Parse(att.Value);
                                                    break;
                                                case "isseparator":
                                                    IsSeparator = bool.Parse(att.Value);
                                                    break;
                                                case "category":
                                                    Category = (att.Value);
                                                    break;
                                            }
                                        }
                                    }
                                    if (Pattern != "")
                                    {
                                        var pat = new Pattern(Pattern, IsComplex, IsSeparator, true) {Category = Category};
                                        pl.Add(pat);
                                    }
                                }
                                else if (pt.Name.ToLowerInvariant() == "patterns")
                                {
                                    string Patterns = pt.ChildNodes[0].Value;
                                    Patterns = Patterns.Replace("\t", " ");
                                    while (Patterns.IndexOf("  ") >= 0)
                                        Patterns = Patterns.Replace("  ", " ");

                                    foreach (string Pattern in Patterns.Split())
                                    {
                                        if (Pattern != "")
                                            pl.Add(new Pattern(Pattern, false, false, true));
                                    }
                                }
                            }
                        }
                    }
                //if (n.Name == "Operators")
                //	ParseStyle(n);
                if (n.Name.ToLowerInvariant() == "operators")
                    foreach (XmlNode cn in n.ChildNodes)
                    {
                        if (cn.Name.ToLowerInvariant() == "patterngroup")
                        {
                            var pl = new PatternList();
                            bl.OperatorsList.Add(pl);
                            foreach (XmlAttribute att in cn.Attributes)
                            {
                                switch (att.Name.ToLowerInvariant())
                                {
                                    case "style":
                                        pl.Style = GetStyle(att.Value);
                                        break;
                                    case "name":
                                        pl.Name = att.Value;
                                        break;
                                    case "normalizecase":
                                        pl.NormalizeCase = bool.Parse(att.Value);
                                        break;
                                    case "casesensitive":
                                        pl.CaseSensitive = bool.Parse(att.Value);
                                        break;
                                }
                            }

                            foreach (XmlNode pt in cn.ChildNodes)
                            {
                                if (pt.Name.ToLowerInvariant() == "pattern")
                                {
                                    bool IsComplex = false;
                                    bool IsSeparator = false;
                                    string Pattern = "";
                                    string Category = null;
                                    if (pt.Attributes != null)
                                    {
                                        foreach (XmlAttribute att in pt.Attributes)
                                        {
                                            switch (att.Name.ToLowerInvariant())
                                            {
                                                case "text":
                                                    Pattern = att.Value;
                                                    break;
                                                case "iscomplex":
                                                    IsComplex = bool.Parse(att.Value);
                                                    break;
                                                case "isseparator":
                                                    IsSeparator = bool.Parse(att.Value);
                                                    break;
                                                case "category":
                                                    Category = (att.Value);
                                                    break;
                                            }
                                        }
                                    }
                                    if (Pattern != "")
                                    {
                                        var pat = new Pattern(Pattern, IsComplex, IsSeparator, false) {Category = Category};
                                        pl.Add(pat);
                                    }
                                }
                                else if (pt.Name.ToLowerInvariant() == "patterns")
                                {
                                    string Patterns = pt.ChildNodes[0].Value;
                                    Patterns = Patterns.Replace("\t", " ");
                                    while (Patterns.IndexOf("  ") >= 0)
                                        Patterns = Patterns.Replace("  ", " ");

                                    foreach (string Pattern in Patterns.Split())
                                    {
                                        if (Pattern != "")
                                            pl.Add(new Pattern(Pattern, false, false, false));
                                    }
                                }
                            }
                        }
                    }

                if (n.Name.ToLowerInvariant() == "childblocks")
                {
                    foreach (XmlNode cn in n.ChildNodes)
                    {
                        if (cn.Name.ToLowerInvariant() == "child")
                        {
                            foreach (XmlAttribute att in cn.Attributes)
                                if (att.Name.ToLowerInvariant() == "name")
                                    bl.childSpanDefinitions.Add(GetBlock(att.Value));
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public Word GetEndBracketWord(Word Start, Pattern End, Span FindIn)
        {
            if (Start == null || Start.Pattern == null || Start.Span == null)
                return null;

            int CurrentRow = Start.Row.Index;

            int LastRow = Count - 1;
            if (FindIn.EndRow != null)
                LastRow = FindIn.EndRow.Index;


            int x = Start.Index;
            int count = 0;
            while (CurrentRow <= LastRow)
            {
                for (int i = x; i < this[CurrentRow].Count; i++)
                {
                    Word w = this[CurrentRow][i];
                    if (w.Span == FindIn && w.Type == WordType.Word)
                    {
                        if (w.Pattern == Start.Pattern)
                            count++;
                        if (w.Pattern == End)
                            count--;

                        if (count == 0)
                            return w;
                    }
                }

                if (!Start.Pattern.IsMultiLineBracket)
                    break;

                CurrentRow++;
                x = 0;
            }
            return null;
        }
Beispiel #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Pattern"></param>
        /// <returns></returns>
        public Pattern Add(Pattern Pattern)
        {
            if (Parent != null && Parent.Parent != null &&
                Parent.Parent.Parent != null)
            {
                Pattern.Separators = Parent.Parent.Parent.Separators;
                Parent.Parent.Parent.ChangeVersion();
            }

            if (!Pattern.IsComplex && !Pattern.ContainsSeparator)
            {
                //store pattern in lookuptable if it is a simple pattern
                string s;

                if (Pattern.StringPattern.Length >= 2)
                    s = Pattern.StringPattern.Substring(0, 2);
                else
                    s = Pattern.StringPattern.Substring(0, 1) + " ";

                s = s.ToLowerInvariant();

                if (Pattern.StringPattern.Length == 1)
                {
                    SimplePatterns1Char[Pattern.StringPattern] = Pattern;
                }
                else
                {
                    if (SimplePatterns2Char[s] == null)
                        SimplePatterns2Char[s] = new PatternCollection();
                    var ar = (PatternCollection) SimplePatterns2Char[s];
                    ar.Add(Pattern);
                }

                if (CaseSensitive)
                    SimplePatterns[Pattern.LowerStringPattern] = Pattern;
                else
                    SimplePatterns[Pattern.StringPattern] = Pattern;
            }
            else
            {
                ComplexPatterns.Add(Pattern);
            }

            patterns.Add(Pattern);
            if (Pattern.Parent == null)
                Pattern.Parent = this;
            else
            {
                throw (new Exception("Pattern already assigned to another PatternList"));
            }
            return Pattern;
        }
Beispiel #4
0
        public Word GetStartBracketWord(Word Start, Pattern End, Span FindIn)
        {
            if (Start == null || Start.Pattern == null || Start.Span == null)
                return null;

            int CurrentRow = Start.Row.Index;
            int FirstRow = FindIn.StartRow.Index;
            int x = Start.Index;
            int count = 0;
            while (CurrentRow >= FirstRow)
            {
                for (int i = x; i >= 0; i--)
                {
                    Word w = this[CurrentRow][i];
                    if (w.Span == FindIn && w.Type == WordType.Word)
                    {
                        if (w.Pattern == Start.Pattern)
                            count++;
                        if (w.Pattern == End)
                            count--;

                        if (count == 0)
                            return w;
                    }
                }

                if (!Start.Pattern.IsMultiLineBracket)
                    break;

                CurrentRow--;
                if (CurrentRow >= 0)
                    x = this[CurrentRow].Count - 1;
            }
            return null;
        }
        private void ParseBlock(XmlNode node)
        {
            string Name = "", Style = "";
            bool   IsMultiline       = false;
            bool   TerminateChildren = false;
            Color  BackColor         = Color.Transparent;

            foreach (XmlAttribute att in node.Attributes)
            {
                if (att.Name.ToLowerInvariant() == "name")
                {
                    Name = att.Value;
                }
                if (att.Name.ToLowerInvariant() == "style")
                {
                    Style = att.Value;
                }
                if (att.Name.ToLowerInvariant() == "ismultiline")
                {
                    IsMultiline = bool.Parse(att.Value);
                }
                if (att.Name.ToLowerInvariant() == "terminatechildren")
                {
                    TerminateChildren = bool.Parse(att.Value);
                }
                if (att.Name.ToLowerInvariant() == "backcolor")
                {
                    BackColor = Color.FromName(att.Value);
                    //Transparent =false;
                }
            }

            //create block object here
            SpanDefinition bl = GetBlock(Name);

            bl.BackColor         = BackColor;
            bl.Name              = Name;
            bl.MultiLine         = IsMultiline;
            bl.Style             = GetStyle(Style);
            bl.TerminateChildren = TerminateChildren;


            foreach (XmlNode n in node.ChildNodes)
            {
                if (n.NodeType == XmlNodeType.Element)
                {
                    if (n.Name.ToLowerInvariant() == "scope")
                    {
                        //bool IsComplex=false;
                        //bool IsSeparator=false;
                        string Start          = "";
                        string End            = "";
                        string style          = "";
                        string text           = "";
                        string EndIsSeparator = "";
                        string StartIsComplex = "false";
                        string EndIsComplex   = "false";
                        string StartIsKeyword = "false";
                        string EndIsKeyword   = "false";
                        string spawnStart     = "";
                        string spawnEnd       = "";
                        string EscapeChar     = "";
                        string CauseIndent    = "false";

                        bool expanded = true;

                        foreach (XmlAttribute att in n.Attributes)
                        {
                            switch (att.Name.ToLowerInvariant())
                            {
                            case "start":
                                Start = att.Value;
                                break;

                            case "escapechar":
                                EscapeChar = att.Value;
                                break;

                            case "end":
                                End = att.Value;
                                break;

                            case "style":
                                style = att.Value;
                                break;

                            case "text":
                                text = att.Value;
                                break;

                            case "defaultexpanded":
                                expanded = bool.Parse(att.Value);
                                break;

                            case "endisseparator":
                                EndIsSeparator = att.Value;
                                break;

                            case "startiskeyword":
                                StartIsKeyword = att.Value;
                                break;

                            case "startiscomplex":
                                StartIsComplex = att.Value;
                                break;

                            case "endiscomplex":
                                EndIsComplex = att.Value;
                                break;

                            case "endiskeyword":
                                EndIsKeyword = att.Value;
                                break;

                            case "spawnblockonstart":
                                spawnStart = att.Value;
                                break;

                            case "spawnblockonend":
                                spawnEnd = att.Value;
                                break;

                            case "causeindent":
                                CauseIndent = att.Value;
                                break;
                            }
                        }
                        if (Start != "")
                        {
                            //bl.StartPattern =new Pattern (Pattern,IsComplex,false,IsSeparator);
                            //bl.StartPatterns.Add (new Pattern (Pattern,IsComplex,IsSeparator,true));
                            bool blnStartIsComplex = bool.Parse(StartIsComplex);
                            bool blnEndIsComplex   = bool.Parse(EndIsComplex);
                            bool blnCauseIndent    = bool.Parse(CauseIndent);

                            var scope = new Scope {
                                Style = GetStyle(style), ExpansionText = text, DefaultExpanded = expanded, CauseIndent = blnCauseIndent
                            };

                            var     StartP     = new Pattern(Start, blnStartIsComplex, false, bool.Parse(StartIsKeyword));
                            Pattern endPattern = EscapeChar != "" ? new Pattern(End, false, bool.Parse(EndIsKeyword), EscapeChar) : new Pattern(End, blnEndIsComplex, false, bool.Parse(EndIsKeyword));

                            if (EndIsSeparator != "")
                            {
                                endPattern.IsSeparator = bool.Parse(EndIsSeparator);
                            }

                            scope.Start = StartP;
                            scope.EndPatterns.Add(endPattern);
                            bl.ScopePatterns.Add(scope);
                            if (spawnStart != "")
                            {
                                scope.spawnSpanOnStart = GetBlock(spawnStart);
                            }
                            if (spawnEnd != "")
                            {
                                scope.spawnSpanOnEnd = GetBlock(spawnEnd);
                            }
                        }
                    }
                    if (n.Name.ToLowerInvariant() == "bracket")
                    {
                        //bool IsComplex=false;
                        //bool IsSeparator=false;
                        string Start = "";
                        string End   = "";
                        string style = "";

                        string StartIsComplex = "false";
                        string EndIsComplex   = "false";

                        string StartIsKeyword = "false";
                        string EndIsKeyword   = "false";
                        string IsMultiLineB   = "true";

                        foreach (XmlAttribute att in n.Attributes)
                        {
                            switch (att.Name.ToLowerInvariant())
                            {
                            case "start":
                                Start = att.Value;
                                break;

                            case "end":
                                End = att.Value;
                                break;

                            case "style":
                                style = att.Value;
                                break;

                            case "endisseparator":
                                if (att.Name.ToLowerInvariant() == "startisseparator")
                                {
                                    if (att.Name.ToLowerInvariant() == "startiskeyword")
                                    {
                                        StartIsKeyword = att.Value;
                                    }
                                }
                                break;

                            case "startiscomplex":
                                StartIsComplex = att.Value;
                                break;

                            case "endiscomplex":
                                EndIsComplex = att.Value;
                                break;

                            case "endiskeyword":
                                EndIsKeyword = att.Value;
                                break;

                            case "ismultiline":
                                IsMultiLineB = att.Value;
                                break;
                            }
                        }
                        if (Start != "")
                        {
                            var pl = new PatternList {
                                Style = GetStyle(style)
                            };

                            bool blnStartIsComplex = bool.Parse(StartIsComplex);
                            bool blnEndIsComplex   = bool.Parse(EndIsComplex);
                            bool blnIsMultiLineB   = bool.Parse(IsMultiLineB);

                            var StartP = new Pattern(Start, blnStartIsComplex, false, bool.Parse(StartIsKeyword));
                            var EndP   = new Pattern(End, blnEndIsComplex, false, bool.Parse(EndIsKeyword));

                            StartP.MatchingBracket    = EndP;
                            EndP.MatchingBracket      = StartP;
                            StartP.BracketType        = BracketType.StartBracket;
                            EndP.BracketType          = BracketType.EndBracket;
                            StartP.IsMultiLineBracket = EndP.IsMultiLineBracket = blnIsMultiLineB;

                            pl.Add(StartP);
                            pl.Add(EndP);
                            bl.OperatorsList.Add(pl);
                        }
                    }
                }

                if (n.Name.ToLowerInvariant() == "keywords")
                {
                    foreach (XmlNode cn in n.ChildNodes)
                    {
                        if (cn.Name.ToLowerInvariant() == "patterngroup")
                        {
                            var pl = new PatternList();
                            bl.KeywordsList.Add(pl);
                            foreach (XmlAttribute att in cn.Attributes)
                            {
                                switch (att.Name.ToLowerInvariant())
                                {
                                case "style":
                                    pl.Style = GetStyle(att.Value);
                                    break;

                                case "name":
                                    pl.Name = att.Value;
                                    break;

                                case "normalizecase":
                                    pl.NormalizeCase = bool.Parse(att.Value);
                                    break;

                                case "casesensitive":
                                    pl.CaseSensitive = bool.Parse(att.Value);
                                    break;
                                }
                            }
                            foreach (XmlNode pt in cn.ChildNodes)
                            {
                                if (pt.Name.ToLowerInvariant() == "pattern")
                                {
                                    bool   IsComplex   = false;
                                    bool   IsSeparator = false;
                                    string Category    = null;
                                    string Pattern     = "";
                                    if (pt.Attributes != null)
                                    {
                                        foreach (XmlAttribute att in pt.Attributes)
                                        {
                                            switch (att.Name.ToLowerInvariant())
                                            {
                                            case "text":
                                                Pattern = att.Value;
                                                break;

                                            case "iscomplex":
                                                IsComplex = bool.Parse(att.Value);
                                                break;

                                            case "isseparator":
                                                IsSeparator = bool.Parse(att.Value);
                                                break;

                                            case "category":
                                                Category = (att.Value);
                                                break;
                                            }
                                        }
                                    }
                                    if (Pattern != "")
                                    {
                                        var pat = new Pattern(Pattern, IsComplex, IsSeparator, true)
                                        {
                                            Category = Category
                                        };
                                        pl.Add(pat);
                                    }
                                }
                                else if (pt.Name.ToLowerInvariant() == "patterns")
                                {
                                    string Patterns = pt.ChildNodes[0].Value;
                                    Patterns = Patterns.Replace("\t", " ");
                                    while (Patterns.IndexOf("  ") >= 0)
                                    {
                                        Patterns = Patterns.Replace("  ", " ");
                                    }


                                    foreach (string Pattern in Patterns.Split())
                                    {
                                        if (Pattern != "")
                                        {
                                            pl.Add(new Pattern(Pattern, false, false, true));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                //if (n.Name == "Operators")
                //	ParseStyle(n);
                if (n.Name.ToLowerInvariant() == "operators")
                {
                    foreach (XmlNode cn in n.ChildNodes)
                    {
                        if (cn.Name.ToLowerInvariant() == "patterngroup")
                        {
                            var pl = new PatternList();
                            bl.OperatorsList.Add(pl);
                            foreach (XmlAttribute att in cn.Attributes)
                            {
                                switch (att.Name.ToLowerInvariant())
                                {
                                case "style":
                                    pl.Style = GetStyle(att.Value);
                                    break;

                                case "name":
                                    pl.Name = att.Value;
                                    break;

                                case "normalizecase":
                                    pl.NormalizeCase = bool.Parse(att.Value);
                                    break;

                                case "casesensitive":
                                    pl.CaseSensitive = bool.Parse(att.Value);
                                    break;
                                }
                            }

                            foreach (XmlNode pt in cn.ChildNodes)
                            {
                                if (pt.Name.ToLowerInvariant() == "pattern")
                                {
                                    bool   IsComplex   = false;
                                    bool   IsSeparator = false;
                                    string Pattern     = "";
                                    string Category    = null;
                                    if (pt.Attributes != null)
                                    {
                                        foreach (XmlAttribute att in pt.Attributes)
                                        {
                                            switch (att.Name.ToLowerInvariant())
                                            {
                                            case "text":
                                                Pattern = att.Value;
                                                break;

                                            case "iscomplex":
                                                IsComplex = bool.Parse(att.Value);
                                                break;

                                            case "isseparator":
                                                IsSeparator = bool.Parse(att.Value);
                                                break;

                                            case "category":
                                                Category = (att.Value);
                                                break;
                                            }
                                        }
                                    }
                                    if (Pattern != "")
                                    {
                                        var pat = new Pattern(Pattern, IsComplex, IsSeparator, false)
                                        {
                                            Category = Category
                                        };
                                        pl.Add(pat);
                                    }
                                }
                                else if (pt.Name.ToLowerInvariant() == "patterns")
                                {
                                    string Patterns = pt.ChildNodes[0].Value;
                                    Patterns = Patterns.Replace("\t", " ");
                                    while (Patterns.IndexOf("  ") >= 0)
                                    {
                                        Patterns = Patterns.Replace("  ", " ");
                                    }

                                    foreach (string Pattern in Patterns.Split())
                                    {
                                        if (Pattern != "")
                                        {
                                            pl.Add(new Pattern(Pattern, false, false, false));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                if (n.Name.ToLowerInvariant() == "childblocks")
                {
                    foreach (XmlNode cn in n.ChildNodes)
                    {
                        if (cn.Name.ToLowerInvariant() == "child")
                        {
                            foreach (XmlAttribute att in cn.Attributes)
                            {
                                if (att.Name.ToLowerInvariant() == "name")
                                {
                                    bl.childSpanDefinitions.Add(GetBlock(att.Value));
                                }
                            }
                        }
                    }
                }
            }
        }