当前位置: 首页>>代码示例>>C#>>正文


C# Range.ClearStyleAndFuncBegin方法代码示例

本文整理汇总了C#中Range.ClearStyleAndFuncBegin方法的典型用法代码示例。如果您正苦于以下问题:C# Range.ClearStyleAndFuncBegin方法的具体用法?C# Range.ClearStyleAndFuncBegin怎么用?C# Range.ClearStyleAndFuncBegin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Range的用法示例。


在下文中一共展示了Range.ClearStyleAndFuncBegin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BasicSyntaxHighlight

        /// <summary>
        /// Highlights BasicScript code
        /// </summary>
        /// <param name="range"></param>
        public void BasicSyntaxHighlight(Range range)
        {
            range.tb.CommentPrefix = "'";
            range.tb.LeftBracket   = '(';
            range.tb.RightBracket  = ')';
            range.tb.LeftBracket2  = '[';
            range.tb.RightBracket2 = ']';
            range.tb.AutoIndentCharsPatterns = @"^\s*[\w\.\(\)]+\s*(?<range>=)\s*(?<range>.+)";
            if (VBStringRegex            == null) InitVBRegex();
            if (BasicScriptKeywordRegex1 == null) InitBasicScriptRegex();
            if (CPPClassNameRegex        == null) InitCPPScriptRegex();
            bool bigText = range.Text.Length > MaxLenght4FastWork;

            range.ClearStyleAndFuncBegin(StringStyle, CommentStyle, NumberStyle, DeclFunctionStyle, ClassNameStyle, KeywordStyle, FunctionsStyle, VariableStyle, ConstantsStyle, PunctuationSyle, TypesStyle);
            range.SetStylesStringsAndComments(VBStringRegex, StringStyle, CommentStyle, false);
            range.SetStyle(NumberStyle      , VBNumberRegex);
            range.SetFunct(DeclFunctionStyle, regexDeclFunctionBAS);

            range.ClearFoldingMarkers();
            range.SetFoldingMarkers(@"#Region\b"                                           , @"#End\s+Region\b"                                  , RegexOptions.IgnoreCase);
            range.SetFoldingMarkers(@"\b(Class|Property|Enum|Structure|Interface)[ \t]+\S+", @"\bEnd (Class|Property|Enum|Structure|Interface)\b", RegexOptions.IgnoreCase);
            range.SetFoldingMarkers(@"^\s*(?<range>While)[ \t]+\S+"                        , @"^\s*(?<range>End While)\b"                        , RegexOptions.IgnoreCase | RegexOptions.Multiline);
            //this declared separately because Sub and Function can be unclosed
            range.SetFoldingMarkers(@"\b(Sub|Function)[ \t]+[^\s']+"                       , @"\bEnd (Sub|Function)\b"                           , RegexOptions.IgnoreCase);
            range.SetFoldingMarkers(@"\bIF[ \t][^\n]+THEN\s*?$"                            , @"\bEND IF\b"                                       , RegexOptions.IgnoreCase | RegexOptions.Multiline);
            range.SetFoldingMarkers(@"(\r|\n|^)[ \t]*(?<range>Get|Set)[ \t]*(\r|\n|$)"     , @"\bEnd (Get|Set)\b"                                , RegexOptions.IgnoreCase);
            range.SetFoldingMarkers(@"^\s*(?<range>For|For\s+Each)\b"                      , @"^\s*(?<range>Next)\b"                             , RegexOptions.IgnoreCase | RegexOptions.Multiline);
            range.SetFoldingMarkers(@"^\s*(?<range>Do)\b"                                  , @"^\s*(?<range>Loop)\b"                             , RegexOptions.IgnoreCase | RegexOptions.Multiline);

            if (bigText && !Worker4BigText.IsBusy) {
                Worker4BigText.RunWorkerAsync(new Syntax2StepArgs(currentLanguage, range));
            } else {
                BasicSyntaxHighlight2(range);
            }
        }
开发者ID:WendyH,项目名称:HMSEditor_addon,代码行数:39,代码来源:SyntaxHighlighter.cs

