135 lines
20 KiB
JavaScript
135 lines
20 KiB
JavaScript
|
module.exports = function(hljs) {
|
||
|
return {
|
||
|
case_insensitive: true,
|
||
|
lexemes: '\\.?' + hljs.IDENT_RE,
|
||
|
keywords: {
|
||
|
keyword:
|
||
|
'lock rep repe repz repne repnz xaquire xrelease bnd nobnd ' +
|
||
|
'aaa aad aam aas adc add and arpl bb0_reset bb1_reset bound bsf bsr bswap bt btc btr bts call cbw cdq cdqe clc cld cli clts cmc cmp cmpsb cmpsd cmpsq cmpsw cmpxchg cmpxchg486 cmpxchg8b cmpxchg16b cpuid cpu_read cpu_write cqo cwd cwde daa das dec div dmint emms enter equ f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcmovb fcmovbe fcmove fcmovnb fcmovnbe fcmovne fcmovnu fcmovu fcom fcomi fcomip fcomp fcompp fcos fdecstp fdisi fdiv fdivp fdivr fdivrp femms feni ffree ffreep fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisttp fisub fisubr fld fld1 fldcw fldenv fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fndisi fneni fninit fnop fnsave fnstcw fnstenv fnstsw fpatan fprem fprem1 fptan frndint frstor fsave fscale fsetpm fsin fsincos fsqrt fst fstcw fstenv fstp fstsw fsub fsubp fsubr fsubrp ftst fucom fucomi fucomip fucomp fucompp fxam fxch fxtract fyl2x fyl2xp1 hlt ibts icebp idiv imul in inc incbin insb insd insw int int01 int1 int03 int3 into invd invpcid invlpg invlpga iret iretd iretq iretw jcxz jecxz jrcxz jmp jmpe lahf lar lds lea leave les lfence lfs lgdt lgs lidt lldt lmsw loadall loadall286 lodsb lodsd lodsq lodsw loop loope loopne loopnz loopz lsl lss ltr mfence monitor mov movd movq movsb movsd movsq movsw movsx movsxd movzx mul mwait neg nop not or out outsb outsd outsw packssdw packsswb packuswb paddb paddd paddsb paddsiw paddsw paddusb paddusw paddw pand pandn pause paveb pavgusb pcmpeqb pcmpeqd pcmpeqw pcmpgtb pcmpgtd pcmpgtw pdistib pf2id pfacc pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin pfmul pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr pi2fd pmachriw pmaddwd pmagw pmulhriw pmulhrwa pmulhrwc pmulhw pmullw pmvgezb pmvlzb pmvnzb pmvzb pop popa popad popaw popf popfd popfq popfw por prefetch prefetchw pslld psllq psllw psrad psraw psrld psrlq psrlw psubb psubd psubsb psubsiw psubsw psubusb psubusw psubw punpckhbw punpckhdq punpckhwd punpcklbw punpckldq punpcklwd push pusha pushad pushaw pushf pushfd pushfq pushfw pxor rcl rcr rdshr rdmsr rdpmc rdtsc rdtscp ret retf retn rol ror rdm rsdc rsldt rsm rsts sahf sal salc sar sbb scasb scasd scasq scasw sfence sgdt shl shld shr shrd sidt sldt skinit smi smint smintold smsw stc std sti stosb stosd stosq stosw str sub svdc svldt svts swapgs syscall sysenter sysexit sysret test ud0 ud1 ud2b ud2 ud2a umov verr verw fwait wbinvd wrshr wrmsr xadd xbts xchg xlatb xlat xor cmove cmovz cmovne cmovnz cmova cmovnbe cmovae cmovnb cmovb cmovnae cmovbe cmovna cmovg cmovnle cmovge cmovnl cmovl cmovnge cmovle cmovng cmovc cmovnc cmovo cmovno cmovs cmovns cmovp cmovpe cmovnp cmovpo je jz jne jnz ja jnbe jae jnb jb jnae jbe jna jg jnle jge jnl jl jnge jle jng jc jnc jo jno js jns jpo jnp jpe jp sete setz setne setnz seta setnbe setae setnb setnc setb setnae setcset setbe setna setg setnle setge setnl setl setnge setle setng sets setns seto setno setpe setp setpo setnp addps addss andnps andps cmpeqps cmpeqss cmpleps cmpless cmpltps cmpltss cmpneqps cmpneqss cmpnleps cmpnless cmpnltps cmpnltss cmpordps cmpordss cmpunordps cmpunordss cmpps cmpss comiss cvtpi2ps cvtps2pi cvtsi2ss cvtss2si cvttps2pi cvttss2si divps divss ldmxcsr maxps maxss minps minss movaps movhps movlhps movlps movhlps movmskps movntps movss movups mulps mulss orps rcpps rcpss rsqrtps rsqrtss shufps sqrtps sqrtss stmxcsr subps subss ucomiss unpckhps unpcklps xorps fxrstor fxrstor64 fxsave fxsave64 xgetbv xsetbv xsave xsave64 xsaveopt xsaveopt64 xrstor xrstor64 prefetchnta prefetcht0 prefetcht1 prefetcht2 maskmovq movntq pavgb pavgw pextrw pinsrw pmaxsw pmaxub pminsw pminub pmovmskb pmulhuw psadbw pshufw pf2iw pfnacc pfpnacc pi2fw pswapd maskmovdqu clflush movntdq movnti movntpd movdqa movdqu movdq2q movq2dq paddq pmuludq pshufd pshufhw pshuflw pslldq psrldq psubq punpckhqdq punpcklqdq addpd addsd andnpd andpd cmpeqpd cmpeqsd cmplepd cmplesd cmpltpd cmpltsd cmpneqpd cmpneqsd cmpnlepd cmpnlesd cmpnltpd cmpnltsd cmpordpd cmpordsd cmpunordpd cmpunordsd cmppd comisd cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtps2dq cvtps2pd cvtsd2si cvtsd2ss cvtsi2sd cvtss2sd cvttpd
|
||
|
literal:
|
||
|
// Instruction pointer
|
||
|
'ip eip rip ' +
|
||
|
// 8-bit registers
|
||
|
'al ah bl bh cl ch dl dh sil dil bpl spl r8b r9b r10b r11b r12b r13b r14b r15b ' +
|
||
|
// 16-bit registers
|
||
|
'ax bx cx dx si di bp sp r8w r9w r10w r11w r12w r13w r14w r15w ' +
|
||
|
// 32-bit registers
|
||
|
'eax ebx ecx edx esi edi ebp esp eip r8d r9d r10d r11d r12d r13d r14d r15d ' +
|
||
|
// 64-bit registers
|
||
|
'rax rbx rcx rdx rsi rdi rbp rsp r8 r9 r10 r11 r12 r13 r14 r15 ' +
|
||
|
// Segment registers
|
||
|
'cs ds es fs gs ss ' +
|
||
|
// Floating point stack registers
|
||
|
'st st0 st1 st2 st3 st4 st5 st6 st7 ' +
|
||
|
// MMX Registers
|
||
|
'mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 ' +
|
||
|
// SSE registers
|
||
|
'xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8 xmm9 xmm10 xmm11 xmm12 xmm13 xmm14 xmm15 ' +
|
||
|
'xmm16 xmm17 xmm18 xmm19 xmm20 xmm21 xmm22 xmm23 xmm24 xmm25 xmm26 xmm27 xmm28 xmm29 xmm30 xmm31 ' +
|
||
|
// AVX registers
|
||
|
'ymm0 ymm1 ymm2 ymm3 ymm4 ymm5 ymm6 ymm7 ymm8 ymm9 ymm10 ymm11 ymm12 ymm13 ymm14 ymm15 ' +
|
||
|
'ymm16 ymm17 ymm18 ymm19 ymm20 ymm21 ymm22 ymm23 ymm24 ymm25 ymm26 ymm27 ymm28 ymm29 ymm30 ymm31 ' +
|
||
|
// AVX-512F registers
|
||
|
'zmm0 zmm1 zmm2 zmm3 zmm4 zmm5 zmm6 zmm7 zmm8 zmm9 zmm10 zmm11 zmm12 zmm13 zmm14 zmm15 ' +
|
||
|
'zmm16 zmm17 zmm18 zmm19 zmm20 zmm21 zmm22 zmm23 zmm24 zmm25 zmm26 zmm27 zmm28 zmm29 zmm30 zmm31 ' +
|
||
|
// AVX-512F mask registers
|
||
|
'k0 k1 k2 k3 k4 k5 k6 k7 ' +
|
||
|
// Bound (MPX) register
|
||
|
'bnd0 bnd1 bnd2 bnd3 ' +
|
||
|
// Special register
|
||
|
'cr0 cr1 cr2 cr3 cr4 cr8 dr0 dr1 dr2 dr3 dr8 tr3 tr4 tr5 tr6 tr7 ' +
|
||
|
// NASM altreg package
|
||
|
'r0 r1 r2 r3 r4 r5 r6 r7 r0b r1b r2b r3b r4b r5b r6b r7b ' +
|
||
|
'r0w r1w r2w r3w r4w r5w r6w r7w r0d r1d r2d r3d r4d r5d r6d r7d ' +
|
||
|
'r0h r1h r2h r3h ' +
|
||
|
'r0l r1l r2l r3l r4l r5l r6l r7l r8l r9l r10l r11l r12l r13l r14l r15l',
|
||
|
|
||
|
pseudo:
|
||
|
'db dw dd dq dt ddq do dy dz ' +
|
||
|
'resb resw resd resq rest resdq reso resy resz ' +
|
||
|
'incbin equ times',
|
||
|
|
||
|
preprocessor:
|
||
|
'%define %xdefine %+ %undef %defstr %deftok %assign %strcat %strlen %substr %rotate %elif %else %endif ' +
|
||
|
'%ifmacro %ifctx %ifidn %ifidni %ifid %ifnum %ifstr %iftoken %ifempty %ifenv %error %warning %fatal %rep ' +
|
||
|
'%endrep %include %push %pop %repl %pathsearch %depend %use %arg %stacksize %local %line %comment %endcomment ' +
|
||
|
'.nolist ' +
|
||
|
'byte word dword qword nosplit rel abs seg wrt strict near far a32 ptr ' +
|
||
|
'__FILE__ __LINE__ __SECT__ __BITS__ __OUTPUT_FORMAT__ __DATE__ __TIME__ __DATE_NUM__ __TIME_NUM__ ' +
|
||
|
'__UTC_DATE__ __UTC_TIME__ __UTC_DATE_NUM__ __UTC_TIME_NUM__ __PASS__ struc endstruc istruc at iend ' +
|
||
|
'align alignb sectalign daz nodaz up down zero default option assume public ',
|
||
|
|
||
|
built_in:
|
||
|
'bits use16 use32 use64 default section segment absolute extern global common cpu float ' +
|
||
|
'__utf16__ __utf16le__ __utf16be__ __utf32__ __utf32le__ __utf32be__ ' +
|
||
|
'__float8__ __float16__ __float32__ __float64__ __float80m__ __float80e__ __float128l__ __float128h__ ' +
|
||
|
'__Infinity__ __QNaN__ __SNaN__ Inf NaN QNaN SNaN float8 float16 float32 float64 float80m float80e ' +
|
||
|
'float128l float128h __FLOAT_DAZ__ __FLOAT_ROUND__ __FLOAT__'
|
||
|
},
|
||
|
contains: [
|
||
|
hljs.COMMENT(
|
||
|
';',
|
||
|
'$',
|
||
|
{
|
||
|
relevance: 0
|
||
|
}
|
||
|
),
|
||
|
{
|
||
|
className: 'number',
|
||
|
variants: [
|
||
|
// Float number and x87 BCD
|
||
|
{
|
||
|
begin: '\\b(?:([0-9][0-9_]*)?\\.[0-9_]*(?:[eE][+-]?[0-9_]+)?|' +
|
||
|
'(0[Xx])?[0-9][0-9_]*\\.?[0-9_]*(?:[pP](?:[+-]?[0-9_]+)?)?)\\b',
|
||
|
relevance: 0
|
||
|
},
|
||
|
|
||
|
// Hex number in $
|
||
|
{ begin: '\\$[0-9][0-9A-Fa-f]*', relevance: 0 },
|
||
|
|
||
|
// Number in H,D,T,Q,O,B,Y suffix
|
||
|
{ begin: '\\b(?:[0-9A-Fa-f][0-9A-Fa-f_]*[Hh]|[0-9][0-9_]*[DdTt]?|[0-7][0-7_]*[QqOo]|[0-1][0-1_]*[BbYy])\\b' },
|
||
|
|
||
|
// Number in X,D,T,Q,O,B,Y prefix
|
||
|
{ begin: '\\b(?:0[Xx][0-9A-Fa-f_]+|0[DdTt][0-9_]+|0[QqOo][0-7_]+|0[BbYy][0-1_]+)\\b'}
|
||
|
]
|
||
|
},
|
||
|
// Double quote string
|
||
|
hljs.QUOTE_STRING_MODE,
|
||
|
{
|
||
|
className: 'string',
|
||
|
variants: [
|
||
|
// Single-quoted string
|
||
|
{ begin: '\'', end: '[^\\\\]\'' },
|
||
|
// Backquoted string
|
||
|
{ begin: '`', end: '[^\\\\]`' },
|
||
|
// Section name
|
||
|
{ begin: '\\.[A-Za-z0-9]+' }
|
||
|
],
|
||
|
relevance: 0
|
||
|
},
|
||
|
{
|
||
|
className: 'label',
|
||
|
variants: [
|
||
|
// Global label and local label
|
||
|
{ begin: '^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)' },
|
||
|
// Macro-local label
|
||
|
{ begin: '^\\s*%%[A-Za-z0-9_$#@~.?]*:' }
|
||
|
],
|
||
|
relevance: 0
|
||
|
},
|
||
|
// Macro parameter
|
||
|
{
|
||
|
className: 'argument',
|
||
|
begin: '%[0-9]+',
|
||
|
relevance: 0
|
||
|
},
|
||
|
// Macro parameter
|
||
|
{
|
||
|
className: 'built_in',
|
||
|
begin: '%!\S+',
|
||
|
relevance: 0
|
||
|
}
|
||
|
]
|
||
|
};
|
||
|
};
|