本文整理汇总了C#中Range.ClearFoldingMarkers方法的典型用法代码示例。如果您正苦于以下问题:C# Range.ClearFoldingMarkers方法的具体用法?C# Range.ClearFoldingMarkers怎么用?C# Range.ClearFoldingMarkers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Range
的用法示例。
在下文中一共展示了Range.ClearFoldingMarkers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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+");
}
示例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
}
示例3: SQLSyntaxHighlight
/// <summary>
/// Highlights SQL code
/// </summary>
/// <param name="range"></param>
public virtual void SQLSyntaxHighlight(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(CommentStyle, StringStyle, NumberStyle, VariableStyle, StatementsStyle, KeywordStyle, FunctionsStyle, TypesStyle);
//
if (SQLStringRegex == null)
InitSQLRegex();
//comment highlighting
range.SetStyle(CommentStyle, SQLCommentRegex1);
range.SetStyle(CommentStyle, SQLCommentRegex2);
range.SetStyle(CommentStyle, SQLCommentRegex3);
//string highlighting
range.SetStyle(StringStyle, SQLStringRegex);
//number highlighting
range.SetStyle(NumberStyle, SQLNumberRegex);
//types highlighting
range.SetStyle(TypesStyle, SQLTypesRegex);
//var highlighting
range.SetStyle(VariableStyle, SQLVarRegex);
//statements
range.SetStyle(StatementsStyle, SQLStatementsRegex);
//keywords
range.SetStyle(KeywordStyle, SQLKeywordsRegex);
//functions
range.SetStyle(FunctionsStyle, SQLFunctionsRegex);
//clear folding markers
range.ClearFoldingMarkers();
//set folding markers
range.SetFoldingMarkers(@"\bBEGIN\b", @"\bEND\b", RegexOptions.IgnoreCase);//allow to collapse BEGIN..END blocks
range.SetFoldingMarkers(@"/\*", @"\*/");//allow to collapse comment block
}
示例4: JScriptSyntaxHighlight
/// <summary>
/// Highlights JavaScript code
/// </summary>
/// <param name="range"></param>
public virtual void JScriptSyntaxHighlight(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, KeywordStyle);
//
if (JScriptStringRegex == null)
InitJScriptRegex();
//string highlighting
range.SetStyle(StringStyle, JScriptStringRegex);
//comment highlighting
range.SetStyle(CommentStyle, JScriptCommentRegex1);
range.SetStyle(CommentStyle, JScriptCommentRegex2);
range.SetStyle(CommentStyle, JScriptCommentRegex3);
//number highlighting
range.SetStyle(NumberStyle, JScriptNumberRegex);
//keyword highlighting
range.SetStyle(KeywordStyle, JScriptKeywordRegex);
//clear folding markers
range.ClearFoldingMarkers();
//set folding markers
range.SetFoldingMarkers("{", "}");//allow to collapse brackets block
range.SetFoldingMarkers(@"/\*", @"\*/");//allow to collapse comment block
}
示例5: 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);
}
示例6: XMLSyntaxHighlight
/// <summary>
/// Highlights XML code
/// </summary>
/// <param name="range"></param>
public virtual void XMLSyntaxHighlight(Range range)
{
range.tb.CommentPrefix = null;
range.tb.LeftBracket = '<';
range.tb.RightBracket = '>';
range.tb.LeftBracket2 = '(';
range.tb.RightBracket2 = ')';
range.tb.AutoIndentCharsPatterns = @"";
//clear style of changed range
range.ClearStyle(CommentStyle, XmlTagBracketStyle, XmlTagNameStyle, XmlAttributeStyle, XmlAttributeValueStyle,
XmlEntityStyle, XmlCDataStyle);
//
if (XMLTagRegex == null)
{
InitXMLRegex();
}
//xml CData
range.SetStyle(XmlCDataStyle, XMLCDataRegex);
//comment highlighting
range.SetStyle(CommentStyle, XMLCommentRegex1);
range.SetStyle(CommentStyle, XMLCommentRegex2);
//tag brackets highlighting
range.SetStyle(XmlTagBracketStyle, XMLTagRegex);
//tag name
range.SetStyle(XmlTagNameStyle, XMLTagNameRegex);
//end of tag
range.SetStyle(XmlTagNameStyle, XMLEndTagRegex);
//attributes
range.SetStyle(XmlAttributeStyle, XMLAttrRegex);
//attribute values
range.SetStyle(XmlAttributeValueStyle, XMLAttrValRegex);
//xml entity
range.SetStyle(XmlEntityStyle, XMLEntityRegex);
//clear folding markers
range.ClearFoldingMarkers();
//set folding markers
XmlFolding(range);
}
示例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
}
示例8: 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");
}
示例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';
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);
}
示例10: 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);
}
示例11: SQLSyntaxHighlight
/// <summary>
/// Highlights SQL code
/// </summary>
/// <param name="range"></param>
public virtual void SQLSyntaxHighlight(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(RedStyle, MagentaStyle, GreenStyle, BlueBoldStyle, BlueStyle, MaroonStyle);
//string highlighting
range.SetStyle(RedStyle, @""".*?""|'.+?'");
//number highlighting
range.SetStyle(MagentaStyle, @"\b\d+[\.]?\d*([eE]\-?\d+)?\b");
//comment highlighting
range.SetStyle(GreenStyle, @"--.*$", RegexOptions.Multiline);
range.SetStyle(GreenStyle, @"(/\*.*?\*/)|(/\*.*)", RegexOptions.Singleline);
range.SetStyle(GreenStyle, @"(/\*.*?\*/)|(.*\*/)", RegexOptions.Singleline | RegexOptions.RightToLeft);
//var highlighting
range.SetStyle(MaroonStyle, @"@[a-zA-Z_\d]*\b");
//statements
range.SetStyle(BlueBoldStyle, @"\b(ALTER APPLICATION ROLE|ALTER ASSEMBLY|ALTER ASYMMETRIC KEY|ALTER AUTHORIZATION|ALTER BROKER PRIORITY|ALTER CERTIFICATE|ALTER CREDENTIAL|ALTER CRYPTOGRAPHIC PROVIDER|ALTER DATABASE|ALTER DATABASE AUDIT SPECIFICATION|ALTER DATABASE ENCRYPTION KEY|ALTER ENDPOINT|ALTER EVENT SESSION|ALTER FULLTEXT CATALOG|ALTER FULLTEXT INDEX|ALTER FULLTEXT STOPLIST|ALTER FUNCTION|ALTER INDEX|ALTER LOGIN|ALTER MASTER KEY|ALTER MESSAGE TYPE|ALTER PARTITION FUNCTION|ALTER PARTITION SCHEME|ALTER PROCEDURE|ALTER QUEUE|ALTER REMOTE SERVICE BINDING|ALTER RESOURCE GOVERNOR|ALTER RESOURCE POOL|ALTER ROLE|ALTER ROUTE|ALTER SCHEMA|ALTER SERVER AUDIT|ALTER SERVER AUDIT SPECIFICATION|ALTER SERVICE|ALTER SERVICE MASTER KEY|ALTER SYMMETRIC KEY|ALTER TABLE|ALTER TRIGGER|ALTER USER|ALTER VIEW|ALTER WORKLOAD GROUP|ALTER XML SCHEMA COLLECTION|BULK INSERT|CREATE AGGREGATE|CREATE APPLICATION ROLE|CREATE ASSEMBLY|CREATE ASYMMETRIC KEY|CREATE BROKER PRIORITY|CREATE CERTIFICATE|CREATE CONTRACT|CREATE CREDENTIAL|CREATE CRYPTOGRAPHIC PROVIDER|CREATE DATABASE|CREATE DATABASE AUDIT SPECIFICATION|CREATE DATABASE ENCRYPTION KEY|CREATE DEFAULT|CREATE ENDPOINT|CREATE EVENT NOTIFICATION|CREATE EVENT SESSION|CREATE FULLTEXT CATALOG|CREATE FULLTEXT INDEX|CREATE FULLTEXT STOPLIST|CREATE FUNCTION|CREATE INDEX|CREATE LOGIN|CREATE MASTER KEY|CREATE MESSAGE TYPE|CREATE PARTITION FUNCTION|CREATE PARTITION SCHEME|CREATE PROCEDURE|CREATE QUEUE|CREATE REMOTE SERVICE BINDING|CREATE RESOURCE POOL|CREATE ROLE|CREATE ROUTE|CREATE RULE|CREATE SCHEMA|CREATE SERVER AUDIT|CREATE SERVER AUDIT SPECIFICATION|CREATE SERVICE|CREATE SPATIAL INDEX|CREATE STATISTICS|CREATE SYMMETRIC KEY|CREATE SYNONYM|CREATE TABLE|CREATE TRIGGER|CREATE TYPE|CREATE USER|CREATE VIEW|CREATE WORKLOAD GROUP|CREATE XML INDEX|CREATE XML SCHEMA COLLECTION|DELETE|DISABLE TRIGGER|DROP AGGREGATE|DROP APPLICATION ROLE|DROP ASSEMBLY|DROP ASYMMETRIC KEY|DROP BROKER PRIORITY|DROP CERTIFICATE|DROP CONTRACT|DROP CREDENTIAL|DROP CRYPTOGRAPHIC PROVIDER|DROP DATABASE|DROP DATABASE AUDIT SPECIFICATION|DROP DATABASE ENCRYPTION KEY|DROP DEFAULT|DROP ENDPOINT|DROP EVENT NOTIFICATION|DROP EVENT SESSION|DROP FULLTEXT CATALOG|DROP FULLTEXT INDEX|DROP FULLTEXT STOPLIST|DROP FUNCTION|DROP INDEX|DROP LOGIN|DROP MASTER KEY|DROP MESSAGE TYPE|DROP PARTITION FUNCTION|DROP PARTITION SCHEME|DROP PROCEDURE|DROP QUEUE|DROP REMOTE SERVICE BINDING|DROP RESOURCE POOL|DROP ROLE|DROP ROUTE|DROP RULE|DROP SCHEMA|DROP SERVER AUDIT|DROP SERVER AUDIT SPECIFICATION|DROP SERVICE|DROP SIGNATURE|DROP STATISTICS|DROP SYMMETRIC KEY|DROP SYNONYM|DROP TABLE|DROP TRIGGER|DROP TYPE|DROP USER|DROP VIEW|DROP WORKLOAD GROUP|DROP XML SCHEMA COLLECTION|ENABLE TRIGGER|EXEC|EXECUTE|FROM|INSERT|MERGE|OPTION|OUTPUT|SELECT|TOP|TRUNCATE TABLE|UPDATE|UPDATE STATISTICS|WHERE|WITH)\b", RegexOptions.IgnoreCase);
//key words
range.SetStyle(BlueStyle, @"\b(ADD|ALL|AND|ANY|AS|ASC|AUTHORIZATION|BACKUP|BEGIN|BETWEEN|BREAK|BROWSE|BY|CASCADE|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COLLATE|COLUMN|COMMIT|COMPUTE|CONSTRAINT|CONTAINS|CONTINUE|CROSS|CURRENT|CURRENT_DATE|CURRENT_TIME|CURSOR|DATABASE|DBCC|DEALLOCATE|DECLARE|DEFAULT|DENY|DESC|DISK|DISTINCT|DISTRIBUTED|DOUBLE|DUMP|ELSE|END|ERRLVL|ESCAPE|EXCEPT|EXISTS|EXIT|EXTERNAL|FETCH|FILE|FILLFACTOR|FOR|FOREIGN|FREETEXT|FULL|FUNCTION|GOTO|GRANT|GROUP|HAVING|HOLDLOCK|IDENTITY|IDENTITY_INSERT|IDENTITYCOL|IF|IN|INDEX|INNER|INTERSECT|INTO|IS|JOIN|KEY|KILL|LIKE|LINENO|LOAD|NATIONAL|NOCHECK|NONCLUSTERED|NOT|NULL|OF|OFF|OFFSETS|ON|OPEN|OR|ORDER|OUTER|OVER|PERCENT|PIVOT|PLAN|PRECISION|PRIMARY|PRINT|PROC|PROCEDURE|PUBLIC|RAISERROR|READ|READTEXT|RECONFIGURE|REFERENCES|REPLICATION|RESTORE|RESTRICT|RETURN|REVERT|REVOKE|ROLLBACK|ROWCOUNT|ROWGUIDCOL|RULE|SAVE|SCHEMA|SECURITYAUDIT|SET|SHUTDOWN|SOME|STATISTICS|TABLE|TABLESAMPLE|TEXTSIZE|THEN|TO|TRAN|TRANSACTION|TRIGGER|TSEQUAL|UNION|UNIQUE|UNPIVOT|UPDATETEXT|USE|USER|VALUES|VARYING|VIEW|WAITFOR|WHEN|WHILE|WRITETEXT)\b", RegexOptions.IgnoreCase);
//functions
range.SetStyle(MaroonStyle, @"(@@CONNECTIONS|@@CPU_BUSY|@@CURSOR_ROWS|@@DATEFIRST|@@DATEFIRST|@@DBTS|@@ERROR|@@FETCH_STATUS|@@IDENTITY|@@IDLE|@@IO_BUSY|@@LANGID|@@LANGUAGE|@@LOCK_TIMEOUT|@@MAX_CONNECTIONS|@@MAX_PRECISION|@@NESTLEVEL|@@OPTIONS|@@PACKET_ERRORS|@@PROCID|@@REMSERVER|@@ROWCOUNT|@@SERVERNAME|@@SERVICENAME|@@SPID|@@TEXTSIZE|@@TRANCOUNT|@@VERSION)\b|\b(ABS|ACOS|APP_NAME|ASCII|ASIN|ASSEMBLYPROPERTY|AsymKey_ID|ASYMKEY_ID|asymkeyproperty|ASYMKEYPROPERTY|ATAN|ATN2|AVG|CASE|CAST|CEILING|Cert_ID|Cert_ID|CertProperty|CHAR|CHARINDEX|CHECKSUM_AGG|COALESCE|COL_LENGTH|COL_NAME|COLLATIONPROPERTY|COLLATIONPROPERTY|COLUMNPROPERTY|COLUMNS_UPDATED|COLUMNS_UPDATED|CONTAINSTABLE|CONVERT|COS|COT|COUNT|COUNT_BIG|CRYPT_GEN_RANDOM|CURRENT_TIMESTAMP|CURRENT_TIMESTAMP|CURRENT_USER|CURRENT_USER|CURSOR_STATUS|DATABASE_PRINCIPAL_ID|DATABASE_PRINCIPAL_ID|DATABASEPROPERTY|DATABASEPROPERTYEX|DATALENGTH|DATALENGTH|DATEADD|DATEDIFF|DATENAME|DATEPART|DAY|DB_ID|DB_NAME|DECRYPTBYASYMKEY|DECRYPTBYCERT|DECRYPTBYKEY|DECRYPTBYKEYAUTOASYMKEY|DECRYPTBYKEYAUTOCERT|DECRYPTBYPASSPHRASE|DEGREES|DENSE_RANK|DIFFERENCE|ENCRYPTBYASYMKEY|ENCRYPTBYCERT|ENCRYPTBYKEY|ENCRYPTBYPASSPHRASE|ERROR_LINE|ERROR_MESSAGE|ERROR_NUMBER|ERROR_PROCEDURE|ERROR_SEVERITY|ERROR_STATE|EVENTDATA|EXP|FILE_ID|FILE_IDEX|FILE_NAME|FILEGROUP_ID|FILEGROUP_NAME|FILEGROUPPROPERTY|FILEPROPERTY|FLOOR|fn_helpcollations|fn_listextendedproperty|fn_servershareddrives|fn_virtualfilestats|fn_virtualfilestats|FORMATMESSAGE|FREETEXTTABLE|FULLTEXTCATALOGPROPERTY|FULLTEXTSERVICEPROPERTY|GETANSINULL|GETDATE|GETUTCDATE|GROUPING|HAS_PERMS_BY_NAME|HOST_ID|HOST_NAME|IDENT_CURRENT|IDENT_CURRENT|IDENT_INCR|IDENT_INCR|IDENT_SEED|IDENTITY\(|INDEX_COL|INDEXKEY_PROPERTY|INDEXPROPERTY|IS_MEMBER|IS_OBJECTSIGNED|IS_SRVROLEMEMBER|ISDATE|ISDATE|ISNULL|ISNUMERIC|Key_GUID|Key_GUID|Key_ID|Key_ID|KEY_NAME|KEY_NAME|LEFT|LEN|LOG|LOG10|LOWER|LTRIM|MAX|MIN|MONTH|NCHAR|NEWID|NTILE|NULLIF|OBJECT_DEFINITION|OBJECT_ID|OBJECT_NAME|OBJECT_SCHEMA_NAME|OBJECTPROPERTY|OBJECTPROPERTYEX|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPENXML|ORIGINAL_LOGIN|ORIGINAL_LOGIN|PARSENAME|PATINDEX|PATINDEX|PERMISSIONS|PI|POWER|PUBLISHINGSERVERNAME|PWDCOMPARE|PWDENCRYPT|QUOTENAME|RADIANS|RAND|RANK|REPLACE|REPLICATE|REVERSE|RIGHT|ROUND|ROW_NUMBER|ROWCOUNT_BIG|RTRIM|SCHEMA_ID|SCHEMA_ID|SCHEMA_NAME|SCHEMA_NAME|SCOPE_IDENTITY|SERVERPROPERTY|SESSION_USER|SESSION_USER|SESSIONPROPERTY|SETUSER|SIGN|SignByAsymKey|SignByCert|SIN|SOUNDEX|SPACE|SQL_VARIANT_PROPERTY|SQRT|SQUARE|STATS_DATE|STDEV|STDEVP|STR|STUFF|SUBSTRING|SUM|SUSER_ID|SUSER_NAME|SUSER_SID|SUSER_SNAME|SWITCHOFFSET|SYMKEYPROPERTY|symkeyproperty|sys\.dm_db_index_physical_stats|sys\.fn_builtin_permissions|sys\.fn_my_permissions|SYSDATETIME|SYSDATETIMEOFFSET|SYSTEM_USER|SYSTEM_USER|SYSUTCDATETIME|TAN|TERTIARY_WEIGHTS|TEXTPTR|TODATETIMEOFFSET|TRIGGER_NESTLEVEL|TYPE_ID|TYPE_NAME|TYPEPROPERTY|UNICODE|UPDATE\(|UPPER|USER_ID|USER_NAME|USER_NAME|VAR|VARP|VerifySignedByAsymKey|VerifySignedByCert|XACT_STATE|YEAR)\b", RegexOptions.IgnoreCase);
//clear folding markers
range.ClearFoldingMarkers();
//set folding markers
range.SetFoldingMarkers(@"\bBEGIN\b", @"\bEND\b", RegexOptions.IgnoreCase);//allow to collapse BEGIN..END blocks
range.SetFoldingMarkers(@"/\*", @"\*/");//allow to collapse comment block
}
示例12: 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(BlueStyle, GrayStyle, MagentaStyle, GreenStyle, RedStyle, MaroonStyle);
//string highlighting
range.SetStyle(RedStyle, @""".*?""|'.+?'");
//number highlighting
range.SetStyle(RedStyle, @"\b\d+[\.]?\d*\b");
//comment highlighting
range.SetStyle(GreenStyle, @"(//|#).*$", RegexOptions.Multiline);
range.SetStyle(GreenStyle, @"(/\*.*?\*/)|(/\*.*)", RegexOptions.Singleline);
range.SetStyle(GreenStyle, @"(/\*.*?\*/)|(.*\*/)", RegexOptions.Singleline | RegexOptions.RightToLeft);
//var highlighting
range.SetStyle(MaroonStyle, @"\$[a-zA-Z_\d]*\b");
//keyword highlighting
range.SetStyle(MagentaStyle, @"\b(die|echo|empty|exit|eval|include|include_once|isset|list|require|require_once|return|print|unset)\b");
range.SetStyle(BlueStyle, @"\b(abstract|and|array|as|break|case|catch|cfunction|class|clone|const|continue|declare|default|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|final|for|foreach|function|global|goto|if|implements|instanceof|interface|namespace|new|or|private|protected|public|static|switch|throw|try|use|var|while|xor)\b");
range.SetStyle(GrayStyle, @"__CLASS__|__DIR__|__FILE__|__LINE__|__FUNCTION__|__METHOD__|__NAMESPACE__");
//clear folding markers
range.ClearFoldingMarkers();
//set folding markers
range.SetFoldingMarkers("{", "}");//allow to collapse brackets block
range.SetFoldingMarkers(@"/\*", @"\*/");//allow to collapse comment block
}
示例13: 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(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+)");
//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);
}
示例14: 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(BlueStyle, BoldStyle, GrayStyle, MagentaStyle, GreenStyle, BrownStyle);
//string highlighting
range.SetStyle(BrownStyle, @""".*?""|'.+?'");
//comment highlighting
range.SetStyle(GreenStyle, @"//.*$", RegexOptions.Multiline);
range.SetStyle(GreenStyle, @"(/\*.*?\*/)|(/\*.*)", RegexOptions.Singleline);
range.SetStyle(GreenStyle, @"(/\*.*?\*/)|(.*\*/)", RegexOptions.Singleline | RegexOptions.RightToLeft);
//number highlighting
range.SetStyle(MagentaStyle, @"\b\d+[\.]?\d*([eE]\-?\d+)?[lLdDfF]?\b|\b0x[a-fA-F\d]+\b");
//attribute highlighting
range.SetStyle(GrayStyle, @"^\s*(?<range>\[.+?\])\s*$", RegexOptions.Multiline);
//class name highlighting
range.SetStyle(BoldStyle, @"\b(class|struct|enum|interface)\s+(?<range>\w+?)\b");
//keyword highlighting
range.SetStyle(BlueStyle, @"\b(abstract|as|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b|#region\b|#endregion\b");
//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
}
示例15: 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);
}
}