Skip to content

comments not preserved #44

@pancelor

Description

@pancelor

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions