Ejemplo n.º 1
0
 private void AddDefaultStylesToLexer(ILexerConfig lexer)
 {
     if (parent.Styles.Count > 0)
     {
         foreach (int key in parent.Styles.Keys)
         {
             lexer.Styles[key] = parent.Styles[key];
         }
     }
 }
Ejemplo n.º 2
0
 private void AddDefaultStylesToLexer(ILexerConfig lexer)
 {
     if (parent.Styles.Count > 0)
     {
         foreach (int key in parent.Styles.Keys)
         {
             lexer.Styles[key] = parent.Styles[key];
         }
     }
 }
Ejemplo n.º 3
0
        private void comboBoxLexer_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.radioButtonLexer.Checked)
            {
                if ((comboBoxLexer.SelectedIndex) < 0 && (comboBoxLexer.Items.Count > 0))
                {
                    comboBoxLexer.SelectedIndex = 0;
                }
                else if (this.comboBoxLexer.SelectedIndex >= 0)
                {
                    ILexerConfig lex = Configuration.Lexers[comboBoxLexer.SelectedItem.ToString()];

                    this.lexerType = Utilities.GetLexerEnumFromLexerType(lex.Type);
                    this.styles    = lex.Styles;
                    BindStylesToForm(lexerType, styles);
                }
            }
        }
