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