fix: more-or-less readable errors + syntax check on sassy macro
This commit is contained in:
parent
53b8a934aa
commit
d5491b86cc
1 changed files with 91 additions and 26 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use proc_macro2::TokenStream;
|
||||
use quote::quote;
|
||||
use regex::Regex;
|
||||
use sabry_intrnl::scoper::ArbitraryScope;
|
||||
use syn::{parse::Parse, Ident};
|
||||
|
||||
use super::{ArbitraryStyleBlock, ArbitraryStyleSyntax};
|
||||
|
|
@ -21,6 +21,14 @@ pub fn sassy_macro_impl(input: TokenStream) -> TokenStream {
|
|||
Err(e) => return e.to_compile_error(),
|
||||
};
|
||||
|
||||
// quick raffia syntax check
|
||||
match ArbitraryScope::from_source(mode.into(), ident.clone(), &code.code) {
|
||||
Ok(_) => {},
|
||||
Err(e) => {
|
||||
return syn::Error::new(code.span, format!("{e:?}")).into_compile_error()
|
||||
}
|
||||
}
|
||||
|
||||
let sourcesass = code.to_string();
|
||||
let identname = ident.to_string();
|
||||
let macro_doc = format!("Arbitrary {:?} code declared with `sassy!`. Pretty usable in tandem with `usey!` and `magic()` at build time", mode);
|
||||
|
|
|
|||
Loading…
Reference in a new issue