eyeling 1.6.33 → 1.7.0
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/examples/snaf.srl +7 -0
- package/eyeling.js +22 -0
- package/package.json +1 -1
package/eyeling.js
CHANGED
|
@@ -84,6 +84,8 @@ const jsonPointerCache = new Map();
|
|
|
84
84
|
|
|
85
85
|
// Controls whether human-readable proof comments are printed.
|
|
86
86
|
let proofCommentsEnabled = false;
|
|
87
|
+
// Super restricted mode: disable *all* builtins except => / <= (log:implies / log:impliedBy)
|
|
88
|
+
let superRestrictedMode = false;
|
|
87
89
|
|
|
88
90
|
// ----------------------------------------------------------------------------
|
|
89
91
|
// Deterministic time support
|
|
@@ -3699,6 +3701,13 @@ function evalBuiltin(goal, subst, facts, backRules, depth, varGen) {
|
|
|
3699
3701
|
const pv = iriValue(g.p);
|
|
3700
3702
|
if (pv === null) return null;
|
|
3701
3703
|
|
|
3704
|
+
// Super restricted mode: disable *all* builtins except => / <= (log:implies / log:impliedBy)
|
|
3705
|
+
if (superRestrictedMode) {
|
|
3706
|
+
const allow1 = LOG_NS + 'implies';
|
|
3707
|
+
const allow2 = LOG_NS + 'impliedBy';
|
|
3708
|
+
if (pv !== allow1 && pv !== allow2) return [];
|
|
3709
|
+
}
|
|
3710
|
+
|
|
3702
3711
|
// -----------------------------------------------------------------
|
|
3703
3712
|
// 4.1 crypto: builtins
|
|
3704
3713
|
// -----------------------------------------------------------------
|
|
@@ -5118,6 +5127,13 @@ function isBuiltinPred(p) {
|
|
|
5118
5127
|
if (!(p instanceof Iri)) return false;
|
|
5119
5128
|
const v = p.value;
|
|
5120
5129
|
|
|
5130
|
+
// Super restricted mode: only treat => / <= as builtins.
|
|
5131
|
+
// Everything else should be handled as ordinary predicates (and thus must be
|
|
5132
|
+
// provided explicitly as facts/rules, without builtin evaluation).
|
|
5133
|
+
if (superRestrictedMode) {
|
|
5134
|
+
return v === LOG_NS + 'implies' || v === LOG_NS + 'impliedBy';
|
|
5135
|
+
}
|
|
5136
|
+
|
|
5121
5137
|
// Treat RDF Collections as list-term builtins too.
|
|
5122
5138
|
if (v === RDF_NS + 'first' || v === RDF_NS + 'rest') {
|
|
5123
5139
|
return true;
|
|
@@ -5796,6 +5812,7 @@ function main() {
|
|
|
5796
5812
|
` -v, --version Print version and exit.\n` +
|
|
5797
5813
|
` -p, --proof-comments Enable proof explanations.\n` +
|
|
5798
5814
|
` -n, --no-proof-comments Disable proof explanations (default).\n` +
|
|
5815
|
+
` -s, --super-restricted Disable all builtins except => and <=.\n` +
|
|
5799
5816
|
` -a, --ast Print parsed AST as JSON and exit.\n`;
|
|
5800
5817
|
(toStderr ? console.error : console.log)(msg);
|
|
5801
5818
|
}
|
|
@@ -5828,6 +5845,11 @@ function main() {
|
|
|
5828
5845
|
proofCommentsEnabled = false;
|
|
5829
5846
|
}
|
|
5830
5847
|
|
|
5848
|
+
// --super-restricted / -s: disable all builtins except => / <=
|
|
5849
|
+
if (argv.includes('--super-restricted') || argv.includes('-s')) {
|
|
5850
|
+
superRestrictedMode = true;
|
|
5851
|
+
}
|
|
5852
|
+
|
|
5831
5853
|
// --------------------------------------------------------------------------
|
|
5832
5854
|
// Positional args (the N3 file)
|
|
5833
5855
|
// --------------------------------------------------------------------------
|