コード例 #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
ファイル: DataStructureBuiltin.java プロジェクト: JoeOsborn/k
 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;
   }
 }