From 0c27905a43ec6b61479a0beaf60f5c85bb6c184f Mon Sep 17 00:00:00 2001 From: dutchie031 Date: Sun, 20 Sep 2026 12:42:17 +0200 Subject: [PATCH] updated the compiler to not leave whitespace when parsing tables --- compiler/src/CodeBlocks.ts | 7 ++++++- dutchies-dcs-scripting-tools/package.json | 2 +- github-actions/bundle-script/package.json | 2 +- github-actions/install-lua-addon/package.json | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/compiler/src/CodeBlocks.ts b/compiler/src/CodeBlocks.ts index b5d6243..486d9b6 100644 --- a/compiler/src/CodeBlocks.ts +++ b/compiler/src/CodeBlocks.ts @@ -223,10 +223,15 @@ export abstract class CodeBlock { } if (tempCursor < fileContent.length && fileContent[tempCursor] === '\n') { - currentBlockString += '\n'; + currentBlockString = trimEndPreserveNewlines(currentBlockString) + '\n'; lineCounter++; lineCursor = 0; leftCursor = tempCursor + 1; + } else if (tempCursor < fileContent.length && fileContent[tempCursor] === '-' && tempCursor + 1 < fileContent.length && fileContent[tempCursor + 1] === '-') { + // Found a comment after whitespace, trim the whitespace and position at the comment + currentBlockString = trimEndPreserveNewlines(currentBlockString) + '\n'; + leftCursor = tempCursor; + lineCursor = tempLineCursor; } else if (tempCursor > leftCursor) { // We found whitespace but no newline, so position cursor at last whitespace leftCursor = tempCursor; diff --git a/dutchies-dcs-scripting-tools/package.json b/dutchies-dcs-scripting-tools/package.json index d6c3f47..ad45837 100644 --- a/dutchies-dcs-scripting-tools/package.json +++ b/dutchies-dcs-scripting-tools/package.json @@ -2,7 +2,7 @@ "name": "dutchies-dcs-scripting-tools", "displayName": "Dutchies Dcs Scripting Tools", "description": "Scripting tools to create DCS script and frameworks easier", - "version": "0.2.0", + "version": "0.2.1", "author": { "name": "dutchie031", "email": "54616262+dutchie031@users.noreply.github.com" diff --git a/github-actions/bundle-script/package.json b/github-actions/bundle-script/package.json index 4e5f601..b3ed2bc 100644 --- a/github-actions/bundle-script/package.json +++ b/github-actions/bundle-script/package.json @@ -1,6 +1,6 @@ { "name": "gh-scripting-compiler", - "version": "1.1.4", + "version": "1.1.5", "type": "module", "main": "dist/index.js", "scripts": { diff --git a/github-actions/install-lua-addon/package.json b/github-actions/install-lua-addon/package.json index 1e4a35a..5eddaf1 100644 --- a/github-actions/install-lua-addon/package.json +++ b/github-actions/install-lua-addon/package.json @@ -1,6 +1,6 @@ { "name": "gh-lua-addon-installer", - "version": "1.1.0", + "version": "1.1.1", "main": "dist/index.js", "scripts": { "build": "node esbuild.js",