Urara-Blog/node_modules/.pnpm-store/v3/files/85/bc9a6761e1ef2869d53f7cd6ad14a77bbdf912f8a6bda496c6bdef34619a49a44a2eccf2da869412e04063afa7e81fe60a68d718130832c74bd933bef0eecb
2022-08-14 01:14:53 +08:00

39 lines
1.1 KiB
Text

import { Comma, WhiteSpace } from '../../tokenizer/index.js';
// var( <ident> , <value>? )
export default function() {
const children = this.createList();
this.skipSC();
// NOTE: Don't check more than a first argument is an ident, rest checks are for lexer
children.push(this.Identifier());
this.skipSC();
if (this.tokenType === Comma) {
children.push(this.Operator());
const startIndex = this.tokenIndex;
const value = this.parseCustomProperty
? this.Value(null)
: this.Raw(this.tokenIndex, this.consumeUntilExclamationMarkOrSemicolon, false);
if (value.type === 'Value' && value.children.isEmpty) {
for (let offset = startIndex - this.tokenIndex; offset <= 0; offset++) {
if (this.lookupType(offset) === WhiteSpace) {
value.children.appendData({
type: 'WhiteSpace',
loc: null,
value: ' '
});
break;
}
}
}
children.push(value);
}
return children;
};