fix(css/ast): Fix delimiter token (#2415)

This commit is contained in:
Alexander Akait 2021-10-14 07:22:51 +03:00 committed by GitHub
parent a25d67bfbf
commit e2e4f2f64f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 1010 additions and 127 deletions

14
Cargo.lock generated
View File

@ -2500,7 +2500,7 @@ dependencies = [
[[package]]
name = "swc_css"
version = "0.14.0"
version = "0.15.0"
dependencies = [
"swc_css_ast",
"swc_css_codegen",
@ -2511,7 +2511,7 @@ dependencies = [
[[package]]
name = "swc_css_ast"
version = "0.13.0"
version = "0.14.0"
dependencies = [
"is-macro",
"serde",
@ -2522,7 +2522,7 @@ dependencies = [
[[package]]
name = "swc_css_codegen"
version = "0.12.0"
version = "0.13.0"
dependencies = [
"auto_impl",
"bitflags",
@ -2548,7 +2548,7 @@ dependencies = [
[[package]]
name = "swc_css_parser"
version = "0.14.1"
version = "0.15.0"
dependencies = [
"bitflags",
"lexical",
@ -2564,7 +2564,7 @@ dependencies = [
[[package]]
name = "swc_css_utils"
version = "0.10.0"
version = "0.11.0"
dependencies = [
"swc_atoms 0.2.8",
"swc_common",
@ -2574,7 +2574,7 @@ dependencies = [
[[package]]
name = "swc_css_visit"
version = "0.12.0"
version = "0.13.0"
dependencies = [
"swc_atoms 0.2.8",
"swc_common",
@ -3140,7 +3140,7 @@ dependencies = [
[[package]]
name = "swc_stylis"
version = "0.11.0"
version = "0.12.0"
dependencies = [
"swc_atoms 0.2.8",
"swc_common",

View File

@ -6,11 +6,11 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_css"
repository = "https://github.com/swc-project/swc.git"
version = "0.14.0"
version = "0.15.0"
[dependencies]
swc_css_ast = {version = "0.13.0", path = "./ast"}
swc_css_codegen = {version = "0.12.0", path = "./codegen"}
swc_css_parser = {version = "0.14.0", path = "./parser"}
swc_css_utils = {version = "0.10.0", path = "./utils/"}
swc_css_visit = {version = "0.12.0", path = "./visit"}
swc_css_ast = {version = "0.14.0", path = "./ast"}
swc_css_codegen = {version = "0.13.0", path = "./codegen"}
swc_css_parser = {version = "0.15.0", path = "./parser"}
swc_css_utils = {version = "0.11.0", path = "./utils/"}
swc_css_visit = {version = "0.13.0", path = "./visit"}

View File

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

View File

@ -86,9 +86,6 @@ pub enum Token {
/// `*`
Asterisk,
/// `.`
Dot,
/// `#`
Hash {
is_id: bool,
@ -123,12 +120,6 @@ pub enum Token {
/// `=`
Equals,
/// `+`
Plus,
/// `-`
Minus,
/// `/`
Div,

View File

@ -6,17 +6,17 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_css_codegen"
repository = "https://github.com/swc-project/swc.git"
version = "0.12.0"
version = "0.13.0"
[dependencies]
auto_impl = "0.4.1"
bitflags = "1.3.2"
swc_atoms = {version = "0.2.7", path = "../../atoms"}
swc_common = {version = "0.13.0", path = "../../common"}
swc_css_ast = {version = "0.13.0", path = "../ast/"}
swc_css_ast = {version = "0.14.0", path = "../ast/"}
swc_css_codegen_macros = {version = "0.2.0", path = "macros/"}
[dev-dependencies]
swc_css_parser = {version = "0.14.0", path = "../parser"}
swc_css_visit = {version = "0.12.0", path = "../visit"}
swc_css_parser = {version = "0.15.0", path = "../parser"}
swc_css_visit = {version = "0.13.0", path = "../visit"}
testing = {version = "0.14.0", path = "../../testing"}

View File

@ -536,9 +536,6 @@ where
Token::Asterisk => {
punct!(self, span, "*");
}
Token::Dot => {
punct!(self, span, ".");
}
Token::Hash { value, .. } => {
punct!(self, "#");
self.wr.write_ident(Some(span), &value, true)?;
@ -570,12 +567,6 @@ where
Token::Equals => {
punct!(self, span, "=");
}
Token::Plus => {
punct!(self, span, "+");
}
Token::Minus => {
punct!(self, span, "-");
}
Token::Div => {
punct!(self, span, "/");
}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_css_parser"
repository = "https://github.com/swc-project/swc.git"
version = "0.14.1"
version = "0.15.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
@ -17,11 +17,11 @@ bitflags = "1.2.1"
lexical = "5.2.2"
swc_atoms = {version = "0.2.7", path = "../../atoms"}
swc_common = {version = "0.13.0", path = "../../common"}
swc_css_ast = {version = "0.13.0", path = "../ast"}
swc_css_ast = {version = "0.14.0", path = "../ast"}
unicode-xid = "0.2.2"
[dev-dependencies]
serde = "1.0.127"
serde_json = "1.0.66"
swc_css_visit = {version = "0.12.0", path = "../visit"}
swc_css_visit = {version = "0.13.0", path = "../visit"}
testing = {version = "0.14.0", path = "../../testing"}

View File

@ -163,17 +163,61 @@ where
try_delim!(b')', ")");
if self.input.is_byte(b'+') {
return self.read_plus();
let pos = self.input.cur_pos();
let c = self.input.cur().unwrap();
self.input.bump();
if self.would_start_number()? {
self.input.reset_to(pos);
return self.read_number();
}
return Ok(Token::Delim { value: c });
}
try_delim!(b',', ",");
if self.input.is_byte(b'-') {
return self.read_minus();
let pos = self.input.cur_pos();
let c = self.input.cur().unwrap();
self.input.bump();
if self.would_start_number()? {
self.input.reset_to(pos);
return self.read_number();
} else if self.input.cur() == Some('-') && self.input.peek() == Some('>') {
self.input.bump();
self.input.bump();
return Ok(Token::CDC);
} else if self.would_start_ident()? {
self.input.reset_to(pos);
return self
.read_name()
.map(|(value, raw)| Token::Ident { value, raw });
}
return Ok(Token::Delim { value: c });
}
if self.input.is_byte(b'.') {
return self.read_dot();
let pos = self.input.cur_pos();
let c = self.input.cur().unwrap();
self.input.bump();
if self.would_start_number()? {
self.input.reset_to(pos);
return self.read_number();
}
return Ok(Token::Delim { value: c });
}
try_delim!(b':', ":");
@ -254,6 +298,47 @@ where
return Ok(Token::Delim { value: c });
}
fn would_start_number(&mut self) -> LexResult<bool> {
let first = self.input.cur();
if first.is_none() {
return Ok(false);
}
match first {
Some('+') | Some('-') => {
if let Some(second) = self.input.peek() {
return match second {
second if second.is_digit(10) => Ok(true),
'.' => {
if let Some(third) = self.input.peek_ahead() {
if third.is_digit(10) {
return Ok(true);
}
}
Ok(false)
}
_ => Ok(false),
};
}
Ok(false)
}
Some('.') => {
if let Some(second) = self.input.peek() {
if second.is_digit(10) {
return Ok(true);
}
}
Ok(false)
}
Some(first) if first.is_digit(10) => Ok(true),
_ => Ok(false),
}
}
fn is_valid_escape(&mut self) -> LexResult<bool> {
if self.input.cur() != Some('\\') {
return Ok(false);
@ -524,28 +609,6 @@ where
Ok((c, raw))
}
fn read_dot(&mut self) -> LexResult<Token> {
if let Some(next) = self.input.peek() {
if next == '.' || next.is_digit(10) {
return self.read_number();
}
}
self.input.bump();
Ok(tok!("."))
}
fn read_plus(&mut self) -> LexResult<Token> {
if let Some(next) = self.input.peek() {
if next == '.' || next.is_digit(10) {
return self.read_number();
}
}
self.input.bump();
Ok(tok!("+"))
}
fn read_at_keyword(&mut self) -> LexResult<Token> {
let name = self.read_name()?;
@ -555,32 +618,6 @@ where
})
}
fn read_minus(&mut self) -> LexResult<Token> {
assert_eq!(self.input.cur(), Some('-'));
match self.input.peek() {
Some('0'..='9') | Some('.') => return self.read_number(),
_ => {}
}
if self.input.peek() == Some('-') && self.input.peek_ahead() == Some('>') {
self.input.bump();
self.input.bump();
self.input.bump();
return Ok(Token::CDC);
}
if self.would_start_ident()? {
return self
.read_name()
.map(|(value, raw)| Token::Ident { value, raw });
}
self.input.bump();
Ok(tok!("-"))
}
/// Ported from `wouldStartIdentifier` of `esbuild`.
fn would_start_ident(&mut self) -> LexResult<bool> {
match self.input.cur() {
@ -714,14 +751,6 @@ where
}
}
#[inline(always)]
fn is_digit(c: char) -> bool {
match c {
'0'..='9' => true,
_ => false,
}
}
#[inline(always)]
fn is_uppercase_letter(c: char) -> bool {
match c {
@ -759,7 +788,7 @@ pub(crate) fn is_name_start(c: char) -> bool {
pub(crate) fn is_name_continue(c: char) -> bool {
is_name_start(c)
|| match c {
c if is_digit(c) || c == '-' => true,
c if c.is_digit(10) || c == '-' => true,
_ => false,
}
}

View File

@ -60,10 +60,6 @@ macro_rules! tok {
swc_css_ast::Token::Asterisk
};
(".") => {
swc_css_ast::Token::Dot
};
("#") => {
swc_css_ast::Token::Hash
};
@ -105,11 +101,15 @@ macro_rules! tok {
};
("+") => {
swc_css_ast::Token::Plus
swc_css_ast::Token::Delim { value: '+', .. }
};
("-") => {
swc_css_ast::Token::Minus
swc_css_ast::Token::Delim { value: '-', .. }
};
(".") => {
swc_css_ast::Token::Delim { value: '.', .. }
};
("/") => {

View File

@ -289,7 +289,6 @@ where
fn parse_class_selector(&mut self) -> PResult<ClassSelector> {
let start = self.input.cur_span()?.lo;
assert_eq!(*cur!(self), tok!("."));
bump!(self);
let text = self.parse_selector_text()?;

View File

@ -0,0 +1,10 @@
div {
property: 10;
property: +10;
property: -10;
property: 0.1;
property: +0.1;
property: -0.1;
property: -.1;
property: +.1;
}

View File

@ -0,0 +1,310 @@
{
"type": "Stylesheet",
"span": {
"start": 0,
"end": 161,
"ctxt": 0
},
"rules": [
{
"type": "StyleRule",
"span": {
"start": 0,
"end": 160,
"ctxt": 0
},
"selectors": [
{
"type": "ComplexSelector",
"span": {
"start": 0,
"end": 3,
"ctxt": 0
},
"selectors": [
{
"type": "CompoundSelector",
"span": {
"start": 0,
"end": 3,
"ctxt": 0
},
"hasNestPrefix": false,
"combinator": null,
"typeSelector": {
"type": "NamespacedName",
"span": {
"start": 0,
"end": 3,
"ctxt": 0
},
"prefix": null,
"name": {
"type": "Text",
"span": {
"start": 0,
"end": 3,
"ctxt": 0
},
"value": "div",
"raw": "div"
}
},
"subclassSelectors": []
}
]
}
],
"block": {
"type": "DeclBlock",
"span": {
"start": 4,
"end": 160,
"ctxt": 0
},
"items": [
{
"type": "Property",
"span": {
"start": 10,
"end": 22,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 10,
"end": 18,
"ctxt": 0
},
"value": "property",
"raw": "property"
},
"values": [
{
"type": "Number",
"span": {
"start": 20,
"end": 22,
"ctxt": 0
},
"value": 10.0
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 28,
"end": 41,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 28,
"end": 36,
"ctxt": 0
},
"value": "property",
"raw": "property"
},
"values": [
{
"type": "Number",
"span": {
"start": 38,
"end": 41,
"ctxt": 0
},
"value": 10.0
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 47,
"end": 60,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 47,
"end": 55,
"ctxt": 0
},
"value": "property",
"raw": "property"
},
"values": [
{
"type": "Number",
"span": {
"start": 57,
"end": 60,
"ctxt": 0
},
"value": -10.0
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 66,
"end": 79,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 66,
"end": 74,
"ctxt": 0
},
"value": "property",
"raw": "property"
},
"values": [
{
"type": "Number",
"span": {
"start": 76,
"end": 79,
"ctxt": 0
},
"value": 0.1
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 85,
"end": 99,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 85,
"end": 93,
"ctxt": 0
},
"value": "property",
"raw": "property"
},
"values": [
{
"type": "Number",
"span": {
"start": 95,
"end": 99,
"ctxt": 0
},
"value": 0.1
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 105,
"end": 119,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 105,
"end": 113,
"ctxt": 0
},
"value": "property",
"raw": "property"
},
"values": [
{
"type": "Number",
"span": {
"start": 115,
"end": 119,
"ctxt": 0
},
"value": -0.1
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 125,
"end": 138,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 125,
"end": 133,
"ctxt": 0
},
"value": "property",
"raw": "property"
},
"values": [
{
"type": "Number",
"span": {
"start": 135,
"end": 138,
"ctxt": 0
},
"value": -0.1
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 144,
"end": 157,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 144,
"end": 152,
"ctxt": 0
},
"value": "property",
"raw": "property"
},
"values": [
{
"type": "Number",
"span": {
"start": 154,
"end": 157,
"ctxt": 0
},
"value": 0.1
}
],
"important": null
}
]
}
}
]
}

View File

@ -0,0 +1,265 @@
error: Stylesheet
--> $DIR/tests/fixture/number/input.css:1:1
|
1 | / div {
2 | | property: 10;
3 | | property: +10;
4 | | property: -10;
... |
9 | | property: +.1;
10 | | }
| |__^
error: Rule
--> $DIR/tests/fixture/number/input.css:1:1
|
1 | / div {
2 | | property: 10;
3 | | property: +10;
4 | | property: -10;
... |
9 | | property: +.1;
10 | | }
| |_^
error: StyleRule
--> $DIR/tests/fixture/number/input.css:1:1
|
1 | / div {
2 | | property: 10;
3 | | property: +10;
4 | | property: -10;
... |
9 | | property: +.1;
10 | | }
| |_^
error: ComplexSelector
--> $DIR/tests/fixture/number/input.css:1:1
|
1 | div {
| ^^^
error: CompoundSelector
--> $DIR/tests/fixture/number/input.css:1:1
|
1 | div {
| ^^^
error: NamespacedName
--> $DIR/tests/fixture/number/input.css:1:1
|
1 | div {
| ^^^
error: Text
--> $DIR/tests/fixture/number/input.css:1:1
|
1 | div {
| ^^^
error: DeclBlock
--> $DIR/tests/fixture/number/input.css:1:5
|
1 | div {
| _____^
2 | | property: 10;
3 | | property: +10;
4 | | property: -10;
... |
9 | | property: +.1;
10 | | }
| |_^
error: Property
--> $DIR/tests/fixture/number/input.css:2:5
|
2 | property: 10;
| ^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/number/input.css:2:5
|
2 | property: 10;
| ^^^^^^^^
error: Value
--> $DIR/tests/fixture/number/input.css:2:15
|
2 | property: 10;
| ^^
error: Num
--> $DIR/tests/fixture/number/input.css:2:15
|
2 | property: 10;
| ^^
error: Property
--> $DIR/tests/fixture/number/input.css:3:5
|
3 | property: +10;
| ^^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/number/input.css:3:5
|
3 | property: +10;
| ^^^^^^^^
error: Value
--> $DIR/tests/fixture/number/input.css:3:15
|
3 | property: +10;
| ^^^
error: Num
--> $DIR/tests/fixture/number/input.css:3:15
|
3 | property: +10;
| ^^^
error: Property
--> $DIR/tests/fixture/number/input.css:4:5
|
4 | property: -10;
| ^^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/number/input.css:4:5
|
4 | property: -10;
| ^^^^^^^^
error: Value
--> $DIR/tests/fixture/number/input.css:4:15
|
4 | property: -10;
| ^^^
error: Num
--> $DIR/tests/fixture/number/input.css:4:15
|
4 | property: -10;
| ^^^
error: Property
--> $DIR/tests/fixture/number/input.css:5:5
|
5 | property: 0.1;
| ^^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/number/input.css:5:5
|
5 | property: 0.1;
| ^^^^^^^^
error: Value
--> $DIR/tests/fixture/number/input.css:5:15
|
5 | property: 0.1;
| ^^^
error: Num
--> $DIR/tests/fixture/number/input.css:5:15
|
5 | property: 0.1;
| ^^^
error: Property
--> $DIR/tests/fixture/number/input.css:6:5
|
6 | property: +0.1;
| ^^^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/number/input.css:6:5
|
6 | property: +0.1;
| ^^^^^^^^
error: Value
--> $DIR/tests/fixture/number/input.css:6:15
|
6 | property: +0.1;
| ^^^^
error: Num
--> $DIR/tests/fixture/number/input.css:6:15
|
6 | property: +0.1;
| ^^^^
error: Property
--> $DIR/tests/fixture/number/input.css:7:5
|
7 | property: -0.1;
| ^^^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/number/input.css:7:5
|
7 | property: -0.1;
| ^^^^^^^^
error: Value
--> $DIR/tests/fixture/number/input.css:7:15
|
7 | property: -0.1;
| ^^^^
error: Num
--> $DIR/tests/fixture/number/input.css:7:15
|
7 | property: -0.1;
| ^^^^
error: Property
--> $DIR/tests/fixture/number/input.css:8:5
|
8 | property: -.1;
| ^^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/number/input.css:8:5
|
8 | property: -.1;
| ^^^^^^^^
error: Value
--> $DIR/tests/fixture/number/input.css:8:15
|
8 | property: -.1;
| ^^^
error: Num
--> $DIR/tests/fixture/number/input.css:8:15
|
8 | property: -.1;
| ^^^
error: Property
--> $DIR/tests/fixture/number/input.css:9:5
|
9 | property: +.1;
| ^^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/number/input.css:9:5
|
9 | property: +.1;
| ^^^^^^^^
error: Value
--> $DIR/tests/fixture/number/input.css:9:15
|
9 | property: +.1;
| ^^^
error: Num
--> $DIR/tests/fixture/number/input.css:9:15
|
9 | property: +.1;
| ^^^

View File

@ -65,7 +65,11 @@
"end": 9,
"ctxt": 0
},
"token": "Dot"
"token": {
"Delim": {
"value": "."
}
}
},
{
"span": {
@ -94,7 +98,11 @@
"end": 14,
"ctxt": 0
},
"token": "Plus"
"token": {
"Delim": {
"value": "+"
}
}
},
{
"span": {

View File

@ -58,7 +58,7 @@ error: Tokens
1 | :global(.foo + a) {
| ^^^^^^^^
error: Dot
error: Delim { value: '.' }
--> $DIR/tests/fixture/styled-jsx/selector/1/input.css:1:9
|
1 | :global(.foo + a) {
@ -76,7 +76,7 @@ error: WhiteSpace
1 | :global(.foo + a) {
| ^
error: Plus
error: Delim { value: '+' }
--> $DIR/tests/fixture/styled-jsx/selector/1/input.css:1:14
|
1 | :global(.foo + a) {

View File

@ -137,7 +137,11 @@
"end": 20,
"ctxt": 0
},
"token": "Dot"
"token": {
"Delim": {
"value": "."
}
}
},
{
"span": {

View File

@ -100,7 +100,7 @@ error: LParen
1 | p :global(span:not(.test)) {
| ^
error: Dot
error: Delim { value: '.' }
--> $DIR/tests/fixture/styled-jsx/selector/2/input.css:1:20
|
1 | p :global(span:not(.test)) {

View File

@ -0,0 +1,3 @@
a {
prop: -;
}

View File

@ -0,0 +1,121 @@
{
"type": "Stylesheet",
"span": {
"start": 0,
"end": 19,
"ctxt": 0
},
"rules": [
{
"type": "StyleRule",
"span": {
"start": 0,
"end": 18,
"ctxt": 0
},
"selectors": [
{
"type": "ComplexSelector",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"selectors": [
{
"type": "CompoundSelector",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"hasNestPrefix": false,
"combinator": null,
"typeSelector": {
"type": "NamespacedName",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"prefix": null,
"name": {
"type": "Text",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
},
"subclassSelectors": []
}
]
}
],
"block": {
"type": "DeclBlock",
"span": {
"start": 2,
"end": 18,
"ctxt": 0
},
"items": [
{
"type": "Tokens",
"span": {
"start": 8,
"end": 15,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 8,
"end": 12,
"ctxt": 0
},
"token": {
"Ident": {
"value": "prop",
"raw": "prop"
}
}
},
{
"span": {
"start": 12,
"end": 13,
"ctxt": 0
},
"token": "Colon"
},
{
"span": {
"start": 13,
"end": 14,
"ctxt": 0
},
"token": "WhiteSpace"
},
{
"span": {
"start": 14,
"end": 15,
"ctxt": 0
},
"token": {
"Delim": {
"value": "-"
}
}
}
]
}
]
}
}
]
}

View File

@ -0,0 +1,6 @@
error: Expected Property value
--> $DIR/tests/recovery/delim-token/minus/input.css:2:11
|
2 | prop: -;
| ^

View File

@ -0,0 +1,3 @@
a {
prop: +;
}

View File

@ -0,0 +1,121 @@
{
"type": "Stylesheet",
"span": {
"start": 0,
"end": 19,
"ctxt": 0
},
"rules": [
{
"type": "StyleRule",
"span": {
"start": 0,
"end": 18,
"ctxt": 0
},
"selectors": [
{
"type": "ComplexSelector",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"selectors": [
{
"type": "CompoundSelector",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"hasNestPrefix": false,
"combinator": null,
"typeSelector": {
"type": "NamespacedName",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"prefix": null,
"name": {
"type": "Text",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
},
"subclassSelectors": []
}
]
}
],
"block": {
"type": "DeclBlock",
"span": {
"start": 2,
"end": 18,
"ctxt": 0
},
"items": [
{
"type": "Tokens",
"span": {
"start": 8,
"end": 15,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 8,
"end": 12,
"ctxt": 0
},
"token": {
"Ident": {
"value": "prop",
"raw": "prop"
}
}
},
{
"span": {
"start": 12,
"end": 13,
"ctxt": 0
},
"token": "Colon"
},
{
"span": {
"start": 13,
"end": 14,
"ctxt": 0
},
"token": "WhiteSpace"
},
{
"span": {
"start": 14,
"end": 15,
"ctxt": 0
},
"token": {
"Delim": {
"value": "+"
}
}
}
]
}
]
}
}
]
}

View File

@ -0,0 +1,6 @@
error: Expected Property value
--> $DIR/tests/recovery/delim-token/plus/input.css:2:11
|
2 | prop: +;
| ^

View File

@ -266,7 +266,11 @@
"end": 138,
"ctxt": 0
},
"token": "Dot"
"token": {
"Delim": {
"value": "."
}
}
},
{
"span": {
@ -575,7 +579,11 @@
"end": 335,
"ctxt": 0
},
"token": "Dot"
"token": {
"Delim": {
"value": "."
}
}
},
{
"span": {
@ -795,7 +803,11 @@
"end": 464,
"ctxt": 0
},
"token": "Dot"
"token": {
"Delim": {
"value": "."
}
}
},
{
"span": {

View File

@ -112,7 +112,11 @@
"end": 14,
"ctxt": 0
},
"token": "Dot"
"token": {
"Delim": {
"value": "."
}
}
},
{
"span": {

View File

@ -6,18 +6,18 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_stylis"
repository = "https://github.com/swc-project/swc.git"
version = "0.11.0"
version = "0.12.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
swc_atoms = {version = "0.2.7", path = "../../atoms"}
swc_common = {version = "0.13.0", path = "../../common"}
swc_css_ast = {version = "0.13.0", path = "../ast"}
swc_css_utils = {version = "0.10.0", path = "../utils/"}
swc_css_visit = {version = "0.12.0", path = "../visit"}
swc_css_ast = {version = "0.14.0", path = "../ast"}
swc_css_utils = {version = "0.11.0", path = "../utils/"}
swc_css_visit = {version = "0.13.0", path = "../visit"}
[dev-dependencies]
swc_css_codegen = {version = "0.12.0", path = "../codegen"}
swc_css_parser = {version = "0.14.0", path = "../parser"}
swc_css_codegen = {version = "0.13.0", path = "../codegen"}
swc_css_parser = {version = "0.15.0", path = "../parser"}
testing = {version = "0.14.0", path = "../../testing"}

View File

@ -6,11 +6,11 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_css_utils"
repository = "https://github.com/swc-project/swc.git"
version = "0.10.0"
version = "0.11.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
swc_atoms = {version = "0.2.7", path = "../../atoms"}
swc_common = {version = "0.13.0", path = "../../common"}
swc_css_ast = {version = "0.13.0", path = "../ast"}
swc_css_visit = {version = "0.12.0", path = "../visit"}
swc_css_ast = {version = "0.14.0", path = "../ast"}
swc_css_visit = {version = "0.13.0", path = "../visit"}

View File

@ -6,12 +6,12 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_css_visit"
repository = "https://github.com/swc-project/swc.git"
version = "0.12.0"
version = "0.13.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
swc_atoms = {version = "0.2.7", path = "../../atoms"}
swc_common = {version = "0.13.0", path = "../../common"}
swc_css_ast = {version = "0.13.0", path = "../ast/"}
swc_css_ast = {version = "0.14.0", path = "../ast/"}
swc_visit = {version = "0.2.6", path = "../../visit"}