Skip to content

Commit

Permalink
fix(css/parser): Avoid skipping extra whitespaces (#6592)
Browse files Browse the repository at this point in the history
**Description:**

 - Avoid skipping whitespaces in `[`/`(`/`{` because it is invalid. Whitespaces can be allowed and can be disallowed based on context, we can't apply this logic to any CSS context.
 - Also, we already skip whitespaces where it is necessary.
 - This also avoids extra actions.
  • Loading branch information
alexander-akait committed Dec 7, 2022
1 parent 3abef05 commit d8936ad
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions crates/swc_css_parser/src/parser/macros.rs
Expand Up @@ -43,28 +43,6 @@ macro_rules! tok_pat {
};
}

macro_rules! can_ignore_ws {
("{") => {
true
};
("}") => {
true
};
("(") => {
true
};
(")") => {
true
};
(":") => {
true
};

($tt:tt) => {
false
};
}

macro_rules! cur {
($parser:expr) => {
match $parser.input.cur() {
Expand Down Expand Up @@ -182,10 +160,6 @@ macro_rules! eat {

macro_rules! expect {
($parser:expr, $tt:tt) => {
if can_ignore_ws!($tt) {
$parser.input.skip_ws()
}

if !eat!($parser, $tt) {
let span = $parser.input.cur_span();
return Err(crate::error::Error::new(
Expand Down

0 comments on commit d8936ad

Please sign in to comment.