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


C# Range.SetStyle方法代码示例

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


在下文中一共展示了Range.SetStyle方法的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: 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

示例3: 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

示例4: highlightText

 public static List<Range> highlightText(string text, FastColoredTextBox editor)
 {
     List<Range> highlightedText = new List<Range>();
     int lineNb = -1;
     foreach (string line in editor.Lines)
     {
         lineNb++;
         MatchCollection matches = Matches(line, [email protected]"{text}\b");
         foreach (Match match in matches)
         {
             Range range = new Range(editor, match.Index, lineNb, (match.Index + text.Length), lineNb);
             range.SetStyle(GreenStyle);
             highlightedText.Add(range);
         }
     }
     return highlightedText;
 }
开发者ID:q55x8x,项目名称:Peronality-Creator,代码行数:17,代码来源:FastColoredEditorUtils.cs

示例5: 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

示例6: 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

示例7: LuaSyntaxHighlight

        /// <summary>
        /// Highlights Lua code
        /// </summary>
        /// <param name="range"></param>
        public virtual 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(StringStyle, CommentStyle, NumberStyle, KeywordStyle, FunctionsStyle);
            //
            if (LuaStringRegex == null)
                InitLuaRegex();
            //string highlighting
            range.SetStyle(StringStyle, LuaStringRegex);
            //comment highlighting
            range.SetStyle(CommentStyle, LuaCommentRegex1);
            range.SetStyle(CommentStyle, LuaCommentRegex2);
            range.SetStyle(CommentStyle, LuaCommentRegex3);
            //number highlighting
            range.SetStyle(NumberStyle, LuaNumberRegex);
            //keyword highlighting
            range.SetStyle(KeywordStyle, LuaKeywordRegex);
            //functions highlighting
            range.SetStyle(FunctionsStyle, LuaFunctionsRegex);
            //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,代码行数:41,代码来源: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 = '\x0';
            range.tb.RightBracket2 = '\x0';
            //clear style of changed range
            range.ClearStyle(StringStyle, CommentStyle, NumberStyle, VariableStyle, KeywordStyle, KeywordStyle2, KeywordStyle3);
            //
            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:remco138,项目名称:FastColoredTextBox,代码行数:37,代码来源:SyntaxHighlighter.cs

示例9: 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(StringStyle, CommentStyle, NumberStyle, ClassNameStyle, KeywordStyle);
            //
            if (VBStringRegex == null)
                InitVBRegex();
            //string highlighting
            range.SetStyle(StringStyle, VBStringRegex);
            //comment highlighting
            range.SetStyle(CommentStyle, VBCommentRegex);
            //number highlighting
            range.SetStyle(NumberStyle, VBNumberRegex);
            //class name highlighting
            range.SetStyle(ClassNameStyle, VBClassNameRegex);
            //keyword highlighting
            range.SetStyle(KeywordStyle, VBKeywordRegex);

            //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:remco138,项目名称:FastColoredTextBox,代码行数:38,代码来源:SyntaxHighlighter.cs

