occam-verify-cli 1.0.256 → 1.0.259

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.
Files changed (45) hide show
  1. package/lib/context/file.js +8 -8
  2. package/lib/context/local.js +9 -9
  3. package/lib/dom/assertion/property.js +3 -3
  4. package/lib/dom/declaration/complexType.js +6 -6
  5. package/lib/dom/declaration/variable.js +2 -2
  6. package/lib/dom/metavariable.js +5 -12
  7. package/lib/dom/parameter.js +14 -15
  8. package/lib/dom/procedureCall.js +2 -2
  9. package/lib/dom/propertyRelation.js +5 -5
  10. package/lib/dom/substitution/frame.js +4 -4
  11. package/lib/dom/substitution/statement.js +4 -4
  12. package/lib/dom/substitution/term.js +7 -7
  13. package/lib/dom/substitution.js +5 -5
  14. package/lib/dom/type.js +1 -8
  15. package/lib/dom/variable.js +6 -6
  16. package/lib/mixins/term/verify.js +6 -4
  17. package/lib/node/declaration/property.js +5 -5
  18. package/lib/node/declaration/variable.js +5 -5
  19. package/lib/node/parameter.js +6 -6
  20. package/lib/node/property.js +11 -11
  21. package/lib/node/propertyRelation.js +5 -5
  22. package/lib/node/variable.js +6 -6
  23. package/package.json +6 -6
  24. package/src/context/file.js +5 -5
  25. package/src/context/local.js +7 -7
  26. package/src/dom/assertion/property.js +2 -2
  27. package/src/dom/declaration/complexType.js +5 -5
  28. package/src/dom/declaration/variable.js +2 -2
  29. package/src/dom/metavariable.js +5 -9
  30. package/src/dom/parameter.js +19 -18
  31. package/src/dom/procedureCall.js +1 -1
  32. package/src/dom/propertyRelation.js +4 -4
  33. package/src/dom/substitution/frame.js +1 -1
  34. package/src/dom/substitution/statement.js +1 -1
  35. package/src/dom/substitution/term.js +2 -2
  36. package/src/dom/substitution.js +3 -3
  37. package/src/dom/type.js +0 -6
  38. package/src/dom/variable.js +7 -5
  39. package/src/mixins/term/verify.js +8 -5
  40. package/src/node/declaration/property.js +3 -3
  41. package/src/node/declaration/variable.js +3 -3
  42. package/src/node/parameter.js +4 -4
  43. package/src/node/property.js +9 -9
  44. package/src/node/propertyRelation.js +3 -3
  45. package/src/node/variable.js +4 -4
