first commit
This commit is contained in:
8
build/node_modules/css-tree/lib/syntax/atrule/font-face.js
generated
vendored
Normal file
8
build/node_modules/css-tree/lib/syntax/atrule/font-face.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
parse: {
|
||||
prelude: null,
|
||||
block: function() {
|
||||
return this.Block(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
39
build/node_modules/css-tree/lib/syntax/atrule/import.js
generated
vendored
Normal file
39
build/node_modules/css-tree/lib/syntax/atrule/import.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
var List = require('../../utils/list');
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var STRING = TYPE.String;
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var URL = TYPE.Url;
|
||||
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
|
||||
|
||||
module.exports = {
|
||||
parse: {
|
||||
prelude: function() {
|
||||
var children = new List();
|
||||
|
||||
this.scanner.skipSC();
|
||||
|
||||
switch (this.scanner.tokenType) {
|
||||
case STRING:
|
||||
children.appendData(this.String());
|
||||
break;
|
||||
|
||||
case URL:
|
||||
children.appendData(this.Url());
|
||||
break;
|
||||
|
||||
default:
|
||||
this.scanner.error('String or url() is expected');
|
||||
}
|
||||
|
||||
if (this.scanner.lookupNonWSType(0) === IDENTIFIER ||
|
||||
this.scanner.lookupNonWSType(0) === LEFTPARENTHESIS) {
|
||||
children.appendData(this.WhiteSpace());
|
||||
children.appendData(this.MediaQueryList());
|
||||
}
|
||||
|
||||
return children;
|
||||
},
|
||||
block: null
|
||||
}
|
||||
};
|
||||
7
build/node_modules/css-tree/lib/syntax/atrule/index.js
generated
vendored
Normal file
7
build/node_modules/css-tree/lib/syntax/atrule/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
'font-face': require('./font-face'),
|
||||
'import': require('./import'),
|
||||
'media': require('./media'),
|
||||
'page': require('./page'),
|
||||
'supports': require('./supports')
|
||||
};
|
||||
14
build/node_modules/css-tree/lib/syntax/atrule/media.js
generated
vendored
Normal file
14
build/node_modules/css-tree/lib/syntax/atrule/media.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
var List = require('../../utils/list');
|
||||
|
||||
module.exports = {
|
||||
parse: {
|
||||
prelude: function() {
|
||||
return new List().appendData(
|
||||
this.MediaQueryList()
|
||||
);
|
||||
},
|
||||
block: function() {
|
||||
return this.Block(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
14
build/node_modules/css-tree/lib/syntax/atrule/page.js
generated
vendored
Normal file
14
build/node_modules/css-tree/lib/syntax/atrule/page.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
var List = require('../../utils/list');
|
||||
|
||||
module.exports = {
|
||||
parse: {
|
||||
prelude: function() {
|
||||
return new List().appendData(
|
||||
this.SelectorList()
|
||||
);
|
||||
},
|
||||
block: function() {
|
||||
return this.Block(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
100
build/node_modules/css-tree/lib/syntax/atrule/supports.js
generated
vendored
Normal file
100
build/node_modules/css-tree/lib/syntax/atrule/supports.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
var List = require('../../utils/list');
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var WHITESPACE = TYPE.WhiteSpace;
|
||||
var COMMENT = TYPE.Comment;
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var FUNCTION = TYPE.Function;
|
||||
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
|
||||
var HYPHENMINUS = TYPE.HyphenMinus;
|
||||
var COLON = TYPE.Colon;
|
||||
|
||||
function consumeRaw() {
|
||||
return new List().appendData(
|
||||
this.Raw(this.scanner.currentToken, 0, 0, false, false)
|
||||
);
|
||||
}
|
||||
|
||||
function parentheses() {
|
||||
var index = 0;
|
||||
|
||||
this.scanner.skipSC();
|
||||
|
||||
// TODO: make it simplier
|
||||
if (this.scanner.tokenType === IDENTIFIER) {
|
||||
index = 1;
|
||||
} else if (this.scanner.tokenType === HYPHENMINUS &&
|
||||
this.scanner.lookupType(1) === IDENTIFIER) {
|
||||
index = 2;
|
||||
}
|
||||
|
||||
if (index !== 0 && this.scanner.lookupNonWSType(index) === COLON) {
|
||||
return new List().appendData(
|
||||
this.Declaration()
|
||||
);
|
||||
}
|
||||
|
||||
return readSequence.call(this);
|
||||
}
|
||||
|
||||
function readSequence() {
|
||||
var children = new List();
|
||||
var space = null;
|
||||
var child;
|
||||
|
||||
this.scanner.skipSC();
|
||||
|
||||
scan:
|
||||
while (!this.scanner.eof) {
|
||||
switch (this.scanner.tokenType) {
|
||||
case WHITESPACE:
|
||||
space = this.WhiteSpace();
|
||||
continue;
|
||||
|
||||
case COMMENT:
|
||||
this.scanner.next();
|
||||
continue;
|
||||
|
||||
case FUNCTION:
|
||||
child = this.Function(consumeRaw, this.scope.AtrulePrelude);
|
||||
break;
|
||||
|
||||
case IDENTIFIER:
|
||||
child = this.Identifier();
|
||||
break;
|
||||
|
||||
case LEFTPARENTHESIS:
|
||||
child = this.Parentheses(parentheses, this.scope.AtrulePrelude);
|
||||
break;
|
||||
|
||||
default:
|
||||
break scan;
|
||||
}
|
||||
|
||||
if (space !== null) {
|
||||
children.appendData(space);
|
||||
space = null;
|
||||
}
|
||||
|
||||
children.appendData(child);
|
||||
}
|
||||
|
||||
return children;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
parse: {
|
||||
prelude: function() {
|
||||
var children = readSequence.call(this);
|
||||
|
||||
if (children.isEmpty()) {
|
||||
this.scanner.error('Condition is expected');
|
||||
}
|
||||
|
||||
return children;
|
||||
},
|
||||
block: function() {
|
||||
return this.Block(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
8
build/node_modules/css-tree/lib/syntax/config/lexer.js
generated
vendored
Normal file
8
build/node_modules/css-tree/lib/syntax/config/lexer.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
var data = require('../../../data');
|
||||
|
||||
module.exports = {
|
||||
generic: true,
|
||||
types: data.types,
|
||||
properties: data.properties,
|
||||
node: require('../node')
|
||||
};
|
||||
94
build/node_modules/css-tree/lib/syntax/config/mix.js
generated
vendored
Normal file
94
build/node_modules/css-tree/lib/syntax/config/mix.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
var shape = {
|
||||
generic: true,
|
||||
types: {},
|
||||
properties: {},
|
||||
parseContext: {},
|
||||
scope: {},
|
||||
atrule: ['parse'],
|
||||
pseudo: ['parse'],
|
||||
node: ['name', 'structure', 'parse', 'generate', 'walkContext']
|
||||
};
|
||||
|
||||
function isObject(value) {
|
||||
return value && value.constructor === Object;
|
||||
}
|
||||
|
||||
function copy(value) {
|
||||
if (isObject(value)) {
|
||||
var res = {};
|
||||
for (var key in value) {
|
||||
if (hasOwnProperty.call(value, key)) {
|
||||
res[key] = value[key];
|
||||
}
|
||||
}
|
||||
return res;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
function extend(dest, src) {
|
||||
for (var key in src) {
|
||||
if (hasOwnProperty.call(src, key)) {
|
||||
if (isObject(dest[key])) {
|
||||
extend(dest[key], copy(src[key]));
|
||||
} else {
|
||||
dest[key] = copy(src[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function mix(dest, src, shape) {
|
||||
for (var key in shape) {
|
||||
if (hasOwnProperty.call(shape, key) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (shape[key] === true) {
|
||||
if (key in src) {
|
||||
if (hasOwnProperty.call(src, key)) {
|
||||
dest[key] = copy(src[key]);
|
||||
}
|
||||
}
|
||||
} else if (shape[key]) {
|
||||
if (isObject(shape[key])) {
|
||||
var res = {};
|
||||
extend(res, dest[key]);
|
||||
extend(res, src[key]);
|
||||
dest[key] = res;
|
||||
} else if (Array.isArray(shape[key])) {
|
||||
var res = {};
|
||||
var innerShape = shape[key].reduce(function(s, k) {
|
||||
s[k] = true;
|
||||
return s;
|
||||
}, {});
|
||||
for (var name in dest[key]) {
|
||||
if (hasOwnProperty.call(dest[key], name)) {
|
||||
res[name] = {};
|
||||
if (dest[key] && dest[key][name]) {
|
||||
mix(res[name], dest[key][name], innerShape);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var name in src[key]) {
|
||||
if (hasOwnProperty.call(src[key], name)) {
|
||||
if (!res[name]) {
|
||||
res[name] = {};
|
||||
}
|
||||
if (src[key] && src[key][name]) {
|
||||
mix(res[name], src[key][name], innerShape);
|
||||
}
|
||||
}
|
||||
}
|
||||
dest[key] = res;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
module.exports = function(dest, src) {
|
||||
return mix(dest, src, shape);
|
||||
};
|
||||
27
build/node_modules/css-tree/lib/syntax/config/parser.js
generated
vendored
Normal file
27
build/node_modules/css-tree/lib/syntax/config/parser.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
module.exports = {
|
||||
parseContext: {
|
||||
default: 'StyleSheet',
|
||||
stylesheet: 'StyleSheet',
|
||||
atrule: 'Atrule',
|
||||
atrulePrelude: function(options) {
|
||||
return this.AtrulePrelude(options.atrule ? String(options.atrule) : null);
|
||||
},
|
||||
mediaQueryList: 'MediaQueryList',
|
||||
mediaQuery: 'MediaQuery',
|
||||
rule: 'Rule',
|
||||
selectorList: 'SelectorList',
|
||||
selector: 'Selector',
|
||||
block: function() {
|
||||
return this.Block(true);
|
||||
},
|
||||
declarationList: 'DeclarationList',
|
||||
declaration: 'Declaration',
|
||||
value: function(options) {
|
||||
return this.Value(options.property ? String(options.property) : null);
|
||||
}
|
||||
},
|
||||
scope: require('../scope'),
|
||||
atrule: require('../atrule'),
|
||||
pseudo: require('../pseudo'),
|
||||
node: require('../node')
|
||||
};
|
||||
3
build/node_modules/css-tree/lib/syntax/config/walker.js
generated
vendored
Normal file
3
build/node_modules/css-tree/lib/syntax/config/walker.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
node: require('../node')
|
||||
};
|
||||
82
build/node_modules/css-tree/lib/syntax/create.js
generated
vendored
Normal file
82
build/node_modules/css-tree/lib/syntax/create.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
var List = require('../utils/list');
|
||||
var Tokenizer = require('../tokenizer');
|
||||
var Lexer = require('../lexer/Lexer');
|
||||
var grammar = require('../lexer/grammar');
|
||||
var createParser = require('../parser/create');
|
||||
var createGenerator = require('../generator/create');
|
||||
var createConvertor = require('../convertor/create');
|
||||
var createWalker = require('../walker/create');
|
||||
var clone = require('../utils/clone');
|
||||
var names = require('../utils/names');
|
||||
var mix = require('./config/mix');
|
||||
|
||||
function assign(dest, src) {
|
||||
for (var key in src) {
|
||||
dest[key] = src[key];
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
function createSyntax(config) {
|
||||
var parse = createParser(config);
|
||||
var walker = createWalker(config);
|
||||
var generator = createGenerator(config);
|
||||
var convertor = createConvertor(walker);
|
||||
|
||||
var syntax = {
|
||||
List: List,
|
||||
Tokenizer: Tokenizer,
|
||||
Lexer: Lexer,
|
||||
|
||||
property: names.property,
|
||||
keyword: names.keyword,
|
||||
|
||||
grammar: grammar,
|
||||
lexer: null,
|
||||
createLexer: function(config) {
|
||||
return new Lexer(config, syntax, syntax.lexer.structure);
|
||||
},
|
||||
|
||||
parse: parse,
|
||||
|
||||
walk: walker.walk,
|
||||
walkUp: walker.walkUp,
|
||||
walkRules: walker.walkRules,
|
||||
walkRulesRight: walker.walkRulesRight,
|
||||
walkDeclarations: walker.walkDeclarations,
|
||||
|
||||
translate: generator.translate,
|
||||
translateWithSourceMap: generator.translateWithSourceMap,
|
||||
translateMarkup: generator.translateMarkup,
|
||||
|
||||
clone: clone,
|
||||
fromPlainObject: convertor.fromPlainObject,
|
||||
toPlainObject: convertor.toPlainObject,
|
||||
|
||||
createSyntax: function(config) {
|
||||
return createSyntax(mix({}, config));
|
||||
},
|
||||
fork: function(extension) {
|
||||
var base = mix({}, config); // copy of config
|
||||
return createSyntax(
|
||||
typeof extension === 'function'
|
||||
? extension(base, assign)
|
||||
: mix(base, extension)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
syntax.lexer = new Lexer({
|
||||
generic: true,
|
||||
types: config.types,
|
||||
properties: config.properties,
|
||||
node: config.node
|
||||
}, syntax);
|
||||
|
||||
return syntax;
|
||||
};
|
||||
|
||||
exports.create = function(config) {
|
||||
return createSyntax(mix({}, config));
|
||||
};
|
||||
15
build/node_modules/css-tree/lib/syntax/function/element.js
generated
vendored
Normal file
15
build/node_modules/css-tree/lib/syntax/function/element.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
var List = require('../../utils/list');
|
||||
|
||||
// https://drafts.csswg.org/css-images-4/#element-notation
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/element
|
||||
module.exports = function() {
|
||||
this.scanner.skipSC();
|
||||
|
||||
var id = this.IdSelector();
|
||||
|
||||
this.scanner.skipSC();
|
||||
|
||||
return new List().appendData(
|
||||
id
|
||||
);
|
||||
};
|
||||
9
build/node_modules/css-tree/lib/syntax/function/expression.js
generated
vendored
Normal file
9
build/node_modules/css-tree/lib/syntax/function/expression.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
var List = require('../../utils/list');
|
||||
|
||||
// legacy IE function
|
||||
// expression '(' raw ')'
|
||||
module.exports = function() {
|
||||
return new List().appendData(
|
||||
this.Raw(this.scanner.currentToken, 0, 0, false, false)
|
||||
);
|
||||
};
|
||||
41
build/node_modules/css-tree/lib/syntax/function/var.js
generated
vendored
Normal file
41
build/node_modules/css-tree/lib/syntax/function/var.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
var List = require('../../utils/list');
|
||||
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 = new List();
|
||||
|
||||
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.appendData({
|
||||
type: 'Identifier',
|
||||
loc: this.getLocation(identStart, this.scanner.tokenStart),
|
||||
name: this.scanner.substrToCursor(identStart)
|
||||
});
|
||||
|
||||
this.scanner.skipSC();
|
||||
|
||||
if (this.scanner.tokenType === COMMA) {
|
||||
children.appendData(this.Operator());
|
||||
children.appendData(this.parseCustomProperty
|
||||
? this.Value(null)
|
||||
: this.Raw(this.scanner.currentToken, EXCLAMATIONMARK, SEMICOLON, false, false)
|
||||
);
|
||||
}
|
||||
|
||||
return children;
|
||||
};
|
||||
20
build/node_modules/css-tree/lib/syntax/index.js
generated
vendored
Normal file
20
build/node_modules/css-tree/lib/syntax/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
function merge() {
|
||||
var dest = {};
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var src = arguments[i];
|
||||
for (var key in src) {
|
||||
dest[key] = src[key];
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
module.exports = require('./create').create(
|
||||
merge(
|
||||
require('./config/lexer'),
|
||||
require('./config/parser'),
|
||||
require('./config/walker')
|
||||
)
|
||||
);
|
||||
180
build/node_modules/css-tree/lib/syntax/node/AnPlusB.js
generated
vendored
Normal file
180
build/node_modules/css-tree/lib/syntax/node/AnPlusB.js
generated
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
var cmpChar = require('../../tokenizer').cmpChar;
|
||||
var isNumber = require('../../tokenizer').isNumber;
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var NUMBER = TYPE.Number;
|
||||
var PLUSSIGN = TYPE.PlusSign;
|
||||
var HYPHENMINUS = TYPE.HyphenMinus;
|
||||
var N = 110; // 'n'.charCodeAt(0)
|
||||
var DISALLOW_SIGN = true;
|
||||
var ALLOW_SIGN = false;
|
||||
|
||||
function checkTokenIsInteger(scanner, disallowSign) {
|
||||
var pos = scanner.tokenStart;
|
||||
|
||||
if (scanner.source.charCodeAt(pos) === PLUSSIGN ||
|
||||
scanner.source.charCodeAt(pos) === HYPHENMINUS) {
|
||||
if (disallowSign) {
|
||||
scanner.error();
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
|
||||
for (; pos < scanner.tokenEnd; pos++) {
|
||||
if (!isNumber(scanner.source.charCodeAt(pos))) {
|
||||
scanner.error('Unexpected input', pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
|
||||
module.exports = {
|
||||
name: 'AnPlusB',
|
||||
structure: {
|
||||
a: [String, null],
|
||||
b: [String, null]
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var end = start;
|
||||
var prefix = '';
|
||||
var a = null;
|
||||
var b = null;
|
||||
|
||||
if (this.scanner.tokenType === NUMBER ||
|
||||
this.scanner.tokenType === PLUSSIGN) {
|
||||
checkTokenIsInteger(this.scanner, ALLOW_SIGN);
|
||||
prefix = this.scanner.getTokenValue();
|
||||
this.scanner.next();
|
||||
end = this.scanner.tokenStart;
|
||||
}
|
||||
|
||||
if (this.scanner.tokenType === IDENTIFIER) {
|
||||
var bStart = this.scanner.tokenStart;
|
||||
|
||||
if (cmpChar(this.scanner.source, bStart, HYPHENMINUS)) {
|
||||
if (prefix === '') {
|
||||
prefix = '-';
|
||||
bStart++;
|
||||
} else {
|
||||
this.scanner.error('Unexpected hyphen minus');
|
||||
}
|
||||
}
|
||||
|
||||
if (!cmpChar(this.scanner.source, bStart, N)) {
|
||||
this.scanner.error();
|
||||
}
|
||||
|
||||
a = prefix === '' ? '1' :
|
||||
prefix === '+' ? '+1' :
|
||||
prefix === '-' ? '-1' :
|
||||
prefix;
|
||||
|
||||
var len = this.scanner.tokenEnd - bStart;
|
||||
if (len > 1) {
|
||||
// ..n-..
|
||||
if (this.scanner.source.charCodeAt(bStart + 1) !== HYPHENMINUS) {
|
||||
this.scanner.error('Unexpected input', bStart + 1);
|
||||
}
|
||||
|
||||
if (len > 2) {
|
||||
// ..n-{number}..
|
||||
this.scanner.tokenStart = bStart + 2;
|
||||
} else {
|
||||
// ..n- {number}
|
||||
this.scanner.next();
|
||||
this.scanner.skipSC();
|
||||
}
|
||||
|
||||
checkTokenIsInteger(this.scanner, DISALLOW_SIGN);
|
||||
b = '-' + this.scanner.getTokenValue();
|
||||
this.scanner.next();
|
||||
end = this.scanner.tokenStart;
|
||||
} else {
|
||||
prefix = '';
|
||||
this.scanner.next();
|
||||
end = this.scanner.tokenStart;
|
||||
this.scanner.skipSC();
|
||||
|
||||
if (this.scanner.tokenType === HYPHENMINUS ||
|
||||
this.scanner.tokenType === PLUSSIGN) {
|
||||
prefix = this.scanner.getTokenValue();
|
||||
this.scanner.next();
|
||||
this.scanner.skipSC();
|
||||
}
|
||||
|
||||
if (this.scanner.tokenType === NUMBER) {
|
||||
checkTokenIsInteger(this.scanner, prefix !== '');
|
||||
|
||||
if (!isNumber(this.scanner.source.charCodeAt(this.scanner.tokenStart))) {
|
||||
prefix = this.scanner.source.charAt(this.scanner.tokenStart);
|
||||
this.scanner.tokenStart++;
|
||||
}
|
||||
|
||||
if (prefix === '') {
|
||||
// should be an operator before number
|
||||
this.scanner.error();
|
||||
} else if (prefix === '+') {
|
||||
// plus is using by default
|
||||
prefix = '';
|
||||
}
|
||||
|
||||
b = prefix + this.scanner.getTokenValue();
|
||||
|
||||
this.scanner.next();
|
||||
end = this.scanner.tokenStart;
|
||||
} else {
|
||||
if (prefix) {
|
||||
this.scanner.eat(NUMBER);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (prefix === '' || prefix === '+') { // no number
|
||||
this.scanner.error(
|
||||
'Number or identifier is expected',
|
||||
this.scanner.tokenStart + (
|
||||
this.scanner.tokenType === PLUSSIGN ||
|
||||
this.scanner.tokenType === HYPHENMINUS
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
b = prefix;
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'AnPlusB',
|
||||
loc: this.getLocation(start, end),
|
||||
a: a,
|
||||
b: b
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
var a = node.a !== null && node.a !== undefined;
|
||||
var b = node.b !== null && node.b !== undefined;
|
||||
|
||||
if (a) {
|
||||
processChunk(
|
||||
node.a === '+1' ? '+n' :
|
||||
node.a === '1' ? 'n' :
|
||||
node.a === '-1' ? '-n' :
|
||||
node.a + 'n'
|
||||
);
|
||||
|
||||
if (b) {
|
||||
b = String(node.b);
|
||||
if (b.charAt(0) === '-' || b.charAt(0) === '+') {
|
||||
processChunk(b.charAt(0));
|
||||
processChunk(b.substr(1));
|
||||
} else {
|
||||
processChunk('+');
|
||||
processChunk(b);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
processChunk(String(node.b));
|
||||
}
|
||||
}
|
||||
};
|
||||
134
build/node_modules/css-tree/lib/syntax/node/Atrule.js
generated
vendored
Normal file
134
build/node_modules/css-tree/lib/syntax/node/Atrule.js
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var ATRULE = TYPE.Atrule;
|
||||
var SEMICOLON = TYPE.Semicolon;
|
||||
var LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;
|
||||
var RIGHTCURLYBRACKET = TYPE.RightCurlyBracket;
|
||||
|
||||
function consumeRaw(startToken) {
|
||||
return this.Raw(startToken, SEMICOLON, LEFTCURLYBRACKET, false, true);
|
||||
}
|
||||
|
||||
function isDeclarationBlockAtrule() {
|
||||
for (var offset = 1, type; type = this.scanner.lookupType(offset); offset++) {
|
||||
if (type === RIGHTCURLYBRACKET) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type === LEFTCURLYBRACKET ||
|
||||
type === ATRULE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.tolerant) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.scanner.skip(offset);
|
||||
this.scanner.eat(RIGHTCURLYBRACKET);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'Atrule',
|
||||
structure: {
|
||||
name: String,
|
||||
prelude: ['AtrulePrelude', 'Raw', null],
|
||||
block: ['Block', null]
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var name;
|
||||
var nameLowerCase;
|
||||
var prelude = null;
|
||||
var block = null;
|
||||
|
||||
this.scanner.eat(ATRULE);
|
||||
|
||||
name = this.scanner.substrToCursor(start + 1);
|
||||
nameLowerCase = name.toLowerCase();
|
||||
this.scanner.skipSC();
|
||||
|
||||
// parse prelude
|
||||
if (this.scanner.eof === false &&
|
||||
this.scanner.tokenType !== LEFTCURLYBRACKET &&
|
||||
this.scanner.tokenType !== SEMICOLON) {
|
||||
if (this.parseAtrulePrelude) {
|
||||
var preludeStartToken = this.scanner.currentToken;
|
||||
prelude = this.tolerantParse(this.AtrulePrelude.bind(this, name), consumeRaw);
|
||||
|
||||
if (this.tolerant && !this.scanner.eof) {
|
||||
if (prelude.type !== 'Raw' &&
|
||||
this.scanner.tokenType !== LEFTCURLYBRACKET &&
|
||||
this.scanner.tokenType !== SEMICOLON) {
|
||||
prelude = consumeRaw.call(this, preludeStartToken);
|
||||
}
|
||||
}
|
||||
|
||||
// turn empty AtrulePrelude into null
|
||||
if (prelude.type === 'AtrulePrelude' && prelude.children.head === null) {
|
||||
prelude = null;
|
||||
}
|
||||
} else {
|
||||
prelude = consumeRaw.call(this, this.scanner.currentToken);
|
||||
}
|
||||
|
||||
this.scanner.skipSC();
|
||||
}
|
||||
|
||||
if (this.atrule.hasOwnProperty(nameLowerCase)) {
|
||||
if (typeof this.atrule[nameLowerCase].block === 'function') {
|
||||
if (this.scanner.tokenType !== LEFTCURLYBRACKET) {
|
||||
// FIXME: make tolerant
|
||||
this.scanner.error('Curly bracket is expected');
|
||||
}
|
||||
|
||||
block = this.atrule[nameLowerCase].block.call(this);
|
||||
} else {
|
||||
if (!this.tolerant || !this.scanner.eof) {
|
||||
this.scanner.eat(SEMICOLON);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch (this.scanner.tokenType) {
|
||||
case SEMICOLON:
|
||||
this.scanner.next();
|
||||
break;
|
||||
|
||||
case LEFTCURLYBRACKET:
|
||||
// TODO: should consume block content as Raw?
|
||||
block = this.Block(isDeclarationBlockAtrule.call(this));
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!this.tolerant) {
|
||||
this.scanner.error('Semicolon or block is expected');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Atrule',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
name: name,
|
||||
prelude: prelude,
|
||||
block: block
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk('@');
|
||||
processChunk(node.name);
|
||||
|
||||
if (node.prelude !== null) {
|
||||
processChunk(' ');
|
||||
this.generate(processChunk, node.prelude);
|
||||
}
|
||||
|
||||
if (node.block) {
|
||||
this.generate(processChunk, node.block);
|
||||
} else {
|
||||
processChunk(';');
|
||||
}
|
||||
},
|
||||
walkContext: 'atrule'
|
||||
};
|
||||
40
build/node_modules/css-tree/lib/syntax/node/AtrulePrelude.js
generated
vendored
Normal file
40
build/node_modules/css-tree/lib/syntax/node/AtrulePrelude.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
var List = require('../../utils/list');
|
||||
|
||||
module.exports = {
|
||||
name: 'AtrulePrelude',
|
||||
structure: {
|
||||
children: [[]]
|
||||
},
|
||||
parse: function(name) {
|
||||
var children = null;
|
||||
|
||||
if (name !== null) {
|
||||
name = name.toLowerCase();
|
||||
}
|
||||
|
||||
if (this.atrule.hasOwnProperty(name)) {
|
||||
// custom consumer
|
||||
if (typeof this.atrule[name].prelude === 'function') {
|
||||
children = this.atrule[name].prelude.call(this);
|
||||
}
|
||||
} else {
|
||||
// default consumer
|
||||
this.scanner.skipSC();
|
||||
children = this.readSequence(this.scope.AtrulePrelude);
|
||||
}
|
||||
|
||||
if (children === null) {
|
||||
children = new List();
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'AtrulePrelude',
|
||||
loc: this.getLocationFromList(children),
|
||||
children: children
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
this.each(processChunk, node);
|
||||
},
|
||||
walkContext: 'atrulePrelude'
|
||||
};
|
||||
162
build/node_modules/css-tree/lib/syntax/node/AttributeSelector.js
generated
vendored
Normal file
162
build/node_modules/css-tree/lib/syntax/node/AttributeSelector.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var STRING = TYPE.String;
|
||||
var DOLLARSIGN = TYPE.DollarSign;
|
||||
var ASTERISK = TYPE.Asterisk;
|
||||
var COLON = TYPE.Colon;
|
||||
var EQUALSSIGN = TYPE.EqualsSign;
|
||||
var LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;
|
||||
var RIGHTSQUAREBRACKET = TYPE.RightSquareBracket;
|
||||
var CIRCUMFLEXACCENT = TYPE.CircumflexAccent;
|
||||
var VERTICALLINE = TYPE.VerticalLine;
|
||||
var TILDE = TYPE.Tilde;
|
||||
|
||||
function getAttributeName() {
|
||||
if (this.scanner.eof) {
|
||||
this.scanner.error('Unexpected end of input');
|
||||
}
|
||||
|
||||
var start = this.scanner.tokenStart;
|
||||
var expectIdentifier = false;
|
||||
var checkColon = true;
|
||||
|
||||
if (this.scanner.tokenType === ASTERISK) {
|
||||
expectIdentifier = true;
|
||||
checkColon = false;
|
||||
this.scanner.next();
|
||||
} else if (this.scanner.tokenType !== VERTICALLINE) {
|
||||
this.scanner.eat(IDENTIFIER);
|
||||
}
|
||||
|
||||
if (this.scanner.tokenType === VERTICALLINE) {
|
||||
if (this.scanner.lookupType(1) !== EQUALSSIGN) {
|
||||
this.scanner.next();
|
||||
this.scanner.eat(IDENTIFIER);
|
||||
} else if (expectIdentifier) {
|
||||
this.scanner.error('Identifier is expected', this.scanner.tokenEnd);
|
||||
}
|
||||
} else if (expectIdentifier) {
|
||||
this.scanner.error('Vertical line is expected');
|
||||
}
|
||||
|
||||
if (checkColon && this.scanner.tokenType === COLON) {
|
||||
this.scanner.next();
|
||||
this.scanner.eat(IDENTIFIER);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Identifier',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
name: this.scanner.substrToCursor(start)
|
||||
};
|
||||
}
|
||||
|
||||
function getOperator() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var tokenType = this.scanner.tokenType;
|
||||
|
||||
if (tokenType !== EQUALSSIGN && // =
|
||||
tokenType !== TILDE && // ~=
|
||||
tokenType !== CIRCUMFLEXACCENT && // ^=
|
||||
tokenType !== DOLLARSIGN && // $=
|
||||
tokenType !== ASTERISK && // *=
|
||||
tokenType !== VERTICALLINE // |=
|
||||
) {
|
||||
this.scanner.error('Attribute selector (=, ~=, ^=, $=, *=, |=) is expected');
|
||||
}
|
||||
|
||||
if (tokenType === EQUALSSIGN) {
|
||||
this.scanner.next();
|
||||
} else {
|
||||
this.scanner.next();
|
||||
this.scanner.eat(EQUALSSIGN);
|
||||
}
|
||||
|
||||
return this.scanner.substrToCursor(start);
|
||||
}
|
||||
|
||||
// '[' S* attrib_name ']'
|
||||
// '[' S* attrib_name S* attrib_matcher S* [ IDENT | STRING ] S* attrib_flags? S* ']'
|
||||
module.exports = {
|
||||
name: 'AttributeSelector',
|
||||
structure: {
|
||||
name: 'Identifier',
|
||||
matcher: [String, null],
|
||||
value: ['String', 'Identifier', null],
|
||||
flags: [String, null]
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var name;
|
||||
var matcher = null;
|
||||
var value = null;
|
||||
var flags = null;
|
||||
|
||||
this.scanner.eat(LEFTSQUAREBRACKET);
|
||||
this.scanner.skipSC();
|
||||
|
||||
name = getAttributeName.call(this);
|
||||
this.scanner.skipSC();
|
||||
|
||||
if (this.scanner.tokenType !== RIGHTSQUAREBRACKET) {
|
||||
// avoid case `[name i]`
|
||||
if (this.scanner.tokenType !== IDENTIFIER) {
|
||||
matcher = getOperator.call(this);
|
||||
|
||||
this.scanner.skipSC();
|
||||
|
||||
value = this.scanner.tokenType === STRING
|
||||
? this.String()
|
||||
: this.Identifier();
|
||||
|
||||
this.scanner.skipSC();
|
||||
}
|
||||
|
||||
// attribute flags
|
||||
if (this.scanner.tokenType === IDENTIFIER) {
|
||||
flags = this.scanner.getTokenValue();
|
||||
this.scanner.next();
|
||||
|
||||
this.scanner.skipSC();
|
||||
}
|
||||
}
|
||||
|
||||
this.scanner.eat(RIGHTSQUAREBRACKET);
|
||||
|
||||
return {
|
||||
type: 'AttributeSelector',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
name: name,
|
||||
matcher: matcher,
|
||||
value: value,
|
||||
flags: flags
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
var flagsPrefix = ' ';
|
||||
|
||||
processChunk('[');
|
||||
this.generate(processChunk, node.name);
|
||||
|
||||
if (node.matcher !== null) {
|
||||
processChunk(node.matcher);
|
||||
|
||||
if (node.value !== null) {
|
||||
this.generate(processChunk, node.value);
|
||||
|
||||
// space between string and flags is not required
|
||||
if (node.value.type === 'String') {
|
||||
flagsPrefix = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (node.flags !== null) {
|
||||
processChunk(flagsPrefix);
|
||||
processChunk(node.flags);
|
||||
}
|
||||
|
||||
processChunk(']');
|
||||
}
|
||||
};
|
||||
79
build/node_modules/css-tree/lib/syntax/node/Block.js
generated
vendored
Normal file
79
build/node_modules/css-tree/lib/syntax/node/Block.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
var List = require('../../utils/list');
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var WHITESPACE = TYPE.WhiteSpace;
|
||||
var COMMENT = TYPE.Comment;
|
||||
var SEMICOLON = TYPE.Semicolon;
|
||||
var ATRULE = TYPE.Atrule;
|
||||
var LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;
|
||||
var RIGHTCURLYBRACKET = TYPE.RightCurlyBracket;
|
||||
|
||||
function consumeRaw(startToken) {
|
||||
return this.Raw(startToken, 0, 0, false, true);
|
||||
}
|
||||
function consumeRule() {
|
||||
return this.tolerantParse(this.Rule, consumeRaw);
|
||||
}
|
||||
function consumeRawDeclaration(startToken) {
|
||||
return this.Raw(startToken, 0, SEMICOLON, true, true);
|
||||
}
|
||||
function consumeDeclaration() {
|
||||
var node = this.tolerantParse(this.Declaration, consumeRawDeclaration);
|
||||
|
||||
if (this.scanner.tokenType === SEMICOLON) {
|
||||
this.scanner.next();
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'Block',
|
||||
structure: {
|
||||
children: [['Atrule', 'Rule', 'Declaration']]
|
||||
},
|
||||
parse: function(isDeclaration) {
|
||||
var consumer = isDeclaration ? consumeDeclaration : consumeRule;
|
||||
|
||||
var start = this.scanner.tokenStart;
|
||||
var children = new List();
|
||||
|
||||
this.scanner.eat(LEFTCURLYBRACKET);
|
||||
|
||||
scan:
|
||||
while (!this.scanner.eof) {
|
||||
switch (this.scanner.tokenType) {
|
||||
case RIGHTCURLYBRACKET:
|
||||
break scan;
|
||||
|
||||
case WHITESPACE:
|
||||
case COMMENT:
|
||||
this.scanner.next();
|
||||
break;
|
||||
|
||||
case ATRULE:
|
||||
children.appendData(this.tolerantParse(this.Atrule, consumeRaw));
|
||||
break;
|
||||
|
||||
default:
|
||||
children.appendData(consumer.call(this));
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.tolerant || !this.scanner.eof) {
|
||||
this.scanner.eat(RIGHTCURLYBRACKET);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Block',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
children: children
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk('{');
|
||||
this.each(processChunk, node);
|
||||
processChunk('}');
|
||||
},
|
||||
walkContext: 'block'
|
||||
};
|
||||
32
build/node_modules/css-tree/lib/syntax/node/Brackets.js
generated
vendored
Normal file
32
build/node_modules/css-tree/lib/syntax/node/Brackets.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
var LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;
|
||||
var RIGHTSQUAREBRACKET = TYPE.RightSquareBracket;
|
||||
|
||||
// currently only Grid Layout uses square brackets, but left it universal
|
||||
// https://drafts.csswg.org/css-grid/#track-sizing
|
||||
// [ ident* ]
|
||||
module.exports = {
|
||||
name: 'Brackets',
|
||||
structure: {
|
||||
children: [[]]
|
||||
},
|
||||
parse: function(readSequence, recognizer) {
|
||||
var start = this.scanner.tokenStart;
|
||||
var children = null;
|
||||
|
||||
this.scanner.eat(LEFTSQUAREBRACKET);
|
||||
children = readSequence.call(this, recognizer);
|
||||
this.scanner.eat(RIGHTSQUAREBRACKET);
|
||||
|
||||
return {
|
||||
type: 'Brackets',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
children: children
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk('[');
|
||||
this.each(processChunk, node);
|
||||
processChunk(']');
|
||||
}
|
||||
};
|
||||
19
build/node_modules/css-tree/lib/syntax/node/CDC.js
generated
vendored
Normal file
19
build/node_modules/css-tree/lib/syntax/node/CDC.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
var CDC = require('../../tokenizer').TYPE.CDC;
|
||||
|
||||
module.exports = {
|
||||
name: 'CDC',
|
||||
structure: [],
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
|
||||
this.scanner.eat(CDC); // -->
|
||||
|
||||
return {
|
||||
type: 'CDC',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart)
|
||||
};
|
||||
},
|
||||
generate: function(processChunk) {
|
||||
processChunk('-->');
|
||||
}
|
||||
};
|
||||
19
build/node_modules/css-tree/lib/syntax/node/CDO.js
generated
vendored
Normal file
19
build/node_modules/css-tree/lib/syntax/node/CDO.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
var CDO = require('../../tokenizer').TYPE.CDO;
|
||||
|
||||
module.exports = {
|
||||
name: 'CDO',
|
||||
structure: [],
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
|
||||
this.scanner.eat(CDO); // <!--
|
||||
|
||||
return {
|
||||
type: 'CDO',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart)
|
||||
};
|
||||
},
|
||||
generate: function(processChunk) {
|
||||
processChunk('<!--');
|
||||
}
|
||||
};
|
||||
24
build/node_modules/css-tree/lib/syntax/node/ClassSelector.js
generated
vendored
Normal file
24
build/node_modules/css-tree/lib/syntax/node/ClassSelector.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var FULLSTOP = TYPE.FullStop;
|
||||
|
||||
// '.' ident
|
||||
module.exports = {
|
||||
name: 'ClassSelector',
|
||||
structure: {
|
||||
name: String
|
||||
},
|
||||
parse: function() {
|
||||
this.scanner.eat(FULLSTOP);
|
||||
|
||||
return {
|
||||
type: 'ClassSelector',
|
||||
loc: this.getLocation(this.scanner.tokenStart - 1, this.scanner.tokenEnd),
|
||||
name: this.scanner.consume(IDENTIFIER)
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk('.');
|
||||
processChunk(node.name);
|
||||
}
|
||||
};
|
||||
43
build/node_modules/css-tree/lib/syntax/node/Combinator.js
generated
vendored
Normal file
43
build/node_modules/css-tree/lib/syntax/node/Combinator.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var PLUSSIGN = TYPE.PlusSign;
|
||||
var SOLIDUS = TYPE.Solidus;
|
||||
var GREATERTHANSIGN = TYPE.GreaterThanSign;
|
||||
var TILDE = TYPE.Tilde;
|
||||
|
||||
// + | > | ~ | /deep/
|
||||
module.exports = {
|
||||
name: 'Combinator',
|
||||
structure: {
|
||||
name: String
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
|
||||
switch (this.scanner.tokenType) {
|
||||
case GREATERTHANSIGN:
|
||||
case PLUSSIGN:
|
||||
case TILDE:
|
||||
this.scanner.next();
|
||||
break;
|
||||
|
||||
case SOLIDUS:
|
||||
this.scanner.next();
|
||||
this.scanner.expectIdentifier('deep');
|
||||
this.scanner.eat(SOLIDUS);
|
||||
break;
|
||||
|
||||
default:
|
||||
this.scanner.error('Combinator is expected');
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Combinator',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
name: this.scanner.substrToCursor(start)
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk(node.name);
|
||||
}
|
||||
};
|
||||
35
build/node_modules/css-tree/lib/syntax/node/Comment.js
generated
vendored
Normal file
35
build/node_modules/css-tree/lib/syntax/node/Comment.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var ASTERISK = TYPE.Asterisk;
|
||||
var SOLIDUS = TYPE.Solidus;
|
||||
|
||||
// '/*' .* '*/'
|
||||
module.exports = {
|
||||
name: 'Comment',
|
||||
structure: {
|
||||
value: String
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var end = this.scanner.tokenEnd;
|
||||
|
||||
if ((end - start + 2) >= 2 &&
|
||||
this.scanner.source.charCodeAt(end - 2) === ASTERISK &&
|
||||
this.scanner.source.charCodeAt(end - 1) === SOLIDUS) {
|
||||
end -= 2;
|
||||
}
|
||||
|
||||
this.scanner.next();
|
||||
|
||||
return {
|
||||
type: 'Comment',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
value: this.scanner.source.substring(start + 2, end)
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk('/*');
|
||||
processChunk(node.value);
|
||||
processChunk('*/');
|
||||
}
|
||||
};
|
||||
127
build/node_modules/css-tree/lib/syntax/node/Declaration.js
generated
vendored
Normal file
127
build/node_modules/css-tree/lib/syntax/node/Declaration.js
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var COLON = TYPE.Colon;
|
||||
var EXCLAMATIONMARK = TYPE.ExclamationMark;
|
||||
var SOLIDUS = TYPE.Solidus;
|
||||
var ASTERISK = TYPE.Asterisk;
|
||||
var DOLLARSIGN = TYPE.DollarSign;
|
||||
var HYPHENMINUS = TYPE.HyphenMinus;
|
||||
var SEMICOLON = TYPE.Semicolon;
|
||||
var RIGHTCURLYBRACKET = TYPE.RightCurlyBracket;
|
||||
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
|
||||
var PLUSSIGN = TYPE.PlusSign;
|
||||
var NUMBERSIGN = TYPE.NumberSign;
|
||||
|
||||
module.exports = {
|
||||
name: 'Declaration',
|
||||
structure: {
|
||||
important: [Boolean, String],
|
||||
property: String,
|
||||
value: ['Value', 'Raw']
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var property = readProperty.call(this);
|
||||
var important = false;
|
||||
var value;
|
||||
|
||||
this.scanner.skipSC();
|
||||
this.scanner.eat(COLON);
|
||||
|
||||
if (isCustomProperty(property) ? this.parseCustomProperty : this.parseValue) {
|
||||
value = this.Value(property);
|
||||
} else {
|
||||
value = this.Raw(this.scanner.currentToken, EXCLAMATIONMARK, SEMICOLON, false, false);
|
||||
}
|
||||
|
||||
if (this.scanner.tokenType === EXCLAMATIONMARK) {
|
||||
important = getImportant(this.scanner);
|
||||
this.scanner.skipSC();
|
||||
}
|
||||
|
||||
// TODO: include or not to include semicolon to range?
|
||||
// if (this.scanner.tokenType === SEMICOLON) {
|
||||
// this.scanner.next();
|
||||
// }
|
||||
|
||||
if (!this.scanner.eof &&
|
||||
this.scanner.tokenType !== SEMICOLON &&
|
||||
this.scanner.tokenType !== RIGHTPARENTHESIS &&
|
||||
this.scanner.tokenType !== RIGHTCURLYBRACKET) {
|
||||
this.scanner.error();
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Declaration',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
important: important,
|
||||
property: property,
|
||||
value: value
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node, item) {
|
||||
processChunk(node.property);
|
||||
processChunk(':');
|
||||
this.generate(processChunk, node.value);
|
||||
|
||||
if (node.important) {
|
||||
processChunk(node.important === true ? '!important' : '!' + node.important);
|
||||
}
|
||||
|
||||
if (item && item.next) {
|
||||
processChunk(';');
|
||||
}
|
||||
},
|
||||
walkContext: 'declaration'
|
||||
};
|
||||
|
||||
function isCustomProperty(name) {
|
||||
return name.length >= 2 &&
|
||||
name.charCodeAt(0) === HYPHENMINUS &&
|
||||
name.charCodeAt(1) === HYPHENMINUS;
|
||||
}
|
||||
|
||||
function readProperty() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var prefix = 0;
|
||||
|
||||
// hacks
|
||||
switch (this.scanner.tokenType) {
|
||||
case ASTERISK:
|
||||
case DOLLARSIGN:
|
||||
case PLUSSIGN:
|
||||
case NUMBERSIGN:
|
||||
prefix = 1;
|
||||
break;
|
||||
|
||||
// TODO: not sure we should support this hack
|
||||
case SOLIDUS:
|
||||
prefix = this.scanner.lookupType(1) === SOLIDUS ? 2 : 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.scanner.lookupType(prefix) === HYPHENMINUS) {
|
||||
prefix++;
|
||||
}
|
||||
|
||||
if (prefix) {
|
||||
this.scanner.skip(prefix);
|
||||
}
|
||||
|
||||
this.scanner.eat(IDENTIFIER);
|
||||
|
||||
return this.scanner.substrToCursor(start);
|
||||
}
|
||||
|
||||
// ! ws* important
|
||||
function getImportant(scanner) {
|
||||
scanner.eat(EXCLAMATIONMARK);
|
||||
scanner.skipSC();
|
||||
|
||||
var important = scanner.consume(IDENTIFIER);
|
||||
|
||||
// store original value in case it differ from `important`
|
||||
// for better original source restoring and hacks like `!ie` support
|
||||
return important === 'important' ? true : important;
|
||||
}
|
||||
43
build/node_modules/css-tree/lib/syntax/node/DeclarationList.js
generated
vendored
Normal file
43
build/node_modules/css-tree/lib/syntax/node/DeclarationList.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
var List = require('../../utils/list');
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var WHITESPACE = TYPE.WhiteSpace;
|
||||
var COMMENT = TYPE.Comment;
|
||||
var SEMICOLON = TYPE.Semicolon;
|
||||
|
||||
function consumeRaw(startToken) {
|
||||
return this.Raw(startToken, 0, SEMICOLON, true, true);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'DeclarationList',
|
||||
structure: {
|
||||
children: [['Declaration']]
|
||||
},
|
||||
parse: function() {
|
||||
var children = new List();
|
||||
|
||||
scan:
|
||||
while (!this.scanner.eof) {
|
||||
switch (this.scanner.tokenType) {
|
||||
case WHITESPACE:
|
||||
case COMMENT:
|
||||
case SEMICOLON:
|
||||
this.scanner.next();
|
||||
break;
|
||||
|
||||
default:
|
||||
children.appendData(this.tolerantParse(this.Declaration, consumeRaw));
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'DeclarationList',
|
||||
loc: this.getLocationFromList(children),
|
||||
children: children
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
this.each(processChunk, node);
|
||||
}
|
||||
};
|
||||
45
build/node_modules/css-tree/lib/syntax/node/Dimension.js
generated
vendored
Normal file
45
build/node_modules/css-tree/lib/syntax/node/Dimension.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
var NUMBER = require('../../tokenizer').TYPE.Number;
|
||||
|
||||
// special reader for units to avoid adjoined IE hacks (i.e. '1px\9')
|
||||
function readUnit(scanner) {
|
||||
var unit = scanner.getTokenValue();
|
||||
var backSlashPos = unit.indexOf('\\');
|
||||
|
||||
if (backSlashPos > 0) {
|
||||
// patch token offset
|
||||
scanner.tokenStart += backSlashPos;
|
||||
|
||||
// return part before backslash
|
||||
return unit.substring(0, backSlashPos);
|
||||
}
|
||||
|
||||
// no backslash in unit name
|
||||
scanner.next();
|
||||
|
||||
return unit;
|
||||
}
|
||||
|
||||
// number ident
|
||||
module.exports = {
|
||||
name: 'Dimension',
|
||||
structure: {
|
||||
value: String,
|
||||
unit: String
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var value = this.scanner.consume(NUMBER);
|
||||
var unit = readUnit(this.scanner);
|
||||
|
||||
return {
|
||||
type: 'Dimension',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
value: value,
|
||||
unit: unit
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk(node.value);
|
||||
processChunk(node.unit);
|
||||
}
|
||||
};
|
||||
37
build/node_modules/css-tree/lib/syntax/node/Function.js
generated
vendored
Normal file
37
build/node_modules/css-tree/lib/syntax/node/Function.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
|
||||
|
||||
// <function-token> <sequence> ')'
|
||||
module.exports = {
|
||||
name: 'Function',
|
||||
structure: {
|
||||
name: String,
|
||||
children: [[]]
|
||||
},
|
||||
parse: function(readSequence, recognizer) {
|
||||
var start = this.scanner.tokenStart;
|
||||
var name = this.scanner.consumeFunctionName();
|
||||
var nameLowerCase = name.toLowerCase();
|
||||
var children;
|
||||
|
||||
children = recognizer.hasOwnProperty(nameLowerCase)
|
||||
? recognizer[nameLowerCase].call(this, recognizer)
|
||||
: readSequence.call(this, recognizer);
|
||||
|
||||
this.scanner.eat(RIGHTPARENTHESIS);
|
||||
|
||||
return {
|
||||
type: 'Function',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
name: name,
|
||||
children: children
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk(node.name);
|
||||
processChunk('(');
|
||||
this.each(processChunk, node);
|
||||
processChunk(')');
|
||||
},
|
||||
walkContext: 'function'
|
||||
};
|
||||
74
build/node_modules/css-tree/lib/syntax/node/HexColor.js
generated
vendored
Normal file
74
build/node_modules/css-tree/lib/syntax/node/HexColor.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
var isHex = require('../../tokenizer').isHex;
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var NUMBER = TYPE.Number;
|
||||
var NUMBERSIGN = TYPE.NumberSign;
|
||||
|
||||
function consumeHexSequence(scanner, required) {
|
||||
if (!isHex(scanner.source.charCodeAt(scanner.tokenStart))) {
|
||||
if (required) {
|
||||
scanner.error('Unexpected input', scanner.tokenStart);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (var pos = scanner.tokenStart + 1; pos < scanner.tokenEnd; pos++) {
|
||||
var code = scanner.source.charCodeAt(pos);
|
||||
|
||||
// break on non-hex char
|
||||
if (!isHex(code)) {
|
||||
// break token, exclude symbol
|
||||
scanner.tokenStart = pos;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// token is full hex sequence, go to next token
|
||||
scanner.next();
|
||||
}
|
||||
|
||||
// # ident
|
||||
module.exports = {
|
||||
name: 'HexColor',
|
||||
structure: {
|
||||
value: String
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
|
||||
this.scanner.eat(NUMBERSIGN);
|
||||
|
||||
scan:
|
||||
switch (this.scanner.tokenType) {
|
||||
case NUMBER:
|
||||
consumeHexSequence(this.scanner, true);
|
||||
|
||||
// if token is identifier then number consists of hex only,
|
||||
// try to add identifier to result
|
||||
if (this.scanner.tokenType === IDENTIFIER) {
|
||||
consumeHexSequence(this.scanner, false);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case IDENTIFIER:
|
||||
consumeHexSequence(this.scanner, true);
|
||||
break;
|
||||
|
||||
default:
|
||||
this.scanner.error('Number or identifier is expected');
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'HexColor',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
value: this.scanner.substrToCursor(start + 1) // skip #
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk('#');
|
||||
processChunk(node.value);
|
||||
}
|
||||
};
|
||||
24
build/node_modules/css-tree/lib/syntax/node/IdSelector.js
generated
vendored
Normal file
24
build/node_modules/css-tree/lib/syntax/node/IdSelector.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var NUMBERSIGN = TYPE.NumberSign;
|
||||
|
||||
// '#' ident
|
||||
module.exports = {
|
||||
name: 'IdSelector',
|
||||
structure: {
|
||||
name: String
|
||||
},
|
||||
parse: function() {
|
||||
this.scanner.eat(NUMBERSIGN);
|
||||
|
||||
return {
|
||||
type: 'IdSelector',
|
||||
loc: this.getLocation(this.scanner.tokenStart - 1, this.scanner.tokenEnd),
|
||||
name: this.scanner.consume(IDENTIFIER)
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk('#');
|
||||
processChunk(node.name);
|
||||
}
|
||||
};
|
||||
19
build/node_modules/css-tree/lib/syntax/node/Identifier.js
generated
vendored
Normal file
19
build/node_modules/css-tree/lib/syntax/node/Identifier.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
|
||||
module.exports = {
|
||||
name: 'Identifier',
|
||||
structure: {
|
||||
name: String
|
||||
},
|
||||
parse: function() {
|
||||
return {
|
||||
type: 'Identifier',
|
||||
loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
|
||||
name: this.scanner.consume(IDENTIFIER)
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk(node.name);
|
||||
}
|
||||
};
|
||||
73
build/node_modules/css-tree/lib/syntax/node/MediaFeature.js
generated
vendored
Normal file
73
build/node_modules/css-tree/lib/syntax/node/MediaFeature.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var NUMBER = TYPE.Number;
|
||||
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
|
||||
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
|
||||
var COLON = TYPE.Colon;
|
||||
var SOLIDUS = TYPE.Solidus;
|
||||
|
||||
module.exports = {
|
||||
name: 'MediaFeature',
|
||||
structure: {
|
||||
name: String,
|
||||
value: ['Identifier', 'Number', 'Dimension', 'Ratio', null]
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var name;
|
||||
var value = null;
|
||||
|
||||
this.scanner.eat(LEFTPARENTHESIS);
|
||||
this.scanner.skipSC();
|
||||
|
||||
name = this.scanner.consume(IDENTIFIER);
|
||||
this.scanner.skipSC();
|
||||
|
||||
if (this.scanner.tokenType !== RIGHTPARENTHESIS) {
|
||||
this.scanner.eat(COLON);
|
||||
this.scanner.skipSC();
|
||||
|
||||
switch (this.scanner.tokenType) {
|
||||
case NUMBER:
|
||||
if (this.scanner.lookupType(1) === IDENTIFIER) {
|
||||
value = this.Dimension();
|
||||
} else if (this.scanner.lookupNonWSType(1) === SOLIDUS) {
|
||||
value = this.Ratio();
|
||||
} else {
|
||||
value = this.Number();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case IDENTIFIER:
|
||||
value = this.Identifier();
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
this.scanner.error('Number, dimension, ratio or identifier is expected');
|
||||
}
|
||||
|
||||
this.scanner.skipSC();
|
||||
}
|
||||
|
||||
this.scanner.eat(RIGHTPARENTHESIS);
|
||||
|
||||
return {
|
||||
type: 'MediaFeature',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
name: name,
|
||||
value: value
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk('(');
|
||||
processChunk(node.name);
|
||||
if (node.value !== null) {
|
||||
processChunk(':');
|
||||
this.generate(processChunk, node.value);
|
||||
}
|
||||
processChunk(')');
|
||||
}
|
||||
};
|
||||
65
build/node_modules/css-tree/lib/syntax/node/MediaQuery.js
generated
vendored
Normal file
65
build/node_modules/css-tree/lib/syntax/node/MediaQuery.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
var List = require('../../utils/list');
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var WHITESPACE = TYPE.WhiteSpace;
|
||||
var COMMENT = TYPE.Comment;
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
|
||||
|
||||
module.exports = {
|
||||
name: 'MediaQuery',
|
||||
structure: {
|
||||
children: [['Identifier', 'MediaFeature', 'WhiteSpace']]
|
||||
},
|
||||
parse: function() {
|
||||
this.scanner.skipSC();
|
||||
|
||||
var children = new List();
|
||||
var child = null;
|
||||
var space = null;
|
||||
|
||||
scan:
|
||||
while (!this.scanner.eof) {
|
||||
switch (this.scanner.tokenType) {
|
||||
case COMMENT:
|
||||
this.scanner.next();
|
||||
continue;
|
||||
|
||||
case WHITESPACE:
|
||||
space = this.WhiteSpace();
|
||||
continue;
|
||||
|
||||
case IDENTIFIER:
|
||||
child = this.Identifier();
|
||||
break;
|
||||
|
||||
case LEFTPARENTHESIS:
|
||||
child = this.MediaFeature();
|
||||
break;
|
||||
|
||||
default:
|
||||
break scan;
|
||||
}
|
||||
|
||||
if (space !== null) {
|
||||
children.appendData(space);
|
||||
space = null;
|
||||
}
|
||||
|
||||
children.appendData(child);
|
||||
}
|
||||
|
||||
if (child === null) {
|
||||
this.scanner.error('Identifier or parenthesis is expected');
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'MediaQuery',
|
||||
loc: this.getLocationFromList(children),
|
||||
children: children
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
this.each(processChunk, node);
|
||||
}
|
||||
};
|
||||
33
build/node_modules/css-tree/lib/syntax/node/MediaQueryList.js
generated
vendored
Normal file
33
build/node_modules/css-tree/lib/syntax/node/MediaQueryList.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
var List = require('../../utils/list');
|
||||
var COMMA = require('../../tokenizer').TYPE.Comma;
|
||||
|
||||
module.exports = {
|
||||
name: 'MediaQueryList',
|
||||
structure: {
|
||||
children: [['MediaQuery']]
|
||||
},
|
||||
parse: function(relative) {
|
||||
var children = new List();
|
||||
|
||||
this.scanner.skipSC();
|
||||
|
||||
while (!this.scanner.eof) {
|
||||
children.appendData(this.MediaQuery(relative));
|
||||
|
||||
if (this.scanner.tokenType !== COMMA) {
|
||||
break;
|
||||
}
|
||||
|
||||
this.scanner.next();
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'MediaQueryList',
|
||||
loc: this.getLocationFromList(children),
|
||||
children: children
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
this.eachComma(processChunk, node);
|
||||
}
|
||||
};
|
||||
52
build/node_modules/css-tree/lib/syntax/node/Nth.js
generated
vendored
Normal file
52
build/node_modules/css-tree/lib/syntax/node/Nth.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
// https://drafts.csswg.org/css-syntax-3/#the-anb-type
|
||||
module.exports = {
|
||||
name: 'Nth',
|
||||
structure: {
|
||||
nth: ['AnPlusB', 'Identifier'],
|
||||
selector: ['SelectorList', null]
|
||||
},
|
||||
parse: function(allowOfClause) {
|
||||
this.scanner.skipSC();
|
||||
|
||||
var start = this.scanner.tokenStart;
|
||||
var end = start;
|
||||
var selector = null;
|
||||
var query;
|
||||
|
||||
if (this.scanner.lookupValue(0, 'odd') || this.scanner.lookupValue(0, 'even')) {
|
||||
query = this.Identifier();
|
||||
} else {
|
||||
query = this.AnPlusB();
|
||||
}
|
||||
|
||||
this.scanner.skipSC();
|
||||
|
||||
if (allowOfClause && this.scanner.lookupValue(0, 'of')) {
|
||||
this.scanner.next();
|
||||
|
||||
selector = this.SelectorList();
|
||||
|
||||
if (this.needPositions) {
|
||||
end = selector.children.last().loc.end.offset;
|
||||
}
|
||||
} else {
|
||||
if (this.needPositions) {
|
||||
end = query.loc.end.offset;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Nth',
|
||||
loc: this.getLocation(start, end),
|
||||
nth: query,
|
||||
selector: selector
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
this.generate(processChunk, node.nth);
|
||||
if (node.selector !== null) {
|
||||
processChunk(' of ');
|
||||
this.generate(processChunk, node.selector);
|
||||
}
|
||||
}
|
||||
};
|
||||
18
build/node_modules/css-tree/lib/syntax/node/Number.js
generated
vendored
Normal file
18
build/node_modules/css-tree/lib/syntax/node/Number.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
var NUMBER = require('../../tokenizer').TYPE.Number;
|
||||
|
||||
module.exports = {
|
||||
name: 'Number',
|
||||
structure: {
|
||||
value: String
|
||||
},
|
||||
parse: function() {
|
||||
return {
|
||||
type: 'Number',
|
||||
loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
|
||||
value: this.scanner.consume(NUMBER)
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk(node.value);
|
||||
}
|
||||
};
|
||||
21
build/node_modules/css-tree/lib/syntax/node/Operator.js
generated
vendored
Normal file
21
build/node_modules/css-tree/lib/syntax/node/Operator.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
// '/' | '*' | ',' | ':' | '+' | '-'
|
||||
module.exports = {
|
||||
name: 'Operator',
|
||||
structure: {
|
||||
value: String
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
|
||||
this.scanner.next();
|
||||
|
||||
return {
|
||||
type: 'Operator',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
value: this.scanner.substrToCursor(start)
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk(node.value);
|
||||
}
|
||||
};
|
||||
29
build/node_modules/css-tree/lib/syntax/node/Parentheses.js
generated
vendored
Normal file
29
build/node_modules/css-tree/lib/syntax/node/Parentheses.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
|
||||
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
|
||||
|
||||
module.exports = {
|
||||
name: 'Parentheses',
|
||||
structure: {
|
||||
children: [[]]
|
||||
},
|
||||
parse: function(readSequence, recognizer) {
|
||||
var start = this.scanner.tokenStart;
|
||||
var children = null;
|
||||
|
||||
this.scanner.eat(LEFTPARENTHESIS);
|
||||
children = readSequence.call(this, recognizer);
|
||||
this.scanner.eat(RIGHTPARENTHESIS);
|
||||
|
||||
return {
|
||||
type: 'Parentheses',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
children: children
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk('(');
|
||||
this.each(processChunk, node);
|
||||
processChunk(')');
|
||||
}
|
||||
};
|
||||
27
build/node_modules/css-tree/lib/syntax/node/Percentage.js
generated
vendored
Normal file
27
build/node_modules/css-tree/lib/syntax/node/Percentage.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var NUMBER = TYPE.Number;
|
||||
var PERCENTSIGN = TYPE.PercentSign;
|
||||
|
||||
module.exports = {
|
||||
name: 'Percentage',
|
||||
structure: {
|
||||
value: String
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var number = this.scanner.consume(NUMBER);
|
||||
|
||||
this.scanner.eat(PERCENTSIGN);
|
||||
|
||||
return {
|
||||
type: 'Percentage',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
value: number
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk(node.value);
|
||||
processChunk('%');
|
||||
}
|
||||
};
|
||||
61
build/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
generated
vendored
Normal file
61
build/node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
var List = require('../../utils/list');
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var FUNCTION = TYPE.Function;
|
||||
var COLON = TYPE.Colon;
|
||||
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
|
||||
|
||||
// : ident [ '(' .. ')' ]?
|
||||
module.exports = {
|
||||
name: 'PseudoClassSelector',
|
||||
structure: {
|
||||
name: String,
|
||||
children: [['Raw'], null]
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var children = null;
|
||||
var name;
|
||||
var nameLowerCase;
|
||||
|
||||
this.scanner.eat(COLON);
|
||||
|
||||
if (this.scanner.tokenType === FUNCTION) {
|
||||
name = this.scanner.consumeFunctionName();
|
||||
nameLowerCase = name.toLowerCase();
|
||||
|
||||
if (this.pseudo.hasOwnProperty(nameLowerCase)) {
|
||||
this.scanner.skipSC();
|
||||
children = this.pseudo[nameLowerCase].call(this);
|
||||
this.scanner.skipSC();
|
||||
} else {
|
||||
children = new List().appendData(
|
||||
this.Raw(this.scanner.currentToken, 0, 0, false, false)
|
||||
);
|
||||
}
|
||||
|
||||
this.scanner.eat(RIGHTPARENTHESIS);
|
||||
} else {
|
||||
name = this.scanner.consume(IDENTIFIER);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'PseudoClassSelector',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
name: name,
|
||||
children: children
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk(':');
|
||||
processChunk(node.name);
|
||||
|
||||
if (node.children !== null) {
|
||||
processChunk('(');
|
||||
this.each(processChunk, node);
|
||||
processChunk(')');
|
||||
}
|
||||
},
|
||||
walkContext: 'function'
|
||||
};
|
||||
62
build/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
generated
vendored
Normal file
62
build/node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
var List = require('../../utils/list');
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var FUNCTION = TYPE.Function;
|
||||
var COLON = TYPE.Colon;
|
||||
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
|
||||
|
||||
// :: ident [ '(' .. ')' ]?
|
||||
module.exports = {
|
||||
name: 'PseudoElementSelector',
|
||||
structure: {
|
||||
name: String,
|
||||
children: [['Raw'], null]
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var children = null;
|
||||
var name;
|
||||
var nameLowerCase;
|
||||
|
||||
this.scanner.eat(COLON);
|
||||
this.scanner.eat(COLON);
|
||||
|
||||
if (this.scanner.tokenType === FUNCTION) {
|
||||
name = this.scanner.consumeFunctionName();
|
||||
nameLowerCase = name.toLowerCase();
|
||||
|
||||
if (this.pseudo.hasOwnProperty(nameLowerCase)) {
|
||||
this.scanner.skipSC();
|
||||
children = this.pseudo[nameLowerCase].call(this);
|
||||
this.scanner.skipSC();
|
||||
} else {
|
||||
children = new List().appendData(
|
||||
this.Raw(this.scanner.currentToken, 0, 0, false, false)
|
||||
);
|
||||
}
|
||||
|
||||
this.scanner.eat(RIGHTPARENTHESIS);
|
||||
} else {
|
||||
name = this.scanner.consume(IDENTIFIER);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'PseudoElementSelector',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
name: name,
|
||||
children: children
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk('::');
|
||||
processChunk(node.name);
|
||||
|
||||
if (node.children !== null) {
|
||||
processChunk('(');
|
||||
this.each(processChunk, node);
|
||||
processChunk(')');
|
||||
}
|
||||
},
|
||||
walkContext: 'function'
|
||||
};
|
||||
57
build/node_modules/css-tree/lib/syntax/node/Ratio.js
generated
vendored
Normal file
57
build/node_modules/css-tree/lib/syntax/node/Ratio.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
var isNumber = require('../../tokenizer').isNumber;
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
var NUMBER = TYPE.Number;
|
||||
var SOLIDUS = TYPE.Solidus;
|
||||
var FULLSTOP = TYPE.FullStop;
|
||||
|
||||
// Terms of <ratio> should to be a positive number (not zero or negative)
|
||||
// (see https://drafts.csswg.org/mediaqueries-3/#values)
|
||||
// However, -o-min-device-pixel-ratio takes fractional values as a ratio's term
|
||||
// and this is using by various sites. Therefore we relax checking on parse
|
||||
// to test a term is unsigned number without exponent part.
|
||||
// Additional checks may to be applied on lexer validation.
|
||||
function consumeNumber(scanner) {
|
||||
var value = scanner.consumeNonWS(NUMBER);
|
||||
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
var code = value.charCodeAt(i);
|
||||
if (!isNumber(code) && code !== FULLSTOP) {
|
||||
scanner.error('Unsigned number is expected', scanner.tokenStart - value.length + i);
|
||||
}
|
||||
}
|
||||
|
||||
if (Number(value) === 0) {
|
||||
scanner.error('Zero number is not allowed', scanner.tokenStart - value.length);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
// <positive-integer> S* '/' S* <positive-integer>
|
||||
module.exports = {
|
||||
name: 'Ratio',
|
||||
structure: {
|
||||
left: String,
|
||||
right: String
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var left = consumeNumber(this.scanner);
|
||||
var right;
|
||||
|
||||
this.scanner.eatNonWS(SOLIDUS);
|
||||
right = consumeNumber(this.scanner);
|
||||
|
||||
return {
|
||||
type: 'Ratio',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
left: left,
|
||||
right: right
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk(node.left);
|
||||
processChunk('/');
|
||||
processChunk(node.right);
|
||||
}
|
||||
};
|
||||
34
build/node_modules/css-tree/lib/syntax/node/Raw.js
generated
vendored
Normal file
34
build/node_modules/css-tree/lib/syntax/node/Raw.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
module.exports = {
|
||||
name: 'Raw',
|
||||
structure: {
|
||||
value: String
|
||||
},
|
||||
parse: function(startToken, endTokenType1, endTokenType2, includeTokenType2, excludeWhiteSpace) {
|
||||
var startOffset = this.scanner.getTokenStart(startToken);
|
||||
var endOffset;
|
||||
|
||||
this.scanner.skip(
|
||||
this.scanner.getRawLength(
|
||||
startToken,
|
||||
endTokenType1,
|
||||
endTokenType2,
|
||||
includeTokenType2
|
||||
)
|
||||
);
|
||||
|
||||
if (excludeWhiteSpace && this.scanner.tokenStart > startOffset) {
|
||||
endOffset = this.scanner.getOffsetExcludeWS();
|
||||
} else {
|
||||
endOffset = this.scanner.tokenStart;
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Raw',
|
||||
loc: this.getLocation(startOffset, endOffset),
|
||||
value: this.scanner.source.substring(startOffset, endOffset)
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk(node.value);
|
||||
}
|
||||
};
|
||||
47
build/node_modules/css-tree/lib/syntax/node/Rule.js
generated
vendored
Normal file
47
build/node_modules/css-tree/lib/syntax/node/Rule.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;
|
||||
|
||||
function consumeRaw(startToken) {
|
||||
return this.Raw(startToken, LEFTCURLYBRACKET, 0, false, true);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'Rule',
|
||||
structure: {
|
||||
prelude: ['SelectorList', 'Raw'],
|
||||
block: ['Block']
|
||||
},
|
||||
parse: function() {
|
||||
var startToken = this.scanner.currentToken;
|
||||
var startOffset = this.scanner.tokenStart;
|
||||
var prelude;
|
||||
var block;
|
||||
|
||||
if (this.parseRulePrelude) {
|
||||
prelude = this.tolerantParse(this.SelectorList, consumeRaw);
|
||||
|
||||
if (this.tolerant && !this.scanner.eof) {
|
||||
if (prelude.type !== 'Raw' && this.scanner.tokenType !== LEFTCURLYBRACKET) {
|
||||
prelude = consumeRaw.call(this, startToken);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
prelude = consumeRaw.call(this, startToken);
|
||||
}
|
||||
|
||||
block = this.Block(true);
|
||||
|
||||
return {
|
||||
type: 'Rule',
|
||||
loc: this.getLocation(startOffset, this.scanner.tokenStart),
|
||||
prelude: prelude,
|
||||
block: block
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
this.generate(processChunk, node.prelude);
|
||||
this.generate(processChunk, node.block);
|
||||
},
|
||||
walkContext: 'rule'
|
||||
};
|
||||
32
build/node_modules/css-tree/lib/syntax/node/Selector.js
generated
vendored
Normal file
32
build/node_modules/css-tree/lib/syntax/node/Selector.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
module.exports = {
|
||||
name: 'Selector',
|
||||
structure: {
|
||||
children: [[
|
||||
'TypeSelector',
|
||||
'IdSelector',
|
||||
'ClassSelector',
|
||||
'AttributeSelector',
|
||||
'PseudoClassSelector',
|
||||
'PseudoElementSelector',
|
||||
'Combinator',
|
||||
'WhiteSpace'
|
||||
]]
|
||||
},
|
||||
parse: function() {
|
||||
var children = this.readSequence(this.scope.Selector);
|
||||
|
||||
// nothing were consumed
|
||||
if (children.isEmpty()) {
|
||||
this.scanner.error('Selector is expected');
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Selector',
|
||||
loc: this.getLocationFromList(children),
|
||||
children: children
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
this.each(processChunk, node);
|
||||
}
|
||||
};
|
||||
35
build/node_modules/css-tree/lib/syntax/node/SelectorList.js
generated
vendored
Normal file
35
build/node_modules/css-tree/lib/syntax/node/SelectorList.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
var List = require('../../utils/list');
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var COMMA = TYPE.Comma;
|
||||
|
||||
module.exports = {
|
||||
name: 'SelectorList',
|
||||
structure: {
|
||||
children: [['Selector', 'Raw']]
|
||||
},
|
||||
parse: function() {
|
||||
var children = new List();
|
||||
|
||||
while (!this.scanner.eof) {
|
||||
children.appendData(this.Selector());
|
||||
|
||||
if (this.scanner.tokenType === COMMA) {
|
||||
this.scanner.next();
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'SelectorList',
|
||||
loc: this.getLocationFromList(children),
|
||||
children: children
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
this.eachComma(processChunk, node);
|
||||
},
|
||||
walkContext: 'selector'
|
||||
};
|
||||
18
build/node_modules/css-tree/lib/syntax/node/String.js
generated
vendored
Normal file
18
build/node_modules/css-tree/lib/syntax/node/String.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
var STRING = require('../../tokenizer').TYPE.String;
|
||||
|
||||
module.exports = {
|
||||
name: 'String',
|
||||
structure: {
|
||||
value: String
|
||||
},
|
||||
parse: function() {
|
||||
return {
|
||||
type: 'String',
|
||||
loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
|
||||
value: this.scanner.consume(STRING)
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk(node.value);
|
||||
}
|
||||
};
|
||||
75
build/node_modules/css-tree/lib/syntax/node/StyleSheet.js
generated
vendored
Normal file
75
build/node_modules/css-tree/lib/syntax/node/StyleSheet.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
var List = require('../../utils/list');
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var WHITESPACE = TYPE.WhiteSpace;
|
||||
var COMMENT = TYPE.Comment;
|
||||
var EXCLAMATIONMARK = TYPE.ExclamationMark;
|
||||
var ATRULE = TYPE.Atrule;
|
||||
var CDO = TYPE.CDO;
|
||||
var CDC = TYPE.CDC;
|
||||
|
||||
function consumeRaw(startToken) {
|
||||
return this.Raw(startToken, 0, 0, false, false);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'StyleSheet',
|
||||
structure: {
|
||||
children: [['Comment', 'Atrule', 'Rule', 'Raw']]
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var children = new List();
|
||||
var child;
|
||||
|
||||
scan:
|
||||
while (!this.scanner.eof) {
|
||||
switch (this.scanner.tokenType) {
|
||||
case WHITESPACE:
|
||||
this.scanner.next();
|
||||
continue;
|
||||
|
||||
case COMMENT:
|
||||
// ignore comments except exclamation comments (i.e. /*! .. */) on top level
|
||||
if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 2) !== EXCLAMATIONMARK) {
|
||||
this.scanner.next();
|
||||
continue;
|
||||
}
|
||||
|
||||
child = this.Comment();
|
||||
break;
|
||||
|
||||
case CDO: // <!--
|
||||
child = this.CDO();
|
||||
break;
|
||||
|
||||
case CDC: // -->
|
||||
child = this.CDC();
|
||||
break;
|
||||
|
||||
// CSS Syntax Module Level 3
|
||||
// §2.2 Error handling
|
||||
// At the "top level" of a stylesheet, an <at-keyword-token> starts an at-rule.
|
||||
case ATRULE:
|
||||
child = this.Atrule();
|
||||
break;
|
||||
|
||||
// Anything else starts a qualified rule ...
|
||||
default:
|
||||
child = this.tolerantParse(this.Rule, consumeRaw);
|
||||
}
|
||||
|
||||
children.appendData(child);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'StyleSheet',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
children: children
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
this.each(processChunk, node);
|
||||
},
|
||||
walkContext: 'stylesheet'
|
||||
};
|
||||
53
build/node_modules/css-tree/lib/syntax/node/TypeSelector.js
generated
vendored
Normal file
53
build/node_modules/css-tree/lib/syntax/node/TypeSelector.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var ASTERISK = TYPE.Asterisk;
|
||||
var VERTICALLINE = TYPE.VerticalLine;
|
||||
|
||||
function eatIdentifierOrAsterisk() {
|
||||
if (this.scanner.tokenType !== IDENTIFIER &&
|
||||
this.scanner.tokenType !== ASTERISK) {
|
||||
this.scanner.error('Identifier or asterisk is expected');
|
||||
}
|
||||
|
||||
this.scanner.next();
|
||||
}
|
||||
|
||||
// ident
|
||||
// ident|ident
|
||||
// ident|*
|
||||
// *
|
||||
// *|ident
|
||||
// *|*
|
||||
// |ident
|
||||
// |*
|
||||
module.exports = {
|
||||
name: 'TypeSelector',
|
||||
structure: {
|
||||
name: String
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
|
||||
if (this.scanner.tokenType === VERTICALLINE) {
|
||||
this.scanner.next();
|
||||
eatIdentifierOrAsterisk.call(this);
|
||||
} else {
|
||||
eatIdentifierOrAsterisk.call(this);
|
||||
|
||||
if (this.scanner.tokenType === VERTICALLINE) {
|
||||
this.scanner.next();
|
||||
eatIdentifierOrAsterisk.call(this);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'TypeSelector',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
name: this.scanner.substrToCursor(start)
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk(node.name);
|
||||
}
|
||||
};
|
||||
125
build/node_modules/css-tree/lib/syntax/node/UnicodeRange.js
generated
vendored
Normal file
125
build/node_modules/css-tree/lib/syntax/node/UnicodeRange.js
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
var isHex = require('../../tokenizer').isHex;
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var NUMBER = TYPE.Number;
|
||||
var PLUSSIGN = TYPE.PlusSign;
|
||||
var HYPHENMINUS = TYPE.HyphenMinus;
|
||||
var FULLSTOP = TYPE.FullStop;
|
||||
var QUESTIONMARK = TYPE.QuestionMark;
|
||||
|
||||
function scanUnicodeNumber(scanner) {
|
||||
for (var pos = scanner.tokenStart + 1; pos < scanner.tokenEnd; pos++) {
|
||||
var code = scanner.source.charCodeAt(pos);
|
||||
|
||||
// break on fullstop or hyperminus/plussign after exponent
|
||||
if (code === FULLSTOP || code === PLUSSIGN) {
|
||||
// break token, exclude symbol
|
||||
scanner.tokenStart = pos;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-syntax-3/#urange
|
||||
function scanUnicodeRange(scanner) {
|
||||
var hexStart = scanner.tokenStart + 1; // skip +
|
||||
var hexLength = 0;
|
||||
|
||||
scan: {
|
||||
if (scanner.tokenType === NUMBER) {
|
||||
if (scanner.source.charCodeAt(scanner.tokenStart) !== FULLSTOP && scanUnicodeNumber(scanner)) {
|
||||
scanner.next();
|
||||
} else if (scanner.source.charCodeAt(scanner.tokenStart) !== HYPHENMINUS) {
|
||||
break scan;
|
||||
}
|
||||
} else {
|
||||
scanner.next(); // PLUSSIGN
|
||||
}
|
||||
|
||||
if (scanner.tokenType === HYPHENMINUS) {
|
||||
scanner.next();
|
||||
}
|
||||
|
||||
if (scanner.tokenType === NUMBER) {
|
||||
scanner.next();
|
||||
}
|
||||
|
||||
if (scanner.tokenType === IDENTIFIER) {
|
||||
scanner.next();
|
||||
}
|
||||
|
||||
if (scanner.tokenStart === hexStart) {
|
||||
scanner.error('Unexpected input', hexStart);
|
||||
}
|
||||
}
|
||||
|
||||
// validate for U+x{1,6} or U+x{1,6}-x{1,6}
|
||||
// where x is [0-9a-fA-F]
|
||||
for (var i = hexStart, wasHyphenMinus = false; i < scanner.tokenStart; i++) {
|
||||
var code = scanner.source.charCodeAt(i);
|
||||
|
||||
if (isHex(code) === false && (code !== HYPHENMINUS || wasHyphenMinus)) {
|
||||
scanner.error('Unexpected input', i);
|
||||
}
|
||||
|
||||
if (code === HYPHENMINUS) {
|
||||
// hex sequence shouldn't be an empty
|
||||
if (hexLength === 0) {
|
||||
scanner.error('Unexpected input', i);
|
||||
}
|
||||
|
||||
wasHyphenMinus = true;
|
||||
hexLength = 0;
|
||||
} else {
|
||||
hexLength++;
|
||||
|
||||
// too long hex sequence
|
||||
if (hexLength > 6) {
|
||||
scanner.error('Too long hex sequence', i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// check we have a non-zero sequence
|
||||
if (hexLength === 0) {
|
||||
scanner.error('Unexpected input', i - 1);
|
||||
}
|
||||
|
||||
// U+abc???
|
||||
if (!wasHyphenMinus) {
|
||||
// consume as many U+003F QUESTION MARK (?) code points as possible
|
||||
for (; hexLength < 6 && !scanner.eof; scanner.next()) {
|
||||
if (scanner.tokenType !== QUESTIONMARK) {
|
||||
break;
|
||||
}
|
||||
|
||||
hexLength++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'UnicodeRange',
|
||||
structure: {
|
||||
value: String
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
|
||||
this.scanner.next(); // U or u
|
||||
scanUnicodeRange(this.scanner);
|
||||
|
||||
return {
|
||||
type: 'UnicodeRange',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
value: this.scanner.substrToCursor(start)
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk(node.value);
|
||||
}
|
||||
};
|
||||
49
build/node_modules/css-tree/lib/syntax/node/Url.js
generated
vendored
Normal file
49
build/node_modules/css-tree/lib/syntax/node/Url.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var STRING = TYPE.String;
|
||||
var URL = TYPE.Url;
|
||||
var RAW = TYPE.Raw;
|
||||
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
|
||||
|
||||
// url '(' S* (string | raw) S* ')'
|
||||
module.exports = {
|
||||
name: 'Url',
|
||||
structure: {
|
||||
value: ['String', 'Raw']
|
||||
},
|
||||
parse: function() {
|
||||
var start = this.scanner.tokenStart;
|
||||
var value;
|
||||
|
||||
this.scanner.eat(URL);
|
||||
this.scanner.skipSC();
|
||||
|
||||
switch (this.scanner.tokenType) {
|
||||
case STRING:
|
||||
value = this.String();
|
||||
break;
|
||||
|
||||
case RAW:
|
||||
value = this.Raw(this.scanner.currentToken, 0, RAW, true, false);
|
||||
break;
|
||||
|
||||
default:
|
||||
this.scanner.error('String or Raw is expected');
|
||||
}
|
||||
|
||||
this.scanner.skipSC();
|
||||
this.scanner.eat(RIGHTPARENTHESIS);
|
||||
|
||||
return {
|
||||
type: 'Url',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
value: value
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk('url');
|
||||
processChunk('(');
|
||||
this.generate(processChunk, node.value);
|
||||
processChunk(')');
|
||||
}
|
||||
};
|
||||
61
build/node_modules/css-tree/lib/syntax/node/Value.js
generated
vendored
Normal file
61
build/node_modules/css-tree/lib/syntax/node/Value.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
var endsWith = require('../../tokenizer').endsWith;
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var WHITESPACE = TYPE.WhiteSpace;
|
||||
var COMMENT = TYPE.Comment;
|
||||
var FUNCTION = TYPE.Function;
|
||||
var COLON = TYPE.Colon;
|
||||
var SEMICOLON = TYPE.Semicolon;
|
||||
var EXCLAMATIONMARK = TYPE.ExclamationMark;
|
||||
|
||||
// 'progid:' ws* 'DXImageTransform.Microsoft.' ident ws* '(' .* ')'
|
||||
function checkProgid(scanner) {
|
||||
var offset = 0;
|
||||
|
||||
for (var type; type = scanner.lookupType(offset); offset++) {
|
||||
if (type !== WHITESPACE && type !== COMMENT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (scanner.lookupValue(offset, 'alpha(') ||
|
||||
scanner.lookupValue(offset, 'chroma(') ||
|
||||
scanner.lookupValue(offset, 'dropshadow(')) {
|
||||
if (scanner.lookupType(offset) !== FUNCTION) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (scanner.lookupValue(offset, 'progid') === false ||
|
||||
scanner.lookupType(offset + 1) !== COLON) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'Value',
|
||||
structure: {
|
||||
children: [[]]
|
||||
},
|
||||
parse: function(property) {
|
||||
// special parser for filter property since it can contains non-standart syntax for old IE
|
||||
if (property !== null && endsWith(property, 'filter') && checkProgid(this.scanner)) {
|
||||
this.scanner.skipSC();
|
||||
return this.Raw(this.scanner.currentToken, EXCLAMATIONMARK, SEMICOLON, false, false);
|
||||
}
|
||||
|
||||
var start = this.scanner.tokenStart;
|
||||
var children = this.readSequence(this.scope.Value);
|
||||
|
||||
return {
|
||||
type: 'Value',
|
||||
loc: this.getLocation(start, this.scanner.tokenStart),
|
||||
children: children
|
||||
};
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
this.each(processChunk, node);
|
||||
}
|
||||
};
|
||||
26
build/node_modules/css-tree/lib/syntax/node/WhiteSpace.js
generated
vendored
Normal file
26
build/node_modules/css-tree/lib/syntax/node/WhiteSpace.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
var WHITESPACE = require('../../tokenizer').TYPE.WhiteSpace;
|
||||
var SPACE = Object.freeze({
|
||||
type: 'WhiteSpace',
|
||||
loc: null,
|
||||
value: ' '
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
name: 'WhiteSpace',
|
||||
structure: {
|
||||
value: String
|
||||
},
|
||||
parse: function() {
|
||||
this.scanner.eat(WHITESPACE);
|
||||
return SPACE;
|
||||
|
||||
// return {
|
||||
// type: 'WhiteSpace',
|
||||
// loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
|
||||
// value: this.scanner.consume(WHITESPACE)
|
||||
// };
|
||||
},
|
||||
generate: function(processChunk, node) {
|
||||
processChunk(node.value);
|
||||
}
|
||||
};
|
||||
42
build/node_modules/css-tree/lib/syntax/node/index.js
generated
vendored
Normal file
42
build/node_modules/css-tree/lib/syntax/node/index.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
module.exports = {
|
||||
AnPlusB: require('./AnPlusB'),
|
||||
Atrule: require('./Atrule'),
|
||||
AtrulePrelude: require('./AtrulePrelude'),
|
||||
AttributeSelector: require('./AttributeSelector'),
|
||||
Block: require('./Block'),
|
||||
Brackets: require('./Brackets'),
|
||||
CDC: require('./CDC'),
|
||||
CDO: require('./CDO'),
|
||||
ClassSelector: require('./ClassSelector'),
|
||||
Combinator: require('./Combinator'),
|
||||
Comment: require('./Comment'),
|
||||
Declaration: require('./Declaration'),
|
||||
DeclarationList: require('./DeclarationList'),
|
||||
Dimension: require('./Dimension'),
|
||||
Function: require('./Function'),
|
||||
HexColor: require('./HexColor'),
|
||||
Identifier: require('./Identifier'),
|
||||
IdSelector: require('./IdSelector'),
|
||||
MediaFeature: require('./MediaFeature'),
|
||||
MediaQuery: require('./MediaQuery'),
|
||||
MediaQueryList: require('./MediaQueryList'),
|
||||
Nth: require('./Nth'),
|
||||
Number: require('./Number'),
|
||||
Operator: require('./Operator'),
|
||||
Parentheses: require('./Parentheses'),
|
||||
Percentage: require('./Percentage'),
|
||||
PseudoClassSelector: require('./PseudoClassSelector'),
|
||||
PseudoElementSelector: require('./PseudoElementSelector'),
|
||||
Ratio: require('./Ratio'),
|
||||
Raw: require('./Raw'),
|
||||
Rule: require('./Rule'),
|
||||
Selector: require('./Selector'),
|
||||
SelectorList: require('./SelectorList'),
|
||||
String: require('./String'),
|
||||
StyleSheet: require('./StyleSheet'),
|
||||
TypeSelector: require('./TypeSelector'),
|
||||
UnicodeRange: require('./UnicodeRange'),
|
||||
Url: require('./Url'),
|
||||
Value: require('./Value'),
|
||||
WhiteSpace: require('./WhiteSpace')
|
||||
};
|
||||
10
build/node_modules/css-tree/lib/syntax/pseudo/common/nth.js
generated
vendored
Normal file
10
build/node_modules/css-tree/lib/syntax/pseudo/common/nth.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
var List = require('../../../utils/list');
|
||||
var DISALLOW_OF_CLAUSE = false;
|
||||
|
||||
module.exports = {
|
||||
parse: function nth() {
|
||||
return new List().appendData(
|
||||
this.Nth(DISALLOW_OF_CLAUSE)
|
||||
);
|
||||
}
|
||||
};
|
||||
10
build/node_modules/css-tree/lib/syntax/pseudo/common/nthWithOfClause.js
generated
vendored
Normal file
10
build/node_modules/css-tree/lib/syntax/pseudo/common/nthWithOfClause.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
var List = require('../../../utils/list');
|
||||
var ALLOW_OF_CLAUSE = true;
|
||||
|
||||
module.exports = {
|
||||
parse: function() {
|
||||
return new List().appendData(
|
||||
this.Nth(ALLOW_OF_CLAUSE)
|
||||
);
|
||||
}
|
||||
};
|
||||
9
build/node_modules/css-tree/lib/syntax/pseudo/common/selectorList.js
generated
vendored
Normal file
9
build/node_modules/css-tree/lib/syntax/pseudo/common/selectorList.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
var List = require('../../../utils/list');
|
||||
|
||||
module.exports = {
|
||||
parse: function selectorList() {
|
||||
return new List().appendData(
|
||||
this.SelectorList()
|
||||
);
|
||||
}
|
||||
};
|
||||
9
build/node_modules/css-tree/lib/syntax/pseudo/dir.js
generated
vendored
Normal file
9
build/node_modules/css-tree/lib/syntax/pseudo/dir.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
var List = require('../../utils/list');
|
||||
|
||||
module.exports = {
|
||||
parse: function() {
|
||||
return new List().appendData(
|
||||
this.Identifier()
|
||||
);
|
||||
}
|
||||
};
|
||||
9
build/node_modules/css-tree/lib/syntax/pseudo/has.js
generated
vendored
Normal file
9
build/node_modules/css-tree/lib/syntax/pseudo/has.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
var List = require('../../utils/list');
|
||||
|
||||
module.exports = {
|
||||
parse: function() {
|
||||
return new List().appendData(
|
||||
this.SelectorList()
|
||||
);
|
||||
}
|
||||
};
|
||||
12
build/node_modules/css-tree/lib/syntax/pseudo/index.js
generated
vendored
Normal file
12
build/node_modules/css-tree/lib/syntax/pseudo/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
module.exports = {
|
||||
'dir': require('./dir'),
|
||||
'has': require('./has'),
|
||||
'lang': require('./lang'),
|
||||
'matches': require('./matches'),
|
||||
'not': require('./not'),
|
||||
'nth-child': require('./nth-child'),
|
||||
'nth-last-child': require('./nth-last-child'),
|
||||
'nth-last-of-type': require('./nth-last-of-type'),
|
||||
'nth-of-type': require('./nth-of-type'),
|
||||
'slotted': require('./slotted')
|
||||
};
|
||||
9
build/node_modules/css-tree/lib/syntax/pseudo/lang.js
generated
vendored
Normal file
9
build/node_modules/css-tree/lib/syntax/pseudo/lang.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
var List = require('../../utils/list');
|
||||
|
||||
module.exports = {
|
||||
parse: function() {
|
||||
return new List().appendData(
|
||||
this.Identifier()
|
||||
);
|
||||
}
|
||||
};
|
||||
1
build/node_modules/css-tree/lib/syntax/pseudo/matches.js
generated
vendored
Normal file
1
build/node_modules/css-tree/lib/syntax/pseudo/matches.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./common/selectorList');
|
||||
1
build/node_modules/css-tree/lib/syntax/pseudo/not.js
generated
vendored
Normal file
1
build/node_modules/css-tree/lib/syntax/pseudo/not.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./common/selectorList');
|
||||
1
build/node_modules/css-tree/lib/syntax/pseudo/nth-child.js
generated
vendored
Normal file
1
build/node_modules/css-tree/lib/syntax/pseudo/nth-child.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./common/nthWithOfClause');
|
||||
1
build/node_modules/css-tree/lib/syntax/pseudo/nth-last-child.js
generated
vendored
Normal file
1
build/node_modules/css-tree/lib/syntax/pseudo/nth-last-child.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./common/nthWithOfClause');
|
||||
1
build/node_modules/css-tree/lib/syntax/pseudo/nth-last-of-type.js
generated
vendored
Normal file
1
build/node_modules/css-tree/lib/syntax/pseudo/nth-last-of-type.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./common/nth');
|
||||
1
build/node_modules/css-tree/lib/syntax/pseudo/nth-of-type.js
generated
vendored
Normal file
1
build/node_modules/css-tree/lib/syntax/pseudo/nth-of-type.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./common/nth');
|
||||
9
build/node_modules/css-tree/lib/syntax/pseudo/slotted.js
generated
vendored
Normal file
9
build/node_modules/css-tree/lib/syntax/pseudo/slotted.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
var List = require('../../utils/list');
|
||||
|
||||
module.exports = {
|
||||
parse: function compoundSelector() {
|
||||
return new List().appendData(
|
||||
this.Selector()
|
||||
);
|
||||
}
|
||||
};
|
||||
3
build/node_modules/css-tree/lib/syntax/scope/atrulePrelude.js
generated
vendored
Normal file
3
build/node_modules/css-tree/lib/syntax/scope/atrulePrelude.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
getNode: require('./default')
|
||||
};
|
||||
78
build/node_modules/css-tree/lib/syntax/scope/default.js
generated
vendored
Normal file
78
build/node_modules/css-tree/lib/syntax/scope/default.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
var cmpChar = require('../../tokenizer').cmpChar;
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var STRING = TYPE.String;
|
||||
var NUMBER = TYPE.Number;
|
||||
var FUNCTION = TYPE.Function;
|
||||
var URL = TYPE.Url;
|
||||
var NUMBERSIGN = TYPE.NumberSign;
|
||||
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
|
||||
var LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;
|
||||
var PLUSSIGN = TYPE.PlusSign;
|
||||
var HYPHENMINUS = TYPE.HyphenMinus;
|
||||
var COMMA = TYPE.Comma;
|
||||
var SOLIDUS = TYPE.Solidus;
|
||||
var ASTERISK = TYPE.Asterisk;
|
||||
var PERCENTSIGN = TYPE.PercentSign;
|
||||
var BACKSLASH = TYPE.Backslash;
|
||||
var U = 117; // 'u'.charCodeAt(0)
|
||||
|
||||
module.exports = function defaultRecognizer(context) {
|
||||
switch (this.scanner.tokenType) {
|
||||
case NUMBERSIGN:
|
||||
return this.HexColor();
|
||||
|
||||
case COMMA:
|
||||
context.space = null;
|
||||
context.ignoreWSAfter = true;
|
||||
return this.Operator();
|
||||
|
||||
case SOLIDUS:
|
||||
case ASTERISK:
|
||||
case PLUSSIGN:
|
||||
case HYPHENMINUS:
|
||||
return this.Operator();
|
||||
|
||||
case LEFTPARENTHESIS:
|
||||
return this.Parentheses(this.readSequence, context.recognizer);
|
||||
|
||||
case LEFTSQUAREBRACKET:
|
||||
return this.Brackets(this.readSequence, context.recognizer);
|
||||
|
||||
case STRING:
|
||||
return this.String();
|
||||
|
||||
case NUMBER:
|
||||
switch (this.scanner.lookupType(1)) {
|
||||
case PERCENTSIGN:
|
||||
return this.Percentage();
|
||||
|
||||
case IDENTIFIER:
|
||||
// edge case: number with folowing \0 and \9 hack shouldn't to be a Dimension
|
||||
if (cmpChar(this.scanner.source, this.scanner.tokenEnd, BACKSLASH)) {
|
||||
return this.Number();
|
||||
} else {
|
||||
return this.Dimension();
|
||||
}
|
||||
|
||||
default:
|
||||
return this.Number();
|
||||
}
|
||||
|
||||
case FUNCTION:
|
||||
return this.Function(this.readSequence, context.recognizer);
|
||||
|
||||
case URL:
|
||||
return this.Url();
|
||||
|
||||
case IDENTIFIER:
|
||||
// check for unicode range, it should start with u+ or U+
|
||||
if (cmpChar(this.scanner.source, this.scanner.tokenStart, U) &&
|
||||
cmpChar(this.scanner.source, this.scanner.tokenStart + 1, PLUSSIGN)) {
|
||||
return this.UnicodeRange();
|
||||
} else {
|
||||
return this.Identifier();
|
||||
}
|
||||
}
|
||||
};
|
||||
5
build/node_modules/css-tree/lib/syntax/scope/index.js
generated
vendored
Normal file
5
build/node_modules/css-tree/lib/syntax/scope/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
AtrulePrelude: require('./atrulePrelude'),
|
||||
Selector: require('./selector'),
|
||||
Value: require('./value')
|
||||
};
|
||||
56
build/node_modules/css-tree/lib/syntax/scope/selector.js
generated
vendored
Normal file
56
build/node_modules/css-tree/lib/syntax/scope/selector.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
var TYPE = require('../../tokenizer').TYPE;
|
||||
|
||||
var IDENTIFIER = TYPE.Identifier;
|
||||
var NUMBER = TYPE.Number;
|
||||
var NUMBERSIGN = TYPE.NumberSign;
|
||||
var LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;
|
||||
var PLUSSIGN = TYPE.PlusSign;
|
||||
var SOLIDUS = TYPE.Solidus;
|
||||
var ASTERISK = TYPE.Asterisk;
|
||||
var FULLSTOP = TYPE.FullStop;
|
||||
var COLON = TYPE.Colon;
|
||||
var GREATERTHANSIGN = TYPE.GreaterThanSign;
|
||||
var VERTICALLINE = TYPE.VerticalLine;
|
||||
var TILDE = TYPE.Tilde;
|
||||
|
||||
function getNode(context) {
|
||||
switch (this.scanner.tokenType) {
|
||||
case PLUSSIGN:
|
||||
case GREATERTHANSIGN:
|
||||
case TILDE:
|
||||
context.space = null;
|
||||
context.ignoreWSAfter = true;
|
||||
return this.Combinator();
|
||||
|
||||
case SOLIDUS: // /deep/
|
||||
return this.Combinator();
|
||||
|
||||
case FULLSTOP:
|
||||
return this.ClassSelector();
|
||||
|
||||
case LEFTSQUAREBRACKET:
|
||||
return this.AttributeSelector();
|
||||
|
||||
case NUMBERSIGN:
|
||||
return this.IdSelector();
|
||||
|
||||
case COLON:
|
||||
if (this.scanner.lookupType(1) === COLON) {
|
||||
return this.PseudoElementSelector();
|
||||
} else {
|
||||
return this.PseudoClassSelector();
|
||||
}
|
||||
|
||||
case IDENTIFIER:
|
||||
case ASTERISK:
|
||||
case VERTICALLINE:
|
||||
return this.TypeSelector();
|
||||
|
||||
case NUMBER:
|
||||
return this.Percentage();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getNode: getNode
|
||||
};
|
||||
7
build/node_modules/css-tree/lib/syntax/scope/value.js
generated
vendored
Normal file
7
build/node_modules/css-tree/lib/syntax/scope/value.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
getNode: require('./default'),
|
||||
'-moz-element': require('../function/element'),
|
||||
'element': require('../function/element'),
|
||||
'expression': require('../function/expression'),
|
||||
'var': require('../function/var')
|
||||
};
|
||||
Reference in New Issue
Block a user