首页 > 编程 > ASP > 正文

VBS、ASP代码语法加亮显示的类(1)

2024-05-04 11:06:16
字体:
来源:转载
供稿:网友
<% class cbuffer
private objfso, objfile, objdict
private m_strpathtofile, m_tablebgcolor, m_starttime
private m_endtime, m_linecount, m_intkeymin, m_intkeymax
private m_codecolor, m_commentcolor, m_stringcolor, m_tabspaces

private sub class_initialize()
tablebgcolor = "white"
codecolor = "blue"
commentcolor = "green"
stringcolor = "gray"
tabspaces = " "
pathtofile = ""

m_starttime = 0
m_endtime = 0
m_linecount = 0

keymin = 2
keymax = 8

set objdict = server.createobject("scripting.dictionary")
objdict.comparemode = 1

createkeywords

set objfso = server.createobject("scripting.filesystemobject")
end sub

private sub class_terminate()
set objdict = nothing
set objfso = nothing
end sub


public property let codecolor(incolor)
m_codecolor = "<font color=" & incolor & "><strong>"
end property
private property get codecolor()
codecolor = m_codecolor
end property

public property let commentcolor(incolor)
m_commentcolor = "<font color=" & incolor & ">"
end property
private property get commentcolor()
commentcolor = m_commentcolor
end property

public property let stringcolor(incolor)
m_stringcolor = "<font color=" & incolor & ">"
end property
private property get stringcolor()
stringcolor = m_stringcolor
end property

public property let tabspaces(inspaces)
m_tabspaces = inspaces
end property
private property get tabspaces()
tabspaces = m_tabspaces
end property

public property let tablebgcolor(incolor)
m_tablebgcolor = incolor
end property

private property get tablebgcolor()
tablebgcolor = m_tablebgcolor
end property

public property get processingtime()
processingtime = second(m_endtime - m_starttime)
end property

public property get linecount()
linecount = m_linecount
end property

public property get pathtofile()
pathtofile = m_strpathtofile
end property
public property let pathtofile(inpath)
m_strpathtofile = inpath
end property

private property let keymin(inmin)
m_intkeymin = inmin
end property
private property get keymin()
keymin = m_intkeymin
end property
private property let keymax(inmax)
m_intkeymax = inmax
end property
private property get keymax()
keymax = m_intkeymax
end property

private sub createkeywords()
objdict.add "abs", "abs"
objdict.add "and", "and"
objdict.add "array", "array"
objdict.add "call", "call"
objdict.add "cbool", "cbool"
objdict.add "cbyte", "cbyte"
objdict.add "ccur", "ccur"
objdict.add "cdate", "cdate"
objdict.add "cdbl", "cdbl"
objdict.add "cint", "cint"
objdict.add "class", "class"
objdict.add "clng", "clng"
objdict.add "const", "const"
objdict.add "csng", "csng"
objdict.add "cstr", "cstr"
objdict.add "date", "date"
objdict.add "dim", "dim"
objdict.add "do", "do"
objdict.add "loop", "loop"
objdict.add "empty", "empty"
objdict.add "eqv", "eqv"
objdict.add "erase", "erase"
objdict.add "exit", "exit"
objdict.add "false", "false"
objdict.add "fix", "fix"
objdict.add "for", "for"
objdict.add "next", "next"
objdict.add "each", "each"
objdict.add "function", "function"
objdict.add "global", "global"
objdict.add "if", "if"
objdict.add "then", "then"
objdict.add "else", "else"
objdict.add "elseif", "elseif"
objdict.add "imp", "imp"
objdict.add "int&quo

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表