原文地址:http://knol.google.com/k/at-t-asm-syntax-highlight-in-source-insight
步骤:
1.添加新的语言:
a) 打开 "Options"->"Preference"->"Languages"
b) 点"add",输入语言名称"at&t asm"
2.设置关键字和属性
a).新建个文本文件,保存以下内容
- !, Delimiter
- #, Delimiter
- %, Delimiter
- &, Delimiter
- ', Delimiter
- (, Delimiter
- ), Delimiter
- *, Delimiter
- +, Delimiter
- ",", Delimiter
- -, Delimiter
- .align, Keyword
- .ascii, Keyword
- .BREAK, Keyword
- .bss, Keyword
- .byte, Keyword
- .CODE, Keyword
- .CONST, Keyword
- .CONTINUE, Keyword
- .CREF, Keyword
- .data, Keyword
- .DATA?, Keyword
- .define, Keyword
- .ELSE, Keyword
- .ELSEIF, Keyword
- .ENDIF, Keyword
- .ENDW, Keyword
- .ERR, Keyword
- .ERRB, Keyword
- .ERRDEF, Keyword
- .ERRDEFI, Keyword
- .ERRE, Keyword
- .ERRIDNI, Keyword
- .ERRNB, Keyword
- .ERRNDEF, Keyword
- .ERRNZ, Keyword
- .fill, Keyword
- .globl, Keyword
- .IF, Keyword
- .long, Keyword
- .MODEL, Keyword
- .NOCREF, Keyword
- .quad, Keyword
- .RADIX, Keyword
- .REPEAT, Keyword
- .STACK, Keyword
- .text, Keyword
- .UNTIL, Keyword
- .UNTILCXZ, Keyword
- .WHILE, Keyword
- .word, Keyword
- /, Delimiter
- :, Delimiter
- ;, Delimiter
- <, Delimiter
- =, Delimiter
- >, Delimiter
- ?, Delimiter
- @CATSTR, Keyword
- @INSTR, Keyword
- @SIZESTR, Keyword
- @SUBSTR, Keyword
- AAA, Keyword
- AAD, Keyword
- AAM, Keyword
- AAS, Keyword
- ADC, Keyword
- ADD, Keyword
- ADDL, Keyword
- ADDR, Keyword
- ADDW, Keyword
- AH, Keyword
- AL, Keyword
- ALIGN, Keyword
- AND, Keyword
- ANDB, Keyword
- ANDL, Keyword
- ANDW, Keyword
- ARPL, Keyword
- ASSUME, Keyword
- AX, Keyword
- BH, Keyword
- BL, Keyword
- BOUND, Keyword
- BP, Keyword
- BSF, Keyword
- BSFL, Keyword
- BSR, Keyword
- BSWAP, Keyword
- BT, Keyword
- BTC, Keyword
- BTR, Keyword
- BTRL, Keyword
- BTS, Keyword
- BX, Keyword
- BYTE, Keyword
- CALL, Keyword
- CASEMAP, Keyword
- CATSTR, Keyword
- CBW, Keyword
- CDQ, Keyword
- CH, Keyword
- CL, Keyword
- CLC, Keyword
- CLD, Keyword
- CLI, Keyword
- CLTS, Keyword
- CMC, Keyword
- CMP, Keyword
- CMPL, Keyword
- CMPS, Keyword
- CMPW, Keyword
- CMPXCHG, Keyword
- COMM, Keyword
- CS, Keyword
- CWD, Keyword
- CWDE, Keyword
- CX, Keyword
- DAA, Keyword
- DAS, Keyword
- DB, Keyword
- DD, Keyword
- DEC, Keyword
- DF, Keyword
- DH, Keyword
- DI, Keyword
- DIV, Keyword
- DL, Keyword
- DQ, Keyword
- DS, Keyword
- DT, Keyword
- DW, Keyword
- DWORD, Keyword
- DX, Keyword
- EAX, Keyword
- EBP, Keyword
- EBX, Keyword
- ECHO, Keyword
- ECX, Keyword
- EDI, Keyword
- EDX, Keyword
- EIP, Keyword
- END, Keyword
- ENDM, Keyword
- ENDS, Keyword
- ENTER, Keyword
- EPILOGUE, Keyword
- EQU, Keyword
- ES, Keyword
- ESC, Keyword
- ESI, Keyword
- ESP, Keyword
- EXITM, Keyword
- EXTERN, Keyword
- EXTERNDEF, Keyword
- FOR, Keyword
- FORC, Keyword
- FS, Keyword
- FWAIT, Keyword
- FWORD, Keyword
- GOTO, Keyword
- GS, Keyword
- HLT, Keyword
- IDIV, Keyword
- IFB, Keyword
- IFDEF, Keyword
- IFNB, Keyword
- IFNDEF, Keyword
- IMUL, Keyword
- IN, Keyword
- INB, Keyword
- INC, Keyword
- INCL, Keyword
- INCLUDE, Keyword
- INCLUDELIB, Keyword
- INCW, Keyword
- INS, Keyword
- INSTR, Keyword
- INT, Keyword
- INTO, Keyword
- INVD, Keyword
- INVLPG, Keyword
- INVOKE, Keyword
- INW, Keyword
- IP, Keyword
- IRET, Control
- IRETD, Control
- JA, Keyword
- JAE, Keyword
- JB, Keyword
- JBE, Keyword
- JC, Keyword
- JCXZ, Control
- JE, Keyword
- JECXZ, Control
- JG, Keyword
- JGE, Keyword
- JL, Keyword
- JLE, Keyword
- JMP, Control
- JMPI, Control
- JNA, Control
- JNAE, Control
- JNB, Control
- JNBE, Control
- JNC, Control
- JNE, Control
- JNG, Control
- JNGE, Control
- JNL, Control
- JNLE, Control
- JNO, Control
- JNP, Control
- JNS, Control
- JNZ, Control
- JO, Control
- JP, Control
- JPE, Keyword
- JPO, Keyword
- JS, Keyword
- JZ, Keyword
- LAHF, Keyword
- LANGUAGE, Keyword
- LAR, Keyword
- LDS, Keyword
- LEA, Control
- LEAVE, Control
- LES, Keyword
- LFS, Keyword
- LGDT, Keyword
- LGS, Keyword
- LIDT, Keyword
- LJMP, Keyword
- LLDT, Keyword
- LMSW, Keyword
- LOCAL, Keyword
- LOCK, Keyword
- LODS, Keyword
- LOOP, Keyword
- LOOPE, Keyword
- LOOPNE, Keyword
- LOOPNZ, Keyword
- LOOPZ, Keyword
- LSL, Keyword
- LSS, Keyword
- LTR, Keyword
- MACRO, Keyword
- MOV, Keyword
- MOVB, Keyword
- MOVL, Keyword
- MOVS, Keyword
- MOVSX, Keyword
- MOVW, Keyword
- MOVZX, Keyword
- MUL, Keyword
- NEG, Keyword
- NOP, Keyword
- NOSCOPED, Keyword
- NOT, Keyword
- NOTL, Keyword
- OFFSET, Keyword
- OPTION, Keyword
- OR, Keyword
- ORG, Keyword
- OUT, Keyword
- OUTB, Keyword
- OUTS, Keyword
- OUTW, Keyword
- POP, Keyword
- POPA, Keyword
- POPAD, Keyword
- POPCONTEXT, Keyword
- POPF, Keyword
- POPFD, Keyword
- POPFL, Keyword
- POPFW, Keyword
- POPL, Keyword
- POPW, Keyword
- PROC, Keyword
- PROTO, Keyword
- PTR, Keyword
- PUBLIC, Keyword
- PURGE, Keyword
- PUSH, Keyword
- PUSHA, Keyword
- PUSHAD, Keyword
- PUSHCONTEXT, Keyword
- PUSHF, Keyword
- PUSHFD, Keyword
- PUSHFL, Keyword
- PUSHL, Keyword
- QWORD, Keyword
- RCL, Keyword
- RCR, Keyword
- REAL10, Keyword
- REAL4, Keyword
- REAL8, Keyword
- RECORD, Keyword
- REP, Keyword
- REPE, Keyword
- REPEAT, Keyword
- REPNE, Keyword
- REPNZ, Keyword
- REPT, Keyword
- REPZ, Keyword
- RET, Keyword
- RETF, Keyword
- ROL, Keyword
- ROR, Keyword
- RORL, Keyword
- SAHF, Keyword
- SAL, Keyword
- SAR, Keyword
- SBB, Keyword
- SBYTE, Keyword
- SCAS, Keyword
- SCOPED, Keyword
- SDWOR, Keyword
- SETAE, Keyword
- SETB, Keyword
- SETBE, Keyword
- SETC, Keyword
- SETE, Keyword
- SETG, Keyword
- SETGE, Keyword
- SETL, Keyword
- SETLE, Keyword
- SETNA, Keyword
- SETNAE, Keyword
- SETNB, Keyword
- SETNC, Keyword
- SETNE, Keyword
- SETNG, Keyword
- SETNGE, Keyword
- SETNL, Keyword
- SETNLE, Keyword
- SETNO, Keyword
- SETNP, Keyword
- SETNS, Keyword
- SETNZ, Keyword
- SETO, Keyword
- SETP, Keyword
- SETPE, Keyword
- SETPO, Keyword
- SETS, Keyword
- SETZ, Keyword
- SGDT, Keyword
- SHL, Keyword
- SHLD, Keyword
- SHR, Keyword
- SHRD, Keyword
- SI, Keyword
- SIDT, Keyword
- SIZEOF, Keyword
- SIZESTR, Keyword
- SLDT, Keyword
- SMSW, Keyword
- SP, Keyword
- SS, Keyword
- STC, Keyword
- STD, Keyword
- STI, Keyword
- STOS, Keyword
- STR, Keyword
- STRUC, Keyword
- STRUCT, Keyword
- SUB, Keyword
- SUBSTR, Keyword
- SWORD, Keyword
- TBYTE, Keyword
- TEST, Keyword
- TESTL, Keyword
- TEXTEQU, Keyword
- TYPEDEF, Keyword
- UNION, Keyword
- USES, Keyword
- VERR, Keyword
- VERW, Keyword
- WAIT, Keyword
- WBINVD, Keyword
- WORD, Keyword
- XCHG, Keyword
- XCHGL, Keyword
- XLAT, Keyword
- XLATB, Keyword
- XOR, Keyword
- XORL, Keyword
- [, Delimiter
- |, Delimiter
- ], Delimiter
- ~, Delimiter
保存完后,将关键字导入:
点"Options"->"Preference"->"keywords... " ,然后按照以下图示导入:
b.设置"Comments and Ranges"
打开 "Options"->"Languages"->"at&t asm Properties"
c)设置"Custom Parsing"
\([A-Za-z0-9_]+\)=.
^\([_A-Za-z][A-Za-z0-9_]+\):*
3.设置symbol lookups
4.添加文件类型
点击"Options"->"Document Options"
点击"add type..."
按照上图设置即可
最后,将工程重新解析下,就可以看到效果了