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


C# Range.ClearStyle方法代码示例

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


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

示例1: HTMLSyntaxHighlight

 private void HTMLSyntaxHighlight(Range range)
 {
     //clear style of changed range
     range.ClearStyle(BlueStyle, MaroonStyle, RedStyle);
     //tag brackets highlighting
     range.SetStyle(BlueStyle, @"<|/>|</|>");
     //tag name
     range.SetStyle(MaroonStyle, @"<(?<range>[!\w]+)");
     //end of tag
     range.SetStyle(MaroonStyle, @"</(?<range>\w+)>");
     //attributes
     range.SetStyle(RedStyle, @"(?<range>\S+?)='[^']*'|(?<range>\S+)=""[^""]*""|(?<range>\S+)=\S+");
     //attribute values
     range.SetStyle(BlueStyle, @"\S+?=(?<range>'[^']*')|\S+=(?<range>""[^""]*"")|\S+=(?<range>\S+)");
 }
开发者ID:tsovince,项目名称:V_Library,代码行数:15,代码来源:VisibleRangeChangedDelayedSample.cs

示例2: HighlightVisibleRange

 private void HighlightVisibleRange()
 {
     //expand visible range (+- margin)
     var startLine = Math.Max(0, fctb.VisibleRange.Start.ILine - margin);
     var endLine = Math.Min(fctb.LinesCount - 1, fctb.VisibleRange.End.ILine + margin);
     var range = new Range(fctb, 0, startLine, 0, endLine);
     //clear folding markers
     range.ClearFoldingMarkers();
     //set markers for folding
     range.SetFoldingMarkers(@"N\d\d00", @"N\d\d99");
     //
     range.ClearStyle(StyleIndex.All);
     range.SetStyle(fctb.SyntaxHighlighter.BlueStyle, @"N\d+");
     range.SetStyle(fctb.SyntaxHighlighter.RedStyle, @"[+\-]?[\d\.]+\d+");
 }
开发者ID:workwhileweb,项目名称:FastColoredTextBox,代码行数:15,代码来源:LazyLoadingSample.cs

示例3: LuaSyntaxHighlight

        /// <summary>
        /// Highlights Lua code
        /// </summary>
        /// <param name="range"></param>
        public override void LuaSyntaxHighlight(Range range)
        {
            range.tb.CommentPrefix = "--";
            range.tb.LeftBracket = '(';
            range.tb.RightBracket = ')';
            range.tb.LeftBracket2 = '{';
            range.tb.RightBracket2 = '}';
            range.tb.BracketsHighlightStrategy = BracketsHighlightStrategy.Strategy2;

            range.tb.AutoIndentCharsPatterns
                = @"^\s*[\w\.]+(\s\w+)?\s*(?<range>=)\s*(?<range>.+)";

            //clear style of changed range
            range.ClearStyle(mStrStyle, mGrayStyle,ConStyle, mNumberStyle, mKeywordStyle, mFunStyle);
            //
            if (base.LuaStringRegex == null)
                base.InitLuaRegex();
            //string highlighting
            range.SetStyle(mStrStyle, base.LuaStringRegex);
            //comment highlighting
            range.SetStyle(mGrayStyle, base.LuaCommentRegex1);
            range.SetStyle(mGrayStyle, base.LuaCommentRegex2);
            range.SetStyle(mGrayStyle, base.LuaCommentRegex3);
            //number highlighting
            range.SetStyle(mNumberStyle, base.LuaNumberRegex);

            //keyword highlighting
            range.SetStyle(mKeywordStyle, base.LuaKeywordRegex);
            //functions highlighting
            range.SetStyle(mFunStyle, base.LuaFunctionsRegex);
            range.SetStyle(mNumberStyle, @"\bc\d+\b");

            range.SetStyle(ConStyle, @"[\s|\(|+|,]{0,1}(?<range>[A-Z_]+?)[\)|+|\s|,|;]");
            //range.SetStyle(mFunStyle, @"[:|\.|\s](?<range>[a-zA-Z0-9_]*?)[\(|\)|\s]");

            //clear folding markers
            range.ClearFoldingMarkers();
            //set folding markers
            range.SetFoldingMarkers("{", "}"); //allow to collapse brackets block
            range.SetFoldingMarkers(@"--\[\[", @"\]\]"); //allow to collapse comment block
        }
开发者ID:jiaoy06,项目名称:DataEditorX,代码行数:45,代码来源:MySyntaxHighlighter.cs

