replace eat terminology with parse

This commit is contained in:
Connor Skees 2020-07-07 12:02:59 -04:00
parent 6faf30795e
commit 35da511860
2 changed files with 9 additions and 9 deletions

View File

@ -15,7 +15,7 @@ use crate::{
use super::super::Parser;
impl<'a> Parser<'a> {
pub(super) fn eat_calc_args(&mut self, buf: &mut String) -> SassResult<()> {
pub(super) fn parse_calc_args(&mut self, buf: &mut String) -> SassResult<()> {
buf.reserve(2);
buf.push('(');
let mut nesting = 0;
@ -54,7 +54,7 @@ impl<'a> Parser<'a> {
Ok(())
}
pub(super) fn eat_progid(&mut self) -> SassResult<String> {
pub(super) fn parse_progid(&mut self) -> SassResult<String> {
let mut string = String::new();
let mut span = self.toks.peek().unwrap().pos();
while let Some(tok) = self.toks.next() {
@ -64,7 +64,7 @@ impl<'a> Parser<'a> {
string.push(tok.kind);
}
'(' => {
self.eat_calc_args(&mut string)?;
self.parse_calc_args(&mut string)?;
break;
}
_ => return Err(("expected \"(\".", span).into()),
@ -73,7 +73,7 @@ impl<'a> Parser<'a> {
Ok(string)
}
pub(super) fn try_eat_url(&mut self) -> SassResult<Option<String>> {
pub(super) fn try_parse_url(&mut self) -> SassResult<Option<String>> {
let mut buf = String::from("url(");
peek_whitespace(self.toks);
while let Some(tok) = self.toks.peek() {

View File

@ -70,7 +70,7 @@ impl<'a> Parser<'a> {
space_separated.push(v.span(val.span))
}
IntermediateValue::Op(op) => {
iter.eat_op(
iter.parse_op(
Spanned {
node: op,
span: val.span,
@ -208,7 +208,7 @@ impl<'a> Parser<'a> {
s = lower;
self.toks.next();
s.push(':');
s.push_str(&self.eat_progid()?);
s.push_str(&self.parse_progid()?);
return Ok(Spanned {
node: IntermediateValue::Value(HigherIntermediateValue::Literal(Value::String(
s,
@ -273,9 +273,9 @@ impl<'a> Parser<'a> {
match lower.as_str() {
"calc" | "element" | "expression" => {
s = lower;
self.eat_calc_args(&mut s)?;
self.parse_calc_args(&mut s)?;
}
"url" => match self.try_eat_url()? {
"url" => match self.try_parse_url()? {
Some(val) => s = val,
None => s.push_str(&self.parse_call_args()?.to_css_string(self)?),
},
@ -742,7 +742,7 @@ impl<'a, 'b: 'a> IntermediateValueIterator<'a, 'b> {
found_whitespace
}
fn eat_op(
fn parse_op(
&mut self,
op: Spanned<Op>,
space_separated: &mut Vec<Spanned<HigherIntermediateValue>>,