mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
got a build script for rebuilding the compiler, too
This commit is contained in:
12
build.coffee
12
build.coffee
@@ -4,10 +4,22 @@
|
||||
|
||||
fs: require 'fs'
|
||||
|
||||
# Run a CoffeeScript through our node/coffee interpreter.
|
||||
run: (args) ->
|
||||
proc: process.createChildProcess 'bin/node_coffee', args
|
||||
proc.addListener 'error', (err) -> if err then puts err
|
||||
|
||||
# Print the usage message for the build scripts.
|
||||
usage: ->
|
||||
puts "build.coffee usage goes here..."
|
||||
|
||||
# Build the CoffeeScript source code -- if you're editing the parser, run
|
||||
# this before you run "build parser".
|
||||
build_compiler: ->
|
||||
fs.readdir('src').addCallback (files) ->
|
||||
files: 'src/' + file for file in files when file.match(/\.coffee$/)
|
||||
run ['-o', 'lib/coffee_script'].concat(files)
|
||||
|
||||
# Rebuild the Jison parser from the compiled lib/grammar.js file.
|
||||
build_parser: ->
|
||||
parser: require('grammar').parser
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
} else {
|
||||
js = coffee.compile(code);
|
||||
if (opts.run) {
|
||||
process.compile(js, source);
|
||||
eval(js);
|
||||
} else if (opts.print) {
|
||||
puts(js);
|
||||
} else if (opts.lint) {
|
||||
|
||||
@@ -78,7 +78,7 @@ compile_scripts: ->
|
||||
else if opts.tree then puts coffee.tree(code).toString()
|
||||
else
|
||||
js: coffee.compile code
|
||||
if opts.run then process.compile js, source
|
||||
if opts.run then eval js
|
||||
else if opts.print then puts js
|
||||
else if opts.lint then lint js
|
||||
else write_js source, coffee.compile code
|
||||
|
||||
Reference in New Issue
Block a user