mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 21:58:31 +00:00
build
This commit is contained in:
parent
a977a9b444
commit
ea7c079e30
17
docs/dist/parse.js
vendored
17
docs/dist/parse.js
vendored
@ -27,6 +27,12 @@ function reify(thing) {
|
||||
}
|
||||
return pure(thing);
|
||||
}
|
||||
function minify(thing) {
|
||||
if (typeof thing === "string") {
|
||||
return mini(thing);
|
||||
}
|
||||
return reify(thing);
|
||||
}
|
||||
const applyOptions = (parent) => (pat, i) => {
|
||||
const ast = parent.source_[i];
|
||||
const options = ast.options_;
|
||||
@ -39,6 +45,9 @@ const applyOptions = (parent) => (pat, i) => {
|
||||
}
|
||||
console.warn(`operator "${operator.type_}" not implemented`);
|
||||
}
|
||||
if (options?.weight) {
|
||||
return pat;
|
||||
}
|
||||
const unimplemented = Object.keys(options || {}).filter((key) => key !== "operator");
|
||||
if (unimplemented.length) {
|
||||
console.warn(`option${unimplemented.length > 1 ? "s" : ""} ${unimplemented.map((o) => `"${o}"`).join(", ")} not implemented`);
|
||||
@ -52,6 +61,10 @@ export function patternifyAST(ast) {
|
||||
if (ast.arguments_.alignment === "v") {
|
||||
return stack(...children);
|
||||
}
|
||||
const weightedChildren = ast.source_.some((child) => !!child.options_?.weight);
|
||||
if (weightedChildren) {
|
||||
return timeCat(...ast.source_.map((child, i) => [child.options_?.weight || 1, children[i]]));
|
||||
}
|
||||
return sequence(...children);
|
||||
case "element":
|
||||
if (ast.source_ === "~") {
|
||||
@ -94,6 +107,10 @@ export const mini = (...strings) => {
|
||||
return pattern;
|
||||
};
|
||||
const m = mini;
|
||||
const s = (...strings) => {
|
||||
const patternified = strings.map((s2) => minify(s2));
|
||||
return stack(...patternified);
|
||||
};
|
||||
export const h = (string) => {
|
||||
const ast = krill.parse(string);
|
||||
return patternifyAST(ast);
|
||||
|
||||
5
docs/dist/tunes.js
vendored
5
docs/dist/tunes.js
vendored
@ -1,3 +1,8 @@
|
||||
export const timeCatMini = `s(
|
||||
'c3@3 [eb3, g3, [c4 d4]/2]',
|
||||
'c2 g2',
|
||||
m('[eb4@5 [f4 eb4 d4]@3] [eb4 c4]/2').slow(8)
|
||||
)`;
|
||||
export const timeCat = `stack(
|
||||
timeCat([3, c3], [1, stack(eb3, g3, m(c4, d4).slow(2))]),
|
||||
m(c2, g2),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user