Compare commits

...

2 Commits

Author SHA1 Message Date
Jill aa1c665421 oops i accidentally parsed 3x the files i needed 2021-11-04 09:19:28 +03:00
Jill 89cbcd85a4 fix some type shenanigans 2021-11-04 09:15:10 +03:00
1 changed files with 8 additions and 4 deletions

View File

@ -28,6 +28,10 @@ function transpileType(type) {
return transpileType(type.slice(0, -2)) + '[]';
}
if (type.startsWith('LuaMultiReturn<[') && type.endsWith(']>')) {
return type.replace('LuaMultiReturn<[','').replace(']>','').split(',').map(t => transpileType(t.split(':')[1])).join(', ');
}
if (type.includes('|')) {
return type.split('|').map(t => transpileType(t)).join(' | ');
}
@ -139,7 +143,7 @@ function parse(code) {
// look for functions
let functionFreeCode = code;
const functions = /(function)?\s(\w+)\s*\(([^;]*)\)(\s*:\s*([\w\[\]\s|<>,]+))?/g; // wow this sucks
const functions = /(function)?\s(\w+)\s*\(([^;]*)\)(\s*:\s*([\w\[\]\s|<>,:]+))?/g; // wow this sucks
while ((match = functions.exec(code)) !== null) {
parsedElements++;
functionFreeCode = functionFreeCode.replace(match[0], '');
@ -176,14 +180,14 @@ function parse(code) {
return elements;
}
async function recursiveReaddir(rpath, p, fileNames) {
async function recursiveReaddir(rpath, p) {
p = p || '';
fileNames = (fileNames || []).slice();
let fileNames = [];
const files = await fs.readdir(rpath);
for (const f of files) {
const stat = await fs.lstat(path.join(rpath, f));
if (stat.isDirectory() || stat.isSymbolicLink()) {
fileNames.push(...await recursiveReaddir(path.join(rpath, f), p + f + '/', fileNames));
fileNames.push(...await recursiveReaddir(path.join(rpath, f), p + f + '/'));
} else {
fileNames.push(p + f);
}