@@ -141,8 +141,8 @@ class LocalContext {
141
141
  addVariable(variable, nested = true) {
142
142
  let variableAdded = false;
143
143
 
144
- const variableName = variable.getNode(),
145
- variablePresent = this.isVariablePresentByVariableName(variableName, nested);
144
+ const variableIdentifier = variable.getIdentifier(),
145
+ variablePresent = this.isVariablePresentByVariableIdentifier(variableIdentifier, nested);
146
146
 
147
147
  if (!variablePresent) {
148
148
  this.variables.push(variable);
@@ -194,12 +194,12 @@ class LocalContext {
194
194
 
195
195
  findMetaLemmaMetatheoremsByReference(reference) { return this.context.findMetaLemmaMetatheoremsByReference(reference); }
196
196
 
197
- findVariableByVariableName(variableName, nested = true) {
197
+ findVariableByVariableIdentifier(variableIdentifier, nested = true) {
198
198
  const variables = this.getVariables(nested),
199
199
  variable = variables.find((variable) => {
200
- const variableNameMatches = variable.matchVariableName(variableName);
200
+ const variableIdentifierMatches = variable.matchVariableIdentifier(variableIdentifier);
201
201
 
202
- if (variableNameMatches) {
202
+ if (variableIdentifierMatches) {
203
203
  return true;
204
204
  }
205
205
  }) || null;
@@ -251,8 +251,8 @@ class LocalContext {
251
251
 
252
252
  isTypePresentByTypeName(typeName) { return this.context.isTypePresentByTypeName(typeName); }
253
253
 
254
- isVariablePresentByVariableName(variableName, nested = true) {
255
- const variable = this.findVariableByVariableName(variableName, nested),
254
+ isVariablePresentByVariableIdentifier(variableIdentifier, nested = true) {
255
+ const variable = this.findVariableByVariableIdentifier(variableIdentifier, nested),
256
256
  variablePresent = (variable !== null);
257
257
 
258
258
  return variablePresent;
@@ -183,9 +183,9 @@ export default domAssigned(class PropertyAssertion {
183
183
  variable = Variable.fromTermNode(termNode, context);
184
184
 
185
185
  if (variable !== null) {
186
- const variableName = variable.getName();
186
+ const variableIdentifier = variable.getIdentifier();
187
187
 
188
- variable = context.findVariableByVariableName(variableName);
188
+ variable = context.findVariableByVariableIdentifier(variableIdentifier);
189
189
 
190
190
  variable = Variable.fromVariableAndPropertyRelation(variable, this.propertyRelation);
191
191
 
@@ -210,11 +210,11 @@ export default domAssigned(class ComplexTypeDeclaration {
210
210
 
211
211
  this.context.trace(`Verifying the '${propertyString}' property...`);
212
212
 
213
- const propertyName = property.getName(),
213
+ const propertyIdentifier = property.getIdentifier(),
214
214
  count = properties.reduce((count, property) => {
215
- const propertyNameMatches = property.matchPropertyName(propertyName);
215
+ const propertyIdentifierMatches = property.matchPropertyIdentifier(propertyIdentifier);
216
216
 
217
- if (propertyNameMatches) {
217
+ if (propertyIdentifierMatches) {
218
218
  count++;
219
219
  }
220
220
 
@@ -225,9 +225,9 @@ export default domAssigned(class ComplexTypeDeclaration {
225
225
  this.context.debug(`The '${propertyString}' property appears more than once.`);
226
226
  } else {
227
227
  const superTypeProperty = superTypeProperties.find((superTypeProperty) => {
228
- const propertyNameMatches = superTypeProperty.matchPropertyName(propertyName);
228
+ const propertyIdentifierMatches = superTypeProperty.matchPropertyIdentifier(propertyIdentifier);
229
229
 
230
- if (propertyNameMatches) {
230
+ if (propertyIdentifierMatches) {
231
231
  return true;
232
232
  }
233
233
  }) || null;
@@ -56,8 +56,8 @@ export default domAssigned(class VariableDeclaration {
56
56
 
57
57
  this.context.trace(`Verifying the '${variableString}' variable...`);
58
58
 
59
- const variableName = this.variable.getName(),
60
- variablePresent = this.context.isVariablePresentByVariableName(variableName);
59
+ const variableIdentifier = this.variable.getIdentifier(),
60
+ variablePresent = this.context.isVariablePresentByVariableIdentifier(variableIdentifier);
61
61
 
62
62
  if (variablePresent) {
63
63
  this.context.debug(`The '${variableName}' variable is already present.`);
@@ -64,16 +64,12 @@ export default domAssigned(class Metavariable {
64
64
  this.metaType = metaType;
65
65
  }
66
66
 
67
- matchName(name) {
68
- const nameMatches = (name === this.name);
67
+ matchParameter(parameter) {
68
+ const name = parameter.getName(),
69
+ nameMatches = (name === this.name),
70
+ parameterMatches = nameMatches; ///
69
71
 
70
- return nameMatches;
71
- }
72
-
73
- matchValue(value) {
74
- const valueMatches = (value === this.name);
75
-
76
- return valueMatches;
72
+ return parameterMatches;
77
73
  }
78
74
 
79
75
  matchMetavariableName(metavariableName) {
@@ -3,16 +3,16 @@
3
3
  import { domAssigned } from "../dom";
4
4
 
5
5
  export default domAssigned(class Parameter {
6
- constructor(value) {
7
- this.value = value;
6
+ constructor(name) {
7
+ this.name = name;
8
8
  }
9
9
 
10
- getValue() {
11
- return this.value;
10
+ getName() {
11
+ return this.name;
12
12
  }
13
13
 
14
14
  getString() {
15
- const string = this.value; ///
15
+ const string = this.name; ///
16
16
 
17
17
  return string;
18
18
  }
@@ -20,13 +20,14 @@ export default domAssigned(class Parameter {
20
20
  findReplacementNode(substitutions) {
21
21
  let replacementNode = null;
22
22
 
23
- const substitution = substitutions.findSubstitution((substitution) => {
24
- const valueMatches = substitution.matchValue(this.value);
23
+ const parameter = this, ///
24
+ substitution = substitutions.findSubstitution((substitution) => {
25
+ const nameMatches = substitution.matchParameter(parameter);
25
26
 
26
- if (valueMatches) {
27
- return true;
28
- }
29
- });
27
+ if (nameMatches) {
28
+ return true;
29
+ }
30
+ });
30
31
 
31
32
  if (substitution !== null) {
32
33
  replacementNode = substitution.getReplacementNode();
@@ -36,9 +37,9 @@ export default domAssigned(class Parameter {
36
37
  }
37
38
 
38
39
  toJSON() {
39
- const value = this.value,
40
+ const name = this.name,
40
41
  json = {
41
- value
42
+ name
42
43
  };
43
44
 
44
45
  return json;
@@ -47,16 +48,16 @@ export default domAssigned(class Parameter {
47
48
  static name = "Parameter";
48
49
 
49
50
  static fromJSON(json, context) {
50
- const { value } = json,
51
- parameter = new Parameter(value);
51
+ const { name } = json,
52
+ parameter = new Parameter(name);
52
53
 
53
54
  return parameter;
54
55
  }
55
56
 
56
57
  static fromParameterNode(parameterNode, context) {
57
- const parameterValue = parameterNode.getParameterValue(),
58
- value = parameterValue, ///
59
- parameter = new Parameter(value);
58
+ const parameterName = parameterNode.getParameterName(),
59
+ name = parameterName, ///
60
+ parameter = new Parameter(name);
60
61
 
61
62
  return parameter;
62
63
  }
@@ -66,7 +66,7 @@ export default domAssigned(class ProcedureCall {
66
66
  }
67
67
 
68
68
  unifyIndependently(substitutions, context) {
69
- let unifiesIndependently = false;
69
+ let unifiesIndependently;
70
70
 
71
71
  const procedureCallString = this.string; ///
72
72
 
@@ -92,12 +92,12 @@ export default domAssigned(class PropertyRelation {
92
92
  context.trace(`Verifying the '${propertyString}' property...`);
93
93
 
94
94
  const termType = this.term.getType(),
95
- propertyName = this.property.getName(),
95
+ propertyIdentifier = this.property.getIdentifier(),
96
96
  termTypeProperties = termType.getProperties(),
97
97
  variableTypeProperty = termTypeProperties.find((termTypeProperty) => {
98
- const propertyNameMatches = termTypeProperty.matchPropertyName(propertyName);
98
+ const propertyIdentifierMatches = termTypeProperty.matchPropertyIdentifier(propertyIdentifier);
99
99
 
100
- if (propertyNameMatches) {
100
+ if (propertyIdentifierMatches) {
101
101
  return true;
102
102
  }
103
103
  }) || null;
@@ -106,7 +106,7 @@ export default domAssigned(class PropertyRelation {
106
106
  const variableString = this.term.getString(),
107
107
  variableTypeString = termType.getString();
108
108
 
109
- context.debug(`The '${propertyName}' property is not a property of the '${variableString}' variable's '${variableTypeString}' type.`);
109
+ context.debug(`The '${propertyIdentifier}' property is not a property of the '${variableString}' variable's '${variableTypeString}' type.`);
110
110
  } else {
111
111
  const type = termType;
112
112
 
@@ -26,7 +26,7 @@ export default domAssigned(class FrameSubstitution extends Substitution {
26
26
 
27
27
  isMetavariableEqualTo(metavariable) { return this.metavariable.isEqualTo(metavariable); }
28
28
 
29
- matchValue(value) { return this.metavariable.matchValue(value); }
29
+ matchParameter(parameter) { return this.metavariable.matchParameter(parameter); }
30
30
 
31
31
  getReplacementNode() {
32
32
  const frameNode = this.frame.getNode(),
@@ -69,7 +69,7 @@ export default domAssigned(class StatementSubstitution extends Substitution {
69
69
  return simple;
70
70
  }
71
71
 
72
- matchName(name) { return this.metavariable.matchName(name); }
72
+ matchParameter(parameter) { return this.metavariable.matchParameter(parameter); }
73
73
 
74
74
  getReplacementNode() {
75
75
  const statementNode = this.statement.getNode(),
@@ -42,6 +42,8 @@ export default domAssigned(class TermSubstitution extends Substitution {
42
42
 
43
43
  isVariableEqualTo(variable) { return this.variable.isEqualTo(variable); }
44
44
 
45
+ matchParameter(parameter) { return this.variable.matchParameter(parameter); }
46
+
45
47
  getReplacementNode() {
46
48
  const termNode = this.term.getNode(),
47
49
  replacementNode = termNode; ///
@@ -49,8 +51,6 @@ export default domAssigned(class TermSubstitution extends Substitution {
49
51
  return replacementNode;
50
52
  }
51
53
 
52
- matchValue(value) { return this.variable.matchValue(value); }
53
-
54
54
  static fromStatementNode(statementNode, context) {
55
55
  let termSubstitution = null;
56
56
 
@@ -135,10 +135,10 @@ export default class Substitution {
135
135
  return resolved;
136
136
  }
137
137
 
138
- matchName(name) {
139
- const nameMatches = false;
138
+ matchParameter(parameter) {
139
+ const parameterMatches = false;
140
140
 
141
- return nameMatches;
141
+ return parameterMatches;
142
142
  }
143
143
 
144
144
  getReplacementNode() {
package/src/dom/type.js CHANGED
@@ -182,12 +182,6 @@ class Type {
182
182
  return equalToOrSuperTypeOf;
183
183
  }
184
184
 
185
- matchName(name) {
186
- const nodeMatches = (this.name === name);
187
-
188
- return nodeMatches;
189
- }
190
-
191
185
  matchTypeName(typeName) {
192
186
  const typeNameMatches = (this.name === typeName);
193
187
 
@@ -48,10 +48,12 @@ export default domAssigned(class Variable {
48
48
  return equalTo;
49
49
  }
50
50
 
51
- mathValue(value) {
52
- const valueMatches = (value === this.identifier);
51
+ matchParameter(parameter) {
52
+ const parameterName = parameter.getName(),
53
+ parameterNameMatchesIdentifier = (parameterName === this.identifier),
54
+ parameterMatches = parameterNameMatchesIdentifier; ///
53
55
 
54
- return valueMatches;
56
+ return parameterMatches;
55
57
  }
56
58
 
57
59
  matchVariableIdentifier(variableIdentifier) {
@@ -233,8 +235,8 @@ export default domAssigned(class Variable {
233
235
  let propertyRelations;
234
236
 
235
237
  const node = variable.getNode(),
236
- identifier = variable.getName(),
237
- type = variable.getType();
238
+ type = variable.getType(),
239
+ identifier = variable.getIdentifier();
238
240
 
239
241
  propertyRelations = variable.getPropertyRelations();
240
242
 
@@ -37,9 +37,12 @@ function verifyTermAsVariable(term, context, verifyAhead) {
37
37
  singularVariableNode = termNode.getSingularVariableNode();
38
38
 
39
39
  if (singularVariableNode !== null) {
40
- const variableNode = singularVariableNode,
41
- variable = Variable.fromVariableNode(variableNode, context),
42
- termString = term.getString();
40
+ let variable;
41
+
42
+ const termString = term.getString(),
43
+ variableNode = singularVariableNode; ///
44
+
45
+ variable = Variable.fromVariableNode(variableNode, context);
43
46
 
44
47
  context.trace(`Verifying the '${termString}' term as a variable...`);
45
48
 
@@ -48,9 +51,9 @@ function verifyTermAsVariable(term, context, verifyAhead) {
48
51
  if (variableVerifies) {
49
52
  let verifiesAhead;
50
53
 
51
- const variableName = variable.getName();
54
+ const variableIdentifier = variable.getIdentifier();
52
55
 
53
- variable = context.findVariableByVariableName(variableName);
56
+ variable = context.findVariableByVariableIdentifier(variableIdentifier);
54
57
 
55
58
  const type = variable.getType();
56
59
 
@@ -5,11 +5,11 @@ import NonTerminalNode from "../../node/nonTerminal";
5
5
  import { TYPE_RULE_NAME, PROPERTY_RULE_NAME } from "../../ruleNames";
6
6
 
7
7
  export default class PropertyDeclarationNode extends NonTerminalNode {
8
- getPropertyName() {
8
+ getPropertyIdentifier() {
9
9
  const propertyNode = this.getPropertyNode(),
10
- propertyName = propertyNode.getPropertyName();
10
+ propertyIdentifier = propertyNode.getPropertyIdentifier();
11
11
 
12
- return propertyName;
12
+ return propertyIdentifier;
13
13
  }
14
14
 
15
15
  getTypeNode() {
@@ -42,11 +42,11 @@ export default class VariableDeclarationNode extends NonTerminalNode {
42
42
  return variableNode;
43
43
  }
44
44
 
45
- getVariableName() {
45
+ getVariableIdentifier() {
46
46
  const variableNode = this.getVariableNode(),
47
- variableName = variableNode.getVariableName();
47
+ variableIdentifier = variableNode.getVariableIdentifier();
48
48
 
49
- return variableName;
49
+ return variableIdentifier;
50
50
  }
51
51
 
52
52
  static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(VariableDeclarationNode, ruleName, childNodes, opacity, precedence); }
@@ -3,21 +3,21 @@
3
3
  import NonTerminalNode from "../node/nonTerminal";
4
4
 
5
5
  export default class ParameterNode extends NonTerminalNode {
6
- getParameterValue() {
7
- let parameterValue;
6
+ getParameterName() {
7
+ let parameterName;
8
8
 
9
9
  this.someChildNode((childNode, index) => {
10
10
  const terminalNode = childNode, ///
11
11
  content = terminalNode.getContent();
12
12
 
13
- parameterValue = content; ///
13
+ parameterName = content; ///
14
14
 
15
15
  if (index === 0) {
16
16
  return true;
17
17
  }
18
18
  });
19
19
 
20
- return parameterValue;
20
+ return parameterName;
21
21
  }
22
22
 
23
23
  static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(ParameterNode, ruleName, childNodes, opacity, precedence); }
@@ -5,23 +5,23 @@ import NonTerminalNode from "../node/nonTerminal";
5
5
  import { SINGLE_SPACE } from "../constants";
6
6
 
7
7
  export default class PropertyNode extends NonTerminalNode {
8
- getPropertyName() {
9
- const names = this.getNames(),
10
- propertyName = names.join(SINGLE_SPACE);
8
+ getPropertyIdentifiers() {
9
+ const identifiers = this.getIdentifiers(),
10
+ propertyIdentifiers = identifiers.join(SINGLE_SPACE);
11
11
 
12
- return propertyName;
12
+ return propertyIdentifiers;
13
13
  }
14
14
 
15
- getNames() {
16
- const names = this.mapChildNode((childNode) => {
15
+ getIdentifiers() {
16
+ const identifiers = this.mapChildNode((childNode) => {
17
17
  const terminalNode = childNode, ///
18
18
  content = terminalNode.getContent(),
19
- name = content; //
19
+ identifier = content; //
20
20
 
21
- return name;
21
+ return identifier;
22
22
  });
23
23
 
24
- return names;
24
+ return identifiers;
25
25
  }
26
26
 
27
27
  static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(PropertyNode, ruleName, childNodes, opacity, precedence); }
@@ -19,11 +19,11 @@ export default class PropertyRelationNode extends NonTerminalNode {
19
19
  return propertyNode;
20
20
  }
21
21
 
22
- getPropertyName() {
22
+ getPropertyIdentifier() {
23
23
  const propertyNode = this.getPropertyNode(),
24
- propertyName = propertyNode.getPropertyName();
24
+ propertyIdentifier = propertyNode.getPropertyIdentifier();
25
25
 
26
- return propertyName;
26
+ return propertyIdentifier;
27
27
  }
28
28
 
29
29
  static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(PropertyRelationNode, ruleName, childNodes, opacity, precedence); }
@@ -3,8 +3,8 @@
3
3
  import NonTerminalNode from "../node/nonTerminal";
4
4
 
5
5
  export default class VariableNode extends NonTerminalNode {
6
- getVariableName() {
7
- let variableName;
6
+ getVariableIdentifier() {
7
+ let variableIdentifier;
8
8
 
9
9
  this.someChildNode((childNode) => {
10
10
  const childNodeTerminalNode = childNode.isTerminalNode();
@@ -13,13 +13,13 @@ export default class VariableNode extends NonTerminalNode {
13
13
  const terminalNode = childNode, ///
14
14
  content = terminalNode.getContent();
15
15
 
16
- variableName = content; ///
16
+ variableIdentifier = content; ///
17
17
 
18
18
  return true;
19
19
  }
20
20
  });
21
21
 
22
- return variableName;
22
+ return variableIdentifier;
23
23
  }
24
24
 
25
25
  static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(VariableNode, ruleName, childNodes, opacity, precedence); }