Sha256: 07fb4ef5f7ebc7b3c548d3825424b5a16bdcc268b5b169f388b2a4bd610cd711

Contents?: true

Size: 892 Bytes

Versions: 129

Compression:

Stored size: 892 Bytes

Contents

/*!
 * Stylus - Token
 * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
 * MIT Licensed
 */

/**
 * Module dependencies.
 */

var inspect = require('util').inspect;

/**
 * Initialize a new `Token` with the given `type` and `val`.
 *
 * @param {String} type
 * @param {Mixed} val
 * @api private
 */

var Token = exports = module.exports = function Token(type, val) {
  this.type = type;
  this.val = val;
};

/**
 * Custom inspect.
 *
 * @return {String}
 * @api public
 */

Token.prototype.inspect = function(){
  var val = ' ' + inspect(this.val);
  return '[Token:' + this.lineno + ' '
    + '\x1b[32m' + this.type + '\x1b[0m'
    + '\x1b[33m' + (this.val ? val : '') + '\x1b[0m'
    + ']';
};

/**
 * Return type or val.
 *
 * @return {String}
 * @api public
 */

Token.prototype.toString = function(){
  return (undefined === this.val
    ? this.type
    : this.val).toString();
};

Version data entries

129 entries across 82 versions & 2 rubygems

Version Path
ela-4.1.6 node_modules/codo/node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.6 node_modules/poised/node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.6 node_modules/codo/node_modules/stylus/lib/token.js
ela-4.1.6 node_modules/poised/node_modules/stylus/lib/token.js
ela-4.1.5 node_modules/codo/node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.5 node_modules/codo/node_modules/stylus/lib/token.js
ela-4.1.5 node_modules/poised/node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.5 node_modules/poised/node_modules/stylus/lib/token.js
ela-4.1.4 node_modules/codo/node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.4 node_modules/poised/node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.4 node_modules/codo/node_modules/stylus/lib/token.js
ela-4.1.4 node_modules/poised/node_modules/stylus/lib/token.js
ela-4.1.3 node_modules/codo/node_modules/stylus/lib/token.js
ela-4.1.3 node_modules/poised/node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.3 node_modules/codo/node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.3 node_modules/poised/node_modules/stylus/lib/token.js
ela-4.1.2 node_modules/codo/node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.2 node_modules/codo/node_modules/stylus/lib/token.js
ela-4.1.2 node_modules/poised/node_modules/stylus/lib/token.js
ela-4.1.2 node_modules/poised/node_modules/nib/node_modules/stylus/lib/token.js