示例4: ScpSyntaxHighlight

        /// <summary>
        /// Highlights Lua code
        /// </summary>
        /// <param name="range"></param>
        public virtual void ScpSyntaxHighlight(Range range)
        {
            range.tb.CommentPrefix = "//";
            range.tb.LeftBracket = '(';
            range.tb.RightBracket = ')';
            range.tb.LeftBracket2 = '<';
            range.tb.RightBracket2 = '>';
            range.ClearStyle(new Style[] { styScpStrings, styScpComments, styScpAttributes,
                styScpVariables, BlueStyle, styScpKeywords2, styScpKeywords3, styScpOperators,styScpTriggers,styScpKeywords1,styScpTriggerSymbols/*<-ek*/ });
            if (vSCPStringRegex == null)
            {
                InitvSCPRegex();
            }
            range.SetStyle(styScpStrings, vSCPStringRegex);
            range.SetStyle(styScpComments, vSCPCommentRegex);
            range.SetStyle(styScpAttributes, vSCPAttributeRegex);
            range.SetStyle(styScpVariables, vSCPVariablesRegex);
            range.SetStyle(styScpKeywords1, vSCPKeywordRegex);
            range.SetStyle(styScpKeywords2, vSCPKeywordRegex2);
            range.SetStyle(styScpKeywords3, vSCPKeywordRegex3);
            range.SetStyle(styScpOperators, vSCPOperatorRegex);
            range.SetStyle(styScpTriggers, vSCPTriggerRegex);
            range.SetStyle(styScpTriggerSymbols, vSCPTriggerSymbolRegex);
            range.ClearFoldingMarkers();

            range.SetFoldingMarkers(@"/\*", @"\*/");
            range.SetFoldingMarkers(@"(?<range>(\[\w+\s+))", @"(?<range>(\[\w+\s+))");
            //range.SetFoldingMarkers(@"\b((?i)for)\b", @"\b((?i)endfor)\b", RegexOptions.IgnoreCase | RegexOptions.Compiled);
            range.SetFoldingMarkers(@"\b((?i)[i,ı]f)\b", @"\b((?i)end[i,ı]f)\b", RegexOptions.IgnoreCase | RegexOptions.Compiled);
            range.SetFoldingMarkers(@"(?<range>([o,O][n,N][email protected]))", @"(?<range>([o,O][n,N][email protected]))");
            range.SetFoldingMarkers(@"//(?i)region\b", @"//(?i)endregion\b");
        }
开发者ID:msx752,项目名称:ScriptCommunityPack-Editor,代码行数:36,代码来源:SyntaxHighlighter.cs

示例5: HighlightInvisibleChars

 private void HighlightInvisibleChars(Range range)
 {
     range.ClearStyle(_invisibleCharsStyle);
     range.SetStyle(_invisibleCharsStyle, @".$|.\r\n|\s");
 }
开发者ID:cabbagecreek,项目名称:Marlin3DprinterTool,代码行数:5,代码来源:FrmFirmwareMigrate.cs

示例6: HighlightSyntax

        public void HighlightSyntax(SyntaxDescriptor desc, Range range)
        {
            //set style order
            range.tb.ClearStylesBuffer();
            for(int i=0;i<desc.styles.Count;i++)
                range.tb.Styles[i] = desc.styles[i];
            //brackets
            var oldBrackets = RememberBrackets(range.tb);
            range.tb.LeftBracket = desc.leftBracket;
            range.tb.RightBracket = desc.rightBracket;
            range.tb.LeftBracket2 = desc.leftBracket2;
            range.tb.RightBracket2 = desc.rightBracket2;
            //clear styles of range
            range.ClearStyle(desc.styles.ToArray());
            //highlight syntax
            foreach (var rule in desc.rules)
                range.SetStyle(rule.style, rule.Regex);
            //clear folding
            range.ClearFoldingMarkers();
            //folding markers
            foreach (var folding in desc.foldings)
                range.SetFoldingMarkers(folding.startMarkerRegex, folding.finishMarkerRegex, folding.options);

            //
            RestoreBrackets(range.tb, oldBrackets);
        }
开发者ID:remco138,项目名称:FastColoredTextBox,代码行数:26,代码来源:SyntaxHighlighter.cs

