Permalink
Browse files

Rework the directory structure to be saner; add a Makefile; add a web…

… server
  • Loading branch information...
1 parent ecaa965 commit 0acca2f30cc6ec01ba17cba1a4e3b90e6b97b85d @pcwalton pcwalton committed May 25, 2010
View
470 LICENSE

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,29 @@
+PREFIX=/usr/local
+INSTALL=install
+NODE=node
+
+BIN_SRC=$(addprefix bin/,jsctags.js)
+LIB_SRC=$(addprefix lib/jsctags/,getopt.js traits.js underscore.js)
+LIB_CTAGS_SRC=$(addprefix lib/jsctags/ctags/,index.js interp.js nativefn.js \
+ reader.js writer.js)
+LIB_NARCISSUS_SRC=$(addprefix lib/jsctags/narcissus/,index.js jsdefs.js \
+ jslex.js jsparse.js)
+
+install:
+ $(INSTALL) -d $(PREFIX)/bin
+ $(INSTALL) $(BIN_SRC) $(BIN_SRC:%.js=$(PREFIX)/%)
+ $(INSTALL) -d $(PREFIX)/lib/jsctags
+ $(INSTALL) $(LIB_SRC) $(PREFIX)/lib/jsctags
+ $(INSTALL) -d $(PREFIX)/lib/jsctags/ctags
+ $(INSTALL) $(LIB_CTAGS_SRC) $(PREFIX)/lib/jsctags/ctags
+ $(INSTALL) -d $(PREFIX)/lib/jsctags/narcissus
+ $(INSTALL) $(LIB_NARCISSUS_SRC) $(PREFIX)/lib/jsctags/narcissus
+
+uninstall:
+ rm -rf $(BIN_SRC:%.js=$(PREFIX)/%) $(PREFIX)/lib/jsctags
+
+serve:
+ $(NODE) serve.js
+
+.PHONY: all install uninstall serve
+
View
@@ -38,7 +38,8 @@
var argv = process.argv;
var path = require('path');
-require.paths.unshift(path.join(path.dirname(argv[1]), '..', 'src', 'lib'));
+require.paths.unshift(path.join(path.dirname(argv[1]), "..", "lib",
+ "jsctags"));
var _ = require('underscore')._;
var fs = require('fs');
View
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>JavaScript parser</title>
+</head>
+<body>
+ <div id=header>
+ <h1>JavaScript parser</h1>
+ <div id=buttons>
+ <button onclick="parse();">Parse</button>
+ </div>
+ </div>
+ <p>
+ Paste in some JavaScript and the parse tree will be displayed over there!
+ </p>
+ <div id="js-container">
+ <textarea id=js rows=25 cols=80></textarea>
+ </div>
+ <div id=tree></div>
+ <script type="text/javascript" src="../js/tiki.js"></script>
+ <script type="text/javascript" src="../js/packages.js"></script>
+ <script type="text/javascript" src="../js/jquery-1.4.2.js"></script>
+ <script type="text/javascript" src="../js/jstree/jquery.tree.js"></script>
+ <script type="text/javascript" src="../js/parser.js"></script>
+</body>
+</html>
+
File renamed without changes.
File renamed without changes.
@@ -45,53 +45,25 @@ tiki.register('::narcissus', {
{
id: 'narcissus:index',
name: 'index',
- url: "lib/narcissus/index.js",
+ url: "../lib/jsctags/narcissus/index.js",
type: 'script'
},
{
id: 'narcissus:jsdefs',
name: 'jsdefs.js',
- url: "lib/narcissus/jsdefs.js",
+ url: "../lib/jsctags/narcissus/jsdefs.js",
type: 'script'
},
{
id: 'narcissus:jslex',
name: 'jslex.js',
- url: "lib/narcissus/jslex.js",
+ url: "../lib/jsctags/narcissus/jslex.js",
type: 'script'
},
{
id: 'narcissus:jsparse',
name: 'jsparse.js',
- url: "lib/narcissus/jsparse.js",
- type: 'script'
- }
- ]
-});
-
-tiki.register('::ctags', {
- name: 'ctags',
- version: "0.0.0",
- dependencies: {
- narcissus: "0.0.0"
- },
- 'tiki:resources': [
- {
- id: 'ctags:',
- name: 'index.js',
- url: "lib/ctags/index.js",
- type: 'script'
- },
- {
- id: 'ctags:reader',
- name: 'reader.js',
- url: "lib/ctags/reader.js",
- type: 'script'
- },
- {
- id: 'ctags:writer',
- name: 'writer.js',
- url: "lib/ctags/writer.js",
+ url: "../lib/jsctags/narcissus/jsparse.js",
type: 'script'
}
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -0,0 +1,56 @@
+#!/usr/bin/env node
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an 'AS IS' basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Bespin.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Bespin Team (bespin@mozilla.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var sys = require('sys');
+
+function log(level, args) {
+ if (level >= exports.level) {
+ sys.puts(Array.prototype.join.call(args, " "));
+ }
+}
+
+var levels = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
+exports.levels = levels;
+
+exports.level = levels.WARN;
+
+exports.debug = function() { log(levels.DEBUG, arguments); };
+exports.warn = function() { log(levels.WARN, arguments); };
+exports.info = function() { log(levels.INFO, arguments); };
+exports.error = function() { log(levels.ERROR, arguments); };
+
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.

0 comments on commit 0acca2f

Please sign in to comment.