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