示例7: VBSyntaxHighlight

        /// <summary>
        /// Highlights VB code
        /// </summary>
        /// <param name="range"></param>
        public virtual void VBSyntaxHighlight(Range range)
        {
            range.tb.CommentPrefix = "'";
            range.tb.LeftBracket = '(';
            range.tb.RightBracket = ')';
            range.tb.LeftBracket2 = '\x0';
            range.tb.RightBracket2 = '\x0';
            //clear style of changed range
            range.ClearStyle(BrownStyle, GreenStyle, MagentaStyle, BoldStyle, BlueStyle);
            //string highlighting
            range.SetStyle(BrownStyle, @""".*?""");
            //comment highlighting
            range.SetStyle(GreenStyle, @"'.*$", RegexOptions.Multiline);
            //number highlighting
            range.SetStyle(MagentaStyle, @"\b\d+[\.]?\d*([eE]\-?\d+)?\b");
            //class name highlighting
            range.SetStyle(BoldStyle, @"\b(Class|Structure|Enum|Interface)[ ]+(?<range>\w+?)\b", RegexOptions.IgnoreCase);
            //keyword highlighting
            range.SetStyle(BlueStyle, @"\b(AddHandler|AddressOf|Alias|And|AndAlso|As|Boolean|ByRef|Byte|ByVal|Call|Case|Catch|CBool|CByte|CChar|CDate|CDbl|CDec|Char|CInt|Class|CLng|CObj|Const|Continue|CSByte|CShort|CSng|CStr|CType|CUInt|CULng|CUShort|Date|Decimal|Declare|Default|Delegate|Dim|DirectCast|Do|Double|Each|Else|ElseIf|End|EndIf|Enum|Erase|Error|Event|Exit|False|Finally|For|Friend|Function|Get|GetType|GetXMLNamespace|Global|GoSub|GoTo|Handles|If|Implements|Imports|In|Inherits|Integer|Interface|Is|IsNot|Let|Lib|Like|Long|Loop|Me|Mod|Module|MustInherit|MustOverride|MyBase|MyClass|Namespace|Narrowing|New|Next|Not|Nothing|NotInheritable|NotOverridable|Object|Of|On|Operator|Option|Optional|Or|OrElse|Overloads|Overridable|Overrides|ParamArray|Partial|Private|Property|Protected|Public|RaiseEvent|ReadOnly|ReDim|REM|RemoveHandler|Resume|Return|SByte|Select|Set|Shadows|Shared|Short|Single|Static|Step|Stop|String|Structure|Sub|SyncLock|Then|Throw|To|True|Try|TryCast|TypeOf|UInteger|ULong|UShort|Using|Variant|Wend|When|While|Widening|With|WithEvents|WriteOnly|Xor|Region)\b|(#Const|#Else|#ElseIf|#End|#If|#Region)\b", RegexOptions.IgnoreCase);

            //clear folding markers
            range.ClearFoldingMarkers();
            //set folding markers
            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.Multiline | RegexOptions.IgnoreCase);
            range.SetFoldingMarkers(@"\b(Sub|Function)[ \t]+[^\s']+", @"\bEnd (Sub|Function)\b", RegexOptions.IgnoreCase);//this declared separately because Sub and Function can be unclosed
            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.Multiline | RegexOptions.IgnoreCase);
            range.SetFoldingMarkers(@"^\s*(?<range>Do)\b", @"^\s*(?<range>Loop)\b", RegexOptions.Multiline | RegexOptions.IgnoreCase);
        }
开发者ID:zp-j,项目名称:CompileSpeaker,代码行数:35,代码来源:SyntaxHighlighter.cs

