summaryrefslogtreecommitdiffstats
path: root/public/prism/prism-asm6502.min.js
blob: 57691cd8ecef135531c4872df26b323e225c351e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Prism.languages.asm6502 = {
  comment: /;.*/,
  directive: { pattern: /\.\w+(?= )/, alias: 'property' },
  string: /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/,
  'op-code': {
    pattern:
      /\b(?:ADC|AND|ASL|BCC|BCS|BEQ|BIT|BMI|BNE|BPL|BRK|BVC|BVS|CLC|CLD|CLI|CLV|CMP|CPX|CPY|DEC|DEX|DEY|EOR|INC|INX|INY|JMP|JSR|LDA|LDX|LDY|LSR|NOP|ORA|PHA|PHP|PLA|PLP|ROL|ROR|RTI|RTS|SBC|SEC|SED|SEI|STA|STX|STY|TAX|TAY|TSX|TXA|TXS|TYA|adc|and|asl|bcc|bcs|beq|bit|bmi|bne|bpl|brk|bvc|bvs|clc|cld|cli|clv|cmp|cpx|cpy|dec|dex|dey|eor|inc|inx|iny|jmp|jsr|lda|ldx|ldy|lsr|nop|ora|pha|php|pla|plp|rol|ror|rti|rts|sbc|sec|sed|sei|sta|stx|sty|tax|tay|tsx|txa|txs|tya)\b/,
    alias: 'keyword',
  },
  'hex-number': { pattern: /#?\$[\da-f]{1,4}\b/i, alias: 'number' },
  'binary-number': { pattern: /#?%[01]+\b/, alias: 'number' },
  'decimal-number': { pattern: /#?\b\d+\b/, alias: 'number' },
  register: { pattern: /\b[xya]\b/i, alias: 'variable' },
  punctuation: /[(),:]/,
};
ass="kd">var properties = '(?:' + tag.source + '(?:[ \t]+' + anchorOrAlias.source + ')?|' + anchorOrAlias.source + '(?:[ \t]+' + tag.source + ')?)'; // https://yaml.org/spec/1.2/spec.html#ns-plain(n,c) // This is a simplified version that doesn't support "#" and multiline keys // All these long scarry character classes are simplified versions of YAML's characters var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace( /<PLAIN>/g, function () { return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/ .source; } ); var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source; /** * * @param {string} value * @param {string} [flags] * @returns {RegExp} */ function createValuePattern(value, flags) { flags = (flags || '').replace(/m/g, '') + 'm'; // add m flag var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source .replace(/<<prop>>/g, function () { return properties; }) .replace(/<<value>>/g, function () { return value; }); return RegExp(pattern, flags); } Prism.languages.yaml = { scalar: { pattern: RegExp( /([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace( /<<prop>>/g, function () { return properties; } ) ), lookbehind: true, alias: 'string', }, comment: /#.*/, key: { pattern: RegExp( /((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source .replace(/<<prop>>/g, function () { return properties; }) .replace(/<<key>>/g, function () { return '(?:' + plainKey + '|' + string + ')'; }) ), lookbehind: true, greedy: true, alias: 'atrule', }, directive: { pattern: /(^[ \t]*)%.+/m, lookbehind: true, alias: 'important', }, datetime: { pattern: createValuePattern( /\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/ .source ), lookbehind: true, alias: 'number', }, boolean: { pattern: createValuePattern(/false|true/.source, 'i'), lookbehind: true, alias: 'important', }, null: { pattern: createValuePattern(/null|~/.source, 'i'), lookbehind: true, alias: 'important', }, string: { pattern: createValuePattern(string), lookbehind: true, greedy: true, }, number: { pattern: createValuePattern( /[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/ .source, 'i' ), lookbehind: true, }, tag: tag, important: anchorOrAlias, punctuation: /---|[:[\]{}\-,|>?]|\.\.\./, }; Prism.languages.yml = Prism.languages.yaml; })(Prism);