From 3f929066c4933d2375c43e598304e4269ab52c47 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sat, 1 Feb 2020 19:24:37 -0500 Subject: [PATCH] Rename `eat_interpolation()` to `parse_interpolation()` --- src/selector.rs | 6 ++++-- src/style.rs | 4 ++-- src/utils.rs | 4 ++-- src/value.rs | 8 ++++---- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/selector.rs b/src/selector.rs index c6fafcf..215913c 100644 --- a/src/selector.rs +++ b/src/selector.rs @@ -1,6 +1,6 @@ use crate::common::{Scope, Symbol}; use crate::utils::{ - devour_whitespace, devour_whitespace_or_comment, eat_interpolation, IsWhitespace, + devour_whitespace, devour_whitespace_or_comment, parse_interpolation, IsWhitespace, }; use crate::{Token, TokenKind}; use std::fmt::{self, Display}; @@ -283,7 +283,9 @@ impl<'a> SelectorParser<'a> { TokenKind::Interpolation => { self.is_interpolated = true; let v = self.tokens_to_selectors( - &mut eat_interpolation(tokens, self.scope).into_iter().peekable(), + &mut parse_interpolation(tokens, self.scope) + .into_iter() + .peekable(), ); self.is_interpolated = false; v diff --git a/src/style.rs b/src/style.rs index 6ac8ee5..6259d0f 100644 --- a/src/style.rs +++ b/src/style.rs @@ -1,5 +1,5 @@ use crate::common::{Scope, Symbol}; -use crate::utils::{devour_whitespace_or_comment, eat_interpolation}; +use crate::utils::{devour_whitespace_or_comment, parse_interpolation}; use crate::value::Value; use crate::{Token, TokenKind}; use std::fmt::{self, Display}; @@ -47,7 +47,7 @@ impl<'a> StyleParser<'a> { TokenKind::Whitespace(_) | TokenKind::MultilineComment(_) => continue, TokenKind::Ident(ref s) => property.push_str(s), TokenKind::Interpolation => property.push_str( - &eat_interpolation(&mut self.tokens, self.scope) + &parse_interpolation(&mut self.tokens, self.scope) .iter() .map(|x| x.kind.to_string()) .collect::(), diff --git a/src/utils.rs b/src/utils.rs index 8d63852..674e176 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -40,7 +40,7 @@ pub(crate) fn devour_whitespace_or_comment, W: IsWhitespac found_whitespace } -pub(crate) fn eat_interpolation>( +pub(crate) fn parse_interpolation>( tokens: &mut I, scope: &Scope, ) -> Vec { @@ -57,7 +57,7 @@ pub(crate) fn eat_interpolation>( TokenKind::Variable(ref v) => val.extend( Lexer::new(&scope.vars.get(v).unwrap().to_string()).collect::>(), ), - TokenKind::Interpolation => val.extend(eat_interpolation(tokens, scope)), + TokenKind::Interpolation => val.extend(parse_interpolation(tokens, scope)), _ => val.push(tok), } } diff --git a/src/value.rs b/src/value.rs index a30d9ec..5575b1d 100644 --- a/src/value.rs +++ b/src/value.rs @@ -8,7 +8,7 @@ use crate::builtin::GLOBAL_FUNCTIONS; use crate::color::Color; use crate::common::{Keyword, Op, QuoteKind, Scope, Symbol}; use crate::units::Unit; -use crate::utils::{devour_whitespace_or_comment, eat_interpolation}; +use crate::utils::{devour_whitespace_or_comment, parse_interpolation}; use crate::{Token, TokenKind}; #[derive(Debug, Clone, Copy, PartialEq, Eq)] @@ -245,7 +245,7 @@ impl Value { TokenKind::Interpolation => { toks.next(); s.push_str( - &eat_interpolation(toks, scope) + &parse_interpolation(toks, scope) .iter() .map(|x| x.kind.to_string()) .collect::(), @@ -308,7 +308,7 @@ impl Value { Some(scope.vars.get(v).expect("expected variable").clone()) } TokenKind::Interpolation => { - let mut s = eat_interpolation(toks, scope) + let mut s = parse_interpolation(toks, scope) .iter() .map(|x| x.kind.to_string()) .collect::(); @@ -317,7 +317,7 @@ impl Value { TokenKind::Interpolation => { toks.next(); s.push_str( - &eat_interpolation(toks, scope) + &parse_interpolation(toks, scope) .iter() .map(|x| x.kind.to_string()) .collect::(),