xast
Version:
AST parsing library
41 lines • 1.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isWhiteSpace = isWhiteSpace;
exports.isDigit = isDigit;
exports.isLetter = isLetter;
exports.isNameStart = isNameStart;
exports.isNameContinue = isNameContinue;
exports.isUnicodeScalarValue = isUnicodeScalarValue;
exports.isSupplementaryCodePoint = isSupplementaryCodePoint;
exports.isLeadingSurrogate = isLeadingSurrogate;
exports.isTrailingSurrogate = isTrailingSurrogate;
function isWhiteSpace(code) {
return code === 0x0009 || code === 0x0020;
}
function isDigit(code) {
return code >= 0x0030 && code <= 0x0039;
}
function isLetter(code) {
return ((code >= 0x0061 && code <= 0x007a) ||
(code >= 0x0041 && code <= 0x005a));
}
function isNameStart(code) {
return isLetter(code) || code === 0x005f;
}
function isNameContinue(code) {
return isLetter(code) || isDigit(code) || code === 0x005f;
}
function isUnicodeScalarValue(code) {
return ((code >= 0x0000 && code <= 0xd7ff) || (code >= 0xe000 && code <= 0x10ffff));
}
function isSupplementaryCodePoint(body, location) {
return (isLeadingSurrogate(body.charCodeAt(location)) &&
isTrailingSurrogate(body.charCodeAt(location + 1)));
}
function isLeadingSurrogate(code) {
return code >= 0xd800 && code <= 0xdbff;
}
function isTrailingSurrogate(code) {
return code >= 0xdc00 && code <= 0xdfff;
}
//# sourceMappingURL=characterClasses.js.map