eyeling 1.25.2 → 1.25.4
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/HANDBOOK.md +12 -8
- package/dist/browser/eyeling.browser.js +335 -131
- package/eyeling.js +335 -131
- package/lib/cli.js +3 -1
- package/lib/engine.js +278 -87
- package/lib/lexer.js +42 -16
- package/lib/parser.js +12 -27
- package/package.json +1 -1
- package/test/api.test.js +40 -0
package/lib/parser.js
CHANGED
|
@@ -642,15 +642,21 @@ class Parser {
|
|
|
642
642
|
|
|
643
643
|
while (true) {
|
|
644
644
|
const { verb, invert } = this.parseStatementVerb();
|
|
645
|
-
const objects = this.parseObjectList();
|
|
646
645
|
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
646
|
+
while (true) {
|
|
647
|
+
const o = this.parseTerm();
|
|
648
|
+
const postTriples = this.pendingTriplesAfter;
|
|
649
|
+
this.pendingTriplesAfter = [];
|
|
650
|
+
|
|
651
|
+
// If VERB or OBJECT contained paths, their helper triples must come
|
|
652
|
+
// before the triple that consumes the path result (Easter depends on this).
|
|
653
|
+
this.flushPendingTriples(out);
|
|
650
654
|
|
|
651
|
-
for (const { term: o, postTriples } of objects) {
|
|
652
655
|
out.push(new Triple(invert ? o : subject, verb, invert ? subject : o));
|
|
653
|
-
if (postTriples
|
|
656
|
+
if (postTriples.length) out.push(...postTriples);
|
|
657
|
+
|
|
658
|
+
if (this.peek().typ !== 'Comma') break;
|
|
659
|
+
this.next();
|
|
654
660
|
}
|
|
655
661
|
|
|
656
662
|
if (this.peek().typ === 'Semicolon') {
|
|
@@ -664,27 +670,6 @@ class Parser {
|
|
|
664
670
|
return out;
|
|
665
671
|
}
|
|
666
672
|
|
|
667
|
-
parseObjectList() {
|
|
668
|
-
// Capture any trailing property-list triples produced while parsing each
|
|
669
|
-
// object term so we can emit them *after* the triple that references the
|
|
670
|
-
// term. (See pendingTriplesAfter in the constructor.)
|
|
671
|
-
|
|
672
|
-
const objs = [];
|
|
673
|
-
const readObj = () => {
|
|
674
|
-
const o = this.parseTerm();
|
|
675
|
-
const post = this.pendingTriplesAfter;
|
|
676
|
-
this.pendingTriplesAfter = [];
|
|
677
|
-
objs.push({ term: o, postTriples: post });
|
|
678
|
-
};
|
|
679
|
-
|
|
680
|
-
readObj();
|
|
681
|
-
while (this.peek().typ === 'Comma') {
|
|
682
|
-
this.next();
|
|
683
|
-
readObj();
|
|
684
|
-
}
|
|
685
|
-
return objs;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
673
|
makeRule(left, right, isForward) {
|
|
689
674
|
let premiseTerm, conclTerm;
|
|
690
675
|
|
package/package.json
CHANGED
package/test/api.test.js
CHANGED
|
@@ -1769,6 +1769,46 @@ ex:w a ex:Woman .
|
|
|
1769
1769
|
expect: [/:(?:test)\s+:(?:is)\s+true\s*\./],
|
|
1770
1770
|
},
|
|
1771
1771
|
|
|
1772
|
+
{
|
|
1773
|
+
name: '58b regression: fully variable top-level fact can trigger indexed ground forward rule',
|
|
1774
|
+
opt: { proofComments: false },
|
|
1775
|
+
input: `@prefix : <http://example.org/#>.
|
|
1776
|
+
|
|
1777
|
+
?S :p ?O.
|
|
1778
|
+
|
|
1779
|
+
{ :s :p :o } => { :test :is true }.
|
|
1780
|
+
`,
|
|
1781
|
+
expect: [/:(?:test)\s+:(?:is)\s+true\s*\./],
|
|
1782
|
+
},
|
|
1783
|
+
|
|
1784
|
+
{
|
|
1785
|
+
name: '58c regression: variable-predicate fact can trigger indexed IRI-predicate rule',
|
|
1786
|
+
opt: { proofComments: false },
|
|
1787
|
+
input: `@prefix : <http://example.org/#>.
|
|
1788
|
+
|
|
1789
|
+
?S ?P :o.
|
|
1790
|
+
|
|
1791
|
+
{ :s :p :o } => { :test :is true }.
|
|
1792
|
+
`,
|
|
1793
|
+
expect: [/:(?:test)\s+:(?:is)\s+true\s*\./],
|
|
1794
|
+
},
|
|
1795
|
+
|
|
1796
|
+
{
|
|
1797
|
+
name: '58d regression: numeric literal equivalence must not be pruned by object indexes',
|
|
1798
|
+
opt: { proofComments: false },
|
|
1799
|
+
input: `@prefix : <http://example.org/#>.
|
|
1800
|
+
|
|
1801
|
+
:a :v 1.0.
|
|
1802
|
+
:b :v 2.0.
|
|
1803
|
+
|
|
1804
|
+
{
|
|
1805
|
+
?x :v 1.00.
|
|
1806
|
+
} => { :test :from ?x }.
|
|
1807
|
+
`,
|
|
1808
|
+
expect: [/:(?:test)\s+:(?:from)\s+:(?:a)\s*\./],
|
|
1809
|
+
reject: [/:(?:test)\s+:(?:from)\s+:(?:b)\s*\./],
|
|
1810
|
+
},
|
|
1811
|
+
|
|
1772
1812
|
{
|
|
1773
1813
|
name: '59 regression: quoted-formula alpha-equivalence must not rename blanks introduced by outer substitution',
|
|
1774
1814
|
opt: { proofComments: false },
|