From d3a55cb663417dc94978f2260ef5b3cfaf8df646 Mon Sep 17 00:00:00 2001 From: c0dev0id Date: Mon, 6 Jul 2026 21:17:46 +0200 Subject: [PATCH] refactor: remove WHAT-comments, keep WHY and RFC references --- static/ast-parser.js | 9 --------- static/components/ObjectExtended.js | 3 --- static/components/ObjectShort.js | 1 - static/components/PaneFO.js | 4 +--- static/components/PaneSubObjects.js | 3 --- static/exporter.js | 13 ------------- 6 files changed, 1 insertion(+), 32 deletions(-) diff --git a/static/ast-parser.js b/static/ast-parser.js index 2bb4bdb..e91f863 100644 --- a/static/ast-parser.js +++ b/static/ast-parser.js @@ -29,7 +29,6 @@ export function parseAstLog(text) { const node = { slot, parentSlot, depth, positionals, props, children: [] }; - // Pop stack to find correct parent (parent must have depth < current) while (stack.length > 1 && stack[stack.length - 1].depth >= depth) { stack.pop(); } @@ -54,18 +53,15 @@ function _parseRest(rest) { let inProps = false; while (i < n) { - // skip spaces while (i < n && rest[i] === ' ') i++; if (i >= n) break; if (rest[i] === "'") { - // single-quoted value (positional string) const j = rest.indexOf("'", i + 1); const val = rest.slice(i + 1, j === -1 ? n : j); i = j === -1 ? n : j + 1; if (!inProps) positionals.push(val); } else { - // scan to next space let j = i; while (j < n && rest[j] !== ' ') j++; const tok = rest.slice(i, j); @@ -78,9 +74,7 @@ function _parseRest(rest) { let rawVal = tok.slice(eqIdx + 1); if (rawVal.startsWith("'")) { - // value continues until next single quote const valStart = i - (tok.length - eqIdx - 1); - // find closing quote: search from after the opening quote const openPos = rest.indexOf("'", rest.lastIndexOf(key + '=', i) + key.length + 1); const closePos = rest.indexOf("'", openPos + 1); rawVal = closePos === -1 ? rest.slice(openPos + 1) : rest.slice(openPos + 1, closePos); @@ -91,15 +85,12 @@ function _parseRest(rest) { } else if (!inProps) { positionals.push(coerce(tok)); } - // bare token after props start is ignored (shouldn't happen per spec) } } return { positionals, props }; } -// ── Second pass: build typed model ────────────────────────────────────────── - function _collectUnknownProps(nodeProps, knownKeys) { return Object.fromEntries(Object.entries(nodeProps).filter(([k]) => !knownKeys.has(k))); } diff --git a/static/components/ObjectExtended.js b/static/components/ObjectExtended.js index fbbcf94..e56ba7b 100644 --- a/static/components/ObjectExtended.js +++ b/static/components/ObjectExtended.js @@ -1,8 +1,5 @@ import { h } from 'vue'; -// Extended property view rendered as a definition list. -// `fields`: array of { key, value, editable?, type? } -// `onChange`: called with { key, value } when field changes. export const ObjectExtended = { props: ['fields', 'onChange'], setup(props) { diff --git a/static/components/ObjectShort.js b/static/components/ObjectShort.js index 5dd5175..96e5142 100644 --- a/static/components/ObjectShort.js +++ b/static/components/ObjectShort.js @@ -1,6 +1,5 @@ import { h } from 'vue'; -// One-line summary row with a drill-down chevron. export const ObjectShort = { props: ['label', 'typeTag', 'focused', 'hasChildren', 'readOnly', 'deletable'], emits: ['focus', 'drillDown', 'delete'], diff --git a/static/components/PaneFO.js b/static/components/PaneFO.js index 9dc0891..cf7dccb 100644 --- a/static/components/PaneFO.js +++ b/static/components/PaneFO.js @@ -58,9 +58,7 @@ export const PaneFO = { return fp.length ? fp[fp.length - 1] : null; } - // Intercepts the first edit to a linked instrument: - // shows embed-or-discard modal before committing. `info.undo` - // (forwarded from ShapeEditor/EnvelopeEditor) reverts the mutation on discard. + // Guard: first edit to a linked instrument triggers embed-or-discard before committing. function makeChangeHandler(instr) { return (info) => { if (instr.isLinked && !instr.isDirty) { diff --git a/static/components/PaneSubObjects.js b/static/components/PaneSubObjects.js index 200e577..a1b7b25 100644 --- a/static/components/PaneSubObjects.js +++ b/static/components/PaneSubObjects.js @@ -2,14 +2,11 @@ import { h } from 'vue'; import { ObjectShort } from './ObjectShort.js'; import { getKindGroups } from '../subobject-kinds.js'; -// Strip the final maximal run of same-class characters (all-digits or all-non-digits) -// from the ID tail. Everything before that run is the group key. function _barGroupKey(id) { const m = id.match(/(\d+|\D+)$/); return m ? id.slice(0, m.index) : id; } -// Increment the trailing numeric run of an ID, preserving zero-padding width. function _incrementId(id) { const m = id.match(/(\d+)$/); if (!m) return id + '1'; diff --git a/static/exporter.js b/static/exporter.js index d405fc6..2c73e9a 100644 --- a/static/exporter.js +++ b/static/exporter.js @@ -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'];