branch: externals/caml
commit 333d2f4a1c624ab0cf0547404cde5c9e2a472012
Merge: adafe8a 5569e23
Author: Christophe Troestler <[email protected]>
Commit: Christophe Troestler <[email protected]>
Improve syntax highlighting
The change to caml-font-other-comment-re is motivated by the following:
Otherwise in (* f' '"' *) the f will be matched as
caml-font-other-comment-re, then ' ' as a character, and the rest as
an unclosed string. With this change, f' is matched as
caml-font-ident-re and '"' as a character.
---
caml-font.el | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/caml-font.el b/caml-font.el
index a282995..3a534ff 100644
--- a/caml-font.el
+++ b/caml-font.el
@@ -160,7 +160,7 @@
; match any char token
(defconst caml-font-char-re
(concat "'\\(\015\012\\|[^\\']\\|"
- "\\(\\\\\\([\\'\"ntbr ]\\|[0-9][0-9][0-9]"
+ "\\(\\\\\\([\\'\"ntbr ]\\|[0-9][0-9][0-9]\\|o[0-3][0-7][0-7]"
"\\|x[0-9A-Fa-f][0-9A-Fa-f]\\)\\)\\)'")
)
@@ -184,7 +184,7 @@
; match any sequence of non-special characters in a comment
; note: this is only to go faster than one character at a time
(defconst caml-font-other-comment-re
- "[^{(*\"'\012\015]+"
+ "[^A-Za-z_\300-\326\330-\366\370-\377{(*\"'\012\015]+"
)
; match any sequence of non-special characters in a string
@@ -299,6 +299,8 @@
((looking-at caml-font-newline-re)
(goto-char (match-end 0))
(setq continue (caml-font-put-state (match-end 0) (cons nil depth))))
+ ((caml-font-looking-at caml-font-ident-re)
+ (goto-char (match-end 0)))
((caml-font-looking-at caml-font-other-comment-re)
(goto-char (match-end 0)))
(t