@mojir/lits 2.0.13 → 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 +978 -819
- 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 +17 -2
- 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 +6 -5
- 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 +978 -821
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +978 -821
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +978 -821
- 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 +17 -2
- 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 +6 -5
- 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 +595 -405
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +595 -405
- 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/index.esm.js
CHANGED
|
@@ -236,6 +236,12 @@ function isLitsError(error) {
|
|
|
236
236
|
return error instanceof LitsError;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
function getSourceCodeInfo(anyValue, sourceCodeInfo) {
|
|
240
|
+
var _a;
|
|
241
|
+
// eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access
|
|
242
|
+
return (_a = anyValue === null || anyValue === void 0 ? void 0 : anyValue.sourceCodeInfo) !== null && _a !== void 0 ? _a : sourceCodeInfo;
|
|
243
|
+
}
|
|
244
|
+
|
|
239
245
|
function isTokenDebugData(tokenDebugData) {
|
|
240
246
|
return (typeof tokenDebugData === 'object'
|
|
241
247
|
&& tokenDebugData !== null
|
|
@@ -254,8 +260,12 @@ function addTokenDebugData(token, debugData) {
|
|
|
254
260
|
}
|
|
255
261
|
token.push(debugData);
|
|
256
262
|
}
|
|
257
|
-
function throwUnexpectedToken(expected, actual) {
|
|
258
|
-
|
|
263
|
+
function throwUnexpectedToken(expected, expectedValue, actual) {
|
|
264
|
+
if (actual === undefined) {
|
|
265
|
+
throw new LitsError("Unexpected end of input, expected ".concat(expected).concat(expectedValue ? " '".concat(expectedValue, "'") : ''), undefined);
|
|
266
|
+
}
|
|
267
|
+
var actualOutput = "".concat(actual[0]).concat(actual[1] ? " '".concat(actual[1], "'") : '');
|
|
268
|
+
throw new LitsError("Unexpected token: ".concat(actualOutput, ", expected ").concat(expected).concat(expectedValue ? " '".concat(expectedValue, "'") : ''), getSourceCodeInfo(actual));
|
|
259
269
|
}
|
|
260
270
|
|
|
261
271
|
var commonSimpleTokenTypes = [
|
|
@@ -277,7 +287,7 @@ function isLParenToken(token) {
|
|
|
277
287
|
}
|
|
278
288
|
function assertLParenToken(token) {
|
|
279
289
|
if (!isLParenToken(token)) {
|
|
280
|
-
throwUnexpectedToken('LParen', token);
|
|
290
|
+
throwUnexpectedToken('LParen', undefined, token);
|
|
281
291
|
}
|
|
282
292
|
}
|
|
283
293
|
function asLParenToken(token) {
|
|
@@ -289,7 +299,7 @@ function isRParenToken(token) {
|
|
|
289
299
|
}
|
|
290
300
|
function assertRParenToken(token) {
|
|
291
301
|
if (!isRParenToken(token)) {
|
|
292
|
-
throwUnexpectedToken('RParen', token);
|
|
302
|
+
throwUnexpectedToken('RParen', undefined, token);
|
|
293
303
|
}
|
|
294
304
|
}
|
|
295
305
|
function isLBracketToken(token) {
|
|
@@ -297,7 +307,7 @@ function isLBracketToken(token) {
|
|
|
297
307
|
}
|
|
298
308
|
function assertLBracketToken(token) {
|
|
299
309
|
if (!isLBracketToken(token)) {
|
|
300
|
-
throwUnexpectedToken('LBracket', token);
|
|
310
|
+
throwUnexpectedToken('LBracket', undefined, token);
|
|
301
311
|
}
|
|
302
312
|
}
|
|
303
313
|
function asLBracketToken(token) {
|
|
@@ -309,7 +319,7 @@ function isRBracketToken(token) {
|
|
|
309
319
|
}
|
|
310
320
|
function assertRBracketToken(token) {
|
|
311
321
|
if (!isRBracketToken(token)) {
|
|
312
|
-
throwUnexpectedToken('RBracket', token);
|
|
322
|
+
throwUnexpectedToken('RBracket', undefined, token);
|
|
313
323
|
}
|
|
314
324
|
}
|
|
315
325
|
function isLBraceToken(token) {
|
|
@@ -317,7 +327,7 @@ function isLBraceToken(token) {
|
|
|
317
327
|
}
|
|
318
328
|
function assertLBraceToken(token) {
|
|
319
329
|
if (!isLBraceToken(token)) {
|
|
320
|
-
throwUnexpectedToken('LBrace', token);
|
|
330
|
+
throwUnexpectedToken('LBrace', undefined, token);
|
|
321
331
|
}
|
|
322
332
|
}
|
|
323
333
|
function asLBraceToken(token) {
|
|
@@ -329,7 +339,7 @@ function isRBraceToken(token) {
|
|
|
329
339
|
}
|
|
330
340
|
function assertRBraceToken(token) {
|
|
331
341
|
if (!isRBraceToken(token)) {
|
|
332
|
-
throwUnexpectedToken('RBrace', token);
|
|
342
|
+
throwUnexpectedToken('RBrace', undefined, token);
|
|
333
343
|
}
|
|
334
344
|
}
|
|
335
345
|
function isStringToken(token) {
|
|
@@ -337,7 +347,7 @@ function isStringToken(token) {
|
|
|
337
347
|
}
|
|
338
348
|
function assertStringToken(token) {
|
|
339
349
|
if (!isStringToken(token)) {
|
|
340
|
-
throwUnexpectedToken('String', token);
|
|
350
|
+
throwUnexpectedToken('String', undefined, token);
|
|
341
351
|
}
|
|
342
352
|
}
|
|
343
353
|
function asStringToken(token) {
|
|
@@ -355,7 +365,7 @@ function isEndNotationToken(token) {
|
|
|
355
365
|
}
|
|
356
366
|
function assertEndNotationToken(token) {
|
|
357
367
|
if (!isEndNotationToken(token)) {
|
|
358
|
-
throwUnexpectedToken('EndNotation', token);
|
|
368
|
+
throwUnexpectedToken('EndNotation', undefined, token);
|
|
359
369
|
}
|
|
360
370
|
}
|
|
361
371
|
|
|
@@ -408,28 +418,28 @@ var otherSymbolicOperators = [
|
|
|
408
418
|
'.', // property accessor
|
|
409
419
|
',', // item separator
|
|
410
420
|
'=', // property assignment
|
|
421
|
+
';', // statement terminator
|
|
411
422
|
];
|
|
412
423
|
var symbolicOperators = __spreadArray(__spreadArray(__spreadArray([], __read(symbolicUnaryOperators), false), __read(symbolicBinaryOperators), false), __read(otherSymbolicOperators), false);
|
|
413
424
|
var nonFunctionOperators = [
|
|
414
425
|
'??',
|
|
415
|
-
'
|
|
426
|
+
'&&',
|
|
416
427
|
'comment',
|
|
417
428
|
'cond',
|
|
418
429
|
'declared?',
|
|
419
430
|
'if',
|
|
420
|
-
'
|
|
421
|
-
'
|
|
431
|
+
'if_not',
|
|
432
|
+
'||',
|
|
422
433
|
'when',
|
|
423
|
-
'
|
|
434
|
+
'when_not',
|
|
424
435
|
'do',
|
|
425
|
-
'time!',
|
|
426
436
|
'throw',
|
|
427
437
|
'let',
|
|
428
438
|
'def',
|
|
429
439
|
'defs',
|
|
430
|
-
'
|
|
431
|
-
'
|
|
432
|
-
'
|
|
440
|
+
'if_let',
|
|
441
|
+
'when_let',
|
|
442
|
+
'when_first',
|
|
433
443
|
'fn',
|
|
434
444
|
'defn',
|
|
435
445
|
'defns',
|
|
@@ -460,7 +470,7 @@ function isA_SymbolToken(token) {
|
|
|
460
470
|
}
|
|
461
471
|
function assertA_SymbolToken(token) {
|
|
462
472
|
if (!isA_SymbolToken(token)) {
|
|
463
|
-
throwUnexpectedToken('A_Symbol', token);
|
|
473
|
+
throwUnexpectedToken('A_Symbol', undefined, token);
|
|
464
474
|
}
|
|
465
475
|
}
|
|
466
476
|
function asA_SymbolToken(token) {
|
|
@@ -470,8 +480,19 @@ function asA_SymbolToken(token) {
|
|
|
470
480
|
function isA_BinaryOperatorToken(token) {
|
|
471
481
|
return (token === null || token === void 0 ? void 0 : token[0]) === 'A_Operator' && isSymbolicBinaryOperator(token[1]);
|
|
472
482
|
}
|
|
473
|
-
function isA_ReservedSymbolToken(token) {
|
|
474
|
-
|
|
483
|
+
function isA_ReservedSymbolToken(token, symbolName) {
|
|
484
|
+
if ((token === null || token === void 0 ? void 0 : token[0]) !== 'A_ReservedSymbol') {
|
|
485
|
+
return false;
|
|
486
|
+
}
|
|
487
|
+
if (symbolName && token[1] !== symbolName) {
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
490
|
+
return true;
|
|
491
|
+
}
|
|
492
|
+
function assertA_ReservedSymbolToken(token, symbolName) {
|
|
493
|
+
if (!isA_ReservedSymbolToken(token, symbolName)) {
|
|
494
|
+
throwUnexpectedToken('A_ReservedSymbol', symbolName, token);
|
|
495
|
+
}
|
|
475
496
|
}
|
|
476
497
|
function isA_CommentToken(token) {
|
|
477
498
|
return (token === null || token === void 0 ? void 0 : token[0]) === 'A_SingleLineComment';
|
|
@@ -490,10 +511,9 @@ function isA_OperatorToken(token, operatorName) {
|
|
|
490
511
|
}
|
|
491
512
|
function assertA_OperatorToken(token, operatorName) {
|
|
492
513
|
if (!isA_OperatorToken(token, operatorName)) {
|
|
493
|
-
|
|
514
|
+
{
|
|
494
515
|
throw new LitsError("Unexpected token: ".concat(token, ", expected operator ").concat(operatorName), undefined);
|
|
495
516
|
}
|
|
496
|
-
throwUnexpectedToken('A_Operator', token);
|
|
497
517
|
}
|
|
498
518
|
}
|
|
499
519
|
function isA_WhitespaceToken(token) {
|
|
@@ -506,7 +526,7 @@ function isA_BasePrefixedNumberToken(token) {
|
|
|
506
526
|
return (token === null || token === void 0 ? void 0 : token[0]) === 'A_BasePrefixedNumber';
|
|
507
527
|
}
|
|
508
528
|
|
|
509
|
-
var modifierNames = ['&', '&let', '&when', '&while'];
|
|
529
|
+
var modifierNames = ['&rest', '&let', '&when', '&while'];
|
|
510
530
|
var polishOnlySimpleTokenTypes = [
|
|
511
531
|
'P_FnShorthand',
|
|
512
532
|
];
|
|
@@ -529,7 +549,7 @@ function isP_StringShorthandToken(token) {
|
|
|
529
549
|
}
|
|
530
550
|
function assertP_StringShorthandToken(token) {
|
|
531
551
|
if (!isP_StringShorthandToken(token)) {
|
|
532
|
-
throwUnexpectedToken('P_StringShorthand', token);
|
|
552
|
+
throwUnexpectedToken('P_StringShorthand', undefined, token);
|
|
533
553
|
}
|
|
534
554
|
}
|
|
535
555
|
function asP_StringShorthandToken(token) {
|
|
@@ -541,7 +561,7 @@ function isP_SymbolToken(token) {
|
|
|
541
561
|
}
|
|
542
562
|
function assertP_SymbolToken(token) {
|
|
543
563
|
if (!isP_SymbolToken(token)) {
|
|
544
|
-
throwUnexpectedToken('P_Symbol', token);
|
|
564
|
+
throwUnexpectedToken('P_Symbol', undefined, token);
|
|
545
565
|
}
|
|
546
566
|
}
|
|
547
567
|
function asP_SymbolToken(token) {
|
|
@@ -559,7 +579,7 @@ function isP_RegexpShorthandToken(token) {
|
|
|
559
579
|
}
|
|
560
580
|
function assertP_RegexpShorthandToken(token) {
|
|
561
581
|
if (!isP_RegexpShorthandToken(token)) {
|
|
562
|
-
throwUnexpectedToken('P_RegexpShorthand', token);
|
|
582
|
+
throwUnexpectedToken('P_RegexpShorthand', undefined, token);
|
|
563
583
|
}
|
|
564
584
|
}
|
|
565
585
|
function asP_RegexpShorthandToken(token) {
|
|
@@ -574,7 +594,7 @@ function isP_CollectionAccessorToken(token) {
|
|
|
574
594
|
}
|
|
575
595
|
function assertP_CollectionAccessorToken(token) {
|
|
576
596
|
if (!isP_CollectionAccessorToken(token)) {
|
|
577
|
-
throwUnexpectedToken('P_CollectionAccessor', token);
|
|
597
|
+
throwUnexpectedToken('P_CollectionAccessor', undefined, token);
|
|
578
598
|
}
|
|
579
599
|
}
|
|
580
600
|
function asP_CollectionAccessorToken(token) {
|
|
@@ -586,7 +606,7 @@ function isP_CommentToken(token) {
|
|
|
586
606
|
}
|
|
587
607
|
function assertP_CommentToken(token) {
|
|
588
608
|
if (!isP_CommentToken(token)) {
|
|
589
|
-
throwUnexpectedToken('P_Comment', token);
|
|
609
|
+
throwUnexpectedToken('P_Comment', undefined, token);
|
|
590
610
|
}
|
|
591
611
|
}
|
|
592
612
|
function asP_CommentToken(token) {
|
|
@@ -601,7 +621,7 @@ function isP_NumberToken(token) {
|
|
|
601
621
|
}
|
|
602
622
|
function assertP_NumberToken(token) {
|
|
603
623
|
if (!isP_NumberToken(token)) {
|
|
604
|
-
throwUnexpectedToken('P_Number', token);
|
|
624
|
+
throwUnexpectedToken('P_Number', undefined, token);
|
|
605
625
|
}
|
|
606
626
|
}
|
|
607
627
|
|
|
@@ -669,12 +689,6 @@ function valueToString(value) {
|
|
|
669
689
|
return JSON.stringify(value);
|
|
670
690
|
}
|
|
671
691
|
|
|
672
|
-
function getSourceCodeInfo(anyValue, sourceCodeInfo) {
|
|
673
|
-
var _a;
|
|
674
|
-
// eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access
|
|
675
|
-
return (_a = anyValue === null || anyValue === void 0 ? void 0 : anyValue.sourceCodeInfo) !== null && _a !== void 0 ? _a : sourceCodeInfo;
|
|
676
|
-
}
|
|
677
|
-
|
|
678
692
|
function getAssertionError(typeName, value, sourceCodeInfo) {
|
|
679
693
|
return new LitsError("Expected ".concat(typeName, ", got ").concat(valueToString(value), "."), getSourceCodeInfo(value, sourceCodeInfo));
|
|
680
694
|
}
|
|
@@ -727,7 +741,7 @@ function isExpressionNode(value) {
|
|
|
727
741
|
}
|
|
728
742
|
|
|
729
743
|
var specialExpressionCommentRemovers = {
|
|
730
|
-
'
|
|
744
|
+
'&&': function (node, removeOptions) {
|
|
731
745
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
732
746
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
733
747
|
},
|
|
@@ -739,6 +753,10 @@ var specialExpressionCommentRemovers = {
|
|
|
739
753
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
740
754
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
741
755
|
},
|
|
756
|
+
'switch': function (node, removeOptions) {
|
|
757
|
+
removeOptions.removeCommenNodesFromArray(node.p);
|
|
758
|
+
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
759
|
+
},
|
|
742
760
|
'declared?': function (node, removeOptions) {
|
|
743
761
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
744
762
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
@@ -760,12 +778,12 @@ var specialExpressionCommentRemovers = {
|
|
|
760
778
|
'doseq': function (_node, _removeOptions) { },
|
|
761
779
|
'fn': function (_node, _removeOptions) { },
|
|
762
780
|
'for': function (_node, _removeOptions) { },
|
|
763
|
-
'
|
|
781
|
+
'if_let': function (_node, _removeOptions) { },
|
|
764
782
|
'if': function (node, removeOptions) {
|
|
765
783
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
766
784
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
767
785
|
},
|
|
768
|
-
'
|
|
786
|
+
'if_not': function (node, removeOptions) {
|
|
769
787
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
770
788
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
771
789
|
},
|
|
@@ -777,7 +795,7 @@ var specialExpressionCommentRemovers = {
|
|
|
777
795
|
});
|
|
778
796
|
},
|
|
779
797
|
'loop': function (_node, _removeOptions) { },
|
|
780
|
-
'
|
|
798
|
+
'||': function (node, removeOptions) {
|
|
781
799
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
782
800
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
783
801
|
},
|
|
@@ -789,19 +807,15 @@ var specialExpressionCommentRemovers = {
|
|
|
789
807
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
790
808
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
791
809
|
},
|
|
792
|
-
'time!': function (node, removeOptions) {
|
|
793
|
-
removeOptions.removeCommenNodesFromArray(node.p);
|
|
794
|
-
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
795
|
-
},
|
|
796
810
|
'throw': function (node, removeOptions) {
|
|
797
811
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
798
812
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
799
813
|
},
|
|
800
814
|
'try': function (_node, _removeOptions) { },
|
|
801
|
-
'
|
|
802
|
-
'
|
|
815
|
+
'when_first': function (_node, _removeOptions) { },
|
|
816
|
+
'when_let': function (_node, _removeOptions) { },
|
|
803
817
|
'when': function (_node, _removeOptions) { },
|
|
804
|
-
'
|
|
818
|
+
'when_not': function (_node, _removeOptions) { },
|
|
805
819
|
};
|
|
806
820
|
function removeCommentNodesFromSpecialExpression(node, removeOptions) {
|
|
807
821
|
var uncommenter = specialExpressionCommentRemovers[node.n];
|
|
@@ -843,6 +857,13 @@ function assertEvenNumberOfParams(node) {
|
|
|
843
857
|
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);
|
|
844
858
|
}
|
|
845
859
|
}
|
|
860
|
+
function assertOddNumberOfParams(node) {
|
|
861
|
+
var _a;
|
|
862
|
+
var length = withoutCommentNodes(node.p).length;
|
|
863
|
+
if (length % 2 !== 1) {
|
|
864
|
+
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);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
846
867
|
function assertNumberOfParams(count, node) {
|
|
847
868
|
var _a, _b;
|
|
848
869
|
assertCount({
|
|
@@ -1006,7 +1027,7 @@ function asNumber(value, sourceCodeInfo, options) {
|
|
|
1006
1027
|
}
|
|
1007
1028
|
|
|
1008
1029
|
var bitwiseNormalExpression = {
|
|
1009
|
-
'
|
|
1030
|
+
'<<': {
|
|
1010
1031
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1011
1032
|
var _b = __read(_a, 2), num = _b[0], count = _b[1];
|
|
1012
1033
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1015,7 +1036,7 @@ var bitwiseNormalExpression = {
|
|
|
1015
1036
|
},
|
|
1016
1037
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1017
1038
|
},
|
|
1018
|
-
'
|
|
1039
|
+
'>>': {
|
|
1019
1040
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1020
1041
|
var _b = __read(_a, 2), num = _b[0], count = _b[1];
|
|
1021
1042
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1024,7 +1045,7 @@ var bitwiseNormalExpression = {
|
|
|
1024
1045
|
},
|
|
1025
1046
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1026
1047
|
},
|
|
1027
|
-
'
|
|
1048
|
+
'>>>': {
|
|
1028
1049
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1029
1050
|
var _b = __read(_a, 2), num = _b[0], count = _b[1];
|
|
1030
1051
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1033,7 +1054,7 @@ var bitwiseNormalExpression = {
|
|
|
1033
1054
|
},
|
|
1034
1055
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1035
1056
|
},
|
|
1036
|
-
'
|
|
1057
|
+
'~': {
|
|
1037
1058
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1038
1059
|
var _b = __read(_a, 1), num = _b[0];
|
|
1039
1060
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1041,7 +1062,7 @@ var bitwiseNormalExpression = {
|
|
|
1041
1062
|
},
|
|
1042
1063
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
1043
1064
|
},
|
|
1044
|
-
'
|
|
1065
|
+
'&': {
|
|
1045
1066
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1046
1067
|
var _b = __read(_a), first = _b[0], rest = _b.slice(1);
|
|
1047
1068
|
assertNumber(first, sourceCodeInfo, { integer: true });
|
|
@@ -1052,7 +1073,7 @@ var bitwiseNormalExpression = {
|
|
|
1052
1073
|
},
|
|
1053
1074
|
validate: function (node) { return assertNumberOfParams({ min: 2 }, node); },
|
|
1054
1075
|
},
|
|
1055
|
-
'
|
|
1076
|
+
'&!': {
|
|
1056
1077
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1057
1078
|
var _b = __read(_a), first = _b[0], rest = _b.slice(1);
|
|
1058
1079
|
assertNumber(first, sourceCodeInfo, { integer: true });
|
|
@@ -1063,7 +1084,7 @@ var bitwiseNormalExpression = {
|
|
|
1063
1084
|
},
|
|
1064
1085
|
validate: function (node) { return assertNumberOfParams({ min: 2 }, node); },
|
|
1065
1086
|
},
|
|
1066
|
-
'
|
|
1087
|
+
'|': {
|
|
1067
1088
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1068
1089
|
var _b = __read(_a), first = _b[0], rest = _b.slice(1);
|
|
1069
1090
|
assertNumber(first, sourceCodeInfo, { integer: true });
|
|
@@ -1074,7 +1095,7 @@ var bitwiseNormalExpression = {
|
|
|
1074
1095
|
},
|
|
1075
1096
|
validate: function (node) { return assertNumberOfParams({ min: 2 }, node); },
|
|
1076
1097
|
},
|
|
1077
|
-
'
|
|
1098
|
+
'^': {
|
|
1078
1099
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1079
1100
|
var _b = __read(_a), first = _b[0], rest = _b.slice(1);
|
|
1080
1101
|
assertNumber(first, sourceCodeInfo, { integer: true });
|
|
@@ -1085,7 +1106,7 @@ var bitwiseNormalExpression = {
|
|
|
1085
1106
|
},
|
|
1086
1107
|
validate: function (node) { return assertNumberOfParams({ min: 2 }, node); },
|
|
1087
1108
|
},
|
|
1088
|
-
'
|
|
1109
|
+
'bit_flip': {
|
|
1089
1110
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1090
1111
|
var _b = __read(_a, 2), num = _b[0], index = _b[1];
|
|
1091
1112
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1095,7 +1116,7 @@ var bitwiseNormalExpression = {
|
|
|
1095
1116
|
},
|
|
1096
1117
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1097
1118
|
},
|
|
1098
|
-
'
|
|
1119
|
+
'bit_set': {
|
|
1099
1120
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1100
1121
|
var _b = __read(_a, 2), num = _b[0], index = _b[1];
|
|
1101
1122
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1105,7 +1126,7 @@ var bitwiseNormalExpression = {
|
|
|
1105
1126
|
},
|
|
1106
1127
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1107
1128
|
},
|
|
1108
|
-
'
|
|
1129
|
+
'bit_clear': {
|
|
1109
1130
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1110
1131
|
var _b = __read(_a, 2), num = _b[0], index = _b[1];
|
|
1111
1132
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1115,7 +1136,7 @@ var bitwiseNormalExpression = {
|
|
|
1115
1136
|
},
|
|
1116
1137
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1117
1138
|
},
|
|
1118
|
-
'
|
|
1139
|
+
'bit_test': {
|
|
1119
1140
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1120
1141
|
var _b = __read(_a, 2), num = _b[0], index = _b[1];
|
|
1121
1142
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -2814,7 +2835,7 @@ var mathNormalExpression = {
|
|
|
2814
2835
|
},
|
|
2815
2836
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
2816
2837
|
},
|
|
2817
|
-
'
|
|
2838
|
+
'%': {
|
|
2818
2839
|
evaluate: function (_a, sourceCodeInfo) {
|
|
2819
2840
|
var _b = __read(_a, 2), dividend = _b[0], divisor = _b[1];
|
|
2820
2841
|
assertNumber(dividend, sourceCodeInfo);
|
|
@@ -2840,7 +2861,7 @@ var mathNormalExpression = {
|
|
|
2840
2861
|
},
|
|
2841
2862
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
2842
2863
|
},
|
|
2843
|
-
'
|
|
2864
|
+
'**': {
|
|
2844
2865
|
evaluate: function (_a, sourceCodeInfo) {
|
|
2845
2866
|
var _b = __read(_a, 2), first = _b[0], second = _b[1];
|
|
2846
2867
|
assertNumber(first, sourceCodeInfo);
|
|
@@ -3117,10 +3138,6 @@ var mathNormalExpression = {
|
|
|
3117
3138
|
},
|
|
3118
3139
|
};
|
|
3119
3140
|
|
|
3120
|
-
var version = "2.0.13";
|
|
3121
|
-
|
|
3122
|
-
var uuidTemplate = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
|
|
3123
|
-
var xyRegexp = /[xy]/g;
|
|
3124
3141
|
var miscNormalExpression = {
|
|
3125
3142
|
'!=': {
|
|
3126
3143
|
evaluate: function (params) {
|
|
@@ -3134,7 +3151,7 @@ var miscNormalExpression = {
|
|
|
3134
3151
|
},
|
|
3135
3152
|
validate: function (node) { return assertNumberOfParams({ min: 1 }, node); },
|
|
3136
3153
|
},
|
|
3137
|
-
'
|
|
3154
|
+
'==': {
|
|
3138
3155
|
evaluate: function (_a) {
|
|
3139
3156
|
var e_1, _b;
|
|
3140
3157
|
var _c = __read(_a), first = _c[0], rest = _c.slice(1);
|
|
@@ -3259,20 +3276,14 @@ var miscNormalExpression = {
|
|
|
3259
3276
|
},
|
|
3260
3277
|
validate: function (node) { return assertNumberOfParams({ min: 1 }, node); },
|
|
3261
3278
|
},
|
|
3262
|
-
'
|
|
3279
|
+
'!': {
|
|
3263
3280
|
evaluate: function (_a) {
|
|
3264
3281
|
var _b = __read(_a, 1), first = _b[0];
|
|
3265
3282
|
return !first;
|
|
3266
3283
|
},
|
|
3267
3284
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3268
3285
|
},
|
|
3269
|
-
'
|
|
3270
|
-
evaluate: function () {
|
|
3271
|
-
return Date.now();
|
|
3272
|
-
},
|
|
3273
|
-
validate: function (node) { return assertNumberOfParams(0, node); },
|
|
3274
|
-
},
|
|
3275
|
-
'inst-ms->iso-date-time': {
|
|
3286
|
+
'epoch>iso_date': {
|
|
3276
3287
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3277
3288
|
var _b = __read(_a, 1), ms = _b[0];
|
|
3278
3289
|
assertNumber(ms, sourceCodeInfo);
|
|
@@ -3280,7 +3291,7 @@ var miscNormalExpression = {
|
|
|
3280
3291
|
},
|
|
3281
3292
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3282
3293
|
},
|
|
3283
|
-
'
|
|
3294
|
+
'iso_date>epoch': {
|
|
3284
3295
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3285
3296
|
var _b = __read(_a, 1), dateTime = _b[0];
|
|
3286
3297
|
assertString(dateTime, sourceCodeInfo);
|
|
@@ -3313,23 +3324,7 @@ var miscNormalExpression = {
|
|
|
3313
3324
|
},
|
|
3314
3325
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
3315
3326
|
},
|
|
3316
|
-
'
|
|
3317
|
-
evaluate: function () {
|
|
3318
|
-
return uuidTemplate.replace(xyRegexp, function (character) {
|
|
3319
|
-
var randomNbr = Math.floor(Math.random() * 16);
|
|
3320
|
-
var newValue = character === 'x' ? randomNbr : (randomNbr & 0x3) | 0x8;
|
|
3321
|
-
return newValue.toString(16);
|
|
3322
|
-
});
|
|
3323
|
-
},
|
|
3324
|
-
validate: function (node) { return assertNumberOfParams(0, node); },
|
|
3325
|
-
},
|
|
3326
|
-
'lits-version!': {
|
|
3327
|
-
evaluate: function () {
|
|
3328
|
-
return version;
|
|
3329
|
-
},
|
|
3330
|
-
validate: function (node) { return assertNumberOfParams(0, node); },
|
|
3331
|
-
},
|
|
3332
|
-
'json-parse': {
|
|
3327
|
+
'json_parse': {
|
|
3333
3328
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3334
3329
|
var _b = __read(_a, 1), first = _b[0];
|
|
3335
3330
|
assertString(first, sourceCodeInfo);
|
|
@@ -3338,7 +3333,7 @@ var miscNormalExpression = {
|
|
|
3338
3333
|
},
|
|
3339
3334
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3340
3335
|
},
|
|
3341
|
-
'
|
|
3336
|
+
'json_stringify': {
|
|
3342
3337
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3343
3338
|
var _b = __read(_a, 2), first = _b[0], second = _b[1];
|
|
3344
3339
|
assertAny(first, sourceCodeInfo);
|
|
@@ -3551,7 +3546,7 @@ var assertNormalExpression = {
|
|
|
3551
3546
|
};
|
|
3552
3547
|
|
|
3553
3548
|
var objectNormalExpression = {
|
|
3554
|
-
|
|
3549
|
+
object: {
|
|
3555
3550
|
evaluate: function (params, sourceCodeInfo) {
|
|
3556
3551
|
var result = {};
|
|
3557
3552
|
for (var i = 0; i < params.length; i += 2) {
|
|
@@ -3564,7 +3559,7 @@ var objectNormalExpression = {
|
|
|
3564
3559
|
},
|
|
3565
3560
|
validate: function (node) { return assertEvenNumberOfParams(node); },
|
|
3566
3561
|
},
|
|
3567
|
-
|
|
3562
|
+
keys: {
|
|
3568
3563
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3569
3564
|
var _b = __read(_a, 1), obj = _b[0];
|
|
3570
3565
|
assertObj(obj, sourceCodeInfo);
|
|
@@ -3572,7 +3567,7 @@ var objectNormalExpression = {
|
|
|
3572
3567
|
},
|
|
3573
3568
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3574
3569
|
},
|
|
3575
|
-
|
|
3570
|
+
vals: {
|
|
3576
3571
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3577
3572
|
var _b = __read(_a, 1), obj = _b[0];
|
|
3578
3573
|
assertObj(obj, sourceCodeInfo);
|
|
@@ -3580,7 +3575,7 @@ var objectNormalExpression = {
|
|
|
3580
3575
|
},
|
|
3581
3576
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3582
3577
|
},
|
|
3583
|
-
|
|
3578
|
+
entries: {
|
|
3584
3579
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3585
3580
|
var _b = __read(_a, 1), obj = _b[0];
|
|
3586
3581
|
assertObj(obj, sourceCodeInfo);
|
|
@@ -3588,7 +3583,7 @@ var objectNormalExpression = {
|
|
|
3588
3583
|
},
|
|
3589
3584
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3590
3585
|
},
|
|
3591
|
-
|
|
3586
|
+
find: {
|
|
3592
3587
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3593
3588
|
var _b = __read(_a, 2), obj = _b[0], key = _b[1];
|
|
3594
3589
|
assertObj(obj, sourceCodeInfo);
|
|
@@ -3599,7 +3594,7 @@ var objectNormalExpression = {
|
|
|
3599
3594
|
},
|
|
3600
3595
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
3601
3596
|
},
|
|
3602
|
-
|
|
3597
|
+
dissoc: {
|
|
3603
3598
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3604
3599
|
var _b = __read(_a, 2), obj = _b[0], key = _b[1];
|
|
3605
3600
|
assertObj(obj, sourceCodeInfo);
|
|
@@ -3610,7 +3605,7 @@ var objectNormalExpression = {
|
|
|
3610
3605
|
},
|
|
3611
3606
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
3612
3607
|
},
|
|
3613
|
-
|
|
3608
|
+
merge: {
|
|
3614
3609
|
evaluate: function (params, sourceCodeInfo) {
|
|
3615
3610
|
if (params.length === 0)
|
|
3616
3611
|
return null;
|
|
@@ -3623,7 +3618,7 @@ var objectNormalExpression = {
|
|
|
3623
3618
|
},
|
|
3624
3619
|
validate: function (node) { return assertNumberOfParams({ min: 0 }, node); },
|
|
3625
3620
|
},
|
|
3626
|
-
|
|
3621
|
+
merge_with: {
|
|
3627
3622
|
evaluate: function (params, sourceCodeInfo, contextStack, _a) {
|
|
3628
3623
|
var executeFunction = _a.executeFunction;
|
|
3629
3624
|
var first = params[0];
|
|
@@ -3646,7 +3641,7 @@ var objectNormalExpression = {
|
|
|
3646
3641
|
},
|
|
3647
3642
|
validate: function (node) { return assertNumberOfParams({ min: 2 }, node); },
|
|
3648
3643
|
},
|
|
3649
|
-
|
|
3644
|
+
zipmap: {
|
|
3650
3645
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3651
3646
|
var _b = __read(_a, 2), keys = _b[0], values = _b[1];
|
|
3652
3647
|
assertStringArray(keys, sourceCodeInfo);
|
|
@@ -3661,7 +3656,7 @@ var objectNormalExpression = {
|
|
|
3661
3656
|
},
|
|
3662
3657
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
3663
3658
|
},
|
|
3664
|
-
|
|
3659
|
+
select_keys: {
|
|
3665
3660
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3666
3661
|
var _b = __read(_a, 2), obj = _b[0], keys = _b[1];
|
|
3667
3662
|
assertStringArray(keys, sourceCodeInfo);
|
|
@@ -3927,7 +3922,7 @@ var stringNormalExpression = {
|
|
|
3927
3922
|
},
|
|
3928
3923
|
validate: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
|
|
3929
3924
|
},
|
|
3930
|
-
'
|
|
3925
|
+
'string_repeat': {
|
|
3931
3926
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3932
3927
|
var _b = __read(_a, 2), str = _b[0], count = _b[1];
|
|
3933
3928
|
assertString(str, sourceCodeInfo);
|
|
@@ -3961,27 +3956,7 @@ var stringNormalExpression = {
|
|
|
3961
3956
|
},
|
|
3962
3957
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3963
3958
|
},
|
|
3964
|
-
'
|
|
3965
|
-
evaluate: function (params, sourceCodeInfo) {
|
|
3966
|
-
var _a = __read(params, 2), num = _a[0], base = _a[1];
|
|
3967
|
-
assertNumber(num, sourceCodeInfo, { finite: true });
|
|
3968
|
-
if (params.length === 1) {
|
|
3969
|
-
return "".concat(num);
|
|
3970
|
-
}
|
|
3971
|
-
else {
|
|
3972
|
-
assertNumber(base, sourceCodeInfo, { finite: true });
|
|
3973
|
-
if (base !== 2 && base !== 8 && base !== 10 && base !== 16) {
|
|
3974
|
-
throw new LitsError("Expected \"number-to-string\" base argument to be 2, 8, 10 or 16, got: ".concat(base), sourceCodeInfo);
|
|
3975
|
-
}
|
|
3976
|
-
if (base === 10)
|
|
3977
|
-
return "".concat(num);
|
|
3978
|
-
assertNumber(num, sourceCodeInfo, { integer: true, nonNegative: true });
|
|
3979
|
-
return Number(num).toString(base);
|
|
3980
|
-
}
|
|
3981
|
-
},
|
|
3982
|
-
validate: function (node) { return assertNumberOfParams({ min: 1, max: 2 }, node); },
|
|
3983
|
-
},
|
|
3984
|
-
'from-char-code': {
|
|
3959
|
+
'from_char_code': {
|
|
3985
3960
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3986
3961
|
var _b = __read(_a, 1), num = _b[0];
|
|
3987
3962
|
assertNumber(num, sourceCodeInfo, { finite: true });
|
|
@@ -3995,7 +3970,7 @@ var stringNormalExpression = {
|
|
|
3995
3970
|
},
|
|
3996
3971
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3997
3972
|
},
|
|
3998
|
-
'
|
|
3973
|
+
'to_char_code': {
|
|
3999
3974
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4000
3975
|
var _b = __read(_a, 1), str = _b[0];
|
|
4001
3976
|
assertString(str, sourceCodeInfo, { nonEmpty: true });
|
|
@@ -4003,7 +3978,7 @@ var stringNormalExpression = {
|
|
|
4003
3978
|
},
|
|
4004
3979
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4005
3980
|
},
|
|
4006
|
-
'
|
|
3981
|
+
'lower_case': {
|
|
4007
3982
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4008
3983
|
var _b = __read(_a, 1), str = _b[0];
|
|
4009
3984
|
assertString(str, sourceCodeInfo);
|
|
@@ -4011,7 +3986,7 @@ var stringNormalExpression = {
|
|
|
4011
3986
|
},
|
|
4012
3987
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4013
3988
|
},
|
|
4014
|
-
'
|
|
3989
|
+
'upper_case': {
|
|
4015
3990
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4016
3991
|
var _b = __read(_a, 1), str = _b[0];
|
|
4017
3992
|
assertString(str, sourceCodeInfo);
|
|
@@ -4027,7 +4002,7 @@ var stringNormalExpression = {
|
|
|
4027
4002
|
},
|
|
4028
4003
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4029
4004
|
},
|
|
4030
|
-
'
|
|
4005
|
+
'trim_left': {
|
|
4031
4006
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4032
4007
|
var _b = __read(_a, 1), str = _b[0];
|
|
4033
4008
|
assertString(str, sourceCodeInfo);
|
|
@@ -4035,7 +4010,7 @@ var stringNormalExpression = {
|
|
|
4035
4010
|
},
|
|
4036
4011
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4037
4012
|
},
|
|
4038
|
-
'
|
|
4013
|
+
'trim_right': {
|
|
4039
4014
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4040
4015
|
var _b = __read(_a, 1), str = _b[0];
|
|
4041
4016
|
assertString(str, sourceCodeInfo);
|
|
@@ -4043,6 +4018,30 @@ var stringNormalExpression = {
|
|
|
4043
4018
|
},
|
|
4044
4019
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4045
4020
|
},
|
|
4021
|
+
'++': {
|
|
4022
|
+
evaluate: function (params, sourceCodeInfo) {
|
|
4023
|
+
if (params.length === 0) {
|
|
4024
|
+
return '';
|
|
4025
|
+
}
|
|
4026
|
+
var first = params[0];
|
|
4027
|
+
if (first !== null) {
|
|
4028
|
+
assertStringOrNumber(first, sourceCodeInfo);
|
|
4029
|
+
}
|
|
4030
|
+
if (params.length === 1) {
|
|
4031
|
+
return first === null ? '' : "".concat(first);
|
|
4032
|
+
}
|
|
4033
|
+
return params.slice(1).reduce(function (acc, str) {
|
|
4034
|
+
if (str !== null) {
|
|
4035
|
+
assertStringOrNumber(str, sourceCodeInfo);
|
|
4036
|
+
}
|
|
4037
|
+
if (str === null) {
|
|
4038
|
+
return acc;
|
|
4039
|
+
}
|
|
4040
|
+
return "".concat(acc).concat(str);
|
|
4041
|
+
}, first === null ? '' : "".concat(first));
|
|
4042
|
+
},
|
|
4043
|
+
validate: function () { return undefined; },
|
|
4044
|
+
},
|
|
4046
4045
|
'join': {
|
|
4047
4046
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4048
4047
|
var _b = __read(_a, 2), stringList = _b[0], delimiter = _b[1];
|
|
@@ -4067,7 +4066,7 @@ var stringNormalExpression = {
|
|
|
4067
4066
|
},
|
|
4068
4067
|
validate: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
|
|
4069
4068
|
},
|
|
4070
|
-
'
|
|
4069
|
+
'pad_left': {
|
|
4071
4070
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4072
4071
|
var _b = __read(_a, 3), str = _b[0], length = _b[1], padString = _b[2];
|
|
4073
4072
|
assertString(str, sourceCodeInfo);
|
|
@@ -4078,7 +4077,7 @@ var stringNormalExpression = {
|
|
|
4078
4077
|
},
|
|
4079
4078
|
validate: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
|
|
4080
4079
|
},
|
|
4081
|
-
'
|
|
4080
|
+
'pad_right': {
|
|
4082
4081
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4083
4082
|
var _b = __read(_a, 3), str = _b[0], length = _b[1], padString = _b[2];
|
|
4084
4083
|
assertString(str, sourceCodeInfo);
|
|
@@ -4120,7 +4119,7 @@ var stringNormalExpression = {
|
|
|
4120
4119
|
},
|
|
4121
4120
|
validate: function (node) { return assertNumberOfParams({ min: 1, max: 10 }, node); },
|
|
4122
4121
|
},
|
|
4123
|
-
'
|
|
4122
|
+
'encode_base64': {
|
|
4124
4123
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4125
4124
|
var _b = __read(_a, 1), value = _b[0];
|
|
4126
4125
|
assertString(value, sourceCodeInfo);
|
|
@@ -4131,7 +4130,7 @@ var stringNormalExpression = {
|
|
|
4131
4130
|
},
|
|
4132
4131
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4133
4132
|
},
|
|
4134
|
-
'
|
|
4133
|
+
'decode_base64': {
|
|
4135
4134
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4136
4135
|
var _b = __read(_a, 1), value = _b[0];
|
|
4137
4136
|
assertString(value, sourceCodeInfo);
|
|
@@ -4149,7 +4148,7 @@ var stringNormalExpression = {
|
|
|
4149
4148
|
},
|
|
4150
4149
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4151
4150
|
},
|
|
4152
|
-
'
|
|
4151
|
+
'encode_uri_component': {
|
|
4153
4152
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4154
4153
|
var _b = __read(_a, 1), value = _b[0];
|
|
4155
4154
|
assertString(value, sourceCodeInfo);
|
|
@@ -4157,7 +4156,7 @@ var stringNormalExpression = {
|
|
|
4157
4156
|
},
|
|
4158
4157
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4159
4158
|
},
|
|
4160
|
-
'
|
|
4159
|
+
'decode_uri_component': {
|
|
4161
4160
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4162
4161
|
var _b = __read(_a, 1), value = _b[0];
|
|
4163
4162
|
assertString(value, sourceCodeInfo);
|
|
@@ -4326,7 +4325,7 @@ var andSpecialExpression = {
|
|
|
4326
4325
|
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
4327
4326
|
var node = {
|
|
4328
4327
|
t: AstNodeType.SpecialExpression,
|
|
4329
|
-
n: '
|
|
4328
|
+
n: '&&',
|
|
4330
4329
|
p: params,
|
|
4331
4330
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
4332
4331
|
};
|
|
@@ -4411,6 +4410,37 @@ var condSpecialExpression = {
|
|
|
4411
4410
|
},
|
|
4412
4411
|
};
|
|
4413
4412
|
|
|
4413
|
+
var switchSpecialExpression = {
|
|
4414
|
+
polishParse: getCommonPolishSpecialExpressionParser('switch'),
|
|
4415
|
+
validateParameterCount: function (node) { return assertOddNumberOfParams(node); },
|
|
4416
|
+
evaluate: function (node, contextStack, _a) {
|
|
4417
|
+
var e_1, _b;
|
|
4418
|
+
var evaluateAstNode = _a.evaluateAstNode;
|
|
4419
|
+
var switchValue = evaluateAstNode(node.p[0], contextStack);
|
|
4420
|
+
try {
|
|
4421
|
+
for (var _c = __values(arrayToPairs(node.p.slice(1))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
4422
|
+
var _e = __read(_d.value, 2), test = _e[0], form = _e[1];
|
|
4423
|
+
var value = evaluateAstNode(test, contextStack);
|
|
4424
|
+
if (value === switchValue) {
|
|
4425
|
+
return evaluateAstNode(form, contextStack);
|
|
4426
|
+
}
|
|
4427
|
+
}
|
|
4428
|
+
}
|
|
4429
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
4430
|
+
finally {
|
|
4431
|
+
try {
|
|
4432
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
4433
|
+
}
|
|
4434
|
+
finally { if (e_1) throw e_1.error; }
|
|
4435
|
+
}
|
|
4436
|
+
return null;
|
|
4437
|
+
},
|
|
4438
|
+
findUnresolvedIdentifiers: function (node, contextStack, _a) {
|
|
4439
|
+
var findUnresolvedIdentifiers = _a.findUnresolvedIdentifiers, builtin = _a.builtin;
|
|
4440
|
+
return findUnresolvedIdentifiers(node.p, contextStack, builtin);
|
|
4441
|
+
},
|
|
4442
|
+
};
|
|
4443
|
+
|
|
4414
4444
|
var declaredSpecialExpression = {
|
|
4415
4445
|
polishParse: getCommonPolishSpecialExpressionParser('declared?'),
|
|
4416
4446
|
validateParameterCount: function (node) { return assertNumberOfParams(1, node); },
|
|
@@ -4883,7 +4913,7 @@ function parseFunctionArguments(tokenStream, parseState, parsers) {
|
|
|
4883
4913
|
tkn = asToken(tokenStream.tokens[parseState.position]);
|
|
4884
4914
|
if (node.t === AstNodeType.Modifier) {
|
|
4885
4915
|
switch (node.v) {
|
|
4886
|
-
case '&':
|
|
4916
|
+
case '&rest':
|
|
4887
4917
|
if (state === 'rest')
|
|
4888
4918
|
throw new LitsError('& can only appear once', (_a = getTokenDebugData(tkn)) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
|
|
4889
4919
|
state = 'rest';
|
|
@@ -4958,7 +4988,7 @@ var ifLetSpecialExpression = {
|
|
|
4958
4988
|
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
4959
4989
|
var node = {
|
|
4960
4990
|
t: AstNodeType.SpecialExpression,
|
|
4961
|
-
n: '
|
|
4991
|
+
n: 'if_let',
|
|
4962
4992
|
b: asNonUndefined(bindings[0], (_c = getTokenDebugData(firstToken)) === null || _c === void 0 ? void 0 : _c.sourceCodeInfo),
|
|
4963
4993
|
p: params,
|
|
4964
4994
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
@@ -4995,7 +5025,7 @@ var ifLetSpecialExpression = {
|
|
|
4995
5025
|
};
|
|
4996
5026
|
|
|
4997
5027
|
var ifNotSpecialExpression = {
|
|
4998
|
-
polishParse: getCommonPolishSpecialExpressionParser('
|
|
5028
|
+
polishParse: getCommonPolishSpecialExpressionParser('if_not'),
|
|
4999
5029
|
validateParameterCount: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
|
|
5000
5030
|
evaluate: function (node, contextStack, _a) {
|
|
5001
5031
|
var _b;
|
|
@@ -5205,7 +5235,7 @@ function parseLoopBinding(tokenStream, parseState, _a) {
|
|
|
5205
5235
|
loopBinding.we = parseToken(tokenStream, parseState);
|
|
5206
5236
|
loopBinding.m.push('&while');
|
|
5207
5237
|
break;
|
|
5208
|
-
case '&':
|
|
5238
|
+
case '&rest':
|
|
5209
5239
|
throw new LitsError("Illegal modifier: ".concat(modifier), (_e = getTokenDebugData(tkn)) === null || _e === void 0 ? void 0 : _e.sourceCodeInfo);
|
|
5210
5240
|
default:
|
|
5211
5241
|
throw new LitsError("Illegal modifier: ".concat(modifier), (_f = getTokenDebugData(tkn)) === null || _f === void 0 ? void 0 : _f.sourceCodeInfo);
|
|
@@ -5405,7 +5435,7 @@ var doseqSpecialExpression = {
|
|
|
5405
5435
|
};
|
|
5406
5436
|
|
|
5407
5437
|
var orSpecialExpression = {
|
|
5408
|
-
polishParse: getCommonPolishSpecialExpressionParser('
|
|
5438
|
+
polishParse: getCommonPolishSpecialExpressionParser('||'),
|
|
5409
5439
|
validateParameterCount: function () { return undefined; },
|
|
5410
5440
|
evaluate: function (node, contextStack, _a) {
|
|
5411
5441
|
var e_1, _b;
|
|
@@ -5497,25 +5527,6 @@ var throwSpecialExpression = {
|
|
|
5497
5527
|
},
|
|
5498
5528
|
};
|
|
5499
5529
|
|
|
5500
|
-
var timeSpecialExpression = {
|
|
5501
|
-
polishParse: getCommonPolishSpecialExpressionParser('time!'),
|
|
5502
|
-
validateParameterCount: function (node) { return assertNumberOfParams(1, node); },
|
|
5503
|
-
evaluate: function (node, contextStack, _a) {
|
|
5504
|
-
var evaluateAstNode = _a.evaluateAstNode;
|
|
5505
|
-
var param = node.p[0];
|
|
5506
|
-
var startTime = Date.now();
|
|
5507
|
-
var result = evaluateAstNode(param, contextStack);
|
|
5508
|
-
var totalTime = Date.now() - startTime;
|
|
5509
|
-
// eslint-disable-next-line no-console
|
|
5510
|
-
console.log("Elapsed time: ".concat(totalTime, " ms"));
|
|
5511
|
-
return result;
|
|
5512
|
-
},
|
|
5513
|
-
findUnresolvedIdentifiers: function (node, contextStack, _a) {
|
|
5514
|
-
var findUnresolvedIdentifiers = _a.findUnresolvedIdentifiers, builtin = _a.builtin;
|
|
5515
|
-
return findUnresolvedIdentifiers(node.p, contextStack, builtin);
|
|
5516
|
-
},
|
|
5517
|
-
};
|
|
5518
|
-
|
|
5519
5530
|
var trySpecialExpression = {
|
|
5520
5531
|
polishParse: function (tokenStream, parseState, firstToken, _a) {
|
|
5521
5532
|
var _b, _c, _d;
|
|
@@ -5616,7 +5627,7 @@ var whenFirstSpecialExpression = {
|
|
|
5616
5627
|
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
5617
5628
|
var node = {
|
|
5618
5629
|
t: AstNodeType.SpecialExpression,
|
|
5619
|
-
n: '
|
|
5630
|
+
n: 'when_first',
|
|
5620
5631
|
b: asNonUndefined(bindings[0], (_c = getTokenDebugData(firstToken)) === null || _c === void 0 ? void 0 : _c.sourceCodeInfo),
|
|
5621
5632
|
p: params,
|
|
5622
5633
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
@@ -5678,7 +5689,7 @@ var whenLetSpecialExpression = {
|
|
|
5678
5689
|
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
5679
5690
|
var node = {
|
|
5680
5691
|
t: AstNodeType.SpecialExpression,
|
|
5681
|
-
n: '
|
|
5692
|
+
n: 'when_let',
|
|
5682
5693
|
b: asNonUndefined(bindings[0], (_c = getTokenDebugData(firstToken)) === null || _c === void 0 ? void 0 : _c.sourceCodeInfo),
|
|
5683
5694
|
p: params,
|
|
5684
5695
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
@@ -5724,7 +5735,7 @@ var whenLetSpecialExpression = {
|
|
|
5724
5735
|
};
|
|
5725
5736
|
|
|
5726
5737
|
var whenNotSpecialExpression = {
|
|
5727
|
-
polishParse: getCommonPolishSpecialExpressionParser('
|
|
5738
|
+
polishParse: getCommonPolishSpecialExpressionParser('when_not'),
|
|
5728
5739
|
validateParameterCount: function (node) { return assertNumberOfParams({ min: 1 }, node); },
|
|
5729
5740
|
evaluate: function (node, contextStack, _a) {
|
|
5730
5741
|
var e_1, _b;
|
|
@@ -5757,9 +5768,10 @@ var whenNotSpecialExpression = {
|
|
|
5757
5768
|
};
|
|
5758
5769
|
|
|
5759
5770
|
var specialExpressions = {
|
|
5760
|
-
'
|
|
5771
|
+
'&&': andSpecialExpression,
|
|
5761
5772
|
'comment': commentSpecialExpression,
|
|
5762
5773
|
'cond': condSpecialExpression,
|
|
5774
|
+
'switch': switchSpecialExpression,
|
|
5763
5775
|
'def': defSpecialExpression,
|
|
5764
5776
|
'defn': defnSpecialExpression,
|
|
5765
5777
|
'defns': defnsSpecialExpression,
|
|
@@ -5769,19 +5781,18 @@ var specialExpressions = {
|
|
|
5769
5781
|
'for': forSpecialExpression,
|
|
5770
5782
|
'fn': fnSpecialExpression,
|
|
5771
5783
|
'if': ifSpecialExpression,
|
|
5772
|
-
'
|
|
5773
|
-
'
|
|
5784
|
+
'if_let': ifLetSpecialExpression,
|
|
5785
|
+
'if_not': ifNotSpecialExpression,
|
|
5774
5786
|
'let': letSpecialExpression,
|
|
5775
5787
|
'loop': loopSpecialExpression,
|
|
5776
|
-
'
|
|
5788
|
+
'||': orSpecialExpression,
|
|
5777
5789
|
'recur': recurSpecialExpression,
|
|
5778
5790
|
'throw': throwSpecialExpression,
|
|
5779
|
-
'time!': timeSpecialExpression,
|
|
5780
5791
|
'try': trySpecialExpression,
|
|
5781
5792
|
'when': whenSpecialExpression,
|
|
5782
|
-
'
|
|
5783
|
-
'
|
|
5784
|
-
'
|
|
5793
|
+
'when_first': whenFirstSpecialExpression,
|
|
5794
|
+
'when_let': whenLetSpecialExpression,
|
|
5795
|
+
'when_not': whenNotSpecialExpression,
|
|
5785
5796
|
'declared?': declaredSpecialExpression,
|
|
5786
5797
|
'??': qqSpecialExpression,
|
|
5787
5798
|
};
|
|
@@ -6338,7 +6349,7 @@ var calculateAndOutcomes = function (_a) {
|
|
|
6338
6349
|
var astNode = _a.astNode, combinateAstNodes = _a.combinateAstNodes;
|
|
6339
6350
|
return combinateAstNodes(astNode.p)
|
|
6340
6351
|
.map(function (p) { return ({
|
|
6341
|
-
n: '
|
|
6352
|
+
n: '&&',
|
|
6342
6353
|
t: AstNodeType.SpecialExpression,
|
|
6343
6354
|
p: p,
|
|
6344
6355
|
token: astNode.token,
|
|
@@ -6460,7 +6471,7 @@ var calculateIfNotOutcomes = function (_a) {
|
|
|
6460
6471
|
if (isAstComputable(condition)) {
|
|
6461
6472
|
return combinateAstNodes(astNode.p)
|
|
6462
6473
|
.map(function (p) { return ({
|
|
6463
|
-
n: '
|
|
6474
|
+
n: 'if_not',
|
|
6464
6475
|
t: astNode.t,
|
|
6465
6476
|
p: p,
|
|
6466
6477
|
token: astNode.token,
|
|
@@ -6573,7 +6584,7 @@ var calculateOrOutcomes = function (_a) {
|
|
|
6573
6584
|
var astNode = _a.astNode, combinateAstNodes = _a.combinateAstNodes;
|
|
6574
6585
|
return combinateAstNodes(astNode.p)
|
|
6575
6586
|
.map(function (p) { return ({
|
|
6576
|
-
n: '
|
|
6587
|
+
n: '||',
|
|
6577
6588
|
t: AstNodeType.SpecialExpression,
|
|
6578
6589
|
p: p,
|
|
6579
6590
|
token: astNode.token,
|
|
@@ -6593,12 +6604,6 @@ var calculateThrowOutcomes = function (_a) {
|
|
|
6593
6604
|
return calculatePossibleAstNodes(astNode.p[0]).map(function (m) { return (__assign(__assign({}, astNode), { p: [m] })); });
|
|
6594
6605
|
};
|
|
6595
6606
|
|
|
6596
|
-
var calculateTimeOutcomes = function (_a) {
|
|
6597
|
-
var astNode = _a.astNode, calculatePossibleAstNodes = _a.calculatePossibleAstNodes;
|
|
6598
|
-
return calculatePossibleAstNodes(astNode.p[0])
|
|
6599
|
-
.map(function (p) { return (__assign(__assign({}, astNode), { n: 'do', p: [p] })); });
|
|
6600
|
-
};
|
|
6601
|
-
|
|
6602
6607
|
var calculateTryOutcomes = function (_a) {
|
|
6603
6608
|
var astNode = _a.astNode, calculatePossibleAstNodes = _a.calculatePossibleAstNodes;
|
|
6604
6609
|
var _b = calculatePossibleAstNodes(astNode.p[0]).reduce(function (acc, node) {
|
|
@@ -6672,7 +6677,7 @@ var calculateWhenNotOutcomes = function (_a) {
|
|
|
6672
6677
|
if (isAstComputable(condition)) {
|
|
6673
6678
|
return combinateAstNodes(astNode.p)
|
|
6674
6679
|
.map(function (p) { return ({
|
|
6675
|
-
n: '
|
|
6680
|
+
n: 'when_not',
|
|
6676
6681
|
t: astNode.t,
|
|
6677
6682
|
p: p,
|
|
6678
6683
|
token: astNode.token,
|
|
@@ -6731,10 +6736,22 @@ var calculateLoopOutcomes = function (_a) {
|
|
|
6731
6736
|
.map(function (p) { return (__assign(__assign({}, astNode), { p: p })); });
|
|
6732
6737
|
};
|
|
6733
6738
|
|
|
6739
|
+
var calculateSwitchOutcomes = function (_a) {
|
|
6740
|
+
var astNode = _a.astNode, nilNode = _a.nilNode, calculatePossibleAstNodes = _a.calculatePossibleAstNodes;
|
|
6741
|
+
// TODO be smarter about this
|
|
6742
|
+
return __spreadArray(__spreadArray([], __read(arrayToPairs(astNode.p.slice(1)).flatMap(function (_a) {
|
|
6743
|
+
var _b = __read(_a, 2); _b[0]; var form = _b[1];
|
|
6744
|
+
return calculatePossibleAstNodes(form);
|
|
6745
|
+
})), false), [
|
|
6746
|
+
nilNode,
|
|
6747
|
+
], false);
|
|
6748
|
+
};
|
|
6749
|
+
|
|
6734
6750
|
var specialExpressionCalculator = {
|
|
6735
|
-
'
|
|
6751
|
+
'&&': function (astNode, helperOptions) { return calculateAndOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6736
6752
|
'comment': function (astNode, helperOptions) { return calculateCommentOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6737
6753
|
'cond': function (astNode, helperOptions) { return calculateCondOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6754
|
+
'switch': function (astNode, helperOptions) { return calculateSwitchOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6738
6755
|
'declared?': function (astNode, helperOptions) { return calculateDeclaredOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6739
6756
|
'defn': function (astNode, helperOptions) { return calculateDefnOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6740
6757
|
'def': function (astNode, helperOptions) { return calculateDefOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
@@ -6744,27 +6761,22 @@ var specialExpressionCalculator = {
|
|
|
6744
6761
|
'doseq': function (astNode, helperOptions) { return calculateDoSeqOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6745
6762
|
'fn': function (astNode, helperOptions) { return calculateFnOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6746
6763
|
'for': function (astNode, helperOptions) { return calculateForOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6747
|
-
'
|
|
6764
|
+
'if_let': function (astNode, helperOptions) { return calculateIfLetOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6748
6765
|
'if': function (astNode, helperOptions) { return calculateIfOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6749
|
-
'
|
|
6766
|
+
'if_not': function (astNode, helperOptions) { return calculateIfNotOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6750
6767
|
'let': function (astNode, helperOptions) { return calculateLetOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6751
6768
|
'loop': function (astNode, helperOptions) { return calculateLoopOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6752
|
-
'
|
|
6769
|
+
'||': function (astNode, helperOptions) { return calculateOrOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6753
6770
|
'??': function (astNode, helperOptions) { return calculateQqOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6754
6771
|
'recur': function (astNode, helperOptions) { return calculateRecurOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6755
|
-
'time!': function (astNode, helperOptions) { return calculateTimeOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6756
6772
|
'throw': function (astNode, helperOptions) { return calculateThrowOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6757
6773
|
'try': function (astNode, helperOptions) { return calculateTryOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6758
|
-
'
|
|
6759
|
-
'
|
|
6774
|
+
'when_first': function (astNode, helperOptions) { return calculateWhenFirstOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6775
|
+
'when_let': function (astNode, helperOptions) { return calculateWhenLetOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6760
6776
|
'when': function (astNode, helperOptions) { return calculateWhenOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6761
|
-
'
|
|
6777
|
+
'when_not': function (astNode, helperOptions) { return calculateWhenNotOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6762
6778
|
};
|
|
6763
6779
|
|
|
6764
|
-
function isIdempotent(normalExpressionName) {
|
|
6765
|
-
return !normalExpressionName.endsWith('!')
|
|
6766
|
-
|| normalExpressionName === 'write!';
|
|
6767
|
-
}
|
|
6768
6780
|
function calculateOutcomes(contextStack, astNodes) {
|
|
6769
6781
|
// First, we try to calculate outcomes for the whole astNodes array.
|
|
6770
6782
|
// If that fails, we try to calculate outcomes for the array without the first element.
|
|
@@ -6839,8 +6851,6 @@ function calculatePossibleAstNodes(contextStack, astNode, newIndentifiers) {
|
|
|
6839
6851
|
: undefined;
|
|
6840
6852
|
var newContextStack = newContext ? contextStack.create(newContext) : contextStack;
|
|
6841
6853
|
if (astNode.t === AstNodeType.NormalExpression) {
|
|
6842
|
-
if (astNode.n && !isIdempotent(astNode.n))
|
|
6843
|
-
throw new Error("NormalExpressionNode with name ".concat(astNode.n, " is not idempotent. Cannot calculate possible ASTs."));
|
|
6844
6854
|
return combinate(astNode.p.map(function (n) { return calculatePossibleAstNodes(newContextStack, n); }))
|
|
6845
6855
|
.map(function (p) { return (__assign(__assign({}, astNode), { p: p })); });
|
|
6846
6856
|
}
|
|
@@ -7067,13 +7077,10 @@ function fromUnaryAlgebraicToAstNode(operator, operand) {
|
|
|
7067
7077
|
var operatorName = operator[1];
|
|
7068
7078
|
switch (operatorName) {
|
|
7069
7079
|
case '+':
|
|
7070
|
-
return createNamedNormalExpressionNode('+', [operand], token);
|
|
7071
7080
|
case '-':
|
|
7072
|
-
return createNamedNormalExpressionNode('-', [operand], token);
|
|
7073
7081
|
case '!':
|
|
7074
|
-
return createNamedNormalExpressionNode('not', [operand], token);
|
|
7075
7082
|
case '~':
|
|
7076
|
-
return createNamedNormalExpressionNode(
|
|
7083
|
+
return createNamedNormalExpressionNode(operatorName, [operand], token);
|
|
7077
7084
|
/* v8 ignore next 2 */
|
|
7078
7085
|
default:
|
|
7079
7086
|
throw new Error("Unknown operator: ".concat(operatorName));
|
|
@@ -7086,68 +7093,36 @@ function fromBinaryOperatorToAstNode(operator, left, right, token) {
|
|
|
7086
7093
|
case '.':
|
|
7087
7094
|
return createAccessorNode(left, fromSymbolToStringNode(asSymbolNode(right, (_a = getTokenDebugData(token)) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo)), token);
|
|
7088
7095
|
case '**': // exponentiation
|
|
7089
|
-
return createNamedNormalExpressionNode('pow', [left, right], token);
|
|
7090
7096
|
case '*':
|
|
7091
|
-
return createNamedNormalExpressionNode('*', [left, right], token);
|
|
7092
7097
|
case '/':
|
|
7093
|
-
return createNamedNormalExpressionNode('/', [left, right], token);
|
|
7094
7098
|
case '%':
|
|
7095
|
-
return createNamedNormalExpressionNode('rem', [left, right], token);
|
|
7096
7099
|
case '+':
|
|
7097
|
-
return createNamedNormalExpressionNode('+', [left, right], token);
|
|
7098
7100
|
case '-':
|
|
7099
|
-
return createNamedNormalExpressionNode('-', [left, right], token);
|
|
7100
7101
|
case '<<':
|
|
7101
|
-
return createNamedNormalExpressionNode('bit-shift-left', [left, right], token);
|
|
7102
7102
|
case '>>':
|
|
7103
|
-
return createNamedNormalExpressionNode('bit-shift-right', [left, right], token);
|
|
7104
7103
|
case '>>>':
|
|
7105
|
-
|
|
7106
|
-
case '++': {
|
|
7107
|
-
var leftString = createNamedNormalExpressionNode('str', [left], token);
|
|
7108
|
-
var rightString = createNamedNormalExpressionNode('str', [right], token);
|
|
7109
|
-
return createNamedNormalExpressionNode('str', [leftString, rightString], token);
|
|
7110
|
-
}
|
|
7104
|
+
case '++':
|
|
7111
7105
|
case '<':
|
|
7112
|
-
return createNamedNormalExpressionNode('<', [left, right], token);
|
|
7113
7106
|
case '<=':
|
|
7114
|
-
return createNamedNormalExpressionNode('<=', [left, right], token);
|
|
7115
7107
|
case '>':
|
|
7116
|
-
return createNamedNormalExpressionNode('>', [left, right], token);
|
|
7117
7108
|
case '>=':
|
|
7118
|
-
return createNamedNormalExpressionNode('>=', [left, right], token);
|
|
7119
7109
|
case '==':
|
|
7120
|
-
return createNamedNormalExpressionNode('=', [left, right], token);
|
|
7121
7110
|
case '!=':
|
|
7122
|
-
return createNamedNormalExpressionNode('!=', [left, right], token);
|
|
7123
7111
|
case '&':
|
|
7124
|
-
return createNamedNormalExpressionNode('bit-and', [left, right], token);
|
|
7125
7112
|
case '^':
|
|
7126
|
-
return createNamedNormalExpressionNode('bit-xor', [left, right], token);
|
|
7127
7113
|
case '|':
|
|
7128
|
-
return createNamedNormalExpressionNode(
|
|
7114
|
+
return createNamedNormalExpressionNode(operatorName, [left, right], token);
|
|
7129
7115
|
case '&&':
|
|
7130
|
-
return {
|
|
7131
|
-
t: AstNodeType.SpecialExpression,
|
|
7132
|
-
n: 'and',
|
|
7133
|
-
p: [left, right],
|
|
7134
|
-
token: getTokenDebugData(token) && token,
|
|
7135
|
-
};
|
|
7136
7116
|
case '||':
|
|
7137
|
-
return {
|
|
7138
|
-
t: AstNodeType.SpecialExpression,
|
|
7139
|
-
n: 'or',
|
|
7140
|
-
p: [left, right],
|
|
7141
|
-
token: getTokenDebugData(token) && token,
|
|
7142
|
-
};
|
|
7143
7117
|
case '??':
|
|
7144
7118
|
return {
|
|
7145
7119
|
t: AstNodeType.SpecialExpression,
|
|
7146
|
-
n:
|
|
7120
|
+
n: operatorName,
|
|
7147
7121
|
p: [left, right],
|
|
7148
7122
|
token: getTokenDebugData(token) && token,
|
|
7149
7123
|
};
|
|
7150
7124
|
/* v8 ignore next 8 */
|
|
7125
|
+
case ';':
|
|
7151
7126
|
case '!':
|
|
7152
7127
|
case '~':
|
|
7153
7128
|
case '=':
|
|
@@ -7168,14 +7143,52 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7168
7143
|
this.parseState.position += 1;
|
|
7169
7144
|
};
|
|
7170
7145
|
AlgebraicParser.prototype.parse = function () {
|
|
7171
|
-
|
|
7146
|
+
var nodes = [];
|
|
7147
|
+
while (!this.isAtEnd()) {
|
|
7148
|
+
nodes.push(this.parseExpression());
|
|
7149
|
+
if (!isA_OperatorToken(this.peek(), ';')) {
|
|
7150
|
+
break;
|
|
7151
|
+
}
|
|
7152
|
+
this.advance();
|
|
7153
|
+
}
|
|
7154
|
+
return nodes;
|
|
7172
7155
|
};
|
|
7173
7156
|
AlgebraicParser.prototype.parseExpression = function (precedence) {
|
|
7174
7157
|
var _a;
|
|
7175
7158
|
if (precedence === void 0) { precedence = 0; }
|
|
7176
|
-
var
|
|
7177
|
-
|
|
7178
|
-
|
|
7159
|
+
var firstToken = this.peek();
|
|
7160
|
+
if (isA_SymbolToken(firstToken) && firstToken[1] === 'def') {
|
|
7161
|
+
return this.parseDef(firstToken);
|
|
7162
|
+
}
|
|
7163
|
+
else if (isA_SymbolToken(firstToken) && firstToken[1] === 'defn') {
|
|
7164
|
+
return this.parseDefn(firstToken);
|
|
7165
|
+
}
|
|
7166
|
+
var left;
|
|
7167
|
+
if (isA_SymbolToken(firstToken) && firstToken[1] === 'if') {
|
|
7168
|
+
left = this.parseIf(firstToken);
|
|
7169
|
+
}
|
|
7170
|
+
else if (isA_SymbolToken(firstToken) && firstToken[1] === 'cond') {
|
|
7171
|
+
left = this.parseCond(firstToken);
|
|
7172
|
+
}
|
|
7173
|
+
else if (isA_SymbolToken(firstToken) && firstToken[1] === 'switch') {
|
|
7174
|
+
left = this.parseSwitch(firstToken);
|
|
7175
|
+
}
|
|
7176
|
+
else if (isA_SymbolToken(firstToken) && firstToken[1] === 'for') {
|
|
7177
|
+
left = this.parseFor(firstToken);
|
|
7178
|
+
}
|
|
7179
|
+
else {
|
|
7180
|
+
left = this.parseOperand();
|
|
7181
|
+
}
|
|
7182
|
+
var operator = this.peek();
|
|
7183
|
+
while (!this.isAtEnd()
|
|
7184
|
+
&& !isA_OperatorToken(operator, ',')
|
|
7185
|
+
&& !isA_OperatorToken(operator, ';')
|
|
7186
|
+
&& !isRBracketToken(operator)
|
|
7187
|
+
&& !isA_ReservedSymbolToken(operator, 'else')
|
|
7188
|
+
&& !isA_ReservedSymbolToken(operator, 'then')
|
|
7189
|
+
&& !isA_ReservedSymbolToken(operator, 'end')
|
|
7190
|
+
&& !isA_ReservedSymbolToken(operator, 'case')
|
|
7191
|
+
&& !isRParenToken(operator)) {
|
|
7179
7192
|
if (isA_BinaryOperatorToken(operator)) {
|
|
7180
7193
|
var name_1 = operator[1];
|
|
7181
7194
|
var newPrecedece = getPrecedence(name_1);
|
|
@@ -7205,6 +7218,7 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7205
7218
|
else {
|
|
7206
7219
|
break;
|
|
7207
7220
|
}
|
|
7221
|
+
operator = this.peek();
|
|
7208
7222
|
}
|
|
7209
7223
|
if (!left) {
|
|
7210
7224
|
throw new LitsError('Expected operand', (_a = getTokenDebugData(this.peek())) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
|
|
@@ -7405,9 +7419,6 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7405
7419
|
var _a, _b;
|
|
7406
7420
|
var isNamedFunction = symbol.t === AstNodeType.Symbol;
|
|
7407
7421
|
this.advance();
|
|
7408
|
-
if (isNamedFunction && symbol.v === 'for') {
|
|
7409
|
-
return this.parseFor(symbol);
|
|
7410
|
-
}
|
|
7411
7422
|
var params = [];
|
|
7412
7423
|
while (!this.isAtEnd() && !isRParenToken(this.peek())) {
|
|
7413
7424
|
params.push(this.parseExpression());
|
|
@@ -7428,17 +7439,14 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7428
7439
|
var name_2 = symbol.v;
|
|
7429
7440
|
switch (name_2) {
|
|
7430
7441
|
case '??':
|
|
7431
|
-
case '
|
|
7442
|
+
case '&&':
|
|
7432
7443
|
case 'comment':
|
|
7433
|
-
case 'cond':
|
|
7434
7444
|
case 'declared?':
|
|
7435
|
-
case '
|
|
7436
|
-
case '
|
|
7437
|
-
case 'or':
|
|
7445
|
+
case 'if_not':
|
|
7446
|
+
case '||':
|
|
7438
7447
|
case 'when':
|
|
7439
|
-
case '
|
|
7448
|
+
case 'when_not':
|
|
7440
7449
|
case 'do':
|
|
7441
|
-
case 'time!':
|
|
7442
7450
|
case 'throw': {
|
|
7443
7451
|
var node = {
|
|
7444
7452
|
t: AstNodeType.SpecialExpression,
|
|
@@ -7451,13 +7459,11 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7451
7459
|
}
|
|
7452
7460
|
case 'let':
|
|
7453
7461
|
return this.parseLet(symbol, params);
|
|
7454
|
-
case 'def':
|
|
7455
7462
|
case 'defs':
|
|
7456
|
-
case '
|
|
7457
|
-
case '
|
|
7458
|
-
case '
|
|
7463
|
+
case 'if_let':
|
|
7464
|
+
case 'when_let':
|
|
7465
|
+
case 'when_first':
|
|
7459
7466
|
case 'fn':
|
|
7460
|
-
case 'defn':
|
|
7461
7467
|
case 'defns':
|
|
7462
7468
|
case 'try':
|
|
7463
7469
|
case 'recur':
|
|
@@ -7480,8 +7486,32 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7480
7486
|
}
|
|
7481
7487
|
};
|
|
7482
7488
|
AlgebraicParser.prototype.parseLambdaFunction = function () {
|
|
7483
|
-
var _a, _b;
|
|
7484
7489
|
var firstToken = this.peek();
|
|
7490
|
+
try {
|
|
7491
|
+
var _a = this.parseFunctionArguments(), functionArguments = _a.functionArguments, arity = _a.arity;
|
|
7492
|
+
if (!isA_OperatorToken(this.peek(), '=>')) {
|
|
7493
|
+
return null;
|
|
7494
|
+
}
|
|
7495
|
+
this.advance();
|
|
7496
|
+
var body = this.parseExpression();
|
|
7497
|
+
return {
|
|
7498
|
+
t: AstNodeType.SpecialExpression,
|
|
7499
|
+
n: 'fn',
|
|
7500
|
+
p: [],
|
|
7501
|
+
o: [{
|
|
7502
|
+
as: functionArguments,
|
|
7503
|
+
b: [body],
|
|
7504
|
+
a: arity,
|
|
7505
|
+
}],
|
|
7506
|
+
token: getTokenDebugData(firstToken) && firstToken,
|
|
7507
|
+
};
|
|
7508
|
+
}
|
|
7509
|
+
catch (_b) {
|
|
7510
|
+
return null;
|
|
7511
|
+
}
|
|
7512
|
+
};
|
|
7513
|
+
AlgebraicParser.prototype.parseFunctionArguments = function () {
|
|
7514
|
+
var _a, _b, _c, _d, _e;
|
|
7485
7515
|
this.advance();
|
|
7486
7516
|
var rest = false;
|
|
7487
7517
|
var letBindingObject;
|
|
@@ -7504,7 +7534,7 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7504
7534
|
}
|
|
7505
7535
|
var symbolToken = this.peek();
|
|
7506
7536
|
if (!isA_SymbolToken(symbolToken)) {
|
|
7507
|
-
|
|
7537
|
+
throw new LitsError('Expected symbol', (_c = getTokenDebugData(this.peek())) === null || _c === void 0 ? void 0 : _c.sourceCodeInfo);
|
|
7508
7538
|
}
|
|
7509
7539
|
if (rest) {
|
|
7510
7540
|
restArg = symbolToken[1];
|
|
@@ -7515,47 +7545,36 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7515
7545
|
this.advance();
|
|
7516
7546
|
}
|
|
7517
7547
|
if (!isA_OperatorToken(this.peek(), ',') && !isRParenToken(this.peek())) {
|
|
7518
|
-
|
|
7548
|
+
throw new LitsError('Expected comma or closing parenthesis', (_d = getTokenDebugData(this.peek())) === null || _d === void 0 ? void 0 : _d.sourceCodeInfo);
|
|
7519
7549
|
}
|
|
7520
7550
|
if (isA_OperatorToken(this.peek(), ',')) {
|
|
7521
7551
|
this.advance();
|
|
7522
7552
|
}
|
|
7523
7553
|
}
|
|
7554
|
+
var arity = restArg !== undefined ? { min: args.length } : args.length;
|
|
7524
7555
|
if (!isRParenToken(this.peek())) {
|
|
7525
|
-
|
|
7556
|
+
throw new LitsError('Expected closing parenthesis', (_e = getTokenDebugData(this.peek())) === null || _e === void 0 ? void 0 : _e.sourceCodeInfo);
|
|
7526
7557
|
}
|
|
7527
|
-
this.advance();
|
|
7528
|
-
if (!isA_OperatorToken(this.peek(), '=>')) {
|
|
7529
|
-
return null;
|
|
7530
|
-
}
|
|
7531
|
-
this.advance();
|
|
7532
7558
|
var letBindings = letBindingObject ? arrayToPairs(letBindingObject.p) : [];
|
|
7533
|
-
var
|
|
7534
|
-
|
|
7559
|
+
var functionArguments = {
|
|
7560
|
+
m: args,
|
|
7561
|
+
r: restArg,
|
|
7562
|
+
b: letBindings.map(function (pair) {
|
|
7563
|
+
var key = pair[0];
|
|
7564
|
+
var value = pair[1];
|
|
7565
|
+
return {
|
|
7566
|
+
t: AstNodeType.Binding,
|
|
7567
|
+
n: key.v,
|
|
7568
|
+
v: value,
|
|
7569
|
+
p: [],
|
|
7570
|
+
token: getTokenDebugData(key.token) && key.token,
|
|
7571
|
+
};
|
|
7572
|
+
}),
|
|
7573
|
+
};
|
|
7574
|
+
this.advance();
|
|
7535
7575
|
return {
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
p: [],
|
|
7539
|
-
o: [{
|
|
7540
|
-
as: {
|
|
7541
|
-
m: args,
|
|
7542
|
-
r: restArg,
|
|
7543
|
-
b: letBindings.map(function (pair) {
|
|
7544
|
-
var key = pair[0];
|
|
7545
|
-
var value = pair[1];
|
|
7546
|
-
return {
|
|
7547
|
-
t: AstNodeType.Binding,
|
|
7548
|
-
n: key.v,
|
|
7549
|
-
v: value,
|
|
7550
|
-
p: [],
|
|
7551
|
-
token: getTokenDebugData(key.token) && key.token,
|
|
7552
|
-
};
|
|
7553
|
-
}),
|
|
7554
|
-
},
|
|
7555
|
-
b: [body],
|
|
7556
|
-
a: arity,
|
|
7557
|
-
}],
|
|
7558
|
-
token: getTokenDebugData(firstToken) && firstToken,
|
|
7576
|
+
functionArguments: functionArguments,
|
|
7577
|
+
arity: arity,
|
|
7559
7578
|
};
|
|
7560
7579
|
};
|
|
7561
7580
|
AlgebraicParser.prototype.parseShorthandLamdaFunction = function () {
|
|
@@ -7640,38 +7659,39 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7640
7659
|
}),
|
|
7641
7660
|
};
|
|
7642
7661
|
};
|
|
7643
|
-
AlgebraicParser.prototype.parseFor = function (
|
|
7662
|
+
AlgebraicParser.prototype.parseFor = function (token) {
|
|
7663
|
+
this.advance();
|
|
7664
|
+
assertLParenToken(this.peek());
|
|
7665
|
+
this.advance();
|
|
7644
7666
|
var forLoopBindings = [
|
|
7645
7667
|
this.parseForLoopBinding(),
|
|
7646
7668
|
];
|
|
7647
|
-
|
|
7648
|
-
while (isA_SymbolToken(nextToken) && nextToken[1] === 'of') {
|
|
7669
|
+
while (!this.isAtEnd() && !isRParenToken(this.peek())) {
|
|
7649
7670
|
forLoopBindings.push(this.parseForLoopBinding());
|
|
7650
|
-
|
|
7671
|
+
if (isA_OperatorToken(this.peek(), ',')) {
|
|
7672
|
+
this.advance();
|
|
7673
|
+
}
|
|
7651
7674
|
}
|
|
7652
|
-
var expression = this.parseExpression();
|
|
7653
7675
|
assertRParenToken(this.peek());
|
|
7654
7676
|
this.advance();
|
|
7677
|
+
var expression = this.parseExpression();
|
|
7678
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7679
|
+
this.advance();
|
|
7655
7680
|
return {
|
|
7656
7681
|
t: AstNodeType.SpecialExpression,
|
|
7657
7682
|
n: 'for',
|
|
7658
7683
|
p: [expression],
|
|
7659
|
-
token: getTokenDebugData(
|
|
7684
|
+
token: getTokenDebugData(token) && token,
|
|
7660
7685
|
l: forLoopBindings,
|
|
7661
7686
|
};
|
|
7662
7687
|
};
|
|
7663
|
-
// export interface LoopBindingNode {
|
|
7664
|
-
// b: BindingNode // Binding
|
|
7665
|
-
// m: Array<'&let' | '&when' | '&while'> // Modifiers
|
|
7666
|
-
// l?: BindingNode[] // Let-Bindings
|
|
7667
|
-
// wn?: AstNode // When Node
|
|
7668
|
-
// we?: AstNode // While Node
|
|
7669
|
-
// }
|
|
7670
7688
|
AlgebraicParser.prototype.parseForLoopBinding = function () {
|
|
7671
7689
|
var _a;
|
|
7672
7690
|
var bindingNode = this.parseBinding();
|
|
7673
|
-
if (isA_OperatorToken(this.peek(), ',')) {
|
|
7674
|
-
this.
|
|
7691
|
+
if (isRParenToken(this.peek()) || isA_OperatorToken(this.peek(), ',')) {
|
|
7692
|
+
if (isA_OperatorToken(this.peek(), ',')) {
|
|
7693
|
+
this.advance();
|
|
7694
|
+
}
|
|
7675
7695
|
return {
|
|
7676
7696
|
b: bindingNode,
|
|
7677
7697
|
m: [],
|
|
@@ -7717,8 +7737,9 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7717
7737
|
}
|
|
7718
7738
|
token = this.peek();
|
|
7719
7739
|
}
|
|
7720
|
-
|
|
7721
|
-
|
|
7740
|
+
if (isA_OperatorToken(token, ',')) {
|
|
7741
|
+
this.advance();
|
|
7742
|
+
}
|
|
7722
7743
|
return {
|
|
7723
7744
|
b: bindingNode,
|
|
7724
7745
|
m: modifiers,
|
|
@@ -7747,15 +7768,185 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7747
7768
|
};
|
|
7748
7769
|
return node;
|
|
7749
7770
|
};
|
|
7771
|
+
AlgebraicParser.prototype.parseIf = function (token) {
|
|
7772
|
+
this.advance();
|
|
7773
|
+
var condition = this.parseExpression();
|
|
7774
|
+
assertA_ReservedSymbolToken(this.peek(), 'then');
|
|
7775
|
+
this.advance();
|
|
7776
|
+
var thenExpressions = [];
|
|
7777
|
+
while (!this.isAtEnd()
|
|
7778
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'else')
|
|
7779
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7780
|
+
thenExpressions.push(this.parseExpression());
|
|
7781
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7782
|
+
this.advance();
|
|
7783
|
+
}
|
|
7784
|
+
}
|
|
7785
|
+
var thenExpression = thenExpressions.length === 1
|
|
7786
|
+
? thenExpressions[0]
|
|
7787
|
+
: {
|
|
7788
|
+
t: AstNodeType.SpecialExpression,
|
|
7789
|
+
n: 'do',
|
|
7790
|
+
p: thenExpressions,
|
|
7791
|
+
token: getTokenDebugData(token) && token,
|
|
7792
|
+
};
|
|
7793
|
+
var elseExpression;
|
|
7794
|
+
if (isA_ReservedSymbolToken(this.peek(), 'else')) {
|
|
7795
|
+
this.advance();
|
|
7796
|
+
var elseExpressions = [];
|
|
7797
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7798
|
+
elseExpressions.push(this.parseExpression());
|
|
7799
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7800
|
+
this.advance();
|
|
7801
|
+
}
|
|
7802
|
+
}
|
|
7803
|
+
elseExpression = elseExpressions.length === 1
|
|
7804
|
+
? elseExpressions[0]
|
|
7805
|
+
: {
|
|
7806
|
+
t: AstNodeType.SpecialExpression,
|
|
7807
|
+
n: 'do',
|
|
7808
|
+
p: elseExpressions,
|
|
7809
|
+
token: getTokenDebugData(token) && token,
|
|
7810
|
+
};
|
|
7811
|
+
}
|
|
7812
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7813
|
+
this.advance();
|
|
7814
|
+
var params = [condition, thenExpression];
|
|
7815
|
+
if (elseExpression) {
|
|
7816
|
+
params.push(elseExpression);
|
|
7817
|
+
}
|
|
7818
|
+
return {
|
|
7819
|
+
t: AstNodeType.SpecialExpression,
|
|
7820
|
+
n: 'if',
|
|
7821
|
+
p: params,
|
|
7822
|
+
token: getTokenDebugData(token) && token,
|
|
7823
|
+
};
|
|
7824
|
+
};
|
|
7825
|
+
AlgebraicParser.prototype.parseCond = function (token) {
|
|
7826
|
+
this.advance();
|
|
7827
|
+
var params = [];
|
|
7828
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7829
|
+
assertA_ReservedSymbolToken(this.peek(), 'case');
|
|
7830
|
+
this.advance();
|
|
7831
|
+
params.push(this.parseExpression());
|
|
7832
|
+
assertA_ReservedSymbolToken(this.peek(), 'then');
|
|
7833
|
+
this.advance();
|
|
7834
|
+
var expressions = [];
|
|
7835
|
+
while (!this.isAtEnd()
|
|
7836
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'case')
|
|
7837
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7838
|
+
expressions.push(this.parseExpression());
|
|
7839
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7840
|
+
this.advance();
|
|
7841
|
+
}
|
|
7842
|
+
}
|
|
7843
|
+
params.push(expressions.length === 1
|
|
7844
|
+
? expressions[0]
|
|
7845
|
+
: {
|
|
7846
|
+
t: AstNodeType.SpecialExpression,
|
|
7847
|
+
n: 'do',
|
|
7848
|
+
p: expressions,
|
|
7849
|
+
token: getTokenDebugData(token) && token,
|
|
7850
|
+
});
|
|
7851
|
+
if (isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7852
|
+
break;
|
|
7853
|
+
}
|
|
7854
|
+
assertA_ReservedSymbolToken(this.peek(), 'case');
|
|
7855
|
+
}
|
|
7856
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7857
|
+
this.advance();
|
|
7858
|
+
return {
|
|
7859
|
+
t: AstNodeType.SpecialExpression,
|
|
7860
|
+
n: 'cond',
|
|
7861
|
+
p: params,
|
|
7862
|
+
token: getTokenDebugData(token) && token,
|
|
7863
|
+
};
|
|
7864
|
+
};
|
|
7865
|
+
AlgebraicParser.prototype.parseSwitch = function (token) {
|
|
7866
|
+
this.advance();
|
|
7867
|
+
var params = [this.parseExpression()];
|
|
7868
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7869
|
+
assertA_ReservedSymbolToken(this.peek(), 'case');
|
|
7870
|
+
this.advance();
|
|
7871
|
+
params.push(this.parseExpression());
|
|
7872
|
+
assertA_ReservedSymbolToken(this.peek(), 'then');
|
|
7873
|
+
this.advance();
|
|
7874
|
+
var expressions = [];
|
|
7875
|
+
while (!this.isAtEnd()
|
|
7876
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'case')
|
|
7877
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7878
|
+
expressions.push(this.parseExpression());
|
|
7879
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7880
|
+
this.advance();
|
|
7881
|
+
}
|
|
7882
|
+
}
|
|
7883
|
+
params.push(expressions.length === 1
|
|
7884
|
+
? expressions[0]
|
|
7885
|
+
: {
|
|
7886
|
+
t: AstNodeType.SpecialExpression,
|
|
7887
|
+
n: 'do',
|
|
7888
|
+
p: expressions,
|
|
7889
|
+
token: getTokenDebugData(token) && token,
|
|
7890
|
+
});
|
|
7891
|
+
if (isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7892
|
+
break;
|
|
7893
|
+
}
|
|
7894
|
+
assertA_ReservedSymbolToken(this.peek(), 'case');
|
|
7895
|
+
}
|
|
7896
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7897
|
+
this.advance();
|
|
7898
|
+
return {
|
|
7899
|
+
t: AstNodeType.SpecialExpression,
|
|
7900
|
+
n: 'switch',
|
|
7901
|
+
p: params,
|
|
7902
|
+
token: getTokenDebugData(token) && token,
|
|
7903
|
+
};
|
|
7904
|
+
};
|
|
7905
|
+
AlgebraicParser.prototype.parseDef = function (token) {
|
|
7906
|
+
this.advance();
|
|
7907
|
+
var symbol = parseSymbol(this.tokenStream, this.parseState);
|
|
7908
|
+
assertA_OperatorToken(this.peek(), '=');
|
|
7909
|
+
this.advance();
|
|
7910
|
+
var value = this.parseExpression();
|
|
7911
|
+
return {
|
|
7912
|
+
t: AstNodeType.SpecialExpression,
|
|
7913
|
+
n: 'def',
|
|
7914
|
+
p: [symbol, value],
|
|
7915
|
+
token: getTokenDebugData(token) && token,
|
|
7916
|
+
};
|
|
7917
|
+
};
|
|
7918
|
+
AlgebraicParser.prototype.parseDefn = function (token) {
|
|
7919
|
+
this.advance();
|
|
7920
|
+
var symbol = parseSymbol(this.tokenStream, this.parseState);
|
|
7921
|
+
var _a = this.parseFunctionArguments(), functionArguments = _a.functionArguments, arity = _a.arity;
|
|
7922
|
+
var body = [];
|
|
7923
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7924
|
+
body.push(this.parseExpression());
|
|
7925
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7926
|
+
this.advance();
|
|
7927
|
+
}
|
|
7928
|
+
}
|
|
7929
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7930
|
+
this.advance();
|
|
7931
|
+
return {
|
|
7932
|
+
t: AstNodeType.SpecialExpression,
|
|
7933
|
+
n: 'defn',
|
|
7934
|
+
f: symbol,
|
|
7935
|
+
p: [],
|
|
7936
|
+
o: [{
|
|
7937
|
+
as: functionArguments,
|
|
7938
|
+
b: body,
|
|
7939
|
+
a: arity,
|
|
7940
|
+
}],
|
|
7941
|
+
token: getTokenDebugData(token) && token,
|
|
7942
|
+
};
|
|
7943
|
+
};
|
|
7750
7944
|
AlgebraicParser.prototype.isAtEnd = function () {
|
|
7751
7945
|
return this.parseState.position >= this.tokenStream.tokens.length;
|
|
7752
7946
|
};
|
|
7753
7947
|
AlgebraicParser.prototype.peek = function () {
|
|
7754
7948
|
return this.tokenStream.tokens[this.parseState.position];
|
|
7755
7949
|
};
|
|
7756
|
-
AlgebraicParser.prototype.peekAhead = function () {
|
|
7757
|
-
return this.tokenStream.tokens[this.parseState.position + 1];
|
|
7758
|
-
};
|
|
7759
7950
|
return AlgebraicParser;
|
|
7760
7951
|
}());
|
|
7761
7952
|
|
|
@@ -8036,10 +8227,18 @@ function parsePolishToken(tokenStream, parseState) {
|
|
|
8036
8227
|
parseState.position += 1;
|
|
8037
8228
|
parseState.algebraic = true;
|
|
8038
8229
|
var algebraicParser = new AlgebraicParser(tokenStream, parseState);
|
|
8039
|
-
var
|
|
8230
|
+
var nodes = algebraicParser.parse();
|
|
8040
8231
|
assertEndNotationToken(tokenStream.tokens[parseState.position++]);
|
|
8041
8232
|
parseState.algebraic = false;
|
|
8042
|
-
|
|
8233
|
+
if (nodes.length === 1) {
|
|
8234
|
+
return nodes[0];
|
|
8235
|
+
}
|
|
8236
|
+
return {
|
|
8237
|
+
t: AstNodeType.SpecialExpression,
|
|
8238
|
+
n: 'do',
|
|
8239
|
+
p: nodes,
|
|
8240
|
+
token: nodes[0].token,
|
|
8241
|
+
};
|
|
8043
8242
|
}
|
|
8044
8243
|
case 'PolNotation': {
|
|
8045
8244
|
var astNodes = [];
|
|
@@ -8106,13 +8305,22 @@ function removeUnnecessaryTokens(tokenStream) {
|
|
|
8106
8305
|
function parseToken(tokenStream, parseState) {
|
|
8107
8306
|
if (parseState.algebraic) {
|
|
8108
8307
|
var algebraicParser = new AlgebraicParser(tokenStream, parseState);
|
|
8109
|
-
|
|
8308
|
+
var nodes = algebraicParser.parse();
|
|
8309
|
+
if (nodes.length === 1) {
|
|
8310
|
+
return nodes[0];
|
|
8311
|
+
}
|
|
8312
|
+
return {
|
|
8313
|
+
t: AstNodeType.SpecialExpression,
|
|
8314
|
+
n: 'do',
|
|
8315
|
+
p: nodes,
|
|
8316
|
+
token: nodes[0].token,
|
|
8317
|
+
};
|
|
8110
8318
|
}
|
|
8111
8319
|
return parsePolishToken(tokenStream, parseState);
|
|
8112
8320
|
}
|
|
8113
8321
|
|
|
8114
|
-
var polishIdentifierCharacterClass = '[\\w
|
|
8115
|
-
var polishIdentifierFirstCharacterClass = '[a-zA-Z_
|
|
8322
|
+
var polishIdentifierCharacterClass = '[\\w@%^?=!$<>+*/:&\|~-]';
|
|
8323
|
+
var polishIdentifierFirstCharacterClass = '[a-zA-Z_@%^?=!$<>+*/&\|~-]';
|
|
8116
8324
|
var algebraicIdentifierCharacterClass = '[\\w$:!?]';
|
|
8117
8325
|
var algebraicIdentifierFirstCharacterClass = '[a-zA-Z_$]';
|
|
8118
8326
|
|
|
@@ -8192,25 +8400,28 @@ var commonTokenizers = [
|
|
|
8192
8400
|
tokenizeString,
|
|
8193
8401
|
];
|
|
8194
8402
|
|
|
8195
|
-
var
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8403
|
+
var validAlgebraicReservedNamesRecord = {
|
|
8404
|
+
true: { value: true, forbidden: false },
|
|
8405
|
+
false: { value: false, forbidden: false },
|
|
8406
|
+
nil: { value: null, forbidden: false },
|
|
8407
|
+
null: { value: null, forbidden: false },
|
|
8408
|
+
then: { value: null, forbidden: false },
|
|
8409
|
+
else: { value: null, forbidden: false },
|
|
8410
|
+
end: { value: null, forbidden: false },
|
|
8411
|
+
case: { value: null, forbidden: false },
|
|
8412
|
+
};
|
|
8413
|
+
var forbiddenAlgebraicReservedNamesRecord = {
|
|
8414
|
+
if_let: { value: null, forbidden: true },
|
|
8415
|
+
when_let: { value: null, forbidden: true },
|
|
8416
|
+
when_first: { value: null, forbidden: true },
|
|
8417
|
+
fn: { value: null, forbidden: true },
|
|
8418
|
+
defns: { value: null, forbidden: true },
|
|
8419
|
+
try: { value: null, forbidden: true },
|
|
8420
|
+
recur: { value: null, forbidden: true },
|
|
8421
|
+
loop: { value: null, forbidden: true },
|
|
8422
|
+
doseq: { value: null, forbidden: true },
|
|
8213
8423
|
};
|
|
8424
|
+
var algebraicReservedNamesRecord = __assign(__assign({}, validAlgebraicReservedNamesRecord), forbiddenAlgebraicReservedNamesRecord);
|
|
8214
8425
|
|
|
8215
8426
|
var identifierRegExp = new RegExp(algebraicIdentifierCharacterClass);
|
|
8216
8427
|
var identifierFirstCharacterRegExp = new RegExp(algebraicIdentifierFirstCharacterClass);
|
|
@@ -8282,45 +8493,19 @@ var tokenizeA_BasePrefixedNumber = function (input, position) {
|
|
|
8282
8493
|
}
|
|
8283
8494
|
return [length, ['A_BasePrefixedNumber', input.substring(position, i)]];
|
|
8284
8495
|
};
|
|
8285
|
-
var tokenizeA_ReservedSymbolToken = function (input, position) {
|
|
8286
|
-
var e_1, _a;
|
|
8287
|
-
try {
|
|
8288
|
-
for (var _b = __values(Object.entries(algebraicReservedNamesRecord)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
8289
|
-
var _d = __read(_c.value, 2), reservedName = _d[0], forbidden = _d[1].forbidden;
|
|
8290
|
-
var length_1 = reservedName.length;
|
|
8291
|
-
var nextChar = input[position + length_1];
|
|
8292
|
-
if (nextChar && identifierRegExp.test(nextChar))
|
|
8293
|
-
continue;
|
|
8294
|
-
var name_1 = input.substring(position, position + length_1);
|
|
8295
|
-
if (name_1 === reservedName) {
|
|
8296
|
-
if (forbidden)
|
|
8297
|
-
throw new LitsError("".concat(name_1, " is forbidden!"), undefined);
|
|
8298
|
-
return [length_1, ['A_ReservedSymbol', reservedName]];
|
|
8299
|
-
}
|
|
8300
|
-
}
|
|
8301
|
-
}
|
|
8302
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
8303
|
-
finally {
|
|
8304
|
-
try {
|
|
8305
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
8306
|
-
}
|
|
8307
|
-
finally { if (e_1) throw e_1.error; }
|
|
8308
|
-
}
|
|
8309
|
-
return NO_MATCH;
|
|
8310
|
-
};
|
|
8311
8496
|
var tokenizeA_Symbol = function (input, position) {
|
|
8312
8497
|
var value = input[position];
|
|
8313
8498
|
if (!value) {
|
|
8314
8499
|
return NO_MATCH;
|
|
8315
8500
|
}
|
|
8316
8501
|
if (value === '\'') {
|
|
8317
|
-
var
|
|
8318
|
-
var char = input[position +
|
|
8502
|
+
var length_1 = 1;
|
|
8503
|
+
var char = input[position + length_1];
|
|
8319
8504
|
var escaping = false;
|
|
8320
8505
|
while (char !== '\'' || escaping) {
|
|
8321
8506
|
if (char === undefined)
|
|
8322
8507
|
throw new LitsError("Unclosed string at position ".concat(position, "."), undefined);
|
|
8323
|
-
|
|
8508
|
+
length_1 += 1;
|
|
8324
8509
|
if (escaping) {
|
|
8325
8510
|
escaping = false;
|
|
8326
8511
|
value += char;
|
|
@@ -8331,10 +8516,10 @@ var tokenizeA_Symbol = function (input, position) {
|
|
|
8331
8516
|
}
|
|
8332
8517
|
value += char;
|
|
8333
8518
|
}
|
|
8334
|
-
char = input[position +
|
|
8519
|
+
char = input[position + length_1];
|
|
8335
8520
|
}
|
|
8336
8521
|
value += '\''; // closing quote
|
|
8337
|
-
return [
|
|
8522
|
+
return [length_1 + 1, ['A_Symbol', value]];
|
|
8338
8523
|
}
|
|
8339
8524
|
if (identifierFirstCharacterRegExp.test(value)) {
|
|
8340
8525
|
var initialPosition = position;
|
|
@@ -8349,6 +8534,22 @@ var tokenizeA_Symbol = function (input, position) {
|
|
|
8349
8534
|
}
|
|
8350
8535
|
return NO_MATCH;
|
|
8351
8536
|
};
|
|
8537
|
+
var tokenizeA_ReservedSymbolToken = function (input, position) {
|
|
8538
|
+
var symbolMeta = tokenizeA_Symbol(input, position);
|
|
8539
|
+
if (symbolMeta[0] === 0 || !symbolMeta[1]) {
|
|
8540
|
+
return NO_MATCH;
|
|
8541
|
+
}
|
|
8542
|
+
var symbolName = symbolMeta[1][1];
|
|
8543
|
+
symbolName = symbolName.startsWith('\'') ? symbolName.slice(1, symbolName.length - 1) : symbolName;
|
|
8544
|
+
var info = algebraicReservedNamesRecord[symbolName];
|
|
8545
|
+
if (!info) {
|
|
8546
|
+
return NO_MATCH;
|
|
8547
|
+
}
|
|
8548
|
+
if (info.forbidden) {
|
|
8549
|
+
throw new LitsError("".concat(symbolName, " is forbidden!"), undefined);
|
|
8550
|
+
}
|
|
8551
|
+
return [symbolMeta[0], ['A_ReservedSymbol', symbolName]];
|
|
8552
|
+
};
|
|
8352
8553
|
var tokenizeA_Operator = function (input, position) {
|
|
8353
8554
|
var _a;
|
|
8354
8555
|
var threeChars = input.slice(position, position + 3);
|
|
@@ -8367,30 +8568,30 @@ var tokenizeA_Operator = function (input, position) {
|
|
|
8367
8568
|
};
|
|
8368
8569
|
var tokenizeA_MultiLineComment = function (input, position) {
|
|
8369
8570
|
if (input[position] === '/' && input[position + 1] === '*') {
|
|
8370
|
-
var
|
|
8571
|
+
var length_2 = 2;
|
|
8371
8572
|
var value = '/*';
|
|
8372
|
-
while (input[position +
|
|
8373
|
-
value += input[position +
|
|
8374
|
-
|
|
8573
|
+
while (input[position + length_2] !== '*' && input[position + length_2 + 1] !== '/' && position + length_2 + 1 < input.length) {
|
|
8574
|
+
value += input[position + length_2];
|
|
8575
|
+
length_2 += 1;
|
|
8375
8576
|
}
|
|
8376
|
-
if (position +
|
|
8577
|
+
if (position + length_2 + 1 >= input.length) {
|
|
8377
8578
|
throw new LitsError('Comment not closed', undefined);
|
|
8378
8579
|
}
|
|
8379
8580
|
value += '*/';
|
|
8380
|
-
|
|
8381
|
-
return [
|
|
8581
|
+
length_2 += 2;
|
|
8582
|
+
return [length_2, ['A_MultiLineComment', value]];
|
|
8382
8583
|
}
|
|
8383
8584
|
return NO_MATCH;
|
|
8384
8585
|
};
|
|
8385
8586
|
var tokenizeA_SingleLineComment = function (input, position) {
|
|
8386
8587
|
if (input[position] === '/' && input[position + 1] === '/') {
|
|
8387
|
-
var
|
|
8588
|
+
var length_3 = 2;
|
|
8388
8589
|
var value = '//';
|
|
8389
|
-
while (input[position +
|
|
8390
|
-
value += input[position +
|
|
8391
|
-
|
|
8590
|
+
while (input[position + length_3] !== '\n' && position + length_3 < input.length) {
|
|
8591
|
+
value += input[position + length_3];
|
|
8592
|
+
length_3 += 1;
|
|
8392
8593
|
}
|
|
8393
|
-
return [
|
|
8594
|
+
return [length_3, ['A_SingleLineComment', value]];
|
|
8394
8595
|
}
|
|
8395
8596
|
return NO_MATCH;
|
|
8396
8597
|
};
|
|
@@ -8550,31 +8751,20 @@ var tokenizeP_FnShorthand = function (input, position) {
|
|
|
8550
8751
|
return [1, ['P_FnShorthand']];
|
|
8551
8752
|
};
|
|
8552
8753
|
var tokenizeP_ReservedSymbol = function (input, position) {
|
|
8553
|
-
var
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
var _d = __read(_c.value, 2), reservedName = _d[0], forbidden = _d[1].forbidden;
|
|
8557
|
-
var length_3 = reservedName.length;
|
|
8558
|
-
var nextChar = input[position + length_3];
|
|
8559
|
-
if (nextChar && P_symbolRegExp.test(nextChar)) {
|
|
8560
|
-
continue;
|
|
8561
|
-
}
|
|
8562
|
-
var symbol = input.substring(position, position + length_3);
|
|
8563
|
-
if (symbol === reservedName) {
|
|
8564
|
-
if (forbidden)
|
|
8565
|
-
throw new LitsError("".concat(symbol, " is forbidden!"), undefined);
|
|
8566
|
-
return [length_3, ['P_ReservedSymbol', reservedName]];
|
|
8567
|
-
}
|
|
8568
|
-
}
|
|
8754
|
+
var symbolMeta = tokenizeP_Symbol(input, position);
|
|
8755
|
+
if (symbolMeta[0] === 0 || !symbolMeta[1]) {
|
|
8756
|
+
return NO_MATCH;
|
|
8569
8757
|
}
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
finally { if (e_1) throw e_1.error; }
|
|
8758
|
+
var symbolName = symbolMeta[1][1];
|
|
8759
|
+
symbolName = symbolName.startsWith('\'') ? symbolName.slice(1, symbolName.length - 1) : symbolName;
|
|
8760
|
+
var info = polishReservedNamesRecord[symbolName];
|
|
8761
|
+
if (!info) {
|
|
8762
|
+
return NO_MATCH;
|
|
8576
8763
|
}
|
|
8577
|
-
|
|
8764
|
+
if (info.forbidden) {
|
|
8765
|
+
throw new LitsError("".concat(symbolName, " is forbidden!"), undefined);
|
|
8766
|
+
}
|
|
8767
|
+
return [symbolMeta[0], ['P_ReservedSymbol', symbolName]];
|
|
8578
8768
|
};
|
|
8579
8769
|
var tokenizeP_StringShorthand = function (input, position) {
|
|
8580
8770
|
if (input[position] !== ':')
|
|
@@ -8587,24 +8777,24 @@ var tokenizeP_StringShorthand = function (input, position) {
|
|
|
8587
8777
|
return [symbolDescription[0] + 1, ['P_StringShorthand', ":".concat(symbolToken[1])]];
|
|
8588
8778
|
};
|
|
8589
8779
|
var tokenizeP_Modifier = function (input, position) {
|
|
8590
|
-
var
|
|
8780
|
+
var e_1, _a;
|
|
8591
8781
|
try {
|
|
8592
8782
|
for (var modifierNames_1 = __values(modifierNames), modifierNames_1_1 = modifierNames_1.next(); !modifierNames_1_1.done; modifierNames_1_1 = modifierNames_1.next()) {
|
|
8593
8783
|
var modifierName = modifierNames_1_1.value;
|
|
8594
|
-
var
|
|
8595
|
-
var charAfterModifier = input[position +
|
|
8596
|
-
if (input.substring(position, position +
|
|
8784
|
+
var length_3 = modifierName.length;
|
|
8785
|
+
var charAfterModifier = input[position + length_3];
|
|
8786
|
+
if (input.substring(position, position + length_3) === modifierName && (!charAfterModifier || !P_symbolRegExp.test(charAfterModifier))) {
|
|
8597
8787
|
var value = modifierName;
|
|
8598
|
-
return [
|
|
8788
|
+
return [length_3, ['P_Modifier', value]];
|
|
8599
8789
|
}
|
|
8600
8790
|
}
|
|
8601
8791
|
}
|
|
8602
|
-
catch (
|
|
8792
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
8603
8793
|
finally {
|
|
8604
8794
|
try {
|
|
8605
8795
|
if (modifierNames_1_1 && !modifierNames_1_1.done && (_a = modifierNames_1.return)) _a.call(modifierNames_1);
|
|
8606
8796
|
}
|
|
8607
|
-
finally { if (
|
|
8797
|
+
finally { if (e_1) throw e_1.error; }
|
|
8608
8798
|
}
|
|
8609
8799
|
return NO_MATCH;
|
|
8610
8800
|
};
|
|
@@ -8641,8 +8831,8 @@ var polishTokenizers = __spreadArray(__spreadArray([
|
|
|
8641
8831
|
tokenizeP_StringShorthand,
|
|
8642
8832
|
tokenizeP_Number,
|
|
8643
8833
|
tokenizeP_ReservedSymbol,
|
|
8644
|
-
tokenizeP_Symbol,
|
|
8645
8834
|
tokenizeP_Modifier,
|
|
8835
|
+
tokenizeP_Symbol,
|
|
8646
8836
|
tokenizeP_RegexpShorthand,
|
|
8647
8837
|
tokenizeP_FnShorthand,
|
|
8648
8838
|
tokenizeP_CollectionAccessor,
|
|
@@ -9050,7 +9240,7 @@ var collectionReference = {
|
|
|
9050
9240
|
},
|
|
9051
9241
|
args: {
|
|
9052
9242
|
coll: {
|
|
9053
|
-
type: ['collection', 'string', '
|
|
9243
|
+
type: ['collection', 'string', 'null'],
|
|
9054
9244
|
},
|
|
9055
9245
|
},
|
|
9056
9246
|
variants: [
|
|
@@ -9139,7 +9329,7 @@ var collectionReference = {
|
|
|
9139
9329
|
},
|
|
9140
9330
|
args: {
|
|
9141
9331
|
coll: {
|
|
9142
|
-
type: ['collection', '
|
|
9332
|
+
type: ['collection', 'null'],
|
|
9143
9333
|
},
|
|
9144
9334
|
key: {
|
|
9145
9335
|
type: ['string', 'number'],
|
|
@@ -9167,7 +9357,7 @@ var collectionReference = {
|
|
|
9167
9357
|
},
|
|
9168
9358
|
args: {
|
|
9169
9359
|
coll: {
|
|
9170
|
-
type: ['collection', '
|
|
9360
|
+
type: ['collection', 'null'],
|
|
9171
9361
|
},
|
|
9172
9362
|
value: {
|
|
9173
9363
|
type: ['any'],
|
|
@@ -9370,7 +9560,7 @@ var collectionReference = {
|
|
|
9370
9560
|
},
|
|
9371
9561
|
args: {
|
|
9372
9562
|
coll: {
|
|
9373
|
-
type: ['collection', '
|
|
9563
|
+
type: ['collection', 'null'],
|
|
9374
9564
|
},
|
|
9375
9565
|
},
|
|
9376
9566
|
variants: [
|
|
@@ -9971,7 +10161,7 @@ var sequenceReference = {
|
|
|
9971
10161
|
},
|
|
9972
10162
|
args: {
|
|
9973
10163
|
'seq': {
|
|
9974
|
-
type: ['sequence', '
|
|
10164
|
+
type: ['sequence', 'null'],
|
|
9975
10165
|
},
|
|
9976
10166
|
'n': {
|
|
9977
10167
|
type: 'integer',
|
|
@@ -10033,7 +10223,7 @@ var sequenceReference = {
|
|
|
10033
10223
|
category: 'Sequence',
|
|
10034
10224
|
linkName: 'pop',
|
|
10035
10225
|
returns: {
|
|
10036
|
-
type: ['sequence', '
|
|
10226
|
+
type: ['sequence', 'null'],
|
|
10037
10227
|
array: true,
|
|
10038
10228
|
},
|
|
10039
10229
|
args: {
|
|
@@ -10086,7 +10276,7 @@ var sequenceReference = {
|
|
|
10086
10276
|
linkName: 'shift',
|
|
10087
10277
|
clojureDocs: null,
|
|
10088
10278
|
returns: {
|
|
10089
|
-
type: ['sequence', '
|
|
10279
|
+
type: ['sequence', 'null'],
|
|
10090
10280
|
array: true,
|
|
10091
10281
|
},
|
|
10092
10282
|
args: {
|
|
@@ -10283,11 +10473,11 @@ var sequenceReference = {
|
|
|
10283
10473
|
linkName: 'position',
|
|
10284
10474
|
clojureDocs: null,
|
|
10285
10475
|
returns: {
|
|
10286
|
-
type: ['number', '
|
|
10476
|
+
type: ['number', 'null'],
|
|
10287
10477
|
},
|
|
10288
10478
|
args: {
|
|
10289
10479
|
seq: {
|
|
10290
|
-
type: ['sequence', '
|
|
10480
|
+
type: ['sequence', 'null'],
|
|
10291
10481
|
},
|
|
10292
10482
|
fn: {
|
|
10293
10483
|
type: 'function',
|
|
@@ -10310,11 +10500,11 @@ var sequenceReference = {
|
|
|
10310
10500
|
linkName: 'index_of',
|
|
10311
10501
|
clojureDocs: null,
|
|
10312
10502
|
returns: {
|
|
10313
|
-
type: ['number', '
|
|
10503
|
+
type: ['number', 'null'],
|
|
10314
10504
|
},
|
|
10315
10505
|
args: {
|
|
10316
10506
|
seq: {
|
|
10317
|
-
type: ['sequence', '
|
|
10507
|
+
type: ['sequence', 'null'],
|
|
10318
10508
|
},
|
|
10319
10509
|
x: {
|
|
10320
10510
|
type: 'any',
|
|
@@ -10340,7 +10530,7 @@ var sequenceReference = {
|
|
|
10340
10530
|
},
|
|
10341
10531
|
args: {
|
|
10342
10532
|
seq: {
|
|
10343
|
-
type: ['sequence', '
|
|
10533
|
+
type: ['sequence', 'null'],
|
|
10344
10534
|
},
|
|
10345
10535
|
fn: {
|
|
10346
10536
|
type: 'function',
|
|
@@ -10363,11 +10553,11 @@ var sequenceReference = {
|
|
|
10363
10553
|
category: 'Sequence',
|
|
10364
10554
|
linkName: 'reverse',
|
|
10365
10555
|
returns: {
|
|
10366
|
-
type: ['sequence', '
|
|
10556
|
+
type: ['sequence', 'null'],
|
|
10367
10557
|
},
|
|
10368
10558
|
args: {
|
|
10369
10559
|
seq: {
|
|
10370
|
-
type: ['sequence', '
|
|
10560
|
+
type: ['sequence', 'null'],
|
|
10371
10561
|
},
|
|
10372
10562
|
},
|
|
10373
10563
|
variants: [
|
|
@@ -10390,7 +10580,7 @@ var sequenceReference = {
|
|
|
10390
10580
|
},
|
|
10391
10581
|
args: {
|
|
10392
10582
|
seq: {
|
|
10393
|
-
type: ['sequence', '
|
|
10583
|
+
type: ['sequence', 'null'],
|
|
10394
10584
|
},
|
|
10395
10585
|
},
|
|
10396
10586
|
variants: [
|
|
@@ -10412,7 +10602,7 @@ var sequenceReference = {
|
|
|
10412
10602
|
},
|
|
10413
10603
|
args: {
|
|
10414
10604
|
seq: {
|
|
10415
|
-
type: ['sequence', '
|
|
10605
|
+
type: ['sequence', 'null'],
|
|
10416
10606
|
},
|
|
10417
10607
|
},
|
|
10418
10608
|
variants: [
|
|
@@ -10435,7 +10625,7 @@ var sequenceReference = {
|
|
|
10435
10625
|
},
|
|
10436
10626
|
args: {
|
|
10437
10627
|
seq: {
|
|
10438
|
-
type: ['sequence', '
|
|
10628
|
+
type: ['sequence', 'null'],
|
|
10439
10629
|
},
|
|
10440
10630
|
},
|
|
10441
10631
|
variants: [
|
|
@@ -10455,7 +10645,7 @@ var sequenceReference = {
|
|
|
10455
10645
|
category: 'Sequence',
|
|
10456
10646
|
linkName: 'rest',
|
|
10457
10647
|
returns: {
|
|
10458
|
-
type: ['sequence', '
|
|
10648
|
+
type: ['sequence', 'null'],
|
|
10459
10649
|
},
|
|
10460
10650
|
args: {
|
|
10461
10651
|
seq: {
|
|
@@ -10508,7 +10698,7 @@ var sequenceReference = {
|
|
|
10508
10698
|
category: 'Sequence',
|
|
10509
10699
|
linkName: 'next',
|
|
10510
10700
|
returns: {
|
|
10511
|
-
type: ['sequence', '
|
|
10701
|
+
type: ['sequence', 'null'],
|
|
10512
10702
|
},
|
|
10513
10703
|
args: {
|
|
10514
10704
|
seq: {
|
|
@@ -10533,7 +10723,7 @@ var sequenceReference = {
|
|
|
10533
10723
|
category: 'Sequence',
|
|
10534
10724
|
linkName: 'nthnext',
|
|
10535
10725
|
returns: {
|
|
10536
|
-
type: ['sequence', '
|
|
10726
|
+
type: ['sequence', 'null'],
|
|
10537
10727
|
array: true,
|
|
10538
10728
|
},
|
|
10539
10729
|
args: {
|
|
@@ -10757,7 +10947,7 @@ var sequenceReference = {
|
|
|
10757
10947
|
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`.',
|
|
10758
10948
|
examples: [
|
|
10759
10949
|
'(sort_by ["Albert" "Mojir" "Nina"] count)',
|
|
10760
|
-
'(sort_by "Albert"
|
|
10950
|
+
'(sort_by "Albert" lower_case #(compare %2 %1))',
|
|
10761
10951
|
],
|
|
10762
10952
|
},
|
|
10763
10953
|
distinct: {
|
|
@@ -11022,7 +11212,7 @@ var sequenceReference = {
|
|
|
11022
11212
|
],
|
|
11023
11213
|
description: 'Applies $fn to each value in $seq, splitting it each time $fn returns a new value. Returns an array of sequences.',
|
|
11024
11214
|
examples: [
|
|
11025
|
-
'(partition_by [1 2 3 4 5] #(
|
|
11215
|
+
'(partition_by [1 2 3 4 5] #(== 3 %1))',
|
|
11026
11216
|
'(partition_by [1 1 1 2 2 3 3] odd?)',
|
|
11027
11217
|
'(partition_by "Leeeeeerrroyyy" identity)',
|
|
11028
11218
|
],
|
|
@@ -11128,10 +11318,11 @@ var mathReference = {
|
|
|
11128
11318
|
description: 'Modulus of `dividend` and `divisor`. Truncates toward negative infinity.',
|
|
11129
11319
|
examples: ['(mod 5 3)', '(mod 5.2 3.1)', '(mod -5 3)', '(mod 5 -3)', '(mod -5 -3)'],
|
|
11130
11320
|
},
|
|
11131
|
-
'
|
|
11132
|
-
title: '
|
|
11321
|
+
'%': {
|
|
11322
|
+
title: '%',
|
|
11133
11323
|
category: 'Math',
|
|
11134
|
-
linkName: '
|
|
11324
|
+
linkName: '-percent',
|
|
11325
|
+
clojureDocs: 'rem',
|
|
11135
11326
|
returns: {
|
|
11136
11327
|
type: 'number',
|
|
11137
11328
|
},
|
|
@@ -11147,7 +11338,7 @@ var mathReference = {
|
|
|
11147
11338
|
{ argumentNames: ['a', 'b'] },
|
|
11148
11339
|
],
|
|
11149
11340
|
description: 'Remainder of dividing `dividend` and `divisor`.',
|
|
11150
|
-
examples: ['(
|
|
11341
|
+
examples: ['(% 5 3)', '(% 5.2 3.1)', '(% -5 3)', '(% 5 -3)', '(% -5 -3)'],
|
|
11151
11342
|
},
|
|
11152
11343
|
'quot': {
|
|
11153
11344
|
title: 'quot',
|
|
@@ -11244,10 +11435,10 @@ var mathReference = {
|
|
|
11244
11435
|
description: 'Computes cube root of $x.',
|
|
11245
11436
|
examples: ['(cbrt 0)', '(cbrt 27)', '(cbrt 2)', '(cbrt 1)'],
|
|
11246
11437
|
},
|
|
11247
|
-
'
|
|
11248
|
-
title: '
|
|
11438
|
+
'**': {
|
|
11439
|
+
title: '**',
|
|
11249
11440
|
category: 'Math',
|
|
11250
|
-
linkName: '
|
|
11441
|
+
linkName: '-star-star',
|
|
11251
11442
|
clojureDocs: null,
|
|
11252
11443
|
returns: {
|
|
11253
11444
|
type: 'number',
|
|
@@ -11264,7 +11455,7 @@ var mathReference = {
|
|
|
11264
11455
|
{ argumentNames: ['a', 'b'] },
|
|
11265
11456
|
],
|
|
11266
11457
|
description: 'Computes returns $a raised to the power of $b.',
|
|
11267
|
-
examples: ['(
|
|
11458
|
+
examples: ['(** 2 3)', '(** 2 0)', '(** 2 -3)', '(** -2 3)', '(** -2 -3)'],
|
|
11268
11459
|
},
|
|
11269
11460
|
'exp': {
|
|
11270
11461
|
title: 'exp',
|
|
@@ -11634,7 +11825,7 @@ var mathReference = {
|
|
|
11634
11825
|
{ argumentNames: ['x'] },
|
|
11635
11826
|
],
|
|
11636
11827
|
description: 'Returns the base `2` logarithm of a number.',
|
|
11637
|
-
examples: ['(log2 0.01)', '(log2 (
|
|
11828
|
+
examples: ['(log2 0.01)', '(log2 (** 2 12))', '(log2 2.5)'],
|
|
11638
11829
|
},
|
|
11639
11830
|
'log10': {
|
|
11640
11831
|
title: 'log10',
|
|
@@ -11653,7 +11844,7 @@ var mathReference = {
|
|
|
11653
11844
|
{ argumentNames: ['x'] },
|
|
11654
11845
|
],
|
|
11655
11846
|
description: 'Returns the `10` logarithm of a number.',
|
|
11656
|
-
examples: ['(log10 0.01)', '(log10 (
|
|
11847
|
+
examples: ['(log10 0.01)', '(log10 (** 10 12))', '(log10 2.5)'],
|
|
11657
11848
|
},
|
|
11658
11849
|
'sin': {
|
|
11659
11850
|
title: 'sin',
|
|
@@ -11907,13 +12098,14 @@ var miscReference = {
|
|
|
11907
12098
|
{ argumentNames: ['x'] },
|
|
11908
12099
|
{ argumentNames: ['x', 'ys'] },
|
|
11909
12100
|
],
|
|
11910
|
-
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 `(
|
|
12101
|
+
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))`.',
|
|
11911
12102
|
examples: ['(!= 3)', '(!= 3 2)', '(!= :3 3)', '(!= 3 3 2)', '(!= :3 :2 :1 :0)', '(!= 0 -0)'],
|
|
11912
12103
|
},
|
|
11913
|
-
'
|
|
11914
|
-
title: '
|
|
12104
|
+
'==': {
|
|
12105
|
+
title: '==',
|
|
11915
12106
|
category: 'Misc',
|
|
11916
|
-
linkName: '-equal',
|
|
12107
|
+
linkName: '-equal-equal',
|
|
12108
|
+
clojureDocs: '=',
|
|
11917
12109
|
returns: {
|
|
11918
12110
|
type: 'boolean',
|
|
11919
12111
|
},
|
|
@@ -11931,7 +12123,7 @@ var miscReference = {
|
|
|
11931
12123
|
{ argumentNames: ['x', 'ys'] },
|
|
11932
12124
|
],
|
|
11933
12125
|
description: 'Compares `values` according to \'equal\' predicate. Result is `true` if every specified value is equal to each other, otherwise result is `false`.',
|
|
11934
|
-
examples: ['(
|
|
12126
|
+
examples: ['(== 1 1)', '(== 1.01 1)', '(== :1 1)', '(== :2 :2 :2 :2)', '(== 2 2 1 2)'],
|
|
11935
12127
|
},
|
|
11936
12128
|
'<': {
|
|
11937
12129
|
title: '<',
|
|
@@ -12025,10 +12217,11 @@ var miscReference = {
|
|
|
12025
12217
|
description: 'Returns `true` if the number $x and $ys are in non increasing order, `false` otherwise.',
|
|
12026
12218
|
examples: ['(>= 1 0)', '(>= 1.01 1)', '(>= 1 1)', '(>= 4 3 2 1)', '(>= 3 2 2 1)'],
|
|
12027
12219
|
},
|
|
12028
|
-
'
|
|
12029
|
-
title: '
|
|
12220
|
+
'!': {
|
|
12221
|
+
title: '!',
|
|
12030
12222
|
category: 'Misc',
|
|
12031
|
-
linkName: '
|
|
12223
|
+
linkName: '-exclamation',
|
|
12224
|
+
clojureDocs: 'not',
|
|
12032
12225
|
returns: {
|
|
12033
12226
|
type: 'boolean',
|
|
12034
12227
|
},
|
|
@@ -12041,7 +12234,7 @@ var miscReference = {
|
|
|
12041
12234
|
{ argumentNames: ['x'] },
|
|
12042
12235
|
],
|
|
12043
12236
|
description: 'Computes logical negation. Note that any other $x than `false`, `0`, `nil` and `\'\'` is truthy.',
|
|
12044
|
-
examples: ['(
|
|
12237
|
+
examples: ['(! 3)', '(! true)', '(! "A string")', '(! 0)', '(! false)', '(! nil)', '(! "")'],
|
|
12045
12238
|
},
|
|
12046
12239
|
'write!': {
|
|
12047
12240
|
title: 'write!',
|
|
@@ -12070,25 +12263,10 @@ var miscReference = {
|
|
|
12070
12263
|
'(write! nil true false)',
|
|
12071
12264
|
],
|
|
12072
12265
|
},
|
|
12073
|
-
'
|
|
12074
|
-
title: '
|
|
12266
|
+
'iso_date>epoch': {
|
|
12267
|
+
title: 'iso_date>epoch',
|
|
12075
12268
|
category: 'Misc',
|
|
12076
|
-
linkName: '
|
|
12077
|
-
clojureDocs: 'inst-ms',
|
|
12078
|
-
returns: {
|
|
12079
|
-
type: 'number',
|
|
12080
|
-
},
|
|
12081
|
-
args: {},
|
|
12082
|
-
variants: [
|
|
12083
|
-
{ argumentNames: [] },
|
|
12084
|
-
],
|
|
12085
|
-
description: 'Returns milliseconds elapsed since the UNIX epoch.',
|
|
12086
|
-
examples: ['(inst-ms!)'],
|
|
12087
|
-
},
|
|
12088
|
-
'iso-date-time->inst-ms': {
|
|
12089
|
-
title: 'iso-date-time->inst-ms',
|
|
12090
|
-
category: 'Misc',
|
|
12091
|
-
linkName: 'iso-date-time--gtinst-ms',
|
|
12269
|
+
linkName: 'iso_date-gtepoch',
|
|
12092
12270
|
returns: {
|
|
12093
12271
|
type: 'number',
|
|
12094
12272
|
},
|
|
@@ -12102,14 +12280,14 @@ var miscReference = {
|
|
|
12102
12280
|
],
|
|
12103
12281
|
description: 'Returns milliseconds elapsed since the UNIX epoch to `iso`.',
|
|
12104
12282
|
examples: [
|
|
12105
|
-
'(
|
|
12106
|
-
'(
|
|
12283
|
+
'(iso_date>epoch "2022-04-12T09:37:10.899Z")',
|
|
12284
|
+
'(iso_date>epoch "1980-01-01")',
|
|
12107
12285
|
],
|
|
12108
12286
|
},
|
|
12109
|
-
'
|
|
12110
|
-
title: '
|
|
12287
|
+
'epoch>iso_date': {
|
|
12288
|
+
title: 'epoch>iso_date',
|
|
12111
12289
|
category: 'Misc',
|
|
12112
|
-
linkName: '
|
|
12290
|
+
linkName: 'epoch-gtiso_date',
|
|
12113
12291
|
returns: {
|
|
12114
12292
|
type: 'string',
|
|
12115
12293
|
},
|
|
@@ -12123,8 +12301,8 @@ var miscReference = {
|
|
|
12123
12301
|
],
|
|
12124
12302
|
description: 'Returns IOS date time string from `ms` (milliseconds elapsed since the UNIX epoch).',
|
|
12125
12303
|
examples: [
|
|
12126
|
-
'(
|
|
12127
|
-
'(
|
|
12304
|
+
'(epoch>iso_date 1649756230899)',
|
|
12305
|
+
'(epoch>iso_date 0)',
|
|
12128
12306
|
],
|
|
12129
12307
|
},
|
|
12130
12308
|
'boolean': {
|
|
@@ -12180,34 +12358,6 @@ var miscReference = {
|
|
|
12180
12358
|
'(compare + -)',
|
|
12181
12359
|
],
|
|
12182
12360
|
},
|
|
12183
|
-
'lits-version!': {
|
|
12184
|
-
title: 'lits-version!',
|
|
12185
|
-
category: 'Misc',
|
|
12186
|
-
linkName: 'lits-version-exclamation',
|
|
12187
|
-
returns: {
|
|
12188
|
-
type: 'string',
|
|
12189
|
-
},
|
|
12190
|
-
args: {},
|
|
12191
|
-
variants: [
|
|
12192
|
-
{ argumentNames: [] },
|
|
12193
|
-
],
|
|
12194
|
-
description: 'Returns the lits version.',
|
|
12195
|
-
examples: ['(lits-version!)'],
|
|
12196
|
-
},
|
|
12197
|
-
'uuid!': {
|
|
12198
|
-
title: 'uuid!',
|
|
12199
|
-
category: 'Misc',
|
|
12200
|
-
linkName: 'uuid-exclamation',
|
|
12201
|
-
returns: {
|
|
12202
|
-
type: 'string',
|
|
12203
|
-
},
|
|
12204
|
-
args: {},
|
|
12205
|
-
variants: [
|
|
12206
|
-
{ argumentNames: [] },
|
|
12207
|
-
],
|
|
12208
|
-
description: 'Returns random UUID string.',
|
|
12209
|
-
examples: ['(uuid!)'],
|
|
12210
|
-
},
|
|
12211
12361
|
'equal?': {
|
|
12212
12362
|
title: 'equal?',
|
|
12213
12363
|
category: 'Misc',
|
|
@@ -12233,14 +12383,14 @@ var miscReference = {
|
|
|
12233
12383
|
'(equal? [1 true nil] [1 true nil])',
|
|
12234
12384
|
'(equal? {:a 10 :b [1 2 {:b 20}]} {:b [1 2 {:b 20}] :a 10})',
|
|
12235
12385
|
'(equal? {:a 10 :b [1 2 {:b 20}]} {:b [1 2 {:b 21}] :a 10})',
|
|
12236
|
-
'(
|
|
12386
|
+
'(== 0.3 (+ 0.1 0.2))',
|
|
12237
12387
|
'(equal? 0.3 (+ 0.1 0.2))',
|
|
12238
12388
|
],
|
|
12239
12389
|
},
|
|
12240
|
-
'
|
|
12241
|
-
title: '
|
|
12390
|
+
'json_parse': {
|
|
12391
|
+
title: 'json_parse',
|
|
12242
12392
|
category: 'Misc',
|
|
12243
|
-
linkName: '
|
|
12393
|
+
linkName: 'json_parse',
|
|
12244
12394
|
clojureDocs: null,
|
|
12245
12395
|
returns: {
|
|
12246
12396
|
type: 'any',
|
|
@@ -12255,13 +12405,13 @@ var miscReference = {
|
|
|
12255
12405
|
],
|
|
12256
12406
|
description: 'Returns `JSON.parse(`$x`)`.',
|
|
12257
12407
|
examples: [
|
|
12258
|
-
'(
|
|
12408
|
+
'(json_parse "[1, 2, 3]")',
|
|
12259
12409
|
],
|
|
12260
12410
|
},
|
|
12261
|
-
'
|
|
12262
|
-
title: '
|
|
12411
|
+
'json_stringify': {
|
|
12412
|
+
title: 'json_stringify',
|
|
12263
12413
|
category: 'Misc',
|
|
12264
|
-
linkName: '
|
|
12414
|
+
linkName: 'json_stringify',
|
|
12265
12415
|
clojureDocs: null,
|
|
12266
12416
|
returns: {
|
|
12267
12417
|
type: 'string',
|
|
@@ -12281,8 +12431,8 @@ var miscReference = {
|
|
|
12281
12431
|
],
|
|
12282
12432
|
description: 'Returns `JSON.stringify(`$x`)`. If second argument is provided, returns `JSON.stringify(`$x`, null, `$indent`)`.',
|
|
12283
12433
|
examples: [
|
|
12284
|
-
'(
|
|
12285
|
-
'(
|
|
12434
|
+
'(json_stringify [1, 2, 3])',
|
|
12435
|
+
'(json_stringify {:a {:b 10}} 2)',
|
|
12286
12436
|
],
|
|
12287
12437
|
},
|
|
12288
12438
|
};
|
|
@@ -12314,7 +12464,7 @@ var assertReference = { 'assert': {
|
|
|
12314
12464
|
linkName: 'assert-equal',
|
|
12315
12465
|
clojureDocs: null,
|
|
12316
12466
|
returns: {
|
|
12317
|
-
type: '
|
|
12467
|
+
type: 'null',
|
|
12318
12468
|
},
|
|
12319
12469
|
args: {
|
|
12320
12470
|
a: {
|
|
@@ -12343,7 +12493,7 @@ var assertReference = { 'assert': {
|
|
|
12343
12493
|
linkName: 'assert-exclamation-equal',
|
|
12344
12494
|
clojureDocs: null,
|
|
12345
12495
|
returns: {
|
|
12346
|
-
type: '
|
|
12496
|
+
type: 'null',
|
|
12347
12497
|
},
|
|
12348
12498
|
args: {
|
|
12349
12499
|
a: {
|
|
@@ -12372,7 +12522,7 @@ var assertReference = { 'assert': {
|
|
|
12372
12522
|
linkName: 'assert_equal',
|
|
12373
12523
|
clojureDocs: null,
|
|
12374
12524
|
returns: {
|
|
12375
|
-
type: '
|
|
12525
|
+
type: 'null',
|
|
12376
12526
|
},
|
|
12377
12527
|
args: {
|
|
12378
12528
|
a: {
|
|
@@ -12401,7 +12551,7 @@ var assertReference = { 'assert': {
|
|
|
12401
12551
|
linkName: 'assert_not_equal',
|
|
12402
12552
|
clojureDocs: null,
|
|
12403
12553
|
returns: {
|
|
12404
|
-
type: '
|
|
12554
|
+
type: 'null',
|
|
12405
12555
|
},
|
|
12406
12556
|
args: {
|
|
12407
12557
|
a: {
|
|
@@ -12430,7 +12580,7 @@ var assertReference = { 'assert': {
|
|
|
12430
12580
|
linkName: 'assert_gt',
|
|
12431
12581
|
clojureDocs: null,
|
|
12432
12582
|
returns: {
|
|
12433
|
-
type: '
|
|
12583
|
+
type: 'null',
|
|
12434
12584
|
},
|
|
12435
12585
|
args: {
|
|
12436
12586
|
a: {
|
|
@@ -12459,7 +12609,7 @@ var assertReference = { 'assert': {
|
|
|
12459
12609
|
linkName: 'assert_lt',
|
|
12460
12610
|
clojureDocs: null,
|
|
12461
12611
|
returns: {
|
|
12462
|
-
type: '
|
|
12612
|
+
type: 'null',
|
|
12463
12613
|
},
|
|
12464
12614
|
args: {
|
|
12465
12615
|
a: {
|
|
@@ -12488,7 +12638,7 @@ var assertReference = { 'assert': {
|
|
|
12488
12638
|
linkName: 'assert_gte',
|
|
12489
12639
|
clojureDocs: null,
|
|
12490
12640
|
returns: {
|
|
12491
|
-
type: '
|
|
12641
|
+
type: 'null',
|
|
12492
12642
|
},
|
|
12493
12643
|
args: {
|
|
12494
12644
|
a: {
|
|
@@ -12517,7 +12667,7 @@ var assertReference = { 'assert': {
|
|
|
12517
12667
|
linkName: 'assert_lte',
|
|
12518
12668
|
clojureDocs: null,
|
|
12519
12669
|
returns: {
|
|
12520
|
-
type: '
|
|
12670
|
+
type: 'null',
|
|
12521
12671
|
},
|
|
12522
12672
|
args: {
|
|
12523
12673
|
a: {
|
|
@@ -12546,7 +12696,7 @@ var assertReference = { 'assert': {
|
|
|
12546
12696
|
linkName: 'assert_true',
|
|
12547
12697
|
clojureDocs: null,
|
|
12548
12698
|
returns: {
|
|
12549
|
-
type: '
|
|
12699
|
+
type: 'null',
|
|
12550
12700
|
},
|
|
12551
12701
|
args: {
|
|
12552
12702
|
value: {
|
|
@@ -12572,7 +12722,7 @@ var assertReference = { 'assert': {
|
|
|
12572
12722
|
linkName: 'assert_false',
|
|
12573
12723
|
clojureDocs: null,
|
|
12574
12724
|
returns: {
|
|
12575
|
-
type: '
|
|
12725
|
+
type: 'null',
|
|
12576
12726
|
},
|
|
12577
12727
|
args: {
|
|
12578
12728
|
value: {
|
|
@@ -12598,7 +12748,7 @@ var assertReference = { 'assert': {
|
|
|
12598
12748
|
linkName: 'assert_truthy',
|
|
12599
12749
|
clojureDocs: null,
|
|
12600
12750
|
returns: {
|
|
12601
|
-
type: '
|
|
12751
|
+
type: 'null',
|
|
12602
12752
|
},
|
|
12603
12753
|
args: {
|
|
12604
12754
|
value: {
|
|
@@ -12631,7 +12781,7 @@ var assertReference = { 'assert': {
|
|
|
12631
12781
|
linkName: 'assert_falsy',
|
|
12632
12782
|
clojureDocs: null,
|
|
12633
12783
|
returns: {
|
|
12634
|
-
type: '
|
|
12784
|
+
type: 'null',
|
|
12635
12785
|
},
|
|
12636
12786
|
args: {
|
|
12637
12787
|
value: {
|
|
@@ -12663,7 +12813,7 @@ var assertReference = { 'assert': {
|
|
|
12663
12813
|
linkName: 'assert_null',
|
|
12664
12814
|
clojureDocs: null,
|
|
12665
12815
|
returns: {
|
|
12666
|
-
type: '
|
|
12816
|
+
type: 'null',
|
|
12667
12817
|
},
|
|
12668
12818
|
args: {
|
|
12669
12819
|
value: {
|
|
@@ -12695,7 +12845,7 @@ var assertReference = { 'assert': {
|
|
|
12695
12845
|
linkName: 'assert_throws',
|
|
12696
12846
|
clojureDocs: null,
|
|
12697
12847
|
returns: {
|
|
12698
|
-
type: '
|
|
12848
|
+
type: 'null',
|
|
12699
12849
|
},
|
|
12700
12850
|
args: {
|
|
12701
12851
|
fn: {
|
|
@@ -12717,7 +12867,7 @@ var assertReference = { 'assert': {
|
|
|
12717
12867
|
linkName: 'assert_throws_error',
|
|
12718
12868
|
clojureDocs: null,
|
|
12719
12869
|
returns: {
|
|
12720
|
-
type: '
|
|
12870
|
+
type: 'null',
|
|
12721
12871
|
},
|
|
12722
12872
|
args: {
|
|
12723
12873
|
'fn': {
|
|
@@ -12746,7 +12896,7 @@ var assertReference = { 'assert': {
|
|
|
12746
12896
|
linkName: 'assert_not_throws',
|
|
12747
12897
|
clojureDocs: null,
|
|
12748
12898
|
returns: {
|
|
12749
|
-
type: '
|
|
12899
|
+
type: 'null',
|
|
12750
12900
|
},
|
|
12751
12901
|
args: {
|
|
12752
12902
|
fn: {
|
|
@@ -12765,7 +12915,7 @@ var assertReference = { 'assert': {
|
|
|
12765
12915
|
} };
|
|
12766
12916
|
|
|
12767
12917
|
var objectReference = {
|
|
12768
|
-
|
|
12918
|
+
dissoc: {
|
|
12769
12919
|
title: 'dissoc',
|
|
12770
12920
|
category: 'Object',
|
|
12771
12921
|
linkName: 'dissoc',
|
|
@@ -12790,7 +12940,7 @@ var objectReference = {
|
|
|
12790
12940
|
"\n(def o { :a 5 }) (dissoc o :a)\no",
|
|
12791
12941
|
],
|
|
12792
12942
|
},
|
|
12793
|
-
|
|
12943
|
+
object: {
|
|
12794
12944
|
title: 'object',
|
|
12795
12945
|
category: 'Object',
|
|
12796
12946
|
linkName: 'object',
|
|
@@ -12816,7 +12966,7 @@ var objectReference = {
|
|
|
12816
12966
|
'{:a 1 :b 2}',
|
|
12817
12967
|
],
|
|
12818
12968
|
},
|
|
12819
|
-
|
|
12969
|
+
keys: {
|
|
12820
12970
|
title: 'keys',
|
|
12821
12971
|
category: 'Object',
|
|
12822
12972
|
linkName: 'keys',
|
|
@@ -12838,7 +12988,7 @@ var objectReference = {
|
|
|
12838
12988
|
'(keys (object :x 10 :y true :z "A string"))',
|
|
12839
12989
|
],
|
|
12840
12990
|
},
|
|
12841
|
-
|
|
12991
|
+
vals: {
|
|
12842
12992
|
title: 'vals',
|
|
12843
12993
|
category: 'Object',
|
|
12844
12994
|
linkName: 'vals',
|
|
@@ -12860,7 +13010,7 @@ var objectReference = {
|
|
|
12860
13010
|
'(vals (object :x 10 :y true :z "A string"))',
|
|
12861
13011
|
],
|
|
12862
13012
|
},
|
|
12863
|
-
|
|
13013
|
+
entries: {
|
|
12864
13014
|
title: 'entries',
|
|
12865
13015
|
category: 'Object',
|
|
12866
13016
|
linkName: 'entries',
|
|
@@ -12882,12 +13032,12 @@ var objectReference = {
|
|
|
12882
13032
|
'(entries (object :x 10 :y true :z "A string"))',
|
|
12883
13033
|
],
|
|
12884
13034
|
},
|
|
12885
|
-
|
|
13035
|
+
find: {
|
|
12886
13036
|
title: 'find',
|
|
12887
13037
|
category: 'Object',
|
|
12888
13038
|
linkName: 'find',
|
|
12889
13039
|
returns: {
|
|
12890
|
-
type: ['array', '
|
|
13040
|
+
type: ['array', 'null'],
|
|
12891
13041
|
},
|
|
12892
13042
|
args: {
|
|
12893
13043
|
obj: {
|
|
@@ -12906,7 +13056,7 @@ var objectReference = {
|
|
|
12906
13056
|
'(find (object :a 1 :b 2) :c)',
|
|
12907
13057
|
],
|
|
12908
13058
|
},
|
|
12909
|
-
|
|
13059
|
+
merge: {
|
|
12910
13060
|
title: 'merge',
|
|
12911
13061
|
category: 'Object',
|
|
12912
13062
|
linkName: 'merge',
|
|
@@ -12928,10 +13078,10 @@ var objectReference = {
|
|
|
12928
13078
|
'(merge (object :x 10) (object :x 15 :y 20))',
|
|
12929
13079
|
],
|
|
12930
13080
|
},
|
|
12931
|
-
|
|
12932
|
-
title: '
|
|
13081
|
+
merge_with: {
|
|
13082
|
+
title: 'merge_with',
|
|
12933
13083
|
category: 'Object',
|
|
12934
|
-
linkName: '
|
|
13084
|
+
linkName: 'merge_with',
|
|
12935
13085
|
returns: {
|
|
12936
13086
|
type: 'object',
|
|
12937
13087
|
},
|
|
@@ -12949,12 +13099,12 @@ var objectReference = {
|
|
|
12949
13099
|
],
|
|
12950
13100
|
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.",
|
|
12951
13101
|
examples: [
|
|
12952
|
-
'(
|
|
12953
|
-
'(
|
|
12954
|
-
'(
|
|
13102
|
+
'(merge_with (object :x 10) (object :y 20) +)',
|
|
13103
|
+
'(merge_with (object :x 10) (object :x 15 :y 20) +)',
|
|
13104
|
+
'(merge_with (object :x 10) (object :x 20) (object :x 30) (object :x 40) -)',
|
|
12955
13105
|
],
|
|
12956
13106
|
},
|
|
12957
|
-
|
|
13107
|
+
zipmap: {
|
|
12958
13108
|
title: 'zipmap',
|
|
12959
13109
|
category: 'Object',
|
|
12960
13110
|
linkName: 'zipmap',
|
|
@@ -12981,10 +13131,10 @@ var objectReference = {
|
|
|
12981
13131
|
'(zipmap [] [10 nil [1 2 3]])',
|
|
12982
13132
|
],
|
|
12983
13133
|
},
|
|
12984
|
-
|
|
12985
|
-
title: '
|
|
13134
|
+
select_keys: {
|
|
13135
|
+
title: 'select_keys',
|
|
12986
13136
|
category: 'Object',
|
|
12987
|
-
linkName: '
|
|
13137
|
+
linkName: 'select_keys',
|
|
12988
13138
|
returns: {
|
|
12989
13139
|
type: 'object',
|
|
12990
13140
|
},
|
|
@@ -13002,8 +13152,8 @@ var objectReference = {
|
|
|
13002
13152
|
],
|
|
13003
13153
|
description: 'Returns an object containing only those entries in $obj whose key is in $keys.',
|
|
13004
13154
|
examples: [
|
|
13005
|
-
'(
|
|
13006
|
-
'(
|
|
13155
|
+
'(select_keys {:a 1 :b 2 :c 3} [:a :b])',
|
|
13156
|
+
'(select_keys {:a 1} [:a :b])',
|
|
13007
13157
|
],
|
|
13008
13158
|
},
|
|
13009
13159
|
};
|
|
@@ -13452,7 +13602,7 @@ var predicateReference = {
|
|
|
13452
13602
|
variants: [
|
|
13453
13603
|
{ argumentNames: ['x'] },
|
|
13454
13604
|
],
|
|
13455
|
-
description: 'Returns `true` if $x is NaN (
|
|
13605
|
+
description: 'Returns `true` if $x is NaN (! a number), otherwise `false`.',
|
|
13456
13606
|
examples: [
|
|
13457
13607
|
'(nan? 1.0)',
|
|
13458
13608
|
'(nan? (/ 1 0))',
|
|
@@ -13563,7 +13713,7 @@ var predicateReference = {
|
|
|
13563
13713
|
},
|
|
13564
13714
|
args: {
|
|
13565
13715
|
x: {
|
|
13566
|
-
type: ['collection', 'string', '
|
|
13716
|
+
type: ['collection', 'string', 'null'],
|
|
13567
13717
|
},
|
|
13568
13718
|
},
|
|
13569
13719
|
variants: [
|
|
@@ -13590,7 +13740,7 @@ var predicateReference = {
|
|
|
13590
13740
|
},
|
|
13591
13741
|
args: {
|
|
13592
13742
|
x: {
|
|
13593
|
-
type: ['collection', 'string', '
|
|
13743
|
+
type: ['collection', 'string', 'null'],
|
|
13594
13744
|
},
|
|
13595
13745
|
},
|
|
13596
13746
|
variants: [
|
|
@@ -13702,10 +13852,10 @@ var regularExpressionReference = {
|
|
|
13702
13852
|
};
|
|
13703
13853
|
|
|
13704
13854
|
var specialExpressionsReference = {
|
|
13705
|
-
'
|
|
13706
|
-
title: '
|
|
13855
|
+
'&&': {
|
|
13856
|
+
title: '&&',
|
|
13707
13857
|
category: 'Special expression',
|
|
13708
|
-
linkName: 'and',
|
|
13858
|
+
linkName: '-and-and',
|
|
13709
13859
|
returns: {
|
|
13710
13860
|
type: 'boolean',
|
|
13711
13861
|
},
|
|
@@ -13718,19 +13868,20 @@ var specialExpressionsReference = {
|
|
|
13718
13868
|
variants: [
|
|
13719
13869
|
{ argumentNames: ['expressions'] },
|
|
13720
13870
|
],
|
|
13721
|
-
description: "\nComputes logical `and
|
|
13871
|
+
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.",
|
|
13722
13872
|
examples: [
|
|
13723
|
-
'(
|
|
13724
|
-
'(
|
|
13725
|
-
'(
|
|
13726
|
-
'(
|
|
13727
|
-
'(
|
|
13873
|
+
'(&& 1 1)',
|
|
13874
|
+
'(&& (> 3 2) "string")',
|
|
13875
|
+
'(&& (< 3 2) "string")',
|
|
13876
|
+
'(&& true true true true)',
|
|
13877
|
+
'(&& true true 0 true)',
|
|
13728
13878
|
],
|
|
13729
13879
|
},
|
|
13730
|
-
'
|
|
13731
|
-
title: '
|
|
13880
|
+
'||': {
|
|
13881
|
+
title: '||',
|
|
13732
13882
|
category: 'Special expression',
|
|
13733
|
-
linkName: 'or',
|
|
13883
|
+
linkName: '-or-or',
|
|
13884
|
+
clojureDocs: 'or',
|
|
13734
13885
|
returns: {
|
|
13735
13886
|
type: 'boolean',
|
|
13736
13887
|
},
|
|
@@ -13743,13 +13894,13 @@ var specialExpressionsReference = {
|
|
|
13743
13894
|
variants: [
|
|
13744
13895
|
{ argumentNames: ['expressions'] },
|
|
13745
13896
|
],
|
|
13746
|
-
description: "\nComputes logical `or
|
|
13897
|
+
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.",
|
|
13747
13898
|
examples: [
|
|
13748
|
-
'(
|
|
13749
|
-
'(
|
|
13750
|
-
'(
|
|
13751
|
-
'(
|
|
13752
|
-
'(
|
|
13899
|
+
'(|| 1 1)',
|
|
13900
|
+
'(|| (> 3 2) "string")',
|
|
13901
|
+
'(|| (< 3 2) "string")',
|
|
13902
|
+
'(|| true true true true)',
|
|
13903
|
+
'(|| 1 2 3 4)',
|
|
13753
13904
|
],
|
|
13754
13905
|
},
|
|
13755
13906
|
'def': {
|
|
@@ -13825,10 +13976,10 @@ var specialExpressionsReference = {
|
|
|
13825
13976
|
description: "\nBinds local variables. The variables lives only within $expressions.\nIt returns evaluation of the last expression in $expressions.",
|
|
13826
13977
|
examples: ["\n (let [a (+ 1 2 3 4) \n b (* 1 2 3 4)]\n (write! a b))"],
|
|
13827
13978
|
},
|
|
13828
|
-
'
|
|
13829
|
-
title: '
|
|
13979
|
+
'if_let': {
|
|
13980
|
+
title: 'if_let',
|
|
13830
13981
|
category: 'Special expression',
|
|
13831
|
-
linkName: '
|
|
13982
|
+
linkName: 'if_let',
|
|
13832
13983
|
returns: {
|
|
13833
13984
|
type: 'any',
|
|
13834
13985
|
},
|
|
@@ -13849,14 +14000,14 @@ var specialExpressionsReference = {
|
|
|
13849
14000
|
],
|
|
13850
14001
|
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).",
|
|
13851
14002
|
examples: [
|
|
13852
|
-
"\n(
|
|
13853
|
-
"\n(
|
|
14003
|
+
"\n(if_let [a (> (count \"Albert\") 4)]\n (write! (str a \", is big enough\"))\n (write! \"Sorry, not big enough.\"))",
|
|
14004
|
+
"\n(if_let [a (> (count \"Albert\") 10)]\n (write! (str a \", is big enough\"))\n (write! \"Sorry, not big enough.\"))",
|
|
13854
14005
|
],
|
|
13855
14006
|
},
|
|
13856
|
-
'
|
|
13857
|
-
title: '
|
|
14007
|
+
'when_let': {
|
|
14008
|
+
title: 'when_let',
|
|
13858
14009
|
category: 'Special expression',
|
|
13859
|
-
linkName: '
|
|
14010
|
+
linkName: 'when_let',
|
|
13860
14011
|
returns: {
|
|
13861
14012
|
type: 'any',
|
|
13862
14013
|
},
|
|
@@ -13874,13 +14025,13 @@ var specialExpressionsReference = {
|
|
|
13874
14025
|
],
|
|
13875
14026
|
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.",
|
|
13876
14027
|
examples: [
|
|
13877
|
-
"\n(
|
|
14028
|
+
"\n(when_let [a (> (count \"Albert\") 4)]\n (write! a))",
|
|
13878
14029
|
],
|
|
13879
14030
|
},
|
|
13880
|
-
'
|
|
13881
|
-
title: '
|
|
14031
|
+
'when_first': {
|
|
14032
|
+
title: 'when_first',
|
|
13882
14033
|
category: 'Special expression',
|
|
13883
|
-
linkName: '
|
|
14034
|
+
linkName: 'when_first',
|
|
13884
14035
|
returns: {
|
|
13885
14036
|
type: 'any',
|
|
13886
14037
|
},
|
|
@@ -13899,11 +14050,11 @@ var specialExpressionsReference = {
|
|
|
13899
14050
|
],
|
|
13900
14051
|
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.',
|
|
13901
14052
|
examples: [
|
|
13902
|
-
"\n(
|
|
13903
|
-
"\n(
|
|
13904
|
-
"\n(
|
|
13905
|
-
"\n(
|
|
13906
|
-
"\n(
|
|
14053
|
+
"\n(when_first [x [1 2 3]]\n (write! x)\n x)",
|
|
14054
|
+
"\n(when_first [x \"Albert\"]\n (write! x)\n x)",
|
|
14055
|
+
"\n(when_first [x [0]]\n (write! x)\n x)",
|
|
14056
|
+
"\n(when_first [x [nil]]\n (write! x)\n x)",
|
|
14057
|
+
"\n(when_first [x []]\n (write! x)\n x)",
|
|
13907
14058
|
],
|
|
13908
14059
|
},
|
|
13909
14060
|
'fn': {
|
|
@@ -14068,10 +14219,10 @@ var specialExpressionsReference = {
|
|
|
14068
14219
|
'(if false (write! "TRUE"))',
|
|
14069
14220
|
],
|
|
14070
14221
|
},
|
|
14071
|
-
'
|
|
14072
|
-
title: '
|
|
14222
|
+
'if_not': {
|
|
14223
|
+
title: 'if_not',
|
|
14073
14224
|
category: 'Special expression',
|
|
14074
|
-
linkName: '
|
|
14225
|
+
linkName: 'if_not',
|
|
14075
14226
|
returns: {
|
|
14076
14227
|
type: 'any',
|
|
14077
14228
|
},
|
|
@@ -14092,10 +14243,10 @@ var specialExpressionsReference = {
|
|
|
14092
14243
|
],
|
|
14093
14244
|
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.',
|
|
14094
14245
|
examples: [
|
|
14095
|
-
'(
|
|
14096
|
-
'(
|
|
14097
|
-
'(
|
|
14098
|
-
'(
|
|
14246
|
+
'(if_not true (write! "TRUE") (write! "FALSE"))',
|
|
14247
|
+
'(if_not false (write! "TRUE") (write! "FALSE"))',
|
|
14248
|
+
'(if_not true (write! "TRUE"))',
|
|
14249
|
+
'(if_not false (write! "TRUE"))',
|
|
14099
14250
|
],
|
|
14100
14251
|
},
|
|
14101
14252
|
'cond': {
|
|
@@ -14120,6 +14271,31 @@ var specialExpressionsReference = {
|
|
|
14120
14271
|
"\n(cond\n false (write! \"FALSE\")\n nil (write! \"nil\"))",
|
|
14121
14272
|
],
|
|
14122
14273
|
},
|
|
14274
|
+
'switch': {
|
|
14275
|
+
title: 'switch',
|
|
14276
|
+
category: 'Special expression',
|
|
14277
|
+
linkName: 'switch',
|
|
14278
|
+
returns: {
|
|
14279
|
+
type: 'any',
|
|
14280
|
+
},
|
|
14281
|
+
args: {
|
|
14282
|
+
value: {
|
|
14283
|
+
type: 'any',
|
|
14284
|
+
},
|
|
14285
|
+
conds: {
|
|
14286
|
+
type: '*conditions',
|
|
14287
|
+
},
|
|
14288
|
+
},
|
|
14289
|
+
variants: [
|
|
14290
|
+
{ argumentNames: ['value', 'conds'] },
|
|
14291
|
+
],
|
|
14292
|
+
description: 'Used for branching. $conds are tested sequentially from the top against $value. If no branch is tested truthy, `nil` is returned.',
|
|
14293
|
+
examples: [
|
|
14294
|
+
"\n(switch 1\n 1 (write! \"FALSE\")\n 2 (write! \"nil\"))",
|
|
14295
|
+
"\n(switch 2\n 1 (write! \"FALSE\")\n 2 (write! \"nil\"))",
|
|
14296
|
+
"\n(switch 3\n 1 (write! \"FALSE\")\n 2 (write! \"nil\"))",
|
|
14297
|
+
],
|
|
14298
|
+
},
|
|
14123
14299
|
'when': {
|
|
14124
14300
|
title: 'when',
|
|
14125
14301
|
category: 'Special expression',
|
|
@@ -14147,10 +14323,10 @@ var specialExpressionsReference = {
|
|
|
14147
14323
|
'(when false)',
|
|
14148
14324
|
],
|
|
14149
14325
|
},
|
|
14150
|
-
'
|
|
14151
|
-
title: '
|
|
14326
|
+
'when_not': {
|
|
14327
|
+
title: 'when_not',
|
|
14152
14328
|
category: 'Special expression',
|
|
14153
|
-
linkName: '
|
|
14329
|
+
linkName: 'when_not',
|
|
14154
14330
|
returns: {
|
|
14155
14331
|
type: 'any',
|
|
14156
14332
|
},
|
|
@@ -14168,10 +14344,10 @@ var specialExpressionsReference = {
|
|
|
14168
14344
|
],
|
|
14169
14345
|
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.",
|
|
14170
14346
|
examples: [
|
|
14171
|
-
'(
|
|
14172
|
-
'(
|
|
14173
|
-
'(
|
|
14174
|
-
'(
|
|
14347
|
+
'(when_not true (write! "Hi") (write! "There"))',
|
|
14348
|
+
'(when_not false (write! "Hi") (write! "There"))',
|
|
14349
|
+
'(when_not true)',
|
|
14350
|
+
'(when_not false)',
|
|
14175
14351
|
],
|
|
14176
14352
|
},
|
|
14177
14353
|
'comment': {
|
|
@@ -14179,7 +14355,7 @@ var specialExpressionsReference = {
|
|
|
14179
14355
|
category: 'Special expression',
|
|
14180
14356
|
linkName: 'comment',
|
|
14181
14357
|
returns: {
|
|
14182
|
-
type: '
|
|
14358
|
+
type: 'null',
|
|
14183
14359
|
},
|
|
14184
14360
|
args: {
|
|
14185
14361
|
expressions: {
|
|
@@ -14220,7 +14396,7 @@ var specialExpressionsReference = {
|
|
|
14220
14396
|
category: 'Special expression',
|
|
14221
14397
|
linkName: 'recur',
|
|
14222
14398
|
returns: {
|
|
14223
|
-
type: '
|
|
14399
|
+
type: 'null',
|
|
14224
14400
|
},
|
|
14225
14401
|
args: {
|
|
14226
14402
|
expressions: {
|
|
@@ -14233,9 +14409,9 @@ var specialExpressionsReference = {
|
|
|
14233
14409
|
],
|
|
14234
14410
|
description: 'Recursevly calls enclosing function or loop with its evaluated $expressions.',
|
|
14235
14411
|
examples: [
|
|
14236
|
-
"\n(defn foo [n]\n (write! n)\n (when (
|
|
14237
|
-
"\n(\n (fn [n]\n (write! n)\n (when (
|
|
14238
|
-
"\n(\n loop [n 3]\n (write! n)\n (when\n (
|
|
14412
|
+
"\n(defn foo [n]\n (write! n)\n (when (! (zero? n))\n (recur\n (dec n))))\n(foo 3)",
|
|
14413
|
+
"\n(\n (fn [n]\n (write! n)\n (when (! (zero? n))\n (recur\n (dec n))))\n 3)",
|
|
14414
|
+
"\n(\n loop [n 3]\n (write! n)\n (when\n (! (zero? n))\n (recur (dec n))))",
|
|
14239
14415
|
],
|
|
14240
14416
|
},
|
|
14241
14417
|
'loop': {
|
|
@@ -14260,35 +14436,16 @@ var specialExpressionsReference = {
|
|
|
14260
14436
|
],
|
|
14261
14437
|
description: 'Executes $expressions with initial $bindings. The $bindings will be replaced with the recur parameters for subsequent recursions.',
|
|
14262
14438
|
examples: [
|
|
14263
|
-
"\n(loop [n 3]\n (write! n)\n (when\n (
|
|
14264
|
-
"\n(loop [n 3]\n (write! n)\n (if\n (
|
|
14439
|
+
"\n(loop [n 3]\n (write! n)\n (when\n (! (zero? n))\n (recur (dec n))))",
|
|
14440
|
+
"\n(loop [n 3]\n (write! n)\n (if\n (! (zero? n))\n (recur (dec n))\n n))",
|
|
14265
14441
|
],
|
|
14266
14442
|
},
|
|
14267
|
-
'time!': {
|
|
14268
|
-
title: 'time!',
|
|
14269
|
-
category: 'Special expression',
|
|
14270
|
-
linkName: 'time-exclamation',
|
|
14271
|
-
clojureDocs: 'time',
|
|
14272
|
-
returns: {
|
|
14273
|
-
type: 'any',
|
|
14274
|
-
},
|
|
14275
|
-
args: {
|
|
14276
|
-
expression: {
|
|
14277
|
-
type: '*expression',
|
|
14278
|
-
},
|
|
14279
|
-
},
|
|
14280
|
-
variants: [
|
|
14281
|
-
{ argumentNames: ['expression'] },
|
|
14282
|
-
],
|
|
14283
|
-
description: 'Prints the time it took to evaluate $expression. Returns $expression evaluated.',
|
|
14284
|
-
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))"],
|
|
14285
|
-
},
|
|
14286
14443
|
'doseq': {
|
|
14287
14444
|
title: 'doseq',
|
|
14288
14445
|
category: 'Special expression',
|
|
14289
14446
|
linkName: 'doseq',
|
|
14290
14447
|
returns: {
|
|
14291
|
-
type: '
|
|
14448
|
+
type: 'null',
|
|
14292
14449
|
},
|
|
14293
14450
|
args: {
|
|
14294
14451
|
bindings: {
|
|
@@ -14428,10 +14585,10 @@ var stringReference = {
|
|
|
14428
14585
|
'(subs "A string" 100)',
|
|
14429
14586
|
],
|
|
14430
14587
|
},
|
|
14431
|
-
'
|
|
14432
|
-
title: '
|
|
14588
|
+
'string_repeat': {
|
|
14589
|
+
title: 'string_repeat',
|
|
14433
14590
|
category: 'String',
|
|
14434
|
-
linkName: '
|
|
14591
|
+
linkName: 'string_repeat',
|
|
14435
14592
|
clojureDocs: null,
|
|
14436
14593
|
returns: {
|
|
14437
14594
|
type: 'number',
|
|
@@ -14449,8 +14606,8 @@ var stringReference = {
|
|
|
14449
14606
|
],
|
|
14450
14607
|
description: 'Repeates $s $n times.',
|
|
14451
14608
|
examples: [
|
|
14452
|
-
'(
|
|
14453
|
-
'(
|
|
14609
|
+
'(string_repeat "*" 10)',
|
|
14610
|
+
'(string_repeat "***" 0)',
|
|
14454
14611
|
],
|
|
14455
14612
|
},
|
|
14456
14613
|
'str': {
|
|
@@ -14500,41 +14657,10 @@ var stringReference = {
|
|
|
14500
14657
|
'(number "-1.01")',
|
|
14501
14658
|
],
|
|
14502
14659
|
},
|
|
14503
|
-
'
|
|
14504
|
-
title: '
|
|
14505
|
-
category: 'String',
|
|
14506
|
-
linkName: 'number-to-string',
|
|
14507
|
-
clojureDocs: null,
|
|
14508
|
-
returns: {
|
|
14509
|
-
type: 'string',
|
|
14510
|
-
},
|
|
14511
|
-
args: {
|
|
14512
|
-
n: {
|
|
14513
|
-
type: 'number',
|
|
14514
|
-
},
|
|
14515
|
-
base: {
|
|
14516
|
-
type: 'number',
|
|
14517
|
-
description: '2, 8, 10 or 16',
|
|
14518
|
-
},
|
|
14519
|
-
},
|
|
14520
|
-
variants: [
|
|
14521
|
-
{ argumentNames: ['n'] },
|
|
14522
|
-
{ argumentNames: ['n', 'base'] },
|
|
14523
|
-
],
|
|
14524
|
-
description: 'Converts $n to a string. If $base is not equal to `10`, $n must be a non negative integer.',
|
|
14525
|
-
examples: [
|
|
14526
|
-
'(number-to-string 10)',
|
|
14527
|
-
'(number-to-string -1.01)',
|
|
14528
|
-
'(number-to-string -.01)',
|
|
14529
|
-
'(number-to-string 15 2)',
|
|
14530
|
-
'(number-to-string 15 8)',
|
|
14531
|
-
'(number-to-string 15 16)',
|
|
14532
|
-
],
|
|
14533
|
-
},
|
|
14534
|
-
'lower-case': {
|
|
14535
|
-
title: 'lower-case',
|
|
14660
|
+
'lower_case': {
|
|
14661
|
+
title: 'lower_case',
|
|
14536
14662
|
category: 'String',
|
|
14537
|
-
linkName: '
|
|
14663
|
+
linkName: 'lower_case',
|
|
14538
14664
|
returns: {
|
|
14539
14665
|
type: 'string',
|
|
14540
14666
|
},
|
|
@@ -14548,14 +14674,14 @@ var stringReference = {
|
|
|
14548
14674
|
],
|
|
14549
14675
|
description: 'Returns $s converted to lower case.',
|
|
14550
14676
|
examples: [
|
|
14551
|
-
'(
|
|
14552
|
-
'(
|
|
14677
|
+
'(lower_case "Albert")',
|
|
14678
|
+
'(lower_case "")',
|
|
14553
14679
|
],
|
|
14554
14680
|
},
|
|
14555
|
-
'
|
|
14556
|
-
title: '
|
|
14681
|
+
'upper_case': {
|
|
14682
|
+
title: 'upper_case',
|
|
14557
14683
|
category: 'String',
|
|
14558
|
-
linkName: '
|
|
14684
|
+
linkName: 'upper_case',
|
|
14559
14685
|
clojureDocs: null,
|
|
14560
14686
|
returns: {
|
|
14561
14687
|
type: 'string',
|
|
@@ -14570,8 +14696,8 @@ var stringReference = {
|
|
|
14570
14696
|
],
|
|
14571
14697
|
description: 'Returns $s converted to upper case.',
|
|
14572
14698
|
examples: [
|
|
14573
|
-
'(
|
|
14574
|
-
'(
|
|
14699
|
+
'(upper_case "Albert")',
|
|
14700
|
+
'(upper_case "")',
|
|
14575
14701
|
],
|
|
14576
14702
|
},
|
|
14577
14703
|
'trim': {
|
|
@@ -14597,10 +14723,10 @@ var stringReference = {
|
|
|
14597
14723
|
'(trim "")',
|
|
14598
14724
|
],
|
|
14599
14725
|
},
|
|
14600
|
-
'
|
|
14601
|
-
title: '
|
|
14726
|
+
'trim_left': {
|
|
14727
|
+
title: 'trim_left',
|
|
14602
14728
|
category: 'String',
|
|
14603
|
-
linkName: '
|
|
14729
|
+
linkName: 'trim_left',
|
|
14604
14730
|
clojureDocs: null,
|
|
14605
14731
|
returns: {
|
|
14606
14732
|
type: 'string',
|
|
@@ -14615,15 +14741,15 @@ var stringReference = {
|
|
|
14615
14741
|
],
|
|
14616
14742
|
description: 'Returns a new string with leading whitespaces removed.',
|
|
14617
14743
|
examples: [
|
|
14618
|
-
'(
|
|
14619
|
-
'(
|
|
14620
|
-
'(
|
|
14744
|
+
'(trim_left " Albert ")',
|
|
14745
|
+
'(trim_left " ")',
|
|
14746
|
+
'(trim_left "")',
|
|
14621
14747
|
],
|
|
14622
14748
|
},
|
|
14623
|
-
'
|
|
14624
|
-
title: '
|
|
14749
|
+
'trim_right': {
|
|
14750
|
+
title: 'trim_right',
|
|
14625
14751
|
category: 'String',
|
|
14626
|
-
linkName: '
|
|
14752
|
+
linkName: 'trim_right',
|
|
14627
14753
|
clojureDocs: null,
|
|
14628
14754
|
returns: {
|
|
14629
14755
|
type: 'string',
|
|
@@ -14638,15 +14764,15 @@ var stringReference = {
|
|
|
14638
14764
|
],
|
|
14639
14765
|
description: 'Returns a new string with trailing whitespaces removed.',
|
|
14640
14766
|
examples: [
|
|
14641
|
-
'(
|
|
14642
|
-
'(
|
|
14643
|
-
'(
|
|
14767
|
+
'(trim_right " Albert ")',
|
|
14768
|
+
'(trim_right " ")',
|
|
14769
|
+
'(trim_right "")',
|
|
14644
14770
|
],
|
|
14645
14771
|
},
|
|
14646
|
-
'
|
|
14647
|
-
title: '
|
|
14772
|
+
'pad_left': {
|
|
14773
|
+
title: 'pad_left',
|
|
14648
14774
|
category: 'String',
|
|
14649
|
-
linkName: '
|
|
14775
|
+
linkName: 'pad_left',
|
|
14650
14776
|
clojureDocs: null,
|
|
14651
14777
|
returns: {
|
|
14652
14778
|
type: 'string',
|
|
@@ -14668,16 +14794,16 @@ var stringReference = {
|
|
|
14668
14794
|
],
|
|
14669
14795
|
description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given $length.',
|
|
14670
14796
|
examples: [
|
|
14671
|
-
'(
|
|
14672
|
-
'(
|
|
14673
|
-
'(
|
|
14674
|
-
'(
|
|
14797
|
+
'(pad_left "Albert" 20)',
|
|
14798
|
+
'(pad_left "Albert" 20 "-*-")',
|
|
14799
|
+
'(pad_left "Albert" 5)',
|
|
14800
|
+
'(pad_left "Albert" -1)',
|
|
14675
14801
|
],
|
|
14676
14802
|
},
|
|
14677
|
-
'
|
|
14678
|
-
title: '
|
|
14803
|
+
'pad_right': {
|
|
14804
|
+
title: 'pad_right',
|
|
14679
14805
|
category: 'String',
|
|
14680
|
-
linkName: '
|
|
14806
|
+
linkName: 'pad_right',
|
|
14681
14807
|
clojureDocs: null,
|
|
14682
14808
|
returns: {
|
|
14683
14809
|
type: 'string',
|
|
@@ -14699,10 +14825,10 @@ var stringReference = {
|
|
|
14699
14825
|
],
|
|
14700
14826
|
description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given `length`.',
|
|
14701
14827
|
examples: [
|
|
14702
|
-
'(
|
|
14703
|
-
'(
|
|
14704
|
-
'(
|
|
14705
|
-
'(
|
|
14828
|
+
'(pad_right "Albert" 20)',
|
|
14829
|
+
'(pad_right "Albert" 20 "-*-")',
|
|
14830
|
+
'(pad_right "Albert" 5)',
|
|
14831
|
+
'(pad_right "Albert" -1)',
|
|
14706
14832
|
],
|
|
14707
14833
|
},
|
|
14708
14834
|
'split': {
|
|
@@ -14773,10 +14899,10 @@ var stringReference = {
|
|
|
14773
14899
|
'(template "No book||||One book||||Two books||||Three books||||$1 books" 4)',
|
|
14774
14900
|
],
|
|
14775
14901
|
},
|
|
14776
|
-
'
|
|
14777
|
-
title: '
|
|
14902
|
+
'to_char_code': {
|
|
14903
|
+
title: 'to_char_code',
|
|
14778
14904
|
category: 'String',
|
|
14779
|
-
linkName: '
|
|
14905
|
+
linkName: 'to_char_code',
|
|
14780
14906
|
clojureDocs: null,
|
|
14781
14907
|
returns: {
|
|
14782
14908
|
type: 'number',
|
|
@@ -14791,14 +14917,14 @@ var stringReference = {
|
|
|
14791
14917
|
],
|
|
14792
14918
|
description: 'Return code point for first character in $c.',
|
|
14793
14919
|
examples: [
|
|
14794
|
-
'(
|
|
14795
|
-
'(
|
|
14920
|
+
'(to_char_code :A)',
|
|
14921
|
+
'(to_char_code "Albert")',
|
|
14796
14922
|
],
|
|
14797
14923
|
},
|
|
14798
|
-
'
|
|
14799
|
-
title: '
|
|
14924
|
+
'from_char_code': {
|
|
14925
|
+
title: 'from_char_code',
|
|
14800
14926
|
category: 'String',
|
|
14801
|
-
linkName: '
|
|
14927
|
+
linkName: 'from_char_code',
|
|
14802
14928
|
clojureDocs: null,
|
|
14803
14929
|
returns: {
|
|
14804
14930
|
type: 'string',
|
|
@@ -14813,14 +14939,14 @@ var stringReference = {
|
|
|
14813
14939
|
],
|
|
14814
14940
|
description: 'Return character for code point $code.',
|
|
14815
14941
|
examples: [
|
|
14816
|
-
'(
|
|
14817
|
-
'(
|
|
14942
|
+
'(from_char_code 65)',
|
|
14943
|
+
'(from_char_code 0)',
|
|
14818
14944
|
],
|
|
14819
14945
|
},
|
|
14820
|
-
'
|
|
14821
|
-
title: '
|
|
14946
|
+
'encode_base64': {
|
|
14947
|
+
title: 'encode_base64',
|
|
14822
14948
|
category: 'String',
|
|
14823
|
-
linkName: '
|
|
14949
|
+
linkName: 'encode_base64',
|
|
14824
14950
|
clojureDocs: null,
|
|
14825
14951
|
returns: {
|
|
14826
14952
|
type: 'string',
|
|
@@ -14835,13 +14961,13 @@ var stringReference = {
|
|
|
14835
14961
|
],
|
|
14836
14962
|
description: 'Returns a Base64 encoded string from $s.',
|
|
14837
14963
|
examples: [
|
|
14838
|
-
'(
|
|
14964
|
+
'(encode_base64 "Albert")',
|
|
14839
14965
|
],
|
|
14840
14966
|
},
|
|
14841
|
-
'
|
|
14842
|
-
title: '
|
|
14967
|
+
'decode_base64': {
|
|
14968
|
+
title: 'decode_base64',
|
|
14843
14969
|
category: 'String',
|
|
14844
|
-
linkName: '
|
|
14970
|
+
linkName: 'decode_base64',
|
|
14845
14971
|
clojureDocs: null,
|
|
14846
14972
|
returns: {
|
|
14847
14973
|
type: 'string',
|
|
@@ -14856,13 +14982,13 @@ var stringReference = {
|
|
|
14856
14982
|
],
|
|
14857
14983
|
description: 'Returns a Base64 decoded string from $base64string.',
|
|
14858
14984
|
examples: [
|
|
14859
|
-
'(
|
|
14985
|
+
'(decode_base64 "QWxiZXJ0IPCfkLs=")',
|
|
14860
14986
|
],
|
|
14861
14987
|
},
|
|
14862
|
-
'
|
|
14863
|
-
title: '
|
|
14988
|
+
'encode_uri_component': {
|
|
14989
|
+
title: 'encode_uri_component',
|
|
14864
14990
|
category: 'String',
|
|
14865
|
-
linkName: '
|
|
14991
|
+
linkName: 'encode_uri_component',
|
|
14866
14992
|
clojureDocs: null,
|
|
14867
14993
|
returns: {
|
|
14868
14994
|
type: 'string',
|
|
@@ -14877,13 +15003,13 @@ var stringReference = {
|
|
|
14877
15003
|
],
|
|
14878
15004
|
description: 'Returns an escaped `URI` string.',
|
|
14879
15005
|
examples: [
|
|
14880
|
-
'(
|
|
15006
|
+
'(encode_uri_component "Hi everyone!?")',
|
|
14881
15007
|
],
|
|
14882
15008
|
},
|
|
14883
|
-
'
|
|
14884
|
-
title: '
|
|
15009
|
+
'decode_uri_component': {
|
|
15010
|
+
title: 'decode_uri_component',
|
|
14885
15011
|
category: 'String',
|
|
14886
|
-
linkName: '
|
|
15012
|
+
linkName: 'decode_uri_component',
|
|
14887
15013
|
clojureDocs: null,
|
|
14888
15014
|
returns: {
|
|
14889
15015
|
type: 'string',
|
|
@@ -14898,7 +15024,7 @@ var stringReference = {
|
|
|
14898
15024
|
],
|
|
14899
15025
|
description: 'Returns an un-escaped `URI` string.',
|
|
14900
15026
|
examples: [
|
|
14901
|
-
'(
|
|
15027
|
+
'(decode_uri_component "Hi%20everyone!%3F%20%F0%9F%91%8D")',
|
|
14902
15028
|
],
|
|
14903
15029
|
},
|
|
14904
15030
|
'join': {
|
|
@@ -14923,15 +15049,42 @@ var stringReference = {
|
|
|
14923
15049
|
description: 'Returns a new string by concatenating all of the elements in $arr, separated by $delimiter.',
|
|
14924
15050
|
examples: [
|
|
14925
15051
|
'(join ["Albert" "Mojir"] " ")',
|
|
14926
|
-
'(join (map
|
|
15052
|
+
'(join (map [0 1 2 3 4 5 6 7 8 9] str) ", ")',
|
|
15053
|
+
],
|
|
15054
|
+
},
|
|
15055
|
+
'++': {
|
|
15056
|
+
title: '++',
|
|
15057
|
+
category: 'String',
|
|
15058
|
+
linkName: '-plus-plus',
|
|
15059
|
+
clojureDocs: null,
|
|
15060
|
+
returns: {
|
|
15061
|
+
type: 'string',
|
|
15062
|
+
},
|
|
15063
|
+
args: {
|
|
15064
|
+
strings: {
|
|
15065
|
+
type: ['string', 'number', 'null'],
|
|
15066
|
+
rest: true,
|
|
15067
|
+
},
|
|
15068
|
+
},
|
|
15069
|
+
variants: [{
|
|
15070
|
+
argumentNames: ['strings'],
|
|
15071
|
+
}],
|
|
15072
|
+
description: 'Concatenats $strings into one string.',
|
|
15073
|
+
examples: [
|
|
15074
|
+
'(++ "Albert" " " "Mojir")',
|
|
15075
|
+
'(++ "Albert" "Mojir")',
|
|
15076
|
+
'(++ "Albert" null "Mojir")',
|
|
15077
|
+
'(++ "Albert")',
|
|
15078
|
+
'(++)',
|
|
14927
15079
|
],
|
|
14928
15080
|
},
|
|
14929
15081
|
};
|
|
14930
15082
|
|
|
14931
|
-
var bitwiseReference = { '
|
|
14932
|
-
title: '
|
|
15083
|
+
var bitwiseReference = { '<<': {
|
|
15084
|
+
title: '<<',
|
|
14933
15085
|
category: 'Bitwise',
|
|
14934
|
-
linkName: '
|
|
15086
|
+
linkName: '-lt-lt',
|
|
15087
|
+
clojureDocs: 'bit-shift-left',
|
|
14935
15088
|
returns: {
|
|
14936
15089
|
type: 'integer',
|
|
14937
15090
|
},
|
|
@@ -14947,11 +15100,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
14947
15100
|
{ argumentNames: ['x', 'n'] },
|
|
14948
15101
|
],
|
|
14949
15102
|
description: 'Shifts $x arithmetically left by $n bit positions.',
|
|
14950
|
-
examples: ['(
|
|
14951
|
-
}, '
|
|
14952
|
-
title: '
|
|
15103
|
+
examples: ['(<< 1 10)', '(<< -4 2)'],
|
|
15104
|
+
}, '>>': {
|
|
15105
|
+
title: '>>',
|
|
14953
15106
|
category: 'Bitwise',
|
|
14954
|
-
linkName: '
|
|
15107
|
+
linkName: '-gt-gt',
|
|
15108
|
+
clojureDocs: 'bit-shift-right',
|
|
14955
15109
|
returns: {
|
|
14956
15110
|
type: 'integer',
|
|
14957
15111
|
},
|
|
@@ -14967,11 +15121,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
14967
15121
|
{ argumentNames: ['x', 'n'] },
|
|
14968
15122
|
],
|
|
14969
15123
|
description: 'Shifts $x arithmetically right by $n bit positions.',
|
|
14970
|
-
examples: ['(
|
|
14971
|
-
}, '
|
|
14972
|
-
title: '
|
|
15124
|
+
examples: ['(>> 2048 10)', '(>> 4 10)'],
|
|
15125
|
+
}, '>>>': {
|
|
15126
|
+
title: '>>>',
|
|
14973
15127
|
category: 'Bitwise',
|
|
14974
|
-
linkName: '
|
|
15128
|
+
linkName: '-gt-gt-gt',
|
|
15129
|
+
clojureDocs: 'unsigned-bit-shift-right',
|
|
14975
15130
|
returns: {
|
|
14976
15131
|
type: 'integer',
|
|
14977
15132
|
},
|
|
@@ -14987,11 +15142,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
14987
15142
|
{ argumentNames: ['x', 'n'] },
|
|
14988
15143
|
],
|
|
14989
15144
|
description: 'Shifts $x arithmetically right by $n bit positions without sign extension.',
|
|
14990
|
-
examples: ['(
|
|
14991
|
-
}, '
|
|
14992
|
-
title: '
|
|
15145
|
+
examples: ['(>>> 2048 10)', '(>>> 4 10)', '(>>> -1 10)'],
|
|
15146
|
+
}, '~': {
|
|
15147
|
+
title: '~',
|
|
14993
15148
|
category: 'Bitwise',
|
|
14994
|
-
linkName: '
|
|
15149
|
+
linkName: '-tilde',
|
|
15150
|
+
clojureDocs: 'bit-not',
|
|
14995
15151
|
returns: {
|
|
14996
15152
|
type: 'integer',
|
|
14997
15153
|
},
|
|
@@ -15004,11 +15160,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15004
15160
|
{ argumentNames: ['x'] },
|
|
15005
15161
|
],
|
|
15006
15162
|
description: 'Returns bitwise `not` of $x.',
|
|
15007
|
-
examples: ['(
|
|
15008
|
-
}, '
|
|
15009
|
-
title: '
|
|
15163
|
+
examples: ['(~ 0)', '(~ 255)'],
|
|
15164
|
+
}, '&': {
|
|
15165
|
+
title: '&',
|
|
15010
15166
|
category: 'Bitwise',
|
|
15011
|
-
linkName: '
|
|
15167
|
+
linkName: '-and',
|
|
15168
|
+
clojureDocs: 'bit-and',
|
|
15012
15169
|
returns: {
|
|
15013
15170
|
type: 'integer',
|
|
15014
15171
|
},
|
|
@@ -15030,13 +15187,14 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15030
15187
|
],
|
|
15031
15188
|
description: 'Returns bitwise `and` of all arguments.',
|
|
15032
15189
|
examples: [
|
|
15033
|
-
'(
|
|
15034
|
-
'(
|
|
15190
|
+
'(& 0b0011 0b0110)',
|
|
15191
|
+
'(& 0b0011 0b0110 0b1001)',
|
|
15035
15192
|
],
|
|
15036
|
-
}, '
|
|
15037
|
-
title: '
|
|
15193
|
+
}, '&!': {
|
|
15194
|
+
title: '&!',
|
|
15038
15195
|
category: 'Bitwise',
|
|
15039
|
-
linkName: '
|
|
15196
|
+
linkName: '-and-exclamation',
|
|
15197
|
+
clojureDocs: 'bit-and-not',
|
|
15040
15198
|
returns: {
|
|
15041
15199
|
type: 'integer',
|
|
15042
15200
|
},
|
|
@@ -15057,11 +15215,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15057
15215
|
{ argumentNames: ['x', 'y', 'rest'] },
|
|
15058
15216
|
],
|
|
15059
15217
|
description: 'Returns bitwise `and` with complement.',
|
|
15060
|
-
examples: ['(
|
|
15061
|
-
}, '
|
|
15062
|
-
title: '
|
|
15218
|
+
examples: ['(&! 0b0011 0b0110)', '(&! 0b0011 0b0110 0b1001)'],
|
|
15219
|
+
}, '|': {
|
|
15220
|
+
title: '|',
|
|
15063
15221
|
category: 'Bitwise',
|
|
15064
|
-
linkName: '
|
|
15222
|
+
linkName: '-or',
|
|
15223
|
+
clojureDocs: 'bit-or',
|
|
15065
15224
|
returns: {
|
|
15066
15225
|
type: 'integer',
|
|
15067
15226
|
},
|
|
@@ -15082,11 +15241,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15082
15241
|
{ argumentNames: ['x', 'y', 'rest'] },
|
|
15083
15242
|
],
|
|
15084
15243
|
description: 'Returns bitwise `or` of all arguments.',
|
|
15085
|
-
examples: ['(
|
|
15086
|
-
}, '
|
|
15087
|
-
title: '
|
|
15244
|
+
examples: ['(| 0b0011 0b0110)', '(| 0b1000 0b0100 0b0010)'],
|
|
15245
|
+
}, '^': {
|
|
15246
|
+
title: '^',
|
|
15088
15247
|
category: 'Bitwise',
|
|
15089
|
-
linkName: '
|
|
15248
|
+
linkName: '-caret',
|
|
15249
|
+
clojureDocs: 'bit-xor',
|
|
15090
15250
|
returns: {
|
|
15091
15251
|
type: 'integer',
|
|
15092
15252
|
},
|
|
@@ -15107,11 +15267,11 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15107
15267
|
{ argumentNames: ['x', 'y', 'rest'] },
|
|
15108
15268
|
],
|
|
15109
15269
|
description: 'Returns bitwise `xor` of all arguments.',
|
|
15110
|
-
examples: ['(
|
|
15111
|
-
}, '
|
|
15112
|
-
title: '
|
|
15270
|
+
examples: ['(^ 0b0011 0b0110)', '(^ 0b11110000 0b00111100 0b10101010)'],
|
|
15271
|
+
}, 'bit_flip': {
|
|
15272
|
+
title: 'bit_flip',
|
|
15113
15273
|
category: 'Bitwise',
|
|
15114
|
-
linkName: '
|
|
15274
|
+
linkName: 'bit_flip',
|
|
15115
15275
|
returns: {
|
|
15116
15276
|
type: 'integer',
|
|
15117
15277
|
},
|
|
@@ -15127,11 +15287,11 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15127
15287
|
{ argumentNames: ['x', 'n'] },
|
|
15128
15288
|
],
|
|
15129
15289
|
description: 'Flips bit number $n.',
|
|
15130
|
-
examples: ['(
|
|
15131
|
-
}, '
|
|
15132
|
-
title: '
|
|
15290
|
+
examples: ['(bit_flip 0b0011 1)', '(bit_flip 0b1100 1)'],
|
|
15291
|
+
}, 'bit_clear': {
|
|
15292
|
+
title: 'bit_clear',
|
|
15133
15293
|
category: 'Bitwise',
|
|
15134
|
-
linkName: '
|
|
15294
|
+
linkName: 'bit_clear',
|
|
15135
15295
|
returns: {
|
|
15136
15296
|
type: 'integer',
|
|
15137
15297
|
},
|
|
@@ -15147,11 +15307,11 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15147
15307
|
{ argumentNames: ['x', 'n'] },
|
|
15148
15308
|
],
|
|
15149
15309
|
description: 'Clears bit number $n.',
|
|
15150
|
-
examples: ['(
|
|
15151
|
-
}, '
|
|
15152
|
-
title: '
|
|
15310
|
+
examples: ['(bit_clear 0b0011 1)', '(bit_clear 0b1100 1)'],
|
|
15311
|
+
}, 'bit_set': {
|
|
15312
|
+
title: 'bit_set',
|
|
15153
15313
|
category: 'Bitwise',
|
|
15154
|
-
linkName: '
|
|
15314
|
+
linkName: 'bit_set',
|
|
15155
15315
|
returns: {
|
|
15156
15316
|
type: 'integer',
|
|
15157
15317
|
},
|
|
@@ -15167,11 +15327,11 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15167
15327
|
{ argumentNames: ['x', 'n'] },
|
|
15168
15328
|
],
|
|
15169
15329
|
description: 'Sets bit number $n.',
|
|
15170
|
-
examples: ['(
|
|
15171
|
-
}, '
|
|
15172
|
-
title: '
|
|
15330
|
+
examples: ['(bit_set 0b0011 1)', '(bit_set 0b1100 1)'],
|
|
15331
|
+
}, 'bit_test': {
|
|
15332
|
+
title: 'bit_test',
|
|
15173
15333
|
category: 'Bitwise',
|
|
15174
|
-
linkName: '
|
|
15334
|
+
linkName: 'bit_test',
|
|
15175
15335
|
returns: {
|
|
15176
15336
|
type: 'boolean',
|
|
15177
15337
|
},
|
|
@@ -15187,7 +15347,7 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15187
15347
|
{ argumentNames: ['x', 'n'] },
|
|
15188
15348
|
],
|
|
15189
15349
|
description: 'Checks if bit number $n is set.',
|
|
15190
|
-
examples: ['(
|
|
15350
|
+
examples: ['(bit_test 0b0011 1)', '(bit_test 0b1100 1)'],
|
|
15191
15351
|
} };
|
|
15192
15352
|
|
|
15193
15353
|
var shorthand = {
|
|
@@ -15515,13 +15675,13 @@ var api = {
|
|
|
15515
15675
|
'*',
|
|
15516
15676
|
'/',
|
|
15517
15677
|
'mod',
|
|
15518
|
-
'
|
|
15678
|
+
'%',
|
|
15519
15679
|
'quot',
|
|
15520
15680
|
'inc',
|
|
15521
15681
|
'dec',
|
|
15522
15682
|
'sqrt',
|
|
15523
15683
|
'cbrt',
|
|
15524
|
-
'
|
|
15684
|
+
'**',
|
|
15525
15685
|
'exp',
|
|
15526
15686
|
'round',
|
|
15527
15687
|
'trunc',
|
|
@@ -15571,23 +15731,20 @@ var api = {
|
|
|
15571
15731
|
],
|
|
15572
15732
|
misc: [
|
|
15573
15733
|
'!=',
|
|
15574
|
-
'
|
|
15734
|
+
'==',
|
|
15575
15735
|
'<',
|
|
15576
15736
|
'>',
|
|
15577
15737
|
'<=',
|
|
15578
15738
|
'>=',
|
|
15579
|
-
'
|
|
15739
|
+
'!',
|
|
15580
15740
|
'write!',
|
|
15581
|
-
'
|
|
15582
|
-
'
|
|
15583
|
-
'inst-ms->iso-date-time',
|
|
15741
|
+
'iso_date>epoch',
|
|
15742
|
+
'epoch>iso_date',
|
|
15584
15743
|
'boolean',
|
|
15585
15744
|
'compare',
|
|
15586
|
-
'lits-version!',
|
|
15587
|
-
'uuid!',
|
|
15588
15745
|
'equal?',
|
|
15589
|
-
'
|
|
15590
|
-
'
|
|
15746
|
+
'json_parse',
|
|
15747
|
+
'json_stringify',
|
|
15591
15748
|
],
|
|
15592
15749
|
object: [
|
|
15593
15750
|
'dissoc',
|
|
@@ -15597,9 +15754,9 @@ var api = {
|
|
|
15597
15754
|
'entries',
|
|
15598
15755
|
'find',
|
|
15599
15756
|
'merge',
|
|
15600
|
-
'
|
|
15757
|
+
'merge_with',
|
|
15601
15758
|
'zipmap',
|
|
15602
|
-
'
|
|
15759
|
+
'select_keys',
|
|
15603
15760
|
],
|
|
15604
15761
|
predicate: [
|
|
15605
15762
|
'boolean?',
|
|
@@ -15633,29 +15790,29 @@ var api = {
|
|
|
15633
15790
|
'replace',
|
|
15634
15791
|
],
|
|
15635
15792
|
specialExpressions: [
|
|
15636
|
-
'
|
|
15637
|
-
'
|
|
15793
|
+
'&&',
|
|
15794
|
+
'||',
|
|
15638
15795
|
'def',
|
|
15639
15796
|
'defs',
|
|
15640
15797
|
'let',
|
|
15641
|
-
'
|
|
15642
|
-
'
|
|
15643
|
-
'
|
|
15798
|
+
'if_let',
|
|
15799
|
+
'when_let',
|
|
15800
|
+
'when_first',
|
|
15644
15801
|
'fn',
|
|
15645
15802
|
'defn',
|
|
15646
15803
|
'defns',
|
|
15647
15804
|
'try',
|
|
15648
15805
|
'throw',
|
|
15649
15806
|
'if',
|
|
15650
|
-
'
|
|
15807
|
+
'if_not',
|
|
15651
15808
|
'cond',
|
|
15809
|
+
'switch',
|
|
15652
15810
|
'when',
|
|
15653
|
-
'
|
|
15811
|
+
'when_not',
|
|
15654
15812
|
'comment',
|
|
15655
15813
|
'do',
|
|
15656
15814
|
'recur',
|
|
15657
15815
|
'loop',
|
|
15658
|
-
'time!',
|
|
15659
15816
|
'doseq',
|
|
15660
15817
|
'for',
|
|
15661
15818
|
'declared?',
|
|
@@ -15663,40 +15820,40 @@ var api = {
|
|
|
15663
15820
|
],
|
|
15664
15821
|
string: [
|
|
15665
15822
|
'subs',
|
|
15666
|
-
'
|
|
15823
|
+
'string_repeat',
|
|
15667
15824
|
'str',
|
|
15668
15825
|
'number',
|
|
15669
|
-
'
|
|
15670
|
-
'
|
|
15671
|
-
'upper-case',
|
|
15826
|
+
'lower_case',
|
|
15827
|
+
'upper_case',
|
|
15672
15828
|
'trim',
|
|
15673
|
-
'
|
|
15674
|
-
'
|
|
15675
|
-
'
|
|
15676
|
-
'
|
|
15829
|
+
'trim_left',
|
|
15830
|
+
'trim_right',
|
|
15831
|
+
'pad_left',
|
|
15832
|
+
'pad_right',
|
|
15677
15833
|
'split',
|
|
15678
15834
|
'template',
|
|
15679
|
-
'
|
|
15680
|
-
'
|
|
15681
|
-
'
|
|
15682
|
-
'
|
|
15683
|
-
'
|
|
15684
|
-
'
|
|
15835
|
+
'to_char_code',
|
|
15836
|
+
'from_char_code',
|
|
15837
|
+
'encode_base64',
|
|
15838
|
+
'decode_base64',
|
|
15839
|
+
'encode_uri_component',
|
|
15840
|
+
'decode_uri_component',
|
|
15685
15841
|
'join',
|
|
15842
|
+
'++',
|
|
15686
15843
|
],
|
|
15687
15844
|
bitwise: [
|
|
15688
|
-
'
|
|
15689
|
-
'
|
|
15690
|
-
'
|
|
15691
|
-
'
|
|
15692
|
-
'
|
|
15693
|
-
'
|
|
15694
|
-
'
|
|
15695
|
-
'
|
|
15696
|
-
'
|
|
15697
|
-
'
|
|
15698
|
-
'
|
|
15699
|
-
'
|
|
15845
|
+
'<<',
|
|
15846
|
+
'>>',
|
|
15847
|
+
'>>>',
|
|
15848
|
+
'~',
|
|
15849
|
+
'&',
|
|
15850
|
+
'&!',
|
|
15851
|
+
'|',
|
|
15852
|
+
'^',
|
|
15853
|
+
'bit_flip',
|
|
15854
|
+
'bit_clear',
|
|
15855
|
+
'bit_set',
|
|
15856
|
+
'bit_test',
|
|
15700
15857
|
],
|
|
15701
15858
|
assert: [
|
|
15702
15859
|
'assert',
|
|
@@ -15783,7 +15940,7 @@ var dataTypes = [
|
|
|
15783
15940
|
'function',
|
|
15784
15941
|
'integer',
|
|
15785
15942
|
'any',
|
|
15786
|
-
'
|
|
15943
|
+
'null',
|
|
15787
15944
|
'collection',
|
|
15788
15945
|
'sequence',
|
|
15789
15946
|
'regexp',
|