示例10: CSharpSyntaxHighlight

        /// <summary>
        /// Highlights C# code
        /// </summary>
        /// <param name="range"></param>
        public virtual void CSharpSyntaxHighlight(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(StringStyle, CommentStyle, NumberStyle, AttributeStyle, ClassNameStyle, KeywordStyle);
            //
            if (CSharpStringRegex == null)
                InitCShaprRegex();
            //string highlighting
            range.SetStyle(StringStyle, CSharpStringRegex);
            //comment highlighting
            range.SetStyle(CommentStyle, CSharpCommentRegex1);
            range.SetStyle(CommentStyle, CSharpCommentRegex2);
            range.SetStyle(CommentStyle, CSharpCommentRegex3);
            //number highlighting
            range.SetStyle(NumberStyle, CSharpNumberRegex);
            //attribute highlighting
            range.SetStyle(AttributeStyle, CSharpAttributeRegex);
            //class name highlighting
            range.SetStyle(ClassNameStyle, CSharpClassNameRegex);
            //keyword highlighting
            range.SetStyle(KeywordStyle, CSharpKeywordRegex);

            //find document comments
            foreach (var 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 (var rr in r.GetRanges(HTMLTagContentRegex))
                {
                    rr.ClearStyle(StyleIndex.All);
                    rr.SetStyle(CommentTagStyle);
                }
                //prefix '///'
                foreach (var 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:remco138,项目名称:FastColoredTextBox,代码行数:62,代码来源:SyntaxHighlighter.cs

示例11: HTMLSyntaxHighlight

        /// <summary>
        /// Highlights HTML code
        /// </summary>
        /// <param name="range"></param>
        public virtual void HTMLSyntaxHighlight(Range range)
        {
            range.tb.CommentPrefix = null;
            range.tb.LeftBracket = '<';
            range.tb.RightBracket = '>';
            range.tb.LeftBracket2 = '(';
            range.tb.RightBracket2 = ')';
            //clear style of changed range
            range.ClearStyle(CommentStyle, TagBracketStyle, TagNameStyle, AttributeStyle, AttributeValueStyle, HtmlEntityStyle);
            //
            if (HTMLTagRegex == null)
                InitHTMLRegex();
            //comment highlighting
            range.SetStyle(CommentStyle, HTMLCommentRegex1);
            range.SetStyle(CommentStyle, HTMLCommentRegex2);
            //tag brackets highlighting
            range.SetStyle(TagBracketStyle, HTMLTagRegex);
            //tag name
            range.SetStyle(TagNameStyle, HTMLTagNameRegex);
            //end of tag
            range.SetStyle(TagNameStyle, HTMLEndTagRegex);
            //attributes
            range.SetStyle(AttributeStyle, HTMLAttrRegex);
            //attribute values
            range.SetStyle(AttributeValueStyle, HTMLAttrValRegex);
            //html entity
            range.SetStyle(HtmlEntityStyle, HTMLEntityRegex);

            //clear folding markers
            range.ClearFoldingMarkers();
            //set folding markers
            range.SetFoldingMarkers("<head", "</head>", RegexOptions.IgnoreCase);
            range.SetFoldingMarkers("<body", "</body>", RegexOptions.IgnoreCase);
            range.SetFoldingMarkers("<table", "</table>", RegexOptions.IgnoreCase);
            range.SetFoldingMarkers("<form", "</form>", RegexOptions.IgnoreCase);
            range.SetFoldingMarkers("<div", "</div>", RegexOptions.IgnoreCase);
            range.SetFoldingMarkers("<script", "</script>", RegexOptions.IgnoreCase);
            range.SetFoldingMarkers("<tr", "</tr>", RegexOptions.IgnoreCase);
        }
开发者ID:remco138,项目名称:FastColoredTextBox,代码行数:43,代码来源:SyntaxHighlighter.cs

示例12: HighlightInvisbleCharacters

 /// <summary>
 ///     Highlights Invisble Characters
 /// </summary>
 /// <param name="r"></param>
 private void HighlightInvisbleCharacters(Range r)
 {
     if (!Globals.Settings.HiddenChars) return;
     if (_invisibleCharsStyle == null)
         _invisibleCharsStyle = new InvisibleCharsRenderer(Pens.Gray);
     r.ClearStyle(_invisibleCharsStyle);
     r.SetStyle(_invisibleCharsStyle, @".$|.\r\n|\s");
 }
开发者ID:samarjeet27,项目名称:ynoteclassic,代码行数:12,代码来源:Editor.cs

示例13: 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';

            range.tb.AutoIndentCharsPatterns
                = @"
            ^\s*[\w\.\(\)]+\s*(?<range>=)\s*(?<range>.+)
            ";
            //clear style of changed range
            range.ClearStyle(StringStyle, CommentStyle, NumberStyle, ClassNameStyle, KeywordStyle, SpecialWordstyle, SpecialWordstyle1); // G.X two last
            //
            if (VBStringRegex == null)
                InitVBRegex();
            //string highlighting
            range.SetStyle(StringStyle, VBStringRegex);
            //comment highlighting
            range.SetStyle(CommentStyle, VBCommentRegex);
            //number highlighting
            range.SetStyle(NumberStyle, VBNumberRegex);
            //class name highlighting
            range.SetStyle(ClassNameStyle, VBClassNameRegex);
            //keyword highlighting
            range.SetStyle(KeywordStyle, VBKeywordRegex);

            range.SetStyle(SpecialWordstyle, VBSpecial);

            range.SetStyle(SpecialWordstyle1, VBSpecial2);
            //clear folding markers
            range.ClearFoldingMarkers();
            //set folding markers
            range.SetFoldingMarkers(@"#Region\b", @"#End\s+Region\b", RegexOptions.IgnoreCase); // Property|Event|Sub|Function|Get
            range.SetFoldingMarkers(@"\b(Property)[ \t]+\S+",
                                    @"\bEnd (Property)\b", RegexOptions.IgnoreCase);
            range.SetFoldingMarkers(@"^\s*(?<range>While)[ \t]+\S+", @"^\s*(?<range>End While)\b",
                                    RegexOptions.Multiline | RegexOptions.IgnoreCase);
            range.SetFoldingMarkers(@"\b(Sub|Function|Event)[ \t]+[^\s']+", @"\bEnd (Sub|Function|Event)\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:GiorgosXou,项目名称:Lua_LOVE_2D_Studio,代码行数:52,代码来源:SyntaxHighlighter.cs

示例14: 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

示例15: PascalSyntaxHighlight

        /// <summary>
        /// Highlights Pascal code
        /// </summary>
        /// <param name="range"></param>
        public virtual void PascalSyntaxHighlight(Range range)
        {
            range.tb.CommentPrefix = "\x0";
            range.tb.LeftBracket = '(';
            range.tb.RightBracket = ')';
            range.tb.LeftBracket2 = '\x0';
            range.tb.RightBracket2 = '\x0';
            //clear style of changed range
            range.ClearStyle(StringStyle, CommentStyle, NumberStyle, ClassNameStyle, KeywordStyle);
            //
            if (PascalStringRegex == null)
                InitPascalRegex();
            //string highlighting
            range.SetStyle(StringStyle, PascalStringRegex);
            //comment highlighting
            range.SetStyle(CommentStyle, PascalCommentRegex);
            range.SetStyle(CommentStyle, PascalCommentRegex2);
            //number highlighting
            range.SetStyle(NumberStyle, PascalNumberRegex);

            //keyword highlighting
            range.SetStyle(KeywordStyle, PascalKeywordRegex);

            //datatype highlighting
            range.SetStyle(DataTypeStyle, PascalDatatypeRegex);

            //clear folding markers
            range.ClearFoldingMarkers();
            //set folding markers
            range.SetFoldingMarkers(@"\b(begin| *= *record|(case \w+ of))", @"\bend", RegexOptions.IgnoreCase);
        }
开发者ID:hoang-nc,项目名称:FastColoredTextBox,代码行数:35,代码来源:SyntaxHighlighter.cs


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