Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var tokenize = require('css-tree').tokenize;
var IDENT = tokenize.TYPE.Ident;
var DOLLARSIGN = 0x0024; // U+0024 DOLLAR SIGN ($)
module.exports = {
name: 'SassVariable',
structure: {
name: 'Identifier'
},
parse: function SassVariable() {
var start = this.scanner.tokenStart;
if (!this.scanner.isDelim(DOLLARSIGN)) {
this.error();
}
this.scanner.next();
var tokenize = require('css-tree').tokenize;
var TYPE = tokenize.TYPE;
var NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)
var DOLLARSIGN = 0x0024; // U+0024 DOLLAR SIGN ($)
var PERCENTAGESIGN = 0x0025; // U+0025 PERCENTAGE SIGN (%)
var COMMERCIALAT = 0x0040; // U+0040 COMMERCIAL AT (@)
var TILDE = 0x007E; // U+007E TILDE (~)
// custom
var PreprocessorExtensionError = function() {
this.type = 'PreprocessorExtensionError';
};
module.exports = function extendParser(syntaxConfig) {
// new node types
syntaxConfig.node.LessVariableReference = require('./less/LessVariableReference');
syntaxConfig.node.LessVariable = require('./less/LessVariable');
var tokenize = require('css-tree').tokenize;
var TYPE = tokenize.TYPE;
var STRING = TYPE.String;
var TILDE = 0x007E; // U+007E TILDE (~)
module.exports = {
name: 'LessEscaping',
structure: {
value: 'String'
},
parse: function LessEscaping() {
var start = this.scanner.tokenStart;
if (!this.scanner.isDelim(TILDE)) {
this.error('Tilde is expected');
}
var List = require('css-tree').List;
var tokenize = require('css-tree').tokenize;
var TYPE = tokenize.TYPE;
var LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;
var RIGHTCURLYBRACKET = TYPE.RightCurlyBracket;
var NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)
module.exports = {
name: 'SassInterpolation',
structure: {
children: [[]]
},
parse: function SassInterpolation(recognizer, readSequence) {
var start = this.scanner.tokenStart;
var children = new List();
if (!this.scanner.isDelim(NUMBERSIGN)) {
this.error();
var tokenize = require('css-tree').tokenize;
var TYPE = tokenize.TYPE;
var ATRULE = TYPE.Atrule;
var COMMERCIALAT = 0x0040; // U+0040 COMMERCIAL AT (@)
module.exports = {
name: 'LessVariableReference',
structure: {
name: 'Identifier'
},
parse: function LessVariableReference() {
var start = this.scanner.tokenStart;
if (!this.scanner.isDelim(COMMERCIALAT)) {
this.error()
}
var TYPE = require('css-tree').tokenize.TYPE;
var ATKEYWORD = TYPE.AtKeyword;
module.exports = {
name: 'LessVariable',
structure: {
name: 'Identifier'
},
parse: function LessVariable() {
var start = this.scanner.tokenStart;
this.eat(ATKEYWORD);
return {
type: 'LessVariable',
loc: this.getLocation(start, this.scanner.tokenEnd),
name: this.scanner.substrToCursor(start + 1)