Skip to content

Commit d8936ad

Browse files
authoredDec 7, 2022
fix(css/parser): Avoid skipping extra whitespaces (#6592)
**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.
1 parent 3abef05 commit d8936ad

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed
 

‎crates/swc_css_parser/src/parser/macros.rs

-26
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,6 @@ macro_rules! tok_pat {
4343
};
4444
}
4545

46-
macro_rules! can_ignore_ws {
47-
("{") => {
48-
true
49-
};
50-
("}") => {
51-
true
52-
};
53-
("(") => {
54-
true
55-
};
56-
(")") => {
57-
true
58-
};
59-
(":") => {
60-
true
61-
};
62-
63-
($tt:tt) => {
64-
false
65-
};
66-
}
67-
6846
macro_rules! cur {
6947
($parser:expr) => {
7048
match $parser.input.cur() {
@@ -182,10 +160,6 @@ macro_rules! eat {
182160

183161
macro_rules! expect {
184162
($parser:expr, $tt:tt) => {
185-
if can_ignore_ws!($tt) {
186-
$parser.input.skip_ws()
187-
}
188-
189163
if !eat!($parser, $tt) {
190164
let span = $parser.input.cur_span();
191165
return Err(crate::error::Error::new(

0 commit comments

Comments
 (0)
Please sign in to comment.