Skip to content
Snippets Groups Projects
Commit fa519677 authored by Michael Leuschel's avatar Michael Leuschel
Browse files

export carrier set comments as desription pragmas

parent d7406930
No related branches found
No related tags found
No related merge requests found
Pipeline #146160 passed
......@@ -18,6 +18,7 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eventb.core.EventBAttributes;
import org.eventb.core.IAxiom;
import org.eventb.core.ICarrierSet;
import org.eventb.core.IContextRoot;
import org.eventb.core.IEventBRoot;
import org.eventb.core.IExtendsContext;
......@@ -52,6 +53,7 @@ import de.be4.classicalb.core.parser.node.ADeferredSetSet;
import de.be4.classicalb.core.parser.node.ADescriptionExpression;
import de.be4.classicalb.core.parser.node.ADescriptionPragma;
import de.be4.classicalb.core.parser.node.ADescriptionPredicate;
import de.be4.classicalb.core.parser.node.ADescriptionSet;
import de.be4.classicalb.core.parser.node.AEventBContextParseUnit;
import de.be4.classicalb.core.parser.node.AExtendsContextClause;
import de.be4.classicalb.core.parser.node.AIdentifierExpression;
......@@ -314,10 +316,23 @@ public final class ContextTranslator extends AbstractComponentTranslator {
final ISCCarrierSet[] carrierSets = context.getSCCarrierSets();
final List<PSet> setList = new ArrayList<PSet>(carrierSets.length);
for (final ISCCarrierSet carrierSet : carrierSets) {
final ADeferredSetSet deferredSet = new ADeferredSetSet(Arrays
.asList(new TIdentifierLiteral[] { new TIdentifierLiteral(carrierSet.getIdentifierString()) }));
final ICarrierSet ucs = (ICarrierSet) carrierSet.getSource(); // comments only attached in unchecked source
if (ucs.hasAttribute(EventBAttributes.COMMENT_ATTRIBUTE)) {
final String commentString = ucs.getAttributeValue(EventBAttributes.COMMENT_ATTRIBUTE);
System.out.println("Carrier set " + carrierSet + " has comment " + commentString);
final TPragmaFreeText desc = new TPragmaFreeText(commentString);
ADescriptionPragma descPragma = new ADescriptionPragma(Collections.singletonList(desc));
final ADescriptionSet descid = new ADescriptionSet(descPragma,deferredSet);
setList.add(descid);
} else {
setList.add(deferredSet);
}
}
return new ASetsContextClause(setList);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment