|
|
@ -138,16 +138,16 @@ less.parser = {
|
|
|
|
optimization: 2,
|
|
|
|
optimization: 2,
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Parse an input string into an abstract syntax tree
|
|
|
|
// Parse an input string into an abstract syntax tree,
|
|
|
|
|
|
|
|
// call `callback` when done.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
parse: function (str) {
|
|
|
|
parse: function (str, callback) {
|
|
|
|
var root, start, end, zone, line, buff = [], c;
|
|
|
|
var root, start, end, zone, line, buff = [], c, error = null;
|
|
|
|
|
|
|
|
|
|
|
|
i = j = current = 0;
|
|
|
|
i = j = current = 0;
|
|
|
|
chunks = [];
|
|
|
|
chunks = [];
|
|
|
|
input = str.replace(/\r\n/g, '\n');
|
|
|
|
input = str.replace(/\r\n/g, '\n');
|
|
|
|
inputLength = input.length;
|
|
|
|
inputLength = input.length;
|
|
|
|
this.error = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Split the input into chunks,
|
|
|
|
// Split the input into chunks,
|
|
|
|
// Either delimited by /\n\n/ or
|
|
|
|
// Either delimited by /\n\n/ or
|
|
|
@ -200,9 +200,9 @@ less.parser = {
|
|
|
|
stylize(stylize(input[i], 'inverse') +
|
|
|
|
stylize(stylize(input[i], 'inverse') +
|
|
|
|
input.slice(i + 1, end),'yellow') + '\033[0m\n';
|
|
|
|
input.slice(i + 1, end),'yellow') + '\033[0m\n';
|
|
|
|
|
|
|
|
|
|
|
|
this.error = { name: "ParseError", message: "Parse Error on line " + line + ":\n" + zone };
|
|
|
|
error = { name: "ParseError", message: "Parse Error on line " + line + ":\n" + zone };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return root;
|
|
|
|
callback(error, root);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|