refactor QualifiedName into common

This commit is contained in:
ConnorSkees 2020-04-26 23:52:32 -04:00
parent 74e3a2e0dc
commit 769b7628d8
2 changed files with 16 additions and 16 deletions

View File

@ -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)
}
}

View File

@ -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,