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