ed3.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. "use strict";
  2. /**
  3. * Character class utilities for XML NS 1.0 edition 3.
  4. *
  5. * @author Louis-Dominique Dubeau
  6. * @license MIT
  7. * @copyright Louis-Dominique Dubeau
  8. */
  9. Object.defineProperty(exports, "__esModule", { value: true });
  10. //
  11. // Fragments.
  12. //
  13. // tslint:disable-next-line:max-line-length
  14. exports.NC_NAME_START_CHAR = "A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\uD800\uDC00-\uDB7F\uDFFF";
  15. exports.NC_NAME_CHAR = "-" + exports.NC_NAME_START_CHAR + ".0-9\u00B7\u0300-\u036F\u203F-\u2040";
  16. //
  17. // Regular expressions.
  18. //
  19. exports.NC_NAME_START_CHAR_RE = new RegExp("^[" + exports.NC_NAME_START_CHAR + "]$", "u");
  20. exports.NC_NAME_CHAR_RE = new RegExp("^[" + exports.NC_NAME_CHAR + "]$", "u");
  21. exports.NC_NAME_RE = new RegExp("^[" + exports.NC_NAME_START_CHAR + "][" + exports.NC_NAME_CHAR + "]*$", "u");
  22. /**
  23. * Determines whether a codepoint matches [[NC_NAME_START_CHAR]].
  24. *
  25. * @param c The code point.
  26. *
  27. * @returns ``true`` if the codepoint matches.
  28. */
  29. // tslint:disable-next-line:cyclomatic-complexity
  30. function isNCNameStartChar(c) {
  31. return ((c >= 0x41 && c <= 0x5A) ||
  32. c === 0x5F ||
  33. (c >= 0x61 && c <= 0x7A) ||
  34. (c >= 0xC0 && c <= 0xD6) ||
  35. (c >= 0xD8 && c <= 0xF6) ||
  36. (c >= 0x00F8 && c <= 0x02FF) ||
  37. (c >= 0x0370 && c <= 0x037D) ||
  38. (c >= 0x037F && c <= 0x1FFF) ||
  39. (c >= 0x200C && c <= 0x200D) ||
  40. (c >= 0x2070 && c <= 0x218F) ||
  41. (c >= 0x2C00 && c <= 0x2FEF) ||
  42. (c >= 0x3001 && c <= 0xD7FF) ||
  43. (c >= 0xF900 && c <= 0xFDCF) ||
  44. (c >= 0xFDF0 && c <= 0xFFFD) ||
  45. (c >= 0x10000 && c <= 0xEFFFF));
  46. }
  47. exports.isNCNameStartChar = isNCNameStartChar;
  48. /**
  49. * Determines whether a codepoint matches [[NC_NAME_CHAR]].
  50. *
  51. * @param c The code point.
  52. *
  53. * @returns ``true`` if the codepoint matches.
  54. */
  55. function isNCNameChar(c) {
  56. return isNCNameStartChar(c) ||
  57. (c === 0x2D ||
  58. c === 0x2E ||
  59. (c >= 0x30 && c <= 0x39) ||
  60. c === 0x00B7 ||
  61. (c >= 0x0300 && c <= 0x036F) ||
  62. (c >= 0x203F && c <= 0x2040));
  63. }
  64. exports.isNCNameChar = isNCNameChar;
  65. //# sourceMappingURL=ed3.js.map