                      (haml-limited-forward-sexp eol))))
 
                (haml-fontify-region-as-ruby (+ 1 beg) (point))))
-            (t (return-from loop)))))
-
-      ;; Move past end chars
-      (when (looking-at "[<>&!]+") (goto-char (match-end 0)))
-      ;; Highlight script
-      (if (looking-at "\\([=~]\\) \\(.*\\)$")
-          (haml-fontify-region-as-ruby (match-beginning 2) (match-end 2))
-        ;; Give font-lock something to highlight
-        (forward-char -1)
-        (looking-at "\\(\\)"))
-      t)))
+            (t (return-from loop))))))
+
+    ;; Move past end chars
+    (when (looking-at "[<>&!]+") (goto-char (match-end 0)))
+    ;; Highlight script
+    (if (looking-at "\\([=~]\\) \\(.*\\)$")
+        (haml-fontify-region-as-ruby (match-beginning 2) (match-end 2))
+      ;; Give font-lock something to highlight
+      (forward-char -1)
+      (looking-at "\\(\\)"))
+    t))
 
 (defun haml-move (re)
   "Try matching and moving to the end of a regular expression."

  %p= 'baz'
  %p{:foo => 'bar'}[@bar]= 'baz'"
  (when (re-search-forward "^ *[%.#]" limit t)
    (let ((eol (save-excursion (end-of-line) (point))))
      (forward-char -1)

      ;; Highlight tag, classes, and ids
      (while (haml-move "\\([.#%]\\)[a-z0-9_:\\-]*")
        (put-text-property (match-beginning 0) (match-end 0) 'face
                           (case (char-after (match-beginning 1))
                             (?% font-lock-function-name-face)
                             (?# font-lock-keyword-face)
                             (?. font-lock-type-face))))

      (block loop
        (while t
          (case (char-after)
            ;; Highlight obj refs
            (?\[

            ;; Highlight new attr hashes
            (?\(
             (forward-char 1)
             (while
                 (and (haml-parse-new-attr-hash
                       (lambda (type beg end)
                         (case type
                           (name (put-text-property beg end 'face font-lock-constant-face))
                           (value (haml-fontify-region-as-ruby beg end)))))
                      (not (eobp)))
               (forward-line 1)
               (beginning-of-line)))
            ;; Highlight old attr hashes
