[Pkg-javascript-commits] [less.js] 90/285: Remove some interdepedencies
Jonas Smedegaard
dr at jones.dk
Mon Oct 26 23:23:42 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag v2.0.0
in repository less.js.
commit e5faba5154da3e92159e3c57508a65fc2d4a08c4
Author: Luke Page <luke.a.page at gmail.com>
Date: Thu Sep 4 18:16:08 2014 +0100
Remove some interdepedencies
---
lib/less/parser/parser-input.js | 6 +++---
lib/less/parser/parser.js | 25 +++++++++++++------------
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/lib/less/parser/parser-input.js b/lib/less/parser/parser-input.js
index aca272f..5c799c6 100644
--- a/lib/less/parser/parser-input.js
+++ b/lib/less/parser/parser-input.js
@@ -211,7 +211,7 @@ module.exports = function() {
return (c > CHARCODE_9 || c < CHARCODE_PLUS) || c === CHARCODE_FORWARD_SLASH || c === CHARCODE_COMMA;
};
- parserInput.start = function(str, chunkInput, parser, env) {
+ parserInput.start = function(str, chunkInput, env) {
input = str;
parserInput.i = j = currentPos = furthest = 0;
@@ -227,12 +227,12 @@ module.exports = function() {
// in the case it causes too much performance issues.
if (chunkInput) {
chunks = chunker(str, function fail(msg, index) {
- throw new(LessError)(parser, {
+ throw new(LessError)({
index: index,
type: 'Parse',
message: msg,
filename: env.currentFileInfo.filename
- }, env);
+ }, env); //TODO works because env contains contents like importManager
});
} else {
chunks = [str];
diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js
index b5e474b..70027d0 100644
--- a/lib/less/parser/parser.js
+++ b/lib/less/parser/parser.js
@@ -42,8 +42,7 @@ module.exports = function(environment) {
//
//
var Parser = function Parser(env) {
- var parser,
- parsers,
+ var parsers,
parserInput = getParserInput();
// Top parser on an import tree must be sure there is one "env"
@@ -73,10 +72,15 @@ var Parser = function Parser(env) {
}
function error(msg, type) {
- var e = new Error(msg);
- e.index = parserInput.i;
- e.type = type || 'Syntax';
- throw e;
+ throw new LessError(
+ {
+ index: parserInput.i,
+ filename: env.currentFileInfo.filename,
+ type: type || 'Syntax',
+ message: msg
+ },
+ imports
+ );
}
function getDebugInfo(index) {
@@ -92,9 +96,8 @@ var Parser = function Parser(env) {
//
// The Parser
//
- parser = {
+ return {
- imports: imports,
//
// Parse an input string into an abstract syntax tree,
// @param str A string containing 'less' markup
@@ -122,7 +125,7 @@ var Parser = function Parser(env) {
// with the `root` property set to true, so no `{}` are
// output. The callback is called when the input is parsed.
try {
- parserInput.start(str, env.chunkInput, parser, env);
+ parserInput.start(str, env.chunkInput, env);
root = new(tree.Ruleset)(null, this.parsers.primary());
root.root = true;
@@ -618,7 +621,7 @@ var Parser = function Parser(env) {
parserInput.restore();
},
args: function (isCall) {
- var parsers = parser.parsers, entities = parsers.entities,
+ var entities = parsers.entities,
returner = { args:null, variadic: false },
expressions = [], argsSemiColon = [], argsComma = [],
isSemiColonSeperated, expressionContainsNamed, name, nameLoop, value, arg;
@@ -1583,8 +1586,6 @@ var Parser = function Parser(env) {
}
}
};
-
- return parser;
};
Parser.serializeVars = function(vars) {
var s = '';
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git
More information about the Pkg-javascript-commits
mailing list