Fix grammar bug, common enums values

This commit is contained in:
barsdeveloper
2023-04-23 14:00:54 +02:00
parent 3ccd3ce9f3
commit 26a4419a2a
7 changed files with 177 additions and 103 deletions

View File

@@ -496,55 +496,63 @@ export default class Grammar {
static rotatorEntity = P.lazy(() => this.createEntityGrammar(RotatorEntity, false))
static simpleSerializationRotatorEntity = P.lazy(() =>
P.seq(
this.number,
this.commaSeparation,
this.number,
this.commaSeparation,
this.number,
).map(([p, _1, y, _3, r]) =>
new SimpleSerializationRotatorEntity({
R: r,
P: p,
Y: y,
})
P.alt(
P.seq(
this.number,
this.commaSeparation,
this.number,
this.commaSeparation,
this.number,
).map(([p, _1, y, _3, r]) =>
new SimpleSerializationRotatorEntity({
R: r,
P: p,
Y: y,
})
),
this.rotatorEntity
)
)
static vector2DEntity = P.lazy(() => this.createEntityGrammar(Vector2DEntity, false))
static simpleSerializationVector2DEntity = P.lazy(() =>
P.seq(
this.number,
this.commaSeparation,
this.number,
).map(([x, _1, y]) => new SimpleSerializationVector2DEntity({
X: x,
Y: y,
}))
P.alt(
P.seq(
this.number,
this.commaSeparation,
this.number,
).map(([x, _1, y]) => new SimpleSerializationVector2DEntity({
X: x,
Y: y,
})),
this.vector2DEntity
)
)
static vectorEntity = P.lazy(() => this.createEntityGrammar(VectorEntity, false))
static simpleSerializationVectorEntity = P.lazy(() =>
P.seq(
this.number,
this.commaSeparation,
this.number,
this.commaSeparation,
this.number,
).map(([x, _1, y, _3, z]) => new SimpleSerializationVectorEntity({
X: x,
Y: y,
Z: z,
}))
P.alt(
P.seq(
this.number,
this.commaSeparation,
this.number,
this.commaSeparation,
this.number,
).map(([x, _1, y, _3, z]) => new SimpleSerializationVectorEntity({
X: x,
Y: y,
Z: z,
})),
this.vectorEntity
)
)
static symbolEntity = P.lazy(() => this.symbol.map(v => new SymbolEntity(v)))
static variableReferenceEntity = P.lazy(() => this.createEntityGrammar(VariableReferenceEntity))
static vector2DEntity = P.lazy(() => this.createEntityGrammar(Vector2DEntity, false))
static vectorEntity = P.lazy(() => this.createEntityGrammar(VectorEntity, false))
static unknownKeysEntity = P.lazy(() =>
P.seq(
this.regexMap(

View File

@@ -90,7 +90,7 @@ export default class ObjectSerializer extends Serializer {
attributeValueConjunctionSign,
key => entity[key] instanceof ObjectEntity ? "" : attributeKeyPrinter(key)
)
+ entity.CustomProperties.map(pin =>
+ entity.getCustomproperties().map(pin =>
moreIndentation
+ attributeKeyPrinter("CustomProperties ")
+ SerializerFactory.getSerializer(PinEntity).doWrite(pin, insideString)