!752 p { S s = "L list2 = [S s in list | isIdentifier(s)];"; L tok = javaTok(s); Map bracketMap = getBracketMap(tok); int i = jfind(tok, "[ in"); if (i >= 0) { S type = tok.get(i+2), id = tok.get(i+4); int j = scanOverExpression(tok, bracketMap, i+8, "|"); S exp = join(tok.subList(i+8, j)); j += 2; int k = scanOverExpression(tok, bracketMap, j, "]"); S where = join(tok.subList(j, k)); ++k; S rest = join(subList(tok, k)); S temp = "temp"; /* S code = "new L<" + type + "> " + temp + ";\n" + "for (" + type + " " + id + " : " + exp + ")\n" + " if (" + where + ") " + temp + ".add(" + id + ");\n";*/ S code = "filter(" + exp + ", func(" + type + " " + id + ") { " + where + " })"; print(join(tok.subList(0, i)) + code + rest); } }