1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use quote::quote;
use crate::SpannableIdent;

use super::{Rc, ToTokensState};
use proc_macro2::{TokenStream, Ident};
use wagon_parser::parser::inverse::Inverse;

impl<U> ToTokensState<U> for Inverse {
    fn to_tokens(&self, state: &mut U, label: Rc<Ident>, attr_fun: fn(&mut U, Rc<Ident>, SpannableIdent)) -> TokenStream {
        match self {
            Self::Not(i) => {
                let i_stream = i.to_tokens(state, label, attr_fun);
                quote!(std::ops::Not::not(#i_stream)?)
            },
            Self::Comparison(c) => {
                c.to_tokens(state, label, attr_fun)
            },
        }
    }
}