40 lines
1.1 KiB
40 lines
1.1 KiB
var TYPE = require('../../tokenizer').TYPE; |
|
|
|
var IDENTIFIER = TYPE.Identifier; |
|
var COMMA = TYPE.Comma; |
|
var SEMICOLON = TYPE.Semicolon; |
|
var HYPHENMINUS = TYPE.HyphenMinus; |
|
var EXCLAMATIONMARK = TYPE.ExclamationMark; |
|
|
|
// var '(' ident (',' <value>? )? ')' |
|
module.exports = function() { |
|
var children = this.createList(); |
|
|
|
this.scanner.skipSC(); |
|
|
|
var identStart = this.scanner.tokenStart; |
|
|
|
this.scanner.eat(HYPHENMINUS); |
|
if (this.scanner.source.charCodeAt(this.scanner.tokenStart) !== HYPHENMINUS) { |
|
this.scanner.error('HyphenMinus is expected'); |
|
} |
|
this.scanner.eat(IDENTIFIER); |
|
|
|
children.push({ |
|
type: 'Identifier', |
|
loc: this.getLocation(identStart, this.scanner.tokenStart), |
|
name: this.scanner.substrToCursor(identStart) |
|
}); |
|
|
|
this.scanner.skipSC(); |
|
|
|
if (this.scanner.tokenType === COMMA) { |
|
children.push(this.Operator()); |
|
children.push(this.parseCustomProperty |
|
? this.Value(null) |
|
: this.Raw(this.scanner.currentToken, EXCLAMATIONMARK, SEMICOLON, false, false) |
|
); |
|
} |
|
|
|
return children; |
|
};
|
|
|