summaryrefslogtreecommitdiffstats
path: root/src/parsing/equalizer_apo.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parsing/equalizer_apo.rs')
-rw-r--r--src/parsing/equalizer_apo.rs1164
1 files changed, 1164 insertions, 0 deletions
diff --git a/src/parsing/equalizer_apo.rs b/src/parsing/equalizer_apo.rs
new file mode 100644
index 0000000..3fab396
--- /dev/null
+++ b/src/parsing/equalizer_apo.rs
@@ -0,0 +1,1164 @@
1// auto-generated: "lalrpop 0.15.2"
2// sha256: 81b6fa5856d7887b20715c2c7f6137db1927ece087e2db9f4bf1fcd8943365c5
3use ::Filter;
4use std::str::FromStr;
5#[allow(unused_extern_crates)]
6extern crate lalrpop_util as __lalrpop_util;
7
8#[cfg_attr(rustfmt, rustfmt_skip)]
9mod __parse__Main {
10 #![allow(non_snake_case, non_camel_case_types, unused_mut, unused_variables, unused_imports, unused_parens)]
11
12 use ::Filter;
13 use std::str::FromStr;
14 #[allow(unused_extern_crates)]
15 extern crate lalrpop_util as __lalrpop_util;
16 use super::__intern_token::Token;
17 #[allow(dead_code)]
18 pub enum __Symbol<'input>
19 {
20 Variant0(&'input str),
21 Variant1((u32, f64)),
22 Variant2(::std::vec::Vec<(u32, f64)>),
23 Variant3(f64),
24 Variant4((Vec<u32>, Vec<f64>)),
25 Variant5(u32),
26 Variant6(Filter),
27 Variant7(i32),
28 }
29 const __ACTION: &'static [i8] = &[
30 // State 0
31 0, 0, 4, 0, 0, 0, 0,
32 // State 1
33 0, 0, 0, 0, 0, 0, 0,
34 // State 2
35 0, 6, 0, 0, 0, 0, 0,
36 // State 3
37 0, 0, 0, 0, 12, 13, 14,
38 // State 4
39 0, 0, 0, 0, 0, 0, 0,
40 // State 5
41 0, 0, 0, 0, 0, 0, 14,
42 // State 6
43 0, -12, 0, 0, 0, 0, 0,
44 // State 7
45 0, 0, 0, 17, 0, 0, 0,
46 // State 8
47 -9, 0, 0, -9, 0, 0, 0,
48 // State 9
49 -7, 0, 0, -7, 0, 0, 0,
50 // State 10
51 -8, 0, 0, -8, 0, 0, 0,
52 // State 11
53 -13, 0, 0, -13, 0, 0, 0,
54 // State 12
55 -14, 0, 0, -14, 0, 0, 0,
56 // State 13
57 -10, 0, 0, -10, -10, -10, -10,
58 // State 14
59 0, 0, 0, 0, 0, 0, 14,
60 // State 15
61 0, 0, 0, 0, 12, 13, 14,
62 // State 16
63 0, -5, 0, 0, 0, 0, 0,
64 // State 17
65 0, 0, 0, 0, 12, 13, 14,
66 // State 18
67 21, 0, 0, 0, 0, 0, 0,
68 // State 19
69 22, 0, 0, 0, 0, 0, 0,
70 // State 20
71 0, 0, 0, 0, 0, 0, -2,
72 // State 21
73 0, 0, 0, 0, 0, 0, -3,
74 ];
75 const __EOF_ACTION: &'static [i8] = &[
76 // State 0
77 0,
78 // State 1
79 -15,
80 // State 2
81 0,
82 // State 3
83 0,
84 // State 4
85 -11,
86 // State 5
87 0,
88 // State 6
89 0,
90 // State 7
91 0,
92 // State 8
93 -9,
94 // State 9
95 -7,
96 // State 10
97 -8,
98 // State 11
99 -13,
100 // State 12
101 -14,
102 // State 13
103 -10,
104 // State 14
105 0,
106 // State 15
107 0,
108 // State 16
109 0,
110 // State 17
111 0,
112 // State 18
113 0,
114 // State 19
115 -6,
116 // State 20
117 0,
118 // State 21
119 0,
120 ];
121 const __GOTO: &'static [i8] = &[
122 // State 0
123 0, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 0,
124 // State 1
125 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
126 // State 2
127 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0,
128 // State 3
129 0, 0, 0, 7, 0, 8, 9, 0, 0, 10, 11, 0,
130 // State 4
131 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
132 // State 5
133 0, 15, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
134 // State 6
135 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
136 // State 7
137 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
138 // State 8
139 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
140 // State 9
141 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
142 // State 10
143 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
144 // State 11
145 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
146 // State 12
147 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
148 // State 13
149 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
150 // State 14
151 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0,
152 // State 15
153 0, 0, 0, 0, 0, 19, 9, 0, 0, 10, 11, 0,
154 // State 16
155 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
156 // State 17
157 0, 0, 0, 0, 0, 20, 9, 0, 0, 10, 11, 0,
158 // State 18
159 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
160 // State 19
161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
162 // State 20
163 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
164 // State 21
165 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
166 ];
167 fn __expected_tokens(__state: usize) -> Vec<::std::string::String> {
168 const __TERMINAL: &'static [&'static str] = &[
169 r###"";""###,
170 r###""GraphicEQ:""###,
171 r###""Preamp:""###,
172 r###""dB""###,
173 r###"r#"-?[0-9]*\\.[0-9]+"#"###,
174 r###"r#"-[0-9]+"#"###,
175 r###"r#"[0-9]+"#"###,
176 ];
177 __ACTION[(__state * 7)..].iter().zip(__TERMINAL).filter_map(|(&state, terminal)| {
178 if state == 0 {
179 None
180 } else {
181 Some(terminal.to_string())
182 }
183 }).collect()
184 }
185 pub struct MainParser {
186 builder: super::__intern_token::__MatcherBuilder,
187 _priv: (),
188 }
189
190 impl MainParser {
191 pub fn new() -> MainParser {
192 let __builder = super::__intern_token::__MatcherBuilder::new();
193 MainParser {
194 builder: __builder,
195 _priv: (),
196 }
197 }
198
199 #[allow(dead_code)]
200 pub fn parse<
201 'input,
202 >(
203 &self,
204 input: &'input str,
205 ) -> Result<Filter, __lalrpop_util::ParseError<usize, Token<'input>, &'static str>>
206 {
207 let mut __tokens = self.builder.matcher(input);
208 let mut __states = vec![0_i8];
209 let mut __symbols = vec![];
210 let mut __integer;
211 let mut __lookahead;
212 let __last_location = &mut Default::default();
213 '__shift: loop {
214 __lookahead = match __tokens.next() {
215 Some(Ok(v)) => v,
216 None => break '__shift,
217 Some(Err(e)) => return Err(e),
218 };
219 *__last_location = __lookahead.2.clone();
220 __integer = match __lookahead.1 {
221 Token(3, _) if true => 0,
222 Token(4, _) if true => 1,
223 Token(5, _) if true => 2,
224 Token(6, _) if true => 3,
225 Token(0, _) if true => 4,
226 Token(1, _) if true => 5,
227 Token(2, _) if true => 6,
228 _ => {
229 let __state = *__states.last().unwrap() as usize;
230 let __error = __lalrpop_util::ParseError::UnrecognizedToken {
231 token: Some(__lookahead),
232 expected: __expected_tokens(__state),
233 };
234 return Err(__error);
235 }
236 };
237 '__inner: loop {
238 let __state = *__states.last().unwrap() as usize;
239 let __action = __ACTION[__state * 7 + __integer];
240 if __action > 0 {
241 let __symbol = match __integer {
242 0 => match __lookahead.1 {
243 Token(3, __tok0) => __Symbol::Variant0((__tok0)),
244 _ => unreachable!(),
245 },
246 1 => match __lookahead.1 {
247 Token(4, __tok0) => __Symbol::Variant0((__tok0)),
248 _ => unreachable!(),
249 },
250 2 => match __lookahead.1 {
251 Token(5, __tok0) => __Symbol::Variant0((__tok0)),
252 _ => unreachable!(),
253 },
254 3 => match __lookahead.1 {
255 Token(6, __tok0) => __Symbol::Variant0((__tok0)),
256 _ => unreachable!(),
257 },
258 4 => match __lookahead.1 {
259 Token(0, __tok0) => __Symbol::Variant0((__tok0)),
260 _ => unreachable!(),
261 },
262 5 => match __lookahead.1 {
263 Token(1, __tok0) => __Symbol::Variant0((__tok0)),
264 _ => unreachable!(),
265 },
266 6 => match __lookahead.1 {
267 Token(2, __tok0) => __Symbol::Variant0((__tok0)),
268 _ => unreachable!(),
269 },
270 _ => unreachable!(),
271 };
272 __states.push(__action - 1);
273 __symbols.push((__lookahead.0, __symbol, __lookahead.2));
274 continue '__shift;
275 } else if __action < 0 {
276 if let Some(r) = __reduce(input, __action, Some(&__lookahead.0), &mut __states, &mut __symbols, ::std::marker::PhantomData::<()>) {
277 if r.is_err() {
278 return r;
279 }
280 return Err(__lalrpop_util::ParseError::ExtraToken { token: __lookahead });
281 }
282 } else {
283 let mut __err_lookahead = Some(__lookahead);
284 let mut __err_integer: Option<usize> = Some(__integer);
285 let __state = *__states.last().unwrap() as usize;
286 let __error = __lalrpop_util::ParseError::UnrecognizedToken {
287 token: __err_lookahead,
288 expected: __expected_tokens(__state),
289 };
290 return Err(__error)
291 }
292 }
293 }
294 loop {
295 let __state = *__states.last().unwrap() as usize;
296 let __action = __EOF_ACTION[__state];
297 if __action < 0 {
298 if let Some(r) = __reduce(input, __action, None, &mut __states, &mut __symbols, ::std::marker::PhantomData::<()>) {
299 return r;
300 }
301 } else {
302 let mut __err_lookahead = None;
303 let mut __err_integer: Option<usize> = None;
304 let __state = *__states.last().unwrap() as usize;
305 let __error = __lalrpop_util::ParseError::UnrecognizedToken {
306 token: __err_lookahead,
307 expected: __expected_tokens(__state),
308 };
309 return Err(__error)
310 }
311 }
312 }
313 }
314 pub(crate) fn __reduce<
315 'input,
316 >(
317 input: &'input str,
318 __action: i8,
319 __lookahead_start: Option<&usize>,
320 __states: &mut ::std::vec::Vec<i8>,
321 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>,
322 _: ::std::marker::PhantomData<()>,
323 ) -> Option<Result<Filter,__lalrpop_util::ParseError<usize, Token<'input>, &'static str>>>
324 {
325 let (__pop_states, __symbol, __nonterminal) = match -__action {
326 1 => {
327 __reduce1(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>)
328 }
329 2 => {
330 __reduce2(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>)
331 }
332 3 => {
333 __reduce3(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>)
334 }
335 4 => {
336 __reduce4(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>)
337 }
338 5 => {
339 __reduce5(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>)
340 }
341 6 => {
342 __reduce6(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>)
343 }
344 7 => {
345 __reduce7(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>)
346 }
347 8 => {
348 __reduce8(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>)
349 }
350 9 => {
351 __reduce9(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>)
352 }
353 10 => {
354 __reduce10(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>)
355 }
356 11 => {
357 __reduce11(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>)
358 }
359 12 => {
360 __reduce12(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>)
361 }
362 13 => {
363 __reduce13(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>)
364 }
365 14 => {
366 __reduce14(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>)
367 }
368 15 => {
369 // __Main = Main => ActionFn(0);
370 let __sym0 = __pop_Variant6(__symbols);
371 let __start = __sym0.0.clone();
372 let __end = __sym0.2.clone();
373 let __nt = super::__action0::<>(input, __sym0);
374 return Some(Ok(__nt));
375 }
376 _ => panic!("invalid action code {}", __action)
377 };
378 let __states_len = __states.len();
379 __states.truncate(__states_len - __pop_states);
380 __symbols.push(__symbol);
381 let __state = *__states.last().unwrap() as usize;
382 let __next_state = __GOTO[__state * 12 + __nonterminal] - 1;
383 __states.push(__next_state);
384 None
385 }
386 fn __pop_Variant4<
387 'input,
388 >(
389 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>
390 ) -> (usize, (Vec<u32>, Vec<f64>), usize)
391 {
392 match __symbols.pop().unwrap() {
393 (__l, __Symbol::Variant4(__v), __r) => (__l, __v, __r),
394 _ => panic!("symbol type mismatch")
395 }
396 }
397 fn __pop_Variant1<
398 'input,
399 >(
400 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>
401 ) -> (usize, (u32, f64), usize)
402 {
403 match __symbols.pop().unwrap() {
404 (__l, __Symbol::Variant1(__v), __r) => (__l, __v, __r),
405 _ => panic!("symbol type mismatch")
406 }
407 }
408 fn __pop_Variant6<
409 'input,
410 >(
411 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>
412 ) -> (usize, Filter, usize)
413 {
414 match __symbols.pop().unwrap() {
415 (__l, __Symbol::Variant6(__v), __r) => (__l, __v, __r),
416 _ => panic!("symbol type mismatch")
417 }
418 }
419 fn __pop_Variant3<
420 'input,
421 >(
422 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>
423 ) -> (usize, f64, usize)
424 {
425 match __symbols.pop().unwrap() {
426 (__l, __Symbol::Variant3(__v), __r) => (__l, __v, __r),
427 _ => panic!("symbol type mismatch")
428 }
429 }
430 fn __pop_Variant7<
431 'input,
432 >(
433 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>
434 ) -> (usize, i32, usize)
435 {
436 match __symbols.pop().unwrap() {
437 (__l, __Symbol::Variant7(__v), __r) => (__l, __v, __r),
438 _ => panic!("symbol type mismatch")
439 }
440 }
441 fn __pop_Variant5<
442 'input,
443 >(
444 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>
445 ) -> (usize, u32, usize)
446 {
447 match __symbols.pop().unwrap() {
448 (__l, __Symbol::Variant5(__v), __r) => (__l, __v, __r),
449 _ => panic!("symbol type mismatch")
450 }
451 }
452 fn __pop_Variant2<
453 'input,
454 >(
455 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>
456 ) -> (usize, ::std::vec::Vec<(u32, f64)>, usize)
457 {
458 match __symbols.pop().unwrap() {
459 (__l, __Symbol::Variant2(__v), __r) => (__l, __v, __r),
460 _ => panic!("symbol type mismatch")
461 }
462 }
463 fn __pop_Variant0<
464 'input,
465 >(
466 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>
467 ) -> (usize, &'input str, usize)
468 {
469 match __symbols.pop().unwrap() {
470 (__l, __Symbol::Variant0(__v), __r) => (__l, __v, __r),
471 _ => panic!("symbol type mismatch")
472 }
473 }
474 pub(crate) fn __reduce1<
475 'input,
476 >(
477 input: &'input str,
478 __action: i8,
479 __lookahead_start: Option<&usize>,
480 __states: &mut ::std::vec::Vec<i8>,
481 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>,
482 _: ::std::marker::PhantomData<()>,
483 ) -> (usize, (usize,__Symbol<'input>,usize), usize)
484 {
485 // (<(Integer Float)> ";") = Integer, Float, ";" => ActionFn(15);
486 let __sym2 = __pop_Variant0(__symbols);
487 let __sym1 = __pop_Variant3(__symbols);
488 let __sym0 = __pop_Variant5(__symbols);
489 let __start = __sym0.0.clone();
490 let __end = __sym2.2.clone();
491 let __nt = super::__action15::<>(input, __sym0, __sym1, __sym2);
492 let __symbol = (__start, __Symbol::Variant1(__nt), __end);
493 (3, __symbol, 0)
494 }
495 pub(crate) fn __reduce2<
496 'input,
497 >(
498 input: &'input str,
499 __action: i8,
500 __lookahead_start: Option<&usize>,
501 __states: &mut ::std::vec::Vec<i8>,
502 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>,
503 _: ::std::marker::PhantomData<()>,
504 ) -> (usize, (usize,__Symbol<'input>,usize), usize)
505 {
506 // (<(Integer Float)> ";")+ = Integer, Float, ";" => ActionFn(17);
507 let __sym2 = __pop_Variant0(__symbols);
508 let __sym1 = __pop_Variant3(__symbols);
509 let __sym0 = __pop_Variant5(__symbols);
510 let __start = __sym0.0.clone();
511 let __end = __sym2.2.clone();
512 let __nt = super::__action17::<>(input, __sym0, __sym1, __sym2);
513 let __symbol = (__start, __Symbol::Variant2(__nt), __end);
514 (3, __symbol, 1)
515 }
516 pub(crate) fn __reduce3<
517 'input,
518 >(
519 input: &'input str,
520 __action: i8,
521 __lookahead_start: Option<&usize>,
522 __states: &mut ::std::vec::Vec<i8>,
523 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>,
524 _: ::std::marker::PhantomData<()>,
525 ) -> (usize, (usize,__Symbol<'input>,usize), usize)
526 {
527 // (<(Integer Float)> ";")+ = (<(Integer Float)> ";")+, Integer, Float, ";" => ActionFn(18);
528 let __sym3 = __pop_Variant0(__symbols);
529 let __sym2 = __pop_Variant3(__symbols);
530 let __sym1 = __pop_Variant5(__symbols);
531 let __sym0 = __pop_Variant2(__symbols);
532 let __start = __sym0.0.clone();
533 let __end = __sym3.2.clone();
534 let __nt = super::__action18::<>(input, __sym0, __sym1, __sym2, __sym3);
535 let __symbol = (__start, __Symbol::Variant2(__nt), __end);
536 (4, __symbol, 1)
537 }
538 pub(crate) fn __reduce4<
539 'input,
540 >(
541 input: &'input str,
542 __action: i8,
543 __lookahead_start: Option<&usize>,
544 __states: &mut ::std::vec::Vec<i8>,
545 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>,
546 _: ::std::marker::PhantomData<()>,
547 ) -> (usize, (usize,__Symbol<'input>,usize), usize)
548 {
549 // (Integer Float) = Integer, Float => ActionFn(14);
550 let __sym1 = __pop_Variant3(__symbols);
551 let __sym0 = __pop_Variant5(__symbols);
552 let __start = __sym0.0.clone();
553 let __end = __sym1.2.clone();
554 let __nt = super::__action14::<>(input, __sym0, __sym1);
555 let __symbol = (__start, __Symbol::Variant1(__nt), __end);
556 (2, __symbol, 2)
557 }
558 pub(crate) fn __reduce5<
559 'input,
560 >(
561 input: &'input str,
562 __action: i8,
563 __lookahead_start: Option<&usize>,
564 __states: &mut ::std::vec::Vec<i8>,
565 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>,
566 _: ::std::marker::PhantomData<()>,
567 ) -> (usize, (usize,__Symbol<'input>,usize), usize)
568 {
569 // Decibel = Float, "dB" => ActionFn(4);
570 let __sym1 = __pop_Variant0(__symbols);
571 let __sym0 = __pop_Variant3(__symbols);
572 let __start = __sym0.0.clone();
573 let __end = __sym1.2.clone();
574 let __nt = super::__action4::<>(input, __sym0, __sym1);
575 let __symbol = (__start, __Symbol::Variant3(__nt), __end);
576 (2, __symbol, 3)
577 }
578 pub(crate) fn __reduce6<
579 'input,
580 >(
581 input: &'input str,
582 __action: i8,
583 __lookahead_start: Option<&usize>,
584 __states: &mut ::std::vec::Vec<i8>,
585 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>,
586 _: ::std::marker::PhantomData<()>,
587 ) -> (usize, (usize,__Symbol<'input>,usize), usize)
588 {
589 // Eq = "GraphicEQ:", (<(Integer Float)> ";")+, Integer, Float => ActionFn(16);
590 let __sym3 = __pop_Variant3(__symbols);
591 let __sym2 = __pop_Variant5(__symbols);
592 let __sym1 = __pop_Variant2(__symbols);
593 let __sym0 = __pop_Variant0(__symbols);
594 let __start = __sym0.0.clone();
595 let __end = __sym3.2.clone();
596 let __nt = super::__action16::<>(input, __sym0, __sym1, __sym2, __sym3);
597 let __symbol = (__start, __Symbol::Variant4(__nt), __end);
598 (4, __symbol, 4)
599 }
600 pub(crate) fn __reduce7<
601 'input,
602 >(
603 input: &'input str,
604 __action: i8,
605 __lookahead_start: Option<&usize>,
606 __states: &mut ::std::vec::Vec<i8>,
607 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>,
608 _: ::std::marker::PhantomData<()>,
609 ) -> (usize, (usize,__Symbol<'input>,usize), usize)
610 {
611 // Float = RawFloat => ActionFn(5);
612 let __sym0 = __pop_Variant3(__symbols);
613 let __start = __sym0.0.clone();
614 let __end = __sym0.2.clone();
615 let __nt = super::__action5::<>(input, __sym0);
616 let __symbol = (__start, __Symbol::Variant3(__nt), __end);
617 (1, __symbol, 5)
618 }
619 pub(crate) fn __reduce8<
620 'input,
621 >(
622 input: &'input str,
623 __action: i8,
624 __lookahead_start: Option<&usize>,
625 __states: &mut ::std::vec::Vec<i8>,
626 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>,
627 _: ::std::marker::PhantomData<()>,
628 ) -> (usize, (usize,__Symbol<'input>,usize), usize)
629 {
630 // Float = SignedInteger => ActionFn(6);
631 let __sym0 = __pop_Variant7(__symbols);
632 let __start = __sym0.0.clone();
633 let __end = __sym0.2.clone();
634 let __nt = super::__action6::<>(input, __sym0);
635 let __symbol = (__start, __Symbol::Variant3(__nt), __end);
636 (1, __symbol, 5)
637 }
638 pub(crate) fn __reduce9<
639 'input,
640 >(
641 input: &'input str,
642 __action: i8,
643 __lookahead_start: Option<&usize>,
644 __states: &mut ::std::vec::Vec<i8>,
645 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>,
646 _: ::std::marker::PhantomData<()>,
647 ) -> (usize, (usize,__Symbol<'input>,usize), usize)
648 {
649 // Float = Integer => ActionFn(7);
650 let __sym0 = __pop_Variant5(__symbols);
651 let __start = __sym0.0.clone();
652 let __end = __sym0.2.clone();
653 let __nt = super::__action7::<>(input, __sym0);
654 let __symbol = (__start, __Symbol::Variant3(__nt), __end);
655 (1, __symbol, 5)
656 }
657 pub(crate) fn __reduce10<
658 'input,
659 >(
660 input: &'input str,
661 __action: i8,
662 __lookahead_start: Option<&usize>,
663 __states: &mut ::std::vec::Vec<i8>,
664 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>,
665 _: ::std::marker::PhantomData<()>,
666 ) -> (usize, (usize,__Symbol<'input>,usize), usize)
667 {
668 // Integer = r#"[0-9]+"# => ActionFn(10);
669 let __sym0 = __pop_Variant0(__symbols);
670 let __start = __sym0.0.clone();
671 let __end = __sym0.2.clone();
672 let __nt = super::__action10::<>(input, __sym0);
673 let __symbol = (__start, __Symbol::Variant5(__nt), __end);
674 (1, __symbol, 6)
675 }
676 pub(crate) fn __reduce11<
677 'input,
678 >(
679 input: &'input str,
680 __action: i8,
681 __lookahead_start: Option<&usize>,
682 __states: &mut ::std::vec::Vec<i8>,
683 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>,
684 _: ::std::marker::PhantomData<()>,
685 ) -> (usize, (usize,__Symbol<'input>,usize), usize)
686 {
687 // Main = Preamp, Eq => ActionFn(1);
688 let __sym1 = __pop_Variant4(__symbols);
689 let __sym0 = __pop_Variant3(__symbols);
690 let __start = __sym0.0.clone();
691 let __end = __sym1.2.clone();
692 let __nt = super::__action1::<>(input, __sym0, __sym1);
693 let __symbol = (__start, __Symbol::Variant6(__nt), __end);
694 (2, __symbol, 7)
695 }
696 pub(crate) fn __reduce12<
697 'input,
698 >(
699 input: &'input str,
700 __action: i8,
701 __lookahead_start: Option<&usize>,
702 __states: &mut ::std::vec::Vec<i8>,
703 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>,
704 _: ::std::marker::PhantomData<()>,
705 ) -> (usize, (usize,__Symbol<'input>,usize), usize)
706 {
707 // Preamp = "Preamp:", Decibel => ActionFn(2);
708 let __sym1 = __pop_Variant3(__symbols);
709 let __sym0 = __pop_Variant0(__symbols);
710 let __start = __sym0.0.clone();
711 let __end = __sym1.2.clone();
712 let __nt = super::__action2::<>(input, __sym0, __sym1);
713 let __symbol = (__start, __Symbol::Variant3(__nt), __end);
714 (2, __symbol, 8)
715 }
716 pub(crate) fn __reduce13<
717 'input,
718 >(
719 input: &'input str,
720 __action: i8,
721 __lookahead_start: Option<&usize>,
722 __states: &mut ::std::vec::Vec<i8>,
723 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>,
724 _: ::std::marker::PhantomData<()>,
725 ) -> (usize, (usize,__Symbol<'input>,usize), usize)
726 {
727 // RawFloat = r#"-?[0-9]*\\.[0-9]+"# => ActionFn(8);
728 let __sym0 = __pop_Variant0(__symbols);
729 let __start = __sym0.0.clone();
730 let __end = __sym0.2.clone();
731 let __nt = super::__action8::<>(input, __sym0);
732 let __symbol = (__start, __Symbol::Variant3(__nt), __end);
733 (1, __symbol, 9)
734 }
735 pub(crate) fn __reduce14<
736 'input,
737 >(
738 input: &'input str,
739 __action: i8,
740 __lookahead_start: Option<&usize>,
741 __states: &mut ::std::vec::Vec<i8>,
742 __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>,
743 _: ::std::marker::PhantomData<()>,
744 ) -> (usize, (usize,__Symbol<'input>,usize), usize)
745 {
746 // SignedInteger = r#"-[0-9]+"# => ActionFn(9);
747 let __sym0 = __pop_Variant0(__symbols);
748 let __start = __sym0.0.clone();
749 let __end = __sym0.2.clone();
750 let __nt = super::__action9::<>(input, __sym0);
751 let __symbol = (__start, __Symbol::Variant7(__nt), __end);
752 (1, __symbol, 10)
753 }
754}
755pub use self::__parse__Main::MainParser;
756#[cfg_attr(rustfmt, rustfmt_skip)]
757mod __intern_token {
758 #![allow(unused_imports)]
759 use ::Filter;
760 use std::str::FromStr;
761 #[allow(unused_extern_crates)]
762 extern crate lalrpop_util as __lalrpop_util;
763 extern crate regex as __regex;
764 use std::fmt as __fmt;
765
766 #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
767 pub struct Token<'input>(pub usize, pub &'input str);
768 impl<'a> __fmt::Display for Token<'a> {
769 fn fmt(&self, formatter: &mut __fmt::Formatter) -> Result<(), __fmt::Error> {
770 __fmt::Display::fmt(self.1, formatter)
771 }
772 }
773
774 pub struct __MatcherBuilder {
775 regex_set: __regex::RegexSet,
776 regex_vec: Vec<__regex::Regex>,
777 }
778
779 impl __MatcherBuilder {
780 pub fn new() -> __MatcherBuilder {
781 let __strs: &[&str] = &[
782 "^((?u:\\-)?(?u:[0-9])*(?u:\\.)(?u:[0-9])+)",
783 "^((?u:\\-)(?u:[0-9])+)",
784 "^((?u:[0-9])+)",
785 "^((?u:;))",
786 "^((?u:GraphicEQ:))",
787 "^((?u:Preamp:))",
788 "^((?u:dB))",
789 ];
790 let __regex_set = __regex::RegexSet::new(__strs).unwrap();
791 let __regex_vec = vec![
792 __regex::Regex::new("^((?u:\\-)?(?u:[0-9])*(?u:\\.)(?u:[0-9])+)").unwrap(),
793 __regex::Regex::new("^((?u:\\-)(?u:[0-9])+)").unwrap(),
794 __regex::Regex::new("^((?u:[0-9])+)").unwrap(),
795 __regex::Regex::new("^((?u:;))").unwrap(),
796 __regex::Regex::new("^((?u:GraphicEQ:))").unwrap(),
797 __regex::Regex::new("^((?u:Preamp:))").unwrap(),
798 __regex::Regex::new("^((?u:dB))").unwrap(),
799 ];
800 __MatcherBuilder { regex_set: __regex_set, regex_vec: __regex_vec }
801 }
802 pub fn matcher<'input, 'builder>(&'builder self, s: &'input str) -> __Matcher<'input, 'builder> {
803 __Matcher {
804 text: s,
805 consumed: 0,
806 regex_set: &self.regex_set,
807 regex_vec: &self.regex_vec,
808 }
809 }
810 }
811
812 pub struct __Matcher<'input, 'builder> {
813 text: &'input str,
814 consumed: usize,
815 regex_set: &'builder __regex::RegexSet,
816 regex_vec: &'builder Vec<__regex::Regex>,
817 }
818
819 impl<'input, 'builder> Iterator for __Matcher<'input, 'builder> {
820 type Item = Result<(usize, Token<'input>, usize), __lalrpop_util::ParseError<usize,Token<'input>,&'static str>>;
821
822 fn next(&mut self) -> Option<Self::Item> {
823 let __text = self.text.trim_left();
824 let __whitespace = self.text.len() - __text.len();
825 let __start_offset = self.consumed + __whitespace;
826 if __text.is_empty() {
827 self.text = __text;
828 self.consumed = __start_offset;
829 None
830 } else {
831 let __matches = self.regex_set.matches(__text);
832 if !__matches.matched_any() {
833 Some(Err(__lalrpop_util::ParseError::InvalidToken {
834 location: __start_offset,
835 }))
836 } else {
837 let mut __longest_match = 0;
838 let mut __index = 0;
839 for __i in 0 .. 7 {
840 if __matches.matched(__i) {
841 let __match = self.regex_vec[__i].find(__text).unwrap();
842 let __len = __match.end();
843 if __len >= __longest_match {
844 __longest_match = __len;
845 __index = __i;
846 }
847 }
848 }
849 let __result = &__text[..__longest_match];
850 let __remaining = &__text[__longest_match..];
851 let __end_offset = __start_offset + __longest_match;
852 self.text = __remaining;
853 self.consumed = __end_offset;
854 Some(Ok((__start_offset, Token(__index, __result), __end_offset)))
855 }
856 }
857 }
858 }
859}
860pub use self::__intern_token::Token;
861
862#[allow(unused_variables)]
863fn __action0<
864 'input,
865>(
866 input: &'input str,
867 (_, __0, _): (usize, Filter, usize),
868) -> Filter
869{
870 (__0)
871}
872
873#[allow(unused_variables)]
874fn __action1<
875 'input,
876>(
877 input: &'input str,
878 (_, preamp, _): (usize, f64, usize),
879 (_, eq, _): (usize, (Vec<u32>, Vec<f64>), usize),
880) -> Filter
881{
882 {
883 let coefficients: Vec<_> = eq.1.iter().map(|decibel| 10f64.powf(decibel / 10f64)).collect();
884 // TODO: add decibel_to_ratio conversion function
885 let preamp = 10f64.powf(preamp / 10f64);
886 Filter { preamp, frequencies: eq.0, coefficients }
887 }
888}
889
890#[allow(unused_variables)]
891fn __action2<
892 'input,
893>(
894 input: &'input str,
895 (_, _, _): (usize, &'input str, usize),
896 (_, __0, _): (usize, f64, usize),
897) -> f64
898{
899 (__0)
900}
901
902#[allow(unused_variables)]
903fn __action3<
904 'input,
905>(
906 input: &'input str,
907 (_, _, _): (usize, &'input str, usize),
908 (_, values, _): (usize, ::std::vec::Vec<(u32, f64)>, usize),
909 (_, end, _): (usize, (u32, f64), usize),
910) -> (Vec<u32>, Vec<f64>)
911{
912 {
913 let mut values = values;
914 values.push(end);
915 values.into_iter().unzip()
916 }
917}
918
919#[allow(unused_variables)]
920fn __action4<
921 'input,
922>(
923 input: &'input str,
924 (_, __0, _): (usize, f64, usize),
925 (_, _, _): (usize, &'input str, usize),
926) -> f64
927{
928 (__0)
929}
930
931#[allow(unused_variables)]
932fn __action5<
933 'input,
934>(
935 input: &'input str,
936 (_, __0, _): (usize, f64, usize),
937) -> f64
938{
939 (__0)
940}
941
942#[allow(unused_variables)]
943fn __action6<
944 'input,
945>(
946 input: &'input str,
947 (_, __0, _): (usize, i32, usize),
948) -> f64
949{
950 __0 as f64
951}
952
953#[allow(unused_variables)]
954fn __action7<
955 'input,
956>(
957 input: &'input str,
958 (_, __0, _): (usize, u32, usize),
959) -> f64
960{
961 __0 as f64
962}
963
964#[allow(unused_variables)]
965fn __action8<
966 'input,
967>(
968 input: &'input str,
969 (_, __0, _): (usize, &'input str, usize),
970) -> f64
971{
972 f64::from_str(__0).unwrap()
973}
974
975#[allow(unused_variables)]
976fn __action9<
977 'input,
978>(
979 input: &'input str,
980 (_, __0, _): (usize, &'input str, usize),
981) -> i32
982{
983 i32::from_str(__0).unwrap()
984}
985
986#[allow(unused_variables)]
987fn __action10<
988 'input,
989>(
990 input: &'input str,
991 (_, __0, _): (usize, &'input str, usize),
992) -> u32
993{
994 u32::from_str(__0).unwrap()
995}
996
997#[allow(unused_variables)]
998fn __action11<
999 'input,
1000>(
1001 input: &'input str,
1002 (_, __0, _): (usize, (u32, f64), usize),
1003) -> ::std::vec::Vec<(u32, f64)>
1004{
1005 vec![__0]
1006}
1007
1008#[allow(unused_variables)]
1009fn __action12<
1010 'input,
1011>(
1012 input: &'input str,
1013 (_, v, _): (usize, ::std::vec::Vec<(u32, f64)>, usize),
1014 (_, e, _): (usize, (u32, f64), usize),
1015) -> ::std::vec::Vec<(u32, f64)>
1016{
1017 { let mut v = v; v.push(e); v }
1018}
1019
1020#[allow(unused_variables)]
1021fn __action13<
1022 'input,
1023>(
1024 input: &'input str,
1025 (_, __0, _): (usize, (u32, f64), usize),
1026 (_, _, _): (usize, &'input str, usize),
1027) -> (u32, f64)
1028{
1029 (__0)
1030}
1031
1032#[allow(unused_variables)]
1033fn __action14<
1034 'input,
1035>(
1036 input: &'input str,
1037 (_, __0, _): (usize, u32, usize),
1038 (_, __1, _): (usize, f64, usize),
1039) -> (u32, f64)
1040{
1041 (__0, __1)
1042}
1043
1044#[allow(unused_variables)]
1045fn __action15<
1046 'input,
1047>(
1048 input: &'input str,
1049 __0: (usize, u32, usize),
1050 __1: (usize, f64, usize),
1051 __2: (usize, &'input str, usize),
1052) -> (u32, f64)
1053{
1054 let __start0 = __0.0.clone();
1055 let __end0 = __1.2.clone();
1056 let __temp0 = __action14(
1057 input,
1058 __0,
1059 __1,
1060 );
1061 let __temp0 = (__start0, __temp0, __end0);
1062 __action13(
1063 input,
1064 __temp0,
1065 __2,
1066 )
1067}
1068
1069#[allow(unused_variables)]
1070fn __action16<
1071 'input,
1072>(
1073 input: &'input str,
1074 __0: (usize, &'input str, usize),
1075 __1: (usize, ::std::vec::Vec<(u32, f64)>, usize),
1076 __2: (usize, u32, usize),
1077 __3: (usize, f64, usize),
1078) -> (Vec<u32>, Vec<f64>)
1079{
1080 let __start0 = __2.0.clone();
1081 let __end0 = __3.2.clone();
1082 let __temp0 = __action14(
1083 input,
1084 __2,
1085 __3,
1086 );
1087 let __temp0 = (__start0, __temp0, __end0);
1088 __action3(
1089 input,
1090 __0,
1091 __1,
1092 __temp0,
1093 )
1094}
1095
1096#[allow(unused_variables)]
1097fn __action17<
1098 'input,
1099>(
1100 input: &'input str,
1101 __0: (usize, u32, usize),
1102 __1: (usize, f64, usize),
1103 __2: (usize, &'input str, usize),
1104) -> ::std::vec::Vec<(u32, f64)>
1105{
1106 let __start0 = __0.0.clone();
1107 let __end0 = __2.2.clone();
1108 let __temp0 = __action15(
1109 input,
1110 __0,
1111 __1,
1112 __2,
1113 );
1114 let __temp0 = (__start0, __temp0, __end0);
1115 __action11(
1116 input,
1117 __temp0,
1118 )
1119}
1120
1121#[allow(unused_variables)]
1122fn __action18<
1123 'input,
1124>(
1125 input: &'input str,
1126 __0: (usize, ::std::vec::Vec<(u32, f64)>, usize),
1127 __1: (usize, u32, usize),
1128 __2: (usize, f64, usize),
1129 __3: (usize, &'input str, usize),
1130) -> ::std::vec::Vec<(u32, f64)>
1131{
1132 let __start0 = __1.0.clone();
1133 let __end0 = __3.2.clone();
1134 let __temp0 = __action15(
1135 input,
1136 __1,
1137 __2,
1138 __3,
1139 );
1140 let __temp0 = (__start0, __temp0, __end0);
1141 __action12(
1142 input,
1143 __0,
1144 __temp0,
1145 )
1146}
1147
1148pub trait __ToTriple<'input, > {
1149 type Error;
1150 fn to_triple(value: Self) -> Result<(usize,Token<'input>,usize),Self::Error>;
1151}
1152
1153impl<'input, > __ToTriple<'input, > for (usize, Token<'input>, usize) {
1154 type Error = &'static str;
1155 fn to_triple(value: Self) -> Result<(usize,Token<'input>,usize),&'static str> {
1156 Ok(value)
1157 }
1158}
1159impl<'input, > __ToTriple<'input, > for Result<(usize, Token<'input>, usize),&'static str> {
1160 type Error = &'static str;
1161 fn to_triple(value: Self) -> Result<(usize,Token<'input>,usize),&'static str> {
1162 value
1163 }
1164}