mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
Fix #22
This commit is contained in:
17
dist/ueblueprint.js
vendored
17
dist/ueblueprint.js
vendored
@@ -2457,7 +2457,7 @@ class Parsernostrum {
|
||||
}
|
||||
|
||||
/**
|
||||
* @template {[Parsernostrum<any>, Parsernostrum<any>, ...Parsernostrum<any>[]]} P
|
||||
* @template {Parsernostrum<any>[]} P
|
||||
* @param {P} parsers
|
||||
* @returns {Parsernostrum<AlternativeParser<UnwrapParser<P>>>}
|
||||
*/
|
||||
@@ -4476,10 +4476,10 @@ class ObjectReferenceEntity extends IEntity {
|
||||
).map(([_full, type, ...path]) => new this({ type, path: path.find(v => v), _full }))
|
||||
static fullReferenceSerializedGrammar = Parsernostrum.regArray(
|
||||
new RegExp(
|
||||
"(" + this.typeReference.getParser().regexp.source + ")"
|
||||
+ `'(` + Grammar.Regex.InsideSingleQuotedString.source + `)'`
|
||||
'"(' + Grammar.Regex.InsideString.source + "?)"
|
||||
+ "(?:'(" + Grammar.Regex.InsideSingleQuotedString.source + `?)')?"`
|
||||
)
|
||||
).map(([_full, type, ...path]) => new this({ type, path: path.find(v => v), _full }))
|
||||
).map(([_full, type, path]) => new this({ type, path, _full }))
|
||||
static typeReferenceGrammar = this.typeReference.map(v => new this({ type: v, path: "", _full: v }))
|
||||
static grammar = this.createGrammar()
|
||||
|
||||
@@ -4499,14 +4499,7 @@ class ObjectReferenceEntity extends IEntity {
|
||||
|
||||
static createGrammar() {
|
||||
return Parsernostrum.alt(
|
||||
Parsernostrum.seq(
|
||||
Parsernostrum.str('"'),
|
||||
Parsernostrum.alt(
|
||||
this.fullReferenceSerializedGrammar,
|
||||
this.typeReferenceGrammar,
|
||||
),
|
||||
Parsernostrum.str('"'),
|
||||
).map(([_0, objectReference, _1]) => (objectReference._full = `"${objectReference._full}"`, objectReference)),
|
||||
this.fullReferenceSerializedGrammar,
|
||||
this.fullReferenceGrammar,
|
||||
this.typeReferenceGrammar,
|
||||
)
|
||||
|
||||
6
dist/ueblueprint.min.js
vendored
6
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -37,10 +37,10 @@ export default class ObjectReferenceEntity extends IEntity {
|
||||
).map(([_full, type, ...path]) => new this({ type, path: path.find(v => v), _full }))
|
||||
static fullReferenceSerializedGrammar = Parsernostrum.regArray(
|
||||
new RegExp(
|
||||
"(" + this.typeReference.getParser().regexp.source + ")"
|
||||
+ `'(` + Grammar.Regex.InsideSingleQuotedString.source + `)'`
|
||||
'"(' + Grammar.Regex.InsideString.source + "?)"
|
||||
+ "(?:'(" + Grammar.Regex.InsideSingleQuotedString.source + `?)')?"`
|
||||
)
|
||||
).map(([_full, type, ...path]) => new this({ type, path: path.find(v => v), _full }))
|
||||
).map(([_full, type, path]) => new this({ type, path, _full }))
|
||||
static typeReferenceGrammar = this.typeReference.map(v => new this({ type: v, path: "", _full: v }))
|
||||
static grammar = this.createGrammar()
|
||||
|
||||
@@ -60,14 +60,7 @@ export default class ObjectReferenceEntity extends IEntity {
|
||||
|
||||
static createGrammar() {
|
||||
return Parsernostrum.alt(
|
||||
Parsernostrum.seq(
|
||||
Parsernostrum.str('"'),
|
||||
Parsernostrum.alt(
|
||||
this.fullReferenceSerializedGrammar,
|
||||
this.typeReferenceGrammar,
|
||||
),
|
||||
Parsernostrum.str('"'),
|
||||
).map(([_0, objectReference, _1]) => (objectReference._full = `"${objectReference._full}"`, objectReference)),
|
||||
this.fullReferenceSerializedGrammar,
|
||||
this.fullReferenceGrammar,
|
||||
this.typeReferenceGrammar,
|
||||
)
|
||||
|
||||
@@ -370,6 +370,13 @@ test("ObjectReferenceEntity", () => {
|
||||
path: "/Script/Engine.GameModeBase",
|
||||
})
|
||||
expect(serializer.write(reference)).toBe(`/Script/CoreUObject.Class'"/Script/Engine.GameModeBase"'`)
|
||||
|
||||
reference = serializer.read(`"/Game/_YukiritoLib/Textures/T_紫色渐变01.T_紫色渐变01"`)
|
||||
expect(reference).toBeInstanceOf(ObjectReferenceEntity)
|
||||
expect(reference).toMatchObject({
|
||||
type: "/Game/_YukiritoLib/Textures/T_紫色渐变01.T_紫色渐变01",
|
||||
path: "",
|
||||
})
|
||||
})
|
||||
|
||||
test("PinEntity", () => {
|
||||
|
||||
Reference in New Issue
Block a user