File: /home/f/r/e/frenchy/www/french-american.org/current/node_modules/uglyfly-js/lib/describe_ast.js
/***********************************************************************
Copyright 2014 (c) Saair Quaderi <saair.quaderi@gmail.com>
Copyright 2012-2013 (c) Mihai Bazon <mihai.bazon@gmail.com>
UglyflyJS sourcecode can be found here:
https://github.com/quaderi/uglyflyjs
UglyflyJS (by Saair) is a fork of UglifyJS2 (by Mihai Bazon)
Both libraries are released under the BSD 2-Clause License.
***********************************************************************/
/*globals define, module, require */
((typeof define === "function") ? define :
function () { "use strict"; require('./nd').apply(module, arguments); })(
"describe_ast",
[
//no dependencies
],
function () {
"use strict";
function print_description(out, NodeType) {
out.print("AST." + NodeType.TYPE);
var props = NodeType.SELF_PROPS.filter(function (prop) {
return !/^\$/.test(prop);
});
if (props.length > 0) {
out.space();
out.with_parens(function () {
props.forEach(function (prop, i) {
if (i) {
out.space();
}
out.print(prop);
});
});
}
if (NodeType.documentation) {
out.space();
out.print_string(out, NodeType.documentation);
}
if (NodeType.SUBCLASSES.length > 0) {
out.space();
out.with_block(function () {
NodeType.SUBCLASSES.forEach(function (NodeType) {
out.indent();
print_description(NodeType);
out.newline();
});
});
}
}
function describe_ast(AST, out) {
print_description(out, AST.Node);
return String(out);
}
return describe_ast;
}
);