affinirum 1.0.0

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.
Files changed (121) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +301 -0
  3. package/dst/Affinirum.d.ts +73 -0
  4. package/dst/Affinirum.js +536 -0
  5. package/dst/Constant.d.ts +15 -0
  6. package/dst/Constant.js +26 -0
  7. package/dst/Constants.d.ts +2 -0
  8. package/dst/Constants.js +22 -0
  9. package/dst/Functions.d.ts +2 -0
  10. package/dst/Functions.js +85 -0
  11. package/dst/Keywords.d.ts +1 -0
  12. package/dst/Keywords.js +17 -0
  13. package/dst/Node.d.ts +13 -0
  14. package/dst/Node.js +22 -0
  15. package/dst/ParserFrame.d.ts +13 -0
  16. package/dst/ParserFrame.js +80 -0
  17. package/dst/ParserState.d.ts +54 -0
  18. package/dst/ParserState.js +562 -0
  19. package/dst/StaticScope.d.ts +13 -0
  20. package/dst/StaticScope.js +44 -0
  21. package/dst/Type.d.ts +72 -0
  22. package/dst/Type.js +196 -0
  23. package/dst/Value.d.ts +3 -0
  24. package/dst/Value.js +1 -0
  25. package/dst/Variable.d.ts +13 -0
  26. package/dst/Variable.js +25 -0
  27. package/dst/atom/ArrayAtom.d.ts +11 -0
  28. package/dst/atom/ArrayAtom.js +38 -0
  29. package/dst/atom/FunctionAtom.d.ts +17 -0
  30. package/dst/atom/FunctionAtom.js +54 -0
  31. package/dst/atom/ObjectAtom.d.ts +11 -0
  32. package/dst/atom/ObjectAtom.js +44 -0
  33. package/dst/atom/PrimitiveAtom.d.ts +8 -0
  34. package/dst/atom/PrimitiveAtom.js +26 -0
  35. package/dst/cjs/Affinirum.js +540 -0
  36. package/dst/cjs/Constant.js +30 -0
  37. package/dst/cjs/Constants.js +25 -0
  38. package/dst/cjs/Functions.js +88 -0
  39. package/dst/cjs/Keywords.js +20 -0
  40. package/dst/cjs/Node.js +26 -0
  41. package/dst/cjs/ParserFrame.js +84 -0
  42. package/dst/cjs/ParserState.js +566 -0
  43. package/dst/cjs/StaticScope.js +48 -0
  44. package/dst/cjs/Type.js +200 -0
  45. package/dst/cjs/Value.js +2 -0
  46. package/dst/cjs/Variable.js +29 -0
  47. package/dst/cjs/atom/ArrayAtom.js +42 -0
  48. package/dst/cjs/atom/FunctionAtom.js +58 -0
  49. package/dst/cjs/atom/ObjectAtom.js +48 -0
  50. package/dst/cjs/atom/PrimitiveAtom.js +30 -0
  51. package/dst/cjs/constant/Array.js +93 -0
  52. package/dst/cjs/constant/Boolean.js +25 -0
  53. package/dst/cjs/constant/Buffer.js +68 -0
  54. package/dst/cjs/constant/Enumerable.js +34 -0
  55. package/dst/cjs/constant/Float.js +85 -0
  56. package/dst/cjs/constant/Integer.js +104 -0
  57. package/dst/cjs/constant/Iterable.js +24 -0
  58. package/dst/cjs/constant/Number.js +59 -0
  59. package/dst/cjs/constant/Object.js +13 -0
  60. package/dst/cjs/constant/String.js +197 -0
  61. package/dst/cjs/constant/Timestamp.js +56 -0
  62. package/dst/cjs/constant/Unknown.js +101 -0
  63. package/dst/cjs/constant/notation/AN.js +46 -0
  64. package/dst/cjs/constant/notation/JSON.js +14 -0
  65. package/dst/cjs/index.js +19 -0
  66. package/dst/cjs/node/ArrayNode.js +34 -0
  67. package/dst/cjs/node/BlockNode.js +33 -0
  68. package/dst/cjs/node/CallNode.js +54 -0
  69. package/dst/cjs/node/ConstantNode.js +33 -0
  70. package/dst/cjs/node/LoopNode.js +34 -0
  71. package/dst/cjs/node/ObjectNode.js +42 -0
  72. package/dst/cjs/node/SwitchNode.js +45 -0
  73. package/dst/cjs/node/VariableNode.js +30 -0
  74. package/dst/cjs/package.json +3 -0
  75. package/dst/constant/Array.d.ts +22 -0
  76. package/dst/constant/Array.js +90 -0
  77. package/dst/constant/Boolean.d.ts +11 -0
  78. package/dst/constant/Boolean.js +22 -0
  79. package/dst/constant/Buffer.d.ts +10 -0
  80. package/dst/constant/Buffer.js +61 -0
  81. package/dst/constant/Enumerable.d.ts +5 -0
  82. package/dst/constant/Enumerable.js +31 -0
  83. package/dst/constant/Float.d.ts +22 -0
  84. package/dst/constant/Float.js +80 -0
  85. package/dst/constant/Integer.d.ts +10 -0
  86. package/dst/constant/Integer.js +100 -0
  87. package/dst/constant/Iterable.d.ts +3 -0
  88. package/dst/constant/Iterable.js +21 -0
  89. package/dst/constant/Number.d.ts +14 -0
  90. package/dst/constant/Number.js +56 -0
  91. package/dst/constant/Object.d.ts +7 -0
  92. package/dst/constant/Object.js +10 -0
  93. package/dst/constant/String.d.ts +34 -0
  94. package/dst/constant/String.js +179 -0
  95. package/dst/constant/Timestamp.d.ts +20 -0
  96. package/dst/constant/Timestamp.js +50 -0
  97. package/dst/constant/Unknown.d.ts +10 -0
  98. package/dst/constant/Unknown.js +95 -0
  99. package/dst/constant/notation/AN.d.ts +6 -0
  100. package/dst/constant/notation/AN.js +42 -0
  101. package/dst/constant/notation/JSON.d.ts +7 -0
  102. package/dst/constant/notation/JSON.js +10 -0
  103. package/dst/index.d.ts +3 -0
  104. package/dst/index.js +3 -0
  105. package/dst/node/ArrayNode.d.ts +12 -0
  106. package/dst/node/ArrayNode.js +30 -0
  107. package/dst/node/BlockNode.d.ts +12 -0
  108. package/dst/node/BlockNode.js +29 -0
  109. package/dst/node/CallNode.d.ts +14 -0
  110. package/dst/node/CallNode.js +50 -0
  111. package/dst/node/ConstantNode.d.ts +15 -0
  112. package/dst/node/ConstantNode.js +29 -0
  113. package/dst/node/LoopNode.d.ts +13 -0
  114. package/dst/node/LoopNode.js +30 -0
  115. package/dst/node/ObjectNode.d.ts +13 -0
  116. package/dst/node/ObjectNode.js +38 -0
  117. package/dst/node/SwitchNode.d.ts +14 -0
  118. package/dst/node/SwitchNode.js +41 -0
  119. package/dst/node/VariableNode.d.ts +14 -0
  120. package/dst/node/VariableNode.js +26 -0
  121. package/package.json +67 -0
