Wu, Zhenyu | 4f73c07 | 2025-01-08 20:20:06 +0100 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: TI linear assembly language |
| 3 | " Document: https://downloads.ti.com/docs/esd/SPRUI03B/#SPRUI03B_HTML/assembler-description.html |
| 4 | " Maintainer: Wu, Zhenyu <wuzhenyu@ustc.edu> |
| 5 | " Last Change: 2025 Jan 08 |
| 6 | |
| 7 | if exists("b:current_syntax") |
| 8 | finish |
| 9 | endif |
| 10 | |
| 11 | syn case ignore |
| 12 | |
| 13 | " storage types |
| 14 | syn match tiasmType "\.bits" |
| 15 | syn match tiasmType "\.byte" |
| 16 | syn match tiasmType "\.char" |
| 17 | syn match tiasmType "\.cstring" |
| 18 | syn match tiasmType "\.double" |
| 19 | syn match tiasmType "\.field" |
| 20 | syn match tiasmType "\.float" |
| 21 | syn match tiasmType "\.half" |
| 22 | syn match tiasmType "\.int" |
| 23 | syn match tiasmType "\.long" |
| 24 | syn match tiasmType "\.short" |
| 25 | syn match tiasmType "\.string" |
| 26 | syn match tiasmType "\.ubyte" |
| 27 | syn match tiasmType "\.uchar" |
| 28 | syn match tiasmType "\.uhalf" |
| 29 | syn match tiasmType "\.uint" |
| 30 | syn match tiasmType "\.ulong" |
| 31 | syn match tiasmType "\.ushort" |
| 32 | syn match tiasmType "\.uword" |
| 33 | syn match tiasmType "\.word" |
| 34 | |
| 35 | syn match tiasmIdentifier "[a-z_][a-z0-9_]*" |
| 36 | |
| 37 | syn match tiasmDecimal "\<[1-9]\d*\>" display |
| 38 | syn match tiasmOctal "\<0[0-7][0-7]\+\>\|\<[0-7]\+[oO]\>" display |
| 39 | syn match tiasmHexadecimal "\<0[xX][0-9a-fA-F]\+\>\|\<[0-9][0-9a-fA-F]*[hH]\>" display |
| 40 | syn match tiasmBinary "\<0[bB][0-1]\+\>\|\<[01]\+[bB]\>" display |
| 41 | |
| 42 | syn match tiasmFloat "\<\d\+\.\d*\%(e[+-]\=\d\+\)\=\>" display |
| 43 | syn match tiasmFloat "\<\d\%(e[+-]\=\d\+\)\>" display |
| 44 | |
| 45 | syn match tiasmCharacter "'.'\|''\|'[^']'" |
| 46 | |
| 47 | syn region tiasmString start="\"" end="\"" skip="\"\"" |
| 48 | |
| 49 | syn match tiasmFunction "\$[a-zA-Z_][a-zA-Z_0-9]*\ze(" |
| 50 | |
| 51 | syn keyword tiasmTodo contained TODO FIXME XXX NOTE |
| 52 | syn region tiasmComment start=";" end="$" keepend contains=tiasmTodo,@Spell |
| 53 | syn match tiasmComment "^[*!].*" contains=tiasmTodo,@Spell |
| 54 | syn match tiasmLabel "^[^ *!;][^ :]*" |
| 55 | |
| 56 | syn match tiasmInclude "\.include" |
| 57 | syn match tiasmCond "\.if" |
| 58 | syn match tiasmCond "\.else" |
| 59 | syn match tiasmCond "\.endif" |
| 60 | syn match tiasmMacro "\.macro" |
| 61 | syn match tiasmMacro "\.endm" |
| 62 | |
| 63 | syn match tiasmDirective "\.[A-Za-z][0-9A-Za-z-_]*" |
| 64 | |
| 65 | syn case match |
| 66 | |
| 67 | hi def link tiasmLabel Label |
| 68 | hi def link tiasmComment Comment |
| 69 | hi def link tiasmTodo Todo |
| 70 | hi def link tiasmDirective Statement |
| 71 | |
| 72 | hi def link tiasmInclude Include |
| 73 | hi def link tiasmCond PreCondit |
| 74 | hi def link tiasmMacro Macro |
| 75 | |
| 76 | if exists('g:tiasm_legacy_syntax_groups') |
| 77 | hi def link hexNumber Number |
| 78 | hi def link decNumber Number |
| 79 | hi def link octNumber Number |
| 80 | hi def link binNumber Number |
| 81 | hi def link tiasmHexadecimal hexNumber |
| 82 | hi def link tiasmDecimal decNumber |
| 83 | hi def link tiasmOctal octNumber |
| 84 | hi def link tiasmBinary binNumber |
| 85 | else |
| 86 | hi def link tiasmHexadecimal Number |
| 87 | hi def link tiasmDecimal Number |
| 88 | hi def link tiasmOctal Number |
| 89 | hi def link tiasmBinary Number |
| 90 | endif |
| 91 | hi def link tiasmFloat Float |
| 92 | |
| 93 | hi def link tiasmString String |
| 94 | hi def link tiasmStringEscape Special |
| 95 | hi def link tiasmCharacter Character |
| 96 | hi def link tiasmCharacterEscape Special |
| 97 | |
| 98 | hi def link tiasmIdentifier Identifier |
| 99 | hi def link tiasmType Type |
| 100 | hi def link tiasmFunction Function |
| 101 | |
Wu, Zhenyu | df4a7d7 | 2025-01-09 22:09:16 +0100 | [diff] [blame] | 102 | let b:current_syntax = "tiasm" |