Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

comments not preserved #44

Open
pancelor opened this issue Sep 3, 2024 · 1 comment
Open

comments not preserved #44

pancelor opened this issue Sep 3, 2024 · 1 comment

Comments

@pancelor
Copy link
Contributor

pancelor commented Sep 3, 2024

A few weird cases I'm running into; I want to preserve comments in my file but am uncovering some bugs:

case 1

> echo -e 'if dev then --cool\n end' | shrinko8 - - -f lua -m --no-minify-comments --no-minify-spaces --const dev true

expected output: --cool
actual output: (nothing)

> echo '--cool' | shrinko8 - - -f lua -m --no-minify-comments --no-minify-spaces

expected output: --cool
actual output: (nothing)

case 2

test2.lua:

--[[something]]
if dev then
-- true
a=1
else
-- false
a=0
end
> shrinko8 test2.lua out.lua -m --no-minify-comments --no-minify-spaces --const dev true

In this case, the --true/--false comments are removed completely for some reason. But weirdly, this only happens when the --[[something]] comment exists -- remove it and the behavior is fine

case 3

test3.lua:

if dev then
-- true
a=1
else
-- false
a=0
end
> shrinko8 --minify --no-minify-spaces --no-minify-comments test3.lua - -f lua
if (n) e=1 else e=0

(expected output: comments should not be removed)

@thisismypassport
Copy link
Owner

I'm looking into it, but it's a bit tricky.
Case 1 is the one I'm least sure about - it's kinda arbitrary whether a comment is applied to an empty block (?!) or the removed "end".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants