aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2010-09-30 14:26:34 +0200
committerBjörn Gustavsson <[email protected]>2010-09-30 14:26:34 +0200
commit0d2a6063f48db1c53bde58fe79cbe6e130adcb4a (patch)
tree02fb7c7cbe2b0d0d2491208591b7c1c58617228b
parent8e9a96141120b43b4edf05705a2a261916a902a5 (diff)
parentb81b6106f9feda8f3bce9eca3173560778c336fb (diff)
downloadotp-0d2a6063f48db1c53bde58fe79cbe6e130adcb4a.tar.gz
otp-0d2a6063f48db1c53bde58fe79cbe6e130adcb4a.tar.bz2
otp-0d2a6063f48db1c53bde58fe79cbe6e130adcb4a.zip
Merge branch 'mh/dollar-font-lock' into dev
* mh/dollar-font-lock: Emacs erlang-mode: fix syntax highlighting of $ in two cases
-rw-r--r--lib/tools/emacs/erlang.el18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index 91acfdf2b6..ed825a298f 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -1481,7 +1481,23 @@ Other commands:
erlang-font-lock-keywords-3
erlang-font-lock-keywords-4)
nil nil ((?_ . "w")) erlang-beginning-of-clause
- (font-lock-mark-block-function . erlang-mark-clause))))
+ (font-lock-mark-block-function . erlang-mark-clause)
+ (font-lock-syntactic-keywords
+ ;; A dollar sign right before the double quote that ends a
+ ;; string is not a character escape.
+ ;;
+ ;; And a "string" has with a double quote not escaped by a
+ ;; dollar sign, any number of non-backslash non-newline
+ ;; characters or escaped backslashes, a dollar sign
+ ;; (otherwise we wouldn't care) and a double quote. This
+ ;; doesn't match multi-line strings, but this is probably
+ ;; the best we can get, since while font-locking we don't
+ ;; know whether matching started inside a string: limiting
+ ;; search to a single line keeps things sane.
+ . (("\\(?:^\\|[^$]\\)\"\\(?:[^\"\n]\\|\\\\\"\\)*\\(\\$\\)\"" 1 "w")
+ ;; And the dollar sign in $\" escapes two characters, not
+ ;; just one.
+ ("\\(\\$\\)\\\\\\\"" 1 "'"))))))