"Fossies" - the Fresh Open Source Software Archive

Member "vim-8.2.1354/runtime/syntax/nasm.vim" (2 Aug 2020, 26285 Bytes) of package /linux/misc/vim-8.2.1354.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) vimscript source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

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