// It's rough but should work if you don't make anonymous classes inside the statement or something... // Return value is index of semicolon+1 static int findEndOfStatement(L cnc, int i) { int j = indexOf(cnc, ";", i); ret j < 0 ? l(cnc)-1 : j+1; }