greybel-interpreter 2.2.0 → 2.2.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.
@@ -63,11 +63,11 @@ exports.StringProcessorHandler = {
63
63
  [greyscript_core_1.Operator.Plus]: (a, b) => new string_1.CustomString(a.toString() + b.toString()),
64
64
  [greyscript_core_1.Operator.Minus]: (a, b) => (0, exports.minusString)(a, b),
65
65
  [greyscript_core_1.Operator.Asterik]: (a, b) => (0, exports.multiplyString)(a, b),
66
- [greyscript_core_1.Operator.LessThan]: (a, b) => new boolean_1.CustomBoolean(a.toString().length < b.toString().length),
67
- [greyscript_core_1.Operator.GreaterThan]: (a, b) => new boolean_1.CustomBoolean(a.toString().length > b.toString().length),
68
- [greyscript_core_1.Operator.GreaterThanOrEqual]: (a, b) => new boolean_1.CustomBoolean(a.toString().length >= b.toString().length),
66
+ [greyscript_core_1.Operator.LessThan]: (a, b) => new boolean_1.CustomBoolean(a.toString() < b.toString()),
67
+ [greyscript_core_1.Operator.GreaterThan]: (a, b) => new boolean_1.CustomBoolean(a.toString() > b.toString()),
68
+ [greyscript_core_1.Operator.GreaterThanOrEqual]: (a, b) => new boolean_1.CustomBoolean(a.toString() >= b.toString()),
69
69
  [greyscript_core_1.Operator.Equal]: (a, b) => new boolean_1.CustomBoolean(a.toString() === b.toString()),
70
- [greyscript_core_1.Operator.LessThanOrEqual]: (a, b) => new boolean_1.CustomBoolean(a.toString().length <= b.toString().length),
70
+ [greyscript_core_1.Operator.LessThanOrEqual]: (a, b) => new boolean_1.CustomBoolean(a.toString() <= b.toString()),
71
71
  [greyscript_core_1.Operator.NotEqual]: (a, b) => new boolean_1.CustomBoolean(a.toString() !== b.toString())
72
72
  };
73
73
  const multiplyList = (a, b) => {
@@ -103,36 +103,12 @@ exports.ListProcessorHandler = {
103
103
  }
104
104
  return left;
105
105
  },
106
- [greyscript_core_1.Operator.LessThan]: (left, right) => {
107
- if (right instanceof list_1.CustomList) {
108
- return new boolean_1.CustomBoolean(left.value.length < right.value.length);
109
- }
110
- return default_1.DefaultType.Void;
111
- },
112
- [greyscript_core_1.Operator.GreaterThan]: (left, right) => {
113
- if (right instanceof list_1.CustomList) {
114
- return new boolean_1.CustomBoolean(left.value.length > right.value.length);
115
- }
116
- return default_1.DefaultType.Void;
117
- },
118
- [greyscript_core_1.Operator.GreaterThanOrEqual]: (left, right) => {
119
- if (right instanceof list_1.CustomList) {
120
- return new boolean_1.CustomBoolean(left.value.length >= right.value.length);
121
- }
122
- return default_1.DefaultType.Void;
123
- },
124
106
  [greyscript_core_1.Operator.Equal]: (left, right) => {
125
107
  if (right instanceof list_1.CustomList) {
126
108
  return new boolean_1.CustomBoolean((0, deep_equal_1.deepEqual)(left, right));
127
109
  }
128
110
  return default_1.DefaultType.Void;
129
111
  },
130
- [greyscript_core_1.Operator.LessThanOrEqual]: (left, right) => {
131
- if (right instanceof list_1.CustomList) {
132
- return new boolean_1.CustomBoolean(left.value.length <= right.value.length);
133
- }
134
- return default_1.DefaultType.Void;
135
- },
136
112
  [greyscript_core_1.Operator.NotEqual]: (left, right) => {
137
113
  if (right instanceof list_1.CustomList) {
138
114
  return new boolean_1.CustomBoolean(!(0, deep_equal_1.deepEqual)(left, right));
@@ -149,36 +125,12 @@ exports.MapProcessorHandler = {
149
125
  }
150
126
  return left;
151
127
  },
152
- [greyscript_core_1.Operator.LessThan]: (left, right) => {
153
- if (right instanceof map_1.CustomMap) {
154
- return new boolean_1.CustomBoolean(left.value.size < right.value.size);
155
- }
156
- return default_1.DefaultType.Void;
157
- },
158
- [greyscript_core_1.Operator.GreaterThan]: (left, right) => {
159
- if (right instanceof map_1.CustomMap) {
160
- return new boolean_1.CustomBoolean(left.value.size > right.value.size);
161
- }
162
- return default_1.DefaultType.Void;
163
- },
164
- [greyscript_core_1.Operator.GreaterThanOrEqual]: (left, right) => {
165
- if (right instanceof map_1.CustomMap) {
166
- return new boolean_1.CustomBoolean(left.value.size >= right.value.size);
167
- }
168
- return default_1.DefaultType.Void;
169
- },
170
128
  [greyscript_core_1.Operator.Equal]: (left, right) => {
171
129
  if (right instanceof map_1.CustomMap) {
172
130
  return new boolean_1.CustomBoolean((0, deep_equal_1.deepEqual)(left, right));
173
131
  }
174
132
  return default_1.DefaultType.Void;
175
133
  },
176
- [greyscript_core_1.Operator.LessThanOrEqual]: (left, right) => {
177
- if (right instanceof map_1.CustomMap) {
178
- return new boolean_1.CustomBoolean(left.value.size <= right.value.size);
179
- }
180
- return default_1.DefaultType.Void;
181
- },
182
134
  [greyscript_core_1.Operator.NotEqual]: (left, right) => {
183
135
  if (right instanceof map_1.CustomMap) {
184
136
  return new boolean_1.CustomBoolean(!(0, deep_equal_1.deepEqual)(left, right));
@@ -199,7 +151,10 @@ exports.FunctionProcessorHandler = {
199
151
  [greyscript_core_1.Operator.NotEqual]: (a, b) => new boolean_1.CustomBoolean(a !== b)
200
152
  };
201
153
  const handleNumber = (op, a, b) => {
202
- if (op in exports.NumberProcessorHandler) {
154
+ if (b instanceof nil_1.CustomNil) {
155
+ b = new number_1.CustomNumber(0);
156
+ }
157
+ if (op in exports.NumberProcessorHandler && b instanceof number_1.CustomNumber) {
203
158
  return exports.NumberProcessorHandler[op](a, b);
204
159
  }
205
160
  else if (op in exports.GenericProcessorHandler) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greybel-interpreter",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Interpreter",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index",
@@ -48,8 +48,8 @@
48
48
  "typescript": "^5.0.4"
49
49
  },
50
50
  "dependencies": {
51
- "greybel-core": "^0.9.5",
52
- "greyscript-core": "^0.9.7"
51
+ "greybel-core": "^0.9.6",
52
+ "greyscript-core": "^0.9.9"
53
53
  },
54
54
  "keywords": [
55
55
  "greyscript",