/// <summary>
        ///     Generates a SyntaxBase
        /// </summary>
        /// <param name="descFile"></param>
        /// <returns></returns>
        private SyntaxBase GenerateBase(string descFile)
        {
            var synbase = new SyntaxBase {SysPath = descFile};
            using (var reader = XmlReader.Create(descFile))
            {
                while (reader.Read())
                    if (reader.IsStartElement())
                    {
                        switch (reader.Name)
                        {
                            case "Syntax":
                                synbase.CommentPrefix = reader["CommentPrefix"];
                                synbase.Extensions = reader["Extensions"].Split('|');
                                break;

                            case "Rule":
                            {
                                var type = reader["Type"];
                                var options = reader["Options"];
                                var regex = reader["Regex"];
                                synbase.Rules.Add(InitRule(type, regex, options));
                                // if (reader.Read())
                                //     synbase.Rules.Add(InitRule(type, regex, options));
                            }
                                break;

                            case "Folding":
                                var start = reader["Start"];
                                var end = reader["End"];
                                var foldOptions = reader["Options"];
                                synbase.FoldingRules.Add(InitFoldingRule(start, end, foldOptions));
                                // if (reader.Read())
                                //     synbase.FoldingRules.Add(InitFoldingRule(start, end, foldOptions));
                                break;

                            case "Brackets":
                                synbase.LeftBracket = reader["Left"][0];
                                synbase.RightBracket = reader["Right"][0];
                                if (reader["Left2"] != null)
                                {
                                    synbase.LeftBracket2 = reader["Left2"][0];
                                    synbase.RightBracket2 = reader["Right2"][0];
                                }
                                break;
                        }
                    }
            }
            return synbase;
        }
 /// <summary>
 ///     Highlight Syntax using SyntaxBase
 /// </summary>
 /// <param name="syntax"></param>
 /// <param name="e"></param>
 private void HighlightSyntaxFromFile(SyntaxBase syntax, TextChangedEventArgs e)
 {
     e.ChangedRange.tb.Language = syntax.Name;
     e.ChangedRange.tb.LeftBracket = syntax.LeftBracket;
     e.ChangedRange.tb.RightBracket = syntax.RightBracket;
     e.ChangedRange.tb.LeftBracket2 = syntax.LeftBracket2;
     e.ChangedRange.tb.RightBracket2 = syntax.RightBracket2;
     e.ChangedRange.tb.CommentPrefix = syntax.CommentPrefix;
     foreach (var rule in syntax.Rules)
     {
         e.ChangedRange.ClearStyle(rule.Type);
         e.ChangedRange.SetStyle(rule.Type, rule.Regex, rule.Options);
     }
     e.ChangedRange.ClearFoldingMarkers();
     foreach (var folding in syntax.FoldingRules)
         e.ChangedRange.SetFoldingMarkers(folding.FoldingStartMarker, folding.FoldingEndMarker, folding.Options);
 }