diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:10:59 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:41:44 +0800 |
| commit | fc87c009806dcc98867f6b58efe29b042aa01dee (patch) | |
| tree | 8f59b3f4a5b66e9dfef2d40c8d318e258a521228 /node_modules/css-tree/cjs/syntax/node/Atrule.cjs | |
| parent | 3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff) | |
node: updatemain
Diffstat (limited to 'node_modules/css-tree/cjs/syntax/node/Atrule.cjs')
| -rw-r--r-- | node_modules/css-tree/cjs/syntax/node/Atrule.cjs | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/node_modules/css-tree/cjs/syntax/node/Atrule.cjs b/node_modules/css-tree/cjs/syntax/node/Atrule.cjs deleted file mode 100644 index 44746306..00000000 --- a/node_modules/css-tree/cjs/syntax/node/Atrule.cjs +++ /dev/null @@ -1,103 +0,0 @@ -'use strict'; - -const types = require('../../tokenizer/types.cjs'); - -function consumeRaw(startToken) { - return this.Raw(startToken, this.consumeUntilLeftCurlyBracketOrSemicolon, true); -} - -function isDeclarationBlockAtrule() { - for (let offset = 1, type; type = this.lookupType(offset); offset++) { - if (type === types.RightCurlyBracket) { - return true; - } - - if (type === types.LeftCurlyBracket || - type === types.AtKeyword) { - return false; - } - } - - return false; -} - - -const name = 'Atrule'; -const walkContext = 'atrule'; -const structure = { - name: String, - prelude: ['AtrulePrelude', 'Raw', null], - block: ['Block', null] -}; - -function parse(isDeclaration = false) { - const start = this.tokenStart; - let name; - let nameLowerCase; - let prelude = null; - let block = null; - - this.eat(types.AtKeyword); - - name = this.substrToCursor(start + 1); - nameLowerCase = name.toLowerCase(); - this.skipSC(); - - // parse prelude - if (this.eof === false && - this.tokenType !== types.LeftCurlyBracket && - this.tokenType !== types.Semicolon) { - if (this.parseAtrulePrelude) { - prelude = this.parseWithFallback(this.AtrulePrelude.bind(this, name, isDeclaration), consumeRaw); - } else { - prelude = consumeRaw.call(this, this.tokenIndex); - } - - this.skipSC(); - } - - switch (this.tokenType) { - case types.Semicolon: - this.next(); - break; - - case types.LeftCurlyBracket: - if (hasOwnProperty.call(this.atrule, nameLowerCase) && - typeof this.atrule[nameLowerCase].block === 'function') { - block = this.atrule[nameLowerCase].block.call(this, isDeclaration); - } else { - // TODO: should consume block content as Raw? - block = this.Block(isDeclarationBlockAtrule.call(this)); - } - - break; - } - - return { - type: 'Atrule', - loc: this.getLocation(start, this.tokenStart), - name, - prelude, - block - }; -} - -function generate(node) { - this.token(types.AtKeyword, '@' + node.name); - - if (node.prelude !== null) { - this.node(node.prelude); - } - - if (node.block) { - this.node(node.block); - } else { - this.token(types.Semicolon, ';'); - } -} - -exports.generate = generate; -exports.name = name; -exports.parse = parse; -exports.structure = structure; -exports.walkContext = walkContext; |
