beginnings of a build script

This commit is contained in:
Jeremy Ashkenas
2010-02-16 01:04:48 -05:00
parent fa63288f52
commit 2f389f1d51
6 changed files with 47 additions and 20 deletions

View File

@@ -15,6 +15,7 @@
option_parser = null;
// The CommandLine handles all of the functionality of the `coffee` utility.
exports.run = function run() {
var flags, separator;
parse_options();
if (options.interactive) {
return require('./repl');
@@ -25,6 +26,13 @@
if (!(sources.length)) {
usage();
}
separator = sources.indexOf('--');
flags = [];
if (separator >= 0) {
flags = sources.slice((separator + 1), sources.length);
sources = sources.slice(0, separator);
}
process.ARGV = flags;
compile_scripts();
return this;
};

View File

@@ -1,5 +1,5 @@
(function(){
var Parser, _1, _2, _3, _4, _5, _6, bnf, fs, grammar, js, name, non_terminal, o, operators, option, parser, parser_path, part, tokens, unwrap;
var Parser, _1, _2, _3, _4, _5, _6, bnf, grammar, name, non_terminal, o, operators, option, part, tokens, unwrap;
var __hasProp = Object.prototype.hasOwnProperty;
Parser = require('jison').Parser;
// DSL ===================================================================
@@ -544,7 +544,7 @@
}).call(this);
}
tokens = tokens.join(" ");
parser = new Parser({
exports.parser = new Parser({
tokens: tokens,
bnf: bnf,
operators: operators.reverse(),
@@ -552,12 +552,4 @@
}, {
debug: false
});
js = parser.generate();
// Save the parser to a file.
// puts parser.generate()
fs = require('fs');
parser_path = 'lib/coffee_script/parser.js';
fs.open(parser_path, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, parseInt('0755', 8)).addCallback(function(fd) {
return fs.write(fd, js);
});
})();