2013-06-10 22:55:27 +00:00
|
|
|
// Generated by CoffeeScript 1.6.1
|
|
|
|
(function() {
|
2013-06-11 16:05:32 +00:00
|
|
|
var fromFile, fs, parse, render, tumble;
|
2013-06-10 22:55:27 +00:00
|
|
|
|
|
|
|
tumble = require('./lexer').parse;
|
|
|
|
|
|
|
|
parse = require('./parser');
|
|
|
|
|
|
|
|
fs = require('fs');
|
|
|
|
|
|
|
|
render = function(str, options, callback) {
|
|
|
|
try {
|
|
|
|
return callback(null, parse(tumble(str), options));
|
|
|
|
} catch (err) {
|
|
|
|
return callback(err, null);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
fromFile = function(path, options, callback) {
|
|
|
|
return fs.readFile(path, 'utf8', function(err, str) {
|
2013-06-11 16:05:32 +00:00
|
|
|
if (callback) {
|
|
|
|
if (err) {
|
|
|
|
return callback(err);
|
|
|
|
}
|
|
|
|
return callback(null, render(str, options, callback));
|
|
|
|
}
|
2013-06-10 22:55:27 +00:00
|
|
|
if (err) {
|
2013-06-11 16:05:32 +00:00
|
|
|
throw err;
|
2013-06-10 22:55:27 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
fromFile.render = render;
|
|
|
|
|
2013-06-11 16:05:32 +00:00
|
|
|
module.exports = fromFile;
|
2013-06-10 22:55:27 +00:00
|
|
|
|
|
|
|
}).call(this);
|