How to use the css-tree.tokenize.TYPE function in css-tree

To help you get started, we’ve selected a few css-tree examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github csstree / stylelint-validator / syntax-extension / less / LessVariableReference.js View on Github external
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()
        }

        this.scanner.next();
github csstree / stylelint-validator / syntax-extension / less / LessEscaping.js View on Github external
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');
        }

        this.scanner.next();
github csstree / stylelint-validator / syntax-extension / sass / SassVariable.js View on Github external
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();
github csstree / stylelint-validator / syntax-extension / sass / SassInterpolation.js View on Github external
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();
        }
github csstree / stylelint-validator / syntax-extension / index.js View on Github external
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');
    syntaxConfig.node.LessEscaping = require('./less/LessEscaping');