mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-03-06 23:57:30 +08:00
Grammar refactoring WIP
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import Parsimmon from "parsimmon"
|
||||
import PinGrammar from "./PinGrammar"
|
||||
import PinEntity from "../entity/PinEntity"
|
||||
import Serializer from "./Serializer"
|
||||
|
||||
export default class PinSerializer extends Serializer {
|
||||
|
||||
static pinGrammar = Parsimmon.createLanguage(new PinGrammar())
|
||||
getAttributes() {
|
||||
return PinEntity.attributes
|
||||
}
|
||||
|
||||
read(value) {
|
||||
const parseResult = PinSerializer.pinGrammar.Pin.parse(value)
|
||||
const parseResult = Serializer.grammar.Pin.parse(value)
|
||||
if (!parseResult.status) {
|
||||
console.error("Error when trying to parse the pin.")
|
||||
return parseResult
|
||||
@@ -16,7 +17,7 @@ export default class PinSerializer extends Serializer {
|
||||
}
|
||||
|
||||
write(object) {
|
||||
let result = `Pin (${Serializer.subWrite('', object)})`
|
||||
let result = `Pin (${this.subWrite([], object, ",")})`
|
||||
return result
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user