occam-verify-cli 1.0.316 → 1.0.317

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.
@@ -19,14 +19,14 @@ import { typesFromJSON,
19
19
  axiomsToAxiomsJSON,
20
20
  conjecturesFromJSON,
21
21
  combinatorsFromJSON,
22
- typeAliasesFromJSON,
22
+ typePrefixesFromJSON,
23
23
  constructorsFromJSON,
24
24
  metatheoremsFromJSON,
25
25
  metavariablesFromJSON,
26
26
  metaLemmasFromNothing,
27
27
  theoremsToTheoremsJSON,
28
28
  variablesToVariablesJSON,
29
- typeAliasesToTypeAliasesJSON,
29
+ typePrefixesToTypePrefixesJSON,
30
30
  conjecturesToConjecturesJSON,
31
31
  combinatorsToCombinatorsJSON,
32
32
  constructorsToConstructorsJSON,
@@ -36,7 +36,7 @@ import { typesFromJSON,
36
36
  const { push, first, filter } = arrayUtilities;
37
37
 
38
38
  export default class FileContext {
39
- constructor(releaseContext, filePath, lineIndex, tokens, node, types, rules, axioms, lemmas, theorems, variables, metaLemmas, conjectures, combinators, typeAliases, constructors, metatheorems, metavariables) {
39
+ constructor(releaseContext, filePath, lineIndex, tokens, node, types, rules, axioms, lemmas, theorems, variables, metaLemmas, conjectures, combinators, typePrefixes, constructors, metatheorems, metavariables) {
40
40
  this.releaseContext = releaseContext;
41
41
  this.filePath = filePath;
42
42
  this.lineIndex = lineIndex;
@@ -51,7 +51,7 @@ export default class FileContext {
51
51
  this.metaLemmas = metaLemmas;
52
52
  this.conjectures = conjectures;
53
53
  this.combinators = combinators;
54
- this.typeAliases = typeAliases;
54
+ this.typePrefixes = typePrefixes;
55
55
  this.constructors = constructors;
56
56
  this.metatheorems = metatheorems;
57
57
  this.metavariables = metavariables;
@@ -277,8 +277,8 @@ export default class FileContext {
277
277
  return combinators;
278
278
  }
279
279
 
280
- getTypeAliases(includeRelease = true) {
281
- return this.typeAliases;
280
+ getTypePrefixes(includeRelease = true) {
281
+ return this.typePrefixes;
282
282
  }
283
283
 
284
284
  getConstructors(includeRelease = true) {
@@ -319,18 +319,18 @@ export default class FileContext {
319
319
  return fileContext;
320
320
  }
321
321
 
322
- getTypeAlias() {
323
- let typeAlias = null;
322
+ getTypePrefix() {
323
+ let typePrefix = null;
324
324
 
325
- const typeAliasesLength = this.typeAliases.length;
325
+ const typePrefixesLength = this.typePrefixes.length;
326
326
 
327
- if (typeAliasesLength === 1) {
328
- const firstTypeAlias = first(this.typeAliases);
327
+ if (typePrefixesLength === 1) {
328
+ const firstTypePrefix = first(this.typePrefixes);
329
329
 
330
- typeAlias = firstTypeAlias; ///
330
+ typePrefix = firstTypePrefix; ///
331
331
  }
332
332
 
333
- return typeAlias;
333
+ return typePrefix;
334
334
  }
335
335
 
336
336
  addType(type) {
@@ -883,7 +883,7 @@ export default class FileContext {
883
883
  this.metaLemmas = [];
884
884
  this.conjectures = [];
885
885
  this.combinators = [];
886
- this.typeAliases = [];
886
+ this.typePrefixes = [];
887
887
  this.constructors = [];
888
888
  this.metatheorems = [];
889
889
  this.metavariables = [];
@@ -929,7 +929,7 @@ export default class FileContext {
929
929
 
930
930
  this.combinators = combinatorsFromJSON(json, fileContext);
931
931
 
932
- this.typeAliases = typeAliasesFromJSON(json, fileContext);
932
+ this.typePrefixes = typePrefixesFromJSON(json, fileContext);
933
933
 
934
934
  this.constructors = constructorsFromJSON(json, fileContext);
935
935
 
@@ -946,7 +946,7 @@ export default class FileContext {
946
946
  variablesJSON = variablesToVariablesJSON(this.variables),
947
947
  conjecturesJSON = conjecturesToConjecturesJSON(this.conjectures),
948
948
  combinatorsJSON = combinatorsToCombinatorsJSON(this.combinators),
949
- typeAliasesJSON = typeAliasesToTypeAliasesJSON(this.typeAliases),
949
+ typePrefixesJSON = typePrefixesToTypePrefixesJSON(this.typePrefixes),
950
950
  constructorsJSON = constructorsToConstructorsJSON(this.constructors),
951
951
  metatheoremsJSON = metatheoremsToMetatheoremsJSON(this.metatheorems),
952
952
  metavariablesJSON = metavariablesToMetavariablesJSON(this.metavariables),
@@ -958,7 +958,7 @@ export default class FileContext {
958
958
  variables = variablesJSON, ///
959
959
  conjectures = conjecturesJSON, ///
960
960
  combinators = combinatorsJSON, ///
961
- typeAliases = typeAliasesJSON, ///
961
+ typePrefixes = typePrefixesJSON, ///
962
962
  constructors = constructorsJSON, ///
963
963
  metatheorems = metatheoremsJSON, ///
964
964
  metavariables = metavariablesJSON, ///
@@ -971,7 +971,7 @@ export default class FileContext {
971
971
  variables,
972
972
  conjectures,
973
973
  combinators,
974
- typeAliases,
974
+ typePrefixes,
975
975
  constructors,
976
976
  metatheorems,
977
977
  metavariables
@@ -994,11 +994,11 @@ export default class FileContext {
994
994
  metaLemmas = [],
995
995
  conjectures = [],
996
996
  combinators = [],
997
- typeAliases = [],
997
+ typePrefixes = [],
998
998
  constructors = [],
999
999
  metatheorems = [],
1000
1000
  metavariables = [],
1001
- fileContext = new FileContext(releaseContext, filePath, lineIndex, tokens, node, types, rules, axioms, lemmas, theorems, variables, metaLemmas, conjectures, combinators, typeAliases, constructors, metatheorems, metavariables);
1001
+ fileContext = new FileContext(releaseContext, filePath, lineIndex, tokens, node, types, rules, axioms, lemmas, theorems, variables, metaLemmas, conjectures, combinators, typePrefixes, constructors, metatheorems, metavariables);
1002
1002
 
1003
1003
  return fileContext;
1004
1004
  }
@@ -1016,11 +1016,11 @@ export default class FileContext {
1016
1016
  metaLemmas = null,
1017
1017
  conjectures = null,
1018
1018
  combinators = null,
1019
- typeAliases = null,
1019
+ typePrefixes = null,
1020
1020
  constructors = null,
1021
1021
  metatheorems = null,
1022
1022
  metavariables = null,
1023
- fileContext = new FileContext(releaseContext, filePath, lineIndex, tokens, node, types, rules, axioms, lemmas, theorems, variables, metaLemmas, conjectures, combinators, typeAliases, constructors, metatheorems, metavariables);
1023
+ fileContext = new FileContext(releaseContext, filePath, lineIndex, tokens, node, types, rules, axioms, lemmas, theorems, variables, metaLemmas, conjectures, combinators, typePrefixes, constructors, metatheorems, metavariables);
1024
1024
 
1025
1025
  fileContext.initialise(json);
1026
1026
 
@@ -64,11 +64,12 @@ export default domAssigned(class TypeAssertion {
64
64
  verifyType(context) {
65
65
  let typeVerifies;
66
66
 
67
- const typeString = this.type.getString();
67
+ const typeName = this.type.getName(),
68
+ typeString = this.type.getString();
68
69
 
69
70
  context.trace(`Verifying the '${typeString}' type...`);
70
71
 
71
- const type = context.findTypeByTypeName(typeString);
72
+ const type = context.findTypeByTypeName(typeName);
72
73
 
73
74
  if (type !== null) {
74
75
  this.type = type;
@@ -92,11 +92,12 @@ export default domAssigned(class Variable {
92
92
  verifyType(context) {
93
93
  let typeVerifies = false;
94
94
 
95
- const typeString = this.type.getString();
95
+ const typeName = this.tyupe.getName(),
96
+ typeString = this.type.getString();
96
97
 
97
98
  context.trace(`Verifying the '${typeString}' type...`);
98
99
 
99
- const type = context.findTypeByTypeName(typeString);
100
+ const type = context.findTypeByTypeName(typeName);
100
101
 
101
102
  if (type === null) {
102
103
  context.debug(`The '${typeString}' type is not present.`);
package/src/node/type.js CHANGED
@@ -22,5 +22,24 @@ export default class TypeNode extends NonTerminalNode {
22
22
  return typeName;
23
23
  }
24
24
 
25
+ getTypePrefix() {
26
+ let typePrefix;
27
+
28
+ this.someChildNode((childNode) => {
29
+ const childNodeTerminalNode = childNode.isTerminalNode();
30
+
31
+ if (childNodeTerminalNode) {
32
+ const terminalNode = childNode, ///
33
+ content = terminalNode.getContent();
34
+
35
+ typePrefix = content; ///
36
+
37
+ return true;
38
+ }
39
+ });
40
+
41
+ return typePrefix;
42
+ }
43
+
25
44
  static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(TypeNode, ruleName, childNodes, opacity, precedence); }
26
45
  }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ import NonTerminalNode from "../node/nonTerminal";
4
+
5
+ export default class TypePrefixNode extends NonTerminalNode {
6
+ getTypePrefix() {
7
+ let typePrefix;
8
+
9
+ this.someChildNode((childNode) => {
10
+ const childNodeTerminalNode = childNode.isTerminalNode();
11
+
12
+ if (childNodeTerminalNode) {
13
+ const terminalNode = childNode, ///
14
+ content = terminalNode.getContent();
15
+
16
+ typePrefix = content; ///
17
+
18
+ return true;
19
+ }
20
+ });
21
+
22
+ return typePrefix;
23
+ }
24
+
25
+ static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(TypePrefixNode, ruleName, childNodes, opacity, precedence); }
26
+ }
@@ -372,20 +372,20 @@ export function combinatorsFromJSON(json, context) {
372
372
  return combinators;
373
373
  }
374
374
 
375
- export function typeAliasesFromJSON(json, context) {
376
- let { typeAliases } = json;
375
+ export function typePrefixesFromJSON(json, context) {
376
+ let { typePrefixes } = json;
377
377
 
378
- const { TypeAlias } = dom,
379
- typeAliasesJSON = typeAliases; ///
378
+ const { TypePrefix } = dom,
379
+ typePrefixesJSON = typePrefixes; ///
380
380
 
381
- typeAliases = typeAliasesJSON.map((typeAliasJSON) => {
382
- const json = typeAliasJSON, ///
383
- typeAlias = TypeAlias.fromJSON(json, context);
381
+ typePrefixes = typePrefixesJSON.map((typePrefixJSON) => {
382
+ const json = typePrefixJSON, ///
383
+ typePrefix = TypePrefix.fromJSON(json, context);
384
384
 
385
- return typeAlias;
385
+ return typePrefix;
386
386
  });
387
387
 
388
- return typeAliases;
388
+ return typePrefixes;
389
389
  }
390
390
 
391
391
  export function constructorsFromJSON(json, context) {
@@ -696,16 +696,16 @@ export function propertiesToPropertiesJSON(properties) {
696
696
  return propertiesJSON;
697
697
  }
698
698
 
699
- export function typeAliasesToTypeAliasesJSON(typeAliases) {
700
- const typeAliasesJSON = typeAliases.map((typeAlias) => {
701
- const typeAliasJSON = typeAlias.toJSON();
699
+ export function typePrefixesToTypePrefixesJSON(typePrefixes) {
700
+ const typePrefixesJSON = typePrefixes.map((typePrefix) => {
701
+ const typePrefixJSON = typePrefix.toJSON();
702
702
 
703
- typeAlias = typeAliasJSON; ///
703
+ typePrefix = typePrefixJSON; ///
704
704
 
705
- return typeAlias;
705
+ return typePrefix;
706
706
  });
707
707
 
708
- return typeAliasesJSON;
708
+ return typePrefixesJSON;
709
709
  }
710
710
 
711
711
  export function conjecturesToConjecturesJSON(conjectures) {