mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 21:58:37 +00:00
add "!" and "_" to mini notation
This commit is contained in:
parent
9ac7212f9c
commit
ef9527d691
@ -178,30 +178,32 @@ function peg$parse(input, options) {
|
||||
var peg$c6 = "'";
|
||||
var peg$c7 = "#";
|
||||
var peg$c8 = "^";
|
||||
var peg$c9 = "[";
|
||||
var peg$c10 = "]";
|
||||
var peg$c11 = "<";
|
||||
var peg$c12 = ">";
|
||||
var peg$c13 = "@";
|
||||
var peg$c14 = "(";
|
||||
var peg$c15 = ")";
|
||||
var peg$c16 = "/";
|
||||
var peg$c17 = "*";
|
||||
var peg$c18 = "%";
|
||||
var peg$c19 = "struct";
|
||||
var peg$c20 = "target";
|
||||
var peg$c21 = "euclid";
|
||||
var peg$c22 = "slow";
|
||||
var peg$c23 = "rotL";
|
||||
var peg$c24 = "rotR";
|
||||
var peg$c25 = "fast";
|
||||
var peg$c26 = "scale";
|
||||
var peg$c27 = "//";
|
||||
var peg$c28 = "cat";
|
||||
var peg$c29 = "$";
|
||||
var peg$c30 = "setcps";
|
||||
var peg$c31 = "setbpm";
|
||||
var peg$c32 = "hush";
|
||||
var peg$c9 = "_";
|
||||
var peg$c10 = "[";
|
||||
var peg$c11 = "]";
|
||||
var peg$c12 = "<";
|
||||
var peg$c13 = ">";
|
||||
var peg$c14 = "@";
|
||||
var peg$c15 = "!";
|
||||
var peg$c16 = "(";
|
||||
var peg$c17 = ")";
|
||||
var peg$c18 = "/";
|
||||
var peg$c19 = "*";
|
||||
var peg$c20 = "%";
|
||||
var peg$c21 = "struct";
|
||||
var peg$c22 = "target";
|
||||
var peg$c23 = "euclid";
|
||||
var peg$c24 = "slow";
|
||||
var peg$c25 = "rotL";
|
||||
var peg$c26 = "rotR";
|
||||
var peg$c27 = "fast";
|
||||
var peg$c28 = "scale";
|
||||
var peg$c29 = "//";
|
||||
var peg$c30 = "cat";
|
||||
var peg$c31 = "$";
|
||||
var peg$c32 = "setcps";
|
||||
var peg$c33 = "setbpm";
|
||||
var peg$c34 = "hush";
|
||||
|
||||
var peg$r0 = /^[1-9]/;
|
||||
var peg$r1 = /^[eE]/;
|
||||
@ -226,63 +228,66 @@ function peg$parse(input, options) {
|
||||
var peg$e13 = peg$classExpectation([["0", "9"], ["a", "z"], ["A", "Z"], "~"], false, false);
|
||||
var peg$e14 = peg$literalExpectation("#", false);
|
||||
var peg$e15 = peg$literalExpectation("^", false);
|
||||
var peg$e16 = peg$literalExpectation("[", false);
|
||||
var peg$e17 = peg$literalExpectation("]", false);
|
||||
var peg$e18 = peg$literalExpectation("<", false);
|
||||
var peg$e19 = peg$literalExpectation(">", false);
|
||||
var peg$e20 = peg$literalExpectation("@", false);
|
||||
var peg$e21 = peg$literalExpectation("(", false);
|
||||
var peg$e22 = peg$literalExpectation(")", false);
|
||||
var peg$e23 = peg$literalExpectation("/", false);
|
||||
var peg$e24 = peg$literalExpectation("*", false);
|
||||
var peg$e25 = peg$literalExpectation("%", false);
|
||||
var peg$e26 = peg$literalExpectation("struct", false);
|
||||
var peg$e27 = peg$literalExpectation("target", false);
|
||||
var peg$e28 = peg$literalExpectation("euclid", false);
|
||||
var peg$e29 = peg$literalExpectation("slow", false);
|
||||
var peg$e30 = peg$literalExpectation("rotL", false);
|
||||
var peg$e31 = peg$literalExpectation("rotR", false);
|
||||
var peg$e32 = peg$literalExpectation("fast", false);
|
||||
var peg$e33 = peg$literalExpectation("scale", false);
|
||||
var peg$e34 = peg$literalExpectation("//", false);
|
||||
var peg$e35 = peg$classExpectation(["\n"], true, false);
|
||||
var peg$e36 = peg$literalExpectation("cat", false);
|
||||
var peg$e37 = peg$literalExpectation("$", false);
|
||||
var peg$e38 = peg$literalExpectation("setcps", false);
|
||||
var peg$e39 = peg$literalExpectation("setbpm", false);
|
||||
var peg$e40 = peg$literalExpectation("hush", false);
|
||||
var peg$e16 = peg$literalExpectation("_", false);
|
||||
var peg$e17 = peg$literalExpectation("[", false);
|
||||
var peg$e18 = peg$literalExpectation("]", false);
|
||||
var peg$e19 = peg$literalExpectation("<", false);
|
||||
var peg$e20 = peg$literalExpectation(">", false);
|
||||
var peg$e21 = peg$literalExpectation("@", false);
|
||||
var peg$e22 = peg$literalExpectation("!", false);
|
||||
var peg$e23 = peg$literalExpectation("(", false);
|
||||
var peg$e24 = peg$literalExpectation(")", false);
|
||||
var peg$e25 = peg$literalExpectation("/", false);
|
||||
var peg$e26 = peg$literalExpectation("*", false);
|
||||
var peg$e27 = peg$literalExpectation("%", false);
|
||||
var peg$e28 = peg$literalExpectation("struct", false);
|
||||
var peg$e29 = peg$literalExpectation("target", false);
|
||||
var peg$e30 = peg$literalExpectation("euclid", false);
|
||||
var peg$e31 = peg$literalExpectation("slow", false);
|
||||
var peg$e32 = peg$literalExpectation("rotL", false);
|
||||
var peg$e33 = peg$literalExpectation("rotR", false);
|
||||
var peg$e34 = peg$literalExpectation("fast", false);
|
||||
var peg$e35 = peg$literalExpectation("scale", false);
|
||||
var peg$e36 = peg$literalExpectation("//", false);
|
||||
var peg$e37 = peg$classExpectation(["\n"], true, false);
|
||||
var peg$e38 = peg$literalExpectation("cat", false);
|
||||
var peg$e39 = peg$literalExpectation("$", false);
|
||||
var peg$e40 = peg$literalExpectation("setcps", false);
|
||||
var peg$e41 = peg$literalExpectation("setbpm", false);
|
||||
var peg$e42 = peg$literalExpectation("hush", false);
|
||||
|
||||
var peg$f0 = function() { return parseFloat(text()); };
|
||||
var peg$f1 = function(chars) { return chars.join("") };
|
||||
var peg$f2 = function(s) { return s};
|
||||
var peg$f3 = function(sc) { sc.arguments_.alignment = "t"; return sc;};
|
||||
var peg$f4 = function(a) { return { weight: a} };
|
||||
var peg$f5 = function(p, s) { return { operator : { type_: "bjorklund", arguments_ :{ pulse: p, step:s } } } };
|
||||
var peg$f6 = function(a) { return { operator : { type_: "stretch", arguments_ :{ amount:a } } } };
|
||||
var peg$f7 = function(a) { return { operator : { type_: "stretch", arguments_ :{ amount:"1/"+a } } } };
|
||||
var peg$f8 = function(a) { return { operator : { type_: "fixed-step", arguments_ :{ amount:a } } } };
|
||||
var peg$f9 = function(s, o) { return new ElementStub(s, o);};
|
||||
var peg$f10 = function(s) { return new PatternStub(s,"h"); };
|
||||
var peg$f11 = function(c, v) { return v};
|
||||
var peg$f12 = function(c, cs) { if (cs.length == 0 && c instanceof Object) { return c;} else { cs.unshift(c); return new PatternStub(cs,"v");} };
|
||||
var peg$f13 = function(s) { return s; };
|
||||
var peg$f14 = function(s) { return { name: "struct", args: { sequence:s }}};
|
||||
var peg$f15 = function(s) { return { name: "target", args : { name:s}}};
|
||||
var peg$f16 = function(p, s) { return { name: "bjorklund", args :{ pulse: parseInt(p), step:parseInt(s) }}};
|
||||
var peg$f17 = function(a) { return { name: "stretch", args :{ amount: a}}};
|
||||
var peg$f18 = function(a) { return { name: "shift", args :{ amount: "-"+a}}};
|
||||
var peg$f19 = function(a) { return { name: "shift", args :{ amount: a}}};
|
||||
var peg$f20 = function(a) { return { name: "stretch", args :{ amount: "1/"+a}}};
|
||||
var peg$f21 = function(s) { return { name: "scale", args :{ scale: s.join("")}}};
|
||||
var peg$f22 = function(s, v) { return v};
|
||||
var peg$f23 = function(s, ss) { ss.unshift(s); return new PatternStub(ss,"t"); };
|
||||
var peg$f24 = function(sg) {return sg};
|
||||
var peg$f25 = function(o, soc) { return new OperatorStub(o.name,o.args,soc)};
|
||||
var peg$f26 = function(sc) { return sc };
|
||||
var peg$f27 = function(c) { return c };
|
||||
var peg$f28 = function(v) { return new CommandStub("setcps", { value: v})};
|
||||
var peg$f29 = function(v) { return new CommandStub("setcps", { value: (v/120/2)})};
|
||||
var peg$f30 = function() { return new CommandStub("hush")};
|
||||
var peg$f5 = function(a) { return { replicate: a } };
|
||||
var peg$f6 = function(p, s) { return { operator : { type_: "bjorklund", arguments_ :{ pulse: p, step:s } } } };
|
||||
var peg$f7 = function(a) { return { operator : { type_: "stretch", arguments_ :{ amount:a } } } };
|
||||
var peg$f8 = function(a) { return { operator : { type_: "stretch", arguments_ :{ amount:"1/"+a } } } };
|
||||
var peg$f9 = function(a) { return { operator : { type_: "fixed-step", arguments_ :{ amount:a } } } };
|
||||
var peg$f10 = function(s, o) { return new ElementStub(s, o);};
|
||||
var peg$f11 = function(s) { return new PatternStub(s,"h"); };
|
||||
var peg$f12 = function(c, v) { return v};
|
||||
var peg$f13 = function(c, cs) { if (cs.length == 0 && c instanceof Object) { return c;} else { cs.unshift(c); return new PatternStub(cs,"v");} };
|
||||
var peg$f14 = function(s) { return s; };
|
||||
var peg$f15 = function(s) { return { name: "struct", args: { sequence:s }}};
|
||||
var peg$f16 = function(s) { return { name: "target", args : { name:s}}};
|
||||
var peg$f17 = function(p, s) { return { name: "bjorklund", args :{ pulse: parseInt(p), step:parseInt(s) }}};
|
||||
var peg$f18 = function(a) { return { name: "stretch", args :{ amount: a}}};
|
||||
var peg$f19 = function(a) { return { name: "shift", args :{ amount: "-"+a}}};
|
||||
var peg$f20 = function(a) { return { name: "shift", args :{ amount: a}}};
|
||||
var peg$f21 = function(a) { return { name: "stretch", args :{ amount: "1/"+a}}};
|
||||
var peg$f22 = function(s) { return { name: "scale", args :{ scale: s.join("")}}};
|
||||
var peg$f23 = function(s, v) { return v};
|
||||
var peg$f24 = function(s, ss) { ss.unshift(s); return new PatternStub(ss,"t"); };
|
||||
var peg$f25 = function(sg) {return sg};
|
||||
var peg$f26 = function(o, soc) { return new OperatorStub(o.name,o.args,soc)};
|
||||
var peg$f27 = function(sc) { return sc };
|
||||
var peg$f28 = function(c) { return c };
|
||||
var peg$f29 = function(v) { return new CommandStub("setcps", { value: v})};
|
||||
var peg$f30 = function(v) { return new CommandStub("setcps", { value: (v/120/2)})};
|
||||
var peg$f31 = function() { return new CommandStub("hush")};
|
||||
|
||||
var peg$currPos = 0;
|
||||
var peg$savedPos = 0;
|
||||
@ -791,6 +796,15 @@ function peg$parse(input, options) {
|
||||
s0 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e15); }
|
||||
}
|
||||
if (s0 === peg$FAILED) {
|
||||
if (input.charCodeAt(peg$currPos) === 95) {
|
||||
s0 = peg$c9;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s0 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e16); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -832,11 +846,11 @@ function peg$parse(input, options) {
|
||||
s0 = peg$currPos;
|
||||
s1 = peg$parsews();
|
||||
if (input.charCodeAt(peg$currPos) === 91) {
|
||||
s2 = peg$c9;
|
||||
s2 = peg$c10;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s2 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e16); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e17); }
|
||||
}
|
||||
if (s2 !== peg$FAILED) {
|
||||
s3 = peg$parsews();
|
||||
@ -844,11 +858,11 @@ function peg$parse(input, options) {
|
||||
if (s4 !== peg$FAILED) {
|
||||
s5 = peg$parsews();
|
||||
if (input.charCodeAt(peg$currPos) === 93) {
|
||||
s6 = peg$c10;
|
||||
s6 = peg$c11;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s6 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e17); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e18); }
|
||||
}
|
||||
if (s6 !== peg$FAILED) {
|
||||
s7 = peg$parsews();
|
||||
@ -876,11 +890,11 @@ function peg$parse(input, options) {
|
||||
s0 = peg$currPos;
|
||||
s1 = peg$parsews();
|
||||
if (input.charCodeAt(peg$currPos) === 60) {
|
||||
s2 = peg$c11;
|
||||
s2 = peg$c12;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s2 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e18); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e19); }
|
||||
}
|
||||
if (s2 !== peg$FAILED) {
|
||||
s3 = peg$parsews();
|
||||
@ -888,11 +902,11 @@ function peg$parse(input, options) {
|
||||
if (s4 !== peg$FAILED) {
|
||||
s5 = peg$parsews();
|
||||
if (input.charCodeAt(peg$currPos) === 62) {
|
||||
s6 = peg$c12;
|
||||
s6 = peg$c13;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s6 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e19); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e20); }
|
||||
}
|
||||
if (s6 !== peg$FAILED) {
|
||||
s7 = peg$parsews();
|
||||
@ -940,6 +954,9 @@ function peg$parse(input, options) {
|
||||
s0 = peg$parseslice_fast();
|
||||
if (s0 === peg$FAILED) {
|
||||
s0 = peg$parseslice_fixed_step();
|
||||
if (s0 === peg$FAILED) {
|
||||
s0 = peg$parseslice_replicate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -953,11 +970,11 @@ function peg$parse(input, options) {
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.charCodeAt(peg$currPos) === 64) {
|
||||
s1 = peg$c13;
|
||||
s1 = peg$c14;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e20); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e21); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsenumber();
|
||||
@ -976,16 +993,44 @@ function peg$parse(input, options) {
|
||||
return s0;
|
||||
}
|
||||
|
||||
function peg$parseslice_replicate() {
|
||||
var s0, s1, s2;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.charCodeAt(peg$currPos) === 33) {
|
||||
s1 = peg$c15;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e22); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsenumber();
|
||||
if (s2 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f5(s2);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
|
||||
return s0;
|
||||
}
|
||||
|
||||
function peg$parseslice_bjorklund() {
|
||||
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.charCodeAt(peg$currPos) === 40) {
|
||||
s1 = peg$c14;
|
||||
s1 = peg$c16;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e21); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e23); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsews();
|
||||
@ -999,15 +1044,15 @@ function peg$parse(input, options) {
|
||||
if (s7 !== peg$FAILED) {
|
||||
s8 = peg$parsews();
|
||||
if (input.charCodeAt(peg$currPos) === 41) {
|
||||
s9 = peg$c15;
|
||||
s9 = peg$c17;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s9 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e22); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e24); }
|
||||
}
|
||||
if (s9 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f5(s3, s7);
|
||||
s0 = peg$f6(s3, s7);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
@ -1037,39 +1082,11 @@ function peg$parse(input, options) {
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.charCodeAt(peg$currPos) === 47) {
|
||||
s1 = peg$c16;
|
||||
s1 = peg$c18;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e23); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsenumber();
|
||||
if (s2 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f6(s2);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
|
||||
return s0;
|
||||
}
|
||||
|
||||
function peg$parseslice_fast() {
|
||||
var s0, s1, s2;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.charCodeAt(peg$currPos) === 42) {
|
||||
s1 = peg$c17;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e24); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e25); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsenumber();
|
||||
@ -1088,16 +1105,16 @@ function peg$parse(input, options) {
|
||||
return s0;
|
||||
}
|
||||
|
||||
function peg$parseslice_fixed_step() {
|
||||
function peg$parseslice_fast() {
|
||||
var s0, s1, s2;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.charCodeAt(peg$currPos) === 37) {
|
||||
s1 = peg$c18;
|
||||
if (input.charCodeAt(peg$currPos) === 42) {
|
||||
s1 = peg$c19;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e25); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e26); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsenumber();
|
||||
@ -1116,6 +1133,34 @@ function peg$parse(input, options) {
|
||||
return s0;
|
||||
}
|
||||
|
||||
function peg$parseslice_fixed_step() {
|
||||
var s0, s1, s2;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.charCodeAt(peg$currPos) === 37) {
|
||||
s1 = peg$c20;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e27); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsenumber();
|
||||
if (s2 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f9(s2);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
|
||||
return s0;
|
||||
}
|
||||
|
||||
function peg$parseslice_with_modifier() {
|
||||
var s0, s1, s2;
|
||||
|
||||
@ -1127,7 +1172,7 @@ function peg$parse(input, options) {
|
||||
s2 = null;
|
||||
}
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f9(s1, s2);
|
||||
s0 = peg$f10(s1, s2);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
@ -1152,7 +1197,7 @@ function peg$parse(input, options) {
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s1 = peg$f10(s1);
|
||||
s1 = peg$f11(s1);
|
||||
}
|
||||
s0 = s1;
|
||||
|
||||
@ -1172,7 +1217,7 @@ function peg$parse(input, options) {
|
||||
s5 = peg$parsesingle_cycle();
|
||||
if (s5 !== peg$FAILED) {
|
||||
peg$savedPos = s3;
|
||||
s3 = peg$f11(s1, s5);
|
||||
s3 = peg$f12(s1, s5);
|
||||
} else {
|
||||
peg$currPos = s3;
|
||||
s3 = peg$FAILED;
|
||||
@ -1189,7 +1234,7 @@ function peg$parse(input, options) {
|
||||
s5 = peg$parsesingle_cycle();
|
||||
if (s5 !== peg$FAILED) {
|
||||
peg$savedPos = s3;
|
||||
s3 = peg$f11(s1, s5);
|
||||
s3 = peg$f12(s1, s5);
|
||||
} else {
|
||||
peg$currPos = s3;
|
||||
s3 = peg$FAILED;
|
||||
@ -1200,7 +1245,7 @@ function peg$parse(input, options) {
|
||||
}
|
||||
}
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f12(s1, s2);
|
||||
s0 = peg$f13(s1, s2);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
@ -1221,7 +1266,7 @@ function peg$parse(input, options) {
|
||||
s4 = peg$parsequote();
|
||||
if (s4 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f13(s3);
|
||||
s0 = peg$f14(s3);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
@ -1271,19 +1316,19 @@ function peg$parse(input, options) {
|
||||
var s0, s1, s2, s3;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.substr(peg$currPos, 6) === peg$c19) {
|
||||
s1 = peg$c19;
|
||||
if (input.substr(peg$currPos, 6) === peg$c21) {
|
||||
s1 = peg$c21;
|
||||
peg$currPos += 6;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e26); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e28); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsews();
|
||||
s3 = peg$parsesequence_or_operator();
|
||||
if (s3 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f14(s3);
|
||||
s0 = peg$f15(s3);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
@ -1300,12 +1345,12 @@ function peg$parse(input, options) {
|
||||
var s0, s1, s2, s3, s4, s5;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.substr(peg$currPos, 6) === peg$c20) {
|
||||
s1 = peg$c20;
|
||||
if (input.substr(peg$currPos, 6) === peg$c22) {
|
||||
s1 = peg$c22;
|
||||
peg$currPos += 6;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e27); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e29); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsews();
|
||||
@ -1316,7 +1361,7 @@ function peg$parse(input, options) {
|
||||
s5 = peg$parsequote();
|
||||
if (s5 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f15(s4);
|
||||
s0 = peg$f16(s4);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
@ -1341,12 +1386,12 @@ function peg$parse(input, options) {
|
||||
var s0, s1, s2, s3, s4, s5;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.substr(peg$currPos, 6) === peg$c21) {
|
||||
s1 = peg$c21;
|
||||
if (input.substr(peg$currPos, 6) === peg$c23) {
|
||||
s1 = peg$c23;
|
||||
peg$currPos += 6;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e28); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e30); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsews();
|
||||
@ -1356,7 +1401,7 @@ function peg$parse(input, options) {
|
||||
s5 = peg$parseint();
|
||||
if (s5 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f16(s3, s5);
|
||||
s0 = peg$f17(s3, s5);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
@ -1377,41 +1422,12 @@ function peg$parse(input, options) {
|
||||
var s0, s1, s2, s3;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.substr(peg$currPos, 4) === peg$c22) {
|
||||
s1 = peg$c22;
|
||||
if (input.substr(peg$currPos, 4) === peg$c24) {
|
||||
s1 = peg$c24;
|
||||
peg$currPos += 4;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e29); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsews();
|
||||
s3 = peg$parsenumber();
|
||||
if (s3 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f17(s3);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
|
||||
return s0;
|
||||
}
|
||||
|
||||
function peg$parserotL() {
|
||||
var s0, s1, s2, s3;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.substr(peg$currPos, 4) === peg$c23) {
|
||||
s1 = peg$c23;
|
||||
peg$currPos += 4;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e30); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e31); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsews();
|
||||
@ -1431,16 +1447,16 @@ function peg$parse(input, options) {
|
||||
return s0;
|
||||
}
|
||||
|
||||
function peg$parserotR() {
|
||||
function peg$parserotL() {
|
||||
var s0, s1, s2, s3;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.substr(peg$currPos, 4) === peg$c24) {
|
||||
s1 = peg$c24;
|
||||
if (input.substr(peg$currPos, 4) === peg$c25) {
|
||||
s1 = peg$c25;
|
||||
peg$currPos += 4;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e31); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e32); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsews();
|
||||
@ -1460,16 +1476,16 @@ function peg$parse(input, options) {
|
||||
return s0;
|
||||
}
|
||||
|
||||
function peg$parsefast() {
|
||||
function peg$parserotR() {
|
||||
var s0, s1, s2, s3;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.substr(peg$currPos, 4) === peg$c25) {
|
||||
s1 = peg$c25;
|
||||
if (input.substr(peg$currPos, 4) === peg$c26) {
|
||||
s1 = peg$c26;
|
||||
peg$currPos += 4;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e32); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e33); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsews();
|
||||
@ -1489,16 +1505,45 @@ function peg$parse(input, options) {
|
||||
return s0;
|
||||
}
|
||||
|
||||
function peg$parsefast() {
|
||||
var s0, s1, s2, s3;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.substr(peg$currPos, 4) === peg$c27) {
|
||||
s1 = peg$c27;
|
||||
peg$currPos += 4;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e34); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsews();
|
||||
s3 = peg$parsenumber();
|
||||
if (s3 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f21(s3);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
|
||||
return s0;
|
||||
}
|
||||
|
||||
function peg$parsescale() {
|
||||
var s0, s1, s2, s3, s4, s5;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.substr(peg$currPos, 5) === peg$c26) {
|
||||
s1 = peg$c26;
|
||||
if (input.substr(peg$currPos, 5) === peg$c28) {
|
||||
s1 = peg$c28;
|
||||
peg$currPos += 5;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e33); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e35); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsews();
|
||||
@ -1518,7 +1563,7 @@ function peg$parse(input, options) {
|
||||
s5 = peg$parsequote();
|
||||
if (s5 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f21(s4);
|
||||
s0 = peg$f22(s4);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
@ -1543,12 +1588,12 @@ function peg$parse(input, options) {
|
||||
var s0, s1, s2, s3;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.substr(peg$currPos, 2) === peg$c27) {
|
||||
s1 = peg$c27;
|
||||
if (input.substr(peg$currPos, 2) === peg$c29) {
|
||||
s1 = peg$c29;
|
||||
peg$currPos += 2;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e34); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e36); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = [];
|
||||
@ -1557,7 +1602,7 @@ function peg$parse(input, options) {
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s3 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e35); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e37); }
|
||||
}
|
||||
while (s3 !== peg$FAILED) {
|
||||
s2.push(s3);
|
||||
@ -1566,7 +1611,7 @@ function peg$parse(input, options) {
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s3 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e35); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e37); }
|
||||
}
|
||||
}
|
||||
s1 = [s1, s2];
|
||||
@ -1583,21 +1628,21 @@ function peg$parse(input, options) {
|
||||
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.substr(peg$currPos, 3) === peg$c28) {
|
||||
s1 = peg$c28;
|
||||
if (input.substr(peg$currPos, 3) === peg$c30) {
|
||||
s1 = peg$c30;
|
||||
peg$currPos += 3;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e36); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e38); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsews();
|
||||
if (input.charCodeAt(peg$currPos) === 91) {
|
||||
s3 = peg$c9;
|
||||
s3 = peg$c10;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s3 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e16); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e17); }
|
||||
}
|
||||
if (s3 !== peg$FAILED) {
|
||||
s4 = peg$parsews();
|
||||
@ -1610,7 +1655,7 @@ function peg$parse(input, options) {
|
||||
s9 = peg$parsesequence_or_operator();
|
||||
if (s9 !== peg$FAILED) {
|
||||
peg$savedPos = s7;
|
||||
s7 = peg$f22(s5, s9);
|
||||
s7 = peg$f23(s5, s9);
|
||||
} else {
|
||||
peg$currPos = s7;
|
||||
s7 = peg$FAILED;
|
||||
@ -1627,7 +1672,7 @@ function peg$parse(input, options) {
|
||||
s9 = peg$parsesequence_or_operator();
|
||||
if (s9 !== peg$FAILED) {
|
||||
peg$savedPos = s7;
|
||||
s7 = peg$f22(s5, s9);
|
||||
s7 = peg$f23(s5, s9);
|
||||
} else {
|
||||
peg$currPos = s7;
|
||||
s7 = peg$FAILED;
|
||||
@ -1639,15 +1684,15 @@ function peg$parse(input, options) {
|
||||
}
|
||||
s7 = peg$parsews();
|
||||
if (input.charCodeAt(peg$currPos) === 93) {
|
||||
s8 = peg$c10;
|
||||
s8 = peg$c11;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s8 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e17); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e18); }
|
||||
}
|
||||
if (s8 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f23(s5, s6);
|
||||
s0 = peg$f24(s5, s6);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
@ -1693,7 +1738,7 @@ function peg$parse(input, options) {
|
||||
s4 = peg$parsecomment();
|
||||
}
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f24(s1);
|
||||
s0 = peg$f25(s1);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
@ -1704,18 +1749,18 @@ function peg$parse(input, options) {
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsews();
|
||||
if (input.charCodeAt(peg$currPos) === 36) {
|
||||
s3 = peg$c29;
|
||||
s3 = peg$c31;
|
||||
peg$currPos++;
|
||||
} else {
|
||||
s3 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e37); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e39); }
|
||||
}
|
||||
if (s3 !== peg$FAILED) {
|
||||
s4 = peg$parsews();
|
||||
s5 = peg$parsesequence_or_operator();
|
||||
if (s5 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f25(s1, s5);
|
||||
s0 = peg$f26(s1, s5);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
@ -1740,7 +1785,7 @@ function peg$parse(input, options) {
|
||||
s1 = peg$parsesequence_or_operator();
|
||||
if (s1 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s1 = peg$f26(s1);
|
||||
s1 = peg$f27(s1);
|
||||
}
|
||||
s0 = s1;
|
||||
if (s0 === peg$FAILED) {
|
||||
@ -1773,7 +1818,7 @@ function peg$parse(input, options) {
|
||||
if (s2 !== peg$FAILED) {
|
||||
s3 = peg$parsews();
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f27(s2);
|
||||
s0 = peg$f28(s2);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
@ -1786,41 +1831,12 @@ function peg$parse(input, options) {
|
||||
var s0, s1, s2, s3;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.substr(peg$currPos, 6) === peg$c30) {
|
||||
s1 = peg$c30;
|
||||
if (input.substr(peg$currPos, 6) === peg$c32) {
|
||||
s1 = peg$c32;
|
||||
peg$currPos += 6;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e38); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsews();
|
||||
s3 = peg$parsenumber();
|
||||
if (s3 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f28(s3);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
|
||||
return s0;
|
||||
}
|
||||
|
||||
function peg$parsesetbpm() {
|
||||
var s0, s1, s2, s3;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.substr(peg$currPos, 6) === peg$c31) {
|
||||
s1 = peg$c31;
|
||||
peg$currPos += 6;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e39); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e40); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsews();
|
||||
@ -1840,20 +1856,49 @@ function peg$parse(input, options) {
|
||||
return s0;
|
||||
}
|
||||
|
||||
function peg$parsesetbpm() {
|
||||
var s0, s1, s2, s3;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.substr(peg$currPos, 6) === peg$c33) {
|
||||
s1 = peg$c33;
|
||||
peg$currPos += 6;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e41); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
s2 = peg$parsews();
|
||||
s3 = peg$parsenumber();
|
||||
if (s3 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s0 = peg$f30(s3);
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
} else {
|
||||
peg$currPos = s0;
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
|
||||
return s0;
|
||||
}
|
||||
|
||||
function peg$parsehush() {
|
||||
var s0, s1;
|
||||
|
||||
s0 = peg$currPos;
|
||||
if (input.substr(peg$currPos, 4) === peg$c32) {
|
||||
s1 = peg$c32;
|
||||
if (input.substr(peg$currPos, 4) === peg$c34) {
|
||||
s1 = peg$c34;
|
||||
peg$currPos += 4;
|
||||
} else {
|
||||
s1 = peg$FAILED;
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e40); }
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e42); }
|
||||
}
|
||||
if (s1 !== peg$FAILED) {
|
||||
peg$savedPos = s0;
|
||||
s1 = peg$f30();
|
||||
s1 = peg$f31();
|
||||
}
|
||||
s0 = s1;
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ quote = '"' / "'"
|
||||
// ------------------ steps and cycles ---------------------------
|
||||
|
||||
// single step definition (e.g bd)
|
||||
step_char = [0-9a-zA-Z~] / "-" / "#" / "." / "^"
|
||||
step_char = [0-9a-zA-Z~] / "-" / "#" / "." / "^" / "_"
|
||||
step = ws chars:step_char+ ws { return chars.join("") }
|
||||
|
||||
// define a sub cycle e.g. [1 2, 3 [4]]
|
||||
@ -95,10 +95,13 @@ slice = step / sub_cycle / timeline
|
||||
|
||||
// slice modifier affects the timing/size of a slice (e.g. [a b c]@3)
|
||||
// at this point, we assume we can represent them as regular sequence operators
|
||||
slice_modifier = slice_weight / slice_bjorklund / slice_slow / slice_fast / slice_fixed_step
|
||||
slice_modifier = slice_weight / slice_bjorklund / slice_slow / slice_fast / slice_fixed_step / slice_replicate
|
||||
|
||||
slice_weight = "@" a:number
|
||||
{ return { weight: a} }
|
||||
|
||||
slice_replicate = "!"a:number
|
||||
{ return { replicate: a } }
|
||||
|
||||
slice_bjorklund = "(" ws p:number ws comma ws s:number ws")"
|
||||
{ return { operator : { type_: "bjorklund", arguments_ :{ pulse: p, step:s } } } }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user