Urara-Blog/node_modules/.pnpm-store/v3/files/d2/076fc96c968ed8863842baaf0ef522ab2223673182cf2573b83770c015db3d435cf21154de36d08f0913a7a1fe8726df921e629d5853f5cdb790ccf9a8b6a8
2022-08-14 01:14:53 +08:00

43 lines
1.3 KiB
Text

var TYPE = require('../../tokenizer').TYPE;
var rawMode = require('../node/Raw').mode;
var COMMA = TYPE.Comma;
var WHITESPACE = TYPE.WhiteSpace;
// var( <ident> , <value>? )
module.exports = function() {
var children = this.createList();
this.scanner.skipSC();
// NOTE: Don't check more than a first argument is an ident, rest checks are for lexer
children.push(this.Identifier());
this.scanner.skipSC();
if (this.scanner.tokenType === COMMA) {
children.push(this.Operator());
const startIndex = this.scanner.tokenIndex;
const value = this.parseCustomProperty
? this.Value(null)
: this.Raw(this.scanner.tokenIndex, rawMode.exclamationMarkOrSemicolon, false);
if (value.type === 'Value' && value.children.isEmpty()) {
for (let offset = startIndex - this.scanner.tokenIndex; offset <= 0; offset++) {
if (this.scanner.lookupType(offset) === WHITESPACE) {
value.children.appendData({
type: 'WhiteSpace',
loc: null,
value: ' '
});
break;
}
}
}
children.push(value);
}
return children;
};