CodePress: Lua用syntax highlighting

http://storehouse.sakura.ne.jp/viewvc/viewvc.cgi/codepress_lua/?root=svn
JavaScript用をベースにして作ってみた。バージョンは5.1。

/*
 * CodePress regular expressions for Lua syntax highlighting
 */
 
// Lua
Language.syntax = [ 
	{ input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
	{ input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
	{ input : /\[(=*)\[(.*?)\](=*)\]/g, output : '<s>[$1[$2]$3]</s>' }, // strings
	{ input : /(function\s+)([\w\.]*)/g, output : '$1<em>$2</em>' }, // functions
	{ input : /\b(and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/g, output : '<b>$1</b>' }, // reserved words
	{ input : /\b(_G|_VERSION|assert|chunkname|collectgarbage|dofile|error|getfenv|getmetatable|index|ipairs|load|load|load|loadfile|loadstring|next|pairs|pcall|print|rawequal|rawget|rawset|select|setfenv|setmetatable|table|tonumber|tostring|type|unpack|xpcall)\b/g, output : '<u>$1</u>' }, // special words
	{ input : /([^:]|^)--(.*?)(<br|<\/P)/g, output : '$1<i>--$2</i>$3' } // comments //
]

Language.snippets = [
	{ input : 'fun', output : 'function $0()\n\t\nend' },
	{ input : 'func', output : 'function $0()\n\t\nend' }
]

Language.complete = [
	{ input : '\'',output : '\'$0\'' },
	{ input : '"', output : '"$0"' },
	{ input : '(', output : '\($0\)' },
	{ input : '[', output : '\[$0\]' },
	{ input : '{', output : '{$0}' }		
]

Language.shortcuts = []
/*
 * CodePress color styles for Lua syntax highlighting
 */

b {color:#7F0055;font-weight:bold;} /* reserved words */
u {color:darkblue;font-weight:bold;} /* special words */
i, i b, i s, i u {color:green;font-weight:normal;} /* comments */
s, s b, s u {color:#2A00FF;font-weight:normal;} /* strings */
em {color:darkblue;font-weight:bold;} /* functions */