[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] externals/caml 02f8809 184/197: Emacs: use symbol boundaries in
From: |
Stefan Monnier |
Subject: |
[nongnu] externals/caml 02f8809 184/197: Emacs: use symbol boundaries in regular expressions |
Date: |
Sat, 21 Nov 2020 01:20:03 -0500 (EST) |
branch: externals/caml
commit 02f8809d38afa7e40cfe4e928c5fb9b9651c109e
Author: Wilfred Hughes <wilfred@fb.com>
Commit: Wilfred Hughes <wilfred@fb.com>
Emacs: use symbol boundaries in regular expressions
\< is a word boundary, whereas \_< is a symbol boundary. Word
boundaries meant that we got confused by variables like in_foo or
end_foo.
This crashed imenu on files that contain variables with names of this
form.
Fixes
https://github.com/ocaml/tuareg/issues/190
https://caml.inria.fr/mantis/view.php?id=7850
---
caml.el | 60 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/caml.el b/caml.el
index 8204d5e..c472bf9 100644
--- a/caml.el
+++ b/caml.el
@@ -461,7 +461,7 @@ have caml-electric-indent on, which see.")
(make-variable-buffer-local 'caml-imenu-shown)
(defconst caml-imenu-search-regexp
- (concat "\\<in\\>\\|"
+ (concat "\\_<in\\_>\\|"
"^[ \t]*\\(let\\|class\\|type\\|m\\(odule\\|ethod\\)"
"\\|functor\\|and\\|val\\)[ \t]+"
"\\(\\('[a-zA-Z0-9]+\\|([^)]+)"
@@ -935,8 +935,8 @@ whole string."
;didn't seem right to me.
(defconst caml-phrase-start-keywords
- (concat "\\<\\(class\\|ex\\(ternal\\|ception\\)\\|functor"
- "\\|let\\|module\\|open\\|type\\|val\\)\\>")
+ (concat "\\_<\\(class\\|ex\\(ternal\\|ception\\)\\|functor"
+ "\\|let\\|module\\|open\\|type\\|val\\)\\_>")
"Keywords starting phrases in files")
;; a phrase starts when a toplevel keyword is at the beginning of a line
@@ -1102,12 +1102,12 @@ Returns nil for the parenthesis opening a comment."
;; Various constants and regexps
(defconst caml-before-expr-prefix
- (concat "\\<\\(asr\\|begin\\|class\\|do\\(wnto\\)?\\|else"
+ (concat "\\_<\\(asr\\|begin\\|class\\|do\\(wnto\\)?\\|else"
"\\|i\\(f\\|n\\(herit\\|itializer\\)?\\)"
"\\|f\\(or\\|un\\(ct\\(ion\\|or\\)\\)?\\)"
"\\|l\\(and\\|or\\|s[lr]\\|xor\\)\\|m\\(atch\\|od\\)"
"\\|o[fr]\\|parser\\|s\\(ig\\|truct\\)\\|t\\(hen\\|o\\|ry\\)"
- "\\|w\\(h\\(en\\|ile\\)\\|ith\\)\\)\\>\\|:begin\\>"
+ "\\|w\\(h\\(en\\|ile\\)\\|ith\\)\\)\\_>\\|:begin\\_>"
"\\|[=<>@^|&+-*/$%][!$%*+-./:<=>?@^|~]*\\|:[:=]\\|[[({,;]")
"Keywords that may appear immediately before an expression.
@@ -1115,8 +1115,8 @@ Used to distinguish it from toplevel let construct.")
(defconst caml-matching-kw-regexp
(concat
- "\\<\\(and\\|do\\(ne\\|wnto\\)?\\|e\\(lse\\|nd\\)\\|in\\|t\\(hen\\|o\\)"
- "\\|with\\)\\>\\|[^[|]|")
+ "\\_<\\(and\\|do\\(ne\\|wnto\\)?\\|e\\(lse\\|nd\\)\\|in\\|t\\(hen\\|o\\)"
+ "\\|with\\)\\_>\\|[^[|]|")
"Regexp used in caml mode for skipping back over nested blocks.")
(defconst caml-matching-kw-alist
@@ -1270,17 +1270,17 @@ the line where the governing keyword occurs.")
(aset caml-kwop-regexps 0
(concat
- "\\<\\(begin\\|object\\|for\\|s\\(ig\\|truct\\)\\|while\\)\\>"
+ "\\_<\\(begin\\|object\\|for\\|s\\(ig\\|truct\\)\\|while\\)\\_>"
"\\|:begin\\>\\|[[({]\\|;;"))
(aset caml-kwop-regexps 1
- (concat (aref caml-kwop-regexps 0) "\\|\\<\\(class\\|module\\)\\>"))
+ (concat (aref caml-kwop-regexps 0) "\\|\\_<\\(class\\|module\\)\\_>"))
(aset caml-kwop-regexps 2
(concat
(aref caml-kwop-regexps 1)
- "\\|\\<\\(fun\\(ction\\)?\\|initializer\\|let\\|m\\(atch\\|ethod\\)"
- "\\|parser\\|try\\|val\\)\\>\\|->"))
+ "\\|\\_<\\(fun\\(ction\\)?\\|initializer\\|let\\|m\\(atch\\|ethod\\)"
+ "\\|parser\\|try\\|val\\)\\_>\\|->"))
(aset caml-kwop-regexps 3
- (concat (aref caml-kwop-regexps 2) "\\|\\<if\\|when\\>"))
+ (concat (aref caml-kwop-regexps 2) "\\|\\_<if\\|when\\_>"))
(aset caml-kwop-regexps 4
(concat (aref caml-kwop-regexps 3) "\\|:=\\|<-"))
(aset caml-kwop-regexps 5
@@ -1290,17 +1290,17 @@ the line where the governing keyword occurs.")
(aset caml-kwop-regexps 7
(concat
(aref caml-kwop-regexps 0)
- "\\|\\<\\(constraint\\|exception\\|in\\(herit\\|clude\\)"
- "\\|o\\(f\\|pen\\)\\|type\\|val\\)\\>"))
+ "\\|\\_<\\(constraint\\|exception\\|in\\(herit\\|clude\\)"
+ "\\|o\\(f\\|pen\\)\\|type\\|val\\)\\_>"))
(aset caml-kwop-regexps 8
(concat (aref caml-kwop-regexps 6)
- "\\|\\<\\(constraint\\|exception\\|in\\(herit\\|clude\\)"
- "\\|o\\(f\\|pen\\)\\|type\\)\\>"))
+ "\\|\\_<\\(constraint\\|exception\\|in\\(herit\\|clude\\)"
+ "\\|o\\(f\\|pen\\)\\|type\\)\\>"))
(defun caml-find-done-match ()
(let ((unbalanced 1) (kwop t))
(while (and (not (= 0 unbalanced)) kwop)
- (setq kwop (caml-find-kwop "\\<\\(done\\|for\\|while\\)\\>"))
+ (setq kwop (caml-find-kwop "\\_<\\(done\\|for\\|while\\)\\_>"))
(cond
((not kwop))
((string= kwop "done") (setq unbalanced (1+ unbalanced)))
@@ -1312,7 +1312,7 @@ the line where the governing keyword occurs.")
(while (and (not (= 0 unbalanced)) kwop)
(setq kwop
(caml-find-kwop
-
"\\<\\(end\\|begin\\|object\\|s\\(ig\\|truct\\)\\)\\>\\|:begin\\>\\|;;"))
+
"\\_<\\(end\\|begin\\|object\\|s\\(ig\\|truct\\)\\)\\_>\\|:begin\\_>\\|;;"))
(cond
((not kwop))
((string= kwop ";;") (setq kwop nil) (forward-line 1))
@@ -1324,7 +1324,7 @@ the line where the governing keyword occurs.")
(defun caml-find-in-match ()
(let ((unbalanced 1) (kwop t))
(while (and (not (= 0 unbalanced)) kwop)
- (setq kwop (caml-find-kwop "\\<\\(in\\|let\\|end\\)\\>"))
+ (setq kwop (caml-find-kwop "\\_<\\(in\\|let\\|end\\)\\_>"))
(cond
((not kwop))
((string= kwop "end") (caml-find-end-match))
@@ -1336,8 +1336,8 @@ the line where the governing keyword occurs.")
(let ((unbalanced 1) (kwop t))
(while (and (not (= 0 unbalanced)) kwop)
(setq kwop
- (caml-find-kwop
- "\\<\\(with\\|try\\|m\\(atch\\|odule\\)\\|functor\\)\\>\\|[{}()]"))
+ (caml-find-kwop
+
"\\_<\\(with\\|try\\|m\\(atch\\|odule\\)\\|functor\\)\\_>\\|[{}()]"))
(cond
((not kwop))
((caml-at-sexp-close-p)
@@ -1371,7 +1371,7 @@ the line where the governing keyword occurs.")
(while (not done)
(setq kwop
(caml-find-kwop
- "\\<\\(e\\(nd\\|lse\\)\\|done\\|then\\|if\\|with\\)\\>\\|[])};]"))
+
"\\_<\\(e\\(nd\\|lse\\)\\|done\\|then\\|if\\|with\\)\\_>\\|[])};]"))
(cond
((not kwop) (setq done t))
((caml-at-sexp-close-p)
@@ -1388,8 +1388,8 @@ the line where the governing keyword occurs.")
(defun caml-find-pipe-match ()
(let ((done nil) (kwop)
(re (concat
- "\\<\\(try\\|match\\|with\\|function\\|parser\\|type"
- "\\|e\\(nd\\|lse\\)\\|done\\|then\\|in\\)\\>"
+ "\\_<\\(try\\|match\\|with\\|function\\|parser\\|type"
+ "\\|e\\(nd\\|lse\\)\\|done\\|then\\|in\\)\\_>"
"\\|[^[|]|\\|[])}]")))
(while (not done)
(setq kwop (caml-find-kwop re))
@@ -1405,7 +1405,7 @@ the line where the governing keyword occurs.")
(setq kwop (caml-find-with-match))
(setq done t))
((string= kwop "parser")
- (if (re-search-backward "\\<with\\>" (- (point) 5) t)
+ (if (re-search-backward "\\_<with\\_>" (- (point) 5) t)
(setq kwop (caml-find-with-match)))
(setq done t))
((string= kwop "done") (caml-find-done-match))
@@ -1420,7 +1420,7 @@ the line where the governing keyword occurs.")
(let ((done nil) (kwop))
(while (not done)
(setq kwop (caml-find-kwop
- "\\<\\(object\\|exception\\|let\\|type\\|end\\|in\\)\\>"))
+ "\\_<\\(object\\|exception\\|let\\|type\\|end\\|in\\)\\_>"))
(cond
((not kwop) (setq done t))
((string= kwop "end") (caml-find-end-match))
@@ -1468,7 +1468,7 @@ the line where the governing keyword occurs.")
(setq kwop "let-in")
(setq done t))))
((and (string= kwop "parser") (>= prio 2)
- (re-search-backward "\\<with\\>" (- (point) 5) t))
+ (re-search-backward "\\_<with\\_>" (- (point) 5) t))
(setq kwop (caml-find-with-match))
(setq done t))
((setq matching-fun (cdr-safe (assoc kwop caml-matching-kw-alist)))
@@ -1536,7 +1536,7 @@ Does not preserve point."
(t
(let ((pos (point)))
(back-to-indentation)
-; (if (looking-at "\\<let\\>") (goto-char pos))
+; (if (looking-at "\\_<let\\_>") (goto-char pos))
(- (symbol-value (nth 3 kwop-info))
(if (looking-at "|") caml-|-extra-indent 0))))))
(extra (if in-expr caml-apply-extra-indent 0)))
@@ -1544,8 +1544,8 @@ Does not preserve point."
(defconst caml-leading-kwops-regexp
(concat
- "\\<\\(and\\|do\\(ne\\|wnto\\)?\\|e\\(lse\\|nd\\)\\|in"
- "\\|t\\(hen\\|o\\)\\|with\\)\\>\\|[]|})]")
+ "\\_<\\(and\\|do\\(ne\\|wnto\\)?\\|e\\(lse\\|nd\\)\\|in"
+ "\\|t\\(hen\\|o\\)\\|with\\)\\_>\\|[]|})]")
"Regexp matching caml keywords which need special indentation.")
- [nongnu] externals/caml d9bc450 156/197: merge branch 4.02 from release 4.02.0 to release 4.02.1, (continued)
- [nongnu] externals/caml d9bc450 156/197: merge branch 4.02 from release 4.02.0 to release 4.02.1, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 633a39e 161/197: Update headers for the new license., Stefan Monnier, 2020/11/21
- [nongnu] externals/caml b499b25 171/197: MPR#7610: caml.el: avoid using deprecated last-command-char variable, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml b2088ca 158/197: GPR#243: Faster test suite, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml a913400 175/197: elisp: cosmetic docstring tweaks, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml c0bf206 169/197: Follow Emacs Lisp conventions for caml.el (#1346), Stefan Monnier, 2020/11/21
- [nongnu] externals/caml f49a296 164/197: caml-types.el: Extract the feedback logic to a separate function., Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 4c414a0 180/197: Emacs: Improve colors on dark themes, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 07d301a 174/197: elisp: fixed grammar in docstrings and comments, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 2964c4d 162/197: Add another format to parse compiler output., Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 02f8809 184/197: Emacs: use symbol boundaries in regular expressions,
Stefan Monnier <=
- [nongnu] externals/caml 4c8c8d3 176/197: makefiles: use 'install' instead of 'cp' in 'make install' targets, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml c9e7f57 186/197: Fix most CheckDoc errors., Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 78ec6be 185/197: Transform the README to Markdown, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 333d2f4 191/197: Improve syntax highlighting, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml adafe8a 190/197: Add OPAM file, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 466d703 194/197: Minor improvements to the README, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 1d6cd46 196/197: Add make target for opam release, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 38ebde1 197/197: Generate a caml-mode-site-file, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 29aaf70 193/197: Move the changelog to CHANGES, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml bfa612b 195/197: Mention easy ways of installing this package, Stefan Monnier, 2020/11/21