sclass CodeSafetyChecker { // general data SS identifierSafetyMap; bool identifiersStartingWithDollarAreSafe; // data for code currently tested S code; Set identifiers; Set tags; void init { if (identifierSafetyMap == null) identifierSafetyMap = codeAnalysis_identifierSafetyMap(); } run { init(); identifiers = tok_allIdentifiers(code); tags = treeSet(); for (S id : identifiers) { S tag; if (identifiersStartingWithDollarAreSafe && startsWith(id, "$")) tag = "safe"; else tag = or2(mapGet(identifierSafetyMap, id), "?"); tags.addAll(tokSplitAtComma(tag)); } tags = simplifySafetyTags(tags); if (empty(tags)) tags.add("safe"); } S checkCode(S code) { this.code = code; run(); ret tags; } }