Module: Musicality::Parsing::Note
- Includes:
- Articulation, Duration, Link, Pitch, Treetop::Runtime
- Included in:
- NoteParser
- Defined in:
- lib/musicality/notation/parsing/note_parsing.rb
Defined Under Namespace
Modules: Note0, Note1, Note2, PitchLink0
Instance Method Summary collapse
Methods included from Duration
#_nt_den_only, #_nt_duration, #_nt_num_and_den, #_nt_num_only
Methods included from PositiveInteger
Methods included from NonnegativeInteger
Methods included from Link
#_nt_glissando, #_nt_link, #_nt_portamento, #_nt_tie
Methods included from Pitch
#_nt_cent, #_nt_letter_a, #_nt_letter_b, #_nt_letter_c, #_nt_letter_d, #_nt_letter_e, #_nt_letter_f, #_nt_letter_g, #_nt_octave, #_nt_pitch, #_nt_pitch_letter
Methods included from Articulation
#_nt_accent, #_nt_articulation, #_nt_marcato, #_nt_portato, #_nt_staccatissimo, #_nt_staccato, #_nt_tenuto
Instance Method Details
#_nt_note ⇒ Object
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 92 93 94 95 96 97 98 99 100 101 102 103 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 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/musicality/notation/parsing/note_parsing.rb', line 60 def _nt_note start_index = index if node_cache[:note].has_key?(index) cached = node_cache[:note][index] if cached node_cache[:note][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if (match_len = has_terminal?("(", false, index)) r2 = true @index += match_len else terminal_parse_failure('"("') r2 = nil end if r2 r1 = r2 else r1 = instantiate_node(SyntaxNode,input, index...index) end s0 << r1 if r1 r3 = _nt_duration s0 << r3 if r3 i5, s5 = index, [] r6 = _nt_pitch_link s5 << r6 if r6 s7, i7 = [], index loop do i8, s8 = index, [] if (match_len = has_terminal?(",", false, index)) r9 = true @index += match_len else terminal_parse_failure('","') r9 = nil end s8 << r9 if r9 r10 = _nt_pitch_link s8 << r10 end if s8.last r8 = instantiate_node(SyntaxNode,input, i8...index, s8) r8.extend(Note0) else @index = i8 r8 = nil end if r8 s7 << r8 else break end end r7 = instantiate_node(SyntaxNode,input, i7...index, s7) s5 << r7 if r7 r12 = _nt_articulation if r12 r11 = r12 else r11 = instantiate_node(SyntaxNode,input, index...index) end s5 << r11 end end if s5.last r5 = instantiate_node(SyntaxNode,input, i5...index, s5) r5.extend(Note1) else @index = i5 r5 = nil end if r5 r4 = r5 else r4 = instantiate_node(SyntaxNode,input, index...index) end s0 << r4 if r4 if (match_len = has_terminal?(")", false, index)) r14 = true @index += match_len else terminal_parse_failure('")"') r14 = nil end if r14 r13 = r14 else r13 = instantiate_node(SyntaxNode,input, index...index) end s0 << r13 end end end if s0.last r0 = instantiate_node(NoteNode,input, i0...index, s0) r0.extend(Note2) else @index = i0 r0 = nil end node_cache[:note][start_index] = r0 r0 end |
#_nt_pitch_link ⇒ Object
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/musicality/notation/parsing/note_parsing.rb', line 186 def _nt_pitch_link start_index = index if node_cache[:pitch_link].has_key?(index) cached = node_cache[:pitch_link][index] if cached node_cache[:pitch_link][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_pitch s0 << r1 if r1 r3 = _nt_link if r3 r2 = r3 else r2 = instantiate_node(SyntaxNode,input, index...index) end s0 << r2 end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(PitchLink0) else @index = i0 r0 = nil end node_cache[:pitch_link][start_index] = r0 r0 end |
#root ⇒ Object
10 11 12 |
# File 'lib/musicality/notation/parsing/note_parsing.rb', line 10 def root @root ||= :note end |