网站导航免费论文 原创论文 论文搜索 原创论文 网学软件 学术大家 资料中心 会员中心 问题解答 原创论文 论文素材 设计下载 最新论文 下载排行 论文上传 在线投稿 联系我们
返回网学首页
网学联系
最新论文 推荐专题 热门论文 素材专题
当前位置: 网学 > 编程文档 > VB.net > 正文
完整的VB.NET的语法解析程序
来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 12/10/15
下载{$ArticleTitle}原创论文样式

作者: blood
  比较长,不过支持全部的关键字,直接就可以用了。
using System;
using System.Text;
using System.Text.RegularExpressions;

namespace Com.OSLeague.Component
{
/// <summary>
/// 语法分析器,将所有Code根据语法进行变色
/// <list type="VB">支持VB.NET</list>
/// <list type="CS">支持CS</list>
/// <author>掉掉</author>
/// <date>2002年5月14日</date>
/// <Memo>
/// 练习正则表达式
/// </Memo>
/// </summary>
public class CodeAnalysis
{

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

const string TAG_FNTRED = @"<font color=""red"">";
const string TAG_FNTBLUE = @"<font color=""blue"">" ;
const string TAG_FNTGRN = @"<font color=""green"">" ;
const string TAG_FNTMRN = @"<font color=""maroon"">" ;
const string TAG_FNTBLACK = @"<font color=""black"">" ;
const string TAG_EFONT = @"</font>" ;
const string TAG_SPNYELLOW = @"<span style=""background-color: yellow;"">";
const string TAG_ESPAN = @"</span>";
const string TAG_B = @"<b>";
const string TAG_EB = @"</b>";
const string TAG_COMMENT = @"<font colr=#008200>";
const string TAG_ECOMMENT = @"</font>";

//



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



/// <summary>
/// 处理VB.NET代码,彩色化..
/// </summary>
/// <param name="Code">传入的Code</param>
/// <returns>处理过后的代码</returns>
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","Int
  • 下一篇资讯: vb.net实现控件数组
  • 网学推荐

    免费论文

    原创论文

    浏览:
    设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
    版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
    Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
    湘ICP备09003080号