branch: master commit b1e7a1d7228de097880028b0af53652be2555d78 Author: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com> Commit: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>
Switch to 1-dimensional array. --- context-coloring.el | 16 ++++++++-------- scopifier.js | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/context-coloring.el b/context-coloring.el index c50205d..ecebce6 100644 --- a/context-coloring.el +++ b/context-coloring.el @@ -210,12 +210,12 @@ start, end, level, and style." (let ((i 0) (len (length tokens))) (while (< i len) - (let ((token (elt tokens i))) - (let ((start (elt token 0)) - (end (elt token 1)) - (face (context-coloring-level-face (elt token 2) (elt token 3)))) - (add-text-properties start end `(face ,face rear-nonsticky t)))) - (setq i (+ i 1)))))) + (let ((start (elt tokens i)) + (end (elt tokens (+ i 1))) + (face (context-coloring-level-face (elt tokens (+ i 2)) + (elt tokens (+ i 3))))) + (add-text-properties start end `(face ,face rear-nonsticky t))) + (setq i (+ i 4)))))) (defun context-coloring-kill-scopifier () "Kills the currently-running scopifier process for this @@ -257,7 +257,7 @@ applying a parsed list of tokens to (with-current-buffer buffer (context-coloring-apply-tokens tokens)) (setq context-coloring-scopifier-process nil) - ;; (message "Colorized (after %f seconds)." (- (float-time) start-time)) + (message "Colorized (after %f seconds)." (- (float-time) start-time)) ))))) ;; Give the process its input. @@ -271,7 +271,7 @@ applying a parsed list of tokens to "Colors the current buffer by function context." (interactive) (setq context-coloring-colorize-start-time (float-time)) - ;; (message "%s" "Colorizing.") + (message "%s" "Colorizing.") (context-coloring-scopify)) (defun context-coloring-change-function (start end length) diff --git a/scopifier.js b/scopifier.js index 4b54091..4f3302a 100644 --- a/scopifier.js +++ b/scopifier.js @@ -61,12 +61,12 @@ module.exports = function (code) { // done now. if (!scope.functionExpressionScope) { range = scope.block.range; - scopes.push([ + scopes.push( range[0] + 1, range[1] + 1, scope.level, normal - ]); + ); definitionsIndex = tokens.length; definitionsCount = 0; for (j = 0; j < scope.variables.length; j += 1) { @@ -75,12 +75,12 @@ module.exports = function (code) { for (k = 0; k < variable.defs.length; k += 1) { definition = variable.defs[k]; range = definition.name.range; - tokens.push([ + tokens.push( range[0] + 1, range[1] + 1, scope.level, bold - ]); + ); } } for (j = 0; j < scope.references.length; j += 1) { @@ -100,13 +100,13 @@ module.exports = function (code) { } } if (!isDefined) { - tokens.push([ + tokens.push( // Handle global references too. range[0] + 1, range[1] + 1, reference.resolved ? reference.resolved.scope.level : 0, reference.__maybeImplicitGlobal ? bold : normal - ]); + ); } } } @@ -116,12 +116,12 @@ module.exports = function (code) { for (i = 0; i < ast.comments.length; i += 1) { comment = ast.comments[i]; range = comment.range; - tokens.push([ + tokens.push( range[0] + 1, range[1] + 1, -1, italic - ]); + ); } return scopes.concat(tokens);