some reorganization
(moved pretty much everything that relates to scope in scope.js, added a module for NodeJS that can be used with require() and exports everything.)
This commit is contained in:
@@ -4,12 +4,11 @@ function OutputStream(options) {
|
||||
indent_start : 0,
|
||||
indent_level : 4,
|
||||
quote_keys : false,
|
||||
space_colon : false,
|
||||
space_colon : true,
|
||||
ascii_only : false,
|
||||
inline_script : false,
|
||||
width : 80,
|
||||
beautify : true,
|
||||
scope_style : "negate"
|
||||
beautify : true
|
||||
});
|
||||
|
||||
var indentation = 0;
|
||||
@@ -184,7 +183,7 @@ function OutputStream(options) {
|
||||
|
||||
function colon() {
|
||||
print(":");
|
||||
space();
|
||||
if (options.space_colon) space();
|
||||
};
|
||||
|
||||
var stack = [];
|
||||
@@ -204,7 +203,7 @@ function OutputStream(options) {
|
||||
with_block : with_block,
|
||||
with_parens : with_parens,
|
||||
with_square : with_square,
|
||||
options : function(opt) { return options[opt] },
|
||||
option : function(opt) { return options[opt] },
|
||||
line : function() { return current_line },
|
||||
col : function() { return current_col },
|
||||
pos : function() { return current_pos },
|
||||
@@ -228,7 +227,6 @@ function OutputStream(options) {
|
||||
nodetype.DEFMETHOD("print", function(stream){
|
||||
var self = this;
|
||||
stream.push_node(self);
|
||||
//stream.print("«" + self.TYPE + ":" + self.start.line + ":" + self.start.col + "»");
|
||||
if (self.needs_parens(stream)) {
|
||||
stream.with_parens(function(){
|
||||
generator(self, stream);
|
||||
@@ -777,10 +775,10 @@ function OutputStream(options) {
|
||||
});
|
||||
DEFPRINT(AST_ObjectKeyVal, function(self, output){
|
||||
var key = self.key;
|
||||
if (output.options("quote_keys")) {
|
||||
if (output.option("quote_keys")) {
|
||||
output.print_string(key);
|
||||
} else if ((typeof key == "number"
|
||||
|| !output.options("beautify")
|
||||
|| !output.option("beautify")
|
||||
&& +key + "" == key)
|
||||
&& parseFloat(key) >= 0) {
|
||||
output.print(make_num(key));
|
||||
@@ -863,7 +861,7 @@ function OutputStream(options) {
|
||||
|
||||
// self should be AST_New. decide if we want to show parens or not.
|
||||
function no_constructor_parens(self, output) {
|
||||
return self.args.length == 0 && !output.options("beautify");
|
||||
return self.args.length == 0 && !output.option("beautify");
|
||||
};
|
||||
|
||||
function best_of(a) {
|
||||
|
||||
Reference in New Issue
Block a user