initial commit
This commit is contained in:
56
node_modules/css-tree/lib/syntax/node/Combinator.js
generated
vendored
Normal file
56
node_modules/css-tree/lib/syntax/node/Combinator.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
var CHARCODE = require('../../tokenizer').CHARCODE;
|
||||
|
||||
var IDENT = TYPE.Ident;
|
||||
var PLUSSIGN = CHARCODE.PlusSign;
|
||||
var SOLIDUS = CHARCODE.Solidus;
|
||||
var GREATERTHANSIGN = CHARCODE.GreaterThanSign;
|
||||
var TILDE = CHARCODE.Tilde;
|
||||
|
||||
// + | > | ~ | /deep/
|
||||
module.exports = {
|
||||
name: 'Combinator',
|
||||
structure: {
|
||||
name: String
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
|
||||
|
||||
switch (code) {
|
||||
case GREATERTHANSIGN:
|
||||
case PLUSSIGN:
|
||||
case TILDE:
|
||||
this.scanner.next();
|
||||
break;
|
||||
|
||||
case SOLIDUS:
|
||||
this.scanner.next();
|
||||
|
||||
if (this.scanner.tokenType !== IDENT || this.scanner.lookupValue(0, 'deep') === false) {
|
||||
this.error('Identifier `deep` is expected');
|
||||
}
|
||||
|
||||
this.scanner.next();
|
||||
|
||||
if (!this.scanner.isDelim(SOLIDUS)) {
|
||||
this.error('Solidus is expected');
|
||||
}
|
||||
|
||||
this.scanner.next();
|
||||
break;
|
||||
|
||||
default:
|
||||
this.error('Combinator is expected');
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Combinator',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
name: this.scanner.substrToCursor(start)
|
||||
};
|
||||
},
|
||||
generate: function(node) {
|
||||
this.chunk(node.name);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user