Skip to content

Commit 005ad0f

Browse files
Disallow 吾有零數, 欲行是術必先得零數 and 取零以施
1 parent 95a1293 commit 005ad0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/parser.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ function tokens2asc(
246246
typeassert(i + 1, ["num"], "variable count");
247247
typeassert(i + 2, ["type"], "variable type");
248248
const cnt = Number(gettok(i + 1, 1));
249-
assert(`Invalid variable count ${cnt}`, pos, Number.isSafeInteger(cnt) && cnt >= 0);
249+
assert(`Invalid variable count ${cnt}`, pos, Number.isSafeInteger(cnt) && cnt > 0);
250250

251251
var x = {
252252
op: "var",
@@ -319,7 +319,7 @@ function tokens2asc(
319319
typeassert(i + 1, ["type"], "argument type");
320320
var typ = gettok(i + 1, 1);
321321
var cnt = Number(gettok(i, 1));
322-
assert(`Invalid argument count ${cnt}.`, pos, Number.isSafeInteger(cnt) && cnt >= 0);
322+
assert(`Invalid argument count ${cnt}.`, pos, Number.isSafeInteger(cnt) && cnt > 0);
323323
x.arity += cnt;
324324
i += 2;
325325
for (var j = 0; j < cnt; j++) {
@@ -549,7 +549,7 @@ function tokens2asc(
549549
} else if (gettok(i, 0) == "take") {
550550
typeassert(i + 1, ["num"], "argument count");
551551
const cnt = Number(gettok(i + 1, 1));
552-
assert(`Invalid argument count ${cnt}`, pos, Number.isSafeInteger(cnt) && cnt >= 0);
552+
assert(`Invalid argument count ${cnt}`, pos, Number.isSafeInteger(cnt) && cnt > 0);
553553
asc.push({ op: "take", count: cnt, pos });
554554
i += 2;
555555
} else if (gettok(i, 0) == "import" && gettok(i, 1) == "file") {

0 commit comments

Comments
 (0)