affinirum 1.2.8 → 1.3.1
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/README.md +17 -17
- package/dst/Affinirum.js +19 -15
- package/dst/Constants.js +10 -10
- package/dst/Functions.js +10 -10
- package/dst/ParserState.js +6 -6
- package/dst/atom/FunctionAtom.js +5 -2
- package/dst/cjs/Affinirum.js +19 -15
- package/dst/cjs/Constants.js +10 -10
- package/dst/cjs/Functions.js +10 -10
- package/dst/cjs/ParserState.js +6 -6
- package/dst/cjs/atom/FunctionAtom.js +5 -2
- package/dst/{constant → native}/notation/JSON.d.ts +1 -1
- package/package.json +7 -6
- /package/dst/cjs/{constant → native}/Aggregable.js +0 -0
- /package/dst/cjs/{constant → native}/Array.js +0 -0
- /package/dst/cjs/{constant → native}/Boolean.js +0 -0
- /package/dst/cjs/{constant → native}/Buffer.js +0 -0
- /package/dst/cjs/{constant → native}/Enumerable.js +0 -0
- /package/dst/cjs/{constant → native}/Float.js +0 -0
- /package/dst/cjs/{constant → native}/Integer.js +0 -0
- /package/dst/cjs/{constant → native}/Iterable.js +0 -0
- /package/dst/cjs/{constant → native}/Number.js +0 -0
- /package/dst/cjs/{constant → native}/Object.js +0 -0
- /package/dst/cjs/{constant → native}/String.js +0 -0
- /package/dst/cjs/{constant → native}/Timestamp.js +0 -0
- /package/dst/cjs/{constant → native}/Unknown.js +0 -0
- /package/dst/cjs/{constant → native}/notation/AN.js +0 -0
- /package/dst/cjs/{constant → native}/notation/JSON.js +0 -0
- /package/dst/{constant → native}/Aggregable.d.ts +0 -0
- /package/dst/{constant → native}/Aggregable.js +0 -0
- /package/dst/{constant → native}/Array.d.ts +0 -0
- /package/dst/{constant → native}/Array.js +0 -0
- /package/dst/{constant → native}/Boolean.d.ts +0 -0
- /package/dst/{constant → native}/Boolean.js +0 -0
- /package/dst/{constant → native}/Buffer.d.ts +0 -0
- /package/dst/{constant → native}/Buffer.js +0 -0
- /package/dst/{constant → native}/Enumerable.d.ts +0 -0
- /package/dst/{constant → native}/Enumerable.js +0 -0
- /package/dst/{constant → native}/Float.d.ts +0 -0
- /package/dst/{constant → native}/Float.js +0 -0
- /package/dst/{constant → native}/Integer.d.ts +0 -0
- /package/dst/{constant → native}/Integer.js +0 -0
- /package/dst/{constant → native}/Iterable.d.ts +0 -0
- /package/dst/{constant → native}/Iterable.js +0 -0
- /package/dst/{constant → native}/Number.d.ts +0 -0
- /package/dst/{constant → native}/Number.js +0 -0
- /package/dst/{constant → native}/Object.d.ts +0 -0
- /package/dst/{constant → native}/Object.js +0 -0
- /package/dst/{constant → native}/String.d.ts +0 -0
- /package/dst/{constant → native}/String.js +0 -0
- /package/dst/{constant → native}/Timestamp.d.ts +0 -0
- /package/dst/{constant → native}/Timestamp.js +0 -0
- /package/dst/{constant → native}/Unknown.d.ts +0 -0
- /package/dst/{constant → native}/Unknown.js +0 -0
- /package/dst/{constant → native}/notation/AN.d.ts +0 -0
- /package/dst/{constant → native}/notation/AN.js +0 -0
- /package/dst/{constant → native}/notation/JSON.js +0 -0
package/README.md
CHANGED
|
@@ -126,8 +126,8 @@ Unknown or variant type is declared as **??**.
|
|
|
126
126
|
### Predefined Constants
|
|
127
127
|
|
|
128
128
|
#### Boolean
|
|
129
|
-
- **boolean Boolean.Or(values
|
|
130
|
-
- **boolean Boolean.And(values: array
|
|
129
|
+
- **boolean Boolean.Or(values:...array)** — Boolean disjunction
|
|
130
|
+
- **boolean Boolean.And(values: ...array)** — Boolean conjunction
|
|
131
131
|
- **boolean Boolean.Not(value: boolean)** — Boolean negation
|
|
132
132
|
- **boolean? Boolean.Decode(value: buffer, offset: integer?)** — Decode boolean from buffer
|
|
133
133
|
- **boolean? Boolean.Parse()** — Parse boolean from string
|
|
@@ -143,9 +143,9 @@ Unknown or variant type is declared as **??**.
|
|
|
143
143
|
- **Float.PositiveInfinity** — Positive infinity
|
|
144
144
|
- **Float.NegativeInfinity** — Negative infinity
|
|
145
145
|
- **Float.Epsilon** — Smallest positive float
|
|
146
|
-
- **float Float.Sum(values: array
|
|
147
|
-
- **float Float.Min(values: array
|
|
148
|
-
- **float Float.Max(values: array
|
|
146
|
+
- **float Float.Sum(values: ...array)** — Numeric sum
|
|
147
|
+
- **float Float.Min(values: ...array)** — Numeric minimum
|
|
148
|
+
- **float Float.Max(values: ...array)** — Numeric maximum
|
|
149
149
|
- **float Float.Exponent()** — Exponent
|
|
150
150
|
- **float Float.Logarithm()** — Logarithm
|
|
151
151
|
- **float Float.Abs()** — Absolute value
|
|
@@ -158,9 +158,9 @@ Unknown or variant type is declared as **??**.
|
|
|
158
158
|
- **float? Float.Parse(value: string)** — Parse float from string
|
|
159
159
|
|
|
160
160
|
#### Integer
|
|
161
|
-
- **integer Integer.Sum(values: array
|
|
162
|
-
- **integer Integer.Min(values: array
|
|
163
|
-
- **integer Integer.Max(values: array
|
|
161
|
+
- **integer Integer.Sum(values: ...array)** — Numeric sum
|
|
162
|
+
- **integer Integer.Min(values: ...array)** — Numeric minimum
|
|
163
|
+
- **integer Integer.Max(values: ...array)** — Numeric maximum
|
|
164
164
|
- **integer Integer.Random(exclusiveTo: integer)** — Random integer up to value
|
|
165
165
|
- **integer? Integer.Decode(value: buffer, encoding: string, offset: integer?)** — Decode integer from buffer
|
|
166
166
|
- **integer? Integer.Parse(value: string)** — Parse integer from string
|
|
@@ -174,14 +174,14 @@ Unknown or variant type is declared as **??**.
|
|
|
174
174
|
- **buffer? Buffer.Parse(value: string)** — Parse buffer from hexadecimal string
|
|
175
175
|
|
|
176
176
|
#### Array
|
|
177
|
-
- **array Array.Join(values: array
|
|
177
|
+
- **array Array.Join(values: ...array)** — Join arrays of any depths into a single array
|
|
178
178
|
- **array Array.Range(inclusiveFrom: integer, exclusiveTo: integer)** — New array filled with integers in range
|
|
179
179
|
- **array Array.Unique()** — Array of unique values
|
|
180
180
|
- **array Array.Intersection(a1: array, a2: array)** — Common values from two arrays
|
|
181
181
|
- **array Array.Difference(a1: array, a2: array)** — Symmetrical difference between arrays
|
|
182
182
|
|
|
183
183
|
#### Object
|
|
184
|
-
- **object Object.Merge(values: array
|
|
184
|
+
- **object Object.Merge(values: ...array)** — Merge multiple objects
|
|
185
185
|
|
|
186
186
|
#### AN
|
|
187
187
|
- **string AN.Format(value: ??, whitespace: string?)** — Format string as AN
|
|
@@ -201,7 +201,7 @@ Unknown or variant type is declared as **??**.
|
|
|
201
201
|
- **string ??.Format(formatting: integer? | string?)** — Format value to string
|
|
202
202
|
|
|
203
203
|
#### Aggregable Functions
|
|
204
|
-
- **float | integer | buffer | string | array float | integer | buffer | string | array.Add(values: array
|
|
204
|
+
- **float | integer | buffer | string | array float | integer | buffer | string | array.Add(values: ...array)** — Add or concatenate values
|
|
205
205
|
|
|
206
206
|
#### Array Functions
|
|
207
207
|
- **?? array.First(condition: function)** — First item satisfying condition
|
|
@@ -216,8 +216,8 @@ Unknown or variant type is declared as **??**.
|
|
|
216
216
|
- **array array.Filter(condition: function)** — Filtered array
|
|
217
217
|
- **?? array.Reduce(reducer: function)** — Reduced value
|
|
218
218
|
- **object array.Compose(generator: function)** — Compose object from array
|
|
219
|
-
- **array array.Prepend(items: array
|
|
220
|
-
- **array array.Append(items: array
|
|
219
|
+
- **array array.Prepend(items: ...array)** — Prepend items
|
|
220
|
+
- **array array.Append(items: ...array)** — Append items
|
|
221
221
|
|
|
222
222
|
#### Buffer Functions
|
|
223
223
|
- **buffer buffer.Byte(pos: integer)** — Byte at position
|
|
@@ -225,8 +225,8 @@ Unknown or variant type is declared as **??**.
|
|
|
225
225
|
|
|
226
226
|
#### Enumerable Functions
|
|
227
227
|
- **buffer | string | array.Slice(start: integer?, end: integer?)** — Slice section
|
|
228
|
-
- **buffer | string | array.Splice(start: integer, remove: integer, inject: array
|
|
229
|
-
- **buffer | string | array.Inject(start: integer, inject: array
|
|
228
|
+
- **buffer | string | array.Splice(start: integer, remove: integer, inject: ...array)** — Splice section
|
|
229
|
+
- **buffer | string | array.Inject(start: integer, inject: ...array)** — Inject section
|
|
230
230
|
|
|
231
231
|
#### Iterable Functions
|
|
232
232
|
- **integer buffer | string | array | object.Length()** — Get length
|
|
@@ -241,7 +241,7 @@ Unknown or variant type is declared as **??**.
|
|
|
241
241
|
- **boolean float | integer.LessOrEqual(value)** — Less or equal
|
|
242
242
|
- **float | integer float | integer.Subtract(subtrahend)** — Subtract value
|
|
243
243
|
- **float | integer float | integer.Negate()** — Negate number
|
|
244
|
-
- **float | integer float | integer.Multiply(values: array
|
|
244
|
+
- **float | integer float | integer.Multiply(values: ...array)** — Multiply values
|
|
245
245
|
- **float | integer float | integer.Divide(divisor)** — Divide value
|
|
246
246
|
- **float | integer float | integer.Remainder(divisor)** — Remainder
|
|
247
247
|
- **float | integer float | integer.Modulo(divisor)** — Modulo
|
|
@@ -270,7 +270,7 @@ Unknown or variant type is declared as **??**.
|
|
|
270
270
|
- **string string.LowerCase()** — To lowercase
|
|
271
271
|
- **string string.UpperCase()** — To uppercase
|
|
272
272
|
- **array string.Split(separator: string = ' ')** — Split into array
|
|
273
|
-
- **string string.ReplaceWith(replacement: string, search: array
|
|
273
|
+
- **string string.ReplaceWith(replacement: string, search: ...array)** — Replace all instances of substring with another
|
|
274
274
|
|
|
275
275
|
#### Timestamp Functions
|
|
276
276
|
- **integer timestamp.Year(utc: boolean?)** — Get year
|
package/dst/Affinirum.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { formatAN } from "./
|
|
2
|
-
import { funcOr, funcAnd, funcNot } from "./
|
|
3
|
-
import { funcAdd } from "./
|
|
4
|
-
import { funcAt, funcHas } from "./
|
|
5
|
-
import { funcGreaterThan, funcLessThan, funcGreaterOrEqual, funcLessOrEqual, funcSubtract, funcMultiply, funcDivide, funcRemainder, funcPower, funcNegate } from "./
|
|
6
|
-
import { funcCoalesce, funcEqual, funcNotEqual } from "./
|
|
1
|
+
import { formatAN } from "./native/notation/AN.js";
|
|
2
|
+
import { funcOr, funcAnd, funcNot } from "./native/Boolean.js";
|
|
3
|
+
import { funcAdd } from "./native/Aggregable.js";
|
|
4
|
+
import { funcAt, funcHas } from "./native/Iterable.js";
|
|
5
|
+
import { funcGreaterThan, funcLessThan, funcGreaterOrEqual, funcLessOrEqual, funcSubtract, funcMultiply, funcDivide, funcRemainder, funcPower, funcNegate } from "./native/Number.js";
|
|
6
|
+
import { funcCoalesce, funcEqual, funcNotEqual } from "./native/Unknown.js";
|
|
7
7
|
import { Constant } from "./Constant.js";
|
|
8
8
|
import { Variable } from "./Variable.js";
|
|
9
9
|
import { Type } from "./Type.js";
|
|
@@ -361,7 +361,7 @@ export class Affinirum {
|
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
363
|
frame.ends(state);
|
|
364
|
-
state.next();
|
|
364
|
+
state.closeBraces().next();
|
|
365
365
|
return new BlockNode(frame, subnodes);
|
|
366
366
|
}
|
|
367
367
|
else if (state.isBracesClose) {
|
|
@@ -398,7 +398,7 @@ export class Affinirum {
|
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
frame.ends(state);
|
|
401
|
-
state.next();
|
|
401
|
+
state.closeBrackets().next();
|
|
402
402
|
if (colon) {
|
|
403
403
|
return new ObjectNode(frame, subnodes.map(([k, v]) => [typeof k === "number" ? new ConstantNode(v, new Constant(String(k))) : k, v]));
|
|
404
404
|
}
|
|
@@ -480,13 +480,15 @@ export class Affinirum {
|
|
|
480
480
|
}
|
|
481
481
|
let argType = Type.Unknown;
|
|
482
482
|
if (state.next().isColon) {
|
|
483
|
-
|
|
483
|
+
variadic = state.next().isEllipsis;
|
|
484
|
+
if (variadic) {
|
|
485
|
+
state.next();
|
|
486
|
+
}
|
|
487
|
+
argType = this._type(state, scope);
|
|
484
488
|
}
|
|
485
489
|
variables.set(token, new Variable(argType));
|
|
486
|
-
if (
|
|
490
|
+
if (variadic) {
|
|
487
491
|
if (argType.isArray) {
|
|
488
|
-
variadic = true;
|
|
489
|
-
state.next();
|
|
490
492
|
break;
|
|
491
493
|
}
|
|
492
494
|
else {
|
|
@@ -567,12 +569,14 @@ export class Affinirum {
|
|
|
567
569
|
let variadic = false;
|
|
568
570
|
const argTypes = [];
|
|
569
571
|
while (!state.next().isParenthesesClose) {
|
|
572
|
+
variadic = state.isEllipsis;
|
|
573
|
+
if (variadic) {
|
|
574
|
+
state.next();
|
|
575
|
+
}
|
|
570
576
|
const argType = this._type(state, scope);
|
|
571
577
|
argTypes.push(argType);
|
|
572
|
-
if (
|
|
578
|
+
if (variadic) {
|
|
573
579
|
if (argType.isArray) {
|
|
574
|
-
variadic = true;
|
|
575
|
-
state.next();
|
|
576
580
|
break;
|
|
577
581
|
}
|
|
578
582
|
else {
|
package/dst/Constants.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { constArray } from "./
|
|
2
|
-
import { constBoolean } from "./
|
|
3
|
-
import { constBuffer } from "./
|
|
4
|
-
import { constInteger } from "./
|
|
5
|
-
import { constFloat } from "./
|
|
6
|
-
import { constObject } from "./
|
|
7
|
-
import { constString } from "./
|
|
8
|
-
import { constTimestamp } from "./
|
|
9
|
-
import { constAN } from "./
|
|
10
|
-
import { constJSON } from "./
|
|
1
|
+
import { constArray } from "./native/Array.js";
|
|
2
|
+
import { constBoolean } from "./native/Boolean.js";
|
|
3
|
+
import { constBuffer } from "./native/Buffer.js";
|
|
4
|
+
import { constInteger } from "./native/Integer.js";
|
|
5
|
+
import { constFloat } from "./native/Float.js";
|
|
6
|
+
import { constObject } from "./native/Object.js";
|
|
7
|
+
import { constString } from "./native/String.js";
|
|
8
|
+
import { constTimestamp } from "./native/Timestamp.js";
|
|
9
|
+
import { constAN } from "./native/notation/AN.js";
|
|
10
|
+
import { constJSON } from "./native/notation/JSON.js";
|
|
11
11
|
export const Constants = [
|
|
12
12
|
["Array", constArray],
|
|
13
13
|
["Boolean", constBoolean],
|
package/dst/Functions.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { funcAdd } from "./
|
|
2
|
-
import { funcFirst, funcLast, funcFirstIndex, funcLastIndex, funcEvery, funcAny, funcFlatten, funcReverse, funcDerive, funcFilter, funcReduce, funcCompose, funcPrepend, funcAppend } from "./
|
|
3
|
-
import { funcByte } from "./
|
|
4
|
-
import { funcSlice, funcSplice, funcInject } from "./
|
|
5
|
-
import { funcLength, funcContains, funcAt, funcHas } from "./
|
|
6
|
-
import { funcGreaterThan, funcLessThan, funcGreaterOrEqual, funcLessOrEqual, funcSubtract, funcMultiply, funcDivide, funcRemainder, funcModulo, funcPower, funcRoot, funcNegate, funcCast, funcCastToFloat, funcCastToInteger } from "./
|
|
7
|
-
import { funcEntries, funcKeys, funcValues } from "./
|
|
8
|
-
import { funcLike, funcUnlike, funcStartsWith, funcEndsWith, funcChar, funcCharCode, funcTrim, funcTrimStart, funcTrimEnd, funcLowerCase, funcUpperCase, funcSplit, funcReplaceWith } from "./
|
|
9
|
-
import { funcYear, funcMonth, funcMonthIndex, funcWeekdayIndex, funcDay, funcHour, funcMinute, funcSecond, funcMillisecond, funcEpochTime, funcDaysSince, funcHoursSince, funcMinutesSince, funcSecondsSince } from "./
|
|
10
|
-
import { funcCoalesce, funcEqual, funcNotEqual, funcEncode, funcFormat } from "./
|
|
1
|
+
import { funcAdd } from "./native/Aggregable.js";
|
|
2
|
+
import { funcFirst, funcLast, funcFirstIndex, funcLastIndex, funcEvery, funcAny, funcFlatten, funcReverse, funcDerive, funcFilter, funcReduce, funcCompose, funcPrepend, funcAppend } from "./native/Array.js";
|
|
3
|
+
import { funcByte } from "./native/Buffer.js";
|
|
4
|
+
import { funcSlice, funcSplice, funcInject } from "./native/Enumerable.js";
|
|
5
|
+
import { funcLength, funcContains, funcAt, funcHas } from "./native/Iterable.js";
|
|
6
|
+
import { funcGreaterThan, funcLessThan, funcGreaterOrEqual, funcLessOrEqual, funcSubtract, funcMultiply, funcDivide, funcRemainder, funcModulo, funcPower, funcRoot, funcNegate, funcCast, funcCastToFloat, funcCastToInteger } from "./native/Number.js";
|
|
7
|
+
import { funcEntries, funcKeys, funcValues } from "./native/Object.js";
|
|
8
|
+
import { funcLike, funcUnlike, funcStartsWith, funcEndsWith, funcChar, funcCharCode, funcTrim, funcTrimStart, funcTrimEnd, funcLowerCase, funcUpperCase, funcSplit, funcReplaceWith } from "./native/String.js";
|
|
9
|
+
import { funcYear, funcMonth, funcMonthIndex, funcWeekdayIndex, funcDay, funcHour, funcMinute, funcSecond, funcMillisecond, funcEpochTime, funcDaysSince, funcHoursSince, funcMinutesSince, funcSecondsSince } from "./native/Timestamp.js";
|
|
10
|
+
import { funcCoalesce, funcEqual, funcNotEqual, funcEncode, funcFormat } from "./native/Unknown.js";
|
|
11
11
|
export const Functions = [
|
|
12
12
|
// Aggregable
|
|
13
13
|
["Add", funcAdd],
|
package/dst/ParserState.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { funcOr, funcAnd, funcNot } from "./
|
|
2
|
-
import { parseBuffer } from "./
|
|
3
|
-
import { funcAdd } from "./
|
|
4
|
-
import { isSignSymbol, isTokenStartSymbol, isNumericSymbol, isTokenSymbol, isDateSymbol, isTimeSymbol, isDateTimeSeparatorSymbol, replaceWith } from "./
|
|
1
|
+
import { funcOr, funcAnd, funcNot } from "./native/Boolean.js";
|
|
2
|
+
import { parseBuffer } from "./native/Buffer.js";
|
|
3
|
+
import { funcAdd } from "./native/Aggregable.js";
|
|
4
|
+
import { isSignSymbol, isTokenStartSymbol, isNumericSymbol, isTokenSymbol, isDateSymbol, isTimeSymbol, isDateTimeSeparatorSymbol, replaceWith } from "./native/String.js";
|
|
5
5
|
import { Constant } from "./Constant.js";
|
|
6
|
-
import { funcGreaterThan, funcLessThan, funcGreaterOrEqual, funcLessOrEqual, funcSubtract, funcMultiply, funcDivide, funcRemainder, funcPower } from "./
|
|
7
|
-
import { funcCoalesce, funcEqual, funcNotEqual } from "./
|
|
6
|
+
import { funcGreaterThan, funcLessThan, funcGreaterOrEqual, funcLessOrEqual, funcSubtract, funcMultiply, funcDivide, funcRemainder, funcPower } from "./native/Number.js";
|
|
7
|
+
import { funcCoalesce, funcEqual, funcNotEqual } from "./native/Unknown.js";
|
|
8
8
|
import { Type } from "./Type.js";
|
|
9
9
|
import { ParserFrame } from "./ParserFrame.js";
|
|
10
10
|
class Literal {
|
package/dst/atom/FunctionAtom.js
CHANGED
|
@@ -64,7 +64,10 @@ export class FunctionAtom {
|
|
|
64
64
|
return 0x1000000000000 + (this._retType ? [this._retType, ...this._argTypes] : []).reduce((acc, i) => acc + i.weight(), 0);
|
|
65
65
|
}
|
|
66
66
|
toString() {
|
|
67
|
-
const argTypes = this._argTypes.map((i) =>
|
|
68
|
-
|
|
67
|
+
const argTypes = this._argTypes.map((i, ix) => {
|
|
68
|
+
const argType = i.toString();
|
|
69
|
+
return (ix === (this._argTypes.length - 1) && this.isVariadic) ? "..." + argType : argType;
|
|
70
|
+
}).join(",");
|
|
71
|
+
return this._undefined ? "function" : `~${this._retType.toString()}(${argTypes})`;
|
|
69
72
|
}
|
|
70
73
|
}
|
package/dst/cjs/Affinirum.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Affinirum = void 0;
|
|
4
|
-
const AN_js_1 = require("./
|
|
5
|
-
const Boolean_js_1 = require("./
|
|
6
|
-
const Aggregable_js_1 = require("./
|
|
7
|
-
const Iterable_js_1 = require("./
|
|
8
|
-
const Number_js_1 = require("./
|
|
9
|
-
const Unknown_js_1 = require("./
|
|
4
|
+
const AN_js_1 = require("./native/notation/AN.js");
|
|
5
|
+
const Boolean_js_1 = require("./native/Boolean.js");
|
|
6
|
+
const Aggregable_js_1 = require("./native/Aggregable.js");
|
|
7
|
+
const Iterable_js_1 = require("./native/Iterable.js");
|
|
8
|
+
const Number_js_1 = require("./native/Number.js");
|
|
9
|
+
const Unknown_js_1 = require("./native/Unknown.js");
|
|
10
10
|
const Constant_js_1 = require("./Constant.js");
|
|
11
11
|
const Variable_js_1 = require("./Variable.js");
|
|
12
12
|
const Type_js_1 = require("./Type.js");
|
|
@@ -364,7 +364,7 @@ class Affinirum {
|
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
frame.ends(state);
|
|
367
|
-
state.next();
|
|
367
|
+
state.closeBraces().next();
|
|
368
368
|
return new BlockNode_js_1.BlockNode(frame, subnodes);
|
|
369
369
|
}
|
|
370
370
|
else if (state.isBracesClose) {
|
|
@@ -401,7 +401,7 @@ class Affinirum {
|
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
403
|
frame.ends(state);
|
|
404
|
-
state.next();
|
|
404
|
+
state.closeBrackets().next();
|
|
405
405
|
if (colon) {
|
|
406
406
|
return new ObjectNode_js_1.ObjectNode(frame, subnodes.map(([k, v]) => [typeof k === "number" ? new ConstantNode_js_1.ConstantNode(v, new Constant_js_1.Constant(String(k))) : k, v]));
|
|
407
407
|
}
|
|
@@ -483,13 +483,15 @@ class Affinirum {
|
|
|
483
483
|
}
|
|
484
484
|
let argType = Type_js_1.Type.Unknown;
|
|
485
485
|
if (state.next().isColon) {
|
|
486
|
-
|
|
486
|
+
variadic = state.next().isEllipsis;
|
|
487
|
+
if (variadic) {
|
|
488
|
+
state.next();
|
|
489
|
+
}
|
|
490
|
+
argType = this._type(state, scope);
|
|
487
491
|
}
|
|
488
492
|
variables.set(token, new Variable_js_1.Variable(argType));
|
|
489
|
-
if (
|
|
493
|
+
if (variadic) {
|
|
490
494
|
if (argType.isArray) {
|
|
491
|
-
variadic = true;
|
|
492
|
-
state.next();
|
|
493
495
|
break;
|
|
494
496
|
}
|
|
495
497
|
else {
|
|
@@ -570,12 +572,14 @@ class Affinirum {
|
|
|
570
572
|
let variadic = false;
|
|
571
573
|
const argTypes = [];
|
|
572
574
|
while (!state.next().isParenthesesClose) {
|
|
575
|
+
variadic = state.isEllipsis;
|
|
576
|
+
if (variadic) {
|
|
577
|
+
state.next();
|
|
578
|
+
}
|
|
573
579
|
const argType = this._type(state, scope);
|
|
574
580
|
argTypes.push(argType);
|
|
575
|
-
if (
|
|
581
|
+
if (variadic) {
|
|
576
582
|
if (argType.isArray) {
|
|
577
|
-
variadic = true;
|
|
578
|
-
state.next();
|
|
579
583
|
break;
|
|
580
584
|
}
|
|
581
585
|
else {
|
package/dst/cjs/Constants.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Constants = void 0;
|
|
4
|
-
const Array_js_1 = require("./
|
|
5
|
-
const Boolean_js_1 = require("./
|
|
6
|
-
const Buffer_js_1 = require("./
|
|
7
|
-
const Integer_js_1 = require("./
|
|
8
|
-
const Float_js_1 = require("./
|
|
9
|
-
const Object_js_1 = require("./
|
|
10
|
-
const String_js_1 = require("./
|
|
11
|
-
const Timestamp_js_1 = require("./
|
|
12
|
-
const AN_js_1 = require("./
|
|
13
|
-
const JSON_js_1 = require("./
|
|
4
|
+
const Array_js_1 = require("./native/Array.js");
|
|
5
|
+
const Boolean_js_1 = require("./native/Boolean.js");
|
|
6
|
+
const Buffer_js_1 = require("./native/Buffer.js");
|
|
7
|
+
const Integer_js_1 = require("./native/Integer.js");
|
|
8
|
+
const Float_js_1 = require("./native/Float.js");
|
|
9
|
+
const Object_js_1 = require("./native/Object.js");
|
|
10
|
+
const String_js_1 = require("./native/String.js");
|
|
11
|
+
const Timestamp_js_1 = require("./native/Timestamp.js");
|
|
12
|
+
const AN_js_1 = require("./native/notation/AN.js");
|
|
13
|
+
const JSON_js_1 = require("./native/notation/JSON.js");
|
|
14
14
|
exports.Constants = [
|
|
15
15
|
["Array", Array_js_1.constArray],
|
|
16
16
|
["Boolean", Boolean_js_1.constBoolean],
|
package/dst/cjs/Functions.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Functions = void 0;
|
|
4
|
-
const Aggregable_js_1 = require("./
|
|
5
|
-
const Array_js_1 = require("./
|
|
6
|
-
const Buffer_js_1 = require("./
|
|
7
|
-
const Enumerable_js_1 = require("./
|
|
8
|
-
const Iterable_js_1 = require("./
|
|
9
|
-
const Number_js_1 = require("./
|
|
10
|
-
const Object_js_1 = require("./
|
|
11
|
-
const String_js_1 = require("./
|
|
12
|
-
const Timestamp_js_1 = require("./
|
|
13
|
-
const Unknown_js_1 = require("./
|
|
4
|
+
const Aggregable_js_1 = require("./native/Aggregable.js");
|
|
5
|
+
const Array_js_1 = require("./native/Array.js");
|
|
6
|
+
const Buffer_js_1 = require("./native/Buffer.js");
|
|
7
|
+
const Enumerable_js_1 = require("./native/Enumerable.js");
|
|
8
|
+
const Iterable_js_1 = require("./native/Iterable.js");
|
|
9
|
+
const Number_js_1 = require("./native/Number.js");
|
|
10
|
+
const Object_js_1 = require("./native/Object.js");
|
|
11
|
+
const String_js_1 = require("./native/String.js");
|
|
12
|
+
const Timestamp_js_1 = require("./native/Timestamp.js");
|
|
13
|
+
const Unknown_js_1 = require("./native/Unknown.js");
|
|
14
14
|
exports.Functions = [
|
|
15
15
|
// Aggregable
|
|
16
16
|
["Add", Aggregable_js_1.funcAdd],
|
package/dst/cjs/ParserState.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ParserState = void 0;
|
|
4
|
-
const Boolean_js_1 = require("./
|
|
5
|
-
const Buffer_js_1 = require("./
|
|
6
|
-
const Aggregable_js_1 = require("./
|
|
7
|
-
const String_js_1 = require("./
|
|
4
|
+
const Boolean_js_1 = require("./native/Boolean.js");
|
|
5
|
+
const Buffer_js_1 = require("./native/Buffer.js");
|
|
6
|
+
const Aggregable_js_1 = require("./native/Aggregable.js");
|
|
7
|
+
const String_js_1 = require("./native/String.js");
|
|
8
8
|
const Constant_js_1 = require("./Constant.js");
|
|
9
|
-
const Number_js_1 = require("./
|
|
10
|
-
const Unknown_js_1 = require("./
|
|
9
|
+
const Number_js_1 = require("./native/Number.js");
|
|
10
|
+
const Unknown_js_1 = require("./native/Unknown.js");
|
|
11
11
|
const Type_js_1 = require("./Type.js");
|
|
12
12
|
const ParserFrame_js_1 = require("./ParserFrame.js");
|
|
13
13
|
class Literal {
|
|
@@ -67,8 +67,11 @@ class FunctionAtom {
|
|
|
67
67
|
return 0x1000000000000 + (this._retType ? [this._retType, ...this._argTypes] : []).reduce((acc, i) => acc + i.weight(), 0);
|
|
68
68
|
}
|
|
69
69
|
toString() {
|
|
70
|
-
const argTypes = this._argTypes.map((i) =>
|
|
71
|
-
|
|
70
|
+
const argTypes = this._argTypes.map((i, ix) => {
|
|
71
|
+
const argType = i.toString();
|
|
72
|
+
return (ix === (this._argTypes.length - 1) && this.isVariadic) ? "..." + argType : argType;
|
|
73
|
+
}).join(",");
|
|
74
|
+
return this._undefined ? "function" : `~${this._retType.toString()}(${argTypes})`;
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
exports.FunctionAtom = FunctionAtom;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "affinirum",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Affinirum Scripting Language",
|
|
5
5
|
"main": "dst/cjs/index.js",
|
|
6
6
|
"module": "dst/index.js",
|
|
@@ -56,12 +56,13 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {},
|
|
58
58
|
"devDependencies": {
|
|
59
|
+
"@eslint/js": "10.0.1",
|
|
59
60
|
"@types/jasmine": "~6.0.0",
|
|
60
61
|
"copyfiles": "~2.4.1",
|
|
61
|
-
"eslint": "~
|
|
62
|
-
"jasmine": "~6.
|
|
63
|
-
"rimraf": "~6.1.
|
|
64
|
-
"typescript": "~
|
|
65
|
-
"typescript-eslint": "~8.
|
|
62
|
+
"eslint": "~10.6.0",
|
|
63
|
+
"jasmine": "~6.3.0",
|
|
64
|
+
"rimraf": "~6.1.3",
|
|
65
|
+
"typescript": "~6.0.3",
|
|
66
|
+
"typescript-eslint": "~8.62.1"
|
|
66
67
|
}
|
|
67
68
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|