@thi.ng/sax
Advanced tools
Comparing version 2.1.122 to 2.1.123
# Change Log | ||
- **Last updated**: 2024-05-08T18:24:32Z | ||
- **Last updated**: 2024-06-21T19:34:38Z | ||
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub) | ||
@@ -12,2 +12,8 @@ | ||
### [2.1.123](https://github.com/thi-ng/umbrella/tree/@thi.ng/sax@2.1.123) (2024-06-21) | ||
#### ♻️ Refactoring | ||
- enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2)) | ||
### [2.1.78](https://github.com/thi-ng/umbrella/tree/@thi.ng/sax@2.1.78) (2023-11-09) | ||
@@ -14,0 +20,0 @@ |
82
index.js
@@ -64,3 +64,3 @@ import { NO_OP } from "@thi.ng/api/api"; | ||
} | ||
const isWS = (x) => { | ||
const __isWS = (x) => { | ||
const c = x.charCodeAt(0); | ||
@@ -72,3 +72,3 @@ return c === 32 || // space | ||
}; | ||
const isTagChar = (x) => { | ||
const __isTagChar = (x) => { | ||
const c = x.charCodeAt(0); | ||
@@ -82,8 +82,8 @@ return c >= 65 && c <= 90 || // A-Z | ||
}; | ||
const error = (s, body) => { | ||
const __error = (s, body) => { | ||
s.state = 1 /* ERROR */; | ||
return [{ type: 7 /* ERROR */, body }]; | ||
}; | ||
const illegalEscape = (s, ch) => error(s, `illegal escape sequence: \\${ch} @ pos ${s.pos - 1}`); | ||
const unexpected = (s, x) => error(s, `unexpected char: '${x}' @ pos ${s.pos}`); | ||
const __illegalEscape = (s, ch) => __error(s, `illegal escape sequence: \\${ch} @ pos ${s.pos - 1}`); | ||
const __unexpected = (s, x) => __error(s, `unexpected char: '${x}' @ pos ${s.pos}`); | ||
const PARSER = { | ||
@@ -93,7 +93,7 @@ [1 /* ERROR */]: NO_OP, | ||
state.pos++; | ||
if (!isWS(ch)) { | ||
if (!__isWS(ch)) { | ||
if (ch === "<") { | ||
state.state = 2 /* MAYBE_ELEM */; | ||
} else { | ||
return unexpected(state, ch); | ||
return __unexpected(state, ch); | ||
} | ||
@@ -106,7 +106,7 @@ } | ||
if (state.scope.length == 0) { | ||
return unexpected(state, ch); | ||
return __unexpected(state, ch); | ||
} | ||
state.state = 4 /* ELEM_END */; | ||
state.tag = ""; | ||
} else if (isTagChar(ch)) { | ||
} else if (__isTagChar(ch)) { | ||
state.state = 3 /* ELEM_START */; | ||
@@ -123,3 +123,3 @@ state.tag = ch; | ||
} else { | ||
return unexpected(state, ch); | ||
return __unexpected(state, ch); | ||
} | ||
@@ -129,12 +129,12 @@ }, | ||
state.pos++; | ||
if (isTagChar(ch)) { | ||
if (__isTagChar(ch)) { | ||
state.tag += ch; | ||
} else if (isWS(ch)) { | ||
} else if (__isWS(ch)) { | ||
state.state = 7 /* MAYBE_ATTRIB */; | ||
} else if (ch === ">") { | ||
return beginElementBody(state); | ||
return __beginElementBody(state); | ||
} else if (ch === "/") { | ||
state.state = 5 /* ELEM_SINGLE */; | ||
} else { | ||
return unexpected(state, ch); | ||
return __unexpected(state, ch); | ||
} | ||
@@ -144,3 +144,3 @@ }, | ||
state.pos++; | ||
if (isTagChar(ch)) { | ||
if (__isTagChar(ch)) { | ||
state.tag += ch; | ||
@@ -158,3 +158,3 @@ } else if (ch === ">") { | ||
} else { | ||
return error( | ||
return __error( | ||
state, | ||
@@ -180,3 +180,3 @@ `unmatched tag: '${state.tag}' @ pos ${state.pos - state.tag.length - 2}` | ||
} else { | ||
return unexpected(state, ch); | ||
return __unexpected(state, ch); | ||
} | ||
@@ -213,3 +213,3 @@ }, | ||
} else { | ||
return illegalEscape(state, ch); | ||
return __illegalEscape(state, ch); | ||
} | ||
@@ -222,3 +222,3 @@ } | ||
state.pos++; | ||
if (isTagChar(ch)) { | ||
if (__isTagChar(ch)) { | ||
state.state = 8 /* ATTRIB_NAME */; | ||
@@ -231,12 +231,12 @@ state.name = ch; | ||
state.state = 16 /* PROC_END */; | ||
} else if (!isWS(ch)) { | ||
return unexpected(state, ch); | ||
} else if (!__isWS(ch)) { | ||
return __unexpected(state, ch); | ||
} | ||
} else { | ||
if (ch === ">") { | ||
return beginElementBody(state); | ||
return __beginElementBody(state); | ||
} else if (ch === "/") { | ||
state.state = 5 /* ELEM_SINGLE */; | ||
} else if (!isWS(ch)) { | ||
return unexpected(state, ch); | ||
} else if (!__isWS(ch)) { | ||
return __unexpected(state, ch); | ||
} | ||
@@ -248,3 +248,3 @@ } | ||
state.pos++; | ||
if (isTagChar(ch)) { | ||
if (__isTagChar(ch)) { | ||
state.name += ch; | ||
@@ -255,3 +255,3 @@ } else if (ch === "=") { | ||
if (!state.name || !state.name.length) { | ||
return error(state, "missing attribute name"); | ||
return __error(state, "missing attribute name"); | ||
} | ||
@@ -267,8 +267,8 @@ if (ch === " ") { | ||
state.attribs[state.name] = true; | ||
return beginElementBody(state); | ||
return __beginElementBody(state); | ||
} else { | ||
return unexpected(state, ch); | ||
return __unexpected(state, ch); | ||
} | ||
} else { | ||
return unexpected(state, ch); | ||
return __unexpected(state, ch); | ||
} | ||
@@ -282,3 +282,3 @@ }, | ||
} else { | ||
return unexpected(state, ch); | ||
return __unexpected(state, ch); | ||
} | ||
@@ -295,3 +295,3 @@ }, | ||
} else { | ||
return illegalEscape(state, ch); | ||
return __illegalEscape(state, ch); | ||
} | ||
@@ -322,3 +322,3 @@ } | ||
} else { | ||
return unexpected(state, ch); | ||
return __unexpected(state, ch); | ||
} | ||
@@ -332,3 +332,3 @@ }, | ||
} else { | ||
return unexpected(state, ch); | ||
return __unexpected(state, ch); | ||
} | ||
@@ -341,3 +341,3 @@ }, | ||
if (state.body.substring(n - 2) !== "--") { | ||
return unexpected(state, ch); | ||
return __unexpected(state, ch); | ||
} | ||
@@ -363,3 +363,3 @@ state.state = 0 /* WAIT */; | ||
} else { | ||
return unexpected(state, ch); | ||
return __unexpected(state, ch); | ||
} | ||
@@ -379,3 +379,3 @@ } else if (ch === ">") { | ||
} else { | ||
return unexpected(state, ch); | ||
return __unexpected(state, ch); | ||
} | ||
@@ -403,5 +403,5 @@ } else if (ch === ">") { | ||
state.pos++; | ||
if (isTagChar(ch)) { | ||
if (__isTagChar(ch)) { | ||
state.tag += ch; | ||
} else if (isWS(ch)) { | ||
} else if (__isWS(ch)) { | ||
state.state = 7 /* MAYBE_ATTRIB */; | ||
@@ -411,3 +411,3 @@ state.isProc = true; | ||
} else { | ||
return unexpected(state, ch); | ||
return __unexpected(state, ch); | ||
} | ||
@@ -424,7 +424,7 @@ }, | ||
} else { | ||
return unexpected(state, ch); | ||
return __unexpected(state, ch); | ||
} | ||
} | ||
}; | ||
const beginElementBody = (state) => { | ||
const __beginElementBody = (state) => { | ||
state.state = 6 /* ELEM_BODY */; | ||
@@ -431,0 +431,0 @@ state.scope.push({ tag: state.tag, attribs: state.attribs, children: [] }); |
{ | ||
"name": "@thi.ng/sax", | ||
"version": "2.1.122", | ||
"version": "2.1.123", | ||
"description": "Transducer-based, SAX-like, non-validating, speedy & tiny XML parser", | ||
@@ -13,3 +13,3 @@ "type": "module", | ||
}, | ||
"homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/sax#readme", | ||
"homepage": "https://thi.ng/sax", | ||
"funding": [ | ||
@@ -40,12 +40,12 @@ { | ||
"dependencies": { | ||
"@thi.ng/api": "^8.11.2", | ||
"@thi.ng/strings": "^3.7.33", | ||
"@thi.ng/transducers": "^9.0.5", | ||
"@thi.ng/transducers-fsm": "^2.2.87" | ||
"@thi.ng/api": "^8.11.3", | ||
"@thi.ng/strings": "^3.7.34", | ||
"@thi.ng/transducers": "^9.0.6", | ||
"@thi.ng/transducers-fsm": "^2.2.88" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "^7.43.2", | ||
"esbuild": "^0.21.1", | ||
"@microsoft/api-extractor": "^7.47.0", | ||
"esbuild": "^0.21.5", | ||
"typedoc": "^0.25.13", | ||
"typescript": "^5.4.5" | ||
"typescript": "^5.5.2" | ||
}, | ||
@@ -85,3 +85,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n" | ||
"gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n" | ||
} |
@@ -10,3 +10,3 @@ <!-- This file is generated - DO NOT EDIT! --> | ||
> [!NOTE] | ||
> This is one of 192 standalone projects, maintained as part | ||
> This is one of 193 standalone projects, maintained as part | ||
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo | ||
@@ -13,0 +13,0 @@ > and anti-framework. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50147
Updated@thi.ng/api@^8.11.3
Updated@thi.ng/strings@^3.7.34
Updated@thi.ng/transducers@^9.0.6