Exemplo n.º 1
0
Arquivo: KApp.java Projeto: kszr/k
 /** 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);
   }
 }
Exemplo n.º 2
0
  public Attributes(Element element, JavaClassesFactory factory) {
    super(element);

    contents = new LinkedHashMap<>();
    List<Element> children = XML.getChildrenElements(element);
    for (Element e : children) add((Attribute<?>) factory.getTerm(e));
  }
Exemplo n.º 3
0
  public TermCons(Element element, Context context) {
    super(element);
    this.sort = element.getAttribute(Constants.SORT_sort_ATTR);
    this.cons = element.getAttribute(Constants.CONS_cons_ATTR);
    this.production = context.conses.get(cons);
    assert this.production != null;

    contents = new ArrayList<Term>();
    List<Element> children = XML.getChildrenElements(element);
    for (Element e : children) contents.add((Term) JavaClassesFactory.getTerm(e));
  }