occam-verify-cli 0.0.518 → 0.0.519
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/assertion/equality.js +69 -0
- package/lib/context/release/combinator.js +64 -0
- package/lib/ocmbinator/bracketed.js +3 -3
- package/lib/{type/object.js → ocmbinator/equality.js} +19 -12
- package/lib/type.js +99 -5
- package/lib/typeNames.js +13 -0
- package/lib/verify/assertion/type.js +6 -4
- package/lib/verify/statement.js +86 -34
- package/lib/verify/term.js +4 -2
- package/lib/verify/variable.js +3 -2
- package/package.json +1 -1
- package/src/assertion/equality.js +33 -0
- package/src/context/release/{bracketedCombinator.js → combinator.js} +5 -5
- package/src/ocmbinator/bracketed.js +2 -2
- package/src/ocmbinator/equality.js +21 -0
- package/src/type.js +14 -1
- package/src/typeNames.js +1 -1
- package/src/verify/assertion/type.js +9 -5
- package/src/verify/statement.js +78 -37
- package/src/verify/term.js +5 -1
- package/src/verify/variable.js +2 -1
- package/lib/context/release/bracketedCombinator.js +0 -64
- package/src/type/object.js +0 -9
|
@@ -70,12 +70,13 @@ function verifyVariableTypeAssertion(typeAssertionNode, assertions, proofContext
|
|
|
70
70
|
variable = firstVariable, ///
|
|
71
71
|
variableName = variable.getName(),
|
|
72
72
|
variableType = variable.getType(),
|
|
73
|
-
assertedTypeEqualToOrSubTypeOfVariableType = (variableType
|
|
74
|
-
true : ///
|
|
75
|
-
assertedType.isEqualToOrSubTypeOf(variableType);
|
|
73
|
+
assertedTypeEqualToOrSubTypeOfVariableType = assertedType.isEqualToOrSubTypeOf(variableType);
|
|
76
74
|
|
|
77
75
|
if (!assertedTypeEqualToOrSubTypeOfVariableType) {
|
|
78
|
-
|
|
76
|
+
const assertedTypeName = assertedType.getName(),
|
|
77
|
+
variableTypeName = variableType.getName();
|
|
78
|
+
|
|
79
|
+
proofContext.error(`The '${assertedTypeName}' asserted type is not equal to or a sub-type of the '${variableName}' variable's '${variableTypeName}' type.`);
|
|
79
80
|
} else {
|
|
80
81
|
const type = assertedType, ///
|
|
81
82
|
typeAssertion = TypeAssertion.fromTypeAndVariableName(type, variableName),
|
|
@@ -115,7 +116,10 @@ function verifyTermTypeAssertion(typeAssertionNode, assertions, proofContext) {
|
|
|
115
116
|
assertedType.isEqualTo(termType);
|
|
116
117
|
|
|
117
118
|
if (!assertedTypeEqualToTermType) {
|
|
118
|
-
|
|
119
|
+
const termTypeName = termType.getName(),
|
|
120
|
+
assertedTypeName = assertedType.getName();
|
|
121
|
+
|
|
122
|
+
proofContext.error(`The '${assertedTypeName}' asserted type is not equal to the '${termString}' term's '${termTypeName}' type.`);
|
|
119
123
|
} else {
|
|
120
124
|
const type = assertedType, ///
|
|
121
125
|
typeAssertion = TypeAssertion.fromTypeAndTermNode(type, termNode),
|
package/src/verify/statement.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import verifyTerm from "../verify/term";
|
|
4
|
+
import EqualityAssertion from "../assertion/equality";
|
|
5
|
+
import equalityCombinator from "../ocmbinator/equality";
|
|
6
|
+
import bracketedCombinator from "../ocmbinator/bracketed";
|
|
4
7
|
import verifyTypeAssertion from "../verify/assertion/type";
|
|
5
8
|
|
|
6
9
|
import { first } from "../utilities/array";
|
|
10
|
+
import { objectType } from "../type";
|
|
7
11
|
import { nodeAsString } from "../utilities/string";
|
|
12
|
+
import { OBJECT_TYPE_NAME } from "../typeNames";
|
|
8
13
|
import { STATEMENT_META_TYPE } from "../metaTypes";
|
|
9
14
|
import { nodeQuery, typeNameFromTypeNode } from "../utilities/query";
|
|
10
15
|
import { ARGUMENT_RULE_NAME, META_ARGUMENT_RULE_NAME } from "../ruleNames";
|
|
11
|
-
import bracketedCombinator from "../ocmbinator/bracketed";
|
|
12
16
|
|
|
13
17
|
const termNodeQuery = nodeQuery("/argument/term!"),
|
|
14
18
|
typeNodeQuery = nodeQuery("/argument/type!"),
|
|
@@ -21,15 +25,20 @@ export default function verifyStatement(statementNode, assertions, proofContext)
|
|
|
21
25
|
|
|
22
26
|
proofContext.begin(statementNode);
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
if (!statementVerified) {
|
|
29
|
+
const statementVerifiedAsEquality = verifyStatementAsEquality(statementNode, assertions, proofContext);
|
|
25
30
|
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
statementVerified = statementVerifiedAsEquality; //
|
|
32
|
+
}
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
if (!statementVerified) {
|
|
35
|
+
const statementVerifiedAsTypeAssertion = verifyStatementAsTypeAssertion(statementNode, assertions, proofContext);
|
|
36
|
+
|
|
37
|
+
statementVerified = statementVerifiedAsTypeAssertion; ///
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!statementVerified) {
|
|
41
|
+
const statementVerifiedAgainstCombinators = verifyStatementAgainstCombinators(statementNode, proofContext);
|
|
33
42
|
|
|
34
43
|
statementVerified = statementVerifiedAgainstCombinators; ///
|
|
35
44
|
}
|
|
@@ -41,17 +50,50 @@ export default function verifyStatement(statementNode, assertions, proofContext)
|
|
|
41
50
|
return statementVerified;
|
|
42
51
|
}
|
|
43
52
|
|
|
44
|
-
function
|
|
45
|
-
let
|
|
53
|
+
function verifyStatementAsEquality(statementNode, assertions, proofContext) {
|
|
54
|
+
let statementVerifiedAsEquality = false;
|
|
55
|
+
|
|
56
|
+
const combinator = equalityCombinator, ///
|
|
57
|
+
statementVerifiedAgainstCombinator = verifyStatementAgainstCombinator(statementNode, combinator, proofContext);
|
|
58
|
+
|
|
59
|
+
if (statementVerifiedAgainstCombinator) {
|
|
60
|
+
const equalityAssertion = EqualityAssertion.fromStatementNode(statementNode),
|
|
61
|
+
assertion = equalityAssertion; ///
|
|
62
|
+
|
|
63
|
+
assertions.push(assertion);
|
|
64
|
+
|
|
65
|
+
statementVerifiedAsEquality = true;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return statementVerifiedAsEquality;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function verifyStatementAsTypeAssertion(statementNode, assertions, proofContext) {
|
|
72
|
+
let statementVerifiedAsTypeAssertion = false;
|
|
46
73
|
|
|
47
|
-
|
|
74
|
+
const typeAssertionNode = typeAssertionNodeQuery(statementNode);
|
|
48
75
|
|
|
49
|
-
|
|
76
|
+
if (typeAssertionNode !== null) {
|
|
77
|
+
const typeAssertionVerified = verifyTypeAssertion(typeAssertionNode, assertions, proofContext);
|
|
50
78
|
|
|
51
|
-
|
|
79
|
+
statementVerifiedAsTypeAssertion = typeAssertionVerified; ///
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return statementVerifiedAsTypeAssertion;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function verifyStatementAgainstCombinators(statementNode, proofContext) {
|
|
86
|
+
let statementVerifiedAgainstCombinators = false;
|
|
87
|
+
|
|
88
|
+
let combinators = proofContext.getCombinators();
|
|
89
|
+
|
|
90
|
+
combinators = [ ///
|
|
91
|
+
bracketedCombinator,
|
|
92
|
+
...combinators
|
|
93
|
+
];
|
|
52
94
|
|
|
53
95
|
const combinator = combinators.find((combinator) => {
|
|
54
|
-
const statementVerifiedAgainstCombinator = verifyStatementAgainstCombinator(statementNode, combinator,
|
|
96
|
+
const statementVerifiedAgainstCombinator = verifyStatementAgainstCombinator(statementNode, combinator, proofContext);
|
|
55
97
|
|
|
56
98
|
if (statementVerifiedAgainstCombinator) {
|
|
57
99
|
return true;
|
|
@@ -62,24 +104,20 @@ function verifyStatementAgainstCombinators(statementNode, context) {
|
|
|
62
104
|
statementVerifiedAgainstCombinators = true;
|
|
63
105
|
}
|
|
64
106
|
|
|
65
|
-
statementVerifiedAgainstCombinators ?
|
|
66
|
-
context.complete(statementNode) :
|
|
67
|
-
context.halt(statementNode);
|
|
68
|
-
|
|
69
107
|
return statementVerifiedAgainstCombinators;
|
|
70
108
|
}
|
|
71
109
|
|
|
72
|
-
function verifyStatementAgainstCombinator(statementNode, combinator,
|
|
110
|
+
function verifyStatementAgainstCombinator(statementNode, combinator, proofContext) {
|
|
73
111
|
const combinatorStatementNode = combinator.getStatementNode(),
|
|
74
112
|
node = statementNode, ///
|
|
75
113
|
combinatorNode = combinatorStatementNode, ///
|
|
76
|
-
nodeVerified = verifyNode(node, combinatorNode,
|
|
114
|
+
nodeVerified = verifyNode(node, combinatorNode, proofContext),
|
|
77
115
|
statementVerifiedAgainstCombinator = nodeVerified; ///
|
|
78
116
|
|
|
79
117
|
return statementVerifiedAgainstCombinator;
|
|
80
118
|
}
|
|
81
119
|
|
|
82
|
-
function verifyNode(node, combinatorNode,
|
|
120
|
+
function verifyNode(node, combinatorNode, proofContext) {
|
|
83
121
|
let nodeVerified;
|
|
84
122
|
|
|
85
123
|
const nodeTerminalNode = node.isTerminalNode(),
|
|
@@ -89,13 +127,13 @@ function verifyNode(node, combinatorNode, context) {
|
|
|
89
127
|
if (nodeTerminalNode) {
|
|
90
128
|
const terminalNode = node, ///
|
|
91
129
|
combinatorTerminalNode = combinatorNode, ///
|
|
92
|
-
terminalNodeVerified = verifyTerminalNode(terminalNode, combinatorTerminalNode,
|
|
130
|
+
terminalNodeVerified = verifyTerminalNode(terminalNode, combinatorTerminalNode, proofContext);
|
|
93
131
|
|
|
94
132
|
nodeVerified = terminalNodeVerified; ///
|
|
95
133
|
} else {
|
|
96
134
|
const nonTerminalNode = node, ///
|
|
97
135
|
combinatorNonTerminalNode = combinatorNode, ///
|
|
98
|
-
nonTerminalNodeVerified = verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode,
|
|
136
|
+
nonTerminalNodeVerified = verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode, proofContext);
|
|
99
137
|
|
|
100
138
|
nodeVerified = nonTerminalNodeVerified; ///
|
|
101
139
|
}
|
|
@@ -104,7 +142,7 @@ function verifyNode(node, combinatorNode, context) {
|
|
|
104
142
|
return nodeVerified;
|
|
105
143
|
}
|
|
106
144
|
|
|
107
|
-
function verifyNodes(nodes, combinatorNodes,
|
|
145
|
+
function verifyNodes(nodes, combinatorNodes, proofContext) {
|
|
108
146
|
let nodesVerified = false;
|
|
109
147
|
|
|
110
148
|
const nodesLength = nodes.length,
|
|
@@ -113,7 +151,7 @@ function verifyNodes(nodes, combinatorNodes, context) {
|
|
|
113
151
|
if (nodesLength === combinatorNodesLength) {
|
|
114
152
|
nodesVerified = nodes.every((node, index) => {
|
|
115
153
|
const combinatorNode = combinatorNodes[index],
|
|
116
|
-
nodeVerified = verifyNode(node, combinatorNode,
|
|
154
|
+
nodeVerified = verifyNode(node, combinatorNode, proofContext);
|
|
117
155
|
|
|
118
156
|
if (nodeVerified) {
|
|
119
157
|
return true;
|
|
@@ -124,7 +162,7 @@ function verifyNodes(nodes, combinatorNodes, context) {
|
|
|
124
162
|
return nodesVerified;
|
|
125
163
|
}
|
|
126
164
|
|
|
127
|
-
function verifyTerminalNode(terminalNode, combinatorTerminalNode,
|
|
165
|
+
function verifyTerminalNode(terminalNode, combinatorTerminalNode, proofContext) {
|
|
128
166
|
let terminalNodeVerified = false;
|
|
129
167
|
|
|
130
168
|
const matches = terminalNode.match(combinatorTerminalNode);
|
|
@@ -136,7 +174,7 @@ function verifyTerminalNode(terminalNode, combinatorTerminalNode, context) {
|
|
|
136
174
|
return terminalNodeVerified;
|
|
137
175
|
}
|
|
138
176
|
|
|
139
|
-
function verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode,
|
|
177
|
+
function verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode, proofContext) {
|
|
140
178
|
let nonTerminalNodeVerified = false;
|
|
141
179
|
|
|
142
180
|
const ruleName = nonTerminalNode.getRuleName(), ///
|
|
@@ -147,7 +185,7 @@ function verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode, conte
|
|
|
147
185
|
case ARGUMENT_RULE_NAME: {
|
|
148
186
|
const argumentNode = nonTerminalNode, ///
|
|
149
187
|
combinatorArgumentNode = combinatorNonTerminalNode, ///
|
|
150
|
-
argumentNodeVerified = verifyArgumentNode(argumentNode, combinatorArgumentNode,
|
|
188
|
+
argumentNodeVerified = verifyArgumentNode(argumentNode, combinatorArgumentNode, proofContext);
|
|
151
189
|
|
|
152
190
|
nonTerminalNodeVerified = argumentNodeVerified; ///
|
|
153
191
|
|
|
@@ -157,7 +195,7 @@ function verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode, conte
|
|
|
157
195
|
case META_ARGUMENT_RULE_NAME: {
|
|
158
196
|
const metaArgumentNode = nonTerminalNode, ///
|
|
159
197
|
combinatorMetaargumentNode = combinatorNonTerminalNode, ///
|
|
160
|
-
metaArgumentNodeVerified = verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode,
|
|
198
|
+
metaArgumentNodeVerified = verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode, proofContext);
|
|
161
199
|
|
|
162
200
|
nonTerminalNodeVerified = metaArgumentNodeVerified; ///
|
|
163
201
|
|
|
@@ -169,7 +207,7 @@ function verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode, conte
|
|
|
169
207
|
combinatorChildNodes = combinatorNonTerminalNode.getChildNodes(),
|
|
170
208
|
nodes = childNodes, ///
|
|
171
209
|
combinatorNodes = combinatorChildNodes, ///
|
|
172
|
-
nodesVerified = verifyNodes(nodes, combinatorNodes,
|
|
210
|
+
nodesVerified = verifyNodes(nodes, combinatorNodes, proofContext);
|
|
173
211
|
|
|
174
212
|
nonTerminalNodeVerified = nodesVerified; ///
|
|
175
213
|
|
|
@@ -181,7 +219,7 @@ function verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode, conte
|
|
|
181
219
|
return nonTerminalNodeVerified;
|
|
182
220
|
}
|
|
183
221
|
|
|
184
|
-
function verifyArgumentNode(argumentNode, combinatorArgumentNode,
|
|
222
|
+
function verifyArgumentNode(argumentNode, combinatorArgumentNode, proofContext) {
|
|
185
223
|
let argumentNodeVerified = false;
|
|
186
224
|
|
|
187
225
|
const termNode = termNodeQuery(argumentNode);
|
|
@@ -189,9 +227,10 @@ function verifyArgumentNode(argumentNode, combinatorArgumentNode, context) {
|
|
|
189
227
|
if (termNode === null) {
|
|
190
228
|
const argumentString = nodeAsString(argumentNode);
|
|
191
229
|
|
|
192
|
-
|
|
230
|
+
proofContext.error(`The ${argumentString} argument should be a term, not a type`);
|
|
193
231
|
} else {
|
|
194
232
|
const types = [],
|
|
233
|
+
context = proofContext, ///
|
|
195
234
|
termVerified = verifyTerm(termNode, types, context);
|
|
196
235
|
|
|
197
236
|
if (termVerified) {
|
|
@@ -199,7 +238,9 @@ function verifyArgumentNode(argumentNode, combinatorArgumentNode, context) {
|
|
|
199
238
|
termType = firstType, ///
|
|
200
239
|
typeNode = typeNodeQuery(combinatorArgumentNode),
|
|
201
240
|
typeName = typeNameFromTypeNode(typeNode),
|
|
202
|
-
type =
|
|
241
|
+
type = (typeName === OBJECT_TYPE_NAME) ?
|
|
242
|
+
objectType : ///
|
|
243
|
+
proofContext.findTypeByTypeName(typeName),
|
|
203
244
|
statementTypeEqualToOrSubTypeOfType = termType.isEqualToOrSubTypeOf(type);
|
|
204
245
|
|
|
205
246
|
if (statementTypeEqualToOrSubTypeOfType) {
|
|
@@ -211,7 +252,7 @@ function verifyArgumentNode(argumentNode, combinatorArgumentNode, context) {
|
|
|
211
252
|
return argumentNodeVerified;
|
|
212
253
|
}
|
|
213
254
|
|
|
214
|
-
function verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode,
|
|
255
|
+
function verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode, proofContext) {
|
|
215
256
|
let metaArgumentNodeVerified = false;
|
|
216
257
|
|
|
217
258
|
const statementNode = statementNodeQuery(metaArgumentNode);
|
|
@@ -219,10 +260,10 @@ function verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode, co
|
|
|
219
260
|
if (statementNode === null) {
|
|
220
261
|
const metaArgumentString = nodeAsString(metaArgumentNode);
|
|
221
262
|
|
|
222
|
-
|
|
263
|
+
proofContext.error(`The '${metaArgumentString}' meta-argument should be a statement, not a meta-type.`);
|
|
223
264
|
} else {
|
|
224
265
|
const assertions = null,
|
|
225
|
-
statementVerified = verifyStatement(statementNode, assertions,
|
|
266
|
+
statementVerified = verifyStatement(statementNode, assertions, proofContext);
|
|
226
267
|
|
|
227
268
|
if (statementVerified) {
|
|
228
269
|
const combinatorMetaTYpeNode = metaTypeNodeQuery(combinatorMetaargumentNode);
|
|
@@ -238,7 +279,7 @@ function verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode, co
|
|
|
238
279
|
if (!metaArgumentNodeVerified) {
|
|
239
280
|
const combinatorMetaargumentString = nodeAsString(combinatorMetaargumentNode);
|
|
240
281
|
|
|
241
|
-
|
|
282
|
+
proofContext.error(`The '${combinatorMetaargumentString}' combinator meta-argument should be the 'Statement' meta-type.`);
|
|
242
283
|
}
|
|
243
284
|
}
|
|
244
285
|
}
|
package/src/verify/term.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { first } from "../utilities/array";
|
|
4
|
+
import { objectType } from "../type";
|
|
4
5
|
import { nodeAsString } from "../utilities/string";
|
|
6
|
+
import { OBJECT_TYPE_NAME } from "../typeNames";
|
|
5
7
|
import { ARGUMENT_RULE_NAME } from "../ruleNames";
|
|
6
8
|
import { nodeQuery, typeNameFromTypeNode, variableNameFromVariableNode } from "../utilities/query";
|
|
7
9
|
|
|
@@ -224,7 +226,9 @@ function verifyArgumentNode(argumentNode, constructorArgumentNode, context) {
|
|
|
224
226
|
termType = firstType, ///
|
|
225
227
|
typeNode = typeNodeQuery(constructorArgumentNode),
|
|
226
228
|
typeName = typeNameFromTypeNode(typeNode),
|
|
227
|
-
type =
|
|
229
|
+
type = (typeName === OBJECT_TYPE_NAME) ?
|
|
230
|
+
objectType : ///
|
|
231
|
+
context.findTypeByTypeName(typeName),
|
|
228
232
|
termTypeEqualToOrSubTypeOfType = termType.isEqualToOrSubTypeOf(type);
|
|
229
233
|
|
|
230
234
|
if (termTypeEqualToOrSubTypeOfType) {
|
package/src/verify/variable.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import Variable from "../variable";
|
|
4
4
|
|
|
5
|
+
import { objectType } from "../type";
|
|
5
6
|
import { nodeAsString } from "../utilities/string";
|
|
6
7
|
import { typeNameFromTypeNode, variableNameFromVariableNode } from "../utilities/query";
|
|
7
8
|
|
|
@@ -25,7 +26,7 @@ export default function verifyVariable(variableNode, typeNode, fileContext) {
|
|
|
25
26
|
const typeName = typeNameFromTypeNode(typeNode);
|
|
26
27
|
|
|
27
28
|
if (typeName === null) {
|
|
28
|
-
const type =
|
|
29
|
+
const type = objectType,
|
|
29
30
|
name = variableName; ///
|
|
30
31
|
|
|
31
32
|
variable = Variable.fromTypeAndName(type, name);
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _occamGrammarUtilities = require("occam-grammar-utilities");
|
|
12
|
-
var _occamCustomGrammars = require("occam-custom-grammars");
|
|
13
|
-
var _customGrammar = require("../../utilities/customGrammar");
|
|
14
|
-
function _classCallCheck(instance, Constructor) {
|
|
15
|
-
if (!(instance instanceof Constructor)) {
|
|
16
|
-
throw new TypeError("Cannot call a class as a function");
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function _defineProperties(target, props) {
|
|
20
|
-
for(var i = 0; i < props.length; i++){
|
|
21
|
-
var descriptor = props[i];
|
|
22
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
23
|
-
descriptor.configurable = true;
|
|
24
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
25
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
29
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
30
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
31
|
-
return Constructor;
|
|
32
|
-
}
|
|
33
|
-
var florenceLexerFromCombinedCustomGrammar = _occamCustomGrammars.lexersUtilities.florenceLexerFromCombinedCustomGrammar, florenceParserFromCombinedCustomGrammar = _occamCustomGrammars.parsersUtilities.florenceParserFromCombinedCustomGrammar;
|
|
34
|
-
var combinedCustomGrammar = (0, _customGrammar.combinedCustomGrammarFromNothing)(), florenceLexer = florenceLexerFromCombinedCustomGrammar(combinedCustomGrammar), florenceParser = florenceParserFromCombinedCustomGrammar(combinedCustomGrammar);
|
|
35
|
-
var BracketedCombinatorReleaseContext = /*#__PURE__*/ function() {
|
|
36
|
-
function BracketedCombinatorReleaseContext() {
|
|
37
|
-
_classCallCheck(this, BracketedCombinatorReleaseContext);
|
|
38
|
-
}
|
|
39
|
-
_createClass(BracketedCombinatorReleaseContext, [
|
|
40
|
-
{
|
|
41
|
-
key: "nodeFromContentAndRuleName",
|
|
42
|
-
value: function nodeFromContentAndRuleName(content, ruleName) {
|
|
43
|
-
var ruleMap = florenceParser.getRuleMap(), rule = ruleMap[ruleName], tokens = florenceLexer.tokenise(content), node = florenceParser.parse(tokens, rule);
|
|
44
|
-
if (node !== null) {
|
|
45
|
-
(0, _occamGrammarUtilities.rewriteNodes)(node);
|
|
46
|
-
}
|
|
47
|
-
return node;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
], [
|
|
51
|
-
{
|
|
52
|
-
key: "fromNothing",
|
|
53
|
-
value: function fromNothing() {
|
|
54
|
-
var bracketedCombinatorReleaseContext = new BracketedCombinatorReleaseContext();
|
|
55
|
-
return bracketedCombinatorReleaseContext;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
]);
|
|
59
|
-
return BracketedCombinatorReleaseContext;
|
|
60
|
-
}();
|
|
61
|
-
var bracketedCombinatorReleaseContext = BracketedCombinatorReleaseContext.fromNothing();
|
|
62
|
-
var _default = bracketedCombinatorReleaseContext;
|
|
63
|
-
|
|
64
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb250ZXh0L3JlbGVhc2UvYnJhY2tldGVkQ29tYmluYXRvci5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IHsgcmV3cml0ZU5vZGVzIH0gZnJvbSBcIm9jY2FtLWdyYW1tYXItdXRpbGl0aWVzXCI7XG5pbXBvcnQgeyBsZXhlcnNVdGlsaXRpZXMsIHBhcnNlcnNVdGlsaXRpZXMgfSBmcm9tIFwib2NjYW0tY3VzdG9tLWdyYW1tYXJzXCI7XG5cbmltcG9ydCB7IGNvbWJpbmVkQ3VzdG9tR3JhbW1hckZyb21Ob3RoaW5nIH0gZnJvbSBcIi4uLy4uL3V0aWxpdGllcy9jdXN0b21HcmFtbWFyXCI7XG5cbmNvbnN0IHsgZmxvcmVuY2VMZXhlckZyb21Db21iaW5lZEN1c3RvbUdyYW1tYXIgfSA9IGxleGVyc1V0aWxpdGllcyxcbiAgICAgIHsgZmxvcmVuY2VQYXJzZXJGcm9tQ29tYmluZWRDdXN0b21HcmFtbWFyIH0gPSBwYXJzZXJzVXRpbGl0aWVzO1xuXG5jb25zdCBjb21iaW5lZEN1c3RvbUdyYW1tYXIgPSBjb21iaW5lZEN1c3RvbUdyYW1tYXJGcm9tTm90aGluZygpLFxuICAgICAgZmxvcmVuY2VMZXhlciA9IGZsb3JlbmNlTGV4ZXJGcm9tQ29tYmluZWRDdXN0b21HcmFtbWFyKGNvbWJpbmVkQ3VzdG9tR3JhbW1hciksXG4gICAgICBmb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