1313import java .util .stream .Collectors ;
1414import java .util .stream .Stream ;
1515
16+ import org .kframework .builtin .Labels ;
17+ import org .kframework .builtin .Sorts ;
1618import org .kframework .kil .ASTNode ;
1719import org .kframework .kil .AbstractVisitor ;
1820import org .kframework .kil .Attributes ;
@@ -82,23 +84,25 @@ public KILtoInnerKORE(org.kframework.kil.loader.Context context) {
8284
8385 public K apply (Bag body ) {
8486 List <K > contents = body .getContents ().stream ().map (this ).collect (Collectors .toList ());
85- return KBag (KList (contents ));
87+ return KApply ( Labels . KBag (), ( KList (contents ) ));
8688 }
8789
88- // public K apply(TermComment c) {
89- // return KList();
90- // }
90+ // public K apply(TermComment c) {
91+ // return KList();
92+ // }
9193
9294 private KApply cellMarker = org .kframework .kore .outer .Configuration .cellMarker ();
9395
9496 @ SuppressWarnings ("unchecked" )
9597 public KApply apply (Cell body ) {
96- K x = apply (body .getContents ());
97- if (x instanceof KBag && !((KBag ) x ).isEmpty ()) {
98- return KApply (KLabel (body .getLabel ()), KList (((KBag ) x )), Attributes (cellMarker ));
99- } else {
100- return KApply (KLabel (body .getLabel ()), KList (x ), Attributes (cellMarker ));
101- }
98+ // K x = ;
99+ // if (x instanceof KApply && ((KApply) x).klabel() == Labels.KBag()
100+ // && ((KApply) x).size() == 0) {
101+ return KApply (KLabel (body .getLabel ()), KList (apply (body .getContents ())), Attributes (cellMarker ));
102+ // } else {
103+ // return KApply(KLabel(body.getLabel()), KList(x),
104+ // Attributes(cellMarker));
105+ // }
102106 }
103107
104108 public K apply (org .kframework .kil .KLabelConstant c ) {
@@ -123,7 +127,8 @@ public KApply apply(ListTerminator t) {
123127 Production production = context .listProductions .get (t .getSort ());
124128 String terminatorKLabel = production .getTerminatorKLabel ();
125129
126- // NOTE: we don't covert it back to ListTerminator because Radu thinks it is not necessary
130+ // NOTE: we don't covert it back to ListTerminator because Radu thinks
131+ // it is not necessary
127132
128133 return KApply (KLabel (terminatorKLabel ), KList (), Attributes ().add (LIST_TERMINATOR ));
129134 }
@@ -166,7 +171,7 @@ private org.kframework.kore.Attributes sortAttributes(Term cons) {
166171 }
167172
168173 public KApply apply (Hole hole ) {
169- return KApply (Hole (), KList (KToken (Sort (hole .getSort ().getName ()), "" )),
174+ return KApply (Labels . Hole (), KList (KToken (Sort (hole .getSort ().getName ()), "" )),
170175 sortAttributes (hole ));
171176 }
172177
@@ -182,7 +187,7 @@ public K applyOrTrue(Term t) {
182187 if (t != null )
183188 return apply (t );
184189 else
185- return new KBoolean (true , Attributes () );
190+ return KToken ( Sorts . KBoolean (), "true" );
186191 }
187192
188193 public org .kframework .kore .Attributes convertAttributes (ASTNode t ) {
@@ -199,13 +204,14 @@ public org.kframework.kore.Attributes convertAttributes(ASTNode t) {
199204 KList (KToken (Sort ("AttributeValue" ), valueString )));
200205 }).collect (Collectors .toSet ());
201206
202- return Attributes (immutable (attributesSet )).addAll (attributesFromLocation (t .getLocation ()));
207+ return Attributes (immutable (attributesSet ))
208+ .addAll (attributesFromLocation (t .getLocation ()));
203209 }
204210
205211 private org .kframework .kore .Attributes attributesFromLocation (Location location ) {
206- if (location != null )
212+ if (location != null )
207213 return Attributes (Location (location .lineStart , location .columnStart , location .lineEnd ,
208- location .columnEnd ));
214+ location .columnEnd ));
209215 else
210216 return Attributes ();
211217 }
0 commit comments