Ejemplo n.º 1
0
        /// <summary>
        /// Creates the lexer from XML file used by the Notepad++ software.
        /// </summary>
        /// <param name="scintilla">The <see cref="Scintilla"/> which lexer style to set.</param>
        /// <param name="lexerType">Type of the lexer.</param>
        /// <param name="fileName">A file name to get the lexer type from.</param>
        /// <param name="useGlobalOverride">A flag indicating whether the style "Global override" should be set for the lexer from the XML document.</param>
        /// <param name="font">A flag indicating whether to use the defined font name from the XML document or not.</param>
        /// <param name="useWhiteSpace">A flag indicating whether to color the white space symbol.</param>
        /// <param name="useSelectionColors">A flag indicating whether to color the selection.</param>
        /// <param name="useMarginColors">A flag indicating whether to color the margin.</param>
        /// <returns><c>true</c> if the operation was successful, <c>false</c> otherwise.</returns>
        public static bool CreateLexerFromFile(Scintilla scintilla, LexerType lexerType,
                                               string fileName, bool useGlobalOverride, bool font, bool useWhiteSpace, bool useSelectionColors,
                                               bool useMarginColors)
        {
            try
            {
                XDocument document = XDocument.Load(fileName);

                ScintillaNotepadPlusPlusStyles.SetGlobalDefaultStyles(document, scintilla, useGlobalOverride, font);

                ScintillaNotepadPlusPlusStyles.LoadScintillaStyleFromNotepadPlusXml(document, scintilla, useWhiteSpace,
                                                                                    useSelectionColors, useMarginColors);

                ScintillaNotepadPlusPlusStyles.LoadLexerStyleFromNotepadPlusXml(document, scintilla,
                                                                                lexerType); // TODO::Font?

                scintilla.Lexer = LexerTypeName.GetLexerByLexerType(lexerType);

                ScintillaKeyWords.SetKeywords(scintilla, lexerType);

                LexerFoldProperties.SetFoldProperties(scintilla, lexerType);

                ScintillaNotepadPlusPlusStyles.SetFolding(document, scintilla);

                System.Diagnostics.Debug.WriteLine(scintilla.DescribeKeywordSets());

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates the lexer for a given Scintilla class instance for the Structured Query Language (SQL).
        /// </summary>
        /// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
        /// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
        /// <returns>True if the operation was successful; otherwise false.</returns>
        public static bool CreateSqlLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors)
        {
            ClearStyle(scintilla);

            // KEYWORD, fontStyle = 1
            scintilla.Styles[Style.Sql.Word].Bold      = true;
            scintilla.Styles[Style.Sql.Word].ForeColor = lexerColors[LexerType.SQL, "WordFore"];
            scintilla.Styles[Style.Sql.Word].BackColor = lexerColors[LexerType.SQL, "WordBack"];

            // NUMBER, fontStyle = 0
            scintilla.Styles[Style.Sql.Number].ForeColor = lexerColors[LexerType.SQL, "NumberFore"];
            scintilla.Styles[Style.Sql.Number].BackColor = lexerColors[LexerType.SQL, "NumberBack"];

            // STRING, fontStyle = 0
            scintilla.Styles[Style.Sql.String].ForeColor = lexerColors[LexerType.SQL, "StringFore"];
            scintilla.Styles[Style.Sql.String].BackColor = lexerColors[LexerType.SQL, "StringBack"];

            // STRING2, fontStyle = 0
            scintilla.Styles[Style.Sql.Character].ForeColor =
                lexerColors[LexerType.SQL, "CharacterFore"];
            scintilla.Styles[Style.Sql.Character].BackColor =
                lexerColors[LexerType.SQL, "CharacterBack"];

            // OPERATOR, fontStyle = 1
            scintilla.Styles[Style.Sql.Operator].Bold      = true;
            scintilla.Styles[Style.Sql.Operator].ForeColor =
                lexerColors[LexerType.SQL, "OperatorFore"];
            scintilla.Styles[Style.Sql.Operator].BackColor =
                lexerColors[LexerType.SQL, "OperatorBack"];

            // COMMENT, fontStyle = 0
            scintilla.Styles[Style.Sql.Comment].ForeColor = lexerColors[LexerType.SQL, "CommentFore"];
            scintilla.Styles[Style.Sql.Comment].BackColor = lexerColors[LexerType.SQL, "CommentBack"];

            // COMMENT LINE, fontStyle = 0
            scintilla.Styles[Style.Sql.CommentLine].ForeColor =
                lexerColors[LexerType.SQL, "CommentLineFore"];
            scintilla.Styles[Style.Sql.CommentLine].BackColor =
                lexerColors[LexerType.SQL, "CommentLineBack"];

            scintilla.Lexer = Lexer.Sql;

            ScintillaKeyWords.SetKeywords(scintilla, LexerType.SQL);

            LexerFoldProperties.SetScintillaProperties(scintilla, LexerFoldProperties.SqlFolding);

            AddFolding(scintilla);
            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates the lexer for a given Scintilla class instance for the batch script file.
        /// </summary>
        /// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
        /// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
        /// <returns>True if the operation was successful; otherwise false.</returns>
        public static bool CreateBatchLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors)
        {
            ClearStyle(scintilla);

            // DEFAULT, fontStyle = 0
            scintilla.Styles[Style.Batch.Default].ForeColor = lexerColors[LexerType.Batch, "DefaultFore"];
            scintilla.Styles[Style.Batch.Default].BackColor = lexerColors[LexerType.Batch, "DefaultBack"];

            // COMMENT, fontStyle = 0
            scintilla.Styles[Style.Batch.Comment].ForeColor = lexerColors[LexerType.Batch, "CommentFore"];
            scintilla.Styles[Style.Batch.Comment].BackColor = lexerColors[LexerType.Batch, "CommentBack"];

            // KEYWORDS, fontStyle = 1
            scintilla.Styles[Style.Batch.Word].Bold      = true;
            scintilla.Styles[Style.Batch.Word].ForeColor = lexerColors[LexerType.Batch, "WordFore"];
            scintilla.Styles[Style.Batch.Word].BackColor = lexerColors[LexerType.Batch, "WordBack"];

            // LABEL, fontStyle = 1
            scintilla.Styles[Style.Batch.Label].Bold      = true;
            scintilla.Styles[Style.Batch.Label].ForeColor = lexerColors[LexerType.Batch, "LabelFore"];
            scintilla.Styles[Style.Batch.Label].BackColor = lexerColors[LexerType.Batch, "LabelBack"];

            // HIDE SYBOL, fontStyle = 0
            scintilla.Styles[Style.Batch.Hide].ForeColor = lexerColors[LexerType.Batch, "HideFore"];
            scintilla.Styles[Style.Batch.Hide].BackColor = lexerColors[LexerType.Batch, "HideBack"];

            // COMMAND, fontStyle = 0
            scintilla.Styles[Style.Batch.Command].ForeColor = lexerColors[LexerType.Batch, "CommandFore"];
            scintilla.Styles[Style.Batch.Command].BackColor = lexerColors[LexerType.Batch, "CommandBack"];

            // VARIABLE, fontStyle = 1
            scintilla.Styles[Style.Batch.Identifier].Bold      = true;
            scintilla.Styles[Style.Batch.Identifier].ForeColor = lexerColors[LexerType.Batch, "IdentifierFore"];
            scintilla.Styles[Style.Batch.Identifier].BackColor = lexerColors[LexerType.Batch, "IdentifierBack"];

            // OPERATOR, fontStyle = 1
            scintilla.Styles[Style.Batch.Operator].Bold      = true;
            scintilla.Styles[Style.Batch.Operator].ForeColor = lexerColors[LexerType.Batch, "OperatorFore"];
            scintilla.Styles[Style.Batch.Operator].BackColor = lexerColors[LexerType.Batch, "OperatorBack"];
            scintilla.Lexer = Lexer.Batch;

            ScintillaKeyWords.SetKeywords(scintilla, LexerType.Batch);

            AddFolding(scintilla);
            return(true);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates the lexer for a given Scintilla class instance for the PHP programming language.
        /// </summary>
        /// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
        /// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
        /// <returns>True if the operation was successful; otherwise false.</returns>
        public static bool CreatePhpLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors)
        {
            ClearStyle(scintilla);

            //..therefore the weird logic.. (which might malfunction)..
            SetPhpStyles(scintilla, lexerColors);
            SetHtmlStyles(scintilla, lexerColors);

            scintilla.Lexer = Lexer.PhpScript;

            ScintillaKeyWords.SetKeywords(scintilla, LexerType.PHP);

            SetScriptedHtml(LexerType.PHP, scintilla, lexerColors);

            AddFolding(scintilla);
            return(true);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates the lexer for a given Scintilla class instance for the HTML (Hypertext Markup Language).
        /// </summary>
        /// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
        /// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
        /// <returns>True if the operation was successful; otherwise false.</returns>
        public static bool CreateHtmlLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors)
        {
            // HTML should be simple but the embedded scripts make it hard for lexical "analysis"..
            ClearStyle(scintilla);

            //..therefore the weird logic.. (which might malfunction)..
            SetHtmlStyles(scintilla, lexerColors);
            SetPhpStyles(scintilla, lexerColors);

            scintilla.Lexer = Lexer.Html;

            ScintillaKeyWords.SetKeywords(scintilla, LexerType.HTML);

            SetScriptedHtml(LexerType.HTML, scintilla, lexerColors);

            AddFolding(scintilla);
            return(true);
        }
        /// <summary>
        /// Creates the lexer for a given Scintilla class instance for the Windows PowerShell script language.
        /// </summary>
        /// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
        /// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
        /// <returns>True if the operation was successful; otherwise false.</returns>
        public static bool CreatePowerShellLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors)
        {
            ClearStyle(scintilla);

            // DEFAULT, fontStyle = 0, styleId = 0
            scintilla.Styles[Style.PowerShell.Default].ForeColor =
                lexerColors[LexerType.WindowsPowerShell, "DefaultFore"];
            scintilla.Styles[Style.PowerShell.Default].BackColor =
                lexerColors[LexerType.WindowsPowerShell, "DefaultBack"];

            // COMMENT, fontStyle = 0, styleId = 1
            scintilla.Styles[Style.PowerShell.Comment].ForeColor =
                lexerColors[LexerType.WindowsPowerShell, "CommentFore"];
            scintilla.Styles[Style.PowerShell.Comment].BackColor =
                lexerColors[LexerType.WindowsPowerShell, "CommentBack"];

            // STRING, fontStyle = 0, styleId = 2
            scintilla.Styles[Style.PowerShell.String].ForeColor =
                lexerColors[LexerType.WindowsPowerShell, "StringFore"];
            scintilla.Styles[Style.PowerShell.String].BackColor =
                lexerColors[LexerType.WindowsPowerShell, "StringBack"];

            // CHARACTER, fontStyle = 0, styleId = 3
            scintilla.Styles[Style.PowerShell.Character].ForeColor =
                lexerColors[LexerType.WindowsPowerShell, "CharacterFore"];
            scintilla.Styles[Style.PowerShell.Character].BackColor =
                lexerColors[LexerType.WindowsPowerShell, "CharacterBack"];

            // NUMBER, fontStyle = 0, styleId = 4
            scintilla.Styles[Style.PowerShell.Number].ForeColor =
                lexerColors[LexerType.WindowsPowerShell, "NumberFore"];
            scintilla.Styles[Style.PowerShell.Number].BackColor =
                lexerColors[LexerType.WindowsPowerShell, "NumberBack"];

            // VARIABLE, fontStyle = 1, styleId = 5
            scintilla.Styles[Style.PowerShell.Variable].Bold      = true;
            scintilla.Styles[Style.PowerShell.Variable].ForeColor =
                lexerColors[LexerType.WindowsPowerShell, "VariableFore"];
            scintilla.Styles[Style.PowerShell.Variable].BackColor =
                lexerColors[LexerType.WindowsPowerShell, "VariableBack"];

            // OPERATOR, fontStyle = 1, styleId = 6
            scintilla.Styles[Style.PowerShell.Operator].Bold      = true;
            scintilla.Styles[Style.PowerShell.Operator].ForeColor =
                lexerColors[LexerType.WindowsPowerShell, "OperatorFore"];
            scintilla.Styles[Style.PowerShell.Operator].BackColor =
                lexerColors[LexerType.WindowsPowerShell, "OperatorBack"];

            // INSTRUCTION WORD, fontStyle = 1, styleId = 8
            scintilla.Styles[Style.PowerShell.Keyword].Bold      = true;
            scintilla.Styles[Style.PowerShell.Keyword].ForeColor =
                lexerColors[LexerType.WindowsPowerShell, "InstructionWordFore"];
            scintilla.Styles[Style.PowerShell.Keyword].BackColor =
                lexerColors[LexerType.WindowsPowerShell, "InstructionWordBack"];

            // CMDLET, fontStyle = 0, styleId = 9
            scintilla.Styles[Style.PowerShell.Cmdlet].ForeColor =
                lexerColors[LexerType.WindowsPowerShell, "CommandletFore"];
            scintilla.Styles[Style.PowerShell.Cmdlet].BackColor =
                lexerColors[LexerType.WindowsPowerShell, "CommandletBack"];

            // ALIAS, fontStyle = 0, styleId = 10
            scintilla.Styles[Style.PowerShell.Alias].ForeColor = lexerColors[LexerType.WindowsPowerShell, "AliasFore"];
            scintilla.Styles[Style.PowerShell.Alias].BackColor = lexerColors[LexerType.WindowsPowerShell, "AliasBack"];

            // COMMENT STREAM, fontStyle = 0, styleId = 13
            scintilla.Styles[Style.PowerShell.CommentStream].ForeColor =
                lexerColors[LexerType.WindowsPowerShell, "CommentStreamFore"];
            scintilla.Styles[Style.PowerShell.CommentStream].BackColor =
                lexerColors[LexerType.WindowsPowerShell, "CommentStreamBack"];

            // HERE STRING, fontStyle = 0, styleId = 14
            scintilla.Styles[Style.PowerShell.HereString].ForeColor =
                lexerColors[LexerType.WindowsPowerShell, "HereStringFore"];
            scintilla.Styles[Style.PowerShell.HereString].BackColor =
                lexerColors[LexerType.WindowsPowerShell, "HereStringBack"];

            // HERE CHARACTER, fontStyle = 0, styleId = 15
            scintilla.Styles[Style.PowerShell.HereCharacter].ForeColor =
                lexerColors[LexerType.WindowsPowerShell, "HereCharacterFore"];
            scintilla.Styles[Style.PowerShell.HereCharacter].BackColor =
                lexerColors[LexerType.WindowsPowerShell, "HereCharacterBack"];

            // COMMENT DOC KEYWORD, fontStyle = 1, styleId = 16
            scintilla.Styles[Style.PowerShell.CommentDocKeyword].Bold      = true;
            scintilla.Styles[Style.PowerShell.CommentDocKeyword].ForeColor =
                lexerColors[LexerType.WindowsPowerShell, "CommentDocKeywordFore"];
            scintilla.Styles[Style.PowerShell.CommentDocKeyword].BackColor =
                lexerColors[LexerType.WindowsPowerShell, "CommentDocKeywordBack"];

            ScintillaKeyWords.SetKeywords(scintilla, LexerType.WindowsPowerShell);

            scintilla.Lexer = Lexer.PowerShell;

            AddFolding(scintilla);

            return(true);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Creates the lexer for a given Scintilla class instance for the YAML (YAML Ain't Markup Language).
        /// </summary>
        /// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
        /// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
        /// <returns>True if the operation was successful; otherwise false.</returns>
        public static bool CreateYamlLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors)
        {
            ClearStyle(scintilla);

            #region YAML_CONSTANTS
            const int SCE_YAML_DEFAULT    = 0;
            const int SCE_YAML_COMMENT    = 1;
            const int SCE_YAML_IDENTIFIER = 2;
            const int SCE_YAML_KEYWORD    = 3;
            const int SCE_YAML_NUMBER     = 4;
            const int SCE_YAML_REFERENCE  = 5;
            const int SCE_YAML_DOCUMENT   = 6;
            const int SCE_YAML_TEXT       = 7;
            const int SCE_YAML_ERROR      = 8;
            const int SCE_YAML_OPERATOR   = 9;
            #endregion

            // DEFAULT, fontStyle = 0
            scintilla.Styles[SCE_YAML_DEFAULT].ForeColor = lexerColors[LexerType.YAML, "YamlDefaultFore"];
            scintilla.Styles[SCE_YAML_DEFAULT].BackColor = lexerColors[LexerType.YAML, "YamlDefaultBack"];

            // COMMENT, fontStyle = 1
            scintilla.Styles[SCE_YAML_COMMENT].ForeColor = lexerColors[LexerType.YAML, "CommentFore"];
            scintilla.Styles[SCE_YAML_COMMENT].BackColor = lexerColors[LexerType.YAML, "CommentBack"];

            // IDENTIFIER, fontStyle = 2
            scintilla.Styles[SCE_YAML_IDENTIFIER].Bold      = true;
            scintilla.Styles[SCE_YAML_IDENTIFIER].ForeColor = lexerColors[LexerType.YAML, "IdentifierFore"];
            scintilla.Styles[SCE_YAML_IDENTIFIER].BackColor = lexerColors[LexerType.YAML, "IdentifierBack"];

            // KEYWORD, fontStyle = 3
            scintilla.Styles[SCE_YAML_KEYWORD].Bold      = true;
            scintilla.Styles[SCE_YAML_KEYWORD].ForeColor = lexerColors[LexerType.YAML, "KeywordFore"];
            scintilla.Styles[SCE_YAML_KEYWORD].BackColor = lexerColors[LexerType.YAML, "KeywordBack"];

            // NUMBER, fontStyle = 4
            scintilla.Styles[SCE_YAML_NUMBER].ForeColor = lexerColors[LexerType.YAML, "NumberFore"];
            scintilla.Styles[SCE_YAML_NUMBER].BackColor = lexerColors[LexerType.YAML, "NumberBack"];

            // REFERENCE, fontStyle = 5
            scintilla.Styles[SCE_YAML_REFERENCE].ForeColor = lexerColors[LexerType.YAML, "ReferenceFore"];
            scintilla.Styles[SCE_YAML_REFERENCE].BackColor = lexerColors[LexerType.YAML, "ReferenceBack"];

            // DOCUMENT, fontStyle = 6
            scintilla.Styles[SCE_YAML_DOCUMENT].ForeColor = lexerColors[LexerType.YAML, "DocumentFore"];
            scintilla.Styles[SCE_YAML_DOCUMENT].BackColor = lexerColors[LexerType.YAML, "DocumentBack"];

            // TEXT, fontStyle = 7
            scintilla.Styles[SCE_YAML_TEXT].Bold      = true;
            scintilla.Styles[SCE_YAML_TEXT].ForeColor = lexerColors[LexerType.YAML, "TextFore"];
            scintilla.Styles[SCE_YAML_TEXT].BackColor = lexerColors[LexerType.YAML, "TextBack"];

            // ERROR, fontStyle = 8
            scintilla.Styles[SCE_YAML_ERROR].ForeColor = lexerColors[LexerType.YAML, "ErrorFore"];
            scintilla.Styles[SCE_YAML_ERROR].BackColor = lexerColors[LexerType.YAML, "ErrorBack"];

            // OPERATOR, fontStyle = 9
            scintilla.Styles[SCE_YAML_OPERATOR].ForeColor = lexerColors[LexerType.YAML, "OperatorFore"];
            scintilla.Styles[SCE_YAML_OPERATOR].BackColor = lexerColors[LexerType.YAML, "OperatorBack"];

            scintilla.Lexer = (Lexer)LexerTypeName.SCLEX_YAML;

            ScintillaKeyWords.SetKeywords(scintilla, LexerType.YAML);

            AddFolding(scintilla);
            return(true);
        }
        /// <summary>
        /// Creates the lexer for a given Scintilla class instance for the InnoSetup programming language.
        /// </summary>
        /// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
        /// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
        /// <returns>True if the operation was successful; otherwise false.</returns>
        public static bool CreateInnoSetupLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors)
        {
            ClearStyle(scintilla);

            // DEFAULT, fontStyle = 0
            scintilla.Styles[InnoSetup.Default].ForeColor = lexerColors[LexerType.InnoSetup, "DefaultFore"];
            scintilla.Styles[InnoSetup.Default].BackColor = lexerColors[LexerType.InnoSetup, "DefaultBack"];

            // IDENTIFIER, fontStyle = 0
            scintilla.Styles[InnoSetup.Identifier].ForeColor = lexerColors[LexerType.InnoSetup, "IdentifierFore"];
            scintilla.Styles[InnoSetup.Identifier].BackColor = lexerColors[LexerType.InnoSetup, "IdentifierBack"];

            // COMMENT, fontStyle = 0
            scintilla.Styles[InnoSetup.Comment].ForeColor = lexerColors[LexerType.InnoSetup, "CommentFore"];
            scintilla.Styles[InnoSetup.Comment].BackColor = lexerColors[LexerType.InnoSetup, "CommentBack"];

            // COMMENT LINE, fontStyle = 0
            scintilla.Styles[InnoSetup.Comment2].ForeColor = lexerColors[LexerType.InnoSetup, "Comment2Fore"];
            scintilla.Styles[InnoSetup.Comment2].BackColor = lexerColors[LexerType.InnoSetup, "Comment2Back"];

            // COMMENT DOC, fontStyle = 0
            scintilla.Styles[InnoSetup.CommentLine].ForeColor = lexerColors[LexerType.InnoSetup, "CommentLineFore"];
            scintilla.Styles[InnoSetup.CommentLine].BackColor = lexerColors[LexerType.InnoSetup, "CommentLineBack"];

            // PREPROCESSOR, fontStyle = 0
            scintilla.Styles[InnoSetup.Preprocessor].ForeColor = lexerColors[LexerType.InnoSetup, "PreprocessorFore"];
            scintilla.Styles[InnoSetup.Preprocessor].BackColor = lexerColors[LexerType.InnoSetup, "PreprocessorBack"];

            // PREPROCESSOR2, fontStyle = 0
            scintilla.Styles[InnoSetup.Preprocessor2].ForeColor = lexerColors[LexerType.InnoSetup, "Preprocessor2Fore"];
            scintilla.Styles[InnoSetup.Preprocessor2].BackColor = lexerColors[LexerType.InnoSetup, "Preprocessor2Back"];

            // NUMBER, fontStyle = 0
            scintilla.Styles[InnoSetup.Number].ForeColor = lexerColors[LexerType.InnoSetup, "NumberFore"];
            scintilla.Styles[InnoSetup.Number].BackColor = lexerColors[LexerType.InnoSetup, "NumberBack"];

            // HEX NUMBER, fontStyle = 0
            scintilla.Styles[InnoSetup.HexNumber].ForeColor = lexerColors[LexerType.InnoSetup, "HexNumberFore"];
            scintilla.Styles[InnoSetup.HexNumber].BackColor = lexerColors[LexerType.InnoSetup, "HexNumberBack"];

            // INSTRUCTION WORD, fontStyle = 1
            scintilla.Styles[InnoSetup.Word].Bold      = true;
            scintilla.Styles[InnoSetup.Word].ForeColor = lexerColors[LexerType.InnoSetup, "WordFore"];
            scintilla.Styles[InnoSetup.Word].BackColor = lexerColors[LexerType.InnoSetup, "WordBack"];

            // STRING, fontStyle = 0
            scintilla.Styles[InnoSetup.String].ForeColor = lexerColors[LexerType.InnoSetup, "StringFore"];
            scintilla.Styles[InnoSetup.String].BackColor = lexerColors[LexerType.InnoSetup, "StringBack"];

            // CHARACTER, fontStyle = 0
            scintilla.Styles[InnoSetup.Character].ForeColor = lexerColors[LexerType.InnoSetup, "CharacterFore"];
            scintilla.Styles[InnoSetup.Character].BackColor = lexerColors[LexerType.InnoSetup, "CharacterBack"];

            // OPERATOR, fontStyle = 1
            scintilla.Styles[InnoSetup.Operator].Bold      = true;
            scintilla.Styles[InnoSetup.Operator].ForeColor = lexerColors[LexerType.InnoSetup, "OperatorFore"];
            scintilla.Styles[InnoSetup.Operator].BackColor = lexerColors[LexerType.InnoSetup, "OperatorBack"];

            // ASM, fontStyle = 1
            scintilla.Styles[InnoSetup.Asm].Bold      = true;
            scintilla.Styles[InnoSetup.Asm].ForeColor = lexerColors[LexerType.InnoSetup, "ForeColorFore"];
            scintilla.Styles[InnoSetup.Asm].BackColor = lexerColors[LexerType.InnoSetup, "ForeColorBack"];

            scintilla.Lexer = (Lexer)LexerTypeName.SCLEX_INNOSETUP;

            ScintillaKeyWords.SetKeywords(scintilla, LexerType.InnoSetup);

            AddFolding(scintilla);
            return(true);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Creates the lexer for a given Scintilla class instance for the Cascading Style Sheets (CSS).
        /// </summary>
        /// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
        /// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
        /// <returns>True if the operation was successful; otherwise false.</returns>
        public static bool CreateCssLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors)
        {
            ClearStyle(scintilla);

            // DEFAULT, fontStyle = 0, styleId = 0
            scintilla.Styles[Style.Css.Default].ForeColor = lexerColors[LexerType.Css, "DefaultFore"];
            scintilla.Styles[Style.Css.Default].BackColor = lexerColors[LexerType.Css, "DefaultFore"];

            // TAG, fontStyle = 0, styleId = 1
            scintilla.Styles[Style.Css.Tag].ForeColor = lexerColors[LexerType.Css, "TagFore"];
            scintilla.Styles[Style.Css.Tag].BackColor = lexerColors[LexerType.Css, "TagBack"];

            // CLASS, fontStyle = 0, styleId = 2
            scintilla.Styles[Style.Css.Class].ForeColor = lexerColors[LexerType.Css, "ClassFore"];
            scintilla.Styles[Style.Css.Class].BackColor = lexerColors[LexerType.Css, "ClassBack"];

            // PSEUDOCLASS, fontStyle = 1, styleId = 3
            scintilla.Styles[Style.Css.PseudoClass].Bold      = true;
            scintilla.Styles[Style.Css.PseudoClass].ForeColor = lexerColors[LexerType.Css, "PseudoClassFore"];
            scintilla.Styles[Style.Css.PseudoClass].BackColor = lexerColors[LexerType.Css, "PseudoClassBack"];

            // UNKNOWN_PSEUDOCLASS, fontStyle = 0, styleId = 4
            scintilla.Styles[Style.Css.UnknownPseudoClass].ForeColor = lexerColors[LexerType.Css, "UnknownPseudoClassFore"];
            scintilla.Styles[Style.Css.UnknownPseudoClass].BackColor = lexerColors[LexerType.Css, "UnknownPseudoClassBack"];

            // OPERATOR, fontStyle = 1, styleId = 5
            scintilla.Styles[Style.Css.Operator].Bold      = true;
            scintilla.Styles[Style.Css.Operator].ForeColor = lexerColors[LexerType.Css, "OperatorFore"];
            scintilla.Styles[Style.Css.Operator].BackColor = lexerColors[LexerType.Css, "OperatorBack"];

            // IDENTIFIER, fontStyle = 1, styleId = 6
            scintilla.Styles[Style.Css.Identifier].Bold      = true;
            scintilla.Styles[Style.Css.Identifier].ForeColor = lexerColors[LexerType.Css, "IdentifierFore"];
            scintilla.Styles[Style.Css.Identifier].BackColor = lexerColors[LexerType.Css, "IdentifierBack"];

            // UNKNOWN_IDENTIFIER, fontStyle = 0, styleId = 7
            scintilla.Styles[Style.Css.UnknownIdentifier].ForeColor = lexerColors[LexerType.Css, "UnknownIdentifierFore"];
            scintilla.Styles[Style.Css.UnknownIdentifier].BackColor = lexerColors[LexerType.Css, "UnknownIdentifierBack"];

            // VALUE, fontStyle = 1, styleId = 8
            scintilla.Styles[Style.Css.Value].Bold      = true;
            scintilla.Styles[Style.Css.Value].ForeColor = lexerColors[LexerType.Css, "ValueFore"];
            scintilla.Styles[Style.Css.Value].BackColor = lexerColors[LexerType.Css, "ValueBack"];

            // COMMENT, fontStyle = 0, styleId = 9
            scintilla.Styles[Style.Css.Comment].ForeColor = lexerColors[LexerType.Css, "CommentFore"];
            scintilla.Styles[Style.Css.Comment].BackColor = lexerColors[LexerType.Css, "CommentBack"];

            // ID, fontStyle = 1, styleId = 10
            scintilla.Styles[Style.Css.Id].Bold      = true;
            scintilla.Styles[Style.Css.Id].ForeColor = lexerColors[LexerType.Css, "IdFore"];
            scintilla.Styles[Style.Css.Id].BackColor = lexerColors[LexerType.Css, "IdBack"];

            // IMPORTANT, fontStyle = 1, styleId = 11
            scintilla.Styles[Style.Css.Important].Bold      = true;
            scintilla.Styles[Style.Css.Important].ForeColor = lexerColors[LexerType.Css, "ImportantFore"];
            scintilla.Styles[Style.Css.Important].BackColor = lexerColors[LexerType.Css, "ImportantBack"];

            // DIRECTIVE, fontStyle = 0, styleId = 12
            scintilla.Styles[Style.Css.Directive].ForeColor = lexerColors[LexerType.Css, "DirectiveFore"];
            scintilla.Styles[Style.Css.Directive].BackColor = lexerColors[LexerType.Css, "DirectiveBack"];


            scintilla.Lexer = Lexer.Css;

            ScintillaKeyWords.SetKeywords(scintilla, LexerType.Css);

            AddFolding(scintilla);

            return(true);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Creates the lexer for a given Scintilla class instance for the NSIS (Nullsoft Scriptable Install System).
        /// </summary>
        /// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
        /// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
        /// <returns>True if the operation was successful; otherwise false.</returns>
        public static bool CreateNsisLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors)
        {
            ClearStyle(scintilla);

            // NSIS not found..
            #region NSIS_CONSTANTS
            const int SCE_NSIS_DEFAULT       = 0;
            const int SCE_NSIS_COMMENT       = 1;
            const int SCE_NSIS_STRINGDQ      = 2;
            const int SCE_NSIS_STRINGLQ      = 3;
            const int SCE_NSIS_STRINGRQ      = 4;
            const int SCE_NSIS_FUNCTION      = 5;
            const int SCE_NSIS_VARIABLE      = 6;
            const int SCE_NSIS_LABEL         = 7;
            const int SCE_NSIS_USERDEFINED   = 8;
            const int SCE_NSIS_SECTIONDEF    = 9;
            const int SCE_NSIS_SUBSECTIONDEF = 10;
            const int SCE_NSIS_IFDEFINEDEF   = 11;
            const int SCE_NSIS_MACRODEF      = 12;
            const int SCE_NSIS_STRINGVAR     = 13;
            const int SCE_NSIS_NUMBER        = 14;
            const int SCE_NSIS_SECTIONGROUP  = 15;
            const int SCE_NSIS_PAGEEX        = 16;
            const int SCE_NSIS_FUNCTIONDEF   = 17;
            const int SCE_NSIS_COMMENTBOX    = 18;
            #endregion

            // DEFAULT, fontStyle = 0
            scintilla.Styles[SCE_NSIS_DEFAULT].ForeColor = lexerColors[LexerType.Nsis, "DefaultFore"];
            scintilla.Styles[SCE_NSIS_DEFAULT].BackColor = lexerColors[LexerType.Nsis, "DefaultBack"];

            // COMMENTLINE, fontStyle = 0
            scintilla.Styles[SCE_NSIS_COMMENT].ForeColor = lexerColors[LexerType.Nsis, "CommentFore"];
            scintilla.Styles[SCE_NSIS_COMMENT].BackColor = lexerColors[LexerType.Nsis, "CommentBack"];

            // STRING DOUBLE QUOTE, fontStyle = 0
            scintilla.Styles[SCE_NSIS_STRINGDQ].ForeColor = lexerColors[LexerType.Nsis, "StringDoubleQuoteFore"];
            scintilla.Styles[SCE_NSIS_STRINGDQ].BackColor = lexerColors[LexerType.Nsis, "StringDoubleQuoteBack"];

            // STRING LEFT QUOTE, fontStyle = 0
            scintilla.Styles[SCE_NSIS_STRINGLQ].ForeColor = lexerColors[LexerType.Nsis, "StringLeftQuoteFore"];
            scintilla.Styles[SCE_NSIS_STRINGLQ].BackColor = lexerColors[LexerType.Nsis, "StringLeftQuoteBack"];

            // STRING RIGHT QUOTE, fontStyle = 0
            scintilla.Styles[SCE_NSIS_STRINGRQ].ForeColor = lexerColors[LexerType.Nsis, "StringRightQuoteFore"];
            scintilla.Styles[SCE_NSIS_STRINGRQ].BackColor = lexerColors[LexerType.Nsis, "StringRightQuoteBack"];

            // FUNCTION, fontStyle = 0
            scintilla.Styles[SCE_NSIS_FUNCTION].ForeColor = lexerColors[LexerType.Nsis, "FunctionFore"];
            scintilla.Styles[SCE_NSIS_FUNCTION].BackColor = lexerColors[LexerType.Nsis, "FunctionBack"];

            // VARIABLE, fontStyle = 0
            scintilla.Styles[SCE_NSIS_VARIABLE].ForeColor = lexerColors[LexerType.Nsis, "VariableFore"];
            scintilla.Styles[SCE_NSIS_VARIABLE].BackColor = lexerColors[LexerType.Nsis, "VariableBack"];

            // LABEL, fontStyle = 0
            scintilla.Styles[SCE_NSIS_LABEL].ForeColor = lexerColors[LexerType.Nsis, "LabelFore"];
            scintilla.Styles[SCE_NSIS_LABEL].BackColor = lexerColors[LexerType.Nsis, "LabelBack"];

            // USER DEFINED, fontStyle = 4
            scintilla.Styles[SCE_NSIS_USERDEFINED].ForeColor = lexerColors[LexerType.Nsis, "UserDefinedFore"];
            scintilla.Styles[SCE_NSIS_USERDEFINED].BackColor = lexerColors[LexerType.Nsis, "UserDefinedBack"];

            // SECTION, fontStyle = 1
            scintilla.Styles[SCE_NSIS_SECTIONDEF].Bold      = true;
            scintilla.Styles[SCE_NSIS_SECTIONDEF].ForeColor = lexerColors[LexerType.Nsis, "SectionFore"];
            scintilla.Styles[SCE_NSIS_SECTIONDEF].BackColor = lexerColors[LexerType.Nsis, "SectionBack"];

            // SUBSECTION, fontStyle = 1
            scintilla.Styles[SCE_NSIS_SUBSECTIONDEF].Bold      = true;
            scintilla.Styles[SCE_NSIS_SUBSECTIONDEF].ForeColor = lexerColors[LexerType.Nsis, "SubSectionFore"];
            scintilla.Styles[SCE_NSIS_SUBSECTIONDEF].BackColor = lexerColors[LexerType.Nsis, "SubSectionBack"];

            // IF DEFINE, fontStyle = 0
            scintilla.Styles[SCE_NSIS_IFDEFINEDEF].ForeColor = lexerColors[LexerType.Nsis, "IfDefineFore"];
            scintilla.Styles[SCE_NSIS_IFDEFINEDEF].BackColor = lexerColors[LexerType.Nsis, "IfDefineBack"];

            // MACRO, fontStyle = 1
            scintilla.Styles[SCE_NSIS_MACRODEF].Bold      = true;
            scintilla.Styles[SCE_NSIS_MACRODEF].ForeColor = lexerColors[LexerType.Nsis, "MacroFore"];
            scintilla.Styles[SCE_NSIS_MACRODEF].BackColor = lexerColors[LexerType.Nsis, "MacroBack"];

            // STRING VAR, fontStyle = 0
            scintilla.Styles[SCE_NSIS_STRINGVAR].ForeColor = lexerColors[LexerType.Nsis, "StringVarFore"];
            scintilla.Styles[SCE_NSIS_STRINGVAR].BackColor = lexerColors[LexerType.Nsis, "StringVarBack"];

            // NUMBER, fontStyle = 0
            scintilla.Styles[SCE_NSIS_NUMBER].ForeColor = lexerColors[LexerType.Nsis, "NumberFore"];
            scintilla.Styles[SCE_NSIS_NUMBER].BackColor = lexerColors[LexerType.Nsis, "NumberBack"];

            // SECTION GROUP, fontStyle = 1
            scintilla.Styles[SCE_NSIS_SECTIONGROUP].Bold      = true;
            scintilla.Styles[SCE_NSIS_SECTIONGROUP].ForeColor = lexerColors[LexerType.Nsis, "SectionGroupFore"];
            scintilla.Styles[SCE_NSIS_SECTIONGROUP].BackColor = lexerColors[LexerType.Nsis, "SectionGroupBack"];

            // PAGE EX, fontStyle = 1
            scintilla.Styles[SCE_NSIS_PAGEEX].Bold      = true;
            scintilla.Styles[SCE_NSIS_PAGEEX].ForeColor = lexerColors[LexerType.Nsis, "PageExFore"];
            scintilla.Styles[SCE_NSIS_PAGEEX].BackColor = lexerColors[LexerType.Nsis, "PageExBack"];

            // FUNCTION DEFINITIONS, fontStyle = 1
            scintilla.Styles[SCE_NSIS_FUNCTIONDEF].Bold      = true;
            scintilla.Styles[SCE_NSIS_FUNCTIONDEF].ForeColor = lexerColors[LexerType.Nsis, "FunctionDefinitionsFore"];
            scintilla.Styles[SCE_NSIS_FUNCTIONDEF].BackColor = lexerColors[LexerType.Nsis, "FunctionDefinitionsBack"];

            // COMMENT, fontStyle = 0
            scintilla.Styles[SCE_NSIS_COMMENTBOX].ForeColor = lexerColors[LexerType.Nsis, "CommentFore"];
            scintilla.Styles[SCE_NSIS_COMMENTBOX].BackColor = lexerColors[LexerType.Nsis, "CommentBack"];

            scintilla.Lexer = (Lexer)LexerTypeName.SCLEX_NSIS;

            ScintillaKeyWords.SetKeywords(scintilla, LexerType.Nsis);

            AddFolding(scintilla);
            return(true);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Creates the lexer for a given Scintilla class instance for the Java programming language.
        /// </summary>
        /// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
        /// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
        /// <returns>True if the operation was successful; otherwise false.</returns>
        public static bool CreateJavaScriptLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors)
        {
            ClearStyle(scintilla);

            // 11 ?, Style.Cpp.Default = 0..
            // DEFAULT, fontStyle = 0, styleId = 11
            scintilla.Styles[Style.Cpp.Default].ForeColor = lexerColors[LexerType.JavaScript, "DefaultFore"];
            scintilla.Styles[Style.Cpp.Default].BackColor = lexerColors[LexerType.JavaScript, "DefaultBack"];
            // TODO::From here onward!!

            // INSTRUCTION WORD, fontStyle = 1, styleId = 5
            scintilla.Styles[Style.Cpp.Word].Bold      = true;
            scintilla.Styles[Style.Cpp.Word].ForeColor = lexerColors[LexerType.JavaScript, "InstructionWordFore"];
            scintilla.Styles[Style.Cpp.Word].BackColor = lexerColors[LexerType.JavaScript, "InstructionWordBack"];

            // TYPE WORD, fontStyle = 0, styleId = 16
            scintilla.Styles[Style.Cpp.Word2].ForeColor = lexerColors[LexerType.JavaScript, "TypeWordFore"];
            scintilla.Styles[Style.Cpp.Word2].BackColor = lexerColors[LexerType.JavaScript, "TypeWordBack"];

            // WINDOW INSTRUCTION, fontStyle = 1, styleId = 19
            scintilla.Styles[Style.Cpp.GlobalClass].Bold      = true;
            scintilla.Styles[Style.Cpp.GlobalClass].ForeColor = lexerColors[LexerType.JavaScript, "WindowInstructionFore"];
            scintilla.Styles[Style.Cpp.GlobalClass].BackColor = lexerColors[LexerType.JavaScript, "WindowInstructionBack"];

            // NUMBER, fontStyle = 0, styleId = 4
            scintilla.Styles[Style.Cpp.Number].ForeColor = lexerColors[LexerType.JavaScript, "NumberFore"];
            scintilla.Styles[Style.Cpp.Number].BackColor = lexerColors[LexerType.JavaScript, "NumberBack"];

            // STRING, fontStyle = 0, styleId = 6
            scintilla.Styles[Style.Cpp.String].ForeColor = lexerColors[LexerType.JavaScript, "StringFore"];
            scintilla.Styles[Style.Cpp.String].BackColor = lexerColors[LexerType.JavaScript, "StringBack"];

            // STRINGRAW, fontStyle = 0, styleId = 20
            scintilla.Styles[Style.Cpp.StringRaw].ForeColor = lexerColors[LexerType.JavaScript, "StringRawFore"];
            scintilla.Styles[Style.Cpp.StringRaw].BackColor = lexerColors[LexerType.JavaScript, "StringRawBack"];

            // CHARACTER, fontStyle = 0, styleId = 7
            scintilla.Styles[Style.Cpp.Character].ForeColor = lexerColors[LexerType.JavaScript, "CharacterFore"];
            scintilla.Styles[Style.Cpp.Character].BackColor = lexerColors[LexerType.JavaScript, "CharacterBack"];

            // OPERATOR, fontStyle = 1, styleId = 10
            scintilla.Styles[Style.Cpp.Operator].Bold      = true;
            scintilla.Styles[Style.Cpp.Operator].ForeColor = lexerColors[LexerType.JavaScript, "OperatorFore"];
            scintilla.Styles[Style.Cpp.Operator].BackColor = lexerColors[LexerType.JavaScript, "OperatorBack"];

            // VERBATIM, fontStyle = 0, styleId = 13
            scintilla.Styles[Style.Cpp.Verbatim].ForeColor = lexerColors[LexerType.JavaScript, "VerbatimFore"];
            scintilla.Styles[Style.Cpp.Verbatim].BackColor = lexerColors[LexerType.JavaScript, "VerbatimBack"];

            // REGEX, fontStyle = 1, styleId = 14
            scintilla.Styles[Style.Cpp.Regex].Bold      = true;
            scintilla.Styles[Style.Cpp.Regex].ForeColor = lexerColors[LexerType.JavaScript, "RegexFore"];
            scintilla.Styles[Style.Cpp.Regex].BackColor = lexerColors[LexerType.JavaScript, "RegexBack"];

            // COMMENT, fontStyle = 0, styleId = 1
            scintilla.Styles[Style.Cpp.Comment].ForeColor = lexerColors[LexerType.JavaScript, "CommentFore"];
            scintilla.Styles[Style.Cpp.Comment].BackColor = lexerColors[LexerType.JavaScript, "CommentBack"];

            // COMMENT LINE, fontStyle = 0, styleId = 2
            scintilla.Styles[Style.Cpp.CommentLine].ForeColor = lexerColors[LexerType.JavaScript, "CommentLineFore"];
            scintilla.Styles[Style.Cpp.CommentLine].BackColor = lexerColors[LexerType.JavaScript, "CommentLineBack"];

            // COMMENT DOC, fontStyle = 0, styleId = 3
            scintilla.Styles[Style.Cpp.CommentDoc].ForeColor = lexerColors[LexerType.JavaScript, "CommentDocFore"];
            scintilla.Styles[Style.Cpp.CommentDoc].BackColor = lexerColors[LexerType.JavaScript, "CommentDocBack"];

            // COMMENT LINE DOC, fontStyle = 0, styleId = 15
            scintilla.Styles[Style.Cpp.CommentLineDoc].ForeColor = lexerColors[LexerType.JavaScript, "CommentLineDocFore"];
            scintilla.Styles[Style.Cpp.CommentLineDoc].BackColor = lexerColors[LexerType.JavaScript, "CommentLineDocBack"];

            // COMMENT DOC KEYWORD, fontStyle = 1, styleId = 17
            scintilla.Styles[Style.Cpp.CommentDocKeyword].Bold      = true;
            scintilla.Styles[Style.Cpp.CommentDocKeyword].ForeColor = lexerColors[LexerType.JavaScript, "CommentDocKeywordFore"];
            scintilla.Styles[Style.Cpp.CommentDocKeyword].BackColor = lexerColors[LexerType.JavaScript, "CommentDocKeywordBack"];

            // COMMENT DOC KEYWORD ERROR, fontStyle = 0, styleId = 18
            scintilla.Styles[Style.Cpp.CommentDocKeywordError].ForeColor = lexerColors[LexerType.JavaScript, "CommentDocKeywordErrorFore"];
            scintilla.Styles[Style.Cpp.CommentDocKeywordError].BackColor = lexerColors[LexerType.JavaScript, "CommentDocKeywordErrorBack"];

            scintilla.Lexer = Lexer.Cpp;

            ScintillaKeyWords.SetKeywords(scintilla, LexerType.JavaScript);

            AddFolding(scintilla);

            return(true);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Creates the lexer for a given Scintilla class instance for the Python programming language.
        /// </summary>
        /// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
        /// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
        /// <returns>True if the operation was successful; otherwise false.</returns>
        public static bool CreatePythonLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors)
        {
            ClearStyle(scintilla);

            // DEFAULT, fontStyle = 0, styleId = 0
            scintilla.Styles[Style.Python.Default].ForeColor = lexerColors[LexerType.Python, "DefaultFore"];
            scintilla.Styles[Style.Python.Default].BackColor = lexerColors[LexerType.Python, "DefaultBack"];

            // COMMENTLINE, fontStyle = 0, styleId = 1
            scintilla.Styles[Style.Python.CommentLine].ForeColor = lexerColors[LexerType.Python, "CommentLineFore"];
            scintilla.Styles[Style.Python.CommentLine].BackColor = lexerColors[LexerType.Python, "CommentLineBack"];

            // NUMBER, fontStyle = 0, styleId = 2
            scintilla.Styles[Style.Python.Number].ForeColor = lexerColors[LexerType.Python, "NumberFore"];
            scintilla.Styles[Style.Python.Number].BackColor = lexerColors[LexerType.Python, "NumberBack"];

            // STRING, fontStyle = 0, styleId = 3
            scintilla.Styles[Style.Python.String].ForeColor = lexerColors[LexerType.Python, "StringFore"];
            scintilla.Styles[Style.Python.String].BackColor = lexerColors[LexerType.Python, "StringBack"];

            // CHARACTER, fontStyle = 0, styleId = 4
            scintilla.Styles[Style.Python.Character].ForeColor = lexerColors[LexerType.Python, "CharacterFore"];
            scintilla.Styles[Style.Python.Character].BackColor = lexerColors[LexerType.Python, "CharacterBack"];

            // KEYWORDS, fontStyle = 1, styleId = 5
            scintilla.Styles[Style.Python.Word].Bold      = true;
            scintilla.Styles[Style.Python.Word].ForeColor = lexerColors[LexerType.Python, "WordFore"];
            scintilla.Styles[Style.Python.Word].BackColor = lexerColors[LexerType.Python, "WordBack"];

            // TRIPLE, fontStyle = 0, styleId = 6
            scintilla.Styles[Style.Python.Triple].ForeColor = lexerColors[LexerType.Python, "TripleFore"];
            scintilla.Styles[Style.Python.Triple].BackColor = lexerColors[LexerType.Python, "TripleBack"];

            // TRIPLEDOUBLE, fontStyle = 0, styleId = 7
            scintilla.Styles[Style.Python.TripleDouble].ForeColor = lexerColors[LexerType.Python, "TripleDoubleFore"];
            scintilla.Styles[Style.Python.TripleDouble].BackColor = lexerColors[LexerType.Python, "TripleDoubleBack"];

            // CLASSNAME, fontStyle = 1, styleId = 8
            scintilla.Styles[Style.Python.ClassName].Bold      = true;
            scintilla.Styles[Style.Python.ClassName].ForeColor = lexerColors[LexerType.Python, "ClassNameFore"];
            scintilla.Styles[Style.Python.ClassName].BackColor = lexerColors[LexerType.Python, "ClassNameBack"];

            // DEFNAME, fontStyle = 0, styleId = 9
            scintilla.Styles[Style.Python.DefName].ForeColor = lexerColors[LexerType.Python, "DefNameFore"];
            scintilla.Styles[Style.Python.DefName].BackColor = lexerColors[LexerType.Python, "DefNameBack"];

            // OPERATOR, fontStyle = 1, styleId = 10
            scintilla.Styles[Style.Python.Operator].Bold      = true;
            scintilla.Styles[Style.Python.Operator].ForeColor = lexerColors[LexerType.Python, "OperatorFore"];
            scintilla.Styles[Style.Python.Operator].BackColor = lexerColors[LexerType.Python, "OperatorBack"];

            // IDENTIFIER, fontStyle = 0, styleId = 11
            scintilla.Styles[Style.Python.Identifier].ForeColor = lexerColors[LexerType.Python, "IdentifierFore"];
            scintilla.Styles[Style.Python.Identifier].BackColor = lexerColors[LexerType.Python, "IdentifierBack"];

            // COMMENTBLOCK, fontStyle = 0, styleId = 12
            scintilla.Styles[Style.Python.CommentBlock].ForeColor = lexerColors[LexerType.Python, "CommentBlockFore"];
            scintilla.Styles[Style.Python.CommentBlock].BackColor = lexerColors[LexerType.Python, "CommentBlockBack"];

            // DECORATOR, fontStyle = 2, styleId = 15
            scintilla.Styles[Style.Python.Decorator].Italic    = true;
            scintilla.Styles[Style.Python.Decorator].ForeColor = lexerColors[LexerType.Python, "DecoratorFore"];
            scintilla.Styles[Style.Python.Decorator].BackColor = lexerColors[LexerType.Python, "DecoratorBack"];

            scintilla.Lexer = Lexer.Python;

            ScintillaKeyWords.SetKeywords(scintilla, LexerType.Python);

            AddFolding(scintilla);

            return(true);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Creates the lexer for a given Scintilla class instance for the Java programming language.
        /// </summary>
        /// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
        /// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
        /// <returns>True if the operation was successful; otherwise false.</returns>
        public static bool CreateJavaLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors)
        {
            ClearStyle(scintilla);

            // PREPROCESSOR, fontStyle = 0, styleId = 9
            scintilla.Styles[Style.Cpp.Preprocessor].ForeColor = lexerColors[LexerType.Java, "PreprocessorFore"];
            scintilla.Styles[Style.Cpp.Preprocessor].BackColor = lexerColors[LexerType.Java, "PreprocessorBack"];

            // Style.Cpp.Identifier ?, Style.Cpp.Default = 0..
            // DEFAULT, fontStyle = 0, styleId = 11
            scintilla.Styles[Style.Cpp.Default].ForeColor = lexerColors[LexerType.Java, "DefaultFore"];
            scintilla.Styles[Style.Cpp.Default].BackColor = lexerColors[LexerType.Java, "DefaultBack"];

            // INSTRUCTION WORD, fontStyle = 1, styleId = 5
            scintilla.Styles[Style.Cpp.Word].Bold      = true;
            scintilla.Styles[Style.Cpp.Word].ForeColor = lexerColors[LexerType.Java, "InstructionWordFore"];
            scintilla.Styles[Style.Cpp.Word].BackColor = lexerColors[LexerType.Java, "InstructionWordBack"];

            // TYPE WORD, fontStyle = 0, styleId = 16
            scintilla.Styles[Style.Cpp.Word2].ForeColor = lexerColors[LexerType.Java, "TypeWordFore"];
            scintilla.Styles[Style.Cpp.Word2].BackColor = lexerColors[LexerType.Java, "TypeWordBack"];

            // NUMBER, fontStyle = 0, styleId = 4
            scintilla.Styles[Style.Cpp.Number].ForeColor = lexerColors[LexerType.Java, "NumberFore"];
            scintilla.Styles[Style.Cpp.Number].BackColor = lexerColors[LexerType.Java, "NumberBack"];

            // STRING, fontStyle = 0, styleId = 6
            scintilla.Styles[Style.Cpp.String].ForeColor = lexerColors[LexerType.Java, "StringFore"];
            scintilla.Styles[Style.Cpp.String].BackColor = lexerColors[LexerType.Java, "StringBack"];

            // CHARACTER, fontStyle = 0, styleId = 7
            scintilla.Styles[Style.Cpp.Character].ForeColor = lexerColors[LexerType.Java, "CharacterFore"];
            scintilla.Styles[Style.Cpp.Character].BackColor = lexerColors[LexerType.Java, "CharacterBack"];

            // OPERATOR, fontStyle = 1, styleId = 10
            scintilla.Styles[Style.Cpp.Operator].Bold      = true;
            scintilla.Styles[Style.Cpp.Operator].ForeColor = lexerColors[LexerType.Java, "OperatorFore"];
            scintilla.Styles[Style.Cpp.Operator].BackColor = lexerColors[LexerType.Java, "OperatorBack"];

            // VERBATIM, fontStyle = 0, styleId = 13
            scintilla.Styles[Style.Cpp.Verbatim].ForeColor = lexerColors[LexerType.Java, "VerbatimFore"];
            scintilla.Styles[Style.Cpp.Verbatim].BackColor = lexerColors[LexerType.Java, "VerbatimBack"];

            // REGEX, fontStyle = 1, styleId = 14
            scintilla.Styles[Style.Cpp.Regex].Bold      = true;
            scintilla.Styles[Style.Cpp.Regex].ForeColor = lexerColors[LexerType.Java, "RegexFore"];
            scintilla.Styles[Style.Cpp.Regex].BackColor = lexerColors[LexerType.Java, "RegexBack"];

            // COMMENT, fontStyle = 0, styleId = 1
            scintilla.Styles[Style.Cpp.Comment].ForeColor = lexerColors[LexerType.Java, "CommentFore"];
            scintilla.Styles[Style.Cpp.Comment].BackColor = lexerColors[LexerType.Java, "CommentBack"];

            // COMMENT LINE, fontStyle = 0, styleId = 2
            scintilla.Styles[Style.Cpp.CommentLine].ForeColor = lexerColors[LexerType.Java, "CommentLineFore"];
            scintilla.Styles[Style.Cpp.CommentLine].BackColor = lexerColors[LexerType.Java, "CommentLineBack"];

            // COMMENT DOC, fontStyle = 0, styleId = 3
            scintilla.Styles[Style.Cpp.CommentDoc].ForeColor = lexerColors[LexerType.Java, "CommentDocFore"];
            scintilla.Styles[Style.Cpp.CommentDoc].BackColor = lexerColors[LexerType.Java, "CommentDocBack"];

            // COMMENT LINE DOC, fontStyle = 0, styleId = 15
            scintilla.Styles[Style.Cpp.CommentLineDoc].ForeColor = lexerColors[LexerType.Java, "CommentLineDocFore"];
            scintilla.Styles[Style.Cpp.CommentLineDoc].BackColor = lexerColors[LexerType.Java, "CommentLineDocBack"];

            // COMMENT DOC KEYWORD, fontStyle = 1, styleId = 17
            scintilla.Styles[Style.Cpp.CommentDocKeyword].Bold      = true;
            scintilla.Styles[Style.Cpp.CommentDocKeyword].ForeColor = lexerColors[LexerType.Java, "CommentDocKeywordFore"];
            scintilla.Styles[Style.Cpp.CommentDocKeyword].BackColor = lexerColors[LexerType.Java, "CommentDocKeywordBack"];

            // COMMENT DOC KEYWORD ERROR, fontStyle = 0, styleId = 18
            scintilla.Styles[Style.Cpp.CommentDocKeywordError].ForeColor = lexerColors[LexerType.Java, "CommentDocKeywordErrorFore"];
            scintilla.Styles[Style.Cpp.CommentDocKeywordError].BackColor = lexerColors[LexerType.Java, "CommentDocKeywordErrorBack"];

            scintilla.Lexer = Lexer.Cpp;

            ScintillaKeyWords.SetKeywords(scintilla, LexerType.Java);

            AddFolding(scintilla);

            return(true);
        }