mirror of
https://github.com/Minres/RDL-Editor.git
synced 2025-06-12 05:12:23 +02:00
Changed grammar and added code generator
* changed the grammar to ease code generation * added a code generator and a standalone setup to generate SystemC code using SC-Components lib
This commit is contained in:
3
com.minres.rdl.parent/com.minres.rdl.ui/xtend-gen/com/minres/rdl/ui/.gitignore
vendored
Normal file
3
com.minres.rdl.parent/com.minres.rdl.ui/xtend-gen/com/minres/rdl/ui/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/RDLEObjectDocumentationProvider.java
|
||||
/RDLEObjectHoverProvider.java
|
||||
/RDLUiModule.java
|
@ -1,11 +1,12 @@
|
||||
package com.minres.rdl.ui;
|
||||
|
||||
import com.minres.rdl.rdl.ComponentDefinition;
|
||||
import com.minres.rdl.rdl.ComponentDefinitionType;
|
||||
import com.minres.rdl.rdl.ComponentInstance;
|
||||
import com.minres.rdl.rdl.ImmediateInstantiation;
|
||||
import com.minres.rdl.rdl.NamedInstantiation;
|
||||
import com.minres.rdl.rdl.Instantiation;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.ui.editor.hover.html.DefaultEObjectHoverProvider;
|
||||
import org.eclipse.xtext.xbase.lib.StringExtensions;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class RDLEObjectHoverProvider extends DefaultEObjectHoverProvider {
|
||||
@ -24,20 +25,19 @@ public class RDLEObjectHoverProvider extends DefaultEObjectHoverProvider {
|
||||
if (o instanceof ComponentInstance) {
|
||||
_matched=true;
|
||||
final EObject parent = ((ComponentInstance)o).eContainer();
|
||||
if ((parent instanceof ImmediateInstantiation)) {
|
||||
EObject _eContainer = ((ImmediateInstantiation)parent).eContainer();
|
||||
final ComponentDefinition compDef = ((ComponentDefinition) _eContainer);
|
||||
String _literal = compDef.getType().getLiteral();
|
||||
String _plus = (_literal + " ");
|
||||
if ((parent instanceof Instantiation)) {
|
||||
ComponentDefinitionType _xifexpression = null;
|
||||
ComponentDefinition _componentRef = ((Instantiation)parent).getComponentRef();
|
||||
boolean _tripleNotEquals = (_componentRef != null);
|
||||
if (_tripleNotEquals) {
|
||||
_xifexpression = ((Instantiation)parent).getComponentRef().getType();
|
||||
} else {
|
||||
_xifexpression = ((Instantiation)parent).getComponent().getType();
|
||||
}
|
||||
String _firstUpper = StringExtensions.toFirstUpper(_xifexpression.getLiteral());
|
||||
String _plus = (_firstUpper + " ");
|
||||
String _name = ((ComponentInstance)o).getName();
|
||||
return (_plus + _name);
|
||||
} else {
|
||||
if ((parent instanceof NamedInstantiation)) {
|
||||
String _literal_1 = ((NamedInstantiation)parent).getComponent().getType().getLiteral();
|
||||
String _plus_1 = (_literal_1 + " ");
|
||||
String _name_1 = ((ComponentInstance)o).getName();
|
||||
return (_plus_1 + _name_1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class RDLUiModule extends AbstractRDLUiModule {
|
||||
return RDLEObjectDocumentationProvider.class;
|
||||
}
|
||||
|
||||
public RDLUiModule(final AbstractUIPlugin arg0) {
|
||||
super(arg0);
|
||||
public RDLUiModule(final AbstractUIPlugin plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
}
|
||||
|
1
com.minres.rdl.parent/com.minres.rdl.ui/xtend-gen/com/minres/rdl/ui/contentassist/.gitignore
vendored
Normal file
1
com.minres.rdl.parent/com.minres.rdl.ui/xtend-gen/com/minres/rdl/ui/contentassist/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/RDLProposalProvider.java
|
2
com.minres.rdl.parent/com.minres.rdl.ui/xtend-gen/com/minres/rdl/ui/labeling/.gitignore
vendored
Normal file
2
com.minres.rdl.parent/com.minres.rdl.ui/xtend-gen/com/minres/rdl/ui/labeling/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/RDLDescriptionLabelProvider.java
|
||||
/RDLLabelProvider.java
|
@ -13,10 +13,8 @@ import com.minres.rdl.rdl.EnumDefinition;
|
||||
import com.minres.rdl.rdl.EnumEntry;
|
||||
import com.minres.rdl.rdl.EnumProperty;
|
||||
import com.minres.rdl.rdl.ExplicitPropertyAssignment;
|
||||
import com.minres.rdl.rdl.ImmediateInstantiation;
|
||||
import com.minres.rdl.rdl.InstancePropertyRef;
|
||||
import com.minres.rdl.rdl.InstanceRef;
|
||||
import com.minres.rdl.rdl.NamedInstantiation;
|
||||
import com.minres.rdl.rdl.PostPropertyAssignment;
|
||||
import com.minres.rdl.rdl.PropertyAssignment;
|
||||
import com.minres.rdl.rdl.PropertyAssignmentRhs;
|
||||
@ -46,46 +44,26 @@ public class RDLLabelProvider extends DefaultEObjectLabelProvider {
|
||||
|
||||
public String text(final ComponentDefinition e) {
|
||||
String _xifexpression = null;
|
||||
ImmediateInstantiation _immediateInstantiation = e.getImmediateInstantiation();
|
||||
boolean _tripleNotEquals = (_immediateInstantiation != null);
|
||||
String _name = e.getName();
|
||||
boolean _tripleNotEquals = (_name != null);
|
||||
if (_tripleNotEquals) {
|
||||
String _xifexpression_1 = null;
|
||||
String _name = e.getName();
|
||||
boolean _tripleNotEquals_1 = (_name != null);
|
||||
if (_tripleNotEquals_1) {
|
||||
String _text = this.text(e.getImmediateInstantiation());
|
||||
String _plus = (_text + " (");
|
||||
String _name_1 = e.getName();
|
||||
String _plus_1 = (_plus + _name_1);
|
||||
_xifexpression_1 = (_plus_1 + ")");
|
||||
} else {
|
||||
_xifexpression_1 = this.text(e.getImmediateInstantiation());
|
||||
}
|
||||
_xifexpression = _xifexpression_1;
|
||||
String _literal = e.getType().getLiteral();
|
||||
String _plus = (_literal + " ");
|
||||
String _name_1 = e.getName();
|
||||
_xifexpression = (_plus + _name_1);
|
||||
} else {
|
||||
String _xifexpression_2 = null;
|
||||
String _name_2 = e.getName();
|
||||
boolean _tripleNotEquals_2 = (_name_2 != null);
|
||||
if (_tripleNotEquals_2) {
|
||||
String _literal = e.getType().getLiteral();
|
||||
String _plus_2 = (_literal + " ");
|
||||
String _name_3 = e.getName();
|
||||
_xifexpression_2 = (_plus_2 + _name_3);
|
||||
} else {
|
||||
String _xblockexpression = null;
|
||||
{
|
||||
final Function1<PropertyAssignment, Boolean> _function = (PropertyAssignment pa) -> {
|
||||
return Boolean.valueOf(((pa instanceof ExplicitPropertyAssignment) && Objects.equal(((ExplicitPropertyAssignment) pa).getName(), PropertyEnum.NAME)));
|
||||
};
|
||||
final PropertyAssignment pa = IterableExtensions.<PropertyAssignment>findFirst(e.getPropertyAssignments(), _function);
|
||||
String _literal_1 = e.getType().getLiteral();
|
||||
String _plus_3 = (_literal_1 + " ");
|
||||
Object _text_1 = this.text(((ExplicitPropertyAssignment) pa).getRhs());
|
||||
_xblockexpression = (_plus_3 + _text_1);
|
||||
}
|
||||
_xifexpression_2 = _xblockexpression;
|
||||
String _xblockexpression = null;
|
||||
{
|
||||
final Function1<PropertyAssignment, Boolean> _function = (PropertyAssignment pa) -> {
|
||||
return Boolean.valueOf(((pa instanceof ExplicitPropertyAssignment) && Objects.equal(((ExplicitPropertyAssignment) pa).getName(), PropertyEnum.NAME)));
|
||||
};
|
||||
final PropertyAssignment pa = IterableExtensions.<PropertyAssignment>findFirst(e.getPropertyAssignments(), _function);
|
||||
String _literal_1 = e.getType().getLiteral();
|
||||
String _plus_1 = (_literal_1 + " ");
|
||||
Object _text = this.text(((ExplicitPropertyAssignment) pa).getRhs());
|
||||
_xblockexpression = (_plus_1 + _text);
|
||||
}
|
||||
_xifexpression = _xifexpression_2;
|
||||
_xifexpression = _xblockexpression;
|
||||
}
|
||||
return _xifexpression;
|
||||
}
|
||||
@ -154,13 +132,6 @@ public class RDLLabelProvider extends DefaultEObjectLabelProvider {
|
||||
return _xifexpression;
|
||||
}
|
||||
|
||||
public String text(final ImmediateInstantiation e) {
|
||||
final Function1<ComponentInstance, String> _function = (ComponentInstance it) -> {
|
||||
return this.text(it);
|
||||
};
|
||||
return IterableExtensions.join(ListExtensions.<ComponentInstance, String>map(e.getComponentInstances(), _function), ", ");
|
||||
}
|
||||
|
||||
public String text(final ComponentInstance e) {
|
||||
String res = e.getName();
|
||||
Range _range = e.getRange();
|
||||
@ -173,10 +144,10 @@ public class RDLLabelProvider extends DefaultEObjectLabelProvider {
|
||||
if (_tripleNotEquals_1) {
|
||||
_xifexpression = e.getRange().getSize().toString();
|
||||
} else {
|
||||
Object _start = e.getRange().getStart();
|
||||
String _plus = (_start + ":");
|
||||
Object _end = e.getRange().getEnd();
|
||||
_xifexpression = (_plus + _end);
|
||||
Object _left = e.getRange().getLeft();
|
||||
String _plus = (_left + ":");
|
||||
Object _right = e.getRange().getRight();
|
||||
_xifexpression = (_plus + _right);
|
||||
}
|
||||
String _plus_1 = ("[" + _xifexpression);
|
||||
String _plus_2 = (_plus_1 + "]");
|
||||
@ -283,17 +254,6 @@ public class RDLLabelProvider extends DefaultEObjectLabelProvider {
|
||||
}
|
||||
}
|
||||
|
||||
public String text(final NamedInstantiation e) {
|
||||
final Function1<ComponentInstance, String> _function = (ComponentInstance it) -> {
|
||||
return this.text(it);
|
||||
};
|
||||
String _join = IterableExtensions.join(ListExtensions.<ComponentInstance, String>map(e.getComponentInstances(), _function), ", ");
|
||||
String _plus = (_join + " (");
|
||||
String _name = e.getComponent().getName();
|
||||
String _plus_1 = (_plus + _name);
|
||||
return (_plus_1 + ")");
|
||||
}
|
||||
|
||||
public String text(final EnumEntry e) {
|
||||
String _xifexpression = null;
|
||||
Object _index = e.getIndex();
|
||||
@ -401,7 +361,7 @@ public class RDLLabelProvider extends DefaultEObjectLabelProvider {
|
||||
return "P.png";
|
||||
}
|
||||
|
||||
public String image(final NamedInstantiation e) {
|
||||
public String image(final ComponentInstance e) {
|
||||
return "I.png";
|
||||
}
|
||||
|
||||
|
1
com.minres.rdl.parent/com.minres.rdl.ui/xtend-gen/com/minres/rdl/ui/outline/.gitignore
vendored
Normal file
1
com.minres.rdl.parent/com.minres.rdl.ui/xtend-gen/com/minres/rdl/ui/outline/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/RDLOutlineTreeProvider.java
|
@ -4,10 +4,11 @@
|
||||
package com.minres.rdl.ui.outline;
|
||||
|
||||
import com.minres.rdl.rdl.ComponentDefinition;
|
||||
import com.minres.rdl.rdl.ComponentInstance;
|
||||
import com.minres.rdl.rdl.EnumDefinition;
|
||||
import com.minres.rdl.rdl.EnumEntry;
|
||||
import com.minres.rdl.rdl.ExplicitPropertyAssignment;
|
||||
import com.minres.rdl.rdl.NamedInstantiation;
|
||||
import com.minres.rdl.rdl.Instantiation;
|
||||
import com.minres.rdl.rdl.PostPropertyAssignment;
|
||||
import com.minres.rdl.rdl.PropertyAssignment;
|
||||
import com.minres.rdl.rdl.PropertyAssignmentRhs;
|
||||
@ -42,10 +43,18 @@ public class RDLOutlineTreeProvider extends DefaultOutlineTreeProvider {
|
||||
this.createNode(parentNode, it);
|
||||
};
|
||||
domainModel.getPropertyAssignments().forEach(_function_3);
|
||||
final Consumer<NamedInstantiation> _function_4 = (NamedInstantiation it) -> {
|
||||
this.createNode(parentNode, it);
|
||||
final Consumer<Instantiation> _function_4 = (Instantiation instantiation) -> {
|
||||
ComponentDefinition _component = instantiation.getComponent();
|
||||
boolean _tripleNotEquals = (_component != null);
|
||||
if (_tripleNotEquals) {
|
||||
this.createNode(parentNode, instantiation.getComponent());
|
||||
}
|
||||
final Consumer<ComponentInstance> _function_5 = (ComponentInstance it) -> {
|
||||
this.createNode(parentNode, it);
|
||||
};
|
||||
instantiation.getComponentInstances().forEach(_function_5);
|
||||
};
|
||||
domainModel.getNamedInstantiations().forEach(_function_4);
|
||||
domainModel.getInstantiations().forEach(_function_4);
|
||||
}
|
||||
|
||||
protected void _createChildren(final IOutlineNode parentNode, final ComponentDefinition compDef) {
|
||||
@ -61,10 +70,18 @@ public class RDLOutlineTreeProvider extends DefaultOutlineTreeProvider {
|
||||
this.createNode(parentNode, it);
|
||||
};
|
||||
compDef.getPropertyAssignments().forEach(_function_2);
|
||||
final Consumer<NamedInstantiation> _function_3 = (NamedInstantiation it) -> {
|
||||
this.createNode(parentNode, it);
|
||||
final Consumer<Instantiation> _function_3 = (Instantiation instantiation) -> {
|
||||
ComponentDefinition _component = instantiation.getComponent();
|
||||
boolean _tripleNotEquals = (_component != null);
|
||||
if (_tripleNotEquals) {
|
||||
this.createNode(parentNode, instantiation.getComponent());
|
||||
}
|
||||
final Consumer<ComponentInstance> _function_4 = (ComponentInstance it) -> {
|
||||
this.createNode(parentNode, it);
|
||||
};
|
||||
instantiation.getComponentInstances().forEach(_function_4);
|
||||
};
|
||||
compDef.getNamedInstantiations().forEach(_function_3);
|
||||
compDef.getInstantiations().forEach(_function_3);
|
||||
}
|
||||
|
||||
protected void _createChildren(final IOutlineNode parentNode, final EnumDefinition e) {
|
||||
@ -82,14 +99,18 @@ public class RDLOutlineTreeProvider extends DefaultOutlineTreeProvider {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean _isLeaf(final NamedInstantiation feature) {
|
||||
return true;
|
||||
protected boolean _isLeaf(final Instantiation feature) {
|
||||
return ((feature.getComponent() == null) && (feature.getComponentInstances().size() == 0));
|
||||
}
|
||||
|
||||
protected boolean _isLeaf(final PropertyAssignmentRhs feature) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean _isLeaf(final ComponentInstance feature) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean _isLeaf(final EnumEntry feature) {
|
||||
int _size = feature.getProperties().size();
|
||||
return (_size == 0);
|
||||
|
1
com.minres.rdl.parent/com.minres.rdl.ui/xtend-gen/com/minres/rdl/ui/quickfix/.gitignore
vendored
Normal file
1
com.minres.rdl.parent/com.minres.rdl.ui/xtend-gen/com/minres/rdl/ui/quickfix/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/RDLQuickfixProvider.java
|
Reference in New Issue
Block a user