Module: Musicality::Parsing::Meter
Defined Under Namespace
Modules: Meter10, Meter11, Meter20, Meter21
Instance Method Summary
collapse
#_nt_positive_integer
#_nt_nonnegative_integer
Instance Method Details
#_nt_meter ⇒ Object
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
|
# File 'lib/musicality/notation/parsing/meter_parsing.rb', line 16
def _nt_meter
start_index = index
if node_cache[:meter].has_key?(index)
cached = node_cache[:meter][index]
if cached
node_cache[:meter][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0 = index
r1 = _nt_meter1
if r1
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
r0 = r1
else
r2 = _nt_meter2
if r2
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
r0 = r2
else
@index = i0
r0 = nil
end
end
node_cache[:meter][start_index] = r0
r0
end
|
#_nt_meter1 ⇒ Object
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
|
# File 'lib/musicality/notation/parsing/meter_parsing.rb', line 64
def _nt_meter1
start_index = index
if node_cache[:meter1].has_key?(index)
cached = node_cache[:meter1][index]
if cached
node_cache[:meter1][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
r1 = _nt_positive_integer
s0 << r1
if r1
if (match_len = has_terminal?("/", false, index))
r2 = true
@index += match_len
else
terminal_parse_failure('"/"')
r2 = nil
end
s0 << r2
if r2
r3 = _nt_positive_integer
s0 << r3
end
end
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(Meter10)
r0.extend(Meter11)
else
@index = i0
r0 = nil
end
node_cache[:meter1][start_index] = r0
r0
end
|
#_nt_meter2 ⇒ Object
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
175
176
177
178
179
180
|
# File 'lib/musicality/notation/parsing/meter_parsing.rb', line 126
def _nt_meter2
start_index = index
if node_cache[:meter2].has_key?(index)
cached = node_cache[:meter2][index]
if cached
node_cache[:meter2][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
r1 = _nt_positive_integer
s0 << r1
if r1
if (match_len = has_terminal?("*", false, index))
r2 = true
@index += match_len
else
terminal_parse_failure('"*"')
r2 = nil
end
s0 << r2
if r2
r3 = _nt_positive_integer
s0 << r3
if r3
if (match_len = has_terminal?("/", false, index))
r4 = true
@index += match_len
else
terminal_parse_failure('"/"')
r4 = nil
end
s0 << r4
if r4
r5 = _nt_positive_integer
s0 << r5
end
end
end
end
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(Meter20)
r0.extend(Meter21)
else
@index = i0
r0 = nil
end
node_cache[:meter2][start_index] = r0
r0
end
|
#root ⇒ Object
10
11
12
|
# File 'lib/musicality/notation/parsing/meter_parsing.rb', line 10
def root
@root ||= :meter
end
|