!7 set flag AllowMetaCode. set flag Reparse. meta-transformNow { tok_standardBot } standard bot WeNeed { Set db = ciSet(); S add(S s) { if (db.add(s)) change(); null; } S remove(S s) { ret db.remove(s) ? with(r change, "What a relief") : null; } S listWithPattern(S pat) { ret or2(lines(map(db, x -> format(ellipsisToStar(pat), x))), "nothing"); } S clearAfterConfirm() { ret "You're kidding, right?"; } sync S processSimplifiedLine(S s, O... _) { try answer super.processSimplifiedLine(s, _); new Matches m; meta { S program = [[ We need ... = + We have ... = - Someone gave us/me ... = - What do we need = listWithPattern("We need ...") We don't need ... anymore = - We need nothing|We don't need anything = clear after confirm ]]; LS tok = javaTok(program); jreplace(tok, "+", "add(\\$1);"); jreplace(tok, "-", "remove(\\$1);"); jreplace(tok, "clear after confirm", "clearAfterConfirm();"); LS lines = lines(join(tok)); lines = map(lines, l -> { PairS p = splitAtEquals_pair(l); ret p == null ? l : "if (matchX2(\*quote(p.a)*/, s, m)) ret \*p.b*/;"; }); ret lines(lines); } null; } }