@scinorandex/slex
Version:
No fuss lexer generator
17 lines • 743 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.initializeCharacter = void 0;
const initializeCharacter = (options) => {
const whitespace = options.whitespace || [" ", "\t", "\n", "\r"];
return {
isDigit: (ch) => ch >= "0" && ch <= "9",
isAlphabetic: (ch) => /^\p{L}+$/u.test(ch),
isAlphabeticUppercase: (ch) => /^\p{Lu}+$/u.test(ch),
isAlphabeticLowercase: (ch) => /^\p{Ll}+$/u.test(ch),
isControl: (ch) => /^\p{Cc}+$/u.test(ch),
isSymbolic: (ch) => /^\p{P}+$/u.test(ch) || /^\p{S}+$/u.test(ch),
isWhitespace: (ch) => whitespace.includes(ch),
};
};
exports.initializeCharacter = initializeCharacter;
//# sourceMappingURL=Character.js.map