示例2: HmsJScriptSyntaxHighlight

        // By WendyH > -------------------------------------------------------
        /// <summary>
        /// Highlights JScript code
        /// </summary>
        /// <param name="range"></param>
        public void HmsJScriptSyntaxHighlight(Range range)
        {
            range.tb.CommentPrefix = "//";
            range.tb.LeftBracket   = '(';
            range.tb.RightBracket  = ')';
            range.tb.LeftBracket2  = '{';
            range.tb.RightBracket2 = '}';
            range.tb.BracketsHighlightStrategy = BracketsHighlightStrategy.Strategy1;
            range.tb.AutoIndentCharsPatterns   = @"^\s*[\w\.]+(\s\w+)?\s*(?<range>=)\s*(?<range>[^;]+);";
            if (JScriptNumberRegex     == null) InitJScriptRegex();
            if (HmsJScriptKeywordRegex == null) InitHmsJScriptRegex();
            if (CPPClassNameRegex      == null) InitCPPScriptRegex();
            bool bigText = range.Text.Length > MaxLenght4FastWork;

            range.ClearStyleAndFuncBegin(StringStyle, CommentStyle, NumberStyle, DeclFunctionStyle, FunctionsStyle, VariableStyle, ConstantsStyle, PunctuationSyle, KeywordStyle, ClassNameStyle);
            range.SetStylesStringsAndComments(CPPStringAndCommentsRegex, StringStyle, CommentStyle);
            range.SetStyle(NumberStyle      , JScriptNumberRegex  );
            range.SetFunct(DeclFunctionStyle, regexDeclFunctionCPP);

            range.ClearFoldingMarkers();
            range.SetFoldingMarkers("{", "}"); //allow to collapse brackets block

            if (bigText && !Worker4BigText.IsBusy) {
                Worker4BigText.RunWorkerAsync(new Syntax2StepArgs(currentLanguage, range));
            } else {
                HmsJScriptSyntaxHighlight2(range);
            }
        }
开发者ID:WendyH,项目名称:HMSEditor_addon,代码行数:33,代码来源:SyntaxHighlighter.cs

示例3: PascalScriptSyntaxHighlight

        /// <summary>
        /// Highlights PascalScript code
        /// </summary>
        /// <param name="range"></param>
        public void PascalScriptSyntaxHighlight(Range range)
        {
            range.tb.CommentPrefix = "//";
            range.tb.LeftBracket   = '(';
            range.tb.RightBracket  = ')';
            range.tb.LeftBracket2  = '[';
            range.tb.RightBracket2 = ']';
            range.tb.BracketsHighlightStrategy = BracketsHighlightStrategy.Strategy1;
            range.tb.AutoIndentCharsPatterns   = @"^\s*[\w\.]+(\s\w+)?\s*(?<range>=)\s*(?<range>[^;]+);^\s*(case|default)\s*[^:]*(?<range>:)\s*(?<range>[^;]+);";
            if (PascalScriptStringRegex == null) InitPascalScriptRegex();
            bool bigText = range.Text.Length > MaxLenght4FastWork;

            range.ClearStyleAndFuncBegin(StringStyle, CommentStyle, NumberStyle, DeclFunctionStyle, ClassNameStyle, KeywordStyle, FunctionsStyle, VariableStyle, ConstantsStyle, TypesStyle, PunctuationSyle);
            range.SetStylesStringsAndComments(PascalScriptStringRegex, StringStyle, CommentStyle);
            range.SetStyle(NumberStyle      , PascalScriptNumberRegex);
            range.SetFunct(DeclFunctionStyle, regexDeclFunctionPAS   );

            range.ClearFoldingMarkers();
            range.SetFoldingMarkers(@"\b(repeat)\b"   , @"\b(until)\b", RegexCompiledOption | RegexOptions.IgnoreCase); //allow to collapse brackets block
            range.SetFoldingMarkers(@"\b(begin|try)\b", @"\b(end)\b"  , RegexCompiledOption | RegexOptions.IgnoreCase); //allow to collapse brackets block

            if (bigText && !Worker4BigText.IsBusy) {
                Worker4BigText.RunWorkerAsync(new Syntax2StepArgs(currentLanguage, range));
            } else {
                PascalScriptSyntaxHighlight2(range);
            }
        }
开发者ID:WendyH,项目名称:HMSEditor_addon,代码行数:31,代码来源:SyntaxHighlighter.cs


注:本文中的Range.ClearStyleAndFuncBegin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。