// e.g. cast req to Req; // (converts req to (Req) req for the rest of the block) svoid tok_castToStatements(LS tok) { while ((i = jfind(tok, "cast to")) >= 0) { S id = tok.get(i+2); int iTypeStart = i+6; int semicolon = findEndOfStatement(tok, iTypeStart)-1; int endOfOuterBlock = findEndOfBracketPart(tok, semicolon)-1; S type = joinSubList(tok, iTypeStart, semicolon-1); for (int j = semicolon+2; j < endOfOuterBlock; j += 2) if (eqGet(tok, j, id)) tok.set(j, "((" + type + ") " + id + ")"); clearTokens(tok, i, semicolon+1); reTok(tok, i, endOfOuterBlock); } }