/* event change; => transient L onChange; selfType onChange(Runnable r) { onChange = syncAddOrCreate(onChange, r); this; } void change() { pcallFAll(onChange); } */ svoid tok_eventFunctions(LS tok) { int i; while ((i = jfind(tok, "event ")) >= 0) { int iSemicolon = i+4; LS tokArgs = null; if (eqGet(tok, i+4, "(")) { int argsFrom = i+6; int argsTo = findCodeTokens(tok, argsFrom, false, ")"); tokArgs = subList(tok, argsFrom-1, argsTo); iSemicolon = argsTo+2; } // TODO for next version: parse modifiers in square brackets //if (eqGet(tok, iSemicolon, "[")) if (neqGet(tok, iSemicolon, ";")) fail("Semicolon expected at end: " + joinSubList(tok, i, iSemicolon+1)); S change = tok.get(i+2); S onChange = "on" + firstToUpper(change); LPairS args = tok_typesAndNamesOfParams(tokArgs); LS types = pairsA(args); S args1 = join(dropFirstAndLast(tokArgs)); S args2 = joinWithComma(pairsB(args)); S typeParams = joinWithComma(map tok_toNonPrimitiveTypes(types)); S listenerType = empty(args) ? "Runnable" : "IVF" + l(args) + "<" + typeParams + ">"; } }