@k-l-lambda/lilylet 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -0
- package/lib/grammar.jison.js +1263 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +6 -0
- package/lib/meiEncoder.d.ts +8 -0
- package/lib/meiEncoder.js +1386 -0
- package/lib/musicXmlDecoder.d.ts +20 -0
- package/lib/musicXmlDecoder.js +1047 -0
- package/lib/musicXmlTypes.d.ts +199 -0
- package/lib/musicXmlTypes.js +7 -0
- package/lib/musicXmlUtils.d.ts +81 -0
- package/lib/musicXmlUtils.js +435 -0
- package/lib/parser.d.ts +3 -0
- package/lib/parser.js +151 -0
- package/lib/serializer.d.ts +11 -0
- package/lib/serializer.js +578 -0
- package/lib/types.d.ts +241 -0
- package/lib/types.js +99 -0
- package/package.json +57 -0
- package/source/lilylet/grammar.jison.js +1263 -0
- package/source/lilylet/index.ts +12 -0
- package/source/lilylet/lilylet.jison +593 -0
- package/source/lilylet/lilypondDecoder.ts +789 -0
- package/source/lilylet/meiEncoder.ts +1780 -0
- package/source/lilylet/musicXmlDecoder.ts +1311 -0
- package/source/lilylet/musicXmlTypes.ts +205 -0
- package/source/lilylet/musicXmlUtils.ts +532 -0
- package/source/lilylet/parser.ts +178 -0
- package/source/lilylet/serializer.ts +748 -0
- package/source/lilylet/types.ts +304 -0
|
@@ -0,0 +1,1263 @@
|
|
|
1
|
+
/* parser generated by jison 0.4.18 */
|
|
2
|
+
/*
|
|
3
|
+
Returns a Parser object of the following structure:
|
|
4
|
+
|
|
5
|
+
Parser: {
|
|
6
|
+
yy: {}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
Parser.prototype: {
|
|
10
|
+
yy: {},
|
|
11
|
+
trace: function(),
|
|
12
|
+
symbols_: {associative list: name ==> number},
|
|
13
|
+
terminals_: {associative list: number ==> name},
|
|
14
|
+
productions_: [...],
|
|
15
|
+
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
|
16
|
+
table: [...],
|
|
17
|
+
defaultActions: {...},
|
|
18
|
+
parseError: function(str, hash),
|
|
19
|
+
parse: function(input),
|
|
20
|
+
|
|
21
|
+
lexer: {
|
|
22
|
+
EOF: 1,
|
|
23
|
+
parseError: function(str, hash),
|
|
24
|
+
setInput: function(input),
|
|
25
|
+
input: function(),
|
|
26
|
+
unput: function(str),
|
|
27
|
+
more: function(),
|
|
28
|
+
less: function(n),
|
|
29
|
+
pastInput: function(),
|
|
30
|
+
upcomingInput: function(),
|
|
31
|
+
showPosition: function(),
|
|
32
|
+
test_match: function(regex_match_array, rule_index),
|
|
33
|
+
next: function(),
|
|
34
|
+
lex: function(),
|
|
35
|
+
begin: function(condition),
|
|
36
|
+
popState: function(),
|
|
37
|
+
_currentRules: function(),
|
|
38
|
+
topState: function(),
|
|
39
|
+
pushState: function(condition),
|
|
40
|
+
|
|
41
|
+
options: {
|
|
42
|
+
ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
|
43
|
+
flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
|
44
|
+
backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
|
48
|
+
rules: [...],
|
|
49
|
+
conditions: {associative list: name ==> set},
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
token location info (@$, _$, etc.): {
|
|
55
|
+
first_line: n,
|
|
56
|
+
last_line: n,
|
|
57
|
+
first_column: n,
|
|
58
|
+
last_column: n,
|
|
59
|
+
range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
|
64
|
+
text: (matched text)
|
|
65
|
+
token: (the produced terminal token, if any)
|
|
66
|
+
line: (yylineno)
|
|
67
|
+
}
|
|
68
|
+
while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
|
69
|
+
loc: (yylloc)
|
|
70
|
+
expected: (string describing the set of expected tokens)
|
|
71
|
+
recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
|
72
|
+
}
|
|
73
|
+
*/
|
|
74
|
+
Object.defineProperty(globalThis, "__lilyletGrammar__", { value: (function(){
|
|
75
|
+
var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[5,22,25,28,40,41,42,47,50,57,58,66,67,72,74,76,77,80,81,82,83,86,87],$V1=[2,29],$V2=[1,9],$V3=[1,10],$V4=[1,11],$V5=[1,12],$V6=[1,13],$V7=[1,14],$V8=[1,15],$V9=[1,16],$Va=[1,26],$Vb=[1,27],$Vc=[5,9,11,14,15,16,17,18,19,20,22,25,28,40,41,42,47,50,57,58,66,67,72,74,76,77,80,81,82,83,86,87],$Vd=[5,9,22,25,28,40,41,42,47,50,57,58,66,67,72,74,76,77,80,81,82,83,86,87],$Ve=[5,22],$Vf=[5,22,25],$Vg=[1,37],$Vh=[5,22,25,28],$Vi=[1,63],$Vj=[1,64],$Vk=[1,65],$Vl=[1,66],$Vm=[1,67],$Vn=[1,68],$Vo=[1,51],$Vp=[1,52],$Vq=[1,69],$Vr=[1,70],$Vs=[1,71],$Vt=[1,72],$Vu=[1,73],$Vv=[1,74],$Vw=[1,75],$Vx=[1,76],$Vy=[1,77],$Vz=[1,60],$VA=[1,61],$VB=[1,62],$VC=[2,22],$VD=[5,9,22,25,28,40,41,42,47,50,57,58,66,67,72,74,76,77,80,81,82,83,85,86,87],$VE=[5,9,13,22,25,28,40,41,42,47,49,50,56,57,58,66,67,72,74,76,77,79,80,81,82,83,85,86,87,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143],$VF=[2,95],$VG=[1,93],$VH=[5,9,13,22,25,28,40,41,42,47,49,50,54,56,57,58,66,67,72,74,76,77,79,80,81,82,83,85,86,87,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143],$VI=[5,9,22,25,28,40,41,47,50,57,58,66,67,72,74,76,77,80,81,82,83,85,86,87],$VJ=[1,177],$VK=[1,182],$VL=[1,145],$VM=[1,146],$VN=[1,144],$VO=[1,179],$VP=[1,138],$VQ=[1,139],$VR=[1,140],$VS=[1,141],$VT=[1,142],$VU=[1,143],$VV=[1,149],$VW=[1,148],$VX=[1,147],$VY=[1,150],$VZ=[1,151],$V_=[1,152],$V$=[1,153],$V01=[1,154],$V11=[1,155],$V21=[1,156],$V31=[1,157],$V41=[1,158],$V51=[1,159],$V61=[1,160],$V71=[1,161],$V81=[1,162],$V91=[1,163],$Va1=[1,164],$Vb1=[1,165],$Vc1=[1,166],$Vd1=[1,167],$Ve1=[1,168],$Vf1=[1,169],$Vg1=[1,170],$Vh1=[1,171],$Vi1=[1,172],$Vj1=[1,173],$Vk1=[1,174],$Vl1=[1,175],$Vm1=[1,176],$Vn1=[1,178],$Vo1=[1,180],$Vp1=[1,181],$Vq1=[5,9,13,22,25,28,40,41,42,47,49,50,56,57,58,66,67,72,74,75,76,77,79,80,81,82,83,85,86,87,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143],$Vr1=[9,40,41,42,47,50,57,58,66,67,72,74,76,77,80,81,82,83,85,86,87],$Vs1=[49,50],$Vt1=[5,9,13,22,25,28,40,41,42,47,49,50,52,53,54,56,57,58,66,67,72,74,76,77,79,80,81,82,83,85,86,87,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143];
|
|
76
|
+
var parser = {trace: function trace () { },
|
|
77
|
+
yy: {},
|
|
78
|
+
symbols_: {"error":2,"document":3,"content":4,"EOF":5,"headers":6,"measures":7,"newlines":8,"NEWLINE":9,"header":10,"HEADER_TITLE":11,"STRING":12,"]":13,"HEADER_SUBTITLE":14,"HEADER_COMPOSER":15,"HEADER_ARRANGER":16,"HEADER_LYRICIST":17,"HEADER_OPUS":18,"HEADER_INSTRUMENT":19,"HEADER_GENRE":20,"measure_content":21,"|":22,"parts":23,"part_voices":24,"PART_SEP":25,"part_start":26,"voice_events":27,"VOICE_SEP":28,"event":29,"note_event":30,"rest_event":31,"context_event":32,"grace_event":33,"tuplet_event":34,"tremolo_event":35,"pitch_reset_event":36,"barline_event":37,"harmony_event":38,"markup_event":39,"CMD_BAR":40,"CMD_CHORDS":41,"CMD_MARKUP":42,"chord":43,"duration":44,"post_events":45,"pitch":46,"<":47,"pitches":48,">":49,"PITCH":50,"octave":51,"OCT_UP":52,"OCT_DOWN":53,"NUMBER":54,"dots":55,".":56,"REST_CHAR":57,"SPACE_CHAR":58,"clef_cmd":59,"key_cmd":60,"time_cmd":61,"tempo_cmd":62,"staff_cmd":63,"ottava_cmd":64,"stem_cmd":65,"CMD_CLEF":66,"CMD_KEY":67,"pitch_name":68,"mode":69,"MODE_MAJOR":70,"MODE_MINOR":71,"CMD_TIME":72,"/":73,"CMD_TEMPO":74,"=":75,"CMD_STAFF":76,"CMD_OTTAVA":77,"#":78,"-":79,"CMD_STEMUP":80,"CMD_STEMDOWN":81,"CMD_STEMNEUTRAL":82,"CMD_GRACE":83,"{":84,"}":85,"CMD_TIMES":86,"CMD_REPEAT":87,"TREMOLO":88,"post_event":89,"articulation_mark":90,"ornament_mark":91,"dynamic_mark":92,"hairpin_mark":93,"pedal_mark":94,"tie_mark":95,"slur_mark":96,"beam_mark":97,"tremolo_mark":98,"direction_mark":99,"rest_mark":100,"fingering_mark":101,"navigation_mark":102,"markup_mark":103,"CMD_REST":104,"ART_STACCATO":105,"ART_STACCATISSIMO":106,"ART_TENUTO":107,"ART_MARCATO":108,"ART_ACCENT":109,"ART_PORTATO":110,"_":111,"^":112,"!":113,"ORN_TRILL":114,"ORN_TURN":115,"ORN_MORDENT":116,"ORN_PRALL":117,"ORN_FERMATA":118,"ORN_SHORTFERMATA":119,"ORN_ARPEGGIO":120,"DYN_PPP":121,"DYN_PP":122,"DYN_P":123,"DYN_MP":124,"DYN_MF":125,"DYN_F":126,"DYN_FF":127,"DYN_FFF":128,"DYN_SFZ":129,"DYN_RFZ":130,"DYN_SF":131,"CMD_CRESC_BEGIN":132,"CMD_DIM_BEGIN":133,"CMD_DYNAMICS_END":134,"CMD_SUSTAINON":135,"CMD_SUSTAINOFF":136,"~":137,"(":138,")":139,"[":140,":":141,"CMD_CODA":142,"CMD_SEGNO":143,"$accept":0,"$end":1},
|
|
79
|
+
terminals_: {2:"error",5:"EOF",9:"NEWLINE",11:"HEADER_TITLE",12:"STRING",13:"]",14:"HEADER_SUBTITLE",15:"HEADER_COMPOSER",16:"HEADER_ARRANGER",17:"HEADER_LYRICIST",18:"HEADER_OPUS",19:"HEADER_INSTRUMENT",20:"HEADER_GENRE",22:"|",25:"PART_SEP",28:"VOICE_SEP",40:"CMD_BAR",41:"CMD_CHORDS",42:"CMD_MARKUP",47:"<",49:">",50:"PITCH",52:"OCT_UP",53:"OCT_DOWN",54:"NUMBER",56:".",57:"REST_CHAR",58:"SPACE_CHAR",66:"CMD_CLEF",67:"CMD_KEY",70:"MODE_MAJOR",71:"MODE_MINOR",72:"CMD_TIME",73:"/",74:"CMD_TEMPO",75:"=",76:"CMD_STAFF",77:"CMD_OTTAVA",78:"#",79:"-",80:"CMD_STEMUP",81:"CMD_STEMDOWN",82:"CMD_STEMNEUTRAL",83:"CMD_GRACE",84:"{",85:"}",86:"CMD_TIMES",87:"CMD_REPEAT",88:"TREMOLO",104:"CMD_REST",105:"ART_STACCATO",106:"ART_STACCATISSIMO",107:"ART_TENUTO",108:"ART_MARCATO",109:"ART_ACCENT",110:"ART_PORTATO",111:"_",112:"^",113:"!",114:"ORN_TRILL",115:"ORN_TURN",116:"ORN_MORDENT",117:"ORN_PRALL",118:"ORN_FERMATA",119:"ORN_SHORTFERMATA",120:"ORN_ARPEGGIO",121:"DYN_PPP",122:"DYN_PP",123:"DYN_P",124:"DYN_MP",125:"DYN_MF",126:"DYN_F",127:"DYN_FF",128:"DYN_FFF",129:"DYN_SFZ",130:"DYN_RFZ",131:"DYN_SF",132:"CMD_CRESC_BEGIN",133:"CMD_DIM_BEGIN",134:"CMD_DYNAMICS_END",135:"CMD_SUSTAINON",136:"CMD_SUSTAINOFF",137:"~",138:"(",139:")",140:"[",141:":",142:"CMD_CODA",143:"CMD_SEGNO"},
|
|
80
|
+
productions_: [0,[3,2],[4,2],[4,3],[4,2],[4,1],[8,1],[8,2],[6,1],[6,2],[6,2],[6,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[10,3],[7,1],[7,3],[7,2],[21,1],[23,1],[23,4],[26,0],[24,1],[24,3],[27,0],[27,2],[29,1],[29,1],[29,1],[29,1],[29,1],[29,1],[29,1],[29,1],[29,1],[29,1],[37,2],[38,2],[39,2],[36,1],[30,3],[30,3],[30,2],[30,2],[43,3],[48,1],[48,2],[46,2],[46,1],[51,1],[51,1],[51,2],[51,2],[44,2],[55,0],[55,2],[31,3],[31,3],[31,2],[31,2],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[59,2],[60,3],[68,1],[69,1],[69,1],[61,4],[62,5],[62,2],[62,4],[63,2],[64,3],[64,4],[64,1],[65,1],[65,1],[65,1],[33,4],[33,2],[33,2],[34,7],[35,9],[35,8],[35,7],[45,0],[45,2],[89,1],[89,1],[89,1],[89,1],[89,1],[89,1],[89,1],[89,1],[89,1],[89,1],[89,1],[89,1],[89,1],[89,1],[100,1],[90,1],[90,1],[90,1],[90,1],[90,1],[90,1],[90,2],[90,2],[90,2],[90,2],[90,2],[90,2],[90,1],[90,1],[90,1],[90,1],[90,1],[90,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[93,1],[93,1],[93,1],[94,1],[94,1],[95,1],[96,1],[96,1],[97,1],[97,1],[98,2],[99,2],[99,2],[101,2],[102,1],[102,1],[103,2]],
|
|
81
|
+
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
|
82
|
+
/* this == yyval */
|
|
83
|
+
|
|
84
|
+
var $0 = $$.length - 1;
|
|
85
|
+
switch (yystate) {
|
|
86
|
+
case 1:
|
|
87
|
+
return { metadata: $$[$0-1].metadata, measures: $$[$0-1].measures };
|
|
88
|
+
break;
|
|
89
|
+
case 2:
|
|
90
|
+
this.$ = ({ metadata: $$[$0-1], measures: $$[$0] });
|
|
91
|
+
break;
|
|
92
|
+
case 3:
|
|
93
|
+
this.$ = ({ metadata: $$[$0-2], measures: $$[$0] });
|
|
94
|
+
break;
|
|
95
|
+
case 4: case 5:
|
|
96
|
+
this.$ = ({ metadata: undefined, measures: $$[$0] });
|
|
97
|
+
break;
|
|
98
|
+
case 8:
|
|
99
|
+
this.$ = $$[$0];
|
|
100
|
+
break;
|
|
101
|
+
case 9:
|
|
102
|
+
this.$ = ({ ...$$[$0-1], ...$$[$0] });
|
|
103
|
+
break;
|
|
104
|
+
case 10: case 49:
|
|
105
|
+
this.$ = $$[$0-1];
|
|
106
|
+
break;
|
|
107
|
+
case 11:
|
|
108
|
+
this.$ = ({ ...$$[$0-2], ...$$[$0] });
|
|
109
|
+
break;
|
|
110
|
+
case 12:
|
|
111
|
+
this.$ = ({ title: $$[$0-1].slice(1, -1) });
|
|
112
|
+
break;
|
|
113
|
+
case 13:
|
|
114
|
+
this.$ = ({ subtitle: $$[$0-1].slice(1, -1) });
|
|
115
|
+
break;
|
|
116
|
+
case 14:
|
|
117
|
+
this.$ = ({ composer: $$[$0-1].slice(1, -1) });
|
|
118
|
+
break;
|
|
119
|
+
case 15:
|
|
120
|
+
this.$ = ({ arranger: $$[$0-1].slice(1, -1) });
|
|
121
|
+
break;
|
|
122
|
+
case 16:
|
|
123
|
+
this.$ = ({ lyricist: $$[$0-1].slice(1, -1) });
|
|
124
|
+
break;
|
|
125
|
+
case 17:
|
|
126
|
+
this.$ = ({ opus: $$[$0-1].slice(1, -1) });
|
|
127
|
+
break;
|
|
128
|
+
case 18:
|
|
129
|
+
this.$ = ({ instrument: $$[$0-1].slice(1, -1) });
|
|
130
|
+
break;
|
|
131
|
+
case 19:
|
|
132
|
+
this.$ = ({ genre: $$[$0-1].slice(1, -1) });
|
|
133
|
+
break;
|
|
134
|
+
case 20: case 50:
|
|
135
|
+
this.$ = [$$[$0]];
|
|
136
|
+
break;
|
|
137
|
+
case 21:
|
|
138
|
+
this.$ = $$[$0-2].concat([$$[$0]]);
|
|
139
|
+
break;
|
|
140
|
+
case 22:
|
|
141
|
+
this.$ = $$[$0-1];
|
|
142
|
+
break;
|
|
143
|
+
case 23:
|
|
144
|
+
this.$ = measure($$[$0], currentKey, currentTimeSig);
|
|
145
|
+
break;
|
|
146
|
+
case 24:
|
|
147
|
+
this.$ = [part($$[$0])];
|
|
148
|
+
break;
|
|
149
|
+
case 25:
|
|
150
|
+
this.$ = $$[$0-3].concat([part($$[$0])]);
|
|
151
|
+
break;
|
|
152
|
+
case 26:
|
|
153
|
+
currentStaff = 1;
|
|
154
|
+
break;
|
|
155
|
+
case 27:
|
|
156
|
+
this.$ = [voice(currentStaff, $$[$0])];
|
|
157
|
+
break;
|
|
158
|
+
case 28:
|
|
159
|
+
this.$ = $$[$0-2].concat([voice(currentStaff, $$[$0])]);
|
|
160
|
+
break;
|
|
161
|
+
case 29: case 95:
|
|
162
|
+
this.$ = [];
|
|
163
|
+
break;
|
|
164
|
+
case 30:
|
|
165
|
+
this.$ = $$[$0-1].concat(Array.isArray($$[$0]) ? $$[$0] : [$$[$0]]);
|
|
166
|
+
break;
|
|
167
|
+
case 41:
|
|
168
|
+
this.$ = barlineEvent($$[$0].slice(1, -1));
|
|
169
|
+
break;
|
|
170
|
+
case 42:
|
|
171
|
+
this.$ = harmonyEvent($$[$0].slice(1, -1));
|
|
172
|
+
break;
|
|
173
|
+
case 43:
|
|
174
|
+
this.$ = markupEvent($$[$0].slice(1, -1));
|
|
175
|
+
break;
|
|
176
|
+
case 44:
|
|
177
|
+
this.$ = ({ type: 'pitchReset' });
|
|
178
|
+
break;
|
|
179
|
+
case 45: case 46:
|
|
180
|
+
currentDuration = $$[$0-1]; this.$ = noteEvent($$[$0-2], $$[$0-1], $$[$0]);
|
|
181
|
+
break;
|
|
182
|
+
case 47: case 48:
|
|
183
|
+
this.$ = noteEvent($$[$0-1], currentDuration, $$[$0]);
|
|
184
|
+
break;
|
|
185
|
+
case 51: case 96:
|
|
186
|
+
this.$ = $$[$0-1].concat([$$[$0]]);
|
|
187
|
+
break;
|
|
188
|
+
case 52:
|
|
189
|
+
this.$ = parsePitch($$[$0-1], $$[$0]);
|
|
190
|
+
break;
|
|
191
|
+
case 53:
|
|
192
|
+
this.$ = parsePitch($$[$0], 0);
|
|
193
|
+
break;
|
|
194
|
+
case 54:
|
|
195
|
+
this.$ = 1;
|
|
196
|
+
break;
|
|
197
|
+
case 55:
|
|
198
|
+
this.$ = -1;
|
|
199
|
+
break;
|
|
200
|
+
case 56:
|
|
201
|
+
this.$ = $$[$0-1] + 1;
|
|
202
|
+
break;
|
|
203
|
+
case 57:
|
|
204
|
+
this.$ = $$[$0-1] - 1;
|
|
205
|
+
break;
|
|
206
|
+
case 58:
|
|
207
|
+
this.$ = duration(Number($$[$0-1]), $$[$0]);
|
|
208
|
+
break;
|
|
209
|
+
case 59:
|
|
210
|
+
this.$ = 0;
|
|
211
|
+
break;
|
|
212
|
+
case 60:
|
|
213
|
+
this.$ = $$[$0-1] + 1;
|
|
214
|
+
break;
|
|
215
|
+
case 61:
|
|
216
|
+
currentDuration = $$[$0-1]; this.$ = restEvent($$[$0-1], { fullMeasure: $$[$0-2] === 'R' });
|
|
217
|
+
break;
|
|
218
|
+
case 62:
|
|
219
|
+
currentDuration = $$[$0-1]; this.$ = restEvent($$[$0-1], { invisible: true });
|
|
220
|
+
break;
|
|
221
|
+
case 63:
|
|
222
|
+
this.$ = restEvent(currentDuration, { fullMeasure: $$[$0-1] === 'R' });
|
|
223
|
+
break;
|
|
224
|
+
case 64:
|
|
225
|
+
this.$ = restEvent(currentDuration, { invisible: true });
|
|
226
|
+
break;
|
|
227
|
+
case 65:
|
|
228
|
+
this.$ = contextChange({ clef: $$[$0] });
|
|
229
|
+
break;
|
|
230
|
+
case 66:
|
|
231
|
+
this.$ = contextChange({ key: $$[$0] });
|
|
232
|
+
break;
|
|
233
|
+
case 67:
|
|
234
|
+
this.$ = contextChange({ time: $$[$0] });
|
|
235
|
+
break;
|
|
236
|
+
case 68:
|
|
237
|
+
this.$ = contextChange({ tempo: $$[$0] });
|
|
238
|
+
break;
|
|
239
|
+
case 69:
|
|
240
|
+
this.$ = contextChange({ staff: $$[$0] });
|
|
241
|
+
break;
|
|
242
|
+
case 70:
|
|
243
|
+
this.$ = contextChange({ ottava: $$[$0] });
|
|
244
|
+
break;
|
|
245
|
+
case 71:
|
|
246
|
+
this.$ = contextChange({ stemDirection: $$[$0] });
|
|
247
|
+
break;
|
|
248
|
+
case 72:
|
|
249
|
+
this.$ = $$[$0].slice(1, -1);
|
|
250
|
+
break;
|
|
251
|
+
case 73:
|
|
252
|
+
currentKey = keySignature($$[$0-1].phonet, $$[$0-1].accidental, $$[$0]); this.$ = currentKey;
|
|
253
|
+
break;
|
|
254
|
+
case 74:
|
|
255
|
+
this.$ = parsePitchName($$[$0]);
|
|
256
|
+
break;
|
|
257
|
+
case 75:
|
|
258
|
+
this.$ = 'major';
|
|
259
|
+
break;
|
|
260
|
+
case 76:
|
|
261
|
+
this.$ = 'minor';
|
|
262
|
+
break;
|
|
263
|
+
case 77:
|
|
264
|
+
currentTimeSig = fraction(Number($$[$0-2]), Number($$[$0])); this.$ = currentTimeSig;
|
|
265
|
+
break;
|
|
266
|
+
case 78:
|
|
267
|
+
this.$ = ({ text: $$[$0-3].slice(1, -1), beat: $$[$0-2], bpm: Number($$[$0]) });
|
|
268
|
+
break;
|
|
269
|
+
case 79:
|
|
270
|
+
this.$ = ({ text: $$[$0].slice(1, -1) });
|
|
271
|
+
break;
|
|
272
|
+
case 80:
|
|
273
|
+
this.$ = ({ beat: $$[$0-2], bpm: Number($$[$0]) });
|
|
274
|
+
break;
|
|
275
|
+
case 81:
|
|
276
|
+
currentStaff = Number($$[$0].slice(1, -1)); this.$ = currentStaff;
|
|
277
|
+
break;
|
|
278
|
+
case 82:
|
|
279
|
+
this.$ = Number($$[$0]);
|
|
280
|
+
break;
|
|
281
|
+
case 83:
|
|
282
|
+
this.$ = -Number($$[$0]);
|
|
283
|
+
break;
|
|
284
|
+
case 84:
|
|
285
|
+
this.$ = 0;
|
|
286
|
+
break;
|
|
287
|
+
case 85:
|
|
288
|
+
this.$ = 'up';
|
|
289
|
+
break;
|
|
290
|
+
case 86:
|
|
291
|
+
this.$ = 'down';
|
|
292
|
+
break;
|
|
293
|
+
case 87:
|
|
294
|
+
this.$ = 'auto';
|
|
295
|
+
break;
|
|
296
|
+
case 88:
|
|
297
|
+
this.$ = ($$[$0-1].filter(e => e.type === 'note' || e.type === 'rest').map(e => ({ ...e, grace: true })));
|
|
298
|
+
break;
|
|
299
|
+
case 89: case 90:
|
|
300
|
+
this.$ = ({ ...$$[$0], grace: true });
|
|
301
|
+
break;
|
|
302
|
+
case 91:
|
|
303
|
+
this.$ = tupletEvent(fraction(Number($$[$0-5]), Number($$[$0-3])), $$[$0-1].filter(e => e.type === 'note' || e.type === 'rest'));
|
|
304
|
+
break;
|
|
305
|
+
case 92:
|
|
306
|
+
currentDuration = $$[$0-3]; this.$ = tremoloEvent([$$[$0-4]], [$$[$0-2]], Number($$[$0-6]), $$[$0-3].division);
|
|
307
|
+
break;
|
|
308
|
+
case 93:
|
|
309
|
+
currentDuration = $$[$0-2]; this.$ = tremoloEvent([$$[$0-3]], [$$[$0-1]], Number($$[$0-5]), $$[$0-2].division);
|
|
310
|
+
break;
|
|
311
|
+
case 94:
|
|
312
|
+
this.$ = tremoloEvent([$$[$0-2]], [$$[$0-1]], Number($$[$0-4]), currentDuration.division);
|
|
313
|
+
break;
|
|
314
|
+
case 111:
|
|
315
|
+
this.$ = ({ pitchedRest: true });
|
|
316
|
+
break;
|
|
317
|
+
case 112: case 118: case 125:
|
|
318
|
+
this.$ = articulation('staccato');
|
|
319
|
+
break;
|
|
320
|
+
case 113: case 122: case 127:
|
|
321
|
+
this.$ = articulation('staccatissimo');
|
|
322
|
+
break;
|
|
323
|
+
case 114: case 123: case 126:
|
|
324
|
+
this.$ = articulation('tenuto');
|
|
325
|
+
break;
|
|
326
|
+
case 115: case 120: case 128:
|
|
327
|
+
this.$ = articulation('marcato');
|
|
328
|
+
break;
|
|
329
|
+
case 116: case 121: case 124:
|
|
330
|
+
this.$ = articulation('accent');
|
|
331
|
+
break;
|
|
332
|
+
case 117: case 119: case 129:
|
|
333
|
+
this.$ = articulation('portato');
|
|
334
|
+
break;
|
|
335
|
+
case 130:
|
|
336
|
+
this.$ = ornament('trill');
|
|
337
|
+
break;
|
|
338
|
+
case 131:
|
|
339
|
+
this.$ = ornament('turn');
|
|
340
|
+
break;
|
|
341
|
+
case 132:
|
|
342
|
+
this.$ = ornament('mordent');
|
|
343
|
+
break;
|
|
344
|
+
case 133:
|
|
345
|
+
this.$ = ornament('prall');
|
|
346
|
+
break;
|
|
347
|
+
case 134:
|
|
348
|
+
this.$ = ornament('fermata');
|
|
349
|
+
break;
|
|
350
|
+
case 135:
|
|
351
|
+
this.$ = ornament('shortFermata');
|
|
352
|
+
break;
|
|
353
|
+
case 136:
|
|
354
|
+
this.$ = ornament('arpeggio');
|
|
355
|
+
break;
|
|
356
|
+
case 137:
|
|
357
|
+
this.$ = dynamic('ppp');
|
|
358
|
+
break;
|
|
359
|
+
case 138:
|
|
360
|
+
this.$ = dynamic('pp');
|
|
361
|
+
break;
|
|
362
|
+
case 139:
|
|
363
|
+
this.$ = dynamic('p');
|
|
364
|
+
break;
|
|
365
|
+
case 140:
|
|
366
|
+
this.$ = dynamic('mp');
|
|
367
|
+
break;
|
|
368
|
+
case 141:
|
|
369
|
+
this.$ = dynamic('mf');
|
|
370
|
+
break;
|
|
371
|
+
case 142:
|
|
372
|
+
this.$ = dynamic('f');
|
|
373
|
+
break;
|
|
374
|
+
case 143:
|
|
375
|
+
this.$ = dynamic('ff');
|
|
376
|
+
break;
|
|
377
|
+
case 144:
|
|
378
|
+
this.$ = dynamic('fff');
|
|
379
|
+
break;
|
|
380
|
+
case 145: case 147:
|
|
381
|
+
this.$ = dynamic('sfz');
|
|
382
|
+
break;
|
|
383
|
+
case 146:
|
|
384
|
+
this.$ = dynamic('rfz');
|
|
385
|
+
break;
|
|
386
|
+
case 148:
|
|
387
|
+
this.$ = hairpin('crescendoStart');
|
|
388
|
+
break;
|
|
389
|
+
case 149:
|
|
390
|
+
this.$ = hairpin('diminuendoStart');
|
|
391
|
+
break;
|
|
392
|
+
case 150:
|
|
393
|
+
this.$ = hairpin('crescendoEnd');
|
|
394
|
+
break;
|
|
395
|
+
case 151:
|
|
396
|
+
this.$ = pedal('sustainOn');
|
|
397
|
+
break;
|
|
398
|
+
case 152:
|
|
399
|
+
this.$ = pedal('sustainOff');
|
|
400
|
+
break;
|
|
401
|
+
case 153:
|
|
402
|
+
this.$ = tie(true);
|
|
403
|
+
break;
|
|
404
|
+
case 154:
|
|
405
|
+
this.$ = slur(true);
|
|
406
|
+
break;
|
|
407
|
+
case 155:
|
|
408
|
+
this.$ = slur(false);
|
|
409
|
+
break;
|
|
410
|
+
case 156:
|
|
411
|
+
this.$ = beam(true);
|
|
412
|
+
break;
|
|
413
|
+
case 157:
|
|
414
|
+
this.$ = beam(false);
|
|
415
|
+
break;
|
|
416
|
+
case 158:
|
|
417
|
+
this.$ = ({ tremolo: Number($$[$0]) });
|
|
418
|
+
break;
|
|
419
|
+
case 159:
|
|
420
|
+
this.$ = ({ ...$$[$0], placement: 'above' });
|
|
421
|
+
break;
|
|
422
|
+
case 160:
|
|
423
|
+
this.$ = ({ ...$$[$0], placement: 'below' });
|
|
424
|
+
break;
|
|
425
|
+
case 161:
|
|
426
|
+
const n = Number($$[$0]); if (n >= 1 && n <= 5) this.$ = fingering(n); else this.$ = null;
|
|
427
|
+
break;
|
|
428
|
+
case 162:
|
|
429
|
+
this.$ = navigation('coda');
|
|
430
|
+
break;
|
|
431
|
+
case 163:
|
|
432
|
+
this.$ = navigation('segno');
|
|
433
|
+
break;
|
|
434
|
+
case 164:
|
|
435
|
+
this.$ = markupMark($$[$0].slice(1, -1));
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
table: [o($V0,$V1,{3:1,4:2,6:3,8:4,7:5,10:6,21:8,23:17,24:18,27:19,9:[1,7],11:$V2,14:$V3,15:$V4,16:$V5,17:$V6,18:$V7,19:$V8,20:$V9}),{1:[3]},{5:[1,20]},o($V0,$V1,{21:8,23:17,24:18,27:19,7:21,8:22,10:23,9:[1,24],11:$V2,14:$V3,15:$V4,16:$V5,17:$V6,18:$V7,19:$V8,20:$V9}),o($V0,$V1,{21:8,23:17,24:18,27:19,7:25,9:$Va}),{5:[2,5],22:$Vb},o($Vc,[2,8]),o($Vd,[2,6]),o($Ve,[2,20]),{12:[1,28]},{12:[1,29]},{12:[1,30]},{12:[1,31]},{12:[1,32]},{12:[1,33]},{12:[1,34]},{12:[1,35]},o($Ve,[2,23],{25:[1,36]}),o($Vf,[2,24],{28:$Vg}),o($Vh,[2,27],{29:38,30:39,31:40,32:41,33:42,34:43,35:44,36:45,37:46,38:47,39:48,43:49,46:50,59:53,60:54,61:55,62:56,63:57,64:58,65:59,9:$Vi,40:$Vj,41:$Vk,42:$Vl,47:$Vm,50:$Vn,57:$Vo,58:$Vp,66:$Vq,67:$Vr,72:$Vs,74:$Vt,76:$Vu,77:$Vv,80:$Vw,81:$Vx,82:$Vy,83:$Vz,86:$VA,87:$VB}),{1:[2,1]},{5:[2,2],22:$Vb},o($V0,$V1,{21:8,23:17,24:18,27:19,7:78,9:$Va}),o($Vc,[2,9]),o($Vd,[2,10],{10:79,11:$V2,14:$V3,15:$V4,16:$V5,17:$V6,18:$V7,19:$V8,20:$V9}),{5:[2,4],22:$Vb},o($Vd,[2,7]),o([9,25,28,40,41,42,47,50,57,58,66,67,72,74,76,77,80,81,82,83,86,87],$V1,{23:17,24:18,27:19,21:80,5:$VC,22:$VC}),{13:[1,81]},{13:[1,82]},{13:[1,83]},{13:[1,84]},{13:[1,85]},{13:[1,86]},{13:[1,87]},{13:[1,88]},o($Vd,[2,26],{26:89}),o($Vd,$V1,{27:90}),o($VD,[2,30]),o($VD,[2,31]),o($VD,[2,32]),o($VD,[2,33]),o($VD,[2,34]),o($VD,[2,35]),o($VD,[2,36]),o($VD,[2,37]),o($VD,[2,38]),o($VD,[2,39]),o($VD,[2,40]),o($VE,$VF,{44:91,45:92,54:$VG}),o($VE,$VF,{44:94,45:95,54:$VG}),o($VE,$VF,{44:96,45:97,54:$VG}),o($VE,$VF,{44:98,45:99,54:$VG}),o($VD,[2,65]),o($VD,[2,66]),o($VD,[2,67]),o($VD,[2,68]),o($VD,[2,69]),o($VD,[2,70]),o($VD,[2,71]),{30:101,31:102,43:49,46:50,47:$Vm,50:$Vn,57:$Vo,58:$Vp,84:[1,100]},{54:[1,103]},{88:[1,104]},o($VD,[2,44]),{12:[1,105]},{12:[1,106]},{12:[1,107]},{46:109,48:108,50:$Vn},o($VH,[2,53],{51:110,52:[1,111],53:[1,112]}),{12:[1,113]},{50:[1,115],68:114},{54:[1,116]},{12:[1,117],44:118,54:$VG},{12:[1,119]},o($VD,[2,84],{78:[1,120]}),o($VD,[2,85]),o($VD,[2,86]),o($VD,[2,87]),{5:[2,3],22:$Vb},o($Vc,[2,11]),o($Ve,[2,21]),o($Vc,[2,12]),o($Vc,[2,13]),o($Vc,[2,14]),o($Vc,[2,15]),o($Vc,[2,16]),o($Vc,[2,17]),o($Vc,[2,18]),o($Vc,[2,19]),o($Vd,$V1,{27:19,24:121}),o($Vh,[2,28],{29:38,30:39,31:40,32:41,33:42,34:43,35:44,36:45,37:46,38:47,39:48,43:49,46:50,59:53,60:54,61:55,62:56,63:57,64:58,65:59,9:$Vi,40:$Vj,41:$Vk,42:$Vl,47:$Vm,50:$Vn,57:$Vo,58:$Vp,66:$Vq,67:$Vr,72:$Vs,74:$Vt,76:$Vu,77:$Vv,80:$Vw,81:$Vx,82:$Vy,83:$Vz,86:$VA,87:$VB}),o($VE,$VF,{45:122}),o($VI,[2,47],{89:123,90:124,91:125,92:126,93:127,94:128,95:129,96:130,97:131,98:132,99:133,100:134,101:135,102:136,103:137,13:$VJ,42:$VK,49:$VL,56:$VM,79:$VN,104:$VO,105:$VP,106:$VQ,107:$VR,108:$VS,109:$VT,110:$VU,111:$VV,112:$VW,113:$VX,114:$VY,115:$VZ,116:$V_,117:$V$,118:$V01,119:$V11,120:$V21,121:$V31,122:$V41,123:$V51,124:$V61,125:$V71,126:$V81,127:$V91,128:$Va1,129:$Vb1,130:$Vc1,131:$Vd1,132:$Ve1,133:$Vf1,134:$Vg1,135:$Vh1,136:$Vi1,137:$Vj1,138:$Vk1,139:$Vl1,140:$Vm1,141:$Vn1,142:$Vo1,143:$Vp1}),o($Vq1,[2,59],{55:183}),o($VE,$VF,{45:184}),o($VI,[2,48],{89:123,90:124,91:125,92:126,93:127,94:128,95:129,96:130,97:131,98:132,99:133,100:134,101:135,102:136,103:137,13:$VJ,42:$VK,49:$VL,56:$VM,79:$VN,104:$VO,105:$VP,106:$VQ,107:$VR,108:$VS,109:$VT,110:$VU,111:$VV,112:$VW,113:$VX,114:$VY,115:$VZ,116:$V_,117:$V$,118:$V01,119:$V11,120:$V21,121:$V31,122:$V41,123:$V51,124:$V61,125:$V71,126:$V81,127:$V91,128:$Va1,129:$Vb1,130:$Vc1,131:$Vd1,132:$Ve1,133:$Vf1,134:$Vg1,135:$Vh1,136:$Vi1,137:$Vj1,138:$Vk1,139:$Vl1,140:$Vm1,141:$Vn1,142:$Vo1,143:$Vp1}),o($VE,$VF,{45:185}),o($VI,[2,63],{89:123,90:124,91:125,92:126,93:127,94:128,95:129,96:130,97:131,98:132,99:133,100:134,101:135,102:136,103:137,13:$VJ,42:$VK,49:$VL,56:$VM,79:$VN,104:$VO,105:$VP,106:$VQ,107:$VR,108:$VS,109:$VT,110:$VU,111:$VV,112:$VW,113:$VX,114:$VY,115:$VZ,116:$V_,117:$V$,118:$V01,119:$V11,120:$V21,121:$V31,122:$V41,123:$V51,124:$V61,125:$V71,126:$V81,127:$V91,128:$Va1,129:$Vb1,130:$Vc1,131:$Vd1,132:$Ve1,133:$Vf1,134:$Vg1,135:$Vh1,136:$Vi1,137:$Vj1,138:$Vk1,139:$Vl1,140:$Vm1,141:$Vn1,142:$Vo1,143:$Vp1}),o($VE,$VF,{45:186}),o($VI,[2,64],{89:123,90:124,91:125,92:126,93:127,94:128,95:129,96:130,97:131,98:132,99:133,100:134,101:135,102:136,103:137,13:$VJ,42:$VK,49:$VL,56:$VM,79:$VN,104:$VO,105:$VP,106:$VQ,107:$VR,108:$VS,109:$VT,110:$VU,111:$VV,112:$VW,113:$VX,114:$VY,115:$VZ,116:$V_,117:$V$,118:$V01,119:$V11,120:$V21,121:$V31,122:$V41,123:$V51,124:$V61,125:$V71,126:$V81,127:$V91,128:$Va1,129:$Vb1,130:$Vc1,131:$Vd1,132:$Ve1,133:$Vf1,134:$Vg1,135:$Vh1,136:$Vi1,137:$Vj1,138:$Vk1,139:$Vl1,140:$Vm1,141:$Vn1,142:$Vo1,143:$Vp1}),o($Vr1,$V1,{27:187}),o($VD,[2,89]),o($VD,[2,90]),{73:[1,188]},{54:[1,189]},o($VD,[2,41]),o($VD,[2,42]),o($VD,[2,43]),{46:191,49:[1,190],50:$Vn},o($Vs1,[2,50]),o($VH,[2,52],{52:[1,192],53:[1,193]}),o($Vt1,[2,54]),o($Vt1,[2,55]),o($VD,[2,72]),{69:194,70:[1,195],71:[1,196]},o([70,71],[2,74]),{73:[1,197]},o($VD,[2,79],{44:198,54:$VG}),{75:[1,199]},o($VD,[2,81]),{54:[1,200],79:[1,201]},o($Vf,[2,25],{28:$Vg}),o($VI,[2,45],{89:123,90:124,91:125,92:126,93:127,94:128,95:129,96:130,97:131,98:132,99:133,100:134,101:135,102:136,103:137,13:$VJ,42:$VK,49:$VL,56:$VM,79:$VN,104:$VO,105:$VP,106:$VQ,107:$VR,108:$VS,109:$VT,110:$VU,111:$VV,112:$VW,113:$VX,114:$VY,115:$VZ,116:$V_,117:$V$,118:$V01,119:$V11,120:$V21,121:$V31,122:$V41,123:$V51,124:$V61,125:$V71,126:$V81,127:$V91,128:$Va1,129:$Vb1,130:$Vc1,131:$Vd1,132:$Ve1,133:$Vf1,134:$Vg1,135:$Vh1,136:$Vi1,137:$Vj1,138:$Vk1,139:$Vl1,140:$Vm1,141:$Vn1,142:$Vo1,143:$Vp1}),o($VE,[2,96]),o($VE,[2,97]),o($VE,[2,98]),o($VE,[2,99]),o($VE,[2,100]),o($VE,[2,101]),o($VE,[2,102]),o($VE,[2,103]),o($VE,[2,104]),o($VE,[2,105]),o($VE,[2,106]),o($VE,[2,107]),o($VE,[2,108]),o($VE,[2,109]),o($VE,[2,110]),o($VE,[2,112]),o($VE,[2,113]),o($VE,[2,114]),o($VE,[2,115]),o($VE,[2,116]),o($VE,[2,117]),o([5,9,13,22,25,28,40,41,42,47,50,57,58,66,67,72,74,76,77,80,81,82,83,85,86,87,104,105,106,107,108,109,110,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143],[2,126],{49:[1,205],54:[1,208],56:[1,202],79:[1,207],111:[1,203],112:[1,204],113:[1,206]}),o($VE,[2,124]),o($VE,[2,125]),o($VE,[2,127]),o($VI,[2,128],{90:124,91:125,92:126,93:127,94:128,95:129,96:130,97:131,98:132,99:133,100:134,101:135,102:136,103:137,89:209,13:$VJ,42:$VK,49:$VL,56:$VM,79:$VN,104:$VO,105:$VP,106:$VQ,107:$VR,108:$VS,109:$VT,110:$VU,111:$VV,112:$VW,113:$VX,114:$VY,115:$VZ,116:$V_,117:$V$,118:$V01,119:$V11,120:$V21,121:$V31,122:$V41,123:$V51,124:$V61,125:$V71,126:$V81,127:$V91,128:$Va1,129:$Vb1,130:$Vc1,131:$Vd1,132:$Ve1,133:$Vf1,134:$Vg1,135:$Vh1,136:$Vi1,137:$Vj1,138:$Vk1,139:$Vl1,140:$Vm1,141:$Vn1,142:$Vo1,143:$Vp1}),o($VI,[2,129],{90:124,91:125,92:126,93:127,94:128,95:129,96:130,97:131,98:132,99:133,100:134,101:135,102:136,103:137,89:210,13:$VJ,42:$VK,49:$VL,56:$VM,79:$VN,104:$VO,105:$VP,106:$VQ,107:$VR,108:$VS,109:$VT,110:$VU,111:$VV,112:$VW,113:$VX,114:$VY,115:$VZ,116:$V_,117:$V$,118:$V01,119:$V11,120:$V21,121:$V31,122:$V41,123:$V51,124:$V61,125:$V71,126:$V81,127:$V91,128:$Va1,129:$Vb1,130:$Vc1,131:$Vd1,132:$Ve1,133:$Vf1,134:$Vg1,135:$Vh1,136:$Vi1,137:$Vj1,138:$Vk1,139:$Vl1,140:$Vm1,141:$Vn1,142:$Vo1,143:$Vp1}),o($VE,[2,130]),o($VE,[2,131]),o($VE,[2,132]),o($VE,[2,133]),o($VE,[2,134]),o($VE,[2,135]),o($VE,[2,136]),o($VE,[2,137]),o($VE,[2,138]),o($VE,[2,139]),o($VE,[2,140]),o($VE,[2,141]),o($VE,[2,142]),o($VE,[2,143]),o($VE,[2,144]),o($VE,[2,145]),o($VE,[2,146]),o($VE,[2,147]),o($VE,[2,148]),o($VE,[2,149]),o($VE,[2,150]),o($VE,[2,151]),o($VE,[2,152]),o($VE,[2,153]),o($VE,[2,154]),o($VE,[2,155]),o($VE,[2,156]),o($VE,[2,157]),{54:[1,211]},o($VE,[2,111]),o($VE,[2,162]),o($VE,[2,163]),{12:[1,212]},o([5,9,13,22,25,28,40,41,42,47,49,50,57,58,66,67,72,74,75,76,77,79,80,81,82,83,85,86,87,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143],[2,58],{56:[1,213]}),o($VI,[2,46],{89:123,90:124,91:125,92:126,93:127,94:128,95:129,96:130,97:131,98:132,99:133,100:134,101:135,102:136,103:137,13:$VJ,42:$VK,49:$VL,56:$VM,79:$VN,104:$VO,105:$VP,106:$VQ,107:$VR,108:$VS,109:$VT,110:$VU,111:$VV,112:$VW,113:$VX,114:$VY,115:$VZ,116:$V_,117:$V$,118:$V01,119:$V11,120:$V21,121:$V31,122:$V41,123:$V51,124:$V61,125:$V71,126:$V81,127:$V91,128:$Va1,129:$Vb1,130:$Vc1,131:$Vd1,132:$Ve1,133:$Vf1,134:$Vg1,135:$Vh1,136:$Vi1,137:$Vj1,138:$Vk1,139:$Vl1,140:$Vm1,141:$Vn1,142:$Vo1,143:$Vp1}),o($VI,[2,61],{89:123,90:124,91:125,92:126,93:127,94:128,95:129,96:130,97:131,98:132,99:133,100:134,101:135,102:136,103:137,13:$VJ,42:$VK,49:$VL,56:$VM,79:$VN,104:$VO,105:$VP,106:$VQ,107:$VR,108:$VS,109:$VT,110:$VU,111:$VV,112:$VW,113:$VX,114:$VY,115:$VZ,116:$V_,117:$V$,118:$V01,119:$V11,120:$V21,121:$V31,122:$V41,123:$V51,124:$V61,125:$V71,126:$V81,127:$V91,128:$Va1,129:$Vb1,130:$Vc1,131:$Vd1,132:$Ve1,133:$Vf1,134:$Vg1,135:$Vh1,136:$Vi1,137:$Vj1,138:$Vk1,139:$Vl1,140:$Vm1,141:$Vn1,142:$Vo1,143:$Vp1}),o($VI,[2,62],{89:123,90:124,91:125,92:126,93:127,94:128,95:129,96:130,97:131,98:132,99:133,100:134,101:135,102:136,103:137,13:$VJ,42:$VK,49:$VL,56:$VM,79:$VN,104:$VO,105:$VP,106:$VQ,107:$VR,108:$VS,109:$VT,110:$VU,111:$VV,112:$VW,113:$VX,114:$VY,115:$VZ,116:$V_,117:$V$,118:$V01,119:$V11,120:$V21,121:$V31,122:$V41,123:$V51,124:$V61,125:$V71,126:$V81,127:$V91,128:$Va1,129:$Vb1,130:$Vc1,131:$Vd1,132:$Ve1,133:$Vf1,134:$Vg1,135:$Vh1,136:$Vi1,137:$Vj1,138:$Vk1,139:$Vl1,140:$Vm1,141:$Vn1,142:$Vo1,143:$Vp1}),{9:$Vi,29:38,30:39,31:40,32:41,33:42,34:43,35:44,36:45,37:46,38:47,39:48,40:$Vj,41:$Vk,42:$Vl,43:49,46:50,47:$Vm,50:$Vn,57:$Vo,58:$Vp,59:53,60:54,61:55,62:56,63:57,64:58,65:59,66:$Vq,67:$Vr,72:$Vs,74:$Vt,76:$Vu,77:$Vv,80:$Vw,81:$Vx,82:$Vy,83:$Vz,85:[1,214],86:$VA,87:$VB},{54:[1,215]},{84:[1,216]},o($VH,[2,49]),o($Vs1,[2,51]),o($Vt1,[2,56]),o($Vt1,[2,57]),o($VD,[2,73]),o($VD,[2,75]),o($VD,[2,76]),{54:[1,217]},{75:[1,218]},{54:[1,219]},o($VD,[2,82]),{54:[1,220]},o($VE,[2,118]),o($VE,[2,119]),o($VE,[2,120]),o($VE,[2,121]),o($VE,[2,122]),o($VE,[2,123]),o($VE,[2,161]),o($VE,[2,159]),o($VE,[2,160]),o($VE,[2,158]),o($VE,[2,164]),o($Vq1,[2,60]),o($VD,[2,88]),{84:[1,221]},{46:222,50:$Vn},o($VD,[2,77]),{54:[1,223]},o($VD,[2,80]),o($VD,[2,83]),o($Vr1,$V1,{27:224}),{44:225,46:226,50:$Vn,54:$VG},o($VD,[2,78]),{9:$Vi,29:38,30:39,31:40,32:41,33:42,34:43,35:44,36:45,37:46,38:47,39:48,40:$Vj,41:$Vk,42:$Vl,43:49,46:50,47:$Vm,50:$Vn,57:$Vo,58:$Vp,59:53,60:54,61:55,62:56,63:57,64:58,65:59,66:$Vq,67:$Vr,72:$Vs,74:$Vt,76:$Vu,77:$Vv,80:$Vw,81:$Vx,82:$Vy,83:$Vz,85:[1,227],86:$VA,87:$VB},{46:228,50:$Vn},{85:[1,229]},o($VD,[2,91]),{44:230,54:$VG,85:[1,231]},o($VD,[2,94]),{85:[1,232]},o($VD,[2,93]),o($VD,[2,92])],
|
|
440
|
+
defaultActions: {20:[2,1]},
|
|
441
|
+
parseError: function parseError (str, hash) {
|
|
442
|
+
if (hash.recoverable) {
|
|
443
|
+
this.trace(str);
|
|
444
|
+
} else {
|
|
445
|
+
var error = new Error(str);
|
|
446
|
+
error.hash = hash;
|
|
447
|
+
throw error;
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
parse: function parse(input) {
|
|
451
|
+
var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
|
452
|
+
var args = lstack.slice.call(arguments, 1);
|
|
453
|
+
var lexer = Object.create(this.lexer);
|
|
454
|
+
var sharedState = { yy: {} };
|
|
455
|
+
for (var k in this.yy) {
|
|
456
|
+
if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
|
457
|
+
sharedState.yy[k] = this.yy[k];
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
lexer.setInput(input, sharedState.yy);
|
|
461
|
+
sharedState.yy.lexer = lexer;
|
|
462
|
+
sharedState.yy.parser = this;
|
|
463
|
+
if (typeof lexer.yylloc == 'undefined') {
|
|
464
|
+
lexer.yylloc = {};
|
|
465
|
+
}
|
|
466
|
+
var yyloc = lexer.yylloc;
|
|
467
|
+
lstack.push(yyloc);
|
|
468
|
+
var ranges = lexer.options && lexer.options.ranges;
|
|
469
|
+
if (typeof sharedState.yy.parseError === 'function') {
|
|
470
|
+
this.parseError = sharedState.yy.parseError;
|
|
471
|
+
} else {
|
|
472
|
+
this.parseError = Object.getPrototypeOf(this).parseError;
|
|
473
|
+
}
|
|
474
|
+
function popStack(n) {
|
|
475
|
+
stack.length = stack.length - 2 * n;
|
|
476
|
+
vstack.length = vstack.length - n;
|
|
477
|
+
lstack.length = lstack.length - n;
|
|
478
|
+
}
|
|
479
|
+
_token_stack:
|
|
480
|
+
var lex = function () {
|
|
481
|
+
var token;
|
|
482
|
+
token = lexer.lex() || EOF;
|
|
483
|
+
if (typeof token !== 'number') {
|
|
484
|
+
token = self.symbols_[token] || token;
|
|
485
|
+
}
|
|
486
|
+
return token;
|
|
487
|
+
};
|
|
488
|
+
var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
|
489
|
+
while (true) {
|
|
490
|
+
state = stack[stack.length - 1];
|
|
491
|
+
if (this.defaultActions[state]) {
|
|
492
|
+
action = this.defaultActions[state];
|
|
493
|
+
} else {
|
|
494
|
+
if (symbol === null || typeof symbol == 'undefined') {
|
|
495
|
+
symbol = lex();
|
|
496
|
+
}
|
|
497
|
+
action = table[state] && table[state][symbol];
|
|
498
|
+
}
|
|
499
|
+
if (typeof action === 'undefined' || !action.length || !action[0]) {
|
|
500
|
+
var errStr = '';
|
|
501
|
+
expected = [];
|
|
502
|
+
for (p in table[state]) {
|
|
503
|
+
if (this.terminals_[p] && p > TERROR) {
|
|
504
|
+
expected.push('\'' + this.terminals_[p] + '\'');
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
if (lexer.showPosition) {
|
|
508
|
+
errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
|
509
|
+
} else {
|
|
510
|
+
errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
|
511
|
+
}
|
|
512
|
+
this.parseError(errStr, {
|
|
513
|
+
text: lexer.match,
|
|
514
|
+
token: this.terminals_[symbol] || symbol,
|
|
515
|
+
line: lexer.yylineno,
|
|
516
|
+
loc: yyloc,
|
|
517
|
+
expected: expected
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
if (action[0] instanceof Array && action.length > 1) {
|
|
521
|
+
throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
|
522
|
+
}
|
|
523
|
+
switch (action[0]) {
|
|
524
|
+
case 1:
|
|
525
|
+
stack.push(symbol);
|
|
526
|
+
vstack.push(lexer.yytext);
|
|
527
|
+
lstack.push(lexer.yylloc);
|
|
528
|
+
stack.push(action[1]);
|
|
529
|
+
symbol = null;
|
|
530
|
+
if (!preErrorSymbol) {
|
|
531
|
+
yyleng = lexer.yyleng;
|
|
532
|
+
yytext = lexer.yytext;
|
|
533
|
+
yylineno = lexer.yylineno;
|
|
534
|
+
yyloc = lexer.yylloc;
|
|
535
|
+
if (recovering > 0) {
|
|
536
|
+
recovering--;
|
|
537
|
+
}
|
|
538
|
+
} else {
|
|
539
|
+
symbol = preErrorSymbol;
|
|
540
|
+
preErrorSymbol = null;
|
|
541
|
+
}
|
|
542
|
+
break;
|
|
543
|
+
case 2:
|
|
544
|
+
len = this.productions_[action[1]][1];
|
|
545
|
+
yyval.$ = vstack[vstack.length - len];
|
|
546
|
+
yyval._$ = {
|
|
547
|
+
first_line: lstack[lstack.length - (len || 1)].first_line,
|
|
548
|
+
last_line: lstack[lstack.length - 1].last_line,
|
|
549
|
+
first_column: lstack[lstack.length - (len || 1)].first_column,
|
|
550
|
+
last_column: lstack[lstack.length - 1].last_column
|
|
551
|
+
};
|
|
552
|
+
if (ranges) {
|
|
553
|
+
yyval._$.range = [
|
|
554
|
+
lstack[lstack.length - (len || 1)].range[0],
|
|
555
|
+
lstack[lstack.length - 1].range[1]
|
|
556
|
+
];
|
|
557
|
+
}
|
|
558
|
+
r = this.performAction.apply(yyval, [
|
|
559
|
+
yytext,
|
|
560
|
+
yyleng,
|
|
561
|
+
yylineno,
|
|
562
|
+
sharedState.yy,
|
|
563
|
+
action[1],
|
|
564
|
+
vstack,
|
|
565
|
+
lstack
|
|
566
|
+
].concat(args));
|
|
567
|
+
if (typeof r !== 'undefined') {
|
|
568
|
+
return r;
|
|
569
|
+
}
|
|
570
|
+
if (len) {
|
|
571
|
+
stack = stack.slice(0, -1 * len * 2);
|
|
572
|
+
vstack = vstack.slice(0, -1 * len);
|
|
573
|
+
lstack = lstack.slice(0, -1 * len);
|
|
574
|
+
}
|
|
575
|
+
stack.push(this.productions_[action[1]][0]);
|
|
576
|
+
vstack.push(yyval.$);
|
|
577
|
+
lstack.push(yyval._$);
|
|
578
|
+
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
|
579
|
+
stack.push(newState);
|
|
580
|
+
break;
|
|
581
|
+
case 3:
|
|
582
|
+
return true;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return true;
|
|
586
|
+
}};
|
|
587
|
+
|
|
588
|
+
// Helper functions
|
|
589
|
+
const fraction = (numerator, denominator) => ({ numerator, denominator });
|
|
590
|
+
|
|
591
|
+
const pitch = (phonet, accidental, octave) => ({
|
|
592
|
+
phonet,
|
|
593
|
+
accidental: accidental || undefined,
|
|
594
|
+
octave: octave || 0,
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
const duration = (division, dots) => ({
|
|
598
|
+
division,
|
|
599
|
+
dots: dots || 0,
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
const noteEvent = (pitches, dur, marks, options = {}) => {
|
|
603
|
+
// Check if this is a pitched rest (e.g., g'\rest)
|
|
604
|
+
const pitchedRestMark = marks && marks.find(m => m && m.pitchedRest);
|
|
605
|
+
if (pitchedRestMark) {
|
|
606
|
+
const pitch = Array.isArray(pitches) ? pitches[0] : pitches;
|
|
607
|
+
return {
|
|
608
|
+
type: 'rest',
|
|
609
|
+
duration: dur,
|
|
610
|
+
pitch: pitch,
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
return {
|
|
614
|
+
type: 'note',
|
|
615
|
+
pitches: Array.isArray(pitches) ? pitches : [pitches],
|
|
616
|
+
duration: dur,
|
|
617
|
+
marks: marks && marks.length ? marks : undefined,
|
|
618
|
+
...options,
|
|
619
|
+
};
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
const restEvent = (dur, options = {}) => ({
|
|
623
|
+
type: 'rest',
|
|
624
|
+
duration: dur,
|
|
625
|
+
...options,
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
const contextChange = (changes) => ({
|
|
629
|
+
type: 'context',
|
|
630
|
+
...changes,
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
const keySignature = (phonet, accidental, mode) => ({
|
|
634
|
+
pitch: phonet,
|
|
635
|
+
accidental: accidental || undefined,
|
|
636
|
+
mode,
|
|
637
|
+
});
|
|
638
|
+
|
|
639
|
+
const voice = (staff, events) => ({
|
|
640
|
+
staff: staff || 1,
|
|
641
|
+
events,
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
const part = (voices, name) => ({
|
|
645
|
+
name: name || undefined,
|
|
646
|
+
voices,
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
const measure = (parts, key, timeSig, partial) => ({
|
|
650
|
+
key: key || undefined,
|
|
651
|
+
timeSig: timeSig || undefined,
|
|
652
|
+
parts,
|
|
653
|
+
partial: partial || undefined,
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
const tupletEvent = (ratio, events) => ({
|
|
657
|
+
type: 'tuplet',
|
|
658
|
+
ratio,
|
|
659
|
+
events,
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
const tremoloEvent = (pitchA, pitchB, count, division) => ({
|
|
663
|
+
type: 'tremolo',
|
|
664
|
+
pitchA,
|
|
665
|
+
pitchB,
|
|
666
|
+
count,
|
|
667
|
+
division,
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
// Articulation/mark helpers - all marks have markType for discrimination
|
|
671
|
+
const articulation = (type, placement) => ({ markType: 'articulation', type, placement });
|
|
672
|
+
const ornament = (type) => ({ markType: 'ornament', type });
|
|
673
|
+
const dynamic = (type) => ({ markType: 'dynamic', type });
|
|
674
|
+
const hairpin = (type) => ({ markType: 'hairpin', type });
|
|
675
|
+
const pedal = (type) => ({ markType: 'pedal', type });
|
|
676
|
+
const tie = (start) => ({ markType: 'tie', start });
|
|
677
|
+
const slur = (start) => ({ markType: 'slur', start });
|
|
678
|
+
const beam = (start) => ({ markType: 'beam', start });
|
|
679
|
+
const fingering = (finger, placement) => ({ markType: 'fingering', finger, placement });
|
|
680
|
+
const navigation = (type) => ({ markType: 'navigation', type });
|
|
681
|
+
|
|
682
|
+
const barlineEvent = (style) => ({ type: 'barline', style });
|
|
683
|
+
const harmonyEvent = (text) => ({ type: 'harmony', text });
|
|
684
|
+
const markupEvent = (content, placement) => ({ type: 'markup', content, placement: placement || undefined });
|
|
685
|
+
const markupMark = (content) => ({ markType: 'markup', content });
|
|
686
|
+
|
|
687
|
+
// Parse PITCH token (e.g., "c", "cs", "bf", "css", "bff") into phonet and accidental
|
|
688
|
+
const parsePitch = (text, octave) => {
|
|
689
|
+
const phonet = text[0].toLowerCase();
|
|
690
|
+
const accStr = text.slice(1).toLowerCase();
|
|
691
|
+
let accidental = undefined;
|
|
692
|
+
if (accStr === 's') accidental = 'sharp';
|
|
693
|
+
else if (accStr === 'f') accidental = 'flat';
|
|
694
|
+
else if (accStr === 'ss') accidental = 'doubleSharp';
|
|
695
|
+
else if (accStr === 'ff') accidental = 'doubleFlat';
|
|
696
|
+
return pitch(phonet, accidental, octave || 0);
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
// Parse PITCH token for key signature (no octave)
|
|
700
|
+
const parsePitchName = (text) => {
|
|
701
|
+
const phonet = text[0].toLowerCase();
|
|
702
|
+
const accStr = text.slice(1).toLowerCase();
|
|
703
|
+
let accidental = undefined;
|
|
704
|
+
if (accStr === 's') accidental = 'sharp';
|
|
705
|
+
else if (accStr === 'f') accidental = 'flat';
|
|
706
|
+
else if (accStr === 'ss') accidental = 'doubleSharp';
|
|
707
|
+
else if (accStr === 'ff') accidental = 'doubleFlat';
|
|
708
|
+
return { phonet, accidental };
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
// Global state for parsing
|
|
712
|
+
let currentStaff = 1;
|
|
713
|
+
let currentKey = null;
|
|
714
|
+
let currentTimeSig = null;
|
|
715
|
+
let currentDuration = { division: 4, dots: 0 }; // default quarter note
|
|
716
|
+
|
|
717
|
+
// Reset parser state - call before each parse
|
|
718
|
+
const resetParserState = () => {
|
|
719
|
+
currentStaff = 1;
|
|
720
|
+
currentKey = null;
|
|
721
|
+
currentTimeSig = null;
|
|
722
|
+
currentDuration = { division: 4, dots: 0 };
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
// Export reset function
|
|
726
|
+
parser.resetState = resetParserState;
|
|
727
|
+
/* generated by jison-lex 0.3.4 */
|
|
728
|
+
var lexer = (function(){
|
|
729
|
+
var lexer = ({
|
|
730
|
+
|
|
731
|
+
EOF:1,
|
|
732
|
+
|
|
733
|
+
parseError:function parseError(str, hash) {
|
|
734
|
+
if (this.yy.parser) {
|
|
735
|
+
this.yy.parser.parseError(str, hash);
|
|
736
|
+
} else {
|
|
737
|
+
throw new Error(str);
|
|
738
|
+
}
|
|
739
|
+
},
|
|
740
|
+
|
|
741
|
+
// resets the lexer, sets new input
|
|
742
|
+
setInput:function (input, yy) {
|
|
743
|
+
this.yy = yy || this.yy || {};
|
|
744
|
+
this._input = input;
|
|
745
|
+
this._more = this._backtrack = this.done = false;
|
|
746
|
+
this.yylineno = this.yyleng = 0;
|
|
747
|
+
this.yytext = this.matched = this.match = '';
|
|
748
|
+
this.conditionStack = ['INITIAL'];
|
|
749
|
+
this.yylloc = {
|
|
750
|
+
first_line: 1,
|
|
751
|
+
first_column: 0,
|
|
752
|
+
last_line: 1,
|
|
753
|
+
last_column: 0
|
|
754
|
+
};
|
|
755
|
+
if (this.options.ranges) {
|
|
756
|
+
this.yylloc.range = [0,0];
|
|
757
|
+
}
|
|
758
|
+
this.offset = 0;
|
|
759
|
+
return this;
|
|
760
|
+
},
|
|
761
|
+
|
|
762
|
+
// consumes and returns one char from the input
|
|
763
|
+
input:function () {
|
|
764
|
+
var ch = this._input[0];
|
|
765
|
+
this.yytext += ch;
|
|
766
|
+
this.yyleng++;
|
|
767
|
+
this.offset++;
|
|
768
|
+
this.match += ch;
|
|
769
|
+
this.matched += ch;
|
|
770
|
+
var lines = ch.match(/(?:\r\n?|\n).*/g);
|
|
771
|
+
if (lines) {
|
|
772
|
+
this.yylineno++;
|
|
773
|
+
this.yylloc.last_line++;
|
|
774
|
+
} else {
|
|
775
|
+
this.yylloc.last_column++;
|
|
776
|
+
}
|
|
777
|
+
if (this.options.ranges) {
|
|
778
|
+
this.yylloc.range[1]++;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
this._input = this._input.slice(1);
|
|
782
|
+
return ch;
|
|
783
|
+
},
|
|
784
|
+
|
|
785
|
+
// unshifts one char (or a string) into the input
|
|
786
|
+
unput:function (ch) {
|
|
787
|
+
var len = ch.length;
|
|
788
|
+
var lines = ch.split(/(?:\r\n?|\n)/g);
|
|
789
|
+
|
|
790
|
+
this._input = ch + this._input;
|
|
791
|
+
this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
|
792
|
+
//this.yyleng -= len;
|
|
793
|
+
this.offset -= len;
|
|
794
|
+
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
|
795
|
+
this.match = this.match.substr(0, this.match.length - 1);
|
|
796
|
+
this.matched = this.matched.substr(0, this.matched.length - 1);
|
|
797
|
+
|
|
798
|
+
if (lines.length - 1) {
|
|
799
|
+
this.yylineno -= lines.length - 1;
|
|
800
|
+
}
|
|
801
|
+
var r = this.yylloc.range;
|
|
802
|
+
|
|
803
|
+
this.yylloc = {
|
|
804
|
+
first_line: this.yylloc.first_line,
|
|
805
|
+
last_line: this.yylineno + 1,
|
|
806
|
+
first_column: this.yylloc.first_column,
|
|
807
|
+
last_column: lines ?
|
|
808
|
+
(lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
|
809
|
+
+ oldLines[oldLines.length - lines.length].length - lines[0].length :
|
|
810
|
+
this.yylloc.first_column - len
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
if (this.options.ranges) {
|
|
814
|
+
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
|
815
|
+
}
|
|
816
|
+
this.yyleng = this.yytext.length;
|
|
817
|
+
return this;
|
|
818
|
+
},
|
|
819
|
+
|
|
820
|
+
// When called from action, caches matched text and appends it on next action
|
|
821
|
+
more:function () {
|
|
822
|
+
this._more = true;
|
|
823
|
+
return this;
|
|
824
|
+
},
|
|
825
|
+
|
|
826
|
+
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
|
|
827
|
+
reject:function () {
|
|
828
|
+
if (this.options.backtrack_lexer) {
|
|
829
|
+
this._backtrack = true;
|
|
830
|
+
} else {
|
|
831
|
+
return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
|
|
832
|
+
text: "",
|
|
833
|
+
token: null,
|
|
834
|
+
line: this.yylineno
|
|
835
|
+
});
|
|
836
|
+
|
|
837
|
+
}
|
|
838
|
+
return this;
|
|
839
|
+
},
|
|
840
|
+
|
|
841
|
+
// retain first n characters of the match
|
|
842
|
+
less:function (n) {
|
|
843
|
+
this.unput(this.match.slice(n));
|
|
844
|
+
},
|
|
845
|
+
|
|
846
|
+
// displays already matched input, i.e. for error messages
|
|
847
|
+
pastInput:function () {
|
|
848
|
+
var past = this.matched.substr(0, this.matched.length - this.match.length);
|
|
849
|
+
return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
|
850
|
+
},
|
|
851
|
+
|
|
852
|
+
// displays upcoming input, i.e. for error messages
|
|
853
|
+
upcomingInput:function () {
|
|
854
|
+
var next = this.match;
|
|
855
|
+
if (next.length < 20) {
|
|
856
|
+
next += this._input.substr(0, 20-next.length);
|
|
857
|
+
}
|
|
858
|
+
return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
|
859
|
+
},
|
|
860
|
+
|
|
861
|
+
// displays the character position where the lexing error occurred, i.e. for error messages
|
|
862
|
+
showPosition:function () {
|
|
863
|
+
var pre = this.pastInput();
|
|
864
|
+
var c = new Array(pre.length + 1).join("-");
|
|
865
|
+
return pre + this.upcomingInput() + "\n" + c + "^";
|
|
866
|
+
},
|
|
867
|
+
|
|
868
|
+
// test the lexed token: return FALSE when not a match, otherwise return token
|
|
869
|
+
test_match:function(match, indexed_rule) {
|
|
870
|
+
var token,
|
|
871
|
+
lines,
|
|
872
|
+
backup;
|
|
873
|
+
|
|
874
|
+
if (this.options.backtrack_lexer) {
|
|
875
|
+
// save context
|
|
876
|
+
backup = {
|
|
877
|
+
yylineno: this.yylineno,
|
|
878
|
+
yylloc: {
|
|
879
|
+
first_line: this.yylloc.first_line,
|
|
880
|
+
last_line: this.last_line,
|
|
881
|
+
first_column: this.yylloc.first_column,
|
|
882
|
+
last_column: this.yylloc.last_column
|
|
883
|
+
},
|
|
884
|
+
yytext: this.yytext,
|
|
885
|
+
match: this.match,
|
|
886
|
+
matches: this.matches,
|
|
887
|
+
matched: this.matched,
|
|
888
|
+
yyleng: this.yyleng,
|
|
889
|
+
offset: this.offset,
|
|
890
|
+
_more: this._more,
|
|
891
|
+
_input: this._input,
|
|
892
|
+
yy: this.yy,
|
|
893
|
+
conditionStack: this.conditionStack.slice(0),
|
|
894
|
+
done: this.done
|
|
895
|
+
};
|
|
896
|
+
if (this.options.ranges) {
|
|
897
|
+
backup.yylloc.range = this.yylloc.range.slice(0);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
lines = match[0].match(/(?:\r\n?|\n).*/g);
|
|
902
|
+
if (lines) {
|
|
903
|
+
this.yylineno += lines.length;
|
|
904
|
+
}
|
|
905
|
+
this.yylloc = {
|
|
906
|
+
first_line: this.yylloc.last_line,
|
|
907
|
+
last_line: this.yylineno + 1,
|
|
908
|
+
first_column: this.yylloc.last_column,
|
|
909
|
+
last_column: lines ?
|
|
910
|
+
lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
|
911
|
+
this.yylloc.last_column + match[0].length
|
|
912
|
+
};
|
|
913
|
+
this.yytext += match[0];
|
|
914
|
+
this.match += match[0];
|
|
915
|
+
this.matches = match;
|
|
916
|
+
this.yyleng = this.yytext.length;
|
|
917
|
+
if (this.options.ranges) {
|
|
918
|
+
this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
|
919
|
+
}
|
|
920
|
+
this._more = false;
|
|
921
|
+
this._backtrack = false;
|
|
922
|
+
this._input = this._input.slice(match[0].length);
|
|
923
|
+
this.matched += match[0];
|
|
924
|
+
token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
|
925
|
+
if (this.done && this._input) {
|
|
926
|
+
this.done = false;
|
|
927
|
+
}
|
|
928
|
+
if (token) {
|
|
929
|
+
return token;
|
|
930
|
+
} else if (this._backtrack) {
|
|
931
|
+
// recover context
|
|
932
|
+
for (var k in backup) {
|
|
933
|
+
this[k] = backup[k];
|
|
934
|
+
}
|
|
935
|
+
return false; // rule action called reject() implying the next rule should be tested instead.
|
|
936
|
+
}
|
|
937
|
+
return false;
|
|
938
|
+
},
|
|
939
|
+
|
|
940
|
+
// return next match in input
|
|
941
|
+
next:function () {
|
|
942
|
+
if (this.done) {
|
|
943
|
+
return this.EOF;
|
|
944
|
+
}
|
|
945
|
+
if (!this._input) {
|
|
946
|
+
this.done = true;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
var token,
|
|
950
|
+
match,
|
|
951
|
+
tempMatch,
|
|
952
|
+
index;
|
|
953
|
+
if (!this._more) {
|
|
954
|
+
this.yytext = '';
|
|
955
|
+
this.match = '';
|
|
956
|
+
}
|
|
957
|
+
var rules = this._currentRules();
|
|
958
|
+
for (var i = 0; i < rules.length; i++) {
|
|
959
|
+
tempMatch = this._input.match(this.rules[rules[i]]);
|
|
960
|
+
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
|
961
|
+
match = tempMatch;
|
|
962
|
+
index = i;
|
|
963
|
+
if (this.options.backtrack_lexer) {
|
|
964
|
+
token = this.test_match(tempMatch, rules[i]);
|
|
965
|
+
if (token !== false) {
|
|
966
|
+
return token;
|
|
967
|
+
} else if (this._backtrack) {
|
|
968
|
+
match = false;
|
|
969
|
+
continue; // rule action called reject() implying a rule MISmatch.
|
|
970
|
+
} else {
|
|
971
|
+
// else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
|
972
|
+
return false;
|
|
973
|
+
}
|
|
974
|
+
} else if (!this.options.flex) {
|
|
975
|
+
break;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
if (match) {
|
|
980
|
+
token = this.test_match(match, rules[index]);
|
|
981
|
+
if (token !== false) {
|
|
982
|
+
return token;
|
|
983
|
+
}
|
|
984
|
+
// else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
|
985
|
+
return false;
|
|
986
|
+
}
|
|
987
|
+
if (this._input === "") {
|
|
988
|
+
return this.EOF;
|
|
989
|
+
} else {
|
|
990
|
+
return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
|
991
|
+
text: "",
|
|
992
|
+
token: null,
|
|
993
|
+
line: this.yylineno
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
},
|
|
997
|
+
|
|
998
|
+
// return next match that has a token
|
|
999
|
+
lex:function lex () {
|
|
1000
|
+
var r = this.next();
|
|
1001
|
+
if (r) {
|
|
1002
|
+
return r;
|
|
1003
|
+
} else {
|
|
1004
|
+
return this.lex();
|
|
1005
|
+
}
|
|
1006
|
+
},
|
|
1007
|
+
|
|
1008
|
+
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
|
1009
|
+
begin:function begin (condition) {
|
|
1010
|
+
this.conditionStack.push(condition);
|
|
1011
|
+
},
|
|
1012
|
+
|
|
1013
|
+
// pop the previously active lexer condition state off the condition stack
|
|
1014
|
+
popState:function popState () {
|
|
1015
|
+
var n = this.conditionStack.length - 1;
|
|
1016
|
+
if (n > 0) {
|
|
1017
|
+
return this.conditionStack.pop();
|
|
1018
|
+
} else {
|
|
1019
|
+
return this.conditionStack[0];
|
|
1020
|
+
}
|
|
1021
|
+
},
|
|
1022
|
+
|
|
1023
|
+
// produce the lexer rule set which is active for the currently active lexer condition state
|
|
1024
|
+
_currentRules:function _currentRules () {
|
|
1025
|
+
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
|
1026
|
+
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
|
1027
|
+
} else {
|
|
1028
|
+
return this.conditions["INITIAL"].rules;
|
|
1029
|
+
}
|
|
1030
|
+
},
|
|
1031
|
+
|
|
1032
|
+
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
|
1033
|
+
topState:function topState (n) {
|
|
1034
|
+
n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
|
1035
|
+
if (n >= 0) {
|
|
1036
|
+
return this.conditionStack[n];
|
|
1037
|
+
} else {
|
|
1038
|
+
return "INITIAL";
|
|
1039
|
+
}
|
|
1040
|
+
},
|
|
1041
|
+
|
|
1042
|
+
// alias for begin(condition)
|
|
1043
|
+
pushState:function pushState (condition) {
|
|
1044
|
+
this.begin(condition);
|
|
1045
|
+
},
|
|
1046
|
+
|
|
1047
|
+
// return the number of states currently on the stack
|
|
1048
|
+
stateStackSize:function stateStackSize() {
|
|
1049
|
+
return this.conditionStack.length;
|
|
1050
|
+
},
|
|
1051
|
+
options: {},
|
|
1052
|
+
performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
|
1053
|
+
var YYSTATE=YY_START;
|
|
1054
|
+
switch($avoiding_name_collisions) {
|
|
1055
|
+
case 0:
|
|
1056
|
+
break;
|
|
1057
|
+
case 1:return 9
|
|
1058
|
+
break;
|
|
1059
|
+
case 2:
|
|
1060
|
+
break;
|
|
1061
|
+
case 3:return 11
|
|
1062
|
+
break;
|
|
1063
|
+
case 4:return 14
|
|
1064
|
+
break;
|
|
1065
|
+
case 5:return 15
|
|
1066
|
+
break;
|
|
1067
|
+
case 6:return 16
|
|
1068
|
+
break;
|
|
1069
|
+
case 7:return 17
|
|
1070
|
+
break;
|
|
1071
|
+
case 8:return 18
|
|
1072
|
+
break;
|
|
1073
|
+
case 9:return 19
|
|
1074
|
+
break;
|
|
1075
|
+
case 10:return 20
|
|
1076
|
+
break;
|
|
1077
|
+
case 11:return 13
|
|
1078
|
+
break;
|
|
1079
|
+
case 12:return 12
|
|
1080
|
+
break;
|
|
1081
|
+
case 13:return 66
|
|
1082
|
+
break;
|
|
1083
|
+
case 14:return 67
|
|
1084
|
+
break;
|
|
1085
|
+
case 15:return 72
|
|
1086
|
+
break;
|
|
1087
|
+
case 16:return 74
|
|
1088
|
+
break;
|
|
1089
|
+
case 17:return 76
|
|
1090
|
+
break;
|
|
1091
|
+
case 18:return 83
|
|
1092
|
+
break;
|
|
1093
|
+
case 19:return 86
|
|
1094
|
+
break;
|
|
1095
|
+
case 20:return 87
|
|
1096
|
+
break;
|
|
1097
|
+
case 21:return 77
|
|
1098
|
+
break;
|
|
1099
|
+
case 22:return 80
|
|
1100
|
+
break;
|
|
1101
|
+
case 23:return 81
|
|
1102
|
+
break;
|
|
1103
|
+
case 24:return 82
|
|
1104
|
+
break;
|
|
1105
|
+
case 25:return 70
|
|
1106
|
+
break;
|
|
1107
|
+
case 26:return 71
|
|
1108
|
+
break;
|
|
1109
|
+
case 27:return 135
|
|
1110
|
+
break;
|
|
1111
|
+
case 28:return 136
|
|
1112
|
+
break;
|
|
1113
|
+
case 29:return 40
|
|
1114
|
+
break;
|
|
1115
|
+
case 30:return 142
|
|
1116
|
+
break;
|
|
1117
|
+
case 31:return 143
|
|
1118
|
+
break;
|
|
1119
|
+
case 32:return 41
|
|
1120
|
+
break;
|
|
1121
|
+
case 33:return 42
|
|
1122
|
+
break;
|
|
1123
|
+
case 34:return 132
|
|
1124
|
+
break;
|
|
1125
|
+
case 35:return 133
|
|
1126
|
+
break;
|
|
1127
|
+
case 36:return 134
|
|
1128
|
+
break;
|
|
1129
|
+
case 37:return 105
|
|
1130
|
+
break;
|
|
1131
|
+
case 38:return 106
|
|
1132
|
+
break;
|
|
1133
|
+
case 39:return 107
|
|
1134
|
+
break;
|
|
1135
|
+
case 40:return 108
|
|
1136
|
+
break;
|
|
1137
|
+
case 41:return 109
|
|
1138
|
+
break;
|
|
1139
|
+
case 42:return 110
|
|
1140
|
+
break;
|
|
1141
|
+
case 43:return 114
|
|
1142
|
+
break;
|
|
1143
|
+
case 44:return 115
|
|
1144
|
+
break;
|
|
1145
|
+
case 45:return 116
|
|
1146
|
+
break;
|
|
1147
|
+
case 46:return 117
|
|
1148
|
+
break;
|
|
1149
|
+
case 47:return 118
|
|
1150
|
+
break;
|
|
1151
|
+
case 48:return 119
|
|
1152
|
+
break;
|
|
1153
|
+
case 49:return 120
|
|
1154
|
+
break;
|
|
1155
|
+
case 50:return 121
|
|
1156
|
+
break;
|
|
1157
|
+
case 51:return 122
|
|
1158
|
+
break;
|
|
1159
|
+
case 52:return 124
|
|
1160
|
+
break;
|
|
1161
|
+
case 53:return 125
|
|
1162
|
+
break;
|
|
1163
|
+
case 54:return 128
|
|
1164
|
+
break;
|
|
1165
|
+
case 55:return 127
|
|
1166
|
+
break;
|
|
1167
|
+
case 56:return 129
|
|
1168
|
+
break;
|
|
1169
|
+
case 57:return 130
|
|
1170
|
+
break;
|
|
1171
|
+
case 58:return 131
|
|
1172
|
+
break;
|
|
1173
|
+
case 59:return 123
|
|
1174
|
+
break;
|
|
1175
|
+
case 60:return 126
|
|
1176
|
+
break;
|
|
1177
|
+
case 61:return 104
|
|
1178
|
+
break;
|
|
1179
|
+
case 62:return 25
|
|
1180
|
+
break;
|
|
1181
|
+
case 63:return 28
|
|
1182
|
+
break;
|
|
1183
|
+
case 64:return 88
|
|
1184
|
+
break;
|
|
1185
|
+
case 65:return 50
|
|
1186
|
+
break;
|
|
1187
|
+
case 66:return 52
|
|
1188
|
+
break;
|
|
1189
|
+
case 67:return 53
|
|
1190
|
+
break;
|
|
1191
|
+
case 68:return 54
|
|
1192
|
+
break;
|
|
1193
|
+
case 69:return 73
|
|
1194
|
+
break;
|
|
1195
|
+
case 70:return 78
|
|
1196
|
+
break;
|
|
1197
|
+
case 71:return 84
|
|
1198
|
+
break;
|
|
1199
|
+
case 72:return 85
|
|
1200
|
+
break;
|
|
1201
|
+
case 73:return 47
|
|
1202
|
+
break;
|
|
1203
|
+
case 74:return 49
|
|
1204
|
+
break;
|
|
1205
|
+
case 75:return 22
|
|
1206
|
+
break;
|
|
1207
|
+
case 76:return 140
|
|
1208
|
+
break;
|
|
1209
|
+
case 77:return 13
|
|
1210
|
+
break;
|
|
1211
|
+
case 78:return 138
|
|
1212
|
+
break;
|
|
1213
|
+
case 79:return 139
|
|
1214
|
+
break;
|
|
1215
|
+
case 80:return 137
|
|
1216
|
+
break;
|
|
1217
|
+
case 81:return 56
|
|
1218
|
+
break;
|
|
1219
|
+
case 82:return 79
|
|
1220
|
+
break;
|
|
1221
|
+
case 83:return 111
|
|
1222
|
+
break;
|
|
1223
|
+
case 84:return 112
|
|
1224
|
+
break;
|
|
1225
|
+
case 85:return 113
|
|
1226
|
+
break;
|
|
1227
|
+
case 86:return 141
|
|
1228
|
+
break;
|
|
1229
|
+
case 87:return 75
|
|
1230
|
+
break;
|
|
1231
|
+
case 88:return 57
|
|
1232
|
+
break;
|
|
1233
|
+
case 89:return 58
|
|
1234
|
+
break;
|
|
1235
|
+
case 90:return 5
|
|
1236
|
+
break;
|
|
1237
|
+
case 91:
|
|
1238
|
+
break;
|
|
1239
|
+
}
|
|
1240
|
+
},
|
|
1241
|
+
rules: [/^(?:[ \t]+)/,/^(?:(\r?\n)+)/,/^(?:%.*)/,/^(?:\[title\b)/,/^(?:\[subtitle\b)/,/^(?:\[composer\b)/,/^(?:\[arranger\b)/,/^(?:\[lyricist\b)/,/^(?:\[opus\b)/,/^(?:\[instrument\b)/,/^(?:\[genre\b)/,/^(?:\])/,/^(?:"[^"]*")/,/^(?:\\clef\b)/,/^(?:\\key\b)/,/^(?:\\time\b)/,/^(?:\\tempo\b)/,/^(?:\\staff\b)/,/^(?:\\grace\b)/,/^(?:\\times\b)/,/^(?:\\repeat\b)/,/^(?:\\ottava\b)/,/^(?:\\stemUp\b)/,/^(?:\\stemDown\b)/,/^(?:\\stemNeutral\b)/,/^(?:\\major\b)/,/^(?:\\minor\b)/,/^(?:\\sustainOn\b)/,/^(?:\\sustainOff\b)/,/^(?:\\bar\b)/,/^(?:\\coda\b)/,/^(?:\\segno\b)/,/^(?:\\chords\b)/,/^(?:\\markup\b)/,/^(?:\\<)/,/^(?:\\>)/,/^(?:\\!)/,/^(?:\\staccato\b)/,/^(?:\\staccatissimo\b)/,/^(?:\\tenuto\b)/,/^(?:\\marcato\b)/,/^(?:\\accent\b)/,/^(?:\\portato\b)/,/^(?:\\trill\b)/,/^(?:\\turn\b)/,/^(?:\\mordent\b)/,/^(?:\\prall\b)/,/^(?:\\fermata\b)/,/^(?:\\shortfermata\b)/,/^(?:\\arpeggio\b)/,/^(?:\\ppp\b)/,/^(?:\\pp\b)/,/^(?:\\mp\b)/,/^(?:\\mf\b)/,/^(?:\\fff\b)/,/^(?:\\ff\b)/,/^(?:\\sfz\b)/,/^(?:\\rfz\b)/,/^(?:\\sf\b)/,/^(?:\\p\b)/,/^(?:\\f)/,/^(?:\\rest\b)/,/^(?:\\\\\\)/,/^(?:\\\\)/,/^(?:tremolo\b)/,/^(?:[a-g](ss|ff|s|f)?)/,/^(?:')/,/^(?:,)/,/^(?:[0-9]+)/,/^(?:\/)/,/^(?:#)/,/^(?:\{)/,/^(?:\})/,/^(?:<)/,/^(?:>)/,/^(?:\|)/,/^(?:\[)/,/^(?:\])/,/^(?:\()/,/^(?:\))/,/^(?:~)/,/^(?:\.)/,/^(?:-)/,/^(?:_\b)/,/^(?:\^)/,/^(?:!)/,/^(?::)/,/^(?:=)/,/^(?:[rR])/,/^(?:[sS])/,/^(?:$)/,/^(?:.)/],
|
|
1242
|
+
conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91],"inclusive":true}}
|
|
1243
|
+
});
|
|
1244
|
+
return lexer;
|
|
1245
|
+
})();
|
|
1246
|
+
parser.lexer = lexer;
|
|
1247
|
+
function Parser () {
|
|
1248
|
+
this.yy = {};
|
|
1249
|
+
}
|
|
1250
|
+
Parser.prototype = parser;parser.Parser = Parser;
|
|
1251
|
+
return new Parser;
|
|
1252
|
+
})(), writable: false, configurable: false });
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
// ES module exports
|
|
1257
|
+
const __grammar = globalThis.__lilyletGrammar__;
|
|
1258
|
+
const __parser = globalThis.__lilyletGrammar__;
|
|
1259
|
+
const __Parser = globalThis.__lilyletGrammar__.Parser;
|
|
1260
|
+
const __parse = function() { return globalThis.__lilyletGrammar__.parse.apply(globalThis.__lilyletGrammar__, arguments); };
|
|
1261
|
+
|
|
1262
|
+
export { __grammar as grammar, __parser as parser, __Parser as Parser, __parse as parse };
|
|
1263
|
+
export default __grammar;
|