From 39744c4b2682e5f3378acc1b4d7e9618dbe9ee6b Mon Sep 17 00:00:00 2001 From: Ruichao Wu Date: Wed, 10 May 2023 15:05:29 +0200 Subject: [PATCH 1/2] Basic grammer: reformat MessagePart, define msg datatype as [datatype] --- .../src/de/fraunhofer/ipa/ros/Basics.xtext | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/plugins/de.fraunhofer.ipa.ros.xtext/src/de/fraunhofer/ipa/ros/Basics.xtext b/plugins/de.fraunhofer.ipa.ros.xtext/src/de/fraunhofer/ipa/ros/Basics.xtext index 5b05060ab..b6b1d7bd7 100644 --- a/plugins/de.fraunhofer.ipa.ros.xtext/src/de/fraunhofer/ipa/ros/Basics.xtext +++ b/plugins/de.fraunhofer.ipa.ros.xtext/src/de/fraunhofer/ipa/ros/Basics.xtext @@ -197,8 +197,7 @@ DateTime0 returns type::DateTime: //MESSAGE PRIMITIVES DEFINITION /////////////////// MessagePart returns primitives::MessagePart: - Type = AbstractType - Data =(KEYWORD | MESSAGE_ASIGMENT | EString) + Data =(KEYWORD | MESSAGE_ASIGMENT | EString)':' Type = AbstractType ; terminal MESSAGE_ASIGMENT: @@ -288,66 +287,66 @@ duration returns primitives::duration: boolArray returns primitives::boolArray: {primitives::boolArray} - 'bool[]' + '[bool]' ; int8Array returns primitives::int8Array: {primitives::int8Array} - 'int8[]' + '[int8]' ; uint8Array returns primitives::uint8Array: {primitives::uint8Array} - 'uint8[]' + '[uint8]' ; int16Array returns primitives::int16Array: {primitives::int16Array} - 'int16[]' + '[int16]' ; uint16Array returns primitives::uint16Array: {primitives::uint16Array} - 'uint16[]' + '[uint16]' ; int32Array returns primitives::int32Array: {primitives::int32Array} - 'int32[]' + '[int32]' ; uint32Array returns primitives::uint32Array: {primitives::uint32Array} - 'uint32[]' + '[uint32]' ; int64Array returns primitives::int64Array: {primitives::int64Array} - 'int64[]' + '[int64]' ; uint64Array returns primitives::uint64Array: {primitives::uint64Array} - 'uint64[]' + '[uint64]' ; float32Array returns primitives::float32Array: {primitives::float32Array} - 'float32[]' + '[float32]' ; float64Array returns primitives::float64Array: {primitives::float64Array} - 'float64[]' + '[float64]' ; string0Array returns primitives::stringArray: {primitives::stringArray} - 'string[]' + '[string]' ; byteArray returns primitives::ByteArray: {primitives::ByteArray} - 'byte[]' + '[byte]' ; Header returns primitives::Header: @@ -360,7 +359,7 @@ TopicSpecRef returns TopicSpecRef: ; ArrayTopicSpecRef returns ArrayTopicSpecRef: - TopicSpec=[TopicSpec|EString]'[]' + '['TopicSpec=[TopicSpec|EString]']' ; KEYWORD: 'goal' | 'message' | 'result' | 'feedback' | 'name' | 'value' | 'service' | 'type' | 'action' | 'duration' | 'time' ; @@ -384,6 +383,9 @@ RosNames returns ecore::EString: ROS_CONVENTION_A | ID | 'node' ; +PreListElement hidden(SL_COMMENT): + '-'; + terminal ROS_CONVENTION_A: ( ('/' ID ) | ( ID '/' ) )* ; From be23989c5a174cb922c4a604e91e4da58c209a74 Mon Sep 17 00:00:00 2001 From: Ruichao Wu Date: Wed, 10 May 2023 15:06:19 +0200 Subject: [PATCH 2/2] Ros grammar: define msg Spec as list --- .../src/de/fraunhofer/ipa/ros/Ros.xtext | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/plugins/de.fraunhofer.ipa.ros.xtext/src/de/fraunhofer/ipa/ros/Ros.xtext b/plugins/de.fraunhofer.ipa.ros.xtext/src/de/fraunhofer/ipa/ros/Ros.xtext index fdcfc85d9..7935378b6 100644 --- a/plugins/de.fraunhofer.ipa.ros.xtext/src/de/fraunhofer/ipa/ros/Ros.xtext +++ b/plugins/de.fraunhofer.ipa.ros.xtext/src/de/fraunhofer/ipa/ros/Ros.xtext @@ -27,7 +27,8 @@ Package_Impl returns Package: ('fromGitRepo:' fromGitRepo=EString)? ('specs:' BEGIN - spec+=SpecBase* + PreListElement spec+=SpecBase + (PreListElement spec+=SpecBase)* END )? ('dependencies:' '[' dependency+=Dependency (',' dependency+=Dependency)* ']' )? @@ -72,44 +73,43 @@ Artifact returns Artifact: Node returns Node: 'node:' name=RosNames - BEGIN - ( - ('publishers:' - BEGIN - publisher+=Publisher* - END - )| - ('subscribers:' - BEGIN - subscriber+=Subscriber* - END - )| - ('serviceservers:' - BEGIN - serviceserver+=ServiceServer* - END - )| - ('serviceclients:' - BEGIN - serviceclient+=ServiceClient* - END - )| - ('actionservers:' - BEGIN - actionserver+=ActionServer* - END - )| - ('actionclients:' - BEGIN - actionclient+=ActionClient* - END - )| - ('parameters:' - BEGIN - parameter+=Parameter* - END - ) - )*END + ( + ('publishers:' + BEGIN + publisher+=Publisher* + END + )| + ('subscribers:' + BEGIN + subscriber+=Subscriber* + END + )| + ('serviceServers:' + BEGIN + serviceserver+=ServiceServer* + END + )| + ('serviceClients:' + BEGIN + serviceclient+=ServiceClient* + END + )| + ('actionServers:' + BEGIN + actionserver+=ActionServer* + END + )| + ('actionClients:' + BEGIN + actionclient+=ActionClient* + END + )| + ('parameters:' + BEGIN + parameter+=Parameter* + END + ) + )* ; /////////////////// @@ -146,7 +146,7 @@ ActionSpec returns ActionSpec: MessageDefinition returns MessageDefinition: {MessageDefinition} - MessagePart+=MessagePart*; + MessagePart+=MessagePart+; /////////////////// //INTERFACES