Revert "Support both old and new sompyler AST slot names in parser"

This reverts commit b56d84befb.
This commit is contained in:
c0dev0id
2026-06-28 01:53:53 +02:00
parent b56d84befb
commit 6be4a3297a
2 changed files with 8 additions and 38 deletions

View File

@@ -443,10 +443,10 @@ function buildOffset(node) {
unknownProps: collectUnknownProps(node.props, new Set(['tick'])),
};
for (const child of node.children) {
if ((child.parentSlot === 'line' || child.parentSlot === 'offset') && child.slot === 'stem_note')
if (child.parentSlot === 'line' && child.slot === 'stem_note')
offset.stemNotes.push(buildStemNote(child));
else if ((child.parentSlot === 'line' || child.parentSlot === 'offset') && child.slot === 'motif')
offset.motifs.push({ label: child.positionals[0] ?? child.props.label, chord: child.props.chord ?? null });
else if (child.parentSlot === 'line' && child.slot === 'motif')
offset.motifs.push({ label: child.positionals[0], chord: child.props.chord ?? null });
}
return offset;
}
@@ -465,7 +465,7 @@ function buildStemNote(node) {
weight: null,
chainText: chainNode?.props._tmp_string ?? '',
writeToName: writeToNode?.positionals[0] ?? null,
clauses: (chainNode ? chainNode.children : node.children)
clauses: (chainNode?.children ?? [])
.filter(c => c.parentSlot === 'chain' && c.slot === 'clause')
.map(buildClause),
isDirty: false,
@@ -478,9 +478,9 @@ function buildClause(node) {
type: 'clause',
index: node.positionals[0] ?? 0,
repeat: node.props.repeat ?? null,
notes: node.children.filter(c => c.slot === 'note' && (c.parentSlot === 'seq' || c.parentSlot === 'clause')).map(c => ({ ...c.props })),
pauses: node.children.filter(c => c.slot === 'pause' && (c.parentSlot === 'seq' || c.parentSlot === 'clause')).map(c => ({ length: c.props.length })),
stacks: node.children.filter(c => c.slot === 'stack' && (c.parentSlot === 'seq' || c.parentSlot === 'clause')).map(c => ({
notes: node.children.filter(c => c.slot === 'note' && c.parentSlot === 'seq').map(c => ({ ...c.props })),
pauses: node.children.filter(c => c.slot === 'pause' && c.parentSlot === 'seq').map(c => ({ length: c.props.length })),
stacks: node.children.filter(c => c.slot === 'stack' && c.parentSlot === 'seq').map(c => ({
length: c.props.length, netlength: c.props.netlength,
notes: c.children.filter(cn => cn.slot === 'note').map(cn => ({ ...cn.props })),
})),
@@ -495,7 +495,7 @@ function buildMotif(node) {
unknownProps: collectUnknownProps(node.props, new Set(['label'])),
};
for (const child of node.children) {
if ((child.parentSlot === 'line' || child.parentSlot === 'motif') && child.slot === 'stem_note')
if (child.parentSlot === 'line' && child.slot === 'stem_note')
m.stemNotes.push(buildStemNote(child));
}
m.isStatic = m.stemNotes.length > 0 && !m.stemNotes.some(sn => Number.isInteger(sn.pitch));