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


C# Range.SetStylesStringsAndComments方法代码示例

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


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

示例1: PHPSyntaxHighlight

        /// <summary>
        /// Highlights PHP code
        /// </summary>
        /// <param name="range"></param>
        public 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();
            range.SetStyle(NumberStyle, PHPNumberRegex);
            range.SetStyle(VariableStyle, PHPVarRegex);
            range.SetStyle(KeywordStyle , PHPKeywordRegex1); //
            range.SetStyle(KeywordStyle2, PHPKeywordRegex2);
            range.SetStyle(KeywordStyle3, PHPKeywordRegex3);
            range.SetStylesStringsAndComments(PHPStringRegex, StringStyle, CommentStyle); // By WendyH

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

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

示例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  = '\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

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

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

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

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

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

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