#!/usr/bin/env node
var flow = require("../flow_parser.js");
var util = require("util");
var fs = require("fs");
var argv = require("minimist")(process.argv.slice(2));

var description =
"This script parses a given string or file and then dumps the ast.\n\
You can either pass in a string to parse like\n\
\t./inspect_ast.js \"1+1\"\n\
Or you can pass in the name of a file to parse, like \n\
\t./inspect_ast.js inspect_ast.js";
if (argv._.length != 1 || argv.help) {
  console.log(description);
} else {
  var content = argv._[0];
  if (fs.existsSync(content)) {
    content = fs.readFileSync(content).toString();
  }
  console.log(util.inspect(flow.parse(content), {showHidden: false, depth: null}));
}

@@ -630,20 +630,22 @@
 log(
-util.inspect
+JSON.stringify
 (flo
@@ -666,40 +666,15 @@
 t), 
-%7BshowHidden: false, depth: null%7D
+null, 2
 ));%0A

use JSON.stringify to dump the AST