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

  (save-excursion
    (while t
      (beginning-of-line)
      (if (looking-at "^ *\\(?:[.#%][a-z_:\\-]+\\)+{")
          (progn
            (goto-char (- (match-end 0) 1))
            (haml-limited-forward-sexp (save-excursion (end-of-line) (point)))

a specific level to which the current line could be indented.")

(defvar haml-block-openers
  `("^ *\\([%\\.#][a-z0-9_:\\-]*\\)+\\({.*}\\)?\\(\\[.*\\]\\)?[><]*[ \t]*$"
    "^ *[&!]?[-=~].*do[ \t]*\\(|.*|[ \t]*\\)?$"
    ,(concat "^ *[&!][-=~][ \t]*\\("
             (regexp-opt '("if" "unless" "while" "until" "else"
