可利用 \\和 \\、把正则表达式分割成不同的组;模式中的每个组自左向右指定为 Group #n,n=1,2,…;组的概念在替换时很有用。 例如∶
abc(xyz)可匹配abcxyz,其中xyz被认为是group#1, 利用21来替换(abc)(xyz),替换结果为xyzabc。
3.2 正则表达式在配置tc编译器中的应用∶
正则表达式格式与源代码文件路径相对应,这里我的tc安装目录为d:tc,tc源文件放在d:tcsrc下,并命名为qn.c或qtn.c(其中n=1,2,…)。 观察Tc编译器某一次输出错误信息的格式∶
Error d:tcsrcq5.c 18: Lvalue required in function jsSort
则我们要匹配\d:tcsrcq5.c 18\部分,进一步地,按照SourceInsight捕捉输出并加以解析时的要求,要以组的形式、分别匹配\d:tcsrcq5.c
18\中的文件部分和行号部分∶
行号([1-9][0-9]*) 空格行号s([1-9][0-9]*)
文件名(d:tcsrc[qQ][tT][1-9][0-9]*.[cC]) 全部加起来为∶
(d:tcsrc[qQ][tT]*[1-9][0-9]*.[cC])s([1-9][0-9]*)
3.3 正则表达式在配置javac编译器中的应用∶
我的JAVA_HOME是c:jdk,我的java源文件放于d:javasrc中,并命名为qn.java或qtn.java(其中n=1,2,…)。 观察JDK编译器某一次输出错误信息的格式∶ D:javasrcQ3.java:3: ';' expected 正则表达式为∶
([dD]:javasrc[qQ][tT]*[1-9][0-9]*.java):([1-9][0-9]*)
4、自定义命令
自定义命令与项目相关,在一个项目中定义的所有自定义命令属于该项目、只对该项目有效(包括快捷键等)。
自定义命令类似于命令行批处理文件。SIS允许自定义命令在后台运行;并可以捕捉自定义命令的输出、放置于文件中、或粘贴入当前光标
插入点。
分别利用上面SIS对输出信息的处理方式,自定义命令对集成编译器相当有用,可以捕捉编译器输出并创建SourceLink寻错;自定义命
令对于文本过滤也相当有用,可选中待过滤区块、运行Sort自定义命令、粘贴回选定区块、即完成文本过滤。
请按下面步骤创建自定义命令∶ Options菜单?Custom Command
?点右边Add钮、填入新自定义命令名称,或下拉左边Commands、选择命令进行修改 ?Run框、填入待执行命令行,可含有特殊元字符,见后面的元字符表
?Dir框、执行命令行时应处的目录,如不填,以源代码文件所在目录为命令执行目录 ?勾选Output框的Capture Output、输出被捕捉,如果勾选Paste Output,输出被粘贴 ?勾选Control Group框中的Save Files First、SIS会在运行命令前先检查文件是否保存 ?勾选Control Group框中的Pause When Done、SIS会在命令结束后暂停、方便检查 ?勾选Source Links in Output框中的Parse Source Links,?/p>
source insight常用宏
转自:http://blog.csdn.net/Jupin/archive/2005/02/04/281020.aspx 说明:
该宏文件实现一些编码程中能会到的功能, 如添加文件头、函数说明和宏定义等, 使用时能自动添加文件名、函数名和当前日期. 使用说明:
1. Project->Open Project... 打开Base工程(该工程一般在\我的文档\\Source Insight\\Projects\\Base\中); 2. Project->Add and Remove Project Files... 加入宏文件(即Gaoke.em);
3. Options->Menu Assignments 打开Menu Assignments窗口, 在Command中输入Macro, 选中要使用的宏, 添加到合适的菜单中.
/*附上宏定义文件*/
/* t357.em - a small collection of useful editing macros */
/****************************************************************************** * InsFileHeader -- insert the information of file *
* modification history * --------------------
* 01a, 23mar2003, added DESCRIPTION by t357 * 01a, 05mar2003, t357 written * --------------------
******************************************************************************/ /*------------------------------------------------------------------------- I N S E R T H E A D E R
Inserts a comment header block at the top of the current function.
This actually works font-size: 12px;\To use this, define an environment variable \and set it to your email name. eg. set szMyName=raygr
-------------------------------------------------------------------------*/ macro InsFileHeader() {
/*######################################################### #########################################################
####### Set szMyName variable to your name ######## ####### for example szMyName = \
######################################################### #########################################################*/ szMyName = \ // Get current time szTime = GetSysTime(1) Day = szTime.Day Month = szTime.Month Year = szTime.Year if (Day < 10) szDay = \0@Day@\ else
szDay = Day
szMonth = NumToName(Month) hBuf = GetCurrentBuf()
szpathName = GetBufName(hBuf) szfileName = GetFileName(szpathName) nlength = StrLen(szfileName)
szInf = Ask(\ile:\
szDescription = Ask(\description of file:\ hbuf = GetCurrentBuf()
// begin assembling the title string
InsBufLine(hbuf, 0, \******************************************************************************\ InsBufLine(hbuf, 1, \* @szfileName@ - @szInf@\ InsBufLine(hbuf, 2, \* \
InsBufLine(hbuf, 3, \* Copyright 1998-2003 Guangzhou Gaoke Communication Technology Co.,Ltd.\ InsBufLine(hbuf, 4, \* \
InsBufLine(hbuf, 5, \* DESCRIPTION: - \ InsBufLine(hbuf, 6, \* @szDescription@\ InsBufLine(hbuf, 7, \* modification history\ InsBufLine(hbuf, 8, \* --------------------\
InsBufLine(hbuf, 9, \* 01a, @szDay@@szMonth@@Year@, @szMyName@ written\ InsBufLine(hbuf, 10, \* --------------------\
InsBufLine(hbuf, 11, \******************************************************************************/\ // put the insertion point inside the header comment SetBufIns(hbuf, 1, nlength + strlen(szInf) + 8) }
/****************************************************************************** * InsFunHeader -- insert function's information *
* modification history * --------------------
* 01a, 23mar2003, added DESCRIPTION by t357
* 01a, 05mar2003, t357 written * --------------------
******************************************************************************/ macro InsFunHeader() {
// Get the owner's name from the environment variable: szMyName. // If the variable doesn't exist, then the owner field is skipped.
/*######################################################### ######################################################### ####### Set szMyName variable to your name ######## ####### for example szMyName = \
######################################################### #########################################################*/ szMyName = \
// Get a handle to the current file buffer and the name // and location of the current symbol where the cursor is. hbuf = GetCurrentBuf() szFunc = GetCurSymbol() ln = GetSymbolLine(szFunc) // Get current time szTime = GetSysTime(1) Day = szTime.Day Month = szTime.Month Year = szTime.Year if (Day < 10) szDay = \0@Day@\ else
szDay = Day
szMonth = NumToName(Month)
szInf = Ask(%unction:\
szDescription = Ask(\the description of function:\ // begin assembling the title string
sz = \******************************************************************************\ InsBufLine(hbuf, ln, sz)
InsBufLine(hbuf, ln + 1, \* @szFunc@ - @szInf@\ InsBufLine(hbuf, ln + 2, \* DESCRIPTION: - \ InsBufLine(hbuf, ln + 3, \* @szDescription@ \// remove by t357. CutWord(szDescription) InsBufLine(hbuf, ln + 4, \* Input: \ InsBufLine(hbuf, ln + 5, \* Output: \ InsBufLine(hbuf, ln + 6, \* Returns: \ InsBufLine(hbuf, ln + 7, \* \
InsBufLine(hbuf, ln + 8, \* modification history\ InsBufLine(hbuf, ln + 9, \* --------------------\
InsBufLine(hbuf, ln + 10, \* 01a, @szDay@@szMonth@@Year@, @szMyName@ written\ InsBufLine(hbuf, ln + 11, \* --------------------\ InsBufLine(hbuf, ln + 12, \
******************************************************************************/\ // put the insertion point inside the header comment SetBufIns(hbuf, ln + 1, strlen(szFunc) + strlen(szInf) + 8) }
/****************************************************************************** * NumToName -- change the month number to name *
* modification history * --------------------
* 01a, 05mar2003, t357 written * --------------------
******************************************************************************/ macro NumToName(Month) {
if (Month == 1) return \an\ if (Month == 2) return \eb\ if (Month == 3) return \ if (Month == 4) return \ if (Month == 5) return \ if (Month == 6) return \ if (Month == 7) return \ if (Month == 8) return \ if (Month == 9) return \ if (Month == 10) return \ if (Month == 11) return \ if (Month == 12) return \}
相关推荐: