eyeling 1.6.12 → 1.6.13
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/eyeling.js +29 -0
- package/package.json +1 -1
package/eyeling.js
CHANGED
|
@@ -2049,6 +2049,13 @@ function unifyTerm(a, b, subst) {
|
|
|
2049
2049
|
if (literalsEquivalentAsXsdString(a.value, b.value)) return { ...subst };
|
|
2050
2050
|
}
|
|
2051
2051
|
|
|
2052
|
+
// Boolean-value match: treat untyped true/false tokens and xsd:boolean as equal.
|
|
2053
|
+
if (a instanceof Literal && b instanceof Literal) {
|
|
2054
|
+
const ai = parseBooleanLiteralInfo(a);
|
|
2055
|
+
const bi = parseBooleanLiteralInfo(b);
|
|
2056
|
+
if (ai && bi && ai.value === bi.value) return { ...subst };
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2052
2059
|
// Numeric-value match for literals, BUT ONLY when datatypes agree (or infer to agree)
|
|
2053
2060
|
if (a instanceof Literal && b instanceof Literal) {
|
|
2054
2061
|
const ai = parseNumericLiteralInfo(a);
|
|
@@ -2537,6 +2544,28 @@ const XSD_INTEGER_DERIVED_DTS = new Set([
|
|
|
2537
2544
|
XSD_NS + 'positiveInteger',
|
|
2538
2545
|
]);
|
|
2539
2546
|
|
|
2547
|
+
function parseBooleanLiteralInfo(t) {
|
|
2548
|
+
if (!(t instanceof Literal)) return null;
|
|
2549
|
+
|
|
2550
|
+
const boolDt = XSD_NS + 'boolean';
|
|
2551
|
+
const v = t.value;
|
|
2552
|
+
const [lex, dt] = literalParts(v);
|
|
2553
|
+
|
|
2554
|
+
// Typed xsd:boolean: accept "true"/"false"/"1"/"0"
|
|
2555
|
+
if (dt !== null) {
|
|
2556
|
+
if (dt !== boolDt) return null;
|
|
2557
|
+
const s = stripQuotes(lex);
|
|
2558
|
+
if (s === 'true' || s === '1') return { dt: boolDt, value: true };
|
|
2559
|
+
if (s === 'false' || s === '0') return { dt: boolDt, value: false };
|
|
2560
|
+
return null;
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
// Untyped boolean token: true/false
|
|
2564
|
+
if (v === 'true') return { dt: boolDt, value: true };
|
|
2565
|
+
if (v === 'false') return { dt: boolDt, value: false };
|
|
2566
|
+
return null;
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2540
2569
|
function parseXsdFloatSpecialLex(s) {
|
|
2541
2570
|
if (s === 'INF' || s === '+INF') return Infinity;
|
|
2542
2571
|
if (s === '-INF') return -Infinity;
|