768 lines
22 KiB
Rust
768 lines
22 KiB
Rust
// auto-generated: "lalrpop 0.19.6"
|
|
// sha3: b4e129326576b92bdcb244ce79862d1fd8d25830fd43a283867e772251d1f229
|
|
use crate::{Token, Tree, Val};
|
|
#[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;
|
|
|
|
#[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::{Token, Tree, Val};
|
|
#[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 super::__ToTriple;
|
|
#[allow(dead_code)]
|
|
pub(crate) enum __Symbol<'s>
|
|
{
|
|
Variant0(Token<'s>),
|
|
Variant1(f64),
|
|
Variant2(&'s str),
|
|
Variant3(i64),
|
|
Variant4(Tree<'s>),
|
|
Variant5(alloc::vec::Vec<Tree<'s>>),
|
|
Variant6(Val<'s>),
|
|
}
|
|
const __ACTION: &[i8] = &[
|
|
// State 0
|
|
3, 0, 7, 8, 9,
|
|
// State 1
|
|
3, -8, 7, 8, 9,
|
|
// State 2
|
|
3, -7, 7, 8, 9,
|
|
// State 3
|
|
-5, -5, -5, -5, -5,
|
|
// State 4
|
|
0, 0, 0, 0, 0,
|
|
// State 5
|
|
-2, -2, -2, -2, -2,
|
|
// State 6
|
|
-10, -10, -10, -10, -10,
|
|
// State 7
|
|
-11, -11, -11, -11, -11,
|
|
// State 8
|
|
-9, -9, -9, -9, -9,
|
|
// State 9
|
|
-6, -6, -6, -6, -6,
|
|
// State 10
|
|
0, 12, 0, 0, 0,
|
|
// State 11
|
|
-1, -1, -1, -1, -1,
|
|
];
|
|
fn __action(state: i8, integer: usize) -> i8 {
|
|
__ACTION[(state as usize) * 5 + integer]
|
|
}
|
|
const __EOF_ACTION: &[i8] = &[
|
|
// State 0
|
|
-7,
|
|
// State 1
|
|
-8,
|
|
// State 2
|
|
0,
|
|
// State 3
|
|
-5,
|
|
// State 4
|
|
-12,
|
|
// State 5
|
|
-2,
|
|
// State 6
|
|
-10,
|
|
// State 7
|
|
-11,
|
|
// State 8
|
|
-9,
|
|
// State 9
|
|
-6,
|
|
// State 10
|
|
0,
|
|
// State 11
|
|
-1,
|
|
];
|
|
fn __goto(state: i8, nt: usize) -> i8 {
|
|
match nt {
|
|
0 => match state {
|
|
1 => 9,
|
|
_ => 3,
|
|
},
|
|
2 => 1,
|
|
3 => match state {
|
|
2 => 10,
|
|
_ => 4,
|
|
},
|
|
4 => 5,
|
|
_ => 0,
|
|
}
|
|
}
|
|
fn __expected_tokens(__state: i8) -> alloc::vec::Vec<alloc::string::String> {
|
|
const __TERMINAL: &[&str] = &[
|
|
r###""(""###,
|
|
r###"")""###,
|
|
r###""@float""###,
|
|
r###""@id""###,
|
|
r###""@int""###,
|
|
];
|
|
__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<'s>
|
|
where
|
|
{
|
|
__phantom: core::marker::PhantomData<(&'s ())>,
|
|
}
|
|
impl<'s> __state_machine::ParserDefinition for __StateMachine<'s>
|
|
where
|
|
{
|
|
type Location = usize;
|
|
type Error = crate::LexError;
|
|
type Token = Token<'s>;
|
|
type TokenIndex = usize;
|
|
type Symbol = __Symbol<'s>;
|
|
type Success = alloc::vec::Vec<Tree<'s>>;
|
|
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<usize> {
|
|
__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, 5 - 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<alloc::string::String> {
|
|
__expected_tokens(state)
|
|
}
|
|
|
|
#[inline]
|
|
fn uses_error_recovery(&self) -> bool {
|
|
false
|
|
}
|
|
|
|
#[inline]
|
|
fn error_recovery_symbol(
|
|
&self,
|
|
recovery: __state_machine::ErrorRecovery<Self>,
|
|
) -> 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<i8>,
|
|
symbols: &mut alloc::vec::Vec<__state_machine::SymbolTriple<Self>>,
|
|
) -> Option<__state_machine::ParseResult<Self>> {
|
|
__reduce(
|
|
action,
|
|
start_location,
|
|
states,
|
|
symbols,
|
|
core::marker::PhantomData::<(&())>,
|
|
)
|
|
}
|
|
|
|
fn simulate_reduce(&self, action: i8) -> __state_machine::SimulatedReduce<Self> {
|
|
panic!("error recovery not enabled for this grammar")
|
|
}
|
|
}
|
|
fn __token_to_integer<
|
|
's,
|
|
>(
|
|
__token: &Token<'s>,
|
|
_: core::marker::PhantomData<(&'s ())>,
|
|
) -> Option<usize>
|
|
{
|
|
match *__token {
|
|
Token::Lparen if true => Some(0),
|
|
Token::Rparen if true => Some(1),
|
|
Token::Float(_) if true => Some(2),
|
|
Token::Ident(_) if true => Some(3),
|
|
Token::Int(_) if true => Some(4),
|
|
_ => None,
|
|
}
|
|
}
|
|
fn __token_to_symbol<
|
|
's,
|
|
>(
|
|
__token_index: usize,
|
|
__token: Token<'s>,
|
|
_: core::marker::PhantomData<(&'s ())>,
|
|
) -> __Symbol<'s>
|
|
{
|
|
match __token_index {
|
|
0 | 1 => __Symbol::Variant0(__token),
|
|
2 => match __token {
|
|
Token::Float(__tok0) if true => __Symbol::Variant1(__tok0),
|
|
_ => unreachable!(),
|
|
},
|
|
3 => match __token {
|
|
Token::Ident(__tok0) if true => __Symbol::Variant2(__tok0),
|
|
_ => unreachable!(),
|
|
},
|
|
4 => match __token {
|
|
Token::Int(__tok0) if true => __Symbol::Variant3(__tok0),
|
|
_ => unreachable!(),
|
|
},
|
|
_ => unreachable!(),
|
|
}
|
|
}
|
|
pub(crate) struct TreesParser {
|
|
_priv: (),
|
|
}
|
|
|
|
impl TreesParser {
|
|
pub(crate) fn new() -> TreesParser {
|
|
TreesParser {
|
|
_priv: (),
|
|
}
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
pub(crate) fn parse<
|
|
's,
|
|
__TOKEN: __ToTriple<'s, >,
|
|
__TOKENS: IntoIterator<Item=__TOKEN>,
|
|
>(
|
|
&self,
|
|
__tokens0: __TOKENS,
|
|
) -> Result<alloc::vec::Vec<Tree<'s>>, __lalrpop_util::ParseError<usize, Token<'s>, crate::LexError>>
|
|
{
|
|
let __tokens = __tokens0.into_iter();
|
|
let mut __tokens = __tokens.map(|t| __ToTriple::to_triple(t));
|
|
__state_machine::Parser::drive(
|
|
__StateMachine {
|
|
__phantom: core::marker::PhantomData::<(&())>,
|
|
},
|
|
__tokens,
|
|
)
|
|
}
|
|
}
|
|
pub(crate) fn __reduce<
|
|
's,
|
|
>(
|
|
__action: i8,
|
|
__lookahead_start: Option<&usize>,
|
|
__states: &mut alloc::vec::Vec<i8>,
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>,
|
|
_: core::marker::PhantomData<(&'s ())>,
|
|
) -> Option<Result<alloc::vec::Vec<Tree<'s>>,__lalrpop_util::ParseError<usize, Token<'s>, crate::LexError>>>
|
|
{
|
|
let (__pop_states, __nonterminal) = match __action {
|
|
0 => {
|
|
__reduce0(__lookahead_start, __symbols, core::marker::PhantomData::<(&())>)
|
|
}
|
|
1 => {
|
|
__reduce1(__lookahead_start, __symbols, core::marker::PhantomData::<(&())>)
|
|
}
|
|
2 => {
|
|
__reduce2(__lookahead_start, __symbols, core::marker::PhantomData::<(&())>)
|
|
}
|
|
3 => {
|
|
__reduce3(__lookahead_start, __symbols, core::marker::PhantomData::<(&())>)
|
|
}
|
|
4 => {
|
|
__reduce4(__lookahead_start, __symbols, core::marker::PhantomData::<(&())>)
|
|
}
|
|
5 => {
|
|
__reduce5(__lookahead_start, __symbols, core::marker::PhantomData::<(&())>)
|
|
}
|
|
6 => {
|
|
__reduce6(__lookahead_start, __symbols, core::marker::PhantomData::<(&())>)
|
|
}
|
|
7 => {
|
|
__reduce7(__lookahead_start, __symbols, core::marker::PhantomData::<(&())>)
|
|
}
|
|
8 => {
|
|
__reduce8(__lookahead_start, __symbols, core::marker::PhantomData::<(&())>)
|
|
}
|
|
9 => {
|
|
__reduce9(__lookahead_start, __symbols, core::marker::PhantomData::<(&())>)
|
|
}
|
|
10 => {
|
|
__reduce10(__lookahead_start, __symbols, core::marker::PhantomData::<(&())>)
|
|
}
|
|
11 => {
|
|
// __Trees = Trees => ActionFn(0);
|
|
let __sym0 = __pop_Variant5(__symbols);
|
|
let __start = __sym0.0.clone();
|
|
let __end = __sym0.2.clone();
|
|
let __nt = super::__action0::<>(__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_Variant0<
|
|
's,
|
|
>(
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>
|
|
) -> (usize, Token<'s>, usize)
|
|
{
|
|
match __symbols.pop() {
|
|
Some((__l, __Symbol::Variant0(__v), __r)) => (__l, __v, __r),
|
|
_ => __symbol_type_mismatch()
|
|
}
|
|
}
|
|
fn __pop_Variant4<
|
|
's,
|
|
>(
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>
|
|
) -> (usize, Tree<'s>, usize)
|
|
{
|
|
match __symbols.pop() {
|
|
Some((__l, __Symbol::Variant4(__v), __r)) => (__l, __v, __r),
|
|
_ => __symbol_type_mismatch()
|
|
}
|
|
}
|
|
fn __pop_Variant6<
|
|
's,
|
|
>(
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>
|
|
) -> (usize, Val<'s>, usize)
|
|
{
|
|
match __symbols.pop() {
|
|
Some((__l, __Symbol::Variant6(__v), __r)) => (__l, __v, __r),
|
|
_ => __symbol_type_mismatch()
|
|
}
|
|
}
|
|
fn __pop_Variant5<
|
|
's,
|
|
>(
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>
|
|
) -> (usize, alloc::vec::Vec<Tree<'s>>, usize)
|
|
{
|
|
match __symbols.pop() {
|
|
Some((__l, __Symbol::Variant5(__v), __r)) => (__l, __v, __r),
|
|
_ => __symbol_type_mismatch()
|
|
}
|
|
}
|
|
fn __pop_Variant1<
|
|
's,
|
|
>(
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>
|
|
) -> (usize, f64, usize)
|
|
{
|
|
match __symbols.pop() {
|
|
Some((__l, __Symbol::Variant1(__v), __r)) => (__l, __v, __r),
|
|
_ => __symbol_type_mismatch()
|
|
}
|
|
}
|
|
fn __pop_Variant3<
|
|
's,
|
|
>(
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>
|
|
) -> (usize, i64, usize)
|
|
{
|
|
match __symbols.pop() {
|
|
Some((__l, __Symbol::Variant3(__v), __r)) => (__l, __v, __r),
|
|
_ => __symbol_type_mismatch()
|
|
}
|
|
}
|
|
fn __pop_Variant2<
|
|
's,
|
|
>(
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>
|
|
) -> (usize, &'s str, usize)
|
|
{
|
|
match __symbols.pop() {
|
|
Some((__l, __Symbol::Variant2(__v), __r)) => (__l, __v, __r),
|
|
_ => __symbol_type_mismatch()
|
|
}
|
|
}
|
|
pub(crate) fn __reduce0<
|
|
's,
|
|
>(
|
|
__lookahead_start: Option<&usize>,
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>,
|
|
_: core::marker::PhantomData<(&'s ())>,
|
|
) -> (usize, usize)
|
|
{
|
|
// Tree = "(", Trees, ")" => ActionFn(2);
|
|
assert!(__symbols.len() >= 3);
|
|
let __sym2 = __pop_Variant0(__symbols);
|
|
let __sym1 = __pop_Variant5(__symbols);
|
|
let __sym0 = __pop_Variant0(__symbols);
|
|
let __start = __sym0.0.clone();
|
|
let __end = __sym2.2.clone();
|
|
let __nt = super::__action2::<>(__sym0, __sym1, __sym2);
|
|
__symbols.push((__start, __Symbol::Variant4(__nt), __end));
|
|
(3, 0)
|
|
}
|
|
pub(crate) fn __reduce1<
|
|
's,
|
|
>(
|
|
__lookahead_start: Option<&usize>,
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>,
|
|
_: core::marker::PhantomData<(&'s ())>,
|
|
) -> (usize, usize)
|
|
{
|
|
// Tree = Val => ActionFn(3);
|
|
let __sym0 = __pop_Variant6(__symbols);
|
|
let __start = __sym0.0.clone();
|
|
let __end = __sym0.2.clone();
|
|
let __nt = super::__action3::<>(__sym0);
|
|
__symbols.push((__start, __Symbol::Variant4(__nt), __end));
|
|
(1, 0)
|
|
}
|
|
pub(crate) fn __reduce2<
|
|
's,
|
|
>(
|
|
__lookahead_start: Option<&usize>,
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>,
|
|
_: core::marker::PhantomData<(&'s ())>,
|
|
) -> (usize, usize)
|
|
{
|
|
// Tree* = => ActionFn(7);
|
|
let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default();
|
|
let __end = __start.clone();
|
|
let __nt = super::__action7::<>(&__start, &__end);
|
|
__symbols.push((__start, __Symbol::Variant5(__nt), __end));
|
|
(0, 1)
|
|
}
|
|
pub(crate) fn __reduce3<
|
|
's,
|
|
>(
|
|
__lookahead_start: Option<&usize>,
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>,
|
|
_: core::marker::PhantomData<(&'s ())>,
|
|
) -> (usize, usize)
|
|
{
|
|
// Tree* = Tree+ => ActionFn(8);
|
|
let __sym0 = __pop_Variant5(__symbols);
|
|
let __start = __sym0.0.clone();
|
|
let __end = __sym0.2.clone();
|
|
let __nt = super::__action8::<>(__sym0);
|
|
__symbols.push((__start, __Symbol::Variant5(__nt), __end));
|
|
(1, 1)
|
|
}
|
|
pub(crate) fn __reduce4<
|
|
's,
|
|
>(
|
|
__lookahead_start: Option<&usize>,
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>,
|
|
_: core::marker::PhantomData<(&'s ())>,
|
|
) -> (usize, usize)
|
|
{
|
|
// Tree+ = Tree => ActionFn(9);
|
|
let __sym0 = __pop_Variant4(__symbols);
|
|
let __start = __sym0.0.clone();
|
|
let __end = __sym0.2.clone();
|
|
let __nt = super::__action9::<>(__sym0);
|
|
__symbols.push((__start, __Symbol::Variant5(__nt), __end));
|
|
(1, 2)
|
|
}
|
|
pub(crate) fn __reduce5<
|
|
's,
|
|
>(
|
|
__lookahead_start: Option<&usize>,
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>,
|
|
_: core::marker::PhantomData<(&'s ())>,
|
|
) -> (usize, usize)
|
|
{
|
|
// Tree+ = Tree+, Tree => ActionFn(10);
|
|
assert!(__symbols.len() >= 2);
|
|
let __sym1 = __pop_Variant4(__symbols);
|
|
let __sym0 = __pop_Variant5(__symbols);
|
|
let __start = __sym0.0.clone();
|
|
let __end = __sym1.2.clone();
|
|
let __nt = super::__action10::<>(__sym0, __sym1);
|
|
__symbols.push((__start, __Symbol::Variant5(__nt), __end));
|
|
(2, 2)
|
|
}
|
|
pub(crate) fn __reduce6<
|
|
's,
|
|
>(
|
|
__lookahead_start: Option<&usize>,
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>,
|
|
_: core::marker::PhantomData<(&'s ())>,
|
|
) -> (usize, usize)
|
|
{
|
|
// Trees = => ActionFn(11);
|
|
let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default();
|
|
let __end = __start.clone();
|
|
let __nt = super::__action11::<>(&__start, &__end);
|
|
__symbols.push((__start, __Symbol::Variant5(__nt), __end));
|
|
(0, 3)
|
|
}
|
|
pub(crate) fn __reduce7<
|
|
's,
|
|
>(
|
|
__lookahead_start: Option<&usize>,
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>,
|
|
_: core::marker::PhantomData<(&'s ())>,
|
|
) -> (usize, usize)
|
|
{
|
|
// Trees = Tree+ => ActionFn(12);
|
|
let __sym0 = __pop_Variant5(__symbols);
|
|
let __start = __sym0.0.clone();
|
|
let __end = __sym0.2.clone();
|
|
let __nt = super::__action12::<>(__sym0);
|
|
__symbols.push((__start, __Symbol::Variant5(__nt), __end));
|
|
(1, 3)
|
|
}
|
|
pub(crate) fn __reduce8<
|
|
's,
|
|
>(
|
|
__lookahead_start: Option<&usize>,
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>,
|
|
_: core::marker::PhantomData<(&'s ())>,
|
|
) -> (usize, usize)
|
|
{
|
|
// Val = "@int" => ActionFn(4);
|
|
let __sym0 = __pop_Variant3(__symbols);
|
|
let __start = __sym0.0.clone();
|
|
let __end = __sym0.2.clone();
|
|
let __nt = super::__action4::<>(__sym0);
|
|
__symbols.push((__start, __Symbol::Variant6(__nt), __end));
|
|
(1, 4)
|
|
}
|
|
pub(crate) fn __reduce9<
|
|
's,
|
|
>(
|
|
__lookahead_start: Option<&usize>,
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>,
|
|
_: core::marker::PhantomData<(&'s ())>,
|
|
) -> (usize, usize)
|
|
{
|
|
// Val = "@float" => ActionFn(5);
|
|
let __sym0 = __pop_Variant1(__symbols);
|
|
let __start = __sym0.0.clone();
|
|
let __end = __sym0.2.clone();
|
|
let __nt = super::__action5::<>(__sym0);
|
|
__symbols.push((__start, __Symbol::Variant6(__nt), __end));
|
|
(1, 4)
|
|
}
|
|
pub(crate) fn __reduce10<
|
|
's,
|
|
>(
|
|
__lookahead_start: Option<&usize>,
|
|
__symbols: &mut alloc::vec::Vec<(usize,__Symbol<'s>,usize)>,
|
|
_: core::marker::PhantomData<(&'s ())>,
|
|
) -> (usize, usize)
|
|
{
|
|
// Val = "@id" => ActionFn(6);
|
|
let __sym0 = __pop_Variant2(__symbols);
|
|
let __start = __sym0.0.clone();
|
|
let __end = __sym0.2.clone();
|
|
let __nt = super::__action6::<>(__sym0);
|
|
__symbols.push((__start, __Symbol::Variant6(__nt), __end));
|
|
(1, 4)
|
|
}
|
|
}
|
|
pub(crate) use self::__parse__Trees::TreesParser;
|
|
|
|
fn __action0<
|
|
's,
|
|
>(
|
|
(_, __0, _): (usize, alloc::vec::Vec<Tree<'s>>, usize),
|
|
) -> alloc::vec::Vec<Tree<'s>>
|
|
{
|
|
__0
|
|
}
|
|
|
|
fn __action1<
|
|
's,
|
|
>(
|
|
(_, __0, _): (usize, alloc::vec::Vec<Tree<'s>>, usize),
|
|
) -> alloc::vec::Vec<Tree<'s>>
|
|
{
|
|
__0
|
|
}
|
|
|
|
fn __action2<
|
|
's,
|
|
>(
|
|
(_, _, _): (usize, Token<'s>, usize),
|
|
(_, __0, _): (usize, alloc::vec::Vec<Tree<'s>>, usize),
|
|
(_, _, _): (usize, Token<'s>, usize),
|
|
) -> Tree<'s>
|
|
{
|
|
Tree::Branch(__0)
|
|
}
|
|
|
|
fn __action3<
|
|
's,
|
|
>(
|
|
(_, __0, _): (usize, Val<'s>, usize),
|
|
) -> Tree<'s>
|
|
{
|
|
Tree::Leaf(__0)
|
|
}
|
|
|
|
fn __action4<
|
|
's,
|
|
>(
|
|
(_, __0, _): (usize, i64, usize),
|
|
) -> Val<'s>
|
|
{
|
|
Val::Int(__0)
|
|
}
|
|
|
|
fn __action5<
|
|
's,
|
|
>(
|
|
(_, __0, _): (usize, f64, usize),
|
|
) -> Val<'s>
|
|
{
|
|
Val::Float(__0)
|
|
}
|
|
|
|
fn __action6<
|
|
's,
|
|
>(
|
|
(_, __0, _): (usize, &'s str, usize),
|
|
) -> Val<'s>
|
|
{
|
|
Val::Ident(__0)
|
|
}
|
|
|
|
fn __action7<
|
|
's,
|
|
>(
|
|
__lookbehind: &usize,
|
|
__lookahead: &usize,
|
|
) -> alloc::vec::Vec<Tree<'s>>
|
|
{
|
|
alloc::vec![]
|
|
}
|
|
|
|
fn __action8<
|
|
's,
|
|
>(
|
|
(_, v, _): (usize, alloc::vec::Vec<Tree<'s>>, usize),
|
|
) -> alloc::vec::Vec<Tree<'s>>
|
|
{
|
|
v
|
|
}
|
|
|
|
fn __action9<
|
|
's,
|
|
>(
|
|
(_, __0, _): (usize, Tree<'s>, usize),
|
|
) -> alloc::vec::Vec<Tree<'s>>
|
|
{
|
|
alloc::vec![__0]
|
|
}
|
|
|
|
fn __action10<
|
|
's,
|
|
>(
|
|
(_, v, _): (usize, alloc::vec::Vec<Tree<'s>>, usize),
|
|
(_, e, _): (usize, Tree<'s>, usize),
|
|
) -> alloc::vec::Vec<Tree<'s>>
|
|
{
|
|
{ let mut v = v; v.push(e); v }
|
|
}
|
|
|
|
fn __action11<
|
|
's,
|
|
>(
|
|
__lookbehind: &usize,
|
|
__lookahead: &usize,
|
|
) -> alloc::vec::Vec<Tree<'s>>
|
|
{
|
|
let __start0 = __lookbehind.clone();
|
|
let __end0 = __lookahead.clone();
|
|
let __temp0 = __action7(
|
|
&__start0,
|
|
&__end0,
|
|
);
|
|
let __temp0 = (__start0, __temp0, __end0);
|
|
__action1(
|
|
__temp0,
|
|
)
|
|
}
|
|
|
|
fn __action12<
|
|
's,
|
|
>(
|
|
__0: (usize, alloc::vec::Vec<Tree<'s>>, usize),
|
|
) -> alloc::vec::Vec<Tree<'s>>
|
|
{
|
|
let __start0 = __0.0.clone();
|
|
let __end0 = __0.2.clone();
|
|
let __temp0 = __action8(
|
|
__0,
|
|
);
|
|
let __temp0 = (__start0, __temp0, __end0);
|
|
__action1(
|
|
__temp0,
|
|
)
|
|
}
|
|
|
|
pub trait __ToTriple<'s, > {
|
|
fn to_triple(value: Self) -> Result<(usize,Token<'s>,usize), __lalrpop_util::ParseError<usize, Token<'s>, crate::LexError>>;
|
|
}
|
|
|
|
impl<'s, > __ToTriple<'s, > for (usize, Token<'s>, usize) {
|
|
fn to_triple(value: Self) -> Result<(usize,Token<'s>,usize), __lalrpop_util::ParseError<usize, Token<'s>, crate::LexError>> {
|
|
Ok(value)
|
|
}
|
|
}
|
|
impl<'s, > __ToTriple<'s, > for Result<(usize, Token<'s>, usize), crate::LexError> {
|
|
fn to_triple(value: Self) -> Result<(usize,Token<'s>,usize), __lalrpop_util::ParseError<usize, Token<'s>, crate::LexError>> {
|
|
match value {
|
|
Ok(v) => Ok(v),
|
|
Err(error) => Err(__lalrpop_util::ParseError::User { error }),
|
|
}
|
|
}
|
|
}
|