Fixed for-loop parsing

This commit is contained in:
dcodeIO
2017-11-29 00:18:14 +01:00
parent df637164a6
commit bad5175a55
10 changed files with 250 additions and 63 deletions

View File

@ -0,0 +1,3 @@
do {
;
} while (a != b);

View File

@ -0,0 +1,9 @@
for (let i: i32 = 0; i < 10; ++i) {
;
}
for (i = 0; i < 10; ++i) {
;
}
for (;;) {
;
}

View File

@ -0,0 +1,42 @@
0;
1;
2;
3;
4;
5;
6;
7;
8;
9;
// 0x0;
// 0x1;
// 0x2;
// 0x3;
// 0x4;
// 0x5;
// 0x6;
// 0x7;
// 0x8;
// 0x9;
// 0xA;
// 0xB;
// 0xC;
// 0xD;
// 0xE;
// 0xF;
// 0xa;
// 0xb;
// 0xc;
// 0xd;
// 0xe;
// 0xf;
// 0o0;
// 0o1;
// 0o2;
// 0o3;
// 0o4;
// 0o5;
// 0o6;
// 0o7;
// 0b0;
// 0b1;

View File

@ -0,0 +1,9 @@
while (1) {
;
}
while (true) {
;
}
while ("str") {
;
}

View File

@ -1,12 +1,15 @@
import * as fs from "fs";
import * as diff from "diff";
import * as chalk from "chalk";
import * as glob from "glob";
import "../../src/glue/js";
import { NodeKind, ExpressionStatement } from "../../src/ast";
import { Parser } from "../../src/parser";
const files = fs.readdirSync(__dirname + "/fixtures");
const filter = process.argv.length > 2 ? "*" + process.argv[2] + "*.ts" : "**.ts";
const files = glob.sync(filter, { cwd: __dirname + "/fixtures" });
files.forEach(filename => {
if (filename.charAt(0) == "_") return;
const isTree = filename.indexOf(".tree.") >= 0;