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

Normalize Whitespace #14

Open
danielWatson3141 opened this issue Mar 4, 2019 · 0 comments
Open

Normalize Whitespace #14

danielWatson3141 opened this issue Mar 4, 2019 · 0 comments

Comments

@danielWatson3141
Copy link
Owner

I would like the ability to normalize the whitespace of all code in a GPS. That is:

Any "unnecessary" spaces, those which do not effect the syntax of the code should be removed.
Any instances of multiple, consecutive, identical, white-space characters should be reduced to single instances of the character (except for tabs).
Newlines should only occur:

  1. After semi-colons

  2. After opening brackets {

  3. Before and after closing brackets }

  4. After colons : as in switch cases and labels.

  5. After ) in for, if, and while blocks with no brackets

  6. I am open to other logical instances.

All other newlines should be stripped out.

For example,
<-------------------------------------------------------------------->
for( int i=0; i<10; i++) would reduce to for(int i=0;i<10;i++). Note the only remaining space comes after the "int" as it is syntactically necessary.
<-------------------------------------------------------------------->
int i=0 reduces to int i=0 (got rid of double space)
<-------------------------------------------------------------------->
for(int i=0;i<10;i++)
foo()
remains unchanged
<-------------------------------------------------------------------->
code

code

would be reduced to:
code
code
as newlines count.
<-------------------------------------------------------------------->
The goal here is to propose and validate one step in an obfuscation process. That is, a way to prevent stylometric attacks without obscuring the meaning of the code.

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

1 participant