From 85c8f386c16084906d6c2eb67f9064ba58a1dfc8 Mon Sep 17 00:00:00 2001 From: David Majda Date: Fri, 9 May 2014 13:39:56 +0200 Subject: [PATCH] Formatting --- lib/compiler/passes/generate-bytecode.js | 2 +- lib/compiler/passes/generate-javascript.js | 19 ++++++++----------- lib/compiler/passes/remove-proxy-rules.js | 8 ++------ lib/compiler/passes/report-left-recursion.js | 4 +--- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/lib/compiler/passes/generate-bytecode.js b/lib/compiler/passes/generate-bytecode.js index 4d3e84f..c23efb6 100644 --- a/lib/compiler/passes/generate-bytecode.js +++ b/lib/compiler/passes/generate-bytecode.js @@ -205,7 +205,7 @@ function generateBytecode(ast) { } function buildCall(functionIndex, delta, env, sp) { - var params = arrays.map( objects.values(env), function(p) { return sp - p; }); + var params = arrays.map(objects.values(env), function(p) { return sp - p; }); return [op.CALL, functionIndex, delta, params.length].concat(params); } diff --git a/lib/compiler/passes/generate-javascript.js b/lib/compiler/passes/generate-javascript.js index 4531a23..0250146 100644 --- a/lib/compiler/passes/generate-javascript.js +++ b/lib/compiler/passes/generate-javascript.js @@ -19,17 +19,14 @@ function generateJavascript(ast, options) { '],', '', 'peg$bytecode = [', - indent2(arrays.map( - ast.rules, - function(rule) { - return 'peg$decode("' - + js.stringEscape(arrays.map( - rule.bytecode, - function(b) { return String.fromCharCode(b + 32); } - ).join('')) - + '")'; - } - ).join(',\n')), + indent2(arrays.map(ast.rules, function(rule) { + return 'peg$decode("' + + js.stringEscape(arrays.map( + rule.bytecode, + function(b) { return String.fromCharCode(b + 32); } + ).join('')) + + '")'; + }).join(',\n')), '],' ].join('\n'); } else { diff --git a/lib/compiler/passes/remove-proxy-rules.js b/lib/compiler/passes/remove-proxy-rules.js index 8978d06..49cbcc4 100644 --- a/lib/compiler/passes/remove-proxy-rules.js +++ b/lib/compiler/passes/remove-proxy-rules.js @@ -18,9 +18,7 @@ function removeProxyRules(ast, options) { function replaceInSubnodes(propertyName) { return function(node, from, to) { - arrays.each(node[propertyName], function(subnode) { - replace(subnode, from, to); - }); + arrays.each(node[propertyName], function(n) { replace(n, from, to); }); }; } @@ -69,9 +67,7 @@ function removeProxyRules(ast, options) { indices.reverse(); - arrays.each(indices, function(index) { - ast.rules.splice(index, 1); - }); + arrays.each(indices, function(i) { ast.rules.splice(i, 1); }); } module.exports = removeProxyRules; diff --git a/lib/compiler/passes/report-left-recursion.js b/lib/compiler/passes/report-left-recursion.js index 7c81f1d..7652065 100644 --- a/lib/compiler/passes/report-left-recursion.js +++ b/lib/compiler/passes/report-left-recursion.js @@ -13,9 +13,7 @@ function reportLeftRecursion(ast) { function checkSubnodes(propertyName) { return function(node, appliedRules) { - arrays.each(node[propertyName], function(subnode) { - check(subnode, appliedRules); - }); + arrays.each(node[propertyName], function(n) { check(n, appliedRules); }); }; }