1extern crate data_query_lexical;
2
3use data_query_lexical as lexer;
4use data_query_lexical::MacroFormat;
5use proc_macro::TokenStream;
6use std::str::FromStr;
7
8#[proc_macro]
9pub fn precompile_lex(input: TokenStream) -> TokenStream {
10 let lex = input.to_string();
11 let const_lex = lexer::compile(&lex);
12 if let Err(v) = const_lex {
13 panic!(
14 "It was not possible to create a const value to the expexted lexica string: {:?}",
15 v
16 )
17 }
18 let code = const_lex.unwrap().macro_fmt();
19 TokenStream::from_str(code.as_str()).unwrap()
20}