Skip to content

Commit

Permalink
- Removed the field args and replaced everything related with type ar…
Browse files Browse the repository at this point in the history
…gs from square brackets to round brackets
  • Loading branch information
chrisdutz committed Oct 22, 2021
1 parent 3e1e1a4 commit ca05161
Show file tree
Hide file tree
Showing 23 changed files with 42 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ complexTypeDefinition
;

complexType
: 'type' name=idExpression (attributes=attributeList) (LBRACKET params=argumentList RBRACKET)? (fieldDefinition|batchSetDefinition)*
| 'discriminatedType' name=idExpression (attributes=attributeList) (LBRACKET params=argumentList RBRACKET)? (fieldDefinition|batchSetDefinition)+
| 'enum' (type=typeReference)? name=idExpression (attributes=attributeList) (LBRACKET params=argumentList RBRACKET)? enumValues=enumValueDefinition+
| 'dataIo' name=idExpression (attributes=attributeList) (LBRACKET params=argumentList RBRACKET)? dataIoTypeSwitch=dataIoDefinition
: 'type' name=idExpression (attributes=attributeList) (LRBRACKET params=argumentList RRBRACKET)? (fieldDefinition|batchSetDefinition)*
| 'discriminatedType' name=idExpression (attributes=attributeList) (LRBRACKET params=argumentList RRBRACKET)? (fieldDefinition|batchSetDefinition)+
| 'enum' (type=typeReference)? name=idExpression (attributes=attributeList) (LRBRACKET params=argumentList RRBRACKET)? enumValues=enumValueDefinition+
| 'dataIo' name=idExpression (attributes=attributeList) (LRBRACKET params=argumentList RRBRACKET)? dataIoTypeSwitch=dataIoDefinition
;

fieldDefinition
: LBRACKET field (attributes=attributeList) (LBRACKET params=multipleExpressions RBRACKET)? RBRACKET
: LBRACKET field (attributes=attributeList) RBRACKET
;

batchSetDefinition
Expand Down Expand Up @@ -138,7 +138,7 @@ enumValueDefinition
;

typeReference
: complexTypeReference=IDENTIFIER_LITERAL (LBRACKET params=multipleExpressions RBRACKET)?
: complexTypeReference=IDENTIFIER_LITERAL (LRBRACKET params=multipleExpressions RRBRACKET)?
| simpleTypeReference=dataType
;

Expand Down Expand Up @@ -210,6 +210,8 @@ idExpression
TICK : '\'';
LBRACKET : '[';
RBRACKET : ']';
LRBRACKET : '(';
RRBRACKET : ')';
LCBRACKET : '{';
RCBRACKET : '}';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ public class DefaultAbstractField extends DefaultField implements AbstractField

private final TypeReference type;
private final String name;
private final List<Term> params;

