Skip to content

Commit b845535

Browse files
committed
add double quotes
1 parent dbf8078 commit b845535

File tree

3 files changed

+57
-27
lines changed

3 files changed

+57
-27
lines changed

packages/svelte/src/compiler/phases/1-parse/read/style.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const REGEX_PERCENTAGE = /^\d+(\.\d+)?%/;
99
const REGEX_NTH_OF =
1010
/^(even|odd|\+?(\d+|\d*n(\s*[+-]\s*\d+)?)|-\d*n(\s*\+\s*\d+))((?=\s*[,)])|\s+of\s+)/;
1111
const REGEX_WHITESPACE_OR_COLON = /[\s:]/;
12-
const REGEX_BRACE_OR_SEMICOLON = /[{;](?=(?:[^']*'[^']*')*[^']*$)/;
12+
const REGEX_BRACE_OR_SEMICOLON = /[{;](?=(?:[^'"]*'[^'"]*')*[^'"]*$)/;
1313
const REGEX_LEADING_HYPHEN_OR_DIGIT = /-?\d/;
1414
const REGEX_VALID_IDENTIFIER_CHAR = /[a-zA-Z0-9_-]/;
1515
const REGEX_COMMENT_CLOSE = /\*\//;

packages/svelte/tests/parser-modern/samples/semicolon-inside-quotes/input.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
<h1>
2+
Semicolon inside quotes
3+
</h1>
14
<style>
2-
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;700&display=swap');
3-
5+
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap");
46
h1 {
57
font-weight: bold;
68
}
Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,100 @@
11
{
22
"css": {
33
"type": "Style",
4-
"start": 0,
5-
"end": 137,
4+
"start": 36,
5+
"end": 174,
66
"attributes": [],
77
"children": [
88
{
99
"type": "Atrule",
10-
"start": 9,
11-
"end": 97,
10+
"start": 45,
11+
"end": 135,
1212
"name": "import",
13-
"prelude": "url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;700&display=swap')",
13+
"prelude": "url(\"https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap\")",
1414
"block": null
1515
},
1616
{
1717
"type": "Rule",
1818
"prelude": {
1919
"type": "SelectorList",
20-
"start": 100,
21-
"end": 102,
20+
"start": 137,
21+
"end": 139,
2222
"children": [
2323
{
2424
"type": "Selector",
25-
"start": 100,
26-
"end": 102,
25+
"start": 137,
26+
"end": 139,
2727
"children": [
2828
{
2929
"type": "TypeSelector",
3030
"name": "h1",
31-
"start": 100,
32-
"end": 102
31+
"start": 137,
32+
"end": 139
3333
}
3434
]
3535
}
3636
]
3737
},
3838
"block": {
3939
"type": "Block",
40-
"start": 103,
41-
"end": 128,
40+
"start": 140,
41+
"end": 165,
4242
"children": [
4343
{
4444
"type": "Declaration",
45-
"start": 107,
46-
"end": 124,
45+
"start": 144,
46+
"end": 161,
4747
"property": "font-weight",
4848
"value": "bold"
4949
}
5050
]
5151
},
52-
"start": 100,
53-
"end": 128
52+
"start": 137,
53+
"end": 165
5454
}
5555
],
5656
"content": {
57-
"start": 7,
58-
"end": 129,
59-
"styles": "\n\t@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;700&display=swap');\n\n\th1 {\n\t\tfont-weight: bold;\n\t}\n"
57+
"start": 43,
58+
"end": 166,
59+
"styles": "\n\t@import url(\"https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap\");\n\th1 {\n\t\tfont-weight: bold;\n\t}\n"
6060
}
6161
},
6262
"js": [],
63-
"start": null,
64-
"end": null,
63+
"start": 0,
64+
"end": 35,
6565
"type": "Root",
6666
"fragment": {
6767
"type": "Fragment",
68-
"nodes": [],
68+
"nodes": [
69+
{
70+
"type": "RegularElement",
71+
"start": 0,
72+
"end": 35,
73+
"name": "h1",
74+
"attributes": [],
75+
"fragment": {
76+
"type": "Fragment",
77+
"nodes": [
78+
{
79+
"type": "Text",
80+
"start": 4,
81+
"end": 30,
82+
"raw": "\n\tSemicolon inside quotes\n",
83+
"data": "\n\tSemicolon inside quotes\n"
84+
}
85+
],
86+
"transparent": true
87+
}
88+
},
89+
{
90+
"type": "Text",
91+
"start": 35,
92+
"end": 36,
93+
"raw": "\n",
94+
"data": "\n"
95+
}
96+
],
6997
"transparent": false
7098
},
7199
"options": null
72-
}
100+
}

0 commit comments

Comments
 (0)