@noldova/context.parsers.regex 0.0.0-stage → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/LICENSE +21 -0
  2. package/api/index.d.ts +1752 -0
  3. package/api/index.js +78 -0
  4. package/api/index.js.map +1 -0
  5. package/extensions/nodes/assertions/regex-end-assertion.node.extensions.js +12 -0
  6. package/extensions/nodes/assertions/regex-end-assertion.node.extensions.js.map +1 -0
  7. package/extensions/nodes/assertions/regex-non-word-boundary-assertion.node.extensions.js +12 -0
  8. package/extensions/nodes/assertions/regex-non-word-boundary-assertion.node.extensions.js.map +1 -0
  9. package/extensions/nodes/assertions/regex-start-assertion.node.extensions.js +12 -0
  10. package/extensions/nodes/assertions/regex-start-assertion.node.extensions.js.map +1 -0
  11. package/extensions/nodes/assertions/regex-word-boundary-assertion.node.extensions.js +12 -0
  12. package/extensions/nodes/assertions/regex-word-boundary-assertion.node.extensions.js.map +1 -0
  13. package/extensions/nodes/classes/regex-character-class.node.extensions.js +12 -0
  14. package/extensions/nodes/classes/regex-character-class.node.extensions.js.map +1 -0
  15. package/extensions/nodes/classes/regex-class-intersection.node.extensions.js +12 -0
  16. package/extensions/nodes/classes/regex-class-intersection.node.extensions.js.map +1 -0
  17. package/extensions/nodes/classes/regex-class-string-disjunction.node.extensions.js +12 -0
  18. package/extensions/nodes/classes/regex-class-string-disjunction.node.extensions.js.map +1 -0
  19. package/extensions/nodes/classes/regex-class-subtraction.node.extensions.js +12 -0
  20. package/extensions/nodes/classes/regex-class-subtraction.node.extensions.js.map +1 -0
  21. package/extensions/nodes/classes/regex-class-union.node.extensions.js +12 -0
  22. package/extensions/nodes/classes/regex-class-union.node.extensions.js.map +1 -0
  23. package/extensions/nodes/escapes/regex-backspace-escape.node.extensions.js +13 -0
  24. package/extensions/nodes/escapes/regex-backspace-escape.node.extensions.js.map +1 -0
  25. package/extensions/nodes/escapes/regex-carriage-return-escape.node.extensions.js +13 -0
  26. package/extensions/nodes/escapes/regex-carriage-return-escape.node.extensions.js.map +1 -0
  27. package/extensions/nodes/escapes/regex-class-control-escape.node.extensions.js +12 -0
  28. package/extensions/nodes/escapes/regex-class-control-escape.node.extensions.js.map +1 -0
  29. package/extensions/nodes/escapes/regex-control-letter-escape.node.extensions.js +12 -0
  30. package/extensions/nodes/escapes/regex-control-letter-escape.node.extensions.js.map +1 -0
  31. package/extensions/nodes/escapes/regex-form-feed-escape.node.extensions.js +13 -0
  32. package/extensions/nodes/escapes/regex-form-feed-escape.node.extensions.js.map +1 -0
  33. package/extensions/nodes/escapes/regex-hex-escape.node.extensions.js +12 -0
  34. package/extensions/nodes/escapes/regex-hex-escape.node.extensions.js.map +1 -0
  35. package/extensions/nodes/escapes/regex-identity-escape.node.extensions.js +12 -0
  36. package/extensions/nodes/escapes/regex-identity-escape.node.extensions.js.map +1 -0
  37. package/extensions/nodes/escapes/regex-legacy-octal-escape.node.extensions.js +12 -0
  38. package/extensions/nodes/escapes/regex-legacy-octal-escape.node.extensions.js.map +1 -0
  39. package/extensions/nodes/escapes/regex-newline-escape.node.extensions.js +13 -0
  40. package/extensions/nodes/escapes/regex-newline-escape.node.extensions.js.map +1 -0
  41. package/extensions/nodes/escapes/regex-null-escape.node.extensions.js +13 -0
  42. package/extensions/nodes/escapes/regex-null-escape.node.extensions.js.map +1 -0
  43. package/extensions/nodes/escapes/regex-tab-escape.node.extensions.js +13 -0
  44. package/extensions/nodes/escapes/regex-tab-escape.node.extensions.js.map +1 -0
  45. package/extensions/nodes/escapes/regex-unicode-escape.node.extensions.js +12 -0
  46. package/extensions/nodes/escapes/regex-unicode-escape.node.extensions.js.map +1 -0
  47. package/extensions/nodes/escapes/regex-unicode-property-escape.node.extensions.js +12 -0
  48. package/extensions/nodes/escapes/regex-unicode-property-escape.node.extensions.js.map +1 -0
  49. package/extensions/nodes/escapes/regex-vertical-tab-escape.node.extensions.js +13 -0
  50. package/extensions/nodes/escapes/regex-vertical-tab-escape.node.extensions.js.map +1 -0
  51. package/extensions/nodes/node.extensions.js +78 -0
  52. package/extensions/nodes/node.extensions.js.map +1 -0
  53. package/extensions/nodes/punctuators/regex-ampersand-ampersand.node.extensions.js +21 -0
  54. package/extensions/nodes/punctuators/regex-ampersand-ampersand.node.extensions.js.map +1 -0
  55. package/extensions/nodes/punctuators/regex-asterisk.node.extensions.js +16 -0
  56. package/extensions/nodes/punctuators/regex-asterisk.node.extensions.js.map +1 -0
  57. package/extensions/nodes/punctuators/regex-bar.node.extensions.js +12 -0
  58. package/extensions/nodes/punctuators/regex-bar.node.extensions.js.map +1 -0
  59. package/extensions/nodes/punctuators/regex-close-brace.node.extensions.js +16 -0
  60. package/extensions/nodes/punctuators/regex-close-brace.node.extensions.js.map +1 -0
  61. package/extensions/nodes/punctuators/regex-close-bracket.node.extensions.js +16 -0
  62. package/extensions/nodes/punctuators/regex-close-bracket.node.extensions.js.map +1 -0
  63. package/extensions/nodes/punctuators/regex-close-parenthesis.node.extensions.js +12 -0
  64. package/extensions/nodes/punctuators/regex-close-parenthesis.node.extensions.js.map +1 -0
  65. package/extensions/nodes/punctuators/regex-colon.node.extensions.js +14 -0
  66. package/extensions/nodes/punctuators/regex-colon.node.extensions.js.map +1 -0
  67. package/extensions/nodes/punctuators/regex-comma.node.extensions.js +14 -0
  68. package/extensions/nodes/punctuators/regex-comma.node.extensions.js.map +1 -0
  69. package/extensions/nodes/punctuators/regex-equals.node.extensions.js +14 -0
  70. package/extensions/nodes/punctuators/regex-equals.node.extensions.js.map +1 -0
  71. package/extensions/nodes/punctuators/regex-exclamation.node.extensions.js +14 -0
  72. package/extensions/nodes/punctuators/regex-exclamation.node.extensions.js.map +1 -0
  73. package/extensions/nodes/punctuators/regex-greater-than.node.extensions.js +14 -0
  74. package/extensions/nodes/punctuators/regex-greater-than.node.extensions.js.map +1 -0
  75. package/extensions/nodes/punctuators/regex-hyphen-hyphen.node.extensions.js +21 -0
  76. package/extensions/nodes/punctuators/regex-hyphen-hyphen.node.extensions.js.map +1 -0
  77. package/extensions/nodes/punctuators/regex-hyphen.node.extensions.js +18 -0
  78. package/extensions/nodes/punctuators/regex-hyphen.node.extensions.js.map +1 -0
  79. package/extensions/nodes/punctuators/regex-less-than.node.extensions.js +14 -0
  80. package/extensions/nodes/punctuators/regex-less-than.node.extensions.js.map +1 -0
  81. package/extensions/nodes/punctuators/regex-open-brace.node.extensions.js +16 -0
  82. package/extensions/nodes/punctuators/regex-open-brace.node.extensions.js.map +1 -0
  83. package/extensions/nodes/punctuators/regex-open-bracket.node.extensions.js +12 -0
  84. package/extensions/nodes/punctuators/regex-open-bracket.node.extensions.js.map +1 -0
  85. package/extensions/nodes/punctuators/regex-open-parenthesis.node.extensions.js +12 -0
  86. package/extensions/nodes/punctuators/regex-open-parenthesis.node.extensions.js.map +1 -0
  87. package/extensions/nodes/punctuators/regex-plus.node.extensions.js +16 -0
  88. package/extensions/nodes/punctuators/regex-plus.node.extensions.js.map +1 -0
  89. package/extensions/nodes/punctuators/regex-question.node.extensions.js +19 -0
  90. package/extensions/nodes/punctuators/regex-question.node.extensions.js.map +1 -0
  91. package/extensions/nodes/regex-character.node.extensions.js +12 -0
  92. package/extensions/nodes/regex-character.node.extensions.js.map +1 -0
  93. package/models/diagnostics/regex-diagnostic-templates.js +53 -0
  94. package/models/diagnostics/regex-diagnostic-templates.js.map +1 -0
  95. package/models/nodes/assertions/regex-end-assertion.node.js +15 -0
  96. package/models/nodes/assertions/regex-end-assertion.node.js.map +1 -0
  97. package/models/nodes/assertions/regex-lookahead-assertion.node.js +18 -0
  98. package/models/nodes/assertions/regex-lookahead-assertion.node.js.map +1 -0
  99. package/models/nodes/assertions/regex-lookbehind-assertion.node.js +18 -0
  100. package/models/nodes/assertions/regex-lookbehind-assertion.node.js.map +1 -0
  101. package/models/nodes/assertions/regex-non-word-boundary-assertion.node.js +15 -0
  102. package/models/nodes/assertions/regex-non-word-boundary-assertion.node.js.map +1 -0
  103. package/models/nodes/assertions/regex-start-assertion.node.js +15 -0
  104. package/models/nodes/assertions/regex-start-assertion.node.js.map +1 -0
  105. package/models/nodes/assertions/regex-word-boundary-assertion.node.js +15 -0
  106. package/models/nodes/assertions/regex-word-boundary-assertion.node.js.map +1 -0
  107. package/models/nodes/classes/regex-character-class.node.js +20 -0
  108. package/models/nodes/classes/regex-character-class.node.js.map +1 -0
  109. package/models/nodes/classes/regex-character-range.node.js +18 -0
  110. package/models/nodes/classes/regex-character-range.node.js.map +1 -0
  111. package/models/nodes/classes/regex-class-intersection.node.js +17 -0
  112. package/models/nodes/classes/regex-class-intersection.node.js.map +1 -0
  113. package/models/nodes/classes/regex-class-string-disjunction.node.js +19 -0
  114. package/models/nodes/classes/regex-class-string-disjunction.node.js.map +1 -0
  115. package/models/nodes/classes/regex-class-string.node.js +14 -0
  116. package/models/nodes/classes/regex-class-string.node.js.map +1 -0
  117. package/models/nodes/classes/regex-class-subtraction.node.js +17 -0
  118. package/models/nodes/classes/regex-class-subtraction.node.js.map +1 -0
  119. package/models/nodes/classes/regex-class-union.node.js +14 -0
  120. package/models/nodes/classes/regex-class-union.node.js.map +1 -0
  121. package/models/nodes/escapes/regex-backreference.node.js +16 -0
  122. package/models/nodes/escapes/regex-backreference.node.js.map +1 -0
  123. package/models/nodes/escapes/regex-backspace-escape.node.js +15 -0
  124. package/models/nodes/escapes/regex-backspace-escape.node.js.map +1 -0
  125. package/models/nodes/escapes/regex-carriage-return-escape.node.js +15 -0
  126. package/models/nodes/escapes/regex-carriage-return-escape.node.js.map +1 -0
  127. package/models/nodes/escapes/regex-class-control-escape.node.js +16 -0
  128. package/models/nodes/escapes/regex-class-control-escape.node.js.map +1 -0
  129. package/models/nodes/escapes/regex-control-letter-escape.node.js +16 -0
  130. package/models/nodes/escapes/regex-control-letter-escape.node.js.map +1 -0
  131. package/models/nodes/escapes/regex-decimal-escape.node.js +16 -0
  132. package/models/nodes/escapes/regex-decimal-escape.node.js.map +1 -0
  133. package/models/nodes/escapes/regex-digit-escape.node.js +15 -0
  134. package/models/nodes/escapes/regex-digit-escape.node.js.map +1 -0
  135. package/models/nodes/escapes/regex-form-feed-escape.node.js +15 -0
  136. package/models/nodes/escapes/regex-form-feed-escape.node.js.map +1 -0
  137. package/models/nodes/escapes/regex-hex-escape.node.js +16 -0
  138. package/models/nodes/escapes/regex-hex-escape.node.js.map +1 -0
  139. package/models/nodes/escapes/regex-identity-escape.node.js +16 -0
  140. package/models/nodes/escapes/regex-identity-escape.node.js.map +1 -0
  141. package/models/nodes/escapes/regex-legacy-octal-escape.node.js +16 -0
  142. package/models/nodes/escapes/regex-legacy-octal-escape.node.js.map +1 -0
  143. package/models/nodes/escapes/regex-named-backreference.node.js +16 -0
  144. package/models/nodes/escapes/regex-named-backreference.node.js.map +1 -0
  145. package/models/nodes/escapes/regex-newline-escape.node.js +15 -0
  146. package/models/nodes/escapes/regex-newline-escape.node.js.map +1 -0
  147. package/models/nodes/escapes/regex-non-digit-escape.node.js +15 -0
  148. package/models/nodes/escapes/regex-non-digit-escape.node.js.map +1 -0
  149. package/models/nodes/escapes/regex-non-whitespace-escape.node.js +15 -0
  150. package/models/nodes/escapes/regex-non-whitespace-escape.node.js.map +1 -0
  151. package/models/nodes/escapes/regex-non-word-escape.node.js +15 -0
  152. package/models/nodes/escapes/regex-non-word-escape.node.js.map +1 -0
  153. package/models/nodes/escapes/regex-null-escape.node.js +15 -0
  154. package/models/nodes/escapes/regex-null-escape.node.js.map +1 -0
  155. package/models/nodes/escapes/regex-tab-escape.node.js +15 -0
  156. package/models/nodes/escapes/regex-tab-escape.node.js.map +1 -0
  157. package/models/nodes/escapes/regex-unicode-escape.node.js +16 -0
  158. package/models/nodes/escapes/regex-unicode-escape.node.js.map +1 -0
  159. package/models/nodes/escapes/regex-unicode-property-escape.node.js +22 -0
  160. package/models/nodes/escapes/regex-unicode-property-escape.node.js.map +1 -0
  161. package/models/nodes/escapes/regex-vertical-tab-escape.node.js +15 -0
  162. package/models/nodes/escapes/regex-vertical-tab-escape.node.js.map +1 -0
  163. package/models/nodes/escapes/regex-whitespace-escape.node.js +15 -0
  164. package/models/nodes/escapes/regex-whitespace-escape.node.js.map +1 -0
  165. package/models/nodes/escapes/regex-word-escape.node.js +15 -0
  166. package/models/nodes/escapes/regex-word-escape.node.js.map +1 -0
  167. package/models/nodes/groups/regex-capturing-group.node.js +18 -0
  168. package/models/nodes/groups/regex-capturing-group.node.js.map +1 -0
  169. package/models/nodes/groups/regex-modifier-group.node.js +20 -0
  170. package/models/nodes/groups/regex-modifier-group.node.js.map +1 -0
  171. package/models/nodes/groups/regex-named-capturing-group.node.js +20 -0
  172. package/models/nodes/groups/regex-named-capturing-group.node.js.map +1 -0
  173. package/models/nodes/groups/regex-non-capturing-group.node.js +16 -0
  174. package/models/nodes/groups/regex-non-capturing-group.node.js.map +1 -0
  175. package/models/nodes/punctuators/regex-ampersand-ampersand.node.js +15 -0
  176. package/models/nodes/punctuators/regex-ampersand-ampersand.node.js.map +1 -0
  177. package/models/nodes/punctuators/regex-asterisk.node.js +15 -0
  178. package/models/nodes/punctuators/regex-asterisk.node.js.map +1 -0
  179. package/models/nodes/punctuators/regex-bar.node.js +15 -0
  180. package/models/nodes/punctuators/regex-bar.node.js.map +1 -0
  181. package/models/nodes/punctuators/regex-class-string-disjunction-start.node.js +15 -0
  182. package/models/nodes/punctuators/regex-class-string-disjunction-start.node.js.map +1 -0
  183. package/models/nodes/punctuators/regex-close-brace.node.js +15 -0
  184. package/models/nodes/punctuators/regex-close-brace.node.js.map +1 -0
  185. package/models/nodes/punctuators/regex-close-bracket.node.js +15 -0
  186. package/models/nodes/punctuators/regex-close-bracket.node.js.map +1 -0
  187. package/models/nodes/punctuators/regex-close-parenthesis.node.js +15 -0
  188. package/models/nodes/punctuators/regex-close-parenthesis.node.js.map +1 -0
  189. package/models/nodes/punctuators/regex-colon.node.js +15 -0
  190. package/models/nodes/punctuators/regex-colon.node.js.map +1 -0
  191. package/models/nodes/punctuators/regex-comma.node.js +15 -0
  192. package/models/nodes/punctuators/regex-comma.node.js.map +1 -0
  193. package/models/nodes/punctuators/regex-equals.node.js +15 -0
  194. package/models/nodes/punctuators/regex-equals.node.js.map +1 -0
  195. package/models/nodes/punctuators/regex-exclamation.node.js +15 -0
  196. package/models/nodes/punctuators/regex-exclamation.node.js.map +1 -0
  197. package/models/nodes/punctuators/regex-greater-than.node.js +15 -0
  198. package/models/nodes/punctuators/regex-greater-than.node.js.map +1 -0
  199. package/models/nodes/punctuators/regex-hyphen-hyphen.node.js +15 -0
  200. package/models/nodes/punctuators/regex-hyphen-hyphen.node.js.map +1 -0
  201. package/models/nodes/punctuators/regex-hyphen.node.js +15 -0
  202. package/models/nodes/punctuators/regex-hyphen.node.js.map +1 -0
  203. package/models/nodes/punctuators/regex-less-than.node.js +15 -0
  204. package/models/nodes/punctuators/regex-less-than.node.js.map +1 -0
  205. package/models/nodes/punctuators/regex-open-brace.node.js +15 -0
  206. package/models/nodes/punctuators/regex-open-brace.node.js.map +1 -0
  207. package/models/nodes/punctuators/regex-open-bracket.node.js +15 -0
  208. package/models/nodes/punctuators/regex-open-bracket.node.js.map +1 -0
  209. package/models/nodes/punctuators/regex-open-parenthesis.node.js +15 -0
  210. package/models/nodes/punctuators/regex-open-parenthesis.node.js.map +1 -0
  211. package/models/nodes/punctuators/regex-plus.node.js +15 -0
  212. package/models/nodes/punctuators/regex-plus.node.js.map +1 -0
  213. package/models/nodes/punctuators/regex-question.node.js +15 -0
  214. package/models/nodes/punctuators/regex-question.node.js.map +1 -0
  215. package/models/nodes/regex-alternative.node.js +14 -0
  216. package/models/nodes/regex-alternative.node.js.map +1 -0
  217. package/models/nodes/regex-character.node.js +14 -0
  218. package/models/nodes/regex-character.node.js.map +1 -0
  219. package/models/nodes/regex-disjunction.node.js +17 -0
  220. package/models/nodes/regex-disjunction.node.js.map +1 -0
  221. package/models/nodes/regex-dot.node.js +15 -0
  222. package/models/nodes/regex-dot.node.js.map +1 -0
  223. package/models/nodes/regex-flags.node.js +31 -0
  224. package/models/nodes/regex-flags.node.js.map +1 -0
  225. package/models/nodes/regex-pattern.node.js +18 -0
  226. package/models/nodes/regex-pattern.node.js.map +1 -0
  227. package/models/nodes/regex-quantifier.node.js +20 -0
  228. package/models/nodes/regex-quantifier.node.js.map +1 -0
  229. package/models/nodes/regex-unknown.node.js +14 -0
  230. package/models/nodes/regex-unknown.node.js.map +1 -0
  231. package/models/nodes/regex.node.js +20 -0
  232. package/models/nodes/regex.node.js.map +1 -0
  233. package/models/regex-alternative-branch.js +16 -0
  234. package/models/regex-alternative-branch.js.map +1 -0
  235. package/models/regex-capturing-group-summary.js +16 -0
  236. package/models/regex-capturing-group-summary.js.map +1 -0
  237. package/models/regex-group-name.js +16 -0
  238. package/models/regex-group-name.js.map +1 -0
  239. package/models/regex-named-group-branch.js +12 -0
  240. package/models/regex-named-group-branch.js.map +1 -0
  241. package/models/regex-parser-context.js +41 -0
  242. package/models/regex-parser-context.js.map +1 -0
  243. package/models/regex-unicode-escape-value.js +16 -0
  244. package/models/regex-unicode-escape-value.js.map +1 -0
  245. package/package.json +26 -4
  246. package/resources.js +112 -0
  247. package/resources.js.map +1 -0
  248. package/services/lexers/character.lexer.js +24 -0
  249. package/services/lexers/character.lexer.js.map +1 -0
  250. package/services/lexers/code-point-escape.lexer.js +56 -0
  251. package/services/lexers/code-point-escape.lexer.js.map +1 -0
  252. package/services/lexers/control-escape.lexer.js +40 -0
  253. package/services/lexers/control-escape.lexer.js.map +1 -0
  254. package/services/lexers/escape.lexer.js +130 -0
  255. package/services/lexers/escape.lexer.js.map +1 -0
  256. package/services/lexers/named-backreference.lexer.js +48 -0
  257. package/services/lexers/named-backreference.lexer.js.map +1 -0
  258. package/services/lexers/numeric-escape.lexer.js +87 -0
  259. package/services/lexers/numeric-escape.lexer.js.map +1 -0
  260. package/services/lexers/regex.lexer.js +200 -0
  261. package/services/lexers/regex.lexer.js.map +1 -0
  262. package/services/lexers/unicode-property-escape.lexer.js +59 -0
  263. package/services/lexers/unicode-property-escape.lexer.js.map +1 -0
  264. package/services/parsers/regex-alternative.parser.js +27 -0
  265. package/services/parsers/regex-alternative.parser.js.map +1 -0
  266. package/services/parsers/regex-assertion.parser.js +38 -0
  267. package/services/parsers/regex-assertion.parser.js.map +1 -0
  268. package/services/parsers/regex-capturing-group.parser.js +24 -0
  269. package/services/parsers/regex-capturing-group.parser.js.map +1 -0
  270. package/services/parsers/regex-character-class.parser.js +107 -0
  271. package/services/parsers/regex-character-class.parser.js.map +1 -0
  272. package/services/parsers/regex-class-set-expression.parser.js +114 -0
  273. package/services/parsers/regex-class-set-expression.parser.js.map +1 -0
  274. package/services/parsers/regex-class-string-disjunction.parser.js +57 -0
  275. package/services/parsers/regex-class-string-disjunction.parser.js.map +1 -0
  276. package/services/parsers/regex-disjunction.parser.js +33 -0
  277. package/services/parsers/regex-disjunction.parser.js.map +1 -0
  278. package/services/parsers/regex-group-end.parser.js +25 -0
  279. package/services/parsers/regex-group-end.parser.js.map +1 -0
  280. package/services/parsers/regex-group.parser.js +91 -0
  281. package/services/parsers/regex-group.parser.js.map +1 -0
  282. package/services/parsers/regex-lookaround.parser.js +35 -0
  283. package/services/parsers/regex-lookaround.parser.js.map +1 -0
  284. package/services/parsers/regex-modifier-group.parser.js +78 -0
  285. package/services/parsers/regex-modifier-group.parser.js.map +1 -0
  286. package/services/parsers/regex-named-capturing-group.parser.js +60 -0
  287. package/services/parsers/regex-named-capturing-group.parser.js.map +1 -0
  288. package/services/parsers/regex-non-capturing-group.parser.js +24 -0
  289. package/services/parsers/regex-non-capturing-group.parser.js.map +1 -0
  290. package/services/parsers/regex-pattern.parser.js +23 -0
  291. package/services/parsers/regex-pattern.parser.js.map +1 -0
  292. package/services/parsers/regex-quantifier.parser.js +85 -0
  293. package/services/parsers/regex-quantifier.parser.js.map +1 -0
  294. package/services/parsers/regex-term.parser.js +50 -0
  295. package/services/parsers/regex-term.parser.js.map +1 -0
  296. package/services/readers/regex-capturing-group-summary.reader.js +56 -0
  297. package/services/readers/regex-capturing-group-summary.reader.js.map +1 -0
  298. package/services/readers/regex-group-name.reader.js +44 -0
  299. package/services/readers/regex-group-name.reader.js.map +1 -0
  300. package/services/readers/regex-unicode-escape.reader.js +72 -0
  301. package/services/readers/regex-unicode-escape.reader.js.map +1 -0
  302. package/services/regex-named-group-registry.js +48 -0
  303. package/services/regex-named-group-registry.js.map +1 -0
  304. package/services/regex-syntax.parser.js +73 -0
  305. package/services/regex-syntax.parser.js.map +1 -0
  306. package/services/regex.parser.js +39 -0
  307. package/services/regex.parser.js.map +1 -0
  308. package/services/unicode/regex-unicode-property-catalog.js +118 -0
  309. package/services/unicode/regex-unicode-property-catalog.js.map +1 -0
  310. package/services/validators/regex-character-range.validator.js +22 -0
  311. package/services/validators/regex-character-range.validator.js.map +1 -0
  312. package/services/validators/regex-class-set-character.validator.js +30 -0
  313. package/services/validators/regex-class-set-character.validator.js.map +1 -0
  314. package/services/validators/regex-flag.validator.js +36 -0
  315. package/services/validators/regex-flag.validator.js.map +1 -0
  316. package/services/validators/regex-group-name.validator.js +17 -0
  317. package/services/validators/regex-group-name.validator.js.map +1 -0
  318. package/services/validators/regex-identity-escape.validator.js +25 -0
  319. package/services/validators/regex-identity-escape.validator.js.map +1 -0
  320. package/README.md +0 -3
