1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

namespacing CoffeeScript in the browser, and sniffing the 'require' function instead of the 'exports' object

This commit is contained in:
Jeremy Ashkenas 2010-02-17 23:15:37 -05:00
parent ff1fd97924
commit 2f6b69b580
12 changed files with 26 additions and 26 deletions

View file

@ -1,15 +1,15 @@
(function(){
var lexer, parser, path;
var exports, lexer, parser, path;
// Set up for both the browser and the server.
if ((typeof process !== "undefined" && process !== null)) {
if ((typeof require !== "undefined" && require !== null)) {
process.mixin(require('nodes'));
path = require('path');
lexer = new (require('lexer').Lexer)();
parser = require('parser').parser;
} else {
this.exports = this;
exports = (this.CoffeeScript = {});
lexer = new Lexer();
parser = exports.parser;
parser = this.parser;
}
// Thin wrapper for Jison compatibility around the real lexer.
parser.lexer = {