codes.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /**
  2. * Character codes.
  3. *
  4. * This module is compiled away!
  5. *
  6. * micromark works based on character codes.
  7. * This module contains constants for the ASCII block and the replacement
  8. * character.
  9. * A couple of them are handled in a special way, such as the line endings
  10. * (CR, LF, and CR+LF, commonly known as end-of-line: EOLs), the tab (horizontal
  11. * tab) and its expansion based on what column it’s at (virtual space),
  12. * and the end-of-file (eof) character.
  13. * As values are preprocessed before handling them, the actual characters LF,
  14. * CR, HT, and NUL (which is present as the replacement character), are
  15. * guaranteed to not exist.
  16. *
  17. * Unicode basic latin block.
  18. */
  19. export const codes = /** @type {const} */ ({
  20. carriageReturn: -5,
  21. lineFeed: -4,
  22. carriageReturnLineFeed: -3,
  23. horizontalTab: -2,
  24. virtualSpace: -1,
  25. eof: null,
  26. nul: 0,
  27. soh: 1,
  28. stx: 2,
  29. etx: 3,
  30. eot: 4,
  31. enq: 5,
  32. ack: 6,
  33. bel: 7,
  34. bs: 8,
  35. ht: 9, // `\t`
  36. lf: 10, // `\n`
  37. vt: 11, // `\v`
  38. ff: 12, // `\f`
  39. cr: 13, // `\r`
  40. so: 14,
  41. si: 15,
  42. dle: 16,
  43. dc1: 17,
  44. dc2: 18,
  45. dc3: 19,
  46. dc4: 20,
  47. nak: 21,
  48. syn: 22,
  49. etb: 23,
  50. can: 24,
  51. em: 25,
  52. sub: 26,
  53. esc: 27,
  54. fs: 28,
  55. gs: 29,
  56. rs: 30,
  57. us: 31,
  58. space: 32,
  59. exclamationMark: 33, // `!`
  60. quotationMark: 34, // `"`
  61. numberSign: 35, // `#`
  62. dollarSign: 36, // `$`
  63. percentSign: 37, // `%`
  64. ampersand: 38, // `&`
  65. apostrophe: 39, // `'`
  66. leftParenthesis: 40, // `(`
  67. rightParenthesis: 41, // `)`
  68. asterisk: 42, // `*`
  69. plusSign: 43, // `+`
  70. comma: 44, // `,`
  71. dash: 45, // `-`
  72. dot: 46, // `.`
  73. slash: 47, // `/`
  74. digit0: 48, // `0`
  75. digit1: 49, // `1`
  76. digit2: 50, // `2`
  77. digit3: 51, // `3`
  78. digit4: 52, // `4`
  79. digit5: 53, // `5`
  80. digit6: 54, // `6`
  81. digit7: 55, // `7`
  82. digit8: 56, // `8`
  83. digit9: 57, // `9`
  84. colon: 58, // `:`
  85. semicolon: 59, // `;`
  86. lessThan: 60, // `<`
  87. equalsTo: 61, // `=`
  88. greaterThan: 62, // `>`
  89. questionMark: 63, // `?`
  90. atSign: 64, // `@`
  91. uppercaseA: 65, // `A`
  92. uppercaseB: 66, // `B`
  93. uppercaseC: 67, // `C`
  94. uppercaseD: 68, // `D`
  95. uppercaseE: 69, // `E`
  96. uppercaseF: 70, // `F`
  97. uppercaseG: 71, // `G`
  98. uppercaseH: 72, // `H`
  99. uppercaseI: 73, // `I`
  100. uppercaseJ: 74, // `J`
  101. uppercaseK: 75, // `K`
  102. uppercaseL: 76, // `L`
  103. uppercaseM: 77, // `M`
  104. uppercaseN: 78, // `N`
  105. uppercaseO: 79, // `O`
  106. uppercaseP: 80, // `P`
  107. uppercaseQ: 81, // `Q`
  108. uppercaseR: 82, // `R`
  109. uppercaseS: 83, // `S`
  110. uppercaseT: 84, // `T`
  111. uppercaseU: 85, // `U`
  112. uppercaseV: 86, // `V`
  113. uppercaseW: 87, // `W`
  114. uppercaseX: 88, // `X`
  115. uppercaseY: 89, // `Y`
  116. uppercaseZ: 90, // `Z`
  117. leftSquareBracket: 91, // `[`
  118. backslash: 92, // `\`
  119. rightSquareBracket: 93, // `]`
  120. caret: 94, // `^`
  121. underscore: 95, // `_`
  122. graveAccent: 96, // `` ` ``
  123. lowercaseA: 97, // `a`
  124. lowercaseB: 98, // `b`
  125. lowercaseC: 99, // `c`
  126. lowercaseD: 100, // `d`
  127. lowercaseE: 101, // `e`
  128. lowercaseF: 102, // `f`
  129. lowercaseG: 103, // `g`
  130. lowercaseH: 104, // `h`
  131. lowercaseI: 105, // `i`
  132. lowercaseJ: 106, // `j`
  133. lowercaseK: 107, // `k`
  134. lowercaseL: 108, // `l`
  135. lowercaseM: 109, // `m`
  136. lowercaseN: 110, // `n`
  137. lowercaseO: 111, // `o`
  138. lowercaseP: 112, // `p`
  139. lowercaseQ: 113, // `q`
  140. lowercaseR: 114, // `r`
  141. lowercaseS: 115, // `s`
  142. lowercaseT: 116, // `t`
  143. lowercaseU: 117, // `u`
  144. lowercaseV: 118, // `v`
  145. lowercaseW: 119, // `w`
  146. lowercaseX: 120, // `x`
  147. lowercaseY: 121, // `y`
  148. lowercaseZ: 122, // `z`
  149. leftCurlyBrace: 123, // `{`
  150. verticalBar: 124, // `|`
  151. rightCurlyBrace: 125, // `}`
  152. tilde: 126, // `~`
  153. del: 127,
  154. // Unicode Specials block.
  155. byteOrderMarker: 65279,
  156. // Unicode Specials block.
  157. replacementCharacter: 65533 // `�`
  158. })