Skip to content
Browse files

Make the build run on Narwhal and Ringo.

  • Loading branch information...
1 parent c2c518c commit b562c2697399237d20163e4778aeb890be47647f @jcoglan committed
View
7 source/bindings.js
@@ -4,7 +4,10 @@
Canopy.MetaGrammarParser[type] = Canopy.Compiler[type];
}
- if (typeof module === 'object')
- module.exports = Canopy;
+ if (typeof exports === 'object') {
+ module.exports = exports;
+ Canopy.extend(exports, Canopy);
+ exports.compile = Canopy.compile;
+ }
})();
View
10 source/canopy/compiler/grammar.js
@@ -90,12 +90,10 @@ Canopy.Compiler.Grammar = {
}
builder.newline_();
- builder.if_('typeof require === "function" && typeof module === "object"', function(builder) {
- builder.module_('module.exports', function(builder) {
- builder.field_('Grammar', 'Grammar');
- builder.field_('Parser', 'Parser');
- builder.field_('parse', 'Parser.parse');
- });
+ builder.if_('typeof require === "function" && typeof exports === "object"', function(builder) {
+ builder.line_('exports.Grammar = Grammar');
+ builder.line_('exports.Parser = Parser');
+ builder.line_('exports.parse = Parser.parse');
builder.newline_();
if (namespaceCondition)
builder.if_(namespaceCondition, expose);
View
10 source/canopy/meta_grammar.js
@@ -2714,12 +2714,10 @@
Parser.SyntaxNode = SyntaxNode;
- if (typeof require === "function" && typeof module === "object") {
- module.exports = {
- Grammar: Grammar,
- Parser: Parser,
- parse: Parser.parse
- };
+ if (typeof require === "function" && typeof exports === "object") {
+ exports.Grammar = Grammar;
+ exports.Parser = Parser;
+ exports.parse = Parser.parse;
if (typeof Canopy !== "undefined") {
Canopy.MetaGrammar = Grammar;
View
2 spec/canopy/compiler/any_char_spec.js
@@ -1,4 +1,4 @@
-Canopy.Compiler.AnyCharSpec = JS.Test.describe("Canopy.Compiler.AnyChar",
+JS.ENV.Canopy.Compiler.AnyCharSpec = JS.Test.describe("Canopy.Compiler.AnyChar",
function() { with(this) {
include(Canopy.SpecHelper)
View
2 spec/canopy/compiler/char_class_spec.js
@@ -1,4 +1,4 @@
-Canopy.Compiler.CharClassSpec = JS.Test.describe("Canopy.Compiler.CharClass",
+JS.ENV.Canopy.Compiler.CharClassSpec = JS.Test.describe("Canopy.Compiler.CharClass",
function() { with(this) {
include(Canopy.SpecHelper)
View
2 spec/canopy/compiler/choice_part_spec.js
@@ -1,4 +1,4 @@
-Canopy.Compiler.ChoicePartSpec = JS.Test.describe("Canopy.Compiler.ChoicePart",
+JS.ENV.Canopy.Compiler.ChoicePartSpec = JS.Test.describe("Canopy.Compiler.ChoicePart",
function() { with(this) {
include(Canopy.SpecHelper)
View
2 spec/canopy/compiler/choice_spec.js
@@ -1,4 +1,4 @@
-Canopy.Compiler.ChoiceSpec = JS.Test.describe("Canopy.Compiler.Choice",
+JS.ENV.Canopy.Compiler.ChoiceSpec = JS.Test.describe("Canopy.Compiler.Choice",
function() { with(this) {
include(Canopy.SpecHelper)
View
2 spec/canopy/compiler/predicate_spec.js
@@ -1,4 +1,4 @@
-Canopy.Compiler.PredicateSpec = JS.Test.describe("Canopy.Compiler.Predicate",
+JS.ENV.Canopy.Compiler.PredicateSpec = JS.Test.describe("Canopy.Compiler.Predicate",
function() { with(this) {
include(Canopy.SpecHelper)
View
2 spec/canopy/compiler/reference_spec.js
@@ -1,4 +1,4 @@
-Canopy.Compiler.ReferenceSpec = JS.Test.describe("Canopy.Compiler.Reference",
+JS.ENV.Canopy.Compiler.ReferenceSpec = JS.Test.describe("Canopy.Compiler.Reference",
function() { with(this) {
include(Canopy.SpecHelper)
View
2 spec/canopy/compiler/repeat_spec.js
@@ -1,4 +1,4 @@
-Canopy.Compiler.RepeatSpec = JS.Test.describe("Canopy.Compiler.Repeat",
+JS.ENV.Canopy.Compiler.RepeatSpec = JS.Test.describe("Canopy.Compiler.Repeat",
function() { with(this) {
include(Canopy.SpecHelper)
View
2 spec/canopy/compiler/sequence_spec.js
@@ -1,4 +1,4 @@
-Canopy.Compiler.SequenceSpec = JS.Test.describe("Canopy.Compiler.Sequence",
+JS.ENV.Canopy.Compiler.SequenceSpec = JS.Test.describe("Canopy.Compiler.Sequence",
function() { with(this) {
include(Canopy.SpecHelper)
View
2 spec/canopy/compiler/string_spec.js
@@ -1,4 +1,4 @@
-Canopy.Compiler.StringSpec = JS.Test.describe("Canopy.Compiler.String",
+JS.ENV.Canopy.Compiler.StringSpec = JS.Test.describe("Canopy.Compiler.String",
function() { with(this) {
include(Canopy.SpecHelper)
View
2 spec/canopy/meta_grammar_parser_spec.js
@@ -1,4 +1,4 @@
-Canopy.MetaGrammarParserSpec = JS.Test.describe("Canopy.MetaGrammarParser",
+JS.ENV.Canopy.MetaGrammarParserSpec = JS.Test.describe("Canopy.MetaGrammarParser",
function() { with(this) {
describe('with an any-char rule', function() { with(this) {
before(function() { with(this) {
View
2 spec/canopy_spec.js
@@ -1,4 +1,4 @@
-CanopySpec = JS.Test.describe("Canopy", function() { with(this) {
+JS.ENV.CanopySpec = JS.Test.describe("Canopy", function() { with(this) {
describe('formatError', function() { with(this) {
before(function() { with(this) {
this.parseError = {
View
9 spec/console.js
@@ -8,13 +8,16 @@ if (this.ActiveXObject)
} finally {
try { if (file) file.Close() } catch (e) {}
}
- }
+ };
-JSCLASS_PATH = 'node_modules/jsclass/min'
+(function() {
+ var $ = (typeof global === 'object') ? global : this
+ $.JSCLASS_PATH = 'node_modules/jsclass/min'
+})()
if (typeof require === 'function') {
require('../' + JSCLASS_PATH + '/loader')
- Canopy = require('../lib/canopy-min')
+ JS.ENV.Canopy = require('../lib/canopy')
require('./runner')
} else {
load(JSCLASS_PATH + '/loader.js')

0 comments on commit b562c26

Please sign in to comment.
Something went wrong with that request. Please try again.