Jump to content
Sign in to follow this  
torndeco

Python SQF NewLine/Indenter Script

Recommended Posts

https://github.com/Torndeco/SQF-Indenter

--------------

--------------

Requirements Python 3.4

Its just a simple script that indents SQF Code..

cd <path to sqf files>

C:\Python34\Python.exe <path to sqf-indenter>/sqfIndentor.py

The script will parse all *.sqf in current directory + create new files with -new added to the filename.

It still needs a small bit of work, but its pretty good.

Really i just needs to recode it so easier for people alter the rules for indentation.

As side bonus it is pretty decent at de-obfuscating SQF Code aswell.

Share this post


Link to post
Share on other sites

Nice.

Didnt see this before now.

Will try it out as soon as i get time.

Reading code that is properly indented is almost as satisfying as like looking at a beautiful woman:)

As a request|Idea.

What about adding in a class for Sqf compression ?

What i mean is, remove all newlines, indents, comments, unnecessary spaces, rename long varnames to shorter ones and so forth.

Kind of like a obfuscator.

It will be a miniscule performance gain. But optimizing code is always a good thing imo.

Example

python sqfIndenter.py -i myscript.sqf <-- will ident the code and save it as a new file

python sqfIndenter.py -c myscript.sqf <-- will compress the code and save it as a new file

Share this post


Link to post
Share on other sites

Awesome work!

I'm about to make a python module that parses SQM code and returns the available player slots as a JSON object. I hope your code may come in handy when parsing SQM.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×