]> code.delx.au - gnu-emacs-elpa/commitdiff
Switch to 1-dimensional array.
authorJackson Ray Hamilton <jackson@jacksonrayhamilton.com>
Sun, 23 Nov 2014 04:48:16 +0000 (20:48 -0800)
committerJackson Ray Hamilton <jackson@jacksonrayhamilton.com>
Sun, 23 Nov 2014 04:48:16 +0000 (20:48 -0800)
context-coloring.el
scopifier.js

index c50205ddfb4a97c69762e1714c6eca6a4d127443..ecebce62e28412096dd588e7636fa61e26ea4f45 100644 (file)
@@ -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)
index 4b54091200990430a5ff9ae199edc0870f33e31b..4f3302af28a5761a142bc76394f53714242ee4c6 100644 (file)
@@ -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);