refactor: use single unified syntax shim type instead of many
This commit is contained in:
parent
28a8f53f1b
commit
7702862071
2 changed files with 102 additions and 92 deletions
|
|
@ -69,7 +69,7 @@ impl ScopeHash {
|
|||
mod test {
|
||||
use syn::Ident;
|
||||
|
||||
use crate::{config::SabryHashConfig, scoper::ArbitraryScope};
|
||||
use crate::{config::SabryHashConfig, scoper::ArbitraryScope, syntax::ostrta::OneSyntaxToRuleThemAll};
|
||||
|
||||
use super::ScopeHash;
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ mod test {
|
|||
let source = ".cls1{color:red; &-dark{color: black} #id1 {color:green;} div {color:blue;}} .cls3#id2{color: black;}";
|
||||
|
||||
let scope1 = ArbitraryScope::from_source(
|
||||
raffia::Syntax::Scss,
|
||||
OneSyntaxToRuleThemAll::Scss,
|
||||
syn::parse_str::<Ident>("lasifudm").unwrap(),
|
||||
source,
|
||||
)
|
||||
|
|
@ -86,7 +86,7 @@ mod test {
|
|||
let hash1 = ScopeHash::new(&scope1, &SabryHashConfig::default());
|
||||
|
||||
let scope2 = ArbitraryScope::from_source(
|
||||
raffia::Syntax::Scss,
|
||||
OneSyntaxToRuleThemAll::Scss,
|
||||
syn::parse_str::<Ident>("lasifudm").unwrap(),
|
||||
source,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use hash::ScopeHash;
|
|||
use raffia::Spanned;
|
||||
use regex::Regex;
|
||||
|
||||
use crate::{config::SabryHashConfig, syntax::StylesheetAdapter};
|
||||
use crate::{config::SabryHashConfig, syntax::{ostrta::OneSyntaxToRuleThemAll, StylesheetAdapter}};
|
||||
|
||||
pub mod hash;
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ pub struct ArbitraryScope<'s> {
|
|||
impl<'s> ArbitraryScope<'s> {
|
||||
/// Parse given source code with given syntax and assign given name
|
||||
pub fn from_source(
|
||||
syntax: raffia::Syntax,
|
||||
syntax: OneSyntaxToRuleThemAll,
|
||||
name: syn::Ident,
|
||||
source: &'s str,
|
||||
) -> Result<Self, ScopeError> {
|
||||
|
|
@ -375,7 +375,7 @@ mod test {
|
|||
|
||||
use crate::{
|
||||
config::SabryHashConfig,
|
||||
scoper::{hash::ScopeHash, HashedScope},
|
||||
scoper::{hash::ScopeHash, HashedScope}, syntax::ostrta::OneSyntaxToRuleThemAll,
|
||||
};
|
||||
|
||||
use super::ArbitraryScope;
|
||||
|
|
@ -415,7 +415,7 @@ mod test {
|
|||
}
|
||||
|
||||
let scope = ArbitraryScope::from_source(
|
||||
raffia::Syntax::Scss,
|
||||
OneSyntaxToRuleThemAll::Scss,
|
||||
syn::parse_str("scope1").unwrap(),
|
||||
code,
|
||||
)
|
||||
|
|
@ -463,7 +463,7 @@ mod test {
|
|||
|
||||
let hash_cfg = SabryHashConfig::default();
|
||||
let scope = ArbitraryScope::from_source(
|
||||
raffia::Syntax::Scss,
|
||||
OneSyntaxToRuleThemAll::Scss,
|
||||
syn::parse_str::<Ident>("scope2oiej").unwrap(),
|
||||
code,
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue