tavurth / godot-gdscript-obfuscator

Start of the work to obfuscate GDscript
GNU General Public License v3.0
45 stars 2 forks source link

Make all code inline (proposal) #3

Open kz-n opened 2 years ago

kz-n commented 2 years ago

Instead of keeping newlines, where possible, replace with ;

tavurth commented 2 years ago

I think this would cause problems with function definition, but perhaps there may be a way around it.

GDScript is primary an indented language, and uses whitespace for the parser.

Any thoughts about how to get around that restriction?

kz-n commented 2 years ago
func _enter_tree(): print("hi")

This works in Godot 4, I just tested and it indeed doesn't work on 3x, It still is possible to condense new lines with ; on those versions though, So maybe only add a new line after the function definition but keep all the rest inline

tavurth commented 2 years ago

This should be pretty easy to accomplish. I haven't actually finished the new construction method yet (AST) as I've been working on other projects.

When I need this I will push for a completion. In general when re-compiling it should be easy to strip out the extra newlines.

kz-n commented 2 years ago

Now that I think about it, this is probably unnecessary, especially with compiled GDScript