Spaces:
Running
Running
k-l-lambda
commited on
Commit
·
8f6ab9b
1
Parent(s):
f65fe85
updated asset files.
Browse files- Dockerfile +0 -3
- jison/lilypond.jison +2884 -0
- jison/measureLayout.jison +253 -0
- ly/articulate-lotus.ly +1060 -0
- ly/lotus.ly +11 -0
- ly/rhythmSymbols.ly +8 -0
Dockerfile
CHANGED
@@ -24,9 +24,6 @@ WORKDIR /app
|
|
24 |
# Copy the entire project including node_modules
|
25 |
COPY . .
|
26 |
|
27 |
-
# Remove .env.local if exists
|
28 |
-
RUN rm -f .env.local
|
29 |
-
|
30 |
# Set all environment variables
|
31 |
ENV PORT=7860
|
32 |
ENV HOST=0.0.0.0
|
|
|
24 |
# Copy the entire project including node_modules
|
25 |
COPY . .
|
26 |
|
|
|
|
|
|
|
27 |
# Set all environment variables
|
28 |
ENV PORT=7860
|
29 |
ENV HOST=0.0.0.0
|
jison/lilypond.jison
ADDED
@@ -0,0 +1,2884 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
%{
|
3 |
+
const preferNumber = x => Number.isFinite(Number(x)) ? Number(x) : x;
|
4 |
+
|
5 |
+
const location = (begin, end) => ({proto: "_PLAIN", lines: [begin.first_line, end.last_line], columns: [begin.first_column, end.last_column]});
|
6 |
+
|
7 |
+
const commandSubProtos = {
|
8 |
+
markup: "MarkupCommand",
|
9 |
+
repeat: "Repeat",
|
10 |
+
relative: "Relative",
|
11 |
+
parallelMusic: "ParallelMusic",
|
12 |
+
time: "TimeSignature",
|
13 |
+
partial: "Partial",
|
14 |
+
times: "Times",
|
15 |
+
tuplet: "Tuplet",
|
16 |
+
clef: "Clef",
|
17 |
+
key: "KeySignature",
|
18 |
+
ottava: "OctaveShift",
|
19 |
+
include: "Include",
|
20 |
+
version: "Version",
|
21 |
+
lyricmode: "LyricMode",
|
22 |
+
chordmode: "ChordMode",
|
23 |
+
grace: "Grace",
|
24 |
+
acciaccatura: "Grace",
|
25 |
+
appoggiatura: "Grace",
|
26 |
+
slashedGrace: "Grace",
|
27 |
+
afterGrace: "AfterGrace",
|
28 |
+
language: "Language",
|
29 |
+
transposition: "Transposition",
|
30 |
+
stemUp: "StemDirection",
|
31 |
+
stemDown: "StemDirection",
|
32 |
+
stemNeutral: "StemDirection",
|
33 |
+
change: "Change",
|
34 |
+
};
|
35 |
+
|
36 |
+
|
37 |
+
const root = (sections = []) => ({proto: "Root", sections});
|
38 |
+
|
39 |
+
const appendSection = (list, item) => {
|
40 |
+
list.sections.push(item);
|
41 |
+
|
42 |
+
return list;
|
43 |
+
};
|
44 |
+
|
45 |
+
const string = exp => ({proto: "LiteralString", exp});
|
46 |
+
|
47 |
+
const command = (cmd, ...args) => ({proto: commandSubProtos[cmd.substr(1)] || "Command", cmd: cmd.substr(1), args});
|
48 |
+
|
49 |
+
const variable = name => ({proto: "Variable", name: name.substr(1)});
|
50 |
+
|
51 |
+
const chord = (pitches, duration, {locations, post_events, ...options} = {}) => ({proto: "Chord", pitches, duration, post_events, _location: location(...locations), options: {...options, proto: "_PLAIN"}});
|
52 |
+
|
53 |
+
const rest = ({name, duration, post_events = null, locations}) => ({proto: "Rest", name, duration, post_events, _location: location(...locations)});
|
54 |
+
|
55 |
+
const chordElem = (pitch, {locations, ...options}) => ({proto: "ChordElement", pitch, _location: location(...locations), options: {...options, proto: "_PLAIN"}});
|
56 |
+
|
57 |
+
const briefChord = (body, {locations, post_events = null} = {}) => ({proto: "BriefChord", body: {...body, proto: "_PLAIN"}, post_events, _location: location(...locations)});
|
58 |
+
|
59 |
+
const block = (block, head, body = []) => ({proto: "Block", block, head, body});
|
60 |
+
|
61 |
+
const inlineBlock = body => ({proto: "InlineBlock", body});
|
62 |
+
|
63 |
+
const scheme = exp => ({proto: "Scheme", exp});
|
64 |
+
|
65 |
+
const schemeFunction = (func, args) => ({proto: "SchemeFunction", func, args});
|
66 |
+
|
67 |
+
const schemePair = (left, right) => ({proto: "SchemePair", left, right});
|
68 |
+
|
69 |
+
const schemePointer = value => ({proto: "SchemePointer", value});
|
70 |
+
|
71 |
+
const schemeEmbed = value => ({proto: "SchemeEmbed", value});
|
72 |
+
|
73 |
+
const assignment = (key, value) => ({proto: "Assignment", key, value});
|
74 |
+
|
75 |
+
const numberUnit = (number, unit) => ({proto: "NumberUnit", number: preferNumber(number), unit});
|
76 |
+
|
77 |
+
const musicBlock = body => ({proto: "MusicBlock", body});
|
78 |
+
|
79 |
+
const simultaneousList = list => ({proto: "SimultaneousList", list});
|
80 |
+
|
81 |
+
const contextedMusic = (head, body, lyrics) => ({proto: "ContextedMusic", head, body, lyrics});
|
82 |
+
|
83 |
+
const tempo = (beatsPerMinute, unit, text) => ({proto: "Tempo", beatsPerMinute: preferNumber(beatsPerMinute), unit: preferNumber(unit), text});
|
84 |
+
|
85 |
+
const postEvent = (direction, arg) => ({proto: "PostEvent", direction, arg});
|
86 |
+
|
87 |
+
const fingering = value => ({proto: "Fingering", value: preferNumber(value)});
|
88 |
+
|
89 |
+
const markup = (head, body) => ({proto: "Markup", head, body});
|
90 |
+
|
91 |
+
const lyric = (content, {locations, ...options}) => ({proto: "Lyric", content, _location: location(...locations), ...options});
|
92 |
+
|
93 |
+
const duration = ({number, dots, multipliers}) => ({proto: "Duration", number, dots, multipliers});
|
94 |
+
|
95 |
+
const comment = ({loc, ...data}) => ({proto: "Comment", _location: location(loc, loc), ...data});
|
96 |
+
|
97 |
+
|
98 |
+
let lineHeadTable = {};
|
99 |
+
let lineTailTable = {};
|
100 |
+
|
101 |
+
const lineHead = (loc, term) => {
|
102 |
+
if (!term || typeof term !== "object")
|
103 |
+
return;
|
104 |
+
|
105 |
+
if (!lineHeadTable[loc.first_line] || lineHeadTable[loc.first_line].column > loc.first_column)
|
106 |
+
lineHeadTable[loc.first_line] = {column: loc.first_column, term};
|
107 |
+
};
|
108 |
+
|
109 |
+
const lineTail = (loc, term) => {
|
110 |
+
if (!term || typeof term !== "object")
|
111 |
+
return;
|
112 |
+
|
113 |
+
if (!lineTailTable[loc.last_line] || lineTailTable[loc.last_line].column < loc.last_column)
|
114 |
+
lineTailTable[loc.last_line] = {column: loc.last_column, term};
|
115 |
+
};
|
116 |
+
|
117 |
+
const lineRegister = (loc, term) => {
|
118 |
+
lineHead(loc, term);
|
119 |
+
lineTail(loc, term);
|
120 |
+
};
|
121 |
+
|
122 |
+
|
123 |
+
const attachComments = yy => {
|
124 |
+
if (yy.$lotusComments && yy.$lotusComments.length > 0) {
|
125 |
+
//console.log("attachComments:", yy.$lotusComments, lineTable);
|
126 |
+
const headLineNumbers = Object.keys(lineHeadTable).map(Number);
|
127 |
+
|
128 |
+
yy.$lotusComments.forEach(data => {
|
129 |
+
const comm = comment(data);
|
130 |
+
|
131 |
+
const tailLine = lineTailTable[data.loc.first_line];
|
132 |
+
if (tailLine) {
|
133 |
+
tailLine.term._tailComment = comm;
|
134 |
+
return;
|
135 |
+
}
|
136 |
+
|
137 |
+
const line = headLineNumbers.find(line => line >= data.loc.last_line);
|
138 |
+
if (Number.isFinite(line) && lineHeadTable[line]) {
|
139 |
+
lineHeadTable[line].term._headComment = comm;
|
140 |
+
return;
|
141 |
+
}
|
142 |
+
|
143 |
+
// TODO: attach on root's tail
|
144 |
+
});
|
145 |
+
}
|
146 |
+
|
147 |
+
// reset parser states
|
148 |
+
lineHeadTable = {};
|
149 |
+
lineTailTable = {};
|
150 |
+
};
|
151 |
+
%}
|
152 |
+
|
153 |
+
|
154 |
+
%lex
|
155 |
+
|
156 |
+
%option flex unicode
|
157 |
+
|
158 |
+
A [a-zA-Z\200-\377]
|
159 |
+
AA {A}|_
|
160 |
+
N [0-9]
|
161 |
+
ANY_CHAR (.|\n)
|
162 |
+
SYMBOL {A}([-_]{A}|{A})*
|
163 |
+
COMMAND \\{SYMBOL}
|
164 |
+
/* SPECIAL category is for every letter that needs to get passed to
|
165 |
+
* the parser rather than being redefinable by the user */
|
166 |
+
SPECIAL [-+*/=<>{}!?_^'',.:]
|
167 |
+
SHORTHAND (.|\\.)
|
168 |
+
UNSIGNED {N}+
|
169 |
+
E_UNSIGNED \\{N}+
|
170 |
+
FRACTION {N}+\/{N}+
|
171 |
+
//INT [-]?{UNSIGNED}
|
172 |
+
//REAL ({INT}\.{N}*)|([-]?\.{N}+)
|
173 |
+
STRICTREAL {UNSIGNED}\.{UNSIGNED}
|
174 |
+
WHITE [ \n\t\f\r]
|
175 |
+
HORIZONTALWHITE [ \t]
|
176 |
+
BLACK [^ \n\t\f\r]
|
177 |
+
RESTNAME [rRs](?=[\W\d_])
|
178 |
+
ESCAPED [nt\\''""]
|
179 |
+
//EXTENDER \_\_
|
180 |
+
//HYPHEN \-\-
|
181 |
+
PRE_EXTENDER \_(?=\_)
|
182 |
+
PRE_HYPHEN \-(?=\-)
|
183 |
+
BOM_UTF8 \357\273\277
|
184 |
+
|
185 |
+
PHONET [abcdefgqh]
|
186 |
+
PITCH {PHONET}(([i][s])*|([e][s])*|[s][e][s]|[s]*|[f]*)(?=[\W\d_])
|
187 |
+
//PLACEHOLDER_PITCH [s](?=[\W\d_^-])
|
188 |
+
//DURATION "1"|"2"|"4"|"8"|"16"|"32"|"64"|"128"|"256"
|
189 |
+
|
190 |
+
//UNICODE_HAN [\p{Script=Han}]
|
191 |
+
|
192 |
+
%%
|
193 |
+
|
194 |
+
// extra lex
|
195 |
+
// TODO: parse the dollar expression details
|
196 |
+
[$][(][^()]*[)] return 'DOLLAR_SCHEME_EXPRESSION'
|
197 |
+
|
198 |
+
\s+ {} // spaces
|
199 |
+
\%\{(.|\n)*?\%\} yy.$lotusComments = yy.$lotusComments || []; yy.$lotusComments.push({text: yytext, loc: yylloc, scoped: true}); // scoped comments
|
200 |
+
\%.* yy.$lotusComments = yy.$lotusComments || []; yy.$lotusComments.push({text: yytext, loc: yylloc}); // scoped comments
|
201 |
+
\"(\\\"|[^"])*\" return 'STRING';
|
202 |
+
|
203 |
+
//{EXTENDER} return 'EXTENDER';
|
204 |
+
//{HYPHEN} return 'HYPHEN';
|
205 |
+
{PRE_EXTENDER} return 'PRE_EXTENDER';
|
206 |
+
{PRE_HYPHEN} return 'PRE_HYPHEN';
|
207 |
+
|
208 |
+
//"/+" return CHORD_BASS;
|
209 |
+
//"^" return CHORD_CARET;
|
210 |
+
//":" return CHORD_COLON;
|
211 |
+
//"-" return CHORD_MINUS;
|
212 |
+
//"/" return CHORD_SLASH;
|
213 |
+
|
214 |
+
//"<" return 'ANGLE_OPEN';
|
215 |
+
//">" return 'ANGLE_CLOSE';
|
216 |
+
"<<" return 'DOUBLE_ANGLE_OPEN';
|
217 |
+
">>" return 'DOUBLE_ANGLE_CLOSE';
|
218 |
+
|
219 |
+
"\\\\" return 'E_BACKSLASH';
|
220 |
+
|
221 |
+
{E_UNSIGNED} return 'E_UNSIGNED';
|
222 |
+
|
223 |
+
"\\new" return 'NEWCONTEXT';
|
224 |
+
|
225 |
+
"\\cm" return 'CENTIMETER';
|
226 |
+
"\\mm" return 'MILLIMETER';
|
227 |
+
|
228 |
+
"\\overrideProperty" return 'OVERRIDEPROPERTY';
|
229 |
+
|
230 |
+
// binary commands
|
231 |
+
"\\relative" return 'CMD_RELATIVE';
|
232 |
+
"\\tweak" return 'CMD_TWEAK';
|
233 |
+
"\\key" return 'CMD_KEY';
|
234 |
+
//"\\times" return 'CMD_TIMES';
|
235 |
+
[\\][t][i][m][e][s] return 'CMD_TIMES';
|
236 |
+
"\\afterGrace" return 'CMD_AFTERGRACE';
|
237 |
+
"\\parallelMusic" return 'CMD_PARALLELMUSIC';
|
238 |
+
"\\shape" return 'CMD_SHAPE';
|
239 |
+
"\\tag" return 'CMD_TAG';
|
240 |
+
"\\scaleDurations" return 'CMD_SCALEDURATIONS';
|
241 |
+
|
242 |
+
// unitary commands
|
243 |
+
"\\clef" return 'CMD_CLEF';
|
244 |
+
"\\time" return 'CMD_TIME';
|
245 |
+
"\\stemUp" return 'CMD_STEMUP';
|
246 |
+
"\\stemDown" return 'CMD_STEMDOWN';
|
247 |
+
"\\stemNeutral" return 'CMD_STEMNEUTRAL';
|
248 |
+
"\\bar" return 'CMD_BAR';
|
249 |
+
"\\omit" return 'CMD_OMIT';
|
250 |
+
"\\ottava" return 'CMD_OTTAVA';
|
251 |
+
"\\barNumberCheck" return 'CMD_BARNUMBERCHECK';
|
252 |
+
"\\partial" return 'CMD_PARTIAL';
|
253 |
+
"\\mark" return 'CMD_MARK';
|
254 |
+
"\\include" return 'CMD_INCLUDE';
|
255 |
+
"\\tupletSpan" return 'CMD_TUPLETSPAN';
|
256 |
+
"\\tuplet" return 'CMD_TUPLET';
|
257 |
+
"\\tupletNeutral" return 'CMD_TUPLETNEUTRAL';
|
258 |
+
"\\skip" return 'CMD_SKIP';
|
259 |
+
"\\skip"(?=\d) return 'CMD_SKIP';
|
260 |
+
"\\parenthesize" return 'CMD_PARENTHESIZE';
|
261 |
+
"\\unfoldRepeats" return 'CMD_UNFOLDREPEATS';
|
262 |
+
"\\grace" return 'CMD_GRACE';
|
263 |
+
"\\acciaccatura" return 'CMD_ACCIACCATURA';
|
264 |
+
"\\appoggiatura" return 'CMD_APPOGGIATURA';
|
265 |
+
"\\slashedGrace" return 'CMD_SLASHEDGRACE';
|
266 |
+
"\\language" return 'CMD_LANGUAGE';
|
267 |
+
"\\once" return 'CMD_ONCE';
|
268 |
+
"\\accidentalStyle" return 'CMD_ACCIDENTALSTYLE';
|
269 |
+
"\\numericTimeSignature" return 'CMD_NUMERICTIMESIGNATURE';
|
270 |
+
"\\defaultTimeSignature" return 'CMD_DEFAULTTIMESIGNATURE';
|
271 |
+
"\\bendAfter" return 'CMD_BENDAFTER';
|
272 |
+
"\\compoundMeter" return 'CMD_COMPOUNDMETER';
|
273 |
+
"\\transposition" return 'CMD_TRANSPOSITION';
|
274 |
+
"\\absolute" return 'CMD_ABSOLUTE';
|
275 |
+
"\\hide" return 'CMD_HIDE';
|
276 |
+
"\\crossStaff" return 'CMD_CROSSSTAFF';
|
277 |
+
"\\keepWithTag" return 'CMD_KEEPWITHTAG';
|
278 |
+
"\\articulate" return 'CMD_ARTICULATE';
|
279 |
+
|
280 |
+
// zero commands
|
281 |
+
"\\tempoLegend" return 'CMD_TEMPOLEGEND';
|
282 |
+
"\\fermata" return 'CMD_FERMATA';
|
283 |
+
"\\mergeDifferentlyDottedOn" return 'CMD_MERGEDIFFERENTLYDOTTEDON';
|
284 |
+
"\\mergeDifferentlyHeadedOn" return 'CMD_MERGEDIFFERENTLYHEADEDON';
|
285 |
+
"\\voiceOne" return 'CMD_VOICE_NUMBER';
|
286 |
+
"\\voiceTwo" return 'CMD_VOICE_NUMBER';
|
287 |
+
"\\voiceThree" return 'CMD_VOICE_NUMBER';
|
288 |
+
"\\voiceFour" return 'CMD_VOICE_NUMBER';
|
289 |
+
//"\\voiceFive" return 'CMD_VOICE_NUMBER';
|
290 |
+
"\\Score" return 'CMD_SCORE';
|
291 |
+
"\\Voice" return 'CMD_VOICE';
|
292 |
+
"\\Staff" return 'CMD_STAFF';
|
293 |
+
"\\PianoStaff" return 'CMD_PIANOSTAFF';
|
294 |
+
"\\arpeggio" return 'CMD_ARPEGGIO';
|
295 |
+
"\\arpeggioArrowDown" return 'CMD_ARPEGGIOARROWDOWN';
|
296 |
+
"\\arpeggioArrowUp" return 'CMD_ARPEGGIOARROWUP';
|
297 |
+
"\\arpeggioNormal" return 'CMD_ARPEGGIONORMAL';
|
298 |
+
"\\arpeggioBracket" return 'CMD_ARPEGGIOBRACKET';
|
299 |
+
"\\arpeggioParenthesis" return 'CMD_ARPEGGIOPARENTHESIS';
|
300 |
+
"\\arpeggioParenthesisDashed" return 'CMD_ARPEGGIOPARENTHESISDASHED';
|
301 |
+
"\\glissando" return 'CMD_GLISSANDO';
|
302 |
+
"\\mordent" return 'CMD_MORDENT';
|
303 |
+
"\\musicglyph" return 'CMD_MUSICGLYPH';
|
304 |
+
"\\powerChords" return 'CMD_POWERCHORDS';
|
305 |
+
"\\prall" return 'CMD_PRALL';
|
306 |
+
"\\sustainOff" return 'CMD_SUSTAINOFF';
|
307 |
+
"\\sustainOn" return 'CMD_SUSTAINON';
|
308 |
+
"\\trill" return 'CMD_TRILL';
|
309 |
+
"\\turn" return 'CMD_TURN';
|
310 |
+
"\\pointAndClickOff" return 'CMD_POINTANDCLICKOFF';
|
311 |
+
"\\upbow" return 'CMD_UPBOW';
|
312 |
+
"\\downbow" return 'CMD_DOWNBOW';
|
313 |
+
"\\breathe" return 'CMD_BREATHE';
|
314 |
+
"\\startTextSpan" return 'CMD_STARTTEXTSPAN';
|
315 |
+
"\\stopTextSpan" return 'CMD_STOPTEXTSPAN';
|
316 |
+
"\\flageolet" return 'CMD_FLAGEOLET';
|
317 |
+
"\\slurDashed" return 'CMD_SLURDASHED';
|
318 |
+
"\\slurSolid" return 'CMD_SLURSOLID';
|
319 |
+
"\\break" return 'CMD_BREAK';
|
320 |
+
"\\pageBreak" return 'CMD_PAGEBREAK';
|
321 |
+
"\\startTrillSpan" return 'CMD_STARTTRILLSPAN';
|
322 |
+
"\\stopTrillSpan" return 'CMD_STOPTRILLSPAN';
|
323 |
+
"\\cadenzaOn" return 'CMD_CADENZAON';
|
324 |
+
"\\cadenzaOff" return 'CMD_CADENZAOFF';
|
325 |
+
"\\cresc" return 'CMD_CRESC';
|
326 |
+
"\\crescTextCresc" return 'CMD_CRESCTEXTCRESC';
|
327 |
+
"\\crescHairpin" return 'CMD_CRESCHAIRPIN';
|
328 |
+
"\\dim"(?=[\W]) return 'CMD_DIM';
|
329 |
+
"\\dimTextDim" return 'CMD_DIMTEXTDIM';
|
330 |
+
"\\dynamicUp" return 'CMD_DYNAMICUP';
|
331 |
+
"\\hideNotes" return 'CMD_HIDENOTES';
|
332 |
+
"\\unHideNotes" return 'CMD_UNHIDENOTES';
|
333 |
+
"\\newSpacingSection" return 'CMD_NEWSPACINGSECTION';
|
334 |
+
"\\noBeam" return 'CMD_NOBEAM';
|
335 |
+
"\\oneVoice" return 'CMD_ONEVOICE';
|
336 |
+
"\\phrasingSlurDown" return 'CMD_PHRASINGSLURDOWN';
|
337 |
+
"\\phrasingSlurNeutral" return 'CMD_PHRASINGSLURNEUTRAL';
|
338 |
+
"\\phrasingSlurUp" return 'CMD_PHRASINGSLURUP';
|
339 |
+
"\\slurDown" return 'CMD_SLURDOWN';
|
340 |
+
"\\slurNeutral" return 'CMD_SLURNEUTRAL';
|
341 |
+
"\\slurUp" return 'CMD_SLURUP';
|
342 |
+
"\\tieDown" return 'CMD_TIEDOWN';
|
343 |
+
"\\tieNeutral" return 'CMD_TIENEUTRAL';
|
344 |
+
"\\tieUp" return 'CMD_TIEUP';
|
345 |
+
"\\tupletUp" return 'CMD_TUPLETUP';
|
346 |
+
"\\tupletDown" return 'CMD_TUPLETDOWN';
|
347 |
+
"\\shiftOn" return 'CMD_SHIFTON';
|
348 |
+
"\\repeatTie" return 'CMD_REPEATTIE';
|
349 |
+
"\\marcato" return 'CMD_MARCATO';
|
350 |
+
"\\stopped" return 'CMD_STOPPED';
|
351 |
+
"\\tenuto" return 'CMD_TENUTO';
|
352 |
+
"\\staccatissimo" return 'CMD_STACCATISSIMO';
|
353 |
+
"\\accent" return 'CMD_ACCENT';
|
354 |
+
"\\staccato" return 'CMD_STACCATO';
|
355 |
+
"\\portato" return 'CMD_PORTATO';
|
356 |
+
|
357 |
+
"\\mp"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
358 |
+
"\\mf"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
359 |
+
"\\"[p]+(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
360 |
+
"\\"[f]+(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
361 |
+
"\\sf"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
362 |
+
"\\sff"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
363 |
+
"\\sfp"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
364 |
+
"\\sfpp"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
365 |
+
"\\fp"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
366 |
+
"\\mfp"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
367 |
+
"\\rf"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
368 |
+
"\\rfz"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
369 |
+
"\\sfz"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
370 |
+
"\\sffz"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
371 |
+
"\\fz"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
372 |
+
"\\fzp"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
373 |
+
"\\ffz"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
374 |
+
"\\ppz"(?=[\W]) return 'CMD_DYNAMIC_MARKINGS';
|
375 |
+
|
376 |
+
"\\breve" return 'CMD_BREVE';
|
377 |
+
"\\longa" return 'CMD_LONGA';
|
378 |
+
|
379 |
+
// markup commands
|
380 |
+
"\\version" return 'CMD_VERSION';
|
381 |
+
"\\column" return 'CMD_COLUMN';
|
382 |
+
"\\line" return 'CMD_LINE';
|
383 |
+
"\\bold" return 'CMD_BOLD';
|
384 |
+
"\\italic" return 'CMD_ITALIC';
|
385 |
+
"\\box" return 'CMD_BOX';
|
386 |
+
"\\whiteout" return 'CMD_WHITEOUT';
|
387 |
+
"\\dynamic" return 'CMD_DYNAMIC';
|
388 |
+
"\\abs-fontsize" return 'CMD_ABS_FONTSIZE';
|
389 |
+
"\\with-color" return 'CMD_WITH_COLOR';
|
390 |
+
"\\char" return 'CMD_CHAR';
|
391 |
+
"\\center-column" return 'CMD_CENTER_COLUMN';
|
392 |
+
"\\right-column" return 'CMD_RIGHT_COLUMN';
|
393 |
+
"\\with-url" return 'CMD_WITH_URL';
|
394 |
+
"\\sans" return 'CMD_SANS';
|
395 |
+
"\\concat" return 'CMD_CONCAT';
|
396 |
+
"\\maintainer" return 'CMD_MAINTAINER';
|
397 |
+
"\\footnote" return 'CMD_FOOTNOTE';
|
398 |
+
"\\natural" return 'CMD_NATURAL';
|
399 |
+
"\\flat" return 'CMD_FLAT';
|
400 |
+
"\\sharp" return 'CMD_SHARP';
|
401 |
+
"\\hspace" return 'CMD_HSPACE';
|
402 |
+
"\\footer" return 'CMD_FOOTER';
|
403 |
+
"\\center-align" return 'CMD_CENTER_ALIGN';
|
404 |
+
"\\right-align" return 'CMD_RIGHT_ALIGN';
|
405 |
+
"\\general-align" return 'CMD_GENERAL_ALIGN';
|
406 |
+
"\\lower" return 'CMD_LOWER';
|
407 |
+
"\\finger" return 'CMD_FINGER';
|
408 |
+
"\\fontsize" return 'CMD_FONTSIZE';
|
409 |
+
"\\raise" return 'CMD_RAISE';
|
410 |
+
"\\note" return 'CMD_NOTE';
|
411 |
+
"\\circle" return 'CMD_CIRCLE';
|
412 |
+
"\\pad-markup" return 'CMD_PAD_MARKUP';
|
413 |
+
"\\smaller" return 'CMD_SMALLER';
|
414 |
+
"\\normal-text" return 'CMD_NORMAL_TEXT';
|
415 |
+
|
416 |
+
"\\huge" return 'CMD_HUGE';
|
417 |
+
"\\large" return 'CMD_LARGE';
|
418 |
+
"\\normalsize" return 'CMD_NORMALSIZE';
|
419 |
+
"\\small" return 'CMD_SMALL';
|
420 |
+
"\\tiny" return 'CMD_TINY';
|
421 |
+
"\\teeny" return 'CMD_TEENY';
|
422 |
+
"\\medium" return 'CMD_MEDIUM';
|
423 |
+
|
424 |
+
// syntax commands
|
425 |
+
"\\header" return 'HEADER';
|
426 |
+
"\\markup" return 'MARKUP';
|
427 |
+
"\\markuplist" return 'MARKUPLIST';
|
428 |
+
"\\repeat" return 'REPEAT';
|
429 |
+
"\\context" return 'CONTEXT';
|
430 |
+
"\\accepts" return 'ACCEPTS';
|
431 |
+
"\\addlyrics" return 'ADDLYRICS';
|
432 |
+
"\\alias" return 'ALIAS';
|
433 |
+
"\\alternative" return 'ALTERNATIVE';
|
434 |
+
"\\book" return 'BOOK';
|
435 |
+
"\\bookpart" return 'BOOKPART';
|
436 |
+
"\\change" return 'CHANGE';
|
437 |
+
"\\chordmode" return 'CHORDMODE';
|
438 |
+
"\\chords" return 'CHORDS';
|
439 |
+
"\\consists" return 'CONSISTS';
|
440 |
+
"\\default" return 'DEFAULT';
|
441 |
+
"\\defaultchild" return 'DEFAULTCHILD';
|
442 |
+
"\\denies" return 'DENIES';
|
443 |
+
"\\description" return 'DESCRIPTION';
|
444 |
+
"\\drummode" return 'DRUMMODE';
|
445 |
+
"\\drums" return 'DRUMS';
|
446 |
+
"\\etc" return 'ETC';
|
447 |
+
"\\figuremode" return 'FIGUREMODE';
|
448 |
+
"\\figures" return 'FIGURES';
|
449 |
+
"\\version-error" return 'INVALID';
|
450 |
+
"\\layout" return 'LAYOUT';
|
451 |
+
"\\lyricmode" return 'LYRICMODE';
|
452 |
+
"\\lyrics" return 'LYRICS';
|
453 |
+
"\\lyricsto" return 'LYRICSTO';
|
454 |
+
"\\midi" return 'MIDI';
|
455 |
+
"\\name" return 'NAME';
|
456 |
+
"\\notemode" return 'NOTEMODE';
|
457 |
+
"\\override" return 'OVERRIDE';
|
458 |
+
"\\paper" return 'PAPER';
|
459 |
+
"\\remove" return 'REMOVE';
|
460 |
+
"\\rest" return 'REST';
|
461 |
+
"\\revert" return 'REVERT';
|
462 |
+
"\\score" return 'SCORE';
|
463 |
+
"\\score-lines" return 'SCORELINES';
|
464 |
+
"\\sequential" return 'SEQUENTIAL';
|
465 |
+
"\\set" return 'SET';
|
466 |
+
"\\simultaneous" return 'SIMULTANEOUS';
|
467 |
+
"\\tempo" return 'TEMPO';
|
468 |
+
"\\type" return 'TYPE';
|
469 |
+
"\\unset" return 'UNSET';
|
470 |
+
"\\with" return 'WITH';
|
471 |
+
|
472 |
+
// simple commands
|
473 |
+
"\\<" return 'CMD_CRESCENDO_BEGIN';
|
474 |
+
"\\>" return 'CMD_DECRESCENDO_BEGIN';
|
475 |
+
"\\!" return 'CMD_DYNAMICS_END';
|
476 |
+
|
477 |
+
{COMMAND} return 'COMMAND';
|
478 |
+
|
479 |
+
{PITCH} return 'PITCH';
|
480 |
+
//{PLACEHOLDER_PITCH} return 'PLACEHOLDER_PITCH';
|
481 |
+
//{UNSIGNED} return 'POST_UNSIGNED';
|
482 |
+
{RESTNAME} return 'RESTNAME';
|
483 |
+
|
484 |
+
{FRACTION} return 'FRACTION';
|
485 |
+
//{REAL} return 'REAL';
|
486 |
+
{UNSIGNED} return 'UNSIGNED';
|
487 |
+
|
488 |
+
//{INT} return 'INT';
|
489 |
+
|
490 |
+
// CHORD_MODIFIER
|
491 |
+
[m][a][j](?=[\W\d]) return 'CHORD_MODIFIER_WORD';
|
492 |
+
m(?=[\W\d]) return 'CHORD_MODIFIER_WORD';
|
493 |
+
[a][u][g](?=[\W\d]) return 'CHORD_MODIFIER_WORD';
|
494 |
+
[d][i][m](?=[\W\d]) return 'CHORD_MODIFIER_WORD';
|
495 |
+
[s][u][s](?=[\W\d]) return 'CHORD_MODIFIER_WORD';
|
496 |
+
|
497 |
+
"inf.0" return yytext;
|
498 |
+
|
499 |
+
{SYMBOL} return 'SYMBOL';
|
500 |
+
|
501 |
+
"#f" return 'SCM_FALSE';
|
502 |
+
"#t" return 'SCM_TRUE';
|
503 |
+
|
504 |
+
"#x"[\da-fA-F]+ return 'SCM_HEX';
|
505 |
+
|
506 |
+
"#:"{SYMBOL} return 'SCM_COLON';
|
507 |
+
|
508 |
+
"\\(" return yytext;
|
509 |
+
"\\)" return yytext;
|
510 |
+
|
511 |
+
\.(?=\d) return 'DOT_NUMBER_R';
|
512 |
+
//(?<=\d)\. return 'DOT_NUMBER_L';
|
513 |
+
|
514 |
+
{SPECIAL} return yytext;
|
515 |
+
\| return 'DIVIDE';
|
516 |
+
|
517 |
+
[()] return yytext;
|
518 |
+
|
519 |
+
"[" return yytext;
|
520 |
+
"]" return yytext;
|
521 |
+
|
522 |
+
"#" return yytext;
|
523 |
+
"~" return yytext;
|
524 |
+
"`" return yytext;
|
525 |
+
|
526 |
+
. return 'UNKNOWN_CHAR';
|
527 |
+
|
528 |
+
<<EOF>> return 'EOF';
|
529 |
+
|
530 |
+
|
531 |
+
/lex
|
532 |
+
|
533 |
+
%start start_symbol
|
534 |
+
|
535 |
+
%%
|
536 |
+
|
537 |
+
start_symbol
|
538 |
+
: lilypond EOF
|
539 |
+
{
|
540 |
+
attachComments(yy);
|
541 |
+
return $1;
|
542 |
+
}
|
543 |
+
//| embedded_lilypond
|
544 |
+
;
|
545 |
+
|
546 |
+
lilypond
|
547 |
+
: %empty
|
548 |
+
{$$ = root();}
|
549 |
+
| version
|
550 |
+
{$$ = root([$1]); lineRegister(@1, $1);}
|
551 |
+
| lilypond toplevel_expression
|
552 |
+
{$$ = appendSection($1, $2); lineRegister(@2, $2);}
|
553 |
+
| lilypond assignment
|
554 |
+
{$$ = appendSection($1, $2); lineRegister(@2, $2);}
|
555 |
+
;
|
556 |
+
|
557 |
+
version
|
558 |
+
: CMD_VERSION literal_string
|
559 |
+
{$$ = command($1, $2);}
|
560 |
+
;
|
561 |
+
|
562 |
+
toplevel_expression
|
563 |
+
: header_block
|
564 |
+
{$$ = $1;}
|
565 |
+
| composite_music
|
566 |
+
{$$ = $1;}
|
567 |
+
| full_markup
|
568 |
+
{$$ = $1;}
|
569 |
+
| output_def
|
570 |
+
{$$ = $1;}
|
571 |
+
| score_block
|
572 |
+
{$$ = $1;}
|
573 |
+
| book_block
|
574 |
+
{$$ = $1;}
|
575 |
+
| scm_identifier
|
576 |
+
{$$ = $1;}
|
577 |
+
//| full_markup_list
|
578 |
+
// {$$ = $1;}
|
579 |
+
//| bookpart_block
|
580 |
+
//| BOOK_IDENTIFIER
|
581 |
+
//| SCM_TOKEN
|
582 |
+
//| embedded_scm_active
|
583 |
+
;
|
584 |
+
|
585 |
+
score_block
|
586 |
+
: SCORE '{' score_body '}'
|
587 |
+
{$$ = block("score", $1, $3);}
|
588 |
+
;
|
589 |
+
|
590 |
+
book_block
|
591 |
+
: BOOK '{' book_body '}'
|
592 |
+
{$$ = block("book", $1, $3);}
|
593 |
+
;
|
594 |
+
|
595 |
+
book_body
|
596 |
+
: %empty
|
597 |
+
{$$ = [];}
|
598 |
+
//| BOOK_IDENTIFIER
|
599 |
+
| book_body paper_block
|
600 |
+
{$$.push($2);}
|
601 |
+
//| book_body bookpart_block
|
602 |
+
// {$$.push($2);}
|
603 |
+
| book_body score_block
|
604 |
+
{$$.push($2);}
|
605 |
+
| book_body composite_music
|
606 |
+
{$$.push($2);}
|
607 |
+
| book_body full_markup
|
608 |
+
{$$.push($2);}
|
609 |
+
| book_body full_markup_list
|
610 |
+
{$$.push($2);}
|
611 |
+
//| book_body SCM_TOKEN
|
612 |
+
| book_body embedded_scm_active
|
613 |
+
{$$.push($2);}
|
614 |
+
| book_body lilypond_header
|
615 |
+
{$$.push($2);}
|
616 |
+
//| book_body error
|
617 |
+
;
|
618 |
+
|
619 |
+
paper_block
|
620 |
+
: output_def
|
621 |
+
{$$ = $1;}
|
622 |
+
;
|
623 |
+
|
624 |
+
header_block
|
625 |
+
: lilypond_header
|
626 |
+
{$$ = $1;}
|
627 |
+
;
|
628 |
+
|
629 |
+
lilypond_header
|
630 |
+
: HEADER '{' lilypond_header_body '}'
|
631 |
+
{$$ = block("header", $1, $3);}
|
632 |
+
;
|
633 |
+
|
634 |
+
lilypond_header_body
|
635 |
+
: %empty
|
636 |
+
{$$ = [];}
|
637 |
+
| lilypond_header_body assignment
|
638 |
+
{$$.push($2); lineRegister(@2, $2);}
|
639 |
+
//| lilypond_header_body SCM_TOKEN
|
640 |
+
//| lilypond_header_body embedded_scm_active
|
641 |
+
;
|
642 |
+
|
643 |
+
assignment
|
644 |
+
: assignment_id '=' identifier_init
|
645 |
+
{$$ = assignment($1, $3);}
|
646 |
+
| assignment_id '.' property_path '=' identifier_init
|
647 |
+
{$$ = assignment($1 + "." + $3, $5);}
|
648 |
+
//| markup_mode_word '=' identifier_init
|
649 |
+
;
|
650 |
+
|
651 |
+
assignment_id
|
652 |
+
: literal_string
|
653 |
+
{$$ = $1;}
|
654 |
+
| SYMBOL
|
655 |
+
{$$ = $1;}
|
656 |
+
// extra formula
|
657 |
+
| PITCH
|
658 |
+
{$$ = $1;}
|
659 |
+
// extra formula
|
660 |
+
| CHORD_MODIFIER_WORD
|
661 |
+
{$$ = $1;}
|
662 |
+
;
|
663 |
+
|
664 |
+
property_path
|
665 |
+
: symbol_list_rev
|
666 |
+
{$$ = $1;}
|
667 |
+
;
|
668 |
+
|
669 |
+
symbol_list_rev
|
670 |
+
: symbol_list_part
|
671 |
+
{$$ = $1;}
|
672 |
+
| symbol_list_rev '.' symbol_list_part
|
673 |
+
{$$ = $1 + "." + $3;}
|
674 |
+
| symbol_list_rev ',' symbol_list_part
|
675 |
+
{$$ = $1 + "," + $3;}
|
676 |
+
;
|
677 |
+
|
678 |
+
symbol_list_part
|
679 |
+
: symbol_list_part_bare
|
680 |
+
{$$ = $1;}
|
681 |
+
| embedded_scm_bare
|
682 |
+
{$$ = $1;}
|
683 |
+
;
|
684 |
+
|
685 |
+
symbol_list_part_bare
|
686 |
+
: SYMBOL
|
687 |
+
{$$ = $1;}
|
688 |
+
| symbol_list_element
|
689 |
+
{$$ = $1;}
|
690 |
+
;
|
691 |
+
|
692 |
+
symbol_list_element
|
693 |
+
: literal_string
|
694 |
+
{$$ = $1;}
|
695 |
+
| UNSIGNED
|
696 |
+
{$$ = $1;}
|
697 |
+
;
|
698 |
+
|
699 |
+
identifier_init
|
700 |
+
: identifier_init_nonumber
|
701 |
+
{$$ = $1;}
|
702 |
+
| number_expression
|
703 |
+
{$$ = $1;}
|
704 |
+
//| symbol_list_part_bare '.' property_path
|
705 |
+
// {$$ = $1 + "." + $3;}
|
706 |
+
//| symbol_list_part_bare ',' property_path
|
707 |
+
// {$$ = $1 + "," + $3;}
|
708 |
+
| post_event_nofinger post_events
|
709 |
+
{$$ = [$1, $2];}
|
710 |
+
;
|
711 |
+
|
712 |
+
number_expression
|
713 |
+
: number_expression '+' number_term
|
714 |
+
| number_expression '-' number_term
|
715 |
+
| number_term
|
716 |
+
;
|
717 |
+
|
718 |
+
number_term
|
719 |
+
: number_factor
|
720 |
+
| number_factor '*' number_factor
|
721 |
+
| number_factor '/' number_factor
|
722 |
+
;
|
723 |
+
|
724 |
+
number_factor
|
725 |
+
: '-' number_factor
|
726 |
+
| bare_number
|
727 |
+
;
|
728 |
+
|
729 |
+
identifier_init_nonumber
|
730 |
+
: header_block
|
731 |
+
{$$ = $1;}
|
732 |
+
| music_assign
|
733 |
+
{$$ = $1;}
|
734 |
+
//| full_markup_list
|
735 |
+
// {$$ = $1;}
|
736 |
+
| string
|
737 |
+
{$$ = $1;}
|
738 |
+
| pitch_or_music
|
739 |
+
{$$ = $1;}
|
740 |
+
| FRACTION
|
741 |
+
{$$ = $1;}
|
742 |
+
| embedded_scm
|
743 |
+
{$$ = $1;}
|
744 |
+
| score_block
|
745 |
+
{$$ = $1;}
|
746 |
+
| output_def
|
747 |
+
{$$ = $1;}
|
748 |
+
| context_modification
|
749 |
+
{$$ = $1;}
|
750 |
+
| book_block
|
751 |
+
{$$ = $1;}
|
752 |
+
//| bookpart_block
|
753 |
+
//| context_def_spec_block
|
754 |
+
//| partial_markup
|
755 |
+
//| partial_function ETC
|
756 |
+
;
|
757 |
+
|
758 |
+
string
|
759 |
+
: literal_string
|
760 |
+
{$$ = $1;}
|
761 |
+
| SYMBOL
|
762 |
+
{$$ = $1;}
|
763 |
+
| full_markup
|
764 |
+
{$$ = $1;}
|
765 |
+
;
|
766 |
+
|
767 |
+
text
|
768 |
+
: literal_string
|
769 |
+
{$$ = $1;}
|
770 |
+
| SYMBOL
|
771 |
+
{$$ = $1;}
|
772 |
+
| full_markup
|
773 |
+
{$$ = $1;}
|
774 |
+
| embedded_scm_bare
|
775 |
+
{$$ = $1;}
|
776 |
+
;
|
777 |
+
|
778 |
+
full_markup_list
|
779 |
+
: MARKUPLIST
|
780 |
+
{$$ = $1;}
|
781 |
+
| markup_list
|
782 |
+
{$$ = $1;}
|
783 |
+
;
|
784 |
+
|
785 |
+
markup_list
|
786 |
+
: markup_composed_list
|
787 |
+
{$$ = $1;}
|
788 |
+
| markup_uncomposed_list
|
789 |
+
{$$ = [$1];}
|
790 |
+
;
|
791 |
+
|
792 |
+
markup_composed_list
|
793 |
+
: markup_head_1_list markup_uncomposed_list
|
794 |
+
//{$$ = block("markup", $1, $2);}
|
795 |
+
{$$ = [...$1, $2];}
|
796 |
+
;
|
797 |
+
|
798 |
+
markup_head_1_list
|
799 |
+
: markup_head_1_item
|
800 |
+
{$$ = [$1];}
|
801 |
+
| markup_head_1_list markup_head_1_item
|
802 |
+
{$$ = $1.concat([$2]);}
|
803 |
+
;
|
804 |
+
|
805 |
+
markup_head_1_item
|
806 |
+
//: markup_function EXPECT_MARKUP markup_command_list_arguments
|
807 |
+
//: markup_function markup_command_list_arguments
|
808 |
+
// {$$ = {func: $1, args: $2};}
|
809 |
+
: markup_function
|
810 |
+
//{$$ = {func: $1};}
|
811 |
+
{$$ = $1;}
|
812 |
+
;
|
813 |
+
|
814 |
+
// equivalent for MARKUP_FUNCTION in lilypond's parser.yy
|
815 |
+
markup_function
|
816 |
+
//: CMD_COLUMN
|
817 |
+
// {$$ = $1;}
|
818 |
+
: CMD_LINE
|
819 |
+
{$$ = $1;}
|
820 |
+
//| CMD_BOLD
|
821 |
+
// {$$ = $1;}
|
822 |
+
//| CMD_ITALIC
|
823 |
+
// {$$ = $1;}
|
824 |
+
//| markup_font_size
|
825 |
+
// {$$ = $1;}
|
826 |
+
| CMD_BOX
|
827 |
+
{$$ = $1;}
|
828 |
+
| CMD_WHITEOUT
|
829 |
+
{$$ = $1;}
|
830 |
+
| CMD_DYNAMIC
|
831 |
+
{$$ = $1;}
|
832 |
+
//| CMD_CENTER_COLUMN
|
833 |
+
// {$$ = $1;}
|
834 |
+
//| CMD_WITH_URL
|
835 |
+
// {$$ = $1;}
|
836 |
+
//| CMD_SANS
|
837 |
+
// {$$ = $1;}
|
838 |
+
//| CMD_CONCAT
|
839 |
+
// {$$ = $1;}
|
840 |
+
| CMD_MAINTAINER
|
841 |
+
{$$ = $1;}
|
842 |
+
;
|
843 |
+
|
844 |
+
// extra syntax
|
845 |
+
markup_font_size
|
846 |
+
: CMD_HUGE
|
847 |
+
{$$ = $1;}
|
848 |
+
| CMD_LARGE
|
849 |
+
{$$ = $1;}
|
850 |
+
| CMD_NORMALSIZE
|
851 |
+
{$$ = $1;}
|
852 |
+
| CMD_SMALL
|
853 |
+
{$$ = $1;}
|
854 |
+
| CMD_TINY
|
855 |
+
{$$ = $1;}
|
856 |
+
| CMD_TEENY
|
857 |
+
{$$ = $1;}
|
858 |
+
| CMD_MEDIUM
|
859 |
+
{$$ = $1;}
|
860 |
+
;
|
861 |
+
|
862 |
+
markup_uncomposed_list
|
863 |
+
: markup_braced_list
|
864 |
+
{$$ = $1;}
|
865 |
+
//| markup_command_list
|
866 |
+
//| markup_scm MARKUPLIST_IDENTIFIER
|
867 |
+
//| SCORELINES '{' score_body '}'
|
868 |
+
;
|
869 |
+
|
870 |
+
markup_braced_list
|
871 |
+
: '{' markup_braced_list_body '}'
|
872 |
+
{$$ = inlineBlock($2);}
|
873 |
+
;
|
874 |
+
|
875 |
+
markup_braced_list_body
|
876 |
+
: %empty
|
877 |
+
{$$ = [];}
|
878 |
+
| markup_braced_list_body markup
|
879 |
+
{$$ = $1.concat([$2]);}
|
880 |
+
| markup_braced_list_body markup_list
|
881 |
+
{$$ = $1.concat($2);}
|
882 |
+
;
|
883 |
+
|
884 |
+
markup
|
885 |
+
: markup_head_1_list simple_markup
|
886 |
+
//{$$ = $1.concat([$2]);}
|
887 |
+
{$$ = markup($1, $2);}
|
888 |
+
| simple_markup
|
889 |
+
{$$ = $1;}
|
890 |
+
;
|
891 |
+
|
892 |
+
simple_markup
|
893 |
+
: markup_word
|
894 |
+
{$$ = $1;}
|
895 |
+
| simple_markup_noword
|
896 |
+
{$$ = $1;}
|
897 |
+
;
|
898 |
+
|
899 |
+
markup_word
|
900 |
+
: literal_string
|
901 |
+
{$$ = $1;}
|
902 |
+
| SYMBOL
|
903 |
+
{$$ = $1;}
|
904 |
+
| unsigned_number
|
905 |
+
{$$ = $1;}
|
906 |
+
| CMD_MUSICGLYPH
|
907 |
+
{$$ = command($1);}
|
908 |
+
| CMD_NATURAL
|
909 |
+
{$$ = $1;}
|
910 |
+
| CMD_FLAT
|
911 |
+
{$$ = $1;}
|
912 |
+
| CMD_SHARP
|
913 |
+
{$$ = $1;}
|
914 |
+
| CMD_FOOTER
|
915 |
+
{$$ = $1;}
|
916 |
+
| scm_identifier
|
917 |
+
{$$ = $1;}
|
918 |
+
// extra formula
|
919 |
+
| music_property_def
|
920 |
+
{$$ = $1;}
|
921 |
+
| context_change
|
922 |
+
{$$ = $1;}
|
923 |
+
| pitch_mode_music
|
924 |
+
{$$ = $1;}
|
925 |
+
// extra formula
|
926 |
+
| PITCH
|
927 |
+
{$$ = $1;}
|
928 |
+
// extra formula
|
929 |
+
| REAL
|
930 |
+
{$$ = $1;}
|
931 |
+
// extra formula
|
932 |
+
| INT
|
933 |
+
{$$ = $1;}
|
934 |
+
// extra formula
|
935 |
+
| general_text
|
936 |
+
{$$ = $1;}
|
937 |
+
;
|
938 |
+
|
939 |
+
// extra syntax
|
940 |
+
long_extender
|
941 |
+
: PRE_EXTENDER "_"
|
942 |
+
{$$ = $1 + $2}
|
943 |
+
| PRE_EXTENDER long_extender
|
944 |
+
{$$ = $1 + $2}
|
945 |
+
;
|
946 |
+
|
947 |
+
// extra syntax
|
948 |
+
general_text
|
949 |
+
: CHORD_MODIFIER_WORD
|
950 |
+
{$$ = $1;}
|
951 |
+
| "."
|
952 |
+
{$$ = $1;}
|
953 |
+
| "-"
|
954 |
+
{$$ = $1;}
|
955 |
+
| "_"
|
956 |
+
{$$ = $1;}
|
957 |
+
| PRE_HYPHEN
|
958 |
+
{$$ = $1;}
|
959 |
+
| long_extender
|
960 |
+
{$$ = $1;}
|
961 |
+
| "="
|
962 |
+
{$$ = $1;}
|
963 |
+
| "'"
|
964 |
+
{$$ = $1;}
|
965 |
+
| ","
|
966 |
+
{$$ = $1;}
|
967 |
+
| ":"
|
968 |
+
{$$ = $1;}
|
969 |
+
| "/"
|
970 |
+
{$$ = $1;}
|
971 |
+
| "("
|
972 |
+
{$$ = $1;}
|
973 |
+
| ")"
|
974 |
+
{$$ = $1;}
|
975 |
+
| "*"
|
976 |
+
{$$ = $1;}
|
977 |
+
| "~"
|
978 |
+
{$$ = $1;}
|
979 |
+
| "!"
|
980 |
+
{$$ = $1;}
|
981 |
+
| "?"
|
982 |
+
{$$ = $1;}
|
983 |
+
| UNKNOWN_CHAR
|
984 |
+
{$$ = $1;}
|
985 |
+
//| PLACEHOLDER_PITCH
|
986 |
+
// {$$ = $1;}
|
987 |
+
| RESTNAME
|
988 |
+
{$$ = $1;}
|
989 |
+
;
|
990 |
+
|
991 |
+
simple_markup_noword
|
992 |
+
: SCORE '{' score_body '}'
|
993 |
+
//{$$ = {score: $3};}
|
994 |
+
{$$ = block("score", $1, $3);}
|
995 |
+
| markup_function markup_command_basic_arguments
|
996 |
+
//{$$ = {func: $1, args: $2};}
|
997 |
+
{$$ = command($1, ...$2);}
|
998 |
+
//| markup_scm MARKUP_IDENTIFIER
|
999 |
+
// extra formula
|
1000 |
+
| OVERRIDE scm_identifier
|
1001 |
+
{$$ = command($1, $2);}
|
1002 |
+
// extra formula
|
1003 |
+
| CMD_ABS_FONTSIZE scm_identifier markup
|
1004 |
+
{$$ = command($1, $2, $3);}
|
1005 |
+
// extra formula
|
1006 |
+
| CMD_ABS_FONTSIZE scm_identifier markup_list
|
1007 |
+
{$$ = command($1, $2, ...$3);}
|
1008 |
+
// extra formula
|
1009 |
+
| CMD_WITH_COLOR scm_identifier markup
|
1010 |
+
{$$ = command($1, $2, $3);}
|
1011 |
+
// extra formula
|
1012 |
+
| CMD_CHAR scm_identifier
|
1013 |
+
{$$ = command($1, $2);}
|
1014 |
+
// extra formula
|
1015 |
+
| CMD_HSPACE scm_identifier
|
1016 |
+
{$$ = command($1, $2);}
|
1017 |
+
// extra formula
|
1018 |
+
| CMD_SANS markup
|
1019 |
+
{$$ = command($1, $2);}
|
1020 |
+
// extra formula
|
1021 |
+
| CMD_SANS markup_list
|
1022 |
+
{$$ = command($1, ...$2);}
|
1023 |
+
// extra formula
|
1024 |
+
| CMD_CONCAT markup_list
|
1025 |
+
{$$ = command($1, ...$2);}
|
1026 |
+
// extra formula
|
1027 |
+
| CMD_COLUMN markup_list
|
1028 |
+
{$$ = command($1, ...$2);}
|
1029 |
+
// extra formula
|
1030 |
+
| CMD_CENTER_COLUMN markup_list
|
1031 |
+
{$$ = command($1, ...$2);}
|
1032 |
+
// extra formula
|
1033 |
+
| CMD_RIGHT_COLUMN markup_list
|
1034 |
+
{$$ = command($1, ...$2);}
|
1035 |
+
// extra formula
|
1036 |
+
| CMD_FOOTNOTE string string
|
1037 |
+
{$$ = command($1, $2, $3);}
|
1038 |
+
// extra formula
|
1039 |
+
| CMD_WITH_URL scalar string
|
1040 |
+
{$$ = command($1, $2, $3);}
|
1041 |
+
// extra formula
|
1042 |
+
| CMD_WITH_URL scalar markup_list
|
1043 |
+
{$$ = command($1, $2, ...$3);}
|
1044 |
+
// extra formula
|
1045 |
+
| CMD_BOLD markup_list
|
1046 |
+
{$$ = command($1, ...$2);}
|
1047 |
+
// extra formula
|
1048 |
+
| CMD_BOLD markup
|
1049 |
+
{$$ = command($1, $2);}
|
1050 |
+
// extra formula
|
1051 |
+
| markup_font_size markup
|
1052 |
+
{$$ = command($1, $2);}
|
1053 |
+
// extra formula
|
1054 |
+
| markup_font_size markup_list
|
1055 |
+
{$$ = command($1, ...$2);}
|
1056 |
+
// extra formula
|
1057 |
+
| CMD_ITALIC markup
|
1058 |
+
{$$ = command($1, $2);}
|
1059 |
+
// extra formula
|
1060 |
+
| CMD_ITALIC markup_list
|
1061 |
+
{$$ = command($1, ...$2);}
|
1062 |
+
// extra formula
|
1063 |
+
| CMD_CENTER_ALIGN markup_list
|
1064 |
+
{$$ = command($1, ...$2);}
|
1065 |
+
// extra formula
|
1066 |
+
| CMD_CENTER_ALIGN markup
|
1067 |
+
{$$ = command($1, $2);}
|
1068 |
+
// extra formula
|
1069 |
+
| CMD_RIGHT_ALIGN markup_list
|
1070 |
+
{$$ = command($1, ...$2);}
|
1071 |
+
// extra formula
|
1072 |
+
| CMD_RIGHT_ALIGN markup
|
1073 |
+
{$$ = command($1, $2);}
|
1074 |
+
// extra formula
|
1075 |
+
| CMD_GENERAL_ALIGN scm_identifier scm_identifier markup
|
1076 |
+
{$$ = command($1, $2, $3, $4);}
|
1077 |
+
// extra formula
|
1078 |
+
| CMD_LOWER scm_identifier
|
1079 |
+
{$$ = command($1, $2);}
|
1080 |
+
// extra formula
|
1081 |
+
| CMD_FINGER string
|
1082 |
+
{$$ = command($1, $2);}
|
1083 |
+
// extra formula
|
1084 |
+
| CMD_FONTSIZE scm_identifier markup
|
1085 |
+
{$$ = command($1, $2, $3);}
|
1086 |
+
// extra formula
|
1087 |
+
| CMD_FONTSIZE scm_identifier markup_list
|
1088 |
+
{$$ = command($1, $2, $3);}
|
1089 |
+
// extra formula
|
1090 |
+
| CMD_RAISE scm_identifier
|
1091 |
+
{$$ = command($1, $2);}
|
1092 |
+
// extra formula
|
1093 |
+
| CMD_NOTE scm_identifier scm_identifier markup
|
1094 |
+
{$$ = command($1, $2, $3, $4);}
|
1095 |
+
// extra formula
|
1096 |
+
| CMD_CIRCLE markup_list
|
1097 |
+
{$$ = command($1, ...$2);}
|
1098 |
+
// extra formula
|
1099 |
+
| CMD_CIRCLE markup
|
1100 |
+
{$$ = command($1, $2);}
|
1101 |
+
// extra formula
|
1102 |
+
| CMD_PAD_MARKUP scm_identifier
|
1103 |
+
{$$ = command($1, $2);}
|
1104 |
+
// extra formula
|
1105 |
+
| CMD_SMALLER markup
|
1106 |
+
{$$ = command($1, $2);}
|
1107 |
+
// extra formula
|
1108 |
+
| CMD_NORMAL_TEXT markup
|
1109 |
+
{$$ = command($1, $2);}
|
1110 |
+
;
|
1111 |
+
|
1112 |
+
markup_command_basic_arguments
|
1113 |
+
: %emtpy
|
1114 |
+
{$$ = [];}
|
1115 |
+
| /*EXPECT_MARKUP_LIST*/ markup_command_list_arguments markup_list
|
1116 |
+
{$$ = $1.concat($2);}
|
1117 |
+
| /*EXPECT_SCM*/ markup_command_list_arguments markup_command_embedded_lilypond
|
1118 |
+
{$$ = $1.concat($2);}
|
1119 |
+
//| EXPECT_SCM markup_command_list_arguments embedded_scm
|
1120 |
+
//| EXPECT_SCM markup_command_list_arguments mode_changed_music
|
1121 |
+
//| EXPECT_SCM markup_command_list_arguments MUSIC_IDENTIFIER
|
1122 |
+
//| EXPECT_SCM markup_command_list_arguments literal_string
|
1123 |
+
//| EXPECT_NO_MORE_ARGS
|
1124 |
+
;
|
1125 |
+
|
1126 |
+
markup_command_list_arguments
|
1127 |
+
: markup_command_basic_arguments
|
1128 |
+
{$$ = [$1];}
|
1129 |
+
| /*EXPECT_MARKUP*/ markup_command_list_arguments markup
|
1130 |
+
{$$ = $1.concat($2);}
|
1131 |
+
;
|
1132 |
+
|
1133 |
+
markup_command_embedded_lilypond
|
1134 |
+
: '{' embedded_lilypond '}'
|
1135 |
+
{$$ = $2;}
|
1136 |
+
;
|
1137 |
+
|
1138 |
+
embedded_lilypond
|
1139 |
+
: %empty
|
1140 |
+
{$$ = $1;}
|
1141 |
+
| identifier_init_nonumber
|
1142 |
+
{$$ = $1;}
|
1143 |
+
| embedded_lilypond_number
|
1144 |
+
{$$ = $1;}
|
1145 |
+
| post_event
|
1146 |
+
{$$ = $1;}
|
1147 |
+
//| duration post_events %prec ':'
|
1148 |
+
| music_embedded music_embedded music_list
|
1149 |
+
{$$ = [$1, $2, $3];}
|
1150 |
+
//| error
|
1151 |
+
//| INVALID embedded_lilypond
|
1152 |
+
;
|
1153 |
+
|
1154 |
+
embedded_lilypond_number
|
1155 |
+
: '-' embedded_lilypond_number
|
1156 |
+
{$$ = -$1;}
|
1157 |
+
| bare_number_common
|
1158 |
+
{$$ = $1;}
|
1159 |
+
//| UNSIGNED NUMBER_IDENTIFIER
|
1160 |
+
;
|
1161 |
+
|
1162 |
+
bare_number_common
|
1163 |
+
: REAL
|
1164 |
+
{$$ = Number($1);}
|
1165 |
+
//| NUMBER_IDENTIFIER
|
1166 |
+
//| REAL NUMBER_IDENTIFIER
|
1167 |
+
| number_identifier
|
1168 |
+
{$$ = $1;}
|
1169 |
+
| FRACTION
|
1170 |
+
{$$ = $1;}
|
1171 |
+
;
|
1172 |
+
|
1173 |
+
// extra syntax
|
1174 |
+
dot
|
1175 |
+
: "."
|
1176 |
+
{$$ = $1;}
|
1177 |
+
| DOT_NUMBER_R
|
1178 |
+
{$$ = $1;}
|
1179 |
+
;
|
1180 |
+
|
1181 |
+
INT
|
1182 |
+
: UNSIGNED
|
1183 |
+
{$$ = Number($1);}
|
1184 |
+
| "-" UNSIGNED
|
1185 |
+
{$$ = -Number($2);}
|
1186 |
+
;
|
1187 |
+
|
1188 |
+
// extra syntax
|
1189 |
+
positive_real
|
1190 |
+
: UNSIGNED DOT_NUMBER_R UNSIGNED
|
1191 |
+
{$$ = Number($1 + $2 + $3);}
|
1192 |
+
//| UNSIGNED DOT_NUMBER_L
|
1193 |
+
// {$$ = Number($1 + $2);}
|
1194 |
+
| DOT_NUMBER_R UNSIGNED
|
1195 |
+
{$$ = Number($1 + $2);}
|
1196 |
+
;
|
1197 |
+
|
1198 |
+
REAL
|
1199 |
+
: positive_real
|
1200 |
+
{$$ = $1;}
|
1201 |
+
| "-" positive_real
|
1202 |
+
{$$ = -$2;}
|
1203 |
+
;
|
1204 |
+
|
1205 |
+
// equivalent for NUMBER_IDENTIFIER in lilypond's parser.yy
|
1206 |
+
number_identifier
|
1207 |
+
: REAL number_unit
|
1208 |
+
{$$ = numberUnit($1, $2);}
|
1209 |
+
//| INT number_unit
|
1210 |
+
// {$$ = numberUnit($1, $2);}
|
1211 |
+
| UNSIGNED number_unit
|
1212 |
+
{$$ = numberUnit($1, $2);}
|
1213 |
+
;
|
1214 |
+
|
1215 |
+
// addon term to construct number_identifier
|
1216 |
+
number_unit
|
1217 |
+
: CENTIMETER
|
1218 |
+
{$$ = $1;}
|
1219 |
+
| MILLIMETER
|
1220 |
+
{$$ = $1;}
|
1221 |
+
;
|
1222 |
+
|
1223 |
+
score_body
|
1224 |
+
: score_items
|
1225 |
+
{$$ = $1;}
|
1226 |
+
//| score_body error
|
1227 |
+
;
|
1228 |
+
|
1229 |
+
score_items
|
1230 |
+
: %empty
|
1231 |
+
{$$ = [];}
|
1232 |
+
| score_items score_item
|
1233 |
+
{$$ = $1.concat([$2]); lineHead(@2, $2);}
|
1234 |
+
| score_items lilypond_header
|
1235 |
+
{$$ = $1.concat([$2]); lineHead(@2, $2);}
|
1236 |
+
;
|
1237 |
+
|
1238 |
+
score_item
|
1239 |
+
: music
|
1240 |
+
{$$ = $1;}
|
1241 |
+
| output_def
|
1242 |
+
{$$ = $1;}
|
1243 |
+
//: embedded_scm
|
1244 |
+
;
|
1245 |
+
|
1246 |
+
//markup_command_list
|
1247 |
+
// : MARKUP_LIST_FUNCTION markup_command_list_arguments
|
1248 |
+
// ;
|
1249 |
+
|
1250 |
+
markup_scm
|
1251 |
+
: embedded_scm
|
1252 |
+
{$$ = $1;}
|
1253 |
+
;
|
1254 |
+
|
1255 |
+
embedded_scm
|
1256 |
+
: embedded_scm_bare
|
1257 |
+
{$$ = $1;}
|
1258 |
+
//| scm_function_call
|
1259 |
+
//| lookup
|
1260 |
+
;
|
1261 |
+
|
1262 |
+
scm_function_call
|
1263 |
+
: SCM_FUNCTION function_arglist
|
1264 |
+
;
|
1265 |
+
|
1266 |
+
function_arglist
|
1267 |
+
: function_arglist_nonbackup
|
1268 |
+
{$$ = $1;}
|
1269 |
+
//| EXPECT_OPTIONAL EXPECT_SCM function_arglist_skip_nonbackup DEFAULT
|
1270 |
+
;
|
1271 |
+
|
1272 |
+
function_arglist_nonbackup
|
1273 |
+
: function_arglist_common
|
1274 |
+
//| EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup post_event_nofinger
|
1275 |
+
//| EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup '-' UNSIGNED
|
1276 |
+
//| EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup '-' REAL
|
1277 |
+
//| EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup '-' NUMBER_IDENTIFIER
|
1278 |
+
//| EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup embedded_scm_arg
|
1279 |
+
//| EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup bare_number_common
|
1280 |
+
| function_arglist_nonbackup_reparse REPARSE pitch_or_music
|
1281 |
+
| function_arglist_nonbackup_reparse REPARSE duration
|
1282 |
+
| function_arglist_nonbackup_reparse REPARSE reparsed_rhythm
|
1283 |
+
| function_arglist_nonbackup_reparse REPARSE bare_number_common
|
1284 |
+
| function_arglist_nonbackup_reparse REPARSE SCM_ARG
|
1285 |
+
| function_arglist_nonbackup_reparse REPARSE lyric_element_music
|
1286 |
+
| function_arglist_nonbackup_reparse REPARSE symbol_list_arg
|
1287 |
+
;
|
1288 |
+
|
1289 |
+
function_arglist_common
|
1290 |
+
//: EXPECT_NO_MORE_ARGS
|
1291 |
+
: %empty
|
1292 |
+
//| EXPECT_SCM function_arglist_optional embedded_scm_arg
|
1293 |
+
//| EXPECT_SCM function_arglist_optional bare_number_common
|
1294 |
+
//| EXPECT_SCM function_arglist_optional post_event_nofinger
|
1295 |
+
//| EXPECT_SCM function_arglist_optional '-' NUMBER_IDENTIFIER
|
1296 |
+
| function_arglist_common_reparse REPARSE SCM_ARG
|
1297 |
+
| function_arglist_common_reparse REPARSE lyric_element_music
|
1298 |
+
| function_arglist_common_reparse REPARSE pitch_or_music
|
1299 |
+
| function_arglist_common_reparse REPARSE bare_number_common
|
1300 |
+
| function_arglist_common_reparse REPARSE duration
|
1301 |
+
| function_arglist_common_reparse REPARSE reparsed_rhythm
|
1302 |
+
| function_arglist_common_reparse REPARSE symbol_list_arg
|
1303 |
+
;
|
1304 |
+
|
1305 |
+
lookup
|
1306 |
+
: LOOKUP_IDENTIFIER
|
1307 |
+
{$$ = $1;}
|
1308 |
+
| LOOKUP_IDENTIFIER '.' symbol_list_rev
|
1309 |
+
{$$ = $1 + "." + $2;}
|
1310 |
+
;
|
1311 |
+
|
1312 |
+
symbol_list_part
|
1313 |
+
: symbol_list_part_bare
|
1314 |
+
{$$ = $1;}
|
1315 |
+
| embedded_scm_bare
|
1316 |
+
{$$ = $1;}
|
1317 |
+
;
|
1318 |
+
|
1319 |
+
embedded_scm_bare
|
1320 |
+
//: SCM_TOKEN
|
1321 |
+
//| SCM_IDENTIFIER
|
1322 |
+
: scm_identifier
|
1323 |
+
{$$ = $1;}
|
1324 |
+
;
|
1325 |
+
|
1326 |
+
// equivalent for SCM_IDENTIFIER in lilypond parser.yy
|
1327 |
+
scm_identifier
|
1328 |
+
//: SCM_FALSE
|
1329 |
+
// {$$ = scheme(false);}
|
1330 |
+
//| SCM_TRUE
|
1331 |
+
// {$$ = scheme(true);}
|
1332 |
+
//| SCM_INT
|
1333 |
+
// {$$ = scheme($1.substr(1));}
|
1334 |
+
//| "#" "'" SYMBOL
|
1335 |
+
// {$$ = scheme("'" + $3);}
|
1336 |
+
: "#" scheme_expression
|
1337 |
+
{$$ = scheme($2);}
|
1338 |
+
| DOLLAR_SCHEME_EXPRESSION
|
1339 |
+
{$$ = $1;}
|
1340 |
+
;
|
1341 |
+
|
1342 |
+
composite_music
|
1343 |
+
: basic_music
|
1344 |
+
{$$ = $1;}
|
1345 |
+
| contexted_basic_music
|
1346 |
+
{$$ = $1;}
|
1347 |
+
//| basic_music new_lyrics
|
1348 |
+
;
|
1349 |
+
|
1350 |
+
contexted_basic_music
|
1351 |
+
: context_prefix contextable_music new_lyrics
|
1352 |
+
{$$ = contextedMusic($1, $2, $3);}
|
1353 |
+
| context_prefix contextable_music
|
1354 |
+
{$$ = contextedMusic($1, $2);}
|
1355 |
+
| context_prefix contexted_basic_music
|
1356 |
+
{$$ = contextedMusic($1, $2);}
|
1357 |
+
;
|
1358 |
+
|
1359 |
+
contextable_music
|
1360 |
+
: basic_music
|
1361 |
+
{$$ = $1;}
|
1362 |
+
| pitch_as_music
|
1363 |
+
{$$ = $1;}
|
1364 |
+
| event_chord
|
1365 |
+
{$$ = $1;}
|
1366 |
+
// extra formula
|
1367 |
+
| variable_command
|
1368 |
+
{$$ = $1;}
|
1369 |
+
;
|
1370 |
+
|
1371 |
+
new_lyrics
|
1372 |
+
: ADDLYRICS optional_context_mods lyric_mode_music
|
1373 |
+
{$$ = [{addLyrics: $3, mods: $2}];}
|
1374 |
+
| new_lyrics ADDLYRICS optional_context_mods lyric_mode_music
|
1375 |
+
{$$ = $1.concat([{addLyrics: $4, mods: $3}]);}
|
1376 |
+
;
|
1377 |
+
|
1378 |
+
lyric_mode_music
|
1379 |
+
: grouped_music_list
|
1380 |
+
{$$ = $1;}
|
1381 |
+
//| MUSIC_IDENTIFIER
|
1382 |
+
| music_identifier
|
1383 |
+
{$$ = $1;}
|
1384 |
+
;
|
1385 |
+
|
1386 |
+
context_prefix
|
1387 |
+
: CONTEXT symbol optional_id optional_context_mods
|
1388 |
+
//{$$ = {context: $2, assign: $3, mods: $4};}
|
1389 |
+
{$$ = command($1, $2, $3, ...$4);}
|
1390 |
+
| NEWCONTEXT symbol optional_id optional_context_mods
|
1391 |
+
//{$$ = {context: $2, new: true, assign: $3, mods: $4};}
|
1392 |
+
{$$ = command($1, $2, $3, ...$4);}
|
1393 |
+
;
|
1394 |
+
|
1395 |
+
optional_id
|
1396 |
+
: %empty
|
1397 |
+
{$$ = null;}
|
1398 |
+
| '=' simple_string
|
1399 |
+
{$$ = assignment(null, $2);}
|
1400 |
+
;
|
1401 |
+
|
1402 |
+
optional_context_mods
|
1403 |
+
: context_modification_mods_list
|
1404 |
+
{$$ = $1;}
|
1405 |
+
;
|
1406 |
+
|
1407 |
+
context_modification_mods_list
|
1408 |
+
: %empty
|
1409 |
+
{$$ = [];}
|
1410 |
+
| context_modification_mods_list context_modification
|
1411 |
+
{$$ = $1.concat($2);}
|
1412 |
+
;
|
1413 |
+
|
1414 |
+
basic_music
|
1415 |
+
: repeated_music
|
1416 |
+
{$$ = $1;}
|
1417 |
+
| music_bare
|
1418 |
+
{$$ = $1;}
|
1419 |
+
| LYRICSTO simple_string lyric_mode_music
|
1420 |
+
{$$ = command($1, $2, $3);}
|
1421 |
+
| LYRICSTO symbol '=' simple_string lyric_mode_music
|
1422 |
+
{$$ = command($1, assignment($2, $4), $5);}
|
1423 |
+
;
|
1424 |
+
|
1425 |
+
music_bare
|
1426 |
+
: grouped_music_list
|
1427 |
+
{$$ = $1;}
|
1428 |
+
| music_identifier
|
1429 |
+
{$$ = $1;}
|
1430 |
+
| mode_changed_music
|
1431 |
+
{$$ = $1;}
|
1432 |
+
;
|
1433 |
+
|
1434 |
+
mode_changed_music
|
1435 |
+
: mode_changing_head grouped_music_list
|
1436 |
+
{$$ = command($1, $2);}
|
1437 |
+
| mode_changing_head_with_context optional_context_mods grouped_music_list
|
1438 |
+
{$$ = command($1, ...$2, $3);}
|
1439 |
+
// extra formula
|
1440 |
+
| CHORDMODE chordmode_braced_music_list
|
1441 |
+
{$$ = command($1, $2);}
|
1442 |
+
// extra formula
|
1443 |
+
| LYRICMODE lyricmode_braced_music_list
|
1444 |
+
{$$ = command($1, $2);}
|
1445 |
+
;
|
1446 |
+
|
1447 |
+
// extra syntax
|
1448 |
+
lyricmode_braced_music_list
|
1449 |
+
: '{' lyricmode_music_list '}'
|
1450 |
+
{$$ = musicBlock($2);}
|
1451 |
+
;
|
1452 |
+
|
1453 |
+
// extra syntax
|
1454 |
+
lyricmode_music_list
|
1455 |
+
: %empty
|
1456 |
+
{$$ = [];}
|
1457 |
+
| lyricmode_music_list lyricmode_music
|
1458 |
+
{$$ = $1.concat([$2]);}
|
1459 |
+
;
|
1460 |
+
|
1461 |
+
// extra syntax
|
1462 |
+
lyricmode_music
|
1463 |
+
: lyric_element_music
|
1464 |
+
{$$ = $1;}
|
1465 |
+
//| music_assign
|
1466 |
+
// {$$ = $1;}
|
1467 |
+
| music_property_def
|
1468 |
+
{$$ = $1;}
|
1469 |
+
| lyricmode_music_identifier
|
1470 |
+
{$$ = $1;}
|
1471 |
+
| lyricmode_repeated_music
|
1472 |
+
{$$ = $1;}
|
1473 |
+
| lyricmode_braced_music_list
|
1474 |
+
{$$ = $1;}
|
1475 |
+
;
|
1476 |
+
|
1477 |
+
// extra syntax
|
1478 |
+
lyricmode_music_identifier
|
1479 |
+
: zero_command
|
1480 |
+
{$$ = $1;}
|
1481 |
+
| CMD_TIME FRACTION
|
1482 |
+
{$$ = command($1, $2);}
|
1483 |
+
| CMD_BAR string
|
1484 |
+
{$$ = command($1, $2);}
|
1485 |
+
| CMD_OMIT property_path
|
1486 |
+
{$$ = command($1, $2);}
|
1487 |
+
| CMD_OTTAVA property_path
|
1488 |
+
{$$ = command($1, $2);}
|
1489 |
+
| CMD_BARNUMBERCHECK scm_identifier
|
1490 |
+
{$$ = command($1, $2);}
|
1491 |
+
| CMD_BARNUMBERCHECK unsigned_number
|
1492 |
+
{$$ = command($1, $2);}
|
1493 |
+
| CMD_MARK full_markup
|
1494 |
+
{$$ = command($1, $2);}
|
1495 |
+
| CMD_SKIP duration
|
1496 |
+
{$$ = command($1, $2);}
|
1497 |
+
| CMD_UNFOLDREPEATS lyricmode_music
|
1498 |
+
{$$ = command($1, $2);}
|
1499 |
+
| CMD_ONCE music_assign
|
1500 |
+
{$$ = command($1, $2);}
|
1501 |
+
| CMD_PARTIAL duration
|
1502 |
+
{$$ = command($1, $2);}
|
1503 |
+
| CMD_TUPLETSPAN duration
|
1504 |
+
{$$ = command($1, $2);}
|
1505 |
+
| CMD_TUPLETSPAN DEFAULT
|
1506 |
+
{$$ = command($1, $2);}
|
1507 |
+
| CMD_TUPLET FRACTION lyricmode_music
|
1508 |
+
{$$ = command($1, $2, $3);}
|
1509 |
+
| CMD_TUPLET FRACTION duration lyricmode_music
|
1510 |
+
{$$ = command($1, $2, $3, $4);}
|
1511 |
+
| CMD_TWEAK property_path scalar
|
1512 |
+
{$$ = command($1, $2, $3);}
|
1513 |
+
| CMD_TIMES FRACTION lyricmode_music
|
1514 |
+
{$$ = command($1, $2, $3);}
|
1515 |
+
| CMD_SHAPE scm_identifier symbol
|
1516 |
+
{$$ = command($1, $2, $3);}
|
1517 |
+
| CMD_ACCIDENTALSTYLE grob_prop_spec
|
1518 |
+
{$$ = command($1, $2);}
|
1519 |
+
| CMD_NUMERICTIMESIGNATURE lyricmode_music_identifier
|
1520 |
+
{$$ = command($1, $2);}
|
1521 |
+
| CMD_DEFAULTTIMESIGNATURE
|
1522 |
+
{$$ = command($1);}
|
1523 |
+
| CMD_BENDAFTER scm_identifier
|
1524 |
+
{$$ = command($1, $2);}
|
1525 |
+
| CMD_COMPOUNDMETER scm_identifier
|
1526 |
+
{$$ = command($1, $2);}
|
1527 |
+
;
|
1528 |
+
|
1529 |
+
// extra syntax
|
1530 |
+
lyricmode_repeated_music
|
1531 |
+
: REPEAT simple_string unsigned_number lyricmode_braced_music_list
|
1532 |
+
{$$ = command($1, $2, $3, $4);}
|
1533 |
+
| REPEAT simple_string unsigned_number lyricmode_braced_music_list ALTERNATIVE lyricmode_braced_music_list
|
1534 |
+
{$$ = command($1, $2, $3, $4, command($5, $6));}
|
1535 |
+
;
|
1536 |
+
|
1537 |
+
// extra syntax
|
1538 |
+
chordmode_braced_music_list
|
1539 |
+
: '{' chordmode_music_list '}'
|
1540 |
+
{$$ = musicBlock($2);}
|
1541 |
+
;
|
1542 |
+
|
1543 |
+
// extra syntax
|
1544 |
+
chordmode_music_list
|
1545 |
+
: %empty
|
1546 |
+
{$$ = [];}
|
1547 |
+
| chordmode_music_list chordmode_music
|
1548 |
+
{$$ = $1.concat([$2]);}
|
1549 |
+
;
|
1550 |
+
|
1551 |
+
// extra syntax
|
1552 |
+
chordmode_music
|
1553 |
+
: new_chord post_events
|
1554 |
+
{$$ = briefChord($1, {post_events: $2, locations: [@1, @2]});}
|
1555 |
+
| music_assign
|
1556 |
+
{$$ = $1;}
|
1557 |
+
| chordmode_repeated_music
|
1558 |
+
{$$ = $1;}
|
1559 |
+
| chordmode_braced_music_list
|
1560 |
+
{$$ = $1;}
|
1561 |
+
;
|
1562 |
+
|
1563 |
+
// extra syntax
|
1564 |
+
chordmode_repeated_music
|
1565 |
+
: REPEAT simple_string unsigned_number chordmode_braced_music_list
|
1566 |
+
{$$ = command($1, $2, $3, $4);}
|
1567 |
+
| REPEAT simple_string unsigned_number chordmode_braced_music_list ALTERNATIVE chordmode_braced_music_list
|
1568 |
+
{$$ = command($1, $2, $3, $4, command($5, $6));}
|
1569 |
+
;
|
1570 |
+
|
1571 |
+
mode_changing_head_with_context
|
1572 |
+
: DRUMS
|
1573 |
+
{$$ = $1;}
|
1574 |
+
| FIGURES
|
1575 |
+
{$$ = $1;}
|
1576 |
+
| CHORDS
|
1577 |
+
{$$ = $1;}
|
1578 |
+
| LYRICS
|
1579 |
+
{$$ = $1;}
|
1580 |
+
;
|
1581 |
+
|
1582 |
+
mode_changing_head
|
1583 |
+
: NOTEMODE
|
1584 |
+
{$$ = $1;}
|
1585 |
+
| DRUMMODE
|
1586 |
+
{$$ = $1;}
|
1587 |
+
| FIGUREMODE
|
1588 |
+
{$$ = $1;}
|
1589 |
+
//| CHORDMODE
|
1590 |
+
// {$$ = $1;}
|
1591 |
+
//| LYRICMODE
|
1592 |
+
// {$$ = $1;}
|
1593 |
+
;
|
1594 |
+
|
1595 |
+
grouped_music_list
|
1596 |
+
: sequential_music
|
1597 |
+
{$$ = $1;}
|
1598 |
+
| simultaneous_music
|
1599 |
+
{$$ = $1;}
|
1600 |
+
;
|
1601 |
+
|
1602 |
+
simultaneous_music
|
1603 |
+
: SIMULTANEOUS braced_music_list
|
1604 |
+
{$$ = command($1, $2);}
|
1605 |
+
//| DOUBLE_ANGLE_OPEN music_list DOUBLE_ANGLE_CLOSE
|
1606 |
+
// {$$ = simultaneousList($2);}
|
1607 |
+
| DOUBLE_ANGLE_OPEN multiple_voices_music_list DOUBLE_ANGLE_CLOSE
|
1608 |
+
{$$ = simultaneousList($2);}
|
1609 |
+
;
|
1610 |
+
|
1611 |
+
// extra syntax
|
1612 |
+
multiple_voices_music_list
|
1613 |
+
: music_list
|
1614 |
+
{$$ = $1;}
|
1615 |
+
| multiple_voices_music_list E_BACKSLASH music_list
|
1616 |
+
{$$ = [...$1, $2, ...$3];}
|
1617 |
+
;
|
1618 |
+
|
1619 |
+
sequential_music
|
1620 |
+
: SEQUENTIAL braced_music_list
|
1621 |
+
{$$ = command($2);}
|
1622 |
+
| braced_music_list
|
1623 |
+
{$$ = $1;}
|
1624 |
+
;
|
1625 |
+
|
1626 |
+
braced_music_list
|
1627 |
+
: '{' music_list '}'
|
1628 |
+
{$$ = musicBlock($2);}
|
1629 |
+
;
|
1630 |
+
|
1631 |
+
music_list
|
1632 |
+
: %empty
|
1633 |
+
{$$ = [];}
|
1634 |
+
| music_list music_embedded
|
1635 |
+
{$$ = $1.concat([$2]); lineRegister(@2, $2);}
|
1636 |
+
;
|
1637 |
+
|
1638 |
+
music_embedded
|
1639 |
+
: music
|
1640 |
+
{$$ = $1;}
|
1641 |
+
| post_event
|
1642 |
+
{$$ = $1;}
|
1643 |
+
| music_embedded_backup
|
1644 |
+
{$$ = $1;}
|
1645 |
+
//| music_embedded_backup BACKUP lyric_element_music
|
1646 |
+
//| duration post_events %prec ':'
|
1647 |
+
;
|
1648 |
+
|
1649 |
+
music_embedded_backup
|
1650 |
+
: embedded_scm
|
1651 |
+
{$$ = $1;}
|
1652 |
+
;
|
1653 |
+
|
1654 |
+
music
|
1655 |
+
: music_assign
|
1656 |
+
{$$ = $1;}
|
1657 |
+
| pitch_as_music
|
1658 |
+
{$$ = $1;}
|
1659 |
+
//| lyric_element_music
|
1660 |
+
;
|
1661 |
+
|
1662 |
+
// extra syntax
|
1663 |
+
variable_command
|
1664 |
+
: COMMAND
|
1665 |
+
{$$ = variable($1);}
|
1666 |
+
// some test case use \lower as a variable name!?
|
1667 |
+
| CMD_LOWER
|
1668 |
+
{$$ = variable($1);}
|
1669 |
+
;
|
1670 |
+
|
1671 |
+
lyric_element_music
|
1672 |
+
: lyric_element optional_notemode_duration post_events
|
1673 |
+
{$$ = lyric($1, {duration: $2, post_events: $3, locations: [@1, @3]});}
|
1674 |
+
// extra formula
|
1675 |
+
| variable_command optional_notemode_duration post_events
|
1676 |
+
{$$ = lyric($1, {duration: $2, post_events: $3, locations: [@1, @3]});}
|
1677 |
+
;
|
1678 |
+
|
1679 |
+
lyric_element
|
1680 |
+
: full_markup
|
1681 |
+
{$$ = $1;}
|
1682 |
+
| SYMBOL
|
1683 |
+
{$$ = $1;}
|
1684 |
+
| literal_string
|
1685 |
+
{$$ = $1;}
|
1686 |
+
//| LYRIC_ELEMENT
|
1687 |
+
// extra formula
|
1688 |
+
| general_text
|
1689 |
+
{$$ = $1;}
|
1690 |
+
// extra formula
|
1691 |
+
| "'"
|
1692 |
+
{$$ = $1;}
|
1693 |
+
// extra formula
|
1694 |
+
| UNSIGNED
|
1695 |
+
{$$ = $1;}
|
1696 |
+
// extra formula
|
1697 |
+
| PITCH
|
1698 |
+
{$$ = $1;}
|
1699 |
+
| UNKNOWN_CHAR
|
1700 |
+
{$$ = $1;}
|
1701 |
+
;
|
1702 |
+
|
1703 |
+
pitch_as_music
|
1704 |
+
: pitch_or_music
|
1705 |
+
{$$ = $1;}
|
1706 |
+
;
|
1707 |
+
|
1708 |
+
music_assign
|
1709 |
+
: simple_music
|
1710 |
+
{$$ = $1;}
|
1711 |
+
| composite_music
|
1712 |
+
{$$ = $1;}
|
1713 |
+
;
|
1714 |
+
|
1715 |
+
simple_music
|
1716 |
+
: event_chord
|
1717 |
+
{$$ = $1;}
|
1718 |
+
| music_property_def
|
1719 |
+
{$$ = $1;}
|
1720 |
+
| context_change
|
1721 |
+
{$$ = $1;}
|
1722 |
+
// extra formula
|
1723 |
+
| variable_command
|
1724 |
+
{$$ = $1;}
|
1725 |
+
// extra formula
|
1726 |
+
| COMMAND full_markup
|
1727 |
+
{$$ = command($1, $2);}
|
1728 |
+
;
|
1729 |
+
|
1730 |
+
context_change
|
1731 |
+
: CHANGE symbol '=' simple_string
|
1732 |
+
{$$ = command($1, assignment($2, $4));}
|
1733 |
+
;
|
1734 |
+
|
1735 |
+
music_property_def
|
1736 |
+
: OVERRIDE grob_prop_path '=' scalar
|
1737 |
+
{$$ = command($1, assignment($2, $4));}
|
1738 |
+
// extra formula
|
1739 |
+
| OVERRIDEPROPERTY grob_prop_spec scm_identifier
|
1740 |
+
{$$ = command($1, $2, $3);}
|
1741 |
+
//| REVERT simple_revert_context revert_arg
|
1742 |
+
// {$$ = command($1, $2, $3);}
|
1743 |
+
| REVERT revert_arg
|
1744 |
+
{$$ = command($1, $2);}
|
1745 |
+
| SET context_prop_spec '=' scalar
|
1746 |
+
{$$ = command($1, assignment($2, $4));}
|
1747 |
+
| UNSET context_prop_spec
|
1748 |
+
{$$ = command($1, $2);}
|
1749 |
+
;
|
1750 |
+
|
1751 |
+
revert_arg
|
1752 |
+
//: revert_arg_backup BACKUP symbol_list_arg
|
1753 |
+
: revert_arg_backup
|
1754 |
+
{$$ = $1;}
|
1755 |
+
// extra formula
|
1756 |
+
| revert_arg_backup symbol_list_arg
|
1757 |
+
{$$ = [$1, $2];}
|
1758 |
+
;
|
1759 |
+
|
1760 |
+
revert_arg_backup
|
1761 |
+
: revert_arg_part
|
1762 |
+
{$$ = $1;}
|
1763 |
+
;
|
1764 |
+
|
1765 |
+
revert_arg_part
|
1766 |
+
: symbol_list_part
|
1767 |
+
{$$ = $1;}
|
1768 |
+
| revert_arg_backup '.' symbol_list_part
|
1769 |
+
{$$ = $1 + "." + $3;}
|
1770 |
+
//| revert_arg_backup BACKUP SCM_ARG '.' symbol_list_part
|
1771 |
+
//| revert_arg_backup BACKUP SCM_ARG ',' symbol_list_part
|
1772 |
+
//| revert_arg_backup BACKUP SCM_ARG symbol_list_part
|
1773 |
+
;
|
1774 |
+
|
1775 |
+
symbol_list_arg
|
1776 |
+
: SYMBOL_LIST
|
1777 |
+
{$$ = $1;}
|
1778 |
+
| SYMBOL_LIST '.' symbol_list_rev
|
1779 |
+
{$$ = $1.toString() + $2 + $3.toString();}
|
1780 |
+
| SYMBOL_LIST ',' symbol_list_rev
|
1781 |
+
{$$ = $1.toString() + $2 + $3.toString();}
|
1782 |
+
;
|
1783 |
+
|
1784 |
+
// extra syntax
|
1785 |
+
SYMBOL_LIST
|
1786 |
+
: symbol_list_part
|
1787 |
+
{$$ = $1;}
|
1788 |
+
;
|
1789 |
+
|
1790 |
+
simple_revert_context
|
1791 |
+
: symbol_list_part
|
1792 |
+
{$$ = $1;}
|
1793 |
+
;
|
1794 |
+
|
1795 |
+
grob_prop_path
|
1796 |
+
: grob_prop_spec
|
1797 |
+
{$$ = [$1];}
|
1798 |
+
| grob_prop_spec property_path
|
1799 |
+
{$$ = [$1, $2];}
|
1800 |
+
;
|
1801 |
+
|
1802 |
+
grob_prop_spec
|
1803 |
+
: symbol_list_rev
|
1804 |
+
{$$ = $1;}
|
1805 |
+
;
|
1806 |
+
|
1807 |
+
context_prop_spec
|
1808 |
+
: symbol_list_rev
|
1809 |
+
{$$ = $1;}
|
1810 |
+
;
|
1811 |
+
|
1812 |
+
event_chord
|
1813 |
+
: note_chord_element
|
1814 |
+
{$$ = $1;}
|
1815 |
+
| tempo_event
|
1816 |
+
{$$ = $1;}
|
1817 |
+
| simple_element post_events
|
1818 |
+
{$$ = rest({...$1, post_events: $2, locations: [@1, @2]});}
|
1819 |
+
//| CHORD_REPETITION optional_notemode_duration post_events
|
1820 |
+
//| MULTI_MEASURE_REST optional_notemode_duration post_events
|
1821 |
+
;
|
1822 |
+
|
1823 |
+
tempo_event
|
1824 |
+
: TEMPO steno_duration '=' tempo_range
|
1825 |
+
//{$$ = {tempo: $4, unit: $2};}
|
1826 |
+
{$$ = tempo($4, $2);}
|
1827 |
+
| TEMPO text steno_duration '=' tempo_range
|
1828 |
+
//{$$ = {tempo: $5, unit: $3, text: $2};}
|
1829 |
+
{$$ = tempo($5, $3, $2);}
|
1830 |
+
| TEMPO text
|
1831 |
+
{$$ = tempo(undefined, undefined, $2);}
|
1832 |
+
| TEMPO CMD_TEMPOLEGEND
|
1833 |
+
{$$ = tempo(undefined, undefined, $2);}
|
1834 |
+
;
|
1835 |
+
|
1836 |
+
tempo_range
|
1837 |
+
: unsigned_number
|
1838 |
+
{$$ = $1;}
|
1839 |
+
| unsigned_number '-' unsigned_number
|
1840 |
+
{$$ = {from: $1, to: $2};}
|
1841 |
+
;
|
1842 |
+
|
1843 |
+
simple_element
|
1844 |
+
//: DRUM_PITCH optional_notemode_duration
|
1845 |
+
: RESTNAME optional_notemode_duration
|
1846 |
+
{$$ = {name: $1, duration: $2};}
|
1847 |
+
;
|
1848 |
+
|
1849 |
+
optional_notemode_duration
|
1850 |
+
: %empty
|
1851 |
+
{$$ = null;}
|
1852 |
+
| duration
|
1853 |
+
{$$ = $1;}
|
1854 |
+
;
|
1855 |
+
|
1856 |
+
duration
|
1857 |
+
: steno_duration multipliers
|
1858 |
+
//{$$ = $1 + $2;}
|
1859 |
+
{$$ = duration({...$1, multipliers: $2});}
|
1860 |
+
;
|
1861 |
+
|
1862 |
+
steno_duration
|
1863 |
+
: unsigned_number dots
|
1864 |
+
//{$$ = $1 + $2;}
|
1865 |
+
{$$ = duration({number: $1, dots: $2.length});}
|
1866 |
+
| DURATION_IDENTIFIER dots
|
1867 |
+
{$$ = duration({number: $1, dots: $2.length});}
|
1868 |
+
;
|
1869 |
+
|
1870 |
+
DURATION_IDENTIFIER
|
1871 |
+
: CMD_BREVE
|
1872 |
+
{$$ = $1;}
|
1873 |
+
| CMD_LONGA
|
1874 |
+
{$$ = $1;}
|
1875 |
+
;
|
1876 |
+
|
1877 |
+
dots
|
1878 |
+
: %empty
|
1879 |
+
{$$ = "";}
|
1880 |
+
| dots dot
|
1881 |
+
{$$ = $1 + $2;}
|
1882 |
+
;
|
1883 |
+
|
1884 |
+
multipliers
|
1885 |
+
: %empty
|
1886 |
+
{$$ = [];}
|
1887 |
+
| multipliers '*' unsigned_number
|
1888 |
+
{$$ = [...$1, $3];}
|
1889 |
+
| multipliers '*' FRACTION
|
1890 |
+
{$$ = [...$1, $3];}
|
1891 |
+
//| multipliers '*' multiplier_scm
|
1892 |
+
;
|
1893 |
+
|
1894 |
+
repeated_music
|
1895 |
+
: REPEAT simple_string unsigned_number music
|
1896 |
+
{$$ = command($1, $2, $3, $4);}
|
1897 |
+
| REPEAT simple_string unsigned_number music ALTERNATIVE braced_music_list
|
1898 |
+
{$$ = command($1, $2, $3, $4, command($5, $6));}
|
1899 |
+
;
|
1900 |
+
|
1901 |
+
unsigned_number
|
1902 |
+
: UNSIGNED
|
1903 |
+
{$$ = $1;}
|
1904 |
+
//| POST_UNSIGNED
|
1905 |
+
// {$$ = $1;}
|
1906 |
+
//| NUMBER_IDENTIFIER
|
1907 |
+
//| embedded_scm
|
1908 |
+
;
|
1909 |
+
|
1910 |
+
simple_string
|
1911 |
+
: literal_string
|
1912 |
+
{$$ = $1;}
|
1913 |
+
| SYMBOL
|
1914 |
+
{$$ = $1;}
|
1915 |
+
;
|
1916 |
+
|
1917 |
+
// all kinds commands in music list, seems named as MUSIC_IDENTIFIER in lilypond's parser.yy
|
1918 |
+
music_identifier
|
1919 |
+
: zero_command
|
1920 |
+
{$$ = $1;}
|
1921 |
+
| CMD_CLEF string
|
1922 |
+
{$$ = command($1, $2);}
|
1923 |
+
| CMD_TIME FRACTION
|
1924 |
+
{$$ = command($1, $2);}
|
1925 |
+
| CMD_BAR string
|
1926 |
+
{$$ = command($1, $2);}
|
1927 |
+
| CMD_OMIT property_path
|
1928 |
+
{$$ = command($1, $2);}
|
1929 |
+
| CMD_OTTAVA property_path
|
1930 |
+
{$$ = command($1, $2);}
|
1931 |
+
| CMD_BARNUMBERCHECK scm_identifier
|
1932 |
+
{$$ = command($1, $2);}
|
1933 |
+
| CMD_BARNUMBERCHECK unsigned_number
|
1934 |
+
{$$ = command($1, $2);}
|
1935 |
+
| CMD_MARK full_markup
|
1936 |
+
{$$ = command($1, $2);}
|
1937 |
+
// TODO:
|
1938 |
+
| CMD_INCLUDE string
|
1939 |
+
{$$ = command($1, $2);}
|
1940 |
+
| CMD_SKIP duration
|
1941 |
+
{$$ = command($1, $2);}
|
1942 |
+
//| CMD_PARENTHESIZE property_path
|
1943 |
+
// {$$ = command($1, $2);}
|
1944 |
+
| CMD_UNFOLDREPEATS music
|
1945 |
+
{$$ = command($1, $2);}
|
1946 |
+
| CMD_GRACE music
|
1947 |
+
{$$ = command($1, $2);}
|
1948 |
+
| CMD_ACCIACCATURA music
|
1949 |
+
{$$ = command($1, $2);}
|
1950 |
+
| CMD_APPOGGIATURA music
|
1951 |
+
{$$ = command($1, $2);}
|
1952 |
+
| CMD_SLASHEDGRACE music
|
1953 |
+
{$$ = command($1, $2);}
|
1954 |
+
| CMD_LANGUAGE string
|
1955 |
+
{$$ = command($1, $2);}
|
1956 |
+
| CMD_ONCE music_assign
|
1957 |
+
{$$ = command($1, $2);}
|
1958 |
+
| CMD_PARTIAL duration
|
1959 |
+
{$$ = command($1, $2);}
|
1960 |
+
| CMD_TUPLETSPAN duration
|
1961 |
+
{$$ = command($1, $2);}
|
1962 |
+
| CMD_TUPLETSPAN DEFAULT
|
1963 |
+
{$$ = command($1, $2);}
|
1964 |
+
| CMD_TUPLET FRACTION music
|
1965 |
+
{$$ = command($1, $2, $3);}
|
1966 |
+
| CMD_TUPLET FRACTION duration music
|
1967 |
+
{$$ = command($1, $2, $3, $4);}
|
1968 |
+
| CMD_TWEAK property_path scalar
|
1969 |
+
{$$ = command($1, $2, $3);}
|
1970 |
+
| CMD_KEY PITCH COMMAND
|
1971 |
+
{$$ = command($1, $2, $3);}
|
1972 |
+
| CMD_TIMES FRACTION music
|
1973 |
+
{$$ = command($1, $2, $3);}
|
1974 |
+
| CMD_AFTERGRACE music music
|
1975 |
+
{$$ = command($1, $2, $3);}
|
1976 |
+
| CMD_PARALLELMUSIC scm_identifier composite_music
|
1977 |
+
{$$ = command($1, $2, $3);}
|
1978 |
+
| CMD_SHAPE scm_identifier symbol
|
1979 |
+
{$$ = command($1, $2, $3);}
|
1980 |
+
| CMD_ACCIDENTALSTYLE grob_prop_spec
|
1981 |
+
{$$ = command($1, $2);}
|
1982 |
+
| CMD_NUMERICTIMESIGNATURE music_identifier
|
1983 |
+
{$$ = command($1, $2);}
|
1984 |
+
| CMD_DEFAULTTIMESIGNATURE
|
1985 |
+
{$$ = command($1);}
|
1986 |
+
| CMD_BENDAFTER scm_identifier
|
1987 |
+
{$$ = command($1, $2);}
|
1988 |
+
| CMD_COMPOUNDMETER scm_identifier
|
1989 |
+
{$$ = command($1, $2);}
|
1990 |
+
| CMD_TRANSPOSITION pitch
|
1991 |
+
{$$ = command($1, chordElem($2, {locations: [@2, @2]}));}
|
1992 |
+
| CMD_ABSOLUTE music
|
1993 |
+
{$$ = command($1, $2);}
|
1994 |
+
| CMD_HIDE symbol
|
1995 |
+
{$$ = command($1, $2);}
|
1996 |
+
| CMD_CROSSSTAFF composite_music
|
1997 |
+
{$$ = command($1, $2);}
|
1998 |
+
| CMD_KEEPWITHTAG symbol
|
1999 |
+
{$$ = command($1, $2);}
|
2000 |
+
| CMD_TAG symbol composite_music
|
2001 |
+
{$$ = command($1, $2, $3);}
|
2002 |
+
| CMD_SCALEDURATIONS FRACTION composite_music
|
2003 |
+
{$$ = command($1, $2, $3);}
|
2004 |
+
| CMD_TUPLETNEUTRAL music
|
2005 |
+
{$$ = command($1, $2);}
|
2006 |
+
| CMD_ARTICULATE music
|
2007 |
+
{$$ = command($1, $2);}
|
2008 |
+
| markup_font_size music
|
2009 |
+
{$$ = command($1, $2);}
|
2010 |
+
| pitch_mode_music
|
2011 |
+
{$$ = $1;}
|
2012 |
+
| "("
|
2013 |
+
{$$ = $1;}
|
2014 |
+
| ")"
|
2015 |
+
{$$ = $1;}
|
2016 |
+
| "["
|
2017 |
+
{$$ = $1;}
|
2018 |
+
| "]"
|
2019 |
+
{$$ = $1;}
|
2020 |
+
| DIVIDE
|
2021 |
+
{$$ = {proto: "Divide"};}
|
2022 |
+
| expressive_mark
|
2023 |
+
{$$ = $1;}
|
2024 |
+
;
|
2025 |
+
|
2026 |
+
// extra syntax
|
2027 |
+
zero_command
|
2028 |
+
: CMD_FERMATA
|
2029 |
+
{$$ = command($1);}
|
2030 |
+
| CMD_STEMUP
|
2031 |
+
{$$ = command($1);}
|
2032 |
+
| CMD_STEMDOWN
|
2033 |
+
{$$ = command($1);}
|
2034 |
+
| CMD_STEMNEUTRAL
|
2035 |
+
{$$ = command($1);}
|
2036 |
+
| CMD_MERGEDIFFERENTLYDOTTEDON
|
2037 |
+
{$$ = command($1);}
|
2038 |
+
| CMD_MERGEDIFFERENTLYHEADEDON
|
2039 |
+
{$$ = command($1);}
|
2040 |
+
| CMD_VOICE_NUMBER
|
2041 |
+
{$$ = command($1);}
|
2042 |
+
| CMD_SCORE
|
2043 |
+
{$$ = command($1);}
|
2044 |
+
| CMD_VOICE
|
2045 |
+
{$$ = command($1);}
|
2046 |
+
| CMD_STAFF
|
2047 |
+
{$$ = command($1);}
|
2048 |
+
| CMD_PIANOSTAFF
|
2049 |
+
{$$ = command($1);}
|
2050 |
+
| CMD_ARPEGGIO
|
2051 |
+
{$$ = command($1);}
|
2052 |
+
| CMD_ARPEGGIOARROWDOWN
|
2053 |
+
{$$ = command($1);}
|
2054 |
+
| CMD_ARPEGGIOARROWUP
|
2055 |
+
{$$ = command($1);}
|
2056 |
+
| CMD_ARPEGGIONORMAL
|
2057 |
+
{$$ = command($1);}
|
2058 |
+
| CMD_ARPEGGIOBRACKET
|
2059 |
+
{$$ = command($1);}
|
2060 |
+
| CMD_ARPEGGIOPARENTHESIS
|
2061 |
+
{$$ = command($1);}
|
2062 |
+
| CMD_ARPEGGIOPARENTHESISDASHED
|
2063 |
+
{$$ = command($1);}
|
2064 |
+
| CMD_GLISSANDO
|
2065 |
+
{$$ = command($1);}
|
2066 |
+
| CMD_MORDENT
|
2067 |
+
{$$ = command($1);}
|
2068 |
+
| CMD_POWERCHORDS
|
2069 |
+
{$$ = command($1);}
|
2070 |
+
| CMD_PRALL
|
2071 |
+
{$$ = command($1);}
|
2072 |
+
//| CMD_SUSTAINOFF
|
2073 |
+
// {$$ = command($1);}
|
2074 |
+
//| CMD_SUSTAINON
|
2075 |
+
// {$$ = command($1);}
|
2076 |
+
| CMD_TRILL
|
2077 |
+
{$$ = command($1);}
|
2078 |
+
| CMD_TURN
|
2079 |
+
{$$ = command($1);}
|
2080 |
+
| CMD_POINTANDCLICKOFF
|
2081 |
+
{$$ = command($1);}
|
2082 |
+
| CMD_UPBOW
|
2083 |
+
{$$ = command($1);}
|
2084 |
+
| CMD_DOWNBOW
|
2085 |
+
{$$ = command($1);}
|
2086 |
+
| CMD_BREATHE
|
2087 |
+
{$$ = command($1);}
|
2088 |
+
| CMD_STARTTEXTSPAN
|
2089 |
+
{$$ = command($1);}
|
2090 |
+
| CMD_STOPTEXTSPAN
|
2091 |
+
{$$ = command($1);}
|
2092 |
+
| CMD_FLAGEOLET
|
2093 |
+
{$$ = command($1);}
|
2094 |
+
| CMD_SLURDASHED
|
2095 |
+
{$$ = command($1);}
|
2096 |
+
| CMD_SLURSOLID
|
2097 |
+
{$$ = command($1);}
|
2098 |
+
| CMD_BREAK
|
2099 |
+
{$$ = command($1);}
|
2100 |
+
| CMD_PAGEBREAK
|
2101 |
+
{$$ = command($1);}
|
2102 |
+
| CMD_STARTTRILLSPAN
|
2103 |
+
{$$ = command($1);}
|
2104 |
+
| CMD_STOPTRILLSPAN
|
2105 |
+
{$$ = command($1);}
|
2106 |
+
| CMD_CADENZAON
|
2107 |
+
{$$ = command($1);}
|
2108 |
+
| CMD_CADENZAOFF
|
2109 |
+
{$$ = command($1);}
|
2110 |
+
| CMD_CRESC
|
2111 |
+
{$$ = command($1);}
|
2112 |
+
| CMD_CRESCTEXTCRESC
|
2113 |
+
{$$ = command($1);}
|
2114 |
+
| CMD_CRESCHAIRPIN
|
2115 |
+
{$$ = command($1);}
|
2116 |
+
| CMD_DIM
|
2117 |
+
{$$ = command($1);}
|
2118 |
+
| CMD_DIMTEXTDIM
|
2119 |
+
{$$ = command($1);}
|
2120 |
+
| CMD_DYNAMICUP
|
2121 |
+
{$$ = command($1);}
|
2122 |
+
| CMD_HIDENOTES
|
2123 |
+
{$$ = command($1);}
|
2124 |
+
| CMD_UNHIDENOTES
|
2125 |
+
{$$ = command($1);}
|
2126 |
+
| CMD_NEWSPACINGSECTION
|
2127 |
+
{$$ = command($1);}
|
2128 |
+
| CMD_NOBEAM
|
2129 |
+
{$$ = command($1);}
|
2130 |
+
| CMD_ONEVOICE
|
2131 |
+
{$$ = command($1);}
|
2132 |
+
| CMD_PHRASINGSLURDOWN
|
2133 |
+
{$$ = command($1);}
|
2134 |
+
| CMD_PHRASINGSLURNEUTRAL
|
2135 |
+
{$$ = command($1);}
|
2136 |
+
| CMD_PHRASINGSLURUP
|
2137 |
+
{$$ = command($1);}
|
2138 |
+
| CMD_SLURDOWN
|
2139 |
+
{$$ = command($1);}
|
2140 |
+
| CMD_SLURNEUTRAL
|
2141 |
+
{$$ = command($1);}
|
2142 |
+
| CMD_SLURUP
|
2143 |
+
{$$ = command($1);}
|
2144 |
+
| CMD_TIEDOWN
|
2145 |
+
{$$ = command($1);}
|
2146 |
+
| CMD_TIENEUTRAL
|
2147 |
+
{$$ = command($1);}
|
2148 |
+
| CMD_TIEUP
|
2149 |
+
{$$ = command($1);}
|
2150 |
+
| CMD_PARENTHESIZE
|
2151 |
+
{$$ = command($1);}
|
2152 |
+
| CMD_TUPLETUP
|
2153 |
+
{$$ = command($1);}
|
2154 |
+
| CMD_TUPLETDOWN
|
2155 |
+
{$$ = command($1);}
|
2156 |
+
| CMD_SHIFTON
|
2157 |
+
{$$ = command($1);}
|
2158 |
+
| CMD_REPEATTIE
|
2159 |
+
{$$ = command($1);}
|
2160 |
+
;
|
2161 |
+
|
2162 |
+
// extra syntax
|
2163 |
+
expressive_mark
|
2164 |
+
: CMD_CRESCENDO_BEGIN
|
2165 |
+
{$$ = $1;}
|
2166 |
+
| CMD_DECRESCENDO_BEGIN
|
2167 |
+
{$$ = $1;}
|
2168 |
+
| CMD_DYNAMICS_END
|
2169 |
+
{$$ = $1;}
|
2170 |
+
| CMD_FERMATA
|
2171 |
+
{$$ = $1;}
|
2172 |
+
| CMD_TWEAK property_path scalar
|
2173 |
+
{$$ = command($1, $2, $3);}
|
2174 |
+
| CMD_BENDAFTER scm_identifier
|
2175 |
+
{$$ = command($1, $2);}
|
2176 |
+
| CMD_DYNAMIC_MARKINGS
|
2177 |
+
{$$ = command($1);}
|
2178 |
+
| CMD_MARCATO
|
2179 |
+
{$$ = command($1);}
|
2180 |
+
| CMD_STOPPED
|
2181 |
+
{$$ = command($1);}
|
2182 |
+
| CMD_TENUTO
|
2183 |
+
{$$ = command($1);}
|
2184 |
+
| CMD_STACCATISSIMO
|
2185 |
+
{$$ = command($1);}
|
2186 |
+
| CMD_ACCENT
|
2187 |
+
{$$ = command($1);}
|
2188 |
+
| CMD_STACCATO
|
2189 |
+
{$$ = command($1);}
|
2190 |
+
| CMD_PORTATO
|
2191 |
+
{$$ = command($1);}
|
2192 |
+
| CMD_MORDENT
|
2193 |
+
{$$ = command($1);}
|
2194 |
+
| CMD_PRALL
|
2195 |
+
{$$ = command($1);}
|
2196 |
+
| CMD_TURN
|
2197 |
+
{$$ = command($1);}
|
2198 |
+
| CMD_ARPEGGIO
|
2199 |
+
{$$ = command($1);}
|
2200 |
+
| CMD_TRILL
|
2201 |
+
{$$ = command($1);}
|
2202 |
+
| CMD_STARTTRILLSPAN
|
2203 |
+
{$$ = command($1);}
|
2204 |
+
| CMD_STOPTRILLSPAN
|
2205 |
+
{$$ = command($1);}
|
2206 |
+
| "~"
|
2207 |
+
{$$ = $1;}
|
2208 |
+
| "("
|
2209 |
+
{$$ = $1;}
|
2210 |
+
| ")"
|
2211 |
+
{$$ = $1;}
|
2212 |
+
| "\("
|
2213 |
+
{$$ = $1;}
|
2214 |
+
| "\)"
|
2215 |
+
{$$ = $1;}
|
2216 |
+
;
|
2217 |
+
|
2218 |
+
// extra syntax
|
2219 |
+
pitch_mode_music
|
2220 |
+
: CMD_RELATIVE pitch music
|
2221 |
+
{$$ = command($1, chordElem($2, {locations: [@2, @2]}), $3);}
|
2222 |
+
| CMD_RELATIVE music
|
2223 |
+
{$$ = command($1, $2);}
|
2224 |
+
;
|
2225 |
+
|
2226 |
+
pitch_or_music
|
2227 |
+
//: pitch exclamations questions octave_check maybe_notemode_duration erroneous_quotes optional_rest post_events
|
2228 |
+
: pitch exclamations questions optional_notemode_duration optional_rest post_events
|
2229 |
+
{$$ = chord([chordElem($1, {locations: [@1, @1]})], $4, {exclamations: $2, questions: $3, rest: $5, post_events: $6, locations: [@1, @6]});}
|
2230 |
+
//| new_chord post_events
|
2231 |
+
// {$$ = briefChord($1, {post_events: $2});}
|
2232 |
+
;
|
2233 |
+
|
2234 |
+
new_chord
|
2235 |
+
//: steno_tonic_pitch maybe_notemode_duration
|
2236 |
+
: pitch optional_notemode_duration
|
2237 |
+
{$$ = {pitch: $1, duration: $2};}
|
2238 |
+
//| steno_tonic_pitch optional_notemode_duration chord_separator chord_items
|
2239 |
+
| pitch optional_notemode_duration chord_separator chord_items
|
2240 |
+
{$$ = {pitch: $1, duration: $2, separator: $3, items: $4};}
|
2241 |
+
;
|
2242 |
+
|
2243 |
+
chord_items
|
2244 |
+
: %empty
|
2245 |
+
{$$ = [];}
|
2246 |
+
| chord_items chord_item
|
2247 |
+
{$$ = $1.concat($2);}
|
2248 |
+
;
|
2249 |
+
|
2250 |
+
chord_item
|
2251 |
+
: chord_separator
|
2252 |
+
{$$ = $1;}
|
2253 |
+
| step_numbers
|
2254 |
+
{$$ = $1;}
|
2255 |
+
| CHORD_MODIFIER
|
2256 |
+
{$$ = $1;}
|
2257 |
+
;
|
2258 |
+
|
2259 |
+
// m, m7, dim, dim7, aug, maj, maj7
|
2260 |
+
CHORD_MODIFIER
|
2261 |
+
: CHORD_MODIFIER_WORD
|
2262 |
+
{$$ = $1;}
|
2263 |
+
//| CHORD_MODIFIER_WORD UNSIGNED
|
2264 |
+
// {$$ = $1 + $2;}
|
2265 |
+
;
|
2266 |
+
|
2267 |
+
step_numbers
|
2268 |
+
: step_number
|
2269 |
+
{$$ = $1;}
|
2270 |
+
| step_numbers dot step_number
|
2271 |
+
{$$ = $1 + $2 + $3;}
|
2272 |
+
;
|
2273 |
+
|
2274 |
+
step_number
|
2275 |
+
: UNSIGNED
|
2276 |
+
{$$ = $1;}
|
2277 |
+
| UNSIGNED '+'
|
2278 |
+
{$$ = $1 + $2;}
|
2279 |
+
| UNSIGNED CHORD_MINUS
|
2280 |
+
{$$ = $1 + $2;}
|
2281 |
+
;
|
2282 |
+
|
2283 |
+
maybe_notemode_duration
|
2284 |
+
: %empty
|
2285 |
+
{$$ = null;}
|
2286 |
+
| duration
|
2287 |
+
{$$ = $1;}
|
2288 |
+
;
|
2289 |
+
|
2290 |
+
steno_tonic_pitch
|
2291 |
+
: TONICNAME_PITCH quotes
|
2292 |
+
{$$ = $1 + $2;}
|
2293 |
+
;
|
2294 |
+
|
2295 |
+
CHORD_BASS
|
2296 |
+
: "/" "+"
|
2297 |
+
{$$ = $1 + $2;}
|
2298 |
+
;
|
2299 |
+
|
2300 |
+
CHORD_CARET
|
2301 |
+
: "^"
|
2302 |
+
{$$ = $1;}
|
2303 |
+
;
|
2304 |
+
|
2305 |
+
CHORD_COLON
|
2306 |
+
: ":"
|
2307 |
+
{$$ = $1;}
|
2308 |
+
;
|
2309 |
+
|
2310 |
+
CHORD_MINUS
|
2311 |
+
: "-"
|
2312 |
+
{$$ = $1;}
|
2313 |
+
;
|
2314 |
+
|
2315 |
+
CHORD_SLASH
|
2316 |
+
: "/"
|
2317 |
+
{$$ = $1;}
|
2318 |
+
;
|
2319 |
+
|
2320 |
+
chord_separator
|
2321 |
+
: CHORD_COLON
|
2322 |
+
{$$ = $1;}
|
2323 |
+
| CHORD_CARET
|
2324 |
+
{$$ = $1;}
|
2325 |
+
//| CHORD_SLASH steno_tonic_pitch
|
2326 |
+
| CHORD_SLASH pitch
|
2327 |
+
{$$ = $1 + $2;}
|
2328 |
+
//| CHORD_BASS steno_tonic_pitch
|
2329 |
+
| CHORD_BASS pitch
|
2330 |
+
{$$ = $1 + $2;}
|
2331 |
+
;
|
2332 |
+
|
2333 |
+
exclamations
|
2334 |
+
: %empty
|
2335 |
+
{$$ = [];}
|
2336 |
+
| exclamations '!'
|
2337 |
+
{$$ = $1.concat($2);}
|
2338 |
+
;
|
2339 |
+
|
2340 |
+
questions
|
2341 |
+
: %empty
|
2342 |
+
{$$ = [];}
|
2343 |
+
| questions '?'
|
2344 |
+
{$$ = $1.concat($2);}
|
2345 |
+
;
|
2346 |
+
|
2347 |
+
post_events
|
2348 |
+
: %empty
|
2349 |
+
{$$ = [];}
|
2350 |
+
| post_events post_event
|
2351 |
+
{$$ = $1.concat($2);}
|
2352 |
+
;
|
2353 |
+
|
2354 |
+
note_chord_element
|
2355 |
+
: chord_body optional_notemode_duration post_events
|
2356 |
+
{$$ = chord($1, $2, {withAngle: true, post_events: $3, locations: [@1, @2]});}
|
2357 |
+
;
|
2358 |
+
|
2359 |
+
chord_body
|
2360 |
+
: "<" chord_body_elements ">"
|
2361 |
+
{$$ = $2;}
|
2362 |
+
//| FIGURE_OPEN figure_list FIGURE_CLOSE
|
2363 |
+
;
|
2364 |
+
|
2365 |
+
chord_body_elements
|
2366 |
+
: %empty
|
2367 |
+
{$$ = [];}
|
2368 |
+
| chord_body_elements chord_body_element
|
2369 |
+
{$$ = $1.concat([$2]);}
|
2370 |
+
;
|
2371 |
+
|
2372 |
+
chord_body_element
|
2373 |
+
//: pitch_or_tonic_pitch exclamations questions octave_check post_events %prec ':'
|
2374 |
+
: pitch_or_tonic_pitch exclamations questions post_events
|
2375 |
+
//{$$ = $1 + $2 + $3 + $4;}
|
2376 |
+
{$$ = chordElem($1, {locations: [@1, @4], exclamations: $2, questions: $3, post_events: $4});}
|
2377 |
+
//| DRUM_PITCH post_events %prec ':'
|
2378 |
+
| music_function_chord_body
|
2379 |
+
{$$ = $1;}
|
2380 |
+
//| post_event
|
2381 |
+
;
|
2382 |
+
|
2383 |
+
music_function_chord_body
|
2384 |
+
//: music_function_call
|
2385 |
+
//| MUSIC_IDENTIFIER
|
2386 |
+
//| embedded_scm
|
2387 |
+
: music_identifier
|
2388 |
+
{$$ = $1;}
|
2389 |
+
;
|
2390 |
+
|
2391 |
+
pitch_or_tonic_pitch
|
2392 |
+
: pitch
|
2393 |
+
{$$ = $1;}
|
2394 |
+
//| steno_tonic_pitch
|
2395 |
+
;
|
2396 |
+
|
2397 |
+
/*// extra syntax
|
2398 |
+
pitches
|
2399 |
+
: pitches pitch
|
2400 |
+
{$$ = $1.concat([$2]);}
|
2401 |
+
| pitch
|
2402 |
+
{$$ = [$1];}
|
2403 |
+
;*/
|
2404 |
+
|
2405 |
+
pitch
|
2406 |
+
: PITCH quotes
|
2407 |
+
{$$ = $1 + $2;}
|
2408 |
+
//| steno_pitch
|
2409 |
+
// extra formula
|
2410 |
+
//| PLACEHOLDER_PITCH
|
2411 |
+
// {$$ = $1;}
|
2412 |
+
;
|
2413 |
+
|
2414 |
+
quotes
|
2415 |
+
: %empty
|
2416 |
+
{$$ = "";}
|
2417 |
+
| sub_quotes
|
2418 |
+
{$$ = $1;}
|
2419 |
+
| sup_quotes
|
2420 |
+
{$$ = $1;}
|
2421 |
+
;
|
2422 |
+
|
2423 |
+
sup_quotes
|
2424 |
+
: "'"
|
2425 |
+
{$$ = $1;}
|
2426 |
+
| sup_quotes "'"
|
2427 |
+
{$$ = $1 + $2;}
|
2428 |
+
;
|
2429 |
+
|
2430 |
+
sub_quotes
|
2431 |
+
: ","
|
2432 |
+
{$$ = $1;}
|
2433 |
+
| sub_quotes ","
|
2434 |
+
{$$ = $1 + $2;}
|
2435 |
+
;
|
2436 |
+
|
2437 |
+
post_event
|
2438 |
+
: post_event_nofinger
|
2439 |
+
{$$ = $1;}
|
2440 |
+
| '-' fingering
|
2441 |
+
//{$$ = {type: "fingering", direction: "middle", value: $2};}
|
2442 |
+
{$$ = postEvent("middle", fingering($2));}
|
2443 |
+
;
|
2444 |
+
|
2445 |
+
HYPHEN
|
2446 |
+
: PRE_HYPHEN "-"
|
2447 |
+
{$$ = "--";}
|
2448 |
+
| PRE_HYPHEN PRE_HYPHEN
|
2449 |
+
{$$ = "--";}
|
2450 |
+
;
|
2451 |
+
|
2452 |
+
EXTENDER
|
2453 |
+
: PRE_EXTENDER "_"
|
2454 |
+
{$$ = "__";}
|
2455 |
+
| PRE_EXTENDER PRE_EXTENDER
|
2456 |
+
{$$ = "__";}
|
2457 |
+
;
|
2458 |
+
|
2459 |
+
post_event_nofinger
|
2460 |
+
: '^' fingering
|
2461 |
+
//{$$ = {direction: "up", fingering: $2};}
|
2462 |
+
{$$ = postEvent("up", fingering($2));}
|
2463 |
+
| '_' fingering
|
2464 |
+
//{$$ = {direction: "down", fingering: $2};}
|
2465 |
+
{$$ = postEvent("down", fingering($2));}
|
2466 |
+
| direction_less_event
|
2467 |
+
{$$ = $1;}
|
2468 |
+
| script_dir music_function_call
|
2469 |
+
{$$ = postEvent($1, $2);}
|
2470 |
+
| HYPHEN
|
2471 |
+
{$$ = $1;}
|
2472 |
+
| EXTENDER
|
2473 |
+
{$$ = $1;}
|
2474 |
+
| script_dir direction_reqd_event
|
2475 |
+
{$$ = postEvent($1, $2);}
|
2476 |
+
| script_dir direction_less_event
|
2477 |
+
{$$ = postEvent($1, $2);}
|
2478 |
+
// extra formula
|
2479 |
+
| script_dir zero_command
|
2480 |
+
{$$ = postEvent($1, $2);}
|
2481 |
+
// extra formula
|
2482 |
+
| script_dir expressive_mark
|
2483 |
+
{$$ = postEvent($1, $2);}
|
2484 |
+
// extra formula
|
2485 |
+
| expressive_mark
|
2486 |
+
{$$ = postEvent(null, $1);}
|
2487 |
+
// extra formula
|
2488 |
+
| CMD_SUSTAINOFF
|
2489 |
+
{$$ = postEvent(null, $1);}
|
2490 |
+
// extra formula
|
2491 |
+
| CMD_SUSTAINON
|
2492 |
+
{$$ = postEvent(null, $1);}
|
2493 |
+
// extra formula
|
2494 |
+
| "["
|
2495 |
+
{$$ = $1;}
|
2496 |
+
// extra formula
|
2497 |
+
| "]"
|
2498 |
+
{$$ = $1;}
|
2499 |
+
// extra formula
|
2500 |
+
| script_dir "["
|
2501 |
+
{$$ = postEvent($1, $2);}
|
2502 |
+
// extra formula
|
2503 |
+
| script_dir "]"
|
2504 |
+
{$$ = postEvent($1, $2);}
|
2505 |
+
// extra formula
|
2506 |
+
| "("
|
2507 |
+
{$$ = $1;}
|
2508 |
+
// extra formula
|
2509 |
+
| ")"
|
2510 |
+
{$$ = $1;}
|
2511 |
+
// extra formula
|
2512 |
+
| script_dir variable_command
|
2513 |
+
{$$ = postEvent($1, $2);}
|
2514 |
+
;
|
2515 |
+
|
2516 |
+
direction_reqd_event
|
2517 |
+
: gen_text_def
|
2518 |
+
{$$ = $1;}
|
2519 |
+
| script_abbreviation
|
2520 |
+
{$$ = $1;}
|
2521 |
+
;
|
2522 |
+
|
2523 |
+
gen_text_def
|
2524 |
+
: full_markup
|
2525 |
+
{$$ = $1;}
|
2526 |
+
| literal_string
|
2527 |
+
{$$ = $1;}
|
2528 |
+
| SYMBOL
|
2529 |
+
{$$ = $1;}
|
2530 |
+
| embedded_scm
|
2531 |
+
{$$ = $1;}
|
2532 |
+
;
|
2533 |
+
|
2534 |
+
script_abbreviation
|
2535 |
+
: '^'
|
2536 |
+
{$$ = $1;}
|
2537 |
+
| '+'
|
2538 |
+
{$$ = $1;}
|
2539 |
+
| '-'
|
2540 |
+
{$$ = $1;}
|
2541 |
+
| '!'
|
2542 |
+
{$$ = $1;}
|
2543 |
+
| '>'
|
2544 |
+
{$$ = $1;}
|
2545 |
+
| dot
|
2546 |
+
{$$ = $1;}
|
2547 |
+
| '_'
|
2548 |
+
{$$ = $1;}
|
2549 |
+
;
|
2550 |
+
|
2551 |
+
direction_less_event
|
2552 |
+
: string_number_event
|
2553 |
+
{$$ = $1;}
|
2554 |
+
//| EVENT_IDENTIFIER
|
2555 |
+
| tremolo_type
|
2556 |
+
{$$ = $1;}
|
2557 |
+
| event_function_event
|
2558 |
+
{$$ = $1;}
|
2559 |
+
;
|
2560 |
+
|
2561 |
+
string_number_event
|
2562 |
+
: E_UNSIGNED
|
2563 |
+
{$$ = $1;}
|
2564 |
+
;
|
2565 |
+
|
2566 |
+
tremolo_type
|
2567 |
+
: ':'
|
2568 |
+
{$$ = ":";}
|
2569 |
+
| ':' UNSIGNED
|
2570 |
+
{$$ = ":" + $2;}
|
2571 |
+
;
|
2572 |
+
|
2573 |
+
event_function_event
|
2574 |
+
: EVENT_FUNCTION function_arglist
|
2575 |
+
;
|
2576 |
+
|
2577 |
+
music_function_call
|
2578 |
+
: MUSIC_FUNCTION function_arglist
|
2579 |
+
;
|
2580 |
+
|
2581 |
+
script_dir
|
2582 |
+
: "_"
|
2583 |
+
{$$ = "down";}
|
2584 |
+
| "^"
|
2585 |
+
{$$ = "up";}
|
2586 |
+
| "-"
|
2587 |
+
{$$ = "middle";}
|
2588 |
+
;
|
2589 |
+
|
2590 |
+
fingering
|
2591 |
+
: UNSIGNED
|
2592 |
+
{$$ = $1;}
|
2593 |
+
;
|
2594 |
+
|
2595 |
+
full_markup
|
2596 |
+
: markup_mode markup_top
|
2597 |
+
{$$ = command($1, ...$2);}
|
2598 |
+
| markup_mode_word
|
2599 |
+
{$$ = $1;}
|
2600 |
+
;
|
2601 |
+
|
2602 |
+
markup_mode
|
2603 |
+
: MARKUP
|
2604 |
+
{$$ = $1;}
|
2605 |
+
;
|
2606 |
+
|
2607 |
+
markup_top
|
2608 |
+
: markup_list
|
2609 |
+
{$$ = $1;}
|
2610 |
+
| markup_head_1_list simple_markup
|
2611 |
+
//{$$ = {head: $1, body: $2};}
|
2612 |
+
{$$ = $1.concat([$2]);}
|
2613 |
+
| simple_markup_noword
|
2614 |
+
{$$ = [$1];}
|
2615 |
+
;
|
2616 |
+
|
2617 |
+
markup_mode_word
|
2618 |
+
: markup_mode markup_word
|
2619 |
+
{$$ = command($1, $2);}
|
2620 |
+
;
|
2621 |
+
|
2622 |
+
output_def
|
2623 |
+
: output_def_body '}'
|
2624 |
+
{$$ = $1;}
|
2625 |
+
;
|
2626 |
+
|
2627 |
+
output_def_body
|
2628 |
+
: output_def_head_with_mode_switch '{'
|
2629 |
+
{$$ = block("score", $1);}
|
2630 |
+
| output_def_body assignment
|
2631 |
+
{
|
2632 |
+
$1.body.push($2);
|
2633 |
+
$$ = $1;
|
2634 |
+
}
|
2635 |
+
| output_def_body music_or_context_def
|
2636 |
+
{
|
2637 |
+
$1.body.push($2);
|
2638 |
+
$$ = $1;
|
2639 |
+
}
|
2640 |
+
| output_def_body scm_identifier
|
2641 |
+
{
|
2642 |
+
$1.body.push($2);
|
2643 |
+
$$ = $1;
|
2644 |
+
}
|
2645 |
+
//| output_def_body embedded_scm_active
|
2646 |
+
//| output_def_body SCM_TOKEN
|
2647 |
+
//| output_def_body error
|
2648 |
+
;
|
2649 |
+
|
2650 |
+
output_def_head_with_mode_switch
|
2651 |
+
: output_def_head
|
2652 |
+
{$$ = $1;}
|
2653 |
+
;
|
2654 |
+
|
2655 |
+
output_def_head
|
2656 |
+
: PAPER
|
2657 |
+
{$$ = $1;}
|
2658 |
+
| MIDI
|
2659 |
+
{$$ = $1;}
|
2660 |
+
| LAYOUT
|
2661 |
+
{$$ = $1;}
|
2662 |
+
;
|
2663 |
+
|
2664 |
+
music_or_context_def
|
2665 |
+
: music_assign
|
2666 |
+
{$$ = $1;}
|
2667 |
+
| context_def_spec_block
|
2668 |
+
{$$ = $1;}
|
2669 |
+
;
|
2670 |
+
|
2671 |
+
context_def_spec_block
|
2672 |
+
: CONTEXT '{' context_def_spec_body '}'
|
2673 |
+
{$$ = block("context", $1, $3);}
|
2674 |
+
;
|
2675 |
+
|
2676 |
+
context_def_spec_body
|
2677 |
+
: %empty
|
2678 |
+
{$$ = [];}
|
2679 |
+
| context_def_spec_body context_mod
|
2680 |
+
{$$ = $1.concat([$2]);}
|
2681 |
+
| context_def_spec_body context_modification
|
2682 |
+
{$$ = $1.concat([$2]);}
|
2683 |
+
| context_def_spec_body context_mod_arg
|
2684 |
+
{$$ = $1.concat([$2]);}
|
2685 |
+
;
|
2686 |
+
|
2687 |
+
context_mod_arg
|
2688 |
+
: embedded_scm
|
2689 |
+
{$$ = $1;}
|
2690 |
+
| composite_music
|
2691 |
+
{$$ = $1;}
|
2692 |
+
;
|
2693 |
+
|
2694 |
+
context_modification
|
2695 |
+
: WITH '{' context_mod_list '}'
|
2696 |
+
{$$ = command($1, inlineBlock($3));}
|
2697 |
+
| WITH context_modification_arg
|
2698 |
+
{$$ = command($1, $2);}
|
2699 |
+
;
|
2700 |
+
|
2701 |
+
context_modification_arg
|
2702 |
+
: embedded_scm
|
2703 |
+
{$$ = $1;}
|
2704 |
+
//| MUSIC_IDENTIFIER
|
2705 |
+
| music_identifier
|
2706 |
+
{$$ = $1;}
|
2707 |
+
;
|
2708 |
+
|
2709 |
+
context_mod_list
|
2710 |
+
: %empty
|
2711 |
+
{$$ = [];}
|
2712 |
+
| context_mod_list context_mod
|
2713 |
+
{$$ = $1.concat($2);}
|
2714 |
+
| context_mod_list context_mod_arg
|
2715 |
+
{$$ = $1.concat($2);}
|
2716 |
+
;
|
2717 |
+
|
2718 |
+
context_mod
|
2719 |
+
: property_operation
|
2720 |
+
{$$ = $1;}
|
2721 |
+
//| context_def_mod SYMBOL
|
2722 |
+
| context_def_mod symbol
|
2723 |
+
{$$ = command($1, $2);}
|
2724 |
+
//| context_def_mod embedded_scm
|
2725 |
+
;
|
2726 |
+
|
2727 |
+
property_operation
|
2728 |
+
: symbol '=' scalar
|
2729 |
+
{$$ = assignment($1, $3);}
|
2730 |
+
| UNSET symbol
|
2731 |
+
{$$ = command($1, $2);}
|
2732 |
+
| OVERRIDE revert_arg '=' scalar
|
2733 |
+
{$$ = command($1, assignment($2, $4));}
|
2734 |
+
| REVERT revert_arg
|
2735 |
+
{$$ = command($1, $2);}
|
2736 |
+
;
|
2737 |
+
|
2738 |
+
symbol
|
2739 |
+
: literal_string
|
2740 |
+
{$$ = $1;}
|
2741 |
+
| SYMBOL
|
2742 |
+
{$$ = $1;}
|
2743 |
+
| embedded_scm_bare
|
2744 |
+
{$$ = $1;}
|
2745 |
+
;
|
2746 |
+
|
2747 |
+
scalar
|
2748 |
+
//: embedded_scm_arg
|
2749 |
+
: pitch_or_music
|
2750 |
+
{$$ = $1;}
|
2751 |
+
| scm_identifier
|
2752 |
+
{$$ = $1;}
|
2753 |
+
| bare_number
|
2754 |
+
{$$ = $1;}
|
2755 |
+
| '-' bare_number
|
2756 |
+
{$$ = -$1;}
|
2757 |
+
| string
|
2758 |
+
{$$ = $1;}
|
2759 |
+
| symbol_list_part_bare '.' property_path
|
2760 |
+
{$$ = $1 + "." + $3;}
|
2761 |
+
| symbol_list_part_bare ',' property_path
|
2762 |
+
{$$ = $1 + "," + $3;}
|
2763 |
+
// extra formula
|
2764 |
+
| UNSIGNED ',' property_path
|
2765 |
+
{$$ = $1 + "," + $3;}
|
2766 |
+
// extra formula
|
2767 |
+
| COMMAND
|
2768 |
+
{$$ = $1;}
|
2769 |
+
;
|
2770 |
+
|
2771 |
+
bare_number
|
2772 |
+
: bare_number_common
|
2773 |
+
{$$ = $1;}
|
2774 |
+
| UNSIGNED
|
2775 |
+
{$$ = Number($1);}
|
2776 |
+
//| UNSIGNED NUMBER_IDENTIFIER
|
2777 |
+
;
|
2778 |
+
|
2779 |
+
context_def_mod
|
2780 |
+
: CONSISTS
|
2781 |
+
{$$ = $1;}
|
2782 |
+
| REMOVE
|
2783 |
+
{$$ = $1;}
|
2784 |
+
| ACCEPTS
|
2785 |
+
{$$ = $1;}
|
2786 |
+
| DEFAULTCHILD
|
2787 |
+
{$$ = $1;}
|
2788 |
+
| DENIES
|
2789 |
+
{$$ = $1;}
|
2790 |
+
| ALIAS
|
2791 |
+
{$$ = $1;}
|
2792 |
+
| TYPE
|
2793 |
+
{$$ = $1;}
|
2794 |
+
| DESCRIPTION
|
2795 |
+
{$$ = $1;}
|
2796 |
+
| NAME
|
2797 |
+
{$$ = $1;}
|
2798 |
+
;
|
2799 |
+
|
2800 |
+
embedded_scm_active
|
2801 |
+
//: SCM_IDENTIFIER
|
2802 |
+
: scm_identifier
|
2803 |
+
{$$ = $1;}
|
2804 |
+
| scm_function_call
|
2805 |
+
{$$ = $1;}
|
2806 |
+
| lookup
|
2807 |
+
{$$ = $1;}
|
2808 |
+
;
|
2809 |
+
|
2810 |
+
|
2811 |
+
/*// extra syntax, maybe the substitution for embedded_scm_active in lilypond's parser
|
2812 |
+
embedded_scheme_expression
|
2813 |
+
: "#" scheme_expression
|
2814 |
+
{$$ = scheme($2);}
|
2815 |
+
;*/
|
2816 |
+
|
2817 |
+
// extra syntax
|
2818 |
+
scheme_expression
|
2819 |
+
: SCM_TRUE
|
2820 |
+
{$$ = true;}
|
2821 |
+
| SCM_FALSE
|
2822 |
+
{$$ = false;}
|
2823 |
+
| SCM_HEX
|
2824 |
+
{$$ = $1}
|
2825 |
+
| SCM_COLON
|
2826 |
+
{$$ = $1}
|
2827 |
+
| bare_number
|
2828 |
+
{$$ = $1;}
|
2829 |
+
| INT
|
2830 |
+
{$$ = $1;}
|
2831 |
+
| "(" ")"
|
2832 |
+
{$$ = null;}
|
2833 |
+
| "+" "inf.0"
|
2834 |
+
{$$ = $1 + $2;}
|
2835 |
+
| "-" "inf.0"
|
2836 |
+
{$$ = $1 + $2;}
|
2837 |
+
| "(" scheme_expression "." scheme_expression ")"
|
2838 |
+
{$$ = schemePair($2, $4);}
|
2839 |
+
| "(" scheme_expression scheme_args ")"
|
2840 |
+
{$$ = schemeFunction($2, $3);}
|
2841 |
+
| scheme_token
|
2842 |
+
{$$ = $1;}
|
2843 |
+
| scheme_token "?"
|
2844 |
+
{$$ = $1 + $2;}
|
2845 |
+
| "'" scheme_expression
|
2846 |
+
{$$ = schemePointer($2);}
|
2847 |
+
| "`" scheme_expression
|
2848 |
+
{$$ = schemePointer($2);}
|
2849 |
+
| "#" "{" lilypond "#" "}"
|
2850 |
+
{$$ = schemeEmbed($3);}
|
2851 |
+
| "*"
|
2852 |
+
{$$ = $1;}
|
2853 |
+
;
|
2854 |
+
|
2855 |
+
scheme_args
|
2856 |
+
: %empty
|
2857 |
+
{$$ = [];}
|
2858 |
+
| scheme_args scheme_expression
|
2859 |
+
{$$ = $1.concat($2);}
|
2860 |
+
;
|
2861 |
+
|
2862 |
+
scheme_token
|
2863 |
+
: bare_number
|
2864 |
+
{$$ = $1;}
|
2865 |
+
| symbol
|
2866 |
+
{$$ = $1;}
|
2867 |
+
| symbol ":" scheme_token
|
2868 |
+
{$$ = $1 + $2 + $3;}
|
2869 |
+
| symbol ":" ":" scheme_token
|
2870 |
+
{$$ = $1 + $2 + $3 + $4;}
|
2871 |
+
;
|
2872 |
+
|
2873 |
+
optional_rest
|
2874 |
+
: %empty
|
2875 |
+
{$$ = null;}
|
2876 |
+
| REST
|
2877 |
+
{$$ = $1;}
|
2878 |
+
;
|
2879 |
+
|
2880 |
+
// extra syntax, the substitution of STRING
|
2881 |
+
literal_string
|
2882 |
+
: STRING
|
2883 |
+
{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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
%{
|
3 |
+
const root = (type, data) => ({__prototype: "MesaureLayout", type, data});
|
4 |
+
|
5 |
+
const singleLayout = n => ({__prototype: "SingleMLayout", measure: Number(n)});
|
6 |
+
const blockLayout = seq => ({__prototype: "BlockMLayout", seq});
|
7 |
+
const voltaBlock = (times, body, alternates) => ({__prototype: "VoltaMLayout", times: Number(times), body, alternates});
|
8 |
+
const abaBlock = (main, rest) => ({__prototype: "ABAMLayout", main, rest});
|
9 |
+
|
10 |
+
const segment = n => ({segment: true, length: Number(n)});
|
11 |
+
|
12 |
+
const alternates = items => items.map(item => {
|
13 |
+
if (item.__prototype === "BlockMLayout")
|
14 |
+
return item.seq;
|
15 |
+
|
16 |
+
return [item];
|
17 |
+
});
|
18 |
+
|
19 |
+
const range = (start, end) => {
|
20 |
+
start = Number(start);
|
21 |
+
end = Number(end);
|
22 |
+
|
23 |
+
if (!(end >= start))
|
24 |
+
throw new Error(`invalid measure range: ${start}..${end}`);
|
25 |
+
|
26 |
+
return Array(end + 1 - start).fill(0).map((_, i) => singleLayout(start + i));
|
27 |
+
};
|
28 |
+
|
29 |
+
|
30 |
+
const serializeSeq = (item, options) => {
|
31 |
+
if (item.segment) {
|
32 |
+
const index = options.index;
|
33 |
+
options.index += item.length;
|
34 |
+
|
35 |
+
return Array(item.length).fill(0).map((_, i) => singleLayout(index + i));
|
36 |
+
}
|
37 |
+
|
38 |
+
return [serialize(item, options)];
|
39 |
+
};
|
40 |
+
|
41 |
+
const serialize = (item, options = {index: 1}) => {
|
42 |
+
const speard = seq => [].concat(...seq.map(it => serializeSeq(it, options)));
|
43 |
+
|
44 |
+
switch (item.__prototype) {
|
45 |
+
case "BlockMLayout":
|
46 |
+
item.seq = speard(item.seq);
|
47 |
+
|
48 |
+
break;
|
49 |
+
case "VoltaMLayout":
|
50 |
+
item.body = speard(item.body);
|
51 |
+
item.alternates = item.alternates && item.alternates.map(speard);
|
52 |
+
|
53 |
+
break;
|
54 |
+
case "ABAMLayout":
|
55 |
+
item.main = serialize(item.main, options);
|
56 |
+
item.rest = speard(item.rest);
|
57 |
+
|
58 |
+
break;
|
59 |
+
}
|
60 |
+
|
61 |
+
return item;
|
62 |
+
};
|
63 |
+
%}
|
64 |
+
|
65 |
+
|
66 |
+
%lex
|
67 |
+
|
68 |
+
%option flex unicode
|
69 |
+
|
70 |
+
A [a-z]
|
71 |
+
N [1-9]
|
72 |
+
N0 [0-9]
|
73 |
+
UNSIGNED {N}{N0}*
|
74 |
+
WORD {A}+
|
75 |
+
|
76 |
+
SPECIAL [*,\[\]<>{}]
|
77 |
+
|
78 |
+
|
79 |
+
%%
|
80 |
+
|
81 |
+
\s+ {} // spaces
|
82 |
+
|
83 |
+
{SPECIAL} return yytext;
|
84 |
+
|
85 |
+
{UNSIGNED} return 'UNSIGNED'
|
86 |
+
{WORD}":" return yytext
|
87 |
+
".." return yytext
|
88 |
+
|
89 |
+
<<EOF>> return 'EOF';
|
90 |
+
|
91 |
+
|
92 |
+
/lex
|
93 |
+
|
94 |
+
%start start_symbol
|
95 |
+
|
96 |
+
%%
|
97 |
+
|
98 |
+
start_symbol
|
99 |
+
: measure_layout EOF
|
100 |
+
{
|
101 |
+
return $1;
|
102 |
+
}
|
103 |
+
;
|
104 |
+
|
105 |
+
measure_layout
|
106 |
+
: index_wise_measure_layout
|
107 |
+
{$$ = root(null, $1);}
|
108 |
+
| 'i:' index_wise_measure_layout
|
109 |
+
{$$ = root("index-wise", $2);}
|
110 |
+
| 's:' segment_wise_measure_layout
|
111 |
+
{$$ = root("segment-wise", serialize($2));}
|
112 |
+
;
|
113 |
+
|
114 |
+
|
115 |
+
index_wise_measure_layout
|
116 |
+
: iw_sequence
|
117 |
+
{
|
118 |
+
if ($1.length === 1 && $1[0].__prototype === "BlockMLayout")
|
119 |
+
$$ = $1[0];
|
120 |
+
else
|
121 |
+
$$ = blockLayout($1);
|
122 |
+
}
|
123 |
+
;
|
124 |
+
|
125 |
+
iw_sequence
|
126 |
+
: iw_item
|
127 |
+
{$$ = [$1];}
|
128 |
+
| range
|
129 |
+
{$$ = $1;}
|
130 |
+
| iw_sequence ',' iw_item
|
131 |
+
{$$ = [...$1, $3];}
|
132 |
+
| iw_sequence ',' range
|
133 |
+
{$$ = [...$1, ...$3];}
|
134 |
+
;
|
135 |
+
|
136 |
+
range
|
137 |
+
: UNSIGNED '..' UNSIGNED
|
138 |
+
{$$ = range($1, $3);}
|
139 |
+
;
|
140 |
+
|
141 |
+
iw_item
|
142 |
+
: single
|
143 |
+
{$$ = $1;}
|
144 |
+
| iw_block_item
|
145 |
+
{$$ = $1;}
|
146 |
+
| iw_volta
|
147 |
+
{$$ = $1;}
|
148 |
+
| iw_aba
|
149 |
+
{$$ = $1;}
|
150 |
+
;
|
151 |
+
|
152 |
+
single
|
153 |
+
: UNSIGNED
|
154 |
+
{$$ = singleLayout($1);}
|
155 |
+
;
|
156 |
+
|
157 |
+
iw_block_item
|
158 |
+
: iw_block
|
159 |
+
{$$ = blockLayout($1);}
|
160 |
+
;
|
161 |
+
|
162 |
+
iw_block
|
163 |
+
: '[' iw_sequence ']'
|
164 |
+
{$$ = $2;}
|
165 |
+
;
|
166 |
+
|
167 |
+
iw_volta
|
168 |
+
: UNSIGNED '*' iw_block iw_optional_alternates
|
169 |
+
{$$ = voltaBlock($1, $3, $4);}
|
170 |
+
;
|
171 |
+
|
172 |
+
iw_optional_alternates
|
173 |
+
: %empty
|
174 |
+
{$$ = null;}
|
175 |
+
| iw_alternates
|
176 |
+
{$$ = $1;}
|
177 |
+
;
|
178 |
+
|
179 |
+
iw_alternates
|
180 |
+
: '{' iw_sequence '}'
|
181 |
+
{$$ = alternates($2);}
|
182 |
+
;
|
183 |
+
|
184 |
+
iw_aba
|
185 |
+
: '<' iw_item ',' iw_sequence '>'
|
186 |
+
{$$ = abaBlock($2, $4);}
|
187 |
+
;
|
188 |
+
|
189 |
+
|
190 |
+
segment_wise_measure_layout
|
191 |
+
: sw_sequence
|
192 |
+
{
|
193 |
+
if ($1.length === 1 && $1[0].__prototype === "BlockMLayout")
|
194 |
+
$$ = $1[0];
|
195 |
+
else
|
196 |
+
$$ = blockLayout($1);
|
197 |
+
}
|
198 |
+
;
|
199 |
+
|
200 |
+
sw_sequence
|
201 |
+
: sw_item
|
202 |
+
{$$ = [$1];}
|
203 |
+
| sw_sequence sw_item
|
204 |
+
{$$ = [...$1, $2];}
|
205 |
+
;
|
206 |
+
|
207 |
+
sw_item
|
208 |
+
: segment
|
209 |
+
{$$ = blockLayout([$1]);}
|
210 |
+
| sw_block_item
|
211 |
+
{$$ = $1;}
|
212 |
+
| sw_volta
|
213 |
+
{$$ = $1;}
|
214 |
+
| sw_aba
|
215 |
+
{$$ = $1;}
|
216 |
+
;
|
217 |
+
|
218 |
+
segment
|
219 |
+
: UNSIGNED
|
220 |
+
{$$ = segment($1);}
|
221 |
+
;
|
222 |
+
|
223 |
+
sw_block_item
|
224 |
+
: sw_block
|
225 |
+
{$$ = blockLayout($1);}
|
226 |
+
;
|
227 |
+
|
228 |
+
sw_block
|
229 |
+
: '[' sw_sequence ']'
|
230 |
+
{$$ = $2;}
|
231 |
+
;
|
232 |
+
|
233 |
+
sw_volta
|
234 |
+
: UNSIGNED '*' sw_block sw_optional_alternates
|
235 |
+
{$$ = voltaBlock($1, $3, $4);}
|
236 |
+
;
|
237 |
+
|
238 |
+
sw_optional_alternates
|
239 |
+
: %empty
|
240 |
+
{$$ = null;}
|
241 |
+
| sw_alternates
|
242 |
+
{$$ = $1;}
|
243 |
+
;
|
244 |
+
|
245 |
+
sw_alternates
|
246 |
+
: '{' sw_sequence '}'
|
247 |
+
{$$ = alternates($2);}
|
248 |
+
;
|
249 |
+
|
250 |
+
sw_aba
|
251 |
+
: '<' sw_item sw_sequence '>'
|
252 |
+
{$$ = abaBlock($2, $3);}
|
253 |
+
;
|
ly/articulate-lotus.ly
ADDED
@@ -0,0 +1,1060 @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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
%
|
2 |
+
% Copyright (C) 2008, 2009, 2010, 2011 NICTA
|
3 |
+
% Author: Peter Chubb <peter.chubb AT nicta.com.au>
|
4 |
+
% $Id: articulate.ly,v 1.7 2011-03-24 00:40:00 peterc Exp $
|
5 |
+
%
|
6 |
+
%
|
7 |
+
% This program is free software; you can redistribute it and/or modify
|
8 |
+
% it under the terms of the GNU General Public License, version 3,
|
9 |
+
% as published by the Free Software Foundation.
|
10 |
+
%
|
11 |
+
% WARNING: this file under GPLv3 only, not GPLv3+
|
12 |
+
%
|
13 |
+
% This program is distributed in the hope that it will be useful,
|
14 |
+
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
+
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
16 |
+
% See the GNU General Public License for more details. It is
|
17 |
+
% available in the Lilypond source tree, or at
|
18 |
+
% http://www.gnu.org/licenses/gpl-3.0.html
|
19 |
+
%
|
20 |
+
% This script tries to make MIDI output from LilyPond a little more realistic.
|
21 |
+
% It tries to take articulations (slurs, staccato, etc) into account, by
|
22 |
+
% replacing notes with sequential music of suitably time-scaled note plus
|
23 |
+
% skip.
|
24 |
+
%
|
25 |
+
% Trills, turns, mordents and pralls are expanded with rallentendo
|
26 |
+
% and accelerando taken into account.
|
27 |
+
%
|
28 |
+
% As my scheme knowledge is poor (I was teaching myself as I went), there
|
29 |
+
% is much scope for improvement.
|
30 |
+
|
31 |
+
% See: http://nicta.com.au/people/chubbp/articulate for additional
|
32 |
+
% information about how the articulate function works.
|
33 |
+
|
34 |
+
%%% Supported items:
|
35 |
+
% Articulations on a single note (staccato, staccatissimo, portato, tenuto).
|
36 |
+
% Slurs and phrasing slurs.
|
37 |
+
% Ornaments (i.e. mordents, trills, turns).
|
38 |
+
% Rallentando, accelerando, ritard and 'a tempo'.
|
39 |
+
%
|
40 |
+
% Please refer to 'MIDI output' (Section 3.5) in the Notation Reference
|
41 |
+
% Manual for a more detailed list of supported items.
|
42 |
+
|
43 |
+
%%% Technical Details:
|
44 |
+
% * Any note not under a slur or phrasing slur, and not marked with an
|
45 |
+
% explicit articulation, is shortened by ac:normalFactor (default 7/8).
|
46 |
+
% (Shortening a note means replacing the note with a note of a smaller
|
47 |
+
% duration, and a rest to make up for the difference between the durations
|
48 |
+
% of the original and the shortened note.)
|
49 |
+
% * Notes marked with articulations are shortened by factors specific to the
|
50 |
+
% articulation as follows:
|
51 |
+
% staccato not under a slur: ac:staccatoFactor (default 1/2)
|
52 |
+
% under a slur: ac:portatoFactor (default 3/4)
|
53 |
+
% staccatissimo ac:staccatissimoFactor (default 1/4)
|
54 |
+
% portato ac:portatoFactor (default 3/4)
|
55 |
+
% tenuto ac:tenutoFactor (default 1/1 - by default, notes marked
|
56 |
+
% tenuto are not shortened)
|
57 |
+
% * Appoggiaturas are made to take half the value of the note following,
|
58 |
+
% without taking dots into account (so in \appoggiatura c8 d2. the c
|
59 |
+
% will take the time of a crotchet).
|
60 |
+
% * Trills and turns are expanded. The algorithm tries to choose notes
|
61 |
+
% within the time of the current tempo that lead to each twiddle being
|
62 |
+
% around 1/8 seconds; this can be adjusted with the ac:maxTwiddleTime
|
63 |
+
% variable.
|
64 |
+
% * Rall, poco rall and a tempo are observed. It'd be fairly trivial to
|
65 |
+
% make accel. and stringendo and so on work too.
|
66 |
+
|
67 |
+
%
|
68 |
+
%%%USAGE
|
69 |
+
% In the \score section do:
|
70 |
+
% \articulate <<
|
71 |
+
% all the rest of the score
|
72 |
+
% >>
|
73 |
+
% or use the lilywrap script.
|
74 |
+
%
|
75 |
+
% TO DO:
|
76 |
+
%
|
77 |
+
% * Dynamics.
|
78 |
+
% * Fix quantisation for dynamics on single note (replace note
|
79 |
+
% with tied 128th notes?) -- started, needs work.
|
80 |
+
% * Make \fp do the right thing (loud start, then quiet).
|
81 |
+
%
|
82 |
+
% * Inegalite. Notes on-beat steal time from notes off-beat.
|
83 |
+
% Degree of stealing is a parameter: from 1.0 (straight)
|
84 |
+
% to 1.5 (extreme swing). Also fix tenuto to use this.
|
85 |
+
%
|
86 |
+
% * add accel (to match rall), and molto rall. I've never seen
|
87 |
+
% molto accel but some composer somewhere has probably used it.
|
88 |
+
%
|
89 |
+
% * Fermata, and Fermata Lunga
|
90 |
+
% * Add more synonyms for accel and rall: rit ritard stringendo
|
91 |
+
%
|
92 |
+
% * Phrasing.
|
93 |
+
% * Rall at end of piece
|
94 |
+
% * Very slight accel into a phrase, rall out of it.
|
95 |
+
% * Dynamics during a phrase???? unclear how these should be in
|
96 |
+
% the general case
|
97 |
+
%
|
98 |
+
% * Trill algorithm needs work.
|
99 |
+
%
|
100 |
+
% * Cope with more ornaments/articulations.
|
101 |
+
% inverted-turns, etc.
|
102 |
+
% -- accent needs better control of dynamics.
|
103 |
+
% -- Handling of generic ornaments (in lily, `\stopped'; in
|
104 |
+
% most early music: ornament this note (trill, turn
|
105 |
+
% or mordent as the player wishes))
|
106 |
+
|
107 |
+
% * Automatic gruppetto at end of trill; better handling of
|
108 |
+
% initial/final grace notes on trill
|
109 |
+
|
110 |
+
% * Automatic ornaments.
|
111 |
+
% * Spot cadences and ornament
|
112 |
+
% * Look for quaver-dotted note for trills, for example.
|
113 |
+
% * Fill in steps. (Needs lookahead/lookbehind.)
|
114 |
+
% * `afterturn' -- a turn after the start of a note.
|
115 |
+
% * accidentals for trills and turns
|
116 |
+
|
117 |
+
% CHANGELOG
|
118 |
+
% * Heikki Tauriainen: handle also the \portato articulation (both as an
|
119 |
+
% explicit articulation, and as the articulation to use for slurred
|
120 |
+
% notes marked \staccato).
|
121 |
+
% * David Kastrup: remove redefinitions of \afterGrace and \appoggiatura
|
122 |
+
% and let their actions be performed when \articulate is called by
|
123 |
+
% recognizing and replacing LilyPond's default code for these constructs.
|
124 |
+
% Cf issue 4517 in LilyPond's tracker.
|
125 |
+
% * David Kastrup: basic 2.15.28 compatibility by using event-chord-wrap!
|
126 |
+
% This should really be done by rewriting the code more thoroughly.
|
127 |
+
% * From Iain Nicol: appoggiatura timings were out; add staccatissimo; fix
|
128 |
+
% trillSpanner endpoints.
|
129 |
+
% * Also handle Breathing events (by throwing them away). This isn't ideal;
|
130 |
+
% one should really shorten the note before a little. But I don't know
|
131 |
+
% how to do lookahead in scheme.
|
132 |
+
% * Also ignore explicit line breaks.
|
133 |
+
% * Add Mordents (reported by Patrick Karl)
|
134 |
+
% * Thomas Morley: extend unfold-repeats to reflect the possibility to
|
135 |
+
% customize its effect to user-settable repeat-types. Here the most general
|
136 |
+
% setting is hard-coded, resulting in unchanged behaviour.
|
137 |
+
|
138 |
+
\version "2.19.22"
|
139 |
+
|
140 |
+
#(use-modules (srfi srfi-1))
|
141 |
+
#(use-modules (srfi srfi-11))
|
142 |
+
#(use-modules (ice-9 debug))
|
143 |
+
#(use-modules (scm display-lily))
|
144 |
+
|
145 |
+
% PARAMETERS
|
146 |
+
% How much to compress notes marked Staccato. CPE Bach says `as short as
|
147 |
+
% may conveniently be played, as if the keys were too hot to touch'.
|
148 |
+
% Most modern sources say 1/2 the notated length of a note.
|
149 |
+
#(define ac:staccatoFactor '(1 . 2))
|
150 |
+
|
151 |
+
% How much to compress notes marked staccatissimo.
|
152 |
+
#(define ac:staccatissimoFactor '(1 . 4))
|
153 |
+
|
154 |
+
% Shortening factor for notes marked portato (or slurred notes marked
|
155 |
+
% staccato).
|
156 |
+
#(define ac:portatoFactor '(3 . 4))
|
157 |
+
|
158 |
+
% And tenuto (if we ever implement time stealing, this should be >1.0)
|
159 |
+
#(define ac:tenutoFactor '(1 . 1))
|
160 |
+
|
161 |
+
% How much to articulate normal notes. CPE Bach says 1/2 (and
|
162 |
+
% staccato should be `as short as may conveniently be played') but this
|
163 |
+
% sounds too short for modern music. 7/8 sounds about right.
|
164 |
+
#(define ac:normalFactor '(7 . 8))
|
165 |
+
|
166 |
+
% How much to slow down for a rall. or a poco rall.
|
167 |
+
% (or speed up for accel or poco accel)
|
168 |
+
#(define ac:rallFactor (ly:make-moment 60/100)) % 40% slowdown
|
169 |
+
#(define ac:pocoRallFactor (ly:make-moment 90/100)) % 10% slowdown
|
170 |
+
|
171 |
+
% The absolute time for a twiddle in a trill, in minutes.
|
172 |
+
% Start with 1/4 seconds == 1/240 minutes
|
173 |
+
#(define ac:maxTwiddleTime (ly:make-moment 1/240))
|
174 |
+
|
175 |
+
% How long ordinary grace notes should be relative to their notated
|
176 |
+
% duration. 9/40 is LilyPond's built-in behaviour for MIDI output
|
177 |
+
% (though the notation reference says 1/4).
|
178 |
+
#(define ac:defaultGraceFactor 9/40)
|
179 |
+
|
180 |
+
% What proportion of an ordinary grace note's time should be stolen
|
181 |
+
% from preceding notes (as opposed to stealing from the principal note).
|
182 |
+
% Composers' intentions for this vary. Taking all from the preceding
|
183 |
+
% notes is LilyPond's built-in behaviour for MIDI output.
|
184 |
+
#(define ac:defaultGraceBackwardness 1)
|
185 |
+
|
186 |
+
|
187 |
+
% Internal variables, don't touch.
|
188 |
+
% (should probably be part of a context somehow)
|
189 |
+
|
190 |
+
% Whether to slur, or not
|
191 |
+
#(define ac:inSlur #f)
|
192 |
+
#(define ac:inPhrasingSlur #f)
|
193 |
+
|
194 |
+
% Whether the current noteevent is in a trill spanner
|
195 |
+
#(define ac:inTrill #f)
|
196 |
+
|
197 |
+
% assume start in C major. Key change events override this.
|
198 |
+
% Could get from context, but don't know how.
|
199 |
+
#(define ac:current-key (make-music
|
200 |
+
'KeyChangeEvent
|
201 |
+
'tonic
|
202 |
+
(ly:make-pitch -1 0 0)
|
203 |
+
'pitch-alist
|
204 |
+
(list (cons 0 0)
|
205 |
+
(cons 1 0)
|
206 |
+
(cons 2 0)
|
207 |
+
(cons 3 0)
|
208 |
+
(cons 4 0)
|
209 |
+
(cons 5 0)
|
210 |
+
(cons 6 0))))
|
211 |
+
|
212 |
+
|
213 |
+
#(define ac:currentTempo (ly:make-moment 15/1)) % 4 = 60, measured wholes per minute
|
214 |
+
#(define ac:lastTempo ac:currentTempo) % for 'a tempo' or 'tempo I'
|
215 |
+
|
216 |
+
% The duration of the current note. Start at a crotchet
|
217 |
+
% for no good reason.
|
218 |
+
#(define ac:currentDuration (ly:make-duration 2 0 1/1))
|
219 |
+
|
220 |
+
% Amount of musical time (in whole notes) that we need to steal from the
|
221 |
+
% next events seen.
|
222 |
+
#(define ac:stealForward 0)
|
223 |
+
|
224 |
+
% List of events in the output so far, in reverse order, from which we can
|
225 |
+
% steal time.
|
226 |
+
#(define ac:eventsBackward '())
|
227 |
+
|
228 |
+
% Log events for the backward chain.
|
229 |
+
#(define (ac:logEventsBackward music)
|
230 |
+
(music-map
|
231 |
+
(lambda (m)
|
232 |
+
(case (ly:music-property m 'name)
|
233 |
+
((EventChord)
|
234 |
+
(set! ac:eventsBackward (cons m ac:eventsBackward))
|
235 |
+
m)
|
236 |
+
((BarCheck SkipMusic)
|
237 |
+
(let ((wm (make-sequential-music (list m))))
|
238 |
+
(set! ac:eventsBackward (cons wm ac:eventsBackward))
|
239 |
+
wm))
|
240 |
+
(else
|
241 |
+
m)))
|
242 |
+
music))
|
243 |
+
|
244 |
+
% Steal time from the backward chain. Adds to ac:stealForward (with a
|
245 |
+
% warning) if it couldn't backward-steal all that was desired.
|
246 |
+
#(define (ac:stealTimeBackward tosteal)
|
247 |
+
(if (<= tosteal 0)
|
248 |
+
#t
|
249 |
+
(if (null? ac:eventsBackward)
|
250 |
+
(begin
|
251 |
+
(ly:warning (_ "articulation failed to steal ~a note backward at beginning of music; stealing forward instead") tosteal)
|
252 |
+
(set! ac:stealForward (+ ac:stealForward tosteal)))
|
253 |
+
(let*
|
254 |
+
((lastev (car ac:eventsBackward))
|
255 |
+
(levlen (ly:moment-main (ly:music-length lastev))))
|
256 |
+
(if (< tosteal levlen)
|
257 |
+
(begin
|
258 |
+
(ly:music-compress lastev (ly:make-moment (/ (- levlen tosteal) levlen)))
|
259 |
+
#t)
|
260 |
+
(begin
|
261 |
+
(if (any (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
|
262 |
+
(ly:music-property lastev 'elements))
|
263 |
+
(ly:warning (_ "stealing the entirety of a note's time")))
|
264 |
+
(set! (ly:music-property lastev 'elements) '())
|
265 |
+
(set! ac:eventsBackward (cdr ac:eventsBackward))
|
266 |
+
(ac:stealTimeBackward (- tosteal levlen))))))))
|
267 |
+
|
268 |
+
% Debugging: display a moment plus some text.
|
269 |
+
% Returns its moment argument so can be used in-line.
|
270 |
+
#(define (display-moment text m)
|
271 |
+
(display text)
|
272 |
+
(display (list (ly:moment-main-numerator m) "/" (ly:moment-main-denominator m)))
|
273 |
+
m
|
274 |
+
)
|
275 |
+
|
276 |
+
% Track tempo (and maybe later, other context properties)
|
277 |
+
% as they change. Needs to better cope with saving only Tempo I,
|
278 |
+
% otherwise "a tempo" goes back to the tempo before the last change.
|
279 |
+
#(define (ac:adjust-props sym music)
|
280 |
+
(case sym
|
281 |
+
((tempoWholesPerMinute)
|
282 |
+
(set! ac:currentTempo (ly:music-property music 'value))
|
283 |
+
(set! ac:lastTempo ac:currentTempo)
|
284 |
+
)))
|
285 |
+
|
286 |
+
% Raise note one step in the current diatonic scale.
|
287 |
+
#(define (ac:up note)
|
288 |
+
(let* ((pitch (ly:music-property note 'pitch))
|
289 |
+
(notename (ly:pitch-notename pitch))
|
290 |
+
(new-notename (if (eqv? notename 6) 0 (+ 1 notename)))
|
291 |
+
(alterations (ly:music-property ac:current-key 'pitch-alist))
|
292 |
+
(new-alteration (cdr (assq new-notename alterations)))
|
293 |
+
(new-octave (if (eqv? new-notename 0) (+ 1 (ly:pitch-octave pitch))
|
294 |
+
(ly:pitch-octave pitch)))
|
295 |
+
)
|
296 |
+
(set! (ly:music-property note 'pitch)(ly:make-pitch new-octave new-notename new-alteration))))
|
297 |
+
|
298 |
+
|
299 |
+
% Lower note one step in the current diatonic scale.
|
300 |
+
#(define (ac:down note)
|
301 |
+
(begin (let* ((pitch (ly:music-property note 'pitch))
|
302 |
+
(notename (ly:pitch-notename pitch))
|
303 |
+
(new-notename (if (eqv? notename 0) 6 (- notename 1)))
|
304 |
+
(alterations (ly:music-property ac:current-key 'pitch-alist))
|
305 |
+
(new-alteration (cdr (assq new-notename alterations)))
|
306 |
+
(new-octave (if (eqv? new-notename 6) (- (ly:pitch-octave pitch) 1)
|
307 |
+
(ly:pitch-octave pitch)))
|
308 |
+
)
|
309 |
+
(set! (ly:music-property note 'pitch)(ly:make-pitch new-octave new-notename new-alteration))))
|
310 |
+
)
|
311 |
+
|
312 |
+
% Shorten a note, and save the note's original duration in ac:currentDuration
|
313 |
+
#(define (ac:articulate-one-note m fraction)
|
314 |
+
"Replace m with m*fraction"
|
315 |
+
(if (eq? 'NoteEvent (ly:music-property m 'name))
|
316 |
+
(let*
|
317 |
+
((dur (ly:music-property m 'duration))
|
318 |
+
(l (ly:duration-log dur))
|
319 |
+
(d (ly:duration-dot-count dur))
|
320 |
+
(factor (ly:duration-factor dur))
|
321 |
+
(num (car fraction))
|
322 |
+
(denom (cdr fraction)))
|
323 |
+
(begin
|
324 |
+
(set! ac:currentDuration dur)
|
325 |
+
(set! (ly:music-property m 'duration)
|
326 |
+
(ly:make-duration l d
|
327 |
+
(* num (car factor))
|
328 |
+
(* denom (cdr factor))))))
|
329 |
+
m))
|
330 |
+
|
331 |
+
% helper routine to set duration.
|
332 |
+
#(define (ac:setduration music duration)
|
333 |
+
"Set a note's duration."
|
334 |
+
(let ((eventtype (ly:music-property music 'name)))
|
335 |
+
(if
|
336 |
+
(or
|
337 |
+
(eq? eventtype 'NoteEvent)
|
338 |
+
(eq? eventtype 'RestEvent)
|
339 |
+
(eq? eventtype 'SkipEvent))
|
340 |
+
(set! (ly:music-property music 'duration) duration))))
|
341 |
+
|
342 |
+
% Add an articulation event to a note.
|
343 |
+
% Used in afterGrace to mark all notes as tenuto, so they're not shortened
|
344 |
+
#(define (ac:add-articulation type music)
|
345 |
+
(music-map (lambda (m)
|
346 |
+
(if (eq? 'EventChord (ly:music-property m 'name))
|
347 |
+
(set! (ly:music-property m 'elements)
|
348 |
+
(append (ly:music-property m 'elements)
|
349 |
+
(list (make-music 'ArticulationEvent 'articulation-type type)))))
|
350 |
+
m)
|
351 |
+
music))
|
352 |
+
|
353 |
+
% Convert a long note to an equivalent set of short notes, tied together.
|
354 |
+
% This is needed to get smooth dynamics changes.
|
355 |
+
% Need to deal properly with stuff other than the notes (dynamics, markup etc)
|
356 |
+
% Still experimental, so disabled for now.
|
357 |
+
#(define (ac:to128 music) music)
|
358 |
+
|
359 |
+
#(define (ac:to128_disabled music)
|
360 |
+
(if (or (eq? 'SkipEvent (ly:music-property music 'name))
|
361 |
+
(eq? 'NoteEvent (ly:music-property music 'name)))
|
362 |
+
(let* ((dur (ly:music-property music 'duration))
|
363 |
+
(log2 (ly:duration-log dur))
|
364 |
+
(shiftcount (- 6 log2))
|
365 |
+
(lastm (ly:music-deep-copy (shift-duration-log music shiftcount 0))))
|
366 |
+
(set! (ly:music-property music 'elements)
|
367 |
+
(cons (make-music 'TieEvent) (ly:music-property music 'elements)))
|
368 |
+
(make-sequential-music (list
|
369 |
+
(make-repeat "unfold" (1- (expt 2 shiftcount))
|
370 |
+
(make-sequential-music (list music)) '())
|
371 |
+
lastm)))
|
372 |
+
music))
|
373 |
+
|
374 |
+
|
375 |
+
% absolute time in minutes of a length of music, as a rational number (moment)
|
376 |
+
#(define (ac:abstime music)
|
377 |
+
(ly:moment-div (ly:music-length music) ac:currentTempo))
|
378 |
+
|
379 |
+
% convert absolute time (in minutes) to a moment in the current tempo
|
380 |
+
#(define (ac:abs->mom m)
|
381 |
+
(ly:moment-mul m ac:currentTempo))
|
382 |
+
|
383 |
+
|
384 |
+
% a moment that is ac:maxTwiddletime seconds at the current tempo.
|
385 |
+
#(define (ac:targetTwiddleTime)
|
386 |
+
(ac:abs->mom ac:maxTwiddleTime))
|
387 |
+
|
388 |
+
|
389 |
+
% Nearest twiddletime (in minutes) achievable with power-of-2 divisions of
|
390 |
+
% the original music. (twiddletime is the time for one pair of notes
|
391 |
+
% in a trill)
|
392 |
+
% If the music has a precomputed twiddletime (e.g., from \afterGrace) use that.
|
393 |
+
#(define (ac:twiddletime music)
|
394 |
+
(let* ((tr (filter (lambda (x)
|
395 |
+
(and (eq? 'ArticulationEvent (ly:music-property x 'name))
|
396 |
+
(string= "trill" (ly:music-property x 'articulation-type))))
|
397 |
+
(ly:music-property music 'elements)))
|
398 |
+
(pre-t (if (pair? tr) (ly:music-property (car tr) 'twiddle)
|
399 |
+
'()))
|
400 |
+
(hemisemimom (ly:make-moment 1/64))
|
401 |
+
(t (ac:targetTwiddleTime)))
|
402 |
+
(if (ly:moment? pre-t)
|
403 |
+
pre-t
|
404 |
+
hemisemimom)))
|
405 |
+
|
406 |
+
|
407 |
+
|
408 |
+
% Note: I'm assuming early music practice of starting on the auxiliary note.
|
409 |
+
% Needs to add gruppetto if it's a long trill (TODO)
|
410 |
+
#(define (ac:trill music)
|
411 |
+
" Replace music with time-compressed repeats of the music,
|
412 |
+
maybe accelerating if the length is longer than a crotchet "
|
413 |
+
(let* ((hemisemidur (ly:make-duration 5 0 1/1))
|
414 |
+
(orig-len (ly:music-length music))
|
415 |
+
(t (ac:twiddletime music))
|
416 |
+
(uppernote '())
|
417 |
+
(note_moment (ly:moment-mul t (ly:make-moment 1/2)))
|
418 |
+
(c1 (ly:moment-div orig-len t))
|
419 |
+
(c2 (inexact->exact
|
420 |
+
(round (/ (ly:moment-main-numerator c1)
|
421 |
+
(* 2 (ly:moment-main-denominator c1))))))
|
422 |
+
(count (if (< c2 2) 2 c2)))
|
423 |
+
|
424 |
+
(set! (ly:music-property music 'elements)
|
425 |
+
(filter (lambda (y) (eq? 'NoteEvent (ly:music-property y 'name)))
|
426 |
+
(ly:music-property music 'elements)))
|
427 |
+
(map (lambda (y) (ac:setduration y hemisemidur))
|
428 |
+
(ly:music-property music 'elements))
|
429 |
+
(set! uppernote (ly:music-deep-copy music))
|
430 |
+
(map ac:up
|
431 |
+
(filter
|
432 |
+
(lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
|
433 |
+
(ly:music-property uppernote 'elements)))
|
434 |
+
|
435 |
+
(let* ((trillMusicElements
|
436 |
+
(let loop ((so_far (list uppernote music))
|
437 |
+
(c count))
|
438 |
+
(if (> c 1)
|
439 |
+
(loop (append (list (ly:music-deep-copy uppernote) (ly:music-deep-copy music)) so_far) (1- c))
|
440 |
+
so_far)))
|
441 |
+
(trillMusic (make-sequential-music trillMusicElements))
|
442 |
+
(newlen (ly:music-length trillMusic))
|
443 |
+
(factor (ly:moment-div orig-len newlen)))
|
444 |
+
(ly:music-compress trillMusic factor)
|
445 |
+
; accelerating the music seems to put lily into an infinite loop in
|
446 |
+
; its layout and midi engines.
|
447 |
+
; (let* ((realfactor (exp (* (/ 1.0 count) (log 0.75))))
|
448 |
+
; (factor (ly:make-moment (inexact->exact (round (* 1024 realfactor)))
|
449 |
+
; 1024)))
|
450 |
+
; (ac:accel trillMusic factor))
|
451 |
+
)))
|
452 |
+
|
453 |
+
|
454 |
+
% Copy music and strip articulations, ties, etc., for generating
|
455 |
+
% mordents etc.
|
456 |
+
#(define (ac:note-copy music)
|
457 |
+
"return a copy of music that is only notes, no articulations, ties, slurs etc"
|
458 |
+
(let ((new-music (ly:music-deep-copy music)))
|
459 |
+
(set! (ly:music-property new-music 'articulations) '())
|
460 |
+
(set! (ly:music-property new-music 'elements)
|
461 |
+
(filter (lambda (y) (eq? 'NoteEvent (ly:music-property y 'name)))
|
462 |
+
(ly:music-property new-music 'elements)))
|
463 |
+
new-music))
|
464 |
+
|
465 |
+
%
|
466 |
+
% Generate a tempoChangeEvent and its associated property setting.
|
467 |
+
%
|
468 |
+
#(define (ac:tempoChange tempo)
|
469 |
+
(make-sequential-music
|
470 |
+
(list (make-music 'TempoChangeEvent
|
471 |
+
'metronome-count
|
472 |
+
tempo
|
473 |
+
'tempo-unit
|
474 |
+
(ly:make-duration 0 0 1/1))
|
475 |
+
(context-spec-music
|
476 |
+
(make-property-set 'tempoWholesPerMinute tempo) 'Score))))
|
477 |
+
|
478 |
+
%
|
479 |
+
% Totally unfold repeats, so that the non-obvious sequencing doesn't
|
480 |
+
% confuse us. This is necessary for time stealing to work, because
|
481 |
+
% that relies on the sequence in which we see events matching their
|
482 |
+
% audible sequence. Also unfold multi-measure rests to equivalent
|
483 |
+
% skips, with preceding and following bar checks, so that time stealing
|
484 |
+
% can change the length of the pause without falling foul of the
|
485 |
+
% implicit bar checks.
|
486 |
+
%
|
487 |
+
#(define (ac:unfoldMusic music)
|
488 |
+
(music-map
|
489 |
+
(lambda (m)
|
490 |
+
(case (ly:music-property m 'name)
|
491 |
+
((UnfoldedRepeatedMusic)
|
492 |
+
(let
|
493 |
+
((body (ly:music-property m 'element))
|
494 |
+
(altl (ly:music-property m 'elements))
|
495 |
+
(rc (ly:music-property m 'repeat-count)))
|
496 |
+
(if (null? altl)
|
497 |
+
(make-sequential-music
|
498 |
+
(list-tabulate rc (lambda (i) (ly:music-deep-copy body))))
|
499 |
+
(let ((ealtl (if (> (length altl) rc) (take altl rc) altl)))
|
500 |
+
(make-sequential-music
|
501 |
+
(apply append!
|
502 |
+
(append!
|
503 |
+
(list-tabulate
|
504 |
+
(- rc (length ealtl))
|
505 |
+
(lambda (i) (list (ly:music-deep-copy body) (ly:music-deep-copy (car ealtl)))))
|
506 |
+
(map (lambda (alt) (list (ly:music-deep-copy body) alt)) ealtl))))))))
|
507 |
+
((EventChord)
|
508 |
+
(let-values
|
509 |
+
(((trem evl)
|
510 |
+
(partition (lambda (v) (eq? (ly:music-property v 'name) 'TremoloEvent))
|
511 |
+
(ly:music-property m 'elements))))
|
512 |
+
(if (null? trem)
|
513 |
+
m
|
514 |
+
(let*
|
515 |
+
((tremtype (ly:music-property (car trem) 'tremolo-type))
|
516 |
+
(tremtype-log (1- (integer-length tremtype)))
|
517 |
+
(durev (find (lambda (v) (not (null? (ly:music-property v 'duration)))) evl))
|
518 |
+
(totaldur (if durev (ly:music-property durev 'duration) (ly:make-duration tremtype-log 0 1)))
|
519 |
+
(tgt-nrep (/ (duration-visual-length totaldur) (duration-log-factor tremtype-log)))
|
520 |
+
(eff-nrep (max (truncate tgt-nrep) 1))
|
521 |
+
(tremdur (ly:make-duration tremtype-log 0
|
522 |
+
(* (/ tgt-nrep eff-nrep) (ly:duration-scale totaldur)))))
|
523 |
+
(or (and (= eff-nrep tgt-nrep) (= (ash 1 tremtype-log) tremtype))
|
524 |
+
(ly:warning (_ "non-integer tremolo ~a:~a")
|
525 |
+
(duration->lily-string (duration-visual totaldur) #:force-duration #t #:time-scale 1)
|
526 |
+
tremtype))
|
527 |
+
(for-each
|
528 |
+
(lambda (v)
|
529 |
+
(or (null? (ly:music-property v 'duration))
|
530 |
+
(set! (ly:music-property v 'duration) tremdur)))
|
531 |
+
evl)
|
532 |
+
(set! (ly:music-property m 'elements) evl)
|
533 |
+
(make-sequential-music
|
534 |
+
(list-tabulate eff-nrep (lambda (i) (ly:music-deep-copy m))))))))
|
535 |
+
((MultiMeasureRestMusic)
|
536 |
+
(make-sequential-music
|
537 |
+
(list
|
538 |
+
(make-music 'BarCheck)
|
539 |
+
(make-music 'SkipMusic 'duration (ly:music-property m 'duration))
|
540 |
+
(make-music 'BarCheck))))
|
541 |
+
(else
|
542 |
+
m)))
|
543 |
+
(unfold-repeats '() music)))
|
544 |
+
|
545 |
+
% If there's an articulation, use it.
|
546 |
+
% If in a slur, use (1 . 1) instead (unless the note is marked staccato,
|
547 |
+
% in which case use ac:portatoFactor).
|
548 |
+
% Treat phrasing slurs as slurs, but allow explicit articulation.
|
549 |
+
%
|
550 |
+
% Expect an EventChord.
|
551 |
+
%
|
552 |
+
% trills, turns, ornaments etc. are also treated as Articulations.
|
553 |
+
% Split into two functions:
|
554 |
+
% ac:getactions traverses the elements in the EventChord
|
555 |
+
% and calculates the parameters.
|
556 |
+
% ac:articulate-chord applies the actions to each NoteEvent in
|
557 |
+
% the EventChord.
|
558 |
+
#(define (ac:getactions music)
|
559 |
+
(let ((at-end-of-slur #f))
|
560 |
+
(let loop ((factor ac:normalFactor)
|
561 |
+
(newelements '())
|
562 |
+
(es (ly:music-property music 'elements))
|
563 |
+
(actions '()))
|
564 |
+
(if (null? es)
|
565 |
+
(begin
|
566 |
+
(set! (ly:music-property music 'elements) (reverse newelements))
|
567 |
+
(if
|
568 |
+
(not (any (lambda (m) (music-is-of-type? m 'rhythmic-event))
|
569 |
+
newelements))
|
570 |
+
actions
|
571 |
+
(append
|
572 |
+
(let ((st ac:stealForward))
|
573 |
+
(if (= st 0)
|
574 |
+
'()
|
575 |
+
(begin
|
576 |
+
(set! ac:stealForward 0)
|
577 |
+
(list 'steal st))))
|
578 |
+
actions
|
579 |
+
(cond
|
580 |
+
(ac:inTrill '(trill))
|
581 |
+
((and (eq? factor ac:normalFactor) (or ac:inSlur ac:inPhrasingSlur))
|
582 |
+
(list 'articulation '(1 . 1)))
|
583 |
+
((and (eq? factor ac:staccatoFactor) (or ac:inSlur at-end-of-slur))
|
584 |
+
(list 'articulation ac:portatoFactor))
|
585 |
+
(else (list 'articulation factor))))))
|
586 |
+
; else part
|
587 |
+
(let ((e (car es))
|
588 |
+
(tail (cdr es)))
|
589 |
+
(case (ly:music-property e 'name)
|
590 |
+
|
591 |
+
((BeamEvent) ; throw away beam events, or they'll be duplicated by turn or trill
|
592 |
+
(loop factor newelements tail actions))
|
593 |
+
|
594 |
+
((LineBreakEvent FingeringEvent MarkEvent BreathingEvent TieEvent SkipEvent RestEvent) ; pass through some events.
|
595 |
+
(loop (cons 1 1) (cons e newelements) tail actions))
|
596 |
+
|
597 |
+
((ArticulationEvent)
|
598 |
+
(let ((articname (ly:music-property e 'articulation-type)))
|
599 |
+
; TODO: add more here
|
600 |
+
(cond
|
601 |
+
((string= articname "staccato")
|
602 |
+
(loop ac:staccatoFactor newelements tail actions))
|
603 |
+
((string= articname "staccatissimo")
|
604 |
+
(loop ac:staccatissimoFactor newelements tail actions))
|
605 |
+
((string= articname "portato")
|
606 |
+
(loop ac:portatoFactor newelements tail actions))
|
607 |
+
((string= articname "tenuto")
|
608 |
+
(loop ac:tenutoFactor newelements tail actions))
|
609 |
+
((string= articname "mordent")
|
610 |
+
(loop (cons 1 1) newelements tail (cons 'mordent actions)))
|
611 |
+
((string= articname "prall")
|
612 |
+
(loop (cons 1 1) newelements tail (cons 'prall actions)))
|
613 |
+
((string= articname "trill")
|
614 |
+
(loop (cons 1 1) newelements tail (cons 'trill actions)))
|
615 |
+
((string= articname "turn")
|
616 |
+
(loop (cons 1 1) newelements tail (cons 'turn actions)))
|
617 |
+
(else (loop factor (cons e newelements) tail actions)))))
|
618 |
+
|
619 |
+
((TextScriptEvent)
|
620 |
+
(let ((t (ly:music-property e 'text)))
|
621 |
+
(if (not (string? t))
|
622 |
+
(loop factor (cons e newelements) tail actions)
|
623 |
+
(begin
|
624 |
+
(cond
|
625 |
+
((or
|
626 |
+
(string= t "rall")
|
627 |
+
(string= t "Rall")
|
628 |
+
(string= t "rit.")
|
629 |
+
(string= t "rall."))
|
630 |
+
(loop factor (cons e newelements) tail (cons 'rall actions)))
|
631 |
+
((or
|
632 |
+
(string= t "accelerando")
|
633 |
+
(string= t "accel")
|
634 |
+
(string= t "accel."))
|
635 |
+
(loop factor (cons e newelements) tail (cons 'accel actions)))
|
636 |
+
((or
|
637 |
+
(string= t "poco accel."))
|
638 |
+
(loop factor (cons e newelements) tail (cons 'pocoAccel actions)))
|
639 |
+
((or
|
640 |
+
(string= t "poco rall.")
|
641 |
+
(string= t "poco rit."))
|
642 |
+
(loop factor (cons e newelements) tail (cons 'pocoRall actions)))
|
643 |
+
((or (string= t "a tempo")
|
644 |
+
(string= t "tempo I"))
|
645 |
+
(loop factor (cons e newelements) tail (cons 'aTempo actions)))
|
646 |
+
(else (loop factor (cons e newelements) tail actions)))))))
|
647 |
+
|
648 |
+
((SlurEvent)
|
649 |
+
(let ((direction (ly:music-property e 'span-direction)))
|
650 |
+
(set! ac:inSlur (eqv? direction -1))
|
651 |
+
(set! at-end-of-slur (eqv? direction 1))
|
652 |
+
(loop factor newelements tail actions)))
|
653 |
+
|
654 |
+
((TrillSpanEvent)
|
655 |
+
(let ((direction (ly:music-property e 'span-direction)))
|
656 |
+
(set! ac:inTrill (eqv? direction -1))
|
657 |
+
(if ac:inTrill
|
658 |
+
(loop factor newelements tail (cons 'trill actions))
|
659 |
+
(loop factor (cons e newelements) tail actions))))
|
660 |
+
|
661 |
+
((PhrasingSlurEvent)
|
662 |
+
(let ((direction (ly:music-property e 'span-direction)))
|
663 |
+
(set! ac:inPhrasingSlur (eqv? direction -1))
|
664 |
+
(loop factor newelements tail actions)))
|
665 |
+
|
666 |
+
(else (loop factor (cons e newelements) tail actions))))))))
|
667 |
+
|
668 |
+
|
669 |
+
|
670 |
+
#(define (ac:articulate-chord music)
|
671 |
+
(cond
|
672 |
+
((eq? 'EventChord (ly:music-property music 'name))
|
673 |
+
(ac:logEventsBackward
|
674 |
+
(let loop ((actions (ac:getactions music)))
|
675 |
+
(if (null? actions)
|
676 |
+
(if (ly:moment<? (ly:make-moment 1/4) (ly:music-length music))
|
677 |
+
(ac:to128 music)
|
678 |
+
music)
|
679 |
+
|
680 |
+
(case (car actions)
|
681 |
+
|
682 |
+
((articulation)
|
683 |
+
(map
|
684 |
+
(lambda (x) (ac:articulate-one-note x (cadr actions)))
|
685 |
+
(ly:music-property music 'elements))
|
686 |
+
(let*
|
687 |
+
((num (caadr actions))
|
688 |
+
(denom (cdadr actions))
|
689 |
+
(mult (ly:duration-factor ac:currentDuration))
|
690 |
+
(newnum (* (- denom num) (car mult)))
|
691 |
+
(newdenom (* (cdr mult) denom))
|
692 |
+
(len (ly:duration-log ac:currentDuration))
|
693 |
+
(dots (ly:duration-dot-count ac:currentDuration)))
|
694 |
+
|
695 |
+
(if (not (eqv? num denom))
|
696 |
+
(make-sequential-music
|
697 |
+
(list (ac:to128 music)
|
698 |
+
(make-music 'EventChord 'elements
|
699 |
+
(list
|
700 |
+
(make-music 'RestEvent 'duration (ly:make-duration len dots newnum newdenom))))))
|
701 |
+
music)))
|
702 |
+
|
703 |
+
((accel)
|
704 |
+
(set! ac:lastTempo ac:currentTempo)
|
705 |
+
(set! ac:currentTempo (ly:moment-div ac:currentTempo ac:rallFactor))
|
706 |
+
(let ((pset (ac:tempoChange ac:currentTempo)))
|
707 |
+
(if (null? (cdr actions))
|
708 |
+
(make-sequential-music (list pset music))
|
709 |
+
(make-sequential-music
|
710 |
+
(list pset (loop (cdr actions)))))))
|
711 |
+
|
712 |
+
((pocoAccel)
|
713 |
+
(set! ac:lastTempo ac:currentTempo)
|
714 |
+
(set! ac:currentTempo (ly:moment-div ac:currentTempo ac:pocoRallFactor))
|
715 |
+
(let ((pset (ac:tempoChange ac:currentTempo)))
|
716 |
+
(if (null? (cdr actions))
|
717 |
+
(make-sequential-music (list pset music))
|
718 |
+
(make-sequential-music
|
719 |
+
(list pset (loop (cdr actions)))))))
|
720 |
+
|
721 |
+
((rall)
|
722 |
+
(set! ac:lastTempo ac:currentTempo)
|
723 |
+
(set! ac:currentTempo (ly:moment-mul ac:currentTempo ac:rallFactor))
|
724 |
+
(let ((pset (ac:tempoChange ac:currentTempo)))
|
725 |
+
(if (null? (cdr actions))
|
726 |
+
(make-sequential-music (list pset music))
|
727 |
+
(make-sequential-music
|
728 |
+
(list pset (loop (cdr actions)))))))
|
729 |
+
|
730 |
+
((pocoRall)
|
731 |
+
(set! ac:lastTempo ac:currentTempo)
|
732 |
+
(set! ac:currentTempo (ly:moment-mul ac:currentTempo ac:pocoRallFactor))
|
733 |
+
(let ((pset (ac:tempoChange ac:currentTempo)))
|
734 |
+
(if (null? (cdr actions))
|
735 |
+
(make-sequential-music (list pset music))
|
736 |
+
(make-sequential-music
|
737 |
+
(list pset (loop (cdr actions)))))))
|
738 |
+
|
739 |
+
((aTempo)
|
740 |
+
(set! ac:currentTempo ac:lastTempo)
|
741 |
+
|
742 |
+
(let ((pset (ac:tempoChange ac:currentTempo)))
|
743 |
+
(if (null? (cdr actions))
|
744 |
+
(make-sequential-music (list pset music))
|
745 |
+
(make-sequential-music
|
746 |
+
(list pset (loop (cdr actions)))))))
|
747 |
+
|
748 |
+
((trill)
|
749 |
+
(ac:trill music))
|
750 |
+
|
751 |
+
((prall)
|
752 |
+
; A pralltriller symbol can either mean an inverted mordent
|
753 |
+
; or a half-shake -- a short, two twiddle trill.
|
754 |
+
; We implement as a half-shake.
|
755 |
+
(let*
|
756 |
+
((origlength (ly:music-length music))
|
757 |
+
(gracedur (ly:make-duration 5 0 1/1))
|
758 |
+
(gracenote (ac:note-copy music))
|
759 |
+
(abovenote (ac:note-copy music))
|
760 |
+
(abovenoteTwo (ac:note-copy music))
|
761 |
+
(mainnote (ly:music-deep-copy music)))
|
762 |
+
|
763 |
+
(map (lambda (y) (ac:setduration y gracedur))
|
764 |
+
(ly:music-property gracenote 'elements))
|
765 |
+
(map (lambda (y) (ac:setduration y gracedur))
|
766 |
+
(ly:music-property abovenote 'elements))
|
767 |
+
(map (lambda (y) (ac:setduration y gracedur))
|
768 |
+
(ly:music-property abovenoteTwo 'elements))
|
769 |
+
(map ac:up
|
770 |
+
(filter
|
771 |
+
(lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
|
772 |
+
(ly:music-property abovenote 'elements)))
|
773 |
+
(map ac:up
|
774 |
+
(filter
|
775 |
+
(lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
|
776 |
+
(ly:music-property abovenoteTwo 'elements)))
|
777 |
+
(let* ((prallMusic (make-sequential-music
|
778 |
+
(list abovenote gracenote abovenoteTwo mainnote)))
|
779 |
+
(newlen (ly:music-length prallMusic))
|
780 |
+
(factor (ly:moment-div origlength newlen)))
|
781 |
+
(ly:music-compress prallMusic factor))))
|
782 |
+
|
783 |
+
((mordent)
|
784 |
+
(let*
|
785 |
+
((origlength (ly:music-length music))
|
786 |
+
(gracedur (ly:make-duration 5 0 1/1))
|
787 |
+
(gracenote (ac:note-copy music))
|
788 |
+
(belownote (ac:note-copy music)))
|
789 |
+
(map (lambda (y) (ac:setduration y gracedur))
|
790 |
+
(ly:music-property gracenote 'elements))
|
791 |
+
(map (lambda (y) (ac:setduration y gracedur))
|
792 |
+
(ly:music-property belownote 'elements))
|
793 |
+
(map ac:down
|
794 |
+
(filter
|
795 |
+
(lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
|
796 |
+
(ly:music-property belownote 'elements)))
|
797 |
+
|
798 |
+
(let* ((mordentMusic (make-sequential-music (list gracenote belownote music)))
|
799 |
+
(newlen (ly:music-length mordentMusic))
|
800 |
+
(factor (ly:moment-div origlength newlen)))
|
801 |
+
(ly:music-compress mordentMusic factor))))
|
802 |
+
|
803 |
+
((turn)
|
804 |
+
(let*
|
805 |
+
((dur (ly:music-property
|
806 |
+
(car (ly:music-property music 'elements)) 'duration))
|
807 |
+
(factor (ly:duration-factor dur))
|
808 |
+
(newdur (ly:make-duration (+ (ly:duration-log dur) 2)
|
809 |
+
(ly:duration-dot-count dur) (car factor)(cdr factor))))
|
810 |
+
(begin
|
811 |
+
(map (lambda (y) (ac:setduration y newdur))
|
812 |
+
(ly:music-property music 'elements))
|
813 |
+
(let* ((above (ly:music-deep-copy music))
|
814 |
+
(below (ly:music-deep-copy music))
|
815 |
+
(newmusic (make-sequential-music (list above music below music))))
|
816 |
+
(begin
|
817 |
+
(map ac:down
|
818 |
+
(filter
|
819 |
+
(lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
|
820 |
+
(ly:music-property below 'elements)))
|
821 |
+
(map ac:up
|
822 |
+
(filter
|
823 |
+
(lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
|
824 |
+
(ly:music-property above 'elements)))
|
825 |
+
newmusic)))))
|
826 |
+
((steal)
|
827 |
+
(let
|
828 |
+
((totallen (ly:moment-main (ly:music-length music)))
|
829 |
+
(steallen (cadr actions)))
|
830 |
+
(if (>= steallen totallen)
|
831 |
+
(begin
|
832 |
+
(if (any (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
|
833 |
+
(ly:music-property music 'elements))
|
834 |
+
(ly:warning (_ "stealing the entirety of a note's time")))
|
835 |
+
(set! ac:stealForward (- steallen totallen))
|
836 |
+
(make-sequential-music '()))
|
837 |
+
(begin
|
838 |
+
(ly:music-compress music (ly:make-moment (/ (- totallen steallen) totallen)))
|
839 |
+
(loop (cddr actions))))))
|
840 |
+
)))))
|
841 |
+
|
842 |
+
((eq? 'GraceMusic (ly:music-property music 'name))
|
843 |
+
(let
|
844 |
+
((first-ev
|
845 |
+
(call-with-current-continuation
|
846 |
+
(lambda (yield-fev)
|
847 |
+
(music-map
|
848 |
+
(lambda (m)
|
849 |
+
(if (eq? 'EventChord (ly:music-property m 'name))
|
850 |
+
(yield-fev m)
|
851 |
+
m))
|
852 |
+
music)
|
853 |
+
#f))))
|
854 |
+
(if first-ev
|
855 |
+
(let ((fev-pos (find-tail (lambda (m) (eq? m first-ev)) ac:eventsBackward)))
|
856 |
+
(if fev-pos
|
857 |
+
(set! ac:eventsBackward (cdr fev-pos))
|
858 |
+
(ly:warning (_ "articulation of grace notes has gone awry"))))))
|
859 |
+
(let*
|
860 |
+
((gmus (ly:music-compress (ly:music-property music 'element)
|
861 |
+
(ly:make-moment ac:defaultGraceFactor)))
|
862 |
+
(glen (ly:moment-main (ly:music-length gmus))))
|
863 |
+
(ac:stealTimeBackward (* glen ac:defaultGraceBackwardness))
|
864 |
+
(set! ac:stealForward (+ ac:stealForward (* glen (- 1 ac:defaultGraceBackwardness))))
|
865 |
+
gmus))
|
866 |
+
|
867 |
+
((memq (ly:music-property music 'name) '(BarCheck SkipMusic))
|
868 |
+
(let ((totallen (ly:moment-main (ly:music-length music)))
|
869 |
+
(steallen ac:stealForward))
|
870 |
+
(cond
|
871 |
+
((= steallen 0)
|
872 |
+
(ac:logEventsBackward music))
|
873 |
+
((< steallen totallen)
|
874 |
+
(set! ac:stealForward 0)
|
875 |
+
(ac:logEventsBackward
|
876 |
+
(ly:music-compress music (ly:make-moment (/ (- totallen steallen) totallen)))))
|
877 |
+
(else
|
878 |
+
(set! ac:stealForward (- steallen totallen))
|
879 |
+
(make-sequential-music '())))))
|
880 |
+
|
881 |
+
((eq? 'KeyChangeEvent (ly:music-property music 'name))
|
882 |
+
(set! ac:current-key music)
|
883 |
+
music)
|
884 |
+
|
885 |
+
((eq? 'PropertySet (ly:music-property music 'name))
|
886 |
+
(ac:adjust-props (ly:music-property music 'symbol) music)
|
887 |
+
music)
|
888 |
+
|
889 |
+
(else music)))
|
890 |
+
|
891 |
+
|
892 |
+
|
893 |
+
% At last ... here's the music function that applies all the above to a
|
894 |
+
% score.
|
895 |
+
%% NOTE: 'articulate-unfold' is the function of original version,
|
896 |
+
%% now 'articulate' is the version which 'unfoldMusic' was removed.
|
897 |
+
articulate = #(define-music-function (music)
|
898 |
+
(ly:music?)
|
899 |
+
"Adjust times of note to add tenuto, staccato and
|
900 |
+
normal articulations.
|
901 |
+
"
|
902 |
+
(dynamic-wind
|
903 |
+
(lambda ()
|
904 |
+
(set! ac:stealForward 0)
|
905 |
+
(set! ac:eventsBackward '()))
|
906 |
+
(lambda ()
|
907 |
+
(music-map
|
908 |
+
ac:articulate-chord
|
909 |
+
(ac:startup-replacements music)))
|
910 |
+
(lambda ()
|
911 |
+
(or (= ac:stealForward 0)
|
912 |
+
(begin
|
913 |
+
(ly:warning (_ "articulation failed to steal ~a note at end of music") ac:stealForward)
|
914 |
+
(set! ac:stealForward 0)))
|
915 |
+
(set! ac:eventsBackward '()))))
|
916 |
+
|
917 |
+
articulate-unfold = #(define-music-function (music)
|
918 |
+
(ly:music?)
|
919 |
+
"Adjust times of note to add tenuto, staccato and
|
920 |
+
normal articulations.
|
921 |
+
"
|
922 |
+
(dynamic-wind
|
923 |
+
(lambda ()
|
924 |
+
(set! ac:stealForward 0)
|
925 |
+
(set! ac:eventsBackward '()))
|
926 |
+
(lambda ()
|
927 |
+
(music-map
|
928 |
+
ac:articulate-chord
|
929 |
+
(ac:startup-replacements-unfold music)))
|
930 |
+
(lambda ()
|
931 |
+
(or (= ac:stealForward 0)
|
932 |
+
(begin
|
933 |
+
(ly:warning (_ "articulation failed to steal ~a note at end of music") ac:stealForward)
|
934 |
+
(set! ac:stealForward 0)))
|
935 |
+
(set! ac:eventsBackward '()))))
|
936 |
+
|
937 |
+
#(define (ac:startup-replacements music)
|
938 |
+
(fold (lambda (f m) (f m))
|
939 |
+
music
|
940 |
+
(list
|
941 |
+
event-chord-wrap!
|
942 |
+
ac:replace-aftergrace
|
943 |
+
ac:replace-appoggiatura
|
944 |
+
)))
|
945 |
+
|
946 |
+
#(define (ac:startup-replacements-unfold music)
|
947 |
+
(fold (lambda (f m) (f m))
|
948 |
+
music
|
949 |
+
(list
|
950 |
+
event-chord-wrap!
|
951 |
+
ac:replace-aftergrace
|
952 |
+
ac:replace-appoggiatura
|
953 |
+
ac:unfoldMusic
|
954 |
+
)))
|
955 |
+
|
956 |
+
#(define (ac:replace-aftergrace music)
|
957 |
+
(map-some-music
|
958 |
+
(lambda (expr)
|
959 |
+
(with-music-match
|
960 |
+
(expr (music 'SimultaneousMusic
|
961 |
+
elements (?before-grace
|
962 |
+
(music 'SequentialMusic
|
963 |
+
elements ((music 'SkipMusic)
|
964 |
+
(music 'GraceMusic
|
965 |
+
element ?grace))))))
|
966 |
+
(ac:aftergrace ?before-grace ?grace)))
|
967 |
+
music))
|
968 |
+
|
969 |
+
#(define (ac:replace-appoggiatura music)
|
970 |
+
;; appoggiature are ugly to deal with since they require a main
|
971 |
+
;; note following them. We only try dealing with this followership
|
972 |
+
;; in sequential music
|
973 |
+
(map-some-music
|
974 |
+
(lambda (m)
|
975 |
+
(if (eq? 'SequentialMusic (ly:music-property m 'name))
|
976 |
+
(pair-for-each
|
977 |
+
(lambda (elts)
|
978 |
+
(let ((expr (car elts))
|
979 |
+
(main (and (pair? (cdr elts)) (cadr elts))))
|
980 |
+
(and main
|
981 |
+
;;stolen from define-music-display-methods
|
982 |
+
(with-music-match
|
983 |
+
(expr (music
|
984 |
+
'GraceMusic
|
985 |
+
element (music
|
986 |
+
'SequentialMusic
|
987 |
+
elements (?start
|
988 |
+
?music
|
989 |
+
?stop))))
|
990 |
+
;; we check whether ?start and ?stop look like
|
991 |
+
;; startAppoggiaturaMusic stopAppoggiaturaMusic
|
992 |
+
(and (with-music-match (?start (music
|
993 |
+
'SequentialMusic
|
994 |
+
elements ((music
|
995 |
+
'EventChord
|
996 |
+
elements
|
997 |
+
((music
|
998 |
+
'SlurEvent
|
999 |
+
span-direction START))))))
|
1000 |
+
#t)
|
1001 |
+
(with-music-match (?stop (music
|
1002 |
+
'SequentialMusic
|
1003 |
+
elements ((music
|
1004 |
+
'EventChord
|
1005 |
+
elements
|
1006 |
+
((music
|
1007 |
+
'SlurEvent
|
1008 |
+
span-direction STOP))))))
|
1009 |
+
#t)
|
1010 |
+
(let* ((app (ac:appoggiatura ?music main))
|
1011 |
+
(apps (ly:music-property app 'elements)))
|
1012 |
+
(set-car! elts (car apps))
|
1013 |
+
(set-car! (cdr elts) (cadr apps))
|
1014 |
+
#f))))))
|
1015 |
+
(ly:music-property m 'elements)))
|
1016 |
+
#f)
|
1017 |
+
music))
|
1018 |
+
|
1019 |
+
% Override \afterGrace to be in terms of audio, not spacing.
|
1020 |
+
% Special handling for a gruppetto after a trill.
|
1021 |
+
#(define (ac:aftergrace main grace)
|
1022 |
+
(let*
|
1023 |
+
((main-length (ly:music-length main))
|
1024 |
+
(grace-orig-length (ly:music-length grace))
|
1025 |
+
(gracelen (ac:twiddletime main))
|
1026 |
+
(grace-factor (ly:moment-div gracelen grace-orig-length))
|
1027 |
+
(new-main-length (ly:moment-sub main-length gracelen))
|
1028 |
+
(factor (ly:moment-div new-main-length main-length))
|
1029 |
+
)
|
1030 |
+
(map (lambda (y) (set! (ly:music-property y 'twiddle) gracelen))
|
1031 |
+
(filter (lambda (z)
|
1032 |
+
(and
|
1033 |
+
(eq? 'ArticulationEvent (ly:music-property z 'name))
|
1034 |
+
(string= "trill" (ly:music-property z 'articulation-type))))
|
1035 |
+
(ly:music-property main 'elements)))
|
1036 |
+
(ac:add-articulation "tenuto" grace)
|
1037 |
+
(make-sequential-music (list (ly:music-compress main factor) (ly:music-compress grace grace-factor)))))
|
1038 |
+
|
1039 |
+
% An appoggiatura takes half the duration of the main note,
|
1040 |
+
% or 1/3 if the note is dotted (i.e., half the undotted equivalent time)
|
1041 |
+
% Somewhere around the end of the 19th, start of 20th century the rules
|
1042 |
+
% changed, but my main interest is early music.
|
1043 |
+
#(define (ac:appoggiatura grace main)
|
1044 |
+
(let* ((maindur (ly:music-length main))
|
1045 |
+
(grace-orig-len (ly:music-length grace))
|
1046 |
+
(main-orig-len (ly:music-length main))
|
1047 |
+
(numerator (ly:moment-main-numerator maindur))
|
1048 |
+
(factor (if (eqv? (remainder numerator 3) 0)
|
1049 |
+
(ly:make-moment 1/3) (ly:make-moment 1/2))))
|
1050 |
+
(ly:music-compress grace
|
1051 |
+
(ly:moment-mul factor (ly:moment-div main-orig-len grace-orig-len)))
|
1052 |
+
(ly:music-compress main (ly:moment-sub (ly:make-moment 1/1) factor))
|
1053 |
+
|
1054 |
+
(set! (ly:music-property grace 'elements)
|
1055 |
+
(append (ly:music-property grace 'elements)
|
1056 |
+
(list (make-music 'SlurEvent 'span-direction -1))))
|
1057 |
+
(set! (ly:music-property main 'elements)
|
1058 |
+
(append (ly:music-property main 'elements)
|
1059 |
+
(list (make-music 'SlurEvent 'span-direction 1))))
|
1060 |
+
(make-sequential-music (list grace main))))
|
ly/lotus.ly
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
% \lotusRepeatABA { {A} B }
|
3 |
+
% ->
|
4 |
+
% {A} B {A}
|
5 |
+
lotusRepeatABA = #(define-music-function (music)
|
6 |
+
(ly:music?)
|
7 |
+
"The placeholder function to represent a music repeat type AB -> ABA,
|
8 |
+
e.g. Da Capo al Fine, Da Segno al Coda, etc.
|
9 |
+
"
|
10 |
+
music
|
11 |
+
)
|
ly/rhythmSymbols.ly
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
dotB = \markup { \char ##x25cf }
|
3 |
+
dotW = \markup { \char ##x25cb }
|
4 |
+
|
5 |
+
lyrRed = { \override Lyrics.LyricText.color = #red \override Lyrics.LyricText.font-series = #'bold }
|
6 |
+
lyrGreen = { \override Lyrics.LyricText.color = #darkgreen \override Lyrics.LyricText.font-series = #'bold }
|
7 |
+
lyrYellow = { \override Lyrics.LyricText.color = #(rgb-color 0.6 0.4 0) \override Lyrics.LyricText.font-series = #'bold }
|
8 |
+
lyrGray = { \override Lyrics.LyricText.color = #(rgb-color 0.8 0.8 0.8) \revert Lyrics.LyricText.font-series }
|