Ejemplo n.º 4
0
        private static void ApplyLexerProperty(Queue <string> keyQueue, string val)
        {
            if (keyQueue.Count > 1)
            {
                string lexerName = keyQueue.Dequeue();
                string key       = keyQueue.Dequeue();

                ILexerConfig lexerConf = config.Lexers[lexerName];
                switch (key)
                {
                case "style":
                    ApplyStyle(lexerConf.Type, lexerConf.Styles, keyQueue, val);
                    break;

                default:
                    config.Lexers[lexerName].Properties[key] = Evaluate(val);
                    break;
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="config"></param>
        public bool PopulateLexerConfig(ILexerConfig config)
        {
            /*--------------------------------------- styles ---------------------------------------
             * The lexers determine a style number for each lexical type, such as keyword, comment or number. These settings
             * determine the visual style to be used for each style number of each lexer.
             * The value of each setting is a set of ',' separated fields, some of which have a subvalue after a ':'. The fields
             * are font, size, fore, back, italics, notitalics, bold, notbold, eolfilled, noteolfilled, underlined,
             * notunderlined, and case. The font field has a subvalue which is the name of the font, the fore and back
             * have colour subvalues, the size field has a numeric size subvalue, the case field has a subvalue of 'm',
             * 'u', or 'l' for mixed, upper or lower case, and the bold, italics and eolfilled fields have no subvalue.
             * The value "fore:#FF0000,font:Courier,size:14" represents 14 point, red Courier text.
             * A global style can be set up using style.*.stylenumber. Any style options set in the global style will be
             * inherited by each lexer style unless overridden.
             * ----------------------------------------------------------------------------------------*/
            string      key, s, lexer = config.LexerName.ToLower();
            ILexerStyle style;
            bool        dataIsFound = false;
            Dictionary <string, string> dict;

            for (int i = 0; i < 128; i++)
            {
                if (config.Styles.ContainsKey(i))
                {
                    style = config.Styles[i];
                }
                else
                {
                    style = new LexerStyle(i);
                }

                dataIsFound = true;
                foreach (string lang in new string[] { "*", lexer })
                {
                    key = string.Format("style.{0}.{1}", lang, i);
                    if (properties.ContainsKey(key))
                    {
                        dataIsFound = true;

                        s    = this.Evaluate(properties[key]);
                        dict = PropertiesReader.GetKeyValuePairs(s);
                        foreach (string styleKey in dict.Keys)
                        {
                            s = dict[styleKey];
                            switch (styleKey)
                            {
                            case "font":
                                style.FontName = s;
                                break;

                            case "size":
                                style.FontSize = Convert.ToInt32(s);
                                break;

                            case "fore":
                                style.ForeColor = ColorTranslator.FromHtml(s);
                                break;

                            case "back":
                                style.BackColor = ColorTranslator.FromHtml(s);
                                break;

                            case "italics":
                                style.Italics = true;
                                break;

                            case "notitalics":
                                style.Italics = false;
                                break;

                            case "bold":
                                style.Bold = true;
                                break;

                            case "notbold":
                                style.Bold = false;
                                break;

                            case "eolfilled":
                                style.EOLFilled = true;
                                break;

                            case "noteolfilled":
                                style.EOLFilled = false;
                                break;

                            case "underlined":
                                style.Underline = true;
                                break;

                            case "notunderlined":
                                style.Underline = false;
                                break;

                            case "case":
                                style.CaseVisibility = ((s == "m") ? CaseVisible.Mixed : ((s == "u") ? CaseVisible.Upper : CaseVisible.Lower));
                                break;
                            }
                        }
                    }
                }

                if (dataIsFound)
                {
                    config.Styles[i] = style;
                }
            }
            return(true);
        }
Ejemplo n.º 6
0
        public void Configure(ScintillaControl scintilla, string language)
        {
            scintilla.StyleClearAll();
            scintilla.DisableMarginClickFold();

            IScintillaConfig conf = this;
            ILanguageConfig  lang = conf.Languages[language];

            if (lang != null)
            {
                lang = lang.CombinedLanguageConfig;
                if (lang.CodePage.HasValue)
                {
                    scintilla.CodePage = lang.CodePage.Value;
                }
                if (lang.SelectionAlpha.HasValue)
                {
                    scintilla.SelectionAlpha = lang.SelectionAlpha.Value;
                }
                if (lang.SelectionBackColor != Color.Empty)
                {
                    scintilla.SetSelectionBackground(true, lang.SelectionBackColor);
                }
                if (lang.TabSize.HasValue)
                {
                    scintilla.TabWidth = lang.TabSize.Value;
                }
                if (lang.IndentSize.HasValue)
                {
                    scintilla.Indent = lang.IndentSize.Value;
                }

                // Enable line numbers
                scintilla.MarginWidthN(0, 40);

                bool enableFolding = false;
                if (lang.Fold.HasValue)
                {
                    enableFolding = lang.Fold.Value;
                }
                if (enableFolding)
                {
                    // Lexer specific properties
                    scintilla.Property("fold", "1");
                    if (lang.FoldAtElse.HasValue)
                    {
                        scintilla.Property("fold.at.else", (lang.FoldAtElse.Value ? "1" : "0"));
                    }
                    if (lang.FoldCompact.HasValue)
                    {
                        scintilla.Property("fold.compact", (lang.FoldCompact.Value ? "1" : "0"));
                    }
                    if (lang.FoldComment.HasValue)
                    {
                        scintilla.Property("fold.comment", (lang.FoldComment.Value ? "1" : "0"));
                    }
                    if (lang.FoldPreprocessor.HasValue)
                    {
                        scintilla.Property("fold.preprocessor", (lang.FoldPreprocessor.Value ? "1" : "0"));
                    }
                    if (lang.StylingWithinPreprocessor.HasValue)
                    {
                        scintilla.Property("styling.within.preprocessor", (lang.PythonFoldQuotes.Value ? "1" : "0"));
                    }

                    if (lang.HtmlFold.HasValue)
                    {
                        scintilla.Property("fold.html", (lang.HtmlFold.Value ? "1" : "0"));
                    }
                    if (lang.HtmlFoldPreprocessor.HasValue)
                    {
                        scintilla.Property("fold.html.preprocessor", (lang.HtmlFoldPreprocessor.Value ? "1" : "0"));
                    }
                    if (lang.HtmlTagsCaseSensitive.HasValue)
                    {
                        scintilla.Property("html.tags.case.sensitive", (lang.HtmlTagsCaseSensitive.Value ? "1" : "0"));
                    }

                    if (lang.PythonFoldComment.HasValue)
                    {
                        scintilla.Property("fold.comment.python", (lang.PythonFoldComment.Value ? "1" : "0"));
                    }
                    if (lang.PythonFoldQuotes.HasValue)
                    {
                        scintilla.Property("fold.quotes.python", (lang.PythonFoldQuotes.Value ? "1" : "0"));
                    }
                    if (lang.PythonWhingeLevel.HasValue)
                    {
                        scintilla.Property("tab.timmy.whinge.level", lang.PythonWhingeLevel.Value.ToString());
                    }

                    if (lang.SqlBackslashEscapes.HasValue)
                    {
                        scintilla.Property("sql.backslash.escapes", (lang.SqlBackslashEscapes.Value ? "1" : "0"));
                    }
                    if (lang.SqlBackticksIdentifier.HasValue)
                    {
                        scintilla.Property("lexer.sql.backticks.identifier", (lang.SqlBackticksIdentifier.Value ? "1" : "0"));
                    }
                    if (lang.SqlFoldOnlyBegin.HasValue)
                    {
                        scintilla.Property("fold.sql.only.begin", (lang.SqlFoldOnlyBegin.Value ? "1" : "0"));
                    }

                    if (lang.PerlFoldPod.HasValue)
                    {
                        scintilla.Property("fold.perl.pod", (lang.PerlFoldPod.Value ? "1" : "0"));
                    }
                    if (lang.PerlFoldPackage.HasValue)
                    {
                        scintilla.Property("fold.perl.package", (lang.PerlFoldPackage.Value ? "1" : "0"));
                    }

                    if (lang.NsisIgnoreCase.HasValue)
                    {
                        scintilla.Property("nsis.ignorecase", (lang.NsisIgnoreCase.Value ? "1" : "0"));
                    }
                    if (lang.NsisUserVars.HasValue)
                    {
                        scintilla.Property("nsis.uservars", (lang.NsisUserVars.Value ? "1" : "0"));
                    }
                    if (lang.NsisFoldUtilCommand.HasValue)
                    {
                        scintilla.Property("nsis.foldutilcmd", (lang.NsisFoldUtilCommand.Value ? "1" : "0"));
                    }
                    if (lang.CppAllowDollars.HasValue)
                    {
                        scintilla.Property("lexer.cpp.allow.dollars", (lang.CppAllowDollars.Value ? "1" : "0"));
                    }

                    //for HTML lexer: "asp.default.language"
                    //enum script_type { eScriptNone = 0, eScriptJS, eScriptVBS, eScriptPython, eScriptPHP, eScriptXML, eScriptSGML, eScriptSGMLblock };

                    scintilla.MarginWidthN(1, 0);
                    scintilla.MarginTypeN(1, MarginType.Symbol);
                    scintilla.MarginMaskN(1, unchecked ((int)0xFE000000));
                    scintilla.MarginSensitiveN(1, true);

                    if (lang.FoldMarginWidth.HasValue)
                    {
                        scintilla.MarginWidthN(1, lang.FoldMarginWidth.Value);
                    }
                    else
                    {
                        scintilla.MarginWidthN(1, 20);
                    }

                    if (lang.FoldMarginColor != Color.Empty)
                    {
                        scintilla.SetFoldMarginColor(true, lang.FoldMarginColor);
                    }
                    if (lang.FoldMarginHighlightColor != Color.Empty)
                    {
                        scintilla.SetFoldMarginHiColor(true, lang.FoldMarginHighlightColor);
                    }
                    if (lang.FoldFlags.HasValue)
                    {
                        scintilla.SetFoldFlags(lang.FoldFlags.Value);
                    }

                    scintilla.MarkerDefine(MarkerOutline.Folder, MarkerSymbol.Plus);
                    scintilla.MarkerDefine(MarkerOutline.FolderOpen, MarkerSymbol.Minus);
                    scintilla.MarkerDefine(MarkerOutline.FolderEnd, MarkerSymbol.Empty);
                    scintilla.MarkerDefine(MarkerOutline.FolderMidTail, MarkerSymbol.Empty);
                    scintilla.MarkerDefine(MarkerOutline.FolderOpenMid, MarkerSymbol.Minus);
                    scintilla.MarkerDefine(MarkerOutline.FolderSub, MarkerSymbol.Empty);
                    scintilla.MarkerDefine(MarkerOutline.FolderTail, MarkerSymbol.Empty);

                    scintilla.EnableMarginClickFold();
                }

                if (!string.IsNullOrEmpty(lang.WhitespaceCharacters))
                {
                    scintilla.WhitespaceChars(lang.WhitespaceCharacters);
                }

                if (!string.IsNullOrEmpty(lang.WordCharacters))
                {
                    scintilla.WordChars(lang.WordCharacters);
                }

                ILexerConfig lexer = lang.Lexer;
                if (lexer != null)
                {
                    scintilla.Lexer = lexer.LexerID;
                    //scintilla.LexerLanguage(lang.Name);
                }

                SortedDictionary <int, ILexerStyle> styles = lang.Styles;
                foreach (ILexerStyle style in styles.Values)
                {
                    if (style.ForeColor != Color.Empty)
                    {
                        scintilla.StyleSetFore(style.StyleIndex, style.ForeColor);
                    }

                    if (style.BackColor != Color.Empty)
                    {
                        scintilla.StyleSetBack(style.StyleIndex, style.BackColor);
                    }

                    if (!string.IsNullOrEmpty(style.FontName))
                    {
                        scintilla.StyleSetFont(style.StyleIndex, style.FontName);
                    }

                    if (style.FontSize.HasValue)
                    {
                        scintilla.StyleSetSize(style.StyleIndex, style.FontSize.Value);
                    }

                    if (style.Bold.HasValue)
                    {
                        scintilla.StyleSetBold(style.StyleIndex, style.Bold.Value);
                    }

                    if (style.Italics.HasValue)
                    {
                        scintilla.StyleSetItalic(style.StyleIndex, style.Italics.Value);
                    }

                    if (style.EOLFilled.HasValue)
                    {
                        scintilla.StyleSetEOLFilled(style.StyleIndex, style.EOLFilled.Value);
                    }

                    scintilla.StyleSetCase(style.StyleIndex, style.CaseVisibility);
                }
                scintilla.StyleBits = scintilla.StyleBitsNeeded;

                for (int j = 0; j < 9; j++)
                {
                    if (lang.KeywordLists.ContainsKey(j))
                    {
                        scintilla.KeyWords(j, lang.KeywordLists[j]);
                    }
                    else
                    {
                        scintilla.KeyWords(j, string.Empty);
                    }
                }
            }

            scintilla.Colorize(0, scintilla.Length);
        }
 public bool PopulateLexerConfig(ILexerConfig config)
 {
     ScintillaPropertiesHelper.Populate(config.ScintillaConfig, GetResource("lex." + config.LexerName.ToLower() + ".properties"));
     return true;
 }
 public bool PopulateLexerConfig(ILexerConfig config)
 {
     ScintillaPropertiesHelper.Populate(config.ScintillaConfig, GetResource("lex." + config.LexerName.ToLower() + ".properties"));
     return(true);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="config"></param>
        public bool PopulateLexerConfig(ILexerConfig config)
        {
            /*--------------------------------------- styles ---------------------------------------
            The lexers determine a style number for each lexical type, such as keyword, comment or number. These settings 
            determine the visual style to be used for each style number of each lexer.
            The value of each setting is a set of ',' separated fields, some of which have a subvalue after a ':'. The fields 
            are font, size, fore, back, italics, notitalics, bold, notbold, eolfilled, noteolfilled, underlined, 
            notunderlined, and case. The font field has a subvalue which is the name of the font, the fore and back 
            have colour subvalues, the size field has a numeric size subvalue, the case field has a subvalue of 'm', 
            'u', or 'l' for mixed, upper or lower case, and the bold, italics and eolfilled fields have no subvalue. 
            The value "fore:#FF0000,font:Courier,size:14" represents 14 point, red Courier text.
            A global style can be set up using style.*.stylenumber. Any style options set in the global style will be 
            inherited by each lexer style unless overridden.
            ----------------------------------------------------------------------------------------*/
            string key, s, lexer = config.LexerName.ToLower();
            ILexerStyle style;
            bool dataIsFound = false;
            Dictionary<string, string> dict;

            for (int i = 0; i < 128; i++)
            {
                if (config.Styles.ContainsKey(i)) 
                    style = config.Styles[i];
                else 
                    style = new LexerStyle(i);

                dataIsFound = true;
                foreach (string lang in new string[] { "*", lexer })
                {
                    key = string.Format("style.{0}.{1}", lang, i);
                    if (properties.ContainsKey(key))
                    {
                        dataIsFound = true;

                        s = this.Evaluate(properties[key]);
                        dict = PropertiesReader.GetKeyValuePairs(s);
                        foreach (string styleKey in dict.Keys)
                        {
                            s = dict[styleKey];
                            switch (styleKey)
                            {
                                case "font":
                                    style.FontName = s;
                                    break;
                                case "size":
                                    style.FontSize = Convert.ToInt32(s);
                                    break;
                                case "fore":
                                    style.ForeColor = ColorTranslator.FromHtml(s);
                                    break;
                                case "back":
                                    style.BackColor = ColorTranslator.FromHtml(s);
                                    break;
                                case "italics":
                                    style.Italics = true;
                                    break;
                                case "notitalics":
                                    style.Italics = false;
                                    break;
                                case "bold":
                                    style.Bold = true;
                                    break;
                                case "notbold":
                                    style.Bold = false;
                                    break;
                                case "eolfilled":
                                    style.EOLFilled = true;
                                    break;
                                case "noteolfilled":
                                    style.EOLFilled = false;
                                    break;
                                case "underlined":
                                    style.Underline = true;
                                    break;
                                case "notunderlined":
                                    style.Underline = false;
                                    break;
                                case "case":
                                    style.CaseVisibility = ((s == "m") ? StyleCase.Mixed : ((s == "u") ? StyleCase.Upper : StyleCase.Lower));
                                    break;
                            }
                        }
                    }
                }

                if (dataIsFound) config.Styles[i] = style;
            }
            return true;
        }
Ejemplo n.º 10
0
        public void Configure(ScintillaNet.Scintilla scintilla, string language)
        {
            scintilla.Styles.ClearAll();
            scintilla.Folding.IsEnabled = false;

            IScintillaConfig conf = this;
            ILanguageConfig  lang = conf.Languages[language];

            if (lang != null)
            {
                lang = lang.CombinedLanguageConfig;

                //CauseError;
                //FIND THE MAP FOR THE NEXT 2 LINES
                if (lang.CodePage.HasValue)
                {
                    scintilla.NativeInterface.SetCodePage(lang.CodePage.Value);
                }
                //if (lang.SelectionAlpha.HasValue) scintilla.Selection.ForeColor = lang.SelectionAlpha.Value;
                if (lang.SelectionBackColor != Color.Empty)
                {
                    scintilla.Selection.BackColor = lang.SelectionBackColor;
                }
                if (lang.TabSize.HasValue)
                {
                    scintilla.Indentation.TabWidth = lang.TabSize.Value;
                }
                if (lang.IndentSize.HasValue)
                {
                    scintilla.Indentation.IndentWidth = lang.IndentSize.Value;
                }

                // Enable line numbers
                scintilla.Margins.Margin0.Width = 40;

                bool enableFolding = false;
                if (lang.Fold.HasValue)
                {
                    enableFolding = lang.Fold.Value;
                }
                if (enableFolding)
                {
                    // Lexer specific properties
                    scintilla.PropertyBag.Add("fold", "1");

                    //CAUSE ERROR;
                    //this Is TO CAUSE AN ERROR TO REMIND ME TO CHECK ALL OF THESE ELEMENTS!!!;

                    if (lang.FoldAtElse.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.at.else", (lang.FoldAtElse.Value ? "1" : "0"));
                    }
                    if (lang.FoldCompact.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.compact", (lang.FoldCompact.Value ? "1" : "0"));
                    }
                    if (lang.FoldComment.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.comment", (lang.FoldComment.Value ? "1" : "0"));
                    }
                    if (lang.FoldPreprocessor.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.preprocessor", (lang.FoldPreprocessor.Value ? "1" : "0"));
                    }
                    if (lang.StylingWithinPreprocessor.HasValue)
                    {
                        scintilla.PropertyBag.Add("styling.within.preprocessor", (lang.PythonFoldQuotes.Value ? "1" : "0"));
                    }

                    if (lang.HtmlFold.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.html", (lang.HtmlFold.Value ? "1" : "0"));
                    }
                    if (lang.HtmlFoldPreprocessor.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.html.preprocessor", (lang.HtmlFoldPreprocessor.Value ? "1" : "0"));
                    }
                    if (lang.HtmlTagsCaseSensitive.HasValue)
                    {
                        scintilla.PropertyBag.Add("html.tags.case.sensitive", (lang.HtmlTagsCaseSensitive.Value ? "1" : "0"));
                    }

                    if (lang.PythonFoldComment.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.comment.python", (lang.PythonFoldComment.Value ? "1" : "0"));
                    }
                    if (lang.PythonFoldQuotes.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.quotes.python", (lang.PythonFoldQuotes.Value ? "1" : "0"));
                    }
                    if (lang.PythonWhingeLevel.HasValue)
                    {
                        scintilla.PropertyBag.Add("tab.timmy.whinge.level", lang.PythonWhingeLevel.Value.ToString());
                    }

                    if (lang.SqlBackslashEscapes.HasValue)
                    {
                        scintilla.PropertyBag.Add("sql.backslash.escapes", (lang.SqlBackslashEscapes.Value ? "1" : "0"));
                    }
                    if (lang.SqlBackticksIdentifier.HasValue)
                    {
                        scintilla.PropertyBag.Add("lexer.sql.backticks.identifier", (lang.SqlBackticksIdentifier.Value ? "1" : "0"));
                    }
                    if (lang.SqlFoldOnlyBegin.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.sql.only.begin", (lang.SqlFoldOnlyBegin.Value ? "1" : "0"));
                    }

                    if (lang.PerlFoldPod.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.perl.pod", (lang.PerlFoldPod.Value ? "1" : "0"));
                    }
                    if (lang.PerlFoldPackage.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.perl.package", (lang.PerlFoldPackage.Value ? "1" : "0"));
                    }

                    if (lang.NsisIgnoreCase.HasValue)
                    {
                        scintilla.PropertyBag.Add("nsis.ignorecase", (lang.NsisIgnoreCase.Value ? "1" : "0"));
                    }
                    if (lang.NsisUserVars.HasValue)
                    {
                        scintilla.PropertyBag.Add("nsis.uservars", (lang.NsisUserVars.Value ? "1" : "0"));
                    }
                    if (lang.NsisFoldUtilCommand.HasValue)
                    {
                        scintilla.PropertyBag.Add("nsis.foldutilcmd", (lang.NsisFoldUtilCommand.Value ? "1" : "0"));
                    }
                    if (lang.CppAllowDollars.HasValue)
                    {
                        scintilla.PropertyBag.Add("lexer.cpp.allow.dollars", (lang.CppAllowDollars.Value ? "1" : "0"));
                    }

                    //for HTML lexer: "asp.default.language"
                    //enum script_type { eScriptNone = 0, eScriptJS, eScriptVBS, eScriptPython, eScriptPHP, eScriptXML, eScriptSGML, eScriptSGMLblock };

                    scintilla.Margins.Margin1.Width       = 0;
                    scintilla.Margins.Margin1.Type        = MarginType.Symbol;
                    scintilla.Margins.Margin1.Mask        = unchecked ((int)0xFE000000);
                    scintilla.Margins.Margin1.IsClickable = true;

                    if (lang.FoldMarginWidth.HasValue)
                    {
                        scintilla.Margins.Margin1.Width = lang.FoldMarginWidth.Value;
                    }
                    else
                    {
                        scintilla.Margins.Margin1.Width = 20;
                    }

                    //if (lang.FoldMarginColor != Color.Empty)
                    //    scintilla.Margins.SetFoldMarginColor(true, lang.FoldMarginColor);
                    //if (lang.FoldMarginHighlightColor != Color.Empty)
                    //    scintilla.SetFoldMarginHiColor(true, lang.FoldMarginHighlightColor);
                    //if (lang.FoldFlags.HasValue)
                    //    scintilla.SetFoldFlags(lang.FoldFlags.Value);

                    scintilla.Markers.Folder.Symbol            = MarkerSymbol.Plus;
                    scintilla.Markers.FolderOpen.Symbol        = MarkerSymbol.Minus;
                    scintilla.Markers.FolderEnd.Symbol         = MarkerSymbol.Empty;
                    scintilla.Markers.FolderOpenMidTail.Symbol = MarkerSymbol.Empty;
                    scintilla.Markers.FolderOpenMid.Symbol     = MarkerSymbol.Minus;
                    scintilla.Markers.FolderSub.Symbol         = MarkerSymbol.Empty;
                    scintilla.Markers.FolderTail.Symbol        = MarkerSymbol.Empty;

                    //scintilla.EnableMarginClickFold();
                }

                if (!string.IsNullOrEmpty(lang.WhitespaceCharacters))
                {
                    scintilla.Lexing.WhitespaceChars = lang.WhitespaceCharacters;
                }

                if (!string.IsNullOrEmpty(lang.WordCharacters))
                {
                    scintilla.Lexing.WordChars = lang.WordCharacters;
                }

                ILexerConfig lexer = lang.Lexer;

                scintilla.Lexing.Lexer     = Utilities.LexerLookupByID(lexer.LexerID);
                scintilla.Lexing.LexerName = lang.Name;

                SortedDictionary <int, ILexerStyle> styles = lang.Styles;
                foreach (ILexerStyle style in styles.Values)
                {
                    if (style.ForeColor != Color.Empty)
                    {
                        scintilla.Styles[style.StyleIndex].ForeColor = style.ForeColor;
                    }

                    if (style.BackColor != Color.Empty)
                    {
                        scintilla.Styles[style.StyleIndex].BackColor = style.BackColor;
                    }

                    if (!string.IsNullOrEmpty(style.FontName))
                    {
                        scintilla.Styles[style.StyleIndex].FontName = style.FontName;
                    }

                    if (style.FontSize.HasValue)
                    {
                        scintilla.Styles[style.StyleIndex].Size = style.FontSize.Value;
                    }

                    if (style.Bold.HasValue)
                    {
                        scintilla.Styles[style.StyleIndex].Bold = style.Bold.Value;
                    }

                    if (style.Italics.HasValue)
                    {
                        scintilla.Styles[style.StyleIndex].Italic = style.Italics.Value;
                    }

                    if (style.EOLFilled.HasValue)
                    {
                        scintilla.Styles[style.StyleIndex].IsSelectionEolFilled = style.EOLFilled.Value;
                    }

                    scintilla.Styles[style.StyleIndex].Case = style.CaseVisibility;
                }


                for (int j = 0; j < 9; j++)
                {
                    if (lang.KeywordLists.ContainsKey(j))
                    {
                        scintilla.Lexing.SetKeywords(j, lang.KeywordLists[j]);
                    }
                    else
                    {
                        scintilla.Lexing.SetKeywords(j, string.Empty);
                    }
                }
            }

            scintilla.Lexing.Colorize(0, scintilla.Text.Length);
        }