mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-14 12:29:30 -07:00
Binding syntax changes
This commit is contained in:
@@ -116,7 +116,7 @@ const getTypeData = (type, attributes, otherStructLayouts) => {
|
||||
const parseAttributes = (str) => {
|
||||
const attributes = {};
|
||||
for (const attr of str.split(",").filter((attr) => attr.length > 0)) {
|
||||
const match = attr.match(/(\w+)(\((.*)\))?/); // foo(bar)
|
||||
const match = attr.match(/@(\w+)(\((.*)\))?/); // @foo(bar)
|
||||
const [_, identifier, __, value] = match;
|
||||
attributes[identifier] = value;
|
||||
}
|
||||
@@ -131,7 +131,8 @@ const parseStructLayout = (identifier, body, structLayouts) => {
|
||||
.split(";")
|
||||
.filter((s) => s.length > 0);
|
||||
for (const line of lines) {
|
||||
const fieldMatch = line.match(/(\[\[(.*?)\]\])? ?(\w+) ?: ?(\[\[(.*?)\]\])? ?(.*)/); // [[...]] foo : [[...]] bar;
|
||||
console.log(line);
|
||||
const fieldMatch = line.match(/(\[\[(.*?)\]\])? ?(\w+) ?: ?(\[\[(.*?)\]\])? ?(.*)/); // @a(...) @b(...) foo : @c(...) @d(...) bar;
|
||||
const [_, __, leftAttributes, identifier, ___, rightAttributes, type] = fieldMatch;
|
||||
|
||||
const typeData = getTypeData(type, parseAttributes(rightAttributes ?? ""), structLayouts);
|
||||
|
||||
Reference in New Issue
Block a user