Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Hitachi H-8300h specific syntax for GNU Assembler |
| 3 | " Maintainer: Kevin Dahlhausen <kdahlhaus@yahoo.com> |
| 4 | " Last Change: 2002 Sep 19 |
| 5 | |
| 6 | " For version 5.x: Clear all syntax items |
| 7 | " For version 6.x: Quit when a syntax file was already loaded |
| 8 | if version < 600 |
| 9 | syntax clear |
| 10 | elseif exists("b:current_syntax") |
| 11 | finish |
| 12 | endif |
| 13 | |
| 14 | syn case ignore |
| 15 | |
| 16 | syn match asmDirective "\.h8300[h]*" |
| 17 | |
| 18 | "h8300[h] registers |
| 19 | syn match asmReg "e\=r[0-7][lh]\=" |
| 20 | |
| 21 | "h8300[h] opcodes - order is important! |
| 22 | syn match asmOpcode "add\.[lbw]" |
| 23 | syn match asmOpcode "add[sx :]" |
| 24 | syn match asmOpcode "and\.[lbw]" |
| 25 | syn match asmOpcode "bl[deots]" |
| 26 | syn match asmOpcode "cmp\.[lbw]" |
| 27 | syn match asmOpcode "dec\.[lbw]" |
| 28 | syn match asmOpcode "divx[us].[bw]" |
| 29 | syn match asmOpcode "ext[su]\.[lw]" |
| 30 | syn match asmOpcode "inc\.[lw]" |
| 31 | syn match asmOpcode "mov\.[lbw]" |
| 32 | syn match asmOpcode "mulx[su]\.[bw]" |
| 33 | syn match asmOpcode "neg\.[lbw]" |
| 34 | syn match asmOpcode "not\.[lbw]" |
| 35 | syn match asmOpcode "or\.[lbw]" |
| 36 | syn match asmOpcode "pop\.[wl]" |
| 37 | syn match asmOpcode "push\.[wl]" |
| 38 | syn match asmOpcode "rotx\=[lr]\.[lbw]" |
| 39 | syn match asmOpcode "sha[lr]\.[lbw]" |
| 40 | syn match asmOpcode "shl[lr]\.[lbw]" |
| 41 | syn match asmOpcode "sub\.[lbw]" |
| 42 | syn match asmOpcode "xor\.[lbw]" |
| 43 | syn keyword asmOpcode "andc" "band" "bcc" "bclr" "bcs" "beq" "bf" "bge" "bgt" |
| 44 | syn keyword asmOpcode "bhi" "bhs" "biand" "bild" "bior" "bist" "bixor" "bmi" |
| 45 | syn keyword asmOpcode "bne" "bnot" "bnp" "bor" "bpl" "bpt" "bra" "brn" "bset" |
| 46 | syn keyword asmOpcode "bsr" "btst" "bst" "bt" "bvc" "bvs" "bxor" "cmp" "daa" |
| 47 | syn keyword asmOpcode "das" "eepmov" "eepmovw" "inc" "jmp" "jsr" "ldc" "movfpe" |
| 48 | syn keyword asmOpcode "movtpe" "mov" "nop" "orc" "rte" "rts" "sleep" "stc" |
| 49 | syn keyword asmOpcode "sub" "trapa" "xorc" |
| 50 | |
| 51 | syn case match |
| 52 | |
| 53 | |
| 54 | " Read the general asm syntax |
| 55 | if version < 600 |
| 56 | source <sfile>:p:h/asm.vim |
| 57 | else |
| 58 | runtime! syntax/asm.vim |
| 59 | endif |
| 60 | |
| 61 | |
| 62 | " Define the default highlighting. |
| 63 | " For version 5.7 and earlier: only when not done already |
| 64 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 65 | if version >= 508 || !exists("did_hitachi_syntax_inits") |
| 66 | if version < 508 |
| 67 | let did_hitachi_syntax_inits = 1 |
| 68 | command -nargs=+ HiLink hi link <args> |
| 69 | else |
| 70 | command -nargs=+ HiLink hi def link <args> |
| 71 | endif |
| 72 | |
| 73 | HiLink asmOpcode Statement |
| 74 | HiLink asmRegister Identifier |
| 75 | |
| 76 | " My default-color overrides: |
| 77 | "hi asmOpcode ctermfg=yellow |
| 78 | "hi asmReg ctermfg=lightmagenta |
| 79 | |
| 80 | delcommand HiLink |
| 81 | endif |
| 82 | |
| 83 | let b:current_syntax = "asmh8300" |
| 84 | |
| 85 | " vim: ts=8 |