summaryrefslogtreecommitdiffstats
path: root/scripts/invalid-code-points-regex.js
blob: 96518cf42897fae1207001eeff77e5fb62474d6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'use strict';

const regenerate = require('regenerate');

const invalidRawCodePoints = require('../data/invalid-raw-code-points.json');
const regexInvalidRawCodePoints = regenerate(invalidRawCodePoints)
	// https://html.spec.whatwg.org/multipage/#preprocessing-the-input-stream
	// “Any character that is a not a Unicode character, i.e. any isolated
	// surrogate, is a parse error.”
	.addRange(0xD800, 0xDBFF)
	.addRange(0xDC00, 0xDFFF)
	.toString();

module.exports = regexInvalidRawCodePoints;