occam-verify-cli 0.0.543 → 0.0.545

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.
@@ -286,11 +286,10 @@ export default class ReleaseContext {
286
286
  return type;
287
287
  }
288
288
 
289
- getReleaseName() {
290
- const name = this.getName(),
291
- releaseName = name; ///
289
+ isReleased() {
290
+ const released = (this.json !== null);
292
291
 
293
- return releaseName;
292
+ return released;
294
293
  }
295
294
 
296
295
  isInitialised() {
@@ -299,6 +298,13 @@ export default class ReleaseContext {
299
298
  return initialised;
300
299
  }
301
300
 
301
+ getReleaseName() {
302
+ const name = this.getName(),
303
+ releaseName = name; ///
304
+
305
+ return releaseName;
306
+ }
307
+
302
308
  getFile(filePath) { return this.entries.getFile(filePath); }
303
309
 
304
310
  getVersion() { return this.entries.getVersion(); }
@@ -330,8 +336,7 @@ export default class ReleaseContext {
330
336
  fatal(message, node = null, tokens = null, filePath = null) { this.log.fatal(message, node, tokens, filePath); }
331
337
 
332
338
  initialise(dependencyReleaseContexts) {
333
- const fileContexts = [],
334
- releaseContext = this, ///
339
+ const releaseContext = this, ///
335
340
  releaseContexts = [
336
341
  releaseContext,
337
342
  ...dependencyReleaseContexts
@@ -340,26 +345,30 @@ export default class ReleaseContext {
340
345
  florenceLexer = florenceLexerFromCombinedCustomGrammar(combinedCustomGrammar),
341
346
  florenceParser = florenceParserFromCombinedCustomGrammar(combinedCustomGrammar);
342
347
 
343
- if (this.json !== null) {
348
+ this.lexer = florenceLexer; ///
349
+
350
+ this.parser = florenceParser; ///
351
+
352
+ if (this.json === null) {
353
+ this.verified = false;
354
+
355
+ this.fileContexts = [];
356
+ } else {
344
357
  const fileContextsJSON = this.json; ///
345
358
 
346
- fileContextsJSON.forEach((fileContextJSON) => {
359
+ this.verified = true;
360
+
361
+ this.fileContexts = fileContextsJSON.map((fileContextJSON) => {
347
362
  const json = fileContextJSON, ///
348
363
  { filePath } = json,
349
364
  fileContext = FileContext.fromFilePathAndReleaseContext(filePath, releaseContext);
350
365
 
351
366
  fileContext.initialise(json);
352
367
 
353
- fileContexts.push(fileContext);
368
+ return fileContext;
354
369
  });
355
370
  }
356
371
 
357
- this.lexer = florenceLexer; ///
358
-
359
- this.parser = florenceParser; ///
360
-
361
- this.fileContexts = fileContexts;
362
-
363
372
  this.dependencyReleaseContexts = dependencyReleaseContexts;
364
373
  }
365
374
 
@@ -377,7 +386,7 @@ export default class ReleaseContext {
377
386
  static fromLogJSONNameAndEntries(log, json, name, entries) {
378
387
  const lexer = null,
379
388
  parser = null,
380
- verified = false,
389
+ verified = null,
381
390
  customGrammar = customGrammarFromNameAndEntries(name, entries),
382
391
  fileContexts = null,
383
392
  dependencyReleaseContexts = null,
package/src/lemma.js CHANGED
@@ -2,11 +2,7 @@
2
2
 
3
3
  import AxiomLemmaTheoremConjecture from "./axiomLemmaTheoremConjecture";
4
4
 
5
- import { LEMMA_KIND } from "./kinds";
6
-
7
5
  export default class Lemma extends AxiomLemmaTheoremConjecture {
8
- static kind = LEMMA_KIND;
9
-
10
6
  static fromJSONAndFileContext(json, fileContext) { return AxiomLemmaTheoremConjecture.fromJSONAndFileContext(Lemma,json, fileContext); }
11
7
 
12
8
  static fromLabelsSuppositionsConsequenceAndProofContext(labels, suppositions, consequence, proofContext) { return AxiomLemmaTheoremConjecture.fromLabelsSuppositionsConsequenceAndProofContext(Lemma, labels, suppositions, consequence, proofContext); }
package/src/metaType.js CHANGED
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- import { META_TYPE_KIND } from "./kinds";
4
3
  import { STATEMENT_META_TYPE_NAME } from "./metaTypeNames";
5
4
 
6
5
  export default class MetaType {
@@ -44,10 +43,8 @@ export default class MetaType {
44
43
  }
45
44
 
46
45
  toJSON(tokens) {
47
- const kind = META_TYPE_KIND,
48
- name = this.name,
46
+ const name = this.name,
49
47
  json = {
50
- kind,
51
48
  name
52
49
  };
53
50
 
@@ -2,8 +2,6 @@
2
2
 
3
3
  import MetaType from "./metaType";
4
4
 
5
- import { METAVARIABLE_KIND } from "./kinds";
6
-
7
5
  export default class Metavariable {
8
6
  constructor(name, metaType) {
9
7
  this.name = name;
@@ -26,11 +24,9 @@ export default class Metavariable {
26
24
 
27
25
  toJSON(tokens) {
28
26
  const metaTypeJSON = this.metaType.toJSON(tokens),
29
- kind = METAVARIABLE_KIND,
30
27
  name = this.name, ///
31
28
  metaType = metaTypeJSON, ///
32
29
  json = {
33
- kind,
34
30
  name,
35
31
  metaType
36
32
  };
@@ -62,7 +58,7 @@ export default class Metavariable {
62
58
 
63
59
  const metaTypeName = metaType.getName();
64
60
 
65
- metaType = fileContext.findTypeByTypeName(metaTypeName); ///
61
+ metaType = fileContext.findMetaTypeByMetaTypeName(metaTypeName); ///
66
62
 
67
63
  const metavariable = new Metavariable(name, metaType);
68
64
 
package/src/rule.js CHANGED
@@ -5,7 +5,6 @@ import Premise from "./premise";
5
5
  import Conclusion from "./conclusion";
6
6
 
7
7
  import { prune } from "./utilities/array";
8
- import { RULE_KIND } from "./kinds";
9
8
  import { someSubArray } from "./utilities/array";
10
9
 
11
10
  export default class Rule {
@@ -125,12 +124,10 @@ export default class Rule {
125
124
  return premiseJSON;
126
125
  }),
127
126
  conclusionJSON = this.conclusion.toJSON(tokens),
128
- kind = RULE_KIND,
129
127
  labels = labelsJSON, ///
130
128
  premises = premisesJSON, ///
131
129
  conclusion = conclusionJSON, ///
132
130
  json = {
133
- kind,
134
131
  labels,
135
132
  premises,
136
133
  conclusion
package/src/theorem.js CHANGED
@@ -2,11 +2,7 @@
2
2
 
3
3
  import AxiomLemmaTheoremConjecture from "./axiomLemmaTheoremConjecture";
4
4
 
5
- import { THEOREM_KIND } from "./kinds";
6
-
7
5
  export default class Theorem extends AxiomLemmaTheoremConjecture {
8
- static kind = THEOREM_KIND;
9
-
10
6
  static fromJSONAndFileContext(json, fileContext) { return AxiomLemmaTheoremConjecture.fromJSONAndFileContext(Theorem, json, fileContext); }
11
7
 
12
8
  static fromLabelsSuppositionsConsequenceAndProofContext(labels, suppositions, consequence, proofContext) { return AxiomLemmaTheoremConjecture.fromLabelsSuppositionsConsequenceAndProofContext(Theorem, labels, suppositions, consequence, proofContext); }
package/src/type.js CHANGED
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- import { TYPE_KIND } from "./kinds";
4
3
  import { OBJECT_TYPE_NAME } from "./typeNames";
5
4
 
6
5
  export default class Type {
@@ -121,11 +120,9 @@ export default class Type {
121
120
 
122
121
  toJSON(tokens) {
123
122
  const superTypeJSON = this.superType.toJSON(tokens),
124
- kind = TYPE_KIND,
125
123
  name = this.name,
126
124
  superType = superTypeJSON, ///
127
125
  json = {
128
- kind,
129
126
  name,
130
127
  superType
131
128
  };
@@ -167,11 +164,9 @@ export default class Type {
167
164
 
168
165
  class ObjectType extends Type {
169
166
  toJSON(tokens) {
170
- const kind = TYPE_KIND,
171
- name = this.name,
167
+ const name = this.name,
172
168
  superType = null, ///
173
169
  json = {
174
- kind,
175
170
  name,
176
171
  superType
177
172
  };
@@ -47,12 +47,12 @@ export function createReleaseContext(dependency, dependentNames, context, callba
47
47
  }, context);
48
48
  }
49
49
 
50
- export function initialiseReleaseContext(dependency, dependentName, verified, context, callback) {
50
+ export function initialiseReleaseContext(dependency, dependentName, dependentReleased, context, callback) {
51
51
  let error = null;
52
52
 
53
53
  const { releaseContextMap } = context,
54
- dependencyName = dependency.getName(),
55
- releaseName = dependencyName, ///
54
+ name = dependency.getName(),
55
+ releaseName = name, ///
56
56
  releaseContext = releaseContextMap[releaseName] || null;
57
57
 
58
58
  if (releaseContext === null) {
@@ -61,7 +61,8 @@ export function initialiseReleaseContext(dependency, dependentName, verified, co
61
61
  return;
62
62
  }
63
63
 
64
- const initialised = releaseContext.isInitialised();
64
+ const released = releaseContext.isReleased(),
65
+ initialised = releaseContext.isInitialised();
65
66
 
66
67
  if (initialised) {
67
68
  callback(error);
@@ -69,11 +70,9 @@ export function initialiseReleaseContext(dependency, dependentName, verified, co
69
70
  return;
70
71
  }
71
72
 
72
- const releaseContextVerified = releaseContext.isVerified();
73
-
74
- if (verified) {
75
- if (!releaseContextVerified) {
76
- error = `Unable to initialise the '${releaseName}' dependency's context because its '${dependentName}' dependent is a package.`;
73
+ if (!released) {
74
+ if (dependentReleased) {
75
+ error = `Unable to initialise the '${name}' dependency's context because its '${dependentName}' dependent is a package.`;
77
76
 
78
77
  callback(error);
79
78
 
@@ -81,14 +80,14 @@ export function initialiseReleaseContext(dependency, dependentName, verified, co
81
80
  }
82
81
  }
83
82
 
84
- dependentName = releaseName; ///
83
+ dependentName = name; ///
85
84
 
86
- verified = releaseContextVerified; ///
85
+ dependentReleased = released; ///
87
86
 
88
87
  const dependencies = releaseContext.getDependencies();
89
88
 
90
89
  dependencies.asynchronousForEachDependency((dependency, next, done) => {
91
- initialiseReleaseContext(dependency, dependentName, verified, context, (error) => {
90
+ initialiseReleaseContext(dependency, dependentName, dependentReleased, context, (error) => {
92
91
  if (error) {
93
92
  callback(error);
94
93
 
package/src/variable.js CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  import Type from "./type";
4
4
 
5
- import { VARIABLE_KIND } from "./kinds";
6
-
7
5
  export default class Variable {
8
6
  constructor(name, type) {
9
7
  this.name = name;
@@ -33,11 +31,9 @@ export default class Variable {
33
31
 
34
32
  toJSON(tokens) {
35
33
  const typeJSON = this.type.toJSON(tokens),
36
- kind = VARIABLE_KIND,
37
34
  name = this.name, ///
38
35
  type = typeJSON, ///
39
36
  json = {
40
- kind,
41
37
  name,
42
38
  type
43
39
  };
package/lib/kinds.js DELETED
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- TYPE_KIND: function() {
13
- return TYPE_KIND;
14
- },
15
- RULE_KIND: function() {
16
- return RULE_KIND;
17
- },
18
- AXIOM_KIND: function() {
19
- return AXIOM_KIND;
20
- },
21
- LEMMA_KIND: function() {
22
- return LEMMA_KIND;
23
- },
24
- THEOREM_KIND: function() {
25
- return THEOREM_KIND;
26
- },
27
- VARIABLE_KIND: function() {
28
- return VARIABLE_KIND;
29
- },
30
- META_TYPE_KIND: function() {
31
- return META_TYPE_KIND;
32
- },
33
- CONJECTURE_KIND: function() {
34
- return CONJECTURE_KIND;
35
- },
36
- COMBINATOR_KIND: function() {
37
- return COMBINATOR_KIND;
38
- },
39
- CONSTRUCTOR_KIND: function() {
40
- return CONSTRUCTOR_KIND;
41
- },
42
- METAVARIABLE_KIND: function() {
43
- return METAVARIABLE_KIND;
44
- }
45
- });
46
- var TYPE_KIND = "type";
47
- var RULE_KIND = "rule";
48
- var AXIOM_KIND = "axiom";
49
- var LEMMA_KIND = "lemma";
50
- var THEOREM_KIND = "theorem";
51
- var VARIABLE_KIND = "variable";
52
- var META_TYPE_KIND = "meta-type";
53
- var CONJECTURE_KIND = "conjecture";
54
- var COMBINATOR_KIND = "combinator";
55
- var CONSTRUCTOR_KIND = "constructor";
56
- var METAVARIABLE_KIND = "metavariable";
57
-
58
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9raW5kcy5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuZXhwb3J0IGNvbnN0IFRZUEVfS0lORCA9IFwidHlwZVwiO1xuZXhwb3J0IGNvbnN0IFJVTEVfS0lORCA9IFwicnVsZVwiO1xuZXhwb3J0IGNvbnN0IEFYSU9NX0tJTkQgPSBcImF4aW9tXCI7XG5leHBvcnQgY29uc3QgTEVNTUFfS0lORCA9IFwibGVtbWFcIjtcbmV4cG9ydCBjb25zdCBUSEVPUkVNX0tJTkQgPSBcInRoZW9yZW1cIjtcbmV4cG9ydCBjb25zdCBWQVJJQUJMRV9LSU5EID0gXCJ2YXJpYWJsZVwiO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FDdEIsSUFBTUMsaUJBQWlCO0FBQ3ZCLElBQU1DLGtCQUFrQjtBQUN4QixJQUFNQyxrQkFBa0I7QUFDeEIsSUFBTUMsbUJBQW1CO0FBQ3pCLElBQU1DLG9CQUFvQiJ9
package/src/kinds.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- export const TYPE_KIND = "type";
4
- export const RULE_KIND = "rule";
5
- export const AXIOM_KIND = "axiom";
6
- export const LEMMA_KIND = "lemma";
7
- export const THEOREM_KIND = "theorem";
8
- export const VARIABLE_KIND = "variable";
9
- export const META_TYPE_KIND = "meta-type";
10
- export const CONJECTURE_KIND = "conjecture";
11
- export const COMBINATOR_KIND = "combinator";
12
- export const CONSTRUCTOR_KIND = "constructor";
13
- export const METAVARIABLE_KIND = "metavariable";