Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix xtext grammar and reference node in process #194

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,32 @@ import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "http://www.ipa.fraunhofer.de/ros" as ros
import "http://www.ipa.fraunhofer.de/primitives" as primitives

System returns System:
RosSystem
;

RosSystem returns System:
Name=EString':'
name=EString':'
BEGIN
(
('processes:'
BEGIN
Processes+=Process*
processes+=Process*
END
) |
('nodes:'
BEGIN
Components+=RosNode*
components+=RosNode*
END
) |
('parameters:'
BEGIN
Parameter+=Parameter*
parameter+=RosParameter*
END
) |
('connections:'
BEGIN
Connections+=RosConnection*
connections+=RosConnection*
END
)
)*
Expand All @@ -37,20 +40,23 @@ RosSystem returns System:

Process returns Process:
{Process}
Name=EString':'
BEGIN
('nodes:' '['
Nodes+=[RosNode|EString]
']')?
('threads:'Threads=INT)
END
name=EString':'
BEGIN
('nodes:' '['nodes+=ComponentRef (',' nodes+=ComponentRef)+']')?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be simplified to:

nodes+=[RosNode| EString]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The grammar is wrong, this implementation doesn't allow a process with a single node. It should be:

('nodes:' '['nodes+=ComponentRef (',' nodes+=ComponentRef)*']')?

('threads:'threads=Integer0)
END
;

ComponentRef returns ComponentRef:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed if the metamodel is correctly defined, see: d1ce353#r113516155

{ComponentRef}
componentRef = [RosNode| EString]
;

RosNode returns RosNode:
{RosNode}
Name=EString':'
name=EString':'
BEGIN
'from:'From=[ros::Node|EString]
'from:'from=[ros::Node|EString]
('interfaces:'
BEGIN
rosinterfaces+=RosInterface*
Expand All @@ -63,9 +69,9 @@ RosNode returns RosNode:
;

RosInterface returns RosInterface:
Name=EString':'
name=EString':'
BEGIN
Reference=InterfaceReference
reference=InterfaceReference
END
;

Expand All @@ -77,40 +83,39 @@ InterfaceReference_Impl returns InterfaceReference:
;

RosPublisherReference returns RosPublisherReference:
'fromPub:'From=[ros::Publisher|EString]
'fromPub:'from=[ros::Publisher|EString]
;

RosSubscriberReference returns RosSubscriberReference:
'fromSub:'From=[ros::Subscriber|EString]
'fromSub:'from=[ros::Subscriber|EString]
;

RosServiceServerReference returns RosServiceServerReference:
'fromSS:'From=[ros::ServiceServer|EString]
'fromSS:'from=[ros::ServiceServer|EString]
;

RosServerClientReference returns RosServerClientReference:
'fromSC:'From=[ros::ServiceClient|EString]
'fromSC:'from=[ros::ServiceClient|EString]
;

RosActionServerReference returns RosActionServerReference:
'fromAS:'From=[ros::ActionServer|EString]
'fromAS:'from=[ros::ActionServer|EString]
;

RosActionClientReference returns RosActionClientReference:
'fromAC:'From=[ros::ActionClient|EString]
'fromAC:'from=[ros::ActionClient|EString]
;

RosParameter returns RosParameter:
Name=EString':'
PreListElement name=EString':' from=[ros::Parameter|EString]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PreListElement was defined in another commit, I will remove it from here. This commit is about uncapitalize the definition of the attributes

BEGIN
'from:'From=[ros::Parameter|EString]
'value:'value=ParameterValue
END
;


RosConnection returns RosConnection:
'-['from=[RosInterface|EString]','to=[RosInterface|EString]']'
PreListElement '['from=[RosInterface|EString]','to=[RosInterface|EString]']'
;

///////////////////
Expand Down