mode-assembly_x86.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. ace.define("ace/mode/assembly_x86_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var AssemblyX86HighlightRules = function() {
  6. this.$rules = { start:
  7. [ { token: 'keyword.control.assembly',
  8. regex: '\\b(?:aaa|aad|aam|aas|adc|add|addpd|addps|addsd|addss|addsubpd|addsubps|aesdec|aesdeclast|aesenc|aesenclast|aesimc|aeskeygenassist|and|andpd|andps|andnpd|andnps|arpl|blendpd|blendps|blendvpd|blendvps|bound|bsf|bsr|bswap|bt|btc|btr|bts|cbw|cwde|cdqe|clc|cld|cflush|clts|cmc|cmov(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|cmp|cmppd|cmpps|cmps|cnpsb|cmpsw|cmpsd|cmpsq|cmpss|cmpxchg|cmpxchg8b|cmpxchg16b|comisd|comiss|cpuid|crc32|cvtdq2pd|cvtdq2ps|cvtpd2dq|cvtpd2pi|cvtpd2ps|cvtpi2pd|cvtpi2ps|cvtps2dq|cvtps2pd|cvtps2pi|cvtsd2si|cvtsd2ss|cvts2sd|cvtsi2ss|cvtss2sd|cvtss2si|cvttpd2dq|cvtpd2pi|cvttps2dq|cvttps2pi|cvttps2dq|cvttps2pi|cvttsd2si|cvttss2si|cwd|cdq|cqo|daa|das|dec|div|divpd|divps|divsd|divss|dppd|dpps|emms|enter|extractps|f2xm1|fabs|fadd|faddp|fiadd|fbld|fbstp|fchs|fclex|fnclex|fcmov(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|fcom|fcmop|fcompp|fcomi|fcomip|fucomi|fucomip|fcos|fdecstp|fdiv|fdivp|fidiv|fdivr|fdivrp|fidivr|ffree|ficom|ficomp|fild|fincstp|finit|fnint|fist|fistp|fisttp|fld|fld1|fldl2t|fldl2e|fldpi|fldlg2|fldln2|fldz|fldcw|fldenv|fmul|fmulp|fimul|fnop|fpatan|fprem|fprem1|fptan|frndint|frstor|fsave|fnsave|fscale|fsin|fsincos|fsqrt|fst|fstp|fstcw|fnstcw|fstenv|fnstenv|fsts|fnstsw|fsub|fsubp|fisub|fsubr|fsubrp|fisubr|ftst|fucom|fucomp|fucompp|fxam|fxch|fxrstor|fxsave|fxtract|fyl2x|fyl2xp1|haddpd|haddps|husbpd|hsubps|idiv|imul|in|inc|ins|insb|insw|insd|insertps|int|into|invd|invplg|invpcid|iret|iretd|iretq|lahf|lar|lddqu|ldmxcsr|lds|les|lfs|lgs|lss|lea|leave|lfence|lgdt|lidt|llgdt|lmsw|lock|lods|lodsb|lodsw|lodsd|lodsq|lsl|ltr|maskmovdqu|maskmovq|maxpd|maxps|maxsd|maxss|mfence|minpd|minps|minsd|minss|monitor|mov|movapd|movaps|movbe|movd|movq|movddup|movdqa|movdqu|movq2q|movhlps|movhpd|movhps|movlhps|movlpd|movlps|movmskpd|movmskps|movntdqa|movntdq|movnti|movntpd|movntps|movntq|movq|movq2dq|movs|movsb|movsw|movsd|movsq|movsd|movshdup|movsldup|movss|movsx|movsxd|movupd|movups|movzx|mpsadbw|mul|mulpd|mulps|mulsd|mulss|mwait|neg|not|or|orpd|orps|out|outs|outsb|outsw|outsd|pabsb|pabsw|pabsd|packsswb|packssdw|packusdw|packuswbpaddb|paddw|paddd|paddq|paddsb|paddsw|paddusb|paddusw|palignr|pand|pandn|pause|pavgb|pavgw|pblendvb|pblendw|pclmulqdq|pcmpeqb|pcmpeqw|pcmpeqd|pcmpeqq|pcmpestri|pcmpestrm|pcmptb|pcmptgw|pcmpgtd|pcmpgtq|pcmpistri|pcmpisrm|pextrb|pextrd|pextrq|pextrw|phaddw|phaddd|phaddsw|phinposuw|phsubw|phsubd|phsubsw|pinsrb|pinsrd|pinsrq|pinsrw|pmaddubsw|pmadddwd|pmaxsb|pmaxsd|pmaxsw|pmaxsw|pmaxub|pmaxud|pmaxuw|pminsb|pminsd|pminsw|pminub|pminud|pminuw|pmovmskb|pmovsx|pmovzx|pmuldq|pmulhrsw|pmulhuw|pmulhw|pmulld|pmullw|pmuludw|pop|popa|popad|popcnt|popf|popfd|popfq|por|prefetch|psadbw|pshufb|pshufd|pshufhw|pshuflw|pshufw|psignb|psignw|psignd|pslldq|psllw|pslld|psllq|psraw|psrad|psrldq|psrlw|psrld|psrlq|psubb|psubw|psubd|psubq|psubsb|psubsw|psubusb|psubusw|test|ptest|punpckhbw|punpckhwd|punpckhdq|punpckhddq|punpcklbw|punpcklwd|punpckldq|punpckldqd|push|pusha|pushad|pushf|pushfd|pxor|prcl|rcr|rol|ror|rcpps|rcpss|rdfsbase|rdgsbase|rdmsr|rdpmc|rdrand|rdtsc|rdtscp|rep|repe|repz|repne|repnz|roundpd|roundps|roundsd|roundss|rsm|rsqrps|rsqrtss|sahf|sal|sar|shl|shr|sbb|scas|scasb|scasw|scasd|set(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|sfence|sgdt|shld|shrd|shufpd|shufps|sidt|sldt|smsw|sqrtpd|sqrtps|sqrtsd|sqrtss|stc|std|stmxcsr|stos|stosb|stosw|stosd|stosq|str|sub|subpd|subps|subsd|subss|swapgs|syscall|sysenter|sysexit|sysret|teset|ucomisd|ucomiss|ud2|unpckhpd|unpckhps|unpcklpd|unpcklps|vbroadcast|vcvtph2ps|vcvtp2sph|verr|verw|vextractf128|vinsertf128|vmaskmov|vpermilpd|vpermilps|vperm2f128|vtestpd|vtestps|vzeroall|vzeroupper|wait|fwait|wbinvd|wrfsbase|wrgsbase|wrmsr|xadd|xchg|xgetbv|xlat|xlatb|xor|xorpd|xorps|xrstor|xsave|xsaveopt|xsetbv|lzcnt|extrq|insertq|movntsd|movntss|vfmaddpd|vfmaddps|vfmaddsd|vfmaddss|vfmaddsubbpd|vfmaddsubps|vfmsubaddpd|vfmsubaddps|vfmsubpd|vfmsubps|vfmsubsd|vfnmaddpd|vfnmaddps|vfnmaddsd|vfnmaddss|vfnmsubpd|vfnmusbps|vfnmusbsd|vfnmusbss|cvt|xor|cli|sti|hlt|nop|lock|wait|enter|leave|ret|loop(?:n?e|n?z)?|call|j(?:mp|n?e|ge?|ae?|le?|be?|n?o|n?z))\\b',
  9. caseInsensitive: true },
  10. { token: 'variable.parameter.register.assembly',
  11. regex: '\\b(?:CS|DS|ES|FS|GS|SS|RAX|EAX|RBX|EBX|RCX|ECX|RDX|EDX|RCX|RIP|EIP|IP|RSP|ESP|SP|RSI|ESI|SI|RDI|EDI|DI|RFLAGS|EFLAGS|FLAGS|R8-15|(?:Y|X)MM(?:[0-9]|10|11|12|13|14|15)|(?:A|B|C|D)(?:X|H|L)|CR(?:[0-4]|DR(?:[0-7]|TR6|TR7|EFER)))\\b',
  12. caseInsensitive: true },
  13. { token: 'constant.character.decimal.assembly',
  14. regex: '\\b[0-9]+\\b' },
  15. { token: 'constant.character.hexadecimal.assembly',
  16. regex: '\\b0x[A-F0-9]+\\b',
  17. caseInsensitive: true },
  18. { token: 'constant.character.hexadecimal.assembly',
  19. regex: '\\b[A-F0-9]+h\\b',
  20. caseInsensitive: true },
  21. { token: 'string.assembly', regex: /'([^\\']|\\.)*'/ },
  22. { token: 'string.assembly', regex: /"([^\\"]|\\.)*"/ },
  23. { token: 'support.function.directive.assembly',
  24. regex: '^\\[',
  25. push:
  26. [ { token: 'support.function.directive.assembly',
  27. regex: '\\]$',
  28. next: 'pop' },
  29. { defaultToken: 'support.function.directive.assembly' } ] },
  30. { token:
  31. [ 'support.function.directive.assembly',
  32. 'support.function.directive.assembly',
  33. 'entity.name.function.assembly' ],
  34. regex: '(^struc)( )([_a-zA-Z][_a-zA-Z0-9]*)' },
  35. { token: 'support.function.directive.assembly',
  36. regex: '^endstruc\\b' },
  37. { token:
  38. [ 'support.function.directive.assembly',
  39. 'entity.name.function.assembly',
  40. 'support.function.directive.assembly',
  41. 'constant.character.assembly' ],
  42. regex: '^(%macro )([_a-zA-Z][_a-zA-Z0-9]*)( )([0-9]+)' },
  43. { token: 'support.function.directive.assembly',
  44. regex: '^%endmacro' },
  45. { token:
  46. [ 'text',
  47. 'support.function.directive.assembly',
  48. 'text',
  49. 'entity.name.function.assembly' ],
  50. regex: '(\\s*)(%define|%xdefine|%idefine|%undef|%assign|%defstr|%strcat|%strlen|%substr|%00|%0|%rotate|%rep|%endrep|%include|\\$\\$|\\$|%unmacro|%if|%elif|%else|%endif|%(?:el)?ifdef|%(?:el)?ifmacro|%(?:el)?ifctx|%(?:el)?ifidn|%(?:el)?ifidni|%(?:el)?ifid|%(?:el)?ifnum|%(?:el)?ifstr|%(?:el)?iftoken|%(?:el)?ifempty|%(?:el)?ifenv|%pathsearch|%depend|%use|%push|%pop|%repl|%arg|%stacksize|%local|%error|%warning|%fatal|%line|%!|%comment|%endcomment|__NASM_VERSION_ID__|__NASM_VER__|__FILE__|__LINE__|__BITS__|__OUTPUT_FORMAT__|__DATE__|__TIME__|__DATE_NUM__|_TIME__NUM__|__UTC_DATE__|__UTC_TIME__|__UTC_DATE_NUM__|__UTC_TIME_NUM__|__POSIX_TIME__|__PASS__|ISTRUC|AT|IEND|BITS 16|BITS 32|BITS 64|USE16|USE32|__SECT__|ABSOLUTE|EXTERN|GLOBAL|COMMON|CPU|FLOAT)\\b( ?)((?:[_a-zA-Z][_a-zA-Z0-9]*)?)',
  51. caseInsensitive: true },
  52. { token: 'support.function.directive.assembly',
  53. regex: '\\b(?:d[bwdqtoy]|res[bwdqto]|equ|times|align|alignb|sectalign|section|ptr|byte|word|dword|qword|incbin)\\b',
  54. caseInsensitive: true },
  55. { token: 'entity.name.function.assembly', regex: '^\\s*%%[\\w.]+?:$' },
  56. { token: 'entity.name.function.assembly', regex: '^\\s*%\\$[\\w.]+?:$' },
  57. { token: 'entity.name.function.assembly', regex: '^[\\w.]+?:' },
  58. { token: 'entity.name.function.assembly', regex: '^[\\w.]+?\\b' },
  59. { token: 'comment.assembly', regex: ';.*$' } ]
  60. }
  61. this.normalizeRules();
  62. };
  63. AssemblyX86HighlightRules.metaData = { fileTypes: [ 'asm' ],
  64. name: 'Assembly x86',
  65. scopeName: 'source.assembly' }
  66. oop.inherits(AssemblyX86HighlightRules, TextHighlightRules);
  67. exports.AssemblyX86HighlightRules = AssemblyX86HighlightRules;
  68. });
  69. ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
  70. "use strict";
  71. var oop = require("../../lib/oop");
  72. var BaseFoldMode = require("./fold_mode").FoldMode;
  73. var Range = require("../../range").Range;
  74. var FoldMode = exports.FoldMode = function() {};
  75. oop.inherits(FoldMode, BaseFoldMode);
  76. (function() {
  77. this.getFoldWidgetRange = function(session, foldStyle, row) {
  78. var range = this.indentationBlock(session, row);
  79. if (range)
  80. return range;
  81. var re = /\S/;
  82. var line = session.getLine(row);
  83. var startLevel = line.search(re);
  84. if (startLevel == -1 || line[startLevel] != "#")
  85. return;
  86. var startColumn = line.length;
  87. var maxRow = session.getLength();
  88. var startRow = row;
  89. var endRow = row;
  90. while (++row < maxRow) {
  91. line = session.getLine(row);
  92. var level = line.search(re);
  93. if (level == -1)
  94. continue;
  95. if (line[level] != "#")
  96. break;
  97. endRow = row;
  98. }
  99. if (endRow > startRow) {
  100. var endColumn = session.getLine(endRow).length;
  101. return new Range(startRow, startColumn, endRow, endColumn);
  102. }
  103. };
  104. this.getFoldWidget = function(session, foldStyle, row) {
  105. var line = session.getLine(row);
  106. var indent = line.search(/\S/);
  107. var next = session.getLine(row + 1);
  108. var prev = session.getLine(row - 1);
  109. var prevIndent = prev.search(/\S/);
  110. var nextIndent = next.search(/\S/);
  111. if (indent == -1) {
  112. session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
  113. return "";
  114. }
  115. if (prevIndent == -1) {
  116. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  117. session.foldWidgets[row - 1] = "";
  118. session.foldWidgets[row + 1] = "";
  119. return "start";
  120. }
  121. } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  122. if (session.getLine(row - 2).search(/\S/) == -1) {
  123. session.foldWidgets[row - 1] = "start";
  124. session.foldWidgets[row + 1] = "";
  125. return "";
  126. }
  127. }
  128. if (prevIndent!= -1 && prevIndent < indent)
  129. session.foldWidgets[row - 1] = "start";
  130. else
  131. session.foldWidgets[row - 1] = "";
  132. if (indent < nextIndent)
  133. return "start";
  134. else
  135. return "";
  136. };
  137. }).call(FoldMode.prototype);
  138. });
  139. ace.define("ace/mode/assembly_x86",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/assembly_x86_highlight_rules","ace/mode/folding/coffee"], function(require, exports, module) {
  140. "use strict";
  141. var oop = require("../lib/oop");
  142. var TextMode = require("./text").Mode;
  143. var AssemblyX86HighlightRules = require("./assembly_x86_highlight_rules").AssemblyX86HighlightRules;
  144. var FoldMode = require("./folding/coffee").FoldMode;
  145. var Mode = function() {
  146. this.HighlightRules = AssemblyX86HighlightRules;
  147. this.foldingRules = new FoldMode();
  148. this.$behaviour = this.$defaultBehaviour;
  149. };
  150. oop.inherits(Mode, TextMode);
  151. (function() {
  152. this.lineCommentStart = ";";
  153. this.$id = "ace/mode/assembly_x86";
  154. }).call(Mode.prototype);
  155. exports.Mode = Mode;
  156. });