/** * @name XML */ let nameStartChar = ":A-Z_a-z\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}", nameChar = nameStartChar + "\\-\\.0-9\u{B7}\u{0300}-\u{036F}\u{203F}-\u{2040}"; export let name = `[${nameStartChar}][${nameChar}]*`, properties = `(\\s+${name}\\s*(=\\s*([^"'>\\s][^>\\s]*|("|')(\\\\[^]|(?!\\4)[^])*\\4?)?)?)*\\s*`, /** @type {{ match: RegExp, sub: import('../index.js').ShjGrammar }} */ xmlElement = { match: RegExp(`<[\/!?]?${name}${properties}[\/!?]?>`, 'g'), sub: [ { type: 'var', match: RegExp(`^<[\/!?]?${name}`, 'g'), sub: [ { type: 'oper', match: /^<[\/!?]?/g } ] }, { type: 'str', match: /=\s*([^"'>\s][^>\s]*|("|')(\\[^]|(?!\2)[^])*\2?)/g, sub: [ { type: 'oper', match: /^=/g } ] }, { type: 'oper', match: /[\/!?]?>/g }, { type: 'class', match: RegExp(name, 'g') } ] }; export default /** @satisfies {import('../index.js').ShjGrammar} */ ([ { match: //g, type: 'cmnt', sub: 'todo' }, { type: 'class', match: //gi }, xmlElement, // https://github.com/speed-highlight/core/issues/49 { type: 'str', match: RegExp(`<\\?${name}([^?]|\\?[^?>])*\\?+>`, 'g'), sub: [ { type: 'var', match: RegExp(`^<\\?${name}`, 'g'), sub: [ { type: 'oper', match: /^<\?/g } ] }, { type: 'oper', match: /\?+>$/g } ] }, { type: 'var', match: /&(#x?)?[\da-z]{1,8};/gi } ]);