mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-24 07:44:42 +08:00
Fix empty array grammar
This commit is contained in:
5
dist/ueblueprint.js
vendored
5
dist/ueblueprint.js
vendored
@@ -3083,6 +3083,7 @@ class Grammar {
|
||||
/**
|
||||
* @template T
|
||||
* @param {AttributeInfo<T>} attribute
|
||||
* @returns {Parsernostrum<DescribedType<T>>}
|
||||
*/
|
||||
static grammarFor(attribute, type = attribute?.type, defaultGrammar = this.unknownValue) {
|
||||
let result = defaultGrammar;
|
||||
@@ -3092,9 +3093,9 @@ class Grammar {
|
||||
}
|
||||
result = Parsernostrum.seq(
|
||||
Parsernostrum.reg(/\(\s*/),
|
||||
this.grammarFor(undefined, type[0]).sepBy(this.commaSeparation),
|
||||
this.grammarFor(undefined, type[0]).sepBy(this.commaSeparation).opt(),
|
||||
Parsernostrum.reg(/\s*(?:,\s*)?\)/),
|
||||
).map(([_0, values, _3]) => values);
|
||||
).map(([_0, values, _3]) => values instanceof Array ? values : []);
|
||||
} else if (type instanceof Union) {
|
||||
result = type.values
|
||||
.map(v => this.grammarFor(undefined, v))
|
||||
|
||||
2
dist/ueblueprint.min.js
vendored
2
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user