示例8: PHPSyntaxHighlight

        /// <summary>
        /// Highlights PHP code
        /// </summary>
        /// <param name="range"></param>
        public virtual void PHPSyntaxHighlight(Range range)
        {
            range.tb.CommentPrefix = "//";
            range.tb.LeftBracket = '(';
            range.tb.RightBracket = ')';
            range.tb.LeftBracket2 = '{';
            range.tb.RightBracket2 = '}';
            range.tb.BracketsHighlightStrategy = BracketsHighlightStrategy.Strategy2;
            //clear style of changed range
            range.ClearStyle(StringStyle, CommentStyle, NumberStyle, VariableStyle, KeywordStyle, KeywordStyle2,
                             KeywordStyle3);

            range.tb.AutoIndentCharsPatterns
                = @"
            ^\s*\$[\w\.\[\]\'\""]+\s*(?<range>=)\s*(?<range>[^;]+);
            ";

            //
            if (PHPStringRegex == null)
                InitPHPRegex();
            //string highlighting
            range.SetStyle(StringStyle, PHPStringRegex);
            //comment highlighting
            range.SetStyle(CommentStyle, PHPCommentRegex1);
            range.SetStyle(CommentStyle, PHPCommentRegex2);
            range.SetStyle(CommentStyle, PHPCommentRegex3);
            //number highlighting
            range.SetStyle(NumberStyle, PHPNumberRegex);
            //var highlighting
            range.SetStyle(VariableStyle, PHPVarRegex);
            //keyword highlighting
            range.SetStyle(KeywordStyle, PHPKeywordRegex1);
            range.SetStyle(KeywordStyle2, PHPKeywordRegex2);
            range.SetStyle(KeywordStyle3, PHPKeywordRegex3);

            //clear folding markers
            range.ClearFoldingMarkers();
            //set folding markers
            range.SetFoldingMarkers("{", "}"); //allow to collapse brackets block
            range.SetFoldingMarkers(@"/\*", @"\*/"); //allow to collapse comment block
        }
开发者ID:tsovince,项目名称:V_Library,代码行数:45,代码来源:SyntaxHighlighter.cs

示例9: HighlightAllMatches

 private void HighlightAllMatches(Range r, string pattern, bool ignorecase)
 {
     r.ClearStyle(_style);
     if (ignorecase)
         r.SetStyle(_style, pattern, RegexOptions.IgnoreCase);
     else
         r.SetStyle(_style, pattern);
 }
开发者ID:samarjeet27,项目名称:ynoteclassic,代码行数:8,代码来源:IncrementalSearcher.cs

示例10: JScriptSyntaxHighlight

        /// <summary>
        /// Highlights JavaScript code
        /// </summary>
        /// <param name="range"></param>
        public void JScriptSyntaxHighlight(Range range)
        {
            range.tb.CommentPrefix = "//";
            range.tb.LeftBracket   = '(';
            range.tb.RightBracket  = ')';
            range.tb.LeftBracket2  = '{';
            range.tb.RightBracket2 = '}';
            range.tb.BracketsHighlightStrategy = BracketsHighlightStrategy.Strategy2;
            range.tb.AutoIndentCharsPatterns = @"^\s*[\w\.]+(\s\w+)?\s*(?<range>=)\s*(?<range>[^;]+);";

            range.ClearStyle(StringStyle, CommentStyle, NumberStyle, KeywordStyle);
            if (JScriptStringRegex == null) InitJScriptRegex();
            range.SetStyle(NumberStyle, JScriptNumberRegex);
            range.SetStyle(KeywordStyle, JScriptKeywordRegex);
            range.SetStylesStringsAndComments(JScriptStringRegex, StringStyle, CommentStyle);
            range.ClearFoldingMarkers();
            range.SetFoldingMarkers("{", "}"); //allow to collapse brackets block
            range.SetFoldingMarkers(@"/\*", @"\*/"); //allow to collapse comment block
        }
开发者ID:WendyH,项目名称:HMSEditor,代码行数:23,代码来源:SyntaxHighlighter.cs

示例11: 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  = '\x0';
            range.tb.RightBracket2 = '\x0';

            range.tb.BracketsHighlightStrategy = BracketsHighlightStrategy.Strategy1;
            range.tb.AutoIndentCharsPatterns = @"^\s*[\w\.]+(\s\w+)?\s*(?<range>=)\s*(?<range>[^;]+);^\s*(case|default)\s*[^:]*(?<range>:)\s*(?<range>[^;]+);";

            range.ClearStyle(StringStyle, CommentStyle, NumberStyle, KeywordStyle, BoldStyle, BoldStyle2, FunctionsStyle, VariableStyle, ConstantsStyle);
            if (PascalScriptStringRegex == null) InitPascalScriptRegex();
            range.SetStyle(NumberStyle      , PascalScriptNumberRegex  );
            range.SetStyle(KeywordStyle     , PascalScriptKeywordRegex1);
            range.SetStyle(ClassNameStyle   , PascalScriptClassNameRegex);
            range.SetStyle(AltPascalKeywordsHighlight ? BoldStyle2 : BoldStyle, PascalScriptKeywordRegex2);
            range.SetStyle(FunctionsStyle   , HMS.RegexHmsFunctions);
            range.SetStyle(VariableStyle    , HMS.RegexHmsVariables);
            range.SetStyle(ConstantsStyle   , HMS.RegexHmsConstants);
            range.SetStyle(DeclFunctionStyle, regexDeclFunctionPAS);
            range.SetStylesStringsAndComments(PascalScriptStringRegex, StringStyle, CommentStyle);
            range.ClearFoldingMarkers();
            range.SetFoldingMarkers(@"\b(begin|try)\b", @"\b(end)\b", RegexCompiledOption | RegexOptions.IgnoreCase); //allow to collapse brackets block
        }
