Notepad++ 内置了一个称为 UDL2.0 (User Defined Language) 的引擎,来实现用户自定义语法高亮,使用它,可以定制自己的代码语言。
相关的参考:
http://udl20.weebly.com/
ABB Rapid 语法类似于 Pascal,Ultraedit 文本编辑器已经有语法高亮定义。因此,可以在参考并引用其中的关键字等信息。
Ultraedit 的语言定义文件:http://www.ultraedit.com/files/wf/abb-s4.uew
之所以要使用 Notepad++ 而不是使用现成的 Ultraedit 是因为后者是收费软件,完全可以用前者来代替。
可导入的 ABB RAPID Notepad++ UDL 定义文件:
<NotepadPlus> <UserLang name="RAPID_MOSTONE" ext="mod sys prg" udlVersion="2.1"> <Settings> <Global caseIgnored="yes" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" /> <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" /> </Settings> <KeywordLists> <Keywords name="Comments">00! 01 02 03%%% 04%%%</Keywords> <Keywords name="Numbers, prefix1"></Keywords> <Keywords name="Numbers, prefix2"></Keywords> <Keywords name="Numbers, extras1"></Keywords> <Keywords name="Numbers, extras2"></Keywords> <Keywords name="Numbers, suffix1"></Keywords> <Keywords name="Numbers, suffix2"></Keywords> <Keywords name="Numbers, range"></Keywords> <Keywords name="Operators1">, : [ ] + - * / < = > \ ;</Keywords> <Keywords name="Operators2">DIV MOD NOT AND OR XOR</Keywords> <Keywords name="Folders in code1, open">MODULE THEN PROC WHILE FOR TEST FUNC RECORD TRAP </Keywords> <Keywords name="Folders in code1, middle">ELSE ELSEIF CASE DEFAULT</Keywords> <Keywords name="Folders in code1, close">ENDIF ENDFOR ENDTRAP ENDWHILE ENDTEST ENDPROC ENDMODULE ENDFUNC ENDRECORD</Keywords> <Keywords name="Folders in code2, open"></Keywords> <Keywords name="Folders in code2, middle"></Keywords> <Keywords name="Folders in code2, close"></Keywords> <Keywords name="Folders in comment, open">regin</Keywords> <Keywords name="Folders in comment, middle"></Keywords> <Keywords name="Folders in comment, close">endregin</Keywords> <Keywords name="Keywords1">BACKWARD CONST FROM INOUT NOSTEPIN NOVIEW PERS RAISE READONLY RETRY STEP SYSMODULE IF DO TO TRYNEXT VAR VIEWONLY WITH</Keywords> <Keywords name="Keywords2">AccSet ActUnit Add CallByVar Clear ClkReset ClkStart ClkStop Close ConfJ ConfL CONNECT CorrClear CorrCon CorrDiscon CorrWrite DeactUnit Decr EoffsOff EOffsOn EoffsSet ERRNO ErrWrite GripLoad IDelete Idisable IEnable Incr IndAMove IndCMove IndDMove IndReset IndRMove InvertDO IODisable IOEnable IsignalDI ISignalDO Isleep ITimer IVarValue IWatch Load MoveAbsJ MoveC MoveJ MoveL Open PathResol PdispOff PDispOn PDispSet PulseDO Reset RestoPath Rewind SearchC SearchL Set SetAO SetDO SetGO SingArea SoftAct SoftDeact StartMove StopMove StorePath TPErase TPReadFK TPReadNum TPShow TPWrite TriggC TriggEquip TriggInt TriggIO TriggJ TriggL TuneReset TuneServo UnLoad VelSet WaitDI WaitDO WaitTime WaitUntil WriteBin WriteStrBin WZBoxDef WZCylDef WZDisable WZDOSet WZEnable WZFree WZLimSup WZSphDef</Keywords> <Keywords name="Keywords3">bool clock confdata corrdescr dionum errnum extjoint intnum iodev jointtarget loaddata local mecunit motsetdata num o_jointtarget o_robtarget orient pos pose progdisp robjoint robtarget shapedata signalai signalao signaldi signaldo signalgi signalgo speeddata string symnum tooldata tpnum triggdata tunetype wobjdata wzstationary wztemporary zonedata seamdata weavedata welddata</Keywords> <Keywords name="Keywords4">Abs ACos AOutput ArgName ASin ATan ATan2 ByteToStr CDate CjointT ClkRead CorrRead Cos CPos CRobT CTime CTool CWObj DefDFrame DefFrame Dim DOutput EulerZYX Exp GetTime Goutput IndInpos IndSpeed IsPers IsVar MirPos NumToStr Offs OpMode OrientZYX ORobT PoseInv PoseMult PoseVect Pow Present ReadBin ReadMotor ReadNum ReadStr RelTool Round RunMode Sin Sqrt StrFind StrLen StrMap StrMatch StrMemb StrOrder StrPart StrToByte StrToVal Tan TestDI Trunc ValToStr</Keywords> <Keywords name="Keywords5">AbsPosVergleich CheckHomePos CheckParity EndSync FahreZuPos High Low Meldung mv PosVergleich ProgInfo RobSync SetParity SMoveJ SMoveL SyncEvent WaitBreakDI WaitMsgDI WaitTPBreakDI</Keywords> <Keywords name="Keywords6">TRUE FALSE</Keywords> <Keywords name="Keywords7">ERROR GOTO RETURN Stop Break EXIT ExitCycle</Keywords> <Keywords name="Keywords8">ArcC ArcL ArcLStart ArcLEnd ArcCStart ArcCEnd</Keywords> <Keywords name="Delimiters">00" 01 02" 03( 04 05) 06{ 07 08} 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords> </KeywordLists> <Styles> <WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" nesting="0" /> <WordsStyle name="COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" nesting="0" /> <WordsStyle name="LINE COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="Courier New" fontStyle="2" nesting="0" /> <WordsStyle name="NUMBERS" fgColor="800080" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS1" fgColor="0000FF" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS2" fgColor="400080" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" nesting="0" /> <WordsStyle name="KEYWORDS3" fgColor="FF00FF" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS4" fgColor="000080" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS5" fgColor="0000A0" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS6" fgColor="0000A0" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" /> <WordsStyle name="KEYWORDS7" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" /> <WordsStyle name="KEYWORDS8" fgColor="0000A0" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" /> <WordsStyle name="OPERATORS" fgColor="006000" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN CODE1" fgColor="0000FF" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN COMMENT" fgColor="408080" bgColor="FFFF80" fontName="" fontStyle="3" nesting="0" /> <WordsStyle name="DELIMITERS1" fgColor="0080C0" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS2" fgColor="004000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="17038336" /> <WordsStyle name="DELIMITERS3" fgColor="FF00FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" /> </Styles> </UserLang> </NotepadPlus>
图:在 Notepad++ 中自定义语言
语法高亮效果:
添加了 regin/endregin 注释折叠
另外,追加了几条 Arc 命令。