prism-nasm.js 793 B

123456789101112131415161718192021222324
  1. Prism.languages.nasm = {
  2. 'comment': /;.*$/m,
  3. 'string': /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/,
  4. 'label': {
  5. pattern: /(^\s*)[A-Za-z._?$][\w.?$@~#]*:/m,
  6. lookbehind: true,
  7. alias: 'function'
  8. },
  9. 'keyword': [
  10. /\[?BITS (?:16|32|64)\]?/,
  11. {
  12. pattern: /(^\s*)section\s*[a-z.]+:?/im,
  13. lookbehind: true
  14. },
  15. /(?:extern|global)[^;\r\n]*/i,
  16. /(?:CPU|DEFAULT|FLOAT).*$/m
  17. ],
  18. 'register': {
  19. pattern: /\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(?:bp|di|si|sp)|[cdefgs]s)\b/i,
  20. alias: 'variable'
  21. },
  22. 'number': /(?:\b|(?=\$))(?:0[hx](?:\.[\da-f]+|[\da-f]+(?:\.[\da-f]+)?)(?:p[+-]?\d+)?|\d[\da-f]+[hx]|\$\d[\da-f]*|0[oq][0-7]+|[0-7]+[oq]|0[by][01]+|[01]+[by]|0[dt]\d+|(?:\d+(?:\.\d+)?|\.\d+)(?:\.?e[+-]?\d+)?[dt]?)\b/i,
  23. 'operator': /[\[\]*+\-\/%<>=&|$!]/
  24. };