[AU3]QQ空间AU3着色代码!

#NoTrayIcon
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=D:\myziliao\au3\regrx\regexstring.kxf
$Form1 = GUICreate("QQ空间AU3着色 - by onepc", 591, 362, 203, 160)
$Group1 = GUICtrlCreateGroup("代码", 8, 16, 569, 305)
$Edit1 = GUICtrlCreateEdit("", 16, 40, 553, 273)
GUICtrlSetData(-1, "")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("生成", 208, 328, 75, 25)
$Button2 = GUICtrlCreateButton("退出", 296, 328, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_HightLine()

Case $Button2

Exit
EndSwitch
WEnd




Func _HightLine()
$code=StringSplit(GUICtrlRead($Edit1),@CRLF)
$mathkey='(?i)(\bexit\b|\bReturn\b|\bSelect\b|\bEndSelect\b|\blocal\b|\bGlobal\b|\bif\b|\belse\b|\bendif\b|\bthen\b|\bfor\b|\bto\b|\bstep\b|\bfunc\b|\bendfunc\b|\bwhile\b|\bswitch\b|\bcase\b|\bWEnd\b|\bEndSwitch\b|\bnext\b)'
$HightCode = ''
For $i=1 To $code[0]
If $code[$i]<>'' Then
$check = StringRegExp($code[$i],';',0)
;;;;;;;;
If $check Then
$temp=StringRegExp($code[$i],'([^;]*)(?=;)(.*)',3)
$leftcode=StringRegExpReplace($temp[0],'<','&lt;')
$leftcode=StringRegExpReplace($leftcode,'>','&gt;')
$leftcode=StringRegExpReplace($leftcode,'(?<=[-,+/*\s=&)(\[]|^)(\$\w+)(?=[-,+/*\s=&)(\[]|$)','<FONT color=AA0000>\1</FONT>')
$leftcode=StringRegExpReplace($leftcode,'(?i)(#\w+\b)','<EM><FONT color=F000FF>\1</FONT></EM>');<EM><FONT color=F000FF>\1</FONT></EM>
$leftcode=StringRegExpReplace($leftcode,$mathkey,'<FONT color=0000FF>\1</FONT>');关键字 0000FF <FONT color=AA0000>\1</FONT>
$leftcode=StringRegExpReplace($leftcode,'(?<=[-,+/*\s=&)(]|^)(@\w+)(?=[-,+/*\s=&)(])','<FONT color=FF33FF>\1</FONT>');FF33FF @hour
$leftcode=StringRegExpReplace($leftcode,'(?<=[-,+/*\s=&)(]|^)(\w+)(?=\s?\()','<FONT color=000090>\1</FONT>');000090 函数()
$rightcode=StringRegExpReplace($temp[1],'<','&lt;')
$rightcode=StringRegExpReplace($rightcode,'>','&gt;')
$rightcode=StringRegExpReplace($rightcode,'(.*)','<EM><FONT color=009933>\1</FONT></EM>') ;注释 009933 [color=Red]aa[/color]
$HightCode &= $leftcode & $rightcode & "<BR>"

Else
;$temp=StringRegExp($code[$i],'([^;]*)(?=;)(.*)',3)
$leftcode=StringRegExpReplace($code[$i],'<','&lt;')
$leftcode=StringRegExpReplace($leftcode,'>','&gt;')
$leftcode=StringRegExpReplace($leftcode,'(?<=[-,+/*\s=&)(\[]|^)(\$\w+)(?=[-,+/*\s=&)(\[]|$)','<FONT color=AA0000>\1</FONT>') ;(\$\w+\b)
;MsgBox(0,"变量",$leftcode)
$leftcode=StringRegExpReplace($leftcode,'(?i)(#\w+\b)','<EM><FONT color=F000FF>\1</FONT></EM>');
;MsgBox(0,"#",$leftcode)
$leftcode=StringRegExpReplace($leftcode,$mathkey,'<FONT color=0000FF>\1</FONT>');关键字 0000FF
$leftcode=StringRegExpReplace($leftcode,'(?<=[-,+/*\s=&)(]|^)(@\w+)(?=[-,+/*\s=&)(])','<FONT color=FF33FF>\1</FONT>');FF33FF @hour
$leftcode=StringRegExpReplace($leftcode,'(?<=[-,+/*\s=&)(]|^)(\w+)(?=\s?\()','<FONT color=000090>\1</FONT>');000090 函数()
$HightCode &=$leftcode & "<BR>"
EndIf
;;;;;;;;;
EndIf
Next
ClipPut($HightCode)
MsgBox(0,"提示","已复制到剪贴板!")
EndFunc

 

转载于:https://www.cnblogs.com/onepc/archive/2011/11/10/2244359.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值