Skip to content

Commit 6417e69

Browse files
css
1 parent 482a708 commit 6417e69

File tree

1 file changed

+9
-22
lines changed

1 file changed

+9
-22
lines changed

src/languages/css.js

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { insertBefore } from '../util/language-util.js';
2-
31
/** @type {import('../types.d.ts').LanguageProto<'css'>} */
42
export default {
53
id: 'css',
@@ -8,8 +6,7 @@ export default {
86
const string =
97
/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
108

11-
/** @type {Grammar} */
12-
const css = {
9+
return {
1310
'comment': /\/\*[\s\S]*?\*\//,
1411
'atrule': {
1512
pattern: RegExp(
@@ -20,7 +17,7 @@ export default {
2017
')*?' +
2118
/(?:;|(?=\s*\{))/.source
2219
),
23-
inside: /** @type {Grammar} */ ({
20+
inside: {
2421
'rule': /^@[\w-]+/,
2522
'selector-function-argument': {
2623
pattern:
@@ -33,8 +30,8 @@ export default {
3330
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
3431
lookbehind: true,
3532
},
36-
$rest: /** @type {Grammar['$rest']} */ ('css'),
37-
}),
33+
$rest: 'css',
34+
},
3835
},
3936
'url': {
4037
// https://drafts.csswg.org/css-values-3/#urls
@@ -85,21 +82,11 @@ export default {
8582
lookbehind: true,
8683
},
8784
'punctuation': /[(){};:,]/,
85+
$insertBefore: {
86+
'function': /** @type {import('../types.d.ts').GrammarTokens} */ (
87+
getOptionalLanguage('css-extras')
88+
),
89+
},
8890
};
89-
90-
const extras = getOptionalLanguage('css-extras');
91-
if (extras) {
92-
insertBefore(
93-
css,
94-
'function',
95-
/** @type {import('../types.d.ts').GrammarTokens} */ (extras)
96-
);
97-
}
98-
99-
return css;
10091
},
10192
};
102-
103-
/**
104-
* @typedef {import('../types.d.ts').Grammar} Grammar
105-
*/

0 commit comments

Comments
 (0)