fix comment removal
This commit is contained in:
parent
d95ec10f53
commit
38038d710b
11
index.js
11
index.js
|
@ -41,6 +41,13 @@ function transpile(parsed, indent, prefix) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeComments(code) {
|
||||||
|
// remove /* */ style comments, for now
|
||||||
|
code = code.replace(/\/\*(.*?)\*\//gs, '');
|
||||||
|
code = code.split('\n').filter(c => !c.trim().startsWith('//')).join('\n');
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} code
|
* @param {string} code
|
||||||
*/
|
*/
|
||||||
|
@ -52,9 +59,7 @@ function parse(code) {
|
||||||
// were gonna end up with an ast of sorts anyways as a result, which we can then use instead of declares
|
// were gonna end up with an ast of sorts anyways as a result, which we can then use instead of declares
|
||||||
|
|
||||||
// sanitize stuff
|
// sanitize stuff
|
||||||
code = code.split('\n').filter(c => !c.trim().startsWith('//')).join('\n');
|
code = removeComments(code);
|
||||||
// remove /* */ style comments, for now
|
|
||||||
code = code.replace(/\/\*(.*?)(?=\*\/)/gs, '');
|
|
||||||
|
|
||||||
const elements = [];
|
const elements = [];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue