Skip to content

Commit 982b798

Browse files
committed
feat: Added the names of the individual encodings to the "current fields attributes"
1 parent 2d71740 commit 982b798

File tree

1 file changed

+9
-1
lines changed
  • code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/parser

1 file changed

+9
-1
lines changed

code-generation/protocol-base-mspec/src/main/java/org/apache/plc4x/plugins/codegenerator/language/mspec/parser/MessageFormatListener.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,15 @@ private Set<String> getCurFieldAttributeNames(RuleContext ctx) {
10441044
Set<String> attributeNames = new HashSet<>();
10451045
if (ctx.parent.parent instanceof MSpecParser.FieldDefinitionContext fieldDefinitionContext) {
10461046
for (MSpecParser.AttributeContext attributeContext : fieldDefinitionContext.attributes.attribute()) {
1047-
attributeNames.add(attributeContext.name.getText());
1047+
String attributeName = attributeContext.name.getText();
1048+
// Setting the global "encoding" also sets the individual encodings.
1049+
if("encoding".equalsIgnoreCase(attributeName)) {
1050+
attributeNames.add("unsignedIntegerEncoding");
1051+
attributeNames.add("signedIntegerEncoding");
1052+
attributeNames.add("floatEncoding");
1053+
attributeNames.add("stringEncoding");
1054+
}
1055+
attributeNames.add(attributeName);
10481056
}
10491057
}
10501058
return attributeNames;

0 commit comments

Comments
 (0)