コード例 #1
0
        /// <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);
            }
        }
コード例 #2
0
        // 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);
            }
        }
コード例 #3
0
        /// <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);
            }
        }