diff --git a/Cakefile b/Cakefile index fee765c2..d288040d 100644 --- a/Cakefile +++ b/Cakefile @@ -7,7 +7,7 @@ run: (args) -> proc.addListener 'error', (err) -> if err then puts err -task 'build:compiler', 'build the CoffeeScript Compiler source code', -> +task 'build', 'build the CoffeeScript language from source', -> fs.readdir('src').addCallback (files) -> files: 'src/' + file for file in files when file.match(/\.coffee$/) run ['-o', 'lib/coffee_script'].concat(files) diff --git a/lib/coffee_script/coffee-script.js b/lib/coffee_script/coffee-script.js index ba936c1a..bce590aa 100644 --- a/lib/coffee_script/coffee-script.js +++ b/lib/coffee_script/coffee-script.js @@ -2,10 +2,10 @@ var compiler, lexer, parser, path; // Set up for both the browser and the server. if ((typeof process !== "undefined" && process !== null)) { - process.mixin(require('./nodes')); + process.mixin(require('nodes')); path = require('path'); - lexer = new (require('./lexer').Lexer)(); - parser = require('./parser').parser; + lexer = new (require('lexer').Lexer)(); + parser = require('parser').parser; } else { this.exports = this; lexer = new Lexer(); diff --git a/lib/coffee_script/command_line.js b/lib/coffee_script/command_line.js index a9d41184..9210fbbc 100644 --- a/lib/coffee_script/command_line.js +++ b/lib/coffee_script/command_line.js @@ -14,7 +14,7 @@ var flags, separator; parse_options(); if (options.interactive) { - return require('./repl'); + return require('repl'); } if (options.eval) { return puts(coffee.compile(sources[0])); diff --git a/lib/coffee_script/nodes.js b/lib/coffee_script/nodes.js index 66d99f35..19a5fcd9 100644 --- a/lib/coffee_script/nodes.js +++ b/lib/coffee_script/nodes.js @@ -1,7 +1,7 @@ (function(){ var AccessorNode, ArrayNode, AssignNode, CallNode, ClosureNode, CodeNode, CommentNode, ExistenceNode, Expressions, ExtendsNode, ForNode, IDENTIFIER, IfNode, IndexNode, LiteralNode, Node, ObjectNode, OpNode, ParentheticalNode, PushNode, RangeNode, ReturnNode, SliceNode, SplatNode, TAB, TRAILING_WHITESPACE, ThisNode, ThrowNode, TryNode, ValueNode, WhileNode, compact, del, flatten, inherit, merge, statement; var __hasProp = Object.prototype.hasOwnProperty; - (typeof process !== "undefined" && process !== null) ? process.mixin(require('./scope')) : (this.exports = this); + (typeof process !== "undefined" && process !== null) ? process.mixin(require('scope')) : (this.exports = this); // Some helper functions // Tabs are two spaces for pretty printing. TAB = ' '; diff --git a/lib/coffee_script/repl.js b/lib/coffee_script/repl.js index e4ac6930..a27e489c 100644 --- a/lib/coffee_script/repl.js +++ b/lib/coffee_script/repl.js @@ -2,7 +2,7 @@ var coffee, prompt, quit, readline, run; // A CoffeeScript port/version of the Node.js REPL. // Required modules. - coffee = require('./coffee-script'); + coffee = require('coffee-script'); process.mixin(require('sys')); // Shortcut variables. prompt = 'coffee> '; diff --git a/lib/coffee_script/runner.js b/lib/coffee_script/runner.js deleted file mode 100644 index fb6b0340..00000000 --- a/lib/coffee_script/runner.js +++ /dev/null @@ -1,11 +0,0 @@ -(function(){ - var coffee, paths; - // Quickie script to compile and run all the files given as arguments. - process.mixin(require('sys')); - coffee = require('./coffee-script'); - paths = process.ARGV; - paths = paths.slice(2, paths.length); - paths.length ? coffee.ruby_compile_files(paths, function(js) { - return eval(js); - }) : require('./repl'); -})(); \ No newline at end of file diff --git a/src/coffee-script.coffee b/src/coffee-script.coffee index ee837f7d..9d27c1c3 100644 --- a/src/coffee-script.coffee +++ b/src/coffee-script.coffee @@ -1,9 +1,9 @@ # Set up for both the browser and the server. if process? - process.mixin require './nodes' + process.mixin require 'nodes' path: require 'path' - lexer: new (require('./lexer').Lexer)() - parser: require('./parser').parser + lexer: new (require('lexer').Lexer)() + parser: require('parser').parser else this.exports: this lexer: new Lexer() diff --git a/src/command_line.coffee b/src/command_line.coffee index f7a78a94..b630f8de 100644 --- a/src/command_line.coffee +++ b/src/command_line.coffee @@ -31,7 +31,7 @@ option_parser: null # The CommandLine handles all of the functionality of the `coffee` utility. exports.run: -> parse_options() - return require './repl' if options.interactive + return require 'repl' if options.interactive return puts coffee.compile sources[0] if options.eval usage() unless sources.length separator: sources.indexOf '--' diff --git a/src/nodes.coffee b/src/nodes.coffee index 55c6aef9..48a245bf 100644 --- a/src/nodes.coffee +++ b/src/nodes.coffee @@ -1,5 +1,5 @@ if process? - process.mixin require './scope' + process.mixin require 'scope' else this.exports: this diff --git a/src/repl.coffee b/src/repl.coffee index d52d403a..e0f07b12 100644 --- a/src/repl.coffee +++ b/src/repl.coffee @@ -1,7 +1,7 @@ # A CoffeeScript port/version of the Node.js REPL. # Required modules. -coffee: require './coffee-script' +coffee: require 'coffee-script' process.mixin require 'sys' # Shortcut variables. diff --git a/src/runner.coffee b/src/runner.coffee deleted file mode 100644 index 0377b146..00000000 --- a/src/runner.coffee +++ /dev/null @@ -1,12 +0,0 @@ -# Quickie script to compile and run all the files given as arguments. - -process.mixin require 'sys' -coffee: require './coffee-script' - -paths: process.ARGV -paths: paths[2...paths.length] - -if paths.length - coffee.ruby_compile_files paths, (js) -> eval(js) -else - require './repl'