occam-furtle 3.0.521 → 3.0.524

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 (59) hide show
  1. package/lib/element/all.js +126 -0
  2. package/lib/element/assignment/object.js +23 -1
  3. package/lib/element/error.js +3 -3
  4. package/lib/element/every.js +13 -13
  5. package/lib/element/exists.js +39 -0
  6. package/lib/element/expression.js +18 -2
  7. package/lib/element/importStatement.js +3 -2
  8. package/lib/element/procedure.js +2 -1
  9. package/lib/element/procedureCall.js +8 -1
  10. package/lib/element/reduce.js +5 -5
  11. package/lib/element/referenceListLiteral.js +24 -0
  12. package/lib/element/references.js +32 -0
  13. package/lib/element/some.js +7 -7
  14. package/lib/element/terms.js +2 -2
  15. package/lib/element/values.js +16 -3
  16. package/lib/example/furtle/bnf.js +2 -2
  17. package/lib/node/all.js +39 -0
  18. package/lib/node/exists.js +39 -0
  19. package/lib/node/expression.js +9 -1
  20. package/lib/node/references.js +23 -0
  21. package/lib/node/referencesListLiteral.js +27 -0
  22. package/lib/nominalValueProperties.js +34 -18
  23. package/lib/nonTerminalNodeMap.js +10 -2
  24. package/lib/parameterNames.js +5 -1
  25. package/lib/preamble.js +7 -3
  26. package/lib/process/instantiate.js +1 -1
  27. package/lib/ruleNames.js +17 -1
  28. package/lib/utilities/element.js +110 -7
  29. package/lib/utilities/string.js +38 -5
  30. package/package.json +5 -5
  31. package/src/element/all.js +119 -0
  32. package/src/element/assignment/object.js +48 -1
  33. package/src/element/error.js +3 -3
  34. package/src/element/every.js +14 -12
  35. package/src/element/exists.js +42 -0
  36. package/src/element/expression.js +19 -1
  37. package/src/element/importStatement.js +3 -1
  38. package/src/element/procedure.js +2 -0
  39. package/src/element/procedureCall.js +14 -0
  40. package/src/element/reduce.js +4 -4
  41. package/src/element/referenceListLiteral.js +19 -0
  42. package/src/element/references.js +31 -0
  43. package/src/element/some.js +7 -6
  44. package/src/element/terms.js +1 -1
  45. package/src/element/values.js +26 -2
  46. package/src/example/furtle/bnf.js +1 -1
  47. package/src/node/all.js +44 -0
  48. package/src/node/exists.js +44 -0
  49. package/src/node/expression.js +17 -1
  50. package/src/node/references.js +16 -0
  51. package/src/node/referencesListLiteral.js +23 -0
  52. package/src/nominalValueProperties.js +43 -25
  53. package/src/nonTerminalNodeMap.js +15 -3
  54. package/src/parameterNames.js +1 -0
  55. package/src/preamble.js +6 -2
  56. package/src/process/instantiate.js +6 -1
  57. package/src/ruleNames.js +4 -0
  58. package/src/utilities/element.js +147 -14
  59. package/src/utilities/string.js +49 -6
@@ -10,7 +10,7 @@ import { LIST_TYPE_NAME } from "../typeNames";
10
10
  import { valueFromNominalValue } from "../utilities/value";
11
11
 
12
12
  const { reduce } = continuationUtilities,
13
- { breakable } = breakPointUtilities;
13
+ { unbreakable } = breakPointUtilities;
14
14
 
