? vb.net亚博足球娱乐场注册--任意三数字加yabo.com直达官网之完整的VB.NET的语法解析程序 亚博足球娱乐场注册,亚博娱乐全天彩,亚博官网赢钱不给
VB.net 2010 视频亚博足球娱乐场注册--任意三数字加yabo.com直达官网 VB.net 2010 视频亚博足球娱乐场注册--任意三数字加yabo.com直达官网 VB.net 2010 视频亚博足球娱乐场注册--任意三数字加yabo.com直达官网
SQL Server 2008 视频亚博足球娱乐场注册--任意三数字加yabo.com直达官网 c#入门经典亚博足球娱乐场注册--任意三数字加yabo.com直达官网 Visual Basic从门到精通视频亚博足球娱乐场注册--任意三数字加yabo.com直达官网
当前位置:
首页 > 编程开发 > VBnet >
  • vb.net亚博足球娱乐场注册--任意三数字加yabo.com直达官网之完整的VB.NET的语法解析程序

  • 2017-06-07 15:59 来源:未知
作者: blood?
??比较长,不过支持全部的关键字,直接就可以用了。
using System;
using System.Text;
using System.Text.RegularExpressions;

namespace Com.OSLeague.Component
{
///
/// 语法分析器,将所有Code根据语法进行变色
/// 支持VB.NET
/// 支持CS
/// 掉掉
/// 2002年5月14日
///
/// 练习正则表达式
///

///

public class CodeAnalysis
{

//
//定义HTML开始和结束的语句,用于语法变色
//

const string TAG_FNTRED = @"";
const string TAG_FNTBLUE = @"" ;
const string TAG_FNTGRN = @"" ;
const string TAG_FNTMRN = @"" ;
const string TAG_FNTBLACK = @"" ;
const string TAG_EFONT = @"
" ;
const string TAG_SPNYELLOW = @"";
const string TAG_ESPAN = @"
";
const string TAG_B = @"";
const string TAG_EB = @"
";
const string TAG_COMMENT = @"";
const string TAG_ECOMMENT = @"
";

//



public CodeAnalysis()
{
//
// TODO: 在此处添加构造函数逻辑
//
}



///
/// 处理VB.NET代码,彩色化..
///

/// 传入的Code
/// 处理过后的代码
public string ParseVB(string Code)
{
//
//定义VB.NET中关键字,将其存为数组
//

string[] VB_Keyword = new string[]
{
"AddHandler","AddressOf","AndAlso","Alias","And","Ansi","As","Assembly","Auto","Boolean",
"ByRef","Byte","ByVal","Call","Case","Catch","CBool","CByte","CChar",
"CDate","CDec","CDbl","Char","CInt","Class","CLng","CObj","Const",
"CShort","CSng","CStr","CType","Date","Decimal","Declare","Default",
"Delegate","Dim","DirectCast","Do","Double","Each","Else","ElseIf","End",
"Enum","Erase","Error","Event","Exit","False",
"Finally","For","Friend","Function","Get","GetType","GoTo","Handles","If",
"Implements","Imports","In","Inherits","Integer","Interface",
"Is","Let","Lib","Like","Long","Loop","Me","Mod","Module",
"MustInherit","MustOverride","MyBase","MyClass","Namespace","New","Next","Not","Nothing",
"NotInheritable","NotOverridable","Object","On","Option","Optional","Or","OrElse",
"Overloads","Overridable","Overrides","ParamArray","Preserve","Private","Property","Protected","Public",
"RaiseEvent","ReadOnly","ReDim","RemoveHandler","Resume","Return",
"Select","Set","Shadows","Shared","Short","Single","Static","Step","Stop",
"String","Structure","Sub","SyncLock","Then","Throw",
"To","True","Try","TypeOf","Unicode","Until","Variant","When","While",
"With","WithEvents","WriteOnly","Xor"
};



//
//设定转换代码颜色
//

string ReplaceVBComment = TAG_COMMENT + "$1" + TAG_ECOMMENT;
string ReplaceVBKeyword = TAG_FNTBLUE + "${char}" + TAG_EFONT;
//开始转换
for (int i=0;i<>
{
string TempDirectives = @"(?(\s" + VB_Keyword[i] + "|" + VB_Keyword[i] + @"\s))";
Code = Regex.Replace(Code,TempDirectives,ReplaceVBKeyword,RegexOptions.IgnoreCase);
Code = Regex.Replace(Code,@"'(?[^\r\n]*)",ReplaceVBComment);
Code = Regex.Replace(Code,@"REM (?[^\r\n]*)",ReplaceVBComment);
}
return Code;?
}
}
}

本栏文章均来自于互联网,版权归原作者和各发布网站所有,本站收集这些文章仅供学习参考之用。任何人都不能将这些文章用于商业或者其他目的。

相关亚博足球娱乐场注册--任意三数字加yabo.com直达官网