public DefaultAbstractField(Map<String, Term> attributes, TypeReference type, String name, List<Term> params) {
public DefaultAbstractField(Map<String, Term> attributes, TypeReference type, String name) {
super(attributes);
this.type = Objects.requireNonNull(type);
this.name = Objects.requireNonNull(name);
this.params = params;
}

public TypeReference getType() {
Expand All @@ -48,8 +46,4 @@ public String getName() {
return name;
}

public Optional<List<Term>> getParams() {
return Optional.ofNullable(params);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ public class DefaultArrayField extends DefaultField implements ArrayField {
private final String name;
private final LoopType loopType;
private final Term loopExpression;
private final List<Term> params;

public DefaultArrayField(Map<String, Term> attributes, TypeReference type, String name, LoopType loopType, Term loopExpression, List<Term> params) {
public DefaultArrayField(Map<String, Term> attributes, TypeReference type, String name, LoopType loopType, Term loopExpression) {
super(attributes);
this.type = Objects.requireNonNull(type);
this.name = Objects.requireNonNull(name);
this.loopType = Objects.requireNonNull(loopType);
this.loopExpression = Objects.requireNonNull(loopExpression);
this.params = params;
}

public TypeReference getType() {
Expand All @@ -60,9 +58,4 @@ public Term getLoopExpression() {
return loopExpression;
}

@Override
public Optional<List<Term>> getParams() {
return Optional.ofNullable(params);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ public class DefaultAssertField extends DefaultField implements AssertField {
private final TypeReference type;
private final String name;
private final Term conditionExpression;
private final List<Term> params;

public DefaultAssertField(Map<String, Term> attributes, TypeReference type, String name, Term conditionExpression, List<Term> params) {
public DefaultAssertField(Map<String, Term> attributes, TypeReference type, String name, Term conditionExpression) {
super(attributes);
this.type = Objects.requireNonNull(type);
this.name = Objects.requireNonNull(name);
this.conditionExpression = Objects.requireNonNull(conditionExpression);
this.params = params;
}

public TypeReference getType() {
Expand All @@ -54,9 +52,4 @@ public Term getConditionExpression() {
return conditionExpression;
}

@Override
public Optional<List<Term>> getParams() {
return Optional.ofNullable(params);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,4 @@ public Term getChecksumExpression() {
return checksumExpression;
}

public Optional<List<Term>> getParams() {
return Optional.of(Collections.emptyList());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,4 @@ public Object getReferenceValue() {
return referenceValue;
}

public Optional<List<Term>> getParams() {
return Optional.of(Collections.emptyList());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,4 @@ public String getName() {
return name;
}

public Optional<List<Term>> getParams() {
return Optional.of(Collections.emptyList());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.plc4x.plugins.codegenerator.types.references.TypeReference;
import org.apache.plc4x.plugins.codegenerator.types.terms.Term;

import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
Expand All @@ -32,14 +31,12 @@ public class DefaultEnumField extends DefaultField implements EnumField {
private final TypeReference type;
private final String name;
private final String fieldName;
private final List<Term> params;

public DefaultEnumField(Map<String, Term> attributes, TypeReference type, String name, String fieldName, List<Term> params) {
public DefaultEnumField(Map<String, Term> attributes, TypeReference type, String name, String fieldName) {
super(attributes);
this.type = Objects.requireNonNull(type);
this.name = Objects.requireNonNull(name);
this.fieldName = fieldName;
this.params = params;
}

public TypeReference getType() {
Expand All @@ -54,9 +51,4 @@ public Optional<String> getFieldName() {
return Optional.ofNullable(fieldName);
}

@Override
public Optional<List<Term>> getParams() {
return Optional.ofNullable(params);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,4 @@ public Term getSerializeExpression() {
return serializeExpression;
}

public Optional<List<Term>> getParams() {
return Optional.of(Collections.emptyList());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
import org.apache.plc4x.plugins.codegenerator.types.references.TypeReference;
import org.apache.plc4x.plugins.codegenerator.types.terms.Term;

import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

public class DefaultManualArrayField extends DefaultField implements ManualArrayField {

Expand All @@ -36,9 +34,8 @@ public class DefaultManualArrayField extends DefaultField implements ManualArray
private final Term parseExpression;
private final Term serializeExpression;
private final Term lengthExpression;
private final List<Term> params;

public DefaultManualArrayField(Map<String, Term> attributes, TypeReference type, String name, LoopType loopType, Term loopExpression, Term parseExpression, Term serializeExpression, Term lengthExpression, List<Term> params) {
public DefaultManualArrayField(Map<String, Term> attributes, TypeReference type, String name, LoopType loopType, Term loopExpression, Term parseExpression, Term serializeExpression, Term lengthExpression) {
super(attributes);
this.type = Objects.requireNonNull(type);
this.name = Objects.requireNonNull(name);
Expand All @@ -47,7 +44,6 @@ public DefaultManualArrayField(Map<String, Term> attributes, TypeReference type,
this.parseExpression = Objects.requireNonNull(parseExpression);
this.serializeExpression = Objects.requireNonNull(serializeExpression);
this.lengthExpression = Objects.requireNonNull(lengthExpression);
this.params = params;
}

public TypeReference getType() {
Expand Down Expand Up @@ -78,8 +74,4 @@ public Term getLengthExpression() {
return lengthExpression;
}

@Override
public Optional<List<Term>> getParams() {
return Optional.ofNullable(params);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@ public class DefaultManualField extends DefaultField implements ManualField {
private final Term parseExpression;
private final Term serializeExpression;
private final Term lengthExpression;
private final List<Term> params;

public DefaultManualField(Map<String, Term> attributes, TypeReference type, String name, Term parseExpression, Term serializeExpression, Term lengthExpression, List<Term> params) {
public DefaultManualField(Map<String, Term> attributes, TypeReference type, String name, Term parseExpression, Term serializeExpression, Term lengthExpression) {
super(attributes);
this.type = Objects.requireNonNull(type);
this.name = Objects.requireNonNull(name);
this.parseExpression = Objects.requireNonNull(parseExpression);
this.serializeExpression = Objects.requireNonNull(serializeExpression);
this.lengthExpression = Objects.requireNonNull(lengthExpression);
this.params = params;
}

public TypeReference getType() {
Expand All @@ -66,8 +64,4 @@ public Term getLengthExpression() {
return lengthExpression;
}

public Optional<List<Term>> getParams() {
return Optional.ofNullable(params);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ public class DefaultOptionalField extends DefaultField implements OptionalField
private final TypeReference type;
private final String name;
private final Term conditionExpression;
private final List<Term> params;

public DefaultOptionalField(Map<String, Term> attributes, TypeReference type, String name, Term conditionExpression, List<Term> params) {
public DefaultOptionalField(Map<String, Term> attributes, TypeReference type, String name, Term conditionExpression) {
super(attributes);
this.type = Objects.requireNonNull(type);
this.name = Objects.requireNonNull(name);
this.conditionExpression = conditionExpression;
this.params = params;
}

public TypeReference getType() {
Expand All @@ -54,8 +52,4 @@ public Optional<Term> getConditionExpression() {
return Optional.ofNullable(conditionExpression);
}

public Optional<List<Term>> getParams() {
return Optional.ofNullable(params);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ public class DefaultPaddingField extends DefaultField implements PaddingField {
private final String name;
private final Term paddingValue;
private final Term paddingCondition;
private final List<Term> params;

public DefaultPaddingField(Map<String, Term> attributes, TypeReference type, String name, Term paddingValue, Term paddingCondition, List<Term> params) {
public DefaultPaddingField(Map<String, Term> attributes, TypeReference type, String name, Term paddingValue, Term paddingCondition) {
super(attributes);
this.type = Objects.requireNonNull(type);
this.name = Objects.requireNonNull(name);
this.paddingValue = Objects.requireNonNull(paddingValue);
this.paddingCondition = Objects.requireNonNull(paddingCondition);
this.params = params;
}

public TypeReference getType() {
Expand All @@ -60,8 +58,4 @@ public Term getPaddingCondition() {
return paddingCondition;
}

public Optional<List<Term>> getParams() {
return Optional.ofNullable(params);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,4 @@ public Object getReferenceValue() {
return referenceValue;
}

public Optional<List<Term>> getParams() {
return Optional.of(Collections.emptyList());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ public class DefaultSimpleField extends DefaultField implements SimpleField {

private final TypeReference type;
private final String name;
private final List<Term> params;

public DefaultSimpleField(Map<String, Term> attributes, TypeReference type, String name, List<Term> params) {
public DefaultSimpleField(Map<String, Term> attributes, TypeReference type, String name) {
super(attributes);
this.type = Objects.requireNonNull(type);
this.name = Objects.requireNonNull(name);
this.params = params;
}

public TypeReference getType() {
Expand All @@ -48,8 +46,4 @@ public String getName() {
return name;
}

public Optional<List<Term>> getParams() {
return Optional.ofNullable(params);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,4 @@ public Optional<Term> getAttribute(String attributeName) {
return Optional.empty();
}

public Optional<List<Term>> getParams() {
return Optional.of(Collections.emptyList());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,4 @@ public TypeReference getType() {
return type;
}

public Optional<List<Term>> getParams() {
return Optional.of(Collections.emptyList());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,4 @@ public Term getValueExpression() {
return valueExpression;
}

public Optional<List<Term>> getParams() {
return Optional.of(Collections.emptyList());
}

}
Loading

0 comments on commit ca05161

Please sign in to comment.