@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/cli/cli.js
CHANGED
|
@@ -92,7 +92,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
92
92
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
var version = "2.0.
|
|
95
|
+
var version = "2.0.15";
|
|
96
96
|
|
|
97
97
|
var AstNodeType;
|
|
98
98
|
(function (AstNodeType) {
|
|
@@ -243,6 +243,12 @@ var UndefinedSymbolError = /** @class */ (function (_super) {
|
|
|
243
243
|
return UndefinedSymbolError;
|
|
244
244
|
}(LitsError));
|
|
245
245
|
|
|
246
|
+
function getSourceCodeInfo(anyValue, sourceCodeInfo) {
|
|
247
|
+
var _a;
|
|
248
|
+
// eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access
|
|
249
|
+
return (_a = anyValue === null || anyValue === void 0 ? void 0 : anyValue.sourceCodeInfo) !== null && _a !== void 0 ? _a : sourceCodeInfo;
|
|
250
|
+
}
|
|
251
|
+
|
|
246
252
|
function isTokenDebugData(tokenDebugData) {
|
|
247
253
|
return (typeof tokenDebugData === 'object'
|
|
248
254
|
&& tokenDebugData !== null
|
|
@@ -261,8 +267,12 @@ function addTokenDebugData(token, debugData) {
|
|
|
261
267
|
}
|
|
262
268
|
token.push(debugData);
|
|
263
269
|
}
|
|
264
|
-
function throwUnexpectedToken(expected, actual) {
|
|
265
|
-
|
|
270
|
+
function throwUnexpectedToken(expected, expectedValue, actual) {
|
|
271
|
+
if (actual === undefined) {
|
|
272
|
+
throw new LitsError("Unexpected end of input, expected ".concat(expected).concat(expectedValue ? " '".concat(expectedValue, "'") : ''), undefined);
|
|
273
|
+
}
|
|
274
|
+
var actualOutput = "".concat(actual[0]).concat(actual[1] ? " '".concat(actual[1], "'") : '');
|
|
275
|
+
throw new LitsError("Unexpected token: ".concat(actualOutput, ", expected ").concat(expected).concat(expectedValue ? " '".concat(expectedValue, "'") : ''), getSourceCodeInfo(actual));
|
|
266
276
|
}
|
|
267
277
|
|
|
268
278
|
var commonSimpleTokenTypes = [
|
|
@@ -284,7 +294,7 @@ function isLParenToken(token) {
|
|
|
284
294
|
}
|
|
285
295
|
function assertLParenToken(token) {
|
|
286
296
|
if (!isLParenToken(token)) {
|
|
287
|
-
throwUnexpectedToken('LParen', token);
|
|
297
|
+
throwUnexpectedToken('LParen', undefined, token);
|
|
288
298
|
}
|
|
289
299
|
}
|
|
290
300
|
function asLParenToken(token) {
|
|
@@ -296,7 +306,7 @@ function isRParenToken(token) {
|
|
|
296
306
|
}
|
|
297
307
|
function assertRParenToken(token) {
|
|
298
308
|
if (!isRParenToken(token)) {
|
|
299
|
-
throwUnexpectedToken('RParen', token);
|
|
309
|
+
throwUnexpectedToken('RParen', undefined, token);
|
|
300
310
|
}
|
|
301
311
|
}
|
|
302
312
|
function isLBracketToken(token) {
|
|
@@ -304,7 +314,7 @@ function isLBracketToken(token) {
|
|
|
304
314
|
}
|
|
305
315
|
function assertLBracketToken(token) {
|
|
306
316
|
if (!isLBracketToken(token)) {
|
|
307
|
-
throwUnexpectedToken('LBracket', token);
|
|
317
|
+
throwUnexpectedToken('LBracket', undefined, token);
|
|
308
318
|
}
|
|
309
319
|
}
|
|
310
320
|
function asLBracketToken(token) {
|
|
@@ -316,7 +326,7 @@ function isRBracketToken(token) {
|
|
|
316
326
|
}
|
|
317
327
|
function assertRBracketToken(token) {
|
|
318
328
|
if (!isRBracketToken(token)) {
|
|
319
|
-
throwUnexpectedToken('RBracket', token);
|
|
329
|
+
throwUnexpectedToken('RBracket', undefined, token);
|
|
320
330
|
}
|
|
321
331
|
}
|
|
322
332
|
function isLBraceToken(token) {
|
|
@@ -324,7 +334,7 @@ function isLBraceToken(token) {
|
|
|
324
334
|
}
|
|
325
335
|
function assertLBraceToken(token) {
|
|
326
336
|
if (!isLBraceToken(token)) {
|
|
327
|
-
throwUnexpectedToken('LBrace', token);
|
|
337
|
+
throwUnexpectedToken('LBrace', undefined, token);
|
|
328
338
|
}
|
|
329
339
|
}
|
|
330
340
|
function asLBraceToken(token) {
|
|
@@ -336,7 +346,7 @@ function isRBraceToken(token) {
|
|
|
336
346
|
}
|
|
337
347
|
function assertRBraceToken(token) {
|
|
338
348
|
if (!isRBraceToken(token)) {
|
|
339
|
-
throwUnexpectedToken('RBrace', token);
|
|
349
|
+
throwUnexpectedToken('RBrace', undefined, token);
|
|
340
350
|
}
|
|
341
351
|
}
|
|
342
352
|
function isStringToken(token) {
|
|
@@ -344,7 +354,7 @@ function isStringToken(token) {
|
|
|
344
354
|
}
|
|
345
355
|
function assertStringToken(token) {
|
|
346
356
|
if (!isStringToken(token)) {
|
|
347
|
-
throwUnexpectedToken('String', token);
|
|
357
|
+
throwUnexpectedToken('String', undefined, token);
|
|
348
358
|
}
|
|
349
359
|
}
|
|
350
360
|
function asStringToken(token) {
|
|
@@ -362,7 +372,7 @@ function isEndNotationToken(token) {
|
|
|
362
372
|
}
|
|
363
373
|
function assertEndNotationToken(token) {
|
|
364
374
|
if (!isEndNotationToken(token)) {
|
|
365
|
-
throwUnexpectedToken('EndNotation', token);
|
|
375
|
+
throwUnexpectedToken('EndNotation', undefined, token);
|
|
366
376
|
}
|
|
367
377
|
}
|
|
368
378
|
|
|
@@ -415,28 +425,28 @@ var otherSymbolicOperators = [
|
|
|
415
425
|
'.', // property accessor
|
|
416
426
|
',', // item separator
|
|
417
427
|
'=', // property assignment
|
|
428
|
+
';', // statement terminator
|
|
418
429
|
];
|
|
419
430
|
var symbolicOperators = __spreadArray(__spreadArray(__spreadArray([], __read(symbolicUnaryOperators), false), __read(symbolicBinaryOperators), false), __read(otherSymbolicOperators), false);
|
|
420
431
|
var nonFunctionOperators = [
|
|
421
432
|
'??',
|
|
422
|
-
'
|
|
433
|
+
'&&',
|
|
423
434
|
'comment',
|
|
424
435
|
'cond',
|
|
425
436
|
'declared?',
|
|
426
437
|
'if',
|
|
427
|
-
'
|
|
428
|
-
'
|
|
438
|
+
'if_not',
|
|
439
|
+
'||',
|
|
429
440
|
'when',
|
|
430
|
-
'
|
|
441
|
+
'when_not',
|
|
431
442
|
'do',
|
|
432
|
-
'time!',
|
|
433
443
|
'throw',
|
|
434
444
|
'let',
|
|
435
445
|
'def',
|
|
436
446
|
'defs',
|
|
437
|
-
'
|
|
438
|
-
'
|
|
439
|
-
'
|
|
447
|
+
'if_let',
|
|
448
|
+
'when_let',
|
|
449
|
+
'when_first',
|
|
440
450
|
'fn',
|
|
441
451
|
'defn',
|
|
442
452
|
'defns',
|
|
@@ -467,7 +477,7 @@ function isA_SymbolToken(token) {
|
|
|
467
477
|
}
|
|
468
478
|
function assertA_SymbolToken(token) {
|
|
469
479
|
if (!isA_SymbolToken(token)) {
|
|
470
|
-
throwUnexpectedToken('A_Symbol', token);
|
|
480
|
+
throwUnexpectedToken('A_Symbol', undefined, token);
|
|
471
481
|
}
|
|
472
482
|
}
|
|
473
483
|
function asA_SymbolToken(token) {
|
|
@@ -477,8 +487,19 @@ function asA_SymbolToken(token) {
|
|
|
477
487
|
function isA_BinaryOperatorToken(token) {
|
|
478
488
|
return (token === null || token === void 0 ? void 0 : token[0]) === 'A_Operator' && isSymbolicBinaryOperator(token[1]);
|
|
479
489
|
}
|
|
480
|
-
function isA_ReservedSymbolToken(token) {
|
|
481
|
-
|
|
490
|
+
function isA_ReservedSymbolToken(token, symbolName) {
|
|
491
|
+
if ((token === null || token === void 0 ? void 0 : token[0]) !== 'A_ReservedSymbol') {
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
if (symbolName && token[1] !== symbolName) {
|
|
495
|
+
return false;
|
|
496
|
+
}
|
|
497
|
+
return true;
|
|
498
|
+
}
|
|
499
|
+
function assertA_ReservedSymbolToken(token, symbolName) {
|
|
500
|
+
if (!isA_ReservedSymbolToken(token, symbolName)) {
|
|
501
|
+
throwUnexpectedToken('A_ReservedSymbol', symbolName, token);
|
|
502
|
+
}
|
|
482
503
|
}
|
|
483
504
|
function isA_CommentToken(token) {
|
|
484
505
|
return (token === null || token === void 0 ? void 0 : token[0]) === 'A_SingleLineComment';
|
|
@@ -497,10 +518,9 @@ function isA_OperatorToken(token, operatorName) {
|
|
|
497
518
|
}
|
|
498
519
|
function assertA_OperatorToken(token, operatorName) {
|
|
499
520
|
if (!isA_OperatorToken(token, operatorName)) {
|
|
500
|
-
|
|
521
|
+
{
|
|
501
522
|
throw new LitsError("Unexpected token: ".concat(token, ", expected operator ").concat(operatorName), undefined);
|
|
502
523
|
}
|
|
503
|
-
throwUnexpectedToken('A_Operator', token);
|
|
504
524
|
}
|
|
505
525
|
}
|
|
506
526
|
function isA_WhitespaceToken(token) {
|
|
@@ -513,7 +533,7 @@ function isA_BasePrefixedNumberToken(token) {
|
|
|
513
533
|
return (token === null || token === void 0 ? void 0 : token[0]) === 'A_BasePrefixedNumber';
|
|
514
534
|
}
|
|
515
535
|
|
|
516
|
-
var modifierNames = ['&', '&let', '&when', '&while'];
|
|
536
|
+
var modifierNames = ['&rest', '&let', '&when', '&while'];
|
|
517
537
|
var polishOnlySimpleTokenTypes = [
|
|
518
538
|
'P_FnShorthand',
|
|
519
539
|
];
|
|
@@ -536,7 +556,7 @@ function isP_StringShorthandToken(token) {
|
|
|
536
556
|
}
|
|
537
557
|
function assertP_StringShorthandToken(token) {
|
|
538
558
|
if (!isP_StringShorthandToken(token)) {
|
|
539
|
-
throwUnexpectedToken('P_StringShorthand', token);
|
|
559
|
+
throwUnexpectedToken('P_StringShorthand', undefined, token);
|
|
540
560
|
}
|
|
541
561
|
}
|
|
542
562
|
function asP_StringShorthandToken(token) {
|
|
@@ -548,7 +568,7 @@ function isP_SymbolToken(token) {
|
|
|
548
568
|
}
|
|
549
569
|
function assertP_SymbolToken(token) {
|
|
550
570
|
if (!isP_SymbolToken(token)) {
|
|
551
|
-
throwUnexpectedToken('P_Symbol', token);
|
|
571
|
+
throwUnexpectedToken('P_Symbol', undefined, token);
|
|
552
572
|
}
|
|
553
573
|
}
|
|
554
574
|
function asP_SymbolToken(token) {
|
|
@@ -566,7 +586,7 @@ function isP_RegexpShorthandToken(token) {
|
|
|
566
586
|
}
|
|
567
587
|
function assertP_RegexpShorthandToken(token) {
|
|
568
588
|
if (!isP_RegexpShorthandToken(token)) {
|
|
569
|
-
throwUnexpectedToken('P_RegexpShorthand', token);
|
|
589
|
+
throwUnexpectedToken('P_RegexpShorthand', undefined, token);
|
|
570
590
|
}
|
|
571
591
|
}
|
|
572
592
|
function asP_RegexpShorthandToken(token) {
|
|
@@ -581,7 +601,7 @@ function isP_CollectionAccessorToken(token) {
|
|
|
581
601
|
}
|
|
582
602
|
function assertP_CollectionAccessorToken(token) {
|
|
583
603
|
if (!isP_CollectionAccessorToken(token)) {
|
|
584
|
-
throwUnexpectedToken('P_CollectionAccessor', token);
|
|
604
|
+
throwUnexpectedToken('P_CollectionAccessor', undefined, token);
|
|
585
605
|
}
|
|
586
606
|
}
|
|
587
607
|
function asP_CollectionAccessorToken(token) {
|
|
@@ -593,7 +613,7 @@ function isP_CommentToken(token) {
|
|
|
593
613
|
}
|
|
594
614
|
function assertP_CommentToken(token) {
|
|
595
615
|
if (!isP_CommentToken(token)) {
|
|
596
|
-
throwUnexpectedToken('P_Comment', token);
|
|
616
|
+
throwUnexpectedToken('P_Comment', undefined, token);
|
|
597
617
|
}
|
|
598
618
|
}
|
|
599
619
|
function asP_CommentToken(token) {
|
|
@@ -608,7 +628,7 @@ function isP_NumberToken(token) {
|
|
|
608
628
|
}
|
|
609
629
|
function assertP_NumberToken(token) {
|
|
610
630
|
if (!isP_NumberToken(token)) {
|
|
611
|
-
throwUnexpectedToken('P_Number', token);
|
|
631
|
+
throwUnexpectedToken('P_Number', undefined, token);
|
|
612
632
|
}
|
|
613
633
|
}
|
|
614
634
|
|
|
@@ -676,12 +696,6 @@ function valueToString(value) {
|
|
|
676
696
|
return JSON.stringify(value);
|
|
677
697
|
}
|
|
678
698
|
|
|
679
|
-
function getSourceCodeInfo(anyValue, sourceCodeInfo) {
|
|
680
|
-
var _a;
|
|
681
|
-
// eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access
|
|
682
|
-
return (_a = anyValue === null || anyValue === void 0 ? void 0 : anyValue.sourceCodeInfo) !== null && _a !== void 0 ? _a : sourceCodeInfo;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
699
|
function getAssertionError(typeName, value, sourceCodeInfo) {
|
|
686
700
|
return new LitsError("Expected ".concat(typeName, ", got ").concat(valueToString(value), "."), getSourceCodeInfo(value, sourceCodeInfo));
|
|
687
701
|
}
|
|
@@ -734,7 +748,7 @@ function isExpressionNode(value) {
|
|
|
734
748
|
}
|
|
735
749
|
|
|
736
750
|
var specialExpressionCommentRemovers = {
|
|
737
|
-
'
|
|
751
|
+
'&&': function (node, removeOptions) {
|
|
738
752
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
739
753
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
740
754
|
},
|
|
@@ -746,6 +760,10 @@ var specialExpressionCommentRemovers = {
|
|
|
746
760
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
747
761
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
748
762
|
},
|
|
763
|
+
'switch': function (node, removeOptions) {
|
|
764
|
+
removeOptions.removeCommenNodesFromArray(node.p);
|
|
765
|
+
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
766
|
+
},
|
|
749
767
|
'declared?': function (node, removeOptions) {
|
|
750
768
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
751
769
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
@@ -767,12 +785,12 @@ var specialExpressionCommentRemovers = {
|
|
|
767
785
|
'doseq': function (_node, _removeOptions) { },
|
|
768
786
|
'fn': function (_node, _removeOptions) { },
|
|
769
787
|
'for': function (_node, _removeOptions) { },
|
|
770
|
-
'
|
|
788
|
+
'if_let': function (_node, _removeOptions) { },
|
|
771
789
|
'if': function (node, removeOptions) {
|
|
772
790
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
773
791
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
774
792
|
},
|
|
775
|
-
'
|
|
793
|
+
'if_not': function (node, removeOptions) {
|
|
776
794
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
777
795
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
778
796
|
},
|
|
@@ -784,7 +802,7 @@ var specialExpressionCommentRemovers = {
|
|
|
784
802
|
});
|
|
785
803
|
},
|
|
786
804
|
'loop': function (_node, _removeOptions) { },
|
|
787
|
-
'
|
|
805
|
+
'||': function (node, removeOptions) {
|
|
788
806
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
789
807
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
790
808
|
},
|
|
@@ -796,19 +814,15 @@ var specialExpressionCommentRemovers = {
|
|
|
796
814
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
797
815
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
798
816
|
},
|
|
799
|
-
'time!': function (node, removeOptions) {
|
|
800
|
-
removeOptions.removeCommenNodesFromArray(node.p);
|
|
801
|
-
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
802
|
-
},
|
|
803
817
|
'throw': function (node, removeOptions) {
|
|
804
818
|
removeOptions.removeCommenNodesFromArray(node.p);
|
|
805
819
|
node.p.forEach(removeOptions.recursivelyRemoveCommentNodes);
|
|
806
820
|
},
|
|
807
821
|
'try': function (_node, _removeOptions) { },
|
|
808
|
-
'
|
|
809
|
-
'
|
|
822
|
+
'when_first': function (_node, _removeOptions) { },
|
|
823
|
+
'when_let': function (_node, _removeOptions) { },
|
|
810
824
|
'when': function (_node, _removeOptions) { },
|
|
811
|
-
'
|
|
825
|
+
'when_not': function (_node, _removeOptions) { },
|
|
812
826
|
};
|
|
813
827
|
function removeCommentNodesFromSpecialExpression(node, removeOptions) {
|
|
814
828
|
var uncommenter = specialExpressionCommentRemovers[node.n];
|
|
@@ -850,6 +864,13 @@ function assertEvenNumberOfParams(node) {
|
|
|
850
864
|
throw new LitsError("Wrong number of arguments, expected an even number, got ".concat(valueToString(length), "."), (_a = getTokenDebugData(node.token)) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
|
|
851
865
|
}
|
|
852
866
|
}
|
|
867
|
+
function assertOddNumberOfParams(node) {
|
|
868
|
+
var _a;
|
|
869
|
+
var length = withoutCommentNodes(node.p).length;
|
|
870
|
+
if (length % 2 !== 1) {
|
|
871
|
+
throw new LitsError("Wrong number of arguments, expected an odd number, got ".concat(valueToString(length), "."), (_a = getTokenDebugData(node.token)) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
853
874
|
function assertNumberOfParams(count, node) {
|
|
854
875
|
var _a, _b;
|
|
855
876
|
assertCount({
|
|
@@ -987,7 +1008,7 @@ function asNumber(value, sourceCodeInfo, options) {
|
|
|
987
1008
|
}
|
|
988
1009
|
|
|
989
1010
|
var bitwiseNormalExpression = {
|
|
990
|
-
'
|
|
1011
|
+
'<<': {
|
|
991
1012
|
evaluate: function (_a, sourceCodeInfo) {
|
|
992
1013
|
var _b = __read(_a, 2), num = _b[0], count = _b[1];
|
|
993
1014
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -996,7 +1017,7 @@ var bitwiseNormalExpression = {
|
|
|
996
1017
|
},
|
|
997
1018
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
998
1019
|
},
|
|
999
|
-
'
|
|
1020
|
+
'>>': {
|
|
1000
1021
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1001
1022
|
var _b = __read(_a, 2), num = _b[0], count = _b[1];
|
|
1002
1023
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1005,7 +1026,7 @@ var bitwiseNormalExpression = {
|
|
|
1005
1026
|
},
|
|
1006
1027
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1007
1028
|
},
|
|
1008
|
-
'
|
|
1029
|
+
'>>>': {
|
|
1009
1030
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1010
1031
|
var _b = __read(_a, 2), num = _b[0], count = _b[1];
|
|
1011
1032
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1014,7 +1035,7 @@ var bitwiseNormalExpression = {
|
|
|
1014
1035
|
},
|
|
1015
1036
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1016
1037
|
},
|
|
1017
|
-
'
|
|
1038
|
+
'~': {
|
|
1018
1039
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1019
1040
|
var _b = __read(_a, 1), num = _b[0];
|
|
1020
1041
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1022,7 +1043,7 @@ var bitwiseNormalExpression = {
|
|
|
1022
1043
|
},
|
|
1023
1044
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
1024
1045
|
},
|
|
1025
|
-
'
|
|
1046
|
+
'&': {
|
|
1026
1047
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1027
1048
|
var _b = __read(_a), first = _b[0], rest = _b.slice(1);
|
|
1028
1049
|
assertNumber(first, sourceCodeInfo, { integer: true });
|
|
@@ -1033,7 +1054,7 @@ var bitwiseNormalExpression = {
|
|
|
1033
1054
|
},
|
|
1034
1055
|
validate: function (node) { return assertNumberOfParams({ min: 2 }, node); },
|
|
1035
1056
|
},
|
|
1036
|
-
'
|
|
1057
|
+
'&!': {
|
|
1037
1058
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1038
1059
|
var _b = __read(_a), first = _b[0], rest = _b.slice(1);
|
|
1039
1060
|
assertNumber(first, sourceCodeInfo, { integer: true });
|
|
@@ -1044,7 +1065,7 @@ var bitwiseNormalExpression = {
|
|
|
1044
1065
|
},
|
|
1045
1066
|
validate: function (node) { return assertNumberOfParams({ min: 2 }, 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 bitwiseNormalExpression = {
|
|
|
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 bitwiseNormalExpression = {
|
|
|
1066
1087
|
},
|
|
1067
1088
|
validate: function (node) { return assertNumberOfParams({ min: 2 }, node); },
|
|
1068
1089
|
},
|
|
1069
|
-
'
|
|
1090
|
+
'bit_flip': {
|
|
1070
1091
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1071
1092
|
var _b = __read(_a, 2), num = _b[0], index = _b[1];
|
|
1072
1093
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1076,7 +1097,7 @@ var bitwiseNormalExpression = {
|
|
|
1076
1097
|
},
|
|
1077
1098
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1078
1099
|
},
|
|
1079
|
-
'
|
|
1100
|
+
'bit_set': {
|
|
1080
1101
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1081
1102
|
var _b = __read(_a, 2), num = _b[0], index = _b[1];
|
|
1082
1103
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1086,7 +1107,7 @@ var bitwiseNormalExpression = {
|
|
|
1086
1107
|
},
|
|
1087
1108
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1088
1109
|
},
|
|
1089
|
-
'
|
|
1110
|
+
'bit_clear': {
|
|
1090
1111
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1091
1112
|
var _b = __read(_a, 2), num = _b[0], index = _b[1];
|
|
1092
1113
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -1096,7 +1117,7 @@ var bitwiseNormalExpression = {
|
|
|
1096
1117
|
},
|
|
1097
1118
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
1098
1119
|
},
|
|
1099
|
-
'
|
|
1120
|
+
'bit_test': {
|
|
1100
1121
|
evaluate: function (_a, sourceCodeInfo) {
|
|
1101
1122
|
var _b = __read(_a, 2), num = _b[0], index = _b[1];
|
|
1102
1123
|
assertNumber(num, sourceCodeInfo, { integer: true });
|
|
@@ -2784,7 +2805,7 @@ var mathNormalExpression = {
|
|
|
2784
2805
|
},
|
|
2785
2806
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
2786
2807
|
},
|
|
2787
|
-
'
|
|
2808
|
+
'%': {
|
|
2788
2809
|
evaluate: function (_a, sourceCodeInfo) {
|
|
2789
2810
|
var _b = __read(_a, 2), dividend = _b[0], divisor = _b[1];
|
|
2790
2811
|
assertNumber(dividend, sourceCodeInfo);
|
|
@@ -2810,7 +2831,7 @@ var mathNormalExpression = {
|
|
|
2810
2831
|
},
|
|
2811
2832
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
2812
2833
|
},
|
|
2813
|
-
'
|
|
2834
|
+
'**': {
|
|
2814
2835
|
evaluate: function (_a, sourceCodeInfo) {
|
|
2815
2836
|
var _b = __read(_a, 2), first = _b[0], second = _b[1];
|
|
2816
2837
|
assertNumber(first, sourceCodeInfo);
|
|
@@ -3087,8 +3108,6 @@ var mathNormalExpression = {
|
|
|
3087
3108
|
},
|
|
3088
3109
|
};
|
|
3089
3110
|
|
|
3090
|
-
var uuidTemplate = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
|
|
3091
|
-
var xyRegexp = /[xy]/g;
|
|
3092
3111
|
var miscNormalExpression = {
|
|
3093
3112
|
'!=': {
|
|
3094
3113
|
evaluate: function (params) {
|
|
@@ -3102,7 +3121,7 @@ var miscNormalExpression = {
|
|
|
3102
3121
|
},
|
|
3103
3122
|
validate: function (node) { return assertNumberOfParams({ min: 1 }, node); },
|
|
3104
3123
|
},
|
|
3105
|
-
'
|
|
3124
|
+
'==': {
|
|
3106
3125
|
evaluate: function (_a) {
|
|
3107
3126
|
var e_1, _b;
|
|
3108
3127
|
var _c = __read(_a), first = _c[0], rest = _c.slice(1);
|
|
@@ -3227,20 +3246,14 @@ var miscNormalExpression = {
|
|
|
3227
3246
|
},
|
|
3228
3247
|
validate: function (node) { return assertNumberOfParams({ min: 1 }, node); },
|
|
3229
3248
|
},
|
|
3230
|
-
'
|
|
3249
|
+
'!': {
|
|
3231
3250
|
evaluate: function (_a) {
|
|
3232
3251
|
var _b = __read(_a, 1), first = _b[0];
|
|
3233
3252
|
return !first;
|
|
3234
3253
|
},
|
|
3235
3254
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3236
3255
|
},
|
|
3237
|
-
'
|
|
3238
|
-
evaluate: function () {
|
|
3239
|
-
return Date.now();
|
|
3240
|
-
},
|
|
3241
|
-
validate: function (node) { return assertNumberOfParams(0, node); },
|
|
3242
|
-
},
|
|
3243
|
-
'inst-ms->iso-date-time': {
|
|
3256
|
+
'epoch>iso_date': {
|
|
3244
3257
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3245
3258
|
var _b = __read(_a, 1), ms = _b[0];
|
|
3246
3259
|
assertNumber(ms, sourceCodeInfo);
|
|
@@ -3248,7 +3261,7 @@ var miscNormalExpression = {
|
|
|
3248
3261
|
},
|
|
3249
3262
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3250
3263
|
},
|
|
3251
|
-
'
|
|
3264
|
+
'iso_date>epoch': {
|
|
3252
3265
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3253
3266
|
var _b = __read(_a, 1), dateTime = _b[0];
|
|
3254
3267
|
assertString(dateTime, sourceCodeInfo);
|
|
@@ -3281,23 +3294,7 @@ var miscNormalExpression = {
|
|
|
3281
3294
|
},
|
|
3282
3295
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
3283
3296
|
},
|
|
3284
|
-
'
|
|
3285
|
-
evaluate: function () {
|
|
3286
|
-
return uuidTemplate.replace(xyRegexp, function (character) {
|
|
3287
|
-
var randomNbr = Math.floor(Math.random() * 16);
|
|
3288
|
-
var newValue = character === 'x' ? randomNbr : (randomNbr & 0x3) | 0x8;
|
|
3289
|
-
return newValue.toString(16);
|
|
3290
|
-
});
|
|
3291
|
-
},
|
|
3292
|
-
validate: function (node) { return assertNumberOfParams(0, node); },
|
|
3293
|
-
},
|
|
3294
|
-
'lits-version!': {
|
|
3295
|
-
evaluate: function () {
|
|
3296
|
-
return version;
|
|
3297
|
-
},
|
|
3298
|
-
validate: function (node) { return assertNumberOfParams(0, node); },
|
|
3299
|
-
},
|
|
3300
|
-
'json-parse': {
|
|
3297
|
+
'json_parse': {
|
|
3301
3298
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3302
3299
|
var _b = __read(_a, 1), first = _b[0];
|
|
3303
3300
|
assertString(first, sourceCodeInfo);
|
|
@@ -3306,7 +3303,7 @@ var miscNormalExpression = {
|
|
|
3306
3303
|
},
|
|
3307
3304
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3308
3305
|
},
|
|
3309
|
-
'
|
|
3306
|
+
'json_stringify': {
|
|
3310
3307
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3311
3308
|
var _b = __read(_a, 2), first = _b[0], second = _b[1];
|
|
3312
3309
|
assertAny(first, sourceCodeInfo);
|
|
@@ -3519,7 +3516,7 @@ var assertNormalExpression = {
|
|
|
3519
3516
|
};
|
|
3520
3517
|
|
|
3521
3518
|
var objectNormalExpression = {
|
|
3522
|
-
|
|
3519
|
+
object: {
|
|
3523
3520
|
evaluate: function (params, sourceCodeInfo) {
|
|
3524
3521
|
var result = {};
|
|
3525
3522
|
for (var i = 0; i < params.length; i += 2) {
|
|
@@ -3532,7 +3529,7 @@ var objectNormalExpression = {
|
|
|
3532
3529
|
},
|
|
3533
3530
|
validate: function (node) { return assertEvenNumberOfParams(node); },
|
|
3534
3531
|
},
|
|
3535
|
-
|
|
3532
|
+
keys: {
|
|
3536
3533
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3537
3534
|
var _b = __read(_a, 1), obj = _b[0];
|
|
3538
3535
|
assertObj(obj, sourceCodeInfo);
|
|
@@ -3540,7 +3537,7 @@ var objectNormalExpression = {
|
|
|
3540
3537
|
},
|
|
3541
3538
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3542
3539
|
},
|
|
3543
|
-
|
|
3540
|
+
vals: {
|
|
3544
3541
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3545
3542
|
var _b = __read(_a, 1), obj = _b[0];
|
|
3546
3543
|
assertObj(obj, sourceCodeInfo);
|
|
@@ -3548,7 +3545,7 @@ var objectNormalExpression = {
|
|
|
3548
3545
|
},
|
|
3549
3546
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3550
3547
|
},
|
|
3551
|
-
|
|
3548
|
+
entries: {
|
|
3552
3549
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3553
3550
|
var _b = __read(_a, 1), obj = _b[0];
|
|
3554
3551
|
assertObj(obj, sourceCodeInfo);
|
|
@@ -3556,7 +3553,7 @@ var objectNormalExpression = {
|
|
|
3556
3553
|
},
|
|
3557
3554
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3558
3555
|
},
|
|
3559
|
-
|
|
3556
|
+
find: {
|
|
3560
3557
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3561
3558
|
var _b = __read(_a, 2), obj = _b[0], key = _b[1];
|
|
3562
3559
|
assertObj(obj, sourceCodeInfo);
|
|
@@ -3567,7 +3564,7 @@ var objectNormalExpression = {
|
|
|
3567
3564
|
},
|
|
3568
3565
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
3569
3566
|
},
|
|
3570
|
-
|
|
3567
|
+
dissoc: {
|
|
3571
3568
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3572
3569
|
var _b = __read(_a, 2), obj = _b[0], key = _b[1];
|
|
3573
3570
|
assertObj(obj, sourceCodeInfo);
|
|
@@ -3578,7 +3575,7 @@ var objectNormalExpression = {
|
|
|
3578
3575
|
},
|
|
3579
3576
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
3580
3577
|
},
|
|
3581
|
-
|
|
3578
|
+
merge: {
|
|
3582
3579
|
evaluate: function (params, sourceCodeInfo) {
|
|
3583
3580
|
if (params.length === 0)
|
|
3584
3581
|
return null;
|
|
@@ -3591,7 +3588,7 @@ var objectNormalExpression = {
|
|
|
3591
3588
|
},
|
|
3592
3589
|
validate: function (node) { return assertNumberOfParams({ min: 0 }, node); },
|
|
3593
3590
|
},
|
|
3594
|
-
|
|
3591
|
+
merge_with: {
|
|
3595
3592
|
evaluate: function (params, sourceCodeInfo, contextStack, _a) {
|
|
3596
3593
|
var executeFunction = _a.executeFunction;
|
|
3597
3594
|
var first = params[0];
|
|
@@ -3614,7 +3611,7 @@ var objectNormalExpression = {
|
|
|
3614
3611
|
},
|
|
3615
3612
|
validate: function (node) { return assertNumberOfParams({ min: 2 }, node); },
|
|
3616
3613
|
},
|
|
3617
|
-
|
|
3614
|
+
zipmap: {
|
|
3618
3615
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3619
3616
|
var _b = __read(_a, 2), keys = _b[0], values = _b[1];
|
|
3620
3617
|
assertStringArray(keys, sourceCodeInfo);
|
|
@@ -3629,7 +3626,7 @@ var objectNormalExpression = {
|
|
|
3629
3626
|
},
|
|
3630
3627
|
validate: function (node) { return assertNumberOfParams(2, node); },
|
|
3631
3628
|
},
|
|
3632
|
-
|
|
3629
|
+
select_keys: {
|
|
3633
3630
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3634
3631
|
var _b = __read(_a, 2), obj = _b[0], keys = _b[1];
|
|
3635
3632
|
assertStringArray(keys, sourceCodeInfo);
|
|
@@ -3895,7 +3892,7 @@ var stringNormalExpression = {
|
|
|
3895
3892
|
},
|
|
3896
3893
|
validate: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
|
|
3897
3894
|
},
|
|
3898
|
-
'
|
|
3895
|
+
'string_repeat': {
|
|
3899
3896
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3900
3897
|
var _b = __read(_a, 2), str = _b[0], count = _b[1];
|
|
3901
3898
|
assertString(str, sourceCodeInfo);
|
|
@@ -3929,27 +3926,7 @@ var stringNormalExpression = {
|
|
|
3929
3926
|
},
|
|
3930
3927
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3931
3928
|
},
|
|
3932
|
-
'
|
|
3933
|
-
evaluate: function (params, sourceCodeInfo) {
|
|
3934
|
-
var _a = __read(params, 2), num = _a[0], base = _a[1];
|
|
3935
|
-
assertNumber(num, sourceCodeInfo, { finite: true });
|
|
3936
|
-
if (params.length === 1) {
|
|
3937
|
-
return "".concat(num);
|
|
3938
|
-
}
|
|
3939
|
-
else {
|
|
3940
|
-
assertNumber(base, sourceCodeInfo, { finite: true });
|
|
3941
|
-
if (base !== 2 && base !== 8 && base !== 10 && base !== 16) {
|
|
3942
|
-
throw new LitsError("Expected \"number-to-string\" base argument to be 2, 8, 10 or 16, got: ".concat(base), sourceCodeInfo);
|
|
3943
|
-
}
|
|
3944
|
-
if (base === 10)
|
|
3945
|
-
return "".concat(num);
|
|
3946
|
-
assertNumber(num, sourceCodeInfo, { integer: true, nonNegative: true });
|
|
3947
|
-
return Number(num).toString(base);
|
|
3948
|
-
}
|
|
3949
|
-
},
|
|
3950
|
-
validate: function (node) { return assertNumberOfParams({ min: 1, max: 2 }, node); },
|
|
3951
|
-
},
|
|
3952
|
-
'from-char-code': {
|
|
3929
|
+
'from_char_code': {
|
|
3953
3930
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3954
3931
|
var _b = __read(_a, 1), num = _b[0];
|
|
3955
3932
|
assertNumber(num, sourceCodeInfo, { finite: true });
|
|
@@ -3963,7 +3940,7 @@ var stringNormalExpression = {
|
|
|
3963
3940
|
},
|
|
3964
3941
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3965
3942
|
},
|
|
3966
|
-
'
|
|
3943
|
+
'to_char_code': {
|
|
3967
3944
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3968
3945
|
var _b = __read(_a, 1), str = _b[0];
|
|
3969
3946
|
assertString(str, sourceCodeInfo, { nonEmpty: true });
|
|
@@ -3971,7 +3948,7 @@ var stringNormalExpression = {
|
|
|
3971
3948
|
},
|
|
3972
3949
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3973
3950
|
},
|
|
3974
|
-
'
|
|
3951
|
+
'lower_case': {
|
|
3975
3952
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3976
3953
|
var _b = __read(_a, 1), str = _b[0];
|
|
3977
3954
|
assertString(str, sourceCodeInfo);
|
|
@@ -3979,7 +3956,7 @@ var stringNormalExpression = {
|
|
|
3979
3956
|
},
|
|
3980
3957
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3981
3958
|
},
|
|
3982
|
-
'
|
|
3959
|
+
'upper_case': {
|
|
3983
3960
|
evaluate: function (_a, sourceCodeInfo) {
|
|
3984
3961
|
var _b = __read(_a, 1), str = _b[0];
|
|
3985
3962
|
assertString(str, sourceCodeInfo);
|
|
@@ -3995,7 +3972,7 @@ var stringNormalExpression = {
|
|
|
3995
3972
|
},
|
|
3996
3973
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
3997
3974
|
},
|
|
3998
|
-
'
|
|
3975
|
+
'trim_left': {
|
|
3999
3976
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4000
3977
|
var _b = __read(_a, 1), str = _b[0];
|
|
4001
3978
|
assertString(str, sourceCodeInfo);
|
|
@@ -4003,7 +3980,7 @@ var stringNormalExpression = {
|
|
|
4003
3980
|
},
|
|
4004
3981
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4005
3982
|
},
|
|
4006
|
-
'
|
|
3983
|
+
'trim_right': {
|
|
4007
3984
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4008
3985
|
var _b = __read(_a, 1), str = _b[0];
|
|
4009
3986
|
assertString(str, sourceCodeInfo);
|
|
@@ -4011,6 +3988,30 @@ var stringNormalExpression = {
|
|
|
4011
3988
|
},
|
|
4012
3989
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4013
3990
|
},
|
|
3991
|
+
'++': {
|
|
3992
|
+
evaluate: function (params, sourceCodeInfo) {
|
|
3993
|
+
if (params.length === 0) {
|
|
3994
|
+
return '';
|
|
3995
|
+
}
|
|
3996
|
+
var first = params[0];
|
|
3997
|
+
if (first !== null) {
|
|
3998
|
+
assertStringOrNumber(first, sourceCodeInfo);
|
|
3999
|
+
}
|
|
4000
|
+
if (params.length === 1) {
|
|
4001
|
+
return first === null ? '' : "".concat(first);
|
|
4002
|
+
}
|
|
4003
|
+
return params.slice(1).reduce(function (acc, str) {
|
|
4004
|
+
if (str !== null) {
|
|
4005
|
+
assertStringOrNumber(str, sourceCodeInfo);
|
|
4006
|
+
}
|
|
4007
|
+
if (str === null) {
|
|
4008
|
+
return acc;
|
|
4009
|
+
}
|
|
4010
|
+
return "".concat(acc).concat(str);
|
|
4011
|
+
}, first === null ? '' : "".concat(first));
|
|
4012
|
+
},
|
|
4013
|
+
validate: function () { return undefined; },
|
|
4014
|
+
},
|
|
4014
4015
|
'join': {
|
|
4015
4016
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4016
4017
|
var _b = __read(_a, 2), stringList = _b[0], delimiter = _b[1];
|
|
@@ -4035,7 +4036,7 @@ var stringNormalExpression = {
|
|
|
4035
4036
|
},
|
|
4036
4037
|
validate: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
|
|
4037
4038
|
},
|
|
4038
|
-
'
|
|
4039
|
+
'pad_left': {
|
|
4039
4040
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4040
4041
|
var _b = __read(_a, 3), str = _b[0], length = _b[1], padString = _b[2];
|
|
4041
4042
|
assertString(str, sourceCodeInfo);
|
|
@@ -4046,7 +4047,7 @@ var stringNormalExpression = {
|
|
|
4046
4047
|
},
|
|
4047
4048
|
validate: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
|
|
4048
4049
|
},
|
|
4049
|
-
'
|
|
4050
|
+
'pad_right': {
|
|
4050
4051
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4051
4052
|
var _b = __read(_a, 3), str = _b[0], length = _b[1], padString = _b[2];
|
|
4052
4053
|
assertString(str, sourceCodeInfo);
|
|
@@ -4088,7 +4089,7 @@ var stringNormalExpression = {
|
|
|
4088
4089
|
},
|
|
4089
4090
|
validate: function (node) { return assertNumberOfParams({ min: 1, max: 10 }, node); },
|
|
4090
4091
|
},
|
|
4091
|
-
'
|
|
4092
|
+
'encode_base64': {
|
|
4092
4093
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4093
4094
|
var _b = __read(_a, 1), value = _b[0];
|
|
4094
4095
|
assertString(value, sourceCodeInfo);
|
|
@@ -4099,7 +4100,7 @@ var stringNormalExpression = {
|
|
|
4099
4100
|
},
|
|
4100
4101
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4101
4102
|
},
|
|
4102
|
-
'
|
|
4103
|
+
'decode_base64': {
|
|
4103
4104
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4104
4105
|
var _b = __read(_a, 1), value = _b[0];
|
|
4105
4106
|
assertString(value, sourceCodeInfo);
|
|
@@ -4117,7 +4118,7 @@ var stringNormalExpression = {
|
|
|
4117
4118
|
},
|
|
4118
4119
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4119
4120
|
},
|
|
4120
|
-
'
|
|
4121
|
+
'encode_uri_component': {
|
|
4121
4122
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4122
4123
|
var _b = __read(_a, 1), value = _b[0];
|
|
4123
4124
|
assertString(value, sourceCodeInfo);
|
|
@@ -4125,7 +4126,7 @@ var stringNormalExpression = {
|
|
|
4125
4126
|
},
|
|
4126
4127
|
validate: function (node) { return assertNumberOfParams(1, node); },
|
|
4127
4128
|
},
|
|
4128
|
-
'
|
|
4129
|
+
'decode_uri_component': {
|
|
4129
4130
|
evaluate: function (_a, sourceCodeInfo) {
|
|
4130
4131
|
var _b = __read(_a, 1), value = _b[0];
|
|
4131
4132
|
assertString(value, sourceCodeInfo);
|
|
@@ -4294,7 +4295,7 @@ var andSpecialExpression = {
|
|
|
4294
4295
|
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
4295
4296
|
var node = {
|
|
4296
4297
|
t: AstNodeType.SpecialExpression,
|
|
4297
|
-
n: '
|
|
4298
|
+
n: '&&',
|
|
4298
4299
|
p: params,
|
|
4299
4300
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
4300
4301
|
};
|
|
@@ -4379,6 +4380,37 @@ var condSpecialExpression = {
|
|
|
4379
4380
|
},
|
|
4380
4381
|
};
|
|
4381
4382
|
|
|
4383
|
+
var switchSpecialExpression = {
|
|
4384
|
+
polishParse: getCommonPolishSpecialExpressionParser('switch'),
|
|
4385
|
+
validateParameterCount: function (node) { return assertOddNumberOfParams(node); },
|
|
4386
|
+
evaluate: function (node, contextStack, _a) {
|
|
4387
|
+
var e_1, _b;
|
|
4388
|
+
var evaluateAstNode = _a.evaluateAstNode;
|
|
4389
|
+
var switchValue = evaluateAstNode(node.p[0], contextStack);
|
|
4390
|
+
try {
|
|
4391
|
+
for (var _c = __values(arrayToPairs(node.p.slice(1))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
4392
|
+
var _e = __read(_d.value, 2), test = _e[0], form = _e[1];
|
|
4393
|
+
var value = evaluateAstNode(test, contextStack);
|
|
4394
|
+
if (value === switchValue) {
|
|
4395
|
+
return evaluateAstNode(form, contextStack);
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4398
|
+
}
|
|
4399
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
4400
|
+
finally {
|
|
4401
|
+
try {
|
|
4402
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
4403
|
+
}
|
|
4404
|
+
finally { if (e_1) throw e_1.error; }
|
|
4405
|
+
}
|
|
4406
|
+
return null;
|
|
4407
|
+
},
|
|
4408
|
+
findUnresolvedIdentifiers: function (node, contextStack, _a) {
|
|
4409
|
+
var findUnresolvedIdentifiers = _a.findUnresolvedIdentifiers, builtin = _a.builtin;
|
|
4410
|
+
return findUnresolvedIdentifiers(node.p, contextStack, builtin);
|
|
4411
|
+
},
|
|
4412
|
+
};
|
|
4413
|
+
|
|
4382
4414
|
var declaredSpecialExpression = {
|
|
4383
4415
|
polishParse: getCommonPolishSpecialExpressionParser('declared?'),
|
|
4384
4416
|
validateParameterCount: function (node) { return assertNumberOfParams(1, node); },
|
|
@@ -4851,7 +4883,7 @@ function parseFunctionArguments(tokenStream, parseState, parsers) {
|
|
|
4851
4883
|
tkn = asToken(tokenStream.tokens[parseState.position]);
|
|
4852
4884
|
if (node.t === AstNodeType.Modifier) {
|
|
4853
4885
|
switch (node.v) {
|
|
4854
|
-
case '&':
|
|
4886
|
+
case '&rest':
|
|
4855
4887
|
if (state === 'rest')
|
|
4856
4888
|
throw new LitsError('& can only appear once', (_a = getTokenDebugData(tkn)) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
|
|
4857
4889
|
state = 'rest';
|
|
@@ -4926,7 +4958,7 @@ var ifLetSpecialExpression = {
|
|
|
4926
4958
|
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
4927
4959
|
var node = {
|
|
4928
4960
|
t: AstNodeType.SpecialExpression,
|
|
4929
|
-
n: '
|
|
4961
|
+
n: 'if_let',
|
|
4930
4962
|
b: asNonUndefined(bindings[0], (_c = getTokenDebugData(firstToken)) === null || _c === void 0 ? void 0 : _c.sourceCodeInfo),
|
|
4931
4963
|
p: params,
|
|
4932
4964
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
@@ -4963,7 +4995,7 @@ var ifLetSpecialExpression = {
|
|
|
4963
4995
|
};
|
|
4964
4996
|
|
|
4965
4997
|
var ifNotSpecialExpression = {
|
|
4966
|
-
polishParse: getCommonPolishSpecialExpressionParser('
|
|
4998
|
+
polishParse: getCommonPolishSpecialExpressionParser('if_not'),
|
|
4967
4999
|
validateParameterCount: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
|
|
4968
5000
|
evaluate: function (node, contextStack, _a) {
|
|
4969
5001
|
var _b;
|
|
@@ -5173,7 +5205,7 @@ function parseLoopBinding(tokenStream, parseState, _a) {
|
|
|
5173
5205
|
loopBinding.we = parseToken(tokenStream, parseState);
|
|
5174
5206
|
loopBinding.m.push('&while');
|
|
5175
5207
|
break;
|
|
5176
|
-
case '&':
|
|
5208
|
+
case '&rest':
|
|
5177
5209
|
throw new LitsError("Illegal modifier: ".concat(modifier), (_e = getTokenDebugData(tkn)) === null || _e === void 0 ? void 0 : _e.sourceCodeInfo);
|
|
5178
5210
|
default:
|
|
5179
5211
|
throw new LitsError("Illegal modifier: ".concat(modifier), (_f = getTokenDebugData(tkn)) === null || _f === void 0 ? void 0 : _f.sourceCodeInfo);
|
|
@@ -5373,7 +5405,7 @@ var doseqSpecialExpression = {
|
|
|
5373
5405
|
};
|
|
5374
5406
|
|
|
5375
5407
|
var orSpecialExpression = {
|
|
5376
|
-
polishParse: getCommonPolishSpecialExpressionParser('
|
|
5408
|
+
polishParse: getCommonPolishSpecialExpressionParser('||'),
|
|
5377
5409
|
validateParameterCount: function () { return undefined; },
|
|
5378
5410
|
evaluate: function (node, contextStack, _a) {
|
|
5379
5411
|
var e_1, _b;
|
|
@@ -5465,25 +5497,6 @@ var throwSpecialExpression = {
|
|
|
5465
5497
|
},
|
|
5466
5498
|
};
|
|
5467
5499
|
|
|
5468
|
-
var timeSpecialExpression = {
|
|
5469
|
-
polishParse: getCommonPolishSpecialExpressionParser('time!'),
|
|
5470
|
-
validateParameterCount: function (node) { return assertNumberOfParams(1, node); },
|
|
5471
|
-
evaluate: function (node, contextStack, _a) {
|
|
5472
|
-
var evaluateAstNode = _a.evaluateAstNode;
|
|
5473
|
-
var param = node.p[0];
|
|
5474
|
-
var startTime = Date.now();
|
|
5475
|
-
var result = evaluateAstNode(param, contextStack);
|
|
5476
|
-
var totalTime = Date.now() - startTime;
|
|
5477
|
-
// eslint-disable-next-line no-console
|
|
5478
|
-
console.log("Elapsed time: ".concat(totalTime, " ms"));
|
|
5479
|
-
return result;
|
|
5480
|
-
},
|
|
5481
|
-
findUnresolvedIdentifiers: function (node, contextStack, _a) {
|
|
5482
|
-
var findUnresolvedIdentifiers = _a.findUnresolvedIdentifiers, builtin = _a.builtin;
|
|
5483
|
-
return findUnresolvedIdentifiers(node.p, contextStack, builtin);
|
|
5484
|
-
},
|
|
5485
|
-
};
|
|
5486
|
-
|
|
5487
5500
|
var trySpecialExpression = {
|
|
5488
5501
|
polishParse: function (tokenStream, parseState, firstToken, _a) {
|
|
5489
5502
|
var _b, _c, _d;
|
|
@@ -5584,7 +5597,7 @@ var whenFirstSpecialExpression = {
|
|
|
5584
5597
|
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
5585
5598
|
var node = {
|
|
5586
5599
|
t: AstNodeType.SpecialExpression,
|
|
5587
|
-
n: '
|
|
5600
|
+
n: 'when_first',
|
|
5588
5601
|
b: asNonUndefined(bindings[0], (_c = getTokenDebugData(firstToken)) === null || _c === void 0 ? void 0 : _c.sourceCodeInfo),
|
|
5589
5602
|
p: params,
|
|
5590
5603
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
@@ -5646,7 +5659,7 @@ var whenLetSpecialExpression = {
|
|
|
5646
5659
|
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
5647
5660
|
var node = {
|
|
5648
5661
|
t: AstNodeType.SpecialExpression,
|
|
5649
|
-
n: '
|
|
5662
|
+
n: 'when_let',
|
|
5650
5663
|
b: asNonUndefined(bindings[0], (_c = getTokenDebugData(firstToken)) === null || _c === void 0 ? void 0 : _c.sourceCodeInfo),
|
|
5651
5664
|
p: params,
|
|
5652
5665
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
@@ -5692,7 +5705,7 @@ var whenLetSpecialExpression = {
|
|
|
5692
5705
|
};
|
|
5693
5706
|
|
|
5694
5707
|
var whenNotSpecialExpression = {
|
|
5695
|
-
polishParse: getCommonPolishSpecialExpressionParser('
|
|
5708
|
+
polishParse: getCommonPolishSpecialExpressionParser('when_not'),
|
|
5696
5709
|
validateParameterCount: function (node) { return assertNumberOfParams({ min: 1 }, node); },
|
|
5697
5710
|
evaluate: function (node, contextStack, _a) {
|
|
5698
5711
|
var e_1, _b;
|
|
@@ -5725,9 +5738,10 @@ var whenNotSpecialExpression = {
|
|
|
5725
5738
|
};
|
|
5726
5739
|
|
|
5727
5740
|
var specialExpressions = {
|
|
5728
|
-
'
|
|
5741
|
+
'&&': andSpecialExpression,
|
|
5729
5742
|
'comment': commentSpecialExpression,
|
|
5730
5743
|
'cond': condSpecialExpression,
|
|
5744
|
+
'switch': switchSpecialExpression,
|
|
5731
5745
|
'def': defSpecialExpression,
|
|
5732
5746
|
'defn': defnSpecialExpression,
|
|
5733
5747
|
'defns': defnsSpecialExpression,
|
|
@@ -5737,19 +5751,18 @@ var specialExpressions = {
|
|
|
5737
5751
|
'for': forSpecialExpression,
|
|
5738
5752
|
'fn': fnSpecialExpression,
|
|
5739
5753
|
'if': ifSpecialExpression,
|
|
5740
|
-
'
|
|
5741
|
-
'
|
|
5754
|
+
'if_let': ifLetSpecialExpression,
|
|
5755
|
+
'if_not': ifNotSpecialExpression,
|
|
5742
5756
|
'let': letSpecialExpression,
|
|
5743
5757
|
'loop': loopSpecialExpression,
|
|
5744
|
-
'
|
|
5758
|
+
'||': orSpecialExpression,
|
|
5745
5759
|
'recur': recurSpecialExpression,
|
|
5746
5760
|
'throw': throwSpecialExpression,
|
|
5747
|
-
'time!': timeSpecialExpression,
|
|
5748
5761
|
'try': trySpecialExpression,
|
|
5749
5762
|
'when': whenSpecialExpression,
|
|
5750
|
-
'
|
|
5751
|
-
'
|
|
5752
|
-
'
|
|
5763
|
+
'when_first': whenFirstSpecialExpression,
|
|
5764
|
+
'when_let': whenLetSpecialExpression,
|
|
5765
|
+
'when_not': whenNotSpecialExpression,
|
|
5753
5766
|
'declared?': declaredSpecialExpression,
|
|
5754
5767
|
'??': qqSpecialExpression,
|
|
5755
5768
|
};
|
|
@@ -6306,7 +6319,7 @@ var calculateAndOutcomes = function (_a) {
|
|
|
6306
6319
|
var astNode = _a.astNode, combinateAstNodes = _a.combinateAstNodes;
|
|
6307
6320
|
return combinateAstNodes(astNode.p)
|
|
6308
6321
|
.map(function (p) { return ({
|
|
6309
|
-
n: '
|
|
6322
|
+
n: '&&',
|
|
6310
6323
|
t: AstNodeType.SpecialExpression,
|
|
6311
6324
|
p: p,
|
|
6312
6325
|
token: astNode.token,
|
|
@@ -6428,7 +6441,7 @@ var calculateIfNotOutcomes = function (_a) {
|
|
|
6428
6441
|
if (isAstComputable(condition)) {
|
|
6429
6442
|
return combinateAstNodes(astNode.p)
|
|
6430
6443
|
.map(function (p) { return ({
|
|
6431
|
-
n: '
|
|
6444
|
+
n: 'if_not',
|
|
6432
6445
|
t: astNode.t,
|
|
6433
6446
|
p: p,
|
|
6434
6447
|
token: astNode.token,
|
|
@@ -6541,7 +6554,7 @@ var calculateOrOutcomes = function (_a) {
|
|
|
6541
6554
|
var astNode = _a.astNode, combinateAstNodes = _a.combinateAstNodes;
|
|
6542
6555
|
return combinateAstNodes(astNode.p)
|
|
6543
6556
|
.map(function (p) { return ({
|
|
6544
|
-
n: '
|
|
6557
|
+
n: '||',
|
|
6545
6558
|
t: AstNodeType.SpecialExpression,
|
|
6546
6559
|
p: p,
|
|
6547
6560
|
token: astNode.token,
|
|
@@ -6561,12 +6574,6 @@ var calculateThrowOutcomes = function (_a) {
|
|
|
6561
6574
|
return calculatePossibleAstNodes(astNode.p[0]).map(function (m) { return (__assign(__assign({}, astNode), { p: [m] })); });
|
|
6562
6575
|
};
|
|
6563
6576
|
|
|
6564
|
-
var calculateTimeOutcomes = function (_a) {
|
|
6565
|
-
var astNode = _a.astNode, calculatePossibleAstNodes = _a.calculatePossibleAstNodes;
|
|
6566
|
-
return calculatePossibleAstNodes(astNode.p[0])
|
|
6567
|
-
.map(function (p) { return (__assign(__assign({}, astNode), { n: 'do', p: [p] })); });
|
|
6568
|
-
};
|
|
6569
|
-
|
|
6570
6577
|
var calculateTryOutcomes = function (_a) {
|
|
6571
6578
|
var astNode = _a.astNode, calculatePossibleAstNodes = _a.calculatePossibleAstNodes;
|
|
6572
6579
|
var _b = calculatePossibleAstNodes(astNode.p[0]).reduce(function (acc, node) {
|
|
@@ -6640,7 +6647,7 @@ var calculateWhenNotOutcomes = function (_a) {
|
|
|
6640
6647
|
if (isAstComputable(condition)) {
|
|
6641
6648
|
return combinateAstNodes(astNode.p)
|
|
6642
6649
|
.map(function (p) { return ({
|
|
6643
|
-
n: '
|
|
6650
|
+
n: 'when_not',
|
|
6644
6651
|
t: astNode.t,
|
|
6645
6652
|
p: p,
|
|
6646
6653
|
token: astNode.token,
|
|
@@ -6699,10 +6706,22 @@ var calculateLoopOutcomes = function (_a) {
|
|
|
6699
6706
|
.map(function (p) { return (__assign(__assign({}, astNode), { p: p })); });
|
|
6700
6707
|
};
|
|
6701
6708
|
|
|
6709
|
+
var calculateSwitchOutcomes = function (_a) {
|
|
6710
|
+
var astNode = _a.astNode, nilNode = _a.nilNode, calculatePossibleAstNodes = _a.calculatePossibleAstNodes;
|
|
6711
|
+
// TODO be smarter about this
|
|
6712
|
+
return __spreadArray(__spreadArray([], __read(arrayToPairs(astNode.p.slice(1)).flatMap(function (_a) {
|
|
6713
|
+
var _b = __read(_a, 2); _b[0]; var form = _b[1];
|
|
6714
|
+
return calculatePossibleAstNodes(form);
|
|
6715
|
+
})), false), [
|
|
6716
|
+
nilNode,
|
|
6717
|
+
], false);
|
|
6718
|
+
};
|
|
6719
|
+
|
|
6702
6720
|
var specialExpressionCalculator = {
|
|
6703
|
-
'
|
|
6721
|
+
'&&': function (astNode, helperOptions) { return calculateAndOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6704
6722
|
'comment': function (astNode, helperOptions) { return calculateCommentOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6705
6723
|
'cond': function (astNode, helperOptions) { return calculateCondOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6724
|
+
'switch': function (astNode, helperOptions) { return calculateSwitchOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6706
6725
|
'declared?': function (astNode, helperOptions) { return calculateDeclaredOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6707
6726
|
'defn': function (astNode, helperOptions) { return calculateDefnOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6708
6727
|
'def': function (astNode, helperOptions) { return calculateDefOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
@@ -6712,27 +6731,22 @@ var specialExpressionCalculator = {
|
|
|
6712
6731
|
'doseq': function (astNode, helperOptions) { return calculateDoSeqOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6713
6732
|
'fn': function (astNode, helperOptions) { return calculateFnOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6714
6733
|
'for': function (astNode, helperOptions) { return calculateForOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6715
|
-
'
|
|
6734
|
+
'if_let': function (astNode, helperOptions) { return calculateIfLetOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6716
6735
|
'if': function (astNode, helperOptions) { return calculateIfOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6717
|
-
'
|
|
6736
|
+
'if_not': function (astNode, helperOptions) { return calculateIfNotOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6718
6737
|
'let': function (astNode, helperOptions) { return calculateLetOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6719
6738
|
'loop': function (astNode, helperOptions) { return calculateLoopOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6720
|
-
'
|
|
6739
|
+
'||': function (astNode, helperOptions) { return calculateOrOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6721
6740
|
'??': function (astNode, helperOptions) { return calculateQqOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6722
6741
|
'recur': function (astNode, helperOptions) { return calculateRecurOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6723
|
-
'time!': function (astNode, helperOptions) { return calculateTimeOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6724
6742
|
'throw': function (astNode, helperOptions) { return calculateThrowOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6725
6743
|
'try': function (astNode, helperOptions) { return calculateTryOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6726
|
-
'
|
|
6727
|
-
'
|
|
6744
|
+
'when_first': function (astNode, helperOptions) { return calculateWhenFirstOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6745
|
+
'when_let': function (astNode, helperOptions) { return calculateWhenLetOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6728
6746
|
'when': function (astNode, helperOptions) { return calculateWhenOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6729
|
-
'
|
|
6747
|
+
'when_not': function (astNode, helperOptions) { return calculateWhenNotOutcomes(__assign({ astNode: astNode }, helperOptions)); },
|
|
6730
6748
|
};
|
|
6731
6749
|
|
|
6732
|
-
function isIdempotent(normalExpressionName) {
|
|
6733
|
-
return !normalExpressionName.endsWith('!')
|
|
6734
|
-
|| normalExpressionName === 'write!';
|
|
6735
|
-
}
|
|
6736
6750
|
function calculateOutcomes(contextStack, astNodes) {
|
|
6737
6751
|
// First, we try to calculate outcomes for the whole astNodes array.
|
|
6738
6752
|
// If that fails, we try to calculate outcomes for the array without the first element.
|
|
@@ -6807,8 +6821,6 @@ function calculatePossibleAstNodes(contextStack, astNode, newIndentifiers) {
|
|
|
6807
6821
|
: undefined;
|
|
6808
6822
|
var newContextStack = newContext ? contextStack.create(newContext) : contextStack;
|
|
6809
6823
|
if (astNode.t === AstNodeType.NormalExpression) {
|
|
6810
|
-
if (astNode.n && !isIdempotent(astNode.n))
|
|
6811
|
-
throw new Error("NormalExpressionNode with name ".concat(astNode.n, " is not idempotent. Cannot calculate possible ASTs."));
|
|
6812
6824
|
return combinate(astNode.p.map(function (n) { return calculatePossibleAstNodes(newContextStack, n); }))
|
|
6813
6825
|
.map(function (p) { return (__assign(__assign({}, astNode), { p: p })); });
|
|
6814
6826
|
}
|
|
@@ -7035,13 +7047,10 @@ function fromUnaryAlgebraicToAstNode(operator, operand) {
|
|
|
7035
7047
|
var operatorName = operator[1];
|
|
7036
7048
|
switch (operatorName) {
|
|
7037
7049
|
case '+':
|
|
7038
|
-
return createNamedNormalExpressionNode('+', [operand], token);
|
|
7039
7050
|
case '-':
|
|
7040
|
-
return createNamedNormalExpressionNode('-', [operand], token);
|
|
7041
7051
|
case '!':
|
|
7042
|
-
return createNamedNormalExpressionNode('not', [operand], token);
|
|
7043
7052
|
case '~':
|
|
7044
|
-
return createNamedNormalExpressionNode(
|
|
7053
|
+
return createNamedNormalExpressionNode(operatorName, [operand], token);
|
|
7045
7054
|
/* v8 ignore next 2 */
|
|
7046
7055
|
default:
|
|
7047
7056
|
throw new Error("Unknown operator: ".concat(operatorName));
|
|
@@ -7054,68 +7063,36 @@ function fromBinaryOperatorToAstNode(operator, left, right, token) {
|
|
|
7054
7063
|
case '.':
|
|
7055
7064
|
return createAccessorNode(left, fromSymbolToStringNode(asSymbolNode(right, (_a = getTokenDebugData(token)) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo)), token);
|
|
7056
7065
|
case '**': // exponentiation
|
|
7057
|
-
return createNamedNormalExpressionNode('pow', [left, right], token);
|
|
7058
7066
|
case '*':
|
|
7059
|
-
return createNamedNormalExpressionNode('*', [left, right], token);
|
|
7060
7067
|
case '/':
|
|
7061
|
-
return createNamedNormalExpressionNode('/', [left, right], token);
|
|
7062
7068
|
case '%':
|
|
7063
|
-
return createNamedNormalExpressionNode('rem', [left, right], token);
|
|
7064
7069
|
case '+':
|
|
7065
|
-
return createNamedNormalExpressionNode('+', [left, right], token);
|
|
7066
7070
|
case '-':
|
|
7067
|
-
return createNamedNormalExpressionNode('-', [left, right], token);
|
|
7068
7071
|
case '<<':
|
|
7069
|
-
return createNamedNormalExpressionNode('bit-shift-left', [left, right], token);
|
|
7070
7072
|
case '>>':
|
|
7071
|
-
return createNamedNormalExpressionNode('bit-shift-right', [left, right], token);
|
|
7072
7073
|
case '>>>':
|
|
7073
|
-
|
|
7074
|
-
case '++': {
|
|
7075
|
-
var leftString = createNamedNormalExpressionNode('str', [left], token);
|
|
7076
|
-
var rightString = createNamedNormalExpressionNode('str', [right], token);
|
|
7077
|
-
return createNamedNormalExpressionNode('str', [leftString, rightString], token);
|
|
7078
|
-
}
|
|
7074
|
+
case '++':
|
|
7079
7075
|
case '<':
|
|
7080
|
-
return createNamedNormalExpressionNode('<', [left, right], token);
|
|
7081
7076
|
case '<=':
|
|
7082
|
-
return createNamedNormalExpressionNode('<=', [left, right], token);
|
|
7083
7077
|
case '>':
|
|
7084
|
-
return createNamedNormalExpressionNode('>', [left, right], token);
|
|
7085
7078
|
case '>=':
|
|
7086
|
-
return createNamedNormalExpressionNode('>=', [left, right], token);
|
|
7087
7079
|
case '==':
|
|
7088
|
-
return createNamedNormalExpressionNode('=', [left, right], token);
|
|
7089
7080
|
case '!=':
|
|
7090
|
-
return createNamedNormalExpressionNode('!=', [left, right], token);
|
|
7091
7081
|
case '&':
|
|
7092
|
-
return createNamedNormalExpressionNode('bit-and', [left, right], token);
|
|
7093
7082
|
case '^':
|
|
7094
|
-
return createNamedNormalExpressionNode('bit-xor', [left, right], token);
|
|
7095
7083
|
case '|':
|
|
7096
|
-
return createNamedNormalExpressionNode(
|
|
7084
|
+
return createNamedNormalExpressionNode(operatorName, [left, right], token);
|
|
7097
7085
|
case '&&':
|
|
7098
|
-
return {
|
|
7099
|
-
t: AstNodeType.SpecialExpression,
|
|
7100
|
-
n: 'and',
|
|
7101
|
-
p: [left, right],
|
|
7102
|
-
token: getTokenDebugData(token) && token,
|
|
7103
|
-
};
|
|
7104
7086
|
case '||':
|
|
7105
|
-
return {
|
|
7106
|
-
t: AstNodeType.SpecialExpression,
|
|
7107
|
-
n: 'or',
|
|
7108
|
-
p: [left, right],
|
|
7109
|
-
token: getTokenDebugData(token) && token,
|
|
7110
|
-
};
|
|
7111
7087
|
case '??':
|
|
7112
7088
|
return {
|
|
7113
7089
|
t: AstNodeType.SpecialExpression,
|
|
7114
|
-
n:
|
|
7090
|
+
n: operatorName,
|
|
7115
7091
|
p: [left, right],
|
|
7116
7092
|
token: getTokenDebugData(token) && token,
|
|
7117
7093
|
};
|
|
7118
7094
|
/* v8 ignore next 8 */
|
|
7095
|
+
case ';':
|
|
7119
7096
|
case '!':
|
|
7120
7097
|
case '~':
|
|
7121
7098
|
case '=':
|
|
@@ -7136,14 +7113,52 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7136
7113
|
this.parseState.position += 1;
|
|
7137
7114
|
};
|
|
7138
7115
|
AlgebraicParser.prototype.parse = function () {
|
|
7139
|
-
|
|
7116
|
+
var nodes = [];
|
|
7117
|
+
while (!this.isAtEnd()) {
|
|
7118
|
+
nodes.push(this.parseExpression());
|
|
7119
|
+
if (!isA_OperatorToken(this.peek(), ';')) {
|
|
7120
|
+
break;
|
|
7121
|
+
}
|
|
7122
|
+
this.advance();
|
|
7123
|
+
}
|
|
7124
|
+
return nodes;
|
|
7140
7125
|
};
|
|
7141
7126
|
AlgebraicParser.prototype.parseExpression = function (precedence) {
|
|
7142
7127
|
var _a;
|
|
7143
7128
|
if (precedence === void 0) { precedence = 0; }
|
|
7144
|
-
var
|
|
7145
|
-
|
|
7146
|
-
|
|
7129
|
+
var firstToken = this.peek();
|
|
7130
|
+
if (isA_SymbolToken(firstToken) && firstToken[1] === 'def') {
|
|
7131
|
+
return this.parseDef(firstToken);
|
|
7132
|
+
}
|
|
7133
|
+
else if (isA_SymbolToken(firstToken) && firstToken[1] === 'defn') {
|
|
7134
|
+
return this.parseDefn(firstToken);
|
|
7135
|
+
}
|
|
7136
|
+
var left;
|
|
7137
|
+
if (isA_SymbolToken(firstToken) && firstToken[1] === 'if') {
|
|
7138
|
+
left = this.parseIf(firstToken);
|
|
7139
|
+
}
|
|
7140
|
+
else if (isA_SymbolToken(firstToken) && firstToken[1] === 'cond') {
|
|
7141
|
+
left = this.parseCond(firstToken);
|
|
7142
|
+
}
|
|
7143
|
+
else if (isA_SymbolToken(firstToken) && firstToken[1] === 'switch') {
|
|
7144
|
+
left = this.parseSwitch(firstToken);
|
|
7145
|
+
}
|
|
7146
|
+
else if (isA_SymbolToken(firstToken) && firstToken[1] === 'for') {
|
|
7147
|
+
left = this.parseFor(firstToken);
|
|
7148
|
+
}
|
|
7149
|
+
else {
|
|
7150
|
+
left = this.parseOperand();
|
|
7151
|
+
}
|
|
7152
|
+
var operator = this.peek();
|
|
7153
|
+
while (!this.isAtEnd()
|
|
7154
|
+
&& !isA_OperatorToken(operator, ',')
|
|
7155
|
+
&& !isA_OperatorToken(operator, ';')
|
|
7156
|
+
&& !isRBracketToken(operator)
|
|
7157
|
+
&& !isA_ReservedSymbolToken(operator, 'else')
|
|
7158
|
+
&& !isA_ReservedSymbolToken(operator, 'then')
|
|
7159
|
+
&& !isA_ReservedSymbolToken(operator, 'end')
|
|
7160
|
+
&& !isA_ReservedSymbolToken(operator, 'case')
|
|
7161
|
+
&& !isRParenToken(operator)) {
|
|
7147
7162
|
if (isA_BinaryOperatorToken(operator)) {
|
|
7148
7163
|
var name_1 = operator[1];
|
|
7149
7164
|
var newPrecedece = getPrecedence(name_1);
|
|
@@ -7173,6 +7188,7 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7173
7188
|
else {
|
|
7174
7189
|
break;
|
|
7175
7190
|
}
|
|
7191
|
+
operator = this.peek();
|
|
7176
7192
|
}
|
|
7177
7193
|
if (!left) {
|
|
7178
7194
|
throw new LitsError('Expected operand', (_a = getTokenDebugData(this.peek())) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
|
|
@@ -7373,9 +7389,6 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7373
7389
|
var _a, _b;
|
|
7374
7390
|
var isNamedFunction = symbol.t === AstNodeType.Symbol;
|
|
7375
7391
|
this.advance();
|
|
7376
|
-
if (isNamedFunction && symbol.v === 'for') {
|
|
7377
|
-
return this.parseFor(symbol);
|
|
7378
|
-
}
|
|
7379
7392
|
var params = [];
|
|
7380
7393
|
while (!this.isAtEnd() && !isRParenToken(this.peek())) {
|
|
7381
7394
|
params.push(this.parseExpression());
|
|
@@ -7396,17 +7409,14 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7396
7409
|
var name_2 = symbol.v;
|
|
7397
7410
|
switch (name_2) {
|
|
7398
7411
|
case '??':
|
|
7399
|
-
case '
|
|
7412
|
+
case '&&':
|
|
7400
7413
|
case 'comment':
|
|
7401
|
-
case 'cond':
|
|
7402
7414
|
case 'declared?':
|
|
7403
|
-
case '
|
|
7404
|
-
case '
|
|
7405
|
-
case 'or':
|
|
7415
|
+
case 'if_not':
|
|
7416
|
+
case '||':
|
|
7406
7417
|
case 'when':
|
|
7407
|
-
case '
|
|
7418
|
+
case 'when_not':
|
|
7408
7419
|
case 'do':
|
|
7409
|
-
case 'time!':
|
|
7410
7420
|
case 'throw': {
|
|
7411
7421
|
var node = {
|
|
7412
7422
|
t: AstNodeType.SpecialExpression,
|
|
@@ -7419,13 +7429,11 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7419
7429
|
}
|
|
7420
7430
|
case 'let':
|
|
7421
7431
|
return this.parseLet(symbol, params);
|
|
7422
|
-
case 'def':
|
|
7423
7432
|
case 'defs':
|
|
7424
|
-
case '
|
|
7425
|
-
case '
|
|
7426
|
-
case '
|
|
7433
|
+
case 'if_let':
|
|
7434
|
+
case 'when_let':
|
|
7435
|
+
case 'when_first':
|
|
7427
7436
|
case 'fn':
|
|
7428
|
-
case 'defn':
|
|
7429
7437
|
case 'defns':
|
|
7430
7438
|
case 'try':
|
|
7431
7439
|
case 'recur':
|
|
@@ -7448,8 +7456,32 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7448
7456
|
}
|
|
7449
7457
|
};
|
|
7450
7458
|
AlgebraicParser.prototype.parseLambdaFunction = function () {
|
|
7451
|
-
var _a, _b;
|
|
7452
7459
|
var firstToken = this.peek();
|
|
7460
|
+
try {
|
|
7461
|
+
var _a = this.parseFunctionArguments(), functionArguments = _a.functionArguments, arity = _a.arity;
|
|
7462
|
+
if (!isA_OperatorToken(this.peek(), '=>')) {
|
|
7463
|
+
return null;
|
|
7464
|
+
}
|
|
7465
|
+
this.advance();
|
|
7466
|
+
var body = this.parseExpression();
|
|
7467
|
+
return {
|
|
7468
|
+
t: AstNodeType.SpecialExpression,
|
|
7469
|
+
n: 'fn',
|
|
7470
|
+
p: [],
|
|
7471
|
+
o: [{
|
|
7472
|
+
as: functionArguments,
|
|
7473
|
+
b: [body],
|
|
7474
|
+
a: arity,
|
|
7475
|
+
}],
|
|
7476
|
+
token: getTokenDebugData(firstToken) && firstToken,
|
|
7477
|
+
};
|
|
7478
|
+
}
|
|
7479
|
+
catch (_b) {
|
|
7480
|
+
return null;
|
|
7481
|
+
}
|
|
7482
|
+
};
|
|
7483
|
+
AlgebraicParser.prototype.parseFunctionArguments = function () {
|
|
7484
|
+
var _a, _b, _c, _d, _e;
|
|
7453
7485
|
this.advance();
|
|
7454
7486
|
var rest = false;
|
|
7455
7487
|
var letBindingObject;
|
|
@@ -7472,7 +7504,7 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7472
7504
|
}
|
|
7473
7505
|
var symbolToken = this.peek();
|
|
7474
7506
|
if (!isA_SymbolToken(symbolToken)) {
|
|
7475
|
-
|
|
7507
|
+
throw new LitsError('Expected symbol', (_c = getTokenDebugData(this.peek())) === null || _c === void 0 ? void 0 : _c.sourceCodeInfo);
|
|
7476
7508
|
}
|
|
7477
7509
|
if (rest) {
|
|
7478
7510
|
restArg = symbolToken[1];
|
|
@@ -7483,47 +7515,36 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7483
7515
|
this.advance();
|
|
7484
7516
|
}
|
|
7485
7517
|
if (!isA_OperatorToken(this.peek(), ',') && !isRParenToken(this.peek())) {
|
|
7486
|
-
|
|
7518
|
+
throw new LitsError('Expected comma or closing parenthesis', (_d = getTokenDebugData(this.peek())) === null || _d === void 0 ? void 0 : _d.sourceCodeInfo);
|
|
7487
7519
|
}
|
|
7488
7520
|
if (isA_OperatorToken(this.peek(), ',')) {
|
|
7489
7521
|
this.advance();
|
|
7490
7522
|
}
|
|
7491
7523
|
}
|
|
7524
|
+
var arity = restArg !== undefined ? { min: args.length } : args.length;
|
|
7492
7525
|
if (!isRParenToken(this.peek())) {
|
|
7493
|
-
|
|
7526
|
+
throw new LitsError('Expected closing parenthesis', (_e = getTokenDebugData(this.peek())) === null || _e === void 0 ? void 0 : _e.sourceCodeInfo);
|
|
7494
7527
|
}
|
|
7495
|
-
this.advance();
|
|
7496
|
-
if (!isA_OperatorToken(this.peek(), '=>')) {
|
|
7497
|
-
return null;
|
|
7498
|
-
}
|
|
7499
|
-
this.advance();
|
|
7500
7528
|
var letBindings = letBindingObject ? arrayToPairs(letBindingObject.p) : [];
|
|
7501
|
-
var
|
|
7502
|
-
|
|
7529
|
+
var functionArguments = {
|
|
7530
|
+
m: args,
|
|
7531
|
+
r: restArg,
|
|
7532
|
+
b: letBindings.map(function (pair) {
|
|
7533
|
+
var key = pair[0];
|
|
7534
|
+
var value = pair[1];
|
|
7535
|
+
return {
|
|
7536
|
+
t: AstNodeType.Binding,
|
|
7537
|
+
n: key.v,
|
|
7538
|
+
v: value,
|
|
7539
|
+
p: [],
|
|
7540
|
+
token: getTokenDebugData(key.token) && key.token,
|
|
7541
|
+
};
|
|
7542
|
+
}),
|
|
7543
|
+
};
|
|
7544
|
+
this.advance();
|
|
7503
7545
|
return {
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
p: [],
|
|
7507
|
-
o: [{
|
|
7508
|
-
as: {
|
|
7509
|
-
m: args,
|
|
7510
|
-
r: restArg,
|
|
7511
|
-
b: letBindings.map(function (pair) {
|
|
7512
|
-
var key = pair[0];
|
|
7513
|
-
var value = pair[1];
|
|
7514
|
-
return {
|
|
7515
|
-
t: AstNodeType.Binding,
|
|
7516
|
-
n: key.v,
|
|
7517
|
-
v: value,
|
|
7518
|
-
p: [],
|
|
7519
|
-
token: getTokenDebugData(key.token) && key.token,
|
|
7520
|
-
};
|
|
7521
|
-
}),
|
|
7522
|
-
},
|
|
7523
|
-
b: [body],
|
|
7524
|
-
a: arity,
|
|
7525
|
-
}],
|
|
7526
|
-
token: getTokenDebugData(firstToken) && firstToken,
|
|
7546
|
+
functionArguments: functionArguments,
|
|
7547
|
+
arity: arity,
|
|
7527
7548
|
};
|
|
7528
7549
|
};
|
|
7529
7550
|
AlgebraicParser.prototype.parseShorthandLamdaFunction = function () {
|
|
@@ -7608,38 +7629,39 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7608
7629
|
}),
|
|
7609
7630
|
};
|
|
7610
7631
|
};
|
|
7611
|
-
AlgebraicParser.prototype.parseFor = function (
|
|
7632
|
+
AlgebraicParser.prototype.parseFor = function (token) {
|
|
7633
|
+
this.advance();
|
|
7634
|
+
assertLParenToken(this.peek());
|
|
7635
|
+
this.advance();
|
|
7612
7636
|
var forLoopBindings = [
|
|
7613
7637
|
this.parseForLoopBinding(),
|
|
7614
7638
|
];
|
|
7615
|
-
|
|
7616
|
-
while (isA_SymbolToken(nextToken) && nextToken[1] === 'of') {
|
|
7639
|
+
while (!this.isAtEnd() && !isRParenToken(this.peek())) {
|
|
7617
7640
|
forLoopBindings.push(this.parseForLoopBinding());
|
|
7618
|
-
|
|
7641
|
+
if (isA_OperatorToken(this.peek(), ',')) {
|
|
7642
|
+
this.advance();
|
|
7643
|
+
}
|
|
7619
7644
|
}
|
|
7620
|
-
var expression = this.parseExpression();
|
|
7621
7645
|
assertRParenToken(this.peek());
|
|
7622
7646
|
this.advance();
|
|
7647
|
+
var expression = this.parseExpression();
|
|
7648
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7649
|
+
this.advance();
|
|
7623
7650
|
return {
|
|
7624
7651
|
t: AstNodeType.SpecialExpression,
|
|
7625
7652
|
n: 'for',
|
|
7626
7653
|
p: [expression],
|
|
7627
|
-
token: getTokenDebugData(
|
|
7654
|
+
token: getTokenDebugData(token) && token,
|
|
7628
7655
|
l: forLoopBindings,
|
|
7629
7656
|
};
|
|
7630
7657
|
};
|
|
7631
|
-
// export interface LoopBindingNode {
|
|
7632
|
-
// b: BindingNode // Binding
|
|
7633
|
-
// m: Array<'&let' | '&when' | '&while'> // Modifiers
|
|
7634
|
-
// l?: BindingNode[] // Let-Bindings
|
|
7635
|
-
// wn?: AstNode // When Node
|
|
7636
|
-
// we?: AstNode // While Node
|
|
7637
|
-
// }
|
|
7638
7658
|
AlgebraicParser.prototype.parseForLoopBinding = function () {
|
|
7639
7659
|
var _a;
|
|
7640
7660
|
var bindingNode = this.parseBinding();
|
|
7641
|
-
if (isA_OperatorToken(this.peek(), ',')) {
|
|
7642
|
-
this.
|
|
7661
|
+
if (isRParenToken(this.peek()) || isA_OperatorToken(this.peek(), ',')) {
|
|
7662
|
+
if (isA_OperatorToken(this.peek(), ',')) {
|
|
7663
|
+
this.advance();
|
|
7664
|
+
}
|
|
7643
7665
|
return {
|
|
7644
7666
|
b: bindingNode,
|
|
7645
7667
|
m: [],
|
|
@@ -7685,8 +7707,9 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7685
7707
|
}
|
|
7686
7708
|
token = this.peek();
|
|
7687
7709
|
}
|
|
7688
|
-
|
|
7689
|
-
|
|
7710
|
+
if (isA_OperatorToken(token, ',')) {
|
|
7711
|
+
this.advance();
|
|
7712
|
+
}
|
|
7690
7713
|
return {
|
|
7691
7714
|
b: bindingNode,
|
|
7692
7715
|
m: modifiers,
|
|
@@ -7715,15 +7738,185 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7715
7738
|
};
|
|
7716
7739
|
return node;
|
|
7717
7740
|
};
|
|
7741
|
+
AlgebraicParser.prototype.parseIf = function (token) {
|
|
7742
|
+
this.advance();
|
|
7743
|
+
var condition = this.parseExpression();
|
|
7744
|
+
assertA_ReservedSymbolToken(this.peek(), 'then');
|
|
7745
|
+
this.advance();
|
|
7746
|
+
var thenExpressions = [];
|
|
7747
|
+
while (!this.isAtEnd()
|
|
7748
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'else')
|
|
7749
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7750
|
+
thenExpressions.push(this.parseExpression());
|
|
7751
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7752
|
+
this.advance();
|
|
7753
|
+
}
|
|
7754
|
+
}
|
|
7755
|
+
var thenExpression = thenExpressions.length === 1
|
|
7756
|
+
? thenExpressions[0]
|
|
7757
|
+
: {
|
|
7758
|
+
t: AstNodeType.SpecialExpression,
|
|
7759
|
+
n: 'do',
|
|
7760
|
+
p: thenExpressions,
|
|
7761
|
+
token: getTokenDebugData(token) && token,
|
|
7762
|
+
};
|
|
7763
|
+
var elseExpression;
|
|
7764
|
+
if (isA_ReservedSymbolToken(this.peek(), 'else')) {
|
|
7765
|
+
this.advance();
|
|
7766
|
+
var elseExpressions = [];
|
|
7767
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7768
|
+
elseExpressions.push(this.parseExpression());
|
|
7769
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7770
|
+
this.advance();
|
|
7771
|
+
}
|
|
7772
|
+
}
|
|
7773
|
+
elseExpression = elseExpressions.length === 1
|
|
7774
|
+
? elseExpressions[0]
|
|
7775
|
+
: {
|
|
7776
|
+
t: AstNodeType.SpecialExpression,
|
|
7777
|
+
n: 'do',
|
|
7778
|
+
p: elseExpressions,
|
|
7779
|
+
token: getTokenDebugData(token) && token,
|
|
7780
|
+
};
|
|
7781
|
+
}
|
|
7782
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7783
|
+
this.advance();
|
|
7784
|
+
var params = [condition, thenExpression];
|
|
7785
|
+
if (elseExpression) {
|
|
7786
|
+
params.push(elseExpression);
|
|
7787
|
+
}
|
|
7788
|
+
return {
|
|
7789
|
+
t: AstNodeType.SpecialExpression,
|
|
7790
|
+
n: 'if',
|
|
7791
|
+
p: params,
|
|
7792
|
+
token: getTokenDebugData(token) && token,
|
|
7793
|
+
};
|
|
7794
|
+
};
|
|
7795
|
+
AlgebraicParser.prototype.parseCond = function (token) {
|
|
7796
|
+
this.advance();
|
|
7797
|
+
var params = [];
|
|
7798
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7799
|
+
assertA_ReservedSymbolToken(this.peek(), 'case');
|
|
7800
|
+
this.advance();
|
|
7801
|
+
params.push(this.parseExpression());
|
|
7802
|
+
assertA_ReservedSymbolToken(this.peek(), 'then');
|
|
7803
|
+
this.advance();
|
|
7804
|
+
var expressions = [];
|
|
7805
|
+
while (!this.isAtEnd()
|
|
7806
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'case')
|
|
7807
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7808
|
+
expressions.push(this.parseExpression());
|
|
7809
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7810
|
+
this.advance();
|
|
7811
|
+
}
|
|
7812
|
+
}
|
|
7813
|
+
params.push(expressions.length === 1
|
|
7814
|
+
? expressions[0]
|
|
7815
|
+
: {
|
|
7816
|
+
t: AstNodeType.SpecialExpression,
|
|
7817
|
+
n: 'do',
|
|
7818
|
+
p: expressions,
|
|
7819
|
+
token: getTokenDebugData(token) && token,
|
|
7820
|
+
});
|
|
7821
|
+
if (isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7822
|
+
break;
|
|
7823
|
+
}
|
|
7824
|
+
assertA_ReservedSymbolToken(this.peek(), 'case');
|
|
7825
|
+
}
|
|
7826
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7827
|
+
this.advance();
|
|
7828
|
+
return {
|
|
7829
|
+
t: AstNodeType.SpecialExpression,
|
|
7830
|
+
n: 'cond',
|
|
7831
|
+
p: params,
|
|
7832
|
+
token: getTokenDebugData(token) && token,
|
|
7833
|
+
};
|
|
7834
|
+
};
|
|
7835
|
+
AlgebraicParser.prototype.parseSwitch = function (token) {
|
|
7836
|
+
this.advance();
|
|
7837
|
+
var params = [this.parseExpression()];
|
|
7838
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7839
|
+
assertA_ReservedSymbolToken(this.peek(), 'case');
|
|
7840
|
+
this.advance();
|
|
7841
|
+
params.push(this.parseExpression());
|
|
7842
|
+
assertA_ReservedSymbolToken(this.peek(), 'then');
|
|
7843
|
+
this.advance();
|
|
7844
|
+
var expressions = [];
|
|
7845
|
+
while (!this.isAtEnd()
|
|
7846
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'case')
|
|
7847
|
+
&& !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7848
|
+
expressions.push(this.parseExpression());
|
|
7849
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7850
|
+
this.advance();
|
|
7851
|
+
}
|
|
7852
|
+
}
|
|
7853
|
+
params.push(expressions.length === 1
|
|
7854
|
+
? expressions[0]
|
|
7855
|
+
: {
|
|
7856
|
+
t: AstNodeType.SpecialExpression,
|
|
7857
|
+
n: 'do',
|
|
7858
|
+
p: expressions,
|
|
7859
|
+
token: getTokenDebugData(token) && token,
|
|
7860
|
+
});
|
|
7861
|
+
if (isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7862
|
+
break;
|
|
7863
|
+
}
|
|
7864
|
+
assertA_ReservedSymbolToken(this.peek(), 'case');
|
|
7865
|
+
}
|
|
7866
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7867
|
+
this.advance();
|
|
7868
|
+
return {
|
|
7869
|
+
t: AstNodeType.SpecialExpression,
|
|
7870
|
+
n: 'switch',
|
|
7871
|
+
p: params,
|
|
7872
|
+
token: getTokenDebugData(token) && token,
|
|
7873
|
+
};
|
|
7874
|
+
};
|
|
7875
|
+
AlgebraicParser.prototype.parseDef = function (token) {
|
|
7876
|
+
this.advance();
|
|
7877
|
+
var symbol = parseSymbol(this.tokenStream, this.parseState);
|
|
7878
|
+
assertA_OperatorToken(this.peek(), '=');
|
|
7879
|
+
this.advance();
|
|
7880
|
+
var value = this.parseExpression();
|
|
7881
|
+
return {
|
|
7882
|
+
t: AstNodeType.SpecialExpression,
|
|
7883
|
+
n: 'def',
|
|
7884
|
+
p: [symbol, value],
|
|
7885
|
+
token: getTokenDebugData(token) && token,
|
|
7886
|
+
};
|
|
7887
|
+
};
|
|
7888
|
+
AlgebraicParser.prototype.parseDefn = function (token) {
|
|
7889
|
+
this.advance();
|
|
7890
|
+
var symbol = parseSymbol(this.tokenStream, this.parseState);
|
|
7891
|
+
var _a = this.parseFunctionArguments(), functionArguments = _a.functionArguments, arity = _a.arity;
|
|
7892
|
+
var body = [];
|
|
7893
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7894
|
+
body.push(this.parseExpression());
|
|
7895
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7896
|
+
this.advance();
|
|
7897
|
+
}
|
|
7898
|
+
}
|
|
7899
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7900
|
+
this.advance();
|
|
7901
|
+
return {
|
|
7902
|
+
t: AstNodeType.SpecialExpression,
|
|
7903
|
+
n: 'defn',
|
|
7904
|
+
f: symbol,
|
|
7905
|
+
p: [],
|
|
7906
|
+
o: [{
|
|
7907
|
+
as: functionArguments,
|
|
7908
|
+
b: body,
|
|
7909
|
+
a: arity,
|
|
7910
|
+
}],
|
|
7911
|
+
token: getTokenDebugData(token) && token,
|
|
7912
|
+
};
|
|
7913
|
+
};
|
|
7718
7914
|
AlgebraicParser.prototype.isAtEnd = function () {
|
|
7719
7915
|
return this.parseState.position >= this.tokenStream.tokens.length;
|
|
7720
7916
|
};
|
|
7721
7917
|
AlgebraicParser.prototype.peek = function () {
|
|
7722
7918
|
return this.tokenStream.tokens[this.parseState.position];
|
|
7723
7919
|
};
|
|
7724
|
-
AlgebraicParser.prototype.peekAhead = function () {
|
|
7725
|
-
return this.tokenStream.tokens[this.parseState.position + 1];
|
|
7726
|
-
};
|
|
7727
7920
|
return AlgebraicParser;
|
|
7728
7921
|
}());
|
|
7729
7922
|
|
|
@@ -8004,10 +8197,18 @@ function parsePolishToken(tokenStream, parseState) {
|
|
|
8004
8197
|
parseState.position += 1;
|
|
8005
8198
|
parseState.algebraic = true;
|
|
8006
8199
|
var algebraicParser = new AlgebraicParser(tokenStream, parseState);
|
|
8007
|
-
var
|
|
8200
|
+
var nodes = algebraicParser.parse();
|
|
8008
8201
|
assertEndNotationToken(tokenStream.tokens[parseState.position++]);
|
|
8009
8202
|
parseState.algebraic = false;
|
|
8010
|
-
|
|
8203
|
+
if (nodes.length === 1) {
|
|
8204
|
+
return nodes[0];
|
|
8205
|
+
}
|
|
8206
|
+
return {
|
|
8207
|
+
t: AstNodeType.SpecialExpression,
|
|
8208
|
+
n: 'do',
|
|
8209
|
+
p: nodes,
|
|
8210
|
+
token: nodes[0].token,
|
|
8211
|
+
};
|
|
8011
8212
|
}
|
|
8012
8213
|
case 'PolNotation': {
|
|
8013
8214
|
var astNodes = [];
|
|
@@ -8074,13 +8275,22 @@ function removeUnnecessaryTokens(tokenStream) {
|
|
|
8074
8275
|
function parseToken(tokenStream, parseState) {
|
|
8075
8276
|
if (parseState.algebraic) {
|
|
8076
8277
|
var algebraicParser = new AlgebraicParser(tokenStream, parseState);
|
|
8077
|
-
|
|
8278
|
+
var nodes = algebraicParser.parse();
|
|
8279
|
+
if (nodes.length === 1) {
|
|
8280
|
+
return nodes[0];
|
|
8281
|
+
}
|
|
8282
|
+
return {
|
|
8283
|
+
t: AstNodeType.SpecialExpression,
|
|
8284
|
+
n: 'do',
|
|
8285
|
+
p: nodes,
|
|
8286
|
+
token: nodes[0].token,
|
|
8287
|
+
};
|
|
8078
8288
|
}
|
|
8079
8289
|
return parsePolishToken(tokenStream, parseState);
|
|
8080
8290
|
}
|
|
8081
8291
|
|
|
8082
|
-
var polishIdentifierCharacterClass = '[\\w
|
|
8083
|
-
var polishIdentifierFirstCharacterClass = '[a-zA-Z_
|
|
8292
|
+
var polishIdentifierCharacterClass = '[\\w@%^?=!$<>+*/:&\|~-]';
|
|
8293
|
+
var polishIdentifierFirstCharacterClass = '[a-zA-Z_@%^?=!$<>+*/&\|~-]';
|
|
8084
8294
|
var algebraicIdentifierCharacterClass = '[\\w$:!?]';
|
|
8085
8295
|
var algebraicIdentifierFirstCharacterClass = '[a-zA-Z_$]';
|
|
8086
8296
|
|
|
@@ -8160,25 +8370,28 @@ var commonTokenizers = [
|
|
|
8160
8370
|
tokenizeString,
|
|
8161
8371
|
];
|
|
8162
8372
|
|
|
8163
|
-
var
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8373
|
+
var validAlgebraicReservedNamesRecord = {
|
|
8374
|
+
true: { value: true, forbidden: false },
|
|
8375
|
+
false: { value: false, forbidden: false },
|
|
8376
|
+
nil: { value: null, forbidden: false },
|
|
8377
|
+
null: { value: null, forbidden: false },
|
|
8378
|
+
then: { value: null, forbidden: false },
|
|
8379
|
+
else: { value: null, forbidden: false },
|
|
8380
|
+
end: { value: null, forbidden: false },
|
|
8381
|
+
case: { value: null, forbidden: false },
|
|
8382
|
+
};
|
|
8383
|
+
var forbiddenAlgebraicReservedNamesRecord = {
|
|
8384
|
+
if_let: { value: null, forbidden: true },
|
|
8385
|
+
when_let: { value: null, forbidden: true },
|
|
8386
|
+
when_first: { value: null, forbidden: true },
|
|
8387
|
+
fn: { value: null, forbidden: true },
|
|
8388
|
+
defns: { value: null, forbidden: true },
|
|
8389
|
+
try: { value: null, forbidden: true },
|
|
8390
|
+
recur: { value: null, forbidden: true },
|
|
8391
|
+
loop: { value: null, forbidden: true },
|
|
8392
|
+
doseq: { value: null, forbidden: true },
|
|
8181
8393
|
};
|
|
8394
|
+
var algebraicReservedNamesRecord = __assign(__assign({}, validAlgebraicReservedNamesRecord), forbiddenAlgebraicReservedNamesRecord);
|
|
8182
8395
|
|
|
8183
8396
|
var identifierRegExp = new RegExp(algebraicIdentifierCharacterClass);
|
|
8184
8397
|
var identifierFirstCharacterRegExp = new RegExp(algebraicIdentifierFirstCharacterClass);
|
|
@@ -8250,45 +8463,19 @@ var tokenizeA_BasePrefixedNumber = function (input, position) {
|
|
|
8250
8463
|
}
|
|
8251
8464
|
return [length, ['A_BasePrefixedNumber', input.substring(position, i)]];
|
|
8252
8465
|
};
|
|
8253
|
-
var tokenizeA_ReservedSymbolToken = function (input, position) {
|
|
8254
|
-
var e_1, _a;
|
|
8255
|
-
try {
|
|
8256
|
-
for (var _b = __values(Object.entries(algebraicReservedNamesRecord)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
8257
|
-
var _d = __read(_c.value, 2), reservedName = _d[0], forbidden = _d[1].forbidden;
|
|
8258
|
-
var length_1 = reservedName.length;
|
|
8259
|
-
var nextChar = input[position + length_1];
|
|
8260
|
-
if (nextChar && identifierRegExp.test(nextChar))
|
|
8261
|
-
continue;
|
|
8262
|
-
var name_1 = input.substring(position, position + length_1);
|
|
8263
|
-
if (name_1 === reservedName) {
|
|
8264
|
-
if (forbidden)
|
|
8265
|
-
throw new LitsError("".concat(name_1, " is forbidden!"), undefined);
|
|
8266
|
-
return [length_1, ['A_ReservedSymbol', reservedName]];
|
|
8267
|
-
}
|
|
8268
|
-
}
|
|
8269
|
-
}
|
|
8270
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
8271
|
-
finally {
|
|
8272
|
-
try {
|
|
8273
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
8274
|
-
}
|
|
8275
|
-
finally { if (e_1) throw e_1.error; }
|
|
8276
|
-
}
|
|
8277
|
-
return NO_MATCH;
|
|
8278
|
-
};
|
|
8279
8466
|
var tokenizeA_Symbol = function (input, position) {
|
|
8280
8467
|
var value = input[position];
|
|
8281
8468
|
if (!value) {
|
|
8282
8469
|
return NO_MATCH;
|
|
8283
8470
|
}
|
|
8284
8471
|
if (value === '\'') {
|
|
8285
|
-
var
|
|
8286
|
-
var char = input[position +
|
|
8472
|
+
var length_1 = 1;
|
|
8473
|
+
var char = input[position + length_1];
|
|
8287
8474
|
var escaping = false;
|
|
8288
8475
|
while (char !== '\'' || escaping) {
|
|
8289
8476
|
if (char === undefined)
|
|
8290
8477
|
throw new LitsError("Unclosed string at position ".concat(position, "."), undefined);
|
|
8291
|
-
|
|
8478
|
+
length_1 += 1;
|
|
8292
8479
|
if (escaping) {
|
|
8293
8480
|
escaping = false;
|
|
8294
8481
|
value += char;
|
|
@@ -8299,10 +8486,10 @@ var tokenizeA_Symbol = function (input, position) {
|
|
|
8299
8486
|
}
|
|
8300
8487
|
value += char;
|
|
8301
8488
|
}
|
|
8302
|
-
char = input[position +
|
|
8489
|
+
char = input[position + length_1];
|
|
8303
8490
|
}
|
|
8304
8491
|
value += '\''; // closing quote
|
|
8305
|
-
return [
|
|
8492
|
+
return [length_1 + 1, ['A_Symbol', value]];
|
|
8306
8493
|
}
|
|
8307
8494
|
if (identifierFirstCharacterRegExp.test(value)) {
|
|
8308
8495
|
var initialPosition = position;
|
|
@@ -8317,6 +8504,22 @@ var tokenizeA_Symbol = function (input, position) {
|
|
|
8317
8504
|
}
|
|
8318
8505
|
return NO_MATCH;
|
|
8319
8506
|
};
|
|
8507
|
+
var tokenizeA_ReservedSymbolToken = function (input, position) {
|
|
8508
|
+
var symbolMeta = tokenizeA_Symbol(input, position);
|
|
8509
|
+
if (symbolMeta[0] === 0 || !symbolMeta[1]) {
|
|
8510
|
+
return NO_MATCH;
|
|
8511
|
+
}
|
|
8512
|
+
var symbolName = symbolMeta[1][1];
|
|
8513
|
+
symbolName = symbolName.startsWith('\'') ? symbolName.slice(1, symbolName.length - 1) : symbolName;
|
|
8514
|
+
var info = algebraicReservedNamesRecord[symbolName];
|
|
8515
|
+
if (!info) {
|
|
8516
|
+
return NO_MATCH;
|
|
8517
|
+
}
|
|
8518
|
+
if (info.forbidden) {
|
|
8519
|
+
throw new LitsError("".concat(symbolName, " is forbidden!"), undefined);
|
|
8520
|
+
}
|
|
8521
|
+
return [symbolMeta[0], ['A_ReservedSymbol', symbolName]];
|
|
8522
|
+
};
|
|
8320
8523
|
var tokenizeA_Operator = function (input, position) {
|
|
8321
8524
|
var _a;
|
|
8322
8525
|
var threeChars = input.slice(position, position + 3);
|
|
@@ -8335,30 +8538,30 @@ var tokenizeA_Operator = function (input, position) {
|
|
|
8335
8538
|
};
|
|
8336
8539
|
var tokenizeA_MultiLineComment = function (input, position) {
|
|
8337
8540
|
if (input[position] === '/' && input[position + 1] === '*') {
|
|
8338
|
-
var
|
|
8541
|
+
var length_2 = 2;
|
|
8339
8542
|
var value = '/*';
|
|
8340
|
-
while (input[position +
|
|
8341
|
-
value += input[position +
|
|
8342
|
-
|
|
8543
|
+
while (input[position + length_2] !== '*' && input[position + length_2 + 1] !== '/' && position + length_2 + 1 < input.length) {
|
|
8544
|
+
value += input[position + length_2];
|
|
8545
|
+
length_2 += 1;
|
|
8343
8546
|
}
|
|
8344
|
-
if (position +
|
|
8547
|
+
if (position + length_2 + 1 >= input.length) {
|
|
8345
8548
|
throw new LitsError('Comment not closed', undefined);
|
|
8346
8549
|
}
|
|
8347
8550
|
value += '*/';
|
|
8348
|
-
|
|
8349
|
-
return [
|
|
8551
|
+
length_2 += 2;
|
|
8552
|
+
return [length_2, ['A_MultiLineComment', value]];
|
|
8350
8553
|
}
|
|
8351
8554
|
return NO_MATCH;
|
|
8352
8555
|
};
|
|
8353
8556
|
var tokenizeA_SingleLineComment = function (input, position) {
|
|
8354
8557
|
if (input[position] === '/' && input[position + 1] === '/') {
|
|
8355
|
-
var
|
|
8558
|
+
var length_3 = 2;
|
|
8356
8559
|
var value = '//';
|
|
8357
|
-
while (input[position +
|
|
8358
|
-
value += input[position +
|
|
8359
|
-
|
|
8560
|
+
while (input[position + length_3] !== '\n' && position + length_3 < input.length) {
|
|
8561
|
+
value += input[position + length_3];
|
|
8562
|
+
length_3 += 1;
|
|
8360
8563
|
}
|
|
8361
|
-
return [
|
|
8564
|
+
return [length_3, ['A_SingleLineComment', value]];
|
|
8362
8565
|
}
|
|
8363
8566
|
return NO_MATCH;
|
|
8364
8567
|
};
|
|
@@ -8518,31 +8721,20 @@ var tokenizeP_FnShorthand = function (input, position) {
|
|
|
8518
8721
|
return [1, ['P_FnShorthand']];
|
|
8519
8722
|
};
|
|
8520
8723
|
var tokenizeP_ReservedSymbol = function (input, position) {
|
|
8521
|
-
var
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
var _d = __read(_c.value, 2), reservedName = _d[0], forbidden = _d[1].forbidden;
|
|
8525
|
-
var length_3 = reservedName.length;
|
|
8526
|
-
var nextChar = input[position + length_3];
|
|
8527
|
-
if (nextChar && P_symbolRegExp.test(nextChar)) {
|
|
8528
|
-
continue;
|
|
8529
|
-
}
|
|
8530
|
-
var symbol = input.substring(position, position + length_3);
|
|
8531
|
-
if (symbol === reservedName) {
|
|
8532
|
-
if (forbidden)
|
|
8533
|
-
throw new LitsError("".concat(symbol, " is forbidden!"), undefined);
|
|
8534
|
-
return [length_3, ['P_ReservedSymbol', reservedName]];
|
|
8535
|
-
}
|
|
8536
|
-
}
|
|
8724
|
+
var symbolMeta = tokenizeP_Symbol(input, position);
|
|
8725
|
+
if (symbolMeta[0] === 0 || !symbolMeta[1]) {
|
|
8726
|
+
return NO_MATCH;
|
|
8537
8727
|
}
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
finally { if (e_1) throw e_1.error; }
|
|
8728
|
+
var symbolName = symbolMeta[1][1];
|
|
8729
|
+
symbolName = symbolName.startsWith('\'') ? symbolName.slice(1, symbolName.length - 1) : symbolName;
|
|
8730
|
+
var info = polishReservedNamesRecord[symbolName];
|
|
8731
|
+
if (!info) {
|
|
8732
|
+
return NO_MATCH;
|
|
8544
8733
|
}
|
|
8545
|
-
|
|
8734
|
+
if (info.forbidden) {
|
|
8735
|
+
throw new LitsError("".concat(symbolName, " is forbidden!"), undefined);
|
|
8736
|
+
}
|
|
8737
|
+
return [symbolMeta[0], ['P_ReservedSymbol', symbolName]];
|
|
8546
8738
|
};
|
|
8547
8739
|
var tokenizeP_StringShorthand = function (input, position) {
|
|
8548
8740
|
if (input[position] !== ':')
|
|
@@ -8555,24 +8747,24 @@ var tokenizeP_StringShorthand = function (input, position) {
|
|
|
8555
8747
|
return [symbolDescription[0] + 1, ['P_StringShorthand', ":".concat(symbolToken[1])]];
|
|
8556
8748
|
};
|
|
8557
8749
|
var tokenizeP_Modifier = function (input, position) {
|
|
8558
|
-
var
|
|
8750
|
+
var e_1, _a;
|
|
8559
8751
|
try {
|
|
8560
8752
|
for (var modifierNames_1 = __values(modifierNames), modifierNames_1_1 = modifierNames_1.next(); !modifierNames_1_1.done; modifierNames_1_1 = modifierNames_1.next()) {
|
|
8561
8753
|
var modifierName = modifierNames_1_1.value;
|
|
8562
|
-
var
|
|
8563
|
-
var charAfterModifier = input[position +
|
|
8564
|
-
if (input.substring(position, position +
|
|
8754
|
+
var length_3 = modifierName.length;
|
|
8755
|
+
var charAfterModifier = input[position + length_3];
|
|
8756
|
+
if (input.substring(position, position + length_3) === modifierName && (!charAfterModifier || !P_symbolRegExp.test(charAfterModifier))) {
|
|
8565
8757
|
var value = modifierName;
|
|
8566
|
-
return [
|
|
8758
|
+
return [length_3, ['P_Modifier', value]];
|
|
8567
8759
|
}
|
|
8568
8760
|
}
|
|
8569
8761
|
}
|
|
8570
|
-
catch (
|
|
8762
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
8571
8763
|
finally {
|
|
8572
8764
|
try {
|
|
8573
8765
|
if (modifierNames_1_1 && !modifierNames_1_1.done && (_a = modifierNames_1.return)) _a.call(modifierNames_1);
|
|
8574
8766
|
}
|
|
8575
|
-
finally { if (
|
|
8767
|
+
finally { if (e_1) throw e_1.error; }
|
|
8576
8768
|
}
|
|
8577
8769
|
return NO_MATCH;
|
|
8578
8770
|
};
|
|
@@ -8609,8 +8801,8 @@ var polishTokenizers = __spreadArray(__spreadArray([
|
|
|
8609
8801
|
tokenizeP_StringShorthand,
|
|
8610
8802
|
tokenizeP_Number,
|
|
8611
8803
|
tokenizeP_ReservedSymbol,
|
|
8612
|
-
tokenizeP_Symbol,
|
|
8613
8804
|
tokenizeP_Modifier,
|
|
8805
|
+
tokenizeP_Symbol,
|
|
8614
8806
|
tokenizeP_RegexpShorthand,
|
|
8615
8807
|
tokenizeP_FnShorthand,
|
|
8616
8808
|
tokenizeP_CollectionAccessor,
|
|
@@ -9018,7 +9210,7 @@ var collectionReference = {
|
|
|
9018
9210
|
},
|
|
9019
9211
|
args: {
|
|
9020
9212
|
coll: {
|
|
9021
|
-
type: ['collection', 'string', '
|
|
9213
|
+
type: ['collection', 'string', 'null'],
|
|
9022
9214
|
},
|
|
9023
9215
|
},
|
|
9024
9216
|
variants: [
|
|
@@ -9107,7 +9299,7 @@ var collectionReference = {
|
|
|
9107
9299
|
},
|
|
9108
9300
|
args: {
|
|
9109
9301
|
coll: {
|
|
9110
|
-
type: ['collection', '
|
|
9302
|
+
type: ['collection', 'null'],
|
|
9111
9303
|
},
|
|
9112
9304
|
key: {
|
|
9113
9305
|
type: ['string', 'number'],
|
|
@@ -9135,7 +9327,7 @@ var collectionReference = {
|
|
|
9135
9327
|
},
|
|
9136
9328
|
args: {
|
|
9137
9329
|
coll: {
|
|
9138
|
-
type: ['collection', '
|
|
9330
|
+
type: ['collection', 'null'],
|
|
9139
9331
|
},
|
|
9140
9332
|
value: {
|
|
9141
9333
|
type: ['any'],
|
|
@@ -9338,7 +9530,7 @@ var collectionReference = {
|
|
|
9338
9530
|
},
|
|
9339
9531
|
args: {
|
|
9340
9532
|
coll: {
|
|
9341
|
-
type: ['collection', '
|
|
9533
|
+
type: ['collection', 'null'],
|
|
9342
9534
|
},
|
|
9343
9535
|
},
|
|
9344
9536
|
variants: [
|
|
@@ -9939,7 +10131,7 @@ var sequenceReference = {
|
|
|
9939
10131
|
},
|
|
9940
10132
|
args: {
|
|
9941
10133
|
'seq': {
|
|
9942
|
-
type: ['sequence', '
|
|
10134
|
+
type: ['sequence', 'null'],
|
|
9943
10135
|
},
|
|
9944
10136
|
'n': {
|
|
9945
10137
|
type: 'integer',
|
|
@@ -10001,7 +10193,7 @@ var sequenceReference = {
|
|
|
10001
10193
|
category: 'Sequence',
|
|
10002
10194
|
linkName: 'pop',
|
|
10003
10195
|
returns: {
|
|
10004
|
-
type: ['sequence', '
|
|
10196
|
+
type: ['sequence', 'null'],
|
|
10005
10197
|
array: true,
|
|
10006
10198
|
},
|
|
10007
10199
|
args: {
|
|
@@ -10054,7 +10246,7 @@ var sequenceReference = {
|
|
|
10054
10246
|
linkName: 'shift',
|
|
10055
10247
|
clojureDocs: null,
|
|
10056
10248
|
returns: {
|
|
10057
|
-
type: ['sequence', '
|
|
10249
|
+
type: ['sequence', 'null'],
|
|
10058
10250
|
array: true,
|
|
10059
10251
|
},
|
|
10060
10252
|
args: {
|
|
@@ -10251,11 +10443,11 @@ var sequenceReference = {
|
|
|
10251
10443
|
linkName: 'position',
|
|
10252
10444
|
clojureDocs: null,
|
|
10253
10445
|
returns: {
|
|
10254
|
-
type: ['number', '
|
|
10446
|
+
type: ['number', 'null'],
|
|
10255
10447
|
},
|
|
10256
10448
|
args: {
|
|
10257
10449
|
seq: {
|
|
10258
|
-
type: ['sequence', '
|
|
10450
|
+
type: ['sequence', 'null'],
|
|
10259
10451
|
},
|
|
10260
10452
|
fn: {
|
|
10261
10453
|
type: 'function',
|
|
@@ -10278,11 +10470,11 @@ var sequenceReference = {
|
|
|
10278
10470
|
linkName: 'index_of',
|
|
10279
10471
|
clojureDocs: null,
|
|
10280
10472
|
returns: {
|
|
10281
|
-
type: ['number', '
|
|
10473
|
+
type: ['number', 'null'],
|
|
10282
10474
|
},
|
|
10283
10475
|
args: {
|
|
10284
10476
|
seq: {
|
|
10285
|
-
type: ['sequence', '
|
|
10477
|
+
type: ['sequence', 'null'],
|
|
10286
10478
|
},
|
|
10287
10479
|
x: {
|
|
10288
10480
|
type: 'any',
|
|
@@ -10308,7 +10500,7 @@ var sequenceReference = {
|
|
|
10308
10500
|
},
|
|
10309
10501
|
args: {
|
|
10310
10502
|
seq: {
|
|
10311
|
-
type: ['sequence', '
|
|
10503
|
+
type: ['sequence', 'null'],
|
|
10312
10504
|
},
|
|
10313
10505
|
fn: {
|
|
10314
10506
|
type: 'function',
|
|
@@ -10331,11 +10523,11 @@ var sequenceReference = {
|
|
|
10331
10523
|
category: 'Sequence',
|
|
10332
10524
|
linkName: 'reverse',
|
|
10333
10525
|
returns: {
|
|
10334
|
-
type: ['sequence', '
|
|
10526
|
+
type: ['sequence', 'null'],
|
|
10335
10527
|
},
|
|
10336
10528
|
args: {
|
|
10337
10529
|
seq: {
|
|
10338
|
-
type: ['sequence', '
|
|
10530
|
+
type: ['sequence', 'null'],
|
|
10339
10531
|
},
|
|
10340
10532
|
},
|
|
10341
10533
|
variants: [
|
|
@@ -10358,7 +10550,7 @@ var sequenceReference = {
|
|
|
10358
10550
|
},
|
|
10359
10551
|
args: {
|
|
10360
10552
|
seq: {
|
|
10361
|
-
type: ['sequence', '
|
|
10553
|
+
type: ['sequence', 'null'],
|
|
10362
10554
|
},
|
|
10363
10555
|
},
|
|
10364
10556
|
variants: [
|
|
@@ -10380,7 +10572,7 @@ var sequenceReference = {
|
|
|
10380
10572
|
},
|
|
10381
10573
|
args: {
|
|
10382
10574
|
seq: {
|
|
10383
|
-
type: ['sequence', '
|
|
10575
|
+
type: ['sequence', 'null'],
|
|
10384
10576
|
},
|
|
10385
10577
|
},
|
|
10386
10578
|
variants: [
|
|
@@ -10403,7 +10595,7 @@ var sequenceReference = {
|
|
|
10403
10595
|
},
|
|
10404
10596
|
args: {
|
|
10405
10597
|
seq: {
|
|
10406
|
-
type: ['sequence', '
|
|
10598
|
+
type: ['sequence', 'null'],
|
|
10407
10599
|
},
|
|
10408
10600
|
},
|
|
10409
10601
|
variants: [
|
|
@@ -10423,7 +10615,7 @@ var sequenceReference = {
|
|
|
10423
10615
|
category: 'Sequence',
|
|
10424
10616
|
linkName: 'rest',
|
|
10425
10617
|
returns: {
|
|
10426
|
-
type: ['sequence', '
|
|
10618
|
+
type: ['sequence', 'null'],
|
|
10427
10619
|
},
|
|
10428
10620
|
args: {
|
|
10429
10621
|
seq: {
|
|
@@ -10476,7 +10668,7 @@ var sequenceReference = {
|
|
|
10476
10668
|
category: 'Sequence',
|
|
10477
10669
|
linkName: 'next',
|
|
10478
10670
|
returns: {
|
|
10479
|
-
type: ['sequence', '
|
|
10671
|
+
type: ['sequence', 'null'],
|
|
10480
10672
|
},
|
|
10481
10673
|
args: {
|
|
10482
10674
|
seq: {
|
|
@@ -10501,7 +10693,7 @@ var sequenceReference = {
|
|
|
10501
10693
|
category: 'Sequence',
|
|
10502
10694
|
linkName: 'nthnext',
|
|
10503
10695
|
returns: {
|
|
10504
|
-
type: ['sequence', '
|
|
10696
|
+
type: ['sequence', 'null'],
|
|
10505
10697
|
array: true,
|
|
10506
10698
|
},
|
|
10507
10699
|
args: {
|
|
@@ -10725,7 +10917,7 @@ var sequenceReference = {
|
|
|
10725
10917
|
description: 'Returns a sorted sequence of the items in $seq, where the sort order is determined by comparing `(keyfn item)`. If no $comp is supplied, uses builtin `compare`.',
|
|
10726
10918
|
examples: [
|
|
10727
10919
|
'(sort_by ["Albert" "Mojir" "Nina"] count)',
|
|
10728
|
-
'(sort_by "Albert"
|
|
10920
|
+
'(sort_by "Albert" lower_case #(compare %2 %1))',
|
|
10729
10921
|
],
|
|
10730
10922
|
},
|
|
10731
10923
|
distinct: {
|
|
@@ -10990,7 +11182,7 @@ var sequenceReference = {
|
|
|
10990
11182
|
],
|
|
10991
11183
|
description: 'Applies $fn to each value in $seq, splitting it each time $fn returns a new value. Returns an array of sequences.',
|
|
10992
11184
|
examples: [
|
|
10993
|
-
'(partition_by [1 2 3 4 5] #(
|
|
11185
|
+
'(partition_by [1 2 3 4 5] #(== 3 %1))',
|
|
10994
11186
|
'(partition_by [1 1 1 2 2 3 3] odd?)',
|
|
10995
11187
|
'(partition_by "Leeeeeerrroyyy" identity)',
|
|
10996
11188
|
],
|
|
@@ -11096,10 +11288,11 @@ var mathReference = {
|
|
|
11096
11288
|
description: 'Modulus of `dividend` and `divisor`. Truncates toward negative infinity.',
|
|
11097
11289
|
examples: ['(mod 5 3)', '(mod 5.2 3.1)', '(mod -5 3)', '(mod 5 -3)', '(mod -5 -3)'],
|
|
11098
11290
|
},
|
|
11099
|
-
'
|
|
11100
|
-
title: '
|
|
11291
|
+
'%': {
|
|
11292
|
+
title: '%',
|
|
11101
11293
|
category: 'Math',
|
|
11102
|
-
linkName: '
|
|
11294
|
+
linkName: '-percent',
|
|
11295
|
+
clojureDocs: 'rem',
|
|
11103
11296
|
returns: {
|
|
11104
11297
|
type: 'number',
|
|
11105
11298
|
},
|
|
@@ -11115,7 +11308,7 @@ var mathReference = {
|
|
|
11115
11308
|
{ argumentNames: ['a', 'b'] },
|
|
11116
11309
|
],
|
|
11117
11310
|
description: 'Remainder of dividing `dividend` and `divisor`.',
|
|
11118
|
-
examples: ['(
|
|
11311
|
+
examples: ['(% 5 3)', '(% 5.2 3.1)', '(% -5 3)', '(% 5 -3)', '(% -5 -3)'],
|
|
11119
11312
|
},
|
|
11120
11313
|
'quot': {
|
|
11121
11314
|
title: 'quot',
|
|
@@ -11212,10 +11405,10 @@ var mathReference = {
|
|
|
11212
11405
|
description: 'Computes cube root of $x.',
|
|
11213
11406
|
examples: ['(cbrt 0)', '(cbrt 27)', '(cbrt 2)', '(cbrt 1)'],
|
|
11214
11407
|
},
|
|
11215
|
-
'
|
|
11216
|
-
title: '
|
|
11408
|
+
'**': {
|
|
11409
|
+
title: '**',
|
|
11217
11410
|
category: 'Math',
|
|
11218
|
-
linkName: '
|
|
11411
|
+
linkName: '-star-star',
|
|
11219
11412
|
clojureDocs: null,
|
|
11220
11413
|
returns: {
|
|
11221
11414
|
type: 'number',
|
|
@@ -11232,7 +11425,7 @@ var mathReference = {
|
|
|
11232
11425
|
{ argumentNames: ['a', 'b'] },
|
|
11233
11426
|
],
|
|
11234
11427
|
description: 'Computes returns $a raised to the power of $b.',
|
|
11235
|
-
examples: ['(
|
|
11428
|
+
examples: ['(** 2 3)', '(** 2 0)', '(** 2 -3)', '(** -2 3)', '(** -2 -3)'],
|
|
11236
11429
|
},
|
|
11237
11430
|
'exp': {
|
|
11238
11431
|
title: 'exp',
|
|
@@ -11602,7 +11795,7 @@ var mathReference = {
|
|
|
11602
11795
|
{ argumentNames: ['x'] },
|
|
11603
11796
|
],
|
|
11604
11797
|
description: 'Returns the base `2` logarithm of a number.',
|
|
11605
|
-
examples: ['(log2 0.01)', '(log2 (
|
|
11798
|
+
examples: ['(log2 0.01)', '(log2 (** 2 12))', '(log2 2.5)'],
|
|
11606
11799
|
},
|
|
11607
11800
|
'log10': {
|
|
11608
11801
|
title: 'log10',
|
|
@@ -11621,7 +11814,7 @@ var mathReference = {
|
|
|
11621
11814
|
{ argumentNames: ['x'] },
|
|
11622
11815
|
],
|
|
11623
11816
|
description: 'Returns the `10` logarithm of a number.',
|
|
11624
|
-
examples: ['(log10 0.01)', '(log10 (
|
|
11817
|
+
examples: ['(log10 0.01)', '(log10 (** 10 12))', '(log10 2.5)'],
|
|
11625
11818
|
},
|
|
11626
11819
|
'sin': {
|
|
11627
11820
|
title: 'sin',
|
|
@@ -11875,13 +12068,14 @@ var miscReference = {
|
|
|
11875
12068
|
{ argumentNames: ['x'] },
|
|
11876
12069
|
{ argumentNames: ['x', 'ys'] },
|
|
11877
12070
|
],
|
|
11878
|
-
description: 'Result is `true` if no two `values` are equal to each other, otherwise result is `false`. Note that only two argument version result is negation of `=` function, that is `(!= a b)` is same as `(
|
|
12071
|
+
description: 'Result is `true` if no two `values` are equal to each other, otherwise result is `false`. Note that only two argument version result is negation of `=` function, that is `(!= a b)` is same as `(! (== a b))`.',
|
|
11879
12072
|
examples: ['(!= 3)', '(!= 3 2)', '(!= :3 3)', '(!= 3 3 2)', '(!= :3 :2 :1 :0)', '(!= 0 -0)'],
|
|
11880
12073
|
},
|
|
11881
|
-
'
|
|
11882
|
-
title: '
|
|
12074
|
+
'==': {
|
|
12075
|
+
title: '==',
|
|
11883
12076
|
category: 'Misc',
|
|
11884
|
-
linkName: '-equal',
|
|
12077
|
+
linkName: '-equal-equal',
|
|
12078
|
+
clojureDocs: '=',
|
|
11885
12079
|
returns: {
|
|
11886
12080
|
type: 'boolean',
|
|
11887
12081
|
},
|
|
@@ -11899,7 +12093,7 @@ var miscReference = {
|
|
|
11899
12093
|
{ argumentNames: ['x', 'ys'] },
|
|
11900
12094
|
],
|
|
11901
12095
|
description: 'Compares `values` according to \'equal\' predicate. Result is `true` if every specified value is equal to each other, otherwise result is `false`.',
|
|
11902
|
-
examples: ['(
|
|
12096
|
+
examples: ['(== 1 1)', '(== 1.01 1)', '(== :1 1)', '(== :2 :2 :2 :2)', '(== 2 2 1 2)'],
|
|
11903
12097
|
},
|
|
11904
12098
|
'<': {
|
|
11905
12099
|
title: '<',
|
|
@@ -11993,10 +12187,11 @@ var miscReference = {
|
|
|
11993
12187
|
description: 'Returns `true` if the number $x and $ys are in non increasing order, `false` otherwise.',
|
|
11994
12188
|
examples: ['(>= 1 0)', '(>= 1.01 1)', '(>= 1 1)', '(>= 4 3 2 1)', '(>= 3 2 2 1)'],
|
|
11995
12189
|
},
|
|
11996
|
-
'
|
|
11997
|
-
title: '
|
|
12190
|
+
'!': {
|
|
12191
|
+
title: '!',
|
|
11998
12192
|
category: 'Misc',
|
|
11999
|
-
linkName: '
|
|
12193
|
+
linkName: '-exclamation',
|
|
12194
|
+
clojureDocs: 'not',
|
|
12000
12195
|
returns: {
|
|
12001
12196
|
type: 'boolean',
|
|
12002
12197
|
},
|
|
@@ -12009,7 +12204,7 @@ var miscReference = {
|
|
|
12009
12204
|
{ argumentNames: ['x'] },
|
|
12010
12205
|
],
|
|
12011
12206
|
description: 'Computes logical negation. Note that any other $x than `false`, `0`, `nil` and `\'\'` is truthy.',
|
|
12012
|
-
examples: ['(
|
|
12207
|
+
examples: ['(! 3)', '(! true)', '(! "A string")', '(! 0)', '(! false)', '(! nil)', '(! "")'],
|
|
12013
12208
|
},
|
|
12014
12209
|
'write!': {
|
|
12015
12210
|
title: 'write!',
|
|
@@ -12038,25 +12233,10 @@ var miscReference = {
|
|
|
12038
12233
|
'(write! nil true false)',
|
|
12039
12234
|
],
|
|
12040
12235
|
},
|
|
12041
|
-
'
|
|
12042
|
-
title: '
|
|
12236
|
+
'iso_date>epoch': {
|
|
12237
|
+
title: 'iso_date>epoch',
|
|
12043
12238
|
category: 'Misc',
|
|
12044
|
-
linkName: '
|
|
12045
|
-
clojureDocs: 'inst-ms',
|
|
12046
|
-
returns: {
|
|
12047
|
-
type: 'number',
|
|
12048
|
-
},
|
|
12049
|
-
args: {},
|
|
12050
|
-
variants: [
|
|
12051
|
-
{ argumentNames: [] },
|
|
12052
|
-
],
|
|
12053
|
-
description: 'Returns milliseconds elapsed since the UNIX epoch.',
|
|
12054
|
-
examples: ['(inst-ms!)'],
|
|
12055
|
-
},
|
|
12056
|
-
'iso-date-time->inst-ms': {
|
|
12057
|
-
title: 'iso-date-time->inst-ms',
|
|
12058
|
-
category: 'Misc',
|
|
12059
|
-
linkName: 'iso-date-time--gtinst-ms',
|
|
12239
|
+
linkName: 'iso_date-gtepoch',
|
|
12060
12240
|
returns: {
|
|
12061
12241
|
type: 'number',
|
|
12062
12242
|
},
|
|
@@ -12070,14 +12250,14 @@ var miscReference = {
|
|
|
12070
12250
|
],
|
|
12071
12251
|
description: 'Returns milliseconds elapsed since the UNIX epoch to `iso`.',
|
|
12072
12252
|
examples: [
|
|
12073
|
-
'(
|
|
12074
|
-
'(
|
|
12253
|
+
'(iso_date>epoch "2022-04-12T09:37:10.899Z")',
|
|
12254
|
+
'(iso_date>epoch "1980-01-01")',
|
|
12075
12255
|
],
|
|
12076
12256
|
},
|
|
12077
|
-
'
|
|
12078
|
-
title: '
|
|
12257
|
+
'epoch>iso_date': {
|
|
12258
|
+
title: 'epoch>iso_date',
|
|
12079
12259
|
category: 'Misc',
|
|
12080
|
-
linkName: '
|
|
12260
|
+
linkName: 'epoch-gtiso_date',
|
|
12081
12261
|
returns: {
|
|
12082
12262
|
type: 'string',
|
|
12083
12263
|
},
|
|
@@ -12091,8 +12271,8 @@ var miscReference = {
|
|
|
12091
12271
|
],
|
|
12092
12272
|
description: 'Returns IOS date time string from `ms` (milliseconds elapsed since the UNIX epoch).',
|
|
12093
12273
|
examples: [
|
|
12094
|
-
'(
|
|
12095
|
-
'(
|
|
12274
|
+
'(epoch>iso_date 1649756230899)',
|
|
12275
|
+
'(epoch>iso_date 0)',
|
|
12096
12276
|
],
|
|
12097
12277
|
},
|
|
12098
12278
|
'boolean': {
|
|
@@ -12148,34 +12328,6 @@ var miscReference = {
|
|
|
12148
12328
|
'(compare + -)',
|
|
12149
12329
|
],
|
|
12150
12330
|
},
|
|
12151
|
-
'lits-version!': {
|
|
12152
|
-
title: 'lits-version!',
|
|
12153
|
-
category: 'Misc',
|
|
12154
|
-
linkName: 'lits-version-exclamation',
|
|
12155
|
-
returns: {
|
|
12156
|
-
type: 'string',
|
|
12157
|
-
},
|
|
12158
|
-
args: {},
|
|
12159
|
-
variants: [
|
|
12160
|
-
{ argumentNames: [] },
|
|
12161
|
-
],
|
|
12162
|
-
description: 'Returns the lits version.',
|
|
12163
|
-
examples: ['(lits-version!)'],
|
|
12164
|
-
},
|
|
12165
|
-
'uuid!': {
|
|
12166
|
-
title: 'uuid!',
|
|
12167
|
-
category: 'Misc',
|
|
12168
|
-
linkName: 'uuid-exclamation',
|
|
12169
|
-
returns: {
|
|
12170
|
-
type: 'string',
|
|
12171
|
-
},
|
|
12172
|
-
args: {},
|
|
12173
|
-
variants: [
|
|
12174
|
-
{ argumentNames: [] },
|
|
12175
|
-
],
|
|
12176
|
-
description: 'Returns random UUID string.',
|
|
12177
|
-
examples: ['(uuid!)'],
|
|
12178
|
-
},
|
|
12179
12331
|
'equal?': {
|
|
12180
12332
|
title: 'equal?',
|
|
12181
12333
|
category: 'Misc',
|
|
@@ -12201,14 +12353,14 @@ var miscReference = {
|
|
|
12201
12353
|
'(equal? [1 true nil] [1 true nil])',
|
|
12202
12354
|
'(equal? {:a 10 :b [1 2 {:b 20}]} {:b [1 2 {:b 20}] :a 10})',
|
|
12203
12355
|
'(equal? {:a 10 :b [1 2 {:b 20}]} {:b [1 2 {:b 21}] :a 10})',
|
|
12204
|
-
'(
|
|
12356
|
+
'(== 0.3 (+ 0.1 0.2))',
|
|
12205
12357
|
'(equal? 0.3 (+ 0.1 0.2))',
|
|
12206
12358
|
],
|
|
12207
12359
|
},
|
|
12208
|
-
'
|
|
12209
|
-
title: '
|
|
12360
|
+
'json_parse': {
|
|
12361
|
+
title: 'json_parse',
|
|
12210
12362
|
category: 'Misc',
|
|
12211
|
-
linkName: '
|
|
12363
|
+
linkName: 'json_parse',
|
|
12212
12364
|
clojureDocs: null,
|
|
12213
12365
|
returns: {
|
|
12214
12366
|
type: 'any',
|
|
@@ -12223,13 +12375,13 @@ var miscReference = {
|
|
|
12223
12375
|
],
|
|
12224
12376
|
description: 'Returns `JSON.parse(`$x`)`.',
|
|
12225
12377
|
examples: [
|
|
12226
|
-
'(
|
|
12378
|
+
'(json_parse "[1, 2, 3]")',
|
|
12227
12379
|
],
|
|
12228
12380
|
},
|
|
12229
|
-
'
|
|
12230
|
-
title: '
|
|
12381
|
+
'json_stringify': {
|
|
12382
|
+
title: 'json_stringify',
|
|
12231
12383
|
category: 'Misc',
|
|
12232
|
-
linkName: '
|
|
12384
|
+
linkName: 'json_stringify',
|
|
12233
12385
|
clojureDocs: null,
|
|
12234
12386
|
returns: {
|
|
12235
12387
|
type: 'string',
|
|
@@ -12249,8 +12401,8 @@ var miscReference = {
|
|
|
12249
12401
|
],
|
|
12250
12402
|
description: 'Returns `JSON.stringify(`$x`)`. If second argument is provided, returns `JSON.stringify(`$x`, null, `$indent`)`.',
|
|
12251
12403
|
examples: [
|
|
12252
|
-
'(
|
|
12253
|
-
'(
|
|
12404
|
+
'(json_stringify [1, 2, 3])',
|
|
12405
|
+
'(json_stringify {:a {:b 10}} 2)',
|
|
12254
12406
|
],
|
|
12255
12407
|
},
|
|
12256
12408
|
};
|
|
@@ -12282,7 +12434,7 @@ var assertReference = { 'assert': {
|
|
|
12282
12434
|
linkName: 'assert-equal',
|
|
12283
12435
|
clojureDocs: null,
|
|
12284
12436
|
returns: {
|
|
12285
|
-
type: '
|
|
12437
|
+
type: 'null',
|
|
12286
12438
|
},
|
|
12287
12439
|
args: {
|
|
12288
12440
|
a: {
|
|
@@ -12311,7 +12463,7 @@ var assertReference = { 'assert': {
|
|
|
12311
12463
|
linkName: 'assert-exclamation-equal',
|
|
12312
12464
|
clojureDocs: null,
|
|
12313
12465
|
returns: {
|
|
12314
|
-
type: '
|
|
12466
|
+
type: 'null',
|
|
12315
12467
|
},
|
|
12316
12468
|
args: {
|
|
12317
12469
|
a: {
|
|
@@ -12340,7 +12492,7 @@ var assertReference = { 'assert': {
|
|
|
12340
12492
|
linkName: 'assert_equal',
|
|
12341
12493
|
clojureDocs: null,
|
|
12342
12494
|
returns: {
|
|
12343
|
-
type: '
|
|
12495
|
+
type: 'null',
|
|
12344
12496
|
},
|
|
12345
12497
|
args: {
|
|
12346
12498
|
a: {
|
|
@@ -12369,7 +12521,7 @@ var assertReference = { 'assert': {
|
|
|
12369
12521
|
linkName: 'assert_not_equal',
|
|
12370
12522
|
clojureDocs: null,
|
|
12371
12523
|
returns: {
|
|
12372
|
-
type: '
|
|
12524
|
+
type: 'null',
|
|
12373
12525
|
},
|
|
12374
12526
|
args: {
|
|
12375
12527
|
a: {
|
|
@@ -12398,7 +12550,7 @@ var assertReference = { 'assert': {
|
|
|
12398
12550
|
linkName: 'assert_gt',
|
|
12399
12551
|
clojureDocs: null,
|
|
12400
12552
|
returns: {
|
|
12401
|
-
type: '
|
|
12553
|
+
type: 'null',
|
|
12402
12554
|
},
|
|
12403
12555
|
args: {
|
|
12404
12556
|
a: {
|
|
@@ -12427,7 +12579,7 @@ var assertReference = { 'assert': {
|
|
|
12427
12579
|
linkName: 'assert_lt',
|
|
12428
12580
|
clojureDocs: null,
|
|
12429
12581
|
returns: {
|
|
12430
|
-
type: '
|
|
12582
|
+
type: 'null',
|
|
12431
12583
|
},
|
|
12432
12584
|
args: {
|
|
12433
12585
|
a: {
|
|
@@ -12456,7 +12608,7 @@ var assertReference = { 'assert': {
|
|
|
12456
12608
|
linkName: 'assert_gte',
|
|
12457
12609
|
clojureDocs: null,
|
|
12458
12610
|
returns: {
|
|
12459
|
-
type: '
|
|
12611
|
+
type: 'null',
|
|
12460
12612
|
},
|
|
12461
12613
|
args: {
|
|
12462
12614
|
a: {
|
|
@@ -12485,7 +12637,7 @@ var assertReference = { 'assert': {
|
|
|
12485
12637
|
linkName: 'assert_lte',
|
|
12486
12638
|
clojureDocs: null,
|
|
12487
12639
|
returns: {
|
|
12488
|
-
type: '
|
|
12640
|
+
type: 'null',
|
|
12489
12641
|
},
|
|
12490
12642
|
args: {
|
|
12491
12643
|
a: {
|
|
@@ -12514,7 +12666,7 @@ var assertReference = { 'assert': {
|
|
|
12514
12666
|
linkName: 'assert_true',
|
|
12515
12667
|
clojureDocs: null,
|
|
12516
12668
|
returns: {
|
|
12517
|
-
type: '
|
|
12669
|
+
type: 'null',
|
|
12518
12670
|
},
|
|
12519
12671
|
args: {
|
|
12520
12672
|
value: {
|
|
@@ -12540,7 +12692,7 @@ var assertReference = { 'assert': {
|
|
|
12540
12692
|
linkName: 'assert_false',
|
|
12541
12693
|
clojureDocs: null,
|
|
12542
12694
|
returns: {
|
|
12543
|
-
type: '
|
|
12695
|
+
type: 'null',
|
|
12544
12696
|
},
|
|
12545
12697
|
args: {
|
|
12546
12698
|
value: {
|
|
@@ -12566,7 +12718,7 @@ var assertReference = { 'assert': {
|
|
|
12566
12718
|
linkName: 'assert_truthy',
|
|
12567
12719
|
clojureDocs: null,
|
|
12568
12720
|
returns: {
|
|
12569
|
-
type: '
|
|
12721
|
+
type: 'null',
|
|
12570
12722
|
},
|
|
12571
12723
|
args: {
|
|
12572
12724
|
value: {
|
|
@@ -12599,7 +12751,7 @@ var assertReference = { 'assert': {
|
|
|
12599
12751
|
linkName: 'assert_falsy',
|
|
12600
12752
|
clojureDocs: null,
|
|
12601
12753
|
returns: {
|
|
12602
|
-
type: '
|
|
12754
|
+
type: 'null',
|
|
12603
12755
|
},
|
|
12604
12756
|
args: {
|
|
12605
12757
|
value: {
|
|
@@ -12631,7 +12783,7 @@ var assertReference = { 'assert': {
|
|
|
12631
12783
|
linkName: 'assert_null',
|
|
12632
12784
|
clojureDocs: null,
|
|
12633
12785
|
returns: {
|
|
12634
|
-
type: '
|
|
12786
|
+
type: 'null',
|
|
12635
12787
|
},
|
|
12636
12788
|
args: {
|
|
12637
12789
|
value: {
|
|
@@ -12663,7 +12815,7 @@ var assertReference = { 'assert': {
|
|
|
12663
12815
|
linkName: 'assert_throws',
|
|
12664
12816
|
clojureDocs: null,
|
|
12665
12817
|
returns: {
|
|
12666
|
-
type: '
|
|
12818
|
+
type: 'null',
|
|
12667
12819
|
},
|
|
12668
12820
|
args: {
|
|
12669
12821
|
fn: {
|
|
@@ -12685,7 +12837,7 @@ var assertReference = { 'assert': {
|
|
|
12685
12837
|
linkName: 'assert_throws_error',
|
|
12686
12838
|
clojureDocs: null,
|
|
12687
12839
|
returns: {
|
|
12688
|
-
type: '
|
|
12840
|
+
type: 'null',
|
|
12689
12841
|
},
|
|
12690
12842
|
args: {
|
|
12691
12843
|
'fn': {
|
|
@@ -12714,7 +12866,7 @@ var assertReference = { 'assert': {
|
|
|
12714
12866
|
linkName: 'assert_not_throws',
|
|
12715
12867
|
clojureDocs: null,
|
|
12716
12868
|
returns: {
|
|
12717
|
-
type: '
|
|
12869
|
+
type: 'null',
|
|
12718
12870
|
},
|
|
12719
12871
|
args: {
|
|
12720
12872
|
fn: {
|
|
@@ -12733,7 +12885,7 @@ var assertReference = { 'assert': {
|
|
|
12733
12885
|
} };
|
|
12734
12886
|
|
|
12735
12887
|
var objectReference = {
|
|
12736
|
-
|
|
12888
|
+
dissoc: {
|
|
12737
12889
|
title: 'dissoc',
|
|
12738
12890
|
category: 'Object',
|
|
12739
12891
|
linkName: 'dissoc',
|
|
@@ -12758,7 +12910,7 @@ var objectReference = {
|
|
|
12758
12910
|
"\n(def o { :a 5 }) (dissoc o :a)\no",
|
|
12759
12911
|
],
|
|
12760
12912
|
},
|
|
12761
|
-
|
|
12913
|
+
object: {
|
|
12762
12914
|
title: 'object',
|
|
12763
12915
|
category: 'Object',
|
|
12764
12916
|
linkName: 'object',
|
|
@@ -12784,7 +12936,7 @@ var objectReference = {
|
|
|
12784
12936
|
'{:a 1 :b 2}',
|
|
12785
12937
|
],
|
|
12786
12938
|
},
|
|
12787
|
-
|
|
12939
|
+
keys: {
|
|
12788
12940
|
title: 'keys',
|
|
12789
12941
|
category: 'Object',
|
|
12790
12942
|
linkName: 'keys',
|
|
@@ -12806,7 +12958,7 @@ var objectReference = {
|
|
|
12806
12958
|
'(keys (object :x 10 :y true :z "A string"))',
|
|
12807
12959
|
],
|
|
12808
12960
|
},
|
|
12809
|
-
|
|
12961
|
+
vals: {
|
|
12810
12962
|
title: 'vals',
|
|
12811
12963
|
category: 'Object',
|
|
12812
12964
|
linkName: 'vals',
|
|
@@ -12828,7 +12980,7 @@ var objectReference = {
|
|
|
12828
12980
|
'(vals (object :x 10 :y true :z "A string"))',
|
|
12829
12981
|
],
|
|
12830
12982
|
},
|
|
12831
|
-
|
|
12983
|
+
entries: {
|
|
12832
12984
|
title: 'entries',
|
|
12833
12985
|
category: 'Object',
|
|
12834
12986
|
linkName: 'entries',
|
|
@@ -12850,12 +13002,12 @@ var objectReference = {
|
|
|
12850
13002
|
'(entries (object :x 10 :y true :z "A string"))',
|
|
12851
13003
|
],
|
|
12852
13004
|
},
|
|
12853
|
-
|
|
13005
|
+
find: {
|
|
12854
13006
|
title: 'find',
|
|
12855
13007
|
category: 'Object',
|
|
12856
13008
|
linkName: 'find',
|
|
12857
13009
|
returns: {
|
|
12858
|
-
type: ['array', '
|
|
13010
|
+
type: ['array', 'null'],
|
|
12859
13011
|
},
|
|
12860
13012
|
args: {
|
|
12861
13013
|
obj: {
|
|
@@ -12874,7 +13026,7 @@ var objectReference = {
|
|
|
12874
13026
|
'(find (object :a 1 :b 2) :c)',
|
|
12875
13027
|
],
|
|
12876
13028
|
},
|
|
12877
|
-
|
|
13029
|
+
merge: {
|
|
12878
13030
|
title: 'merge',
|
|
12879
13031
|
category: 'Object',
|
|
12880
13032
|
linkName: 'merge',
|
|
@@ -12896,10 +13048,10 @@ var objectReference = {
|
|
|
12896
13048
|
'(merge (object :x 10) (object :x 15 :y 20))',
|
|
12897
13049
|
],
|
|
12898
13050
|
},
|
|
12899
|
-
|
|
12900
|
-
title: '
|
|
13051
|
+
merge_with: {
|
|
13052
|
+
title: 'merge_with',
|
|
12901
13053
|
category: 'Object',
|
|
12902
|
-
linkName: '
|
|
13054
|
+
linkName: 'merge_with',
|
|
12903
13055
|
returns: {
|
|
12904
13056
|
type: 'object',
|
|
12905
13057
|
},
|
|
@@ -12917,12 +13069,12 @@ var objectReference = {
|
|
|
12917
13069
|
],
|
|
12918
13070
|
description: "\nReturns a new object created by merging together all arguments.\nIf two keys appears in more than one object $fn is used to calculate the new value.\n\nIf no arguments are provided `nil` is returned.",
|
|
12919
13071
|
examples: [
|
|
12920
|
-
'(
|
|
12921
|
-
'(
|
|
12922
|
-
'(
|
|
13072
|
+
'(merge_with (object :x 10) (object :y 20) +)',
|
|
13073
|
+
'(merge_with (object :x 10) (object :x 15 :y 20) +)',
|
|
13074
|
+
'(merge_with (object :x 10) (object :x 20) (object :x 30) (object :x 40) -)',
|
|
12923
13075
|
],
|
|
12924
13076
|
},
|
|
12925
|
-
|
|
13077
|
+
zipmap: {
|
|
12926
13078
|
title: 'zipmap',
|
|
12927
13079
|
category: 'Object',
|
|
12928
13080
|
linkName: 'zipmap',
|
|
@@ -12949,10 +13101,10 @@ var objectReference = {
|
|
|
12949
13101
|
'(zipmap [] [10 nil [1 2 3]])',
|
|
12950
13102
|
],
|
|
12951
13103
|
},
|
|
12952
|
-
|
|
12953
|
-
title: '
|
|
13104
|
+
select_keys: {
|
|
13105
|
+
title: 'select_keys',
|
|
12954
13106
|
category: 'Object',
|
|
12955
|
-
linkName: '
|
|
13107
|
+
linkName: 'select_keys',
|
|
12956
13108
|
returns: {
|
|
12957
13109
|
type: 'object',
|
|
12958
13110
|
},
|
|
@@ -12970,8 +13122,8 @@ var objectReference = {
|
|
|
12970
13122
|
],
|
|
12971
13123
|
description: 'Returns an object containing only those entries in $obj whose key is in $keys.',
|
|
12972
13124
|
examples: [
|
|
12973
|
-
'(
|
|
12974
|
-
'(
|
|
13125
|
+
'(select_keys {:a 1 :b 2 :c 3} [:a :b])',
|
|
13126
|
+
'(select_keys {:a 1} [:a :b])',
|
|
12975
13127
|
],
|
|
12976
13128
|
},
|
|
12977
13129
|
};
|
|
@@ -13420,7 +13572,7 @@ var predicateReference = {
|
|
|
13420
13572
|
variants: [
|
|
13421
13573
|
{ argumentNames: ['x'] },
|
|
13422
13574
|
],
|
|
13423
|
-
description: 'Returns `true` if $x is NaN (
|
|
13575
|
+
description: 'Returns `true` if $x is NaN (! a number), otherwise `false`.',
|
|
13424
13576
|
examples: [
|
|
13425
13577
|
'(nan? 1.0)',
|
|
13426
13578
|
'(nan? (/ 1 0))',
|
|
@@ -13531,7 +13683,7 @@ var predicateReference = {
|
|
|
13531
13683
|
},
|
|
13532
13684
|
args: {
|
|
13533
13685
|
x: {
|
|
13534
|
-
type: ['collection', 'string', '
|
|
13686
|
+
type: ['collection', 'string', 'null'],
|
|
13535
13687
|
},
|
|
13536
13688
|
},
|
|
13537
13689
|
variants: [
|
|
@@ -13558,7 +13710,7 @@ var predicateReference = {
|
|
|
13558
13710
|
},
|
|
13559
13711
|
args: {
|
|
13560
13712
|
x: {
|
|
13561
|
-
type: ['collection', 'string', '
|
|
13713
|
+
type: ['collection', 'string', 'null'],
|
|
13562
13714
|
},
|
|
13563
13715
|
},
|
|
13564
13716
|
variants: [
|
|
@@ -13670,10 +13822,10 @@ var regularExpressionReference = {
|
|
|
13670
13822
|
};
|
|
13671
13823
|
|
|
13672
13824
|
var specialExpressionsReference = {
|
|
13673
|
-
'
|
|
13674
|
-
title: '
|
|
13825
|
+
'&&': {
|
|
13826
|
+
title: '&&',
|
|
13675
13827
|
category: 'Special expression',
|
|
13676
|
-
linkName: 'and',
|
|
13828
|
+
linkName: '-and-and',
|
|
13677
13829
|
returns: {
|
|
13678
13830
|
type: 'boolean',
|
|
13679
13831
|
},
|
|
@@ -13686,19 +13838,20 @@ var specialExpressionsReference = {
|
|
|
13686
13838
|
variants: [
|
|
13687
13839
|
{ argumentNames: ['expressions'] },
|
|
13688
13840
|
],
|
|
13689
|
-
description: "\nComputes logical `and
|
|
13841
|
+
description: "\nComputes logical `and`. Evaluation of $expressions starts from left.\nAs soon as a `expression` evaluates to a falsy value, the result is returned.\n\nIf all expressions evaluate to truthy values, the value of the last expression is returned.",
|
|
13690
13842
|
examples: [
|
|
13691
|
-
'(
|
|
13692
|
-
'(
|
|
13693
|
-
'(
|
|
13694
|
-
'(
|
|
13695
|
-
'(
|
|
13843
|
+
'(&& 1 1)',
|
|
13844
|
+
'(&& (> 3 2) "string")',
|
|
13845
|
+
'(&& (< 3 2) "string")',
|
|
13846
|
+
'(&& true true true true)',
|
|
13847
|
+
'(&& true true 0 true)',
|
|
13696
13848
|
],
|
|
13697
13849
|
},
|
|
13698
|
-
'
|
|
13699
|
-
title: '
|
|
13850
|
+
'||': {
|
|
13851
|
+
title: '||',
|
|
13700
13852
|
category: 'Special expression',
|
|
13701
|
-
linkName: 'or',
|
|
13853
|
+
linkName: '-or-or',
|
|
13854
|
+
clojureDocs: 'or',
|
|
13702
13855
|
returns: {
|
|
13703
13856
|
type: 'boolean',
|
|
13704
13857
|
},
|
|
@@ -13711,13 +13864,13 @@ var specialExpressionsReference = {
|
|
|
13711
13864
|
variants: [
|
|
13712
13865
|
{ argumentNames: ['expressions'] },
|
|
13713
13866
|
],
|
|
13714
|
-
description: "\nComputes logical `or
|
|
13867
|
+
description: "\nComputes logical `or`. Evaluation of $expressions evaluation starts from left.\nAs soon as a `expression` evaluates to a truthy value, the result is returned.\n\nIf all expressions evaluate to falsy values, the value of the last expression is returned.",
|
|
13715
13868
|
examples: [
|
|
13716
|
-
'(
|
|
13717
|
-
'(
|
|
13718
|
-
'(
|
|
13719
|
-
'(
|
|
13720
|
-
'(
|
|
13869
|
+
'(|| 1 1)',
|
|
13870
|
+
'(|| (> 3 2) "string")',
|
|
13871
|
+
'(|| (< 3 2) "string")',
|
|
13872
|
+
'(|| true true true true)',
|
|
13873
|
+
'(|| 1 2 3 4)',
|
|
13721
13874
|
],
|
|
13722
13875
|
},
|
|
13723
13876
|
'def': {
|
|
@@ -13793,10 +13946,10 @@ var specialExpressionsReference = {
|
|
|
13793
13946
|
description: "\nBinds local variables. The variables lives only within $expressions.\nIt returns evaluation of the last expression in $expressions.",
|
|
13794
13947
|
examples: ["\n (let [a (+ 1 2 3 4) \n b (* 1 2 3 4)]\n (write! a b))"],
|
|
13795
13948
|
},
|
|
13796
|
-
'
|
|
13797
|
-
title: '
|
|
13949
|
+
'if_let': {
|
|
13950
|
+
title: 'if_let',
|
|
13798
13951
|
category: 'Special expression',
|
|
13799
|
-
linkName: '
|
|
13952
|
+
linkName: 'if_let',
|
|
13800
13953
|
returns: {
|
|
13801
13954
|
type: 'any',
|
|
13802
13955
|
},
|
|
@@ -13817,14 +13970,14 @@ var specialExpressionsReference = {
|
|
|
13817
13970
|
],
|
|
13818
13971
|
description: "\nBinds one local variable. If it evaluates to a truthy value\n$then-expr is executed with the variable accessable.\nIf the bound variable evaluates to false, the $else-expr is evaluated\n(without variable accessable).",
|
|
13819
13972
|
examples: [
|
|
13820
|
-
"\n(
|
|
13821
|
-
"\n(
|
|
13973
|
+
"\n(if_let [a (> (count \"Albert\") 4)]\n (write! (str a \", is big enough\"))\n (write! \"Sorry, not big enough.\"))",
|
|
13974
|
+
"\n(if_let [a (> (count \"Albert\") 10)]\n (write! (str a \", is big enough\"))\n (write! \"Sorry, not big enough.\"))",
|
|
13822
13975
|
],
|
|
13823
13976
|
},
|
|
13824
|
-
'
|
|
13825
|
-
title: '
|
|
13977
|
+
'when_let': {
|
|
13978
|
+
title: 'when_let',
|
|
13826
13979
|
category: 'Special expression',
|
|
13827
|
-
linkName: '
|
|
13980
|
+
linkName: 'when_let',
|
|
13828
13981
|
returns: {
|
|
13829
13982
|
type: 'any',
|
|
13830
13983
|
},
|
|
@@ -13842,13 +13995,13 @@ var specialExpressionsReference = {
|
|
|
13842
13995
|
],
|
|
13843
13996
|
description: "\nBinds one local variable. If it evaluates to a truthy value\n$expressions is executed with the variable accessable.\nIf the bound variable evaluates to a falsy value, `nil` is returned.",
|
|
13844
13997
|
examples: [
|
|
13845
|
-
"\n(
|
|
13998
|
+
"\n(when_let [a (> (count \"Albert\") 4)]\n (write! a))",
|
|
13846
13999
|
],
|
|
13847
14000
|
},
|
|
13848
|
-
'
|
|
13849
|
-
title: '
|
|
14001
|
+
'when_first': {
|
|
14002
|
+
title: 'when_first',
|
|
13850
14003
|
category: 'Special expression',
|
|
13851
|
-
linkName: '
|
|
14004
|
+
linkName: 'when_first',
|
|
13852
14005
|
returns: {
|
|
13853
14006
|
type: 'any',
|
|
13854
14007
|
},
|
|
@@ -13867,11 +14020,11 @@ var specialExpressionsReference = {
|
|
|
13867
14020
|
],
|
|
13868
14021
|
description: 'When the binding value in $binding is a non empty sequence, the first element of that sequence (instead of the sequence itself) is bound to the variable.',
|
|
13869
14022
|
examples: [
|
|
13870
|
-
"\n(
|
|
13871
|
-
"\n(
|
|
13872
|
-
"\n(
|
|
13873
|
-
"\n(
|
|
13874
|
-
"\n(
|
|
14023
|
+
"\n(when_first [x [1 2 3]]\n (write! x)\n x)",
|
|
14024
|
+
"\n(when_first [x \"Albert\"]\n (write! x)\n x)",
|
|
14025
|
+
"\n(when_first [x [0]]\n (write! x)\n x)",
|
|
14026
|
+
"\n(when_first [x [nil]]\n (write! x)\n x)",
|
|
14027
|
+
"\n(when_first [x []]\n (write! x)\n x)",
|
|
13875
14028
|
],
|
|
13876
14029
|
},
|
|
13877
14030
|
'fn': {
|
|
@@ -14036,10 +14189,10 @@ var specialExpressionsReference = {
|
|
|
14036
14189
|
'(if false (write! "TRUE"))',
|
|
14037
14190
|
],
|
|
14038
14191
|
},
|
|
14039
|
-
'
|
|
14040
|
-
title: '
|
|
14192
|
+
'if_not': {
|
|
14193
|
+
title: 'if_not',
|
|
14041
14194
|
category: 'Special expression',
|
|
14042
|
-
linkName: '
|
|
14195
|
+
linkName: 'if_not',
|
|
14043
14196
|
returns: {
|
|
14044
14197
|
type: 'any',
|
|
14045
14198
|
},
|
|
@@ -14060,10 +14213,10 @@ var specialExpressionsReference = {
|
|
|
14060
14213
|
],
|
|
14061
14214
|
description: 'Either $then-expr or $else-expr branch is taken. $then-expr is selected when $test is falsy. If $test is truthy $else-expr is executed, if no $else-expr exists, `nil` is returned.',
|
|
14062
14215
|
examples: [
|
|
14063
|
-
'(
|
|
14064
|
-
'(
|
|
14065
|
-
'(
|
|
14066
|
-
'(
|
|
14216
|
+
'(if_not true (write! "TRUE") (write! "FALSE"))',
|
|
14217
|
+
'(if_not false (write! "TRUE") (write! "FALSE"))',
|
|
14218
|
+
'(if_not true (write! "TRUE"))',
|
|
14219
|
+
'(if_not false (write! "TRUE"))',
|
|
14067
14220
|
],
|
|
14068
14221
|
},
|
|
14069
14222
|
'cond': {
|
|
@@ -14088,6 +14241,31 @@ var specialExpressionsReference = {
|
|
|
14088
14241
|
"\n(cond\n false (write! \"FALSE\")\n nil (write! \"nil\"))",
|
|
14089
14242
|
],
|
|
14090
14243
|
},
|
|
14244
|
+
'switch': {
|
|
14245
|
+
title: 'switch',
|
|
14246
|
+
category: 'Special expression',
|
|
14247
|
+
linkName: 'switch',
|
|
14248
|
+
returns: {
|
|
14249
|
+
type: 'any',
|
|
14250
|
+
},
|
|
14251
|
+
args: {
|
|
14252
|
+
value: {
|
|
14253
|
+
type: 'any',
|
|
14254
|
+
},
|
|
14255
|
+
conds: {
|
|
14256
|
+
type: '*conditions',
|
|
14257
|
+
},
|
|
14258
|
+
},
|
|
14259
|
+
variants: [
|
|
14260
|
+
{ argumentNames: ['value', 'conds'] },
|
|
14261
|
+
],
|
|
14262
|
+
description: 'Used for branching. $conds are tested sequentially from the top against $value. If no branch is tested truthy, `nil` is returned.',
|
|
14263
|
+
examples: [
|
|
14264
|
+
"\n(switch 1\n 1 (write! \"FALSE\")\n 2 (write! \"nil\"))",
|
|
14265
|
+
"\n(switch 2\n 1 (write! \"FALSE\")\n 2 (write! \"nil\"))",
|
|
14266
|
+
"\n(switch 3\n 1 (write! \"FALSE\")\n 2 (write! \"nil\"))",
|
|
14267
|
+
],
|
|
14268
|
+
},
|
|
14091
14269
|
'when': {
|
|
14092
14270
|
title: 'when',
|
|
14093
14271
|
category: 'Special expression',
|
|
@@ -14115,10 +14293,10 @@ var specialExpressionsReference = {
|
|
|
14115
14293
|
'(when false)',
|
|
14116
14294
|
],
|
|
14117
14295
|
},
|
|
14118
|
-
'
|
|
14119
|
-
title: '
|
|
14296
|
+
'when_not': {
|
|
14297
|
+
title: 'when_not',
|
|
14120
14298
|
category: 'Special expression',
|
|
14121
|
-
linkName: '
|
|
14299
|
+
linkName: 'when_not',
|
|
14122
14300
|
returns: {
|
|
14123
14301
|
type: 'any',
|
|
14124
14302
|
},
|
|
@@ -14136,10 +14314,10 @@ var specialExpressionsReference = {
|
|
|
14136
14314
|
],
|
|
14137
14315
|
description: "If $test yields a falsy value, the expressions are evaluated\nand the value returned by the last `expression` is returned.\nOtherwise, if $test yields a truthy value, the $expressions are not evaluated,\nand `nil` is returned. If no `expression` is provided, `nil` is returned.",
|
|
14138
14316
|
examples: [
|
|
14139
|
-
'(
|
|
14140
|
-
'(
|
|
14141
|
-
'(
|
|
14142
|
-
'(
|
|
14317
|
+
'(when_not true (write! "Hi") (write! "There"))',
|
|
14318
|
+
'(when_not false (write! "Hi") (write! "There"))',
|
|
14319
|
+
'(when_not true)',
|
|
14320
|
+
'(when_not false)',
|
|
14143
14321
|
],
|
|
14144
14322
|
},
|
|
14145
14323
|
'comment': {
|
|
@@ -14147,7 +14325,7 @@ var specialExpressionsReference = {
|
|
|
14147
14325
|
category: 'Special expression',
|
|
14148
14326
|
linkName: 'comment',
|
|
14149
14327
|
returns: {
|
|
14150
|
-
type: '
|
|
14328
|
+
type: 'null',
|
|
14151
14329
|
},
|
|
14152
14330
|
args: {
|
|
14153
14331
|
expressions: {
|
|
@@ -14188,7 +14366,7 @@ var specialExpressionsReference = {
|
|
|
14188
14366
|
category: 'Special expression',
|
|
14189
14367
|
linkName: 'recur',
|
|
14190
14368
|
returns: {
|
|
14191
|
-
type: '
|
|
14369
|
+
type: 'null',
|
|
14192
14370
|
},
|
|
14193
14371
|
args: {
|
|
14194
14372
|
expressions: {
|
|
@@ -14201,9 +14379,9 @@ var specialExpressionsReference = {
|
|
|
14201
14379
|
],
|
|
14202
14380
|
description: 'Recursevly calls enclosing function or loop with its evaluated $expressions.',
|
|
14203
14381
|
examples: [
|
|
14204
|
-
"\n(defn foo [n]\n (write! n)\n (when (
|
|
14205
|
-
"\n(\n (fn [n]\n (write! n)\n (when (
|
|
14206
|
-
"\n(\n loop [n 3]\n (write! n)\n (when\n (
|
|
14382
|
+
"\n(defn foo [n]\n (write! n)\n (when (! (zero? n))\n (recur\n (dec n))))\n(foo 3)",
|
|
14383
|
+
"\n(\n (fn [n]\n (write! n)\n (when (! (zero? n))\n (recur\n (dec n))))\n 3)",
|
|
14384
|
+
"\n(\n loop [n 3]\n (write! n)\n (when\n (! (zero? n))\n (recur (dec n))))",
|
|
14207
14385
|
],
|
|
14208
14386
|
},
|
|
14209
14387
|
'loop': {
|
|
@@ -14228,35 +14406,16 @@ var specialExpressionsReference = {
|
|
|
14228
14406
|
],
|
|
14229
14407
|
description: 'Executes $expressions with initial $bindings. The $bindings will be replaced with the recur parameters for subsequent recursions.',
|
|
14230
14408
|
examples: [
|
|
14231
|
-
"\n(loop [n 3]\n (write! n)\n (when\n (
|
|
14232
|
-
"\n(loop [n 3]\n (write! n)\n (if\n (
|
|
14409
|
+
"\n(loop [n 3]\n (write! n)\n (when\n (! (zero? n))\n (recur (dec n))))",
|
|
14410
|
+
"\n(loop [n 3]\n (write! n)\n (if\n (! (zero? n))\n (recur (dec n))\n n))",
|
|
14233
14411
|
],
|
|
14234
14412
|
},
|
|
14235
|
-
'time!': {
|
|
14236
|
-
title: 'time!',
|
|
14237
|
-
category: 'Special expression',
|
|
14238
|
-
linkName: 'time-exclamation',
|
|
14239
|
-
clojureDocs: 'time',
|
|
14240
|
-
returns: {
|
|
14241
|
-
type: 'any',
|
|
14242
|
-
},
|
|
14243
|
-
args: {
|
|
14244
|
-
expression: {
|
|
14245
|
-
type: '*expression',
|
|
14246
|
-
},
|
|
14247
|
-
},
|
|
14248
|
-
variants: [
|
|
14249
|
-
{ argumentNames: ['expression'] },
|
|
14250
|
-
],
|
|
14251
|
-
description: 'Prints the time it took to evaluate $expression. Returns $expression evaluated.',
|
|
14252
|
-
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))"],
|
|
14253
|
-
},
|
|
14254
14413
|
'doseq': {
|
|
14255
14414
|
title: 'doseq',
|
|
14256
14415
|
category: 'Special expression',
|
|
14257
14416
|
linkName: 'doseq',
|
|
14258
14417
|
returns: {
|
|
14259
|
-
type: '
|
|
14418
|
+
type: 'null',
|
|
14260
14419
|
},
|
|
14261
14420
|
args: {
|
|
14262
14421
|
bindings: {
|
|
@@ -14396,10 +14555,10 @@ var stringReference = {
|
|
|
14396
14555
|
'(subs "A string" 100)',
|
|
14397
14556
|
],
|
|
14398
14557
|
},
|
|
14399
|
-
'
|
|
14400
|
-
title: '
|
|
14558
|
+
'string_repeat': {
|
|
14559
|
+
title: 'string_repeat',
|
|
14401
14560
|
category: 'String',
|
|
14402
|
-
linkName: '
|
|
14561
|
+
linkName: 'string_repeat',
|
|
14403
14562
|
clojureDocs: null,
|
|
14404
14563
|
returns: {
|
|
14405
14564
|
type: 'number',
|
|
@@ -14417,8 +14576,8 @@ var stringReference = {
|
|
|
14417
14576
|
],
|
|
14418
14577
|
description: 'Repeates $s $n times.',
|
|
14419
14578
|
examples: [
|
|
14420
|
-
'(
|
|
14421
|
-
'(
|
|
14579
|
+
'(string_repeat "*" 10)',
|
|
14580
|
+
'(string_repeat "***" 0)',
|
|
14422
14581
|
],
|
|
14423
14582
|
},
|
|
14424
14583
|
'str': {
|
|
@@ -14468,41 +14627,10 @@ var stringReference = {
|
|
|
14468
14627
|
'(number "-1.01")',
|
|
14469
14628
|
],
|
|
14470
14629
|
},
|
|
14471
|
-
'
|
|
14472
|
-
title: '
|
|
14473
|
-
category: 'String',
|
|
14474
|
-
linkName: 'number-to-string',
|
|
14475
|
-
clojureDocs: null,
|
|
14476
|
-
returns: {
|
|
14477
|
-
type: 'string',
|
|
14478
|
-
},
|
|
14479
|
-
args: {
|
|
14480
|
-
n: {
|
|
14481
|
-
type: 'number',
|
|
14482
|
-
},
|
|
14483
|
-
base: {
|
|
14484
|
-
type: 'number',
|
|
14485
|
-
description: '2, 8, 10 or 16',
|
|
14486
|
-
},
|
|
14487
|
-
},
|
|
14488
|
-
variants: [
|
|
14489
|
-
{ argumentNames: ['n'] },
|
|
14490
|
-
{ argumentNames: ['n', 'base'] },
|
|
14491
|
-
],
|
|
14492
|
-
description: 'Converts $n to a string. If $base is not equal to `10`, $n must be a non negative integer.',
|
|
14493
|
-
examples: [
|
|
14494
|
-
'(number-to-string 10)',
|
|
14495
|
-
'(number-to-string -1.01)',
|
|
14496
|
-
'(number-to-string -.01)',
|
|
14497
|
-
'(number-to-string 15 2)',
|
|
14498
|
-
'(number-to-string 15 8)',
|
|
14499
|
-
'(number-to-string 15 16)',
|
|
14500
|
-
],
|
|
14501
|
-
},
|
|
14502
|
-
'lower-case': {
|
|
14503
|
-
title: 'lower-case',
|
|
14630
|
+
'lower_case': {
|
|
14631
|
+
title: 'lower_case',
|
|
14504
14632
|
category: 'String',
|
|
14505
|
-
linkName: '
|
|
14633
|
+
linkName: 'lower_case',
|
|
14506
14634
|
returns: {
|
|
14507
14635
|
type: 'string',
|
|
14508
14636
|
},
|
|
@@ -14516,14 +14644,14 @@ var stringReference = {
|
|
|
14516
14644
|
],
|
|
14517
14645
|
description: 'Returns $s converted to lower case.',
|
|
14518
14646
|
examples: [
|
|
14519
|
-
'(
|
|
14520
|
-
'(
|
|
14647
|
+
'(lower_case "Albert")',
|
|
14648
|
+
'(lower_case "")',
|
|
14521
14649
|
],
|
|
14522
14650
|
},
|
|
14523
|
-
'
|
|
14524
|
-
title: '
|
|
14651
|
+
'upper_case': {
|
|
14652
|
+
title: 'upper_case',
|
|
14525
14653
|
category: 'String',
|
|
14526
|
-
linkName: '
|
|
14654
|
+
linkName: 'upper_case',
|
|
14527
14655
|
clojureDocs: null,
|
|
14528
14656
|
returns: {
|
|
14529
14657
|
type: 'string',
|
|
@@ -14538,8 +14666,8 @@ var stringReference = {
|
|
|
14538
14666
|
],
|
|
14539
14667
|
description: 'Returns $s converted to upper case.',
|
|
14540
14668
|
examples: [
|
|
14541
|
-
'(
|
|
14542
|
-
'(
|
|
14669
|
+
'(upper_case "Albert")',
|
|
14670
|
+
'(upper_case "")',
|
|
14543
14671
|
],
|
|
14544
14672
|
},
|
|
14545
14673
|
'trim': {
|
|
@@ -14565,10 +14693,10 @@ var stringReference = {
|
|
|
14565
14693
|
'(trim "")',
|
|
14566
14694
|
],
|
|
14567
14695
|
},
|
|
14568
|
-
'
|
|
14569
|
-
title: '
|
|
14696
|
+
'trim_left': {
|
|
14697
|
+
title: 'trim_left',
|
|
14570
14698
|
category: 'String',
|
|
14571
|
-
linkName: '
|
|
14699
|
+
linkName: 'trim_left',
|
|
14572
14700
|
clojureDocs: null,
|
|
14573
14701
|
returns: {
|
|
14574
14702
|
type: 'string',
|
|
@@ -14583,15 +14711,15 @@ var stringReference = {
|
|
|
14583
14711
|
],
|
|
14584
14712
|
description: 'Returns a new string with leading whitespaces removed.',
|
|
14585
14713
|
examples: [
|
|
14586
|
-
'(
|
|
14587
|
-
'(
|
|
14588
|
-
'(
|
|
14714
|
+
'(trim_left " Albert ")',
|
|
14715
|
+
'(trim_left " ")',
|
|
14716
|
+
'(trim_left "")',
|
|
14589
14717
|
],
|
|
14590
14718
|
},
|
|
14591
|
-
'
|
|
14592
|
-
title: '
|
|
14719
|
+
'trim_right': {
|
|
14720
|
+
title: 'trim_right',
|
|
14593
14721
|
category: 'String',
|
|
14594
|
-
linkName: '
|
|
14722
|
+
linkName: 'trim_right',
|
|
14595
14723
|
clojureDocs: null,
|
|
14596
14724
|
returns: {
|
|
14597
14725
|
type: 'string',
|
|
@@ -14606,15 +14734,15 @@ var stringReference = {
|
|
|
14606
14734
|
],
|
|
14607
14735
|
description: 'Returns a new string with trailing whitespaces removed.',
|
|
14608
14736
|
examples: [
|
|
14609
|
-
'(
|
|
14610
|
-
'(
|
|
14611
|
-
'(
|
|
14737
|
+
'(trim_right " Albert ")',
|
|
14738
|
+
'(trim_right " ")',
|
|
14739
|
+
'(trim_right "")',
|
|
14612
14740
|
],
|
|
14613
14741
|
},
|
|
14614
|
-
'
|
|
14615
|
-
title: '
|
|
14742
|
+
'pad_left': {
|
|
14743
|
+
title: 'pad_left',
|
|
14616
14744
|
category: 'String',
|
|
14617
|
-
linkName: '
|
|
14745
|
+
linkName: 'pad_left',
|
|
14618
14746
|
clojureDocs: null,
|
|
14619
14747
|
returns: {
|
|
14620
14748
|
type: 'string',
|
|
@@ -14636,16 +14764,16 @@ var stringReference = {
|
|
|
14636
14764
|
],
|
|
14637
14765
|
description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given $length.',
|
|
14638
14766
|
examples: [
|
|
14639
|
-
'(
|
|
14640
|
-
'(
|
|
14641
|
-
'(
|
|
14642
|
-
'(
|
|
14767
|
+
'(pad_left "Albert" 20)',
|
|
14768
|
+
'(pad_left "Albert" 20 "-*-")',
|
|
14769
|
+
'(pad_left "Albert" 5)',
|
|
14770
|
+
'(pad_left "Albert" -1)',
|
|
14643
14771
|
],
|
|
14644
14772
|
},
|
|
14645
|
-
'
|
|
14646
|
-
title: '
|
|
14773
|
+
'pad_right': {
|
|
14774
|
+
title: 'pad_right',
|
|
14647
14775
|
category: 'String',
|
|
14648
|
-
linkName: '
|
|
14776
|
+
linkName: 'pad_right',
|
|
14649
14777
|
clojureDocs: null,
|
|
14650
14778
|
returns: {
|
|
14651
14779
|
type: 'string',
|
|
@@ -14667,10 +14795,10 @@ var stringReference = {
|
|
|
14667
14795
|
],
|
|
14668
14796
|
description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given `length`.',
|
|
14669
14797
|
examples: [
|
|
14670
|
-
'(
|
|
14671
|
-
'(
|
|
14672
|
-
'(
|
|
14673
|
-
'(
|
|
14798
|
+
'(pad_right "Albert" 20)',
|
|
14799
|
+
'(pad_right "Albert" 20 "-*-")',
|
|
14800
|
+
'(pad_right "Albert" 5)',
|
|
14801
|
+
'(pad_right "Albert" -1)',
|
|
14674
14802
|
],
|
|
14675
14803
|
},
|
|
14676
14804
|
'split': {
|
|
@@ -14741,10 +14869,10 @@ var stringReference = {
|
|
|
14741
14869
|
'(template "No book||||One book||||Two books||||Three books||||$1 books" 4)',
|
|
14742
14870
|
],
|
|
14743
14871
|
},
|
|
14744
|
-
'
|
|
14745
|
-
title: '
|
|
14872
|
+
'to_char_code': {
|
|
14873
|
+
title: 'to_char_code',
|
|
14746
14874
|
category: 'String',
|
|
14747
|
-
linkName: '
|
|
14875
|
+
linkName: 'to_char_code',
|
|
14748
14876
|
clojureDocs: null,
|
|
14749
14877
|
returns: {
|
|
14750
14878
|
type: 'number',
|
|
@@ -14759,14 +14887,14 @@ var stringReference = {
|
|
|
14759
14887
|
],
|
|
14760
14888
|
description: 'Return code point for first character in $c.',
|
|
14761
14889
|
examples: [
|
|
14762
|
-
'(
|
|
14763
|
-
'(
|
|
14890
|
+
'(to_char_code :A)',
|
|
14891
|
+
'(to_char_code "Albert")',
|
|
14764
14892
|
],
|
|
14765
14893
|
},
|
|
14766
|
-
'
|
|
14767
|
-
title: '
|
|
14894
|
+
'from_char_code': {
|
|
14895
|
+
title: 'from_char_code',
|
|
14768
14896
|
category: 'String',
|
|
14769
|
-
linkName: '
|
|
14897
|
+
linkName: 'from_char_code',
|
|
14770
14898
|
clojureDocs: null,
|
|
14771
14899
|
returns: {
|
|
14772
14900
|
type: 'string',
|
|
@@ -14781,14 +14909,14 @@ var stringReference = {
|
|
|
14781
14909
|
],
|
|
14782
14910
|
description: 'Return character for code point $code.',
|
|
14783
14911
|
examples: [
|
|
14784
|
-
'(
|
|
14785
|
-
'(
|
|
14912
|
+
'(from_char_code 65)',
|
|
14913
|
+
'(from_char_code 0)',
|
|
14786
14914
|
],
|
|
14787
14915
|
},
|
|
14788
|
-
'
|
|
14789
|
-
title: '
|
|
14916
|
+
'encode_base64': {
|
|
14917
|
+
title: 'encode_base64',
|
|
14790
14918
|
category: 'String',
|
|
14791
|
-
linkName: '
|
|
14919
|
+
linkName: 'encode_base64',
|
|
14792
14920
|
clojureDocs: null,
|
|
14793
14921
|
returns: {
|
|
14794
14922
|
type: 'string',
|
|
@@ -14803,13 +14931,13 @@ var stringReference = {
|
|
|
14803
14931
|
],
|
|
14804
14932
|
description: 'Returns a Base64 encoded string from $s.',
|
|
14805
14933
|
examples: [
|
|
14806
|
-
'(
|
|
14934
|
+
'(encode_base64 "Albert")',
|
|
14807
14935
|
],
|
|
14808
14936
|
},
|
|
14809
|
-
'
|
|
14810
|
-
title: '
|
|
14937
|
+
'decode_base64': {
|
|
14938
|
+
title: 'decode_base64',
|
|
14811
14939
|
category: 'String',
|
|
14812
|
-
linkName: '
|
|
14940
|
+
linkName: 'decode_base64',
|
|
14813
14941
|
clojureDocs: null,
|
|
14814
14942
|
returns: {
|
|
14815
14943
|
type: 'string',
|
|
@@ -14824,13 +14952,13 @@ var stringReference = {
|
|
|
14824
14952
|
],
|
|
14825
14953
|
description: 'Returns a Base64 decoded string from $base64string.',
|
|
14826
14954
|
examples: [
|
|
14827
|
-
'(
|
|
14955
|
+
'(decode_base64 "QWxiZXJ0IPCfkLs=")',
|
|
14828
14956
|
],
|
|
14829
14957
|
},
|
|
14830
|
-
'
|
|
14831
|
-
title: '
|
|
14958
|
+
'encode_uri_component': {
|
|
14959
|
+
title: 'encode_uri_component',
|
|
14832
14960
|
category: 'String',
|
|
14833
|
-
linkName: '
|
|
14961
|
+
linkName: 'encode_uri_component',
|
|
14834
14962
|
clojureDocs: null,
|
|
14835
14963
|
returns: {
|
|
14836
14964
|
type: 'string',
|
|
@@ -14845,13 +14973,13 @@ var stringReference = {
|
|
|
14845
14973
|
],
|
|
14846
14974
|
description: 'Returns an escaped `URI` string.',
|
|
14847
14975
|
examples: [
|
|
14848
|
-
'(
|
|
14976
|
+
'(encode_uri_component "Hi everyone!?")',
|
|
14849
14977
|
],
|
|
14850
14978
|
},
|
|
14851
|
-
'
|
|
14852
|
-
title: '
|
|
14979
|
+
'decode_uri_component': {
|
|
14980
|
+
title: 'decode_uri_component',
|
|
14853
14981
|
category: 'String',
|
|
14854
|
-
linkName: '
|
|
14982
|
+
linkName: 'decode_uri_component',
|
|
14855
14983
|
clojureDocs: null,
|
|
14856
14984
|
returns: {
|
|
14857
14985
|
type: 'string',
|
|
@@ -14866,7 +14994,7 @@ var stringReference = {
|
|
|
14866
14994
|
],
|
|
14867
14995
|
description: 'Returns an un-escaped `URI` string.',
|
|
14868
14996
|
examples: [
|
|
14869
|
-
'(
|
|
14997
|
+
'(decode_uri_component "Hi%20everyone!%3F%20%F0%9F%91%8D")',
|
|
14870
14998
|
],
|
|
14871
14999
|
},
|
|
14872
15000
|
'join': {
|
|
@@ -14891,15 +15019,42 @@ var stringReference = {
|
|
|
14891
15019
|
description: 'Returns a new string by concatenating all of the elements in $arr, separated by $delimiter.',
|
|
14892
15020
|
examples: [
|
|
14893
15021
|
'(join ["Albert" "Mojir"] " ")',
|
|
14894
|
-
'(join (map
|
|
15022
|
+
'(join (map [0 1 2 3 4 5 6 7 8 9] str) ", ")',
|
|
15023
|
+
],
|
|
15024
|
+
},
|
|
15025
|
+
'++': {
|
|
15026
|
+
title: '++',
|
|
15027
|
+
category: 'String',
|
|
15028
|
+
linkName: '-plus-plus',
|
|
15029
|
+
clojureDocs: null,
|
|
15030
|
+
returns: {
|
|
15031
|
+
type: 'string',
|
|
15032
|
+
},
|
|
15033
|
+
args: {
|
|
15034
|
+
strings: {
|
|
15035
|
+
type: ['string', 'number', 'null'],
|
|
15036
|
+
rest: true,
|
|
15037
|
+
},
|
|
15038
|
+
},
|
|
15039
|
+
variants: [{
|
|
15040
|
+
argumentNames: ['strings'],
|
|
15041
|
+
}],
|
|
15042
|
+
description: 'Concatenats $strings into one string.',
|
|
15043
|
+
examples: [
|
|
15044
|
+
'(++ "Albert" " " "Mojir")',
|
|
15045
|
+
'(++ "Albert" "Mojir")',
|
|
15046
|
+
'(++ "Albert" null "Mojir")',
|
|
15047
|
+
'(++ "Albert")',
|
|
15048
|
+
'(++)',
|
|
14895
15049
|
],
|
|
14896
15050
|
},
|
|
14897
15051
|
};
|
|
14898
15052
|
|
|
14899
|
-
var bitwiseReference = { '
|
|
14900
|
-
title: '
|
|
15053
|
+
var bitwiseReference = { '<<': {
|
|
15054
|
+
title: '<<',
|
|
14901
15055
|
category: 'Bitwise',
|
|
14902
|
-
linkName: '
|
|
15056
|
+
linkName: '-lt-lt',
|
|
15057
|
+
clojureDocs: 'bit-shift-left',
|
|
14903
15058
|
returns: {
|
|
14904
15059
|
type: 'integer',
|
|
14905
15060
|
},
|
|
@@ -14915,11 +15070,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
14915
15070
|
{ argumentNames: ['x', 'n'] },
|
|
14916
15071
|
],
|
|
14917
15072
|
description: 'Shifts $x arithmetically left by $n bit positions.',
|
|
14918
|
-
examples: ['(
|
|
14919
|
-
}, '
|
|
14920
|
-
title: '
|
|
15073
|
+
examples: ['(<< 1 10)', '(<< -4 2)'],
|
|
15074
|
+
}, '>>': {
|
|
15075
|
+
title: '>>',
|
|
14921
15076
|
category: 'Bitwise',
|
|
14922
|
-
linkName: '
|
|
15077
|
+
linkName: '-gt-gt',
|
|
15078
|
+
clojureDocs: 'bit-shift-right',
|
|
14923
15079
|
returns: {
|
|
14924
15080
|
type: 'integer',
|
|
14925
15081
|
},
|
|
@@ -14935,11 +15091,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
14935
15091
|
{ argumentNames: ['x', 'n'] },
|
|
14936
15092
|
],
|
|
14937
15093
|
description: 'Shifts $x arithmetically right by $n bit positions.',
|
|
14938
|
-
examples: ['(
|
|
14939
|
-
}, '
|
|
14940
|
-
title: '
|
|
15094
|
+
examples: ['(>> 2048 10)', '(>> 4 10)'],
|
|
15095
|
+
}, '>>>': {
|
|
15096
|
+
title: '>>>',
|
|
14941
15097
|
category: 'Bitwise',
|
|
14942
|
-
linkName: '
|
|
15098
|
+
linkName: '-gt-gt-gt',
|
|
15099
|
+
clojureDocs: 'unsigned-bit-shift-right',
|
|
14943
15100
|
returns: {
|
|
14944
15101
|
type: 'integer',
|
|
14945
15102
|
},
|
|
@@ -14955,11 +15112,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
14955
15112
|
{ argumentNames: ['x', 'n'] },
|
|
14956
15113
|
],
|
|
14957
15114
|
description: 'Shifts $x arithmetically right by $n bit positions without sign extension.',
|
|
14958
|
-
examples: ['(
|
|
14959
|
-
}, '
|
|
14960
|
-
title: '
|
|
15115
|
+
examples: ['(>>> 2048 10)', '(>>> 4 10)', '(>>> -1 10)'],
|
|
15116
|
+
}, '~': {
|
|
15117
|
+
title: '~',
|
|
14961
15118
|
category: 'Bitwise',
|
|
14962
|
-
linkName: '
|
|
15119
|
+
linkName: '-tilde',
|
|
15120
|
+
clojureDocs: 'bit-not',
|
|
14963
15121
|
returns: {
|
|
14964
15122
|
type: 'integer',
|
|
14965
15123
|
},
|
|
@@ -14972,11 +15130,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
14972
15130
|
{ argumentNames: ['x'] },
|
|
14973
15131
|
],
|
|
14974
15132
|
description: 'Returns bitwise `not` of $x.',
|
|
14975
|
-
examples: ['(
|
|
14976
|
-
}, '
|
|
14977
|
-
title: '
|
|
15133
|
+
examples: ['(~ 0)', '(~ 255)'],
|
|
15134
|
+
}, '&': {
|
|
15135
|
+
title: '&',
|
|
14978
15136
|
category: 'Bitwise',
|
|
14979
|
-
linkName: '
|
|
15137
|
+
linkName: '-and',
|
|
15138
|
+
clojureDocs: 'bit-and',
|
|
14980
15139
|
returns: {
|
|
14981
15140
|
type: 'integer',
|
|
14982
15141
|
},
|
|
@@ -14998,13 +15157,14 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
14998
15157
|
],
|
|
14999
15158
|
description: 'Returns bitwise `and` of all arguments.',
|
|
15000
15159
|
examples: [
|
|
15001
|
-
'(
|
|
15002
|
-
'(
|
|
15160
|
+
'(& 0b0011 0b0110)',
|
|
15161
|
+
'(& 0b0011 0b0110 0b1001)',
|
|
15003
15162
|
],
|
|
15004
|
-
}, '
|
|
15005
|
-
title: '
|
|
15163
|
+
}, '&!': {
|
|
15164
|
+
title: '&!',
|
|
15006
15165
|
category: 'Bitwise',
|
|
15007
|
-
linkName: '
|
|
15166
|
+
linkName: '-and-exclamation',
|
|
15167
|
+
clojureDocs: 'bit-and-not',
|
|
15008
15168
|
returns: {
|
|
15009
15169
|
type: 'integer',
|
|
15010
15170
|
},
|
|
@@ -15025,11 +15185,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15025
15185
|
{ argumentNames: ['x', 'y', 'rest'] },
|
|
15026
15186
|
],
|
|
15027
15187
|
description: 'Returns bitwise `and` with complement.',
|
|
15028
|
-
examples: ['(
|
|
15029
|
-
}, '
|
|
15030
|
-
title: '
|
|
15188
|
+
examples: ['(&! 0b0011 0b0110)', '(&! 0b0011 0b0110 0b1001)'],
|
|
15189
|
+
}, '|': {
|
|
15190
|
+
title: '|',
|
|
15031
15191
|
category: 'Bitwise',
|
|
15032
|
-
linkName: '
|
|
15192
|
+
linkName: '-or',
|
|
15193
|
+
clojureDocs: 'bit-or',
|
|
15033
15194
|
returns: {
|
|
15034
15195
|
type: 'integer',
|
|
15035
15196
|
},
|
|
@@ -15050,11 +15211,12 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15050
15211
|
{ argumentNames: ['x', 'y', 'rest'] },
|
|
15051
15212
|
],
|
|
15052
15213
|
description: 'Returns bitwise `or` of all arguments.',
|
|
15053
|
-
examples: ['(
|
|
15054
|
-
}, '
|
|
15055
|
-
title: '
|
|
15214
|
+
examples: ['(| 0b0011 0b0110)', '(| 0b1000 0b0100 0b0010)'],
|
|
15215
|
+
}, '^': {
|
|
15216
|
+
title: '^',
|
|
15056
15217
|
category: 'Bitwise',
|
|
15057
|
-
linkName: '
|
|
15218
|
+
linkName: '-caret',
|
|
15219
|
+
clojureDocs: 'bit-xor',
|
|
15058
15220
|
returns: {
|
|
15059
15221
|
type: 'integer',
|
|
15060
15222
|
},
|
|
@@ -15075,11 +15237,11 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15075
15237
|
{ argumentNames: ['x', 'y', 'rest'] },
|
|
15076
15238
|
],
|
|
15077
15239
|
description: 'Returns bitwise `xor` of all arguments.',
|
|
15078
|
-
examples: ['(
|
|
15079
|
-
}, '
|
|
15080
|
-
title: '
|
|
15240
|
+
examples: ['(^ 0b0011 0b0110)', '(^ 0b11110000 0b00111100 0b10101010)'],
|
|
15241
|
+
}, 'bit_flip': {
|
|
15242
|
+
title: 'bit_flip',
|
|
15081
15243
|
category: 'Bitwise',
|
|
15082
|
-
linkName: '
|
|
15244
|
+
linkName: 'bit_flip',
|
|
15083
15245
|
returns: {
|
|
15084
15246
|
type: 'integer',
|
|
15085
15247
|
},
|
|
@@ -15095,11 +15257,11 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15095
15257
|
{ argumentNames: ['x', 'n'] },
|
|
15096
15258
|
],
|
|
15097
15259
|
description: 'Flips bit number $n.',
|
|
15098
|
-
examples: ['(
|
|
15099
|
-
}, '
|
|
15100
|
-
title: '
|
|
15260
|
+
examples: ['(bit_flip 0b0011 1)', '(bit_flip 0b1100 1)'],
|
|
15261
|
+
}, 'bit_clear': {
|
|
15262
|
+
title: 'bit_clear',
|
|
15101
15263
|
category: 'Bitwise',
|
|
15102
|
-
linkName: '
|
|
15264
|
+
linkName: 'bit_clear',
|
|
15103
15265
|
returns: {
|
|
15104
15266
|
type: 'integer',
|
|
15105
15267
|
},
|
|
@@ -15115,11 +15277,11 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15115
15277
|
{ argumentNames: ['x', 'n'] },
|
|
15116
15278
|
],
|
|
15117
15279
|
description: 'Clears bit number $n.',
|
|
15118
|
-
examples: ['(
|
|
15119
|
-
}, '
|
|
15120
|
-
title: '
|
|
15280
|
+
examples: ['(bit_clear 0b0011 1)', '(bit_clear 0b1100 1)'],
|
|
15281
|
+
}, 'bit_set': {
|
|
15282
|
+
title: 'bit_set',
|
|
15121
15283
|
category: 'Bitwise',
|
|
15122
|
-
linkName: '
|
|
15284
|
+
linkName: 'bit_set',
|
|
15123
15285
|
returns: {
|
|
15124
15286
|
type: 'integer',
|
|
15125
15287
|
},
|
|
@@ -15135,11 +15297,11 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15135
15297
|
{ argumentNames: ['x', 'n'] },
|
|
15136
15298
|
],
|
|
15137
15299
|
description: 'Sets bit number $n.',
|
|
15138
|
-
examples: ['(
|
|
15139
|
-
}, '
|
|
15140
|
-
title: '
|
|
15300
|
+
examples: ['(bit_set 0b0011 1)', '(bit_set 0b1100 1)'],
|
|
15301
|
+
}, 'bit_test': {
|
|
15302
|
+
title: 'bit_test',
|
|
15141
15303
|
category: 'Bitwise',
|
|
15142
|
-
linkName: '
|
|
15304
|
+
linkName: 'bit_test',
|
|
15143
15305
|
returns: {
|
|
15144
15306
|
type: 'boolean',
|
|
15145
15307
|
},
|
|
@@ -15155,7 +15317,7 @@ var bitwiseReference = { 'bit-shift-left': {
|
|
|
15155
15317
|
{ argumentNames: ['x', 'n'] },
|
|
15156
15318
|
],
|
|
15157
15319
|
description: 'Checks if bit number $n is set.',
|
|
15158
|
-
examples: ['(
|
|
15320
|
+
examples: ['(bit_test 0b0011 1)', '(bit_test 0b1100 1)'],
|
|
15159
15321
|
} };
|
|
15160
15322
|
|
|
15161
15323
|
var shorthand = {
|
|
@@ -15471,13 +15633,13 @@ var api = {
|
|
|
15471
15633
|
'*',
|
|
15472
15634
|
'/',
|
|
15473
15635
|
'mod',
|
|
15474
|
-
'
|
|
15636
|
+
'%',
|
|
15475
15637
|
'quot',
|
|
15476
15638
|
'inc',
|
|
15477
15639
|
'dec',
|
|
15478
15640
|
'sqrt',
|
|
15479
15641
|
'cbrt',
|
|
15480
|
-
'
|
|
15642
|
+
'**',
|
|
15481
15643
|
'exp',
|
|
15482
15644
|
'round',
|
|
15483
15645
|
'trunc',
|
|
@@ -15527,23 +15689,20 @@ var api = {
|
|
|
15527
15689
|
],
|
|
15528
15690
|
misc: [
|
|
15529
15691
|
'!=',
|
|
15530
|
-
'
|
|
15692
|
+
'==',
|
|
15531
15693
|
'<',
|
|
15532
15694
|
'>',
|
|
15533
15695
|
'<=',
|
|
15534
15696
|
'>=',
|
|
15535
|
-
'
|
|
15697
|
+
'!',
|
|
15536
15698
|
'write!',
|
|
15537
|
-
'
|
|
15538
|
-
'
|
|
15539
|
-
'inst-ms->iso-date-time',
|
|
15699
|
+
'iso_date>epoch',
|
|
15700
|
+
'epoch>iso_date',
|
|
15540
15701
|
'boolean',
|
|
15541
15702
|
'compare',
|
|
15542
|
-
'lits-version!',
|
|
15543
|
-
'uuid!',
|
|
15544
15703
|
'equal?',
|
|
15545
|
-
'
|
|
15546
|
-
'
|
|
15704
|
+
'json_parse',
|
|
15705
|
+
'json_stringify',
|
|
15547
15706
|
],
|
|
15548
15707
|
object: [
|
|
15549
15708
|
'dissoc',
|
|
@@ -15553,9 +15712,9 @@ var api = {
|
|
|
15553
15712
|
'entries',
|
|
15554
15713
|
'find',
|
|
15555
15714
|
'merge',
|
|
15556
|
-
'
|
|
15715
|
+
'merge_with',
|
|
15557
15716
|
'zipmap',
|
|
15558
|
-
'
|
|
15717
|
+
'select_keys',
|
|
15559
15718
|
],
|
|
15560
15719
|
predicate: [
|
|
15561
15720
|
'boolean?',
|
|
@@ -15589,29 +15748,29 @@ var api = {
|
|
|
15589
15748
|
'replace',
|
|
15590
15749
|
],
|
|
15591
15750
|
specialExpressions: [
|
|
15592
|
-
'
|
|
15593
|
-
'
|
|
15751
|
+
'&&',
|
|
15752
|
+
'||',
|
|
15594
15753
|
'def',
|
|
15595
15754
|
'defs',
|
|
15596
15755
|
'let',
|
|
15597
|
-
'
|
|
15598
|
-
'
|
|
15599
|
-
'
|
|
15756
|
+
'if_let',
|
|
15757
|
+
'when_let',
|
|
15758
|
+
'when_first',
|
|
15600
15759
|
'fn',
|
|
15601
15760
|
'defn',
|
|
15602
15761
|
'defns',
|
|
15603
15762
|
'try',
|
|
15604
15763
|
'throw',
|
|
15605
15764
|
'if',
|
|
15606
|
-
'
|
|
15765
|
+
'if_not',
|
|
15607
15766
|
'cond',
|
|
15767
|
+
'switch',
|
|
15608
15768
|
'when',
|
|
15609
|
-
'
|
|
15769
|
+
'when_not',
|
|
15610
15770
|
'comment',
|
|
15611
15771
|
'do',
|
|
15612
15772
|
'recur',
|
|
15613
15773
|
'loop',
|
|
15614
|
-
'time!',
|
|
15615
15774
|
'doseq',
|
|
15616
15775
|
'for',
|
|
15617
15776
|
'declared?',
|
|
@@ -15619,40 +15778,40 @@ var api = {
|
|
|
15619
15778
|
],
|
|
15620
15779
|
string: [
|
|
15621
15780
|
'subs',
|
|
15622
|
-
'
|
|
15781
|
+
'string_repeat',
|
|
15623
15782
|
'str',
|
|
15624
15783
|
'number',
|
|
15625
|
-
'
|
|
15626
|
-
'
|
|
15627
|
-
'upper-case',
|
|
15784
|
+
'lower_case',
|
|
15785
|
+
'upper_case',
|
|
15628
15786
|
'trim',
|
|
15629
|
-
'
|
|
15630
|
-
'
|
|
15631
|
-
'
|
|
15632
|
-
'
|
|
15787
|
+
'trim_left',
|
|
15788
|
+
'trim_right',
|
|
15789
|
+
'pad_left',
|
|
15790
|
+
'pad_right',
|
|
15633
15791
|
'split',
|
|
15634
15792
|
'template',
|
|
15635
|
-
'
|
|
15636
|
-
'
|
|
15637
|
-
'
|
|
15638
|
-
'
|
|
15639
|
-
'
|
|
15640
|
-
'
|
|
15793
|
+
'to_char_code',
|
|
15794
|
+
'from_char_code',
|
|
15795
|
+
'encode_base64',
|
|
15796
|
+
'decode_base64',
|
|
15797
|
+
'encode_uri_component',
|
|
15798
|
+
'decode_uri_component',
|
|
15641
15799
|
'join',
|
|
15800
|
+
'++',
|
|
15642
15801
|
],
|
|
15643
15802
|
bitwise: [
|
|
15644
|
-
'
|
|
15645
|
-
'
|
|
15646
|
-
'
|
|
15647
|
-
'
|
|
15648
|
-
'
|
|
15649
|
-
'
|
|
15650
|
-
'
|
|
15651
|
-
'
|
|
15652
|
-
'
|
|
15653
|
-
'
|
|
15654
|
-
'
|
|
15655
|
-
'
|
|
15803
|
+
'<<',
|
|
15804
|
+
'>>',
|
|
15805
|
+
'>>>',
|
|
15806
|
+
'~',
|
|
15807
|
+
'&',
|
|
15808
|
+
'&!',
|
|
15809
|
+
'|',
|
|
15810
|
+
'^',
|
|
15811
|
+
'bit_flip',
|
|
15812
|
+
'bit_clear',
|
|
15813
|
+
'bit_set',
|
|
15814
|
+
'bit_test',
|
|
15656
15815
|
],
|
|
15657
15816
|
assert: [
|
|
15658
15817
|
'assert',
|