!7 srecord Guesser(S regexp, S annotation) {} cmodule CLAG > DynPrintLogAndEnabled { new Map entries; // text -> annotations L guessers = litsynclist(Guesser("eval", "eval command")); sclass ByCategory { Guesser bestGuesser; } start { doEvery(1.0, r step); } void step enter { if (!enabled) ret; temp tempPrintTime(); dm_clearModulePrintLog(); // find annotator module S mod = annotator(); if (empty(mod)) ret; // get visible rows IntRange vis = cast quickImport(dm_rcall visibleRows(mod)); if (vis == null) ret; L allData = (L) dm_rcall data(mod); L visibleData = subList(allData, vis); // get all annotations Set all = cast dm_rcall allAnnotations(mod); print(+all); bool change; fOr (virtual Entry e : visibleData) { S text = getString text(e); LS annotations = cast rcall annotations(e); entries.put(text, annotations); Set guesses = ciSet(); for (Guesser guesser : guessers) if (regexpFindIC(guesser.regexp, text)) guesses.add(guesser.annotation); S guess = joinWithComma(guesses); if (set_trueIfChanged(e, +guess)) set change; } if (change) dm_rcall fireDataChanged(mod); } S annotator() { ret dm_moduleWithSnippetID(#1024172); } }