/** Constructs a {@link KApp} object from an XML {@link Element}. */ public KApp(Element element, org.kframework.kil.loader.Context context) { super(element); List<Element> childrenElements = XML.getChildrenElements(element); Element body = XML.getChildrenElements(childrenElements.get(0)).get(0); setLabel((Term) JavaClassesFactory.getTerm(body)); Term term = (Term) JavaClassesFactory.getTerm(childrenElements.get(1)); if (!(term.getSort().equals(Sort.KLIST) || term instanceof Ambiguity)) { setChild(new KList(Collections.<Term>singletonList(term))); } else { setChild(term); } }
/** * Constructs a {@link KApp} object representing the application of the specified KLabel to the * specified KList. * * @param location the line and column * @param filename the complete name of the file * @param label the KLabel which is applied to the given KList. A non-null instance of {@link * KLabel}, {@link Variable} of sort KLabel or {@link Ambiguity}. * @param child the KList which the given KLabel is applied to. A non-null instance of {@link * KList}, {@link Variable} of sort KList, or {@link Ambiguity}. */ public KApp(Location location, Source source, Term label, Term child) { super(location, source, Sort.KITEM); setLabel(label); setChild(child); }
/** * Constructs a {@link KApp} object representing the application of the specified KLabel to the * specified KList. * * @param label the KLabel which is applied to the given KList. A non-null instance of {@link * KLabel}, {@link Variable} of sort KLabel or {@link Ambiguity}. * @param child the KList which the given KLabel is applied to. A non-null instance of {@link * KList}, {@link Variable} of sort KList, or {@link Ambiguity}. */ public KApp(Term label, Term child) { super(label.getLocation(), label.getSource(), Sort.KITEM); setLabel(label); setChild(child); }
private KApp(KApp node) { super(node); setLabel(node.label); setChild(node.child); }