Sha256: a141d9d07111209273f50d5c0eed17207bf35911f888411f0210ca5185653536

Contents?: true

Size: 913 Bytes

Versions: 10

Compression:

Stored size: 913 Bytes

Contents

var _ref = require('./lexer'), Lexer = _ref.Lexer, RESERVED = _ref.RESERVED;
var parser = require('./parser').parser, lexer;

lexer = new Lexer();

parser.lexer = {
  lex: function() {
    var tag, _ref;
    _ref = this.tokens[this.pos++] || [''];
    tag  = _ref[0];
    this.yytext = _ref[1];
    this.yylineno = _ref[2];
    return tag;
  },
  setInput: function(tokens) {
    this.tokens = tokens;
    this.pos = 0;
    return 0;
  },
  upcomingInput: function() {
    return "";
  }
};

parser.yy = require('./nodes');


exports.compile = function(code, options) {
  if (options === null) {
    options = {};
  }
  try {
    return parser.parse(lexer.tokenize(code)).compile(options);
  } catch (err) {
    if (options.fileName) {
      err.message = "In " + options.fileName + ", " + err.message;
    }
    throw err;
  }
};

exports.compileFormat = function(code) {
  return exports.compile(code, {});
};

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
spade-packager-0.1.0.1 packages/coffee-script/lib/spade-format.js
spade-packager-0.1.0 packages/coffee-script/lib/spade-format.js
spade-0.0.8.1 packages/coffee-script/lib/spade-format.js
spade-0.0.7 packages/coffee-script/lib/spade-format.js
spade-0.0.6 packages/coffee-script/lib/spade-format.js
spade-0.0.5 packages/coffee-script/lib/spade-format.js
spade-0.0.4 packages/coffee-script/lib/spade-format.js
spade-0.0.3 packages/coffee-script/lib/spade-format.js
spade-0.0.2 packages/coffee-script/lib/spade-format.js
spade-0.0.1 packages/coffee-script/lib/spade-format.js