UNPKG

highlightjs-snbt

Version:

Minecraft SNBT (Stringified NamedBinary Tags) highlighting for highlight.js

29 lines (28 loc) 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NUMERIC = void 0; const decimalDigits = "\\d[_\\d]*"; const binaryDigits = "[01][_01]*"; const hexDigits = "[\\da-fA-F][_\\da-fA-F]*"; const sci = `[eE](${decimalDigits})`; const frac = `\\.(${decimalDigits})`; const decimalPrefix = "[+-]?"; const binaryPrefix = "\\+?0b"; const hexPrefix = "\\+?0x"; const intSuffix = "[us]?[bsil]"; const floatSuffix = "[fd]"; exports.NUMERIC = { className: "number", variants: [ // definitely int { begin: `(${binaryPrefix}${binaryDigits}(?:${intSuffix})?)` }, { begin: `(${hexPrefix}${hexDigits}(?:${intSuffix})?)` }, { begin: `(${decimalPrefix}${decimalDigits}(?:${intSuffix}))` }, // definitely float { begin: `(${decimalPrefix}${decimalDigits}(?:${sci}|${frac})(?:${floatSuffix})?)` }, { begin: `(${decimalPrefix}${decimalDigits}(?:${floatSuffix}))` }, // others { begin: `(${decimalPrefix}${decimalDigits}(?:${intSuffix}|${floatSuffix})?)` }, ], relevance: 0, };