feat: docker compose maybe
This commit is contained in:
8
node_modules/css-tree/lib/syntax/atrule/font-face.js
generated
vendored
Normal file
8
node_modules/css-tree/lib/syntax/atrule/font-face.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
export default {
|
||||
parse: {
|
||||
prelude: null,
|
||||
block() {
|
||||
return this.Block(true);
|
||||
}
|
||||
}
|
||||
};
|
39
node_modules/css-tree/lib/syntax/atrule/import.js
generated
vendored
Normal file
39
node_modules/css-tree/lib/syntax/atrule/import.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
import {
|
||||
String as StringToken,
|
||||
Ident,
|
||||
Url,
|
||||
Function as FunctionToken,
|
||||
LeftParenthesis
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
export default {
|
||||
parse: {
|
||||
prelude() {
|
||||
const children = this.createList();
|
||||
|
||||
this.skipSC();
|
||||
|
||||
switch (this.tokenType) {
|
||||
case StringToken:
|
||||
children.push(this.String());
|
||||
break;
|
||||
|
||||
case Url:
|
||||
case FunctionToken:
|
||||
children.push(this.Url());
|
||||
break;
|
||||
|
||||
default:
|
||||
this.error('String or url() is expected');
|
||||
}
|
||||
|
||||
if (this.lookupNonWSType(0) === Ident ||
|
||||
this.lookupNonWSType(0) === LeftParenthesis) {
|
||||
children.push(this.MediaQueryList());
|
||||
}
|
||||
|
||||
return children;
|
||||
},
|
||||
block: null
|
||||
}
|
||||
};
|
15
node_modules/css-tree/lib/syntax/atrule/index.js
generated
vendored
Normal file
15
node_modules/css-tree/lib/syntax/atrule/index.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
import fontFace from './font-face.js';
|
||||
import importAtrule from './import.js';
|
||||
import media from './media.js';
|
||||
import nest from './nest.js';
|
||||
import page from './page.js';
|
||||
import supports from './supports.js';
|
||||
|
||||
export default {
|
||||
'font-face': fontFace,
|
||||
'import': importAtrule,
|
||||
media,
|
||||
nest,
|
||||
page,
|
||||
supports
|
||||
};
|
12
node_modules/css-tree/lib/syntax/atrule/media.js
generated
vendored
Normal file
12
node_modules/css-tree/lib/syntax/atrule/media.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
export default {
|
||||
parse: {
|
||||
prelude() {
|
||||
return this.createSingleNodeList(
|
||||
this.MediaQueryList()
|
||||
);
|
||||
},
|
||||
block(isStyleBlock = false) {
|
||||
return this.Block(isStyleBlock);
|
||||
}
|
||||
}
|
||||
};
|
12
node_modules/css-tree/lib/syntax/atrule/nest.js
generated
vendored
Normal file
12
node_modules/css-tree/lib/syntax/atrule/nest.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
export default {
|
||||
parse: {
|
||||
prelude() {
|
||||
return this.createSingleNodeList(
|
||||
this.SelectorList()
|
||||
);
|
||||
},
|
||||
block() {
|
||||
return this.Block(true);
|
||||
}
|
||||
}
|
||||
};
|
12
node_modules/css-tree/lib/syntax/atrule/page.js
generated
vendored
Normal file
12
node_modules/css-tree/lib/syntax/atrule/page.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
export default {
|
||||
parse: {
|
||||
prelude() {
|
||||
return this.createSingleNodeList(
|
||||
this.SelectorList()
|
||||
);
|
||||
},
|
||||
block() {
|
||||
return this.Block(true);
|
||||
}
|
||||
}
|
||||
};
|
80
node_modules/css-tree/lib/syntax/atrule/supports.js
generated
vendored
Normal file
80
node_modules/css-tree/lib/syntax/atrule/supports.js
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
import {
|
||||
WhiteSpace,
|
||||
Comment,
|
||||
Ident,
|
||||
Function,
|
||||
Colon,
|
||||
LeftParenthesis
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
function consumeRaw() {
|
||||
return this.createSingleNodeList(
|
||||
this.Raw(this.tokenIndex, null, false)
|
||||
);
|
||||
}
|
||||
|
||||
function parentheses() {
|
||||
this.skipSC();
|
||||
|
||||
if (this.tokenType === Ident &&
|
||||
this.lookupNonWSType(1) === Colon) {
|
||||
return this.createSingleNodeList(
|
||||
this.Declaration()
|
||||
);
|
||||
}
|
||||
|
||||
return readSequence.call(this);
|
||||
}
|
||||
|
||||
function readSequence() {
|
||||
const children = this.createList();
|
||||
let child;
|
||||
|
||||
this.skipSC();
|
||||
|
||||
scan:
|
||||
while (!this.eof) {
|
||||
switch (this.tokenType) {
|
||||
case Comment:
|
||||
case WhiteSpace:
|
||||
this.next();
|
||||
continue;
|
||||
|
||||
case Function:
|
||||
child = this.Function(consumeRaw, this.scope.AtrulePrelude);
|
||||
break;
|
||||
|
||||
case Ident:
|
||||
child = this.Identifier();
|
||||
break;
|
||||
|
||||
case LeftParenthesis:
|
||||
child = this.Parentheses(parentheses, this.scope.AtrulePrelude);
|
||||
break;
|
||||
|
||||
default:
|
||||
break scan;
|
||||
}
|
||||
|
||||
children.push(child);
|
||||
}
|
||||
|
||||
return children;
|
||||
}
|
||||
|
||||
export default {
|
||||
parse: {
|
||||
prelude() {
|
||||
const children = readSequence.call(this);
|
||||
|
||||
if (this.getFirstListNode(children) === null) {
|
||||
this.error('Condition is expected');
|
||||
}
|
||||
|
||||
return children;
|
||||
},
|
||||
block(isStyleBlock = false) {
|
||||
return this.Block(isStyleBlock);
|
||||
}
|
||||
}
|
||||
};
|
5
node_modules/css-tree/lib/syntax/config/generator.js
generated
vendored
Normal file
5
node_modules/css-tree/lib/syntax/config/generator.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import * as node from '../node/index-generate.js';
|
||||
|
||||
export default {
|
||||
node
|
||||
};
|
8
node_modules/css-tree/lib/syntax/config/lexer.js
generated
vendored
Normal file
8
node_modules/css-tree/lib/syntax/config/lexer.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
import definitions from '../../data.js';
|
||||
import * as node from '../node/index.js';
|
||||
|
||||
export default {
|
||||
generic: true,
|
||||
...definitions,
|
||||
node
|
||||
};
|
115
node_modules/css-tree/lib/syntax/config/mix.js
generated
vendored
Normal file
115
node_modules/css-tree/lib/syntax/config/mix.js
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
function appendOrSet(a, b) {
|
||||
if (typeof b === 'string' && /^\s*\|/.test(b)) {
|
||||
return typeof a === 'string'
|
||||
? a + b
|
||||
: b.replace(/^\s*\|\s*/, '');
|
||||
}
|
||||
|
||||
return b || null;
|
||||
}
|
||||
|
||||
function sliceProps(obj, props) {
|
||||
const result = Object.create(null);
|
||||
|
||||
for (const [key, value] of Object.entries(obj)) {
|
||||
if (value) {
|
||||
result[key] = {};
|
||||
for (const prop of Object.keys(value)) {
|
||||
if (props.includes(prop)) {
|
||||
result[key][prop] = value[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export default function mix(dest, src) {
|
||||
const result = { ...dest };
|
||||
|
||||
for (const [prop, value] of Object.entries(src)) {
|
||||
switch (prop) {
|
||||
case 'generic':
|
||||
result[prop] = Boolean(value);
|
||||
break;
|
||||
|
||||
case 'units':
|
||||
result[prop] = { ...dest[prop] };
|
||||
for (const [name, patch] of Object.entries(value)) {
|
||||
result[prop][name] = Array.isArray(patch) ? patch : [];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'atrules':
|
||||
result[prop] = { ...dest[prop] };
|
||||
|
||||
for (const [name, atrule] of Object.entries(value)) {
|
||||
const exists = result[prop][name] || {};
|
||||
const current = result[prop][name] = {
|
||||
prelude: exists.prelude || null,
|
||||
descriptors: {
|
||||
...exists.descriptors
|
||||
}
|
||||
};
|
||||
|
||||
if (!atrule) {
|
||||
continue;
|
||||
}
|
||||
|
||||
current.prelude = atrule.prelude
|
||||
? appendOrSet(current.prelude, atrule.prelude)
|
||||
: current.prelude || null;
|
||||
|
||||
for (const [descriptorName, descriptorValue] of Object.entries(atrule.descriptors || {})) {
|
||||
current.descriptors[descriptorName] = descriptorValue
|
||||
? appendOrSet(current.descriptors[descriptorName], descriptorValue)
|
||||
: null;
|
||||
}
|
||||
|
||||
if (!Object.keys(current.descriptors).length) {
|
||||
current.descriptors = null;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'types':
|
||||
case 'properties':
|
||||
result[prop] = { ...dest[prop] };
|
||||
for (const [name, syntax] of Object.entries(value)) {
|
||||
result[prop][name] = appendOrSet(result[prop][name], syntax);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'scope':
|
||||
result[prop] = { ...dest[prop] };
|
||||
for (const [name, props] of Object.entries(value)) {
|
||||
result[prop][name] = { ...result[prop][name], ...props };
|
||||
}
|
||||
break;
|
||||
|
||||
case 'parseContext':
|
||||
result[prop] = {
|
||||
...dest[prop],
|
||||
...value
|
||||
};
|
||||
break;
|
||||
|
||||
case 'atrule':
|
||||
case 'pseudo':
|
||||
result[prop] = {
|
||||
...dest[prop],
|
||||
...sliceProps(value, ['parse']) };
|
||||
break;
|
||||
|
||||
case 'node':
|
||||
result[prop] = {
|
||||
...dest[prop],
|
||||
...sliceProps(value, ['name', 'structure', 'parse', 'generate', 'walkContext'])
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
15
node_modules/css-tree/lib/syntax/config/parser-selector.js
generated
vendored
Normal file
15
node_modules/css-tree/lib/syntax/config/parser-selector.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
import { Selector } from '../scope/index.js';
|
||||
import pseudo from '../pseudo/index.js';
|
||||
import * as node from '../node/index-parse-selector.js';
|
||||
|
||||
export default {
|
||||
parseContext: {
|
||||
default: 'SelectorList',
|
||||
selectorList: 'SelectorList',
|
||||
selector: 'Selector'
|
||||
},
|
||||
scope: { Selector },
|
||||
atrule: {},
|
||||
pseudo,
|
||||
node
|
||||
};
|
30
node_modules/css-tree/lib/syntax/config/parser.js
generated
vendored
Normal file
30
node_modules/css-tree/lib/syntax/config/parser.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
import * as scope from '../scope/index.js';
|
||||
import atrule from '../atrule/index.js';
|
||||
import pseudo from '../pseudo/index.js';
|
||||
import * as node from '../node/index-parse.js';
|
||||
|
||||
export default {
|
||||
parseContext: {
|
||||
default: 'StyleSheet',
|
||||
stylesheet: 'StyleSheet',
|
||||
atrule: 'Atrule',
|
||||
atrulePrelude(options) {
|
||||
return this.AtrulePrelude(options.atrule ? String(options.atrule) : null);
|
||||
},
|
||||
mediaQueryList: 'MediaQueryList',
|
||||
mediaQuery: 'MediaQuery',
|
||||
rule: 'Rule',
|
||||
selectorList: 'SelectorList',
|
||||
selector: 'Selector',
|
||||
block() {
|
||||
return this.Block(true);
|
||||
},
|
||||
declarationList: 'DeclarationList',
|
||||
declaration: 'Declaration',
|
||||
value: 'Value'
|
||||
},
|
||||
scope,
|
||||
atrule,
|
||||
pseudo,
|
||||
node
|
||||
};
|
5
node_modules/css-tree/lib/syntax/config/walker.js
generated
vendored
Normal file
5
node_modules/css-tree/lib/syntax/config/walker.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import * as node from '../node/index.js';
|
||||
|
||||
export default {
|
||||
node
|
||||
};
|
54
node_modules/css-tree/lib/syntax/create.js
generated
vendored
Normal file
54
node_modules/css-tree/lib/syntax/create.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
import { tokenize } from '../tokenizer/index.js';
|
||||
import { createParser } from '../parser/create.js';
|
||||
import { createGenerator } from '../generator/create.js';
|
||||
import { createConvertor } from '../convertor/create.js';
|
||||
import { createWalker } from '../walker/create.js';
|
||||
import { Lexer } from '../lexer/Lexer.js';
|
||||
import mix from './config/mix.js';
|
||||
|
||||
function createSyntax(config) {
|
||||
const parse = createParser(config);
|
||||
const walk = createWalker(config);
|
||||
const generate = createGenerator(config);
|
||||
const { fromPlainObject, toPlainObject } = createConvertor(walk);
|
||||
|
||||
const syntax = {
|
||||
lexer: null,
|
||||
createLexer: config => new Lexer(config, syntax, syntax.lexer.structure),
|
||||
|
||||
tokenize,
|
||||
parse,
|
||||
generate,
|
||||
|
||||
walk,
|
||||
find: walk.find,
|
||||
findLast: walk.findLast,
|
||||
findAll: walk.findAll,
|
||||
|
||||
fromPlainObject,
|
||||
toPlainObject,
|
||||
|
||||
fork(extension) {
|
||||
const base = mix({}, config); // copy of config
|
||||
|
||||
return createSyntax(
|
||||
typeof extension === 'function'
|
||||
? extension(base, Object.assign)
|
||||
: mix(base, extension)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
syntax.lexer = new Lexer({
|
||||
generic: true,
|
||||
units: config.units,
|
||||
types: config.types,
|
||||
atrules: config.atrules,
|
||||
properties: config.properties,
|
||||
node: config.node
|
||||
}, syntax);
|
||||
|
||||
return syntax;
|
||||
};
|
||||
|
||||
export default config => createSyntax(mix({}, config));
|
7
node_modules/css-tree/lib/syntax/function/expression.js
generated
vendored
Normal file
7
node_modules/css-tree/lib/syntax/function/expression.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
// legacy IE function
|
||||
// expression( <any-value> )
|
||||
export default function() {
|
||||
return this.createSingleNodeList(
|
||||
this.Raw(this.tokenIndex, null, false)
|
||||
);
|
||||
}
|
39
node_modules/css-tree/lib/syntax/function/var.js
generated
vendored
Normal file
39
node_modules/css-tree/lib/syntax/function/var.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
import { Comma, WhiteSpace } from '../../tokenizer/index.js';
|
||||
|
||||
// var( <ident> , <value>? )
|
||||
export default function() {
|
||||
const children = this.createList();
|
||||
|
||||
this.skipSC();
|
||||
|
||||
// NOTE: Don't check more than a first argument is an ident, rest checks are for lexer
|
||||
children.push(this.Identifier());
|
||||
|
||||
this.skipSC();
|
||||
|
||||
if (this.tokenType === Comma) {
|
||||
children.push(this.Operator());
|
||||
|
||||
const startIndex = this.tokenIndex;
|
||||
const value = this.parseCustomProperty
|
||||
? this.Value(null)
|
||||
: this.Raw(this.tokenIndex, this.consumeUntilExclamationMarkOrSemicolon, false);
|
||||
|
||||
if (value.type === 'Value' && value.children.isEmpty) {
|
||||
for (let offset = startIndex - this.tokenIndex; offset <= 0; offset++) {
|
||||
if (this.lookupType(offset) === WhiteSpace) {
|
||||
value.children.appendData({
|
||||
type: 'WhiteSpace',
|
||||
loc: null,
|
||||
value: ' '
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
children.push(value);
|
||||
}
|
||||
|
||||
return children;
|
||||
};
|
10
node_modules/css-tree/lib/syntax/index.js
generated
vendored
Normal file
10
node_modules/css-tree/lib/syntax/index.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
import createSyntax from './create.js';
|
||||
import lexerConfig from './config/lexer.js';
|
||||
import parserConfig from './config/parser.js';
|
||||
import walkerConfig from './config/walker.js';
|
||||
|
||||
export default createSyntax({
|
||||
...lexerConfig,
|
||||
...parserConfig,
|
||||
...walkerConfig
|
||||
});
|
292
node_modules/css-tree/lib/syntax/node/AnPlusB.js
generated
vendored
Normal file
292
node_modules/css-tree/lib/syntax/node/AnPlusB.js
generated
vendored
Normal file
@ -0,0 +1,292 @@
|
||||
import {
|
||||
isDigit,
|
||||
WhiteSpace,
|
||||
Comment,
|
||||
Ident,
|
||||
Number,
|
||||
Dimension
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
const PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
|
||||
const HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)
|
||||
const N = 0x006E; // U+006E LATIN SMALL LETTER N (n)
|
||||
const DISALLOW_SIGN = true;
|
||||
const ALLOW_SIGN = false;
|
||||
|
||||
function checkInteger(offset, disallowSign) {
|
||||
let pos = this.tokenStart + offset;
|
||||
const code = this.charCodeAt(pos);
|
||||
|
||||
if (code === PLUSSIGN || code === HYPHENMINUS) {
|
||||
if (disallowSign) {
|
||||
this.error('Number sign is not allowed');
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
|
||||
for (; pos < this.tokenEnd; pos++) {
|
||||
if (!isDigit(this.charCodeAt(pos))) {
|
||||
this.error('Integer is expected', pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkTokenIsInteger(disallowSign) {
|
||||
return checkInteger.call(this, 0, disallowSign);
|
||||
}
|
||||
|
||||
function expectCharCode(offset, code) {
|
||||
if (!this.cmpChar(this.tokenStart + offset, code)) {
|
||||
let msg = '';
|
||||
|
||||
switch (code) {
|
||||
case N:
|
||||
msg = 'N is expected';
|
||||
break;
|
||||
case HYPHENMINUS:
|
||||
msg = 'HyphenMinus is expected';
|
||||
break;
|
||||
}
|
||||
|
||||
this.error(msg, this.tokenStart + offset);
|
||||
}
|
||||
}
|
||||
|
||||
// ... <signed-integer>
|
||||
// ... ['+' | '-'] <signless-integer>
|
||||
function consumeB() {
|
||||
let offset = 0;
|
||||
let sign = 0;
|
||||
let type = this.tokenType;
|
||||
|
||||
while (type === WhiteSpace || type === Comment) {
|
||||
type = this.lookupType(++offset);
|
||||
}
|
||||
|
||||
if (type !== Number) {
|
||||
if (this.isDelim(PLUSSIGN, offset) ||
|
||||
this.isDelim(HYPHENMINUS, offset)) {
|
||||
sign = this.isDelim(PLUSSIGN, offset) ? PLUSSIGN : HYPHENMINUS;
|
||||
|
||||
do {
|
||||
type = this.lookupType(++offset);
|
||||
} while (type === WhiteSpace || type === Comment);
|
||||
|
||||
if (type !== Number) {
|
||||
this.skip(offset);
|
||||
checkTokenIsInteger.call(this, DISALLOW_SIGN);
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (offset > 0) {
|
||||
this.skip(offset);
|
||||
}
|
||||
|
||||
if (sign === 0) {
|
||||
type = this.charCodeAt(this.tokenStart);
|
||||
if (type !== PLUSSIGN && type !== HYPHENMINUS) {
|
||||
this.error('Number sign is expected');
|
||||
}
|
||||
}
|
||||
|
||||
checkTokenIsInteger.call(this, sign !== 0);
|
||||
return sign === HYPHENMINUS ? '-' + this.consume(Number) : this.consume(Number);
|
||||
}
|
||||
|
||||
// An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
|
||||
export const name = 'AnPlusB';
|
||||
export const structure = {
|
||||
a: [String, null],
|
||||
b: [String, null]
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
/* eslint-disable brace-style*/
|
||||
const start = this.tokenStart;
|
||||
let a = null;
|
||||
let b = null;
|
||||
|
||||
// <integer>
|
||||
if (this.tokenType === Number) {
|
||||
checkTokenIsInteger.call(this, ALLOW_SIGN);
|
||||
b = this.consume(Number);
|
||||
}
|
||||
|
||||
// -n
|
||||
// -n <signed-integer>
|
||||
// -n ['+' | '-'] <signless-integer>
|
||||
// -n- <signless-integer>
|
||||
// <dashndashdigit-ident>
|
||||
else if (this.tokenType === Ident && this.cmpChar(this.tokenStart, HYPHENMINUS)) {
|
||||
a = '-1';
|
||||
|
||||
expectCharCode.call(this, 1, N);
|
||||
|
||||
switch (this.tokenEnd - this.tokenStart) {
|
||||
// -n
|
||||
// -n <signed-integer>
|
||||
// -n ['+' | '-'] <signless-integer>
|
||||
case 2:
|
||||
this.next();
|
||||
b = consumeB.call(this);
|
||||
break;
|
||||
|
||||
// -n- <signless-integer>
|
||||
case 3:
|
||||
expectCharCode.call(this, 2, HYPHENMINUS);
|
||||
|
||||
this.next();
|
||||
this.skipSC();
|
||||
|
||||
checkTokenIsInteger.call(this, DISALLOW_SIGN);
|
||||
|
||||
b = '-' + this.consume(Number);
|
||||
break;
|
||||
|
||||
// <dashndashdigit-ident>
|
||||
default:
|
||||
expectCharCode.call(this, 2, HYPHENMINUS);
|
||||
checkInteger.call(this, 3, DISALLOW_SIGN);
|
||||
this.next();
|
||||
|
||||
b = this.substrToCursor(start + 2);
|
||||
}
|
||||
}
|
||||
|
||||
// '+'? n
|
||||
// '+'? n <signed-integer>
|
||||
// '+'? n ['+' | '-'] <signless-integer>
|
||||
// '+'? n- <signless-integer>
|
||||
// '+'? <ndashdigit-ident>
|
||||
else if (this.tokenType === Ident || (this.isDelim(PLUSSIGN) && this.lookupType(1) === Ident)) {
|
||||
let sign = 0;
|
||||
a = '1';
|
||||
|
||||
// just ignore a plus
|
||||
if (this.isDelim(PLUSSIGN)) {
|
||||
sign = 1;
|
||||
this.next();
|
||||
}
|
||||
|
||||
expectCharCode.call(this, 0, N);
|
||||
|
||||
switch (this.tokenEnd - this.tokenStart) {
|
||||
// '+'? n
|
||||
// '+'? n <signed-integer>
|
||||
// '+'? n ['+' | '-'] <signless-integer>
|
||||
case 1:
|
||||
this.next();
|
||||
b = consumeB.call(this);
|
||||
break;
|
||||
|
||||
// '+'? n- <signless-integer>
|
||||
case 2:
|
||||
expectCharCode.call(this, 1, HYPHENMINUS);
|
||||
|
||||
this.next();
|
||||
this.skipSC();
|
||||
|
||||
checkTokenIsInteger.call(this, DISALLOW_SIGN);
|
||||
|
||||
b = '-' + this.consume(Number);
|
||||
break;
|
||||
|
||||
// '+'? <ndashdigit-ident>
|
||||
default:
|
||||
expectCharCode.call(this, 1, HYPHENMINUS);
|
||||
checkInteger.call(this, 2, DISALLOW_SIGN);
|
||||
this.next();
|
||||
|
||||
b = this.substrToCursor(start + sign + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// <ndashdigit-dimension>
|
||||
// <ndash-dimension> <signless-integer>
|
||||
// <n-dimension>
|
||||
// <n-dimension> <signed-integer>
|
||||
// <n-dimension> ['+' | '-'] <signless-integer>
|
||||
else if (this.tokenType === Dimension) {
|
||||
const code = this.charCodeAt(this.tokenStart);
|
||||
const sign = code === PLUSSIGN || code === HYPHENMINUS;
|
||||
let i = this.tokenStart + sign;
|
||||
|
||||
for (; i < this.tokenEnd; i++) {
|
||||
if (!isDigit(this.charCodeAt(i))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i === this.tokenStart + sign) {
|
||||
this.error('Integer is expected', this.tokenStart + sign);
|
||||
}
|
||||
|
||||
expectCharCode.call(this, i - this.tokenStart, N);
|
||||
a = this.substring(start, i);
|
||||
|
||||
// <n-dimension>
|
||||
// <n-dimension> <signed-integer>
|
||||
// <n-dimension> ['+' | '-'] <signless-integer>
|
||||
if (i + 1 === this.tokenEnd) {
|
||||
this.next();
|
||||
b = consumeB.call(this);
|
||||
} else {
|
||||
expectCharCode.call(this, i - this.tokenStart + 1, HYPHENMINUS);
|
||||
|
||||
// <ndash-dimension> <signless-integer>
|
||||
if (i + 2 === this.tokenEnd) {
|
||||
this.next();
|
||||
this.skipSC();
|
||||
checkTokenIsInteger.call(this, DISALLOW_SIGN);
|
||||
b = '-' + this.consume(Number);
|
||||
}
|
||||
// <ndashdigit-dimension>
|
||||
else {
|
||||
checkInteger.call(this, i - this.tokenStart + 2, DISALLOW_SIGN);
|
||||
this.next();
|
||||
b = this.substrToCursor(i + 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.error();
|
||||
}
|
||||
|
||||
if (a !== null && a.charCodeAt(0) === PLUSSIGN) {
|
||||
a = a.substr(1);
|
||||
}
|
||||
|
||||
if (b !== null && b.charCodeAt(0) === PLUSSIGN) {
|
||||
b = b.substr(1);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'AnPlusB',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
a,
|
||||
b
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
if (node.a) {
|
||||
const a =
|
||||
node.a === '+1' && 'n' ||
|
||||
node.a === '1' && 'n' ||
|
||||
node.a === '-1' && '-n' ||
|
||||
node.a + 'n';
|
||||
|
||||
if (node.b) {
|
||||
const b = node.b[0] === '-' || node.b[0] === '+'
|
||||
? node.b
|
||||
: '+' + node.b;
|
||||
this.tokenize(a + b);
|
||||
} else {
|
||||
this.tokenize(a);
|
||||
}
|
||||
} else {
|
||||
this.tokenize(node.b);
|
||||
}
|
||||
}
|
100
node_modules/css-tree/lib/syntax/node/Atrule.js
generated
vendored
Normal file
100
node_modules/css-tree/lib/syntax/node/Atrule.js
generated
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
import {
|
||||
AtKeyword,
|
||||
Semicolon,
|
||||
LeftCurlyBracket,
|
||||
RightCurlyBracket
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
function consumeRaw(startToken) {
|
||||
return this.Raw(startToken, this.consumeUntilLeftCurlyBracketOrSemicolon, true);
|
||||
}
|
||||
|
||||
function isDeclarationBlockAtrule() {
|
||||
for (let offset = 1, type; type = this.lookupType(offset); offset++) {
|
||||
if (type === RightCurlyBracket) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type === LeftCurlyBracket ||
|
||||
type === AtKeyword) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
export const name = 'Atrule';
|
||||
export const walkContext = 'atrule';
|
||||
export const structure = {
|
||||
name: String,
|
||||
prelude: ['AtrulePrelude', 'Raw', null],
|
||||
block: ['Block', null]
|
||||
};
|
||||
|
||||
export function parse(isDeclaration = false) {
|
||||
const start = this.tokenStart;
|
||||
let name;
|
||||
let nameLowerCase;
|
||||
let prelude = null;
|
||||
let block = null;
|
||||
|
||||
this.eat(AtKeyword);
|
||||
|
||||
name = this.substrToCursor(start + 1);
|
||||
nameLowerCase = name.toLowerCase();
|
||||
this.skipSC();
|
||||
|
||||
// parse prelude
|
||||
if (this.eof === false &&
|
||||
this.tokenType !== LeftCurlyBracket &&
|
||||
this.tokenType !== Semicolon) {
|
||||
if (this.parseAtrulePrelude) {
|
||||
prelude = this.parseWithFallback(this.AtrulePrelude.bind(this, name, isDeclaration), consumeRaw);
|
||||
} else {
|
||||
prelude = consumeRaw.call(this, this.tokenIndex);
|
||||
}
|
||||
|
||||
this.skipSC();
|
||||
}
|
||||
|
||||
switch (this.tokenType) {
|
||||
case Semicolon:
|
||||
this.next();
|
||||
break;
|
||||
|
||||
case LeftCurlyBracket:
|
||||
if (hasOwnProperty.call(this.atrule, nameLowerCase) &&
|
||||
typeof this.atrule[nameLowerCase].block === 'function') {
|
||||
block = this.atrule[nameLowerCase].block.call(this, isDeclaration);
|
||||
} else {
|
||||
// TODO: should consume block content as Raw?
|
||||
block = this.Block(isDeclarationBlockAtrule.call(this));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Atrule',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
name,
|
||||
prelude,
|
||||
block
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(AtKeyword, '@' + node.name);
|
||||
|
||||
if (node.prelude !== null) {
|
||||
this.node(node.prelude);
|
||||
}
|
||||
|
||||
if (node.block) {
|
||||
this.node(node.block);
|
||||
} else {
|
||||
this.token(Semicolon, ';');
|
||||
}
|
||||
}
|
47
node_modules/css-tree/lib/syntax/node/AtrulePrelude.js
generated
vendored
Normal file
47
node_modules/css-tree/lib/syntax/node/AtrulePrelude.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
import {
|
||||
Semicolon,
|
||||
LeftCurlyBracket
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'AtrulePrelude';
|
||||
export const walkContext = 'atrulePrelude';
|
||||
export const structure = {
|
||||
children: [[]]
|
||||
};
|
||||
|
||||
export function parse(name) {
|
||||
let children = null;
|
||||
|
||||
if (name !== null) {
|
||||
name = name.toLowerCase();
|
||||
}
|
||||
|
||||
this.skipSC();
|
||||
|
||||
if (hasOwnProperty.call(this.atrule, name) &&
|
||||
typeof this.atrule[name].prelude === 'function') {
|
||||
// custom consumer
|
||||
children = this.atrule[name].prelude.call(this);
|
||||
} else {
|
||||
// default consumer
|
||||
children = this.readSequence(this.scope.AtrulePrelude);
|
||||
}
|
||||
|
||||
this.skipSC();
|
||||
|
||||
if (this.eof !== true &&
|
||||
this.tokenType !== LeftCurlyBracket &&
|
||||
this.tokenType !== Semicolon) {
|
||||
this.error('Semicolon or block is expected');
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'AtrulePrelude',
|
||||
loc: this.getLocationFromList(children),
|
||||
children
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.children(node);
|
||||
}
|
147
node_modules/css-tree/lib/syntax/node/AttributeSelector.js
generated
vendored
Normal file
147
node_modules/css-tree/lib/syntax/node/AttributeSelector.js
generated
vendored
Normal file
@ -0,0 +1,147 @@
|
||||
import {
|
||||
Ident,
|
||||
String as StringToken,
|
||||
Delim,
|
||||
LeftSquareBracket,
|
||||
RightSquareBracket
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
const DOLLARSIGN = 0x0024; // U+0024 DOLLAR SIGN ($)
|
||||
const ASTERISK = 0x002A; // U+002A ASTERISK (*)
|
||||
const EQUALSSIGN = 0x003D; // U+003D EQUALS SIGN (=)
|
||||
const CIRCUMFLEXACCENT = 0x005E; // U+005E (^)
|
||||
const VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|)
|
||||
const TILDE = 0x007E; // U+007E TILDE (~)
|
||||
|
||||
function getAttributeName() {
|
||||
if (this.eof) {
|
||||
this.error('Unexpected end of input');
|
||||
}
|
||||
|
||||
const start = this.tokenStart;
|
||||
let expectIdent = false;
|
||||
|
||||
if (this.isDelim(ASTERISK)) {
|
||||
expectIdent = true;
|
||||
this.next();
|
||||
} else if (!this.isDelim(VERTICALLINE)) {
|
||||
this.eat(Ident);
|
||||
}
|
||||
|
||||
if (this.isDelim(VERTICALLINE)) {
|
||||
if (this.charCodeAt(this.tokenStart + 1) !== EQUALSSIGN) {
|
||||
this.next();
|
||||
this.eat(Ident);
|
||||
} else if (expectIdent) {
|
||||
this.error('Identifier is expected', this.tokenEnd);
|
||||
}
|
||||
} else if (expectIdent) {
|
||||
this.error('Vertical line is expected');
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Identifier',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
name: this.substrToCursor(start)
|
||||
};
|
||||
}
|
||||
|
||||
function getOperator() {
|
||||
const start = this.tokenStart;
|
||||
const code = this.charCodeAt(start);
|
||||
|
||||
if (code !== EQUALSSIGN && // =
|
||||
code !== TILDE && // ~=
|
||||
code !== CIRCUMFLEXACCENT && // ^=
|
||||
code !== DOLLARSIGN && // $=
|
||||
code !== ASTERISK && // *=
|
||||
code !== VERTICALLINE // |=
|
||||
) {
|
||||
this.error('Attribute selector (=, ~=, ^=, $=, *=, |=) is expected');
|
||||
}
|
||||
|
||||
this.next();
|
||||
|
||||
if (code !== EQUALSSIGN) {
|
||||
if (!this.isDelim(EQUALSSIGN)) {
|
||||
this.error('Equal sign is expected');
|
||||
}
|
||||
|
||||
this.next();
|
||||
}
|
||||
|
||||
return this.substrToCursor(start);
|
||||
}
|
||||
|
||||
// '[' <wq-name> ']'
|
||||
// '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'
|
||||
export const name = 'AttributeSelector';
|
||||
export const structure = {
|
||||
name: 'Identifier',
|
||||
matcher: [String, null],
|
||||
value: ['String', 'Identifier', null],
|
||||
flags: [String, null]
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
let name;
|
||||
let matcher = null;
|
||||
let value = null;
|
||||
let flags = null;
|
||||
|
||||
this.eat(LeftSquareBracket);
|
||||
this.skipSC();
|
||||
|
||||
name = getAttributeName.call(this);
|
||||
this.skipSC();
|
||||
|
||||
if (this.tokenType !== RightSquareBracket) {
|
||||
// avoid case `[name i]`
|
||||
if (this.tokenType !== Ident) {
|
||||
matcher = getOperator.call(this);
|
||||
|
||||
this.skipSC();
|
||||
|
||||
value = this.tokenType === StringToken
|
||||
? this.String()
|
||||
: this.Identifier();
|
||||
|
||||
this.skipSC();
|
||||
}
|
||||
|
||||
// attribute flags
|
||||
if (this.tokenType === Ident) {
|
||||
flags = this.consume(Ident);
|
||||
|
||||
this.skipSC();
|
||||
}
|
||||
}
|
||||
|
||||
this.eat(RightSquareBracket);
|
||||
|
||||
return {
|
||||
type: 'AttributeSelector',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
name,
|
||||
matcher,
|
||||
value,
|
||||
flags
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(Delim, '[');
|
||||
this.node(node.name);
|
||||
|
||||
if (node.matcher !== null) {
|
||||
this.tokenize(node.matcher);
|
||||
this.node(node.value);
|
||||
}
|
||||
|
||||
if (node.flags !== null) {
|
||||
this.token(Ident, node.flags);
|
||||
}
|
||||
|
||||
this.token(Delim, ']');
|
||||
}
|
95
node_modules/css-tree/lib/syntax/node/Block.js
generated
vendored
Normal file
95
node_modules/css-tree/lib/syntax/node/Block.js
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
import {
|
||||
WhiteSpace,
|
||||
Comment,
|
||||
Semicolon,
|
||||
AtKeyword,
|
||||
LeftCurlyBracket,
|
||||
RightCurlyBracket
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
const AMPERSAND = 0x0026; // U+0026 AMPERSAND (&)
|
||||
|
||||
function consumeRaw(startToken) {
|
||||
return this.Raw(startToken, null, true);
|
||||
}
|
||||
function consumeRule() {
|
||||
return this.parseWithFallback(this.Rule, consumeRaw);
|
||||
}
|
||||
function consumeRawDeclaration(startToken) {
|
||||
return this.Raw(startToken, this.consumeUntilSemicolonIncluded, true);
|
||||
}
|
||||
function consumeDeclaration() {
|
||||
if (this.tokenType === Semicolon) {
|
||||
return consumeRawDeclaration.call(this, this.tokenIndex);
|
||||
}
|
||||
|
||||
const node = this.parseWithFallback(this.Declaration, consumeRawDeclaration);
|
||||
|
||||
if (this.tokenType === Semicolon) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
export const name = 'Block';
|
||||
export const walkContext = 'block';
|
||||
export const structure = {
|
||||
children: [[
|
||||
'Atrule',
|
||||
'Rule',
|
||||
'Declaration'
|
||||
]]
|
||||
};
|
||||
|
||||
export function parse(isStyleBlock) {
|
||||
const consumer = isStyleBlock ? consumeDeclaration : consumeRule;
|
||||
const start = this.tokenStart;
|
||||
let children = this.createList();
|
||||
|
||||
this.eat(LeftCurlyBracket);
|
||||
|
||||
scan:
|
||||
while (!this.eof) {
|
||||
switch (this.tokenType) {
|
||||
case RightCurlyBracket:
|
||||
break scan;
|
||||
|
||||
case WhiteSpace:
|
||||
case Comment:
|
||||
this.next();
|
||||
break;
|
||||
|
||||
case AtKeyword:
|
||||
children.push(this.parseWithFallback(this.Atrule.bind(this, isStyleBlock), consumeRaw));
|
||||
break;
|
||||
|
||||
default:
|
||||
if (isStyleBlock && this.isDelim(AMPERSAND)) {
|
||||
children.push(consumeRule.call(this));
|
||||
} else {
|
||||
children.push(consumer.call(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.eof) {
|
||||
this.eat(RightCurlyBracket);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Block',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
children
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(LeftCurlyBracket, '{');
|
||||
this.children(node, prev => {
|
||||
if (prev.type === 'Declaration') {
|
||||
this.token(Semicolon, ';');
|
||||
}
|
||||
});
|
||||
this.token(RightCurlyBracket, '}');
|
||||
}
|
35
node_modules/css-tree/lib/syntax/node/Brackets.js
generated
vendored
Normal file
35
node_modules/css-tree/lib/syntax/node/Brackets.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
import {
|
||||
Delim,
|
||||
LeftSquareBracket,
|
||||
RightSquareBracket
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'Brackets';
|
||||
export const structure = {
|
||||
children: [[]]
|
||||
};
|
||||
|
||||
export function parse(readSequence, recognizer) {
|
||||
const start = this.tokenStart;
|
||||
let children = null;
|
||||
|
||||
this.eat(LeftSquareBracket);
|
||||
|
||||
children = readSequence.call(this, recognizer);
|
||||
|
||||
if (!this.eof) {
|
||||
this.eat(RightSquareBracket);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Brackets',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
children
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(Delim, '[');
|
||||
this.children(node);
|
||||
this.token(Delim, ']');
|
||||
}
|
19
node_modules/css-tree/lib/syntax/node/CDC.js
generated
vendored
Normal file
19
node_modules/css-tree/lib/syntax/node/CDC.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
import { CDC } from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'CDC';
|
||||
export const structure = [];
|
||||
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
|
||||
this.eat(CDC); // -->
|
||||
|
||||
return {
|
||||
type: 'CDC',
|
||||
loc: this.getLocation(start, this.tokenStart)
|
||||
};
|
||||
}
|
||||
|
||||
export function generate() {
|
||||
this.token(CDC, '-->');
|
||||
}
|
19
node_modules/css-tree/lib/syntax/node/CDO.js
generated
vendored
Normal file
19
node_modules/css-tree/lib/syntax/node/CDO.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
import { CDO } from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'CDO';
|
||||
export const structure = [];
|
||||
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
|
||||
this.eat(CDO); // <!--
|
||||
|
||||
return {
|
||||
type: 'CDO',
|
||||
loc: this.getLocation(start, this.tokenStart)
|
||||
};
|
||||
}
|
||||
|
||||
export function generate() {
|
||||
this.token(CDO, '<!--');
|
||||
}
|
24
node_modules/css-tree/lib/syntax/node/ClassSelector.js
generated
vendored
Normal file
24
node_modules/css-tree/lib/syntax/node/ClassSelector.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
import { Delim, Ident } from '../../tokenizer/index.js';
|
||||
|
||||
const FULLSTOP = 0x002E; // U+002E FULL STOP (.)
|
||||
|
||||
// '.' ident
|
||||
export const name = 'ClassSelector';
|
||||
export const structure = {
|
||||
name: String
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
this.eatDelim(FULLSTOP);
|
||||
|
||||
return {
|
||||
type: 'ClassSelector',
|
||||
loc: this.getLocation(this.tokenStart - 1, this.tokenEnd),
|
||||
name: this.consume(Ident)
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(Delim, '.');
|
||||
this.token(Ident, node.name);
|
||||
}
|
54
node_modules/css-tree/lib/syntax/node/Combinator.js
generated
vendored
Normal file
54
node_modules/css-tree/lib/syntax/node/Combinator.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
import { WhiteSpace, Delim } from '../../tokenizer/index.js';
|
||||
|
||||
const PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
|
||||
const SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
|
||||
const GREATERTHANSIGN = 0x003E; // U+003E GREATER-THAN SIGN (>)
|
||||
const TILDE = 0x007E; // U+007E TILDE (~)
|
||||
|
||||
export const name = 'Combinator';
|
||||
export const structure = {
|
||||
name: String
|
||||
};
|
||||
|
||||
// + | > | ~ | /deep/
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
let name;
|
||||
|
||||
switch (this.tokenType) {
|
||||
case WhiteSpace:
|
||||
name = ' ';
|
||||
break;
|
||||
|
||||
case Delim:
|
||||
switch (this.charCodeAt(this.tokenStart)) {
|
||||
case GREATERTHANSIGN:
|
||||
case PLUSSIGN:
|
||||
case TILDE:
|
||||
this.next();
|
||||
break;
|
||||
|
||||
case SOLIDUS:
|
||||
this.next();
|
||||
this.eatIdent('deep');
|
||||
this.eatDelim(SOLIDUS);
|
||||
break;
|
||||
|
||||
default:
|
||||
this.error('Combinator is expected');
|
||||
}
|
||||
|
||||
name = this.substrToCursor(start);
|
||||
break;
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Combinator',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
name
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.tokenize(node.name);
|
||||
}
|
33
node_modules/css-tree/lib/syntax/node/Comment.js
generated
vendored
Normal file
33
node_modules/css-tree/lib/syntax/node/Comment.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
import { Comment } from '../../tokenizer/index.js';
|
||||
|
||||
const ASTERISK = 0x002A; // U+002A ASTERISK (*)
|
||||
const SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
|
||||
|
||||
|
||||
export const name = 'Comment';
|
||||
export const structure = {
|
||||
value: String
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
let end = this.tokenEnd;
|
||||
|
||||
this.eat(Comment);
|
||||
|
||||
if ((end - start + 2) >= 2 &&
|
||||
this.charCodeAt(end - 2) === ASTERISK &&
|
||||
this.charCodeAt(end - 1) === SOLIDUS) {
|
||||
end -= 2;
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Comment',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
value: this.substring(start + 2, end)
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(Comment, '/*' + node.value + '*/');
|
||||
}
|
165
node_modules/css-tree/lib/syntax/node/Declaration.js
generated
vendored
Normal file
165
node_modules/css-tree/lib/syntax/node/Declaration.js
generated
vendored
Normal file
@ -0,0 +1,165 @@
|
||||
import { isCustomProperty } from '../../utils/names.js';
|
||||
import {
|
||||
Ident,
|
||||
Hash,
|
||||
Colon,
|
||||
Semicolon,
|
||||
Delim,
|
||||
WhiteSpace
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
const EXCLAMATIONMARK = 0x0021; // U+0021 EXCLAMATION MARK (!)
|
||||
const NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)
|
||||
const DOLLARSIGN = 0x0024; // U+0024 DOLLAR SIGN ($)
|
||||
const AMPERSAND = 0x0026; // U+0026 AMPERSAND (&)
|
||||
const ASTERISK = 0x002A; // U+002A ASTERISK (*)
|
||||
const PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
|
||||
const SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
|
||||
|
||||
function consumeValueRaw(startToken) {
|
||||
return this.Raw(startToken, this.consumeUntilExclamationMarkOrSemicolon, true);
|
||||
}
|
||||
|
||||
function consumeCustomPropertyRaw(startToken) {
|
||||
return this.Raw(startToken, this.consumeUntilExclamationMarkOrSemicolon, false);
|
||||
}
|
||||
|
||||
function consumeValue() {
|
||||
const startValueToken = this.tokenIndex;
|
||||
const value = this.Value();
|
||||
|
||||
if (value.type !== 'Raw' &&
|
||||
this.eof === false &&
|
||||
this.tokenType !== Semicolon &&
|
||||
this.isDelim(EXCLAMATIONMARK) === false &&
|
||||
this.isBalanceEdge(startValueToken) === false) {
|
||||
this.error();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
export const name = 'Declaration';
|
||||
export const walkContext = 'declaration';
|
||||
export const structure = {
|
||||
important: [Boolean, String],
|
||||
property: String,
|
||||
value: ['Value', 'Raw']
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
const startToken = this.tokenIndex;
|
||||
const property = readProperty.call(this);
|
||||
const customProperty = isCustomProperty(property);
|
||||
const parseValue = customProperty ? this.parseCustomProperty : this.parseValue;
|
||||
const consumeRaw = customProperty ? consumeCustomPropertyRaw : consumeValueRaw;
|
||||
let important = false;
|
||||
let value;
|
||||
|
||||
this.skipSC();
|
||||
this.eat(Colon);
|
||||
|
||||
const valueStart = this.tokenIndex;
|
||||
|
||||
if (!customProperty) {
|
||||
this.skipSC();
|
||||
}
|
||||
|
||||
if (parseValue) {
|
||||
value = this.parseWithFallback(consumeValue, consumeRaw);
|
||||
} else {
|
||||
value = consumeRaw.call(this, this.tokenIndex);
|
||||
}
|
||||
|
||||
if (customProperty && value.type === 'Value' && value.children.isEmpty) {
|
||||
for (let offset = valueStart - this.tokenIndex; offset <= 0; offset++) {
|
||||
if (this.lookupType(offset) === WhiteSpace) {
|
||||
value.children.appendData({
|
||||
type: 'WhiteSpace',
|
||||
loc: null,
|
||||
value: ' '
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isDelim(EXCLAMATIONMARK)) {
|
||||
important = getImportant.call(this);
|
||||
this.skipSC();
|
||||
}
|
||||
|
||||
// Do not include semicolon to range per spec
|
||||
// https://drafts.csswg.org/css-syntax/#declaration-diagram
|
||||
|
||||
if (this.eof === false &&
|
||||
this.tokenType !== Semicolon &&
|
||||
this.isBalanceEdge(startToken) === false) {
|
||||
this.error();
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Declaration',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
important,
|
||||
property,
|
||||
value
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(Ident, node.property);
|
||||
this.token(Colon, ':');
|
||||
this.node(node.value);
|
||||
|
||||
if (node.important) {
|
||||
this.token(Delim, '!');
|
||||
this.token(Ident, node.important === true ? 'important' : node.important);
|
||||
}
|
||||
}
|
||||
|
||||
function readProperty() {
|
||||
const start = this.tokenStart;
|
||||
|
||||
// hacks
|
||||
if (this.tokenType === Delim) {
|
||||
switch (this.charCodeAt(this.tokenStart)) {
|
||||
case ASTERISK:
|
||||
case DOLLARSIGN:
|
||||
case PLUSSIGN:
|
||||
case NUMBERSIGN:
|
||||
case AMPERSAND:
|
||||
this.next();
|
||||
break;
|
||||
|
||||
// TODO: not sure we should support this hack
|
||||
case SOLIDUS:
|
||||
this.next();
|
||||
if (this.isDelim(SOLIDUS)) {
|
||||
this.next();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.tokenType === Hash) {
|
||||
this.eat(Hash);
|
||||
} else {
|
||||
this.eat(Ident);
|
||||
}
|
||||
|
||||
return this.substrToCursor(start);
|
||||
}
|
||||
|
||||
// ! ws* important
|
||||
function getImportant() {
|
||||
this.eat(Delim);
|
||||
this.skipSC();
|
||||
|
||||
const important = this.consume(Ident);
|
||||
|
||||
// store original value in case it differ from `important`
|
||||
// for better original source restoring and hacks like `!ie` support
|
||||
return important === 'important' ? true : important;
|
||||
}
|
62
node_modules/css-tree/lib/syntax/node/DeclarationList.js
generated
vendored
Normal file
62
node_modules/css-tree/lib/syntax/node/DeclarationList.js
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
import {
|
||||
WhiteSpace,
|
||||
Comment,
|
||||
Semicolon,
|
||||
AtKeyword
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
const AMPERSAND = 0x0026; // U+0026 AMPERSAND (&)
|
||||
|
||||
function consumeRaw(startToken) {
|
||||
return this.Raw(startToken, this.consumeUntilSemicolonIncluded, true);
|
||||
}
|
||||
|
||||
export const name = 'DeclarationList';
|
||||
export const structure = {
|
||||
children: [[
|
||||
'Declaration',
|
||||
'Atrule',
|
||||
'Rule'
|
||||
]]
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const children = this.createList();
|
||||
|
||||
scan:
|
||||
while (!this.eof) {
|
||||
switch (this.tokenType) {
|
||||
case WhiteSpace:
|
||||
case Comment:
|
||||
case Semicolon:
|
||||
this.next();
|
||||
break;
|
||||
|
||||
case AtKeyword:
|
||||
children.push(this.parseWithFallback(this.Atrule.bind(this, true), consumeRaw));
|
||||
break;
|
||||
|
||||
default:
|
||||
if (this.isDelim(AMPERSAND)) {
|
||||
children.push(this.parseWithFallback(this.Rule, consumeRaw));
|
||||
} else {
|
||||
children.push(this.parseWithFallback(this.Declaration, consumeRaw));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'DeclarationList',
|
||||
loc: this.getLocationFromList(children),
|
||||
children
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.children(node, prev => {
|
||||
if (prev.type === 'Declaration') {
|
||||
this.token(Semicolon, ';');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
23
node_modules/css-tree/lib/syntax/node/Dimension.js
generated
vendored
Normal file
23
node_modules/css-tree/lib/syntax/node/Dimension.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
import { Dimension } from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'Dimension';
|
||||
export const structure = {
|
||||
value: String,
|
||||
unit: String
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
const value = this.consumeNumber(Dimension);
|
||||
|
||||
return {
|
||||
type: 'Dimension',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
value,
|
||||
unit: this.substring(start + value.length, this.tokenStart)
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(Dimension, node.value + node.unit);
|
||||
}
|
41
node_modules/css-tree/lib/syntax/node/Function.js
generated
vendored
Normal file
41
node_modules/css-tree/lib/syntax/node/Function.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
import {
|
||||
Function as FunctionToken,
|
||||
RightParenthesis
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
|
||||
export const name = 'Function';
|
||||
export const walkContext = 'function';
|
||||
export const structure = {
|
||||
name: String,
|
||||
children: [[]]
|
||||
};
|
||||
|
||||
// <function-token> <sequence> )
|
||||
export function parse(readSequence, recognizer) {
|
||||
const start = this.tokenStart;
|
||||
const name = this.consumeFunctionName();
|
||||
const nameLowerCase = name.toLowerCase();
|
||||
let children;
|
||||
|
||||
children = recognizer.hasOwnProperty(nameLowerCase)
|
||||
? recognizer[nameLowerCase].call(this, recognizer)
|
||||
: readSequence.call(this, recognizer);
|
||||
|
||||
if (!this.eof) {
|
||||
this.eat(RightParenthesis);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Function',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
name,
|
||||
children
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(FunctionToken, node.name + '(');
|
||||
this.children(node);
|
||||
this.token(RightParenthesis, ')');
|
||||
}
|
23
node_modules/css-tree/lib/syntax/node/Hash.js
generated
vendored
Normal file
23
node_modules/css-tree/lib/syntax/node/Hash.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
import { Hash } from '../../tokenizer/index.js';
|
||||
|
||||
// '#' ident
|
||||
export const xxx = 'XXX';
|
||||
export const name = 'Hash';
|
||||
export const structure = {
|
||||
value: String
|
||||
};
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
|
||||
this.eat(Hash);
|
||||
|
||||
return {
|
||||
type: 'Hash',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
value: this.substrToCursor(start + 1)
|
||||
};
|
||||
}
|
||||
export function generate(node) {
|
||||
this.token(Hash, '#' + node.value);
|
||||
}
|
||||
|
26
node_modules/css-tree/lib/syntax/node/IdSelector.js
generated
vendored
Normal file
26
node_modules/css-tree/lib/syntax/node/IdSelector.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
import { Hash, Delim } from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'IdSelector';
|
||||
export const structure = {
|
||||
name: String
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
|
||||
// TODO: check value is an ident
|
||||
this.eat(Hash);
|
||||
|
||||
return {
|
||||
type: 'IdSelector',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
name: this.substrToCursor(start + 1)
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
// Using Delim instead of Hash is a hack to avoid for a whitespace between ident and id-selector
|
||||
// in safe mode (e.g. "a#id"), because IE11 doesn't allow a sequence <ident-token> <hash-token>
|
||||
// without a whitespace in values (e.g. "1px solid#000")
|
||||
this.token(Delim, '#' + node.name);
|
||||
}
|
18
node_modules/css-tree/lib/syntax/node/Identifier.js
generated
vendored
Normal file
18
node_modules/css-tree/lib/syntax/node/Identifier.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
import { Ident } from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'Identifier';
|
||||
export const structure = {
|
||||
name: String
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
return {
|
||||
type: 'Identifier',
|
||||
loc: this.getLocation(this.tokenStart, this.tokenEnd),
|
||||
name: this.consume(Ident)
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(Ident, node.name);
|
||||
}
|
77
node_modules/css-tree/lib/syntax/node/MediaFeature.js
generated
vendored
Normal file
77
node_modules/css-tree/lib/syntax/node/MediaFeature.js
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
import {
|
||||
Ident,
|
||||
Number,
|
||||
Dimension,
|
||||
LeftParenthesis,
|
||||
RightParenthesis,
|
||||
Colon,
|
||||
Delim
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'MediaFeature';
|
||||
export const structure = {
|
||||
name: String,
|
||||
value: ['Identifier', 'Number', 'Dimension', 'Ratio', null]
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
let name;
|
||||
let value = null;
|
||||
|
||||
this.eat(LeftParenthesis);
|
||||
this.skipSC();
|
||||
|
||||
name = this.consume(Ident);
|
||||
this.skipSC();
|
||||
|
||||
if (this.tokenType !== RightParenthesis) {
|
||||
this.eat(Colon);
|
||||
this.skipSC();
|
||||
|
||||
switch (this.tokenType) {
|
||||
case Number:
|
||||
if (this.lookupNonWSType(1) === Delim) {
|
||||
value = this.Ratio();
|
||||
} else {
|
||||
value = this.Number();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Dimension:
|
||||
value = this.Dimension();
|
||||
break;
|
||||
|
||||
case Ident:
|
||||
value = this.Identifier();
|
||||
break;
|
||||
|
||||
default:
|
||||
this.error('Number, dimension, ratio or identifier is expected');
|
||||
}
|
||||
|
||||
this.skipSC();
|
||||
}
|
||||
|
||||
this.eat(RightParenthesis);
|
||||
|
||||
return {
|
||||
type: 'MediaFeature',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
name,
|
||||
value
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(LeftParenthesis, '(');
|
||||
this.token(Ident, node.name);
|
||||
|
||||
if (node.value !== null) {
|
||||
this.token(Colon, ':');
|
||||
this.node(node.value);
|
||||
}
|
||||
|
||||
this.token(RightParenthesis, ')');
|
||||
}
|
60
node_modules/css-tree/lib/syntax/node/MediaQuery.js
generated
vendored
Normal file
60
node_modules/css-tree/lib/syntax/node/MediaQuery.js
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
import {
|
||||
WhiteSpace,
|
||||
Comment,
|
||||
Ident,
|
||||
LeftParenthesis
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'MediaQuery';
|
||||
export const structure = {
|
||||
children: [[
|
||||
'Identifier',
|
||||
'MediaFeature',
|
||||
'WhiteSpace'
|
||||
]]
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const children = this.createList();
|
||||
let child = null;
|
||||
|
||||
this.skipSC();
|
||||
|
||||
scan:
|
||||
while (!this.eof) {
|
||||
switch (this.tokenType) {
|
||||
case Comment:
|
||||
case WhiteSpace:
|
||||
this.next();
|
||||
continue;
|
||||
|
||||
case Ident:
|
||||
child = this.Identifier();
|
||||
break;
|
||||
|
||||
case LeftParenthesis:
|
||||
child = this.MediaFeature();
|
||||
break;
|
||||
|
||||
default:
|
||||
break scan;
|
||||
}
|
||||
|
||||
children.push(child);
|
||||
}
|
||||
|
||||
if (child === null) {
|
||||
this.error('Identifier or parenthesis is expected');
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'MediaQuery',
|
||||
loc: this.getLocationFromList(children),
|
||||
children
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.children(node);
|
||||
}
|
||||
|
34
node_modules/css-tree/lib/syntax/node/MediaQueryList.js
generated
vendored
Normal file
34
node_modules/css-tree/lib/syntax/node/MediaQueryList.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
import { Comma } from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'MediaQueryList';
|
||||
export const structure = {
|
||||
children: [[
|
||||
'MediaQuery'
|
||||
]]
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const children = this.createList();
|
||||
|
||||
this.skipSC();
|
||||
|
||||
while (!this.eof) {
|
||||
children.push(this.MediaQuery());
|
||||
|
||||
if (this.tokenType !== Comma) {
|
||||
break;
|
||||
}
|
||||
|
||||
this.next();
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'MediaQueryList',
|
||||
loc: this.getLocationFromList(children),
|
||||
children
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.children(node, () => this.token(Comma, ','));
|
||||
}
|
22
node_modules/css-tree/lib/syntax/node/NestingSelector.js
generated
vendored
Normal file
22
node_modules/css-tree/lib/syntax/node/NestingSelector.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
import { Delim } from '../../tokenizer/index.js';
|
||||
|
||||
const AMPERSAND = 0x0026; // U+0026 AMPERSAND (&)
|
||||
|
||||
export const name = 'NestingSelector';
|
||||
export const structure = {
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
|
||||
this.eatDelim(AMPERSAND);
|
||||
|
||||
return {
|
||||
type: 'NestingSelector',
|
||||
loc: this.getLocation(start, this.tokenStart)
|
||||
};
|
||||
}
|
||||
|
||||
export function generate() {
|
||||
this.token(Delim, '&');
|
||||
}
|
47
node_modules/css-tree/lib/syntax/node/Nth.js
generated
vendored
Normal file
47
node_modules/css-tree/lib/syntax/node/Nth.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
import { Ident } from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'Nth';
|
||||
export const structure = {
|
||||
nth: ['AnPlusB', 'Identifier'],
|
||||
selector: ['SelectorList', null]
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
this.skipSC();
|
||||
|
||||
const start = this.tokenStart;
|
||||
let end = start;
|
||||
let selector = null;
|
||||
let nth;
|
||||
|
||||
if (this.lookupValue(0, 'odd') || this.lookupValue(0, 'even')) {
|
||||
nth = this.Identifier();
|
||||
} else {
|
||||
nth = this.AnPlusB();
|
||||
}
|
||||
|
||||
end = this.tokenStart;
|
||||
this.skipSC();
|
||||
|
||||
if (this.lookupValue(0, 'of')) {
|
||||
this.next();
|
||||
|
||||
selector = this.SelectorList();
|
||||
end = this.tokenStart;
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Nth',
|
||||
loc: this.getLocation(start, end),
|
||||
nth,
|
||||
selector
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.node(node.nth);
|
||||
if (node.selector !== null) {
|
||||
this.token(Ident, 'of');
|
||||
this.node(node.selector);
|
||||
}
|
||||
}
|
18
node_modules/css-tree/lib/syntax/node/Number.js
generated
vendored
Normal file
18
node_modules/css-tree/lib/syntax/node/Number.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
import { Number as NumberToken } from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'Number';
|
||||
export const structure = {
|
||||
value: String
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
return {
|
||||
type: 'Number',
|
||||
loc: this.getLocation(this.tokenStart, this.tokenEnd),
|
||||
value: this.consume(NumberToken)
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(NumberToken, node.value);
|
||||
}
|
21
node_modules/css-tree/lib/syntax/node/Operator.js
generated
vendored
Normal file
21
node_modules/css-tree/lib/syntax/node/Operator.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// '/' | '*' | ',' | ':' | '+' | '-'
|
||||
export const name = 'Operator';
|
||||
export const structure = {
|
||||
value: String
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
|
||||
this.next();
|
||||
|
||||
return {
|
||||
type: 'Operator',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
value: this.substrToCursor(start)
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.tokenize(node.value);
|
||||
}
|
34
node_modules/css-tree/lib/syntax/node/Parentheses.js
generated
vendored
Normal file
34
node_modules/css-tree/lib/syntax/node/Parentheses.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
import {
|
||||
LeftParenthesis,
|
||||
RightParenthesis
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'Parentheses';
|
||||
export const structure = {
|
||||
children: [[]]
|
||||
};
|
||||
|
||||
export function parse(readSequence, recognizer) {
|
||||
const start = this.tokenStart;
|
||||
let children = null;
|
||||
|
||||
this.eat(LeftParenthesis);
|
||||
|
||||
children = readSequence.call(this, recognizer);
|
||||
|
||||
if (!this.eof) {
|
||||
this.eat(RightParenthesis);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Parentheses',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
children
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(LeftParenthesis, '(');
|
||||
this.children(node);
|
||||
this.token(RightParenthesis, ')');
|
||||
}
|
18
node_modules/css-tree/lib/syntax/node/Percentage.js
generated
vendored
Normal file
18
node_modules/css-tree/lib/syntax/node/Percentage.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
import { Percentage } from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'Percentage';
|
||||
export const structure = {
|
||||
value: String
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
return {
|
||||
type: 'Percentage',
|
||||
loc: this.getLocation(this.tokenStart, this.tokenEnd),
|
||||
value: this.consumeNumber(Percentage)
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(Percentage, node.value + '%');
|
||||
}
|
63
node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
generated
vendored
Normal file
63
node_modules/css-tree/lib/syntax/node/PseudoClassSelector.js
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
import {
|
||||
Ident,
|
||||
Function as FunctionToken,
|
||||
Colon,
|
||||
RightParenthesis
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
|
||||
export const name = 'PseudoClassSelector';
|
||||
export const walkContext = 'function';
|
||||
export const structure = {
|
||||
name: String,
|
||||
children: [['Raw'], null]
|
||||
};
|
||||
|
||||
// : [ <ident> | <function-token> <any-value>? ) ]
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
let children = null;
|
||||
let name;
|
||||
let nameLowerCase;
|
||||
|
||||
this.eat(Colon);
|
||||
|
||||
if (this.tokenType === FunctionToken) {
|
||||
name = this.consumeFunctionName();
|
||||
nameLowerCase = name.toLowerCase();
|
||||
|
||||
if (hasOwnProperty.call(this.pseudo, nameLowerCase)) {
|
||||
this.skipSC();
|
||||
children = this.pseudo[nameLowerCase].call(this);
|
||||
this.skipSC();
|
||||
} else {
|
||||
children = this.createList();
|
||||
children.push(
|
||||
this.Raw(this.tokenIndex, null, false)
|
||||
);
|
||||
}
|
||||
|
||||
this.eat(RightParenthesis);
|
||||
} else {
|
||||
name = this.consume(Ident);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'PseudoClassSelector',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
name,
|
||||
children
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(Colon, ':');
|
||||
|
||||
if (node.children === null) {
|
||||
this.token(Ident, node.name);
|
||||
} else {
|
||||
this.token(FunctionToken, node.name + '(');
|
||||
this.children(node);
|
||||
this.token(RightParenthesis, ')');
|
||||
}
|
||||
}
|
64
node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
generated
vendored
Normal file
64
node_modules/css-tree/lib/syntax/node/PseudoElementSelector.js
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
import {
|
||||
Ident,
|
||||
Function as FunctionToken,
|
||||
Colon,
|
||||
RightParenthesis
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'PseudoElementSelector';
|
||||
export const walkContext = 'function';
|
||||
export const structure = {
|
||||
name: String,
|
||||
children: [['Raw'], null]
|
||||
};
|
||||
|
||||
// :: [ <ident> | <function-token> <any-value>? ) ]
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
let children = null;
|
||||
let name;
|
||||
let nameLowerCase;
|
||||
|
||||
this.eat(Colon);
|
||||
this.eat(Colon);
|
||||
|
||||
if (this.tokenType === FunctionToken) {
|
||||
name = this.consumeFunctionName();
|
||||
nameLowerCase = name.toLowerCase();
|
||||
|
||||
if (hasOwnProperty.call(this.pseudo, nameLowerCase)) {
|
||||
this.skipSC();
|
||||
children = this.pseudo[nameLowerCase].call(this);
|
||||
this.skipSC();
|
||||
} else {
|
||||
children = this.createList();
|
||||
children.push(
|
||||
this.Raw(this.tokenIndex, null, false)
|
||||
);
|
||||
}
|
||||
|
||||
this.eat(RightParenthesis);
|
||||
} else {
|
||||
name = this.consume(Ident);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'PseudoElementSelector',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
name,
|
||||
children
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(Colon, ':');
|
||||
this.token(Colon, ':');
|
||||
|
||||
if (node.children === null) {
|
||||
this.token(Ident, node.name);
|
||||
} else {
|
||||
this.token(FunctionToken, node.name + '(');
|
||||
this.children(node);
|
||||
this.token(RightParenthesis, ')');
|
||||
}
|
||||
}
|
59
node_modules/css-tree/lib/syntax/node/Ratio.js
generated
vendored
Normal file
59
node_modules/css-tree/lib/syntax/node/Ratio.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
import { isDigit, Delim, Number as NumberToken } from '../../tokenizer/index.js';
|
||||
|
||||
const SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
|
||||
const FULLSTOP = 0x002E; // U+002E FULL STOP (.)
|
||||
|
||||
// Terms of <ratio> should be a positive numbers (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 an exponent part.
|
||||
// Additional checking may be applied on lexer validation.
|
||||
function consumeNumber() {
|
||||
this.skipSC();
|
||||
|
||||
const value = this.consume(NumberToken);
|
||||
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const code = value.charCodeAt(i);
|
||||
if (!isDigit(code) && code !== FULLSTOP) {
|
||||
this.error('Unsigned number is expected', this.tokenStart - value.length + i);
|
||||
}
|
||||
}
|
||||
|
||||
if (Number(value) === 0) {
|
||||
this.error('Zero number is not allowed', this.tokenStart - value.length);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
export const name = 'Ratio';
|
||||
export const structure = {
|
||||
left: String,
|
||||
right: String
|
||||
};
|
||||
|
||||
// <positive-integer> S* '/' S* <positive-integer>
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
const left = consumeNumber.call(this);
|
||||
let right;
|
||||
|
||||
this.skipSC();
|
||||
this.eatDelim(SOLIDUS);
|
||||
right = consumeNumber.call(this);
|
||||
|
||||
return {
|
||||
type: 'Ratio',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
left,
|
||||
right
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(NumberToken, node.left);
|
||||
this.token(Delim, '/');
|
||||
this.token(NumberToken, node.right);
|
||||
}
|
41
node_modules/css-tree/lib/syntax/node/Raw.js
generated
vendored
Normal file
41
node_modules/css-tree/lib/syntax/node/Raw.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
import { WhiteSpace } from '../../tokenizer/index.js';
|
||||
|
||||
function getOffsetExcludeWS() {
|
||||
if (this.tokenIndex > 0) {
|
||||
if (this.lookupType(-1) === WhiteSpace) {
|
||||
return this.tokenIndex > 1
|
||||
? this.getTokenStart(this.tokenIndex - 1)
|
||||
: this.firstCharOffset;
|
||||
}
|
||||
}
|
||||
|
||||
return this.tokenStart;
|
||||
}
|
||||
|
||||
export const name = 'Raw';
|
||||
export const structure = {
|
||||
value: String
|
||||
};
|
||||
|
||||
export function parse(startToken, consumeUntil, excludeWhiteSpace) {
|
||||
const startOffset = this.getTokenStart(startToken);
|
||||
let endOffset;
|
||||
|
||||
this.skipUntilBalanced(startToken, consumeUntil || this.consumeUntilBalanceEnd);
|
||||
|
||||
if (excludeWhiteSpace && this.tokenStart > startOffset) {
|
||||
endOffset = getOffsetExcludeWS.call(this);
|
||||
} else {
|
||||
endOffset = this.tokenStart;
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Raw',
|
||||
loc: this.getLocation(startOffset, endOffset),
|
||||
value: this.substring(startOffset, endOffset)
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.tokenize(node.value);
|
||||
}
|
51
node_modules/css-tree/lib/syntax/node/Rule.js
generated
vendored
Normal file
51
node_modules/css-tree/lib/syntax/node/Rule.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
import { LeftCurlyBracket } from '../../tokenizer/index.js';
|
||||
|
||||
function consumeRaw(startToken) {
|
||||
return this.Raw(startToken, this.consumeUntilLeftCurlyBracket, true);
|
||||
}
|
||||
|
||||
function consumePrelude() {
|
||||
const prelude = this.SelectorList();
|
||||
|
||||
if (prelude.type !== 'Raw' &&
|
||||
this.eof === false &&
|
||||
this.tokenType !== LeftCurlyBracket) {
|
||||
this.error();
|
||||
}
|
||||
|
||||
return prelude;
|
||||
}
|
||||
|
||||
export const name = 'Rule';
|
||||
export const walkContext = 'rule';
|
||||
export const structure = {
|
||||
prelude: ['SelectorList', 'Raw'],
|
||||
block: ['Block']
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const startToken = this.tokenIndex;
|
||||
const startOffset = this.tokenStart;
|
||||
let prelude;
|
||||
let block;
|
||||
|
||||
if (this.parseRulePrelude) {
|
||||
prelude = this.parseWithFallback(consumePrelude, consumeRaw);
|
||||
} else {
|
||||
prelude = consumeRaw.call(this, startToken);
|
||||
}
|
||||
|
||||
block = this.Block(true);
|
||||
|
||||
return {
|
||||
type: 'Rule',
|
||||
loc: this.getLocation(startOffset, this.tokenStart),
|
||||
prelude,
|
||||
block
|
||||
};
|
||||
}
|
||||
export function generate(node) {
|
||||
this.node(node.prelude);
|
||||
this.node(node.block);
|
||||
}
|
||||
|
32
node_modules/css-tree/lib/syntax/node/Selector.js
generated
vendored
Normal file
32
node_modules/css-tree/lib/syntax/node/Selector.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
export const name = 'Selector';
|
||||
export const structure = {
|
||||
children: [[
|
||||
'TypeSelector',
|
||||
'IdSelector',
|
||||
'ClassSelector',
|
||||
'AttributeSelector',
|
||||
'PseudoClassSelector',
|
||||
'PseudoElementSelector',
|
||||
'Combinator',
|
||||
'WhiteSpace'
|
||||
]]
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const children = this.readSequence(this.scope.Selector);
|
||||
|
||||
// nothing were consumed
|
||||
if (this.getFirstListNode(children) === null) {
|
||||
this.error('Selector is expected');
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Selector',
|
||||
loc: this.getLocationFromList(children),
|
||||
children
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.children(node);
|
||||
}
|
35
node_modules/css-tree/lib/syntax/node/SelectorList.js
generated
vendored
Normal file
35
node_modules/css-tree/lib/syntax/node/SelectorList.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
import { Comma } from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'SelectorList';
|
||||
export const walkContext = 'selector';
|
||||
export const structure = {
|
||||
children: [[
|
||||
'Selector',
|
||||
'Raw'
|
||||
]]
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const children = this.createList();
|
||||
|
||||
while (!this.eof) {
|
||||
children.push(this.Selector());
|
||||
|
||||
if (this.tokenType === Comma) {
|
||||
this.next();
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'SelectorList',
|
||||
loc: this.getLocationFromList(children),
|
||||
children
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.children(node, () => this.token(Comma, ','));
|
||||
}
|
19
node_modules/css-tree/lib/syntax/node/String.js
generated
vendored
Normal file
19
node_modules/css-tree/lib/syntax/node/String.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
import { String as StringToken } from '../../tokenizer/index.js';
|
||||
import { decode, encode } from '../../utils/string.js';
|
||||
|
||||
export const name = 'String';
|
||||
export const structure = {
|
||||
value: String
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
return {
|
||||
type: 'String',
|
||||
loc: this.getLocation(this.tokenStart, this.tokenEnd),
|
||||
value: decode(this.consume(StringToken))
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(StringToken, encode(node.value));
|
||||
}
|
82
node_modules/css-tree/lib/syntax/node/StyleSheet.js
generated
vendored
Normal file
82
node_modules/css-tree/lib/syntax/node/StyleSheet.js
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
import {
|
||||
WhiteSpace,
|
||||
Comment,
|
||||
AtKeyword,
|
||||
CDO,
|
||||
CDC
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
const EXCLAMATIONMARK = 0x0021; // U+0021 EXCLAMATION MARK (!)
|
||||
|
||||
function consumeRaw(startToken) {
|
||||
return this.Raw(startToken, null, false);
|
||||
}
|
||||
|
||||
export const name = 'StyleSheet';
|
||||
export const walkContext = 'stylesheet';
|
||||
export const structure = {
|
||||
children: [[
|
||||
'Comment',
|
||||
'CDO',
|
||||
'CDC',
|
||||
'Atrule',
|
||||
'Rule',
|
||||
'Raw'
|
||||
]]
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
const children = this.createList();
|
||||
let child;
|
||||
|
||||
scan:
|
||||
while (!this.eof) {
|
||||
switch (this.tokenType) {
|
||||
case WhiteSpace:
|
||||
this.next();
|
||||
continue;
|
||||
|
||||
case Comment:
|
||||
// ignore comments except exclamation comments (i.e. /*! .. */) on top level
|
||||
if (this.charCodeAt(this.tokenStart + 2) !== EXCLAMATIONMARK) {
|
||||
this.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 AtKeyword:
|
||||
child = this.parseWithFallback(this.Atrule, consumeRaw);
|
||||
break;
|
||||
|
||||
// Anything else starts a qualified rule ...
|
||||
default:
|
||||
child = this.parseWithFallback(this.Rule, consumeRaw);
|
||||
}
|
||||
|
||||
children.push(child);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'StyleSheet',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
children
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.children(node);
|
||||
}
|
52
node_modules/css-tree/lib/syntax/node/TypeSelector.js
generated
vendored
Normal file
52
node_modules/css-tree/lib/syntax/node/TypeSelector.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
import { Ident } from '../../tokenizer/index.js';
|
||||
|
||||
const ASTERISK = 0x002A; // U+002A ASTERISK (*)
|
||||
const VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|)
|
||||
|
||||
function eatIdentifierOrAsterisk() {
|
||||
if (this.tokenType !== Ident &&
|
||||
this.isDelim(ASTERISK) === false) {
|
||||
this.error('Identifier or asterisk is expected');
|
||||
}
|
||||
|
||||
this.next();
|
||||
}
|
||||
|
||||
export const name = 'TypeSelector';
|
||||
export const structure = {
|
||||
name: String
|
||||
};
|
||||
|
||||
// ident
|
||||
// ident|ident
|
||||
// ident|*
|
||||
// *
|
||||
// *|ident
|
||||
// *|*
|
||||
// |ident
|
||||
// |*
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
|
||||
if (this.isDelim(VERTICALLINE)) {
|
||||
this.next();
|
||||
eatIdentifierOrAsterisk.call(this);
|
||||
} else {
|
||||
eatIdentifierOrAsterisk.call(this);
|
||||
|
||||
if (this.isDelim(VERTICALLINE)) {
|
||||
this.next();
|
||||
eatIdentifierOrAsterisk.call(this);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'TypeSelector',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
name: this.substrToCursor(start)
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.tokenize(node.name);
|
||||
}
|
156
node_modules/css-tree/lib/syntax/node/UnicodeRange.js
generated
vendored
Normal file
156
node_modules/css-tree/lib/syntax/node/UnicodeRange.js
generated
vendored
Normal file
@ -0,0 +1,156 @@
|
||||
import {
|
||||
isHexDigit,
|
||||
Ident,
|
||||
Number,
|
||||
Dimension
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
const PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
|
||||
const HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)
|
||||
const QUESTIONMARK = 0x003F; // U+003F QUESTION MARK (?)
|
||||
|
||||
function eatHexSequence(offset, allowDash) {
|
||||
let len = 0;
|
||||
|
||||
for (let pos = this.tokenStart + offset; pos < this.tokenEnd; pos++) {
|
||||
const code = this.charCodeAt(pos);
|
||||
|
||||
if (code === HYPHENMINUS && allowDash && len !== 0) {
|
||||
eatHexSequence.call(this, offset + len + 1, false);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!isHexDigit(code)) {
|
||||
this.error(
|
||||
allowDash && len !== 0
|
||||
? 'Hyphen minus' + (len < 6 ? ' or hex digit' : '') + ' is expected'
|
||||
: (len < 6 ? 'Hex digit is expected' : 'Unexpected input'),
|
||||
pos
|
||||
);
|
||||
}
|
||||
|
||||
if (++len > 6) {
|
||||
this.error('Too many hex digits', pos);
|
||||
};
|
||||
}
|
||||
|
||||
this.next();
|
||||
return len;
|
||||
}
|
||||
|
||||
function eatQuestionMarkSequence(max) {
|
||||
let count = 0;
|
||||
|
||||
while (this.isDelim(QUESTIONMARK)) {
|
||||
if (++count > max) {
|
||||
this.error('Too many question marks');
|
||||
}
|
||||
|
||||
this.next();
|
||||
}
|
||||
}
|
||||
|
||||
function startsWith(code) {
|
||||
if (this.charCodeAt(this.tokenStart) !== code) {
|
||||
this.error((code === PLUSSIGN ? 'Plus sign' : 'Hyphen minus') + ' is expected');
|
||||
}
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-syntax/#urange
|
||||
// Informally, the <urange> production has three forms:
|
||||
// U+0001
|
||||
// Defines a range consisting of a single code point, in this case the code point "1".
|
||||
// U+0001-00ff
|
||||
// Defines a range of codepoints between the first and the second value, in this case
|
||||
// the range between "1" and "ff" (255 in decimal) inclusive.
|
||||
// U+00??
|
||||
// Defines a range of codepoints where the "?" characters range over all hex digits,
|
||||
// in this case defining the same as the value U+0000-00ff.
|
||||
// In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat "?" as a hexadecimal digit).
|
||||
//
|
||||
// <urange> =
|
||||
// u '+' <ident-token> '?'* |
|
||||
// u <dimension-token> '?'* |
|
||||
// u <number-token> '?'* |
|
||||
// u <number-token> <dimension-token> |
|
||||
// u <number-token> <number-token> |
|
||||
// u '+' '?'+
|
||||
function scanUnicodeRange() {
|
||||
let hexLength = 0;
|
||||
|
||||
switch (this.tokenType) {
|
||||
case Number:
|
||||
// u <number-token> '?'*
|
||||
// u <number-token> <dimension-token>
|
||||
// u <number-token> <number-token>
|
||||
hexLength = eatHexSequence.call(this, 1, true);
|
||||
|
||||
if (this.isDelim(QUESTIONMARK)) {
|
||||
eatQuestionMarkSequence.call(this, 6 - hexLength);
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.tokenType === Dimension ||
|
||||
this.tokenType === Number) {
|
||||
startsWith.call(this, HYPHENMINUS);
|
||||
eatHexSequence.call(this, 1, false);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Dimension:
|
||||
// u <dimension-token> '?'*
|
||||
hexLength = eatHexSequence.call(this, 1, true);
|
||||
|
||||
if (hexLength > 0) {
|
||||
eatQuestionMarkSequence.call(this, 6 - hexLength);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
// u '+' <ident-token> '?'*
|
||||
// u '+' '?'+
|
||||
this.eatDelim(PLUSSIGN);
|
||||
|
||||
if (this.tokenType === Ident) {
|
||||
hexLength = eatHexSequence.call(this, 0, true);
|
||||
if (hexLength > 0) {
|
||||
eatQuestionMarkSequence.call(this, 6 - hexLength);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.isDelim(QUESTIONMARK)) {
|
||||
this.next();
|
||||
eatQuestionMarkSequence.call(this, 5);
|
||||
break;
|
||||
}
|
||||
|
||||
this.error('Hex digit or question mark is expected');
|
||||
}
|
||||
}
|
||||
|
||||
export const name = 'UnicodeRange';
|
||||
export const structure = {
|
||||
value: String
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
|
||||
// U or u
|
||||
this.eatIdent('u');
|
||||
scanUnicodeRange.call(this);
|
||||
|
||||
return {
|
||||
type: 'UnicodeRange',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
value: this.substrToCursor(start)
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.tokenize(node.value);
|
||||
}
|
52
node_modules/css-tree/lib/syntax/node/Url.js
generated
vendored
Normal file
52
node_modules/css-tree/lib/syntax/node/Url.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
import * as url from '../../utils/url.js';
|
||||
import * as string from '../../utils/string.js';
|
||||
import {
|
||||
Function as FunctionToken,
|
||||
String as StringToken,
|
||||
Url,
|
||||
RightParenthesis
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
export const name = 'Url';
|
||||
export const structure = {
|
||||
value: String
|
||||
};
|
||||
|
||||
// <url-token> | <function-token> <string> )
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
let value;
|
||||
|
||||
switch (this.tokenType) {
|
||||
case Url:
|
||||
value = url.decode(this.consume(Url));
|
||||
break;
|
||||
|
||||
case FunctionToken:
|
||||
if (!this.cmpStr(this.tokenStart, this.tokenEnd, 'url(')) {
|
||||
this.error('Function name must be `url`');
|
||||
}
|
||||
|
||||
this.eat(FunctionToken);
|
||||
this.skipSC();
|
||||
value = string.decode(this.consume(StringToken));
|
||||
this.skipSC();
|
||||
if (!this.eof) {
|
||||
this.eat(RightParenthesis);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
this.error('Url or Function is expected');
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Url',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
value
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(Url, url.encode(node.value));
|
||||
}
|
19
node_modules/css-tree/lib/syntax/node/Value.js
generated
vendored
Normal file
19
node_modules/css-tree/lib/syntax/node/Value.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
export const name = 'Value';
|
||||
export const structure = {
|
||||
children: [[]]
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
const start = this.tokenStart;
|
||||
const children = this.readSequence(this.scope.Value);
|
||||
|
||||
return {
|
||||
type: 'Value',
|
||||
loc: this.getLocation(start, this.tokenStart),
|
||||
children
|
||||
};
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.children(node);
|
||||
}
|
27
node_modules/css-tree/lib/syntax/node/WhiteSpace.js
generated
vendored
Normal file
27
node_modules/css-tree/lib/syntax/node/WhiteSpace.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
import { WhiteSpace } from '../../tokenizer/index.js';
|
||||
|
||||
const SPACE = Object.freeze({
|
||||
type: 'WhiteSpace',
|
||||
loc: null,
|
||||
value: ' '
|
||||
});
|
||||
|
||||
export const name = 'WhiteSpace';
|
||||
export const structure = {
|
||||
value: String
|
||||
};
|
||||
|
||||
export function parse() {
|
||||
this.eat(WhiteSpace);
|
||||
return SPACE;
|
||||
|
||||
// return {
|
||||
// type: 'WhiteSpace',
|
||||
// loc: this.getLocation(this.tokenStart, this.tokenEnd),
|
||||
// value: this.consume(WHITESPACE)
|
||||
// };
|
||||
}
|
||||
|
||||
export function generate(node) {
|
||||
this.token(WhiteSpace, node.value);
|
||||
}
|
41
node_modules/css-tree/lib/syntax/node/index-generate.js
generated
vendored
Normal file
41
node_modules/css-tree/lib/syntax/node/index-generate.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
export { generate as AnPlusB } from './AnPlusB.js';
|
||||
export { generate as Atrule } from './Atrule.js';
|
||||
export { generate as AtrulePrelude } from './AtrulePrelude.js';
|
||||
export { generate as AttributeSelector } from './AttributeSelector.js';
|
||||
export { generate as Block } from './Block.js';
|
||||
export { generate as Brackets } from './Brackets.js';
|
||||
export { generate as CDC } from './CDC.js';
|
||||
export { generate as CDO } from './CDO.js';
|
||||
export { generate as ClassSelector } from './ClassSelector.js';
|
||||
export { generate as Combinator } from './Combinator.js';
|
||||
export { generate as Comment } from './Comment.js';
|
||||
export { generate as Declaration } from './Declaration.js';
|
||||
export { generate as DeclarationList } from './DeclarationList.js';
|
||||
export { generate as Dimension } from './Dimension.js';
|
||||
export { generate as Function } from './Function.js';
|
||||
export { generate as Hash } from './Hash.js';
|
||||
export { generate as Identifier } from './Identifier.js';
|
||||
export { generate as IdSelector } from './IdSelector.js';
|
||||
export { generate as MediaFeature } from './MediaFeature.js';
|
||||
export { generate as MediaQuery } from './MediaQuery.js';
|
||||
export { generate as MediaQueryList } from './MediaQueryList.js';
|
||||
export { generate as NestingSelector } from './NestingSelector.js';
|
||||
export { generate as Nth } from './Nth.js';
|
||||
export { generate as Number } from './Number.js';
|
||||
export { generate as Operator } from './Operator.js';
|
||||
export { generate as Parentheses } from './Parentheses.js';
|
||||
export { generate as Percentage } from './Percentage.js';
|
||||
export { generate as PseudoClassSelector } from './PseudoClassSelector.js';
|
||||
export { generate as PseudoElementSelector } from './PseudoElementSelector.js';
|
||||
export { generate as Ratio } from './Ratio.js';
|
||||
export { generate as Raw } from './Raw.js';
|
||||
export { generate as Rule } from './Rule.js';
|
||||
export { generate as Selector } from './Selector.js';
|
||||
export { generate as SelectorList } from './SelectorList.js';
|
||||
export { generate as String } from './String.js';
|
||||
export { generate as StyleSheet } from './StyleSheet.js';
|
||||
export { generate as TypeSelector } from './TypeSelector.js';
|
||||
export { generate as UnicodeRange } from './UnicodeRange.js';
|
||||
export { generate as Url } from './Url.js';
|
||||
export { generate as Value } from './Value.js';
|
||||
export { generate as WhiteSpace } from './WhiteSpace.js';
|
16
node_modules/css-tree/lib/syntax/node/index-parse-selector.js
generated
vendored
Normal file
16
node_modules/css-tree/lib/syntax/node/index-parse-selector.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
export { parse as AnPlusB } from './AnPlusB.js';
|
||||
export { parse as AttributeSelector } from './AttributeSelector.js';
|
||||
export { parse as ClassSelector } from './ClassSelector.js';
|
||||
export { parse as Combinator } from './Combinator.js';
|
||||
export { parse as Identifier } from './Identifier.js';
|
||||
export { parse as IdSelector } from './IdSelector.js';
|
||||
export { parse as NestingSelector } from './NestingSelector.js';
|
||||
export { parse as Nth } from './Nth.js';
|
||||
export { parse as Percentage } from './Percentage.js';
|
||||
export { parse as PseudoClassSelector } from './PseudoClassSelector.js';
|
||||
export { parse as PseudoElementSelector } from './PseudoElementSelector.js';
|
||||
export { parse as Raw } from './Raw.js';
|
||||
export { parse as Selector } from './Selector.js';
|
||||
export { parse as SelectorList } from './SelectorList.js';
|
||||
export { parse as String } from './String.js';
|
||||
export { parse as TypeSelector } from './TypeSelector.js';
|
41
node_modules/css-tree/lib/syntax/node/index-parse.js
generated
vendored
Normal file
41
node_modules/css-tree/lib/syntax/node/index-parse.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
export { parse as AnPlusB } from './AnPlusB.js';
|
||||
export { parse as Atrule } from './Atrule.js';
|
||||
export { parse as AtrulePrelude } from './AtrulePrelude.js';
|
||||
export { parse as AttributeSelector } from './AttributeSelector.js';
|
||||
export { parse as Block } from './Block.js';
|
||||
export { parse as Brackets } from './Brackets.js';
|
||||
export { parse as CDC } from './CDC.js';
|
||||
export { parse as CDO } from './CDO.js';
|
||||
export { parse as ClassSelector } from './ClassSelector.js';
|
||||
export { parse as Combinator } from './Combinator.js';
|
||||
export { parse as Comment } from './Comment.js';
|
||||
export { parse as Declaration } from './Declaration.js';
|
||||
export { parse as DeclarationList } from './DeclarationList.js';
|
||||
export { parse as Dimension } from './Dimension.js';
|
||||
export { parse as Function } from './Function.js';
|
||||
export { parse as Hash } from './Hash.js';
|
||||
export { parse as Identifier } from './Identifier.js';
|
||||
export { parse as IdSelector } from './IdSelector.js';
|
||||
export { parse as MediaFeature } from './MediaFeature.js';
|
||||
export { parse as MediaQuery } from './MediaQuery.js';
|
||||
export { parse as MediaQueryList } from './MediaQueryList.js';
|
||||
export { parse as NestingSelector } from './NestingSelector.js';
|
||||
export { parse as Nth } from './Nth.js';
|
||||
export { parse as Number } from './Number.js';
|
||||
export { parse as Operator } from './Operator.js';
|
||||
export { parse as Parentheses } from './Parentheses.js';
|
||||
export { parse as Percentage } from './Percentage.js';
|
||||
export { parse as PseudoClassSelector } from './PseudoClassSelector.js';
|
||||
export { parse as PseudoElementSelector } from './PseudoElementSelector.js';
|
||||
export { parse as Ratio } from './Ratio.js';
|
||||
export { parse as Raw } from './Raw.js';
|
||||
export { parse as Rule } from './Rule.js';
|
||||
export { parse as Selector } from './Selector.js';
|
||||
export { parse as SelectorList } from './SelectorList.js';
|
||||
export { parse as String } from './String.js';
|
||||
export { parse as StyleSheet } from './StyleSheet.js';
|
||||
export { parse as TypeSelector } from './TypeSelector.js';
|
||||
export { parse as UnicodeRange } from './UnicodeRange.js';
|
||||
export { parse as Url } from './Url.js';
|
||||
export { parse as Value } from './Value.js';
|
||||
export { parse as WhiteSpace } from './WhiteSpace.js';
|
41
node_modules/css-tree/lib/syntax/node/index.js
generated
vendored
Normal file
41
node_modules/css-tree/lib/syntax/node/index.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
export * as AnPlusB from './AnPlusB.js';
|
||||
export * as Atrule from './Atrule.js';
|
||||
export * as AtrulePrelude from './AtrulePrelude.js';
|
||||
export * as AttributeSelector from './AttributeSelector.js';
|
||||
export * as Block from './Block.js';
|
||||
export * as Brackets from './Brackets.js';
|
||||
export * as CDC from './CDC.js';
|
||||
export * as CDO from './CDO.js';
|
||||
export * as ClassSelector from './ClassSelector.js';
|
||||
export * as Combinator from './Combinator.js';
|
||||
export * as Comment from './Comment.js';
|
||||
export * as Declaration from './Declaration.js';
|
||||
export * as DeclarationList from './DeclarationList.js';
|
||||
export * as Dimension from './Dimension.js';
|
||||
export * as Function from './Function.js';
|
||||
export * as Hash from './Hash.js';
|
||||
export * as Identifier from './Identifier.js';
|
||||
export * as IdSelector from './IdSelector.js';
|
||||
export * as MediaFeature from './MediaFeature.js';
|
||||
export * as MediaQuery from './MediaQuery.js';
|
||||
export * as MediaQueryList from './MediaQueryList.js';
|
||||
export * as NestingSelector from './NestingSelector.js';
|
||||
export * as Nth from './Nth.js';
|
||||
export * as Number from './Number.js';
|
||||
export * as Operator from './Operator.js';
|
||||
export * as Parentheses from './Parentheses.js';
|
||||
export * as Percentage from './Percentage.js';
|
||||
export * as PseudoClassSelector from './PseudoClassSelector.js';
|
||||
export * as PseudoElementSelector from './PseudoElementSelector.js';
|
||||
export * as Ratio from './Ratio.js';
|
||||
export * as Raw from './Raw.js';
|
||||
export * as Rule from './Rule.js';
|
||||
export * as Selector from './Selector.js';
|
||||
export * as SelectorList from './SelectorList.js';
|
||||
export * as String from './String.js';
|
||||
export * as StyleSheet from './StyleSheet.js';
|
||||
export * as TypeSelector from './TypeSelector.js';
|
||||
export * as UnicodeRange from './UnicodeRange.js';
|
||||
export * as Url from './Url.js';
|
||||
export * as Value from './Value.js';
|
||||
export * as WhiteSpace from './WhiteSpace.js';
|
50
node_modules/css-tree/lib/syntax/pseudo/index.js
generated
vendored
Normal file
50
node_modules/css-tree/lib/syntax/pseudo/index.js
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
const selectorList = {
|
||||
parse() {
|
||||
return this.createSingleNodeList(
|
||||
this.SelectorList()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const selector = {
|
||||
parse() {
|
||||
return this.createSingleNodeList(
|
||||
this.Selector()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const identList = {
|
||||
parse() {
|
||||
return this.createSingleNodeList(
|
||||
this.Identifier()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const nth = {
|
||||
parse() {
|
||||
return this.createSingleNodeList(
|
||||
this.Nth()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
'dir': identList,
|
||||
'has': selectorList,
|
||||
'lang': identList,
|
||||
'matches': selectorList,
|
||||
'is': selectorList,
|
||||
'-moz-any': selectorList,
|
||||
'-webkit-any': selectorList,
|
||||
'where': selectorList,
|
||||
'not': selectorList,
|
||||
'nth-child': nth,
|
||||
'nth-last-child': nth,
|
||||
'nth-last-of-type': nth,
|
||||
'nth-of-type': nth,
|
||||
'slotted': selector,
|
||||
'host': selector,
|
||||
'host-context': selector
|
||||
};
|
5
node_modules/css-tree/lib/syntax/scope/atrulePrelude.js
generated
vendored
Normal file
5
node_modules/css-tree/lib/syntax/scope/atrulePrelude.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import getNode from './default.js';
|
||||
|
||||
export default {
|
||||
getNode
|
||||
};
|
85
node_modules/css-tree/lib/syntax/scope/default.js
generated
vendored
Normal file
85
node_modules/css-tree/lib/syntax/scope/default.js
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
import {
|
||||
Ident,
|
||||
String as StringToken,
|
||||
Number as NumberToken,
|
||||
Function as FunctionToken,
|
||||
Url,
|
||||
Hash,
|
||||
Dimension,
|
||||
Percentage,
|
||||
LeftParenthesis,
|
||||
LeftSquareBracket,
|
||||
Comma,
|
||||
Delim
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
const NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)
|
||||
const ASTERISK = 0x002A; // U+002A ASTERISK (*)
|
||||
const PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
|
||||
const HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)
|
||||
const SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
|
||||
const U = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
|
||||
|
||||
export default function defaultRecognizer(context) {
|
||||
switch (this.tokenType) {
|
||||
case Hash:
|
||||
return this.Hash();
|
||||
|
||||
case Comma:
|
||||
return this.Operator();
|
||||
|
||||
case LeftParenthesis:
|
||||
return this.Parentheses(this.readSequence, context.recognizer);
|
||||
|
||||
case LeftSquareBracket:
|
||||
return this.Brackets(this.readSequence, context.recognizer);
|
||||
|
||||
case StringToken:
|
||||
return this.String();
|
||||
|
||||
case Dimension:
|
||||
return this.Dimension();
|
||||
|
||||
case Percentage:
|
||||
return this.Percentage();
|
||||
|
||||
case NumberToken:
|
||||
return this.Number();
|
||||
|
||||
case FunctionToken:
|
||||
return this.cmpStr(this.tokenStart, this.tokenEnd, 'url(')
|
||||
? this.Url()
|
||||
: this.Function(this.readSequence, context.recognizer);
|
||||
|
||||
case Url:
|
||||
return this.Url();
|
||||
|
||||
case Ident:
|
||||
// check for unicode range, it should start with u+ or U+
|
||||
if (this.cmpChar(this.tokenStart, U) &&
|
||||
this.cmpChar(this.tokenStart + 1, PLUSSIGN)) {
|
||||
return this.UnicodeRange();
|
||||
} else {
|
||||
return this.Identifier();
|
||||
}
|
||||
|
||||
case Delim: {
|
||||
const code = this.charCodeAt(this.tokenStart);
|
||||
|
||||
if (code === SOLIDUS ||
|
||||
code === ASTERISK ||
|
||||
code === PLUSSIGN ||
|
||||
code === HYPHENMINUS) {
|
||||
return this.Operator(); // TODO: replace with Delim
|
||||
}
|
||||
|
||||
// TODO: produce a node with Delim node type
|
||||
|
||||
if (code === NUMBERSIGN) {
|
||||
this.error('Hex or identifier is expected', this.tokenStart + 1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
3
node_modules/css-tree/lib/syntax/scope/index.js
generated
vendored
Normal file
3
node_modules/css-tree/lib/syntax/scope/index.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export { default as AtrulePrelude } from './atrulePrelude.js';
|
||||
export { default as Selector } from './selector.js';
|
||||
export { default as Value } from './value.js';
|
94
node_modules/css-tree/lib/syntax/scope/selector.js
generated
vendored
Normal file
94
node_modules/css-tree/lib/syntax/scope/selector.js
generated
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
import {
|
||||
Delim,
|
||||
Ident,
|
||||
Dimension,
|
||||
Percentage,
|
||||
Number as NumberToken,
|
||||
Hash,
|
||||
Colon,
|
||||
LeftSquareBracket
|
||||
} from '../../tokenizer/index.js';
|
||||
|
||||
const NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)
|
||||
const AMPERSAND = 0x0026; // U+0026 AMPERSAND (&)
|
||||
const ASTERISK = 0x002A; // U+002A ASTERISK (*)
|
||||
const PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
|
||||
const SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
|
||||
const FULLSTOP = 0x002E; // U+002E FULL STOP (.)
|
||||
const GREATERTHANSIGN = 0x003E; // U+003E GREATER-THAN SIGN (>)
|
||||
const VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|)
|
||||
const TILDE = 0x007E; // U+007E TILDE (~)
|
||||
|
||||
function onWhiteSpace(next, children) {
|
||||
if (children.last !== null && children.last.type !== 'Combinator' &&
|
||||
next !== null && next.type !== 'Combinator') {
|
||||
children.push({ // FIXME: this.Combinator() should be used instead
|
||||
type: 'Combinator',
|
||||
loc: null,
|
||||
name: ' '
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getNode() {
|
||||
switch (this.tokenType) {
|
||||
case LeftSquareBracket:
|
||||
return this.AttributeSelector();
|
||||
|
||||
case Hash:
|
||||
return this.IdSelector();
|
||||
|
||||
case Colon:
|
||||
if (this.lookupType(1) === Colon) {
|
||||
return this.PseudoElementSelector();
|
||||
} else {
|
||||
return this.PseudoClassSelector();
|
||||
}
|
||||
|
||||
case Ident:
|
||||
return this.TypeSelector();
|
||||
|
||||
case NumberToken:
|
||||
case Percentage:
|
||||
return this.Percentage();
|
||||
|
||||
case Dimension:
|
||||
// throws when .123ident
|
||||
if (this.charCodeAt(this.tokenStart) === FULLSTOP) {
|
||||
this.error('Identifier is expected', this.tokenStart + 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case Delim: {
|
||||
const code = this.charCodeAt(this.tokenStart);
|
||||
|
||||
switch (code) {
|
||||
case PLUSSIGN:
|
||||
case GREATERTHANSIGN:
|
||||
case TILDE:
|
||||
case SOLIDUS: // /deep/
|
||||
return this.Combinator();
|
||||
|
||||
case FULLSTOP:
|
||||
return this.ClassSelector();
|
||||
|
||||
case ASTERISK:
|
||||
case VERTICALLINE:
|
||||
return this.TypeSelector();
|
||||
|
||||
case NUMBERSIGN:
|
||||
return this.IdSelector();
|
||||
|
||||
case AMPERSAND:
|
||||
return this.NestingSelector();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
onWhiteSpace,
|
||||
getNode
|
||||
};
|
25
node_modules/css-tree/lib/syntax/scope/value.js
generated
vendored
Normal file
25
node_modules/css-tree/lib/syntax/scope/value.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
import getNode from './default.js';
|
||||
import expressionFn from '../function/expression.js';
|
||||
import varFn from '../function/var.js';
|
||||
|
||||
function isPlusMinusOperator(node) {
|
||||
return (
|
||||
node !== null &&
|
||||
node.type === 'Operator' &&
|
||||
(node.value[node.value.length - 1] === '-' || node.value[node.value.length - 1] === '+')
|
||||
);
|
||||
}
|
||||
|
||||
export default {
|
||||
getNode,
|
||||
onWhiteSpace(next, children) {
|
||||
if (isPlusMinusOperator(next)) {
|
||||
next.value = ' ' + next.value;
|
||||
}
|
||||
if (isPlusMinusOperator(children.last)) {
|
||||
children.last.value += ' ';
|
||||
}
|
||||
},
|
||||
'expression': expressionFn,
|
||||
'var': varFn
|
||||
};
|
Reference in New Issue
Block a user