mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-14 00:54:48 +08:00
* Keep track of entities * Fix renaming * Niagara variables wip * Several niagara decode and test * Move nodeTemplate code to dedicated file, self node added * Move node decoding functions to dedicated files * Move pin decoding logic to dedicated files * Accept space separated keys in objects * Build * Prevent a crash in case of incomplete object * Avoid creating objects unnecessarily * types formatting * Initial metasound style * Common pcg nodes colors * Fix string serialization * Metasound new styles and fixes * More metasound styles and colors * WIP * Several fixes * More tests and fixes * Clean gitignore
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
import Parsernostrum from "parsernostrum"
|
|
import Grammar from "../serialization/Grammar.js"
|
|
import AttributeInfo from "./AttributeInfo.js"
|
|
import IEntity from "./IEntity.js"
|
|
|
|
export default class InvariantTextEntity extends IEntity {
|
|
|
|
static attributes = {
|
|
...super.attributes,
|
|
value: AttributeInfo.createValue(""),
|
|
lookbehind: new AttributeInfo({
|
|
...super.attributes.lookbehind,
|
|
default: "INVTEXT",
|
|
}),
|
|
}
|
|
static grammar = this.createGrammar()
|
|
|
|
static createGrammar() {
|
|
return Parsernostrum.alt(
|
|
Parsernostrum.seq(
|
|
Parsernostrum.reg(new RegExp(`${this.attributes.lookbehind.default}\\s*\\(`)),
|
|
Grammar.grammarFor(this.attributes.value),
|
|
Parsernostrum.reg(/\s*\)/)
|
|
)
|
|
.map(([_0, value, _2]) => value),
|
|
Parsernostrum.reg(new RegExp(this.attributes.lookbehind.default)) // InvariantTextEntity can not have arguments
|
|
.map(() => "")
|
|
).map(value => new this(value))
|
|
}
|
|
|
|
constructor(values) {
|
|
if (values.constructor !== Object) {
|
|
values = {
|
|
value: values,
|
|
}
|
|
}
|
|
super(values)
|
|
/** @type {String} */ this.value
|
|
}
|
|
|
|
toString() {
|
|
return this.value
|
|
}
|
|
}
|