srecord noeq Tok_IdentifierSemicolonToReturnStatement(LS tok) { Set exceptions = defaultExceptions; static Set defaultExceptions = litset("break", "continue", "return", "else", "endifdef", "endif"); Set precedingTokens = defaultPrecedingTokens; static Set defaultPrecedingTokens = litset("}", ";"); TokCondition cond = new { public bool get(L tok, int nIdx) { ret contains(precedingTokens, _get(tok, nIdx-1)) && !contains(exceptions, tok.get(nIdx+1)); } }; run { for (S pre : precedingTokens) jreplace(tok, ";", "ret $1;", cond); } }