occam-verify-cli 1.0.617 → 1.0.632
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/lib/context/ephemeral.js +152 -47
- package/lib/context/file/nominal.js +136 -140
- package/lib/context/liminal.js +16 -26
- package/lib/context/scoped.js +26 -55
- package/lib/context.js +103 -53
- package/lib/element/assertion/contained.js +3 -1
- package/lib/element/assertion/defined.js +5 -3
- package/lib/element/assertion/property.js +10 -58
- package/lib/element/assertion/satisfies.js +3 -1
- package/lib/element/assertion/subproof.js +3 -1
- package/lib/element/assertion/type.js +65 -109
- package/lib/element/assumption.js +40 -16
- package/lib/element/constructor/bracketed.js +13 -53
- package/lib/element/constructor.js +5 -5
- package/lib/element/declaration/constructor.js +5 -2
- package/lib/element/derivation.js +8 -10
- package/lib/element/equality.js +102 -62
- package/lib/element/equivalence.js +6 -6
- package/lib/element/equivalences.js +4 -4
- package/lib/element/frame.js +21 -21
- package/lib/element/hypothesis.js +5 -7
- package/lib/element/judgement.js +47 -25
- package/lib/element/metaType.js +2 -2
- package/lib/element/metavariable.js +12 -3
- package/lib/element/propertyRelation.js +3 -3
- package/lib/element/reference.js +9 -21
- package/lib/element/rule.js +13 -15
- package/lib/element/signature.js +5 -5
- package/lib/element/statement.js +23 -25
- package/lib/element/subDerivation.js +4 -6
- package/lib/element/substitution/frame.js +4 -4
- package/lib/element/substitution/reference.js +4 -4
- package/lib/element/substitution/statement.js +4 -4
- package/lib/element/substitution/term.js +9 -3
- package/lib/element/substitution.js +71 -43
- package/lib/element/term.js +20 -6
- package/lib/element/topLevelAssertion.js +9 -11
- package/lib/element/topLevelMetaAssertion.js +9 -11
- package/lib/element/variable.js +44 -3
- package/lib/process/assign.js +96 -26
- package/lib/process/unify.js +3 -4
- package/lib/process/validate.js +7 -7
- package/lib/process/verify.js +2 -2
- package/lib/ruleNames.js +5 -1
- package/lib/utilities/element.js +74 -12
- package/lib/utilities/json.js +2 -2
- package/lib/utilities/string.js +9 -24
- package/lib/utilities/substitutions.js +14 -22
- package/lib/utilities/validation.js +3 -3
- package/package.json +4 -4
- package/src/context/ephemeral.js +170 -50
- package/src/context/file/nominal.js +136 -141
- package/src/context/liminal.js +22 -34
- package/src/context/scoped.js +33 -74
- package/src/context.js +97 -46
- package/src/element/assertion/contained.js +4 -0
- package/src/element/assertion/defined.js +6 -2
- package/src/element/assertion/property.js +15 -26
- package/src/element/assertion/satisfies.js +4 -0
- package/src/element/assertion/subproof.js +4 -0
- package/src/element/assertion/type.js +69 -77
- package/src/element/assumption.js +48 -16
- package/src/element/constructor/bracketed.js +11 -12
- package/src/element/constructor.js +4 -4
- package/src/element/declaration/constructor.js +5 -1
- package/src/element/derivation.js +3 -5
- package/src/element/equality.js +109 -74
- package/src/element/equivalence.js +7 -7
- package/src/element/equivalences.js +7 -5
- package/src/element/frame.js +25 -25
- package/src/element/hypothesis.js +4 -6
- package/src/element/judgement.js +54 -24
- package/src/element/metaType.js +1 -1
- package/src/element/metavariable.js +16 -3
- package/src/element/propertyRelation.js +2 -2
- package/src/element/reference.js +12 -26
- package/src/element/rule.js +8 -10
- package/src/element/signature.js +4 -4
- package/src/element/statement.js +27 -30
- package/src/element/subDerivation.js +3 -5
- package/src/element/substitution/frame.js +1 -1
- package/src/element/substitution/reference.js +1 -1
- package/src/element/substitution/statement.js +1 -1
- package/src/element/substitution/term.js +4 -2
- package/src/element/substitution.js +60 -36
- package/src/element/term.js +24 -5
- package/src/element/topLevelAssertion.js +4 -6
- package/src/element/topLevelMetaAssertion.js +4 -6
- package/src/element/variable.js +2 -0
- package/src/process/assign.js +114 -37
- package/src/process/unify.js +2 -3
- package/src/process/validate.js +5 -5
- package/src/process/verify.js +1 -1
- package/src/ruleNames.js +1 -0
- package/src/utilities/element.js +83 -26
- package/src/utilities/json.js +1 -1
- package/src/utilities/string.js +7 -29
- package/src/utilities/substitutions.js +18 -29
- package/src/utilities/validation.js +2 -2
|
@@ -10,6 +10,7 @@ import NominalParser from "../../nominal/parser";
|
|
|
10
10
|
|
|
11
11
|
import { verifyFile } from "../../process/verify";
|
|
12
12
|
import { baseTypeFromNothing } from "../../utilities/type";
|
|
13
|
+
import { findMetaTypeByMetaTypeName } from "../../metaTypes";
|
|
13
14
|
import { typesFromJSON,
|
|
14
15
|
rulesFromJSON,
|
|
15
16
|
axiomsFromJSON,
|
|
@@ -94,6 +95,7 @@ export default class NominalFileContext extends FileContext {
|
|
|
94
95
|
|
|
95
96
|
getEquivalences() {
|
|
96
97
|
const { Equivalences } = elements,
|
|
98
|
+
context = this, ///
|
|
97
99
|
equivalences = Equivalences.fromNothing(context);
|
|
98
100
|
|
|
99
101
|
return equivalences;
|
|
@@ -374,43 +376,40 @@ export default class NominalFileContext extends FileContext {
|
|
|
374
376
|
this.trace(`Added the '${metavariableString}' metavariable to the '${filePath}' file context.`)
|
|
375
377
|
}
|
|
376
378
|
|
|
377
|
-
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
const metavariableUnifies = label.unifyReference(reference, context);
|
|
379
|
+
findMetavariable(metavariable) {
|
|
380
|
+
const metavariables = this.getMetavariables(),
|
|
381
|
+
specificMetavariable = metavariable; ///
|
|
381
382
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
383
|
+
metavariable = metavariables.find((metavariable) => {
|
|
384
|
+
const context = this, ///
|
|
385
|
+
generalMetavariable = metavariable, ///
|
|
386
|
+
metavariableUnifies = generalMetavariable.unifyMetavariable(specificMetavariable, context);
|
|
386
387
|
|
|
387
|
-
|
|
388
|
+
if (metavariableUnifies) {
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
}) || null;
|
|
392
|
+
|
|
393
|
+
return metavariable;
|
|
388
394
|
}
|
|
389
395
|
|
|
390
|
-
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
const
|
|
396
|
+
findLabelByMetavariable(metavariable) {
|
|
397
|
+
const labels = this.getLabels(),
|
|
398
|
+
label = labels.find((label) => {
|
|
399
|
+
const labelMetavariableComparesToMetavariable = label.compareMetavariable(metavariable);
|
|
394
400
|
|
|
395
|
-
if (
|
|
401
|
+
if (labelMetavariableComparesToMetavariable) {
|
|
396
402
|
return true;
|
|
397
403
|
}
|
|
398
404
|
}) || null;
|
|
399
405
|
|
|
400
|
-
return
|
|
406
|
+
return label;
|
|
401
407
|
}
|
|
402
408
|
|
|
403
|
-
|
|
404
|
-
const
|
|
405
|
-
metatheorem = metatheorems.find((metatheorem) => {
|
|
406
|
-
const metatheoremComparesToReference = metatheorem.compareReference(reference);
|
|
407
|
-
|
|
408
|
-
if (metatheoremComparesToReference) {
|
|
409
|
-
return true;
|
|
410
|
-
}
|
|
411
|
-
}) || null;
|
|
409
|
+
findMetaTypeByMetaTypeName(metaTypeName) {
|
|
410
|
+
const metaType = findMetaTypeByMetaTypeName(metaTypeName);
|
|
412
411
|
|
|
413
|
-
return
|
|
412
|
+
return metaType;
|
|
414
413
|
}
|
|
415
414
|
|
|
416
415
|
findRuleByReference(reference) {
|
|
@@ -469,17 +468,17 @@ export default class NominalFileContext extends FileContext {
|
|
|
469
468
|
return theorem;
|
|
470
469
|
}
|
|
471
470
|
|
|
472
|
-
|
|
473
|
-
const
|
|
474
|
-
|
|
475
|
-
const
|
|
471
|
+
findMetaLemmaByReference(reference) {
|
|
472
|
+
const metaLemmas = this.getMetaLemmas(),
|
|
473
|
+
metaLemma = metaLemmas.find((metaLemma) => {
|
|
474
|
+
const metaLemmaComparesToReference = metaLemma.compareReference(reference);
|
|
476
475
|
|
|
477
|
-
if (
|
|
476
|
+
if (metaLemmaComparesToReference) {
|
|
478
477
|
return true;
|
|
479
478
|
}
|
|
480
479
|
}) || null;
|
|
481
480
|
|
|
482
|
-
return
|
|
481
|
+
return metaLemma;
|
|
483
482
|
}
|
|
484
483
|
|
|
485
484
|
findConjectureByReference(reference) {
|
|
@@ -512,6 +511,19 @@ export default class NominalFileContext extends FileContext {
|
|
|
512
511
|
return metaLemmas;
|
|
513
512
|
}
|
|
514
513
|
|
|
514
|
+
findMetatheoremByReference(reference) {
|
|
515
|
+
const metatheorems = this.getMetatheorems(),
|
|
516
|
+
metatheorem = metatheorems.find((metatheorem) => {
|
|
517
|
+
const metatheoremComparesToReference = metatheorem.compareReference(reference);
|
|
518
|
+
|
|
519
|
+
if (metatheoremComparesToReference) {
|
|
520
|
+
return true;
|
|
521
|
+
}
|
|
522
|
+
}) || null;
|
|
523
|
+
|
|
524
|
+
return metatheorem;
|
|
525
|
+
}
|
|
526
|
+
|
|
515
527
|
findMetatheoremsByReference(reference) {
|
|
516
528
|
const metatheorems = this.getMetatheorems();
|
|
517
529
|
|
|
@@ -528,6 +540,16 @@ export default class NominalFileContext extends FileContext {
|
|
|
528
540
|
return metatheorems;
|
|
529
541
|
}
|
|
530
542
|
|
|
543
|
+
findTopLevelAssertionByReference(reference) {
|
|
544
|
+
const axiom = this.findAxiomByReference(reference),
|
|
545
|
+
lemma = this.findLemmaByReference(reference),
|
|
546
|
+
theorem = this.findTheoremByReference(reference),
|
|
547
|
+
conjecture = this.findConjectureByReference(reference),
|
|
548
|
+
topLevelAssertion = (axiom || lemma || theorem || conjecture);
|
|
549
|
+
|
|
550
|
+
return topLevelAssertion;
|
|
551
|
+
}
|
|
552
|
+
|
|
531
553
|
findTopLevelMetaAssertionByReference(reference) {
|
|
532
554
|
const metaLemma = this.findMetaLemmaByReference(reference),
|
|
533
555
|
metatheorem = this.findMetatheoremByReference(reference),
|
|
@@ -547,33 +569,6 @@ export default class NominalFileContext extends FileContext {
|
|
|
547
569
|
return topLevelMetaAssertions;
|
|
548
570
|
}
|
|
549
571
|
|
|
550
|
-
findTopLevelAssertionByReference(reference) {
|
|
551
|
-
const axiom = this.findAxiomByReference(reference),
|
|
552
|
-
lemma = this.findLemmaByReference(reference),
|
|
553
|
-
theorem = this.findTheoremByReference(reference),
|
|
554
|
-
conjecture = this.findConjectureByReference(reference),
|
|
555
|
-
topLevelAssertion = (axiom || lemma || theorem || conjecture);
|
|
556
|
-
|
|
557
|
-
return topLevelAssertion;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
findMetavariable(metavariable) {
|
|
561
|
-
const metavariables = this.getMetavariables(),
|
|
562
|
-
specificMetavariable = metavariable; ///
|
|
563
|
-
|
|
564
|
-
metavariable = metavariables.find((metavariable) => {
|
|
565
|
-
const context = this, ///
|
|
566
|
-
generalMetavariable = metavariable, ///
|
|
567
|
-
metavariableUnifies = generalMetavariable.unifyMetavariable(specificMetavariable, context);
|
|
568
|
-
|
|
569
|
-
if (metavariableUnifies) {
|
|
570
|
-
return true;
|
|
571
|
-
}
|
|
572
|
-
}) || null;
|
|
573
|
-
|
|
574
|
-
return metavariable;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
572
|
findTypeByTypeName(typeName, includeRelease = true, includeDependencies = true) {
|
|
578
573
|
let types = this.getTypes(includeRelease, includeDependencies);
|
|
579
574
|
|
|
@@ -650,19 +645,6 @@ export default class NominalFileContext extends FileContext {
|
|
|
650
645
|
return typePrefix;
|
|
651
646
|
}
|
|
652
647
|
|
|
653
|
-
findVariableByVariableIdentifier(variableIdentifier) {
|
|
654
|
-
const variables = this.getVariables(),
|
|
655
|
-
variable = variables.find((variable) => {
|
|
656
|
-
const variableComparesToVariableIdentifier = variable.compareVariableIdentifier(variableIdentifier);
|
|
657
|
-
|
|
658
|
-
if (variableComparesToVariableIdentifier) {
|
|
659
|
-
return true;
|
|
660
|
-
}
|
|
661
|
-
}) || null;
|
|
662
|
-
|
|
663
|
-
return variable;
|
|
664
|
-
}
|
|
665
|
-
|
|
666
648
|
findLabelByMetavariableName(metavariableName) {
|
|
667
649
|
const labels = this.getLabels(),
|
|
668
650
|
label = labels.find((label) => {
|
|
@@ -676,30 +658,30 @@ export default class NominalFileContext extends FileContext {
|
|
|
676
658
|
return label;
|
|
677
659
|
}
|
|
678
660
|
|
|
679
|
-
|
|
680
|
-
const
|
|
681
|
-
|
|
682
|
-
const
|
|
661
|
+
findJudgementByMetavariableName(metavariableName) {
|
|
662
|
+
const judgements = this.getJudgements(),
|
|
663
|
+
judgement = judgements.find((judgement) => {
|
|
664
|
+
const judgementMetavariableComparesToMetavariable = judgement.compareMetavariableName(metavariableName);
|
|
683
665
|
|
|
684
|
-
if (
|
|
666
|
+
if (judgementMetavariableComparesToMetavariable) {
|
|
685
667
|
return true;
|
|
686
668
|
}
|
|
687
669
|
}) || null;
|
|
688
670
|
|
|
689
|
-
return
|
|
671
|
+
return judgement;
|
|
690
672
|
}
|
|
691
673
|
|
|
692
|
-
|
|
693
|
-
const
|
|
694
|
-
|
|
695
|
-
const
|
|
674
|
+
findVariableByVariableIdentifier(variableIdentifier) {
|
|
675
|
+
const variables = this.getVariables(),
|
|
676
|
+
variable = variables.find((variable) => {
|
|
677
|
+
const variableComparesToVariableIdentifier = variable.compareVariableIdentifier(variableIdentifier);
|
|
696
678
|
|
|
697
|
-
if (
|
|
679
|
+
if (variableComparesToVariableIdentifier) {
|
|
698
680
|
return true;
|
|
699
681
|
}
|
|
700
682
|
}) || null;
|
|
701
683
|
|
|
702
|
-
return
|
|
684
|
+
return variable;
|
|
703
685
|
}
|
|
704
686
|
|
|
705
687
|
findMetavariableByMetavariableName(metavariableName) {
|
|
@@ -715,6 +697,69 @@ export default class NominalFileContext extends FileContext {
|
|
|
715
697
|
return metavariable;
|
|
716
698
|
}
|
|
717
699
|
|
|
700
|
+
findProcedureByProcedureName(procedureName) {
|
|
701
|
+
const procedures = this.getProcedures(),
|
|
702
|
+
procedure = procedures.find((procedure) => {
|
|
703
|
+
const procedureComparesToProcedureName = procedure.compareProcedureName(procedureName);
|
|
704
|
+
|
|
705
|
+
if (procedureComparesToProcedureName) {
|
|
706
|
+
return true;
|
|
707
|
+
}
|
|
708
|
+
}) || null;
|
|
709
|
+
|
|
710
|
+
return procedure;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
isMetavariablePresent(metavariable) {
|
|
714
|
+
metavariable = this.findMetavariable(metavariable);
|
|
715
|
+
|
|
716
|
+
const metavariablePresent = (metavariable !== null);
|
|
717
|
+
|
|
718
|
+
return metavariablePresent;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
isLabelPresentByMetavariable(metavariable) {
|
|
722
|
+
const label = this.findLabelByMetavariable(metavariable),
|
|
723
|
+
labelPresent = (label !== null);
|
|
724
|
+
|
|
725
|
+
return labelPresent;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
isLabelPresentByReference(reference) {
|
|
729
|
+
const labels = this.getLabels(),
|
|
730
|
+
labelPresent = labels.some((label) => {
|
|
731
|
+
const context = this, ///
|
|
732
|
+
labelUnifies = reference.unifyLabel(label, context);
|
|
733
|
+
|
|
734
|
+
if (labelUnifies) {
|
|
735
|
+
return true;
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
|
|
739
|
+
return labelPresent;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
isMetavariablePresentByReference(reference) {
|
|
743
|
+
const metavariables = this.getMetavariables(),
|
|
744
|
+
metavariablePresent = metavariables.some((metavariable) => {
|
|
745
|
+
const context = this, ///
|
|
746
|
+
metavariableUnifies = reference.unifyMetavariable(metavariable, context);
|
|
747
|
+
|
|
748
|
+
if (metavariableUnifies) {
|
|
749
|
+
return true;
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
return metavariablePresent;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
isTopLevelMetaAssertionPresentByReference(reference) {
|
|
757
|
+
const topLevelMetaAssertion = this.findTopLevelMetaAssertionByReference(reference),
|
|
758
|
+
topLevelMetaAssertionPresent = (topLevelMetaAssertion !== null);
|
|
759
|
+
|
|
760
|
+
return topLevelMetaAssertionPresent;
|
|
761
|
+
}
|
|
762
|
+
|
|
718
763
|
isTypePresentByTypeName(typeName, includeRelease = true, includeDependencies = true) {
|
|
719
764
|
const type = this.findTypeByTypeName(typeName, includeRelease, includeDependencies),
|
|
720
765
|
typePresent = (type !== null);
|
|
@@ -736,6 +781,13 @@ export default class NominalFileContext extends FileContext {
|
|
|
736
781
|
return typePresent;
|
|
737
782
|
}
|
|
738
783
|
|
|
784
|
+
isLabelPresentByMetavariableName(metavariableName) {
|
|
785
|
+
const label = this.findLabelByMetavariableName(metavariableName),
|
|
786
|
+
labelPresent = (label !== null);
|
|
787
|
+
|
|
788
|
+
return labelPresent;
|
|
789
|
+
}
|
|
790
|
+
|
|
739
791
|
isTypePrefixPresentByTypePrefixName(typePrefixName) {
|
|
740
792
|
const typePrefix = this.findTypePrefixByTypePrefixName(typePrefixName),
|
|
741
793
|
typePrefixPresent = (typePrefix !== null);
|
|
@@ -750,20 +802,6 @@ export default class NominalFileContext extends FileContext {
|
|
|
750
802
|
return variablePresent;
|
|
751
803
|
}
|
|
752
804
|
|
|
753
|
-
isLabelPresentByMetavariableName(metavariableName) {
|
|
754
|
-
const label = this.findLabelByMetavariableName(metavariableName),
|
|
755
|
-
labelPresent = (label !== null);
|
|
756
|
-
|
|
757
|
-
return labelPresent;
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
isLabelPresentByMetavariable(metavariable) {
|
|
761
|
-
const label = this.findLabelByMetavariable(metavariable),
|
|
762
|
-
labelPresent = (label !== null);
|
|
763
|
-
|
|
764
|
-
return labelPresent;
|
|
765
|
-
}
|
|
766
|
-
|
|
767
805
|
isMetavariablePresentByMetavariableName(metavariableName) {
|
|
768
806
|
const metavariable = this.findMetavariableByMetavariableName(metavariableName),
|
|
769
807
|
metavariablePresent = (metavariable !== null);
|
|
@@ -771,14 +809,6 @@ export default class NominalFileContext extends FileContext {
|
|
|
771
809
|
return metavariablePresent;
|
|
772
810
|
}
|
|
773
811
|
|
|
774
|
-
isMetavariablePresent(metavariable) {
|
|
775
|
-
metavariable = this.findMetavariable(metavariable);
|
|
776
|
-
|
|
777
|
-
const metavariablePresent = (metavariable !== null);
|
|
778
|
-
|
|
779
|
-
return metavariablePresent;
|
|
780
|
-
}
|
|
781
|
-
|
|
782
812
|
isProcedurePresentByProcedureName(procedureName) {
|
|
783
813
|
const procedure = this.findProcedureByProcedureName(procedureName),
|
|
784
814
|
procedurePresent = (procedure !== null);
|
|
@@ -786,41 +816,6 @@ export default class NominalFileContext extends FileContext {
|
|
|
786
816
|
return procedurePresent;
|
|
787
817
|
}
|
|
788
818
|
|
|
789
|
-
isLabelPresentByReference(reference) {
|
|
790
|
-
const labels = this.getLabels(),
|
|
791
|
-
labelPresent = labels.some((label) => {
|
|
792
|
-
const context = this, ///
|
|
793
|
-
labelUnifies = reference.unifyLabel(label, context);
|
|
794
|
-
|
|
795
|
-
if (labelUnifies) {
|
|
796
|
-
return true;
|
|
797
|
-
}
|
|
798
|
-
});
|
|
799
|
-
|
|
800
|
-
return labelPresent;
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
isMetavariablePresentByReference(reference) {
|
|
804
|
-
const metavariables = this.getMetavariables(),
|
|
805
|
-
metavariablePresent = metavariables.some((metavariable) => {
|
|
806
|
-
const context = this, ///
|
|
807
|
-
metavariableUnifies = reference.unifyMetavariable(metavariable, context);
|
|
808
|
-
|
|
809
|
-
if (metavariableUnifies) {
|
|
810
|
-
return true;
|
|
811
|
-
}
|
|
812
|
-
});
|
|
813
|
-
|
|
814
|
-
return metavariablePresent;
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
isTopLevelMetaAssertionPresentByReference(reference) {
|
|
818
|
-
const topLevelMetaAssertion = this.findTopLevelMetaAssertionByReference(reference),
|
|
819
|
-
topLevelMetaAssertionPresent = (topLevelMetaAssertion !== null);
|
|
820
|
-
|
|
821
|
-
return topLevelMetaAssertionPresent;
|
|
822
|
-
}
|
|
823
|
-
|
|
824
819
|
clear() {
|
|
825
820
|
this.types = [];
|
|
826
821
|
this.rules = [];
|
|
@@ -875,7 +870,7 @@ export default class NominalFileContext extends FileContext {
|
|
|
875
870
|
|
|
876
871
|
async verifyFile() {
|
|
877
872
|
const node = this.getNode(),
|
|
878
|
-
context = this,
|
|
873
|
+
context = this, ///
|
|
879
874
|
fileNode = node, ///
|
|
880
875
|
fileVerifies = await verifyFile(fileNode, context);
|
|
881
876
|
|
package/src/context/liminal.js
CHANGED
|
@@ -96,19 +96,16 @@ export default class LiminalContext extends Context {
|
|
|
96
96
|
metavariableNames = metavariableNamesFromSubstitutions(substitutions);
|
|
97
97
|
|
|
98
98
|
metavariableNames.forEach((metavariableName) => {
|
|
99
|
-
const complexSubstitutions = this.findComplexSubstitutionsByMetavariableName(metavariableName)
|
|
100
|
-
complexSubstitutionsResolved = complexSubstitutions.every((complexSubstitution) => {
|
|
101
|
-
const substitution = complexSubstitution, ///
|
|
102
|
-
resolved = substitution.isResolved();
|
|
99
|
+
const complexSubstitutions = this.findComplexSubstitutionsByMetavariableName(metavariableName);
|
|
103
100
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
});
|
|
101
|
+
complexSubstitutions.forEach((complexSubstitution) => {
|
|
102
|
+
const substitution = complexSubstitution, ///
|
|
103
|
+
resolved = substitution.isResolved();
|
|
108
104
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
105
|
+
if (!resolved) {
|
|
106
|
+
substitution.resolve(generalContext, specificContext);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
112
109
|
});
|
|
113
110
|
}
|
|
114
111
|
|
|
@@ -143,9 +140,9 @@ export default class LiminalContext extends Context {
|
|
|
143
140
|
context.addSubstitutions(this.substitutions);
|
|
144
141
|
}
|
|
145
142
|
|
|
146
|
-
findSubstitution(callback
|
|
143
|
+
findSubstitution(callback) {
|
|
147
144
|
const substitutions = this.getSubstitutions(),
|
|
148
|
-
substitution = substitutions.find(callback
|
|
145
|
+
substitution = substitutions.find(callback);
|
|
149
146
|
|
|
150
147
|
return substitution;
|
|
151
148
|
}
|
|
@@ -160,16 +157,12 @@ export default class LiminalContext extends Context {
|
|
|
160
157
|
return substitutions;
|
|
161
158
|
}
|
|
162
159
|
|
|
163
|
-
findSubstitutionByVariableIdentifier(
|
|
160
|
+
findSubstitutionByVariableIdentifier(variableIdentifier) {
|
|
164
161
|
const substitution = this.findSubstitution((substitution) => {
|
|
165
|
-
const
|
|
162
|
+
const substitutionComparesToVariableIdentifier = substitution.compareVariableIdentifier(variableIdentifier);
|
|
166
163
|
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (substitutionVariableMatchesVariableIdentifier) {
|
|
171
|
-
return true;
|
|
172
|
-
}
|
|
164
|
+
if (substitutionComparesToVariableIdentifier) {
|
|
165
|
+
return true;
|
|
173
166
|
}
|
|
174
167
|
}) || null;
|
|
175
168
|
|
|
@@ -177,13 +170,8 @@ export default class LiminalContext extends Context {
|
|
|
177
170
|
}
|
|
178
171
|
|
|
179
172
|
findSubstitutionByMetavariableName(metavariableName) {
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (substitutionMatchesMetavariableName) {
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
}) || null;
|
|
173
|
+
const simpleSubstitution = this.findSimpleSubstitutionByMetavariableName(metavariableName),
|
|
174
|
+
substitution = simpleSubstitution; ///
|
|
187
175
|
|
|
188
176
|
return substitution;
|
|
189
177
|
}
|
|
@@ -194,9 +182,9 @@ export default class LiminalContext extends Context {
|
|
|
194
182
|
|
|
195
183
|
if (substitutionSimple) {
|
|
196
184
|
const simpleSubstitution = substitution, ///
|
|
197
|
-
|
|
185
|
+
simpleSubstitutionComparesToMetavariableName = simpleSubstitution.compareMetavariableName(metavariableName);
|
|
198
186
|
|
|
199
|
-
if (
|
|
187
|
+
if (simpleSubstitutionComparesToMetavariableName) {
|
|
200
188
|
return true;
|
|
201
189
|
}
|
|
202
190
|
}
|
|
@@ -211,9 +199,9 @@ export default class LiminalContext extends Context {
|
|
|
211
199
|
|
|
212
200
|
if (substitutionComplex) {
|
|
213
201
|
const complexSubstitution = substitution, ///
|
|
214
|
-
|
|
202
|
+
complexSubstitutionComparesToMetavariableName = complexSubstitution.compareMetavariableName(metavariableName);
|
|
215
203
|
|
|
216
|
-
if (
|
|
204
|
+
if (complexSubstitutionComparesToMetavariableName) {
|
|
217
205
|
return true;
|
|
218
206
|
}
|
|
219
207
|
}
|
|
@@ -226,9 +214,9 @@ export default class LiminalContext extends Context {
|
|
|
226
214
|
const substitutionA = substitution; ///
|
|
227
215
|
|
|
228
216
|
substitution = this.findSubstitution((substitution) => { ///
|
|
229
|
-
const
|
|
217
|
+
const substitutionComparesToMetavariableName = substitution.compareMetavariableName(metavariableName);
|
|
230
218
|
|
|
231
|
-
if (
|
|
219
|
+
if (substitutionComparesToMetavariableName) {
|
|
232
220
|
const substitutionB = substitution, ///
|
|
233
221
|
substitutionBSubstitutionComparesToSubstitutionA = substitutionB.compare(substitutionA);
|
|
234
222
|
|