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

This reverts commit 2f6b69b580.
This commit is contained in:
Jeremy Ashkenas 2010-02-17 23:22:05 -05:00
parent 2f6b69b580
commit dec9950649
12 changed files with 26 additions and 26 deletions

View File

@ -854,7 +854,7 @@ print reverse 'tpircseeffoc'</textarea>
var source = document.getElementById('repl_source').value;
var js = '';
try {
js = CoffeeScript.compile(source, {no_wrap: true});
js = compile(source, {no_wrap: true});
} catch(error) {
alert(error);
}

View File

@ -1725,7 +1725,7 @@ html <span class="Keyword">=</span> <span class="String"><span class="String">&q
var source = document.getElementById('repl_source').value;
var js = '';
try {
js = CoffeeScript.compile(source, {no_wrap: true});
js = compile(source, {no_wrap: true});
} catch(error) {
alert(error);
}

View File

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

View File

@ -1,9 +1,9 @@
(function(){
var ACCESSORS, ASSIGNMENT, BEFORE_WHEN, CALLABLE, CODE, COMMENT, COMMENT_CLEANER, HEREDOC, HEREDOC_INDENT, IDENTIFIER, JS, JS_CLEANER, KEYWORDS, LAST_DENT, LAST_DENTS, MULTILINER, MULTI_DENT, NOT_REGEX, NO_NEWLINE, NUMBER, OPERATOR, REGEX, RESERVED, Rewriter, STRING, STRING_NEWLINES, WHITESPACE, exports, lex;
if ((typeof require !== "undefined" && require !== null)) {
var ACCESSORS, ASSIGNMENT, BEFORE_WHEN, CALLABLE, CODE, COMMENT, COMMENT_CLEANER, HEREDOC, HEREDOC_INDENT, IDENTIFIER, JS, JS_CLEANER, KEYWORDS, LAST_DENT, LAST_DENTS, MULTILINER, MULTI_DENT, NOT_REGEX, NO_NEWLINE, NUMBER, OPERATOR, REGEX, RESERVED, Rewriter, STRING, STRING_NEWLINES, WHITESPACE, lex;
if ((typeof process !== "undefined" && process !== null)) {
Rewriter = require('./rewriter').Rewriter;
} else {
exports = this;
this.exports = this;
Rewriter = this.Rewriter;
}
// The lexer reads a stream of CoffeeScript and divvys it up into tagged

View File

@ -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, exports, flatten, inherit, merge, statement;
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 require !== "undefined" && require !== null) ? process.mixin(require('scope')) : (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 = ' ';

View File

@ -1,8 +1,8 @@
(function(){
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_START, EXPRESSION_TAIL, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, INVERSES, SINGLE_CLOSERS, SINGLE_LINERS, _a, _b, _c, _d, _e, _f, _g, _h, exports, pair, re;
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_START, EXPRESSION_TAIL, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, INVERSES, SINGLE_CLOSERS, SINGLE_LINERS, _a, _b, _c, _d, _e, _f, _g, _h, pair, re;
var __hasProp = Object.prototype.hasOwnProperty;
if (!((typeof require !== "undefined" && require !== null))) {
exports = this;
if (!((typeof process !== "undefined" && process !== null))) {
this.exports = this;
}
// In order to keep the grammar simple, the stream of tokens that the Lexer
// emits is rewritten by the Rewriter, smoothing out ambiguities, mis-nested

View File

@ -1,8 +1,8 @@
(function(){
var Scope, exports;
var Scope;
var __hasProp = Object.prototype.hasOwnProperty;
if (!((typeof require !== "undefined" && require !== null))) {
exports = this;
if (!((typeof process !== "undefined" && process !== null))) {
this.exports = this;
}
// Scope objects form a tree corresponding to the shape of the function
// definitions present in the script. They provide lexical scope, to determine

View File

@ -1,13 +1,13 @@
# Set up for both the browser and the server.
if require?
if process?
process.mixin require 'nodes'
path: require 'path'
lexer: new (require('lexer').Lexer)()
parser: require('parser').parser
else
exports: this.CoffeeScript: {}
this.exports: this
lexer: new Lexer()
parser: this.parser
parser: exports.parser
# Thin wrapper for Jison compatibility around the real lexer.
parser.lexer: {

View File

@ -1,7 +1,7 @@
if require?
if process?
Rewriter: require('./rewriter').Rewriter
else
exports: this
this.exports: this
Rewriter: this.Rewriter
# The lexer reads a stream of CoffeeScript and divvys it up into tagged

View File

@ -1,7 +1,7 @@
if require?
if process?
process.mixin require 'scope'
else
exports: this
this.exports: this
# Some helper functions

View File

@ -1,4 +1,4 @@
exports: this unless require?
this.exports: this unless process?
# In order to keep the grammar simple, the stream of tokens that the Lexer
# emits is rewritten by the Rewriter, smoothing out ambiguities, mis-nested

View File

@ -1,4 +1,4 @@
exports: this unless require?
this.exports: this unless process?
# Scope objects form a tree corresponding to the shape of the function
# definitions present in the script. They provide lexical scope, to determine