barmark 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -1
- package/dist/chart/expand.js +15 -2
- package/dist/chords/parse.js +6 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,48 @@ Releases follow the process in [RELEASING.md](RELEASING.md).
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [0.8.0] - 2026-11-02
|
|
13
|
+
|
|
14
|
+
`(add9)` and friends inside parentheses, clearer messages for an empty
|
|
15
|
+
section and a rejected tone, and grammar notes from Stem Shovel's issues.
|
|
16
|
+
Charts that read before read the same. Implements the
|
|
17
|
+
[grammar v0.1 draft](https://github.com/kevinpeckham/barmark/blob/main/docs/grammar-v0.1-draft.md).
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- **`(addN)` reads inside parentheses** (issue #62). `Am(add9)`,
|
|
22
|
+
`C(add2)`, `C(add4)` and `C(add11)` are aliases of `Am(9)`, `C(2)`,
|
|
23
|
+
`C(4)` and `C(11)`, alone or in a list (`C(b9,add11)` is `C(b9,11)`),
|
|
24
|
+
and print in the canonical form. `add13` and `add#11` stay errors.
|
|
25
|
+
Grammar Appendix A.5 and the decisions log.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- **An empty section that matches nothing says how to fix it** (issue
|
|
30
|
+
#63). `## Progression` with no bars and no earlier section of that name
|
|
31
|
+
reported `no earlier section named "Progression" to replay`; it now
|
|
32
|
+
reports `"Progression" has no bars and no earlier section has that
|
|
33
|
+
name; write its bars under it, or remove the heading`. When the name is
|
|
34
|
+
written out later in the chart, the message says replays use only
|
|
35
|
+
earlier sections and gives that line. It is still an error: a section
|
|
36
|
+
with no bars replays (grammar §6), and there is no intentionally empty
|
|
37
|
+
section.
|
|
38
|
+
- **Grammar notes; no chart changes meaning.** §8 gains a note for
|
|
39
|
+
generators: write one slot per beat (the 2.1 beat, so 6/8 has two),
|
|
40
|
+
then canonicalize; a length that is not a whole number of beats needs
|
|
41
|
+
an eighth-note grid or a `_` group; leave out a section with no bars
|
|
42
|
+
(issue #64). §2.3: a tool that knows only the chord part writes `N.C.`
|
|
43
|
+
for its rests, not `--` (issue #65). §7.1: `feel:` names a kind of
|
|
44
|
+
groove, not an amount, so `swing 60%` stays an error, and the "custom
|
|
45
|
+
swing ratios" open question is closed (issue #66).
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
- **A rejected tone in parentheses is named as written.** `C(add9x)`
|
|
50
|
+
reported `"x" is not a tone a parenthesis can add`, and `Am(add9)`
|
|
51
|
+
reported `""`, because a bare `add9` was looked for inside the group
|
|
52
|
+
too; the message now quotes the tone as written (`"add9x"`).
|
|
53
|
+
|
|
12
54
|
## [0.7.0] - 2026-11-02
|
|
13
55
|
|
|
14
56
|
Print a chart you have already parsed, and conformance fixtures from real
|
|
@@ -160,7 +202,8 @@ The first working release: the reference parser and printer for the
|
|
|
160
202
|
|
|
161
203
|
- **A placeholder package that holds the `barmark` name** while the spec and parser are written.
|
|
162
204
|
|
|
163
|
-
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.
|
|
205
|
+
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.8.0...HEAD
|
|
206
|
+
[0.8.0]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.7.0...barmark-v0.8.0
|
|
164
207
|
[0.7.0]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.6.0...barmark-v0.7.0
|
|
165
208
|
[0.6.0]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.5.0...barmark-v0.6.0
|
|
166
209
|
[0.5.0]: https://github.com/kevinpeckham/barmark/compare/barmark-v0.4.0...barmark-v0.5.0
|
package/dist/chart/expand.js
CHANGED
|
@@ -4,6 +4,19 @@ export const MAX_EXPANDED_BARS = 10_000;
|
|
|
4
4
|
/** Repeats of bodies that play no bars (fermatas only) are bounded too. */
|
|
5
5
|
const MAX_WORK = MAX_EXPANDED_BARS * 10;
|
|
6
6
|
const normalize = (name) => name.toLowerCase().replace(/\s+/g, " ").trim();
|
|
7
|
+
const isWritten = (s) => s.lines.some((l) => l.kind === "bars" || l.kind === "invalid");
|
|
8
|
+
/** Grammar §6: an empty section that matches nothing, and how to fix it. */
|
|
9
|
+
function unmatchedReplay(heading, sections) {
|
|
10
|
+
const name = normalize(heading.name);
|
|
11
|
+
const later = sections.find((s) => s.heading &&
|
|
12
|
+
s.heading.line > heading.line &&
|
|
13
|
+
normalize(s.heading.name) === name &&
|
|
14
|
+
isWritten(s))?.heading;
|
|
15
|
+
const fix = later
|
|
16
|
+
? `replays use only earlier sections (it is written at line ${later.line})`
|
|
17
|
+
: "write its bars under it, or remove the heading";
|
|
18
|
+
return `"${heading.name}" has no bars and no earlier section has that name; ${fix}`;
|
|
19
|
+
}
|
|
7
20
|
/** Every played bar in order, with an open repeat's pass included once. */
|
|
8
21
|
export function flattenBars(events) {
|
|
9
22
|
return events.flatMap((e) => e.kind === "bar" ? [e.bar] : e.kind === "open" ? flattenBars(e.events) : []);
|
|
@@ -258,7 +271,7 @@ export function expand(lines) {
|
|
|
258
271
|
}
|
|
259
272
|
sectionName = h.name;
|
|
260
273
|
const out = [];
|
|
261
|
-
const isDefinition = s
|
|
274
|
+
const isDefinition = isWritten(s);
|
|
262
275
|
let replayOf = null;
|
|
263
276
|
if (isDefinition) {
|
|
264
277
|
definitions.set(normalize(h.name), s);
|
|
@@ -272,7 +285,7 @@ export function expand(lines) {
|
|
|
272
285
|
continue;
|
|
273
286
|
const source = definitions.get(normalize(h.name));
|
|
274
287
|
if (!source?.heading) {
|
|
275
|
-
error(h.line,
|
|
288
|
+
error(h.line, unmatchedReplay(h, sections), h.name);
|
|
276
289
|
continue;
|
|
277
290
|
}
|
|
278
291
|
replayOf = source.heading.line;
|
package/dist/chords/parse.js
CHANGED
|
@@ -86,9 +86,13 @@ function normalizeSymbol(symbol) {
|
|
|
86
86
|
for (const [pattern, replacement] of ALIASES)
|
|
87
87
|
rest = rest.replace(pattern, replacement);
|
|
88
88
|
rest = logicGroups(rest);
|
|
89
|
-
|
|
89
|
+
// `(add9)` is `(9)`: inside a group, `add` before a tone it may add is dropped.
|
|
90
|
+
rest = rest.replace(/(?<=[(,]\s*)add(2|4|9|11)(?=\s*[,)])/g, "$1");
|
|
91
|
+
// A bare `add9` outside any group; what is left inside one is the tokenizer's to name.
|
|
92
|
+
const bare = /add(2|4|9|11)(?![^(]*\))/g;
|
|
93
|
+
const added = [...rest.matchAll(bare)].map((m) => m[1] ?? "");
|
|
90
94
|
if (added.length) {
|
|
91
|
-
rest = rest.replace(
|
|
95
|
+
rest = rest.replace(bare, "");
|
|
92
96
|
const close = rest.indexOf(")");
|
|
93
97
|
if (close >= 0)
|
|
94
98
|
rest = `${rest.slice(0, close)},${added.join(",")}${rest.slice(close)}`;
|