// turns out reMutable and reImmutable are the same thing :) // TODO: handle this.myVar svoid tok_reImmutableVars(LS tok) { tok_unifyKeywords(tok, remutableKeywords(), "reImmutable"); // without assignment jreplace_dyn(tok, "reImmutable ;", (_tok, i) -> { S var = _get(tok, i+2); S var2 = makeVar(var); ret "var \*var2*/ = \*var*/; replace var \*var*/ with \*var2*/.\n"; }); // with assignment for (int i : jfind_all_reversed(tok, "reImmutable =")) { S var = _get(tok, i+2); S var2 = makeVar(var); int j = tok_endOfStatement(tok, i+6); S expr = joinSubList(tok, i+6, j-1); tokReplace_reTok(tok, i, j, "var \*var2*/ = \*expr*/; replace var \*var*/ with \*var2*/.\n"); } }