And if Game Maker didn't allow these bull**** programming styles, I wouldn't have to
write hours of extra code. *trollface*
For the purpose of pointing this out, here is a section from the obfuscator code:
private static void fix****tyProgramming(List<Token> l, int ver) {
for (int i = 0; i < l.size(); i++) {
if (l.get(i).getType() == TokenType.FIXCANDIDATE) {
Token prev = previousNonCommentOrSpaceToken(l, i);
if (prev != null && prev.getType() == TokenType.IDENTIFIER &&
!GMNativityUtil.isGMKeyword(prev.getToken(), ver)) {
insertProperCurlyBrackets(l, i);
}
}
}
}
private static Token previousNonCommentOrSpaceToken(List<Token> l, int index) {
Token t = null;
for (int i = index-1; i >= 0; i--) {
if (l.get(i).getType() != TokenType.COMMENT) {
if (!(l.get(i).getType() == TokenType.DELIMITER &&
l.get(i).getToken().equals(" "))) {
t = l.get(i);
break;
}
}
}
return t;
}
private static void insertProperCurlyBrackets(List<Token> l, int index) {
l.add(index, new Token(TokenType.DELIMITER, "{"));
// strategy: two adjacent identifiers or a semicolon or a } marks end of block
// knowledge: we already know that every space separates two identifiers
boolean found = false;
for (int i = index; i < l.size(); i++) {
Token t = l.get(i);
if (t.getType() == TokenType.DELIMITER && (t.getToken().equals(" ") ||
t.getToken().equals(";") || t.getToken().equals("}"))) {
l.add(i+1, new Token(TokenType.DELIMITER, "}"));
found = true;
break;
}
}
if (!found) {
l.add(l.size(), new Token(TokenType.DELIMITER, "}"));
}
}
Pay special attention to what name I gave the first method there.
Edited by Schreib, 06 June 2012 - 06:02 PM.