Permalink
Browse files

JavaScript Version

  • Loading branch information...
1 parent dfe0939 commit 31ffc94a7d1be94f451119b55896797f5bf0359e @douglascrockford committed Jan 9, 2012
Showing with 518 additions and 4 deletions.
  1. +19 −4 README
  2. +499 −0 jsdev.js
View
23 README
@@ -11,8 +11,8 @@ This makes it possible to put development, performance, and testing scaffolding,
into a source file. The scaffolding is removed by minification, but is activated
by JSDev.
-JSDev is a filter that reads stdin, looking for tagged comments in either of
-these forms:
+JSDev is a filter that takes a source file and looks for tagged comments in
+either ofthese forms:
/*<tag> <stuff>*/
@@ -33,7 +33,7 @@ as
console.log("*\/ test");
*/
-On the command line, list the names of the tags that should be activated.
+JSDev is given a list the names of the tags that should be activated.
Also, methods can be defined by following the tag name with : and a method
name. There can be no spaces around the :.
@@ -45,12 +45,27 @@ name. There can be no spaces around the :.
If a condition was included, then the replacement will be preceeded with an
if statement.
-The command line can also include a -comment specification.
+The implementation in C obtains the input from stdin, and provides the result
+to stdout. The tag list is taken from the command line. The command line can
+also include a -comment specification. It will exit(1) if there is an error.
+
+In JavaScript, it is available as the JSDEV function that takes a source,
+an array of tags, and an optional array of comments. It will throw an
+exception if there is an error.
Example:
jsdev -comment "Devel Edition." <input >output test_expose enter:trace.enter exit:trace.exit unless:alert
+JavaScript:
+
+ output = JSDEV(input, [
+ "test_expose",
+ "enter:trace.enter",
+ "exit:trace.exit",
+ "unless:alert"
+ ] , ["Devel Edition."]);
+
input:
// This is a sample file.
Oops, something went wrong.

0 comments on commit 31ffc94

Please sign in to comment.