15
15
  export default define(class Reduce extends Element {
16
16
  constructor(context, string, node, breakPoint, variable, initialValue, anonymousProcedure) {
@@ -33,10 +33,10 @@ export default define(class Reduce extends Element {
33
33
  return this.anonymousProcedure;
34
34
  }
35
35
 
36
- evaluate = breakable(function (context, forward, back) {
36
+ evaluate = unbreakable(function (context, forward, back) {
37
37
  const reduceString = this.getString();
38
38
 
39
- context.trace(`Evaluating the '${reduceString}' reduce...`);
39
+ context.trace(`Evaluating the '${reduceString}' function...`);
40
40
 
41
41
  return this.variable.evaluate(context, (value, back) => {
42
42
  const valueType = value.getType(),
@@ -59,7 +59,7 @@ export default define(class Reduce extends Element {
59
59
  }, initialValue, (value, back) => {
60
60
  const valueString = value.getString();
61
61
 
62
- context.trace(`...evaluated the '${reduceString}' reduce as '${valueString}'.`);
62
+ context.trace(`...evaluated the '${reduceString}' function as '${valueString}'.`);
63
63
 
64
64
  return forward(value, back);
65
65
  }, back);
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ import { Element } from "occam-languages";
4
+
5
+ import { define } from "../elements";
6
+
7
+ export default define(class ReferenceListLiteral extends Element {
8
+ constructor(context, string, node, breakPoint, references) {
9
+ super(context, string, node, breakPoint);
10
+
11
+ this.references = references;
12
+ }
13
+
14
+ getReferences() {
15
+ return this.references;
16
+ }
17
+
18
+ static name = "ReferenceListLiteral";
19
+ });
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ import { Element } from "occam-languages";
4
+
5
+ import { define } from "../elements";
6
+
7
+ export default define(class References extends Element {
8
+ constructor(context, string, node, breakPoint, array) {
9
+ super(context, string, node, breakPoint);
10
+
11
+ this.array = array;
12
+ }
13
+
14
+ getArray() {
15
+ return this.array;
16
+ }
17
+
18
+ getLength() {
19
+ const length = this.array.length;
20
+
21
+ return length;
22
+ }
23
+
24
+ getReference(index) {
25
+ const reference = this.array[index] || null;
26
+
27
+ return reference;
28
+ }
29
+
30
+ static name = "References";
31
+ });
@@ -10,7 +10,7 @@ import { LIST_TYPE_NAME, BOOLEAN_TYPE_NAME } from "../typeNames";
10
10
  import { valueFromBoolean, valueFromNominalValue } from "../utilities/value";
11
11
 
12
12
  const { some } = continuationUtilities,
13
- { breakable } = breakPointUtilities;
13
+ { unbreakable } = breakPointUtilities;
14
14
 
15
15
  export default define(class Some extends Element {
16
16
  constructor(context, string, node, breakPoint, variable, anonymousProcedure) {
@@ -28,10 +28,10 @@ export default define(class Some extends Element {
28
28
  return this.anonymousProcedure;
29
29
  }
30
30
 
31
- evaluate = breakable(function (context, forward, back) {
31
+ evaluate = unbreakable(function (context, forward, back) {
32
32
  const someString = this.getString();
33
33
 
34
- context.trace(`Evaluating the '${someString}' some...`);
34
+ context.trace(`Evaluating the '${someString}' function...`);
35
35
 
36
36
  return this.variable.evaluate(context, (value, back) => {
37
37
  const valueType = value.getType(),
@@ -50,11 +50,12 @@ export default define(class Some extends Element {
50
50
 
51
51
  return some(nominalValues, (nominalValue, forward, back) => {
52
52
  return this.evaluateAnonymousProcedure(nominalValue, context, forward, back);
53
- }, (boolean, back) => {
54
- const value = valueFromBoolean(boolean, context),
53
+ }, context, (context, back) => {
54
+ const boolean = true,
55
+ value = valueFromBoolean(boolean, context),
55
56
  valueString = value.getString();
56
57
 
57
- context.trace(`...evaluated the '${someString}' some as '${valueString}'.`);
58
+ context.trace(`...evaluated the '${someString}' function as '${valueString}'.`);
58
59
 
59
60
  return forward(value, back);
60
61
  }, back);
@@ -44,7 +44,7 @@ export default define(class Terms extends Element {
44
44
  return this.mapTerm((term, forward, back) => {
45
45
  return term.evaluate(context, forward, back);
46
46
  }, (valuesArray) => {
47
- const valuesString = valuesStringFromValuesArray(valuesArray, context),
47
+ const valuesString = valuesStringFromValuesArray(valuesArray),
48
48
  string = valuesString, ///
49
49
  array = valuesArray, ///
50
50
  node = null,
@@ -46,7 +46,7 @@ export default define(class Values extends Element {
46
46
  return this.mapValue((value, forward, back) => {
47
47
  return value.evaluate(context, forward, back);
48
48
  }, (valuesArray, back) => {
49
- const valuesString = valuesStringFromValuesArray(valuesArray, context),
49
+ const valuesString = valuesStringFromValuesArray(valuesArray),
50
50
  string = valuesString, ///
51
51
  array = valuesArray, ///
52
52
  node = null,
@@ -60,13 +60,37 @@ export default define(class Values extends Element {
60
60
  }, back);
61
61
  }
62
62
 
63
+ merge(values, context) {
64
+ let array;
65
+
66
+ array = values.getArray();
67
+
68
+ const valuesArray = [
69
+ ...this.array,
70
+ ...array,
71
+ ],
72
+ valuesString = valuesStringFromValuesArray(valuesArray),
73
+ string = valuesString; ///
74
+
75
+ array = valuesArray; ///
76
+
77
+ const node = null,
78
+ breakPoint = null;
79
+
80
+ context = null;
81
+
82
+ values = new Values(context, string, node, breakPoint, array);
83
+
84
+ return values;
85
+ }
86
+
63
87
  static name = "Values";
64
88
 
65
89
  static fromValue(value, context) {
66
90
  const valuesArray = [
67
91
  value
68
92
  ],
69
- valuesString = valuesStringFromValuesArray(valuesArray, context),
93
+ valuesString = valuesStringFromValuesArray(valuesArray),
70
94
  string = valuesString, ///
71
95
  array = valuesArray, ///
72
96
  node = null,
@@ -28,7 +28,7 @@ const bnf = `
28
28
 
29
29
  objectAssignment ::= "{" namedBindings "}" "=" variable ";" ;
30
30
 
31
- listAssignment ::= "[" bindings "]" "=" variable ";" ;
31
+ listAssignment ::= "[" bindings "]" "=" variable ";" ;
32
32
 
33
33
 
34
34
 
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ import { NonTerminalNode } from "occam-languages";
4
+
5
+ import { VALUES_RULE_NAME, VARIABLE_RULE_NAME, REFERENCE_LIST_LITERAL_RULE_NAME } from "../ruleNames";
6
+
7
+ export default class AllNode extends NonTerminalNode {
8
+ getReferencesNode() {
9
+ const referenceListLiteralNode = this.getReferenceListLiteralNode(),
10
+ referencesNode = referenceListLiteralNode.getReferencesNode();
11
+
12
+ return referencesNode;
13
+ }
14
+
15
+ getValueNodes() {
16
+ const valuesNode = this.getValuesNode(),
17
+ valueNodes = valuesNode.getValueNodes();
18
+
19
+ return valueNodes;
20
+ }
21
+
22
+ getValuesNode() {
23
+ const ruleName = VALUES_RULE_NAME,
24
+ valuesNode = this.getNodeByRuleName(ruleName);
25
+
26
+ return valuesNode;
27
+ }
28
+
29
+ getVariableNode() {
30
+ const ruleName = VARIABLE_RULE_NAME,
31
+ variableNode = this.getNodeByRuleName(ruleName);
32
+
33
+ return variableNode;
34
+ }
35
+
36
+ getReferenceListLiteralNode() {
37
+ const ruleName = REFERENCE_LIST_LITERAL_RULE_NAME,
38
+ referenceListLiteralNode = this.getNodeByRuleName(ruleName);
39
+
40
+ return referenceListLiteralNode;
41
+ }
42
+
43
+ static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(AllNode, ruleName, childNodes, opacity, precedence); }
44
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ import { NonTerminalNode } from "occam-languages";
4
+
5
+ import { VALUES_RULE_NAME, VARIABLE_RULE_NAME, REFERENCE_LIST_LITERAL_RULE_NAME } from "../ruleNames";
6
+
7
+ export default class ExistsNode extends NonTerminalNode {
8
+ getReferencesNode() {
9
+ const referenceListLiteralNode = this.getReferenceListLiteralNode(),
10
+ referencesNode = referenceListLiteralNode.getReferencesNode();
11
+
12
+ return referencesNode;
13
+ }
14
+
15
+ getValueNodes() {
16
+ const valuesNode = this.getValuesNode(),
17
+ valueNodes = valuesNode.getValueNodes();
18
+
19
+ return valueNodes;
20
+ }
21
+
22
+ getValuesNode() {
23
+ const ruleName = VALUES_RULE_NAME,
24
+ valuesNode = this.getNodeByRuleName(ruleName);
25
+
26
+ return valuesNode;
27
+ }
28
+
29
+ getVariableNode() {
30
+ const ruleName = VARIABLE_RULE_NAME,
31
+ variableNode = this.getNodeByRuleName(ruleName);
32
+
33
+ return variableNode;
34
+ }
35
+
36
+ getReferenceListLiteralNode() {
37
+ const ruleName = REFERENCE_LIST_LITERAL_RULE_NAME,
38
+ referenceListLiteralNode = this.getNodeByRuleName(ruleName);
39
+
40
+ return referenceListLiteralNode;
41
+ }
42
+
43
+ static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(ExistsNode, ruleName, childNodes, opacity, precedence); }
44
+ }
@@ -2,10 +2,12 @@
2
2
 
3
3
  import { NonTerminalNode } from "occam-languages";
4
4
 
5
- import { TERM_RULE_NAME,
5
+ import { ALL_RULE_NAME,
6
+ TERM_RULE_NAME,
6
7
  SOME_RULE_NAME,
7
8
  EVERY_RULE_NAME,
8
9
  REDUCE_RULE_NAME,
10
+ EXISTS_RULE_NAME,
9
11
  TERNARY_RULE_NAME,
10
12
  CONTAINS_RULE_NAME,
11
13
  LENGTH_OF_RULE_NAME,
@@ -19,6 +21,13 @@ import { TERM_RULE_NAME,
19
21
  PROCEDURE_CALL_RULE_NAME } from "../ruleNames";
20
22
 
21
23
  export default class ExpressionNode extends NonTerminalNode {
24
+ getAllNode() {
25
+ const ruleName = ALL_RULE_NAME,
26
+ allNode = this.getNodeByRuleName(ruleName);
27
+
28
+ return allNode;
29
+ }
30
+
22
31
  getTermNode() {
23
32
  const ruleName = TERM_RULE_NAME,
24
33
  termNode = this.getNodeByRuleName(ruleName);
@@ -47,6 +56,13 @@ export default class ExpressionNode extends NonTerminalNode {
47
56
  return reduceNode;
48
57
  }
49
58
 
59
+ getExistsNode() {
60
+ const ruleName = EXISTS_RULE_NAME,
61
+ existsNode = this.getNodeByRuleName(ruleName);
62
+
63
+ return existsNode;
64
+ }
65
+
50
66
  getTernaryNode() {
51
67
  const ruleName = TERNARY_RULE_NAME,
52
68
  ternaryNode = this.getNodeByRuleName(ruleName);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ import { NonTerminalNode } from "occam-languages";
4
+
5
+ import { REFERENCE_RULE_NAME } from "../ruleNames";
6
+
7
+ export default class ReferencesNode extends NonTerminalNode {
8
+ getReferenceNodes() {
9
+ const ruleName = REFERENCE_RULE_NAME,
10
+ referenceNodes = this.getNodesByRuleName(ruleName);
11
+
12
+ return referenceNodes;
13
+ }
14
+
15
+ static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(ReferencesNode, ruleName, childNodes, opacity, precedence); }
16
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ import { NonTerminalNode } from "occam-languages";
4
+
5
+ import { REFERENCES_RULE_NAME } from "../ruleNames";
6
+
7
+ export default class ReferencesListLiteralNode extends NonTerminalNode {
8
+ getReferenceNodes() {
9
+ const referencesNode = this.getReferencesNode(),
10
+ referenceNodes = referencesNode.getReferenceNodes();
11
+
12
+ return referenceNodes;
13
+ }
14
+
15
+ getReferencesNode() {
16
+ const ruleName = REFERENCES_RULE_NAME,
17
+ referencesNode = this.getNodeByRuleName(ruleName);
18
+
19
+ return referencesNode;
20
+ }
21
+
22
+ static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(ReferencesListLiteralNode, ruleName, childNodes, opacity, precedence); }
23
+ }
@@ -8,10 +8,34 @@ import NominalValueProperty from "./nominalValueProperty";
8
8
 
9
9
  import { nominalValuePropertiesStringFromNominalValuePropertiesArray } from "./utilities/string";
10
10
  import { LIST_TYPE_NAME, STRING_TYPE_NAME, BOOLEAN_TYPE_NAME, NOMINAL_VALUE_TYPE_NAME } from "./typeNames";
11
- import { CONTENT_PARAMETER_NAME, TERMINAL_PARAMETER_NAME, CHILD_NODES_PARAMETER_NAME, NO_WHITESPACE_PARAMETER_NAME } from "./parameterNames";
11
+ import { TYPE_PARAMETER_NAME, CONTENT_PARAMETER_NAME, TERMINAL_PARAMETER_NAME, CHILD_NODES_PARAMETER_NAME, NO_WHITESPACE_PARAMETER_NAME } from "./parameterNames";
12
12
 
13
13
  const { some } = continuationUtilities;
14
14
 
15
+ const properties = [
16
+ {
17
+ name: TYPE_PARAMETER_NAME,
18
+ typeName: STRING_TYPE_NAME
19
+ },
20
+ {
21
+ name: CONTENT_PARAMETER_NAME,
22
+ typeName: STRING_TYPE_NAME
23
+ },
24
+ {
25
+ name: TERMINAL_PARAMETER_NAME,
26
+ typeName: BOOLEAN_TYPE_NAME
27
+ },
28
+ {
29
+ name: NO_WHITESPACE_PARAMETER_NAME,
30
+ typeName: BOOLEAN_TYPE_NAME
31
+ },
32
+ {
33
+ name: CHILD_NODES_PARAMETER_NAME,
34
+ typeName: LIST_TYPE_NAME,
35
+ argumentTypeName: NOMINAL_VALUE_TYPE_NAME
36
+ }
37
+ ];
38
+
15
39
  class NominalValueProperties {
16
40
  constructor(string, array) {
17
41
  this.string = string;
@@ -71,30 +95,9 @@ const nominalValueProperties = NominalValueProperties.fromNothing();
71
95
  export default nominalValueProperties;
72
96
 
73
97
  function nominalValuePropertiesArrayFromNothing() {
74
- const names = [
75
- CONTENT_PARAMETER_NAME,
76
- TERMINAL_PARAMETER_NAME,
77
- NO_WHITESPACE_PARAMETER_NAME,
78
- CHILD_NODES_PARAMETER_NAME,
79
- ],
80
- typeNames = [
81
- STRING_TYPE_NAME,
82
- BOOLEAN_TYPE_NAME,
83
- BOOLEAN_TYPE_NAME,
84
- LIST_TYPE_NAME
85
- ],
86
- argumentTypeNames = [
87
- null,
88
- null,
89
- null,
90
- NOMINAL_VALUE_TYPE_NAME
91
- ],
92
- nominalValuePropertiesArray = names.map((name, index) => {
93
- const { Type } = elements,
94
- context = null,
95
- typeName = typeNames[index],
96
- argumentTypeName = argumentTypeNames[index],
97
- type = Type.fromTypeNameAndArgumentTypeName(typeName, argumentTypeName, context),
98
+ const nominalValuePropertiesArray = properties.map((property) => {
99
+ const name = nameFromProperty(property),
100
+ type = typeFromProperty(property),
98
101
  nominalValueProperty = NominalValueProperty.fromNameAndType(name, type);
99
102
 
100
103
  return nominalValueProperty;
@@ -102,3 +105,18 @@ function nominalValuePropertiesArrayFromNothing() {
102
105
 
103
106
  return nominalValuePropertiesArray;
104
107
  }
108
+
109
+ function nameFromProperty(property) {
110
+ const { name } = property;
111
+
112
+ return name;
113
+ }
114
+
115
+ function typeFromProperty(property) {
116
+ const { typeName, argumentTypeName = null } = property,
117
+ { Type } = elements,
118
+ context = null,
119
+ type = Type.fromTypeNameAndArgumentTypeName(typeName, argumentTypeName, context);
120
+
121
+ return type;
122
+ }
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ import AllNode from "./node/all";
3
4
  import SomeNode from "./node/some";
4
5
  import TermNode from "./node/term";
5
6
  import TypeNode from "./node/type";
@@ -8,6 +9,7 @@ import EveryNode from "./node/every";
8
9
  import LabelNode from "./node/label";
9
10
  import ErrorNode from "./node/error";
10
11
  import ValueNode from "./node/value";
12
+ import ExistsNode from "./node/exists";
11
13
  import ValuesNode from "./node/values";
12
14
  import ReduceNode from "./node/reduce";
13
15
  import TernaryNode from "./node/ternary";
@@ -26,6 +28,7 @@ import StatementNode from "./node/statement";
26
28
  import NodeQueryNode from "./node/nodeQuery";
27
29
  import ToIntegerNode from "./node/toInteger";
28
30
  import ProcedureNode from "./node/procedure";
31
+ import ReferencesNode from "./node/references";
29
32
  import StartsWithNode from "./node/startsWith";
30
33
  import TryIntegerNode from "./node/tryInteger";
31
34
  import NodesQueryNode from "./node/nodesQuery";
@@ -48,8 +51,10 @@ import ObjectAssignmentNode from "./node/assignment/object";
48
51
  import AnonymousProcedureNode from "./node/anoymousProcedure";
49
52
  import VariableAssignmentNode from "./node/assignment/variable";
50
53
  import VariableAssignmentsNode from "./node/assignments/variable";
54
+ import ReferenceListLiteralNode from "./node/referencesListLiteral";
51
55
 
52
- import { SOME_RULE_NAME,
56
+ import { ALL_RULE_NAME,
57
+ SOME_RULE_NAME,
53
58
  TERM_RULE_NAME,
54
59
  TYPE_RULE_NAME,
55
60
  TERMS_RULE_NAME,
@@ -57,6 +62,7 @@ import { SOME_RULE_NAME,
57
62
  LABEL_RULE_NAME,
58
63
  ERROR_RULE_NAME,
59
64
  VALUE_RULE_NAME,
65
+ EXISTS_RULE_NAME,
60
66
  VALUES_RULE_NAME,
61
67
  REDUCE_RULE_NAME,
62
68
  TERNARY_RULE_NAME,
@@ -77,6 +83,7 @@ import { SOME_RULE_NAME,
77
83
  EXPRESSION_RULE_NAME,
78
84
  PARAMETERS_RULE_NAME,
79
85
  TO_INTEGER_RULE_NAME,
86
+ REFERENCES_RULE_NAME,
80
87
  TRY_INTEGER_RULE_NAME,
81
88
  NODES_QUERY_RULE_NAME,
82
89
  STARTS_WITH_RULE_NAME,
@@ -96,9 +103,11 @@ import { SOME_RULE_NAME,
96
103
  OBJECT_ASSIGNMENT_RULE_NAME,
97
104
  VARIABLE_ASSIGNMENT_RULE_NAME,
98
105
  ANONYMOUS_PROCEDURE_RULE_NAME,
99
- VARIABLE_ASSIGNMENTS_RULE_NAME } from "./ruleNames";
106
+ VARIABLE_ASSIGNMENTS_RULE_NAME,
107
+ REFERENCE_LIST_LITERAL_RULE_NAME } from "./ruleNames";
100
108
 
101
109
  const NonTerminalNodeMap = {
110
+ [ALL_RULE_NAME]: AllNode,
102
111
  [SOME_RULE_NAME]: SomeNode,
103
112
  [TERM_RULE_NAME]: TermNode,
104
113
  [TYPE_RULE_NAME]: TypeNode,
@@ -107,6 +116,7 @@ const NonTerminalNodeMap = {
107
116
  [LABEL_RULE_NAME]: LabelNode,
108
117
  [ERROR_RULE_NAME]: ErrorNode,
109
118
  [VALUE_RULE_NAME]: ValueNode,
119
+ [EXISTS_RULE_NAME]: ExistsNode,
110
120
  [VALUES_RULE_NAME]: ValuesNode,
111
121
  [REDUCE_RULE_NAME]: ReduceNode,
112
122
  [TERNARY_RULE_NAME]: TernaryNode,
@@ -127,6 +137,7 @@ const NonTerminalNodeMap = {
127
137
  [NODE_QUERY_RULE_NAME]: NodeQueryNode,
128
138
  [EXPRESSION_RULE_NAME]: ExpressionNode,
129
139
  [PARAMETERS_RULE_NAME]: ParametersNode,
140
+ [REFERENCES_RULE_NAME]: ReferencesNode,
130
141
  [STARTS_WITH_RULE_NAME]: StartsWithNode,
131
142
  [TRY_INTEGER_RULE_NAME]: TryIntegerNode,
132
143
  [NODES_QUERY_RULE_NAME]: NodesQueryNode,
@@ -146,7 +157,8 @@ const NonTerminalNodeMap = {
146
157
  [OBJECT_ASSIGNMENT_RULE_NAME]: ObjectAssignmentNode,
147
158
  [ANONYMOUS_PROCEDURE_RULE_NAME]: AnonymousProcedureNode,
148
159
  [VARIABLE_ASSIGNMENT_RULE_NAME]: VariableAssignmentNode,
149
- [VARIABLE_ASSIGNMENTS_RULE_NAME]: VariableAssignmentsNode
160
+ [VARIABLE_ASSIGNMENTS_RULE_NAME]: VariableAssignmentsNode,
161
+ [REFERENCE_LIST_LITERAL_RULE_NAME]: ReferenceListLiteralNode
150
162
  };
151
163
 
152
164
  export default NonTerminalNodeMap;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ export const TYPE_PARAMETER_NAME = "type";
3
4
  export const CONTENT_PARAMETER_NAME = "content";
4
5
  export const TERMINAL_PARAMETER_NAME = "terminal";
5
6
  export const CHILD_NODES_PARAMETER_NAME = "childNodes";
package/src/preamble.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ import All from "./element/all";
3
4
  import Some from "./element/some";
4
5
  import Term from "./element/term";
5
6
  import Type from "./element/type";
@@ -10,6 +11,7 @@ import Every from "./element/every";
10
11
  import Value from "./element/value";
11
12
  import Values from "./element/values";
12
13
  import Reduce from "./element/reduce";
14
+ import Exists from "./element/exists";
13
15
  import Ternary from "./element/ternary";
14
16
  import Binding from "./element/binding";
15
17
  import Bindings from "./element/bindings";
@@ -29,20 +31,22 @@ import TryInteger from "./element/tryInteger";
29
31
  import Parameters from "./element/parameters";
30
32
  import NodesQuery from "./element/nodesQuery";
31
33
  import Expression from "./element/expression";
34
+ import References from "./element/references";
32
35
  import ReturnBlock from "./element/returnBlock";
33
36
  import NegatedTerm from "./element/term/negated";
34
37
  import LogicalTerm from "./element/term/logical";
35
38
  import NamedBinding from "./element/binding/named";
36
39
  import ProcedureCall from "./element/procedureCall";
40
+ import ImportBinding from "./element/importBinding";
37
41
  import NamedBindings from "./element/bindings/named";
38
42
  import BracketedTerm from "./element/term/bracketed";
39
- import ImportBinding from "./element/importBinding";
43
+ import ImportBindings from "./element/importBindings";
40
44
  import listAssignment from "./element/assignment/list";
41
45
  import ComparisonTerm from "./element/term/comparison";
42
- import ImportBindings from "./element/importBindings";
43
46
  import ImportStatement from "./element/importStatement";
44
47
  import ReturnStatement from "./element/returnStatement";
45
48
  import ObjectAssignment from "./element/assignment/object";
46
49
  import AnonymousProcedure from "./element/anonymousProcedure";
47
50
  import VariableAssignment from "./element/assignment/variable";
48
51
  import VariableAssignments from "./element/assignments/variable";
52
+ import ReferenceListLiteral from "./element/referenceListLiteral";
@@ -3,7 +3,12 @@
3
3
  import { bnfUtilities } from "occam-languages";
4
4
 
5
5
  import { PERIOD, PERIOD_STRING_LITERAL } from "../constants";
6
- import { TYPE_RULE_NAME, LABEL_RULE_NAME, REFERENCE_RULE_NAME, PARAMETERS_RULE_NAME, IMPORT_BINDING_RULE_NAME, IMPORT_STATEMENT_RULE_NAME } from "../ruleNames";
6
+ import { TYPE_RULE_NAME,
7
+ LABEL_RULE_NAME,
8
+ REFERENCE_RULE_NAME,
9
+ PARAMETERS_RULE_NAME,
10
+ IMPORT_BINDING_RULE_NAME,
11
+ IMPORT_STATEMENT_RULE_NAME } from "../ruleNames";
7
12
 
8
13
  const { instantiate, ruleFromRuleName } = bnfUtilities;
9
14
 
package/src/ruleNames.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ export const ALL_RULE_NAME = "all";
3
4
  export const SOME_RULE_NAME = "some";
4
5
  export const TERM_RULE_NAME = "term";
5
6
  export const TYPE_RULE_NAME = "type";
@@ -8,6 +9,7 @@ export const EVERY_RULE_NAME = "every";
8
9
  export const LABEL_RULE_NAME = "label";
9
10
  export const ERROR_RULE_NAME = "error";
10
11
  export const VALUE_RULE_NAME = "value";
12
+ export const EXISTS_RULE_NAME = "exists";
11
13
  export const VALUES_RULE_NAME = "values";
12
14
  export const REDUCE_RULE_NAME = "reduce";
13
15
  export const TERNARY_RULE_NAME = "ternary";
@@ -24,6 +26,7 @@ export const PRIMITIVE_RULE_NAME = "primitive";
24
26
  export const REFERENCE_RULE_NAME = "reference";
25
27
  export const PARAMETER_RULE_NAME = "parameter";
26
28
  export const ENDS_WITH_RULE_NAME = "endsWith";
29
+ export const REFERENCES_RULE_NAME = "references";
27
30
  export const NODE_QUERY_RULE_NAME = "nodeQuery";
28
31
  export const EXPRESSION_RULE_NAME = "expression";
29
32
  export const PARAMETERS_RULE_NAME = "parameters";
@@ -48,3 +51,4 @@ export const OBJECT_ASSIGNMENT_RULE_NAME = "objectAssignment";
48
51
  export const VARIABLE_ASSIGNMENT_RULE_NAME = "variableAssignment";
49
52
  export const ANONYMOUS_PROCEDURE_RULE_NAME = "anonymousProcedure";
50
53
  export const VARIABLE_ASSIGNMENTS_RULE_NAME = "variableAssignments";
54
+ export const REFERENCE_LIST_LITERAL_RULE_NAME = "referencesListLiteral";