27 lines
1.2 KiB
JavaScript
27 lines
1.2 KiB
JavaScript
// "MSP430 Assembly" language definition for highlight.js authored by John Breaux, 2023-06-26
|
|
hljs.registerLanguage("msp430", function (r) {
|
|
return {
|
|
cI: !0,
|
|
l: "\\.?" + r.IR,
|
|
k: {
|
|
meta: ".byte .cseg .db .def .define .device .dseg .dw .endmacro .equ .eseg .exit .include .list .listmac .macro .nolist .org .set"
|
|
},
|
|
c: [
|
|
r.CBCM, // C block comments or C line comments
|
|
r.CLCM,
|
|
r.C(";", "$"), // Comments starting with ; and ending at EOL
|
|
{ cN: "built_in", b: /@?\b(pc|sp|sr|cg|r1[0-5]|r[0-9])\b\+?/ },
|
|
{ cN: "keyword", b: /\b(adc|addc?|and|bi[cs]|bitb?|br|call|clr[cnz]?|cmp|dad[cd]|decd?|[de]int|incd?|inv|j([cz]|eq|ge|hs|lo?|mp|n[cez]?)|mov|[np]op|push|reti?|r[lr][ac]|sbc|set[cnz]|subc?|swpb|sxt|tst|xor)(\.[bw])?\b/ },
|
|
{ cN: "string", b: /['"]/, e: /[^\\]['"]/, i: /[^\\][^'"]/ },
|
|
{ cN: "meta", b: "<", e: ">" }, // MSProbe/Microcorruption specific: jump/call targets are placed in <tags>
|
|
{ cN: "symbol", b: /^[A-Za-z0-9_.$]+:/ },
|
|
{ cN: "number", b: /\b[0-9a-fA-F]{4}\b/ },
|
|
{ cN: "number", b: /[#&]?-?\b(0o[0-7]+|(0x)?[0-9A-Fa-fx]+|\$[0-9A-Za-z]+)\b\(?/ },
|
|
r.CNM, // highlight.js standard number parsers
|
|
r.BNM,
|
|
r.QSM,
|
|
{ cN: "subst", b: "@[0-9]+" } // Accept numbers beginning with an @
|
|
]
|
|
}
|
|
});
|