예제 #1
0
파일: KApp.java 프로젝트: 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);
   }
 }
예제 #2
0
파일: MetaK.java 프로젝트: TomGebhardt/k
 public static Term defaultTerm(Term v, org.kframework.kil.loader.Context context) {
   String sort = v.getSort();
   KSort ksort = KSort.getKSort(sort).mainSort();
   if (ksort.isDefaultable()) return new Empty(ksort.toString());
   GlobalSettings.kem.register(
       new KException(
           ExceptionType.WARNING,
           KExceptionGroup.COMPILER,
           "Don't know the default value for term " + v.toString() + ". Assuming .K",
           v.getFilename(),
           v.getLocation()));
   return KSequence.EMPTY;
 }
예제 #3
0
 protected DataStructureBuiltin(DataStructureSort sort, Collection<Term> baseTerms) {
   super(sort.name());
   this.dataStructureSort = sort;
   this.baseTerms = baseTerms;
   if (baseTerms.size() == 1) {
     Term term = baseTerms.iterator().next();
     if (term instanceof Variable && term.getSort().equals(sort.name())) {
       viewBase = (Variable) term;
     } else {
       viewBase = null;
     }
   } else {
     viewBase = null;
   }
 }