package/dst/Type.js ADDED
@@ -0,0 +1,196 @@
1
+ import { PrimitiveAtom } from './atom/PrimitiveAtom.js';
2
+ import { ArrayAtom } from './atom/ArrayAtom.js';
3
+ import { ObjectAtom } from './atom/ObjectAtom.js';
4
+ import { FunctionAtom } from './atom/FunctionAtom.js';
5
+ export class Type {
6
+ _atoms;
7
+ constructor(_atoms = []) {
8
+ this._atoms = _atoms;
9
+ }
10
+ get isUnknown() {
11
+ return this._atoms.length === 0;
12
+ }
13
+ get isAtom() {
14
+ return this._atoms.length === 1;
15
+ }
16
+ get isOptional() {
17
+ return this.isUnknown || this._atoms.length > 1 && this._atoms.some((i) => i.match(Type.Void._atoms[0]));
18
+ }
19
+ get isVoid() {
20
+ return this.isAtom && this._atoms[0].match(Type.Void._atoms[0]);
21
+ }
22
+ get isBoolean() {
23
+ return this.isAtom && this._atoms[0].match(Type.Boolean._atoms[0]);
24
+ }
25
+ get isTimestamp() {
26
+ return this.isAtom && this._atoms[0].match(Type.Timestamp._atoms[0]);
27
+ }
28
+ get isFloat() {
29
+ return this.isAtom && this._atoms[0].match(Type.Float._atoms[0]);
30
+ }
31
+ get isInteger() {
32
+ return this.isAtom && this._atoms[0].match(Type.Integer._atoms[0]);
33
+ }
34
+ get isBuffer() {
35
+ return this.isAtom && this._atoms[0].match(Type.Buffer._atoms[0]);
36
+ }
37
+ get isString() {
38
+ return this.isAtom && this._atoms[0].match(Type.String._atoms[0]);
39
+ }
40
+ get isArray() {
41
+ return this._atoms.every((i) => i instanceof ArrayAtom);
42
+ }
43
+ get isObject() {
44
+ return this._atoms.every((i) => i instanceof ObjectAtom);
45
+ }
46
+ get isFunction() {
47
+ return this._atoms.every((i) => i instanceof FunctionAtom);
48
+ }
49
+ get isNumeric() {
50
+ return this._atoms.length === 2
51
+ && (this._atoms[0].match(Type.Float._atoms[0]) || this._atoms[0].match(Type.Integer._atoms[0]));
52
+ }
53
+ toOptional() {
54
+ return this._atoms.length ? Type.union(Type.Void, this) : this;
55
+ }
56
+ mergeFunctionAtomRetType(type) {
57
+ const atoms = this._atoms.filter((i) => i instanceof FunctionAtom && (!i.retType || i.retType.match(type)));
58
+ return Type.union(...atoms.map((i) => i.retType ?? Type.Unknown));
59
+ }
60
+ mergeFunctionAtom(type, argc) {
61
+ if (this.isUnknown || type.isVoid) {
62
+ return Type._functionAtom(type, Array.from({ length: argc }).map(() => Type.Unknown), false);
63
+ }
64
+ const atoms = this._atoms.filter((i) => i instanceof FunctionAtom && i.minArity <= argc && i.maxArity >= argc && (!i.retType || i.retType.match(type)));
65
+ if (!atoms.length) {
66
+ return undefined;
67
+ }
68
+ return Type._functionAtom(Type.union(...atoms.map((i) => i.retType ?? Type.Unknown)), Array.from({ length: argc }).map((_, ix) => Type.union(...atoms.map((i) => i.argType(ix)))), atoms.some((i) => i.isVariadic));
69
+ }
70
+ reduce(mask) {
71
+ if (mask.isUnknown || mask.isVoid) {
72
+ return this;
73
+ }
74
+ if (this.isUnknown) {
75
+ return mask;
76
+ }
77
+ const list = this._atoms.filter((i) => mask.match(i));
78
+ return list.length === 0
79
+ ? undefined
80
+ : list.length === this._atoms.length
81
+ ? this
82
+ : new Type(list);
83
+ }
84
+ match(type) {
85
+ if (type instanceof Type) {
86
+ return this.isUnknown || type.isUnknown || type.isVoid || this._atoms.some((i) => type._atoms.some((j) => i.match(j)));
87
+ }
88
+ else {
89
+ return this._atoms.some((i) => i.match(type));
90
+ }
91
+ }
92
+ weight() {
93
+ return this._atoms.reduce((acc, i) => acc + i.weight(), 0);
94
+ }
95
+ toString() {
96
+ return this._atoms.length
97
+ ? this._atoms.sort((a, b) => a.weight() - b.weight()).map((i) => i.toString()).join('|')
98
+ : '??';
99
+ }
100
+ static union(...types) {
101
+ if (types.some((i) => i.isUnknown)) {
102
+ return Type.Unknown;
103
+ }
104
+ const type = new Type([]);
105
+ types.map((i) => i._atoms).flat().forEach((i) => {
106
+ if (!type.match(i)) {
107
+ type._atoms.push(i);
108
+ }
109
+ });
110
+ return type;
111
+ }
112
+ static of(value) {
113
+ return value == null
114
+ ? Type.Void
115
+ : typeof value === 'boolean'
116
+ ? Type.Boolean
117
+ : value instanceof Date
118
+ ? Type.Timestamp
119
+ : typeof value === 'number'
120
+ ? Type.Float
121
+ : typeof value === 'bigint'
122
+ ? Type.Integer
123
+ : value instanceof ArrayBuffer
124
+ ? Type.Buffer
125
+ : typeof value === 'string'
126
+ ? Type.String
127
+ : Array.isArray(value)
128
+ ? Type.Array
129
+ : typeof value === 'object'
130
+ ? Type.Object
131
+ : Type.Function;
132
+ }
133
+ static isPrimitiveType(value) {
134
+ return value == null
135
+ || typeof value === 'boolean'
136
+ || value instanceof Date
137
+ || typeof value === 'number'
138
+ || typeof value === 'bigint'
139
+ || value instanceof ArrayBuffer
140
+ || typeof value === 'string';
141
+ }
142
+ static arrayType(itemTypes = []) {
143
+ return new Type([new ArrayAtom(itemTypes)]);
144
+ }
145
+ static objectType(propTypes = {}) {
146
+ return new Type([new ObjectAtom(propTypes)]);
147
+ }
148
+ static functionType(retType, argTypes = [], isVariadic = false) {
149
+ return new Type([Type._functionAtom(retType, argTypes, isVariadic)]);
150
+ }
151
+ static Unknown = new Type();
152
+ static Void = Type._primitiveType('void');
153
+ static Boolean = Type._primitiveType('boolean');
154
+ static OptionalBoolean = Type.union(Type.Void, Type.Boolean);
155
+ static Timestamp = Type._primitiveType('timestamp');
156
+ static OptionalTimestamp = Type.union(Type.Void, Type.Timestamp);
157
+ static Float = Type._primitiveType('float');
158
+ static OptionalFloat = Type.union(Type.Void, Type.Float);
159
+ static Integer = Type._primitiveType('integer');
160
+ static OptionalInteger = Type.union(Type.Void, Type.Integer);
161
+ static Buffer = Type._primitiveType('buffer');
162
+ static OptionalBuffer = Type.union(Type.Void, Type.Buffer);
163
+ static String = Type._primitiveType('string');
164
+ static OptionalString = Type.union(Type.Void, Type.String);
165
+ static Array = Type.arrayType();
166
+ static OptionalArray = Type.union(Type.Void, Type.Array);
167
+ static Object = Type.objectType();
168
+ static OptionalObject = Type.union(Type.Void, Type.Object);
169
+ static Function = Type.functionType();
170
+ static OptionalFunction = Type.union(Type.Void, Type.Function);
171
+ static Number = Type.union(Type.Float, Type.Integer);
172
+ static OptionalNumber = Type.union(Type.Void, Type.Float, Type.Integer);
173
+ static Enumerable = Type.union(Type.Buffer, Type.String, Type.Array);
174
+ static OptionalEnumerable = Type.union(Type.Void, Type.Buffer, Type.String, Type.Array);
175
+ static Iterable = Type.union(Type.Buffer, Type.String, Type.Array, Type.Object);
176
+ static OptionalIterable = Type.union(Type.Void, Type.Buffer, Type.String, Type.Array, Type.Object);
177
+ static _primitiveType(primitive) {
178
+ return new Type([new PrimitiveAtom(primitive)]);
179
+ }
180
+ static _functionAtom(retType, argTypes = [], isVariadic = false) {
181
+ let ix = 0;
182
+ while (ix < argTypes.length && !argTypes[ix].isOptional) {
183
+ ++ix;
184
+ }
185
+ const minArity = ix;
186
+ if (ix < argTypes.length) {
187
+ while (ix < argTypes.length && argTypes[ix].isOptional) {
188
+ ++ix;
189
+ }
190
+ if (ix < argTypes.length) {
191
+ throw new Error('a required parameter illegally follows an optional one');
192
+ }
193
+ }
194
+ return new FunctionAtom(retType, argTypes, minArity, isVariadic);
195
+ }
196
+ }
package/dst/Value.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export type Value = void | undefined | null | number | boolean | Date | bigint | ArrayBuffer | string | Value[] | {
2
+ [key: string]: Value;
3
+ } | ((...args: any[]) => Value);
package/dst/Value.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import { Value } from './Value.js';
2
+ import { Type } from './Type.js';
3
+ export declare class Variable {
4
+ protected _type: Type;
5
+ protected _constant: boolean;
6
+ protected _value?: Value;
7
+ constructor(_type?: Type, _constant?: boolean);
8
+ get value(): Value | undefined;
9
+ set value(value: Value | undefined);
10
+ get type(): Type;
11
+ set type(type: Type);
12
+ get constant(): boolean;
13
+ }
@@ -0,0 +1,25 @@
1
+ import { Type } from './Type.js';
2
+ export class Variable {
3
+ _type;
4
+ _constant;
5
+ _value;
6
+ constructor(_type = Type.Unknown, _constant = false) {
7
+ this._type = _type;
8
+ this._constant = _constant;
9
+ }
10
+ get value() {
11
+ return this._value;
12
+ }
13
+ set value(value) {
14
+ this._value = value;
15
+ }
16
+ get type() {
17
+ return this._type;
18
+ }
19
+ set type(type) {
20
+ this._type = type;
21
+ }
22
+ get constant() {
23
+ return this._constant;
24
+ }
25
+ }
@@ -0,0 +1,11 @@
1
+ import { IType } from '../Type.js';
2
+ export declare class ArrayAtom implements IType {
3
+ protected readonly _itemTypes: IType[];
4
+ constructor(_itemTypes?: IType[]);
5
+ get empty(): boolean;
6
+ subtypes(): IType[];
7
+ itemType(index: number): IType | undefined;
8
+ match(type: IType): boolean;
9
+ weight(): number;
10
+ toString(): string;
11
+ }
@@ -0,0 +1,38 @@
1
+ export class ArrayAtom {
2
+ _itemTypes;
3
+ constructor(_itemTypes = []) {
4
+ this._itemTypes = _itemTypes;
5
+ }
6
+ get empty() {
7
+ return this._itemTypes.length === 0;
8
+ }
9
+ subtypes() {
10
+ return this._itemTypes;
11
+ }
12
+ itemType(index) {
13
+ return this._itemTypes[index];
14
+ }
15
+ match(type) {
16
+ if (type instanceof ArrayAtom) {
17
+ if (this.empty || type.empty) {
18
+ return true;
19
+ }
20
+ if (this.subtypes().length !== type.subtypes().length) {
21
+ return false;
22
+ }
23
+ for (let i = 0; i < this._itemTypes.length; ++i) {
24
+ if (!this._itemTypes[i].match(type._itemTypes[i])) {
25
+ return false;
26
+ }
27
+ }
28
+ return true;
29
+ }
30
+ return false;
31
+ }
32
+ weight() {
33
+ return 0x10000 + this.subtypes().reduce((acc, i) => acc + i.weight(), 0);
34
+ }
35
+ toString() {
36
+ return `[${this._itemTypes.join(',')}]`;
37
+ }
38
+ }
@@ -0,0 +1,17 @@
1
+ import { IType } from '../Type.js';
2
+ export declare class FunctionAtom implements IType {
3
+ protected readonly _retType?: IType | undefined;
4
+ protected readonly _argTypes: IType[];
5
+ protected readonly _minArity: number;
6
+ protected readonly _isVariadic: boolean;
7
+ constructor(_retType?: IType | undefined, _argTypes?: IType[], _minArity?: number, _isVariadic?: boolean);
8
+ get retType(): IType | undefined;
9
+ get minArity(): number;
10
+ get maxArity(): number;
11
+ get isVariadic(): boolean;
12
+ subtypes(): IType[];
13
+ argType(index: number): IType;
14
+ match(type: IType): boolean;
15
+ weight(): number;
16
+ toString(): string;
17
+ }
@@ -0,0 +1,54 @@
1
+ export class FunctionAtom {
2
+ _retType;
3
+ _argTypes;
4
+ _minArity;
5
+ _isVariadic;
6
+ constructor(_retType, _argTypes = [], _minArity = _argTypes.length, _isVariadic = false) {
7
+ this._retType = _retType;
8
+ this._argTypes = _argTypes;
9
+ this._minArity = _minArity;
10
+ this._isVariadic = _isVariadic;
11
+ }
12
+ get retType() {
13
+ return this._retType;
14
+ }
15
+ get minArity() {
16
+ return this._minArity;
17
+ }
18
+ get maxArity() {
19
+ return this._isVariadic ? Number.POSITIVE_INFINITY : this._argTypes.length;
20
+ }
21
+ get isVariadic() {
22
+ return this._isVariadic;
23
+ }
24
+ subtypes() {
25
+ return this._retType ? [this._retType, ...this._argTypes] : [];
26
+ }
27
+ argType(index) {
28
+ return this._argTypes[index] ?? this._argTypes[this._argTypes.length - 1];
29
+ }
30
+ match(type) {
31
+ if (type instanceof FunctionAtom) {
32
+ if (!this._retType || !type._retType) {
33
+ return true;
34
+ }
35
+ if (!this._retType.match(type._retType) || this.minArity > type.maxArity || this.maxArity < type.minArity) {
36
+ return false;
37
+ }
38
+ for (let i = 0, argc = Math.max(this.minArity, type.minArity); i < argc; ++i) {
39
+ if (!this.argType(i).match(type.argType(i))) {
40
+ return false;
41
+ }
42
+ }
43
+ return true;
44
+ }
45
+ return false;
46
+ }
47
+ weight() {
48
+ return 0x1000000000000 + this.subtypes().reduce((acc, i) => acc + i.weight(), 0);
49
+ }
50
+ toString() {
51
+ const argTypes = this._argTypes.map((i) => i.toString()).join(',');
52
+ return this._retType ? `~${this._retType.toString()}(${argTypes}${this.isVariadic ? '...' : ''})` : '~()';
53
+ }
54
+ }
@@ -0,0 +1,11 @@
1
+ import { IType } from '../Type.js';
2
+ export declare class ObjectAtom implements IType {
3
+ protected readonly _propTypes: Record<string, IType>;
4
+ constructor(_propTypes?: Record<string, IType>);
5
+ get empty(): boolean;
6
+ subtypes(): IType[];
7
+ propType(property: string): IType;
8
+ match(type: IType): boolean;
9
+ weight(): number;
10
+ toString(): string;
11
+ }
@@ -0,0 +1,44 @@
1
+ export class ObjectAtom {
2
+ _propTypes;
3
+ constructor(_propTypes = {}) {
4
+ this._propTypes = _propTypes;
5
+ }
6
+ get empty() {
7
+ return Object.keys(this._propTypes).length === 0;
8
+ }
9
+ subtypes() {
10
+ return Object.values(this._propTypes);
11
+ }
12
+ propType(property) {
13
+ return this._propTypes[property];
14
+ }
15
+ match(type) {
16
+ if (type instanceof ObjectAtom) {
17
+ if (this.empty || type.empty) {
18
+ return true;
19
+ }
20
+ for (const prop in this._propTypes) {
21
+ if (!type.propType(prop)) {
22
+ return false;
23
+ }
24
+ if (!this._propTypes[prop].match(type._propTypes[prop])) {
25
+ return false;
26
+ }
27
+ }
28
+ for (const prop in type._propTypes) {
29
+ if (!this.propType(prop)) {
30
+ return false;
31
+ }
32
+ }
33
+ return true;
34
+ }
35
+ return false;
36
+ }
37
+ weight() {
38
+ return 0x100000000 + this.subtypes().reduce((acc, i) => acc + i.weight(), 0);
39
+ }
40
+ toString() {
41
+ const entries = Object.entries(this._propTypes);
42
+ return entries.length ? `[${entries.map((i) => i[0] + ':' + i[1].toString()).join(',')}]` : '[:]';
43
+ }
44
+ }
@@ -0,0 +1,8 @@
1
+ import { IType, Primitive } from '../Type.js';
2
+ export declare class PrimitiveAtom implements IType {
3
+ protected readonly _primitive: Primitive;
4
+ constructor(_primitive?: Primitive);
5
+ match(type: IType): boolean;
6
+ weight(): number;
7
+ toString(): string;
8
+ }
@@ -0,0 +1,26 @@
1
+ export class PrimitiveAtom {
2
+ _primitive;
3
+ constructor(_primitive = 'void') {
4
+ this._primitive = _primitive;
5
+ }
6
+ match(type) {
7
+ if (type instanceof PrimitiveAtom) {
8
+ return type._primitive === this._primitive;
9
+ }
10
+ return false;
11
+ }
12
+ weight() {
13
+ switch (this._primitive) {
14
+ case 'void': return 0x0;
15
+ case 'boolean': return 0x2;
16
+ case 'timestamp': return 0x3;
17
+ case 'float': return 0x8;
18
+ case 'integer': return 0x10;
19
+ case 'buffer': return 0x20;
20
+ case 'string': return 0x30;
21
+ }
22
+ }
23
+ toString() {
24
+ return this._primitive;
25
+ }
26
+ }