Skip to content

Commit

Permalink
Css don't have line comments
Browse files Browse the repository at this point in the history
I.e. `//` does not mark that the rest of the line is a comment in css.
  • Loading branch information
kaj committed Sep 22, 2024
1 parent 911df43 commit b66d263
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions rsass/src/parser/css/media.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::util::{ignore_comments, opt_spacelike, spacelike};
use super::{strings, values, PResult, Span};
use super::super::util::ignore_comments;
use super::{opt_spacelike, spacelike, strings, values, PResult, Span};
use crate::css::{MediaArgs, Value};
use crate::value::{ListSeparator, Operator};
use nom::branch::alt;
Expand Down
10 changes: 9 additions & 1 deletion rsass/src/parser/css/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ mod rule;
pub(crate) mod strings;
mod values;

use super::util::{opt_spacelike, spacelike};
use super::{PResult, Span};
use crate::css::{AtRule, Comment, Import, Item, MediaRule, Value};
use nom::branch::alt;
use nom::bytes::complete::{is_not, tag, tag_no_case};
use nom::character::complete::{multispace0, multispace1};
use nom::combinator::{
all_consuming, into, map, map_res, not, opt, peek, recognize,
};
Expand Down Expand Up @@ -146,3 +146,11 @@ pub fn comment2(input: Span) -> PResult<String> {
tag("*/"),
)(input)
}

pub fn spacelike(input: Span) -> PResult<()> {
map(multispace1, |_| ())(input)
}

pub fn opt_spacelike(input: Span) -> PResult<()> {
map(multispace0, |_| ())(input)
}
2 changes: 1 addition & 1 deletion rsass/src/parser/css/rule.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::util::opt_spacelike;
use super::super::{PResult, Span};
use super::opt_spacelike;
use super::strings::custom_value;
use super::{comment, import2, strings, values};
use crate::css::parser::selector_set;
Expand Down
2 changes: 1 addition & 1 deletion rsass/src/parser/css/strings.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::super::{input_to_str, input_to_string, PResult, Span};
use super::opt_spacelike;
use crate::css::CssString;
use crate::parser::util::opt_spacelike;
use crate::value::Quotes;
use nom::branch::alt;
use nom::bytes::complete::{is_not, tag, take};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn runner() -> crate::TestRunner {
}

#[test]
#[ignore] // missing error
#[ignore] // wrong error
fn test() {
assert_eq!(
runner().err("@use \'plain\'\n"),
Expand Down

0 comments on commit b66d263

Please sign in to comment.