Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: NASM - The Netwide Assembler (v0.98) |
Bram Moolenaar | 690afe1 | 2017-01-28 18:34:47 +0100 | [diff] [blame] | 3 | " Maintainer: Andrii Sokolov <andriy145@gmail.com> |
Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 4 | " Original Author: Manuel M.H. Stol <Manuel.Stol@allieddata.nl> |
| 5 | " Former Maintainer: Manuel M.H. Stol <Manuel.Stol@allieddata.nl> |
Bram Moolenaar | b7398fe | 2023-05-14 18:50:25 +0100 | [diff] [blame] | 6 | " Contributors: |
| 7 | " Leonard König <leonard.r.koenig@gmail.com> (C string highlighting), |
| 8 | " Peter Stanhope <dev.rptr@gmail.com> (Add missing 64-bit mode registers) |
| 9 | " Frédéric Hamel <rederic.hamel123@gmail.com> (F16c support, partial AVX |
| 10 | " support, other) |
Andrii Sokolov | 733bbcd | 2023-09-09 12:00:09 +0200 | [diff] [blame] | 11 | " Last Change: 2023 Sep 7 |
Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 12 | " NASM Home: http://www.nasm.us/ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 13 | |
| 14 | |
| 15 | |
| 16 | " Setup Syntax: |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 17 | " quit when a syntax file was already loaded |
| 18 | if exists("b:current_syntax") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 19 | finish |
| 20 | endif |
| 21 | " Assembler syntax is case insensetive |
| 22 | syn case ignore |
| 23 | |
| 24 | |
| 25 | |
| 26 | " Vim search and movement commands on identifers |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 27 | " Comments at start of a line inside which to skip search for indentifiers |
| 28 | setlocal comments=:; |
| 29 | " Identifier Keyword characters (defines \k) |
| 30 | setlocal iskeyword=@,48-57,#,$,.,?,@-@,_,~ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 31 | |
| 32 | |
| 33 | " Comments: |
| 34 | syn region nasmComment start=";" keepend end="$" contains=@nasmGrpInComments |
| 35 | syn region nasmSpecialComment start=";\*\*\*" keepend end="$" |
| 36 | syn keyword nasmInCommentTodo contained TODO FIXME XXX[XXXXX] |
| 37 | syn cluster nasmGrpInComments contains=nasmInCommentTodo |
| 38 | syn cluster nasmGrpComments contains=@nasmGrpInComments,nasmComment,nasmSpecialComment |
| 39 | |
| 40 | |
| 41 | |
| 42 | " Label Identifiers: |
| 43 | " in NASM: 'Everything is a Label' |
| 44 | " Definition Label = label defined by %[i]define or %[i]assign |
| 45 | " Identifier Label = label defined as first non-keyword on a line or %[i]macro |
Bram Moolenaar | 5dc6252 | 2012-02-13 00:05:22 +0100 | [diff] [blame] | 46 | syn match nasmLabelError "$\=\(\d\+\K\|[#.@]\|\$\$\k\)\k*\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 47 | syn match nasmLabel "\<\(\h\|[?@]\)\k*\>" |
| 48 | syn match nasmLabel "[\$\~]\(\h\|[?@]\)\k*\>"lc=1 |
| 49 | " Labels starting with one or two '.' are special |
| 50 | syn match nasmLocalLabel "\<\.\(\w\|[#$?@~]\)\k*\>" |
| 51 | syn match nasmLocalLabel "\<\$\.\(\w\|[#$?@~]\)\k*\>"ms=s+1 |
| 52 | if !exists("nasm_no_warn") |
Bram Moolenaar | 5dc6252 | 2012-02-13 00:05:22 +0100 | [diff] [blame] | 53 | syn match nasmLabelWarn "\<\~\=\$\=[_.][_.\~]*\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 54 | endif |
| 55 | if exists("nasm_loose_syntax") |
| 56 | syn match nasmSpecialLabel "\<\.\.@\k\+\>" |
| 57 | syn match nasmSpecialLabel "\<\$\.\.@\k\+\>"ms=s+1 |
| 58 | if !exists("nasm_no_warn") |
| 59 | syn match nasmLabelWarn "\<\$\=\.\.@\(\d\|[#$\.~]\)\k*\>" |
| 60 | endif |
| 61 | " disallow use of nasm internal label format |
| 62 | syn match nasmLabelError "\<\$\=\.\.@\d\+\.\k*\>" |
| 63 | else |
| 64 | syn match nasmSpecialLabel "\<\.\.@\(\h\|[?@]\)\k*\>" |
| 65 | syn match nasmSpecialLabel "\<\$\.\.@\(\h\|[?@]\)\k*\>"ms=s+1 |
| 66 | endif |
| 67 | " Labels can be dereferenced with '$' to destinguish them from reserved words |
| 68 | syn match nasmLabelError "\<\$\K\k*\s*:" |
| 69 | syn match nasmLabelError "^\s*\$\K\k*\>" |
| 70 | syn match nasmLabelError "\<\~\s*\(\k*\s*:\|\$\=\.\k*\)" |
| 71 | |
| 72 | |
| 73 | |
| 74 | " Constants: |
Bram Moolenaar | 690afe1 | 2017-01-28 18:34:47 +0100 | [diff] [blame] | 75 | syn match nasmStringError +["'`]+ |
| 76 | " NASM is case sensitive here: eg. u-prefix allows for 4-digit, U-prefix for |
| 77 | " 8-digit Unicode characters |
| 78 | syn case match |
| 79 | " one-char escape-sequences |
| 80 | syn match nasmCStringEscape display contained "\\[’"‘\\\?abtnvfre]" |
| 81 | " hex and octal numbers |
| 82 | syn match nasmCStringEscape display contained "\\\(x\x\{2}\|\o\{1,3}\)" |
| 83 | " Unicode characters |
| 84 | syn match nasmCStringEscape display contained "\\\(u\x\{4}\|U\x\{8}\)" |
| 85 | " ISO C99 format strings (copied from cFormat in runtime/syntax/c.vim) |
| 86 | syn match nasmCStringFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained |
| 87 | syn match nasmCStringFormat display "%%" contained |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 88 | syn match nasmString +\("[^"]\{-}"\|'[^']\{-}'\)+ |
Bram Moolenaar | 690afe1 | 2017-01-28 18:34:47 +0100 | [diff] [blame] | 89 | " Highlight C escape- and format-sequences within ``-strings |
| 90 | syn match nasmCString +\(`[^`]\{-}`\)+ contains=nasmCStringEscape,nasmCStringFormat extend |
| 91 | syn case ignore |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 92 | syn match nasmBinNumber "\<[0-1]\+b\>" |
| 93 | syn match nasmBinNumber "\<\~[0-1]\+b\>"lc=1 |
| 94 | syn match nasmOctNumber "\<\o\+q\>" |
| 95 | syn match nasmOctNumber "\<\~\o\+q\>"lc=1 |
| 96 | syn match nasmDecNumber "\<\d\+\>" |
| 97 | syn match nasmDecNumber "\<\~\d\+\>"lc=1 |
| 98 | syn match nasmHexNumber "\<\(\d\x*h\|0x\x\+\|\$\d\x*\)\>" |
| 99 | syn match nasmHexNumber "\<\~\(\d\x*h\|0x\x\+\|\$\d\x*\)\>"lc=1 |
| 100 | syn match nasmFltNumber "\<\d\+\.\d*\(e[+-]\=\d\+\)\=\>" |
| 101 | syn keyword nasmFltNumber Inf Infinity Indefinite NaN SNaN QNaN |
| 102 | syn match nasmNumberError "\<\~\s*\d\+\.\d*\(e[+-]\=\d\+\)\=\>" |
| 103 | |
| 104 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 105 | " Netwide Assembler Storage Directives: |
| 106 | " Storage types |
| 107 | syn keyword nasmTypeError DF EXTRN FWORD RESF TBYTE |
| 108 | syn keyword nasmType FAR NEAR SHORT |
| 109 | syn keyword nasmType BYTE WORD DWORD QWORD DQWORD HWORD DHWORD TWORD |
| 110 | syn keyword nasmType CDECL FASTCALL NONE PASCAL STDCALL |
| 111 | syn keyword nasmStorage DB DW DD DQ DDQ DT |
| 112 | syn keyword nasmStorage RESB RESW RESD RESQ RESDQ REST |
| 113 | syn keyword nasmStorage EXTERN GLOBAL COMMON |
| 114 | " Structured storage types |
| 115 | syn match nasmTypeError "\<\(AT\|I\=\(END\)\=\(STRUCT\=\|UNION\)\|I\=END\)\>" |
| 116 | syn match nasmStructureLabel contained "\<\(AT\|I\=\(END\)\=\(STRUCT\=\|UNION\)\|I\=END\)\>" |
| 117 | " structures cannot be nested (yet) -> use: 'keepend' and 're=' |
| 118 | syn cluster nasmGrpCntnStruc contains=ALLBUT,@nasmGrpInComments,nasmMacroDef,@nasmGrpInMacros,@nasmGrpInPreCondits,nasmStructureDef,@nasmGrpInStrucs |
| 119 | syn region nasmStructureDef transparent matchgroup=nasmStructure keepend start="^\s*STRUCT\>"hs=e-5 end="^\s*ENDSTRUCT\>"re=e-9 contains=@nasmGrpCntnStruc |
| 120 | syn region nasmStructureDef transparent matchgroup=nasmStructure keepend start="^\s*STRUC\>"hs=e-4 end="^\s*ENDSTRUC\>"re=e-8 contains=@nasmGrpCntnStruc |
| 121 | syn region nasmStructureDef transparent matchgroup=nasmStructure keepend start="\<ISTRUCT\=\>" end="\<IEND\(STRUCT\=\)\=\>" contains=@nasmGrpCntnStruc,nasmInStructure |
| 122 | " union types are not part of nasm (yet) |
| 123 | "syn region nasmStructureDef transparent matchgroup=nasmStructure keepend start="^\s*UNION\>"hs=e-4 end="^\s*ENDUNION\>"re=e-8 contains=@nasmGrpCntnStruc |
| 124 | "syn region nasmStructureDef transparent matchgroup=nasmStructure keepend start="\<IUNION\>" end="\<IEND\(UNION\)\=\>" contains=@nasmGrpCntnStruc,nasmInStructure |
| 125 | syn match nasmInStructure contained "^\s*AT\>"hs=e-1 |
| 126 | syn cluster nasmGrpInStrucs contains=nasmStructure,nasmInStructure,nasmStructureLabel |
| 127 | |
| 128 | |
| 129 | |
| 130 | " PreProcessor Instructions: |
| 131 | " NAsm PreProcs start with %, but % is not a character |
| 132 | syn match nasmPreProcError "%{\=\(%\=\k\+\|%%\+\k*\|[+-]\=\d\+\)}\=" |
| 133 | if exists("nasm_loose_syntax") |
| 134 | syn cluster nasmGrpNxtCtx contains=nasmStructureLabel,nasmLabel,nasmLocalLabel,nasmSpecialLabel,nasmLabelError,nasmPreProcError |
| 135 | else |
| 136 | syn cluster nasmGrpNxtCtx contains=nasmStructureLabel,nasmLabel,nasmLabelError,nasmPreProcError |
| 137 | endif |
| 138 | |
| 139 | " Multi-line macro |
| 140 | syn cluster nasmGrpCntnMacro contains=ALLBUT,@nasmGrpInComments,nasmStructureDef,@nasmGrpInStrucs,nasmMacroDef,@nasmGrpPreCondits,nasmMemReference,nasmInMacPreCondit,nasmInMacStrucDef |
| 141 | syn region nasmMacroDef matchgroup=nasmMacro keepend start="^\s*%macro\>"hs=e-5 start="^\s*%imacro\>"hs=e-6 end="^\s*%endmacro\>"re=e-9 contains=@nasmGrpCntnMacro,nasmInMacStrucDef |
| 142 | if exists("nasm_loose_syntax") |
| 143 | syn match nasmInMacLabel contained "%\(%\k\+\>\|{%\k\+}\)" |
| 144 | syn match nasmInMacLabel contained "%\($\+\(\w\|[#\.?@~]\)\k*\>\|{$\+\(\w\|[#\.?@~]\)\k*}\)" |
| 145 | syn match nasmInMacPreProc contained "^\s*%\(push\|repl\)\>"hs=e-4 skipwhite nextgroup=nasmStructureLabel,nasmLabel,nasmInMacParam,nasmLocalLabel,nasmSpecialLabel,nasmLabelError,nasmPreProcError |
| 146 | if !exists("nasm_no_warn") |
| 147 | syn match nasmInMacLblWarn contained "%\(%[$\.]\k*\>\|{%[$\.]\k*}\)" |
| 148 | syn match nasmInMacLblWarn contained "%\($\+\(\d\|[#\.@~]\)\k*\|{\$\+\(\d\|[#\.@~]\)\k*}\)" |
| 149 | hi link nasmInMacCatLabel nasmInMacLblWarn |
| 150 | else |
| 151 | hi link nasmInMacCatLabel nasmInMacLabel |
| 152 | endif |
| 153 | else |
| 154 | syn match nasmInMacLabel contained "%\(%\(\w\|[#?@~]\)\k*\>\|{%\(\w\|[#?@~]\)\k*}\)" |
| 155 | syn match nasmInMacLabel contained "%\($\+\(\h\|[?@]\)\k*\>\|{$\+\(\h\|[?@]\)\k*}\)" |
| 156 | hi link nasmInMacCatLabel nasmLabelError |
| 157 | endif |
| 158 | syn match nasmInMacCatLabel contained "\d\K\k*"lc=1 |
| 159 | syn match nasmInMacLabel contained "\d}\k\+"lc=2 |
| 160 | if !exists("nasm_no_warn") |
| 161 | syn match nasmInMacLblWarn contained "%\(\($\+\|%\)[_~][._~]*\>\|{\($\+\|%\)[_~][._~]*}\)" |
| 162 | endif |
| 163 | syn match nasmInMacPreProc contained "^\s*%pop\>"hs=e-3 |
| 164 | syn match nasmInMacPreProc contained "^\s*%\(push\|repl\)\>"hs=e-4 skipwhite nextgroup=@nasmGrpNxtCtx |
| 165 | " structures cannot be nested (yet) -> use: 'keepend' and 're=' |
| 166 | syn region nasmInMacStrucDef contained transparent matchgroup=nasmStructure keepend start="^\s*STRUCT\>"hs=e-5 end="^\s*ENDSTRUCT\>"re=e-9 contains=@nasmGrpCntnMacro |
| 167 | syn region nasmInMacStrucDef contained transparent matchgroup=nasmStructure keepend start="^\s*STRUC\>"hs=e-4 end="^\s*ENDSTRUC\>"re=e-8 contains=@nasmGrpCntnMacro |
| 168 | syn region nasmInMacStrucDef contained transparent matchgroup=nasmStructure keepend start="\<ISTRUCT\=\>" end="\<IEND\(STRUCT\=\)\=\>" contains=@nasmGrpCntnMacro,nasmInStructure |
| 169 | " union types are not part of nasm (yet) |
| 170 | "syn region nasmInMacStrucDef contained transparent matchgroup=nasmStructure keepend start="^\s*UNION\>"hs=e-4 end="^\s*ENDUNION\>"re=e-8 contains=@nasmGrpCntnMacro |
| 171 | "syn region nasmInMacStrucDef contained transparent matchgroup=nasmStructure keepend start="\<IUNION\>" end="\<IEND\(UNION\)\=\>" contains=@nasmGrpCntnMacro,nasmInStructure |
| 172 | syn region nasmInMacPreConDef contained transparent matchgroup=nasmInMacPreCondit start="^\s*%ifnidni\>"hs=e-7 start="^\s*%if\(idni\|n\(ctx\|def\|idn\|num\|str\)\)\>"hs=e-6 start="^\s*%if\(ctx\|def\|idn\|nid\|num\|str\)\>"hs=e-5 start="^\s*%ifid\>"hs=e-4 start="^\s*%if\>"hs=e-2 end="%endif\>" contains=@nasmGrpCntnMacro,nasmInMacPreCondit,nasmInPreCondit |
Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 173 | " Todo: allow STRUC/ISTRUC to be used inside preprocessor conditional block |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 174 | syn match nasmInMacPreCondit contained transparent "ctx\s"lc=3 skipwhite nextgroup=@nasmGrpNxtCtx |
| 175 | syn match nasmInMacPreCondit contained "^\s*%elifctx\>"hs=e-7 skipwhite nextgroup=@nasmGrpNxtCtx |
| 176 | syn match nasmInMacPreCondit contained "^\s*%elifnctx\>"hs=e-8 skipwhite nextgroup=@nasmGrpNxtCtx |
| 177 | syn match nasmInMacParamNum contained "\<\d\+\.list\>"me=e-5 |
| 178 | syn match nasmInMacParamNum contained "\<\d\+\.nolist\>"me=e-7 |
| 179 | syn match nasmInMacDirective contained "\.\(no\)\=list\>" |
| 180 | syn match nasmInMacMacro contained transparent "macro\s"lc=5 skipwhite nextgroup=nasmStructureLabel |
| 181 | syn match nasmInMacMacro contained "^\s*%rotate\>"hs=e-6 |
| 182 | syn match nasmInMacParam contained "%\([+-]\=\d\+\|{[+-]\=\d\+}\)" |
| 183 | " nasm conditional macro operands/arguments |
| 184 | " Todo: check feasebility; add too nasmGrpInMacros, etc. |
| 185 | "syn match nasmInMacCond contained "\<\(N\=\([ABGL]E\=\|[CEOSZ]\)\|P[EO]\=\)\>" |
| 186 | syn cluster nasmGrpInMacros contains=nasmMacro,nasmInMacMacro,nasmInMacParam,nasmInMacParamNum,nasmInMacDirective,nasmInMacLabel,nasmInMacLblWarn,nasmInMacMemRef,nasmInMacPreConDef,nasmInMacPreCondit,nasmInMacPreProc,nasmInMacStrucDef |
| 187 | |
| 188 | " Context pre-procs that are better used inside a macro |
| 189 | if exists("nasm_ctx_outside_macro") |
| 190 | syn region nasmPreConditDef transparent matchgroup=nasmCtxPreCondit start="^\s*%ifnctx\>"hs=e-6 start="^\s*%ifctx\>"hs=e-5 end="%endif\>" contains=@nasmGrpCntnPreCon |
| 191 | syn match nasmCtxPreProc "^\s*%pop\>"hs=e-3 |
| 192 | if exists("nasm_loose_syntax") |
Bram Moolenaar | 5dc6252 | 2012-02-13 00:05:22 +0100 | [diff] [blame] | 193 | syn match nasmCtxLocLabel "%$\+\(\w\|[#.?@~]\)\k*\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 194 | else |
| 195 | syn match nasmCtxLocLabel "%$\+\(\h\|[?@]\)\k*\>" |
| 196 | endif |
| 197 | syn match nasmCtxPreProc "^\s*%\(push\|repl\)\>"hs=e-4 skipwhite nextgroup=@nasmGrpNxtCtx |
| 198 | syn match nasmCtxPreCondit contained transparent "ctx\s"lc=3 skipwhite nextgroup=@nasmGrpNxtCtx |
| 199 | syn match nasmCtxPreCondit contained "^\s*%elifctx\>"hs=e-7 skipwhite nextgroup=@nasmGrpNxtCtx |
| 200 | syn match nasmCtxPreCondit contained "^\s*%elifnctx\>"hs=e-8 skipwhite nextgroup=@nasmGrpNxtCtx |
| 201 | if exists("nasm_no_warn") |
| 202 | hi link nasmCtxPreCondit nasmPreCondit |
| 203 | hi link nasmCtxPreProc nasmPreProc |
| 204 | hi link nasmCtxLocLabel nasmLocalLabel |
| 205 | else |
| 206 | hi link nasmCtxPreCondit nasmPreProcWarn |
| 207 | hi link nasmCtxPreProc nasmPreProcWarn |
| 208 | hi link nasmCtxLocLabel nasmLabelWarn |
| 209 | endif |
| 210 | endif |
| 211 | |
| 212 | " Conditional assembly |
| 213 | syn cluster nasmGrpCntnPreCon contains=ALLBUT,@nasmGrpInComments,@nasmGrpInMacros,@nasmGrpInStrucs |
| 214 | syn region nasmPreConditDef transparent matchgroup=nasmPreCondit start="^\s*%ifnidni\>"hs=e-7 start="^\s*%if\(idni\|n\(def\|idn\|num\|str\)\)\>"hs=e-6 start="^\s*%if\(def\|idn\|nid\|num\|str\)\>"hs=e-5 start="^\s*%ifid\>"hs=e-4 start="^\s*%if\>"hs=e-2 end="%endif\>" contains=@nasmGrpCntnPreCon |
| 215 | syn match nasmInPreCondit contained "^\s*%el\(if\|se\)\>"hs=e-4 |
| 216 | syn match nasmInPreCondit contained "^\s*%elifid\>"hs=e-6 |
| 217 | syn match nasmInPreCondit contained "^\s*%elif\(def\|idn\|nid\|num\|str\)\>"hs=e-7 |
| 218 | syn match nasmInPreCondit contained "^\s*%elif\(n\(def\|idn\|num\|str\)\|idni\)\>"hs=e-8 |
| 219 | syn match nasmInPreCondit contained "^\s*%elifnidni\>"hs=e-9 |
| 220 | syn cluster nasmGrpInPreCondits contains=nasmPreCondit,nasmInPreCondit,nasmCtxPreCondit |
| 221 | syn cluster nasmGrpPreCondits contains=nasmPreConditDef,@nasmGrpInPreCondits,nasmCtxPreProc,nasmCtxLocLabel |
| 222 | |
| 223 | " Other pre-processor statements |
Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 224 | syn match nasmPreProc "^\s*%\(rep\|use\)\>"hs=e-3 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 225 | syn match nasmPreProc "^\s*%line\>"hs=e-4 |
Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 226 | syn match nasmPreProc "^\s*%\(clear\|error\|fatal\)\>"hs=e-5 |
| 227 | syn match nasmPreProc "^\s*%\(endrep\|strlen\|substr\)\>"hs=e-6 |
| 228 | syn match nasmPreProc "^\s*%\(exitrep\|warning\)\>"hs=e-7 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 229 | syn match nasmDefine "^\s*%undef\>"hs=e-5 |
| 230 | syn match nasmDefine "^\s*%\(assign\|define\)\>"hs=e-6 |
| 231 | syn match nasmDefine "^\s*%i\(assign\|define\)\>"hs=e-7 |
Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 232 | syn match nasmDefine "^\s*%unmacro\>"hs=e-7 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 233 | syn match nasmInclude "^\s*%include\>"hs=e-7 |
Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 234 | " Todo: Treat the line tail after %fatal, %error, %warning as text |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 235 | |
| 236 | " Multiple pre-processor instructions on single line detection (obsolete) |
| 237 | "syn match nasmPreProcError +^\s*\([^\t "%';][^"%';]*\|[^\t "';][^"%';]\+\)%\a\+\>+ |
| 238 | syn cluster nasmGrpPreProcs contains=nasmMacroDef,@nasmGrpInMacros,@nasmGrpPreCondits,nasmPreProc,nasmDefine,nasmInclude,nasmPreProcWarn,nasmPreProcError |
| 239 | |
| 240 | |
| 241 | |
| 242 | " Register Identifiers: |
| 243 | " Register operands: |
| 244 | syn match nasmGen08Register "\<[A-D][HL]\>" |
| 245 | syn match nasmGen16Register "\<\([A-D]X\|[DS]I\|[BS]P\)\>" |
| 246 | syn match nasmGen32Register "\<E\([A-D]X\|[DS]I\|[BS]P\)\>" |
Bram Moolenaar | 130cbfc | 2021-04-07 21:07:20 +0200 | [diff] [blame] | 247 | syn match nasmGen64Register "\<R\([A-D]X\|[DS]I\|[BS]P\|[89]\|1[0-5]\|[89][WDB]\|1[0-5][WDB]\)\>" |
| 248 | syn match nasmExtRegister "\<\([SB]PL\|[SD]IL\)\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 249 | syn match nasmSegRegister "\<[C-GS]S\>" |
| 250 | syn match nasmSpcRegister "\<E\=IP\>" |
| 251 | syn match nasmFpuRegister "\<ST\o\>" |
| 252 | syn match nasmMmxRegister "\<MM\o\>" |
Andrii Sokolov | 733bbcd | 2023-09-09 12:00:09 +0200 | [diff] [blame] | 253 | syn match nasmAvxRegister "\<[XYZ]MM\d\{1,2}\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 254 | syn match nasmCtrlRegister "\<CR\o\>" |
| 255 | syn match nasmDebugRegister "\<DR\o\>" |
| 256 | syn match nasmTestRegister "\<TR\o\>" |
| 257 | syn match nasmRegisterError "\<\(CR[15-9]\|DR[4-58-9]\|TR[0-28-9]\)\>" |
Andrii Sokolov | 733bbcd | 2023-09-09 12:00:09 +0200 | [diff] [blame] | 258 | syn match nasmRegisterError "\<[XYZ]MM\(3[2-9]\|[04-9]\d\)\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 259 | syn match nasmRegisterError "\<ST\((\d)\|[8-9]\>\)" |
| 260 | syn match nasmRegisterError "\<E\([A-D][HL]\|[C-GS]S\)\>" |
| 261 | " Memory reference operand (address): |
Bram Moolenaar | 5dc6252 | 2012-02-13 00:05:22 +0100 | [diff] [blame] | 262 | syn match nasmMemRefError "[[\]]" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 263 | syn cluster nasmGrpCntnMemRef contains=ALLBUT,@nasmGrpComments,@nasmGrpPreProcs,@nasmGrpInStrucs,nasmMemReference,nasmMemRefError |
Bram Moolenaar | 5dc6252 | 2012-02-13 00:05:22 +0100 | [diff] [blame] | 264 | syn match nasmInMacMemRef contained "\[[^;[\]]\{-}\]" contains=@nasmGrpCntnMemRef,nasmPreProcError,nasmInMacLabel,nasmInMacLblWarn,nasmInMacParam |
| 265 | syn match nasmMemReference "\[[^;[\]]\{-}\]" contains=@nasmGrpCntnMemRef,nasmPreProcError,nasmCtxLocLabel |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 266 | |
| 267 | |
| 268 | |
| 269 | " Netwide Assembler Directives: |
| 270 | " Compilation constants |
| 271 | syn keyword nasmConstant __BITS__ __DATE__ __FILE__ __FORMAT__ __LINE__ |
| 272 | syn keyword nasmConstant __NASM_MAJOR__ __NASM_MINOR__ __NASM_VERSION__ |
| 273 | syn keyword nasmConstant __TIME__ |
| 274 | " Instruction modifiers |
| 275 | syn match nasmInstructnError "\<TO\>" |
| 276 | syn match nasmInstrModifier "\(^\|:\)\s*[C-GS]S\>"ms=e-1 |
| 277 | syn keyword nasmInstrModifier A16 A32 O16 O32 |
| 278 | syn match nasmInstrModifier "\<F\(ADD\|MUL\|\(DIV\|SUB\)R\=\)\s\+TO\>"lc=5,ms=e-1 |
| 279 | " the 'to' keyword is not allowed for fpu-pop instructions (yet) |
| 280 | "syn match nasmInstrModifier "\<F\(ADD\|MUL\|\(DIV\|SUB\)R\=\)P\s\+TO\>"lc=6,ms=e-1 |
| 281 | " NAsm directives |
| 282 | syn keyword nasmRepeat TIMES |
| 283 | syn keyword nasmDirective ALIGN[B] INCBIN EQU NOSPLIT SPLIT |
Bram Moolenaar | b7398fe | 2023-05-14 18:50:25 +0100 | [diff] [blame] | 284 | syn keyword nasmDirective ABSOLUTE BITS SECTION SEGMENT DEFAULT |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 285 | syn keyword nasmDirective ENDSECTION ENDSEGMENT |
| 286 | syn keyword nasmDirective __SECT__ |
| 287 | " Macro created standard directives: (requires %include) |
| 288 | syn case match |
| 289 | syn keyword nasmStdDirective ENDPROC EPILOGUE LOCALS PROC PROLOGUE USES |
| 290 | syn keyword nasmStdDirective ENDIF ELSE ELIF ELSIF IF |
| 291 | "syn keyword nasmStdDirective BREAK CASE DEFAULT ENDSWITCH SWITCH |
| 292 | "syn keyword nasmStdDirective CASE OF ENDCASE |
| 293 | syn keyword nasmStdDirective DO ENDFOR ENDWHILE FOR REPEAT UNTIL WHILE EXIT |
| 294 | syn case ignore |
| 295 | " Format specific directives: (all formats) |
| 296 | " (excluded: extension directives to section, global, common and extern) |
| 297 | syn keyword nasmFmtDirective ORG |
| 298 | syn keyword nasmFmtDirective EXPORT IMPORT GROUP UPPERCASE SEG WRT |
| 299 | syn keyword nasmFmtDirective LIBRARY |
| 300 | syn case match |
| 301 | syn keyword nasmFmtDirective _GLOBAL_OFFSET_TABLE_ __GLOBAL_OFFSET_TABLE_ |
| 302 | syn keyword nasmFmtDirective ..start ..got ..gotoff ..gotpc ..plt ..sym |
| 303 | syn case ignore |
| 304 | |
| 305 | |
| 306 | |
| 307 | " Standard Instructions: |
| 308 | syn match nasmInstructnError "\<\(F\=CMOV\|SET\)N\=\a\{0,2}\>" |
| 309 | syn keyword nasmInstructnError CMPS MOVS LCS LODS STOS XLAT |
| 310 | syn match nasmStdInstruction "\<MOV\>" |
| 311 | syn match nasmInstructnError "\<MOV\s[^,;[]*\<CS\>\s*[^:]"he=e-1 |
| 312 | syn match nasmStdInstruction "\<\(CMOV\|J\|SET\)\(N\=\([ABGL]E\=\|[CEOSZ]\)\|P[EO]\=\)\>" |
| 313 | syn match nasmStdInstruction "\<POP\>" |
| 314 | syn keyword nasmStdInstruction AAA AAD AAM AAS ADC ADD AND |
| 315 | syn keyword nasmStdInstruction BOUND BSF BSR BSWAP BT[C] BTR BTS |
Bram Moolenaar | b7398fe | 2023-05-14 18:50:25 +0100 | [diff] [blame] | 316 | syn keyword nasmStdInstruction CALL CBW CDQ CDQE CLC CLD CMC CMP CMPSB CMPSD CMPSW CMPSQ |
Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 317 | syn keyword nasmStdInstruction CMPXCHG CMPXCHG8B CPUID CWD[E] CQO |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 318 | syn keyword nasmStdInstruction DAA DAS DEC DIV ENTER |
Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 319 | syn keyword nasmStdInstruction IDIV IMUL INC INT[O] IRET[D] IRETW IRETQ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 320 | syn keyword nasmStdInstruction JCXZ JECXZ JMP |
Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 321 | syn keyword nasmStdInstruction LAHF LDS LEA LEAVE LES LFS LGS LODSB LODSD LODSQ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 322 | syn keyword nasmStdInstruction LODSW LOOP[E] LOOPNE LOOPNZ LOOPZ LSS |
Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 323 | syn keyword nasmStdInstruction MOVSB MOVSD MOVSW MOVSX MOVSQ MOVZX MUL NEG NOP NOT |
| 324 | syn keyword nasmStdInstruction OR POPA[D] POPAW POPF[D] POPFW POPFQ |
| 325 | syn keyword nasmStdInstruction PUSH[AD] PUSHAW PUSHF[D] PUSHFW PUSHFQ |
Bram Moolenaar | b7398fe | 2023-05-14 18:50:25 +0100 | [diff] [blame] | 326 | syn keyword nasmStdInstruction PAUSE |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 327 | syn keyword nasmStdInstruction RCL RCR RETF RET[N] ROL ROR |
| 328 | syn keyword nasmStdInstruction SAHF SAL SAR SBB SCASB SCASD SCASW |
Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 329 | syn keyword nasmStdInstruction SHL[D] SHR[D] STC STD STOSB STOSD STOSW STOSQ SUB |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 330 | syn keyword nasmStdInstruction TEST XADD XCHG XLATB XOR |
Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 331 | syn keyword nasmStdInstruction LFENCE MFENCE SFENCE |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 332 | |
| 333 | |
| 334 | " System Instructions: (usually privileged) |
| 335 | " Verification of pointer parameters |
| 336 | syn keyword nasmSysInstruction ARPL LAR LSL VERR VERW |
| 337 | " Addressing descriptor tables |
| 338 | syn keyword nasmSysInstruction LLDT SLDT LGDT SGDT |
| 339 | " Multitasking |
| 340 | syn keyword nasmSysInstruction LTR STR |
| 341 | " Coprocessing and Multiprocessing (requires fpu and multiple cpu's resp.) |
| 342 | syn keyword nasmSysInstruction CLTS LOCK WAIT |
| 343 | " Input and Output |
| 344 | syn keyword nasmInstructnError INS OUTS |
| 345 | syn keyword nasmSysInstruction IN INSB INSW INSD OUT OUTSB OUTSB OUTSW OUTSD |
| 346 | " Interrupt control |
| 347 | syn keyword nasmSysInstruction CLI STI LIDT SIDT |
| 348 | " System control |
| 349 | syn match nasmSysInstruction "\<MOV\s[^;]\{-}\<CR\o\>"me=s+3 |
| 350 | syn keyword nasmSysInstruction HLT INVD LMSW |
| 351 | syn keyword nasmSseInstruction PREFETCHT0 PREFETCHT1 PREFETCHT2 PREFETCHNTA |
| 352 | syn keyword nasmSseInstruction RSM SFENCE SMSW SYSENTER SYSEXIT UD2 WBINVD |
| 353 | " TLB (Translation Lookahead Buffer) testing |
| 354 | syn match nasmSysInstruction "\<MOV\s[^;]\{-}\<TR\o\>"me=s+3 |
| 355 | syn keyword nasmSysInstruction INVLPG |
| 356 | |
| 357 | " Debugging Instructions: (privileged) |
| 358 | syn match nasmDbgInstruction "\<MOV\s[^;]\{-}\<DR\o\>"me=s+3 |
| 359 | syn keyword nasmDbgInstruction INT1 INT3 RDMSR RDTSC RDPMC WRMSR |
| 360 | |
| 361 | |
| 362 | " Floating Point Instructions: (requires FPU) |
| 363 | syn match nasmFpuInstruction "\<FCMOVN\=\([AB]E\=\|[CEPUZ]\)\>" |
| 364 | syn keyword nasmFpuInstruction F2XM1 FABS FADD[P] FBLD FBSTP |
| 365 | syn keyword nasmFpuInstruction FCHS FCLEX FCOM[IP] FCOMP[P] FCOS |
| 366 | syn keyword nasmFpuInstruction FDECSTP FDISI FDIV[P] FDIVR[P] FENI FFREE |
| 367 | syn keyword nasmFpuInstruction FIADD FICOM[P] FIDIV[R] FILD |
| 368 | syn keyword nasmFpuInstruction FIMUL FINCSTP FINIT FIST[P] FISUB[R] |
| 369 | syn keyword nasmFpuInstruction FLD[1] FLDCW FLDENV FLDL2E FLDL2T FLDLG2 |
| 370 | syn keyword nasmFpuInstruction FLDLN2 FLDPI FLDZ FMUL[P] |
| 371 | syn keyword nasmFpuInstruction FNCLEX FNDISI FNENI FNINIT FNOP FNSAVE |
| 372 | syn keyword nasmFpuInstruction FNSTCW FNSTENV FNSTSW FNSTSW |
| 373 | syn keyword nasmFpuInstruction FPATAN FPREM[1] FPTAN FRNDINT FRSTOR |
| 374 | syn keyword nasmFpuInstruction FSAVE FSCALE FSETPM FSIN FSINCOS FSQRT |
| 375 | syn keyword nasmFpuInstruction FSTCW FSTENV FST[P] FSTSW FSUB[P] FSUBR[P] |
| 376 | syn keyword nasmFpuInstruction FTST FUCOM[IP] FUCOMP[P] |
| 377 | syn keyword nasmFpuInstruction FXAM FXCH FXTRACT FYL2X FYL2XP1 |
| 378 | |
| 379 | |
| 380 | " Multi Media Xtension Packed Instructions: (requires MMX unit) |
| 381 | " Standard MMX instructions: (requires MMX1 unit) |
| 382 | syn match nasmInstructnError "\<P\(ADD\|SUB\)U\=S\=[DQ]\=\>" |
| 383 | syn match nasmInstructnError "\<PCMP\a\{0,2}[BDWQ]\=\>" |
| 384 | syn keyword nasmMmxInstruction EMMS MOVD MOVQ |
| 385 | syn keyword nasmMmxInstruction PACKSSDW PACKSSWB PACKUSWB PADDB PADDD PADDW |
| 386 | syn keyword nasmMmxInstruction PADDSB PADDSW PADDUSB PADDUSW PAND[N] |
| 387 | syn keyword nasmMmxInstruction PCMPEQB PCMPEQD PCMPEQW PCMPGTB PCMPGTD PCMPGTW |
| 388 | syn keyword nasmMmxInstruction PMACHRIW PMADDWD PMULHW PMULLW POR |
| 389 | syn keyword nasmMmxInstruction PSLLD PSLLQ PSLLW PSRAD PSRAW PSRLD PSRLQ PSRLW |
| 390 | syn keyword nasmMmxInstruction PSUBB PSUBD PSUBW PSUBSB PSUBSW PSUBUSB PSUBUSW |
| 391 | syn keyword nasmMmxInstruction PUNPCKHBW PUNPCKHDQ PUNPCKHWD |
| 392 | syn keyword nasmMmxInstruction PUNPCKLBW PUNPCKLDQ PUNPCKLWD PXOR |
| 393 | " Extended MMX instructions: (requires MMX2/SSE unit) |
| 394 | syn keyword nasmMmxInstruction MASKMOVQ MOVNTQ |
| 395 | syn keyword nasmMmxInstruction PAVGB PAVGW PEXTRW PINSRW PMAXSW PMAXUB |
| 396 | syn keyword nasmMmxInstruction PMINSW PMINUB PMOVMSKB PMULHUW PSADBW PSHUFW |
| 397 | |
| 398 | |
| 399 | " Streaming SIMD Extension Packed Instructions: (requires SSE unit) |
| 400 | syn match nasmInstructnError "\<CMP\a\{1,5}[PS]S\>" |
| 401 | syn match nasmSseInstruction "\<CMP\(N\=\(EQ\|L[ET]\)\|\(UN\)\=ORD\)\=[PS]S\>" |
| 402 | syn keyword nasmSseInstruction ADDPS ADDSS ANDNPS ANDPS |
| 403 | syn keyword nasmSseInstruction COMISS CVTPI2PS CVTPS2PI |
| 404 | syn keyword nasmSseInstruction CVTSI2SS CVTSS2SI CVTTPS2PI CVTTSS2SI |
| 405 | syn keyword nasmSseInstruction DIVPS DIVSS FXRSTOR FXSAVE LDMXCSR |
| 406 | syn keyword nasmSseInstruction MAXPS MAXSS MINPS MINSS MOVAPS MOVHLPS MOVHPS |
| 407 | syn keyword nasmSseInstruction MOVLHPS MOVLPS MOVMSKPS MOVNTPS MOVSS MOVUPS |
| 408 | syn keyword nasmSseInstruction MULPS MULSS |
| 409 | syn keyword nasmSseInstruction ORPS RCPPS RCPSS RSQRTPS RSQRTSS |
| 410 | syn keyword nasmSseInstruction SHUFPS SQRTPS SQRTSS STMXCSR SUBPS SUBSS |
| 411 | syn keyword nasmSseInstruction UCOMISS UNPCKHPS UNPCKLPS XORPS |
| 412 | |
Bram Moolenaar | b7398fe | 2023-05-14 18:50:25 +0100 | [diff] [blame] | 413 | " F16c Instructions |
| 414 | syn keyword nasmF16CInstruction VCVTPH2PS VCVTPS2PH |
| 415 | |
| 416 | " AVX Instructions |
| 417 | syn keyword nasmAVXInstruction VCVTDQ2PD VCVTDQ2PS VCVTPD2DQ VCVTPD2P VCVTPD2PS |
| 418 | syn keyword nasmAVXInstruction VCVTPS2DQ VCVTPS2PD |
| 419 | syn keyword nasmAVXInstruction VCVTSD2SI VCVTSD2SS VCVTSI2SD VCVTSI2SS VCVTSS2SD VCVTSS2SI |
| 420 | syn keyword nasmAVXInstruction VMAXPS VMAXSS VMINPS VMINSS VMOVAPS VMOVHLPS VMOVHPS |
| 421 | syn keyword nasmAVXInstruction VMAXPD VMAXSD VMINPD VMINSD VMOVAPD VMOVHLPD VMOVHPD |
| 422 | syn keyword nasmAVXInstruction VMOVLHPS VMOVLPS VMOVMSKPS VMOVNTPS VMOVSS VMOVUPS |
| 423 | syn keyword nasmAVXInstruction VMULPS VMULSS VPXOR |
| 424 | |
| 425 | syn match nasmInstructnError "\<VP\a\{3}R\a\>" |
| 426 | syn match nasmAVXInstruction "\<VP\(INS\|EXT\)R[BDQW]\>" |
| 427 | |
| 428 | syn keyword nasmAVXInstruction VORPS VPABSB VPABSD VPABSW |
| 429 | syn keyword nasmAVXInstruction PACKSSDW VPACKSSWB VPACKUSDW VPACKUSWB VPADDD |
| 430 | syn keyword nasmAVXInstruction PADDQ VPADDSB VPADDSW VPADDUSB VPADDUSW |
| 431 | syn keyword nasmAVXInstruction PADDW VPALIGNR VPAND VPANDN VPAVGB |
| 432 | syn keyword nasmAVXInstruction PAVGW VPBLENDD VPBLENDVB VPBLENDW VPBROADCASTB |
| 433 | syn keyword nasmAVXInstruction PBROADCASTD VPBROADCASTQ VPBROADCASTW VPCLMULQDQ VPCMOV |
| 434 | syn keyword nasmAVXInstruction PCMPEQB VPCMPEQD VPCMPEQQ VPCMPEQW VPCMPESTRI |
| 435 | syn keyword nasmAVXInstruction PCMPESTRM VPCMPGTB VPCMPGTD VPCMPGTQ VPCMPGTW |
| 436 | syn keyword nasmAVXInstruction PCMPISTRI VPCMPISTRM VPCOMB VPCOMD VPCOMQ |
| 437 | syn keyword nasmAVXInstruction PCOMUB VPCOMUD VPCOMUQ VPCOMUW VPCOMW |
| 438 | syn keyword nasmAVXInstruction PERM2FVPERM2IVPERMD VPERMIL2PD VPERMIL2PS VPERMILPD VPERMILPS |
| 439 | syn keyword nasmAVXInstruction PERMPD VPERMPS VPERMQ VPEXTRB VPEXTRD |
| 440 | syn keyword nasmAVXInstruction PEXTRQ VPEXTRW VPGATHERDD VPGATHERDQ VPGATHERQD |
| 441 | syn keyword nasmAVXInstruction PGATHERQQ VPHADDBD VPHADDBQ VPHADDBW VPHADDD |
| 442 | syn keyword nasmAVXInstruction PHADDDQ VPHADDSW VPHADDUBQ VPHADDUBW VPHADDUDQ |
| 443 | syn keyword nasmAVXInstruction PHADDUWD VPHADDUWQ VPHADDW VPHADDWD VPHADDWQ |
| 444 | syn keyword nasmAVXInstruction PHMINPOSUW VPHSUBBW VPHSUBD VPHSUBDQ VPHSUBSW |
| 445 | syn keyword nasmAVXInstruction PHSUBW VPHSUBWD VPINSRB VPINSRD VPINSRQ |
| 446 | syn keyword nasmAVXInstruction PINSRW VPMACSDD VPMACSDQH |
| 447 | syn keyword nasmAVXInstruction VPMACSDQL VPMACSSDD VPMACSSDQL VPMACSSQH VPMACSSWD |
| 448 | syn keyword nasmAVXInstruction VPMACSSWW VPMACSWD VPMACSWW VPMADCSSWD VPMADCSWD |
| 449 | syn keyword nasmAVXInstruction VPMADDUBSW VPMADDWD VPMASKMOVD VPMASKMOVQ VPMAXSB |
| 450 | syn keyword nasmAVXInstruction VPMAXSD VPMAXSW VPMAXUB VPMAXUD VPMAXUW |
| 451 | syn keyword nasmAVXInstruction VPMINSB VPMINSD VPMINSW VPMINUB VPMINUD |
| 452 | syn keyword nasmAVXInstruction VPMINUW VPMOVMSKB VPMOVSXBD VPMOVSXBQ VPMOVSXBW |
| 453 | syn keyword nasmAVXInstruction VPMOVSXDQ VPMOVSXWD VPMOVSXWQ VPMOVZXBD VPMOVZXBQ |
| 454 | syn keyword nasmAVXInstruction VPMOVZXBW VPMOVZXDQ VPMOVZXWD VPMOVZXWQ VPMULDQ |
| 455 | syn keyword nasmAVXInstruction VPMULHRSW VPMULHUW VPMULHW VPMULLD VPMULLW |
| 456 | syn keyword nasmAVXInstruction VPMULUDQ VPOR VPPERM VPROTB VPROTD |
| 457 | syn keyword nasmAVXInstruction VPROTQ VPROTW VPSADBW VPSHAB VPSHAD |
| 458 | syn keyword nasmAVXInstruction VPSHAQ VPSHAW VPSHLB VPSHLD VPSHLQ |
| 459 | syn keyword nasmAVXInstruction VPSHLW VPSHUFB VPSHUFD VPSHUFHW VPSHUFLW |
| 460 | syn keyword nasmAVXInstruction VPSIGNB VPSIGND VPSIGNW VPSLLD VPSLLDQ |
| 461 | syn keyword nasmAVXInstruction VPSLLQ VPSLLVD VPSLLVQ VPSLLW VPSRAD |
| 462 | syn keyword nasmAVXInstruction VPSRAVD VPSRAW VPSRLD VPSRLDQ VPSRLQ |
| 463 | syn keyword nasmAVXInstruction VPSRLVD VPSRLVQ VPSRLW VPSUBB VPSUBD |
| 464 | syn keyword nasmAVXInstruction VPSUBQ VPSUBSB VPSUBSW VPSUBUSB VPSUBUSW |
| 465 | syn keyword nasmAVXInstruction VPSUBW VPTEST VPUNPCKHBW VPUNPCKHDQ VPUNPCKHQDQ |
| 466 | syn keyword nasmAVXInstruction VPUNPCKHWD VPUNPCKLBW VPUNPCKLDQ VPUNPCKLQDQ VPUNPCKLWD |
| 467 | syn keyword nasmAVXInstruction VPXOR VRCPPS |
| 468 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 469 | |
| 470 | " Three Dimensional Now Packed Instructions: (requires 3DNow! unit) |
| 471 | syn keyword nasmNowInstruction FEMMS PAVGUSB PF2ID PFACC PFADD PFCMPEQ PFCMPGE |
| 472 | syn keyword nasmNowInstruction PFCMPGT PFMAX PFMIN PFMUL PFRCP PFRCPIT1 |
| 473 | syn keyword nasmNowInstruction PFRCPIT2 PFRSQIT1 PFRSQRT PFSUB[R] PI2FD |
| 474 | syn keyword nasmNowInstruction PMULHRWA PREFETCH[W] |
| 475 | |
| 476 | |
| 477 | " Vendor Specific Instructions: |
| 478 | " Cyrix instructions (requires Cyrix processor) |
| 479 | syn keyword nasmCrxInstruction PADDSIW PAVEB PDISTIB PMAGW PMULHRW[C] PMULHRIW |
| 480 | syn keyword nasmCrxInstruction PMVGEZB PMVLZB PMVNZB PMVZB PSUBSIW |
| 481 | syn keyword nasmCrxInstruction RDSHR RSDC RSLDT SMINT SMINTOLD SVDC SVLDT SVTS |
| 482 | syn keyword nasmCrxInstruction WRSHR |
| 483 | " AMD instructions (requires AMD processor) |
| 484 | syn keyword nasmAmdInstruction SYSCALL SYSRET |
| 485 | |
| 486 | |
| 487 | " Undocumented Instructions: |
| 488 | syn match nasmUndInstruction "\<POP\s[^;]*\<CS\>"me=s+3 |
| 489 | syn keyword nasmUndInstruction CMPXCHG486 IBTS ICEBP INT01 INT03 LOADALL |
| 490 | syn keyword nasmUndInstruction LOADALL286 LOADALL386 SALC SMI UD1 UMOV XBTS |
| 491 | |
| 492 | |
| 493 | |
| 494 | " Synchronize Syntax: |
| 495 | syn sync clear |
| 496 | syn sync minlines=50 "for multiple region nesting |
| 497 | syn sync match nasmSync grouphere nasmMacroDef "^\s*%i\=macro\>"me=s-1 |
| 498 | syn sync match nasmSync grouphere NONE "^\s*%endmacro\>" |
| 499 | |
| 500 | |
| 501 | " Define the default highlighting. |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 502 | " Only when an item doesn't have highlighting yet |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 503 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 504 | " Sub Links: |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 505 | hi def link nasmInMacDirective nasmDirective |
| 506 | hi def link nasmInMacLabel nasmLocalLabel |
| 507 | hi def link nasmInMacLblWarn nasmLabelWarn |
| 508 | hi def link nasmInMacMacro nasmMacro |
| 509 | hi def link nasmInMacParam nasmMacro |
| 510 | hi def link nasmInMacParamNum nasmDecNumber |
| 511 | hi def link nasmInMacPreCondit nasmPreCondit |
| 512 | hi def link nasmInMacPreProc nasmPreProc |
| 513 | hi def link nasmInPreCondit nasmPreCondit |
| 514 | hi def link nasmInStructure nasmStructure |
| 515 | hi def link nasmStructureLabel nasmStructure |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 516 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 517 | " Comment Group: |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 518 | hi def link nasmComment Comment |
| 519 | hi def link nasmSpecialComment SpecialComment |
| 520 | hi def link nasmInCommentTodo Todo |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 521 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 522 | " Constant Group: |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 523 | hi def link nasmString String |
Bram Moolenaar | 690afe1 | 2017-01-28 18:34:47 +0100 | [diff] [blame] | 524 | hi def link nasmCString String |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 525 | hi def link nasmStringError Error |
Bram Moolenaar | 690afe1 | 2017-01-28 18:34:47 +0100 | [diff] [blame] | 526 | hi def link nasmCStringEscape SpecialChar |
| 527 | hi def link nasmCStringFormat SpecialChar |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 528 | hi def link nasmBinNumber Number |
| 529 | hi def link nasmOctNumber Number |
| 530 | hi def link nasmDecNumber Number |
| 531 | hi def link nasmHexNumber Number |
| 532 | hi def link nasmFltNumber Float |
| 533 | hi def link nasmNumberError Error |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 534 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 535 | " Identifier Group: |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 536 | hi def link nasmLabel Identifier |
| 537 | hi def link nasmLocalLabel Identifier |
| 538 | hi def link nasmSpecialLabel Special |
| 539 | hi def link nasmLabelError Error |
| 540 | hi def link nasmLabelWarn Todo |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 541 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 542 | " PreProc Group: |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 543 | hi def link nasmPreProc PreProc |
| 544 | hi def link nasmDefine Define |
| 545 | hi def link nasmInclude Include |
| 546 | hi def link nasmMacro Macro |
| 547 | hi def link nasmPreCondit PreCondit |
| 548 | hi def link nasmPreProcError Error |
| 549 | hi def link nasmPreProcWarn Todo |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 550 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 551 | " Type Group: |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 552 | hi def link nasmType Type |
| 553 | hi def link nasmStorage StorageClass |
| 554 | hi def link nasmStructure Structure |
| 555 | hi def link nasmTypeError Error |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 556 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 557 | " Directive Group: |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 558 | hi def link nasmConstant Constant |
| 559 | hi def link nasmInstrModifier Operator |
| 560 | hi def link nasmRepeat Repeat |
| 561 | hi def link nasmDirective Keyword |
| 562 | hi def link nasmStdDirective Operator |
| 563 | hi def link nasmFmtDirective Keyword |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 564 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 565 | " Register Group: |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 566 | hi def link nasmCtrlRegister Special |
| 567 | hi def link nasmDebugRegister Debug |
| 568 | hi def link nasmTestRegister Special |
| 569 | hi def link nasmRegisterError Error |
| 570 | hi def link nasmMemRefError Error |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 571 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 572 | " Instruction Group: |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 573 | hi def link nasmStdInstruction Statement |
| 574 | hi def link nasmSysInstruction Statement |
| 575 | hi def link nasmDbgInstruction Debug |
| 576 | hi def link nasmFpuInstruction Statement |
| 577 | hi def link nasmMmxInstruction Statement |
| 578 | hi def link nasmSseInstruction Statement |
Bram Moolenaar | b7398fe | 2023-05-14 18:50:25 +0100 | [diff] [blame] | 579 | hi def link nasmF16cInstruction Statement |
| 580 | hi def link nasmAVXInstruction Statement |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 581 | hi def link nasmNowInstruction Statement |
| 582 | hi def link nasmAmdInstruction Special |
| 583 | hi def link nasmCrxInstruction Special |
| 584 | hi def link nasmUndInstruction Todo |
| 585 | hi def link nasmInstructnError Error |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 586 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 587 | let b:current_syntax = "nasm" |
| 588 | |
| 589 | " vim:ts=8 sw=4 |