refactor: remove WHAT-comments, keep WHY and RFC references

This commit is contained in:
c0dev0id
2026-07-06 21:17:46 +02:00
parent 884955195a
commit d3a55cb663
6 changed files with 1 additions and 32 deletions

View File

@@ -1,6 +1,5 @@
import { stressorToString } from './util.js';
// ── Shape ──────────────────────────────────────────────────────────────────
// RFC §1.3.4.5: SHAPE = [PREFIX (":" / ";")] Node 1*(";" Node)
// Node = x "," y ["*" z] ["!"]
// PREFIX+colon is the duration/resolution; optional START+semicolon follows.
@@ -19,7 +18,6 @@ function _serializeShape(shape) {
return prefix + nodes;
}
// ── FM / AM modulation ─────────────────────────────────────────────────────
// RFC §3.2.1.1.6-7: FM = FREQUENCY ["f"/"F"] ["@" OSC] ["[" SHAPE "]"] ";" MOD ":" BASE
function _serializeModulation(m) {
@@ -31,9 +29,7 @@ function _serializeModulation(m) {
return s;
}
// ── Basic properties ───────────────────────────────────────────────────────
// RFC §3.2.1.1: O, A, S, R, FM go directly in the variation MAPPING.
// Returns array of YAML lines at 0 indent.
function _basicPropLines(bp) {
if (!bp) return [];
@@ -50,9 +46,7 @@ function _basicPropLines(bp) {
return lines;
}
// ── Labelled property groups ───────────────────────────────────────────────
// RFC §3.2.1.2: label name (3+ lowercase chars) is the MAPPING KEY directly.
// Returns array of YAML lines at 0 indent.
function _labelSpecLines(ls) {
const inner = _basicPropLines(ls.basicProperties);
@@ -60,8 +54,6 @@ function _labelSpecLines(ls) {
return [`${ls.label}:`, ...inner.map(l => ` ${l}`)];
}
// ── Variation ─────────────────────────────────────────────────────────────
// Returns YAML lines for one variation MAPPING (no leading "- ").
// RFC §3.2.1.3: VOLUMES, TIMBRE are variation properties, not instrument-level.
function _variationLines(v) {
@@ -81,7 +73,6 @@ function _variationLines(v) {
return lines;
}
// ── Instrument character block ─────────────────────────────────────────────
// VOLUMES, TIMBRE, FM are variation properties (RFC §3.2.1.3). The AST parser
// stores them on the instrument because they appear at depth 01 (root variation
// is implicit when no character: wrapper exists). Promote them into a synthetic
@@ -125,7 +116,6 @@ function _instrCharacterLines(instr) {
return result;
}
// ── Instrument ────────────────────────────────────────────────────────────
// RFC §4.4: embedded instrument key is "instrument NAME:" not "instrument: 'NAME'"
export function exportInstrument(instr) {
@@ -136,7 +126,6 @@ export function exportInstrument(instr) {
return lines.join('\n');
}
// ── Articles ───────────────────────────────────────────────────────────────
// RFC §4.3: articles: MAPPING { LABEL: { ATTR: VALUE ... } ... }
function _serializeArticleValue(v) {
@@ -174,8 +163,6 @@ function _patchArticles(text, articles) {
return lines.join('\n');
}
// ── Score patch ────────────────────────────────────────────────────────────
// Replace dirty article, instrument, and bar _meta blocks.
// Voice note content in bar documents is left verbatim.
const META_KEYS = ['title', 'composer', 'source', 'encrypter'];