fix(css/parser): Resolve some TODOs (#2572)

This commit is contained in:
Alexander Akait 2021-10-29 13:55:02 +03:00 committed by GitHub
parent 67c0d4cc37
commit 47f7f1ad4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 32 additions and 5 deletions

2
Cargo.lock generated
View File

@ -2552,7 +2552,7 @@ dependencies = [
[[package]] [[package]]
name = "swc_css_parser" name = "swc_css_parser"
version = "0.25.1" version = "0.25.2"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"lexical", "lexical",

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_css_parser" name = "swc_css_parser"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.25.1" version = "0.25.2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features] [features]

View File

@ -622,7 +622,10 @@ where
// EOF // EOF
// This is a parse error. Return the <string-token>. // This is a parse error. Return the <string-token>.
None => { None => {
return Err(ErrorKind::Eof); return Ok(Token::Str {
value: value.into(),
raw: raw.into(),
})
} }
} }
} }
@ -719,8 +722,10 @@ where
}); });
} }
None => { None => {
// TODO: This is a parse error. Return the <url-token>. return Ok(Token::Url {
return Err(ErrorKind::Eof); value: value.into(),
raw: raw.into(),
});
} }
_ => {} _ => {}
} }

View File

@ -0,0 +1,2 @@
div {
prop: "string

View File

@ -0,0 +1,2 @@
error: Expected "}"

View File

@ -0,0 +1,2 @@
div {
prop: 'string

View File

@ -0,0 +1,2 @@
error: Expected "}"

View File

@ -0,0 +1 @@
a { prop: url(foo.png

View File

@ -0,0 +1,2 @@
error: Expected "}"

View File

View File

@ -0,0 +1,9 @@
{
"type": "Stylesheet",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"rules": []
}

View File

@ -0,0 +1,2 @@
error: Stylesheet