开发者ID:WendyH,项目名称:HMSEditor,代码行数:29,代码来源:SyntaxHighlighter.cs

示例12: CPPScriptSyntaxHighlight

 /// <summary>
 /// Highlights C++Script code
 /// </summary>
 /// <param name="range"></param>
 public void CPPScriptSyntaxHighlight(Range range)
 {
     range.tb.CommentPrefix = "//";
     range.tb.LeftBracket   = '(';
     range.tb.RightBracket  = ')';
     range.tb.LeftBracket2  = '{';
     range.tb.RightBracket2 = '}';
     range.tb.BracketsHighlightStrategy = BracketsHighlightStrategy.Strategy2;
     range.tb.AutoIndentCharsPatterns = @"^\s*[\w\.]+(\s\w+)?\s*(?<range>=)\s*(?<range>[^;]+);^\s*(case|default)\s*[^:]*(?<range>:)\s*(?<range>[^;]+);";
     range.ClearStyle(StringStyle, CommentStyle, NumberStyle, AttributeStyle, ClassNameStyle, KeywordStyle, FunctionsStyle, DeclFunctionStyle, VariableStyle, ConstantsStyle);
     if (CSharpStringRegex     == null) InitCSharpRegex();
     if (CPPScriptKeywordRegex == null) InitCPPScriptRegex();
     range.SetStyle(NumberStyle   , CSharpNumberRegex);
     range.SetStyle(AttributeStyle, CSharpAttributeRegex);
     range.SetStyle(ClassNameStyle, CPPClassNameRegex);
     range.SetStyle(FunctionsStyle, HMS.RegexHmsFunctions);
     range.SetStyle(VariableStyle , HMS.RegexHmsVariables);
     range.SetStyle(ConstantsStyle, HMS.RegexHmsConstants);
     range.SetStyle(DeclFunctionStyle, regexDeclFunctionCPP);
     range.SetStyle(KeywordStyle  , CPPScriptKeywordRegex);
     range.SetStylesStringsAndComments(CSharpStringAndCommentsRegex, StringStyle, CommentStyle);
     range.ClearFoldingMarkers();
     range.SetFoldingMarkers("{", "}");       //allow to collapse brackets block
 }
开发者ID:WendyH,项目名称:HMSEditor,代码行数:28,代码来源:SyntaxHighlighter.cs

示例13: CSharpSyntaxHighlight

        /// <summary>
        /// Highlights C# code
        /// </summary>
        /// <param name="range"></param>
        public void CSharpSyntaxHighlight(Range range)
        {
            range.tb.CommentPrefix = "//";
            range.tb.LeftBracket = '(';
            range.tb.RightBracket = ')';
            range.tb.LeftBracket2 = '{';
            range.tb.RightBracket2 = '}';
            range.tb.BracketsHighlightStrategy = BracketsHighlightStrategy.Strategy2;

            range.tb.AutoIndentCharsPatterns = @"^\s*[\w\.]+(\s\w+)?\s*(?<range>=)\s*(?<range>[^;]+);^\s*(case|default)\s*[^:]*(?<range>:)\s*(?<range>[^;]+);";
            range.ClearStyle(StringStyle, CommentStyle, NumberStyle, AttributeStyle, ClassNameStyle, KeywordStyle);
            if (CSharpStringRegex == null) InitCSharpRegex();
            range.SetStyle(NumberStyle, CSharpNumberRegex);
            range.SetStyle(AttributeStyle, CSharpAttributeRegex);
            range.SetStyle(ClassNameStyle, CSharpClassNameRegex);
            range.SetStyle(KeywordStyle, CSharpKeywordRegex);
            range.SetStylesStringsAndComments(CSharpStringAndCommentsRegex, StringStyle, CommentStyle); // By WendyH

            //find document comments
            foreach (Range r in range.GetRanges(@"^\s*///.*$", RegexOptions.Multiline)) {
                //remove C# highlighting from this fragment
                r.ClearStyle(StyleIndex.All);
                //do XML highlighting
                if (HTMLTagRegex == null)
                    InitHTMLRegex();
                //
                r.SetStyle(CommentStyle);
                //tags
                foreach (Range rr in r.GetRanges(HTMLTagContentRegex)) {
                    rr.ClearStyle(StyleIndex.All);
                    rr.SetStyle(CommentTagStyle);
                }
                //prefix '///'
                foreach (Range rr in r.GetRanges(@"^\s*///", RegexOptions.Multiline)) {
                    rr.ClearStyle(StyleIndex.All);
                    rr.SetStyle(CommentTagStyle);
                }
            }

            //clear folding markers
            range.ClearFoldingMarkers();
            //set folding markers
            range.SetFoldingMarkers("{", "}"); //allow to collapse brackets block
            range.SetFoldingMarkers(@"#region\b", @"#endregion\b"); //allow to collapse #region blocks
            range.SetFoldingMarkers(@"/\*", @"\*/"); //allow to collapse comment block
        }
