You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.6 KiB

  1. /**
  2. * Character classes and associated utilities for the 2nd edition of XML 1.1.
  3. *
  4. * @author Louis-Dominique Dubeau
  5. * @license MIT
  6. * @copyright Louis-Dominique Dubeau
  7. */
  8. export declare const CHAR = "\u0001-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF";
  9. export declare const RESTRICTED_CHAR = "\u0001-\b\v\f\u000E-\u001F-\u0084\u0086-\u009F";
  10. export declare const S = " \t\r\n";
  11. export declare const 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";
  12. export declare const NAME_CHAR: string;
  13. export declare const CHAR_RE: RegExp;
  14. export declare const RESTRICTED_CHAR_RE: RegExp;
  15. export declare const S_RE: RegExp;
  16. export declare const NAME_START_CHAR_RE: RegExp;
  17. export declare const NAME_CHAR_RE: RegExp;
  18. export declare const NAME_RE: RegExp;
  19. export declare const NMTOKEN_RE: RegExp;
  20. /** All characters in the ``S`` production. */
  21. export declare const S_LIST: number[];
  22. /**
  23. * Determines whether a codepoint matches the ``CHAR`` production.
  24. *
  25. * @param c The code point.
  26. *
  27. * @returns ``true`` if the codepoint matches ``CHAR``.
  28. */
  29. export declare function isChar(c: number): boolean;
  30. /**
  31. * Determines whether a codepoint matches the ``RESTRICTED_CHAR`` production.
  32. *
  33. * @param c The code point.
  34. *
  35. * @returns ``true`` if the codepoint matches ``RESTRICTED_CHAR``.
  36. */
  37. export declare function isRestrictedChar(c: number): boolean;
  38. /**
  39. * Determines whether a codepoint matches the ``CHAR`` production and does not
  40. * match the ``RESTRICTED_CHAR`` production. ``isCharAndNotRestricted(x)`` is
  41. * equivalent to ``isChar(x) && !isRestrictedChar(x)``. This function is faster
  42. * than running the two-call equivalent.
  43. *
  44. * @param c The code point.
  45. *
  46. * @returns ``true`` if the codepoint matches ``CHAR`` and does not match
  47. * ``RESTRICTED_CHAR``.
  48. */
  49. export declare function isCharAndNotRestricted(c: number): boolean;
  50. /**
  51. * Determines whether a codepoint matches the ``S`` (space) production.
  52. *
  53. * @param c The code point.
  54. *
  55. * @returns ``true`` if the codepoint matches ``S``.
  56. */
  57. export declare function isS(c: number): boolean;
  58. /**
  59. * Determines whether a codepoint matches the ``NAME_START_CHAR`` production.
  60. *
  61. * @param c The code point.
  62. *
  63. * @returns ``true`` if the codepoint matches ``NAME_START_CHAR``.
  64. */
  65. export declare function isNameStartChar(c: number): boolean;
  66. /**
  67. * Determines whether a codepoint matches the ``NAME_CHAR`` production.
  68. *
  69. * @param c The code point.
  70. *
  71. * @returns ``true`` if the codepoint matches ``NAME_CHAR``.
  72. */
  73. export declare function isNameChar(c: number): boolean;