Skip to content
Browse files

working

  • Loading branch information...
1 parent 60ef1ce commit 3b1b76b0e031e29d38783f6340e9412e0756efaa @ramitos ramitos committed
Showing with 24 additions and 40 deletions.
  1. +6 −6 cfa2/jscfa.js
  2. +4 −10 index.js
  3. +6 −6 jsctags/ctags/index.js
  4. +1 −1 jsctags/ctags/interp.js
  5. +2 −2 jsctags/ctags/reader.js
  6. +2 −2 jsctags/ctags/writer.js
  7. +3 −3 narcissus/lib/parser.js
  8. +0 −10 require.js
View
12 cfa2/jscfa.js
@@ -163,22 +163,22 @@ function errorWithCode(code, msg) {
//////////////////// PREPARE AST FOR FLOW ANALYSIS ///////////////////////
////////////////////////////////////////////////////////////////////////////////
-var jsparse = require('narcissus/lib/parser');
+var jsparse = require('../narcissus/lib/parser');
var Node = jsparse.Node;
const DECLARED_FORM = jsparse.DECLARED_FORM;
const STATEMENT_FORM = jsparse.STATEMENT_FORM;
-eval(require('narcissus/lib/definitions').consts);
-//var print = console.log;
-//var fs = require('fs');
-//function printf(fd, s) { fs.writeSync(fd, s, null, encoding='utf8'); }
+eval(require('../narcissus/lib/definitions').consts);
+var print = console.log;
+var fs = require('fs');
+function printf(fd, s) { fs.writeSync(fd, s, null, encoding='utf8'); }
// count is used to generate a unique ID for each node in the AST.
var count;
function newCount() { return ++count; }
// Use token_count to get fresh IDs for new non-terminals
-var token_count = (require('narcissus/lib/definitions').tokens).length;
+var token_count = (require('../narcissus/lib/definitions').tokens).length;
const DOT_PROTO = token_count++;
const ARGUMENTS = token_count++;
const PLUS_ASSIGN = token_count++;
View
14 index.js
@@ -1,12 +1,6 @@
-//jsc index.js -- "$(cat example.js)"
+var fs = require('fs'),
+ tags = new (require('jsctags/ctags/index').Tags)()
-load('require.js')
+tags.scan(fs.readFileSync('./' + process.argv[2], 'utf8'))
-var tags = require('jsctags/ctags/index').Tags,
- prettify = require('prettify')
-
-tags = new tags();
-
-tags.scan(arguments[0])
-
-print(JSON.stringify(tags))
+console.log(tags)
View
12 jsctags/ctags/index.js
@@ -35,12 +35,12 @@
*
* ***** END LICENSE BLOCK ***** */
-var parse = require('narcissus/lib/parser').parse;
-var _ = require('jsctags/underscore')._;
-var Interpreter = require('jsctags/ctags/interp').Interpreter;
-var TagReader = require('jsctags/ctags/reader').TagReader;
-var TagWriter = require('jsctags/ctags/writer').TagWriter;
-var Trait = require('jsctags/traits').Trait;
+var parse = require('../../narcissus/lib/parser').parse;
+var _ = require('../underscore')._;
+var Interpreter = require('./interp').Interpreter;
+var TagReader = require('./reader').TagReader;
+var TagWriter = require('./writer').TagWriter;
+var Trait = require('../traits').Trait;
exports.Tags = function (initialTags) {
this.tags = initialTags != null ? initialTags : [];
View
2 jsctags/ctags/interp.js
@@ -37,7 +37,7 @@
// Abstract interpreter, based on Narcissus.
-var getTags = require('cfa2/jscfa').getTags;
+var getTags = require('../../cfa2/jscfa').getTags;
//dimvar: opts stands for options. If we are using commonJS it gives
//info about the module (see getModuleInfo@jsctags.js).
View
4 jsctags/ctags/reader.js
@@ -35,8 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
-var _ = require('jsctags/underscore')._;
-var Trait = require('jsctags/traits').Trait;
+var _ = require('../underscore')._;
+var Trait = require('../traits').Trait;
exports.TagReader = Trait({
readLines: function (lines) {
View
4 jsctags/ctags/writer.js
@@ -35,8 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
-var Trait = require('jsctags/traits').Trait;
-var _ = require('jsctags/underscore')._;
+var Trait = require('../traits').Trait;
+var _ = require('../underscore')._;
const ESCAPES = { "\\": "\\\\", "\n": "\\n", "\r": "\\r", "\t": "\\t" };
View
6 narcissus/lib/parser.js
@@ -41,9 +41,9 @@
*
* ***** END LICENSE BLOCK ***** */
-require("narcissus/lib/jsdefs");
-require("narcissus/lib/jslex");
-require("narcissus/lib/jsparse");
+require("./jsdefs");
+require("./jslex");
+require("./jsparse");
for (var exp in Narcissus.parser)
exports[exp] = Narcissus.parser[exp];
View
10 require.js
@@ -1,10 +0,0 @@
-var exports = {}
-
-function require (path) {
- exports = {}
- var tmp
- load(path + '.js')
- tmp = exports
- exports = {}
- return tmp
-}

0 comments on commit 3b1b76b

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