mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-16 19:04:40 +08:00
Grammar refactoring WIP
This commit is contained in:
@@ -2,8 +2,31 @@ import Serializer from "./Serializer";
|
||||
|
||||
export default class ObjectSerializer extends Serializer {
|
||||
|
||||
showProperty(attributeKey, attributeValue) {
|
||||
switch (attributeKey.toString()) {
|
||||
case "Class":
|
||||
case "Name":
|
||||
// Serielized separately
|
||||
return false
|
||||
}
|
||||
return super.showProperty(attributeKey, attributeValue)
|
||||
}
|
||||
|
||||
read(value) {
|
||||
const parseResult = Serializer.grammar.Object.parse(value)
|
||||
if (!parseResult.status) {
|
||||
console.error("Error when trying to parse the object.")
|
||||
return parseResult
|
||||
}
|
||||
return parseResult.value
|
||||
}
|
||||
|
||||
write(object) {
|
||||
let result = `Pin (${this.constructor.subWrite('', this)})`
|
||||
let result = `
|
||||
Begin Object Class=${object.Class} Name=${object.Name}
|
||||
${this.subWrite([], object, "\n", " ")}
|
||||
End Object
|
||||
`
|
||||
return result
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user