svoid tok_moduleClassDecls(L tok) { jreplace(tok, "module implements", "module $2 extends DynModule implements"); jreplace(tok, "module {", "module $2 extends DynModule {"); jreplace(tok, "module {", "module " + stefansOS_defaultModuleClassName() + " {"); jreplace(tok, "module > ", "module " + stefansOS_defaultModuleClassName() + " > $3"); int i = -1; while ((i = jfind(tok, i+1, "module ", // check for interference with other productions (_tok, nIdx) -> !eqGetOneOf(_tok, nIdx+3, "instanceof", "default", "aka"))) >= 0) { int j = findEndOfBlock(tok, indexOf(tok, "{", i))-1; S name = tok.get(i+2); tok.set(i, "sclass"); tokAppend(tok, j, "\nsbool _moduleClass_" + name + " = true;"); // just a marker to quickly find module classes reTok(tok, j, j+1); } }