package/api/index.d.ts ADDED
@@ -0,0 +1,1752 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ import type { CompositeNode, Node, ParserResult, Source, SourceReader, SourceSpan, ValueNode } from "@noldova/context.parsers";
10
+
11
+ /**
12
+ * The end assertion represented by `$`.
13
+ */
14
+ export declare class RegexEndAssertionNode extends ValueNode {
15
+ /**
16
+ * Creates the end assertion at its exact source span.
17
+ *
18
+ * @param span The absolute UTF-16 source span of the assertion.
19
+ *
20
+ * @see {@link RegexStartAssertionNode} for usage and {@link RegexNode} for shared node-construction contracts.
21
+ */
22
+ public constructor(span: SourceSpan);
23
+ }
24
+
25
+ /**
26
+ * A positive or negative lookahead assertion.
27
+ *
28
+ * @example Lookarounds have a disjunction and polarity, but allocate no capture index themselves.
29
+ * ```ts
30
+ * import { RegexLookaheadAssertionNode, RegexLookbehindAssertionNode, RegexParser } from "@noldova/context.parsers.regex";
31
+ *
32
+ * const nodes = new RegexParser("(?=a)(?<!b)").parse().rootNode.patternNode.disjunctionNode.children[0].children;
33
+ * const ahead = nodes[0];
34
+ * const behind = nodes[1];
35
+ * console.assert(ahead instanceof RegexLookaheadAssertionNode && !ahead.negated);
36
+ * console.assert(behind instanceof RegexLookbehindAssertionNode && behind.negated);
37
+ * ```
38
+ */
39
+ export declare class RegexLookaheadAssertionNode extends Node {
40
+ /**
41
+ * The disjunction tested without consuming input.
42
+ */
43
+ public readonly disjunctionNode: RegexDisjunctionNode;
44
+
45
+ /**
46
+ * Whether the assertion succeeds when its disjunction does not match.
47
+ */
48
+ public readonly negated: boolean;
49
+
50
+ /**
51
+ * Creates a lookahead assertion from its disjunction and polarity.
52
+ *
53
+ * @param disjunctionNode The disjunction tested by the assertion.
54
+ * @param negated Whether the assertion is negative.
55
+ * @param span The absolute UTF-16 source span of the assertion.
56
+ *
57
+ * @see {@link RegexLookaheadAssertionNode} for usage and {@link RegexNode} for shared node-construction contracts.
58
+ */
59
+ public constructor(disjunctionNode: RegexDisjunctionNode, negated: boolean, span: SourceSpan);
60
+ }
61
+
62
+ /**
63
+ * A positive or negative lookbehind assertion.
64
+ */
65
+ export declare class RegexLookbehindAssertionNode extends Node {
66
+ /**
67
+ * The disjunction tested behind the current input position.
68
+ */
69
+ public readonly disjunctionNode: RegexDisjunctionNode;
70
+
71
+ /**
72
+ * Whether the assertion succeeds when its disjunction does not match.
73
+ */
74
+ public readonly negated: boolean;
75
+
76
+ /**
77
+ * Creates a lookbehind assertion from its disjunction and polarity.
78
+ *
79
+ * @param disjunctionNode The disjunction tested by the assertion.
80
+ * @param negated Whether the assertion is negative.
81
+ * @param span The absolute UTF-16 source span of the assertion.
82
+ *
83
+ * @see {@link RegexLookaheadAssertionNode} for usage and {@link RegexNode} for shared node-construction contracts.
84
+ */
85
+ public constructor(disjunctionNode: RegexDisjunctionNode, negated: boolean, span: SourceSpan);
86
+ }
87
+
88
+ /**
89
+ * The non-word-boundary assertion represented by `\B`.
90
+ */
91
+ export declare class RegexNonWordBoundaryAssertionNode extends ValueNode {
92
+ /**
93
+ * Creates the non-word-boundary assertion at its exact source span.
94
+ *
95
+ * @param span The absolute UTF-16 source span of the assertion.
96
+ *
97
+ * @see {@link RegexStartAssertionNode} for usage and {@link RegexNode} for shared node-construction contracts.
98
+ */
99
+ public constructor(span: SourceSpan);
100
+ }
101
+
102
+ /**
103
+ * The start assertion represented by `^`.
104
+ *
105
+ * @example The same escape has assertion semantics outside a class and character semantics inside it.
106
+ * ```ts
107
+ * import {
108
+ * RegexBackspaceEscapeNode, RegexCharacterClassNode, RegexClassUnionNode, RegexEndAssertionNode,
109
+ * RegexParser, RegexStartAssertionNode, RegexWordBoundaryAssertionNode
110
+ * } from "@noldova/context.parsers.regex";
111
+ *
112
+ * const nodes = new RegexParser("^\\b[\\b]$", "u").parse().rootNode.patternNode.disjunctionNode.children[0].children;
113
+ * console.assert(nodes[0] instanceof RegexStartAssertionNode);
114
+ * console.assert(nodes[1] instanceof RegexWordBoundaryAssertionNode);
115
+ * console.assert(nodes[3] instanceof RegexEndAssertionNode);
116
+ * const characterClass = nodes[2];
117
+ * console.assert(characterClass instanceof RegexCharacterClassNode);
118
+ * if (characterClass instanceof RegexCharacterClassNode && characterClass.expressionNode instanceof RegexClassUnionNode)
119
+ * console.assert(characterClass.expressionNode.children[0] instanceof RegexBackspaceEscapeNode);
120
+ * ```
121
+ */
122
+ export declare class RegexStartAssertionNode extends ValueNode {
123
+ /**
124
+ * Creates the start assertion at its exact source span.
125
+ *
126
+ * @param span The absolute UTF-16 source span of the assertion.
127
+ *
128
+ * @see {@link RegexStartAssertionNode} for usage and {@link RegexNode} for shared node-construction contracts.
129
+ */
130
+ public constructor(span: SourceSpan);
131
+ }
132
+
133
+ /**
134
+ * The word-boundary assertion represented by `\b`.
135
+ */
136
+ export declare class RegexWordBoundaryAssertionNode extends ValueNode {
137
+ /**
138
+ * Creates the word-boundary assertion at its exact source span.
139
+ *
140
+ * @param span The absolute UTF-16 source span of the assertion.
141
+ *
142
+ * @see {@link RegexStartAssertionNode} for usage and {@link RegexNode} for shared node-construction contracts.
143
+ */
144
+ public constructor(span: SourceSpan);
145
+ }
146
+
147
+ /**
148
+ * A character class containing a classic class union or a Unicode-set expression.
149
+ *
150
+ * @example A classic class exposes its range through the union expression.
151
+ * ```ts
152
+ * import { RegexCharacterClassNode, RegexCharacterRangeNode, RegexClassUnionNode, RegexParser } from "@noldova/context.parsers.regex";
153
+ *
154
+ * const node = new RegexParser("[^a-z]", "u").parse().rootNode.patternNode.disjunctionNode.children[0].children[0];
155
+ * if (node instanceof RegexCharacterClassNode && node.expressionNode instanceof RegexClassUnionNode) {
156
+ * console.assert(node.negated && !node.mayContainStrings);
157
+ * const range = node.expressionNode.children[0];
158
+ * console.assert(range instanceof RegexCharacterRangeNode);
159
+ * console.assert(range?.span.startOffset === 2 && range.span.length === 3);
160
+ * }
161
+ * ```
162
+ */
163
+ export declare class RegexCharacterClassNode extends Node {
164
+ /**
165
+ * The union, intersection, or subtraction expression contained by the class.
166
+ */
167
+ public readonly expressionNode: Node;
168
+
169
+ /**
170
+ * Whether the class selects the complement of its expression.
171
+ */
172
+ public readonly negated: boolean;
173
+
174
+ /**
175
+ * Whether the class may match a sequence containing zero or multiple characters.
176
+ */
177
+ public readonly mayContainStrings: boolean;
178
+
179
+ /**
180
+ * Creates a character class from its parsed expression and polarity.
181
+ *
182
+ * @param expressionNode The parsed character-set expression.
183
+ * @param negated Whether the class selects the complement of the expression.
184
+ * @param mayContainStrings Whether the expression may match a non-single-character sequence.
185
+ * @param span The absolute UTF-16 source span of the complete character class.
186
+ *
187
+ * @see {@link RegexCharacterClassNode} for usage and {@link RegexNode} for shared node-construction contracts.
188
+ */
189
+ public constructor(expressionNode: Node, negated: boolean, mayContainStrings: boolean, span: SourceSpan);
190
+ }
191
+
192
+ /**
193
+ * A source range form between two class atoms. In a non-Unicode Annex B
194
+ * pattern, a character-class escape endpoint gives union semantics instead
195
+ * of ordinary character-range semantics.
196
+ */
197
+ export declare class RegexCharacterRangeNode extends Node {
198
+ /**
199
+ * The first class atom in the source range form.
200
+ */
201
+ public readonly startNode: Node;
202
+
203
+ /**
204
+ * The second class atom in the source range form.
205
+ */
206
+ public readonly endNode: Node;
207
+
208
+ /**
209
+ * Creates a character range from its parsed endpoints.
210
+ *
211
+ * @param startNode The first class atom.
212
+ * @param endNode The second class atom.
213
+ * @param span The absolute UTF-16 source span of the complete range.
214
+ *
215
+ * @see {@link RegexCharacterClassNode} for usage and {@link RegexNode} for shared node-construction contracts.
216
+ */
217
+ public constructor(startNode: Node, endNode: Node, span: SourceSpan);
218
+ }
219
+
220
+ /**
221
+ * A Unicode-set intersection whose operands are evaluated from left to right.
222
+ *
223
+ * @example Unicode-set operators retain the ordered operands, not the operator tokens.
224
+ * ```ts
225
+ * import {
226
+ * RegexCharacterClassNode, RegexClassIntersectionNode, RegexClassSubtractionNode, RegexParser
227
+ * } from "@noldova/context.parsers.regex";
228
+ *
229
+ * const nodes = new RegexParser("[a&&b][a--b]", "v").parse().rootNode.patternNode.disjunctionNode.children[0].children;
230
+ * const intersection = nodes[0];
231
+ * const subtraction = nodes[1];
232
+ * if (intersection instanceof RegexCharacterClassNode && intersection.expressionNode instanceof RegexClassIntersectionNode)
233
+ * console.assert(intersection.expressionNode.children.length === 2);
234
+ * if (subtraction instanceof RegexCharacterClassNode && subtraction.expressionNode instanceof RegexClassSubtractionNode)
235
+ * console.assert(subtraction.expressionNode.children.length === 2);
236
+ * ```
237
+ */
238
+ export declare class RegexClassIntersectionNode extends CompositeNode {
239
+ /**
240
+ * A non-empty snapshot of the ordered operands. Later changes to the
241
+ * caller's collection do not alter this node.
242
+ */
243
+ public readonly children: readonly [Node, ...Node[]];
244
+
245
+ /**
246
+ * Creates an intersection from its ordered operands.
247
+ *
248
+ * @param operands One or more character-set operands in source order. The array is copied; the operand nodes remain shared.
249
+ * @param span The absolute UTF-16 source span of the intersection.
250
+ * @throws ArgumentException If the collection is empty.
251
+ *
252
+ * @see {@link RegexClassIntersectionNode} for usage and {@link RegexNode} for shared node-construction contracts.
253
+ */
254
+ public constructor(operands: readonly Node[], span: SourceSpan);
255
+ }
256
+
257
+ /**
258
+ * A `\q{...}` disjunction of strings inside a Unicode-set character class.
259
+ *
260
+ * Strings are syntax alternatives inside the pattern, not the subject text that
261
+ * a future matcher processes. Empty and multi-character alternatives set
262
+ * mayContainStrings; a single supplementary code point still counts as one character.
263
+ *
264
+ * @example Inspect an empty and a two-character string alternative.
265
+ * ```ts
266
+ * import { RegexCharacterClassNode, RegexClassStringDisjunctionNode, RegexClassUnionNode, RegexParser } from "@noldova/context.parsers.regex";
267
+ *
268
+ * const result = new RegexParser("[\\q{|ab}]", "v").parse();
269
+ * const characterClass = result.rootNode.patternNode.disjunctionNode.children[0].children[0];
270
+ * if (characterClass instanceof RegexCharacterClassNode && characterClass.expressionNode instanceof RegexClassUnionNode) {
271
+ * const strings = characterClass.expressionNode.children[0];
272
+ * if (strings instanceof RegexClassStringDisjunctionNode) {
273
+ * console.assert(strings.children[0].children.length === 0);
274
+ * console.assert(strings.children[1]?.children.length === 2);
275
+ * console.assert(strings.mayContainStrings);
276
+ * }
277
+ * }
278
+ * ```
279
+ */
280
+ export declare class RegexClassStringDisjunctionNode extends CompositeNode {
281
+ /**
282
+ * A non-empty snapshot of the ordered strings. Later changes to the
283
+ * caller's collection do not alter this node.
284
+ */
285
+ public readonly children: readonly [RegexClassStringNode, ...RegexClassStringNode[]];
286
+
287
+ /**
288
+ * Whether at least one alternative contains zero or multiple characters.
289
+ */
290
+ public readonly mayContainStrings: boolean;
291
+
292
+ /**
293
+ * Creates a class-string disjunction from its alternatives.
294
+ *
295
+ * @param strings One or more alternatives in source order; each string may be empty. The array is copied; string nodes remain shared.
296
+ * @param span The absolute UTF-16 source span of the complete `\q{...}` expression.
297
+ * @throws ArgumentException If the collection is empty.
298
+ *
299
+ * @see {@link RegexClassStringDisjunctionNode} for usage and {@link RegexNode} for shared node-construction contracts.
300
+ */
301
+ public constructor(strings: readonly RegexClassStringNode[], span: SourceSpan);
302
+ }
303
+
304
+ /**
305
+ * One character sequence inside a Unicode-set class-string disjunction.
306
+ */
307
+ export declare class RegexClassStringNode extends CompositeNode {
308
+ /**
309
+ * Creates a class string from its ordered character-producing elements.
310
+ *
311
+ * @param characters Character-producing elements in source order; may be empty. The array is retained, not copied; do not mutate it after passing it.
312
+ * @param span The absolute UTF-16 source span of the string alternative.
313
+ *
314
+ * @see {@link RegexClassStringDisjunctionNode} for usage and {@link RegexNode} for shared node-construction contracts.
315
+ */
316
+ public constructor(characters: readonly Node[], span: SourceSpan);
317
+ }
318
+
319
+ /**
320
+ * A Unicode-set subtraction whose operands are evaluated from left to right.
321
+ */
322
+ export declare class RegexClassSubtractionNode extends CompositeNode {
323
+ /**
324
+ * A non-empty snapshot of the ordered operands. Later changes to the
325
+ * caller's collection do not alter this node.
326
+ */
327
+ public readonly children: readonly [Node, ...Node[]];
328
+
329
+ /**
330
+ * Creates a subtraction from its ordered operands.
331
+ *
332
+ * @param operands One or more character-set operands in source order. The array is copied; the operand nodes remain shared.
333
+ * @param span The absolute UTF-16 source span of the subtraction.
334
+ * @throws ArgumentException If the collection is empty.
335
+ *
336
+ * @see {@link RegexClassIntersectionNode} for usage and {@link RegexNode} for shared node-construction contracts.
337
+ */
338
+ public constructor(operands: readonly Node[], span: SourceSpan);
339
+ }
340
+
341
+ /**
342
+ * An ordered union of character-class members, ranges, or nested set operands.
343
+ */
344
+ export declare class RegexClassUnionNode extends CompositeNode {
345
+ /**
346
+ * Creates a union from its ordered operands.
347
+ *
348
+ * @param operands Character-set operands in source order; may be empty. The array is retained, not copied; do not mutate it after passing it.
349
+ * @param span The absolute UTF-16 source span of the union.
350
+ *
351
+ * @see {@link RegexCharacterClassNode} for usage and {@link RegexNode} for shared node-construction contracts.
352
+ */
353
+ public constructor(operands: readonly Node[], span: SourceSpan);
354
+ }
355
+
356
+ /**
357
+ * A numeric backreference to a capturing group in the complete pattern.
358
+ *
359
+ * @example A decimal reference can precede the capturing group it names.
360
+ * ```ts
361
+ * import { RegexBackreferenceNode, RegexParser } from "@noldova/context.parsers.regex";
362
+ *
363
+ * const result = new RegexParser("\\1(a)", "u").parse();
364
+ * const reference = result.rootNode.patternNode.disjunctionNode.children[0].children[0];
365
+ * console.assert(result.diagnostics.length === 0);
366
+ * console.assert(reference instanceof RegexBackreferenceNode && reference.groupIndex === 1);
367
+ * ```
368
+ */
369
+ export declare class RegexBackreferenceNode extends ValueNode {
370
+ /**
371
+ * The one-based index of the referenced capturing group.
372
+ */
373
+ public readonly groupIndex: number;
374
+
375
+ /**
376
+ * Creates a numeric backreference from its source text and resolved group index.
377
+ *
378
+ * @param value The complete source text of the backreference.
379
+ * @param groupIndex The one-based index of the referenced capturing group.
380
+ * @param span The absolute UTF-16 source span of the backreference.
381
+ *
382
+ * @see {@link RegexBackreferenceNode} for usage and {@link RegexNode} for shared node-construction contracts.
383
+ */
384
+ public constructor(value: string, groupIndex: number, span: SourceSpan);
385
+ }
386
+
387
+ /**
388
+ * The class-only backspace escape represented by `\b`.
389
+ */
390
+ export declare class RegexBackspaceEscapeNode extends ValueNode {
391
+ /**
392
+ * Creates the backspace escape at its exact source span.
393
+ *
394
+ * @param span The absolute UTF-16 source span of the escape.
395
+ *
396
+ * @see {@link RegexDigitEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
397
+ */
398
+ public constructor(span: SourceSpan);
399
+ }
400
+
401
+ /**
402
+ * The carriage-return character escape represented by `\r`.
403
+ */
404
+ export declare class RegexCarriageReturnEscapeNode extends ValueNode {
405
+ /**
406
+ * Creates the carriage-return escape at its exact source span.
407
+ *
408
+ * @param span The absolute UTF-16 source span of the escape.
409
+ *
410
+ * @see {@link RegexDigitEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
411
+ */
412
+ public constructor(span: SourceSpan);
413
+ }
414
+
415
+ /**
416
+ * A legacy non-Unicode class-control escape represented by `\c` followed by a decimal digit or underscore.
417
+ */
418
+ export declare class RegexClassControlEscapeNode extends ValueNode {
419
+ /**
420
+ * The code point produced by the escape.
421
+ */
422
+ public readonly codePoint: number;
423
+
424
+ /**
425
+ * Creates a class-control escape from its source text and resolved code point.
426
+ *
427
+ * @param value The complete source text of the escape.
428
+ * @param codePoint The decoded integer character value, distinct from its source spelling; the constructor stores it without re-decoding value.
429
+ * @param span The absolute UTF-16 source span of the escape.
430
+ *
431
+ * @see {@link RegexUnicodeEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
432
+ */
433
+ public constructor(value: string, codePoint: number, span: SourceSpan);
434
+ }
435
+
436
+ /**
437
+ * A control-letter escape represented by `\c` followed by its control letter.
438
+ */
439
+ export declare class RegexControlLetterEscapeNode extends ValueNode {
440
+ /**
441
+ * The code point produced by the escape.
442
+ */
443
+ public readonly codePoint: number;
444
+
445
+ /**
446
+ * Creates a control-letter escape from its source text and resolved code point.
447
+ *
448
+ * @param value The complete source text of the escape.
449
+ * @param codePoint The decoded integer character value, distinct from its source spelling; the constructor stores it without re-decoding value.
450
+ * @param span The absolute UTF-16 source span of the escape.
451
+ *
452
+ * @see {@link RegexUnicodeEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
453
+ */
454
+ public constructor(value: string, codePoint: number, span: SourceSpan);
455
+ }
456
+
457
+ /**
458
+ * An invalid decimal escape retained for syntax recovery after its complete
459
+ * pattern meaning has been checked.
460
+ */
461
+ export declare class RegexDecimalEscapeNode extends ValueNode {
462
+ /**
463
+ * The decimal integer written after the reverse solidus.
464
+ */
465
+ public readonly decimalValue: bigint;
466
+
467
+ /**
468
+ * Creates a decimal escape from its source text and parsed integer.
469
+ *
470
+ * @param value The complete source text of the escape.
471
+ * @param decimalValue The decimal integer written by the source.
472
+ * @param span The absolute UTF-16 source span of the escape.
473
+ *
474
+ * @see {@link RegexUnknownNode} for usage and {@link RegexNode} for shared node-construction contracts.
475
+ */
476
+ public constructor(value: string, decimalValue: bigint, span: SourceSpan);
477
+ }
478
+
479
+ /**
480
+ * The decimal-digit character-class escape represented by `\d`.
481
+ *
482
+ * @example Character-class escapes are class-valued nodes, not decoded character nodes.
483
+ * ```ts
484
+ * import { RegexDigitEscapeNode, RegexParser, RegexTabEscapeNode } from "@noldova/context.parsers.regex";
485
+ *
486
+ * const nodes = new RegexParser("\\d\\t", "u").parse().rootNode.patternNode.disjunctionNode.children[0].children;
487
+ * console.assert(nodes[0] instanceof RegexDigitEscapeNode);
488
+ * const tab = nodes[1];
489
+ * console.assert(tab instanceof RegexTabEscapeNode && tab.value === "\\t");
490
+ * ```
491
+ */
492
+ export declare class RegexDigitEscapeNode extends ValueNode {
493
+ /**
494
+ * Creates the digit escape at its exact source span.
495
+ *
496
+ * @param span The absolute UTF-16 source span of the escape.
497
+ *
498
+ * @see {@link RegexDigitEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
499
+ */
500
+ public constructor(span: SourceSpan);
501
+ }
502
+
503
+ /**
504
+ * The form-feed character escape represented by `\f`.
505
+ */
506
+ export declare class RegexFormFeedEscapeNode extends ValueNode {
507
+ /**
508
+ * Creates the form-feed escape at its exact source span.
509
+ *
510
+ * @param span The absolute UTF-16 source span of the escape.
511
+ *
512
+ * @see {@link RegexDigitEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
513
+ */
514
+ public constructor(span: SourceSpan);
515
+ }
516
+
517
+ /**
518
+ * A hexadecimal character escape represented by `\x` and two hexadecimal digits.
519
+ */
520
+ export declare class RegexHexEscapeNode extends ValueNode {
521
+ /**
522
+ * The code point produced by the escape.
523
+ */
524
+ public readonly codePoint: number;
525
+
526
+ /**
527
+ * Creates a hexadecimal escape from its source text and resolved code point.
528
+ *
529
+ * @param value The complete source text of the escape.
530
+ * @param codePoint The decoded integer character value, distinct from its source spelling; the constructor stores it without re-decoding value.
531
+ * @param span The absolute UTF-16 source span of the escape.
532
+ *
533
+ * @see {@link RegexUnicodeEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
534
+ */
535
+ public constructor(value: string, codePoint: number, span: SourceSpan);
536
+ }
537
+
538
+ /**
539
+ * An identity escape whose escaped character retains its own meaning.
540
+ */
541
+ export declare class RegexIdentityEscapeNode extends ValueNode {
542
+ /**
543
+ * The code point produced by the escape.
544
+ */
545
+ public readonly codePoint: number;
546
+
547
+ /**
548
+ * Creates an identity escape from its source text and resolved code point.
549
+ *
550
+ * @param value The complete source text of the escape.
551
+ * @param codePoint The decoded integer character value, distinct from its source spelling; the constructor stores it without re-decoding value.
552
+ * @param span The absolute UTF-16 source span of the escape.
553
+ *
554
+ * @see {@link RegexUnicodeEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
555
+ */
556
+ public constructor(value: string, codePoint: number, span: SourceSpan);
557
+ }
558
+
559
+ /**
560
+ * A legacy octal character escape accepted by non-Unicode patterns.
561
+ */
562
+ export declare class RegexLegacyOctalEscapeNode extends ValueNode {
563
+ /**
564
+ * The code point produced by the escape.
565
+ */
566
+ public readonly codePoint: number;
567
+
568
+ /**
569
+ * Creates a legacy octal escape from its source text and resolved code point.
570
+ *
571
+ * @param value The complete source text of the escape.
572
+ * @param codePoint The decoded integer character value, distinct from its source spelling; the constructor stores it without re-decoding value.
573
+ * @param span The absolute UTF-16 source span of the escape.
574
+ *
575
+ * @see {@link RegexUnicodeEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
576
+ */
577
+ public constructor(value: string, codePoint: number, span: SourceSpan);
578
+ }
579
+
580
+ /**
581
+ * A named backreference to a named capturing group in the complete pattern.
582
+ */
583
+ export declare class RegexNamedBackreferenceNode extends ValueNode {
584
+ /**
585
+ * The decoded name of the referenced capturing group.
586
+ */
587
+ public readonly groupName: string;
588
+
589
+ /**
590
+ * Creates a named backreference from its source text and decoded group name.
591
+ *
592
+ * @param value The complete source text of the backreference.
593
+ * @param groupName The decoded identifier, without normalization. Resolution and source-spelling validity are checked by the parser, not this constructor.
594
+ * @param span The absolute UTF-16 source span of the backreference.
595
+ *
596
+ * @see {@link RegexNamedCapturingGroupNode} for usage and {@link RegexNode} for shared node-construction contracts.
597
+ */
598
+ public constructor(value: string, groupName: string, span: SourceSpan);
599
+ }
600
+
601
+ /**
602
+ * The line-feed character escape represented by `\n`.
603
+ */
604
+ export declare class RegexNewlineEscapeNode extends ValueNode {
605
+ /**
606
+ * Creates the newline escape at its exact source span.
607
+ *
608
+ * @param span The absolute UTF-16 source span of the escape.
609
+ *
610
+ * @see {@link RegexDigitEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
611
+ */
612
+ public constructor(span: SourceSpan);
613
+ }
614
+
615
+ /**
616
+ * The non-digit character-class escape represented by `\D`.
617
+ */
618
+ export declare class RegexNonDigitEscapeNode extends ValueNode {
619
+ /**
620
+ * Creates the non-digit escape at its exact source span.
621
+ *
622
+ * @param span The absolute UTF-16 source span of the escape.
623
+ *
624
+ * @see {@link RegexDigitEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
625
+ */
626
+ public constructor(span: SourceSpan);
627
+ }
628
+
629
+ /**
630
+ * The non-whitespace character-class escape represented by `\S`.
631
+ */
632
+ export declare class RegexNonWhitespaceEscapeNode extends ValueNode {
633
+ /**
634
+ * Creates the non-whitespace escape at its exact source span.
635
+ *
636
+ * @param span The absolute UTF-16 source span of the escape.
637
+ *
638
+ * @see {@link RegexDigitEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
639
+ */
640
+ public constructor(span: SourceSpan);
641
+ }
642
+
643
+ /**
644
+ * The non-word-character class escape represented by `\W`.
645
+ */
646
+ export declare class RegexNonWordEscapeNode extends ValueNode {
647
+ /**
648
+ * Creates the non-word escape at its exact source span.
649
+ *
650
+ * @param span The absolute UTF-16 source span of the escape.
651
+ *
652
+ * @see {@link RegexDigitEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
653
+ */
654
+ public constructor(span: SourceSpan);
655
+ }
656
+
657
+ /**
658
+ * The null-character escape represented by `\0`.
659
+ */
660
+ export declare class RegexNullEscapeNode extends ValueNode {
661
+ /**
662
+ * Creates the null escape at its exact source span.
663
+ *
664
+ * @param span The absolute UTF-16 source span of the escape.
665
+ *
666
+ * @see {@link RegexDigitEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
667
+ */
668
+ public constructor(span: SourceSpan);
669
+ }
670
+
671
+ /**
672
+ * The horizontal-tab character escape represented by `\t`.
673
+ */
674
+ export declare class RegexTabEscapeNode extends ValueNode {
675
+ /**
676
+ * Creates the tab escape at its exact source span.
677
+ *
678
+ * @param span The absolute UTF-16 source span of the escape.
679
+ *
680
+ * @see {@link RegexDigitEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
681
+ */
682
+ public constructor(span: SourceSpan);
683
+ }
684
+
685
+ /**
686
+ * A Unicode character escape in fixed-width or code-point form.
687
+ *
688
+ * The inherited value preserves escape spelling; codePoint holds the decoded
689
+ * numeric value. A fixed-width surrogate pair combines in Unicode-aware mode
690
+ * and in group names, whereas braced escapes each represent one element.
691
+ *
692
+ * @example Source width and decoded character width need not be the same.
693
+ * ```ts
694
+ * import { RegexHexEscapeNode, RegexParser, RegexUnicodeEscapeNode } from "@noldova/context.parsers.regex";
695
+ *
696
+ * const nodes = new RegexParser("\\x41\\u{1F600}", "u").parse().rootNode.patternNode.disjunctionNode.children[0].children;
697
+ * const hex = nodes[0];
698
+ * const unicode = nodes[1];
699
+ * console.assert(hex instanceof RegexHexEscapeNode && hex.codePoint === 0x41 && hex.value === "\\x41");
700
+ * if (unicode instanceof RegexUnicodeEscapeNode) {
701
+ * console.assert(unicode.codePoint === 0x1F600);
702
+ * console.assert(unicode.span.startOffset === 4 && unicode.span.length === 9);
703
+ * }
704
+ * ```
705
+ */
706
+ export declare class RegexUnicodeEscapeNode extends ValueNode {
707
+ /**
708
+ * The code point produced by the escape.
709
+ */
710
+ public readonly codePoint: number;
711
+
712
+ /**
713
+ * Creates a Unicode escape from its source text and resolved code point.
714
+ *
715
+ * @param value The complete source text of the escape.
716
+ * @param codePoint The decoded integer character value, distinct from its source spelling; the constructor stores it without re-decoding value.
717
+ * @param span The absolute UTF-16 source span of the escape.
718
+ *
719
+ * @see {@link RegexUnicodeEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
720
+ */
721
+ public constructor(value: string, codePoint: number, span: SourceSpan);
722
+ }
723
+
724
+ /**
725
+ * A Unicode property escape that includes either a lone property value or an explicit property-name and value pair.
726
+ *
727
+ * Names and values preserve the supplied alias spelling; they are not
728
+ * canonicalized. Accepted aliases come from the package's Unicode 15.1 profile.
729
+ * String-valued properties require Unicode-set mode and cannot be complemented.
730
+ *
731
+ * @example Distinguish an explicit property pair from a lone property value.
732
+ * ```ts
733
+ * import { RegexParser, RegexUnicodePropertyEscapeNode } from "@noldova/context.parsers.regex";
734
+ *
735
+ * const nodes = new RegexParser("\\p{Script=Greek}\\P{ASCII}", "u").parse().rootNode.patternNode.disjunctionNode.children[0].children;
736
+ * const script = nodes[0];
737
+ * const complement = nodes[1];
738
+ * if (script instanceof RegexUnicodePropertyEscapeNode) {
739
+ * console.assert(script.propertyName === "Script" && script.propertyValue === "Greek");
740
+ * console.assert(!script.negated && !script.mayContainStrings);
741
+ * }
742
+ * if (complement instanceof RegexUnicodePropertyEscapeNode)
743
+ * console.assert(complement.propertyName === undefined && complement.negated);
744
+ * ```
745
+ */
746
+ export declare class RegexUnicodePropertyEscapeNode extends ValueNode {
747
+ /**
748
+ * Whether the selected property may match strings instead of only individual characters.
749
+ */
750
+ public readonly mayContainStrings: boolean;
751
+
752
+ /**
753
+ * The explicit property name, or `undefined` when the escape contains a lone property value.
754
+ */
755
+ public readonly propertyName: string | undefined;
756
+
757
+ /**
758
+ * The property value selected by the escape.
759
+ */
760
+ public readonly propertyValue: string;
761
+
762
+ /**
763
+ * Whether the escape matches code points outside the selected property.
764
+ */
765
+ public readonly negated: boolean;
766
+
767
+ /**
768
+ * Creates a Unicode property escape from its parsed property expression.
769
+ *
770
+ * @param value The complete source text of the escape.
771
+ * @param propertyName The explicit property name, or `undefined` for a lone value.
772
+ * @param propertyValue The property value selected by the escape.
773
+ * @param negated Whether the escape excludes the selected property.
774
+ * @param mayContainStrings Whether the selected property can match strings.
775
+ * @param span The absolute UTF-16 source span of the escape.
776
+ *
777
+ * @see {@link RegexUnicodePropertyEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
778
+ */
779
+ public constructor(value: string, propertyName: string | undefined, propertyValue: string, negated: boolean, mayContainStrings: boolean, span: SourceSpan);
780
+ }
781
+
782
+ /**
783
+ * The vertical-tab character escape represented by `\v`.
784
+ */
785
+ export declare class RegexVerticalTabEscapeNode extends ValueNode {
786
+ /**
787
+ * Creates the vertical-tab escape at its exact source span.
788
+ *
789
+ * @param span The absolute UTF-16 source span of the escape.
790
+ *
791
+ * @see {@link RegexDigitEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
792
+ */
793
+ public constructor(span: SourceSpan);
794
+ }
795
+
796
+ /**
797
+ * The whitespace character-class escape represented by `\s`.
798
+ */
799
+ export declare class RegexWhitespaceEscapeNode extends ValueNode {
800
+ /**
801
+ * Creates the whitespace escape at its exact source span.
802
+ *
803
+ * @param span The absolute UTF-16 source span of the escape.
804
+ *
805
+ * @see {@link RegexDigitEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
806
+ */
807
+ public constructor(span: SourceSpan);
808
+ }
809
+
810
+ /**
811
+ * The word-character class escape represented by `\w`.
812
+ */
813
+ export declare class RegexWordEscapeNode extends ValueNode {
814
+ /**
815
+ * Creates the word escape at its exact source span.
816
+ *
817
+ * @param span The absolute UTF-16 source span of the escape.
818
+ *
819
+ * @see {@link RegexDigitEscapeNode} for usage and {@link RegexNode} for shared node-construction contracts.
820
+ */
821
+ public constructor(span: SourceSpan);
822
+ }
823
+
824
+ /**
825
+ * A capturing group represented by `(disjunction)`.
826
+ *
827
+ * @example Captures are numbered by opening-parenthesis order, including nested groups.
828
+ * ```ts
829
+ * import { RegexCapturingGroupNode, RegexNonCapturingGroupNode, RegexParser } from "@noldova/context.parsers.regex";
830
+ *
831
+ * const nodes = new RegexParser("(a(b))(?:c)").parse().rootNode.patternNode.disjunctionNode.children[0].children;
832
+ * const outer = nodes[0];
833
+ * if (outer instanceof RegexCapturingGroupNode) {
834
+ * const inner = outer.disjunctionNode.children[0].children[1];
835
+ * console.assert(outer.groupIndex === 1);
836
+ * console.assert(inner instanceof RegexCapturingGroupNode && inner.groupIndex === 2);
837
+ * }
838
+ * console.assert(nodes[1] instanceof RegexNonCapturingGroupNode);
839
+ * ```
840
+ */
841
+ export declare class RegexCapturingGroupNode extends Node {
842
+ /**
843
+ * The one-based capture index assigned by the complete pattern.
844
+ */
845
+ public readonly groupIndex: number;
846
+
847
+ /**
848
+ * The disjunction evaluated by the capturing group.
849
+ */
850
+ public readonly disjunctionNode: RegexDisjunctionNode;
851
+
852
+ /**
853
+ * Creates a capturing group from its parsed disjunction.
854
+ *
855
+ * @param groupIndex The one-based capture index assigned by source order.
856
+ * @param disjunctionNode The disjunction evaluated by the group.
857
+ * @param span The absolute UTF-16 source span of the complete group.
858
+ *
859
+ * @see {@link RegexCapturingGroupNode} for usage and {@link RegexNode} for shared node-construction contracts.
860
+ */
861
+ public constructor(groupIndex: number, disjunctionNode: RegexDisjunctionNode, span: SourceSpan);
862
+ }
863
+
864
+ /**
865
+ * A modifier group that changes matching behavior for its nested disjunction.
866
+ *
867
+ * @example Modifiers apply to the group's disjunction, not to the root flags.
868
+ * ```ts
869
+ * import { RegexModifierGroupNode, RegexParser } from "@noldova/context.parsers.regex";
870
+ *
871
+ * const root = new RegexParser("(?im-s:a)").parse().rootNode;
872
+ * const group = root.patternNode.disjunctionNode.children[0].children[0];
873
+ * if (group instanceof RegexModifierGroupNode) {
874
+ * console.assert(group.enabledModifiers === "im");
875
+ * console.assert(group.disabledModifiers === "s");
876
+ * }
877
+ * console.assert(!root.flagsNode.ignoreCase);
878
+ * ```
879
+ */
880
+ export declare class RegexModifierGroupNode extends Node {
881
+ /**
882
+ * The modifier characters enabled within the group, in source order.
883
+ */
884
+ public readonly enabledModifiers: string;
885
+
886
+ /**
887
+ * The modifier characters disabled within the group, in source order.
888
+ */
889
+ public readonly disabledModifiers: string;
890
+
891
+ /**
892
+ * The disjunction evaluated with the modified matching behavior.
893
+ */
894
+ public readonly disjunctionNode: RegexDisjunctionNode;
895
+
896
+ /**
897
+ * Creates a modifier group from its enabled and disabled modifiers.
898
+ *
899
+ * @param enabledModifiers The enabled source characters, normally distinct i, m, or s; may be empty. Invalid spellings are retained during recovery.
900
+ * @param disabledModifiers The disabled source characters, normally distinct i, m, or s; may be empty and must not overlap valid enabled modifiers.
901
+ * @param disjunctionNode The disjunction evaluated by the group.
902
+ * @param span The absolute UTF-16 source span of the complete group.
903
+ *
904
+ * @see {@link RegexModifierGroupNode} for usage and {@link RegexNode} for shared node-construction contracts.
905
+ */
906
+ public constructor(enabledModifiers: string, disabledModifiers: string, disjunctionNode: RegexDisjunctionNode, span: SourceSpan);
907
+ }
908
+
909
+ /**
910
+ * A named capturing group represented by `(?<name>disjunction)`.
911
+ *
912
+ * The name is decoded without Unicode normalization. If the input is invalid,
913
+ * recovery may retain the decoded name alongside diagnostics; a readable name
914
+ * alone does not establish that its source spelling was valid.
915
+ *
916
+ * @example A named declaration and reference share a decoded name, not the same source spelling.
917
+ * ```ts
918
+ * import { RegexNamedBackreferenceNode, RegexNamedCapturingGroupNode, RegexParser } from "@noldova/context.parsers.regex";
919
+ *
920
+ * const result = new RegexParser("(?<\\u006E>a)\\k<n>", "u").parse();
921
+ * const nodes = result.rootNode.patternNode.disjunctionNode.children[0].children;
922
+ * const group = nodes[0];
923
+ * const reference = nodes[1];
924
+ * console.assert(result.diagnostics.length === 0);
925
+ * console.assert(group instanceof RegexNamedCapturingGroupNode && group.groupName === "n");
926
+ * console.assert(reference instanceof RegexNamedBackreferenceNode && reference.groupName === "n");
927
+ * ```
928
+ */
929
+ export declare class RegexNamedCapturingGroupNode extends Node {
930
+ /**
931
+ * The one-based capture index assigned by the complete pattern.
932
+ */
933
+ public readonly groupIndex: number;
934
+
935
+ /**
936
+ * The decoded name assigned to the captured value.
937
+ */
938
+ public readonly groupName: string;
939
+
940
+ /**
941
+ * The disjunction evaluated by the named capturing group.
942
+ */
943
+ public readonly disjunctionNode: RegexDisjunctionNode;
944
+
945
+ /**
946
+ * Creates a named capturing group from its decoded name and parsed disjunction.
947
+ *
948
+ * @param groupIndex The one-based capture index assigned by source order.
949
+ * @param groupName The decoded identifier without normalization; invalid source can retain this value alongside a diagnostic.
950
+ * @param disjunctionNode The disjunction evaluated by the group.
951
+ * @param span The absolute UTF-16 source span of the complete group.
952
+ *
953
+ * @see {@link RegexNamedCapturingGroupNode} for usage and {@link RegexNode} for shared node-construction contracts.
954
+ */
955
+ public constructor(groupIndex: number, groupName: string, disjunctionNode: RegexDisjunctionNode, span: SourceSpan);
956
+ }
957
+
958
+ /**
959
+ * A non-capturing group represented by `(?:disjunction)`.
960
+ */
961
+ export declare class RegexNonCapturingGroupNode extends Node {
962
+ /**
963
+ * The disjunction evaluated without creating a capture.
964
+ */
965
+ public readonly disjunctionNode: RegexDisjunctionNode;
966
+
967
+ /**
968
+ * Creates a non-capturing group from its parsed disjunction.
969
+ *
970
+ * @param disjunctionNode The disjunction evaluated by the group.
971
+ * @param span The absolute UTF-16 source span of the complete group.
972
+ *
973
+ * @see {@link RegexCapturingGroupNode} for usage and {@link RegexNode} for shared node-construction contracts.
974
+ */
975
+ public constructor(disjunctionNode: RegexDisjunctionNode, span: SourceSpan);
976
+ }
977
+
978
+ /**
979
+ * The Unicode-set intersection punctuator represented by `&&`.
980
+ */
981
+ export declare class RegexAmpersandAmpersandNode extends ValueNode {
982
+ /**
983
+ * Creates the punctuator at its exact source span.
984
+ *
985
+ * @param span The absolute UTF-16 source span of the punctuator.
986
+ *
987
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
988
+ */
989
+ public constructor(span: SourceSpan);
990
+ }
991
+
992
+ /**
993
+ * The asterisk punctuator used by the zero-or-more quantifier.
994
+ *
995
+ * Punctuator nodes carry their fixed spelling in the inherited value property.
996
+ * They describe lexical syntax; the parser normally consumes them into semantic
997
+ * nodes instead of retaining punctuation-only children in the finished AST.
998
+ *
999
+ * @example Construct a punctuator; parsing the same spelling as a quantifier produces a semantic node.
1000
+ * ```ts
1001
+ * import { SourceSpan } from "@noldova/context.parsers";
1002
+ * import { RegexAsteriskNode, RegexParser, RegexQuantifierNode } from "@noldova/context.parsers.regex";
1003
+ *
1004
+ * const token = new RegexAsteriskNode(new SourceSpan(4, 1));
1005
+ * console.assert(token.value === "*");
1006
+ * console.assert(token.span.startOffset === 4);
1007
+ * const nodes = new RegexParser("a*").parse().rootNode.patternNode.disjunctionNode.children[0].children;
1008
+ * console.assert(nodes[1] instanceof RegexQuantifierNode);
1009
+ * ```
1010
+ */
1011
+ export declare class RegexAsteriskNode extends ValueNode {
1012
+ /**
1013
+ * Creates the punctuator at its exact source span.
1014
+ *
1015
+ * @param span The absolute UTF-16 source span of the punctuator.
1016
+ *
1017
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1018
+ */
1019
+ public constructor(span: SourceSpan);
1020
+ }
1021
+
1022
+ /**
1023
+ * The vertical-bar punctuator separating alternatives or class strings.
1024
+ */
1025
+ export declare class RegexBarNode extends ValueNode {
1026
+ /**
1027
+ * Creates the punctuator at its exact source span.
1028
+ *
1029
+ * @param span The absolute UTF-16 source span of the punctuator.
1030
+ *
1031
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1032
+ */
1033
+ public constructor(span: SourceSpan);
1034
+ }
1035
+
1036
+ /**
1037
+ * The `\q{` punctuator that begins a Unicode-set class-string disjunction.
1038
+ */
1039
+ export declare class RegexClassStringDisjunctionStartNode extends ValueNode {
1040
+ /**
1041
+ * Creates the punctuator at its exact source span.
1042
+ *
1043
+ * @param span The absolute UTF-16 source span of the punctuator.
1044
+ *
1045
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1046
+ */
1047
+ public constructor(span: SourceSpan);
1048
+ }
1049
+
1050
+ /**
1051
+ * The closing-brace punctuator used by bounded quantifiers and braced constructs.
1052
+ */
1053
+ export declare class RegexCloseBraceNode extends ValueNode {
1054
+ /**
1055
+ * Creates the punctuator at its exact source span.
1056
+ *
1057
+ * @param span The absolute UTF-16 source span of the punctuator.
1058
+ *
1059
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1060
+ */
1061
+ public constructor(span: SourceSpan);
1062
+ }
1063
+
1064
+ /**
1065
+ * The punctuator that closes a character class.
1066
+ */
1067
+ export declare class RegexCloseBracketNode extends ValueNode {
1068
+ /**
1069
+ * Creates the punctuator at its exact source span.
1070
+ *
1071
+ * @param span The absolute UTF-16 source span of the punctuator.
1072
+ *
1073
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1074
+ */
1075
+ public constructor(span: SourceSpan);
1076
+ }
1077
+
1078
+ /**
1079
+ * The punctuator that closes a group or lookaround assertion.
1080
+ */
1081
+ export declare class RegexCloseParenthesisNode extends ValueNode {
1082
+ /**
1083
+ * Creates the punctuator at its exact source span.
1084
+ *
1085
+ * @param span The absolute UTF-16 source span of the punctuator.
1086
+ *
1087
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1088
+ */
1089
+ public constructor(span: SourceSpan);
1090
+ }
1091
+
1092
+ /**
1093
+ * The colon punctuator terminating a non-capturing or modifier-group prefix.
1094
+ */
1095
+ export declare class RegexColonNode extends ValueNode {
1096
+ /**
1097
+ * Creates the punctuator at its exact source span.
1098
+ *
1099
+ * @param span The absolute UTF-16 source span of the punctuator.
1100
+ *
1101
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1102
+ */
1103
+ public constructor(span: SourceSpan);
1104
+ }
1105
+
1106
+ /**
1107
+ * The comma punctuator separating bounded-quantifier limits.
1108
+ */
1109
+ export declare class RegexCommaNode extends ValueNode {
1110
+ /**
1111
+ * Creates the punctuator at its exact source span.
1112
+ *
1113
+ * @param span The absolute UTF-16 source span of the punctuator.
1114
+ *
1115
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1116
+ */
1117
+ public constructor(span: SourceSpan);
1118
+ }
1119
+
1120
+ /**
1121
+ * The equals punctuator used by positive lookaround prefixes.
1122
+ */
1123
+ export declare class RegexEqualsNode extends ValueNode {
1124
+ /**
1125
+ * Creates the punctuator at its exact source span.
1126
+ *
1127
+ * @param span The absolute UTF-16 source span of the punctuator.
1128
+ *
1129
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1130
+ */
1131
+ public constructor(span: SourceSpan);
1132
+ }
1133
+
1134
+ /**
1135
+ * The exclamation punctuator used by negative lookaround prefixes.
1136
+ */
1137
+ export declare class RegexExclamationNode extends ValueNode {
1138
+ /**
1139
+ * Creates the punctuator at its exact source span.
1140
+ *
1141
+ * @param span The absolute UTF-16 source span of the punctuator.
1142
+ *
1143
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1144
+ */
1145
+ public constructor(span: SourceSpan);
1146
+ }
1147
+
1148
+ /**
1149
+ * The greater-than punctuator that closes a named-group identifier.
1150
+ */
1151
+ export declare class RegexGreaterThanNode extends ValueNode {
1152
+ /**
1153
+ * Creates the punctuator at its exact source span.
1154
+ *
1155
+ * @param span The absolute UTF-16 source span of the punctuator.
1156
+ *
1157
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1158
+ */
1159
+ public constructor(span: SourceSpan);
1160
+ }
1161
+
1162
+ /**
1163
+ * The Unicode-set subtraction punctuator represented by `--`.
1164
+ */
1165
+ export declare class RegexHyphenHyphenNode extends ValueNode {
1166
+ /**
1167
+ * Creates the punctuator at its exact source span.
1168
+ *
1169
+ * @param span The absolute UTF-16 source span of the punctuator.
1170
+ *
1171
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1172
+ */
1173
+ public constructor(span: SourceSpan);
1174
+ }
1175
+
1176
+ /**
1177
+ * The hyphen punctuator used by character ranges and modifier groups.
1178
+ */
1179
+ export declare class RegexHyphenNode extends ValueNode {
1180
+ /**
1181
+ * Creates the punctuator at its exact source span.
1182
+ *
1183
+ * @param span The absolute UTF-16 source span of the punctuator.
1184
+ *
1185
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1186
+ */
1187
+ public constructor(span: SourceSpan);
1188
+ }
1189
+
1190
+ /**
1191
+ * The less-than punctuator used by lookbehind and named-group prefixes.
1192
+ */
1193
+ export declare class RegexLessThanNode extends ValueNode {
1194
+ /**
1195
+ * Creates the punctuator at its exact source span.
1196
+ *
1197
+ * @param span The absolute UTF-16 source span of the punctuator.
1198
+ *
1199
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1200
+ */
1201
+ public constructor(span: SourceSpan);
1202
+ }
1203
+
1204
+ /**
1205
+ * The opening-brace punctuator used by bounded quantifiers and braced constructs.
1206
+ */
1207
+ export declare class RegexOpenBraceNode extends ValueNode {
1208
+ /**
1209
+ * Creates the punctuator at its exact source span.
1210
+ *
1211
+ * @param span The absolute UTF-16 source span of the punctuator.
1212
+ *
1213
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1214
+ */
1215
+ public constructor(span: SourceSpan);
1216
+ }
1217
+
1218
+ /**
1219
+ * The punctuator that begins a character class.
1220
+ */
1221
+ export declare class RegexOpenBracketNode extends ValueNode {
1222
+ /**
1223
+ * Creates the punctuator at its exact source span.
1224
+ *
1225
+ * @param span The absolute UTF-16 source span of the punctuator.
1226
+ *
1227
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1228
+ */
1229
+ public constructor(span: SourceSpan);
1230
+ }
1231
+
1232
+ /**
1233
+ * The punctuator that begins a group or lookaround assertion.
1234
+ */
1235
+ export declare class RegexOpenParenthesisNode extends ValueNode {
1236
+ /**
1237
+ * Creates the punctuator at its exact source span.
1238
+ *
1239
+ * @param span The absolute UTF-16 source span of the punctuator.
1240
+ *
1241
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1242
+ */
1243
+ public constructor(span: SourceSpan);
1244
+ }
1245
+
1246
+ /**
1247
+ * The plus punctuator used by the one-or-more quantifier.
1248
+ */
1249
+ export declare class RegexPlusNode extends ValueNode {
1250
+ /**
1251
+ * Creates the punctuator at its exact source span.
1252
+ *
1253
+ * @param span The absolute UTF-16 source span of the punctuator.
1254
+ *
1255
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1256
+ */
1257
+ public constructor(span: SourceSpan);
1258
+ }
1259
+
1260
+ /**
1261
+ * The question punctuator used by quantifiers and group prefixes.
1262
+ */
1263
+ export declare class RegexQuestionNode extends ValueNode {
1264
+ /**
1265
+ * Creates the punctuator at its exact source span.
1266
+ *
1267
+ * @param span The absolute UTF-16 source span of the punctuator.
1268
+ *
1269
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1270
+ */
1271
+ public constructor(span: SourceSpan);
1272
+ }
1273
+
1274
+ /**
1275
+ * An ordered sequence of regular-expression terms forming one alternative.
1276
+ *
1277
+ * An empty alternative has no children. A quantified term contributes its atom
1278
+ * followed by a separate {@link RegexQuantifierNode}; it is not wrapped in another node.
1279
+ *
1280
+ * @example Inspect quantified terms and an empty alternative.
1281
+ * ```ts
1282
+ * import { RegexCharacterNode, RegexParser, RegexQuantifierNode } from "@noldova/context.parsers.regex";
1283
+ *
1284
+ * const result = new RegexParser("a+|", "u").parse();
1285
+ * const alternatives = result.rootNode.patternNode.disjunctionNode.children;
1286
+ * const first = alternatives[0].children;
1287
+ * console.assert(first[0] instanceof RegexCharacterNode);
1288
+ * console.assert(first[1] instanceof RegexQuantifierNode);
1289
+ * console.assert(alternatives[1]?.children.length === 0);
1290
+ * ```
1291
+ */
1292
+ export declare class RegexAlternativeNode extends CompositeNode {
1293
+ /**
1294
+ * Creates an alternative from its ordered terms and exact source span.
1295
+ *
1296
+ * @param terms Ordered terms, with each quantifier following its atom; may be empty. The array is retained, not copied; do not mutate it after passing it.
1297
+ * @param span The absolute UTF-16 source span of the alternative.
1298
+ *
1299
+ * @see {@link RegexAlternativeNode} for usage and {@link RegexNode} for shared node-construction contracts.
1300
+ */
1301
+ public constructor(terms: readonly Node[], span: SourceSpan);
1302
+ }
1303
+
1304
+ /**
1305
+ * A regular-expression disjunction containing one or more alternatives.
1306
+ *
1307
+ * @example An empty pattern still has one empty alternative.
1308
+ * ```ts
1309
+ * import { RegexParser } from "@noldova/context.parsers.regex";
1310
+ *
1311
+ * const alternatives = new RegexParser("").parse().rootNode.patternNode.disjunctionNode.children;
1312
+ * console.assert(alternatives.length === 1);
1313
+ * console.assert(alternatives[0].children.length === 0);
1314
+ * ```
1315
+ */
1316
+ export declare class RegexDisjunctionNode extends CompositeNode {
1317
+ /**
1318
+ * A non-empty snapshot of the ordered alternatives. Later changes to the
1319
+ * caller's collection do not alter this node.
1320
+ */
1321
+ public readonly children: readonly [RegexAlternativeNode, ...RegexAlternativeNode[]];
1322
+
1323
+ /**
1324
+ * Creates a disjunction from its ordered alternatives and exact source span.
1325
+ *
1326
+ * @param alternatives One or more alternatives in source order, including empty alternatives. The array is copied; the alternative nodes remain shared.
1327
+ * @param span The absolute UTF-16 source span of the disjunction.
1328
+ * @throws ArgumentException If the collection is empty.
1329
+ *
1330
+ * @see {@link RegexDisjunctionNode} for usage and {@link RegexNode} for shared node-construction contracts.
1331
+ */
1332
+ public constructor(alternatives: readonly RegexAlternativeNode[], span: SourceSpan);
1333
+ }
1334
+
1335
+ /**
1336
+ * The regular-expression wildcard atom represented by `.`.
1337
+ */
1338
+ export declare class RegexDotNode extends ValueNode {
1339
+ /**
1340
+ * Creates the wildcard atom at its exact source span.
1341
+ *
1342
+ * @param span The absolute UTF-16 source span of the wildcard atom.
1343
+ *
1344
+ * @see {@link RegexAsteriskNode} for usage and {@link RegexNode} for shared node-construction contracts.
1345
+ */
1346
+ public constructor(span: SourceSpan);
1347
+ }
1348
+
1349
+ /**
1350
+ * The flags supplied with a regular expression.
1351
+ *
1352
+ * Booleans describe the presence of flag characters, not successful validation.
1353
+ * Unknown, repeated, or conflicting flags remain in value; {@link RegexParser}
1354
+ * reports their diagnostics. These fields describe matching options but do not
1355
+ * perform matching.
1356
+ *
1357
+ * @example Invalid combinations are preserved for inspection.
1358
+ * ```ts
1359
+ * import { RegexParser } from "@noldova/context.parsers.regex";
1360
+ *
1361
+ * const result = new RegexParser("a", "uv").parse();
1362
+ * console.assert(result.rootNode.flagsNode.value === "uv");
1363
+ * console.assert(result.rootNode.flagsNode.unicode && result.rootNode.flagsNode.unicodeSets);
1364
+ * console.assert(result.diagnostics.length > 0);
1365
+ * ```
1366
+ */
1367
+ export declare class RegexFlagsNode extends ValueNode {
1368
+ /**
1369
+ * Whether match indices are requested by the `d` flag.
1370
+ */
1371
+ public readonly hasIndices: boolean;
1372
+
1373
+ /**
1374
+ * Whether all matches are requested by the `g` flag.
1375
+ */
1376
+ public readonly global: boolean;
1377
+
1378
+ /**
1379
+ * Whether matching ignores case differences through the `i` flag.
1380
+ */
1381
+ public readonly ignoreCase: boolean;
1382
+
1383
+ /**
1384
+ * Whether line boundaries affect anchors through the `m` flag.
1385
+ */
1386
+ public readonly multiline: boolean;
1387
+
1388
+ /**
1389
+ * Whether the wildcard matches line terminators through the `s` flag.
1390
+ */
1391
+ public readonly dotAll: boolean;
1392
+
1393
+ /**
1394
+ * Whether Unicode-aware matching is enabled through the `u` flag.
1395
+ */
1396
+ public readonly unicode: boolean;
1397
+
1398
+ /**
1399
+ * Whether Unicode set notation is enabled through the `v` flag.
1400
+ */
1401
+ public readonly unicodeSets: boolean;
1402
+
1403
+ /**
1404
+ * Whether matching begins at the current last index through the `y` flag.
1405
+ */
1406
+ public readonly sticky: boolean;
1407
+
1408
+ /**
1409
+ * Creates the parsed flag value at its exact source span.
1410
+ *
1411
+ * @param value The exact supplied flags, normally a non-repeating selection from dgimsuvy with at most one of u and v; may be empty or invalid.
1412
+ * @param span The absolute UTF-16 source span of the flags.
1413
+ *
1414
+ * @see {@link RegexFlagsNode} for usage and {@link RegexNode} for shared node-construction contracts.
1415
+ */
1416
+ public constructor(value: string, span: SourceSpan);
1417
+ }
1418
+
1419
+ /**
1420
+ * A raw UTF-16 code unit in a legacy pattern or a code point in a Unicode-aware
1421
+ * pattern. Group-name lexing uses code points regardless of the flags.
1422
+ *
1423
+ * @example The mode controls atom boundaries, while all spans remain UTF-16 based.
1424
+ * ```ts
1425
+ * import { RegexCharacterNode, RegexParser } from "@noldova/context.parsers.regex";
1426
+ *
1427
+ * const legacy = new RegexParser("😀").parse().rootNode.patternNode.disjunctionNode.children[0].children;
1428
+ * const unicode = new RegexParser("😀", "u").parse().rootNode.patternNode.disjunctionNode.children[0].children;
1429
+ * console.assert(legacy.length === 2 && legacy[0]?.span.length === 1);
1430
+ * const character = unicode[0];
1431
+ * console.assert(unicode.length === 1);
1432
+ * console.assert(character instanceof RegexCharacterNode && character.value === "😀" && character.span.length === 2);
1433
+ * ```
1434
+ */
1435
+ export declare class RegexCharacterNode extends ValueNode {
1436
+ /**
1437
+ * Creates a literal character from its source value.
1438
+ *
1439
+ * @param value One raw UTF-16 code unit in legacy mode, or one raw code point in Unicode-aware mode or a group name; a code point may occupy two units.
1440
+ * @param span The absolute UTF-16 source span of the character.
1441
+ *
1442
+ * @see {@link RegexCharacterNode} for usage and {@link RegexNode} for shared node-construction contracts.
1443
+ */
1444
+ public constructor(value: string, span: SourceSpan);
1445
+ }
1446
+
1447
+ /**
1448
+ * The root of a parsed regular expression.
1449
+ *
1450
+ * Node spans use absolute UTF-16 code-unit offsets in the original source,
1451
+ * including delimiters where the represented construct has them. Nodes store
1452
+ * spans, not source identities; diagnostics preserve a supplied Source's identity.
1453
+ *
1454
+ * Constructors assemble the values supplied by the caller; they do not parse or
1455
+ * revalidate ECMAScript grammar. Keep source spelling, decoded fields, child
1456
+ * roles, and spans consistent. Use {@link RegexParser} when accepting source text.
1457
+ * Children and spans are retained by reference. Collection constructors document
1458
+ * whether they retain the array or copy it; neither operation clones child nodes.
1459
+ *
1460
+ * @example Assemble a small tree; an atom and its quantifier remain separate children.
1461
+ * ```ts
1462
+ * import { SourceSpan } from "@noldova/context.parsers";
1463
+ * import {
1464
+ * RegexAlternativeNode, RegexCharacterNode, RegexDisjunctionNode, RegexFlagsNode,
1465
+ * RegexNode, RegexPatternNode, RegexQuantifierNode
1466
+ * } from "@noldova/context.parsers.regex";
1467
+ *
1468
+ * const character = new RegexCharacterNode("a", new SourceSpan(0, 1));
1469
+ * const quantifier = new RegexQuantifierNode("+", 1n, undefined, true, new SourceSpan(1, 1));
1470
+ * const alternative = new RegexAlternativeNode([character, quantifier], new SourceSpan(0, 2));
1471
+ * const disjunction = new RegexDisjunctionNode([alternative], new SourceSpan(0, 2));
1472
+ * const pattern = new RegexPatternNode("a+", disjunction, new SourceSpan(0, 2));
1473
+ * const flags = new RegexFlagsNode("u", new SourceSpan(2, 1));
1474
+ * const root = new RegexNode("a+u", pattern, flags, new SourceSpan(0, 3));
1475
+ * console.assert(root.patternNode.disjunctionNode.children[0].children[1] === quantifier);
1476
+ * console.assert(root.flagsNode.unicode);
1477
+ * ```
1478
+ */
1479
+ export declare class RegexNode extends Node {
1480
+ /**
1481
+ * The exact inputSpan text for source/reader input, including supplied host
1482
+ * delimiters; for string input, the pattern followed by flags without added delimiters.
1483
+ */
1484
+ public readonly rawValue: string;
1485
+
1486
+ /**
1487
+ * The parsed pattern.
1488
+ */
1489
+ public readonly patternNode: RegexPatternNode;
1490
+
1491
+ /**
1492
+ * The parsed flags.
1493
+ */
1494
+ public readonly flagsNode: RegexFlagsNode;
1495
+
1496
+ /**
1497
+ * Creates a regular-expression root from its original and parsed forms.
1498
+ *
1499
+ * @param rawValue The exact text covered by span, including any supplied host delimiters and flags; no delimiters are synthesized.
1500
+ * @param patternNode The parsed pattern.
1501
+ * @param flagsNode The parsed flags.
1502
+ * @param span The absolute UTF-16 source span of the complete regular expression.
1503
+ * @param leadingTrivia Optional outer-language trivia before the expression, retained by reference. Omission means no leading trivia.
1504
+ * @param trailingTrivia Optional outer-language trivia after the expression, retained by reference. Omission means no trailing trivia.
1505
+ *
1506
+ * @see {@link RegexNode} for tree-construction examples and shared node contracts.
1507
+ */
1508
+ public constructor(
1509
+ rawValue: string,
1510
+ patternNode: RegexPatternNode,
1511
+ flagsNode: RegexFlagsNode,
1512
+ span: SourceSpan,
1513
+ leadingTrivia?: Node,
1514
+ trailingTrivia?: Node);
1515
+ }
1516
+
1517
+ /**
1518
+ * An ECMAScript regular-expression pattern and its parsed disjunction.
1519
+ */
1520
+ export declare class RegexPatternNode extends Node {
1521
+ /**
1522
+ * The original pattern text without delimiters or flags.
1523
+ */
1524
+ public readonly value: string;
1525
+
1526
+ /**
1527
+ * The parsed top-level disjunction.
1528
+ */
1529
+ public readonly disjunctionNode: RegexDisjunctionNode;
1530
+
1531
+ /**
1532
+ * Creates a pattern from its original text and parsed disjunction.
1533
+ *
1534
+ * @param value The original pattern text without delimiters or flags.
1535
+ * @param disjunctionNode The parsed top-level disjunction.
1536
+ * @param span The absolute UTF-16 source span of the pattern.
1537
+ *
1538
+ * @see {@link RegexNode} for tree-construction examples and shared node contracts.
1539
+ */
1540
+ public constructor(value: string, disjunctionNode: RegexDisjunctionNode, span: SourceSpan);
1541
+ }
1542
+
1543
+ /**
1544
+ * A quantifier applied to the immediately preceding regular-expression atom.
1545
+ *
1546
+ * The bounds use bigint so large decimal counts do not lose precision. A malformed
1547
+ * bounded quantifier can retain minimum greater than maximum with a diagnostic;
1548
+ * its existence in a recovered AST is not evidence of valid repetition semantics.
1549
+ *
1550
+ * @example Read unbounded and lazy bounded repetition without parsing the spelling yourself.
1551
+ * ```ts
1552
+ * import { RegexParser, RegexQuantifierNode } from "@noldova/context.parsers.regex";
1553
+ *
1554
+ * const nodes = new RegexParser("a*b{2,4}?").parse().rootNode.patternNode.disjunctionNode.children[0].children;
1555
+ * const unbounded = nodes[1];
1556
+ * const bounded = nodes[3];
1557
+ * console.assert(unbounded instanceof RegexQuantifierNode && unbounded.minimum === 0n && unbounded.maximum === undefined);
1558
+ * if (bounded instanceof RegexQuantifierNode)
1559
+ * console.assert(bounded.minimum === 2n && bounded.maximum === 4n && !bounded.greedy);
1560
+ * ```
1561
+ */
1562
+ export declare class RegexQuantifierNode extends ValueNode {
1563
+ /**
1564
+ * The minimum number of matches required.
1565
+ */
1566
+ public readonly minimum: bigint;
1567
+
1568
+ /**
1569
+ * The maximum number of matches permitted, or `undefined` when unbounded.
1570
+ */
1571
+ public readonly maximum: bigint | undefined;
1572
+
1573
+ /**
1574
+ * Whether the quantifier initially attempts the greatest permitted match count.
1575
+ */
1576
+ public readonly greedy: boolean;
1577
+
1578
+ /**
1579
+ * Creates a quantifier from its source value and parsed repetition bounds.
1580
+ *
1581
+ * @param value The original quantifier text, including a non-greedy suffix when present.
1582
+ * @param minimum The non-negative repetition count from the source, without floating-point precision loss.
1583
+ * @param maximum The non-negative upper count, or undefined when unbounded. Invalid bounded source may preserve a count smaller than minimum.
1584
+ * @param greedy Whether the quantifier initially attempts the greatest permitted match count.
1585
+ * @param span The absolute UTF-16 source span of the quantifier.
1586
+ *
1587
+ * @see {@link RegexQuantifierNode} for usage and {@link RegexNode} for shared node-construction contracts.
1588
+ */
1589
+ public constructor(value: string, minimum: bigint, maximum: bigint | undefined, greedy: boolean, span: SourceSpan);
1590
+ }
1591
+
1592
+ /**
1593
+ * Source text retained when token classification fails or syntax recovery skips
1594
+ * a region, including recovery from the parser's nesting limit.
1595
+ *
1596
+ * @example Malformed escape text remains represented in a diagnostic-bearing tree.
1597
+ * ```ts
1598
+ * import { RegexParser, RegexUnknownNode } from "@noldova/context.parsers.regex";
1599
+ *
1600
+ * const result = new RegexParser("\\xQ", "u").parse();
1601
+ * const first = result.rootNode.patternNode.disjunctionNode.children[0].children[0];
1602
+ * console.assert(result.diagnostics.length > 0);
1603
+ * console.assert(first instanceof RegexUnknownNode);
1604
+ * ```
1605
+ */
1606
+ export declare class RegexUnknownNode extends ValueNode {
1607
+ /**
1608
+ * Creates an unknown token from its exact source text.
1609
+ *
1610
+ * @param value The exact malformed or skipped source spelling, without normalization.
1611
+ * @param span The absolute UTF-16 source span of the token.
1612
+ *
1613
+ * @see {@link RegexUnknownNode} for usage and {@link RegexNode} for shared node-construction contracts.
1614
+ */
1615
+ public constructor(value: string, span: SourceSpan);
1616
+ }
1617
+
1618
+ /**
1619
+ * Parses one ECMAScript regular-expression input and returns its AST and
1620
+ * diagnostics. Construct a new parser for each parse operation and call
1621
+ * {@link parse} once; token navigation, the lexer, and the parser context are internal.
1622
+ *
1623
+ * The implementation supports 512 enclosing groups and character classes
1624
+ * combined. Deeper input produces CTX1037 and is skipped to its closing
1625
+ * delimiter or the pattern boundary. This is an implementation limit, not an
1626
+ * ECMAScript grammar restriction.
1627
+ *
1628
+ * The accepted language profile is ECMAScript regular-expression syntax aligned
1629
+ * with TypeScript 7.0.2 and Unicode 15.1. Parsing does not execute a pattern,
1630
+ * match a subject string, or require the host RegExp engine's Unicode tables.
1631
+ *
1632
+ * @example Parse standalone text, inspect diagnostics, and keep the result after the session ends.
1633
+ * ```ts
1634
+ * import { RegexParser } from "@noldova/context.parsers.regex";
1635
+ *
1636
+ * const parser = new RegexParser("a+", "u");
1637
+ * const result = parser.parse();
1638
+ * console.assert(result.diagnostics.length === 0);
1639
+ * console.assert(result.rootNode.patternNode.value === "a+");
1640
+ * console.assert(result.rootNode.rawValue === "a+u"); // No slash delimiters were supplied.
1641
+ *
1642
+ * const invalid = new RegexParser("(", "u").parse();
1643
+ * console.assert(invalid.diagnostics.length > 0); // Source errors are data, not thrown exceptions.
1644
+ * console.assert(invalid.rootNode.patternNode.value === "(");
1645
+ * ```
1646
+ *
1647
+ * @example A second parse attempt is a caller error, not a syntax diagnostic.
1648
+ * ```ts
1649
+ * import { ParserException } from "@noldova/context.parsers";
1650
+ * import { RegexParser } from "@noldova/context.parsers.regex";
1651
+ *
1652
+ * const parser = new RegexParser("");
1653
+ * const first = parser.parse();
1654
+ * let rejected = false;
1655
+ * try {
1656
+ * parser.parse();
1657
+ * }
1658
+ * catch (error) {
1659
+ * if (!(error instanceof ParserException))
1660
+ * throw error;
1661
+ * rejected = true;
1662
+ * }
1663
+ * console.assert(rejected && first.rootNode.patternNode.value === "");
1664
+ * ```
1665
+ */
1666
+ export declare class RegexParser {
1667
+ /**
1668
+ * Creates a parser for a pattern without host delimiters.
1669
+ *
1670
+ * @param pattern The pattern alone, with no enclosing slash delimiters; may be empty. Escape backslashes as required by the host string syntax.
1671
+ * @param flags The exact flag text; defaults to empty. Valid flags are dgimsuvy without duplicates and with at most one of u and v; invalid flags yield diagnostics.
1672
+ * @remarks An anonymous source contains the pattern followed by the flags.
1673
+ * Pattern spans start at zero; flag spans follow the pattern. The root's raw
1674
+ * value is that combined source text, without synthesized slash delimiters.
1675
+ *
1676
+ * @see {@link RegexParser} for standalone parsing and lifecycle examples.
1677
+ */
1678
+ public constructor(pattern: string, flags?: string);
1679
+
1680
+ /**
1681
+ * Creates a parser for a bounded pattern within an existing source.
1682
+ *
1683
+ * @param source The immutable source shared with the embedding language; its optional identity is preserved in diagnostic locations.
1684
+ * @param patternSpan The bounded UTF-16 pattern region, excluding host delimiters and flags. May be empty; must lie within inputSpan.
1685
+ * @param flagsSpan The UTF-16 flags region at or after patternSpan.endOffset, contained in inputSpan. Use an empty span when there are no flags.
1686
+ * @param inputSpan The complete UTF-16 input region containing patternSpan and flagsSpan, including supplied host delimiters. Must lie within source.
1687
+ * @remarks All spans are absolute UTF-16 offsets in the supplied source.
1688
+ * The pattern and flags must remain within inputSpan. Parsing uses a new
1689
+ * bounded reader and preserves the source's optional identity in diagnostics.
1690
+ * @throws InvalidSpanException If any region extends outside source.
1691
+ * @throws ArgumentException If the pattern or flags lie outside inputSpan, or flags begin before the pattern ends.
1692
+ *
1693
+ * @example Parse an embedded literal while retaining host offsets and diagnostic identity.
1694
+ * ```ts
1695
+ * import { Source, SourceSpan } from "@noldova/context.parsers";
1696
+ * import { RegexParser } from "@noldova/context.parsers.regex";
1697
+ *
1698
+ * const source = new Source("before /(/u after", "example.ctx");
1699
+ * const result = new RegexParser(source, new SourceSpan(8, 1), new SourceSpan(10, 1), new SourceSpan(7, 4)).parse();
1700
+ * console.assert(result.rootNode.rawValue === "/(/u");
1701
+ * console.assert(result.rootNode.span.startOffset === 7);
1702
+ * console.assert(result.rootNode.patternNode.span.startOffset === 8);
1703
+ * console.assert(result.diagnostics.length > 0);
1704
+ * console.assert(result.diagnostics[0]?.location?.sourceIdentity === "example.ctx");
1705
+ * ```
1706
+ */
1707
+ public constructor(source: Source, patternSpan: SourceSpan, flagsSpan: SourceSpan, inputSpan: SourceSpan);
1708
+
1709
+ /**
1710
+ * Creates a parser that consumes a caller-supplied bounded reader.
1711
+ *
1712
+ * @param reader The shared bounded pattern reader, positioned exactly at startOffset; an empty region is allowed. Construction may advance it to lex the first token.
1713
+ * @param flagsSpan The UTF-16 flags region at or after reader.endOffset and within inputSpan; may be empty.
1714
+ * @param inputSpan The complete UTF-16 input region containing the reader's region and flagsSpan, within the reader's source.
1715
+ * @remarks Construction and parsing use the same reader. Do not move it externally
1716
+ * until parse returns. A completed parse leaves it at endOffset without consuming
1717
+ * surrounding text; all spans are absolute UTF-16 source coordinates.
1718
+ * @throws InvalidSpanException If flagsSpan or inputSpan extends outside the reader's source.
1719
+ * @throws ArgumentException If the reader is not at startOffset, its region or flags lie outside inputSpan, or flags begin before reader.endOffset.
1720
+ *
1721
+ * @example The host owns delimiters and bounds; the Regex parser consumes only the pattern region.
1722
+ * ```ts
1723
+ * import { Source, SourceReader, SourceSpan } from "@noldova/context.parsers";
1724
+ * import { RegexParser } from "@noldova/context.parsers.regex";
1725
+ *
1726
+ * const source = new Source("before /a+/u after");
1727
+ * const reader = new SourceReader(source, new SourceSpan(8, 2));
1728
+ * const parser = new RegexParser(reader, new SourceSpan(11, 1), new SourceSpan(7, 5));
1729
+ * const result = parser.parse();
1730
+ * console.assert(reader.currentOffset === 10);
1731
+ * console.assert(source.getText(reader.currentOffset, 1) === "/");
1732
+ * console.assert(result.rootNode.rawValue === "/a+/u");
1733
+ * console.assert(result.diagnostics.length === 0);
1734
+ * ```
1735
+ */
1736
+ public constructor(reader: SourceReader, flagsSpan: SourceSpan, inputSpan: SourceSpan);
1737
+
1738
+ /**
1739
+ * Parses the complete pattern and validates its flags.
1740
+ *
1741
+ * @returns The recovered AST and a diagnostic snapshot in encounter order. A
1742
+ * clean parse has an empty diagnostic collection; malformed syntax is reported
1743
+ * through diagnostics and can leave recovery nodes in the tree. The result
1744
+ * remains usable after the single-use parser session ends; it does not expose
1745
+ * the internal lexer or parser context.
1746
+ * @throws ParserException If this session has already attempted parsing.
1747
+ * Create a new parser for another operation; the first result remains usable.
1748
+ *
1749
+ * @see {@link RegexParser} for successful parsing, diagnostics, and single-use examples.
1750
+ */
1751
+ public parse(): ParserResult<RegexNode>;
1752
+ }