make read_until_newline
parser method public
This commit is contained in:
parent
5902ebd642
commit
005f0e52e8
@ -459,7 +459,13 @@ impl<'a> Parser<'a> {
|
|||||||
found_whitespace
|
found_whitespace
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_until_newline(&mut self) {
|
/// Eat tokens until a newline
|
||||||
|
///
|
||||||
|
/// This exists largely to eat silent comments, "//"
|
||||||
|
/// We only have to check for \n as the lexing step normalizes all newline characters
|
||||||
|
///
|
||||||
|
/// The newline is consumed
|
||||||
|
pub fn read_until_newline(&mut self) {
|
||||||
while let Some(tok) = self.toks.next() {
|
while let Some(tok) = self.toks.next() {
|
||||||
if tok.kind == '\n' {
|
if tok.kind == '\n' {
|
||||||
break;
|
break;
|
||||||
|
@ -3,10 +3,7 @@ use codemap::Spanned;
|
|||||||
use crate::{
|
use crate::{
|
||||||
common::Identifier,
|
common::Identifier,
|
||||||
error::SassResult,
|
error::SassResult,
|
||||||
utils::{
|
utils::{peek_ident_no_interpolation, read_until_closing_paren, read_until_closing_quote},
|
||||||
peek_ident_no_interpolation, read_until_closing_paren, read_until_closing_quote,
|
|
||||||
read_until_newline,
|
|
||||||
},
|
|
||||||
value::Value,
|
value::Value,
|
||||||
Token,
|
Token,
|
||||||
};
|
};
|
||||||
@ -124,7 +121,7 @@ impl<'a> Parser<'a> {
|
|||||||
'/' => {
|
'/' => {
|
||||||
let next = self.toks.next().unwrap();
|
let next = self.toks.next().unwrap();
|
||||||
match self.toks.peek() {
|
match self.toks.peek() {
|
||||||
Some(Token { kind: '/', .. }) => read_until_newline(self.toks),
|
Some(Token { kind: '/', .. }) => self.read_until_newline(),
|
||||||
Some(..) | None => val_toks.push(next),
|
Some(..) | None => val_toks.push(next),
|
||||||
};
|
};
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user