mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-22 14:54:43 +08:00
Split grammar (#15)
* Move grammar parsers to entity classes * Fix includes * Fix Entity5 test * Small detail * Fix unknown keys entities * Persistent grammar objects * Fix grammar * Grammar from variable
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import GuidEntity from "./GuidEntity.js"
|
||||
import IEntity from "./IEntity.js"
|
||||
import Parsimmon from "parsimmon"
|
||||
import PathSymbolEntity from "./PathSymbolEntity.js"
|
||||
|
||||
export default class PinReferenceEntity extends IEntity {
|
||||
@@ -13,10 +14,23 @@ export default class PinReferenceEntity extends IEntity {
|
||||
type: GuidEntity,
|
||||
},
|
||||
}
|
||||
|
||||
static {
|
||||
this.cleanupAttributes(this.attributes)
|
||||
}
|
||||
static grammar = this.createGrammar()
|
||||
|
||||
static createGrammar() {
|
||||
return Parsimmon.seq(
|
||||
PathSymbolEntity.createGrammar(),
|
||||
Parsimmon.whitespace,
|
||||
GuidEntity.createGrammar()
|
||||
).map(
|
||||
([objectName, _1, pinGuid]) => new this({
|
||||
objectName: objectName,
|
||||
pinGuid: pinGuid,
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
constructor(values) {
|
||||
super(values)
|
||||
|
||||
Reference in New Issue
Block a user