@Override public ASTNode visit(org.kframework.kil.Definition node, Void _void) { Definition definition = new Definition(context, kem, indexingData); globalContext.setDefinition(definition); Module singletonModule = node.getSingletonModule(); for (org.kframework.kil.Rule rule : singletonModule.getRules()) { if (rule.containsAttribute(Attribute.PREDICATE_KEY)) { continue; } definition.addRule((Rule) this.visitNode(rule)); } for (String kLabelName : singletonModule.getModuleKLabels()) { definition.addKLabel(KLabelConstant.of(kLabelName, globalContext.getDefinition())); } return definition; }
@Override public ASTNode transform(org.kframework.kil.Definition node) { Definition definition = new Definition(context); this.definition = definition; Module singletonModule = node.getSingletonModule(); for (org.kframework.kil.Rule rule : singletonModule.getRules()) { if (!rule.containsAttribute(SymbolicBackend.SYMBOLIC) || rule.containsAttribute(Attribute.PREDICATE.getKey()) || rule.containsAttribute(Attribute.ANYWHERE.getKey())) { continue; } try { definition.addRule((Rule) rule.accept(this)); } catch (TransformerException e) { System.err.println(rule); System.err.flush(); e.printStackTrace(); } } for (String kLabelName : singletonModule.getModuleKLabels()) { definition.addKLabel(KLabelConstant.of(kLabelName, context)); } /* collect the productions which have the attributes strict and seqstrict */ Set<Production> productions = singletonModule.getSyntaxByTag("strict", context); productions.addAll(singletonModule.getSyntaxByTag("seqstrict", context)); for (Production production : productions) { definition.addFrozenKLabel(KLabelConstant.of(production.getKLabel(), context)); } this.definition = null; return definition; }