refactor QualifiedName into common
This commit is contained in:
parent
74e3a2e0dc
commit
769b7628d8
@ -104,3 +104,18 @@ impl ListSeparator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub(crate) struct QualifiedName {
|
||||
pub ident: String,
|
||||
pub namespace: Option<String>,
|
||||
}
|
||||
|
||||
impl Display for QualifiedName {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
if let Some(namespace) = &self.namespace {
|
||||
write!(f, "{}|", namespace)?;
|
||||
}
|
||||
f.write_str(&self.ident)
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ use peekmore::PeekMoreIterator;
|
||||
use codemap::Span;
|
||||
|
||||
use super::{Selector, SelectorKind};
|
||||
use crate::common::QuoteKind;
|
||||
use crate::common::{QualifiedName, QuoteKind};
|
||||
use crate::error::SassResult;
|
||||
use crate::scope::Scope;
|
||||
use crate::utils::{devour_whitespace, eat_ident, is_ident, parse_quoted_string};
|
||||
@ -21,21 +21,6 @@ pub(crate) struct Attribute {
|
||||
span: Span,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
struct QualifiedName {
|
||||
pub ident: String,
|
||||
pub namespace: Option<String>,
|
||||
}
|
||||
|
||||
impl Display for QualifiedName {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
if let Some(namespace) = &self.namespace {
|
||||
write!(f, "{}|", namespace)?;
|
||||
}
|
||||
f.write_str(&self.ident)
|
||||
}
|
||||
}
|
||||
|
||||
fn attribute_name<I: Iterator<Item = Token>>(
|
||||
toks: &mut PeekMoreIterator<I>,
|
||||
scope: &Scope,
|
||||
|
Loading…
x
Reference in New Issue
Block a user