Skip to content

Commit

Permalink
Fixed migration of comment block.
Browse files Browse the repository at this point in the history
  • Loading branch information
ylussaud committed Dec 14, 2023
1 parent f401537 commit f867984
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,17 @@ private Object caseDocumentation(org.eclipse.acceleo.model.mtl.Documentation inp
}

private Object caseComment(org.eclipse.acceleo.model.mtl.Comment inputComment) {
Comment outputComment = AcceleoFactory.eINSTANCE.createComment();
CommentBody commentBody = AcceleoFactory.eINSTANCE.createCommentBody();
commentBody.setValue(inputComment.getBody().getValue().substring(1));
final String commentValue;
final Comment outputComment;
if (inputComment.getBody().getValue().contains("/]")) {
outputComment = AcceleoFactory.eINSTANCE.createBlockComment();
commentValue = inputComment.getBody().getValue();
} else {
outputComment = AcceleoFactory.eINSTANCE.createComment();
commentValue = inputComment.getBody().getValue().substring(1);
}
final CommentBody commentBody = AcceleoFactory.eINSTANCE.createCommentBody();
commentBody.setValue(commentValue);
outputComment.setBody(commentBody);
return outputComment;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[module commentedQuery('http://www.eclipse.org/emf/2002/Ecore')/]

[comment][query public myQuery(myParam : ecore::EPackage) : ecore::EClassifier = myParam.eClassifiers->first()/][/comment]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[module commentedQuery('http://www.eclipse.org/emf/2002/Ecore')/]

[comment][query public myQuery(myParam : ecore::EPackage) : ecore::EClassifier = myParam.eClassifiers->first()/][/comment]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[module commentedQuery('http://www.eclipse.org/emf/2002/Ecore')/]

[comment][query public myQuery(myParam : ecore::EPackage) : ecore::EClassifier = myParam.eClassifiers->first()/][/comment]
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:mtl="http://www.eclipse.org/acceleo/mtl/3.0" xmlns:ocl.ecore="http://www.eclipse.org/ocl/1.1.0/Ecore">
<mtl:Module name="commentedQuery" nsURI="resources::acceleoAqlTests::language::comment::commentedQuery::commentedQuery" endHeaderPosition="63">
<input>
<takesTypesFrom href="http://www.eclipse.org/emf/2002/Ecore#/"/>
</input>
<ownedModuleElement xsi:type="mtl:Comment">
<body startPosition="76" endPosition="179" value="[query public myQuery(myParam : ecore::EPackage) : ecore::EClassifier = myParam.eClassifiers->first()/]"/>
</ownedModuleElement>
</mtl:Module>
<ecore:EPackage name="additions">
<eClassifiers xsi:type="ecore:EClass" name="oclstdlib_String_Class">
<eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL">
<references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="oclstdlib_Integer_Class">
<eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL">
<references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/Integer"/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="oclstdlib_Real_Class">
<eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL">
<references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/Real"/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ecore_EObject_Class">
<eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL">
<references href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="oclstdlib_OclAny_Class">
<eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL">
<references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OclAny"/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="oclstdlib_Collection(T)_Class">
<eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL">
<references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/Collection(T)"/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="oclstdlib_Sequence(T)_Class">
<eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL">
<references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/Sequence(T)"/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="oclstdlib_OrderedSet(T)_Class">
<eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL">
<references href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/OrderedSet(T)"/>
</eAnnotations>
</eClassifiers>
</ecore:EPackage>
<ocl.ecore:Variable name="self">
<eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
</ocl.ecore:Variable>
<ecore:EAnnotation source="positions">
<eAnnotations source="positions.0" references="/0/%">
<details key="start" value="67"/>
<details key="end" value="189"/>
<details key="line" value="0"/>
</eAnnotations>
</ecore:EAnnotation>
</xmi:XMI>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[module commentedQuery('http://www.eclipse.org/emf/2002/Ecore')/]

[comment][query public myQuery(myParam : ecore::EPackage) : ecore::EClassifier = myParam.eClassifiers->first()/][/comment]

0 comments on commit f867984

Please sign in to comment.