replace eat
terminology with parse
This commit is contained in:
parent
6faf30795e
commit
35da511860
@ -15,7 +15,7 @@ use crate::{
|
|||||||
use super::super::Parser;
|
use super::super::Parser;
|
||||||
|
|
||||||
impl<'a> Parser<'a> {
|
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.reserve(2);
|
||||||
buf.push('(');
|
buf.push('(');
|
||||||
let mut nesting = 0;
|
let mut nesting = 0;
|
||||||
@ -54,7 +54,7 @@ impl<'a> Parser<'a> {
|
|||||||
Ok(())
|
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 string = String::new();
|
||||||
let mut span = self.toks.peek().unwrap().pos();
|
let mut span = self.toks.peek().unwrap().pos();
|
||||||
while let Some(tok) = self.toks.next() {
|
while let Some(tok) = self.toks.next() {
|
||||||
@ -64,7 +64,7 @@ impl<'a> Parser<'a> {
|
|||||||
string.push(tok.kind);
|
string.push(tok.kind);
|
||||||
}
|
}
|
||||||
'(' => {
|
'(' => {
|
||||||
self.eat_calc_args(&mut string)?;
|
self.parse_calc_args(&mut string)?;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_ => return Err(("expected \"(\".", span).into()),
|
_ => return Err(("expected \"(\".", span).into()),
|
||||||
@ -73,7 +73,7 @@ impl<'a> Parser<'a> {
|
|||||||
Ok(string)
|
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(");
|
let mut buf = String::from("url(");
|
||||||
peek_whitespace(self.toks);
|
peek_whitespace(self.toks);
|
||||||
while let Some(tok) = self.toks.peek() {
|
while let Some(tok) = self.toks.peek() {
|
||||||
|
@ -70,7 +70,7 @@ impl<'a> Parser<'a> {
|
|||||||
space_separated.push(v.span(val.span))
|
space_separated.push(v.span(val.span))
|
||||||
}
|
}
|
||||||
IntermediateValue::Op(op) => {
|
IntermediateValue::Op(op) => {
|
||||||
iter.eat_op(
|
iter.parse_op(
|
||||||
Spanned {
|
Spanned {
|
||||||
node: op,
|
node: op,
|
||||||
span: val.span,
|
span: val.span,
|
||||||
@ -208,7 +208,7 @@ impl<'a> Parser<'a> {
|
|||||||
s = lower;
|
s = lower;
|
||||||
self.toks.next();
|
self.toks.next();
|
||||||
s.push(':');
|
s.push(':');
|
||||||
s.push_str(&self.eat_progid()?);
|
s.push_str(&self.parse_progid()?);
|
||||||
return Ok(Spanned {
|
return Ok(Spanned {
|
||||||
node: IntermediateValue::Value(HigherIntermediateValue::Literal(Value::String(
|
node: IntermediateValue::Value(HigherIntermediateValue::Literal(Value::String(
|
||||||
s,
|
s,
|
||||||
@ -273,9 +273,9 @@ impl<'a> Parser<'a> {
|
|||||||
match lower.as_str() {
|
match lower.as_str() {
|
||||||
"calc" | "element" | "expression" => {
|
"calc" | "element" | "expression" => {
|
||||||
s = lower;
|
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,
|
Some(val) => s = val,
|
||||||
None => s.push_str(&self.parse_call_args()?.to_css_string(self)?),
|
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
|
found_whitespace
|
||||||
}
|
}
|
||||||
|
|
||||||
fn eat_op(
|
fn parse_op(
|
||||||
&mut self,
|
&mut self,
|
||||||
op: Spanned<Op>,
|
op: Spanned<Op>,
|
||||||
space_separated: &mut Vec<Spanned<HigherIntermediateValue>>,
|
space_separated: &mut Vec<Spanned<HigherIntermediateValue>>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user