@mojir/lits 2.0.14 → 2.0.15
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/dist/cli/cli.js +851 -783
- package/dist/cli/reference/api.d.ts +8 -8
- package/dist/cli/src/analyze/calculateOutcomes/calculateIfLetOutcomes.d.ts +1 -1
- package/dist/cli/src/analyze/calculateOutcomes/calculateIfNotOutcomes.d.ts +1 -1
- package/dist/cli/src/analyze/calculateOutcomes/calculateSwitchOutcomes.d.ts +3 -0
- package/dist/cli/src/analyze/calculateOutcomes/calculateWhenFirstOutcomes.d.ts +1 -1
- package/dist/cli/src/analyze/calculateOutcomes/calculateWhenLetOutcomes.d.ts +1 -1
- package/dist/cli/src/analyze/calculateOutcomes/calculateWhenNotOutcomes.d.ts +1 -1
- package/dist/cli/src/analyze/calculateOutcomes/specialExpressionCalculators.d.ts +14 -14
- package/dist/cli/src/builtin/index.d.ts +9 -9
- package/dist/cli/src/builtin/specialExpressions/and.d.ts +1 -1
- package/dist/cli/src/builtin/specialExpressions/{if-let.d.ts → if_let.d.ts} +1 -1
- package/dist/{src/builtin/specialExpressions/if-not.d.ts → cli/src/builtin/specialExpressions/if_not.d.ts} +1 -1
- package/dist/cli/src/builtin/specialExpressions/or.d.ts +1 -1
- package/dist/{src/builtin/specialExpressions/time.d.ts → cli/src/builtin/specialExpressions/switch.d.ts} +2 -2
- package/dist/cli/src/builtin/specialExpressions/{when-first.d.ts → when_first.d.ts} +1 -1
- package/dist/{src/builtin/specialExpressions/when-let.d.ts → cli/src/builtin/specialExpressions/when_let.d.ts} +1 -1
- package/dist/cli/src/builtin/specialExpressions/{when-not.d.ts → when_not.d.ts} +1 -1
- package/dist/cli/src/identifier.d.ts +2 -2
- package/dist/cli/src/parser/AlgebraicParser.d.ts +6 -1
- package/dist/cli/src/tokenizer/algebraic/algebraicReservedNames.d.ts +106 -7
- package/dist/cli/src/tokenizer/algebraic/algebraicTokenizers.d.ts +1 -1
- package/dist/cli/src/tokenizer/algebraic/algebraicTokens.d.ts +5 -4
- package/dist/cli/src/tokenizer/polish/polishTokenizers.d.ts +1 -1
- package/dist/cli/src/tokenizer/polish/polishTokens.d.ts +1 -1
- package/dist/cli/src/tokenizer/utils.d.ts +1 -1
- package/dist/cli/src/typeGuards/index.d.ts +1 -0
- package/dist/index.esm.js +851 -785
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +851 -785
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +851 -785
- package/dist/lits.iife.js.map +1 -1
- package/dist/reference/api.d.ts +8 -8
- package/dist/src/analyze/calculateOutcomes/calculateIfLetOutcomes.d.ts +1 -1
- package/dist/src/analyze/calculateOutcomes/calculateIfNotOutcomes.d.ts +1 -1
- package/dist/src/analyze/calculateOutcomes/calculateSwitchOutcomes.d.ts +3 -0
- package/dist/src/analyze/calculateOutcomes/calculateWhenFirstOutcomes.d.ts +1 -1
- package/dist/src/analyze/calculateOutcomes/calculateWhenLetOutcomes.d.ts +1 -1
- package/dist/src/analyze/calculateOutcomes/calculateWhenNotOutcomes.d.ts +1 -1
- package/dist/src/analyze/calculateOutcomes/specialExpressionCalculators.d.ts +14 -14
- package/dist/src/builtin/index.d.ts +9 -9
- package/dist/src/builtin/specialExpressions/and.d.ts +1 -1
- package/dist/src/builtin/specialExpressions/{if-let.d.ts → if_let.d.ts} +1 -1
- package/dist/{cli/src/builtin/specialExpressions/if-not.d.ts → src/builtin/specialExpressions/if_not.d.ts} +1 -1
- package/dist/src/builtin/specialExpressions/or.d.ts +1 -1
- package/dist/{cli/src/builtin/specialExpressions/time.d.ts → src/builtin/specialExpressions/switch.d.ts} +2 -2
- package/dist/src/builtin/specialExpressions/{when-first.d.ts → when_first.d.ts} +1 -1
- package/dist/{cli/src/builtin/specialExpressions/when-let.d.ts → src/builtin/specialExpressions/when_let.d.ts} +1 -1
- package/dist/src/builtin/specialExpressions/{when-not.d.ts → when_not.d.ts} +1 -1
- package/dist/src/identifier.d.ts +2 -2
- package/dist/src/parser/AlgebraicParser.d.ts +6 -1
- package/dist/src/tokenizer/algebraic/algebraicReservedNames.d.ts +106 -7
- package/dist/src/tokenizer/algebraic/algebraicTokenizers.d.ts +1 -1
- package/dist/src/tokenizer/algebraic/algebraicTokens.d.ts +5 -4
- package/dist/src/tokenizer/polish/polishTokenizers.d.ts +1 -1
- package/dist/src/tokenizer/polish/polishTokens.d.ts +1 -1
- package/dist/src/tokenizer/utils.d.ts +1 -1
- package/dist/src/typeGuards/index.d.ts +1 -0
- package/dist/testFramework.esm.js +468 -369
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +468 -369
- package/dist/testFramework.js.map +1 -1
- package/package.json +1 -1
- package/dist/cli/src/analyze/calculateOutcomes/calculateTimeOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateTimeOutcomes.d.ts +0 -3
package/dist/cli/cli.js
CHANGED
|
@@ -92,7 +92,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
92
92
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
var version = "2.0.
|
|
95
|
+
var version = "2.0.15";
|
|
96
96
|
|
|
97
97
|
var AstNodeType;
|
|
98
98
|
(function (AstNodeType) {
|
|
@@ -243,6 +243,12 @@ var UndefinedSymbolError = /** @class */ (function (_super) {
|
|
|
243
243
|
return UndefinedSymbolError;
|
|
244
244
|
}(LitsError));
|
|
245
245
|
|
|
246
|
+
function getSourceCodeInfo(anyValue, sourceCodeInfo) {
|
|
247
|
+
var _a;
|
|
248
|
+
// eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access
|
|
249
|
+
return (_a = anyValue === null || anyValue === void 0 ? void 0 : anyValue.sourceCodeInfo) !== null && _a !== void 0 ? _a : sourceCodeInfo;
|
|
250
|
+
}
|
|
251
|
+
|
|
246
252
|
function isTokenDebugData(tokenDebugData) {
|
|
247
253
|
return (typeof tokenDebugData === 'object'
|
|
248
254
|
&& tokenDebugData !== null
|
|
@@ -261,8 +267,12 @@ function addTokenDebugData(token, debugData) {
|
|
|
261
267
|
}
|
|
262
268
|
token.push(debugData);
|
|
263
269
|
}
|
|
264
|
-
function throwUnexpectedToken(expected, actual) {
|
|
265
|
-
|
|
270
|
+
function throwUnexpectedToken(expected, expectedValue, actual) {
|
|
271
|
+
if (actual === undefined) {
|
|
272
|
+
throw new LitsError("Unexpected end of input, expected ".concat(expected).concat(expectedValue ? " '".concat(expectedValue, "'") : ''), undefined);
|
|
273
|
+
}
|
|
274
|
+
var actualOutput = "".concat(actual[0]).concat(actual[1] ? " '".concat(actual[1], "'") : '');
|
|
275
|
+
throw new LitsError("Unexpected token: ".concat(actualOutput, ", expected ").concat(expected).concat(expectedValue ? " '".concat(expectedValue, "'") : ''), getSourceCodeInfo(actual));
|
|
266
276
|
}
|
|
267
277
|
|
|
268
278
|
var commonSimpleTokenTypes = [
|
|
@@ -284,7 +294,7 @@ function isLParenToken(token) {
|
|
|
284
294
|
}
|
|
285
295
|
function assertLParenToken(token) {
|
|
286
296
|
if (!isLParenToken(token)) {
|
|
287
|
-
throwUnexpectedToken('LParen', token);
|
|
297
|
+
throwUnexpectedToken('LParen', undefined, token);
|
|
288
298
|
}
|
|
289
299
|
}
|
|
290
300
|
function asLParenToken(token) {
|
|
@@ -296,7 +306,7 @@ function isRParenToken(token) {
|
|
|
296
306
|
}
|
|
297
307
|
function assertRParenToken(token) {
|
|
298
308
|
if (!isRParenToken(token)) {
|
|
299
|
-
throwUnexpectedToken('RParen', token);
|
|
309
|
+
throwUnexpectedToken('RParen', undefined, token);
|
|
300
310
|
}
|
|
301
311
|
}
|
|
302
312
|
function isLBracketToken(token) {
|
|
@@ -304,7 +314,7 @@ function isLBracketToken(token) {
|
|
|
304
314
|
}
|
|
305
315
|
function assertLBracketToken(token) {
|
|
306
316
|
if (!isLBracketToken(token)) {
|
|
307
|
-
throwUnexpectedToken('LBracket', token);
|
|
317
|
+
throwUnexpectedToken('LBracket', undefined, token);
|
|
308
318
|
}
|
|
309
319
|
}
|
|
310
320
|
function asLBracketToken(token) {
|
|
@@ -316,7 +326,7 @@ function isRBracketToken(token) {
|
|
|
316
326
|
}
|
|
317
327
|
function assertRBracketToken(token) {
|
|
318
328
|
if (!isRBracketToken(token)) {
|
|
319
|
-
throwUnexpectedToken('RBracket', token);
|
|
329
|
+
throwUnexpectedToken('RBracket', undefined, token);
|
|
320
330
|
}
|
|
321
331
|
}
|
|
322
332
|
function isLBraceToken(token) {
|
|
@@ -324,7 +334,7 @@ function isLBraceToken(token) {
|
|
|
324
334
|
}
|
|
325
335
|
function assertLBraceToken(token) {
|
|
326
336
|
if (!isLBraceToken(token)) {
|
|
327
|
-
throwUnexpectedToken('LBrace', token);
|
|
337
|
+
throwUnexpectedToken('LBrace', undefined, token);
|
|
328
338
|
}
|
|
329
339
|
}
|
|
330
340
|
function asLBraceToken(token) {
|
|
@@ -336,7 +346,7 @@ function isRBraceToken(token) {
|
|
|
336
346
|
}
|
|
337
347
|
function assertRBraceToken(token) {
|
|
338
348
|
if (!isRBraceToken(token)) {
|
|
339
|
-
throwUnexpectedToken('RBrace', token);
|
|
349
|
+
throwUnexpectedToken('RBrace', undefined, token);
|
|
340
350
|
}
|
|
341
351
|
}
|
|
342
352
|
function isStringToken(token) {
|
|
@@ -344,7 +354,7 @@ function isStringToken(token) {
|
|
|
344
354
|
}
|
|
345
355
|
function assertStringToken(token) {
|
|
346
356
|
if (!isStringToken(token)) {
|
|
347
|
-
throwUnexpectedToken('String', token);
|
|
357
|
+
throwUnexpectedToken('String', undefined, token);
|
|
348
358
|
}
|
|
349
359
|
}
|
|
350
360
|
function asStringToken(token) {
|
|
@@ -362,7 +372,7 @@ function isEndNotationToken(token) {
|
|
|
362
372
|
}
|
|
363
373
|
function assertEndNotationToken(token) {
|
|
364
374
|
if (!isEndNotationToken(token)) {
|
|
365
|
-
throwUnexpectedToken('EndNotation', token);
|
|
375
|
+
throwUnexpectedToken('EndNotation', undefined, token);
|
|
366
376
|
}
|
|
367
377
|
}
|
|
368
378
|
|
|
@@ -420,24 +430,23 @@ var otherSymbolicOperators = [
|
|
|
420
430
|
var symbolicOperators = __spreadArray(__spreadArray(__spreadArray([], __read(symbolicUnaryOperators), false), __read(symbolicBinaryOperators), false), __read(otherSymbolicOperators), false);
|
|
421
431
|
var nonFunctionOperators = [
|
|
422
432
|
'??',
|
|
423
|
-
'
|
|
433
|
+
'&&',
|
|
424
434
|
'comment',
|
|
425
435
|
'cond',
|
|
426
436
|
'declared?',
|
|
427
437
|
'if',
|
|
428
|
-
'
|
|
429
|
-
'
|
|
438
|
+
'if_not',
|
|
439
|
+
'||',
|
|
430
440
|
'when',
|
|
431
|
-
'
|
|
441
|
+
'when_not',
|
|
432
442
|
'do',
|
|
433
|
-
'time!',
|
|
434
443
|
'throw',
|
|
435
444
|
'let',
|
|
436
445
|
'def',
|
|
437
446
|
'defs',
|
|
438
|
-
'
|
|
439
|
-
'
|
|
440
|
-
'
|
|
447
|
+
'if_let',
|
|
448
|
+
'when_let',
|
|
449
|
+
'when_first',
|
|
441
450
|
'fn',
|
|
442
451
|
'defn',
|
|
443
452
|
'defns',
|
|
@@ -468,7 +477,7 @@ function isA_SymbolToken(token) {
|
|
|
468
477
|
}
|
|
469
478
|
function assertA_SymbolToken(token) {
|
|
470
479
|
if (!isA_SymbolToken(token)) {
|
|
471
|
-
throwUnexpectedToken('A_Symbol', token);
|
|
480
|
+
throwUnexpectedToken('A_Symbol', undefined, token);
|
|
472
481
|
}
|
|
473
482
|
}
|
|
474
483
|
function asA_SymbolToken(token) {
|
|
@@ -478,8 +487,19 @@ function asA_SymbolToken(token) {
|
|
|
478
487
|
function isA_BinaryOperatorToken(token) {
|
|
479
488
|
return (token === null || token === void 0 ? void 0 : token[0]) === 'A_Operator' && isSymbolicBinaryOperator(token[1]);
|
|
480
489
|
}
|
|
481
|
-
function isA_ReservedSymbolToken(token) {
|
|
482
|
-
|
|
490
|
+
function isA_ReservedSymbolToken(token, symbolName) {
|
|
491
|
+
if ((token === null || token === void 0 ? void 0 : token[0]) !== 'A_ReservedSymbol') {
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
if (symbolName && token[1] !== symbolName) {
|
|
495
|
+
return false;
|
|
496
|
+
}
|
|
497
|
+
return true;
|
|
498
|
+
}
|
|
499
|
+
function assertA_ReservedSymbolToken(token, symbolName) {
|
|
500
|
+
if (!isA_ReservedSymbolToken(token, symbolName)) {
|
|
501
|
+
throwUnexpectedToken('A_ReservedSymbol', symbolName, token);
|
|
502
|
+
}
|
|
483
503
|
}
|
|
484
504
|
function isA_CommentToken(token) {
|
|
485
505
|
return (token === null || token === void 0 ? void 0 : token[0]) === 'A_SingleLineComment';
|
|
@@ -498,10 +518,9 @@ function isA_OperatorToken(token, operatorName) {
|
|
|
498
518
|
}
|
|
499
519
|
function assertA_OperatorToken(token, operatorName) {
|
|
500
520
|
if (!isA_OperatorToken(token, operatorName)) {
|
|
501
|
-
|
|
521
|
+
{
|
|
502
522
|
throw new LitsError("Unexpected token: ".concat(token, ", expected operator ").concat(operatorName), undefined);
|
|
503
523
|
}
|
|
504
|
-
throwUnexpectedToken('A_Operator', token);
|
|
505
524
|
}
|
|
506
525
|
}
|
|
507
526
|
function isA_WhitespaceToken(token) {
|
|
@@ -514,7 +533,7 @@ function isA_BasePrefixedNumberToken(token) {
|
|
|
514
533
|
return (token === null || token === void 0 ? void 0 : token[0]) === 'A_BasePrefixedNumber';
|
|
515
534
|
}
|
|
516
535
|
|
|
517
|
-
var modifierNames = ['&', '&let', '&when', '&while'];
|
|
536
|
+
var modifierNames = ['&rest', '&let', '&when', '&while'];
|
|
518
537
|
var polishOnlySimpleTokenTypes = [
|
|
519
538
|
'P_FnShorthand',
|
|
520
539
|
];
|
|
@@ -537,7 +556,7 @@ function isP_StringShorthandToken(token) {
|
|
|
537
556
|
}
|
|
538
557
|
function assertP_StringShorthandToken(token) {
|
|
539
558
|
if (!isP_StringShorthandToken(token)) {
|
|
540
|
-
throwUnexpectedToken('P_StringShorthand', token);
|
|
559
|
+
throwUnexpectedToken('P_StringShorthand', undefined, token);
|
|
541
560
|
}
|
|
542
561
|
}
|
|
543
562
|
function asP_StringShorthandToken(token) {
|
|
@@ -549,7 +568,7 @@ function isP_SymbolToken(token) {
|
|
|
549
568
|
}
|
|
550
569
|
function assertP_SymbolToken(token) {
|
|
551
570
|
if (!isP_SymbolToken(token)) {
|
|
552
|
-
throwUnexpectedToken('P_Symbol', token);
|
|
571
|
+
throwUnexpectedToken('P_Symbol', undefined, token);
|
|
553
572
|
}
|
|
554
573
|
}
|
|
555
574
|
function asP_SymbolToken(token) {
|
|
@@ -567,7 +586,7 @@ function isP_RegexpShorthandToken(token) {
|
|
|
567
586
|
}
|
|
568
587
|
function assertP_RegexpShorthandToken(token) {
|
|
569
588
|
if (!isP_RegexpShorthandToken(token)) {
|
|
570
|
-
throwUnexpectedToken('P_RegexpShorthand', token);
|
|
589
|
+
throwUnexpectedToken('P_RegexpShorthand', undefined, token);
|
|
571
590
|
}
|
|
572
591
|
}
|
|
573
592
|
function asP_RegexpShorthandToken(token) {
|
|
@@ -582,7 +601,7 @@ function isP_CollectionAccessorToken(token) {
|
|
|
582
601
|
}
|
|
583
602
|
function assertP_CollectionAccessorToken(token) {
|
|
584
603
|
if (!isP_CollectionAccessorToken(token)) {
|
|
585
|
-
throwUnexpectedToken('P_CollectionAccessor', token);
|
|
604
|
+
throwUnexpectedToken('P_CollectionAccessor', undefined, token);
|
|
586
605
|
}
|
|
587
606
|
}
|
|
588
607
|
function asP_CollectionAccessorToken(token) {
|
|
@@ -594,7 +613,7 @@ function isP_CommentToken(token) {
|
|
|
594
613
|
}
|
|
595
614
|
function assertP_CommentToken(token) {
|
|
596
615
|
if (!isP_CommentToken(token)) {
|
|
597
|
-
throwUnexpectedToken('P_Comment', token);
|
|
616
|
+
throwUnexpectedToken('P_Comment', undefined, token);
|
|
598
617
|
}
|
|
599
618
|
}
|
|
600
619
|
function asP_CommentToken(token) {
|
|
@@ -609,7 +628,7 @@ function isP_NumberToken(token) {
|
|
|
609
628
|
}
|
|
610
629
|
function assertP_NumberToken(token) {
|
|
611
630
|
if (!isP_NumberToken(token)) {
|
|
612
|
-
throwUnexpectedToken('P_Number', token);
|
|
631
|
+
throwUnexpectedToken('P_Number', undefined, token);
|
|
613
632
|
}
|
|
614
633
|
}
|
|
615
634
|
|
|
@@ -677,12 +696,6 @@ function valueToString(value) {
|
|
|
677
696
|
return JSON.stringify(value);
|
|
678
697
|
}
|
|
679
698
|
|
|
680
|
-
function getSourceCodeInfo(anyValue, sourceCodeInfo) {
|
|
681
|
-
var _a;
|
|
682
|
-
// eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access
|
|
683
|
-
return (_a = anyValue === null || anyValue === void 0 ? void 0 : anyValue.sourceCodeInfo) !== null && _a !== void 0 ? _a : sourceCodeInfo;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
699
|
function getAssertionError(typeName, value, sourceCodeInfo) {
|
|
687
700
|
return new LitsError("Expected ".concat(typeName, ", got ").concat(valueToString(value), "."), getSourceCodeInfo(value, sourceCodeInfo));
|
|
688
701
|
}
|
|
@@ -735,7 +748,7 @@ function isExpressionNode(value) {
|
|
|
735
748
|
}
|
|
736
749
|
|
|
737
750
|
var specialExpressionCommentRemovers = {
|
|
738
|
-
'
|
|
751
|
+
'&&': function (node, removeOptions) {
|
|
739
752
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
740
753
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
741
754
|
},
|
|
@@ -747,6 +760,10 @@ var specialExpressionCommentRemovers = {
|
|
|
747
760
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
748
761
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
749
762
|
},
|
|
763
|
+
'switch': function (node, removeOptions) {
|
|
764
|
+
removeOptions.removeCommenNodesFromArray(node.p);
|
|
765
|
+
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
766
|
+
},
|
|
750
767
|
'declared?': function (node, removeOptions) {
|
|
751
768
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
752
769
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
@@ -768,12 +785,12 @@ var specialExpressionCommentRemovers = {
|
|
|
768
785
|
'doseq': function (_node, _removeOptions) { },
|
|
769
786
|
'fn': function (_node, _removeOptions) { },
|
|
770
787
|
'for': function (_node, _removeOptions) { },
|
|
771
|
-
'
|
|
788
|
+
'if_let': function (_node, _removeOptions) { },
|
|
772
789
|
'if': function (node, removeOptions) {
|
|
773
790
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
774
791
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
775
792
|
},
|
|
776
|
-
'
|
|
793
|
+
'if_not': function (node, removeOptions) {
|
|
777
794
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
778
795
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
779
796
|
},
|
|
@@ -785,7 +802,7 @@ var specialExpressionCommentRemovers = {
|
|
|
785
802
|
});
|
|
786
803
|
},
|
|
787
804
|
'loop': function (_node, _removeOptions) { },
|
|
788
|
-
'
|
|
805
|
+
'||': function (node, removeOptions) {
|
|
789
806
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
790
807
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
791
808
|
},
|
|
@@ -797,19 +814,15 @@ var specialExpressionCommentRemovers = {
|
|
|
797
814
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
798
815
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
799
816
|
},
|
|
800
|
-
'time!': function (node, removeOptions) {
|
|
801
|
-
removeOptions.removeCommenNodesFromArray(node.p);
|
|
802
|
-
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
803
|
-
},
|
|
804
817
|
'throw': function (node, removeOptions) {
|
|
805
818
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
806
819
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
807
820
|
},
|
|
808
821
|
'try': function (_node, _removeOptions) { },
|
|
809
|
-
'
|
|
810
|
-
'
|
|
822
|
+
'when_first': function (_node, _removeOptions) { },
|
|
823
|
+
'when_let': function (_node, _removeOptions) { },
|
|
811
824
|
'when': function (_node, _removeOptions) { },
|
|
812
|
-
'
|
|
825
|
+
'when_not': function (_node, _removeOptions) { },
|
|
813
826
|
};
|
|
814
827
|
function removeCommentNodesFromSpecialExpression(node, removeOptions) {
|
|
815
828
|
var uncommenter = specialExpressionCommentRemovers[node.n];
|
|
@@ -851,6 +864,13 @@ function assertEvenNumberOfParams(node) {
|
|
|
851
864
|
throw new LitsError("Wrong number of arguments, expected an even number, got ".concat(valueToString(length), "."), (_a = getTokenDebugData(node.token)) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
|
|
852
865
|
}
|
|
853
866
|
}
|
|
867
|
+
function assertOddNumberOfParams(node) {
|
|
868
|
+
var _a;
|
|
869
|
+
var length = withoutCommentNodes(node.p).length;
|
|
870
|
+
if (length % 2 !== 1) {
|
|
871
|
+
throw new LitsError("Wrong number of arguments, expected an odd number, got ".concat(valueToString(length), "."), (_a = getTokenDebugData(node.token)) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
854
874
|
function assertNumberOfParams(count, node) {
|
|
855
875
|
var _a, _b;
|
|
856
876
|
assertCount({
|
|
@@ -988,7 +1008,7 @@ function asNumber(value, sourceCodeInfo, options) {
|
|
|
988
1008
|
}
|
|
989
1009
|
|
|
990
1010
|
var bitwiseNormalExpression = {
|
|
991
|
-
'
|
|
1011
|
+
'<<': {
|
|
992
1012
|
evaluate: function (_a, sourceCodeInfo) {
|
|
993
1013
|
var _b = __read(_a, 2), num = _b[0], count = _b[1];
|
|
994
1014
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -997,7 +1017,7 @@ var bitwiseNormalExpression = {
|
|
|
997
1017
|
},
|
|
998
1018
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
999
1019
|
},
|
|
1000
|
-
'
|
|
1020
|
+
'>>': {
|
|
1001
1021
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1002
1022
|
var _b = __read(_a, 2), num = _b[0], count = _b[1];
|
|
1003
1023
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1006,7 +1026,7 @@ var bitwiseNormalExpression = {
|
|
|
1006
1026
|
},
|
|
1007
1027
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1008
1028
|
},
|
|
1009
|
-
'
|
|
1029
|
+
'>>>': {
|
|
1010
1030
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1011
1031
|
var _b = __read(_a, 2), num = _b[0], count = _b[1];
|
|
1012
1032
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1015,7 +1035,7 @@ var bitwiseNormalExpression = {
|
|
|
1015
1035
|
},
|
|
1016
1036
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1017
1037
|
},
|
|
1018
|
-
'
|
|
1038
|
+
'~': {
|
|
1019
1039
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1020
1040
|
var _b = __read(_a, 1), num = _b[0];
|
|
1021
1041
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1023,7 +1043,7 @@ var bitwiseNormalExpression = {
|
|
|
1023
1043
|
},
|
|
1024
1044
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
1025
1045
|
},
|
|
1026
|
-
'
|
|
1046
|
+
'&': {
|
|
1027
1047
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1028
1048
|
var _b = __read(_a), first = _b[0], rest = _b.slice(1);
|
|
1029
1049
|
assertNumber(first, sourceCodeInfo, { integer: true });
|
|
@@ -1034,7 +1054,7 @@ var bitwiseNormalExpression = {
|
|
|
1034
1054
|
},
|
|
1035
1055
|
validate: function (node) { return assertNumberOfParams({ min: 2 }, node); },
|
|
1036
1056
|
},
|
|
1037
|
-
'
|
|
1057
|
+
'&!': {
|
|
1038
1058
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1039
1059
|
var _b = __read(_a), first = _b[0], rest = _b.slice(1);
|
|
1040
1060
|
assertNumber(first, sourceCodeInfo, { integer: true });
|
|
@@ -1045,7 +1065,7 @@ var bitwiseNormalExpression = {
|
|
|
1045
1065
|
},
|
|
1046
1066
|
validate: function (node) { return assertNumberOfParams({ min: 2 }, node); },
|
|
1047
1067
|
},
|
|
1048
|
-
'
|
|
1068
|
+
'|': {
|
|
1049
1069
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1050
1070
|
var _b = __read(_a), first = _b[0], rest = _b.slice(1);
|
|
1051
1071
|
assertNumber(first, sourceCodeInfo, { integer: true });
|
|
@@ -1056,7 +1076,7 @@ var bitwiseNormalExpression = {
|
|
|
1056
1076
|
},
|
|
1057
1077
|
validate: function (node) { return assertNumberOfParams({ min: 2 }, node); },
|
|
1058
1078
|
},
|
|
1059
|
-
'
|
|
1079
|
+
'^': {
|
|
1060
1080
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1061
1081
|
var _b = __read(_a), first = _b[0], rest = _b.slice(1);
|
|
1062
1082
|
assertNumber(first, sourceCodeInfo, { integer: true });
|
|
@@ -1067,7 +1087,7 @@ var bitwiseNormalExpression = {
|
|
|
1067
1087
|
},
|
|
1068
1088
|
validate: function (node) { return assertNumberOfParams({ min: 2 }, node); },
|
|
1069
1089
|
},
|
|
1070
|
-
'
|
|
1090
|
+
'bit_flip': {
|
|
1071
1091
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1072
1092
|
var _b = __read(_a, 2), num = _b[0], index = _b[1];
|
|
1073
1093
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1077,7 +1097,7 @@ var bitwiseNormalExpression = {
|
|
|
1077
1097
|
},
|
|
1078
1098
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1079
1099
|
},
|
|
1080
|
-
'
|
|
1100
|
+
'bit_set': {
|
|
1081
1101
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1082
1102
|
var _b = __read(_a, 2), num = _b[0], index = _b[1];
|
|
1083
1103
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1087,7 +1107,7 @@ var bitwiseNormalExpression = {
|
|
|
1087
1107
|
},
|
|
1088
1108
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1089
1109
|
},
|
|
1090
|
-
'
|
|
1110
|
+
'bit_clear': {
|
|
1091
1111
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1092
1112
|
var _b = __read(_a, 2), num = _b[0], index = _b[1];
|
|
1093
1113
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1097,7 +1117,7 @@ var bitwiseNormalExpression = {
|
|
|
1097
1117
|
},
|
|
1098
1118
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1099
1119
|
},
|
|
1100
|
-
'
|
|
1120
|
+
'bit_test': {
|
|
1101
1121
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1102
1122
|
var _b = __read(_a, 2), num = _b[0], index = _b[1];
|
|
1103
1123
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -2785,7 +2805,7 @@ var mathNormalExpression = {
|
|
|
2785
2805
|
},
|
|
2786
2806
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
2787
2807
|
},
|
|
2788
|
-
'
|
|
2808
|
+
'%': {
|
|
2789
2809
|
evaluate: function (_a, sourceCodeInfo) {
|
|
2790
2810
|
var _b = __read(_a, 2), dividend = _b[0], divisor = _b[1];
|
|
2791
2811
|
assertNumber(dividend, sourceCodeInfo);
|
|
@@ -2811,7 +2831,7 @@ var mathNormalExpression = {
|
|
|
2811
2831
|
},
|
|
2812
2832
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
2813
2833
|
},
|
|
2814
|
-
'
|
|
2834
|
+
'**': {
|
|
2815
2835
|
evaluate: function (_a, sourceCodeInfo) {
|
|
2816
2836
|
var _b = __read(_a, 2), first = _b[0], second = _b[1];
|
|
2817
2837
|
assertNumber(first, sourceCodeInfo);
|
|
@@ -3088,8 +3108,6 @@ var mathNormalExpression = {
|
|
|
3088
3108
|
},
|
|
3089
3109
|
};
|
|
3090
3110
|
|
|
3091
|
-
var uuidTemplate = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
|
|
3092
|
-
var xyRegexp = /[xy]/g;
|
|
3093
3111
|
var miscNormalExpression = {
|
|
3094
3112
|
'!=': {
|
|
3095
3113
|
evaluate: function (params) {
|
|
@@ -3103,7 +3121,7 @@ var miscNormalExpression = {
|
|
|
3103
3121
|
},
|
|
3104
3122
|
validate: function (node) { return assertNumberOfParams({ min: 1 }, node); },
|
|
3105
3123
|
},
|
|
3106
|
-
'
|
|
3124
|
+
'==': {
|
|
3107
3125
|
evaluate: function (_a) {
|
|
3108
3126
|
var e_1, _b;
|
|
3109
3127
|
var _c = __read(_a), first = _c[0], rest = _c.slice(1);
|
|
@@ -3228,20 +3246,14 @@ var miscNormalExpression = {
|
|
|
3228
3246
|
},
|
|
3229
3247
|
validate: function (node) { return assertNumberOfParams({ min: 1 }, node); },
|
|
3230
3248
|
},
|
|
3231
|
-
'
|
|
3249
|
+
'!': {
|
|
3232
3250
|
evaluate: function (_a) {
|
|
3233
3251
|
var _b = __read(_a, 1), first = _b[0];
|
|
3234
3252
|
return !first;
|
|
3235
3253
|
},
|
|
3236
3254
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3237
3255
|
},
|
|
3238
|
-
'
|
|
3239
|
-
evaluate: function () {
|
|
3240
|
-
return Date.now();
|
|
3241
|
-
},
|
|
3242
|
-
validate: function (node) { return assertNumberOfParams(0, node); },
|
|
3243
|
-
},
|
|
3244
|
-
'inst-ms->iso-date-time': {
|
|
3256
|
+
'epoch>iso_date': {
|
|
3245
3257
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3246
3258
|
var _b = __read(_a, 1), ms = _b[0];
|
|
3247
3259
|
assertNumber(ms, sourceCodeInfo);
|
|
@@ -3249,7 +3261,7 @@ var miscNormalExpression = {
|
|
|
3249
3261
|
},
|
|
3250
3262
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3251
3263
|
},
|
|
3252
|
-
'
|
|
3264
|
+
'iso_date>epoch': {
|
|
3253
3265
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3254
3266
|
var _b = __read(_a, 1), dateTime = _b[0];
|
|
3255
3267
|
assertString(dateTime, sourceCodeInfo);
|
|
@@ -3282,23 +3294,7 @@ var miscNormalExpression = {
|
|
|
3282
3294
|
},
|
|
3283
3295
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
3284
3296
|
},
|
|
3285
|
-
'
|
|
3286
|
-
evaluate: function () {
|
|
3287
|
-
return uuidTemplate.replace(xyRegexp, function (character) {
|
|
3288
|
-
var randomNbr = Math.floor(Math.random() * 16);
|
|
3289
|
-
var newValue = character === 'x' ? randomNbr : (randomNbr & 0x3) | 0x8;
|
|
3290
|
-
return newValue.toString(16);
|
|
3291
|
-
});
|
|
3292
|
-
},
|
|
3293
|
-
validate: function (node) { return assertNumberOfParams(0, node); },
|
|
3294
|
-
},
|
|
3295
|
-
'lits-version!': {
|
|
3296
|
-
evaluate: function () {
|
|
3297
|
-
return version;
|
|
3298
|
-
},
|
|
3299
|
-
validate: function (node) { return assertNumberOfParams(0, node); },
|
|
3300
|
-
},
|
|
3301
|
-
'json-parse': {
|
|
3297
|
+
'json_parse': {
|
|
3302
3298
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3303
3299
|
var _b = __read(_a, 1), first = _b[0];
|
|
3304
3300
|
assertString(first, sourceCodeInfo);
|
|
@@ -3307,7 +3303,7 @@ var miscNormalExpression = {
|
|
|
3307
3303
|
},
|
|
3308
3304
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3309
3305
|
},
|
|
3310
|
-
'
|
|
3306
|
+
'json_stringify': {
|
|
3311
3307
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3312
3308
|
var _b = __read(_a, 2), first = _b[0], second = _b[1];
|
|
3313
3309
|
assertAny(first, sourceCodeInfo);
|
|
@@ -3520,7 +3516,7 @@ var assertNormalExpression = {
|
|
|
3520
3516
|
};
|
|
3521
3517
|
|
|
3522
3518
|
var objectNormalExpression = {
|
|
3523
|
-
|
|
3519
|
+
object: {
|
|
3524
3520
|
evaluate: function (params, sourceCodeInfo) {
|
|
3525
3521
|
var result = {};
|
|
3526
3522
|
for (var i = 0; i < params.length; i += 2) {
|
|
@@ -3533,7 +3529,7 @@ var objectNormalExpression = {
|
|
|
3533
3529
|
},
|
|
3534
3530
|
validate: function (node) { return assertEvenNumberOfParams(node); },
|
|
3535
3531
|
},
|
|
3536
|
-
|
|
3532
|
+
keys: {
|
|
3537
3533
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3538
3534
|
var _b = __read(_a, 1), obj = _b[0];
|
|
3539
3535
|
assertObj(obj, sourceCodeInfo);
|
|
@@ -3541,7 +3537,7 @@ var objectNormalExpression = {
|
|
|
3541
3537
|
},
|
|
3542
3538
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3543
3539
|
},
|
|
3544
|
-
|
|
3540
|
+
vals: {
|
|
3545
3541
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3546
3542
|
var _b = __read(_a, 1), obj = _b[0];
|
|
3547
3543
|
assertObj(obj, sourceCodeInfo);
|
|
@@ -3549,7 +3545,7 @@ var objectNormalExpression = {
|
|
|
3549
3545
|
},
|
|
3550
3546
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3551
3547
|
},
|
|
3552
|
-
|
|
3548
|
+
entries: {
|
|
3553
3549
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3554
3550
|
var _b = __read(_a, 1), obj = _b[0];
|
|
3555
3551
|
assertObj(obj, sourceCodeInfo);
|
|
@@ -3557,7 +3553,7 @@ var objectNormalExpression = {
|
|
|
3557
3553
|
},
|
|
3558
3554
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3559
3555
|
},
|
|
3560
|
-
|
|
3556
|
+
find: {
|
|
3561
3557
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3562
3558
|
var _b = __read(_a, 2), obj = _b[0], key = _b[1];
|
|
3563
3559
|
assertObj(obj, sourceCodeInfo);
|
|
@@ -3568,7 +3564,7 @@ var objectNormalExpression = {
|
|
|
3568
3564
|
},
|
|
3569
3565
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
3570
3566
|
},
|
|
3571
|
-
|
|
3567
|
+
dissoc: {
|
|
3572
3568
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3573
3569
|
var _b = __read(_a, 2), obj = _b[0], key = _b[1];
|
|
3574
3570
|
assertObj(obj, sourceCodeInfo);
|
|
@@ -3579,7 +3575,7 @@ var objectNormalExpression = {
|
|
|
3579
3575
|
},
|
|
3580
3576
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
3581
3577
|
},
|
|
3582
|
-
|
|
3578
|
+
merge: {
|
|
3583
3579
|
evaluate: function (params, sourceCodeInfo) {
|
|
3584
3580
|
if (params.length === 0)
|
|
3585
3581
|
return null;
|
|
@@ -3592,7 +3588,7 @@ var objectNormalExpression = {
|
|
|
3592
3588
|
},
|
|
3593
3589
|
validate: function (node) { return assertNumberOfParams({ min: 0 }, node); },
|
|
3594
3590
|
},
|
|
3595
|
-
|
|
3591
|
+
merge_with: {
|
|
3596
3592
|
evaluate: function (params, sourceCodeInfo, contextStack, _a) {
|
|
3597
3593
|
var executeFunction = _a.executeFunction;
|
|
3598
3594
|
var first = params[0];
|
|
@@ -3615,7 +3611,7 @@ var objectNormalExpression = {
|
|
|
3615
3611
|
},
|
|
3616
3612
|
validate: function (node) { return assertNumberOfParams({ min: 2 }, node); },
|
|
3617
3613
|
},
|
|
3618
|
-
|
|
3614
|
+
zipmap: {
|
|
3619
3615
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3620
3616
|
var _b = __read(_a, 2), keys = _b[0], values = _b[1];
|
|
3621
3617
|
assertStringArray(keys, sourceCodeInfo);
|
|
@@ -3630,7 +3626,7 @@ var objectNormalExpression = {
|
|
|
3630
3626
|
},
|
|
3631
3627
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
3632
3628
|
},
|
|
3633
|
-
|
|
3629
|
+
select_keys: {
|
|
3634
3630
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3635
3631
|
var _b = __read(_a, 2), obj = _b[0], keys = _b[1];
|
|
3636
3632
|
assertStringArray(keys, sourceCodeInfo);
|
|
@@ -3896,7 +3892,7 @@ var stringNormalExpression = {
|
|
|
3896
3892
|
},
|
|
3897
3893
|
validate: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
|
|
3898
3894
|
},
|
|
3899
|
-
'
|
|
3895
|
+
'string_repeat': {
|
|
3900
3896
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3901
3897
|
var _b = __read(_a, 2), str = _b[0], count = _b[1];
|
|
3902
3898
|
assertString(str, sourceCodeInfo);
|
|
@@ -3930,27 +3926,7 @@ var stringNormalExpression = {
|
|
|
3930
3926
|
},
|
|
3931
3927
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3932
3928
|
},
|
|
3933
|
-
'
|
|
3934
|
-
evaluate: function (params, sourceCodeInfo) {
|
|
3935
|
-
var _a = __read(params, 2), num = _a[0], base = _a[1];
|
|
3936
|
-
assertNumber(num, sourceCodeInfo, { finite: true });
|
|
3937
|
-
if (params.length === 1) {
|
|
3938
|
-
return "".concat(num);
|
|
3939
|
-
}
|
|
3940
|
-
else {
|
|
3941
|
-
assertNumber(base, sourceCodeInfo, { finite: true });
|
|
3942
|
-
if (base !== 2 && base !== 8 && base !== 10 && base !== 16) {
|
|
3943
|
-
throw new LitsError("Expected \"number-to-string\" base argument to be 2, 8, 10 or 16, got: ".concat(base), sourceCodeInfo);
|
|
3944
|
-
}
|
|
3945
|
-
if (base === 10)
|
|
3946
|
-
return "".concat(num);
|
|
3947
|
-
assertNumber(num, sourceCodeInfo, { integer: true, nonNegative: true });
|
|
3948
|
-
return Number(num).toString(base);
|
|
3949
|
-
}
|
|
3950
|
-
},
|
|
3951
|
-
validate: function (node) { return assertNumberOfParams({ min: 1, max: 2 }, node); },
|
|
3952
|
-
},
|
|
3953
|
-
'from-char-code': {
|
|
3929
|
+
'from_char_code': {
|
|
3954
3930
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3955
3931
|
var _b = __read(_a, 1), num = _b[0];
|
|
3956
3932
|
assertNumber(num, sourceCodeInfo, { finite: true });
|
|
@@ -3964,7 +3940,7 @@ var stringNormalExpression = {
|
|
|
3964
3940
|
},
|
|
3965
3941
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3966
3942
|
},
|
|
3967
|
-
'
|
|
3943
|
+
'to_char_code': {
|
|
3968
3944
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3969
3945
|
var _b = __read(_a, 1), str = _b[0];
|
|
3970
3946
|
assertString(str, sourceCodeInfo, { nonEmpty: true });
|
|
@@ -3972,7 +3948,7 @@ var stringNormalExpression = {
|
|
|
3972
3948
|
},
|
|
3973
3949
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3974
3950
|
},
|
|
3975
|
-
'
|
|
3951
|
+
'lower_case': {
|
|
3976
3952
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3977
3953
|
var _b = __read(_a, 1), str = _b[0];
|
|
3978
3954
|
assertString(str, sourceCodeInfo);
|
|
@@ -3980,7 +3956,7 @@ var stringNormalExpression = {
|
|
|
3980
3956
|
},
|
|
3981
3957
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3982
3958
|
},
|
|
3983
|
-
'
|
|
3959
|
+
'upper_case': {
|
|
3984
3960
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3985
3961
|
var _b = __read(_a, 1), str = _b[0];
|
|
3986
3962
|
assertString(str, sourceCodeInfo);
|
|
@@ -3996,7 +3972,7 @@ var stringNormalExpression = {
|
|
|
3996
3972
|
},
|
|
3997
3973
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3998
3974
|
},
|
|
3999
|
-
'
|
|
3975
|
+
'trim_left': {
|
|
4000
3976
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4001
3977
|
var _b = __read(_a, 1), str = _b[0];
|
|
4002
3978
|
assertString(str, sourceCodeInfo);
|
|
@@ -4004,7 +3980,7 @@ var stringNormalExpression = {
|
|
|
4004
3980
|
},
|
|
4005
3981
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4006
3982
|
},
|
|
4007
|
-
'
|
|
3983
|
+
'trim_right': {
|
|
4008
3984
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4009
3985
|
var _b = __read(_a, 1), str = _b[0];
|
|
4010
3986
|
assertString(str, sourceCodeInfo);
|
|
@@ -4012,6 +3988,30 @@ var stringNormalExpression = {
|
|
|
4012
3988
|
},
|
|
4013
3989
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4014
3990
|
},
|
|
3991
|
+
'++': {
|
|
3992
|
+
evaluate: function (params, sourceCodeInfo) {
|
|
3993
|
+
if (params.length === 0) {
|
|
3994
|
+
return '';
|
|
3995
|
+
}
|
|
3996
|
+
var first = params[0];
|
|
3997
|
+
if (first !== null) {
|
|
3998
|
+
assertStringOrNumber(first, sourceCodeInfo);
|
|
3999
|
+
}
|
|
4000
|
+
if (params.length === 1) {
|
|
4001
|
+
return first === null ? '' : "".concat(first);
|
|
4002
|
+
}
|
|
4003
|
+
return params.slice(1).reduce(function (acc, str) {
|
|
4004
|
+
if (str !== null) {
|
|
4005
|
+
assertStringOrNumber(str, sourceCodeInfo);
|
|
4006
|
+
}
|
|
4007
|
+
if (str === null) {
|
|
4008
|
+
return acc;
|
|
4009
|
+
}
|
|
4010
|
+
return "".concat(acc).concat(str);
|
|
4011
|
+
}, first === null ? '' : "".concat(first));
|
|
4012
|
+
},
|
|
4013
|
+
validate: function () { return undefined; },
|
|
4014
|
+
},
|
|
4015
4015
|
'join': {
|
|
4016
4016
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4017
4017
|
var _b = __read(_a, 2), stringList = _b[0], delimiter = _b[1];
|
|
@@ -4036,7 +4036,7 @@ var stringNormalExpression = {
|
|
|
4036
4036
|
},
|
|
4037
4037
|
validate: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
|
|
4038
4038
|
},
|
|
4039
|
-
'
|
|
4039
|
+
'pad_left': {
|
|
4040
4040
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4041
4041
|
var _b = __read(_a, 3), str = _b[0], length = _b[1], padString = _b[2];
|
|
4042
4042
|
assertString(str, sourceCodeInfo);
|
|
@@ -4047,7 +4047,7 @@ var stringNormalExpression = {
|
|
|
4047
4047
|
},
|
|
4048
4048
|
validate: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
|
|
4049
4049
|
},
|
|
4050
|
-
'
|
|
4050
|
+
'pad_right': {
|
|
4051
4051
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4052
4052
|
var _b = __read(_a, 3), str = _b[0], length = _b[1], padString = _b[2];
|
|
4053
4053
|
assertString(str, sourceCodeInfo);
|
|
@@ -4089,7 +4089,7 @@ var stringNormalExpression = {
|
|
|
4089
4089
|
},
|
|
4090
4090
|
validate: function (node) { return assertNumberOfParams({ min: 1, max: 10 }, node); },
|
|
4091
4091
|
},
|
|
4092
|
-
'
|
|
4092
|
+
'encode_base64': {
|
|
4093
4093
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4094
4094
|
var _b = __read(_a, 1), value = _b[0];
|
|
4095
4095
|
assertString(value, sourceCodeInfo);
|
|
@@ -4100,7 +4100,7 @@ var stringNormalExpression = {
|
|
|
4100
4100
|
},
|
|
4101
4101
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4102
4102
|
},
|
|
4103
|
-
'
|
|
4103
|
+
'decode_base64': {
|
|
4104
4104
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4105
4105
|
var _b = __read(_a, 1), value = _b[0];
|
|
4106
4106
|
assertString(value, sourceCodeInfo);
|
|
@@ -4118,7 +4118,7 @@ var stringNormalExpression = {
|
|
|
4118
4118
|
},
|
|
4119
4119
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4120
4120
|
},
|
|
4121
|
-
'
|
|
4121
|
+
'encode_uri_component': {
|
|
4122
4122
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4123
4123
|
var _b = __read(_a, 1), value = _b[0];
|
|
4124
4124
|
assertString(value, sourceCodeInfo);
|
|
@@ -4126,7 +4126,7 @@ var stringNormalExpression = {
|
|
|
4126
4126
|
},
|
|
4127
4127
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4128
4128
|
},
|
|
4129
|
-
'
|
|
4129
|
+
'decode_uri_component': {
|
|
4130
4130
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4131
4131
|
var _b = __read(_a, 1), value = _b[0];
|
|
4132
4132
|
assertString(value, sourceCodeInfo);
|
|
@@ -4295,7 +4295,7 @@ var andSpecialExpression = {
|
|
|
4295
4295
|
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
4296
4296
|
var node = {
|
|
4297
4297
|
t: AstNodeType.SpecialExpression,
|
|
4298
|
-
n: '
|
|
4298
|
+
n: '&&',
|
|
4299
4299
|
p: params,
|
|
4300
4300
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
4301
4301
|
};
|
|
@@ -4380,6 +4380,37 @@ var condSpecialExpression = {
|
|
|
4380
4380
|
},
|
|
4381
4381
|
};
|
|
4382
4382
|
|
|
4383
|
+
var switchSpecialExpression = {
|
|
4384
|
+
polishParse: getCommonPolishSpecialExpressionParser('switch'),
|
|
4385
|
+
validateParameterCount: function (node) { return assertOddNumberOfParams(node); },
|
|
4386
|
+
evaluate: function (node, contextStack, _a) {
|
|
4387
|
+
var e_1, _b;
|
|
4388
|
+
var evaluateAstNode = _a.evaluateAstNode;
|
|
4389
|
+
var switchValue = evaluateAstNode(node.p[0], contextStack);
|
|
4390
|
+
try {
|
|
4391
|
+
for (var _c = __values(arrayToPairs(node.p.slice(1))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
4392
|
+
var _e = __read(_d.value, 2), test = _e[0], form = _e[1];
|
|
4393
|
+
var value = evaluateAstNode(test, contextStack);
|
|
4394
|
+
if (value === switchValue) {
|
|
4395
|
+
return evaluateAstNode(form, contextStack);
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4398
|
+
}
|
|
4399
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
4400
|
+
finally {
|
|
4401
|
+
try {
|
|
4402
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
4403
|
+
}
|
|
4404
|
+
finally { if (e_1) throw e_1.error; }
|
|
4405
|
+
}
|
|
4406
|
+
return null;
|
|
4407
|
+
},
|
|
4408
|
+
findUnresolvedIdentifiers: function (node, contextStack, _a) {
|
|
4409
|
+
var findUnresolvedIdentifiers = _a.findUnresolvedIdentifiers, builtin = _a.builtin;
|
|
4410
|
+
return findUnresolvedIdentifiers(node.p, contextStack, builtin);
|
|
4411
|
+
},
|
|
4412
|
+
};
|
|
4413
|
+
|
|
4383
4414
|
var declaredSpecialExpression = {
|
|
4384
4415
|
polishParse: getCommonPolishSpecialExpressionParser('declared?'),
|
|
4385
4416
|
validateParameterCount: function (node) { return assertNumberOfParams(1, node); },
|
|
@@ -4852,7 +4883,7 @@ function parseFunctionArguments(tokenStream, parseState, parsers) {
|
|
|
4852
4883
|
tkn = asToken(tokenStream.tokens[parseState.position]);
|
|
4853
4884
|
if (node.t === AstNodeType.Modifier) {
|
|
4854
4885
|
switch (node.v) {
|
|
4855
|
-
case '&':
|
|
4886
|
+
case '&rest':
|
|
4856
4887
|
if (state === 'rest')
|
|
4857
4888
|
throw new LitsError('& can only appear once', (_a = getTokenDebugData(tkn)) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
|
|
4858
4889
|
state = 'rest';
|
|
@@ -4927,7 +4958,7 @@ var ifLetSpecialExpression = {
|
|
|
4927
4958
|
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
4928
4959
|
var node = {
|
|
4929
4960
|
t: AstNodeType.SpecialExpression,
|
|
4930
|
-
n: '
|
|
4961
|
+
n: 'if_let',
|
|
4931
4962
|
b: asNonUndefined(bindings[0], (_c = getTokenDebugData(firstToken)) === null || _c === void 0 ? void 0 : _c.sourceCodeInfo),
|
|
4932
4963
|
p: params,
|
|
4933
4964
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
@@ -4964,7 +4995,7 @@ var ifLetSpecialExpression = {
|
|
|
4964
4995
|
};
|
|
4965
4996
|
|
|
4966
4997
|
var ifNotSpecialExpression = {
|
|
4967
|
-
polishParse: getCommonPolishSpecialExpressionParser('
|
|
4998
|
+
polishParse: getCommonPolishSpecialExpressionParser('if_not'),
|
|
4968
4999
|
validateParameterCount: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
|
|
4969
5000
|
evaluate: function (node, contextStack, _a) {
|
|
4970
5001
|
var _b;
|
|
@@ -5174,7 +5205,7 @@ function parseLoopBinding(tokenStream, parseState, _a) {
|
|
|
5174
5205
|
loopBinding.we = parseToken(tokenStream, parseState);
|
|
5175
5206
|
loopBinding.m.push('&while');
|
|
5176
5207
|
break;
|
|
5177
|
-
case '&':
|
|
5208
|
+
case '&rest':
|
|
5178
5209
|
throw new LitsError("Illegal modifier: ".concat(modifier), (_e = getTokenDebugData(tkn)) === null || _e === void 0 ? void 0 : _e.sourceCodeInfo);
|
|
5179
5210
|
default:
|
|
5180
5211
|
throw new LitsError("Illegal modifier: ".concat(modifier), (_f = getTokenDebugData(tkn)) === null || _f === void 0 ? void 0 : _f.sourceCodeInfo);
|
|
@@ -5374,7 +5405,7 @@ var doseqSpecialExpression = {
|
|
|
5374
5405
|
};
|
|
5375
5406
|
|
|
5376
5407
|
var orSpecialExpression = {
|
|
5377
|
-
polishParse: getCommonPolishSpecialExpressionParser('
|
|
5408
|
+
polishParse: getCommonPolishSpecialExpressionParser('||'),
|
|
5378
5409
|
validateParameterCount: function () { return undefined; },
|
|
5379
5410
|
evaluate: function (node, contextStack, _a) {
|
|
5380
5411
|
var e_1, _b;
|
|
@@ -5466,25 +5497,6 @@ var throwSpecialExpression = {
|
|
|
5466
5497
|
},
|
|
5467
5498
|
};
|
|
5468
5499
|
|
|
5469
|
-
var timeSpecialExpression = {
|
|
5470
|
-
polishParse: getCommonPolishSpecialExpressionParser('time!'),
|
|
5471
|
-
validateParameterCount: function (node) { return assertNumberOfParams(1, node); },
|
|
5472
|
-
evaluate: function (node, contextStack, _a) {
|
|
5473
|
-
var evaluateAstNode = _a.evaluateAstNode;
|
|
5474
|
-
var param = node.p[0];
|
|
5475
|
-
var startTime = Date.now();
|
|
5476
|
-
var result = evaluateAstNode(param, contextStack);
|
|
5477
|
-
var totalTime = Date.now() - startTime;
|
|
5478
|
-
// eslint-disable-next-line no-console
|
|
5479
|
-
console.log("Elapsed time: ".concat(totalTime, " ms"));
|
|
5480
|
-
return result;
|
|
5481
|
-
},
|
|
5482
|
-
findUnresolvedIdentifiers: function (node, contextStack, _a) {
|
|
5483
|
-
var findUnresolvedIdentifiers = _a.findUnresolvedIdentifiers, builtin = _a.builtin;
|
|
5484
|
-
return findUnresolvedIdentifiers(node.p, contextStack, builtin);
|
|
5485
|
-
},
|
|
5486
|
-
};
|
|
5487
|
-
|
|
5488
5500
|
var trySpecialExpression = {
|
|
5489
5501
|
polishParse: function (tokenStream, parseState, firstToken, _a) {
|
|
5490
5502
|
var _b, _c, _d;
|
|
@@ -5585,7 +5597,7 @@ var whenFirstSpecialExpression = {
|
|
|
5585
5597
|
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
5586
5598
|
var node = {
|
|
5587
5599
|
t: AstNodeType.SpecialExpression,
|
|
5588
|
-
n: '
|
|
5600
|
+
n: 'when_first',
|
|
5589
5601
|
b: asNonUndefined(bindings[0], (_c = getTokenDebugData(firstToken)) === null || _c === void 0 ? void 0 : _c.sourceCodeInfo),
|
|
5590
5602
|
p: params,
|
|
5591
5603
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
@@ -5647,7 +5659,7 @@ var whenLetSpecialExpression = {
|
|
|
5647
5659
|
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
5648
5660
|
var node = {
|
|
5649
5661
|
t: AstNodeType.SpecialExpression,
|
|
5650
|
-
n: '
|
|
5662
|
+
n: 'when_let',
|
|
5651
5663
|
b: asNonUndefined(bindings[0], (_c = getTokenDebugData(firstToken)) === null || _c === void 0 ? void 0 : _c.sourceCodeInfo),
|
|
5652
5664
|
p: params,
|
|
5653
5665
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
@@ -5693,7 +5705,7 @@ var whenLetSpecialExpression = {
|
|
|
5693
5705
|
};
|
|
5694
5706
|
|
|
5695
5707
|
var whenNotSpecialExpression = {
|
|
5696
|
-
polishParse: getCommonPolishSpecialExpressionParser('
|
|
5708
|
+
polishParse: getCommonPolishSpecialExpressionParser('when_not'),
|
|
5697
5709
|
validateParameterCount: function (node) { return assertNumberOfParams({ min: 1 }, node); },
|
|
5698
5710
|
evaluate: function (node, contextStack, _a) {
|
|
5699
5711
|
var e_1, _b;
|
|
@@ -5726,9 +5738,10 @@ var whenNotSpecialExpression = {
|
|
|
5726
5738
|
};
|
|
5727
5739
|
|
|
5728
5740
|
var specialExpressions = {
|
|
5729
|
-
'
|
|
5741
|
+
'&&': andSpecialExpression,
|
|
5730
5742
|
'comment': commentSpecialExpression,
|
|
5731
5743
|
'cond': condSpecialExpression,
|
|
5744
|
+
'switch': switchSpecialExpression,
|
|
5732
5745
|
'def': defSpecialExpression,
|
|
5733
5746
|
'defn': defnSpecialExpression,
|
|
5734
5747
|
'defns': defnsSpecialExpression,
|
|
@@ -5738,19 +5751,18 @@ var specialExpressions = {
|
|
|
5738
5751
|
'for': forSpecialExpression,
|
|
5739
5752
|
'fn': fnSpecialExpression,
|
|
5740
5753
|
'if': ifSpecialExpression,
|
|
5741
|
-
'
|
|
5742
|
-
'
|
|
5754
|
+
'if_let': ifLetSpecialExpression,
|
|
5755
|
+
'if_not': ifNotSpecialExpression,
|
|
5743
5756
|
'let': letSpecialExpression,
|
|
5744
5757
|
'loop': loopSpecialExpression,
|
|
5745
|
-
'
|
|
5758
|
+
'||': orSpecialExpression,
|
|
5746
5759
|
'recur': recurSpecialExpression,
|
|
5747
5760
|
'throw': throwSpecialExpression,
|
|
5748
|
-
'time!': timeSpecialExpression,
|
|
5749
5761
|
'try': trySpecialExpression,
|
|
5750
5762
|
'when': whenSpecialExpression,
|
|
5751
|
-
'
|
|
5752
|
-
'
|
|
5753
|
-
'
|
|
5763
|
+
'when_first': whenFirstSpecialExpression,
|
|
5764
|
+
'when_let': whenLetSpecialExpression,
|
|
5765
|
+
'when_not': whenNotSpecialExpression,
|
|
5754
5766
|
'declared?': declaredSpecialExpression,
|
|
5755
5767
|
'??': qqSpecialExpression,
|
|
5756
5768
|
};
|
|
@@ -6307,7 +6319,7 @@ var calculateAndOutcomes = function (_a) {
|
|
|
6307
6319
|
var astNode = _a.astNode, combinateAstNodes = _a.combinateAstNodes;
|
|
6308
6320
|
return combinateAstNodes(astNode.p)
|
|
6309
6321
|
.map(function (p) { return ({
|
|
6310
|
-
n: '
|
|
6322
|
+
n: '&&',
|
|
6311
6323
|
t: AstNodeType.SpecialExpression,
|
|
6312
6324
|
p: p,
|
|
6313
6325
|
token: astNode.token,
|
|
@@ -6429,7 +6441,7 @@ var calculateIfNotOutcomes = function (_a) {
|
|
|
6429
6441
|
if (isAstComputable(condition)) {
|
|
6430
6442
|
return combinateAstNodes(astNode.p)
|
|
6431
6443
|
.map(function (p) { return ({
|
|
6432
|
-
n: '
|
|
6444
|
+
n: 'if_not',
|
|
6433
6445
|
t: astNode.t,
|
|
6434
6446
|
p: p,
|
|
6435
6447
|
token: astNode.token,
|
|
@@ -6542,7 +6554,7 @@ var calculateOrOutcomes = function (_a) {
|
|
|
6542
6554
|
var astNode = _a.astNode, combinateAstNodes = _a.combinateAstNodes;
|
|
6543
6555
|
return combinateAstNodes(astNode.p)
|
|
6544
6556
|
.map(function (p) { return ({
|
|
6545
|
-
n: '
|
|
6557
|
+
n: '||',
|
|
6546
6558
|
t: AstNodeType.SpecialExpression,
|
|
6547
6559
|
p: p,
|
|
6548
6560
|
token: astNode.token,
|
|
@@ -6562,12 +6574,6 @@ var calculateThrowOutcomes = function (_a) {
|
|
|
6562
6574
|
return calculatePossibleAstNodes(astNode.p[0]).map(function (m) { return (__assign(__assign({}, astNode), { p: [m] })); });
|
|
6563
6575
|
};
|
|
6564
6576
|
|
|
6565
|
-
var calculateTimeOutcomes = function (_a) {
|
|
6566
|
-
var astNode = _a.astNode, calculatePossibleAstNodes = _a.calculatePossibleAstNodes;
|
|
6567
|
-
return calculatePossibleAstNodes(astNode.p[0])
|
|
6568
|
-
.map(function (p) { return (__assign(__assign({}, astNode), { n: 'do', p: [p] })); });
|
|
6569
|
-
};
|
|
6570
|
-
|
|
6571
6577
|
var calculateTryOutcomes = function (_a) {
|
|
6572
6578
|
var astNode = _a.astNode, calculatePossibleAstNodes = _a.calculatePossibleAstNodes;
|
|
6573
6579
|
var _b = calculatePossibleAstNodes(astNode.p[0]).reduce(function (acc, node) {
|
|
@@ -6641,7 +6647,7 @@ var calculateWhenNotOutcomes = function (_a) {
|
|
|
6641
6647
|
if (isAstComputable(condition)) {
|
|
6642
6648
|
return combinateAstNodes(astNode.p)
|
|
6643
6649
|
.map(function (p) { return ({
|
|
6644
|
-
n: '
|
|
6650
|
+
n: 'when_not',
|
|
6645
6651
|
t: astNode.t,
|
|
6646
6652
|
p: p,
|
|
6647
6653
|
token: astNode.token,
|
|
@@ -6700,10 +6706,22 @@ var calculateLoopOutcomes = function (_a) {
|
|
|
6700
6706
|
.map(function (p) { return (__assign(__assign({}, astNode), { p: p })); });
|
|
6701
6707
|
};
|
|
6702
6708
|
|
|
6709
|
+
var calculateSwitchOutcomes = function (_a) {
|
|
6710
|
+
var astNode = _a.astNode, nilNode = _a.nilNode, calculatePossibleAstNodes = _a.calculatePossibleAstNodes;
|
|
6711
|
+
// TODO be smarter about this
|
|
6712
|
+
return __spreadArray(__spreadArray([], __read(arrayToPairs(astNode.p.slice(1)).flatMap(function (_a) {
|
|
6713
|
+
var _b = __read(_a, 2); _b[0]; var form = _b[1];
|
|
6714
|
+
return calculatePossibleAstNodes(form);
|
|
6715
|
+
})), false), [
|
|
6716
|
+
nilNode,
|
|
6717
|
+
], false);
|
|
6718
|
+
};
|
|
6719
|
+
|
|
6703
6720
|
var specialExpressionCalculator = {
|
|
6704
|
-
'
|
|
6721
|
+
'&&': function (astNode, helperOptions) { return calculateAndOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6705
6722
|
'comment': function (astNode, helperOptions) { return calculateCommentOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6706
6723
|
'cond': function (astNode, helperOptions) { return calculateCondOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6724
|
+
'switch': function (astNode, helperOptions) { return calculateSwitchOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6707
6725
|
'declared?': function (astNode, helperOptions) { return calculateDeclaredOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6708
6726
|
'defn': function (astNode, helperOptions) { return calculateDefnOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6709
6727
|
'def': function (astNode, helperOptions) { return calculateDefOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
@@ -6713,27 +6731,22 @@ var specialExpressionCalculator = {
|
|
|
6713
6731
|
'doseq': function (astNode, helperOptions) { return calculateDoSeqOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6714
6732
|
'fn': function (astNode, helperOptions) { return calculateFnOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6715
6733
|
'for': function (astNode, helperOptions) { return calculateForOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6716
|
-
'
|
|
6734
|
+
'if_let': function (astNode, helperOptions) { return calculateIfLetOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6717
6735
|
'if': function (astNode, helperOptions) { return calculateIfOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6718
|
-
'
|
|
6736
|
+
'if_not': function (astNode, helperOptions) { return calculateIfNotOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6719
6737
|
'let': function (astNode, helperOptions) { return calculateLetOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6720
6738
|
'loop': function (astNode, helperOptions) { return calculateLoopOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6721
|
-
'
|
|
6739
|
+
'||': function (astNode, helperOptions) { return calculateOrOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6722
6740
|
'??': function (astNode, helperOptions) { return calculateQqOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6723
6741
|
'recur': function (astNode, helperOptions) { return calculateRecurOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6724
|
-
'time!': function (astNode, helperOptions) { return calculateTimeOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6725
6742
|
'throw': function (astNode, helperOptions) { return calculateThrowOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6726
6743
|
'try': function (astNode, helperOptions) { return calculateTryOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6727
|
-
'
|
|
6728
|
-
'
|
|
6744
|
+
'when_first': function (astNode, helperOptions) { return calculateWhenFirstOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6745
|
+
'when_let': function (astNode, helperOptions) { return calculateWhenLetOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6729
6746
|
'when': function (astNode, helperOptions) { return calculateWhenOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6730
|
-
'
|
|
6747
|
+
'when_not': function (astNode, helperOptions) { return calculateWhenNotOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6731
6748
|
};
|
|
6732
6749
|
|
|
6733
|
-
function isIdempotent(normalExpressionName) {
|
|
6734
|
-
return !normalExpressionName.endsWith('!')
|
|
6735
|
-
|| normalExpressionName === 'write!';
|
|
6736
|
-
}
|
|
6737
6750
|
function calculateOutcomes(contextStack, astNodes) {
|
|
6738
6751
|
// First, we try to calculate outcomes for the whole astNodes array.
|
|
6739
6752
|
// If that fails, we try to calculate outcomes for the array without the first element.
|
|
@@ -6808,8 +6821,6 @@ function calculatePossibleAstNodes(contextStack, astNode, newIndentifiers) {
|
|
|
6808
6821
|
: undefined;
|
|
6809
6822
|
var newContextStack = newContext ? contextStack.create(newContext) : contextStack;
|
|
6810
6823
|
if (astNode.t === AstNodeType.NormalExpression) {
|
|
6811
|
-
if (astNode.n && !isIdempotent(astNode.n))
|
|
6812
|
-
throw new Error("NormalExpressionNode with name ".concat(astNode.n, " is not idempotent. Cannot calculate possible ASTs."));
|
|
6813
6824
|
return combinate(astNode.p.map(function (n) { return calculatePossibleAstNodes(newContextStack, n); }))
|
|
6814
6825
|
.map(function (p) { return (__assign(__assign({}, astNode), { p: p })); });
|
|
6815
6826
|
}
|
|
@@ -7036,13 +7047,10 @@ function fromUnaryAlgebraicToAstNode(operator, operand) {
|
|
|
7036
7047
|
var operatorName = operator[1];
|
|
7037
7048
|
switch (operatorName) {
|
|
7038
7049
|
case '+':
|
|
7039
|
-
return createNamedNormalExpressionNode('+', [operand], token);
|
|
7040
7050
|
case '-':
|
|
7041
|
-
return createNamedNormalExpressionNode('-', [operand], token);
|
|
7042
7051
|
case '!':
|
|
7043
|
-
return createNamedNormalExpressionNode('not', [operand], token);
|
|
7044
7052
|
case '~':
|
|
7045
|
-
return createNamedNormalExpressionNode(
|
|
7053
|
+
return createNamedNormalExpressionNode(operatorName, [operand], token);
|
|
7046
7054
|
/* v8 ignore next 2 */
|
|
7047
7055
|
default:
|
|
7048
7056
|
throw new Error("Unknown operator: ".concat(operatorName));
|
|
@@ -7055,64 +7063,31 @@ function fromBinaryOperatorToAstNode(operator, left, right, token) {
|
|
|
7055
7063
|
case '.':
|
|
7056
7064
|
return createAccessorNode(left, fromSymbolToStringNode(asSymbolNode(right, (_a = getTokenDebugData(token)) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo)), token);
|
|
7057
7065
|
case '**': // exponentiation
|
|
7058
|
-
return createNamedNormalExpressionNode('pow', [left, right], token);
|
|
7059
7066
|
case '*':
|
|
7060
|
-
return createNamedNormalExpressionNode('*', [left, right], token);
|
|
7061
7067
|
case '/':
|
|
7062
|
-
return createNamedNormalExpressionNode('/', [left, right], token);
|
|
7063
7068
|
case '%':
|
|
7064
|
-
return createNamedNormalExpressionNode('rem', [left, right], token);
|
|
7065
7069
|
case '+':
|
|
7066
|
-
return createNamedNormalExpressionNode('+', [left, right], token);
|
|
7067
7070
|
case '-':
|
|
7068
|
-
return createNamedNormalExpressionNode('-', [left, right], token);
|
|
7069
7071
|
case '<<':
|
|
7070
|
-
return createNamedNormalExpressionNode('bit-shift-left', [left, right], token);
|
|
7071
7072
|
case '>>':
|
|
7072
|
-
return createNamedNormalExpressionNode('bit-shift-right', [left, right], token);
|
|
7073
7073
|
case '>>>':
|
|
7074
|
-
|
|
7075
|
-
case '++': {
|
|
7076
|
-
var leftString = createNamedNormalExpressionNode('str', [left], token);
|
|
7077
|
-
var rightString = createNamedNormalExpressionNode('str', [right], token);
|
|
7078
|
-
return createNamedNormalExpressionNode('str', [leftString, rightString], token);
|
|
7079
|
-
}
|
|
7074
|
+
case '++':
|
|
7080
7075
|
case '<':
|
|
7081
|
-
return createNamedNormalExpressionNode('<', [left, right], token);
|
|
7082
7076
|
case '<=':
|
|
7083
|
-
return createNamedNormalExpressionNode('<=', [left, right], token);
|
|
7084
7077
|
case '>':
|
|
7085
|
-
return createNamedNormalExpressionNode('>', [left, right], token);
|
|
7086
7078
|
case '>=':
|
|
7087
|
-
return createNamedNormalExpressionNode('>=', [left, right], token);
|
|
7088
7079
|
case '==':
|
|
7089
|
-
return createNamedNormalExpressionNode('=', [left, right], token);
|
|
7090
7080
|
case '!=':
|
|
7091
|
-
return createNamedNormalExpressionNode('!=', [left, right], token);
|
|
7092
7081
|
case '&':
|
|
7093
|
-
return createNamedNormalExpressionNode('bit-and', [left, right], token);
|
|
7094
7082
|
case '^':
|
|
7095
|
-
return createNamedNormalExpressionNode('bit-xor', [left, right], token);
|
|
7096
7083
|
case '|':
|
|
7097
|
-
return createNamedNormalExpressionNode(
|
|
7084
|
+
return createNamedNormalExpressionNode(operatorName, [left, right], token);
|
|
7098
7085
|
case '&&':
|
|
7099
|
-
return {
|
|
7100
|
-
t: AstNodeType.SpecialExpression,
|
|
7101
|
-
n: 'and',
|
|
7102
|
-
p: [left, right],
|
|
7103
|
-
token: getTokenDebugData(token) && token,
|
|
7104
|
-
};
|
|
7105
7086
|
case '||':
|
|
7106
|
-
return {
|
|
7107
|
-
t: AstNodeType.SpecialExpression,
|
|
7108
|
-
n: 'or',
|
|
7109
|
-
p: [left, right],
|
|
7110
|
-
token: getTokenDebugData(token) && token,
|
|
7111
|
-
};
|
|
7112
7087
|
case '??':
|
|
7113
7088
|
return {
|
|
7114
7089
|
t: AstNodeType.SpecialExpression,
|
|
7115
|
-
n:
|
|
7090
|
+
n: operatorName,
|
|
7116
7091
|
p: [left, right],
|
|
7117
7092
|
token: getTokenDebugData(token) && token,
|
|
7118
7093
|
};
|
|
@@ -7155,15 +7130,34 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7155
7130
|
if (isA_SymbolToken(firstToken) && firstToken[1] === 'def') {
|
|
7156
7131
|
return this.parseDef(firstToken);
|
|
7157
7132
|
}
|
|
7158
|
-
if (isA_SymbolToken(firstToken) && firstToken[1] === 'defn') {
|
|
7133
|
+
else if (isA_SymbolToken(firstToken) && firstToken[1] === 'defn') {
|
|
7159
7134
|
return this.parseDefn(firstToken);
|
|
7160
7135
|
}
|
|
7161
|
-
var left
|
|
7136
|
+
var left;
|
|
7137
|
+
if (isA_SymbolToken(firstToken) && firstToken[1] === 'if') {
|
|
7138
|
+
left = this.parseIf(firstToken);
|
|
7139
|
+
}
|
|
7140
|
+
else if (isA_SymbolToken(firstToken) && firstToken[1] === 'cond') {
|
|
7141
|
+
left = this.parseCond(firstToken);
|
|
7142
|
+
}
|
|
7143
|
+
else if (isA_SymbolToken(firstToken) && firstToken[1] === 'switch') {
|
|
7144
|
+
left = this.parseSwitch(firstToken);
|
|
7145
|
+
}
|
|
7146
|
+
else if (isA_SymbolToken(firstToken) && firstToken[1] === 'for') {
|
|
7147
|
+
left = this.parseFor(firstToken);
|
|
7148
|
+
}
|
|
7149
|
+
else {
|
|
7150
|
+
left = this.parseOperand();
|
|
7151
|
+
}
|
|
7162
7152
|
var operator = this.peek();
|
|
7163
7153
|
while (!this.isAtEnd()
|
|
7164
7154
|
&& !isA_OperatorToken(operator, ',')
|
|
7165
7155
|
&& !isA_OperatorToken(operator, ';')
|
|
7166
7156
|
&& !isRBracketToken(operator)
|
|
7157
|
+
&& !isA_ReservedSymbolToken(operator, 'else')
|
|
7158
|
+
&& !isA_ReservedSymbolToken(operator, 'then')
|
|
7159
|
+
&& !isA_ReservedSymbolToken(operator, 'end')
|
|
7160
|
+
&& !isA_ReservedSymbolToken(operator, 'case')
|
|
7167
7161
|
&& !isRParenToken(operator)) {
|
|
7168
7162
|
if (isA_BinaryOperatorToken(operator)) {
|
|
7169
7163
|
var name_1 = operator[1];
|
|
@@ -7395,9 +7389,6 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7395
7389
|
var _a, _b;
|
|
7396
7390
|
var isNamedFunction = symbol.t === AstNodeType.Symbol;
|
|
7397
7391
|
this.advance();
|
|
7398
|
-
if (isNamedFunction && symbol.v === 'for') {
|
|
7399
|
-
return this.parseFor(symbol);
|
|
7400
|
-
}
|
|
7401
7392
|
var params = [];
|
|
7402
7393
|
while (!this.isAtEnd() && !isRParenToken(this.peek())) {
|
|
7403
7394
|
params.push(this.parseExpression());
|
|
@@ -7418,17 +7409,14 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7418
7409
|
var name_2 = symbol.v;
|
|
7419
7410
|
switch (name_2) {
|
|
7420
7411
|
case '??':
|
|
7421
|
-
case '
|
|
7412
|
+
case '&&':
|
|
7422
7413
|
case 'comment':
|
|
7423
|
-
case 'cond':
|
|
7424
7414
|
case 'declared?':
|
|
7425
|
-
case '
|
|
7426
|
-
case '
|
|
7427
|
-
case 'or':
|
|
7415
|
+
case 'if_not':
|
|
7416
|
+
case '||':
|
|
7428
7417
|
case 'when':
|
|
7429
|
-
case '
|
|
7418
|
+
case 'when_not':
|
|
7430
7419
|
case 'do':
|
|
7431
|
-
case 'time!':
|
|
7432
7420
|
case 'throw': {
|
|
7433
7421
|
var node = {
|
|
7434
7422
|
t: AstNodeType.SpecialExpression,
|
|
@@ -7442,9 +7430,9 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7442
7430
|
case 'let':
|
|
7443
7431
|
return this.parseLet(symbol, params);
|
|
7444
7432
|
case 'defs':
|
|
7445
|
-
case '
|
|
7446
|
-
case '
|
|
7447
|
-
case '
|
|
7433
|
+
case 'if_let':
|
|
7434
|
+
case 'when_let':
|
|
7435
|
+
case 'when_first':
|
|
7448
7436
|
case 'fn':
|
|
7449
7437
|
case 'defns':
|
|
7450
7438
|
case 'try':
|
|
@@ -7641,38 +7629,39 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7641
7629
|
}),
|
|
7642
7630
|
};
|
|
7643
7631
|
};
|
|
7644
|
-
AlgebraicParser.prototype.parseFor = function (
|
|
7632
|
+
AlgebraicParser.prototype.parseFor = function (token) {
|
|
7633
|
+
this.advance();
|
|
7634
|
+
assertLParenToken(this.peek());
|
|
7635
|
+
this.advance();
|
|
7645
7636
|
var forLoopBindings = [
|
|
7646
7637
|
this.parseForLoopBinding(),
|
|
7647
7638
|
];
|
|
7648
|
-
|
|
7649
|
-
while (isA_SymbolToken(nextToken) && nextToken[1] === 'of') {
|
|
7639
|
+
while (!this.isAtEnd() && !isRParenToken(this.peek())) {
|
|
7650
7640
|
forLoopBindings.push(this.parseForLoopBinding());
|
|
7651
|
-
|
|
7641
|
+
if (isA_OperatorToken(this.peek(), ',')) {
|
|
7642
|
+
this.advance();
|
|
7643
|
+
}
|
|
7652
7644
|
}
|
|
7653
|
-
var expression = this.parseExpression();
|
|
7654
7645
|
assertRParenToken(this.peek());
|
|
7655
7646
|
this.advance();
|
|
7647
|
+
var expression = this.parseExpression();
|
|
7648
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7649
|
+
this.advance();
|
|
7656
7650
|
return {
|
|
7657
7651
|
t: AstNodeType.SpecialExpression,
|
|
7658
7652
|
n: 'for',
|
|
7659
7653
|
p: [expression],
|
|
7660
|
-
token: getTokenDebugData(
|
|
7654
|
+
token: getTokenDebugData(token) && token,
|
|
7661
7655
|
l: forLoopBindings,
|
|
7662
7656
|
};
|
|
7663
7657
|
};
|
|
7664
|
-
// export interface LoopBindingNode {
|
|
7665
|
-
// b: BindingNode // Binding
|
|
7666
|
-
// m: Array<'&let' | '&when' | '&while'> // Modifiers
|
|
7667
|
-
// l?: BindingNode[] // Let-Bindings
|
|
7668
|
-
// wn?: AstNode // When Node
|
|
7669
|
-
// we?: AstNode // While Node
|
|
7670
|
-
// }
|
|
7671
7658
|
AlgebraicParser.prototype.parseForLoopBinding = function () {
|
|
7672
7659
|
var _a;
|
|
7673
7660
|
var bindingNode = this.parseBinding();
|
|
7674
|
-
if (isA_OperatorToken(this.peek(), ',')) {
|
|
7675
|
-
this.
|
|
7661
|
+
if (isRParenToken(this.peek()) || isA_OperatorToken(this.peek(), ',')) {
|
|
7662
|
+
if (isA_OperatorToken(this.peek(), ',')) {
|
|
7663
|
+
this.advance();
|
|
7664
|
+
}
|
|
7676
7665
|
return {
|
|
7677
7666
|
b: bindingNode,
|
|
7678
7667
|
m: [],
|
|
@@ -7718,8 +7707,9 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7718
7707
|
}
|
|
7719
7708
|
token = this.peek();
|
|
7720
7709
|
}
|
|
7721
|
-
|
|
7722
|
-
|
|
7710
|
+
if (isA_OperatorToken(token, ',')) {
|
|
7711
|
+
this.advance();
|
|
7712
|
+
}
|
|
7723
7713
|
return {
|
|
7724
7714
|
b: bindingNode,
|
|
7725
7715
|
m: modifiers,
|
|
@@ -7748,6 +7738,140 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7748
7738
|
};
|
|
7749
7739
|
return node;
|
|
7750
7740
|
};
|
|
7741
|
+
AlgebraicParser.prototype.parseIf = function (token) {
|
|
7742
|
+
this.advance();
|
|
7743
|
+
var condition = this.parseExpression();
|
|
7744
|
+
assertA_ReservedSymbolToken(this.peek(), 'then');
|
|
7745
|
+
this.advance();
|
|
7746
|
+
var thenExpressions = [];
|
|
7747
|
+
while (!this.isAtEnd()
|
|
7748
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'else')
|
|
7749
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7750
|
+
thenExpressions.push(this.parseExpression());
|
|
7751
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7752
|
+
this.advance();
|
|
7753
|
+
}
|
|
7754
|
+
}
|
|
7755
|
+
var thenExpression = thenExpressions.length === 1
|
|
7756
|
+
? thenExpressions[0]
|
|
7757
|
+
: {
|
|
7758
|
+
t: AstNodeType.SpecialExpression,
|
|
7759
|
+
n: 'do',
|
|
7760
|
+
p: thenExpressions,
|
|
7761
|
+
token: getTokenDebugData(token) && token,
|
|
7762
|
+
};
|
|
7763
|
+
var elseExpression;
|
|
7764
|
+
if (isA_ReservedSymbolToken(this.peek(), 'else')) {
|
|
7765
|
+
this.advance();
|
|
7766
|
+
var elseExpressions = [];
|
|
7767
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7768
|
+
elseExpressions.push(this.parseExpression());
|
|
7769
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7770
|
+
this.advance();
|
|
7771
|
+
}
|
|
7772
|
+
}
|
|
7773
|
+
elseExpression = elseExpressions.length === 1
|
|
7774
|
+
? elseExpressions[0]
|
|
7775
|
+
: {
|
|
7776
|
+
t: AstNodeType.SpecialExpression,
|
|
7777
|
+
n: 'do',
|
|
7778
|
+
p: elseExpressions,
|
|
7779
|
+
token: getTokenDebugData(token) && token,
|
|
7780
|
+
};
|
|
7781
|
+
}
|
|
7782
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7783
|
+
this.advance();
|
|
7784
|
+
var params = [condition, thenExpression];
|
|
7785
|
+
if (elseExpression) {
|
|
7786
|
+
params.push(elseExpression);
|
|
7787
|
+
}
|
|
7788
|
+
return {
|
|
7789
|
+
t: AstNodeType.SpecialExpression,
|
|
7790
|
+
n: 'if',
|
|
7791
|
+
p: params,
|
|
7792
|
+
token: getTokenDebugData(token) && token,
|
|
7793
|
+
};
|
|
7794
|
+
};
|
|
7795
|
+
AlgebraicParser.prototype.parseCond = function (token) {
|
|
7796
|
+
this.advance();
|
|
7797
|
+
var params = [];
|
|
7798
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7799
|
+
assertA_ReservedSymbolToken(this.peek(), 'case');
|
|
7800
|
+
this.advance();
|
|
7801
|
+
params.push(this.parseExpression());
|
|
7802
|
+
assertA_ReservedSymbolToken(this.peek(), 'then');
|
|
7803
|
+
this.advance();
|
|
7804
|
+
var expressions = [];
|
|
7805
|
+
while (!this.isAtEnd()
|
|
7806
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'case')
|
|
7807
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7808
|
+
expressions.push(this.parseExpression());
|
|
7809
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7810
|
+
this.advance();
|
|
7811
|
+
}
|
|
7812
|
+
}
|
|
7813
|
+
params.push(expressions.length === 1
|
|
7814
|
+
? expressions[0]
|
|
7815
|
+
: {
|
|
7816
|
+
t: AstNodeType.SpecialExpression,
|
|
7817
|
+
n: 'do',
|
|
7818
|
+
p: expressions,
|
|
7819
|
+
token: getTokenDebugData(token) && token,
|
|
7820
|
+
});
|
|
7821
|
+
if (isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7822
|
+
break;
|
|
7823
|
+
}
|
|
7824
|
+
assertA_ReservedSymbolToken(this.peek(), 'case');
|
|
7825
|
+
}
|
|
7826
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7827
|
+
this.advance();
|
|
7828
|
+
return {
|
|
7829
|
+
t: AstNodeType.SpecialExpression,
|
|
7830
|
+
n: 'cond',
|
|
7831
|
+
p: params,
|
|
7832
|
+
token: getTokenDebugData(token) && token,
|
|
7833
|
+
};
|
|
7834
|
+
};
|
|
7835
|
+
AlgebraicParser.prototype.parseSwitch = function (token) {
|
|
7836
|
+
this.advance();
|
|
7837
|
+
var params = [this.parseExpression()];
|
|
7838
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7839
|
+
assertA_ReservedSymbolToken(this.peek(), 'case');
|
|
7840
|
+
this.advance();
|
|
7841
|
+
params.push(this.parseExpression());
|
|
7842
|
+
assertA_ReservedSymbolToken(this.peek(), 'then');
|
|
7843
|
+
this.advance();
|
|
7844
|
+
var expressions = [];
|
|
7845
|
+
while (!this.isAtEnd()
|
|
7846
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'case')
|
|
7847
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7848
|
+
expressions.push(this.parseExpression());
|
|
7849
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7850
|
+
this.advance();
|
|
7851
|
+
}
|
|
7852
|
+
}
|
|
7853
|
+
params.push(expressions.length === 1
|
|
7854
|
+
? expressions[0]
|
|
7855
|
+
: {
|
|
7856
|
+
t: AstNodeType.SpecialExpression,
|
|
7857
|
+
n: 'do',
|
|
7858
|
+
p: expressions,
|
|
7859
|
+
token: getTokenDebugData(token) && token,
|
|
7860
|
+
});
|
|
7861
|
+
if (isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7862
|
+
break;
|
|
7863
|
+
}
|
|
7864
|
+
assertA_ReservedSymbolToken(this.peek(), 'case');
|
|
7865
|
+
}
|
|
7866
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7867
|
+
this.advance();
|
|
7868
|
+
return {
|
|
7869
|
+
t: AstNodeType.SpecialExpression,
|
|
7870
|
+
n: 'switch',
|
|
7871
|
+
p: params,
|
|
7872
|
+
token: getTokenDebugData(token) && token,
|
|
7873
|
+
};
|
|
7874
|
+
};
|
|
7751
7875
|
AlgebraicParser.prototype.parseDef = function (token) {
|
|
7752
7876
|
this.advance();
|
|
7753
7877
|
var symbol = parseSymbol(this.tokenStream, this.parseState);
|
|
@@ -7762,22 +7886,17 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7762
7886
|
};
|
|
7763
7887
|
};
|
|
7764
7888
|
AlgebraicParser.prototype.parseDefn = function (token) {
|
|
7765
|
-
var _a;
|
|
7766
7889
|
this.advance();
|
|
7767
7890
|
var symbol = parseSymbol(this.tokenStream, this.parseState);
|
|
7768
|
-
var
|
|
7769
|
-
assertLBraceToken(this.peek());
|
|
7770
|
-
this.advance();
|
|
7891
|
+
var _a = this.parseFunctionArguments(), functionArguments = _a.functionArguments, arity = _a.arity;
|
|
7771
7892
|
var body = [];
|
|
7772
|
-
while (!this.isAtEnd() && !
|
|
7893
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7773
7894
|
body.push(this.parseExpression());
|
|
7774
7895
|
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7775
7896
|
this.advance();
|
|
7776
7897
|
}
|
|
7777
7898
|
}
|
|
7778
|
-
|
|
7779
|
-
throw new LitsError('Expected closing brace', (_a = getTokenDebugData(this.peek())) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
|
|
7780
|
-
}
|
|
7899
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7781
7900
|
this.advance();
|
|
7782
7901
|
return {
|
|
7783
7902
|
t: AstNodeType.SpecialExpression,
|
|
@@ -7798,9 +7917,6 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7798
7917
|
AlgebraicParser.prototype.peek = function () {
|
|
7799
7918
|
return this.tokenStream.tokens[this.parseState.position];
|
|
7800
7919
|
};
|
|
7801
|
-
AlgebraicParser.prototype.peekAhead = function () {
|
|
7802
|
-
return this.tokenStream.tokens[this.parseState.position + 1];
|
|
7803
|
-
};
|
|
7804
7920
|
return AlgebraicParser;
|
|
7805
7921
|
}());
|
|
7806
7922
|
|
|
@@ -8173,8 +8289,8 @@ function parseToken(tokenStream, parseState) {
|
|
|
8173
8289
|
return parsePolishToken(tokenStream, parseState);
|
|
8174
8290
|
}
|
|
8175
8291
|
|
|
8176
|
-
var polishIdentifierCharacterClass = '[\\w
|
|
8177
|
-
var polishIdentifierFirstCharacterClass = '[a-zA-Z_
|
|
8292
|
+
var polishIdentifierCharacterClass = '[\\w@%^?=!$<>+*/:&\|~-]';
|
|
8293
|
+
var polishIdentifierFirstCharacterClass = '[a-zA-Z_@%^?=!$<>+*/&\|~-]';
|
|
8178
8294
|
var algebraicIdentifierCharacterClass = '[\\w$:!?]';
|
|
8179
8295
|
var algebraicIdentifierFirstCharacterClass = '[a-zA-Z_$]';
|
|
8180
8296
|
|
|
@@ -8254,22 +8370,28 @@ var commonTokenizers = [
|
|
|
8254
8370
|
tokenizeString,
|
|
8255
8371
|
];
|
|
8256
8372
|
|
|
8257
|
-
var
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
'defns': { value: null, forbidden: true },
|
|
8267
|
-
'try': { value: null, forbidden: true },
|
|
8268
|
-
'recur': { value: null, forbidden: true },
|
|
8269
|
-
'loop': { value: null, forbidden: true },
|
|
8270
|
-
'time!': { value: null, forbidden: true },
|
|
8271
|
-
'doseq': { value: null, forbidden: true },
|
|
8373
|
+
var validAlgebraicReservedNamesRecord = {
|
|
8374
|
+
true: { value: true, forbidden: false },
|
|
8375
|
+
false: { value: false, forbidden: false },
|
|
8376
|
+
nil: { value: null, forbidden: false },
|
|
8377
|
+
null: { value: null, forbidden: false },
|
|
8378
|
+
then: { value: null, forbidden: false },
|
|
8379
|
+
else: { value: null, forbidden: false },
|
|
8380
|
+
end: { value: null, forbidden: false },
|
|
8381
|
+
case: { value: null, forbidden: false },
|
|
8272
8382
|
};
|
|
8383
|
+
var forbiddenAlgebraicReservedNamesRecord = {
|
|
8384
|
+
if_let: { value: null, forbidden: true },
|
|
8385
|
+
when_let: { value: null, forbidden: true },
|
|
8386
|
+
when_first: { value: null, forbidden: true },
|
|
8387
|
+
fn: { value: null, forbidden: true },
|
|
8388
|
+
defns: { value: null, forbidden: true },
|
|
8389
|
+
try: { value: null, forbidden: true },
|
|
8390
|
+
recur: { value: null, forbidden: true },
|
|
8391
|
+
loop: { value: null, forbidden: true },
|
|
8392
|
+
doseq: { value: null, forbidden: true },
|
|
8393
|
+
};
|
|
8394
|
+
var algebraicReservedNamesRecord = __assign(__assign({}, validAlgebraicReservedNamesRecord), forbiddenAlgebraicReservedNamesRecord);
|
|
8273
8395
|
|
|
8274
8396
|
var identifierRegExp = new RegExp(algebraicIdentifierCharacterClass);
|
|
8275
8397
|
var identifierFirstCharacterRegExp = new RegExp(algebraicIdentifierFirstCharacterClass);
|
|
@@ -8341,45 +8463,19 @@ var tokenizeA_BasePrefixedNumber = function (input, position) {
|
|
|
8341
8463
|
}
|
|
8342
8464
|
return [length, ['A_BasePrefixedNumber', input.substring(position, i)]];
|
|
8343
8465
|
};
|
|
8344
|
-
var tokenizeA_ReservedSymbolToken = function (input, position) {
|
|
8345
|
-
var e_1, _a;
|
|
8346
|
-
try {
|
|
8347
|
-
for (var _b = __values(Object.entries(algebraicReservedNamesRecord)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
8348
|
-
var _d = __read(_c.value, 2), reservedName = _d[0], forbidden = _d[1].forbidden;
|
|
8349
|
-
var length_1 = reservedName.length;
|
|
8350
|
-
var nextChar = input[position + length_1];
|
|
8351
|
-
if (nextChar && identifierRegExp.test(nextChar))
|
|
8352
|
-
continue;
|
|
8353
|
-
var name_1 = input.substring(position, position + length_1);
|
|
8354
|
-
if (name_1 === reservedName) {
|
|
8355
|
-
if (forbidden)
|
|
8356
|
-
throw new LitsError("".concat(name_1, " is forbidden!"), undefined);
|
|
8357
|
-
return [length_1, ['A_ReservedSymbol', reservedName]];
|
|
8358
|
-
}
|
|
8359
|
-
}
|
|
8360
|
-
}
|
|
8361
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
8362
|
-
finally {
|
|
8363
|
-
try {
|
|
8364
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
8365
|
-
}
|
|
8366
|
-
finally { if (e_1) throw e_1.error; }
|
|
8367
|
-
}
|
|
8368
|
-
return NO_MATCH;
|
|
8369
|
-
};
|
|
8370
8466
|
var tokenizeA_Symbol = function (input, position) {
|
|
8371
8467
|
var value = input[position];
|
|
8372
8468
|
if (!value) {
|
|
8373
8469
|
return NO_MATCH;
|
|
8374
8470
|
}
|
|
8375
8471
|
if (value === '\'') {
|
|
8376
|
-
var
|
|
8377
|
-
var char = input[position +
|
|
8472
|
+
var length_1 = 1;
|
|
8473
|
+
var char = input[position + length_1];
|
|
8378
8474
|
var escaping = false;
|
|
8379
8475
|
while (char !== '\'' || escaping) {
|
|
8380
8476
|
if (char === undefined)
|
|
8381
8477
|
throw new LitsError("Unclosed string at position ".concat(position, "."), undefined);
|
|
8382
|
-
|
|
8478
|
+
length_1 += 1;
|
|
8383
8479
|
if (escaping) {
|
|
8384
8480
|
escaping = false;
|
|
8385
8481
|
value += char;
|
|
@@ -8390,10 +8486,10 @@ var tokenizeA_Symbol = function (input, position) {
|
|
|
8390
8486
|
}
|
|
8391
8487
|
value += char;
|
|
8392
8488
|
}
|
|
8393
|
-
char = input[position +
|
|
8489
|
+
char = input[position + length_1];
|
|
8394
8490
|
}
|
|
8395
8491
|
value += '\''; // closing quote
|
|
8396
|
-
return [
|
|
8492
|
+
return [length_1 + 1, ['A_Symbol', value]];
|
|
8397
8493
|
}
|
|
8398
8494
|
if (identifierFirstCharacterRegExp.test(value)) {
|
|
8399
8495
|
var initialPosition = position;
|
|
@@ -8408,6 +8504,22 @@ var tokenizeA_Symbol = function (input, position) {
|
|
|
8408
8504
|
}
|
|
8409
8505
|
return NO_MATCH;
|
|
8410
8506
|
};
|
|
8507
|
+
var tokenizeA_ReservedSymbolToken = function (input, position) {
|
|
8508
|
+
var symbolMeta = tokenizeA_Symbol(input, position);
|
|
8509
|
+
if (symbolMeta[0] === 0 || !symbolMeta[1]) {
|
|
8510
|
+
return NO_MATCH;
|
|
8511
|
+
}
|
|
8512
|
+
var symbolName = symbolMeta[1][1];
|
|
8513
|
+
symbolName = symbolName.startsWith('\'') ? symbolName.slice(1, symbolName.length - 1) : symbolName;
|
|
8514
|
+
var info = algebraicReservedNamesRecord[symbolName];
|
|
8515
|
+
if (!info) {
|
|
8516
|
+
return NO_MATCH;
|
|
8517
|
+
}
|
|
8518
|
+
if (info.forbidden) {
|
|
8519
|
+
throw new LitsError("".concat(symbolName, " is forbidden!"), undefined);
|
|
8520
|
+
}
|
|
8521
|
+
return [symbolMeta[0], ['A_ReservedSymbol', symbolName]];
|
|
8522
|
+
};
|
|
8411
8523
|
var tokenizeA_Operator = function (input, position) {
|
|
8412
8524
|
var _a;
|
|
8413
8525
|
var threeChars = input.slice(position, position + 3);
|
|
@@ -8426,30 +8538,30 @@ var tokenizeA_Operator = function (input, position) {
|
|
|
8426
8538
|
};
|
|
8427
8539
|
var tokenizeA_MultiLineComment = function (input, position) {
|
|
8428
8540
|
if (input[position] === '/' && input[position + 1] === '*') {
|
|
8429
|
-
var
|
|
8541
|
+
var length_2 = 2;
|
|
8430
8542
|
var value = '/*';
|
|
8431
|
-
while (input[position +
|
|
8432
|
-
value += input[position +
|
|
8433
|
-
|
|
8543
|
+
while (input[position + length_2] !== '*' && input[position + length_2 + 1] !== '/' && position + length_2 + 1 < input.length) {
|
|
8544
|
+
value += input[position + length_2];
|
|
8545
|
+
length_2 += 1;
|
|
8434
8546
|
}
|
|
8435
|
-
if (position +
|
|
8547
|
+
if (position + length_2 + 1 >= input.length) {
|
|
8436
8548
|
throw new LitsError('Comment not closed', undefined);
|
|
8437
8549
|
}
|
|
8438
8550
|
value += '*/';
|
|
8439
|
-
|
|
8440
|
-
return [
|
|
8551
|
+
length_2 += 2;
|
|
8552
|
+
return [length_2, ['A_MultiLineComment', value]];
|
|
8441
8553
|
}
|
|
8442
8554
|
return NO_MATCH;
|
|
8443
8555
|
};
|
|
8444
8556
|
var tokenizeA_SingleLineComment = function (input, position) {
|
|
8445
8557
|
if (input[position] === '/' && input[position + 1] === '/') {
|
|
8446
|
-
var
|
|
8558
|
+
var length_3 = 2;
|
|
8447
8559
|
var value = '//';
|
|
8448
|
-
while (input[position +
|
|
8449
|
-
value += input[position +
|
|
8450
|
-
|
|
8560
|
+
while (input[position + length_3] !== '\n' && position + length_3 < input.length) {
|
|
8561
|
+
value += input[position + length_3];
|
|
8562
|
+
length_3 += 1;
|
|
8451
8563
|
}
|
|
8452
|
-
return [
|
|
8564
|
+
return [length_3, ['A_SingleLineComment', value]];
|
|
8453
8565
|
}
|
|
8454
8566
|
return NO_MATCH;
|
|
8455
8567
|
};
|
|
@@ -8609,31 +8721,20 @@ var tokenizeP_FnShorthand = function (input, position) {
|
|
|
8609
8721
|
return [1, ['P_FnShorthand']];
|
|
8610
8722
|
};
|
|
8611
8723
|
var tokenizeP_ReservedSymbol = function (input, position) {
|
|
8612
|
-
var
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
var _d = __read(_c.value, 2), reservedName = _d[0], forbidden = _d[1].forbidden;
|
|
8616
|
-
var length_3 = reservedName.length;
|
|
8617
|
-
var nextChar = input[position + length_3];
|
|
8618
|
-
if (nextChar && P_symbolRegExp.test(nextChar)) {
|
|
8619
|
-
continue;
|
|
8620
|
-
}
|
|
8621
|
-
var symbol = input.substring(position, position + length_3);
|
|
8622
|
-
if (symbol === reservedName) {
|
|
8623
|
-
if (forbidden)
|
|
8624
|
-
throw new LitsError("".concat(symbol, " is forbidden!"), undefined);
|
|
8625
|
-
return [length_3, ['P_ReservedSymbol', reservedName]];
|
|
8626
|
-
}
|
|
8627
|
-
}
|
|
8724
|
+
var symbolMeta = tokenizeP_Symbol(input, position);
|
|
8725
|
+
if (symbolMeta[0] === 0 || !symbolMeta[1]) {
|
|
8726
|
+
return NO_MATCH;
|
|
8628
8727
|
}
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
finally { if (e_1) throw e_1.error; }
|
|
8728
|
+
var symbolName = symbolMeta[1][1];
|
|
8729
|
+
symbolName = symbolName.startsWith('\'') ? symbolName.slice(1, symbolName.length - 1) : symbolName;
|
|
8730
|
+
var info = polishReservedNamesRecord[symbolName];
|
|
8731
|
+
if (!info) {
|
|
8732
|
+
return NO_MATCH;
|
|
8635
8733
|
}
|
|
8636
|
-
|
|
8734
|
+
if (info.forbidden) {
|
|
8735
|
+
throw new LitsError("".concat(symbolName, " is forbidden!"), undefined);
|
|
8736
|
+
}
|
|
8737
|
+
return [symbolMeta[0], ['P_ReservedSymbol', symbolName]];
|
|
8637
8738
|
};
|
|
8638
8739
|
var tokenizeP_StringShorthand = function (input, position) {
|
|
8639
8740
|
if (input[position] !== ':')
|
|
@@ -8646,24 +8747,24 @@ var tokenizeP_StringShorthand = function (input, position) {
|
|
|
8646
8747
|
return [symbolDescription[0] + 1, ['P_StringShorthand', ":".concat(symbolToken[1])]];
|
|
8647
8748
|
};
|
|
8648
8749
|
var tokenizeP_Modifier = function (input, position) {
|
|
8649
|
-
var
|
|
8750
|
+
var e_1, _a;
|
|
8650
8751
|
try {
|
|
8651
8752
|
for (var modifierNames_1 = __values(modifierNames), modifierNames_1_1 = modifierNames_1.next(); !modifierNames_1_1.done; modifierNames_1_1 = modifierNames_1.next()) {
|
|
8652
8753
|
var modifierName = modifierNames_1_1.value;
|
|
8653
|
-
var
|
|
8654
|
-
var charAfterModifier = input[position +
|
|
8655
|
-
if (input.substring(position, position +
|
|
8754
|
+
var length_3 = modifierName.length;
|
|
8755
|
+
var charAfterModifier = input[position + length_3];
|
|
8756
|
+
if (input.substring(position, position + length_3) === modifierName && (!charAfterModifier || !P_symbolRegExp.test(charAfterModifier))) {
|
|
8656
8757
|
var value = modifierName;
|
|
8657
|
-
return [
|
|
8758
|
+
return [length_3, ['P_Modifier', value]];
|
|
8658
8759
|
}
|
|
8659
8760
|
}
|
|
8660
8761
|
}
|
|
8661
|
-
catch (
|
|
8762
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
8662
8763
|
finally {
|
|
8663
8764
|
try {
|
|
8664
8765
|
if (modifierNames_1_1 && !modifierNames_1_1.done && (_a = modifierNames_1.return)) _a.call(modifierNames_1);
|
|
8665
8766
|
}
|
|
8666
|
-
finally { if (
|
|
8767
|
+
finally { if (e_1) throw e_1.error; }
|
|
8667
8768
|
}
|
|
8668
8769
|
return NO_MATCH;
|
|
8669
8770
|
};
|
|
@@ -8700,8 +8801,8 @@ var polishTokenizers = __spreadArray(__spreadArray([
|
|
|
8700
8801
|
tokenizeP_StringShorthand,
|
|
8701
8802
|
tokenizeP_Number,
|
|
8702
8803
|
tokenizeP_ReservedSymbol,
|
|
8703
|
-
tokenizeP_Symbol,
|
|
8704
8804
|
tokenizeP_Modifier,
|
|
8805
|
+
tokenizeP_Symbol,
|
|
8705
8806
|
tokenizeP_RegexpShorthand,
|
|
8706
8807
|
tokenizeP_FnShorthand,
|
|
8707
8808
|
tokenizeP_CollectionAccessor,
|
|
@@ -9109,7 +9210,7 @@ var collectionReference = {
|
|
|
9109
9210
|
},
|
|
9110
9211
|
args: {
|
|
9111
9212
|
coll: {
|
|
9112
|
-
type: ['collection', 'string', '
|
|
9213
|
+
type: ['collection', 'string', 'null'],
|
|
9113
9214
|
},
|
|
9114
9215
|
},
|
|
9115
9216
|
variants: [
|
|
@@ -9198,7 +9299,7 @@ var collectionReference = {
|
|
|
9198
9299
|
},
|
|
9199
9300
|
args: {
|
|
9200
9301
|
coll: {
|
|
9201
|
-
type: ['collection', '
|
|
9302
|
+
type: ['collection', 'null'],
|
|
9202
9303
|
},
|
|
9203
9304
|
key: {
|
|
9204
9305
|
type: ['string', 'number'],
|
|
@@ -9226,7 +9327,7 @@ var collectionReference = {
|
|
|
9226
9327
|
},
|
|
9227
9328
|
args: {
|
|
9228
9329
|
coll: {
|
|
9229
|
-
type: ['collection', '
|
|
9330
|
+
type: ['collection', 'null'],
|
|
9230
9331
|
},
|
|
9231
9332
|
value: {
|
|
9232
9333
|
type: ['any'],
|
|
@@ -9429,7 +9530,7 @@ var collectionReference = {
|
|
|
9429
9530
|
},
|
|
9430
9531
|
args: {
|
|
9431
9532
|
coll: {
|
|
9432
|
-
type: ['collection', '
|
|
9533
|
+
type: ['collection', 'null'],
|
|
9433
9534
|
},
|
|
9434
9535
|
},
|
|
9435
9536
|
variants: [
|
|
@@ -10030,7 +10131,7 @@ var sequenceReference = {
|
|
|
10030
10131
|
},
|
|
10031
10132
|
args: {
|
|
10032
10133
|
'seq': {
|
|
10033
|
-
type: ['sequence', '
|
|
10134
|
+
type: ['sequence', 'null'],
|
|
10034
10135
|
},
|
|
10035
10136
|
'n': {
|
|
10036
10137
|
type: 'integer',
|
|
@@ -10092,7 +10193,7 @@ var sequenceReference = {
|
|
|
10092
10193
|
category: 'Sequence',
|
|
10093
10194
|
linkName: 'pop',
|
|
10094
10195
|
returns: {
|
|
10095
|
-
type: ['sequence', '
|
|
10196
|
+
type: ['sequence', 'null'],
|
|
10096
10197
|
array: true,
|
|
10097
10198
|
},
|
|
10098
10199
|
args: {
|
|
@@ -10145,7 +10246,7 @@ var sequenceReference = {
|
|
|
10145
10246
|
linkName: 'shift',
|
|
10146
10247
|
clojureDocs: null,
|
|
10147
10248
|
returns: {
|
|
10148
|
-
type: ['sequence', '
|
|
10249
|
+
type: ['sequence', 'null'],
|
|
10149
10250
|
array: true,
|
|
10150
10251
|
},
|
|
10151
10252
|
args: {
|
|
@@ -10342,11 +10443,11 @@ var sequenceReference = {
|
|
|
10342
10443
|
linkName: 'position',
|
|
10343
10444
|
clojureDocs: null,
|
|
10344
10445
|
returns: {
|
|
10345
|
-
type: ['number', '
|
|
10446
|
+
type: ['number', 'null'],
|
|
10346
10447
|
},
|
|
10347
10448
|
args: {
|
|
10348
10449
|
seq: {
|
|
10349
|
-
type: ['sequence', '
|
|
10450
|
+
type: ['sequence', 'null'],
|
|
10350
10451
|
},
|
|
10351
10452
|
fn: {
|
|
10352
10453
|
type: 'function',
|
|
@@ -10369,11 +10470,11 @@ var sequenceReference = {
|
|
|
10369
10470
|
linkName: 'index_of',
|
|
10370
10471
|
clojureDocs: null,
|
|
10371
10472
|
returns: {
|
|
10372
|
-
type: ['number', '
|
|
10473
|
+
type: ['number', 'null'],
|
|
10373
10474
|
},
|
|
10374
10475
|
args: {
|
|
10375
10476
|
seq: {
|
|
10376
|
-
type: ['sequence', '
|
|
10477
|
+
type: ['sequence', 'null'],
|
|
10377
10478
|
},
|
|
10378
10479
|
x: {
|
|
10379
10480
|
type: 'any',
|
|
@@ -10399,7 +10500,7 @@ var sequenceReference = {
|
|
|
10399
10500
|
},
|
|
10400
10501
|
args: {
|
|
10401
10502
|
seq: {
|
|
10402
|
-
type: ['sequence', '
|
|
10503
|
+
type: ['sequence', 'null'],
|
|
10403
10504
|
},
|
|
10404
10505
|
fn: {
|
|
10405
10506
|
type: 'function',
|
|
@@ -10422,11 +10523,11 @@ var sequenceReference = {
|
|
|
10422
10523
|
category: 'Sequence',
|
|
10423
10524
|
linkName: 'reverse',
|
|
10424
10525
|
returns: {
|
|
10425
|
-
type: ['sequence', '
|
|
10526
|
+
type: ['sequence', 'null'],
|
|
10426
10527
|
},
|
|
10427
10528
|
args: {
|
|
10428
10529
|
seq: {
|
|
10429
|
-
type: ['sequence', '
|
|
10530
|
+
type: ['sequence', 'null'],
|
|
10430
10531
|
},
|
|
10431
10532
|
},
|
|
10432
10533
|
variants: [
|
|
@@ -10449,7 +10550,7 @@ var sequenceReference = {
|
|
|
10449
10550
|
},
|
|
10450
10551
|
args: {
|
|
10451
10552
|
seq: {
|
|
10452
|
-
type: ['sequence', '
|
|
10553
|
+
type: ['sequence', 'null'],
|
|
10453
10554
|
},
|
|
10454
10555
|
},
|
|
10455
10556
|
variants: [
|
|
@@ -10471,7 +10572,7 @@ var sequenceReference = {
|
|
|
10471
10572
|
},
|
|
10472
10573
|
args: {
|
|
10473
10574
|
seq: {
|
|
10474
|
-
type: ['sequence', '
|
|
10575
|
+
type: ['sequence', 'null'],
|
|
10475
10576
|
},
|
|
10476
10577
|
},
|
|
10477
10578
|
variants: [
|
|
@@ -10494,7 +10595,7 @@ var sequenceReference = {
|
|
|
10494
10595
|
},
|
|
10495
10596
|
args: {
|
|
10496
10597
|
seq: {
|
|
10497
|
-
type: ['sequence', '
|
|
10598
|
+
type: ['sequence', 'null'],
|
|
10498
10599
|
},
|
|
10499
10600
|
},
|
|
10500
10601
|
variants: [
|
|
@@ -10514,7 +10615,7 @@ var sequenceReference = {
|
|
|
10514
10615
|
category: 'Sequence',
|
|
10515
10616
|
linkName: 'rest',
|
|
10516
10617
|
returns: {
|
|
10517
|
-
type: ['sequence', '
|
|
10618
|
+
type: ['sequence', 'null'],
|
|
10518
10619
|
},
|
|
10519
10620
|
args: {
|
|
10520
10621
|
seq: {
|
|
@@ -10567,7 +10668,7 @@ var sequenceReference = {
|
|
|
10567
10668
|
category: 'Sequence',
|
|
10568
10669
|
linkName: 'next',
|
|
10569
10670
|
returns: {
|
|
10570
|
-
type: ['sequence', '
|
|
10671
|
+
type: ['sequence', 'null'],
|
|
10571
10672
|
},
|
|
10572
10673
|
args: {
|
|
10573
10674
|
seq: {
|
|
@@ -10592,7 +10693,7 @@ var sequenceReference = {
|
|
|
10592
10693
|
category: 'Sequence',
|
|
10593
10694
|
linkName: 'nthnext',
|
|
10594
10695
|
returns: {
|
|
10595
|
-
type: ['sequence', '
|
|
10696
|
+
type: ['sequence', 'null'],
|
|
10596
10697
|
array: true,
|
|
10597
10698
|
},
|
|
10598
10699
|
args: {
|
|
@@ -10816,7 +10917,7 @@ var sequenceReference = {
|
|
|
10816
10917
|
description: 'Returns a sorted sequence of the items in $seq, where the sort order is determined by comparing `(keyfn item)`. If no $comp is supplied, uses builtin `compare`.',
|
|
10817
10918
|
examples: [
|
|
10818
10919
|
'(sort_by ["Albert" "Mojir" "Nina"] count)',
|
|
10819
|
-
'(sort_by "Albert"
|
|
10920
|
+
'(sort_by "Albert" lower_case #(compare %2 %1))',
|
|
10820
10921
|
],
|
|
10821
10922
|
},
|
|
10822
10923
|
distinct: {
|
|
@@ -11081,7 +11182,7 @@ var sequenceReference = {
|
|
|
11081
11182
|
],
|
|
11082
11183
|
description: 'Applies $fn to each value in $seq, splitting it each time $fn returns a new value. Returns an array of sequences.',
|
|
11083
11184
|
examples: [
|
|
11084
|
-
'(partition_by [1 2 3 4 5] #(
|
|
11185
|
+
'(partition_by [1 2 3 4 5] #(== 3 %1))',
|
|
11085
11186
|
'(partition_by [1 1 1 2 2 3 3] odd?)',
|
|
11086
11187
|
'(partition_by "Leeeeeerrroyyy" identity)',
|
|
11087
11188
|
],
|
|
@@ -11187,10 +11288,11 @@ var mathReference = {
|
|
|
11187
11288
|
description: 'Modulus of `dividend` and `divisor`. Truncates toward negative infinity.',
|
|
11188
11289
|
examples: ['(mod 5 3)', '(mod 5.2 3.1)', '(mod -5 3)', '(mod 5 -3)', '(mod -5 -3)'],
|
|
11189
11290
|
},
|
|
11190
|
-
'
|
|
11191
|
-
title: '
|
|
11291
|
+
'%': {
|
|
11292
|
+
title: '%',
|
|
11192
11293
|
category: 'Math',
|
|
11193
|
-
linkName: '
|
|
11294
|
+
linkName: '-percent',
|
|
11295
|
+
clojureDocs: 'rem',
|
|
11194
11296
|
returns: {
|
|
11195
11297
|
type: 'number',
|
|
11196
11298
|
},
|
|
@@ -11206,7 +11308,7 @@ var mathReference = {
|
|
|
11206
11308
|
{ argumentNames: ['a', 'b'] },
|
|
11207
11309
|
],
|
|
11208
11310
|
description: 'Remainder of dividing `dividend` and `divisor`.',
|
|
11209
|
-
examples: ['(
|
|
11311
|
+
examples: ['(% 5 3)', '(% 5.2 3.1)', '(% -5 3)', '(% 5 -3)', '(% -5 -3)'],
|
|
11210
11312
|
},
|
|
11211
11313
|
'quot': {
|
|
11212
11314
|
title: 'quot',
|
|
@@ -11303,10 +11405,10 @@ var mathReference = {
|
|
|
11303
11405
|
description: 'Computes cube root of $x.',
|
|
11304
11406
|
examples: ['(cbrt 0)', '(cbrt 27)', '(cbrt 2)', '(cbrt 1)'],
|
|
11305
11407
|
},
|
|
11306
|
-
'
|
|
11307
|
-
title: '
|
|
11408
|
+
'**': {
|
|
11409
|
+
title: '**',
|
|
11308
11410
|
category: 'Math',
|
|
11309
|
-
linkName: '
|
|
11411
|
+
linkName: '-star-star',
|
|
11310
11412
|
clojureDocs: null,
|
|
11311
11413
|
returns: {
|
|
11312
11414
|
type: 'number',
|
|
@@ -11323,7 +11425,7 @@ var mathReference = {
|
|
|
11323
11425
|
{ argumentNames: ['a', 'b'] },
|
|
11324
11426
|
],
|
|
11325
11427
|
description: 'Computes returns $a raised to the power of $b.',
|
|
11326
|
-
examples: ['(
|
|
11428
|
+
examples: ['(** 2 3)', '(** 2 0)', '(** 2 -3)', '(** -2 3)', '(** -2 -3)'],
|
|
11327
11429
|
},
|
|
11328
11430
|
'exp': {
|
|
11329
11431
|
title: 'exp',
|
|
@@ -11693,7 +11795,7 @@ var mathReference = {
|
|
|
11693
11795
|
{ argumentNames: ['x'] },
|
|
11694
11796
|
],
|
|
11695
11797
|
description: 'Returns the base `2` logarithm of a number.',
|
|
11696
|
-
examples: ['(log2 0.01)', '(log2 (
|
|
11798
|
+
examples: ['(log2 0.01)', '(log2 (** 2 12))', '(log2 2.5)'],
|
|
11697
11799
|
},
|
|
11698
11800
|
'log10': {
|
|
11699
11801
|
title: 'log10',
|
|
@@ -11712,7 +11814,7 @@ var mathReference = {
|
|
|
11712
11814
|
{ argumentNames: ['x'] },
|
|
11713
11815
|
],
|
|
11714
11816
|
description: 'Returns the `10` logarithm of a number.',
|
|
11715
|
-
examples: ['(log10 0.01)', '(log10 (
|
|
11817
|
+
examples: ['(log10 0.01)', '(log10 (** 10 12))', '(log10 2.5)'],
|
|
11716
11818
|
},
|
|
11717
11819
|
'sin': {
|
|
11718
11820
|
title: 'sin',
|
|
@@ -11966,13 +12068,14 @@ var miscReference = {
|
|
|
11966
12068
|
{ argumentNames: ['x'] },
|
|
11967
12069
|
{ argumentNames: ['x', 'ys'] },
|
|
11968
12070
|
],
|
|
11969
|
-
description: 'Result is `true` if no two `values` are equal to each other, otherwise result is `false`. Note that only two argument version result is negation of `=` function, that is `(!= a b)` is same as `(
|
|
12071
|
+
description: 'Result is `true` if no two `values` are equal to each other, otherwise result is `false`. Note that only two argument version result is negation of `=` function, that is `(!= a b)` is same as `(! (== a b))`.',
|
|
11970
12072
|
examples: ['(!= 3)', '(!= 3 2)', '(!= :3 3)', '(!= 3 3 2)', '(!= :3 :2 :1 :0)', '(!= 0 -0)'],
|
|
11971
12073
|
},
|
|
11972
|
-
'
|
|
11973
|
-
title: '
|
|
12074
|
+
'==': {
|
|
12075
|
+
title: '==',
|
|
11974
12076
|
category: 'Misc',
|
|
11975
|
-
linkName: '-equal',
|
|
12077
|
+
linkName: '-equal-equal',
|
|
12078
|
+
clojureDocs: '=',
|
|
11976
12079
|
returns: {
|
|
11977
12080
|
type: 'boolean',
|
|
11978
12081
|
},
|
|
@@ -11990,7 +12093,7 @@ var miscReference = {
|
|
|
11990
12093
|
{ argumentNames: ['x', 'ys'] },
|
|
11991
12094
|
],
|
|
11992
12095
|
description: 'Compares `values` according to \'equal\' predicate. Result is `true` if every specified value is equal to each other, otherwise result is `false`.',
|
|
11993
|
-
examples: ['(
|
|
12096
|
+
examples: ['(== 1 1)', '(== 1.01 1)', '(== :1 1)', '(== :2 :2 :2 :2)', '(== 2 2 1 2)'],
|
|
11994
12097
|
},
|
|
11995
12098
|
'<': {
|
|
11996
12099
|
title: '<',
|
|
@@ -12084,10 +12187,11 @@ var miscReference = {
|
|
|
12084
12187
|
description: 'Returns `true` if the number $x and $ys are in non increasing order, `false` otherwise.',
|
|
12085
12188
|
examples: ['(>= 1 0)', '(>= 1.01 1)', '(>= 1 1)', '(>= 4 3 2 1)', '(>= 3 2 2 1)'],
|
|
12086
12189
|
},
|
|
12087
|
-
'
|
|
12088
|
-
title: '
|
|
12190
|
+
'!': {
|
|
12191
|
+
title: '!',
|
|
12089
12192
|
category: 'Misc',
|
|
12090
|
-
linkName: '
|
|
12193
|
+
linkName: '-exclamation',
|
|
12194
|
+
clojureDocs: 'not',
|
|
12091
12195
|
returns: {
|
|
12092
12196
|
type: 'boolean',
|
|
12093
12197
|
},
|
|
@@ -12100,7 +12204,7 @@ var miscReference = {
|
|
|
12100
12204
|
{ argumentNames: ['x'] },
|
|
12101
12205
|
],
|
|
12102
12206
|
description: 'Computes logical negation. Note that any other $x than `false`, `0`, `nil` and `\'\'` is truthy.',
|
|
12103
|
-
examples: ['(
|
|
12207
|
+
examples: ['(! 3)', '(! true)', '(! "A string")', '(! 0)', '(! false)', '(! nil)', '(! "")'],
|
|
12104
12208
|
},
|
|
12105
12209
|
'write!': {
|
|
12106
12210
|
title: 'write!',
|
|
@@ -12129,25 +12233,10 @@ var miscReference = {
|
|
|
12129
12233
|
'(write! nil true false)',
|
|
12130
12234
|
],
|
|
12131
12235
|
},
|
|
12132
|
-
'
|
|
12133
|
-
title: '
|
|
12236
|
+
'iso_date>epoch': {
|
|
12237
|
+
title: 'iso_date>epoch',
|
|
12134
12238
|
category: 'Misc',
|
|
12135
|
-
linkName: '
|
|
12136
|
-
clojureDocs: 'inst-ms',
|
|
12137
|
-
returns: {
|
|
12138
|
-
type: 'number',
|
|
12139
|
-
},
|
|
12140
|
-
args: {},
|
|
12141
|
-
variants: [
|
|
12142
|
-
{ argumentNames: [] },
|
|
12143
|
-
],
|
|
12144
|
-
description: 'Returns milliseconds elapsed since the UNIX epoch.',
|
|
12145
|
-
examples: ['(inst-ms!)'],
|
|
12146
|
-
},
|
|
12147
|
-
'iso-date-time->inst-ms': {
|
|
12148
|
-
title: 'iso-date-time->inst-ms',
|
|
12149
|
-
category: 'Misc',
|
|
12150
|
-
linkName: 'iso-date-time--gtinst-ms',
|
|
12239
|
+
linkName: 'iso_date-gtepoch',
|
|
12151
12240
|
returns: {
|
|
12152
12241
|
type: 'number',
|
|
12153
12242
|
},
|
|
@@ -12161,14 +12250,14 @@ var miscReference = {
|
|
|
12161
12250
|
],
|
|
12162
12251
|
description: 'Returns milliseconds elapsed since the UNIX epoch to `iso`.',
|
|
12163
12252
|
examples: [
|
|
12164
|
-
'(
|
|
12165
|
-
'(
|
|
12253
|
+
'(iso_date>epoch "2022-04-12T09:37:10.899Z")',
|
|
12254
|
+
'(iso_date>epoch "1980-01-01")',
|
|
12166
12255
|
],
|
|
12167
12256
|
},
|
|
12168
|
-
'
|
|
12169
|
-
title: '
|
|
12257
|
+
'epoch>iso_date': {
|
|
12258
|
+
title: 'epoch>iso_date',
|
|
12170
12259
|
category: 'Misc',
|
|
12171
|
-
linkName: '
|
|
12260
|
+
linkName: 'epoch-gtiso_date',
|
|
12172
12261
|
returns: {
|
|
12173
12262
|
type: 'string',
|
|
12174
12263
|
},
|
|
@@ -12182,8 +12271,8 @@ var miscReference = {
|
|
|
12182
12271
|
],
|
|
12183
12272
|
description: 'Returns IOS date time string from `ms` (milliseconds elapsed since the UNIX epoch).',
|
|
12184
12273
|
examples: [
|
|
12185
|
-
'(
|
|
12186
|
-
'(
|
|
12274
|
+
'(epoch>iso_date 1649756230899)',
|
|
12275
|
+
'(epoch>iso_date 0)',
|
|
12187
12276
|
],
|
|
12188
12277
|
},
|
|
12189
12278
|
'boolean': {
|
|
@@ -12239,34 +12328,6 @@ var miscReference = {
|
|
|
12239
12328
|
'(compare + -)',
|
|
12240
12329
|
],
|
|
12241
12330
|
},
|
|
12242
|
-
'lits-version!': {
|
|
12243
|
-
title: 'lits-version!',
|
|
12244
|
-
category: 'Misc',
|
|
12245
|
-
linkName: 'lits-version-exclamation',
|
|
12246
|
-
returns: {
|
|
12247
|
-
type: 'string',
|
|
12248
|
-
},
|
|
12249
|
-
args: {},
|
|
12250
|
-
variants: [
|
|
12251
|
-
{ argumentNames: [] },
|
|
12252
|
-
],
|
|
12253
|
-
description: 'Returns the lits version.',
|
|
12254
|
-
examples: ['(lits-version!)'],
|
|
12255
|
-
},
|
|
12256
|
-
'uuid!': {
|
|
12257
|
-
title: 'uuid!',
|
|
12258
|
-
category: 'Misc',
|
|
12259
|
-
linkName: 'uuid-exclamation',
|
|
12260
|
-
returns: {
|
|
12261
|
-
type: 'string',
|
|
12262
|
-
},
|
|
12263
|
-
args: {},
|
|
12264
|
-
variants: [
|
|
12265
|
-
{ argumentNames: [] },
|
|
12266
|
-
],
|
|
12267
|
-
description: 'Returns random UUID string.',
|
|
12268
|
-
examples: ['(uuid!)'],
|
|
12269
|
-
},
|
|
12270
12331
|
'equal?': {
|
|
12271
12332
|
title: 'equal?',
|
|
12272
12333
|
category: 'Misc',
|
|
@@ -12292,14 +12353,14 @@ var miscReference = {
|
|
|
12292
12353
|
'(equal? [1 true nil] [1 true nil])',
|
|
12293
12354
|
'(equal? {:a 10 :b [1 2 {:b 20}]} {:b [1 2 {:b 20}] :a 10})',
|
|
12294
12355
|
'(equal? {:a 10 :b [1 2 {:b 20}]} {:b [1 2 {:b 21}] :a 10})',
|
|
12295
|
-
'(
|
|
12356
|
+
'(== 0.3 (+ 0.1 0.2))',
|
|
12296
12357
|
'(equal? 0.3 (+ 0.1 0.2))',
|
|
12297
12358
|
],
|
|
12298
12359
|
},
|
|
12299
|
-
'
|
|
12300
|
-
title: '
|
|
12360
|
+
'json_parse': {
|
|
12361
|
+
title: 'json_parse',
|
|
12301
12362
|
category: 'Misc',
|
|
12302
|
-
linkName: '
|
|
12363
|
+
linkName: 'json_parse',
|
|
12303
12364
|
clojureDocs: null,
|
|
12304
12365
|
returns: {
|
|
12305
12366
|
type: 'any',
|
|
@@ -12314,13 +12375,13 @@ var miscReference = {
|
|
|
12314
12375
|
],
|
|
12315
12376
|
description: 'Returns `JSON.parse(`$x`)`.',
|
|
12316
12377
|
examples: [
|
|
12317
|
-
'(
|
|
12378
|
+
'(json_parse "[1, 2, 3]")',
|
|
12318
12379
|
],
|
|
12319
12380
|
},
|
|
12320
|
-
'
|
|
12321
|
-
title: '
|
|
12381
|
+
'json_stringify': {
|
|
12382
|
+
title: 'json_stringify',
|
|
12322
12383
|
category: 'Misc',
|
|
12323
|
-
linkName: '
|
|
12384
|
+
linkName: 'json_stringify',
|
|
12324
12385
|
clojureDocs: null,
|
|
12325
12386
|
returns: {
|
|
12326
12387
|
type: 'string',
|
|
@@ -12340,8 +12401,8 @@ var miscReference = {
|
|
|
12340
12401
|
],
|
|
12341
12402
|
description: 'Returns `JSON.stringify(`$x`)`. If second argument is provided, returns `JSON.stringify(`$x`, null, `$indent`)`.',
|
|
12342
12403
|
examples: [
|
|
12343
|
-
'(
|
|
12344
|
-
'(
|
|
12404
|
+
'(json_stringify [1, 2, 3])',
|
|
12405
|
+
'(json_stringify {:a {:b 10}} 2)',
|
|
12345
12406
|
],
|
|
12346
12407
|
},
|
|
12347
12408
|
};
|
|
@@ -12373,7 +12434,7 @@ var assertReference = { 'assert': {
|
|
|
12373
12434
|
linkName: 'assert-equal',
|
|
12374
12435
|
clojureDocs: null,
|
|
12375
12436
|
returns: {
|
|
12376
|
-
type: '
|
|
12437
|
+
type: 'null',
|
|
12377
12438
|
},
|
|
12378
12439
|
args: {
|
|
12379
12440
|
a: {
|
|
@@ -12402,7 +12463,7 @@ var assertReference = { 'assert': {
|
|
|
12402
12463
|
linkName: 'assert-exclamation-equal',
|
|
12403
12464
|
clojureDocs: null,
|
|
12404
12465
|
returns: {
|
|
12405
|
-
type: '
|
|
12466
|
+
type: 'null',
|
|
12406
12467
|
},
|
|
12407
12468
|
args: {
|
|
12408
12469
|
a: {
|
|
@@ -12431,7 +12492,7 @@ var assertReference = { 'assert': {
|
|
|
12431
12492
|
linkName: 'assert_equal',
|
|
12432
12493
|
clojureDocs: null,
|
|
12433
12494
|
returns: {
|
|
12434
|
-
type: '
|
|
12495
|
+
type: 'null',
|
|
12435
12496
|
},
|
|
12436
12497
|
args: {
|
|
12437
12498
|
a: {
|
|
@@ -12460,7 +12521,7 @@ var assertReference = { 'assert': {
|
|
|
12460
12521
|
linkName: 'assert_not_equal',
|
|
12461
12522
|
clojureDocs: null,
|
|
12462
12523
|
returns: {
|
|
12463
|
-
type: '
|
|
12524
|
+
type: 'null',
|
|
12464
12525
|
},
|
|
12465
12526
|
args: {
|
|
12466
12527
|
a: {
|
|
@@ -12489,7 +12550,7 @@ var assertReference = { 'assert': {
|
|
|
12489
12550
|
linkName: 'assert_gt',
|
|
12490
12551
|
clojureDocs: null,
|
|
12491
12552
|
returns: {
|
|
12492
|
-
type: '
|
|
12553
|
+
type: 'null',
|
|
12493
12554
|
},
|
|
12494
12555
|
args: {
|
|
12495
12556
|
a: {
|
|
@@ -12518,7 +12579,7 @@ var assertReference = { 'assert': {
|
|
|
12518
12579
|
linkName: 'assert_lt',
|
|
12519
12580
|
clojureDocs: null,
|
|
12520
12581
|
returns: {
|
|
12521
|
-
type: '
|
|
12582
|
+
type: 'null',
|
|
12522
12583
|
},
|
|
12523
12584
|
args: {
|
|
12524
12585
|
a: {
|
|
@@ -12547,7 +12608,7 @@ var assertReference = { 'assert': {
|
|
|
12547
12608
|
linkName: 'assert_gte',
|
|
12548
12609
|
clojureDocs: null,
|
|
12549
12610
|
returns: {
|
|
12550
|
-
type: '
|
|
12611
|
+
type: 'null',
|
|
12551
12612
|
},
|
|
12552
12613
|
args: {
|
|
12553
12614
|
a: {
|
|
@@ -12576,7 +12637,7 @@ var assertReference = { 'assert': {
|
|
|
12576
12637
|
linkName: 'assert_lte',
|
|
12577
12638
|
clojureDocs: null,
|
|
12578
12639
|
returns: {
|
|
12579
|
-
type: '
|
|
12640
|
+
type: 'null',
|
|
12580
12641
|
},
|
|
12581
12642
|
args: {
|
|
12582
12643
|
a: {
|
|
@@ -12605,7 +12666,7 @@ var assertReference = { 'assert': {
|
|
|
12605
12666
|
linkName: 'assert_true',
|
|
12606
12667
|
clojureDocs: null,
|
|
12607
12668
|
returns: {
|
|
12608
|
-
type: '
|
|
12669
|
+
type: 'null',
|
|
12609
12670
|
},
|
|
12610
12671
|
args: {
|
|
12611
12672
|
value: {
|
|
@@ -12631,7 +12692,7 @@ var assertReference = { 'assert': {
|
|
|
12631
12692
|
linkName: 'assert_false',
|
|
12632
12693
|
clojureDocs: null,
|
|
12633
12694
|
returns: {
|
|
12634
|
-
type: '
|
|
12695
|
+
type: 'null',
|
|
12635
12696
|
},
|
|
12636
12697
|
args: {
|
|
12637
12698
|
value: {
|
|
@@ -12657,7 +12718,7 @@ var assertReference = { 'assert': {
|
|
|
12657
12718
|
linkName: 'assert_truthy',
|
|
12658
12719
|
clojureDocs: null,
|
|
12659
12720
|
returns: {
|
|
12660
|
-
type: '
|
|
12721
|
+
type: 'null',
|
|
12661
12722
|
},
|
|
12662
12723
|
args: {
|
|
12663
12724
|
value: {
|
|
@@ -12690,7 +12751,7 @@ var assertReference = { 'assert': {
|
|
|
12690
12751
|
linkName: 'assert_falsy',
|
|
12691
12752
|
clojureDocs: null,
|
|
12692
12753
|
returns: {
|
|
12693
|
-
type: '
|
|
12754
|
+
type: 'null',
|
|
12694
12755
|
},
|
|
12695
12756
|
args: {
|
|
12696
12757
|
value: {
|
|
@@ -12722,7 +12783,7 @@ var assertReference = { 'assert': {
|
|
|
12722
12783
|
linkName: 'assert_null',
|
|
12723
12784
|
clojureDocs: null,
|
|
12724
12785
|
returns: {
|
|
12725
|
-
type: '
|
|
12786
|
+
type: 'null',
|
|
12726
12787
|
},
|
|
12727
12788
|
args: {
|
|
12728
12789
|
value: {
|
|
@@ -12754,7 +12815,7 @@ var assertReference = { 'assert': {
|
|
|
12754
12815
|
linkName: 'assert_throws',
|
|
12755
12816
|
clojureDocs: null,
|
|
12756
12817
|
returns: {
|
|
12757
|
-
type: '
|
|
12818
|
+
type: 'null',
|
|
12758
12819
|
},
|
|
12759
12820
|
args: {
|
|
12760
12821
|
fn: {
|
|
@@ -12776,7 +12837,7 @@ var assertReference = { 'assert': {
|
|
|
12776
12837
|
linkName: 'assert_throws_error',
|
|
12777
12838
|
clojureDocs: null,
|
|
12778
12839
|
returns: {
|
|
12779
|
-
type: '
|
|
12840
|
+
type: 'null',
|
|
12780
12841
|
},
|
|
12781
12842
|
args: {
|
|
12782
12843
|
'fn': {
|
|
@@ -12805,7 +12866,7 @@ var assertReference = { 'assert': {
|
|
|
12805
12866
|
linkName: 'assert_not_throws',
|
|
12806
12867
|
clojureDocs: null,
|
|
12807
12868
|
returns: {
|
|
12808
|
-
type: '
|
|
12869
|
+
type: 'null',
|
|
12809
12870
|
},
|
|
12810
12871
|
args: {
|
|
12811
12872
|
fn: {
|
|
@@ -12824,7 +12885,7 @@ var assertReference = { 'assert': {
|
|
|
12824
12885
|
} };
|
|
12825
12886
|
|
|
12826
12887
|
var objectReference = {
|
|
12827
|
-
|
|
12888
|
+
dissoc: {
|
|
12828
12889
|
title: 'dissoc',
|
|
12829
12890
|
category: 'Object',
|
|
12830
12891
|
linkName: 'dissoc',
|
|
@@ -12849,7 +12910,7 @@ var objectReference = {
|
|
|
12849
12910
|
"\n(def o { :a 5 }) (dissoc o :a)\no",
|
|
12850
12911
|
],
|
|
12851
12912
|
},
|
|
12852
|
-
|
|
12913
|
+
object: {
|
|
12853
12914
|
title: 'object',
|
|
12854
12915
|
category: 'Object',
|
|
12855
12916
|
linkName: 'object',
|
|
@@ -12875,7 +12936,7 @@ var objectReference = {
|
|
|
12875
12936
|
'{:a 1 :b 2}',
|
|
12876
12937
|
],
|
|
12877
12938
|
},
|
|
12878
|
-
|
|
12939
|
+
keys: {
|
|
12879
12940
|
title: 'keys',
|
|
12880
12941
|
category: 'Object',
|
|
12881
12942
|
linkName: 'keys',
|
|
@@ -12897,7 +12958,7 @@ var objectReference = {
|
|
|
12897
12958
|
'(keys (object :x 10 :y true :z "A string"))',
|
|
12898
12959
|
],
|
|
12899
12960
|
},
|
|
12900
|
-
|
|
12961
|
+
vals: {
|
|
12901
12962
|
title: 'vals',
|
|
12902
12963
|
category: 'Object',
|
|
12903
12964
|
linkName: 'vals',
|
|
@@ -12919,7 +12980,7 @@ var objectReference = {
|
|
|
12919
12980
|
'(vals (object :x 10 :y true :z "A string"))',
|
|
12920
12981
|
],
|
|
12921
12982
|
},
|
|
12922
|
-
|
|
12983
|
+
entries: {
|
|
12923
12984
|
title: 'entries',
|
|
12924
12985
|
category: 'Object',
|
|
12925
12986
|
linkName: 'entries',
|
|
@@ -12941,12 +13002,12 @@ var objectReference = {
|
|
|
12941
13002
|
'(entries (object :x 10 :y true :z "A string"))',
|
|
12942
13003
|
],
|
|
12943
13004
|
},
|
|
12944
|
-
|
|
13005
|
+
find: {
|
|
12945
13006
|
title: 'find',
|
|
12946
13007
|
category: 'Object',
|
|
12947
13008
|
linkName: 'find',
|
|
12948
13009
|
returns: {
|
|
12949
|
-
type: ['array', '
|
|
13010
|
+
type: ['array', 'null'],
|
|
12950
13011
|
},
|
|
12951
13012
|
args: {
|
|
12952
13013
|
obj: {
|
|
@@ -12965,7 +13026,7 @@ var objectReference = {
|
|
|
12965
13026
|
'(find (object :a 1 :b 2) :c)',
|
|
12966
13027
|
],
|
|
12967
13028
|
},
|
|
12968
|
-
|
|
13029
|
+
merge: {
|
|
12969
13030
|
title: 'merge',
|
|
12970
13031
|
category: 'Object',
|
|
12971
13032
|
linkName: 'merge',
|
|
@@ -12987,10 +13048,10 @@ var objectReference = {
|
|
|
12987
13048
|
'(merge (object :x 10) (object :x 15 :y 20))',
|
|
12988
13049
|
],
|
|
12989
13050
|
},
|
|
12990
|
-
|
|
12991
|
-
title: '
|
|
13051
|
+
merge_with: {
|
|
13052
|
+
title: 'merge_with',
|
|
12992
13053
|
category: 'Object',
|
|
12993
|
-
linkName: '
|
|
13054
|
+
linkName: 'merge_with',
|
|
12994
13055
|
returns: {
|
|
12995
13056
|
type: 'object',
|
|
12996
13057
|
},
|
|
@@ -13008,12 +13069,12 @@ var objectReference = {
|
|
|
13008
13069
|
],
|
|
13009
13070
|
description: "\nReturns a new object created by merging together all arguments.\nIf two keys appears in more than one object $fn is used to calculate the new value.\n\nIf no arguments are provided `nil` is returned.",
|
|
13010
13071
|
examples: [
|
|
13011
|
-
'(
|
|
13012
|
-
'(
|
|
13013
|
-
'(
|
|
13072
|
+
'(merge_with (object :x 10) (object :y 20) +)',
|
|
13073
|
+
'(merge_with (object :x 10) (object :x 15 :y 20) +)',
|
|
13074
|
+
'(merge_with (object :x 10) (object :x 20) (object :x 30) (object :x 40) -)',
|
|
13014
13075
|
],
|
|
13015
13076
|
},
|
|
13016
|
-
|
|
13077
|
+
zipmap: {
|
|
13017
13078
|
title: 'zipmap',
|
|
13018
13079
|
category: 'Object',
|
|
13019
13080
|
linkName: 'zipmap',
|
|
@@ -13040,10 +13101,10 @@ var objectReference = {
|
|
|
13040
13101
|
'(zipmap [] [10 nil [1 2 3]])',
|
|
13041
13102
|
],
|
|
13042
13103
|
},
|
|
13043
|
-
|
|
13044
|
-
title: '
|
|
13104
|
+
select_keys: {
|
|
13105
|
+
title: 'select_keys',
|
|
13045
13106
|
category: 'Object',
|
|
13046
|
-
linkName: '
|
|
13107
|
+
linkName: 'select_keys',
|
|
13047
13108
|
returns: {
|
|
13048
13109
|
type: 'object',
|
|
13049
13110
|
},
|
|
@@ -13061,8 +13122,8 @@ var objectReference = {
|
|
|
13061
13122
|
],
|
|
13062
13123
|
description: 'Returns an object containing only those entries in $obj whose key is in $keys.',
|
|
13063
13124
|
examples: [
|
|
13064
|
-
'(
|
|
13065
|
-
'(
|
|
13125
|
+
'(select_keys {:a 1 :b 2 :c 3} [:a :b])',
|
|
13126
|
+
'(select_keys {:a 1} [:a :b])',
|
|
13066
13127
|
],
|
|
13067
13128
|
},
|
|
13068
13129
|
};
|
|
@@ -13511,7 +13572,7 @@ var predicateReference = {
|
|
|
13511
13572
|
variants: [
|
|
13512
13573
|
{ argumentNames: ['x'] },
|
|
13513
13574
|
],
|
|
13514
|
-
description: 'Returns `true` if $x is NaN (
|
|
13575
|
+
description: 'Returns `true` if $x is NaN (! a number), otherwise `false`.',
|
|
13515
13576
|
examples: [
|
|
13516
13577
|
'(nan? 1.0)',
|
|
13517
13578
|
'(nan? (/ 1 0))',
|
|
@@ -13622,7 +13683,7 @@ var predicateReference = {
|
|
|
13622
13683
|
},
|
|
13623
13684
|
args: {
|
|
13624
13685
|
x: {
|
|
13625
|
-
type: ['collection', 'string', '
|
|
13686
|
+
type: ['collection', 'string', 'null'],
|
|
13626
13687
|
},
|
|
13627
13688
|
},
|
|
13628
13689
|
variants: [
|
|
@@ -13649,7 +13710,7 @@ var predicateReference = {
|
|
|
13649
13710
|
},
|
|
13650
13711
|
args: {
|
|
13651
13712
|
x: {
|
|
13652
|
-
type: ['collection', 'string', '
|
|
13713
|
+
type: ['collection', 'string', 'null'],
|
|
13653
13714
|
},
|
|
13654
13715
|
},
|
|
13655
13716
|
variants: [
|
|
@@ -13761,10 +13822,10 @@ var regularExpressionReference = {
|
|
|
13761
13822
|
};
|
|
13762
13823
|
|
|
13763
13824
|
var specialExpressionsReference = {
|
|
13764
|
-
'
|
|
13765
|
-
title: '
|
|
13825
|
+
'&&': {
|
|
13826
|
+
title: '&&',
|
|
13766
13827
|
category: 'Special expression',
|
|
13767
|
-
linkName: 'and',
|
|
13828
|
+
linkName: '-and-and',
|
|
13768
13829
|
returns: {
|
|
13769
13830
|
type: 'boolean',
|
|
13770
13831
|
},
|
|
@@ -13777,19 +13838,20 @@ var specialExpressionsReference = {
|
|
|
13777
13838
|
variants: [
|
|
13778
13839
|
{ argumentNames: ['expressions'] },
|
|
13779
13840
|
],
|
|
13780
|
-
description: "\nComputes logical `and
|
|
13841
|
+
description: "\nComputes logical `and`. Evaluation of $expressions starts from left.\nAs soon as a `expression` evaluates to a falsy value, the result is returned.\n\nIf all expressions evaluate to truthy values, the value of the last expression is returned.",
|
|
13781
13842
|
examples: [
|
|
13782
|
-
'(
|
|
13783
|
-
'(
|
|
13784
|
-
'(
|
|
13785
|
-
'(
|
|
13786
|
-
'(
|
|
13843
|
+
'(&& 1 1)',
|
|
13844
|
+
'(&& (> 3 2) "string")',
|
|
13845
|
+
'(&& (< 3 2) "string")',
|
|
13846
|
+
'(&& true true true true)',
|
|
13847
|
+
'(&& true true 0 true)',
|
|
13787
13848
|
],
|
|
13788
13849
|
},
|
|
13789
|
-
'
|
|
13790
|
-
title: '
|
|
13850
|
+
'||': {
|
|
13851
|
+
title: '||',
|
|
13791
13852
|
category: 'Special expression',
|
|
13792
|
-
linkName: 'or',
|
|
13853
|
+
linkName: '-or-or',
|
|
13854
|
+
clojureDocs: 'or',
|
|
13793
13855
|
returns: {
|
|
13794
13856
|
type: 'boolean',
|
|
13795
13857
|
},
|
|
@@ -13802,13 +13864,13 @@ var specialExpressionsReference = {
|
|
|
13802
13864
|
variants: [
|
|
13803
13865
|
{ argumentNames: ['expressions'] },
|
|
13804
13866
|
],
|
|
13805
|
-
description: "\nComputes logical `or
|
|
13867
|
+
description: "\nComputes logical `or`. Evaluation of $expressions evaluation starts from left.\nAs soon as a `expression` evaluates to a truthy value, the result is returned.\n\nIf all expressions evaluate to falsy values, the value of the last expression is returned.",
|
|
13806
13868
|
examples: [
|
|
13807
|
-
'(
|
|
13808
|
-
'(
|
|
13809
|
-
'(
|
|
13810
|
-
'(
|
|
13811
|
-
'(
|
|
13869
|
+
'(|| 1 1)',
|
|
13870
|
+
'(|| (> 3 2) "string")',
|
|
13871
|
+
'(|| (< 3 2) "string")',
|
|
13872
|
+
'(|| true true true true)',
|
|
13873
|
+
'(|| 1 2 3 4)',
|
|
13812
13874
|
],
|
|
13813
13875
|
},
|
|
13814
13876
|
'def': {
|
|
@@ -13884,10 +13946,10 @@ var specialExpressionsReference = {
|
|
|
13884
13946
|
description: "\nBinds local variables. The variables lives only within $expressions.\nIt returns evaluation of the last expression in $expressions.",
|
|
13885
13947
|
examples: ["\n (let [a (+ 1 2 3 4) \n b (* 1 2 3 4)]\n (write! a b))"],
|
|
13886
13948
|
},
|
|
13887
|
-
'
|
|
13888
|
-
title: '
|
|
13949
|
+
'if_let': {
|
|
13950
|
+
title: 'if_let',
|
|
13889
13951
|
category: 'Special expression',
|
|
13890
|
-
linkName: '
|
|
13952
|
+
linkName: 'if_let',
|
|
13891
13953
|
returns: {
|
|
13892
13954
|
type: 'any',
|
|
13893
13955
|
},
|
|
@@ -13908,14 +13970,14 @@ var specialExpressionsReference = {
|
|
|
13908
13970
|
],
|
|
13909
13971
|
description: "\nBinds one local variable. If it evaluates to a truthy value\n$then-expr is executed with the variable accessable.\nIf the bound variable evaluates to false, the $else-expr is evaluated\n(without variable accessable).",
|
|
13910
13972
|
examples: [
|
|
13911
|
-
"\n(
|
|
13912
|
-
"\n(
|
|
13973
|
+
"\n(if_let [a (> (count \"Albert\") 4)]\n (write! (str a \", is big enough\"))\n (write! \"Sorry, not big enough.\"))",
|
|
13974
|
+
"\n(if_let [a (> (count \"Albert\") 10)]\n (write! (str a \", is big enough\"))\n (write! \"Sorry, not big enough.\"))",
|
|
13913
13975
|
],
|
|
13914
13976
|
},
|
|
13915
|
-
'
|
|
13916
|
-
title: '
|
|
13977
|
+
'when_let': {
|
|
13978
|
+
title: 'when_let',
|
|
13917
13979
|
category: 'Special expression',
|
|
13918
|
-
linkName: '
|
|
13980
|
+
linkName: 'when_let',
|
|
13919
13981
|
returns: {
|
|
13920
13982
|
type: 'any',
|
|
13921
13983
|
},
|
|
@@ -13933,13 +13995,13 @@ var specialExpressionsReference = {
|
|
|
13933
13995
|
],
|
|
13934
13996
|
description: "\nBinds one local variable. If it evaluates to a truthy value\n$expressions is executed with the variable accessable.\nIf the bound variable evaluates to a falsy value, `nil` is returned.",
|
|
13935
13997
|
examples: [
|
|
13936
|
-
"\n(
|
|
13998
|
+
"\n(when_let [a (> (count \"Albert\") 4)]\n (write! a))",
|
|
13937
13999
|
],
|
|
13938
14000
|
},
|
|
13939
|
-
'
|
|
13940
|
-
title: '
|
|
14001
|
+
'when_first': {
|
|
14002
|
+
title: 'when_first',
|
|
13941
14003
|
category: 'Special expression',
|
|
13942
|
-
linkName: '
|
|
14004
|
+
linkName: 'when_first',
|
|
13943
14005
|
returns: {
|
|
13944
14006
|
type: 'any',
|
|
13945
14007
|
},
|
|
@@ -13958,11 +14020,11 @@ var specialExpressionsReference = {
|
|
|
13958
14020
|
],
|
|
13959
14021
|
description: 'When the binding value in $binding is a non empty sequence, the first element of that sequence (instead of the sequence itself) is bound to the variable.',
|
|
13960
14022
|
examples: [
|
|
13961
|
-
"\n(
|
|
13962
|
-
"\n(
|
|
13963
|
-
"\n(
|
|
13964
|
-
"\n(
|
|
13965
|
-
"\n(
|
|
14023
|
+
"\n(when_first [x [1 2 3]]\n (write! x)\n x)",
|
|
14024
|
+
"\n(when_first [x \"Albert\"]\n (write! x)\n x)",
|
|
14025
|
+
"\n(when_first [x [0]]\n (write! x)\n x)",
|
|
14026
|
+
"\n(when_first [x [nil]]\n (write! x)\n x)",
|
|
14027
|
+
"\n(when_first [x []]\n (write! x)\n x)",
|
|
13966
14028
|
],
|
|
13967
14029
|
},
|
|
13968
14030
|
'fn': {
|
|
@@ -14127,10 +14189,10 @@ var specialExpressionsReference = {
|
|
|
14127
14189
|
'(if false (write! "TRUE"))',
|
|
14128
14190
|
],
|
|
14129
14191
|
},
|
|
14130
|
-
'
|
|
14131
|
-
title: '
|
|
14192
|
+
'if_not': {
|
|
14193
|
+
title: 'if_not',
|
|
14132
14194
|
category: 'Special expression',
|
|
14133
|
-
linkName: '
|
|
14195
|
+
linkName: 'if_not',
|
|
14134
14196
|
returns: {
|
|
14135
14197
|
type: 'any',
|
|
14136
14198
|
},
|
|
@@ -14151,10 +14213,10 @@ var specialExpressionsReference = {
|
|
|
14151
14213
|
],
|
|
14152
14214
|
description: 'Either $then-expr or $else-expr branch is taken. $then-expr is selected when $test is falsy. If $test is truthy $else-expr is executed, if no $else-expr exists, `nil` is returned.',
|
|
14153
14215
|
examples: [
|
|
14154
|
-
'(
|
|
14155
|
-
'(
|
|
14156
|
-
'(
|
|
14157
|
-
'(
|
|
14216
|
+
'(if_not true (write! "TRUE") (write! "FALSE"))',
|
|
14217
|
+
'(if_not false (write! "TRUE") (write! "FALSE"))',
|
|
14218
|
+
'(if_not true (write! "TRUE"))',
|
|
14219
|
+
'(if_not false (write! "TRUE"))',
|
|
14158
14220
|
],
|
|
14159
14221
|
},
|
|
14160
14222
|
'cond': {
|
|
@@ -14179,6 +14241,31 @@ var specialExpressionsReference = {
|
|
|
14179
14241
|
"\n(cond\n false (write! \"FALSE\")\n nil (write! \"nil\"))",
|
|
14180
14242
|
],
|
|
14181
14243
|
},
|
|
14244
|
+
'switch': {
|
|
14245
|
+
title: 'switch',
|
|
14246
|
+
category: 'Special expression',
|
|
14247
|
+
linkName: 'switch',
|
|
14248
|
+
returns: {
|
|
14249
|
+
type: 'any',
|
|
14250
|
+
},
|
|
14251
|
+
args: {
|
|
14252
|
+
value: {
|
|
14253
|
+
type: 'any',
|
|
14254
|
+
},
|
|
14255
|
+
conds: {
|
|
14256
|
+
type: '*conditions',
|
|
14257
|
+
},
|
|
14258
|
+
},
|
|
14259
|
+
variants: [
|
|
14260
|
+
{ argumentNames: ['value', 'conds'] },
|
|
14261
|
+
],
|
|
14262
|
+
description: 'Used for branching. $conds are tested sequentially from the top against $value. If no branch is tested truthy, `nil` is returned.',
|
|
14263
|
+
examples: [
|
|
14264
|
+
"\n(switch 1\n 1 (write! \"FALSE\")\n 2 (write! \"nil\"))",
|
|
14265
|
+
"\n(switch 2\n 1 (write! \"FALSE\")\n 2 (write! \"nil\"))",
|
|
14266
|
+
"\n(switch 3\n 1 (write! \"FALSE\")\n 2 (write! \"nil\"))",
|
|
14267
|
+
],
|
|
14268
|
+
},
|
|
14182
14269
|
'when': {
|
|
14183
14270
|
title: 'when',
|
|
14184
14271
|
category: 'Special expression',
|
|
@@ -14206,10 +14293,10 @@ var specialExpressionsReference = {
|
|
|
14206
14293
|
'(when false)',
|
|
14207
14294
|
],
|
|
14208
14295
|
},
|
|
14209
|
-
'
|
|
14210
|
-
title: '
|
|
14296
|
+
'when_not': {
|
|
14297
|
+
title: 'when_not',
|
|
14211
14298
|
category: 'Special expression',
|
|
14212
|
-
linkName: '
|
|
14299
|
+
linkName: 'when_not',
|
|
14213
14300
|
returns: {
|
|
14214
14301
|
type: 'any',
|
|
14215
14302
|
},
|
|
@@ -14227,10 +14314,10 @@ var specialExpressionsReference = {
|
|
|
14227
14314
|
],
|
|
14228
14315
|
description: "If $test yields a falsy value, the expressions are evaluated\nand the value returned by the last `expression` is returned.\nOtherwise, if $test yields a truthy value, the $expressions are not evaluated,\nand `nil` is returned. If no `expression` is provided, `nil` is returned.",
|
|
14229
14316
|
examples: [
|
|
14230
|
-
'(
|
|
14231
|
-
'(
|
|
14232
|
-
'(
|
|
14233
|
-
'(
|
|
14317
|
+
'(when_not true (write! "Hi") (write! "There"))',
|
|
14318
|
+
'(when_not false (write! "Hi") (write! "There"))',
|
|
14319
|
+
'(when_not true)',
|
|
14320
|
+
'(when_not false)',
|
|
14234
14321
|
],
|
|
14235
14322
|
},
|
|
14236
14323
|
'comment': {
|
|
@@ -14238,7 +14325,7 @@ var specialExpressionsReference = {
|
|
|
14238
14325
|
category: 'Special expression',
|
|
14239
14326
|
linkName: 'comment',
|
|
14240
14327
|
returns: {
|
|
14241
|
-
type: '
|
|
14328
|
+
type: 'null',
|
|
14242
14329
|
},
|
|
14243
14330
|
args: {
|
|
14244
14331
|
expressions: {
|
|
@@ -14279,7 +14366,7 @@ var specialExpressionsReference = {
|
|
|
14279
14366
|
category: 'Special expression',
|
|
14280
14367
|
linkName: 'recur',
|
|
14281
14368
|
returns: {
|
|
14282
|
-
type: '
|
|
14369
|
+
type: 'null',
|
|
14283
14370
|
},
|
|
14284
14371
|
args: {
|
|
14285
14372
|
expressions: {
|
|
@@ -14292,9 +14379,9 @@ var specialExpressionsReference = {
|
|
|
14292
14379
|
],
|
|
14293
14380
|
description: 'Recursevly calls enclosing function or loop with its evaluated $expressions.',
|
|
14294
14381
|
examples: [
|
|
14295
|
-
"\n(defn foo [n]\n (write! n)\n (when (
|
|
14296
|
-
"\n(\n (fn [n]\n (write! n)\n (when (
|
|
14297
|
-
"\n(\n loop [n 3]\n (write! n)\n (when\n (
|
|
14382
|
+
"\n(defn foo [n]\n (write! n)\n (when (! (zero? n))\n (recur\n (dec n))))\n(foo 3)",
|
|
14383
|
+
"\n(\n (fn [n]\n (write! n)\n (when (! (zero? n))\n (recur\n (dec n))))\n 3)",
|
|
14384
|
+
"\n(\n loop [n 3]\n (write! n)\n (when\n (! (zero? n))\n (recur (dec n))))",
|
|
14298
14385
|
],
|
|
14299
14386
|
},
|
|
14300
14387
|
'loop': {
|
|
@@ -14319,35 +14406,16 @@ var specialExpressionsReference = {
|
|
|
14319
14406
|
],
|
|
14320
14407
|
description: 'Executes $expressions with initial $bindings. The $bindings will be replaced with the recur parameters for subsequent recursions.',
|
|
14321
14408
|
examples: [
|
|
14322
|
-
"\n(loop [n 3]\n (write! n)\n (when\n (
|
|
14323
|
-
"\n(loop [n 3]\n (write! n)\n (if\n (
|
|
14409
|
+
"\n(loop [n 3]\n (write! n)\n (when\n (! (zero? n))\n (recur (dec n))))",
|
|
14410
|
+
"\n(loop [n 3]\n (write! n)\n (if\n (! (zero? n))\n (recur (dec n))\n n))",
|
|
14324
14411
|
],
|
|
14325
14412
|
},
|
|
14326
|
-
'time!': {
|
|
14327
|
-
title: 'time!',
|
|
14328
|
-
category: 'Special expression',
|
|
14329
|
-
linkName: 'time-exclamation',
|
|
14330
|
-
clojureDocs: 'time',
|
|
14331
|
-
returns: {
|
|
14332
|
-
type: 'any',
|
|
14333
|
-
},
|
|
14334
|
-
args: {
|
|
14335
|
-
expression: {
|
|
14336
|
-
type: '*expression',
|
|
14337
|
-
},
|
|
14338
|
-
},
|
|
14339
|
-
variants: [
|
|
14340
|
-
{ argumentNames: ['expression'] },
|
|
14341
|
-
],
|
|
14342
|
-
description: 'Prints the time it took to evaluate $expression. Returns $expression evaluated.',
|
|
14343
|
-
examples: ["\n(defn fib [x]\n (if\n (<= x 2)\n 1\n (+ \n (fib (dec x))\n (fib (- x 2)))))\n(time! (fib 20))"],
|
|
14344
|
-
},
|
|
14345
14413
|
'doseq': {
|
|
14346
14414
|
title: 'doseq',
|
|
14347
14415
|
category: 'Special expression',
|
|
14348
14416
|
linkName: 'doseq',
|
|
14349
14417
|
returns: {
|
|
14350
|
-
type: '
|
|
14418
|
+
type: 'null',
|
|
14351
14419
|
},
|
|
14352
14420
|
args: {
|
|
14353
14421
|
bindings: {
|
|
@@ -14487,10 +14555,10 @@ var stringReference = {
|
|
|
14487
14555
|
'(subs "A string" 100)',
|
|
14488
14556
|
],
|
|
14489
14557
|
},
|
|
14490
|
-
'
|
|
14491
|
-
title: '
|
|
14558
|
+
'string_repeat': {
|
|
14559
|
+
title: 'string_repeat',
|
|
14492
14560
|
category: 'String',
|
|
14493
|
-
linkName: '
|
|
14561
|
+
linkName: 'string_repeat',
|
|
14494
14562
|
clojureDocs: null,
|
|
14495
14563
|
returns: {
|
|
14496
14564
|
type: 'number',
|
|
@@ -14508,8 +14576,8 @@ var stringReference = {
|
|
|
14508
14576
|
],
|
|
14509
14577
|
description: 'Repeates $s $n times.',
|
|
14510
14578
|
examples: [
|
|
14511
|
-
'(
|
|
14512
|
-
'(
|
|
14579
|
+
'(string_repeat "*" 10)',
|
|
14580
|
+
'(string_repeat "***" 0)',
|
|
14513
14581
|
],
|
|
14514
14582
|
},
|
|
14515
14583
|
'str': {
|
|
@@ -14559,41 +14627,10 @@ var stringReference = {
|
|
|
14559
14627
|
'(number "-1.01")',
|
|
14560
14628
|
],
|
|
14561
14629
|
},
|
|
14562
|
-
'
|
|
14563
|
-
title: '
|
|
14630
|
+
'lower_case': {
|
|
14631
|
+
title: 'lower_case',
|
|
14564
14632
|
category: 'String',
|
|
14565
|
-
linkName: '
|
|
14566
|
-
clojureDocs: null,
|
|
14567
|
-
returns: {
|
|
14568
|
-
type: 'string',
|
|
14569
|
-
},
|
|
14570
|
-
args: {
|
|
14571
|
-
n: {
|
|
14572
|
-
type: 'number',
|
|
14573
|
-
},
|
|
14574
|
-
base: {
|
|
14575
|
-
type: 'number',
|
|
14576
|
-
description: '2, 8, 10 or 16',
|
|
14577
|
-
},
|
|
14578
|
-
},
|
|
14579
|
-
variants: [
|
|
14580
|
-
{ argumentNames: ['n'] },
|
|
14581
|
-
{ argumentNames: ['n', 'base'] },
|
|
14582
|
-
],
|
|
14583
|
-
description: 'Converts $n to a string. If $base is not equal to `10`, $n must be a non negative integer.',
|
|
14584
|
-
examples: [
|
|
14585
|
-
'(number-to-string 10)',
|
|
14586
|
-
'(number-to-string -1.01)',
|
|
14587
|
-
'(number-to-string -.01)',
|
|
14588
|
-
'(number-to-string 15 2)',
|
|
14589
|
-
'(number-to-string 15 8)',
|
|
14590
|
-
'(number-to-string 15 16)',
|
|
14591
|
-
],
|
|
14592
|
-
},
|
|
14593
|
-
'lower-case': {
|
|
14594
|
-
title: 'lower-case',
|
|
14595
|
-
category: 'String',
|
|
14596
|
-
linkName: 'lower-case',
|
|
14633
|
+
linkName: 'lower_case',
|
|
14597
14634
|
returns: {
|
|
14598
14635
|
type: 'string',
|
|
14599
14636
|
},
|
|
@@ -14607,14 +14644,14 @@ var stringReference = {
|
|
|
14607
14644
|
],
|
|
14608
14645
|
description: 'Returns $s converted to lower case.',
|
|
14609
14646
|
examples: [
|
|
14610
|
-
'(
|
|
14611
|
-
'(
|
|
14647
|
+
'(lower_case "Albert")',
|
|
14648
|
+
'(lower_case "")',
|
|
14612
14649
|
],
|
|
14613
14650
|
},
|
|
14614
|
-
'
|
|
14615
|
-
title: '
|
|
14651
|
+
'upper_case': {
|
|
14652
|
+
title: 'upper_case',
|
|
14616
14653
|
category: 'String',
|
|
14617
|
-
linkName: '
|
|
14654
|
+
linkName: 'upper_case',
|
|
14618
14655
|
clojureDocs: null,
|
|
14619
14656
|
returns: {
|
|
14620
14657
|
type: 'string',
|
|
@@ -14629,8 +14666,8 @@ var stringReference = {
|
|
|
14629
14666
|
],
|
|
14630
14667
|
description: 'Returns $s converted to upper case.',
|
|
14631
14668
|
examples: [
|
|
14632
|
-
'(
|
|
14633
|
-
'(
|
|
14669
|
+
'(upper_case "Albert")',
|
|
14670
|
+
'(upper_case "")',
|
|
14634
14671
|
],
|
|
14635
14672
|
},
|
|
14636
14673
|
'trim': {
|
|
@@ -14656,10 +14693,10 @@ var stringReference = {
|
|
|
14656
14693
|
'(trim "")',
|
|
14657
14694
|
],
|
|
14658
14695
|
},
|
|
14659
|
-
'
|
|
14660
|
-
title: '
|
|
14696
|
+
'trim_left': {
|
|
14697
|
+
title: 'trim_left',
|
|
14661
14698
|
category: 'String',
|
|
14662
|
-
linkName: '
|
|
14699
|
+
linkName: 'trim_left',
|
|
14663
14700
|
clojureDocs: null,
|
|
14664
14701
|
returns: {
|
|
14665
14702
|
type: 'string',
|
|
@@ -14674,15 +14711,15 @@ var stringReference = {
|
|
|
14674
14711
|
],
|
|
14675
14712
|
description: 'Returns a new string with leading whitespaces removed.',
|
|
14676
14713
|
examples: [
|
|
14677
|
-
'(
|
|
14678
|
-
'(
|
|
14679
|
-
'(
|
|
14714
|
+
'(trim_left " Albert ")',
|
|
14715
|
+
'(trim_left " ")',
|
|
14716
|
+
'(trim_left "")',
|
|
14680
14717
|
],
|
|
14681
14718
|
},
|
|
14682
|
-
'
|
|
14683
|
-
title: '
|
|
14719
|
+
'trim_right': {
|
|
14720
|
+
title: 'trim_right',
|
|
14684
14721
|
category: 'String',
|
|
14685
|
-
linkName: '
|
|
14722
|
+
linkName: 'trim_right',
|
|
14686
14723
|
clojureDocs: null,
|
|
14687
14724
|
returns: {
|
|
14688
14725
|
type: 'string',
|
|
@@ -14697,15 +14734,15 @@ var stringReference = {
|
|
|
14697
14734
|
],
|
|
14698
14735
|
description: 'Returns a new string with trailing whitespaces removed.',
|
|
14699
14736
|
examples: [
|
|
14700
|
-
'(
|
|
14701
|
-
'(
|
|
14702
|
-
'(
|
|
14737
|
+
'(trim_right " Albert ")',
|
|
14738
|
+
'(trim_right " ")',
|
|
14739
|
+
'(trim_right "")',
|
|
14703
14740
|
],
|
|
14704
14741
|
},
|
|
14705
|
-
'
|
|
14706
|
-
title: '
|
|
14742
|
+
'pad_left': {
|
|
14743
|
+
title: 'pad_left',
|
|
14707
14744
|
category: 'String',
|
|
14708
|
-
linkName: '
|
|
14745
|
+
linkName: 'pad_left',
|
|
14709
14746
|
clojureDocs: null,
|
|
14710
14747
|
returns: {
|
|
14711
14748
|
type: 'string',
|
|
@@ -14727,16 +14764,16 @@ var stringReference = {
|
|
|
14727
14764
|
],
|
|
14728
14765
|
description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given $length.',
|
|
14729
14766
|
examples: [
|
|
14730
|
-
'(
|
|
14731
|
-
'(
|
|
14732
|
-
'(
|
|
14733
|
-
'(
|
|
14767
|
+
'(pad_left "Albert" 20)',
|
|
14768
|
+
'(pad_left "Albert" 20 "-*-")',
|
|
14769
|
+
'(pad_left "Albert" 5)',
|
|
14770
|
+
'(pad_left "Albert" -1)',
|
|
14734
14771
|
],
|
|
14735
14772
|
},
|
|
14736
|
-
'
|
|
14737
|
-
title: '
|
|
14773
|
+
'pad_right': {
|
|
14774
|
+
title: 'pad_right',
|
|
14738
14775
|
category: 'String',
|
|
14739
|
-
linkName: '
|
|
14776
|
+
linkName: 'pad_right',
|
|
14740
14777
|
clojureDocs: null,
|
|
14741
14778
|
returns: {
|
|
14742
14779
|
type: 'string',
|
|
@@ -14758,10 +14795,10 @@ var stringReference = {
|
|
|
14758
14795
|
],
|
|
14759
14796
|
description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given `length`.',
|
|
14760
14797
|
examples: [
|
|
14761
|
-
'(
|
|
14762
|
-
'(
|
|
14763
|
-
'(
|
|
14764
|
-
'(
|
|
14798
|
+
'(pad_right "Albert" 20)',
|
|
14799
|
+
'(pad_right "Albert" 20 "-*-")',
|
|
14800
|
+
'(pad_right "Albert" 5)',
|
|
14801
|
+
'(pad_right "Albert" -1)',
|
|
14765
14802
|
],
|
|
14766
14803
|
},
|
|
14767
14804
|
'split': {
|
|
@@ -14832,10 +14869,10 @@ var stringReference = {
|
|
|
14832
14869
|
'(template "No book||||One book||||Two books||||Three books||||$1 books" 4)',
|
|
14833
14870
|
],
|
|
14834
14871
|
},
|
|
14835
|
-
'
|
|
14836
|
-
title: '
|
|
14872
|
+
'to_char_code': {
|
|
14873
|
+
title: 'to_char_code',
|
|
14837
14874
|
category: 'String',
|
|
14838
|
-
linkName: '
|
|
14875
|
+
linkName: 'to_char_code',
|
|
14839
14876
|
clojureDocs: null,
|
|
14840
14877
|
returns: {
|
|
14841
14878
|
type: 'number',
|
|
@@ -14850,14 +14887,14 @@ var stringReference = {
|
|
|
14850
14887
|
],
|
|
14851
14888
|
description: 'Return code point for first character in $c.',
|
|
14852
14889
|
examples: [
|
|
14853
|
-
'(
|
|
14854
|
-
'(
|
|
14890
|
+
'(to_char_code :A)',
|
|
14891
|
+
'(to_char_code "Albert")',
|
|
14855
14892
|
],
|
|
14856
14893
|
},
|
|
14857
|
-
'
|
|
14858
|
-
title: '
|
|
14894
|
+
'from_char_code': {
|
|
14895
|
+
title: 'from_char_code',
|
|
14859
14896
|
category: 'String',
|
|
14860
|
-
linkName: '
|
|
14897
|
+
linkName: 'from_char_code',
|
|
14861
14898
|
clojureDocs: null,
|
|
14862
14899
|
returns: {
|
|
14863
14900
|
type: 'string',
|
|
@@ -14872,14 +14909,14 @@ var stringReference = {
|
|
|
14872
14909
|
],
|
|
14873
14910
|
description: 'Return character for code point $code.',
|
|
14874
14911
|
examples: [
|
|
14875
|
-
'(
|
|
14876
|
-
'(
|
|
14912
|
+
'(from_char_code 65)',
|
|
14913
|
+
'(from_char_code 0)',
|
|
14877
14914
|
],
|
|
14878
14915
|
},
|
|
14879
|
-
'
|
|
14880
|
-
title: '
|
|
14916
|
+
'encode_base64': {
|
|
14917
|
+
title: 'encode_base64',
|
|
14881
14918
|
category: 'String',
|
|
14882
|
-
linkName: '
|
|
14919
|
+
linkName: 'encode_base64',
|
|
14883
14920
|
clojureDocs: null,
|
|
14884
14921
|
returns: {
|
|
14885
14922
|
type: 'string',
|
|
@@ -14894,13 +14931,13 @@ var stringReference = {
|
|
|
14894
14931
|
],
|
|
14895
14932
|
description: 'Returns a Base64 encoded string from $s.',
|
|
14896
14933
|
examples: [
|
|
14897
|
-
'(
|
|
14934
|
+
'(encode_base64 "Albert")',
|
|
14898
14935
|
],
|
|
14899
14936
|
},
|
|
14900
|
-
'
|
|
14901
|
-
title: '
|
|
14937
|
+
'decode_base64': {
|
|
14938
|
+
title: 'decode_base64',
|
|
14902
14939
|
category: 'String',
|
|
14903
|
-
linkName: '
|
|
14940
|
+
linkName: 'decode_base64',
|
|
14904
14941
|
clojureDocs: null,
|
|
14905
14942
|
returns: {
|
|
14906
14943
|
type: 'string',
|
|
@@ -14915,13 +14952,13 @@ var stringReference = {
|
|
|
14915
14952
|
],
|
|
14916
14953
|
description: 'Returns a Base64 decoded string from $base64string.',
|
|
14917
14954
|
examples: [
|
|
14918
|
-
'(
|
|
14955
|
+
'(decode_base64 "QWxiZXJ0IPCfkLs=")',
|
|
14919
14956
|
],
|
|
14920
14957
|
},
|
|
14921
|
-
'
|
|
14922
|
-
title: '
|
|
14958
|
+
'encode_uri_component': {
|
|
14959
|
+
title: 'encode_uri_component',
|
|
14923
14960
|
category: 'String',
|
|
14924
|
-
linkName: '
|
|
14961
|
+
linkName: 'encode_uri_component',
|
|
14925
14962
|
clojureDocs: null,
|
|
14926
14963
|
returns: {
|
|
14927
14964
|
type: 'string',
|
|
@@ -14936,13 +14973,13 @@ var stringReference = {
|
|
|
14936
14973
|
],
|
|
14937
14974
|
description: 'Returns an escaped `URI` string.',
|
|
14938
14975
|
examples: [
|
|
14939
|
-
'(
|
|
14976
|
+
'(encode_uri_component "Hi everyone!?")',
|
|
14940
14977
|
],
|
|
14941
14978
|
},
|
|
14942
|
-
'
|
|
14943
|
-
title: '
|
|
14979
|
+
'decode_uri_component': {
|
|
14980
|
+
title: 'decode_uri_component',
|
|
14944
14981
|
category: 'String',
|
|
14945
|
-
linkName: '
|
|
14982
|
+
linkName: 'decode_uri_component',
|
|
14946
14983
|
clojureDocs: null,
|
|
14947
14984
|
returns: {
|
|
14948
14985
|
type: 'string',
|
|
@@ -14957,7 +14994,7 @@ var stringReference = {
|
|
|
14957
14994
|
],
|
|
14958
14995
|
description: 'Returns an un-escaped `URI` string.',
|
|
14959
14996
|
examples: [
|
|
14960
|
-
'(
|
|
14997
|
+
'(decode_uri_component "Hi%20everyone!%3F%20%F0%9F%91%8D")',
|
|
14961
14998
|
],
|
|
14962
14999
|
},
|
|
14963
15000
|
'join': {
|
|
@@ -14982,15 +15019,42 @@ var stringReference = {
|
|
|
14982
15019
|
description: 'Returns a new string by concatenating all of the elements in $arr, separated by $delimiter.',
|
|
14983
15020
|
examples: [
|
|
14984
15021
|
'(join ["Albert" "Mojir"] " ")',
|
|
14985
|
-
'(join (map
|
|
15022
|
+
'(join (map [0 1 2 3 4 5 6 7 8 9] str) ", ")',
|
|
15023
|
+
],
|
|
15024
|
+
},
|
|
15025
|
+
'++': {
|
|
15026
|
+
title: '++',
|
|
15027
|
+
category: 'String',
|
|
15028
|
+
linkName: '-plus-plus',
|
|
15029
|
+
clojureDocs: null,
|
|
15030
|
+
returns: {
|
|
15031
|
+
type: 'string',
|
|
15032
|
+
},
|
|
15033
|
+
args: {
|
|
15034
|
+
strings: {
|
|
15035
|
+
type: ['string', 'number', 'null'],
|
|
15036
|
+
rest: true,
|
|
15037
|
+
},
|
|
15038
|
+
},
|
|
15039
|
+
variants: [{
|
|
15040
|
+
argumentNames: ['strings'],
|
|
15041
|
+
}],
|
|
15042
|
+
description: 'Concatenats $strings into one string.',
|
|
15043
|
+
examples: [
|
|
15044
|
+
'(++ "Albert" " " "Mojir")',
|
|
15045
|
+
'(++ "Albert" "Mojir")',
|
|
15046
|
+
'(++ "Albert" null "Mojir")',
|
|
15047
|
+
'(++ "Albert")',
|
|
15048
|
+
'(++)',
|
|
14986
15049
|
],
|
|
14987
15050
|
},
|
|
14988
15051
|
};
|
|
14989
15052
|
|
|
14990
|
-
var bitwiseReference = { '
|
|
14991
|
-
title: '
|
|
15053
|
+
var bitwiseReference = { '<<': {
|
|
15054
|
+
title: '<<',
|
|
14992
15055
|
category: 'Bitwise',
|
|
14993
|
-
linkName: '
|
|
15056
|
+
linkName: '-lt-lt',
|
|
15057
|
+
clojureDocs: 'bit-shift-left',
|
|
14994
15058
|
returns: {
|
|
14995
15059
|
type: 'integer',
|
|
14996
15060
|
},
|
|
@@ -15006,11 +15070,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15006
15070
|
{ argumentNames: ['x', 'n'] },
|
|
15007
15071
|
],
|
|
15008
15072
|
description: 'Shifts $x arithmetically left by $n bit positions.',
|
|
15009
|
-
examples: ['(
|
|
15010
|
-
}, '
|
|
15011
|
-
title: '
|
|
15073
|
+
examples: ['(<< 1 10)', '(<< -4 2)'],
|
|
15074
|
+
}, '>>': {
|
|
15075
|
+
title: '>>',
|
|
15012
15076
|
category: 'Bitwise',
|
|
15013
|
-
linkName: '
|
|
15077
|
+
linkName: '-gt-gt',
|
|
15078
|
+
clojureDocs: 'bit-shift-right',
|
|
15014
15079
|
returns: {
|
|
15015
15080
|
type: 'integer',
|
|
15016
15081
|
},
|
|
@@ -15026,11 +15091,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15026
15091
|
{ argumentNames: ['x', 'n'] },
|
|
15027
15092
|
],
|
|
15028
15093
|
description: 'Shifts $x arithmetically right by $n bit positions.',
|
|
15029
|
-
examples: ['(
|
|
15030
|
-
}, '
|
|
15031
|
-
title: '
|
|
15094
|
+
examples: ['(>> 2048 10)', '(>> 4 10)'],
|
|
15095
|
+
}, '>>>': {
|
|
15096
|
+
title: '>>>',
|
|
15032
15097
|
category: 'Bitwise',
|
|
15033
|
-
linkName: '
|
|
15098
|
+
linkName: '-gt-gt-gt',
|
|
15099
|
+
clojureDocs: 'unsigned-bit-shift-right',
|
|
15034
15100
|
returns: {
|
|
15035
15101
|
type: 'integer',
|
|
15036
15102
|
},
|
|
@@ -15046,11 +15112,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15046
15112
|
{ argumentNames: ['x', 'n'] },
|
|
15047
15113
|
],
|
|
15048
15114
|
description: 'Shifts $x arithmetically right by $n bit positions without sign extension.',
|
|
15049
|
-
examples: ['(
|
|
15050
|
-
}, '
|
|
15051
|
-
title: '
|
|
15115
|
+
examples: ['(>>> 2048 10)', '(>>> 4 10)', '(>>> -1 10)'],
|
|
15116
|
+
}, '~': {
|
|
15117
|
+
title: '~',
|
|
15052
15118
|
category: 'Bitwise',
|
|
15053
|
-
linkName: '
|
|
15119
|
+
linkName: '-tilde',
|
|
15120
|
+
clojureDocs: 'bit-not',
|
|
15054
15121
|
returns: {
|
|
15055
15122
|
type: 'integer',
|
|
15056
15123
|
},
|
|
@@ -15063,11 +15130,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15063
15130
|
{ argumentNames: ['x'] },
|
|
15064
15131
|
],
|
|
15065
15132
|
description: 'Returns bitwise `not` of $x.',
|
|
15066
|
-
examples: ['(
|
|
15067
|
-
}, '
|
|
15068
|
-
title: '
|
|
15133
|
+
examples: ['(~ 0)', '(~ 255)'],
|
|
15134
|
+
}, '&': {
|
|
15135
|
+
title: '&',
|
|
15069
15136
|
category: 'Bitwise',
|
|
15070
|
-
linkName: '
|
|
15137
|
+
linkName: '-and',
|
|
15138
|
+
clojureDocs: 'bit-and',
|
|
15071
15139
|
returns: {
|
|
15072
15140
|
type: 'integer',
|
|
15073
15141
|
},
|
|
@@ -15089,13 +15157,14 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15089
15157
|
],
|
|
15090
15158
|
description: 'Returns bitwise `and` of all arguments.',
|
|
15091
15159
|
examples: [
|
|
15092
|
-
'(
|
|
15093
|
-
'(
|
|
15160
|
+
'(& 0b0011 0b0110)',
|
|
15161
|
+
'(& 0b0011 0b0110 0b1001)',
|
|
15094
15162
|
],
|
|
15095
|
-
}, '
|
|
15096
|
-
title: '
|
|
15163
|
+
}, '&!': {
|
|
15164
|
+
title: '&!',
|
|
15097
15165
|
category: 'Bitwise',
|
|
15098
|
-
linkName: '
|
|
15166
|
+
linkName: '-and-exclamation',
|
|
15167
|
+
clojureDocs: 'bit-and-not',
|
|
15099
15168
|
returns: {
|
|
15100
15169
|
type: 'integer',
|
|
15101
15170
|
},
|
|
@@ -15116,11 +15185,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15116
15185
|
{ argumentNames: ['x', 'y', 'rest'] },
|
|
15117
15186
|
],
|
|
15118
15187
|
description: 'Returns bitwise `and` with complement.',
|
|
15119
|
-
examples: ['(
|
|
15120
|
-
}, '
|
|
15121
|
-
title: '
|
|
15188
|
+
examples: ['(&! 0b0011 0b0110)', '(&! 0b0011 0b0110 0b1001)'],
|
|
15189
|
+
}, '|': {
|
|
15190
|
+
title: '|',
|
|
15122
15191
|
category: 'Bitwise',
|
|
15123
|
-
linkName: '
|
|
15192
|
+
linkName: '-or',
|
|
15193
|
+
clojureDocs: 'bit-or',
|
|
15124
15194
|
returns: {
|
|
15125
15195
|
type: 'integer',
|
|
15126
15196
|
},
|
|
@@ -15141,11 +15211,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15141
15211
|
{ argumentNames: ['x', 'y', 'rest'] },
|
|
15142
15212
|
],
|
|
15143
15213
|
description: 'Returns bitwise `or` of all arguments.',
|
|
15144
|
-
examples: ['(
|
|
15145
|
-
}, '
|
|
15146
|
-
title: '
|
|
15214
|
+
examples: ['(| 0b0011 0b0110)', '(| 0b1000 0b0100 0b0010)'],
|
|
15215
|
+
}, '^': {
|
|
15216
|
+
title: '^',
|
|
15147
15217
|
category: 'Bitwise',
|
|
15148
|
-
linkName: '
|
|
15218
|
+
linkName: '-caret',
|
|
15219
|
+
clojureDocs: 'bit-xor',
|
|
15149
15220
|
returns: {
|
|
15150
15221
|
type: 'integer',
|
|
15151
15222
|
},
|
|
@@ -15166,11 +15237,11 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15166
15237
|
{ argumentNames: ['x', 'y', 'rest'] },
|
|
15167
15238
|
],
|
|
15168
15239
|
description: 'Returns bitwise `xor` of all arguments.',
|
|
15169
|
-
examples: ['(
|
|
15170
|
-
}, '
|
|
15171
|
-
title: '
|
|
15240
|
+
examples: ['(^ 0b0011 0b0110)', '(^ 0b11110000 0b00111100 0b10101010)'],
|
|
15241
|
+
}, 'bit_flip': {
|
|
15242
|
+
title: 'bit_flip',
|
|
15172
15243
|
category: 'Bitwise',
|
|
15173
|
-
linkName: '
|
|
15244
|
+
linkName: 'bit_flip',
|
|
15174
15245
|
returns: {
|
|
15175
15246
|
type: 'integer',
|
|
15176
15247
|
},
|
|
@@ -15186,11 +15257,11 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15186
15257
|
{ argumentNames: ['x', 'n'] },
|
|
15187
15258
|
],
|
|
15188
15259
|
description: 'Flips bit number $n.',
|
|
15189
|
-
examples: ['(
|
|
15190
|
-
}, '
|
|
15191
|
-
title: '
|
|
15260
|
+
examples: ['(bit_flip 0b0011 1)', '(bit_flip 0b1100 1)'],
|
|
15261
|
+
}, 'bit_clear': {
|
|
15262
|
+
title: 'bit_clear',
|
|
15192
15263
|
category: 'Bitwise',
|
|
15193
|
-
linkName: '
|
|
15264
|
+
linkName: 'bit_clear',
|
|
15194
15265
|
returns: {
|
|
15195
15266
|
type: 'integer',
|
|
15196
15267
|
},
|
|
@@ -15206,11 +15277,11 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15206
15277
|
{ argumentNames: ['x', 'n'] },
|
|
15207
15278
|
],
|
|
15208
15279
|
description: 'Clears bit number $n.',
|
|
15209
|
-
examples: ['(
|
|
15210
|
-
}, '
|
|
15211
|
-
title: '
|
|
15280
|
+
examples: ['(bit_clear 0b0011 1)', '(bit_clear 0b1100 1)'],
|
|
15281
|
+
}, 'bit_set': {
|
|
15282
|
+
title: 'bit_set',
|
|
15212
15283
|
category: 'Bitwise',
|
|
15213
|
-
linkName: '
|
|
15284
|
+
linkName: 'bit_set',
|
|
15214
15285
|
returns: {
|
|
15215
15286
|
type: 'integer',
|
|
15216
15287
|
},
|
|
@@ -15226,11 +15297,11 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15226
15297
|
{ argumentNames: ['x', 'n'] },
|
|
15227
15298
|
],
|
|
15228
15299
|
description: 'Sets bit number $n.',
|
|
15229
|
-
examples: ['(
|
|
15230
|
-
}, '
|
|
15231
|
-
title: '
|
|
15300
|
+
examples: ['(bit_set 0b0011 1)', '(bit_set 0b1100 1)'],
|
|
15301
|
+
}, 'bit_test': {
|
|
15302
|
+
title: 'bit_test',
|
|
15232
15303
|
category: 'Bitwise',
|
|
15233
|
-
linkName: '
|
|
15304
|
+
linkName: 'bit_test',
|
|
15234
15305
|
returns: {
|
|
15235
15306
|
type: 'boolean',
|
|
15236
15307
|
},
|
|
@@ -15246,7 +15317,7 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15246
15317
|
{ argumentNames: ['x', 'n'] },
|
|
15247
15318
|
],
|
|
15248
15319
|
description: 'Checks if bit number $n is set.',
|
|
15249
|
-
examples: ['(
|
|
15320
|
+
examples: ['(bit_test 0b0011 1)', '(bit_test 0b1100 1)'],
|
|
15250
15321
|
} };
|
|
15251
15322
|
|
|
15252
15323
|
var shorthand = {
|
|
@@ -15562,13 +15633,13 @@ var api = {
|
|
|
15562
15633
|
'*',
|
|
15563
15634
|
'/',
|
|
15564
15635
|
'mod',
|
|
15565
|
-
'
|
|
15636
|
+
'%',
|
|
15566
15637
|
'quot',
|
|
15567
15638
|
'inc',
|
|
15568
15639
|
'dec',
|
|
15569
15640
|
'sqrt',
|
|
15570
15641
|
'cbrt',
|
|
15571
|
-
'
|
|
15642
|
+
'**',
|
|
15572
15643
|
'exp',
|
|
15573
15644
|
'round',
|
|
15574
15645
|
'trunc',
|
|
@@ -15618,23 +15689,20 @@ var api = {
|
|
|
15618
15689
|
],
|
|
15619
15690
|
misc: [
|
|
15620
15691
|
'!=',
|
|
15621
|
-
'
|
|
15692
|
+
'==',
|
|
15622
15693
|
'<',
|
|
15623
15694
|
'>',
|
|
15624
15695
|
'<=',
|
|
15625
15696
|
'>=',
|
|
15626
|
-
'
|
|
15697
|
+
'!',
|
|
15627
15698
|
'write!',
|
|
15628
|
-
'
|
|
15629
|
-
'
|
|
15630
|
-
'inst-ms->iso-date-time',
|
|
15699
|
+
'iso_date>epoch',
|
|
15700
|
+
'epoch>iso_date',
|
|
15631
15701
|
'boolean',
|
|
15632
15702
|
'compare',
|
|
15633
|
-
'lits-version!',
|
|
15634
|
-
'uuid!',
|
|
15635
15703
|
'equal?',
|
|
15636
|
-
'
|
|
15637
|
-
'
|
|
15704
|
+
'json_parse',
|
|
15705
|
+
'json_stringify',
|
|
15638
15706
|
],
|
|
15639
15707
|
object: [
|
|
15640
15708
|
'dissoc',
|
|
@@ -15644,9 +15712,9 @@ var api = {
|
|
|
15644
15712
|
'entries',
|
|
15645
15713
|
'find',
|
|
15646
15714
|
'merge',
|
|
15647
|
-
'
|
|
15715
|
+
'merge_with',
|
|
15648
15716
|
'zipmap',
|
|
15649
|
-
'
|
|
15717
|
+
'select_keys',
|
|
15650
15718
|
],
|
|
15651
15719
|
predicate: [
|
|
15652
15720
|
'boolean?',
|
|
@@ -15680,29 +15748,29 @@ var api = {
|
|
|
15680
15748
|
'replace',
|
|
15681
15749
|
],
|
|
15682
15750
|
specialExpressions: [
|
|
15683
|
-
'
|
|
15684
|
-
'
|
|
15751
|
+
'&&',
|
|
15752
|
+
'||',
|
|
15685
15753
|
'def',
|
|
15686
15754
|
'defs',
|
|
15687
15755
|
'let',
|
|
15688
|
-
'
|
|
15689
|
-
'
|
|
15690
|
-
'
|
|
15756
|
+
'if_let',
|
|
15757
|
+
'when_let',
|
|
15758
|
+
'when_first',
|
|
15691
15759
|
'fn',
|
|
15692
15760
|
'defn',
|
|
15693
15761
|
'defns',
|
|
15694
15762
|
'try',
|
|
15695
15763
|
'throw',
|
|
15696
15764
|
'if',
|
|
15697
|
-
'
|
|
15765
|
+
'if_not',
|
|
15698
15766
|
'cond',
|
|
15767
|
+
'switch',
|
|
15699
15768
|
'when',
|
|
15700
|
-
'
|
|
15769
|
+
'when_not',
|
|
15701
15770
|
'comment',
|
|
15702
15771
|
'do',
|
|
15703
15772
|
'recur',
|
|
15704
15773
|
'loop',
|
|
15705
|
-
'time!',
|
|
15706
15774
|
'doseq',
|
|
15707
15775
|
'for',
|
|
15708
15776
|
'declared?',
|
|
@@ -15710,40 +15778,40 @@ var api = {
|
|
|
15710
15778
|
],
|
|
15711
15779
|
string: [
|
|
15712
15780
|
'subs',
|
|
15713
|
-
'
|
|
15781
|
+
'string_repeat',
|
|
15714
15782
|
'str',
|
|
15715
15783
|
'number',
|
|
15716
|
-
'
|
|
15717
|
-
'
|
|
15718
|
-
'upper-case',
|
|
15784
|
+
'lower_case',
|
|
15785
|
+
'upper_case',
|
|
15719
15786
|
'trim',
|
|
15720
|
-
'
|
|
15721
|
-
'
|
|
15722
|
-
'
|
|
15723
|
-
'
|
|
15787
|
+
'trim_left',
|
|
15788
|
+
'trim_right',
|
|
15789
|
+
'pad_left',
|
|
15790
|
+
'pad_right',
|
|
15724
15791
|
'split',
|
|
15725
15792
|
'template',
|
|
15726
|
-
'
|
|
15727
|
-
'
|
|
15728
|
-
'
|
|
15729
|
-
'
|
|
15730
|
-
'
|
|
15731
|
-
'
|
|
15793
|
+
'to_char_code',
|
|
15794
|
+
'from_char_code',
|
|
15795
|
+
'encode_base64',
|
|
15796
|
+
'decode_base64',
|
|
15797
|
+
'encode_uri_component',
|
|
15798
|
+
'decode_uri_component',
|
|
15732
15799
|
'join',
|
|
15800
|
+
'++',
|
|
15733
15801
|
],
|
|
15734
15802
|
bitwise: [
|
|
15735
|
-
'
|
|
15736
|
-
'
|
|
15737
|
-
'
|
|
15738
|
-
'
|
|
15739
|
-
'
|
|
15740
|
-
'
|
|
15741
|
-
'
|
|
15742
|
-
'
|
|
15743
|
-
'
|
|
15744
|
-
'
|
|
15745
|
-
'
|
|
15746
|
-
'
|
|
15803
|
+
'<<',
|
|
15804
|
+
'>>',
|
|
15805
|
+
'>>>',
|
|
15806
|
+
'~',
|
|
15807
|
+
'&',
|
|
15808
|
+
'&!',
|
|
15809
|
+
'|',
|
|
15810
|
+
'^',
|
|
15811
|
+
'bit_flip',
|
|
15812
|
+
'bit_clear',
|
|
15813
|
+
'bit_set',
|
|
15814
|
+
'bit_test',
|
|
15747
15815
|
],
|
|
15748
15816
|
assert: [
|
|
15749
15817
|
'assert',
|