occam-furtle 3.0.378 → 3.0.381
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/element/contains.js +54 -0
- package/lib/element/endsWith.js +52 -0
- package/lib/element/expression.js +26 -2
- package/lib/element/startsWith.js +52 -0
- package/lib/node/contains.js +39 -0
- package/lib/node/endsWith.js +39 -0
- package/lib/node/expression.js +13 -1
- package/lib/node/startsWith.js +39 -0
- package/lib/nonTerminalNodeMap.js +7 -1
- package/lib/preamble.js +4 -1
- package/lib/ruleNames.js +13 -1
- package/lib/utilities/element.js +108 -3
- package/package.json +5 -5
- package/src/element/contains.js +63 -0
- package/src/element/endsWith.js +60 -0
- package/src/element/expression.js +28 -1
- package/src/element/startsWith.js +60 -0
- package/src/node/contains.js +41 -0
- package/src/node/endsWith.js +41 -0
- package/src/node/expression.js +25 -1
- package/src/node/startsWith.js +41 -0
- package/src/nonTerminalNodeMap.js +9 -0
- package/src/preamble.js +3 -0
- package/src/ruleNames.js +3 -1
- package/src/utilities/element.js +130 -1
package/src/utilities/element.js
CHANGED
|
@@ -207,6 +207,36 @@ export function ternaryFromTernaryNode(ternaryNode, context) {
|
|
|
207
207
|
return ternary;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
export function containsFromContainsNode(containsNode, context) {
|
|
211
|
+
const { Contains } = elements,
|
|
212
|
+
node = containsNode, ///
|
|
213
|
+
string = context.nodeAsString(node),
|
|
214
|
+
breakPoint = null,
|
|
215
|
+
variable = variableFromContainsNode(containsNode, context),
|
|
216
|
+
substring = substringFromContainsNode(containsNode, context);
|
|
217
|
+
|
|
218
|
+
context = null;
|
|
219
|
+
|
|
220
|
+
const contains = new Contains(context, string, node, breakPoint, variable, substring);
|
|
221
|
+
|
|
222
|
+
return contains;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export function endsWithFromEndsWithNode(endsWithNode, context) {
|
|
226
|
+
const { EndsWith } = elements,
|
|
227
|
+
node = endsWithNode, ///
|
|
228
|
+
string = context.nodeAsString(node),
|
|
229
|
+
breakPoint = null,
|
|
230
|
+
variable = variableFromEndsWithNode(endsWithNode, context),
|
|
231
|
+
substring = substringFromEndsWithNode(endsWithNode, context);
|
|
232
|
+
|
|
233
|
+
context = null;
|
|
234
|
+
|
|
235
|
+
const endsWith = new EndsWith(context, string, node, breakPoint, variable, substring);
|
|
236
|
+
|
|
237
|
+
return endsWith;
|
|
238
|
+
}
|
|
239
|
+
|
|
210
240
|
export function variableFromVariableNode(variableNode, context) {
|
|
211
241
|
const { Variable } = elements,
|
|
212
242
|
node = variableNode, ///
|
|
@@ -356,6 +386,21 @@ export function toIntegerFromToIntegerNode(toIntegerNode, context) {
|
|
|
356
386
|
return toInteger;
|
|
357
387
|
}
|
|
358
388
|
|
|
389
|
+
export function startsWithFromStartsWithNode(startsWithNode, context) {
|
|
390
|
+
const { StartsWith } = elements,
|
|
391
|
+
node = startsWithNode, ///
|
|
392
|
+
string = context.nodeAsString(node),
|
|
393
|
+
breakPoint = null,
|
|
394
|
+
variable = variableFromStartsWithNode(startsWithNode, context),
|
|
395
|
+
substring = substringFromStartsWithNode(startsWithNode, context);
|
|
396
|
+
|
|
397
|
+
context = null;
|
|
398
|
+
|
|
399
|
+
const startsWith = new StartsWith(context, string, node, breakPoint, variable, substring);
|
|
400
|
+
|
|
401
|
+
return startsWith;
|
|
402
|
+
}
|
|
403
|
+
|
|
359
404
|
export function nodesQueryFromNodesQueryNode(nodesQueryNode, context) {
|
|
360
405
|
const { NodesQuery } = elements,
|
|
361
406
|
node = nodesQueryNode, ///
|
|
@@ -399,6 +444,9 @@ export function expressionFromExpressionNode(expressionNode, context) {
|
|
|
399
444
|
lengthOf = lengthOfFromExpressionNode(expressionNode, context),
|
|
400
445
|
toInteger = toIntegerFromExpressionNode(expressionNode, context),
|
|
401
446
|
tryInteger = tryIntegerFromExpressionNode(expressionNode, context),
|
|
447
|
+
contains = containsFromExpressionNode(expressionNode, context),
|
|
448
|
+
endsWith = endsWithFromExpressionNode(expressionNode, context),
|
|
449
|
+
startsWith = startsWithFromExpressionNode(expressionNode, context),
|
|
402
450
|
returnBlock = returnBlockFromExpressionNode(expressionNode, context),
|
|
403
451
|
procedureCall = procedureCallFromExpressionNode(expressionNode, context),
|
|
404
452
|
properties = [
|
|
@@ -412,6 +460,9 @@ export function expressionFromExpressionNode(expressionNode, context) {
|
|
|
412
460
|
lengthOf,
|
|
413
461
|
toInteger,
|
|
414
462
|
tryInteger,
|
|
463
|
+
contains,
|
|
464
|
+
endsWith,
|
|
465
|
+
startsWith,
|
|
415
466
|
returnBlock,
|
|
416
467
|
procedureCall
|
|
417
468
|
],
|
|
@@ -421,7 +472,7 @@ export function expressionFromExpressionNode(expressionNode, context) {
|
|
|
421
472
|
|
|
422
473
|
context = null;
|
|
423
474
|
|
|
424
|
-
const expression = new Expression(context, string, node, breakPoint, term, some, every, reduce, ternary, nodeQuery, nodesQuery, lengthOf, toInteger, tryInteger, returnBlock, procedureCall);
|
|
475
|
+
const expression = new Expression(context, string, node, breakPoint, term, some, every, reduce, ternary, nodeQuery, nodesQuery, lengthOf, toInteger, tryInteger, contains, endsWith, startsWith, returnBlock, procedureCall);
|
|
425
476
|
|
|
426
477
|
return expression;
|
|
427
478
|
}
|
|
@@ -942,6 +993,20 @@ export function argumentTypeFromTypeNode(typeNode, context) {
|
|
|
942
993
|
|
|
943
994
|
export function variableFromLengthOfNode(lengthOfNode, context) {
|
|
944
995
|
const variableNode = lengthOfNode.getVariableNode(),
|
|
996
|
+
variable = variableFromVariableNode(variableNode, context);
|
|
997
|
+
|
|
998
|
+
return variable;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
export function variableFromContainsNode(containsNode, context) {
|
|
1002
|
+
const variableNode = containsNode.getVariableNode(),
|
|
1003
|
+
variable = variableFromVariableNode(variableNode, context);
|
|
1004
|
+
|
|
1005
|
+
return variable;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
export function variableFromEndsWithNode(endsWithNode, context) {
|
|
1009
|
+
const variableNode = endsWithNode.getVariableNode(),
|
|
945
1010
|
variable = variableFromVariableNode(variableNode, context);
|
|
946
1011
|
|
|
947
1012
|
return variable;
|
|
@@ -972,6 +1037,20 @@ export function nameFromNamedBindingNode(namedBindingNode, context) {
|
|
|
972
1037
|
return name;
|
|
973
1038
|
}
|
|
974
1039
|
|
|
1040
|
+
export function substringFromContainsNode(containsNode, context) {
|
|
1041
|
+
const string = containsNode.getString(),
|
|
1042
|
+
substring = string; ///
|
|
1043
|
+
|
|
1044
|
+
return substring;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
export function substringFromEndsWithNode(endsWithNode, context) {
|
|
1048
|
+
const string = endsWithNode.getString(),
|
|
1049
|
+
substring = string; ///
|
|
1050
|
+
|
|
1051
|
+
return substring;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
975
1054
|
export function aliasFromNamedBindingNode(namedBindingNode, context) {
|
|
976
1055
|
const alias = namedBindingNode.getAlias();
|
|
977
1056
|
|
|
@@ -1055,6 +1134,13 @@ export function variableFromTryIntegerNode(tryIntegerNode, context) {
|
|
|
1055
1134
|
return variable;
|
|
1056
1135
|
}
|
|
1057
1136
|
|
|
1137
|
+
export function variableFromStartsWithNode(startsWithNode, context) {
|
|
1138
|
+
const variableNode = startsWithNode.getVariableNode(),
|
|
1139
|
+
variable = variableFromVariableNode(variableNode, context);
|
|
1140
|
+
|
|
1141
|
+
return variable;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1058
1144
|
export function variableFromNodesQueryNode(nodesQueryNode, context) {
|
|
1059
1145
|
const variableNode = nodesQueryNode.getVariableNode(),
|
|
1060
1146
|
variable = variableFromVariableNode(variableNode, context);
|
|
@@ -1074,6 +1160,30 @@ export function lengthOfFromExpressionNode(expressionNode, context) {
|
|
|
1074
1160
|
return lengthOf;
|
|
1075
1161
|
}
|
|
1076
1162
|
|
|
1163
|
+
export function containsFromExpressionNode(expressionNode, context) {
|
|
1164
|
+
let contains = null;
|
|
1165
|
+
|
|
1166
|
+
const containsNode = expressionNode.getContainsNode();
|
|
1167
|
+
|
|
1168
|
+
if (containsNode !== null) {
|
|
1169
|
+
contains = containsFromContainsNode(containsNode, context);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
return contains;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
export function endsWithFromExpressionNode(expressionNode, context) {
|
|
1176
|
+
let endsWith = null;
|
|
1177
|
+
|
|
1178
|
+
const endsWithNode = expressionNode.getEndsWithNode();
|
|
1179
|
+
|
|
1180
|
+
if (endsWithNode !== null) {
|
|
1181
|
+
endsWith = endsWithFromEndsWithNode(endsWithNode, context);
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
return endsWith;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1077
1187
|
export function ifExpressionFromTernaryNode(ternaryNode, context) {
|
|
1078
1188
|
const ifExpressionNode = ternaryNode.getIfExpressionNode(),
|
|
1079
1189
|
ifExpression = expressionFromExpressionNode(ifExpressionNode, context);
|
|
@@ -1112,6 +1222,13 @@ export function nodeQueryFromExpressionNode(expressionNode, context) {
|
|
|
1112
1222
|
return nodeQuery;
|
|
1113
1223
|
}
|
|
1114
1224
|
|
|
1225
|
+
export function substringFromStartsWithNode(startsWithNode, context) {
|
|
1226
|
+
const string = startsWithNode.getString(),
|
|
1227
|
+
substring = string; ///
|
|
1228
|
+
|
|
1229
|
+
return substring;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1115
1232
|
export function leftTermFromLogicalTermNode(logicalTermNode, context) {
|
|
1116
1233
|
const leftTermNode = logicalTermNode.getLeftTermNode(),
|
|
1117
1234
|
leftTerm = termFromTermNode(leftTermNode, context);
|
|
@@ -1170,6 +1287,18 @@ export function tryIntegerFromExpressionNode(expressionNode, context) {
|
|
|
1170
1287
|
return tryInteger;
|
|
1171
1288
|
}
|
|
1172
1289
|
|
|
1290
|
+
export function startsWithFromExpressionNode(expressionNode, context) {
|
|
1291
|
+
let startsWith = null;
|
|
1292
|
+
|
|
1293
|
+
const startsWithNode = expressionNode.getStartsWithNode();
|
|
1294
|
+
|
|
1295
|
+
if (startsWithNode !== null) {
|
|
1296
|
+
startsWith = startsWithFromStartsWithNode(startsWithNode, context);
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
return startsWith;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1173
1302
|
export function rightTermFromLogicalTermNode(logicalTermNode, context) {
|
|
1174
1303
|
const rightTermNode = logicalTermNode.getRightTermNode(),
|
|
1175
1304
|
rightTerm = termFromTermNode(rightTermNode, context);
|