more tellyscript tweaks

This commit is contained in:
zefie
2025-02-21 07:24:45 -05:00
parent a2e1166efc
commit 67375ce72f
8 changed files with 11 additions and 944 deletions

View File

@@ -918,7 +918,7 @@ class WTVTellyScriptMinifier {
tokenize(input) {
// Define token specs as pairs: [regex, tokenType]
const tokenSpecs = [
[/^\s+/, 'WHITESPACE'], // Whitespace (skip)
[/^\s+/, 'WHITESPACE'], // Whitespace
[/^\/\/.*/, null], // Single-line comment (skip)
[/^\/\*[\s\S]*?\*\//, null], // Multi-line comment (skip)
// Keywords (update with your TellyScript keywords as needed)
@@ -967,7 +967,14 @@ class WTVTellyScriptMinifier {
let output = "";
for (let i = 0; i < tokens.length; i++) {
const token = tokens[i];
output += token.value;
if (token.type === 'WHITESPACE') {
//token.value = token.value.replaceAll("\r", " ");
if (token.value.indexOf("\n") !== -1) output += token.value.replaceAll("\n\n\n", "\n\n");
else output += " ";
} else {
output += token.value;
}
// Look ahead to the next token
if (i < tokens.length - 1) {