/// <summary> /// Added by giaosudauto /// </summary> /// <param name="language"></param> /// <param name="range"></param> public virtual void HighlightComment(Language language, Range range) { switch (language) { case Language.Pascal: range.ClearDic(); range.ClearStyle(CommentCurlyStyle, CommentDoubleStyle); range.SetStyle(CommentDoubleStyle, PascalCommentRegex, HighlightType.CommentDouble); range.SetStyle(CommentCurlyStyle, PascalCommentCurlyRegex, HighlightType.CommentCurly); range.DoHighLight(); //System.Windows.Forms.MessageBox.Show("xxx"); //System.Windows.Forms.MessageBox.Show(range.Text); break; default: break; } }
/// <summary> /// Highlights C# code /// </summary> /// <param name="range"></param> public virtual void PascalSyntaxHighlight(Range range, Range rangforComment) { range.ClearDic(); 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>[^;]+); "; //clear style of changed range range.ClearStyle(OperatorStyle, StringStyle, CommentDoubleStyle, NumberStyle, ClassNameStyle, KeywordStyle, VariableStyle, CommentCurlyStyle, CommentLineStyle, InstructionCompileStyle, SharpCharStyle); //rangforComment.ClearStyle(CommentCurlyStyle, CommentStyle); // if (PascalStringRegex == null) { InitCShaprRegex(); } //comment highlighting range.SetStyle(CommentLineStyle, PascalCommentLineRegex, HighlightType.CommentLine); //range.SetBrackets(CommentCurlyStyle, CommentStyle); range.SetBrackets(CommentCurlyStyle, CommentDoubleStyle, InstructionCompileStyle); //range.SetStyle(CommentStyle, PascalCommentRegex, HighlightType.Comment); //range.SetStyle(CommentStyle, PascalCommentRegex3); range.SetStyle(CommentDoubleStyle, PascalCommentRegex, HighlightType.CommentDouble); range.SetStyle(CommentCurlyStyle, PascalCommentCurlyRegex, HighlightType.CommentCurly); //string highlighting range.SetStyle(StringStyle, PascalStringRegex, HighlightType.String); //number highlighting range.SetStyle(NumberStyle, PascalNumberRegex, HighlightType.Nummber); //attribute highlighting //range.SetStyle(AttributeStyle, PascalAttributeRegex,HighlightType.); //class name highlighting range.SetStyle(ClassNameStyle, PascalClassNameRegex, HighlightType.ClassName); //keyword highlighting range.SetStyle(KeywordStyle, PascalKeywordRegex, HighlightType.Keyword); // variable type highlighting range.SetStyle(VariableStyle, PascalVariableRegex, HighlightType.Variable); // operator highlight range.SetStyle(OperatorStyle, PascalOperatorRegex, HighlightType.Operator); // sharp char range.SetStyle(SharpCharStyle, PascalSharpCharRegex, HighlightType.SharpChar); // instruction commpile range.SetStyle(InstructionCompileStyle, PascalInstructionCompileRegex, HighlightType.InstructionCompile); // processing... //rangforComment.DoHighLight(); range.DoHighLight(); //clear folding markers range.ClearFoldingMarkers(); //set folding markers range.SetFoldingMarkers(@"{", @"}", HighlightType.CommentCurly); //allow to collapse brackets block range.SetFoldingMarkers(@"\(\*", @"\*\)", HighlightType.CommentDouble); //allow to collapse comment block range.SetFoldingMarkers(@"\b(repeat)\b", @"\b(until)\b", RegexOptions.IgnoreCase | RegexOptions.Compiled, HighlightType.Keyword); //allow to collapse beginend; blocks range.SetFoldingMarkers(@"\b(begin|case|record)\b", @"\b(end)\b", RegexOptions.IgnoreCase | RegexOptions.Compiled, HighlightType.Keyword); //allow to collapse beginend. blocks }