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