// if condition then code end svoid tok_ifThenEnd(LS tok) { int i = -1; while >= 0 (i = jfind(tok, i+1, "if ")) { int iThen = indexOf(tok, i, "then"); if (iThen < 0) continue with print("No then for if"); int iEnd = tok_findTokenSkippingCurlyBrackets(tok, iThen, "end"); if (iEnd < 0) continue with print("No end for if"); tokSet(tok, iEnd, "}"); replaceTokens_reTok(tok, iThen-1, iThen+1, ") {"); replaceTokens_reTok(tok, i, i+2, "if ("); } }