From 46b96f3e828e23cb92bea570541e32f899c0e5d5 Mon Sep 17 00:00:00 2001 From: Nixon Enraght-Moony Date: Mon, 27 Dec 2021 15:07:07 +0000 Subject: [PATCH] Drracket compat --- .gitignore | 1 + src/grammar.lalrpop | 14 +- src/grammar.rs | 3708 +++++++++++++++++++-------------- src/main.rs | 5 +- src/test/pass/lambda-calc.scm | 6 +- src/test/pass/math.scm | 4 +- 6 files changed, 2135 insertions(+), 1603 deletions(-) diff --git a/.gitignore b/.gitignore index ea8c4bf..ef2d36a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +*.scm~ \ No newline at end of file diff --git a/src/grammar.lalrpop b/src/grammar.lalrpop index ee02122..f73eadf 100644 --- a/src/grammar.lalrpop +++ b/src/grammar.lalrpop @@ -9,7 +9,10 @@ match { _ } -pub(crate) Trees = Tree+; + +pub(crate) File = {Lang? } + +Trees = Tree+; pub(crate) Tree: Tree = { "(" ")" => Tree::Branch(<>), @@ -37,4 +40,11 @@ Num: f64 = { r"[0-9]+(\.[0-9]+)?" => <>.parse().unwrap() } Bool: bool = { "#t" => true, "#f" => false, -} \ No newline at end of file +} + +Lang: () = { "#lang" LangName } +LangName = { + // TODO: What should these be? + "scheme", + "r7rs", +} \ No newline at end of file diff --git a/src/grammar.rs b/src/grammar.rs index 091c393..0ef023e 100644 --- a/src/grammar.rs +++ b/src/grammar.rs @@ -1,5 +1,5 @@ // auto-generated: "lalrpop 0.19.6" -// sha3: 44b62ddba83dfa68ba81984aa4db1583d1e3d6bdab9f86bff4d7442243f0d965 +// sha3: 081836a45e94e7f63b8cab92d6c3fb6f3fd286189113e73ef425a1afba86 use crate::{Tree, Literal, Lambda}; use std::rc::Rc; #[allow(unused_extern_crates)] @@ -10,7 +10,7 @@ extern crate core; extern crate alloc; #[cfg_attr(rustfmt, rustfmt_skip)] -mod __parse__Tree { +mod __parse__File { #![allow(non_snake_case, non_camel_case_types, unused_mut, unused_variables, unused_imports, unused_parens)] use crate::{Tree, Literal, Lambda}; @@ -28,101 +28,119 @@ mod __parse__Tree { Variant0(&'input str), Variant1(Box), Variant2(bool), - Variant3(Literal), - Variant4(f64), - Variant5(Rc<[String]>), - Variant6(Rc<[Tree]>), - Variant7(String), - Variant8(alloc::vec::Vec), - Variant9(Tree), - Variant10(alloc::vec::Vec), + Variant3(alloc::vec::Vec), + Variant4(()), + Variant5(core::option::Option<()>), + Variant6(Literal), + Variant7(f64), + Variant8(Rc<[String]>), + Variant9(Rc<[Tree]>), + Variant10(String), + Variant11(alloc::vec::Vec), + Variant12(Tree), } const __ACTION: &[i8] = &[ // State 0 - 21, 22, 2, 0, 0, 0, 0, 23, 24, + 26, 4, 27, 5, 0, 0, 0, 0, 0, 0, 28, 29, // State 1 - 21, 22, 2, 0, 4, 5, 6, 23, 24, + 26, 0, 27, 5, 0, 0, 0, 0, 0, 0, 28, 29, // State 2 - 21, 22, 2, 27, 0, 0, 0, 23, 24, + 26, 0, 27, 5, 0, 0, 0, 0, 0, 0, 28, 29, // State 3 - 0, 0, 8, 0, 0, 0, 0, 0, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 33, 34, 0, 0, // State 4 - 21, 22, 2, 0, 0, 0, 0, 23, 24, + 26, 0, 27, 5, 0, 7, 8, 9, 0, 0, 28, 29, // State 5 - 0, 0, 0, -9, 0, 0, 0, 0, 24, + 26, 0, 27, 5, 35, 0, 0, 0, 0, 0, 28, 29, // State 6 - 21, 22, 2, 0, 0, 0, 0, 23, 24, + 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 29, // State 7 - 0, 0, 0, 0, 0, 0, 0, 0, 24, + 26, 0, 27, 5, 0, 0, 0, 0, 0, 0, 28, 29, // State 8 - 21, 22, 2, 0, 0, 0, 0, 23, 24, + 0, 0, 0, 0, -16, 0, 0, 0, 0, 0, 0, 29, // State 9 - 0, 0, 0, -10, 0, 0, 0, 0, 24, + 26, 0, 27, 5, 0, 0, 0, 0, 0, 0, 28, 29, // State 10 - 0, 0, 0, -9, 0, 0, 0, 0, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, // State 11 - 21, 22, 2, 0, 0, 0, 0, 23, 24, + 26, 0, 27, 5, 0, 0, 0, 0, 0, 0, 28, 29, // State 12 - 21, 22, 2, -11, 0, 0, 0, 23, 24, + 0, 0, 0, 0, -17, 0, 0, 0, 0, 0, 0, 29, // State 13 - 21, 22, 2, -12, 0, 0, 0, 23, 24, + 0, 0, 0, 0, -16, 0, 0, 0, 0, 0, 0, 29, // State 14 - 21, 22, 2, -11, 0, 0, 0, 23, 24, + 26, 0, 27, 5, 0, 0, 0, 0, 0, 0, 28, 29, // State 15 - -7, -7, -7, -7, 0, 0, 0, -7, -7, + 26, 0, 27, 5, -18, 0, 0, 0, 0, 0, 28, 29, // State 16 - -23, -23, -23, -23, 0, 0, 0, -23, -23, + 26, 0, 27, 5, -19, 0, 0, 0, 0, 0, 28, 29, // State 17 - -6, -6, -6, -6, 0, 0, 0, -6, -6, + 26, 0, 27, 5, -18, 0, 0, 0, 0, 0, 28, 29, // State 18 - -5, -5, -5, -5, 0, 0, 0, -5, -5, + -14, 0, -14, -14, -14, 0, 0, 0, 0, 0, -14, -14, // State 19 - 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 20 - -3, -3, -3, -3, 0, 0, 0, -3, -3, + -30, 0, -30, -30, -30, 0, 0, 0, 0, 0, -30, -30, // State 21 - -2, -2, -2, -2, 0, 0, 0, -2, -2, + -13, 0, -13, -13, -13, 0, 0, 0, 0, 0, -13, -13, // State 22 - -8, -8, -8, -8, 0, 0, 0, -8, -8, + -12, 0, -12, -12, -12, 0, 0, 0, 0, 0, -12, -12, // State 23 - -13, -13, -13, -13, 0, 0, 0, -13, -13, + -33, 0, -33, -33, -33, 0, 0, 0, 0, 0, -33, -33, // State 24 - -26, -26, -26, -26, 0, 0, 0, -26, -26, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 25 - -27, -27, -27, -27, 0, 0, 0, -27, -27, + -3, 0, -3, -3, -3, 0, 0, 0, 0, 0, -3, -3, // State 26 - -18, -18, -18, -18, 0, 0, 0, -18, -18, + -2, 0, -2, -2, -2, 0, 0, 0, 0, 0, -2, -2, // State 27 - 0, 0, 0, 13, 0, 0, 0, 0, 0, + -15, 0, -15, -15, -15, 0, 0, 0, 0, 0, -15, -15, // State 28 - 0, 0, 0, -16, 0, 0, 0, 0, -16, + -20, 0, -20, -20, -20, 0, 0, 0, 0, 0, -20, -20, // State 29 - 0, 0, 0, 34, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 30 - 0, 0, 0, -1, 0, 0, 0, 0, 0, + -34, 0, -34, -34, -34, 0, 0, 0, 0, 0, -34, -34, // State 31 - 0, 0, 0, -4, 0, 0, 0, 0, 0, + -7, 0, -7, -7, 0, 0, 0, 0, 0, 0, -7, -7, // State 32 - 0, 0, 0, -17, 0, 0, 0, 0, -17, + -11, 0, -11, -11, 0, 0, 0, 0, 0, 0, -11, -11, // State 33 - -19, -19, -19, -19, 0, 0, 0, -19, -19, + -10, 0, -10, -10, 0, 0, 0, 0, 0, 0, -10, -10, // State 34 - 0, 0, 0, 15, 0, 0, 0, 0, 0, + -25, 0, -25, -25, -25, 0, 0, 0, 0, 0, -25, -25, // State 35 - 0, 0, 0, 38, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, // State 36 - 0, 0, 0, 39, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -23, 0, 0, 0, 0, 0, 0, -23, // State 37 - -21, -21, -21, -21, 0, 0, 0, -21, -21, + 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, // State 38 - -22, -22, -22, -22, 0, 0, 0, -22, -22, + 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, // State 39 - 0, 0, 0, 41, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 0, 0, // State 40 - -20, -20, -20, -20, 0, 0, 0, -20, -20, + 0, 0, 0, 0, -24, 0, 0, 0, 0, 0, 0, -24, + // State 41 + -26, 0, -26, -26, -26, 0, 0, 0, 0, 0, -26, -26, + // State 42 + 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, + // State 43 + 0, 0, 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, + // State 44 + 0, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, + // State 45 + -28, 0, -28, -28, -28, 0, 0, 0, 0, 0, -28, -28, + // State 46 + -29, 0, -29, -29, -29, 0, 0, 0, 0, 0, -29, -29, + // State 47 + 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, + // State 48 + -27, 0, -27, -27, -27, 0, 0, 0, 0, 0, -27, -27, ]; fn __action(state: i8, integer: usize) -> i8 { - __ACTION[(state as usize) * 9 + integer] + __ACTION[(state as usize) * 12 + integer] } const __EOF_ACTION: &[i8] = &[ // State 0 @@ -130,7 +148,7 @@ mod __parse__Tree { // State 1 0, // State 2 - 0, + -35, // State 3 0, // State 4 @@ -156,93 +174,116 @@ mod __parse__Tree { // State 14 0, // State 15 - -7, + 0, // State 16 - -23, + 0, // State 17 - -6, + 0, // State 18 - -5, + -14, // State 19 - -29, + -36, // State 20 - -3, + -30, // State 21 - -2, - // State 22 - -8, - // State 23 -13, + // State 22 + -12, + // State 23 + -33, // State 24 - 0, + -6, // State 25 - 0, + -3, // State 26 - -18, + -2, // State 27 - 0, + -15, // State 28 - 0, + -20, // State 29 - 0, + -5, // State 30 - 0, + -34, // State 31 0, // State 32 0, // State 33 - -19, - // State 34 0, + // State 34 + -25, // State 35 0, // State 36 0, // State 37 - -21, + 0, // State 38 - -22, + 0, // State 39 0, // State 40 - -20, + 0, + // State 41 + -26, + // State 42 + 0, + // State 43 + 0, + // State 44 + 0, + // State 45 + -28, + // State 46 + -29, + // State 47 + 0, + // State 48 + -27, ]; fn __goto(state: i8, nt: usize) -> i8 { match nt { - 0 => 29, - 1 => 15, - 2 => 30, - 3 => 16, - 4 => 17, - 5 => match state { - 10 => 34, - _ => 27, + 0 => 37, + 1 => 18, + 2 => 38, + 3 => 19, + 4 => 1, + 6 => 31, + 7 => 20, + 8 => 21, + 9 => match state { + 13 => 42, + _ => 35, }, - 6 => match state { - 14 => 39, - _ => 36, - }, - 7 => match state { - 3 => 6, - 7 => 10, - 5 | 10 => 28, - 9 => 32, - _ => 18, - }, - 9 => 9, 10 => match state { - 4 => 8, - 8 => 11, - 0 => 19, - 2 | 13 => 25, - 6 => 31, - 11 => 35, - _ => 24, + 17 => 47, + _ => 44, }, - 12 => match state { - 1 => 2, - _ => 13, + 11 => match state { + 6 => 9, + 10 => 13, + 8 | 13 => 36, + 12 => 40, + _ => 22, + }, + 13 => 12, + 14 => match state { + 7 => 11, + 11 => 14, + 2 | 5 | 16 => 30, + 9 => 39, + 14 => 43, + _ => 23, + }, + 16 => match state { + 0..=1 => 2, + 4 => 5, + _ => 16, + }, + 17 => match state { + 1 => 29, + _ => 24, }, _ => 0, } @@ -250,12 +291,15 @@ mod __parse__Tree { fn __expected_tokens(__state: i8) -> alloc::vec::Vec { const __TERMINAL: &[&str] = &[ r###""#f""###, + r###""#lang""###, r###""#t""###, r###""(""###, r###"")""###, r###""define""###, r###""if""###, r###""lambda (""###, + r###""r7rs""###, + r###""scheme""###, r###"r#"[0-9]+(\\.[0-9]+)?"#"###, r###"r#"[A-Za-z!$%&*+\\-./:<=>?@^_~][A-Za-z!$%&*+\\-./:<=>?@^_~0-9]*"#"###, ]; @@ -282,7 +326,7 @@ mod __parse__Tree { type Token = Token<'input>; type TokenIndex = usize; type Symbol = __Symbol<'input>; - type Success = Tree; + type Success = alloc::vec::Vec; type StateIndex = i8; type Action = i8; type ReduceIndex = i8; @@ -310,7 +354,7 @@ mod __parse__Tree { #[inline] fn error_action(&self, state: i8) -> i8 { - __action(state, 9 - 1) + __action(state, 12 - 1) } #[inline] @@ -381,8 +425,11 @@ mod __parse__Tree { Token(6, _) if true => Some(4), Token(7, _) if true => Some(5), Token(8, _) if true => Some(6), - Token(0, _) if true => Some(7), - Token(1, _) if true => Some(8), + Token(9, _) if true => Some(7), + Token(10, _) if true => Some(8), + Token(11, _) if true => Some(9), + Token(0, _) if true => Some(10), + Token(1, _) if true => Some(11), _ => None, } } @@ -396,8 +443,1410 @@ mod __parse__Tree { ) -> __Symbol<'input> { match __token_index { - 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 => match __token { - Token(2, __tok0) | Token(3, __tok0) | Token(4, __tok0) | Token(5, __tok0) | Token(6, __tok0) | Token(7, __tok0) | Token(8, __tok0) | Token(0, __tok0) | Token(1, __tok0) if true => __Symbol::Variant0(__tok0), + 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 => match __token { + Token(2, __tok0) | Token(3, __tok0) | Token(4, __tok0) | Token(5, __tok0) | Token(6, __tok0) | Token(7, __tok0) | Token(8, __tok0) | Token(9, __tok0) | Token(10, __tok0) | Token(11, __tok0) | Token(0, __tok0) | Token(1, __tok0) if true => __Symbol::Variant0(__tok0), + _ => unreachable!(), + }, + _ => unreachable!(), + } + } + pub(crate) struct FileParser { + builder: __lalrpop_util::lexer::MatcherBuilder, + _priv: (), + } + + impl FileParser { + pub(crate) fn new() -> FileParser { + let __builder = super::__intern_token::new_builder(); + FileParser { + builder: __builder, + _priv: (), + } + } + + #[allow(dead_code)] + pub(crate) fn parse< + 'input, + 's, + >( + &self, + input: &'input str, + ) -> Result, __lalrpop_util::ParseError, &'static str>> + { + let mut __tokens = self.builder.matcher(input); + __state_machine::Parser::drive( + __StateMachine { + input, + __phantom: core::marker::PhantomData::<(&(), &())>, + }, + __tokens, + ) + } + } + pub(crate) fn __reduce< + 'input, + 's, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut alloc::vec::Vec, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> Option,__lalrpop_util::ParseError, &'static str>>> + { + let (__pop_states, __nonterminal) = match __action { + 0 => { + __reduce0(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 1 => { + __reduce1(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 2 => { + __reduce2(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 3 => { + __reduce3(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 4 => { + __reduce4(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 5 => { + __reduce5(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 6 => { + __reduce6(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 7 => { + __reduce7(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 8 => { + __reduce8(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 9 => { + __reduce9(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 10 => { + __reduce10(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 11 => { + __reduce11(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 12 => { + __reduce12(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 13 => { + __reduce13(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 14 => { + __reduce14(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 15 => { + __reduce15(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 16 => { + __reduce16(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 17 => { + __reduce17(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 18 => { + __reduce18(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 19 => { + __reduce19(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 20 => { + __reduce20(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 21 => { + __reduce21(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 22 => { + __reduce22(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 23 => { + __reduce23(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 24 => { + __reduce24(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 25 => { + __reduce25(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 26 => { + __reduce26(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 27 => { + __reduce27(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 28 => { + __reduce28(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 29 => { + __reduce29(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 30 => { + __reduce30(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 31 => { + __reduce31(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 32 => { + __reduce32(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 33 => { + __reduce33(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 34 => { + __reduce34(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 35 => { + // __File = File => ActionFn(0); + let __sym0 = __pop_Variant3(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action0::<>(input, __sym0); + return Some(Ok(__nt)); + } + 36 => { + __reduce36(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + _ => panic!("invalid action code {}", __action) + }; + let __states_len = __states.len(); + __states.truncate(__states_len - __pop_states); + let __state = *__states.last().unwrap(); + let __next_state = __goto(__state, __nonterminal); + __states.push(__next_state); + None + } + #[inline(never)] + fn __symbol_type_mismatch() -> ! { + panic!("symbol type mismatch") + } + fn __pop_Variant4< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, (), usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant4(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant1< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, Box, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant1(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant6< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, Literal, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant6(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant8< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, Rc<[String]>, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant8(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant9< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, Rc<[Tree]>, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant9(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant10< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, String, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant10(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant12< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, Tree, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant12(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant11< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, alloc::vec::Vec, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant11(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant3< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, alloc::vec::Vec, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant3(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant2< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, bool, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant2(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant5< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, core::option::Option<()>, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant5(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant7< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, f64, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant7(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant0< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, &'input str, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant0(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + pub(crate) fn __reduce0< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // BTree = Box => ActionFn(10); + let __sym0 = __pop_Variant1(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action10::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant1(__nt), __end)); + (1, 0) + } + pub(crate) fn __reduce1< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Bool = "#t" => ActionFn(16); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action16::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant2(__nt), __end)); + (1, 1) + } + pub(crate) fn __reduce2< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Bool = "#f" => ActionFn(17); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action17::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant2(__nt), __end)); + (1, 1) + } + pub(crate) fn __reduce3< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Box = Tree => ActionFn(21); + let __sym0 = __pop_Variant12(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action21::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant1(__nt), __end)); + (1, 2) + } + pub(crate) fn __reduce4< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // File = Lang, Trees => ActionFn(34); + assert!(__symbols.len() >= 2); + let __sym1 = __pop_Variant3(__symbols); + let __sym0 = __pop_Variant4(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym1.2.clone(); + let __nt = super::__action34::<>(input, __sym0, __sym1); + __symbols.push((__start, __Symbol::Variant3(__nt), __end)); + (2, 3) + } + pub(crate) fn __reduce5< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // File = Trees => ActionFn(35); + let __sym0 = __pop_Variant3(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action35::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant3(__nt), __end)); + (1, 3) + } + pub(crate) fn __reduce6< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Lang = "#lang", LangName => ActionFn(18); + assert!(__symbols.len() >= 2); + let __sym1 = __pop_Variant0(__symbols); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym1.2.clone(); + let __nt = super::__action18::<>(input, __sym0, __sym1); + __symbols.push((__start, __Symbol::Variant4(__nt), __end)); + (2, 4) + } + pub(crate) fn __reduce7< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Lang? = Lang => ActionFn(26); + let __sym0 = __pop_Variant4(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action26::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant5(__nt), __end)); + (1, 5) + } + pub(crate) fn __reduce8< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Lang? = => ActionFn(27); + let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); + let __end = __start.clone(); + let __nt = super::__action27::<>(input, &__start, &__end); + __symbols.push((__start, __Symbol::Variant5(__nt), __end)); + (0, 5) + } + pub(crate) fn __reduce9< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // LangName = "scheme" => ActionFn(19); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action19::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant0(__nt), __end)); + (1, 6) + } + pub(crate) fn __reduce10< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // LangName = "r7rs" => ActionFn(20); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action20::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant0(__nt), __end)); + (1, 6) + } + pub(crate) fn __reduce11< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Literal = Sym => ActionFn(11); + let __sym0 = __pop_Variant10(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action11::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant6(__nt), __end)); + (1, 7) + } + pub(crate) fn __reduce12< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Literal = Num => ActionFn(12); + let __sym0 = __pop_Variant7(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action12::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant6(__nt), __end)); + (1, 7) + } + pub(crate) fn __reduce13< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Literal = Bool => ActionFn(13); + let __sym0 = __pop_Variant2(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action13::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant6(__nt), __end)); + (1, 7) + } + pub(crate) fn __reduce14< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Num = r#"[0-9]+(\\.[0-9]+)?"# => ActionFn(15); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action15::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant7(__nt), __end)); + (1, 8) + } + pub(crate) fn __reduce15< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // RcSlice = => ActionFn(36); + let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); + let __end = __start.clone(); + let __nt = super::__action36::<>(input, &__start, &__end); + __symbols.push((__start, __Symbol::Variant8(__nt), __end)); + (0, 9) + } + pub(crate) fn __reduce16< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // RcSlice = Sym+ => ActionFn(37); + let __sym0 = __pop_Variant11(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action37::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant8(__nt), __end)); + (1, 9) + } + pub(crate) fn __reduce17< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // RcSlice = => ActionFn(38); + let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); + let __end = __start.clone(); + let __nt = super::__action38::<>(input, &__start, &__end); + __symbols.push((__start, __Symbol::Variant9(__nt), __end)); + (0, 10) + } + pub(crate) fn __reduce18< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // RcSlice = Tree+ => ActionFn(39); + let __sym0 = __pop_Variant3(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action39::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant9(__nt), __end)); + (1, 10) + } + pub(crate) fn __reduce19< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Sym = r#"[A-Za-z!$%&*+\\-./:<=>?@^_~][A-Za-z!$%&*+\\-./:<=>?@^_~0-9]*"# => ActionFn(14); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action14::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant10(__nt), __end)); + (1, 11) + } + pub(crate) fn __reduce20< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Sym* = => ActionFn(28); + let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); + let __end = __start.clone(); + let __nt = super::__action28::<>(input, &__start, &__end); + __symbols.push((__start, __Symbol::Variant11(__nt), __end)); + (0, 12) + } + pub(crate) fn __reduce21< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Sym* = Sym+ => ActionFn(29); + let __sym0 = __pop_Variant11(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action29::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant11(__nt), __end)); + (1, 12) + } + pub(crate) fn __reduce22< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Sym+ = Sym => ActionFn(32); + let __sym0 = __pop_Variant10(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action32::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant11(__nt), __end)); + (1, 13) + } + pub(crate) fn __reduce23< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Sym+ = Sym+, Sym => ActionFn(33); + assert!(__symbols.len() >= 2); + let __sym1 = __pop_Variant10(__symbols); + let __sym0 = __pop_Variant11(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym1.2.clone(); + let __nt = super::__action33::<>(input, __sym0, __sym1); + __symbols.push((__start, __Symbol::Variant11(__nt), __end)); + (2, 13) + } + pub(crate) fn __reduce24< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Tree = "(", Tree+, ")" => ActionFn(4); + assert!(__symbols.len() >= 3); + let __sym2 = __pop_Variant0(__symbols); + let __sym1 = __pop_Variant3(__symbols); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym2.2.clone(); + let __nt = super::__action4::<>(input, __sym0, __sym1, __sym2); + __symbols.push((__start, __Symbol::Variant12(__nt), __end)); + (3, 14) + } + pub(crate) fn __reduce25< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Tree = "(", "define", Sym, BTree, ")" => ActionFn(5); + assert!(__symbols.len() >= 5); + let __sym4 = __pop_Variant0(__symbols); + let __sym3 = __pop_Variant1(__symbols); + let __sym2 = __pop_Variant10(__symbols); + let __sym1 = __pop_Variant0(__symbols); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym4.2.clone(); + let __nt = super::__action5::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4); + __symbols.push((__start, __Symbol::Variant12(__nt), __end)); + (5, 14) + } + pub(crate) fn __reduce26< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Tree = "(", "define", "(", Sym, RcSlice, ")", RcSlice, ")" => ActionFn(6); + assert!(__symbols.len() >= 8); + let __sym7 = __pop_Variant0(__symbols); + let __sym6 = __pop_Variant9(__symbols); + let __sym5 = __pop_Variant0(__symbols); + let __sym4 = __pop_Variant8(__symbols); + let __sym3 = __pop_Variant10(__symbols); + let __sym2 = __pop_Variant0(__symbols); + let __sym1 = __pop_Variant0(__symbols); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym7.2.clone(); + let __nt = super::__action6::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5, __sym6, __sym7); + __symbols.push((__start, __Symbol::Variant12(__nt), __end)); + (8, 14) + } + pub(crate) fn __reduce27< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Tree = "(", "if", Tree, Tree, Tree, ")" => ActionFn(7); + assert!(__symbols.len() >= 6); + let __sym5 = __pop_Variant0(__symbols); + let __sym4 = __pop_Variant12(__symbols); + let __sym3 = __pop_Variant12(__symbols); + let __sym2 = __pop_Variant12(__symbols); + let __sym1 = __pop_Variant0(__symbols); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym5.2.clone(); + let __nt = super::__action7::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + __symbols.push((__start, __Symbol::Variant12(__nt), __end)); + (6, 14) + } + pub(crate) fn __reduce28< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Tree = "(", "lambda (", RcSlice, ")", RcSlice, ")" => ActionFn(8); + assert!(__symbols.len() >= 6); + let __sym5 = __pop_Variant0(__symbols); + let __sym4 = __pop_Variant9(__symbols); + let __sym3 = __pop_Variant0(__symbols); + let __sym2 = __pop_Variant8(__symbols); + let __sym1 = __pop_Variant0(__symbols); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym5.2.clone(); + let __nt = super::__action8::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + __symbols.push((__start, __Symbol::Variant12(__nt), __end)); + (6, 14) + } + pub(crate) fn __reduce29< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Tree = Literal => ActionFn(9); + let __sym0 = __pop_Variant6(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action9::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant12(__nt), __end)); + (1, 14) + } + pub(crate) fn __reduce30< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Tree* = => ActionFn(30); + let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); + let __end = __start.clone(); + let __nt = super::__action30::<>(input, &__start, &__end); + __symbols.push((__start, __Symbol::Variant3(__nt), __end)); + (0, 15) + } + pub(crate) fn __reduce31< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Tree* = Tree+ => ActionFn(31); + let __sym0 = __pop_Variant3(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action31::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant3(__nt), __end)); + (1, 15) + } + pub(crate) fn __reduce32< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Tree+ = Tree => ActionFn(24); + let __sym0 = __pop_Variant12(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action24::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant3(__nt), __end)); + (1, 16) + } + pub(crate) fn __reduce33< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Tree+ = Tree+, Tree => ActionFn(25); + assert!(__symbols.len() >= 2); + let __sym1 = __pop_Variant12(__symbols); + let __sym0 = __pop_Variant3(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym1.2.clone(); + let __nt = super::__action25::<>(input, __sym0, __sym1); + __symbols.push((__start, __Symbol::Variant3(__nt), __end)); + (2, 16) + } + pub(crate) fn __reduce34< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Trees = Tree+ => ActionFn(3); + let __sym0 = __pop_Variant3(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action3::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant3(__nt), __end)); + (1, 17) + } + pub(crate) fn __reduce36< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // __Tree = Tree => ActionFn(1); + let __sym0 = __pop_Variant12(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action1::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant12(__nt), __end)); + (1, 19) + } +} +pub(crate) use self::__parse__File::FileParser; + +#[cfg_attr(rustfmt, rustfmt_skip)] +mod __parse__Tree { + #![allow(non_snake_case, non_camel_case_types, unused_mut, unused_variables, unused_imports, unused_parens)] + + use crate::{Tree, Literal, Lambda}; + use std::rc::Rc; + #[allow(unused_extern_crates)] + extern crate lalrpop_util as __lalrpop_util; + #[allow(unused_imports)] + use self::__lalrpop_util::state_machine as __state_machine; + extern crate core; + extern crate alloc; + use self::__lalrpop_util::lexer::Token; + #[allow(dead_code)] + pub(crate) enum __Symbol<'input> + { + Variant0(&'input str), + Variant1(Box), + Variant2(bool), + Variant3(alloc::vec::Vec), + Variant4(()), + Variant5(core::option::Option<()>), + Variant6(Literal), + Variant7(f64), + Variant8(Rc<[String]>), + Variant9(Rc<[Tree]>), + Variant10(String), + Variant11(alloc::vec::Vec), + Variant12(Tree), + } + const __ACTION: &[i8] = &[ + // State 0 + 21, 0, 22, 2, 0, 0, 0, 0, 0, 0, 23, 24, + // State 1 + 21, 0, 22, 2, 0, 4, 5, 6, 0, 0, 23, 24, + // State 2 + 21, 0, 22, 2, 27, 0, 0, 0, 0, 0, 23, 24, + // State 3 + 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 24, + // State 4 + 21, 0, 22, 2, 0, 0, 0, 0, 0, 0, 23, 24, + // State 5 + 0, 0, 0, 0, -16, 0, 0, 0, 0, 0, 0, 24, + // State 6 + 21, 0, 22, 2, 0, 0, 0, 0, 0, 0, 23, 24, + // State 7 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, + // State 8 + 21, 0, 22, 2, 0, 0, 0, 0, 0, 0, 23, 24, + // State 9 + 0, 0, 0, 0, -17, 0, 0, 0, 0, 0, 0, 24, + // State 10 + 0, 0, 0, 0, -16, 0, 0, 0, 0, 0, 0, 24, + // State 11 + 21, 0, 22, 2, 0, 0, 0, 0, 0, 0, 23, 24, + // State 12 + 21, 0, 22, 2, -18, 0, 0, 0, 0, 0, 23, 24, + // State 13 + 21, 0, 22, 2, -19, 0, 0, 0, 0, 0, 23, 24, + // State 14 + 21, 0, 22, 2, -18, 0, 0, 0, 0, 0, 23, 24, + // State 15 + -14, 0, -14, -14, -14, 0, 0, 0, 0, 0, -14, -14, + // State 16 + -30, 0, -30, -30, -30, 0, 0, 0, 0, 0, -30, -30, + // State 17 + -13, 0, -13, -13, -13, 0, 0, 0, 0, 0, -13, -13, + // State 18 + -12, 0, -12, -12, -12, 0, 0, 0, 0, 0, -12, -12, + // State 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 20 + -3, 0, -3, -3, -3, 0, 0, 0, 0, 0, -3, -3, + // State 21 + -2, 0, -2, -2, -2, 0, 0, 0, 0, 0, -2, -2, + // State 22 + -15, 0, -15, -15, -15, 0, 0, 0, 0, 0, -15, -15, + // State 23 + -20, 0, -20, -20, -20, 0, 0, 0, 0, 0, -20, -20, + // State 24 + -33, 0, -33, -33, -33, 0, 0, 0, 0, 0, -33, -33, + // State 25 + -34, 0, -34, -34, -34, 0, 0, 0, 0, 0, -34, -34, + // State 26 + -25, 0, -25, -25, -25, 0, 0, 0, 0, 0, -25, -25, + // State 27 + 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, + // State 28 + 0, 0, 0, 0, -23, 0, 0, 0, 0, 0, 0, -23, + // State 29 + 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, + // State 30 + 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, + // State 31 + 0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 0, 0, + // State 32 + 0, 0, 0, 0, -24, 0, 0, 0, 0, 0, 0, -24, + // State 33 + -26, 0, -26, -26, -26, 0, 0, 0, 0, 0, -26, -26, + // State 34 + 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, + // State 35 + 0, 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, + // State 36 + 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, + // State 37 + -28, 0, -28, -28, -28, 0, 0, 0, 0, 0, -28, -28, + // State 38 + -29, 0, -29, -29, -29, 0, 0, 0, 0, 0, -29, -29, + // State 39 + 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, + // State 40 + -27, 0, -27, -27, -27, 0, 0, 0, 0, 0, -27, -27, + ]; + fn __action(state: i8, integer: usize) -> i8 { + __ACTION[(state as usize) * 12 + integer] + } + const __EOF_ACTION: &[i8] = &[ + // State 0 + 0, + // State 1 + 0, + // State 2 + 0, + // State 3 + 0, + // State 4 + 0, + // State 5 + 0, + // State 6 + 0, + // State 7 + 0, + // State 8 + 0, + // State 9 + 0, + // State 10 + 0, + // State 11 + 0, + // State 12 + 0, + // State 13 + 0, + // State 14 + 0, + // State 15 + -14, + // State 16 + -30, + // State 17 + -13, + // State 18 + -12, + // State 19 + -37, + // State 20 + -3, + // State 21 + -2, + // State 22 + -15, + // State 23 + -20, + // State 24 + 0, + // State 25 + 0, + // State 26 + -25, + // State 27 + 0, + // State 28 + 0, + // State 29 + 0, + // State 30 + 0, + // State 31 + 0, + // State 32 + 0, + // State 33 + -26, + // State 34 + 0, + // State 35 + 0, + // State 36 + 0, + // State 37 + -28, + // State 38 + -29, + // State 39 + 0, + // State 40 + -27, + ]; + fn __goto(state: i8, nt: usize) -> i8 { + match nt { + 0 => 29, + 1 => 15, + 2 => 30, + 7 => 16, + 8 => 17, + 9 => match state { + 10 => 34, + _ => 27, + }, + 10 => match state { + 14 => 39, + _ => 36, + }, + 11 => match state { + 3 => 6, + 7 => 10, + 5 | 10 => 28, + 9 => 32, + _ => 18, + }, + 13 => 9, + 14 => match state { + 4 => 8, + 8 => 11, + 0 => 19, + 2 | 13 => 25, + 6 => 31, + 11 => 35, + _ => 24, + }, + 16 => match state { + 1 => 2, + _ => 13, + }, + _ => 0, + } + } + fn __expected_tokens(__state: i8) -> alloc::vec::Vec { + const __TERMINAL: &[&str] = &[ + r###""#f""###, + r###""#lang""###, + r###""#t""###, + r###""(""###, + r###"")""###, + r###""define""###, + r###""if""###, + r###""lambda (""###, + r###""r7rs""###, + r###""scheme""###, + r###"r#"[0-9]+(\\.[0-9]+)?"#"###, + r###"r#"[A-Za-z!$%&*+\\-./:<=>?@^_~][A-Za-z!$%&*+\\-./:<=>?@^_~0-9]*"#"###, + ]; + __TERMINAL.iter().enumerate().filter_map(|(index, terminal)| { + let next_state = __action(__state, index); + if next_state == 0 { + None + } else { + Some(alloc::string::ToString::to_string(terminal)) + } + }).collect() + } + pub(crate) struct __StateMachine<'input, 's> + where + { + input: &'input str, + __phantom: core::marker::PhantomData<(&'input (), &'s ())>, + } + impl<'input, 's> __state_machine::ParserDefinition for __StateMachine<'input, 's> + where + { + type Location = usize; + type Error = &'static str; + type Token = Token<'input>; + type TokenIndex = usize; + type Symbol = __Symbol<'input>; + type Success = Tree; + type StateIndex = i8; + type Action = i8; + type ReduceIndex = i8; + type NonterminalIndex = usize; + + #[inline] + fn start_location(&self) -> Self::Location { + Default::default() + } + + #[inline] + fn start_state(&self) -> Self::StateIndex { + 0 + } + + #[inline] + fn token_to_index(&self, token: &Self::Token) -> Option { + __token_to_integer(token, core::marker::PhantomData::<(&(), &())>) + } + + #[inline] + fn action(&self, state: i8, integer: usize) -> i8 { + __action(state, integer) + } + + #[inline] + fn error_action(&self, state: i8) -> i8 { + __action(state, 12 - 1) + } + + #[inline] + fn eof_action(&self, state: i8) -> i8 { + __EOF_ACTION[state as usize] + } + + #[inline] + fn goto(&self, state: i8, nt: usize) -> i8 { + __goto(state, nt) + } + + fn token_to_symbol(&self, token_index: usize, token: Self::Token) -> Self::Symbol { + __token_to_symbol(token_index, token, core::marker::PhantomData::<(&(), &())>) + } + + fn expected_tokens(&self, state: i8) -> alloc::vec::Vec { + __expected_tokens(state) + } + + #[inline] + fn uses_error_recovery(&self) -> bool { + false + } + + #[inline] + fn error_recovery_symbol( + &self, + recovery: __state_machine::ErrorRecovery, + ) -> Self::Symbol { + panic!("error recovery not enabled for this grammar") + } + + fn reduce( + &mut self, + action: i8, + start_location: Option<&Self::Location>, + states: &mut alloc::vec::Vec, + symbols: &mut alloc::vec::Vec<__state_machine::SymbolTriple>, + ) -> Option<__state_machine::ParseResult> { + __reduce( + self.input, + action, + start_location, + states, + symbols, + core::marker::PhantomData::<(&(), &())>, + ) + } + + fn simulate_reduce(&self, action: i8) -> __state_machine::SimulatedReduce { + panic!("error recovery not enabled for this grammar") + } + } + fn __token_to_integer< + 'input, + 's, + >( + __token: &Token<'input>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> Option + { + match *__token { + Token(2, _) if true => Some(0), + Token(3, _) if true => Some(1), + Token(4, _) if true => Some(2), + Token(5, _) if true => Some(3), + Token(6, _) if true => Some(4), + Token(7, _) if true => Some(5), + Token(8, _) if true => Some(6), + Token(9, _) if true => Some(7), + Token(10, _) if true => Some(8), + Token(11, _) if true => Some(9), + Token(0, _) if true => Some(10), + Token(1, _) if true => Some(11), + _ => None, + } + } + fn __token_to_symbol< + 'input, + 's, + >( + __token_index: usize, + __token: Token<'input>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> __Symbol<'input> + { + match __token_index { + 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 => match __token { + Token(2, __tok0) | Token(3, __tok0) | Token(4, __tok0) | Token(5, __tok0) | Token(6, __tok0) | Token(7, __tok0) | Token(8, __tok0) | Token(9, __tok0) | Token(10, __tok0) | Token(11, __tok0) | Token(0, __tok0) | Token(1, __tok0) if true => __Symbol::Variant0(__tok0), _ => unreachable!(), }, _ => unreachable!(), @@ -534,16 +1983,37 @@ mod __parse__Tree { __reduce27(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) } 28 => { + __reduce28(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 29 => { + __reduce29(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 30 => { + __reduce30(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 31 => { + __reduce31(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 32 => { + __reduce32(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 33 => { + __reduce33(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 34 => { + __reduce34(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 35 => { + __reduce35(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) + } + 36 => { // __Tree = Tree => ActionFn(1); - let __sym0 = __pop_Variant9(__symbols); + let __sym0 = __pop_Variant12(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); let __nt = super::__action1::<>(input, __sym0); return Some(Ok(__nt)); } - 29 => { - __reduce29(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } _ => panic!("invalid action code {}", __action) }; let __states_len = __states.len(); @@ -557,6 +2027,17 @@ mod __parse__Tree { fn __symbol_type_mismatch() -> ! { panic!("symbol type mismatch") } + fn __pop_Variant4< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, (), usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant4(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } fn __pop_Variant1< 'input, >( @@ -568,83 +2049,83 @@ mod __parse__Tree { _ => __symbol_type_mismatch() } } - fn __pop_Variant3< + fn __pop_Variant6< 'input, >( __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> ) -> (usize, Literal, usize) - { - match __symbols.pop() { - Some((__l, __Symbol::Variant3(__v), __r)) => (__l, __v, __r), - _ => __symbol_type_mismatch() - } - } - fn __pop_Variant5< - 'input, - >( - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, Rc<[String]>, usize) - { - match __symbols.pop() { - Some((__l, __Symbol::Variant5(__v), __r)) => (__l, __v, __r), - _ => __symbol_type_mismatch() - } - } - fn __pop_Variant6< - 'input, - >( - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, Rc<[Tree]>, usize) { match __symbols.pop() { Some((__l, __Symbol::Variant6(__v), __r)) => (__l, __v, __r), _ => __symbol_type_mismatch() } } - fn __pop_Variant7< - 'input, - >( - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, String, usize) - { - match __symbols.pop() { - Some((__l, __Symbol::Variant7(__v), __r)) => (__l, __v, __r), - _ => __symbol_type_mismatch() - } - } - fn __pop_Variant9< - 'input, - >( - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, Tree, usize) - { - match __symbols.pop() { - Some((__l, __Symbol::Variant9(__v), __r)) => (__l, __v, __r), - _ => __symbol_type_mismatch() - } - } fn __pop_Variant8< 'input, >( __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, alloc::vec::Vec, usize) + ) -> (usize, Rc<[String]>, usize) { match __symbols.pop() { Some((__l, __Symbol::Variant8(__v), __r)) => (__l, __v, __r), _ => __symbol_type_mismatch() } } + fn __pop_Variant9< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, Rc<[Tree]>, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant9(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } fn __pop_Variant10< 'input, >( __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, alloc::vec::Vec, usize) + ) -> (usize, String, usize) { match __symbols.pop() { Some((__l, __Symbol::Variant10(__v), __r)) => (__l, __v, __r), _ => __symbol_type_mismatch() } } + fn __pop_Variant12< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, Tree, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant12(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant11< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, alloc::vec::Vec, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant11(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant3< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, alloc::vec::Vec, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant3(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } fn __pop_Variant2< 'input, >( @@ -656,14 +2137,25 @@ mod __parse__Tree { _ => __symbol_type_mismatch() } } - fn __pop_Variant4< + fn __pop_Variant5< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, core::option::Option<()>, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant5(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant7< 'input, >( __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> ) -> (usize, f64, usize) { match __symbols.pop() { - Some((__l, __Symbol::Variant4(__v), __r)) => (__l, __v, __r), + Some((__l, __Symbol::Variant7(__v), __r)) => (__l, __v, __r), _ => __symbol_type_mismatch() } } @@ -688,11 +2180,11 @@ mod __parse__Tree { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // BTree = Box => ActionFn(9); + // BTree = Box => ActionFn(10); let __sym0 = __pop_Variant1(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action9::<>(input, __sym0); + let __nt = super::__action10::<>(input, __sym0); __symbols.push((__start, __Symbol::Variant1(__nt), __end)); (1, 0) } @@ -706,11 +2198,11 @@ mod __parse__Tree { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Bool = "#t" => ActionFn(15); + // Bool = "#t" => ActionFn(16); let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action15::<>(input, __sym0); + let __nt = super::__action16::<>(input, __sym0); __symbols.push((__start, __Symbol::Variant2(__nt), __end)); (1, 1) } @@ -724,11 +2216,11 @@ mod __parse__Tree { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Bool = "#f" => ActionFn(16); + // Bool = "#f" => ActionFn(17); let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action16::<>(input, __sym0); + let __nt = super::__action17::<>(input, __sym0); __symbols.push((__start, __Symbol::Variant2(__nt), __end)); (1, 1) } @@ -742,11 +2234,11 @@ mod __parse__Tree { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Box = Tree => ActionFn(17); - let __sym0 = __pop_Variant9(__symbols); + // Box = Tree => ActionFn(21); + let __sym0 = __pop_Variant12(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action17::<>(input, __sym0); + let __nt = super::__action21::<>(input, __sym0); __symbols.push((__start, __Symbol::Variant1(__nt), __end)); (1, 2) } @@ -760,13 +2252,15 @@ mod __parse__Tree { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Literal = Sym => ActionFn(10); - let __sym0 = __pop_Variant7(__symbols); + // File = Lang, Trees => ActionFn(34); + assert!(__symbols.len() >= 2); + let __sym1 = __pop_Variant3(__symbols); + let __sym0 = __pop_Variant4(__symbols); let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action10::<>(input, __sym0); + let __end = __sym1.2.clone(); + let __nt = super::__action34::<>(input, __sym0, __sym1); __symbols.push((__start, __Symbol::Variant3(__nt), __end)); - (1, 3) + (2, 3) } pub(crate) fn __reduce5< 'input, @@ -778,11 +2272,11 @@ mod __parse__Tree { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Literal = Num => ActionFn(11); - let __sym0 = __pop_Variant4(__symbols); + // File = Trees => ActionFn(35); + let __sym0 = __pop_Variant3(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action11::<>(input, __sym0); + let __nt = super::__action35::<>(input, __sym0); __symbols.push((__start, __Symbol::Variant3(__nt), __end)); (1, 3) } @@ -796,13 +2290,15 @@ mod __parse__Tree { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Literal = Bool => ActionFn(12); - let __sym0 = __pop_Variant2(__symbols); + // Lang = "#lang", LangName => ActionFn(18); + assert!(__symbols.len() >= 2); + let __sym1 = __pop_Variant0(__symbols); + let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action12::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant3(__nt), __end)); - (1, 3) + let __end = __sym1.2.clone(); + let __nt = super::__action18::<>(input, __sym0, __sym1); + __symbols.push((__start, __Symbol::Variant4(__nt), __end)); + (2, 4) } pub(crate) fn __reduce7< 'input, @@ -814,13 +2310,13 @@ mod __parse__Tree { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Num = r#"[0-9]+(\\.[0-9]+)?"# => ActionFn(14); - let __sym0 = __pop_Variant0(__symbols); + // Lang? = Lang => ActionFn(26); + let __sym0 = __pop_Variant4(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action14::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant4(__nt), __end)); - (1, 4) + let __nt = super::__action26::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant5(__nt), __end)); + (1, 5) } pub(crate) fn __reduce8< 'input, @@ -832,10 +2328,10 @@ mod __parse__Tree { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // RcSlice = => ActionFn(28); + // Lang? = => ActionFn(27); let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); let __end = __start.clone(); - let __nt = super::__action28::<>(input, &__start, &__end); + let __nt = super::__action27::<>(input, &__start, &__end); __symbols.push((__start, __Symbol::Variant5(__nt), __end)); (0, 5) } @@ -849,13 +2345,13 @@ mod __parse__Tree { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // RcSlice = Sym+ => ActionFn(29); - let __sym0 = __pop_Variant8(__symbols); + // LangName = "scheme" => ActionFn(19); + let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action29::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant5(__nt), __end)); - (1, 5) + let __nt = super::__action19::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant0(__nt), __end)); + (1, 6) } pub(crate) fn __reduce10< 'input, @@ -867,12 +2363,13 @@ mod __parse__Tree { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // RcSlice = => ActionFn(30); - let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); - let __end = __start.clone(); - let __nt = super::__action30::<>(input, &__start, &__end); - __symbols.push((__start, __Symbol::Variant6(__nt), __end)); - (0, 6) + // LangName = "r7rs" => ActionFn(20); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action20::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant0(__nt), __end)); + (1, 6) } pub(crate) fn __reduce11< 'input, @@ -884,13 +2381,13 @@ mod __parse__Tree { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // RcSlice = Tree+ => ActionFn(31); + // Literal = Sym => ActionFn(11); let __sym0 = __pop_Variant10(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action31::<>(input, __sym0); + let __nt = super::__action11::<>(input, __sym0); __symbols.push((__start, __Symbol::Variant6(__nt), __end)); - (1, 6) + (1, 7) } pub(crate) fn __reduce12< 'input, @@ -902,12 +2399,12 @@ mod __parse__Tree { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Sym = r#"[A-Za-z!$%&*+\\-./:<=>?@^_~][A-Za-z!$%&*+\\-./:<=>?@^_~0-9]*"# => ActionFn(13); - let __sym0 = __pop_Variant0(__symbols); + // Literal = Num => ActionFn(12); + let __sym0 = __pop_Variant7(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action13::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant7(__nt), __end)); + let __nt = super::__action12::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant6(__nt), __end)); (1, 7) } pub(crate) fn __reduce13< @@ -920,12 +2417,13 @@ mod __parse__Tree { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Sym* = => ActionFn(22); - let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); - let __end = __start.clone(); - let __nt = super::__action22::<>(input, &__start, &__end); - __symbols.push((__start, __Symbol::Variant8(__nt), __end)); - (0, 8) + // Literal = Bool => ActionFn(13); + let __sym0 = __pop_Variant2(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action13::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant6(__nt), __end)); + (1, 7) } pub(crate) fn __reduce14< 'input, @@ -937,1239 +2435,12 @@ mod __parse__Tree { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Sym* = Sym+ => ActionFn(23); - let __sym0 = __pop_Variant8(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action23::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant8(__nt), __end)); - (1, 8) - } - pub(crate) fn __reduce15< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Sym+ = Sym => ActionFn(26); - let __sym0 = __pop_Variant7(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action26::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant8(__nt), __end)); - (1, 9) - } - pub(crate) fn __reduce16< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Sym+ = Sym+, Sym => ActionFn(27); - assert!(__symbols.len() >= 2); - let __sym1 = __pop_Variant7(__symbols); - let __sym0 = __pop_Variant8(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym1.2.clone(); - let __nt = super::__action27::<>(input, __sym0, __sym1); - __symbols.push((__start, __Symbol::Variant8(__nt), __end)); - (2, 9) - } - pub(crate) fn __reduce17< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Tree = "(", Tree+, ")" => ActionFn(3); - assert!(__symbols.len() >= 3); - let __sym2 = __pop_Variant0(__symbols); - let __sym1 = __pop_Variant10(__symbols); - let __sym0 = __pop_Variant0(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym2.2.clone(); - let __nt = super::__action3::<>(input, __sym0, __sym1, __sym2); - __symbols.push((__start, __Symbol::Variant9(__nt), __end)); - (3, 10) - } - pub(crate) fn __reduce18< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Tree = "(", "define", Sym, BTree, ")" => ActionFn(4); - assert!(__symbols.len() >= 5); - let __sym4 = __pop_Variant0(__symbols); - let __sym3 = __pop_Variant1(__symbols); - let __sym2 = __pop_Variant7(__symbols); - let __sym1 = __pop_Variant0(__symbols); - let __sym0 = __pop_Variant0(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym4.2.clone(); - let __nt = super::__action4::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4); - __symbols.push((__start, __Symbol::Variant9(__nt), __end)); - (5, 10) - } - pub(crate) fn __reduce19< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Tree = "(", "define", "(", Sym, RcSlice, ")", RcSlice, ")" => ActionFn(5); - assert!(__symbols.len() >= 8); - let __sym7 = __pop_Variant0(__symbols); - let __sym6 = __pop_Variant6(__symbols); - let __sym5 = __pop_Variant0(__symbols); - let __sym4 = __pop_Variant5(__symbols); - let __sym3 = __pop_Variant7(__symbols); - let __sym2 = __pop_Variant0(__symbols); - let __sym1 = __pop_Variant0(__symbols); - let __sym0 = __pop_Variant0(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym7.2.clone(); - let __nt = super::__action5::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5, __sym6, __sym7); - __symbols.push((__start, __Symbol::Variant9(__nt), __end)); - (8, 10) - } - pub(crate) fn __reduce20< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Tree = "(", "if", Tree, Tree, Tree, ")" => ActionFn(6); - assert!(__symbols.len() >= 6); - let __sym5 = __pop_Variant0(__symbols); - let __sym4 = __pop_Variant9(__symbols); - let __sym3 = __pop_Variant9(__symbols); - let __sym2 = __pop_Variant9(__symbols); - let __sym1 = __pop_Variant0(__symbols); - let __sym0 = __pop_Variant0(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym5.2.clone(); - let __nt = super::__action6::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); - __symbols.push((__start, __Symbol::Variant9(__nt), __end)); - (6, 10) - } - pub(crate) fn __reduce21< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Tree = "(", "lambda (", RcSlice, ")", RcSlice, ")" => ActionFn(7); - assert!(__symbols.len() >= 6); - let __sym5 = __pop_Variant0(__symbols); - let __sym4 = __pop_Variant6(__symbols); - let __sym3 = __pop_Variant0(__symbols); - let __sym2 = __pop_Variant5(__symbols); - let __sym1 = __pop_Variant0(__symbols); - let __sym0 = __pop_Variant0(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym5.2.clone(); - let __nt = super::__action7::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); - __symbols.push((__start, __Symbol::Variant9(__nt), __end)); - (6, 10) - } - pub(crate) fn __reduce22< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Tree = Literal => ActionFn(8); - let __sym0 = __pop_Variant3(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action8::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant9(__nt), __end)); - (1, 10) - } - pub(crate) fn __reduce23< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Tree* = => ActionFn(24); - let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); - let __end = __start.clone(); - let __nt = super::__action24::<>(input, &__start, &__end); - __symbols.push((__start, __Symbol::Variant10(__nt), __end)); - (0, 11) - } - pub(crate) fn __reduce24< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Tree* = Tree+ => ActionFn(25); - let __sym0 = __pop_Variant10(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action25::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant10(__nt), __end)); - (1, 11) - } - pub(crate) fn __reduce25< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Tree+ = Tree => ActionFn(20); - let __sym0 = __pop_Variant9(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action20::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant10(__nt), __end)); - (1, 12) - } - pub(crate) fn __reduce26< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Tree+ = Tree+, Tree => ActionFn(21); - assert!(__symbols.len() >= 2); - let __sym1 = __pop_Variant9(__symbols); - let __sym0 = __pop_Variant10(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym1.2.clone(); - let __nt = super::__action21::<>(input, __sym0, __sym1); - __symbols.push((__start, __Symbol::Variant10(__nt), __end)); - (2, 12) - } - pub(crate) fn __reduce27< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Trees = Tree+ => ActionFn(2); - let __sym0 = __pop_Variant10(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action2::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant10(__nt), __end)); - (1, 13) - } - pub(crate) fn __reduce29< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // __Trees = Trees => ActionFn(0); - let __sym0 = __pop_Variant10(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action0::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant10(__nt), __end)); - (1, 15) - } -} -pub(crate) use self::__parse__Tree::TreeParser; - -#[cfg_attr(rustfmt, rustfmt_skip)] -mod __parse__Trees { - #![allow(non_snake_case, non_camel_case_types, unused_mut, unused_variables, unused_imports, unused_parens)] - - use crate::{Tree, Literal, Lambda}; - use std::rc::Rc; - #[allow(unused_extern_crates)] - extern crate lalrpop_util as __lalrpop_util; - #[allow(unused_imports)] - use self::__lalrpop_util::state_machine as __state_machine; - extern crate core; - extern crate alloc; - use self::__lalrpop_util::lexer::Token; - #[allow(dead_code)] - pub(crate) enum __Symbol<'input> - { - Variant0(&'input str), - Variant1(Box), - Variant2(bool), - Variant3(Literal), - Variant4(f64), - Variant5(Rc<[String]>), - Variant6(Rc<[Tree]>), - Variant7(String), - Variant8(alloc::vec::Vec), - Variant9(Tree), - Variant10(alloc::vec::Vec), - } - const __ACTION: &[i8] = &[ - // State 0 - 23, 24, 3, 0, 0, 0, 0, 25, 26, - // State 1 - 23, 24, 3, 0, 0, 0, 0, 25, 26, - // State 2 - 23, 24, 3, 0, 5, 6, 7, 25, 26, - // State 3 - 23, 24, 3, 28, 0, 0, 0, 25, 26, - // State 4 - 0, 0, 9, 0, 0, 0, 0, 0, 26, - // State 5 - 23, 24, 3, 0, 0, 0, 0, 25, 26, - // State 6 - 0, 0, 0, -9, 0, 0, 0, 0, 26, - // State 7 - 23, 24, 3, 0, 0, 0, 0, 25, 26, - // State 8 - 0, 0, 0, 0, 0, 0, 0, 0, 26, - // State 9 - 23, 24, 3, 0, 0, 0, 0, 25, 26, - // State 10 - 0, 0, 0, -10, 0, 0, 0, 0, 26, - // State 11 - 0, 0, 0, -9, 0, 0, 0, 0, 26, - // State 12 - 23, 24, 3, 0, 0, 0, 0, 25, 26, - // State 13 - 23, 24, 3, -11, 0, 0, 0, 25, 26, - // State 14 - 23, 24, 3, -12, 0, 0, 0, 25, 26, - // State 15 - 23, 24, 3, -11, 0, 0, 0, 25, 26, - // State 16 - -7, -7, -7, -7, 0, 0, 0, -7, -7, - // State 17 - -23, -23, -23, -23, 0, 0, 0, -23, -23, - // State 18 - -6, -6, -6, -6, 0, 0, 0, -6, -6, - // State 19 - -5, -5, -5, -5, 0, 0, 0, -5, -5, - // State 20 - -26, -26, -26, -26, 0, 0, 0, -26, -26, - // State 21 - 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 22 - -3, -3, -3, -3, 0, 0, 0, -3, -3, - // State 23 - -2, -2, -2, -2, 0, 0, 0, -2, -2, - // State 24 - -8, -8, -8, -8, 0, 0, 0, -8, -8, - // State 25 - -13, -13, -13, -13, 0, 0, 0, -13, -13, - // State 26 - -27, -27, -27, -27, 0, 0, 0, -27, -27, - // State 27 - -18, -18, -18, -18, 0, 0, 0, -18, -18, - // State 28 - 0, 0, 0, 14, 0, 0, 0, 0, 0, - // State 29 - 0, 0, 0, -16, 0, 0, 0, 0, -16, - // State 30 - 0, 0, 0, 35, 0, 0, 0, 0, 0, - // State 31 - 0, 0, 0, -1, 0, 0, 0, 0, 0, - // State 32 - 0, 0, 0, -4, 0, 0, 0, 0, 0, - // State 33 - 0, 0, 0, -17, 0, 0, 0, 0, -17, - // State 34 - -19, -19, -19, -19, 0, 0, 0, -19, -19, - // State 35 - 0, 0, 0, 16, 0, 0, 0, 0, 0, - // State 36 - 0, 0, 0, 39, 0, 0, 0, 0, 0, - // State 37 - 0, 0, 0, 40, 0, 0, 0, 0, 0, - // State 38 - -21, -21, -21, -21, 0, 0, 0, -21, -21, - // State 39 - -22, -22, -22, -22, 0, 0, 0, -22, -22, - // State 40 - 0, 0, 0, 42, 0, 0, 0, 0, 0, - // State 41 - -20, -20, -20, -20, 0, 0, 0, -20, -20, - ]; - fn __action(state: i8, integer: usize) -> i8 { - __ACTION[(state as usize) * 9 + integer] - } - const __EOF_ACTION: &[i8] = &[ - // State 0 - 0, - // State 1 - -28, - // State 2 - 0, - // State 3 - 0, - // State 4 - 0, - // State 5 - 0, - // State 6 - 0, - // State 7 - 0, - // State 8 - 0, - // State 9 - 0, - // State 10 - 0, - // State 11 - 0, - // State 12 - 0, - // State 13 - 0, - // State 14 - 0, - // State 15 - 0, - // State 16 - -7, - // State 17 - -23, - // State 18 - -6, - // State 19 - -5, - // State 20 - -26, - // State 21 - -30, - // State 22 - -3, - // State 23 - -2, - // State 24 - -8, - // State 25 - -13, - // State 26 - -27, - // State 27 - -18, - // State 28 - 0, - // State 29 - 0, - // State 30 - 0, - // State 31 - 0, - // State 32 - 0, - // State 33 - 0, - // State 34 - -19, - // State 35 - 0, - // State 36 - 0, - // State 37 - 0, - // State 38 - -21, - // State 39 - -22, - // State 40 - 0, - // State 41 - -20, - ]; - fn __goto(state: i8, nt: usize) -> i8 { - match nt { - 0 => 30, - 1 => 16, - 2 => 31, - 3 => 17, - 4 => 18, - 5 => match state { - 11 => 35, - _ => 28, - }, - 6 => match state { - 15 => 40, - _ => 37, - }, - 7 => match state { - 4 => 7, - 8 => 11, - 6 | 11 => 29, - 10 => 33, - _ => 19, - }, - 9 => 10, - 10 => match state { - 5 => 9, - 9 => 12, - 1 | 3 | 14 => 26, - 7 => 32, - 12 => 36, - _ => 20, - }, - 12 => match state { - 0 => 1, - 2 => 3, - _ => 14, - }, - 13 => 21, - _ => 0, - } - } - fn __expected_tokens(__state: i8) -> alloc::vec::Vec { - const __TERMINAL: &[&str] = &[ - r###""#f""###, - r###""#t""###, - r###""(""###, - r###"")""###, - r###""define""###, - r###""if""###, - r###""lambda (""###, - r###"r#"[0-9]+(\\.[0-9]+)?"#"###, - r###"r#"[A-Za-z!$%&*+\\-./:<=>?@^_~][A-Za-z!$%&*+\\-./:<=>?@^_~0-9]*"#"###, - ]; - __TERMINAL.iter().enumerate().filter_map(|(index, terminal)| { - let next_state = __action(__state, index); - if next_state == 0 { - None - } else { - Some(alloc::string::ToString::to_string(terminal)) - } - }).collect() - } - pub(crate) struct __StateMachine<'input, 's> - where - { - input: &'input str, - __phantom: core::marker::PhantomData<(&'input (), &'s ())>, - } - impl<'input, 's> __state_machine::ParserDefinition for __StateMachine<'input, 's> - where - { - type Location = usize; - type Error = &'static str; - type Token = Token<'input>; - type TokenIndex = usize; - type Symbol = __Symbol<'input>; - type Success = alloc::vec::Vec; - type StateIndex = i8; - type Action = i8; - type ReduceIndex = i8; - type NonterminalIndex = usize; - - #[inline] - fn start_location(&self) -> Self::Location { - Default::default() - } - - #[inline] - fn start_state(&self) -> Self::StateIndex { - 0 - } - - #[inline] - fn token_to_index(&self, token: &Self::Token) -> Option { - __token_to_integer(token, core::marker::PhantomData::<(&(), &())>) - } - - #[inline] - fn action(&self, state: i8, integer: usize) -> i8 { - __action(state, integer) - } - - #[inline] - fn error_action(&self, state: i8) -> i8 { - __action(state, 9 - 1) - } - - #[inline] - fn eof_action(&self, state: i8) -> i8 { - __EOF_ACTION[state as usize] - } - - #[inline] - fn goto(&self, state: i8, nt: usize) -> i8 { - __goto(state, nt) - } - - fn token_to_symbol(&self, token_index: usize, token: Self::Token) -> Self::Symbol { - __token_to_symbol(token_index, token, core::marker::PhantomData::<(&(), &())>) - } - - fn expected_tokens(&self, state: i8) -> alloc::vec::Vec { - __expected_tokens(state) - } - - #[inline] - fn uses_error_recovery(&self) -> bool { - false - } - - #[inline] - fn error_recovery_symbol( - &self, - recovery: __state_machine::ErrorRecovery, - ) -> Self::Symbol { - panic!("error recovery not enabled for this grammar") - } - - fn reduce( - &mut self, - action: i8, - start_location: Option<&Self::Location>, - states: &mut alloc::vec::Vec, - symbols: &mut alloc::vec::Vec<__state_machine::SymbolTriple>, - ) -> Option<__state_machine::ParseResult> { - __reduce( - self.input, - action, - start_location, - states, - symbols, - core::marker::PhantomData::<(&(), &())>, - ) - } - - fn simulate_reduce(&self, action: i8) -> __state_machine::SimulatedReduce { - panic!("error recovery not enabled for this grammar") - } - } - fn __token_to_integer< - 'input, - 's, - >( - __token: &Token<'input>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> Option - { - match *__token { - Token(2, _) if true => Some(0), - Token(3, _) if true => Some(1), - Token(4, _) if true => Some(2), - Token(5, _) if true => Some(3), - Token(6, _) if true => Some(4), - Token(7, _) if true => Some(5), - Token(8, _) if true => Some(6), - Token(0, _) if true => Some(7), - Token(1, _) if true => Some(8), - _ => None, - } - } - fn __token_to_symbol< - 'input, - 's, - >( - __token_index: usize, - __token: Token<'input>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> __Symbol<'input> - { - match __token_index { - 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 => match __token { - Token(2, __tok0) | Token(3, __tok0) | Token(4, __tok0) | Token(5, __tok0) | Token(6, __tok0) | Token(7, __tok0) | Token(8, __tok0) | Token(0, __tok0) | Token(1, __tok0) if true => __Symbol::Variant0(__tok0), - _ => unreachable!(), - }, - _ => unreachable!(), - } - } - pub(crate) struct TreesParser { - builder: __lalrpop_util::lexer::MatcherBuilder, - _priv: (), - } - - impl TreesParser { - pub(crate) fn new() -> TreesParser { - let __builder = super::__intern_token::new_builder(); - TreesParser { - builder: __builder, - _priv: (), - } - } - - #[allow(dead_code)] - pub(crate) fn parse< - 'input, - 's, - >( - &self, - input: &'input str, - ) -> Result, __lalrpop_util::ParseError, &'static str>> - { - let mut __tokens = self.builder.matcher(input); - __state_machine::Parser::drive( - __StateMachine { - input, - __phantom: core::marker::PhantomData::<(&(), &())>, - }, - __tokens, - ) - } - } - pub(crate) fn __reduce< - 'input, - 's, - >( - input: &'input str, - __action: i8, - __lookahead_start: Option<&usize>, - __states: &mut alloc::vec::Vec, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> Option,__lalrpop_util::ParseError, &'static str>>> - { - let (__pop_states, __nonterminal) = match __action { - 0 => { - __reduce0(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 1 => { - __reduce1(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 2 => { - __reduce2(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 3 => { - __reduce3(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 4 => { - __reduce4(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 5 => { - __reduce5(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 6 => { - __reduce6(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 7 => { - __reduce7(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 8 => { - __reduce8(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 9 => { - __reduce9(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 10 => { - __reduce10(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 11 => { - __reduce11(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 12 => { - __reduce12(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 13 => { - __reduce13(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 14 => { - __reduce14(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 15 => { - __reduce15(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 16 => { - __reduce16(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 17 => { - __reduce17(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 18 => { - __reduce18(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 19 => { - __reduce19(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 20 => { - __reduce20(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 21 => { - __reduce21(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 22 => { - __reduce22(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 23 => { - __reduce23(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 24 => { - __reduce24(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 25 => { - __reduce25(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 26 => { - __reduce26(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 27 => { - __reduce27(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 28 => { - __reduce28(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &())>) - } - 29 => { - // __Trees = Trees => ActionFn(0); - let __sym0 = __pop_Variant10(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action0::<>(input, __sym0); - return Some(Ok(__nt)); - } - _ => panic!("invalid action code {}", __action) - }; - let __states_len = __states.len(); - __states.truncate(__states_len - __pop_states); - let __state = *__states.last().unwrap(); - let __next_state = __goto(__state, __nonterminal); - __states.push(__next_state); - None - } - #[inline(never)] - fn __symbol_type_mismatch() -> ! { - panic!("symbol type mismatch") - } - fn __pop_Variant1< - 'input, - >( - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, Box, usize) - { - match __symbols.pop() { - Some((__l, __Symbol::Variant1(__v), __r)) => (__l, __v, __r), - _ => __symbol_type_mismatch() - } - } - fn __pop_Variant3< - 'input, - >( - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, Literal, usize) - { - match __symbols.pop() { - Some((__l, __Symbol::Variant3(__v), __r)) => (__l, __v, __r), - _ => __symbol_type_mismatch() - } - } - fn __pop_Variant5< - 'input, - >( - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, Rc<[String]>, usize) - { - match __symbols.pop() { - Some((__l, __Symbol::Variant5(__v), __r)) => (__l, __v, __r), - _ => __symbol_type_mismatch() - } - } - fn __pop_Variant6< - 'input, - >( - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, Rc<[Tree]>, usize) - { - match __symbols.pop() { - Some((__l, __Symbol::Variant6(__v), __r)) => (__l, __v, __r), - _ => __symbol_type_mismatch() - } - } - fn __pop_Variant7< - 'input, - >( - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, String, usize) - { - match __symbols.pop() { - Some((__l, __Symbol::Variant7(__v), __r)) => (__l, __v, __r), - _ => __symbol_type_mismatch() - } - } - fn __pop_Variant9< - 'input, - >( - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, Tree, usize) - { - match __symbols.pop() { - Some((__l, __Symbol::Variant9(__v), __r)) => (__l, __v, __r), - _ => __symbol_type_mismatch() - } - } - fn __pop_Variant8< - 'input, - >( - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, alloc::vec::Vec, usize) - { - match __symbols.pop() { - Some((__l, __Symbol::Variant8(__v), __r)) => (__l, __v, __r), - _ => __symbol_type_mismatch() - } - } - fn __pop_Variant10< - 'input, - >( - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, alloc::vec::Vec, usize) - { - match __symbols.pop() { - Some((__l, __Symbol::Variant10(__v), __r)) => (__l, __v, __r), - _ => __symbol_type_mismatch() - } - } - fn __pop_Variant2< - 'input, - >( - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, bool, usize) - { - match __symbols.pop() { - Some((__l, __Symbol::Variant2(__v), __r)) => (__l, __v, __r), - _ => __symbol_type_mismatch() - } - } - fn __pop_Variant4< - 'input, - >( - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, f64, usize) - { - match __symbols.pop() { - Some((__l, __Symbol::Variant4(__v), __r)) => (__l, __v, __r), - _ => __symbol_type_mismatch() - } - } - fn __pop_Variant0< - 'input, - >( - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, &'input str, usize) - { - match __symbols.pop() { - Some((__l, __Symbol::Variant0(__v), __r)) => (__l, __v, __r), - _ => __symbol_type_mismatch() - } - } - pub(crate) fn __reduce0< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // BTree = Box => ActionFn(9); - let __sym0 = __pop_Variant1(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action9::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant1(__nt), __end)); - (1, 0) - } - pub(crate) fn __reduce1< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Bool = "#t" => ActionFn(15); + // Num = r#"[0-9]+(\\.[0-9]+)?"# => ActionFn(15); let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); let __nt = super::__action15::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant2(__nt), __end)); - (1, 1) - } - pub(crate) fn __reduce2< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Bool = "#f" => ActionFn(16); - let __sym0 = __pop_Variant0(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action16::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant2(__nt), __end)); - (1, 1) - } - pub(crate) fn __reduce3< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Box = Tree => ActionFn(17); - let __sym0 = __pop_Variant9(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action17::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant1(__nt), __end)); - (1, 2) - } - pub(crate) fn __reduce4< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Literal = Sym => ActionFn(10); - let __sym0 = __pop_Variant7(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action10::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant3(__nt), __end)); - (1, 3) - } - pub(crate) fn __reduce5< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Literal = Num => ActionFn(11); - let __sym0 = __pop_Variant4(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action11::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant3(__nt), __end)); - (1, 3) - } - pub(crate) fn __reduce6< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Literal = Bool => ActionFn(12); - let __sym0 = __pop_Variant2(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action12::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant3(__nt), __end)); - (1, 3) - } - pub(crate) fn __reduce7< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Num = r#"[0-9]+(\\.[0-9]+)?"# => ActionFn(14); - let __sym0 = __pop_Variant0(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action14::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant4(__nt), __end)); - (1, 4) - } - pub(crate) fn __reduce8< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // RcSlice = => ActionFn(28); - let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); - let __end = __start.clone(); - let __nt = super::__action28::<>(input, &__start, &__end); - __symbols.push((__start, __Symbol::Variant5(__nt), __end)); - (0, 5) - } - pub(crate) fn __reduce9< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // RcSlice = Sym+ => ActionFn(29); - let __sym0 = __pop_Variant8(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action29::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant5(__nt), __end)); - (1, 5) - } - pub(crate) fn __reduce10< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // RcSlice = => ActionFn(30); - let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); - let __end = __start.clone(); - let __nt = super::__action30::<>(input, &__start, &__end); - __symbols.push((__start, __Symbol::Variant6(__nt), __end)); - (0, 6) - } - pub(crate) fn __reduce11< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // RcSlice = Tree+ => ActionFn(31); - let __sym0 = __pop_Variant10(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action31::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant6(__nt), __end)); - (1, 6) - } - pub(crate) fn __reduce12< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Sym = r#"[A-Za-z!$%&*+\\-./:<=>?@^_~][A-Za-z!$%&*+\\-./:<=>?@^_~0-9]*"# => ActionFn(13); - let __sym0 = __pop_Variant0(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action13::<>(input, __sym0); __symbols.push((__start, __Symbol::Variant7(__nt), __end)); - (1, 7) - } - pub(crate) fn __reduce13< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Sym* = => ActionFn(22); - let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); - let __end = __start.clone(); - let __nt = super::__action22::<>(input, &__start, &__end); - __symbols.push((__start, __Symbol::Variant8(__nt), __end)); - (0, 8) - } - pub(crate) fn __reduce14< - 'input, - 's, - >( - input: &'input str, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'input (), &'s ())>, - ) -> (usize, usize) - { - // Sym* = Sym+ => ActionFn(23); - let __sym0 = __pop_Variant8(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action23::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant8(__nt), __end)); (1, 8) } pub(crate) fn __reduce15< @@ -2182,13 +2453,12 @@ mod __parse__Trees { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Sym+ = Sym => ActionFn(26); - let __sym0 = __pop_Variant7(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action26::<>(input, __sym0); + // RcSlice = => ActionFn(36); + let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); + let __end = __start.clone(); + let __nt = super::__action36::<>(input, &__start, &__end); __symbols.push((__start, __Symbol::Variant8(__nt), __end)); - (1, 9) + (0, 9) } pub(crate) fn __reduce16< 'input, @@ -2200,15 +2470,13 @@ mod __parse__Trees { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Sym+ = Sym+, Sym => ActionFn(27); - assert!(__symbols.len() >= 2); - let __sym1 = __pop_Variant7(__symbols); - let __sym0 = __pop_Variant8(__symbols); + // RcSlice = Sym+ => ActionFn(37); + let __sym0 = __pop_Variant11(__symbols); let __start = __sym0.0.clone(); - let __end = __sym1.2.clone(); - let __nt = super::__action27::<>(input, __sym0, __sym1); + let __end = __sym0.2.clone(); + let __nt = super::__action37::<>(input, __sym0); __symbols.push((__start, __Symbol::Variant8(__nt), __end)); - (2, 9) + (1, 9) } pub(crate) fn __reduce17< 'input, @@ -2220,16 +2488,12 @@ mod __parse__Trees { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Tree = "(", Tree+, ")" => ActionFn(3); - assert!(__symbols.len() >= 3); - let __sym2 = __pop_Variant0(__symbols); - let __sym1 = __pop_Variant10(__symbols); - let __sym0 = __pop_Variant0(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym2.2.clone(); - let __nt = super::__action3::<>(input, __sym0, __sym1, __sym2); + // RcSlice = => ActionFn(38); + let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); + let __end = __start.clone(); + let __nt = super::__action38::<>(input, &__start, &__end); __symbols.push((__start, __Symbol::Variant9(__nt), __end)); - (3, 10) + (0, 10) } pub(crate) fn __reduce18< 'input, @@ -2241,18 +2505,13 @@ mod __parse__Trees { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Tree = "(", "define", Sym, BTree, ")" => ActionFn(4); - assert!(__symbols.len() >= 5); - let __sym4 = __pop_Variant0(__symbols); - let __sym3 = __pop_Variant1(__symbols); - let __sym2 = __pop_Variant7(__symbols); - let __sym1 = __pop_Variant0(__symbols); - let __sym0 = __pop_Variant0(__symbols); + // RcSlice = Tree+ => ActionFn(39); + let __sym0 = __pop_Variant3(__symbols); let __start = __sym0.0.clone(); - let __end = __sym4.2.clone(); - let __nt = super::__action4::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4); + let __end = __sym0.2.clone(); + let __nt = super::__action39::<>(input, __sym0); __symbols.push((__start, __Symbol::Variant9(__nt), __end)); - (5, 10) + (1, 10) } pub(crate) fn __reduce19< 'input, @@ -2264,21 +2523,13 @@ mod __parse__Trees { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Tree = "(", "define", "(", Sym, RcSlice, ")", RcSlice, ")" => ActionFn(5); - assert!(__symbols.len() >= 8); - let __sym7 = __pop_Variant0(__symbols); - let __sym6 = __pop_Variant6(__symbols); - let __sym5 = __pop_Variant0(__symbols); - let __sym4 = __pop_Variant5(__symbols); - let __sym3 = __pop_Variant7(__symbols); - let __sym2 = __pop_Variant0(__symbols); - let __sym1 = __pop_Variant0(__symbols); + // Sym = r#"[A-Za-z!$%&*+\\-./:<=>?@^_~][A-Za-z!$%&*+\\-./:<=>?@^_~0-9]*"# => ActionFn(14); let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); - let __end = __sym7.2.clone(); - let __nt = super::__action5::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5, __sym6, __sym7); - __symbols.push((__start, __Symbol::Variant9(__nt), __end)); - (8, 10) + let __end = __sym0.2.clone(); + let __nt = super::__action14::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant10(__nt), __end)); + (1, 11) } pub(crate) fn __reduce20< 'input, @@ -2290,19 +2541,12 @@ mod __parse__Trees { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Tree = "(", "if", Tree, Tree, Tree, ")" => ActionFn(6); - assert!(__symbols.len() >= 6); - let __sym5 = __pop_Variant0(__symbols); - let __sym4 = __pop_Variant9(__symbols); - let __sym3 = __pop_Variant9(__symbols); - let __sym2 = __pop_Variant9(__symbols); - let __sym1 = __pop_Variant0(__symbols); - let __sym0 = __pop_Variant0(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym5.2.clone(); - let __nt = super::__action6::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); - __symbols.push((__start, __Symbol::Variant9(__nt), __end)); - (6, 10) + // Sym* = => ActionFn(28); + let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); + let __end = __start.clone(); + let __nt = super::__action28::<>(input, &__start, &__end); + __symbols.push((__start, __Symbol::Variant11(__nt), __end)); + (0, 12) } pub(crate) fn __reduce21< 'input, @@ -2314,19 +2558,13 @@ mod __parse__Trees { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Tree = "(", "lambda (", RcSlice, ")", RcSlice, ")" => ActionFn(7); - assert!(__symbols.len() >= 6); - let __sym5 = __pop_Variant0(__symbols); - let __sym4 = __pop_Variant6(__symbols); - let __sym3 = __pop_Variant0(__symbols); - let __sym2 = __pop_Variant5(__symbols); - let __sym1 = __pop_Variant0(__symbols); - let __sym0 = __pop_Variant0(__symbols); + // Sym* = Sym+ => ActionFn(29); + let __sym0 = __pop_Variant11(__symbols); let __start = __sym0.0.clone(); - let __end = __sym5.2.clone(); - let __nt = super::__action7::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); - __symbols.push((__start, __Symbol::Variant9(__nt), __end)); - (6, 10) + let __end = __sym0.2.clone(); + let __nt = super::__action29::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant11(__nt), __end)); + (1, 12) } pub(crate) fn __reduce22< 'input, @@ -2338,13 +2576,13 @@ mod __parse__Trees { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Tree = Literal => ActionFn(8); - let __sym0 = __pop_Variant3(__symbols); + // Sym+ = Sym => ActionFn(32); + let __sym0 = __pop_Variant10(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action8::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant9(__nt), __end)); - (1, 10) + let __nt = super::__action32::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant11(__nt), __end)); + (1, 13) } pub(crate) fn __reduce23< 'input, @@ -2356,12 +2594,15 @@ mod __parse__Trees { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Tree* = => ActionFn(24); - let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); - let __end = __start.clone(); - let __nt = super::__action24::<>(input, &__start, &__end); - __symbols.push((__start, __Symbol::Variant10(__nt), __end)); - (0, 11) + // Sym+ = Sym+, Sym => ActionFn(33); + assert!(__symbols.len() >= 2); + let __sym1 = __pop_Variant10(__symbols); + let __sym0 = __pop_Variant11(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym1.2.clone(); + let __nt = super::__action33::<>(input, __sym0, __sym1); + __symbols.push((__start, __Symbol::Variant11(__nt), __end)); + (2, 13) } pub(crate) fn __reduce24< 'input, @@ -2373,13 +2614,16 @@ mod __parse__Trees { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Tree* = Tree+ => ActionFn(25); - let __sym0 = __pop_Variant10(__symbols); + // Tree = "(", Tree+, ")" => ActionFn(4); + assert!(__symbols.len() >= 3); + let __sym2 = __pop_Variant0(__symbols); + let __sym1 = __pop_Variant3(__symbols); + let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action25::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant10(__nt), __end)); - (1, 11) + let __end = __sym2.2.clone(); + let __nt = super::__action4::<>(input, __sym0, __sym1, __sym2); + __symbols.push((__start, __Symbol::Variant12(__nt), __end)); + (3, 14) } pub(crate) fn __reduce25< 'input, @@ -2391,13 +2635,18 @@ mod __parse__Trees { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Tree+ = Tree => ActionFn(20); - let __sym0 = __pop_Variant9(__symbols); + // Tree = "(", "define", Sym, BTree, ")" => ActionFn(5); + assert!(__symbols.len() >= 5); + let __sym4 = __pop_Variant0(__symbols); + let __sym3 = __pop_Variant1(__symbols); + let __sym2 = __pop_Variant10(__symbols); + let __sym1 = __pop_Variant0(__symbols); + let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action20::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant10(__nt), __end)); - (1, 12) + let __end = __sym4.2.clone(); + let __nt = super::__action5::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4); + __symbols.push((__start, __Symbol::Variant12(__nt), __end)); + (5, 14) } pub(crate) fn __reduce26< 'input, @@ -2409,15 +2658,21 @@ mod __parse__Trees { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Tree+ = Tree+, Tree => ActionFn(21); - assert!(__symbols.len() >= 2); - let __sym1 = __pop_Variant9(__symbols); - let __sym0 = __pop_Variant10(__symbols); + // Tree = "(", "define", "(", Sym, RcSlice, ")", RcSlice, ")" => ActionFn(6); + assert!(__symbols.len() >= 8); + let __sym7 = __pop_Variant0(__symbols); + let __sym6 = __pop_Variant9(__symbols); + let __sym5 = __pop_Variant0(__symbols); + let __sym4 = __pop_Variant8(__symbols); + let __sym3 = __pop_Variant10(__symbols); + let __sym2 = __pop_Variant0(__symbols); + let __sym1 = __pop_Variant0(__symbols); + let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); - let __end = __sym1.2.clone(); - let __nt = super::__action21::<>(input, __sym0, __sym1); - __symbols.push((__start, __Symbol::Variant10(__nt), __end)); - (2, 12) + let __end = __sym7.2.clone(); + let __nt = super::__action6::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5, __sym6, __sym7); + __symbols.push((__start, __Symbol::Variant12(__nt), __end)); + (8, 14) } pub(crate) fn __reduce27< 'input, @@ -2429,13 +2684,19 @@ mod __parse__Trees { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // Trees = Tree+ => ActionFn(2); - let __sym0 = __pop_Variant10(__symbols); + // Tree = "(", "if", Tree, Tree, Tree, ")" => ActionFn(7); + assert!(__symbols.len() >= 6); + let __sym5 = __pop_Variant0(__symbols); + let __sym4 = __pop_Variant12(__symbols); + let __sym3 = __pop_Variant12(__symbols); + let __sym2 = __pop_Variant12(__symbols); + let __sym1 = __pop_Variant0(__symbols); + let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action2::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant10(__nt), __end)); - (1, 13) + let __end = __sym5.2.clone(); + let __nt = super::__action7::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + __symbols.push((__start, __Symbol::Variant12(__nt), __end)); + (6, 14) } pub(crate) fn __reduce28< 'input, @@ -2447,16 +2708,149 @@ mod __parse__Trees { _: core::marker::PhantomData<(&'input (), &'s ())>, ) -> (usize, usize) { - // __Tree = Tree => ActionFn(1); - let __sym0 = __pop_Variant9(__symbols); + // Tree = "(", "lambda (", RcSlice, ")", RcSlice, ")" => ActionFn(8); + assert!(__symbols.len() >= 6); + let __sym5 = __pop_Variant0(__symbols); + let __sym4 = __pop_Variant9(__symbols); + let __sym3 = __pop_Variant0(__symbols); + let __sym2 = __pop_Variant8(__symbols); + let __sym1 = __pop_Variant0(__symbols); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym5.2.clone(); + let __nt = super::__action8::<>(input, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + __symbols.push((__start, __Symbol::Variant12(__nt), __end)); + (6, 14) + } + pub(crate) fn __reduce29< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Tree = Literal => ActionFn(9); + let __sym0 = __pop_Variant6(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action1::<>(input, __sym0); - __symbols.push((__start, __Symbol::Variant9(__nt), __end)); + let __nt = super::__action9::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (1, 14) } + pub(crate) fn __reduce30< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Tree* = => ActionFn(30); + let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); + let __end = __start.clone(); + let __nt = super::__action30::<>(input, &__start, &__end); + __symbols.push((__start, __Symbol::Variant3(__nt), __end)); + (0, 15) + } + pub(crate) fn __reduce31< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Tree* = Tree+ => ActionFn(31); + let __sym0 = __pop_Variant3(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action31::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant3(__nt), __end)); + (1, 15) + } + pub(crate) fn __reduce32< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Tree+ = Tree => ActionFn(24); + let __sym0 = __pop_Variant12(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action24::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant3(__nt), __end)); + (1, 16) + } + pub(crate) fn __reduce33< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Tree+ = Tree+, Tree => ActionFn(25); + assert!(__symbols.len() >= 2); + let __sym1 = __pop_Variant12(__symbols); + let __sym0 = __pop_Variant3(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym1.2.clone(); + let __nt = super::__action25::<>(input, __sym0, __sym1); + __symbols.push((__start, __Symbol::Variant3(__nt), __end)); + (2, 16) + } + pub(crate) fn __reduce34< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // Trees = Tree+ => ActionFn(3); + let __sym0 = __pop_Variant3(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action3::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant3(__nt), __end)); + (1, 17) + } + pub(crate) fn __reduce35< + 'input, + 's, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input (), &'s ())>, + ) -> (usize, usize) + { + // __File = File => ActionFn(0); + let __sym0 = __pop_Variant3(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action0::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant3(__nt), __end)); + (1, 18) + } } -pub(crate) use self::__parse__Trees::TreesParser; +pub(crate) use self::__parse__Tree::TreeParser; #[cfg_attr(rustfmt, rustfmt_skip)] mod __intern_token { #![allow(unused_imports)] @@ -2473,12 +2867,15 @@ mod __intern_token { ("^([0-9]+(\\.[0-9]+)?)", false), ("^([!\\$-\\&\\*-\\+\\--/:<-Z\\^-_a-z\\~][!\\$-\\&\\*-\\+\\--:<-Z\\^-_a-z\\~]*)", false), ("^(\\#f)", false), + ("^(\\#lang)", false), ("^(\\#t)", false), ("^(\\()", false), ("^(\\))", false), ("^(define)", false), ("^(if)", false), ("^(lambda \\()", false), + ("^(r7rs)", false), + ("^(scheme)", false), ("^(;[\u{0}-\t\u{b}-\u{c}\u{e}-\u{10ffff}]*[\n\r]*)", true), ("^([\t-\r \u{85}\u{a0}\u{1680}\u{2000}-\u{200a}\u{2028}-\u{2029}\u{202f}\u{205f}\u{3000}]*)", true), ]; @@ -2517,6 +2914,7 @@ fn __action2< 's, >( input: &'input str, + (_, _, _): (usize, core::option::Option<()>, usize), (_, __0, _): (usize, alloc::vec::Vec, usize), ) -> alloc::vec::Vec { @@ -2527,6 +2925,18 @@ fn __action2< fn __action3< 'input, 's, +>( + input: &'input str, + (_, __0, _): (usize, alloc::vec::Vec, usize), +) -> alloc::vec::Vec +{ + __0 +} + +#[allow(unused_variables)] +fn __action4< + 'input, + 's, >( input: &'input str, (_, _, _): (usize, &'input str, usize), @@ -2538,7 +2948,7 @@ fn __action3< } #[allow(unused_variables)] -fn __action4< +fn __action5< 'input, 's, >( @@ -2554,7 +2964,7 @@ fn __action4< } #[allow(unused_variables)] -fn __action5< +fn __action6< 'input, 's, >( @@ -2573,7 +2983,7 @@ fn __action5< } #[allow(unused_variables)] -fn __action6< +fn __action7< 'input, 's, >( @@ -2590,7 +3000,7 @@ fn __action6< } #[allow(unused_variables)] -fn __action7< +fn __action8< 'input, 's, >( @@ -2607,7 +3017,7 @@ fn __action7< } #[allow(unused_variables)] -fn __action8< +fn __action9< 'input, 's, >( @@ -2619,7 +3029,7 @@ fn __action8< } #[allow(unused_variables)] -fn __action9< +fn __action10< 'input, 's, >( @@ -2631,7 +3041,7 @@ fn __action9< } #[allow(unused_variables)] -fn __action10< +fn __action11< 'input, 's, >( @@ -2643,7 +3053,7 @@ fn __action10< } #[allow(unused_variables)] -fn __action11< +fn __action12< 'input, 's, >( @@ -2655,7 +3065,7 @@ fn __action11< } #[allow(unused_variables)] -fn __action12< +fn __action13< 'input, 's, >( @@ -2667,7 +3077,7 @@ fn __action12< } #[allow(unused_variables)] -fn __action13< +fn __action14< 'input, 's, >( @@ -2679,7 +3089,7 @@ fn __action13< } #[allow(unused_variables)] -fn __action14< +fn __action15< 'input, 's, >( @@ -2691,7 +3101,7 @@ fn __action14< } #[allow(unused_variables)] -fn __action15< +fn __action16< 'input, 's, >( @@ -2703,7 +3113,7 @@ fn __action15< } #[allow(unused_variables)] -fn __action16< +fn __action17< 'input, 's, >( @@ -2715,7 +3125,44 @@ fn __action16< } #[allow(unused_variables)] -fn __action17< +fn __action18< + 'input, + 's, +>( + input: &'input str, + (_, __0, _): (usize, &'input str, usize), + (_, __1, _): (usize, &'input str, usize), +) -> () +{ + () +} + +#[allow(unused_variables)] +fn __action19< + 'input, + 's, +>( + input: &'input str, + (_, __0, _): (usize, &'input str, usize), +) -> &'input str +{ + __0 +} + +#[allow(unused_variables)] +fn __action20< + 'input, + 's, +>( + input: &'input str, + (_, __0, _): (usize, &'input str, usize), +) -> &'input str +{ + __0 +} + +#[allow(unused_variables)] +fn __action21< 'input, 's, >( @@ -2727,7 +3174,7 @@ fn __action17< } #[allow(unused_variables)] -fn __action18< +fn __action22< 'input, 's, >( @@ -2739,7 +3186,7 @@ fn __action18< } #[allow(unused_variables)] -fn __action19< +fn __action23< 'input, 's, >( @@ -2751,7 +3198,7 @@ fn __action19< } #[allow(unused_variables)] -fn __action20< +fn __action24< 'input, 's, >( @@ -2763,7 +3210,7 @@ fn __action20< } #[allow(unused_variables)] -fn __action21< +fn __action25< 'input, 's, >( @@ -2776,7 +3223,32 @@ fn __action21< } #[allow(unused_variables)] -fn __action22< +fn __action26< + 'input, + 's, +>( + input: &'input str, + (_, __0, _): (usize, (), usize), +) -> core::option::Option<()> +{ + Some(__0) +} + +#[allow(unused_variables)] +fn __action27< + 'input, + 's, +>( + input: &'input str, + __lookbehind: &usize, + __lookahead: &usize, +) -> core::option::Option<()> +{ + None +} + +#[allow(unused_variables)] +fn __action28< 'input, 's, >( @@ -2789,7 +3261,7 @@ fn __action22< } #[allow(unused_variables)] -fn __action23< +fn __action29< 'input, 's, >( @@ -2801,7 +3273,7 @@ fn __action23< } #[allow(unused_variables)] -fn __action24< +fn __action30< 'input, 's, >( @@ -2814,7 +3286,7 @@ fn __action24< } #[allow(unused_variables)] -fn __action25< +fn __action31< 'input, 's, >( @@ -2826,7 +3298,7 @@ fn __action25< } #[allow(unused_variables)] -fn __action26< +fn __action32< 'input, 's, >( @@ -2838,7 +3310,7 @@ fn __action26< } #[allow(unused_variables)] -fn __action27< +fn __action33< 'input, 's, >( @@ -2851,7 +3323,55 @@ fn __action27< } #[allow(unused_variables)] -fn __action28< +fn __action34< + 'input, + 's, +>( + input: &'input str, + __0: (usize, (), usize), + __1: (usize, alloc::vec::Vec, usize), +) -> alloc::vec::Vec +{ + let __start0 = __0.0.clone(); + let __end0 = __0.2.clone(); + let __temp0 = __action26( + input, + __0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action2( + input, + __temp0, + __1, + ) +} + +#[allow(unused_variables)] +fn __action35< + 'input, + 's, +>( + input: &'input str, + __0: (usize, alloc::vec::Vec, usize), +) -> alloc::vec::Vec +{ + let __start0 = __0.0.clone(); + let __end0 = __0.0.clone(); + let __temp0 = __action27( + input, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action2( + input, + __temp0, + __0, + ) +} + +#[allow(unused_variables)] +fn __action36< 'input, 's, >( @@ -2862,20 +3382,20 @@ fn __action28< { let __start0 = __lookbehind.clone(); let __end0 = __lookahead.clone(); - let __temp0 = __action22( + let __temp0 = __action28( input, &__start0, &__end0, ); let __temp0 = (__start0, __temp0, __end0); - __action19( + __action23( input, __temp0, ) } #[allow(unused_variables)] -fn __action29< +fn __action37< 'input, 's, >( @@ -2885,19 +3405,19 @@ fn __action29< { let __start0 = __0.0.clone(); let __end0 = __0.2.clone(); - let __temp0 = __action23( + let __temp0 = __action29( input, __0, ); let __temp0 = (__start0, __temp0, __end0); - __action19( + __action23( input, __temp0, ) } #[allow(unused_variables)] -fn __action30< +fn __action38< 'input, 's, >( @@ -2908,20 +3428,20 @@ fn __action30< { let __start0 = __lookbehind.clone(); let __end0 = __lookahead.clone(); - let __temp0 = __action24( + let __temp0 = __action30( input, &__start0, &__end0, ); let __temp0 = (__start0, __temp0, __end0); - __action18( + __action22( input, __temp0, ) } #[allow(unused_variables)] -fn __action31< +fn __action39< 'input, 's, >( @@ -2931,12 +3451,12 @@ fn __action31< { let __start0 = __0.0.clone(); let __end0 = __0.2.clone(); - let __temp0 = __action25( + let __temp0 = __action31( input, __0, ); let __temp0 = (__start0, __temp0, __end0); - __action18( + __action22( input, __temp0, ) diff --git a/src/main.rs b/src/main.rs index d771222..a675b8f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,6 @@ mod grammar; #[cfg(test)] mod tests; - // use debug2::dbg; use rustyline::validate::{ MatchingBracketValidator, ValidationContext, ValidationResult, Validator, @@ -156,7 +155,7 @@ fn main() { fn run_file(file: &str) -> io::Result<()> { let src = std::fs::read_to_string(file)?; - let tree = grammar::TreesParser::new().parse(&src).unwrap(); + let tree = grammar::FileParser::new().parse(&src).unwrap(); let mut env = default_env(); for i in tree { eval(&i, &mut env).unwrap(); @@ -381,5 +380,3 @@ impl Validator for InputValidator { self.brackets.validate(ctx) } } - - diff --git a/src/test/pass/lambda-calc.scm b/src/test/pass/lambda-calc.scm index 6eb505f..5d3e56e 100644 --- a/src/test/pass/lambda-calc.scm +++ b/src/test/pass/lambda-calc.scm @@ -1,3 +1,5 @@ +#lang scheme + (define (displayln x) (display x) (newline)) (define (printbool x) (displayln (bool->int x))) @@ -9,8 +11,8 @@ (define (bool->int x) (if - (equal? x true) 1 - (if (equal? x false) 0 (- 1)))) + (equal? x true) 1 + (if (equal? x false) 0 (- 1)))) (printbool true) (printbool false) diff --git a/src/test/pass/math.scm b/src/test/pass/math.scm index 0c5c8bb..e24fc57 100644 --- a/src/test/pass/math.scm +++ b/src/test/pass/math.scm @@ -1,4 +1,6 @@ -(define (displayln x) (display x) (newline)) +(define (displayln x) + (display x) + (newline)) (displayln (+)) (displayln (+ 1))