mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-03 23:55:04 +08:00
PathSymbol => PathSymbolEntity
This commit is contained in:
1444
dist/ueblueprint.js
vendored
1444
dist/ueblueprint.js
vendored
File diff suppressed because one or more lines are too long
16
js/entity/PathSymbolEntity.js
Normal file
16
js/entity/PathSymbolEntity.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import Entity from "./Entity"
|
||||
|
||||
export default class PathSymbolEntity extends Entity {
|
||||
|
||||
static attributes = {
|
||||
value: String
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
return PathSymbolEntity.attributes
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this.value
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import Entity from "./Entity"
|
||||
import Guid from "./primitive/Guid"
|
||||
import PathSymbol from "./primitive/PathSymbol"
|
||||
import PathSymbol from "./PathSymbolEntity"
|
||||
|
||||
export default class PinReferenceEntity extends Entity {
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import Primitive from "./Primitive"
|
||||
|
||||
export default class PathSymbol extends Primitive {
|
||||
|
||||
constructor(value) {
|
||||
super()
|
||||
this.value = new String(value).valueOf()
|
||||
}
|
||||
|
||||
valueOf() {
|
||||
this.value
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this.value
|
||||
}
|
||||
}
|
||||
19
js/export.js
19
js/export.js
@@ -1,16 +1,18 @@
|
||||
import Blueprint from "./Blueprint"
|
||||
import CustomSerializer from "./serialization/CustomSerializer"
|
||||
import FunctionReferenceEntity from "./entity/FunctionReferenceEntity"
|
||||
import GeneralSerializer from "./serialization/GeneralSerializer"
|
||||
import GraphLink from "./graph/GraphLink"
|
||||
import GraphNode from "./graph/GraphNode"
|
||||
import LocalizedTextEntity from "./entity/LocalizedTextEntity"
|
||||
import ObjectEntity from "./entity/ObjectEntity"
|
||||
import ObjectSerializer from "./serialization/ObjectSerializer"
|
||||
import PinEntity from "./entity/PinEntity"
|
||||
import SerializerFactory from "./serialization/SerializerFactory"
|
||||
import Blueprint from "./Blueprint"
|
||||
import GraphNode from "./graph/GraphNode"
|
||||
import GraphLink from "./graph/GraphLink"
|
||||
import PinReferenceEntity from "./entity/PinReferenceEntity"
|
||||
import ObjectReferenceEntity from "./entity/ObjectReferenceEntity"
|
||||
import CustomSerializer from "./serialization/CustomSerializer"
|
||||
import ObjectSerializer from "./serialization/ObjectSerializer"
|
||||
import PathSymbolEntity from "./entity/PathSymbolEntity"
|
||||
import PinEntity from "./entity/PinEntity"
|
||||
import PinReferenceEntity from "./entity/PinReferenceEntity"
|
||||
import SerializerFactory from "./serialization/SerializerFactory"
|
||||
import ToStringSerializer from "./serialization/ToStringSerializer"
|
||||
|
||||
SerializerFactory.registerSerializer(
|
||||
ObjectEntity,
|
||||
@@ -42,5 +44,6 @@ SerializerFactory.registerSerializer(
|
||||
: ""
|
||||
))
|
||||
)
|
||||
SerializerFactory.registerSerializer(PathSymbolEntity, new ToStringSerializer(PathSymbolEntity))
|
||||
|
||||
export { Blueprint as Blueprint, GraphNode as GraphNode, GraphLink as GraphLink }
|
||||
@@ -8,7 +8,7 @@ import Parsimmon from "parsimmon"
|
||||
import PinEntity from "../entity/PinEntity"
|
||||
import PinReferenceEntity from "../entity/PinReferenceEntity"
|
||||
import Utility from "../Utility"
|
||||
import PathSymbol from "../entity/primitive/PathSymbol"
|
||||
import PathSymbolEntity from "../entity/PathSymbolEntity"
|
||||
|
||||
let P = Parsimmon
|
||||
|
||||
@@ -25,8 +25,8 @@ export default class Grammar {
|
||||
String = _ => P.regex(/(?:[^"\\]|\\")*/).wrap(P.string('"'), P.string('"')).desc('string (with possibility to escape the quote using \")')
|
||||
Word = _ => P.regex(/[a-zA-Z]+/).desc("a word")
|
||||
Guid = _ => P.regex(/[0-9a-zA-Z]{32}/).map(v => new Guid(v)).desc("32 digit hexadecimal (accepts all the letters for safety) value")
|
||||
PathSymbol = _ => P.regex(/[0-9a-zA-Z_]+/).map(v => new PathSymbol(v))
|
||||
ReferencePath = r => P.seq(P.string("/"), r.PathSymbol.map(v => v.toString()).sepBy1(P.string(".")).tieWith("."))
|
||||
PathSymbolEntity = _ => P.regex(/[0-9a-zA-Z_]+/).map(v => new PathSymbolEntity({ value: v }))
|
||||
ReferencePath = r => P.seq(P.string("/"), r.PathSymbolEntity.map(v => v.toString()).sepBy1(P.string(".")).tieWith("."))
|
||||
.tie()
|
||||
.atLeast(2)
|
||||
.tie()
|
||||
@@ -62,7 +62,7 @@ export default class Grammar {
|
||||
})
|
||||
)
|
||||
PinReference = r => P.seqMap(
|
||||
r.PathSymbol,
|
||||
r.PathSymbolEntity,
|
||||
P.whitespace,
|
||||
r.Guid,
|
||||
(objectName, _, pinGuid) => new PinReferenceEntity({
|
||||
|
||||
13
js/serialization/ToStringSerializer.js
Normal file
13
js/serialization/ToStringSerializer.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import GeneralSerializer from "./GeneralSerializer"
|
||||
|
||||
export default class ToStringSerializer extends GeneralSerializer {
|
||||
|
||||
constructor(entityType) {
|
||||
super(undefined, entityType)
|
||||
}
|
||||
|
||||
write(object) {
|
||||
let result = object.toString()
|
||||
return result
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user