开发者ID:WendyH,项目名称:HMSEditor,代码行数:50,代码来源:SyntaxHighlighter.cs

示例14: 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  = '\x0';
     range.tb.RightBracket2 = '\x0';
     range.tb.AutoIndentCharsPatterns = @"^\s*[\w\.\(\)]+\s*(?<range>=)\s*(?<range>.+)";
     range.ClearStyle(StringStyle, CommentStyle, NumberStyle, ClassNameStyle, KeywordStyle, FunctionsStyle, VariableStyle, ConstantsStyle);
     if (VBStringRegex == null) InitVBRegex();
     if (BasicScriptKeywordRegex1 == null) InitBasicScriptRegex();
     range.SetStyle(NumberStyle   , VBNumberRegex);
     range.SetStyle(ClassNameStyle, VBClassNameRegex);
     range.SetStyle(KeywordStyle  , BasicScriptKeywordRegex1);
     range.SetStyle(BlueBoldStyle , BasicScriptKeywordRegex2);
     range.SetStyle(FunctionsStyle, HMS.RegexHmsFunctions);
     range.SetStyle(VariableStyle , HMS.RegexHmsVariables);
     range.SetStyle(ConstantsStyle, HMS.RegexHmsConstants);
     range.SetStyle(DeclFunctionStyle, regexDeclFunctionBAS);
     range.SetStylesStringsAndComments(VBStringRegex, StringStyle, CommentStyle, false);
     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.Multiline | RegexOptions.IgnoreCase);
     range.SetFoldingMarkers(@"\b(Sub|Function)[ \t]+[^\s']+", @"\bEnd (Sub|Function)\b"  , RegexOptions.IgnoreCase);
     //this declared separately because Sub and Function can be unclosed
     //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.Multiline | RegexOptions.IgnoreCase);
     //range.SetFoldingMarkers(@"^\s*(?<range>Do)\b", @"^\s*(?<range>Loop)\b", RegexOptions.Multiline | RegexOptions.IgnoreCase);
 }
开发者ID:WendyH,项目名称:HMSEditor,代码行数:34,代码来源:SyntaxHighlighter.cs

示例15: YAMLSyntaxHighlight

 /// <summary>
 /// Highlights YAML code
 /// </summary>
 /// <param name="range"></param>
 public void YAMLSyntaxHighlight(Range range)
 {
     range.tb.CommentPrefix = "#";
     range.tb.LeftBracket   = '(';
     range.tb.RightBracket  = ')';
     range.tb.LeftBracket2  = '\x0';
     range.tb.RightBracket2 = '\x0';
     range.ClearStyle(StringStyle, CommentStyle, NumberStyle, KeywordStyle, ClassNameStyle, TagBracketStyle, VariableStyle, ConstantsStyle);
     if (YAMLStringRegex == null) InitYAMLRegex();
     range.SetStyle(NumberStyle, YAMLNumberRegex);
     range.SetStyle(ClassNameStyle , YAMLObjectNameRegex);
     range.SetStyle(VariableStyle  , HMS.RegexHmsVariables);
     range.SetStyle(ConstantsStyle , HMS.RegexHmsConstants);
     range.SetStyle(TagBracketStyle, YAMLBreaketsRegex);
     range.SetStyle(KeywordStyle   , YAMLKeywordRegex);
     range.SetStylesStringsAndComments(YAMLStringRegex, StringStyle, CommentStyle);
     range.ClearFoldingMarkers();
     range.SetFoldingMarkers(@"^[\s-]*?\w+\s*?:", "[IDENT]", RegexOptions.Multiline); // Allow to collapse block
 }
开发者ID:WendyH,项目名称:HMSEditor,代码行数:23,代码来源:SyntaxHighlighter.cs


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