Skip to content

Instantly share code, notes, and snippets.

@yocontra
Created February 10, 2012 13:42
Show Gist options
  • Save yocontra/1789699 to your computer and use it in GitHub Desktop.
Save yocontra/1789699 to your computer and use it in GitHub Desktop.
dox AST transformer
//This function initializes the library
exports.initialize = function (wha) {
console.log("initialized " + wha);
};
//This is super complex - watch out for it!
//Serious bro
exports.coolprop = "hi";
//This function kills a process
exports.kill = function (pid) {
console.log("killed " + pid);
};
//Does nothing but looks neat
exports.whatever = "fool";
{ initialize:
{ type: 'function',
source: 'function (wha) {\n console.log("initialized " + wha);\n}',
lines: 3,
arguments: 1,
comments: [ 'This function initializes the library' ] },
coolprop:
{ type: 'string',
source: '"hi"',
lines: 1,
arguments: 0,
comments: [ 'This is super complex - watch out for it!', 'Serious bro' ] },
kill:
{ type: 'function',
source: 'function (pid) {\n console.log("killed " + pid);\n}',
lines: 3,
arguments: 1,
comments: [ 'This function kills a process' ] },
whatever:
{ type: 'string',
source: '"fool"',
lines: 1,
arguments: 0,
comments: [ 'Does nothing but looks neat' ] } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment