Skip to content
Browse files

Remove path unshift hack

  • Loading branch information...
1 parent 7d3f9b6 commit c569a916bd8b169d4461ca560d4093147ef473b5 @puffnfresh committed
Showing with 16 additions and 36 deletions.
  1. +9 −8 interleaved-roy.js
  2. +1 −22 roy
  3. +5 −5 src/compile.js
  4. +1 −1 src/typeinference.js
View
17 interleaved-roy.js
@@ -1,4 +1,4 @@
-var roy;
+var roy = {};
//= node_modules/underscore/underscore.js
@@ -13,24 +13,25 @@ var roy;
return modules[x];
}
- load["compile"] = function(exports) {
+ load["./compile"] = function(exports) {
//= src/compile.js
};
- load["lexer"] = function(exports) {
+ load["./lexer"] = function(exports) {
//= src/lexer.js
};
- load["nodes"] = function(exports) {
+ load["./nodes"] = function(exports) {
//= src/nodes.js
};
- load["parser"] = function(exports) {
+ load["./parser"] = function(exports) {
//= src/parser.js
};
- load["typeinference"] = function(exports) {
+ load["./typeinference"] = function(exports) {
//= src/typeinference.js
};
- load["types"] = function(exports) {
+ load["./types"] = function(exports) {
//= src/types.js
};
- roy = require("compile");
+ roy.lexer = require("./lexer");
+ roy.compile = require("./compile").compile;
})();
View
23 roy
@@ -1,23 +1,2 @@
#!/usr/bin/env node
-
-var requireUnshift = true;
-
-try {
- require.paths.unshift('src');
-} catch(e) {
- requireUnshift = false;
-}
-
-try {
- require('parser');
-} catch(e) {
- if(!requireUnshift) {
- console.log('require.paths is removed. Execute like:');
- console.log('NODE_PATH=src ./roy');
- } else {
- console.log('parser module not found. Must run `make` first.');
- }
- return;
-}
-
-require('compile').main();
+require('./src/compile').main();
View
10 src/compile.js
@@ -1,8 +1,8 @@
-var typecheck = require('typeinference').typecheck,
- nodes = require('nodes').nodes,
- types = require('types'),
- parser = require('parser').parser,
- lexer = require('lexer'),
+var typecheck = require('./typeinference').typecheck,
+ nodes = require('./nodes').nodes,
+ types = require('./types'),
+ parser = require('./parser').parser,
+ lexer = require('./lexer'),
_ = require('underscore');
// Assigning the nodes to `parser.yy` allows the grammar to access the nodes from
View
2 src/typeinference.js
@@ -6,7 +6,7 @@
// Cardelli's [Modula-2 code](http://bit.ly/Hjpvb). Wow.
// Type variable and built-in types are defined in the `types` module.
-var t = require('types'),
+var t = require('./types'),
_ = require('underscore');
// ### Unification

0 comments on commit c569a91

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