@usearazzo/parser 1.0.1-alpha.21 → 1.0.1-alpha.23
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.
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.1-alpha.23](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.22...v1.0.1-alpha.23) (2026-11-04)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @usearazzo/parser
|
|
9
|
+
|
|
10
|
+
## [1.0.1-alpha.22](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.21...v1.0.1-alpha.22) (2026-11-04)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @usearazzo/parser
|
|
13
|
+
|
|
6
14
|
## [1.0.1-alpha.21](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.20...v1.0.1-alpha.21) (2026-11-03)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @usearazzo/parser
|
|
@@ -54270,6 +54270,11 @@ const Ast = function fnast() {
|
|
|
54270
54270
|
let depth = 0;
|
|
54271
54271
|
xml += '<?xml version="1.0" encoding="utf-8"?>\n';
|
|
54272
54272
|
xml += `<root nodes="${records.length / 2}" characters="${chars.length}">\n`;
|
|
54273
|
+
xml += `<!--\n`;
|
|
54274
|
+
xml += ` Caveat: AST node phrases may not be faithfully represented.\n`;
|
|
54275
|
+
xml += ` Invalid XML characters are replaced with 0xFFFD.\n`;
|
|
54276
|
+
xml += ` Special characters &<>"\' are escaped with XML entities.\n`;
|
|
54277
|
+
xml += `-->\n`;
|
|
54273
54278
|
xml += `<!-- input string -->\n`;
|
|
54274
54279
|
xml += indent(depth + 2);
|
|
54275
54280
|
xml += utils.charsToXmlString(chars);
|
|
@@ -54662,14 +54667,49 @@ const utilities = {
|
|
|
54662
54667
|
}
|
|
54663
54668
|
return String.fromCodePoint(...subChars);
|
|
54664
54669
|
},
|
|
54665
|
-
charsToXmlString: (chars, beg, len) =>
|
|
54666
|
-
|
|
54667
|
-
|
|
54670
|
+
charsToXmlString: (chars, beg, len) => {
|
|
54671
|
+
function isInvalidXmlCodePoint(code) {
|
|
54672
|
+
return (
|
|
54673
|
+
!Number.isFinite(code) ||
|
|
54674
|
+
code < 0 ||
|
|
54675
|
+
code > 0x10ffff ||
|
|
54676
|
+
(code >= 0x0000 && code <= 0x0008) ||
|
|
54677
|
+
(code >= 0x000b && code <= 0x000c) ||
|
|
54678
|
+
(code >= 0x000e && code <= 0x001f) ||
|
|
54679
|
+
(code >= 0xd800 && code <= 0xdfff) ||
|
|
54680
|
+
(code >= 0xfffe && code <= 0xffff)
|
|
54681
|
+
);
|
|
54682
|
+
}
|
|
54683
|
+
let start = 0;
|
|
54684
|
+
let finish = chars.length;
|
|
54685
|
+
|
|
54686
|
+
if (typeof beg === 'number') {
|
|
54687
|
+
if (beg >= chars.length) {
|
|
54688
|
+
return '';
|
|
54689
|
+
}
|
|
54690
|
+
start = beg < 0 ? 0 : beg;
|
|
54691
|
+
}
|
|
54692
|
+
if (typeof len === 'number') {
|
|
54693
|
+
if (len <= 0) {
|
|
54694
|
+
return '';
|
|
54695
|
+
}
|
|
54696
|
+
finish = len > chars.length - start ? chars.length : start + len;
|
|
54697
|
+
}
|
|
54698
|
+
|
|
54699
|
+
const sanitized = chars.slice(start, finish).map((code) => (isInvalidXmlCodePoint(code) ? 0xfffd : code));
|
|
54700
|
+
const CHUNK = 0x8000;
|
|
54701
|
+
let out = '';
|
|
54702
|
+
for (let i = 0; i < sanitized.length; i += CHUNK) {
|
|
54703
|
+
out += String.fromCodePoint.apply(null, sanitized.slice(i, i + CHUNK));
|
|
54704
|
+
}
|
|
54705
|
+
|
|
54706
|
+
return out
|
|
54668
54707
|
.replace(/&/g, '&')
|
|
54669
54708
|
.replace(/</g, '<')
|
|
54670
54709
|
.replace(/>/g, '>')
|
|
54671
54710
|
.replace(/'/g, ''')
|
|
54672
|
-
.replace(/"/g, '"')
|
|
54711
|
+
.replace(/"/g, '"');
|
|
54712
|
+
},
|
|
54673
54713
|
};
|
|
54674
54714
|
|
|
54675
54715
|
const identifiers = {
|