You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2025/09/22 09:25:30 UTC

(plc4x) branch develop updated: feat: Added the names of the individual encodings to the "current fields attributes"

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 982b7989e0 feat: Added the names of the individual encodings to the "current fields attributes"
982b7989e0 is described below

commit 982b7989e03b7c30e8a4e33e2db8d823aaab6214
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Sep 22 11:25:23 2025 +0200

    feat: Added the names of the individual encodings to the "current fields attributes"
---
 .../language/mspec/parser/MessageFormatListener.java           | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/parser/MessageFormatListener.java b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/parser/MessageFormatListener.java
index 4871ef788d..ff1d31f312 100644
--- a/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/parser/MessageFormatListener.java
+++ b/code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/parser/MessageFormatListener.java
@@ -1044,7 +1044,15 @@ public class MessageFormatListener extends MSpecBaseListener implements LazyType
         Set<String> attributeNames = new HashSet<>();
         if (ctx.parent.parent instanceof MSpecParser.FieldDefinitionContext fieldDefinitionContext) {
             for (MSpecParser.AttributeContext attributeContext : fieldDefinitionContext.attributes.attribute()) {
-                attributeNames.add(attributeContext.name.getText());
+                String attributeName = attributeContext.name.getText();
+                // Setting the global "encoding" also sets the individual encodings.
+                if("encoding".equalsIgnoreCase(attributeName)) {
+                    attributeNames.add("unsignedIntegerEncoding");
+                    attributeNames.add("signedIntegerEncoding");
+                    attributeNames.add("floatEncoding");
+                    attributeNames.add("stringEncoding");
+                }
+                attributeNames.add(attributeName);
             }
         }
         return attributeNames;