Skip to content

Commit

Permalink
Extract haml-ruby-script-re as a separate constant
Browse files Browse the repository at this point in the history
  • Loading branch information
purcell committed Dec 21, 2012
1 parent b60c500 commit 9ff73cb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions haml-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,14 @@ END.")
"\\(\\(?:.*?[,{(\\[][ \t]*\n\\)*.*\\)"
"Regexp to match trailing ruby code which may continue onto subsequent lines.")

(defconst haml-ruby-script-re
(concat "^[ \t]*\\(-\\|[&!]?[=~]\\) " haml-possibly-multiline-code-re)
"Regexp to match -, = or ~ blocks and any continued code lines.")

(defun haml-highlight-ruby-script (limit)
"Highlight a Ruby script expression (-, =, or ~).
LIMIT works as it does in `re-search-forward'."
(when (re-search-forward (concat "^[ \t]*\\(-\\|[&!]?[=~]\\) "
haml-possibly-multiline-code-re)
limit t)
(when (re-search-forward haml-ruby-script-re limit t)
(haml-fontify-region-as-ruby (match-beginning 2) (match-end 2))))

(defun haml-highlight-ruby-tag (limit)
Expand Down

0 comments on commit 9ff73cb

Please sign in to comment.