public LanguageConfigCollection(IScintillaConfig parent, IScintillaConfigProvider provider, ILexerConfigCollection lexers)
        {
            if (provider == null)
                throw new Exception("IScintillaConfigProvider must be provided in the LanguageConfigCollection constructor!");
            if (lexers == null)
                throw new Exception("The LexerConfigCollection must be provided in the LanguageConfigCollection constructor!");
            if (parent == null)
                throw new Exception("The ScintillaConfig must be provided in the LanguageConfigCollection constructor!");

            this.parent = parent;
            this.provider = provider;
            this.lexers = lexers;
        }
예제 #2
0
        public LanguageConfigCollection(IScintillaConfig parent, IScintillaConfigProvider provider, ILexerConfigCollection lexers)
        {
            if (provider == null)
            {
                throw new Exception("IScintillaConfigProvider must be provided in the LanguageConfigCollection constructor!");
            }
            if (lexers == null)
            {
                throw new Exception("The LexerConfigCollection must be provided in the LanguageConfigCollection constructor!");
            }
            if (parent == null)
            {
                throw new Exception("The ScintillaConfig must be provided in the LanguageConfigCollection constructor!");
            }

            this.parent   = parent;
            this.provider = provider;
            this.lexers   = lexers;
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="config"></param>
        public bool PopulateLanguageConfig(ILanguageConfig config, ILexerConfigCollection lexers)
        {
            bool   success = true;
            string key, s,
                   language = config.Name.ToLower(),
                   extList  = GetExtensionListFromLanguage(language);

            if (extList == null)
            {
                extList = "*." + language;
                languageExtentions[language] = extList;
            }

            config.ExtensionList = extList;

            key = string.Format("lexer.{0}", extList);
            if (properties.ContainsKey(key))
            {
                config.Lexer = lexers[this.Evaluate(properties[key])];
            }

            if (config.Lexer == null)
            {
                success = false;
            }

            /*--------------------------------------- keywords ---------------------------------------
            *  Most of the lexers differentiate between names and keywords and use the keywords variables to do so.
            *  To avoid repeating the keyword list for each file extension, where several file extensions are
            *  used for one language, a keywordclass variable is defined in the distributed properties file
            *  although this is just a convention. Some lexers define a second set of keywords which will be
            *  displayed in a different style to the first set of keywords. This is used in the HTML lexer
            *  to display JavaScript keywords in a different style to HTML tags and attributes.
            *  ----------------------------------------------------------------------------------------*/
            for (int i = 0; i <= 8; i++)
            {
                s   = (i == 0) ? string.Empty : i.ToString();
                key = string.Format("keywords{0}.{1}", s, extList);
                s   = GetString(key);
                if (s != null)
                {
                    config.KeywordLists[i] = s;
                }
            }

            /*--------------------------------------- word characters ---------------------------------------
             * Defines which characters can be parts of words. The default value here is all the alphabetic and
             * numeric characters and the underscore which is a reasonable value for languages such as C++.
             * ----------------------------------------------------------------------------------------*/
            key = string.Format("word.characters.{0}", extList);
            config.WordCharacters = GetString(key);

            /*--------------------------------------- whitespace characters ---------------------------------------
             * Defines which characters are considered whitespace. The default value is that initially set up by Scintilla,
             * which is space and all chars less than 0x20. Setting this property allows you to force Scintilla to consider other
             * characters as whitespace (e.g. punctuation) during such activities as cursor navigation (ctrl+left/right).
             * ----------------------------------------------------------------------------------------*/
            key = string.Format("whitespace.characters.{0}", extList);
            config.WhitespaceCharacters = GetString(key);

            return(success);
        }
 public bool PopulateLanguageConfig(ILanguageConfig config, ILexerConfigCollection lexers)
 {
     ScintillaPropertiesHelper.Populate(config.ScintillaConfig, GetResource("lang." + config.Name.ToLower() + ".properties"));
     return true;
 }
 public bool PopulateLanguageConfig(ILanguageConfig config, ILexerConfigCollection lexers)
 {
     ScintillaPropertiesHelper.Populate(config.ScintillaConfig, GetResource("lang." + config.Name.ToLower() + ".properties"));
     return(true);
 }
예제 #6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="config"></param>
        public bool PopulateLanguageConfig(ILanguageConfig config, ILexerConfigCollection lexers)
        {
            bool success = true;
            string key, s, 
                language = config.Name.ToLower(),
                extList = GetExtensionListFromLanguage(language);

            if (extList == null)
            {
                extList = "*." + language;
                languageExtentions[language] = extList;
            }

            config.ExtensionList = extList;

            key = string.Format("lexer.{0}", extList);
            if (properties.ContainsKey(key))
            {
                config.Lexer = lexers[this.Evaluate(properties[key])];
            }

            if (config.Lexer == null) success = false;

            /*--------------------------------------- keywords ---------------------------------------
            Most of the lexers differentiate between names and keywords and use the keywords variables to do so. 
            To avoid repeating the keyword list for each file extension, where several file extensions are 
            used for one language, a keywordclass variable is defined in the distributed properties file 
            although this is just a convention. Some lexers define a second set of keywords which will be 
            displayed in a different style to the first set of keywords. This is used in the HTML lexer 
            to display JavaScript keywords in a different style to HTML tags and attributes.
            ----------------------------------------------------------------------------------------*/
            for (int i = 0; i <= 8; i++)
            {
                s = (i == 0) ? string.Empty : i.ToString();
                key = string.Format("keywords{0}.{1}", s, extList);
                s = GetString(key);
                if (s != null) config.KeywordLists[i] = s;
            }

            /*--------------------------------------- word characters ---------------------------------------
            Defines which characters can be parts of words. The default value here is all the alphabetic and  
            numeric characters and the underscore which is a reasonable value for languages such as C++. 
            ----------------------------------------------------------------------------------------*/
            key = string.Format("word.characters.{0}", extList);
            config.WordCharacters = GetString(key);

            /*--------------------------------------- whitespace characters ---------------------------------------
            Defines which characters are considered whitespace. The default value is that initially set up by Scintilla, 
            which is space and all chars less than 0x20. Setting this property allows you to force Scintilla to consider other 
            characters as whitespace (e.g. punctuation) during such activities as cursor navigation (ctrl+left/right).  
            ----------------------------------------------------------------------------------------*/
            key = string.Format("whitespace.characters.{0}", extList);
            config.WhitespaceCharacters = GetString(key);

            return success;
        }