Compare commits
2 Commits
738bbdafb9
...
aa1c665421
Author | SHA1 | Date |
---|---|---|
Jill | aa1c665421 | |
Jill | 89cbcd85a4 |
12
index.js
12
index.js
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue