!7 sclass Entry { S pattern; Map params; // null if not matched sS _fieldOrder = "pattern params"; } cmodule MatchingInputPatterns > DynObjectTable { transient S input; transient LinkedHashSet processedGroupings; start { set fieldsInOrder; dm_onTopInput_q(vf process); process(dm_topInput()); dm_vmBus_onMessage_q('newInputGroupings, voidfunc(O mod, S _input, LS groupings) { print("Got groupings"); S topInput = dm_topInput(); if (neq(topInput, input)) process(topInput); if (neq(_input, input)) ret; for (S s : groupings) process2(s); }); } // happens in queue void process(S s) { clear(); input = s; processedGroupings = new LinkedHashSet; process2(s); } void process2(S s) { if (!processedGroupings.add(s)) ret; LS patterns = collect pattern((L) dm_requireAndCallModule("#1020518/InputPatterns", 'data)); print("Processing input " + quote(s) + " with " + n2(patterns, "pattern") + ": " + patterns); new Matches m; for (S pat : patterns) if (match3_plusBrackets(pat, s, m)) { add(nu(Entry, pattern := pat, params := matchesToMap(m))); print("Data length: " + l(data)); } } }