[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode 7afad7b 464/486: rearrange II: Regexp variables
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode 7afad7b 464/486: rearrange II: Regexp variables and functions |
Date: |
Sat, 7 Aug 2021 09:26:15 -0400 (EDT) |
branch: elpa/rust-mode
commit 7afad7b043364ef21e36bc40eb454aea81505eb2
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Nathan Moreau <nathan.moreau@m4x.org>
rearrange II: Regexp variables and functions
---
rust-mode.el | 57 ++++++++++++++++++++++++++++-----------------------------
1 file changed, 28 insertions(+), 29 deletions(-)
diff --git a/rust-mode.el b/rust-mode.el
index d7a03ba..8571a9c 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -144,18 +144,6 @@ to the function arguments. When nil, `->' will be
indented one level."
(defconst rust-re-ident
"[[:word:][:multibyte:]_][[:word:][:multibyte:]_[:digit:]]*")
(defconst rust-re-lc-ident
"[[:lower:][:multibyte:]_][[:word:][:multibyte:]_[:digit:]]*")
(defconst rust-re-uc-ident "[[:upper:]][[:word:][:multibyte:]_[:digit:]]*")
-(defconst rust-re-unsafe "unsafe")
-(defconst rust-re-extern "extern")
-(defconst rust-re-async-or-const "async\\|const")
-(defconst rust-re-generic
- (concat "<[[:space:]]*'" rust-re-ident "[[:space:]]*>"))
-(defconst rust-re-union
- (rx-to-string
- `(seq
- (or space line-start)
- (group symbol-start "union" symbol-end)
- (+ space) (regexp ,rust-re-ident))))
-
(defvar rust-re-vis
;; pub | pub ( crate ) | pub ( self ) | pub ( super ) | pub ( in SimplePath )
(concat
@@ -174,8 +162,23 @@ to the function arguments. When nil, `->' will be
indented one level."
(rust-re-shy (concat "::" rust-re-ident)) "*"))))
"[[:space:]]*)"))
"?"))
+(defconst rust-re-unsafe "unsafe")
+(defconst rust-re-extern "extern")
+(defconst rust-re-async-or-const "async\\|const")
+(defconst rust-re-generic
+ (concat "<[[:space:]]*'" rust-re-ident "[[:space:]]*>"))
+(defconst rust-re-union
+ (rx-to-string
+ `(seq
+ (or space line-start)
+ (group symbol-start "union" symbol-end)
+ (+ space) (regexp ,rust-re-ident))))
+
+(defun rust-re-item-def (itype)
+ (concat (rust-re-word itype)
+ (rust-re-shy rust-re-generic) "?"
+ "[[:space:]]+" (rust-re-grab rust-re-ident)))
-;;; Start of a Rust item
(defvar rust-top-item-beg-re
(concat "\\s-*"
;; TODO some of this does only make sense for `fn' (unsafe,
extern...)
@@ -189,6 +192,18 @@ to the function arguments. When nil, `->' will be
indented one level."
"\\_>")
"Start of a Rust item.")
+;; TODO some of this does only make sense for `fn' (unsafe, extern...)
+;; and not other items
+(defun rust-re-item-def-imenu (itype)
+ (concat "^[[:space:]]*"
+ (rust-re-shy (concat rust-re-vis "[[:space:]]+")) "?"
+ (rust-re-shy (concat (rust-re-word "default") "[[:space:]]+")) "?"
+ (rust-re-shy (concat (rust-re-shy rust-re-async-or-const)
"[[:space:]]+")) "?"
+ (rust-re-shy (concat (rust-re-word rust-re-unsafe) "[[:space:]]+"))
"?"
+ (rust-re-shy (concat (rust-re-word rust-re-extern) "[[:space:]]+"
+ (rust-re-shy "\"[^\"]+\"[[:space:]]+") "?")) "?"
+ (rust-re-item-def itype)))
+
(defun rust-looking-back-str (str)
"Return non-nil if there's a match on the text before point and STR.
Like `looking-back' but for fixed strings rather than regexps (so
@@ -713,22 +728,6 @@ buffer."
symbol-end))
(defconst rust-re-pre-expression-operators "[-=!%&*/:<>[{(|.^;}]")
-(defun rust-re-item-def (itype)
- (concat (rust-re-word itype)
- (rust-re-shy rust-re-generic) "?"
- "[[:space:]]+" (rust-re-grab rust-re-ident)))
-
-;; TODO some of this does only make sense for `fn' (unsafe, extern...)
-;; and not other items
-(defun rust-re-item-def-imenu (itype)
- (concat "^[[:space:]]*"
- (rust-re-shy (concat rust-re-vis "[[:space:]]+")) "?"
- (rust-re-shy (concat (rust-re-word "default") "[[:space:]]+")) "?"
- (rust-re-shy (concat (rust-re-shy rust-re-async-or-const)
"[[:space:]]+")) "?"
- (rust-re-shy (concat (rust-re-word rust-re-unsafe) "[[:space:]]+"))
"?"
- (rust-re-shy (concat (rust-re-word rust-re-extern) "[[:space:]]+"
- (rust-re-shy "\"[^\"]+\"[[:space:]]+") "?")) "?"
- (rust-re-item-def itype)))
(defconst rust-re-special-types (regexp-opt rust-special-types 'symbols))
- [nongnu] elpa/rust-mode 9e03890 478/486: Create rust-compile.el from existing code, (continued)
- [nongnu] elpa/rust-mode 9e03890 478/486: Create rust-compile.el from existing code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 41642f0 481/486: rust-end-of-string: Move definition, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d548425 483/486: Create rust-playpen.el from existing code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode eb5270b 437/486: rust-before-save-hook: log errors., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 2df6cf7 439/486: Don't fail on re-search-forward. (#359), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ca415e9 470/486: Add rust-check function, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode e327658 274/486: Merge pull request #178 from ryuslash/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7e2533f 415/486: Fix rustc-compilation-regexps: match error messages with dashes. (#331), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9107989 424/486: review, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d0f3f45 431/486: imenu: fn items: match async/const and all pub variants. (#346), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7afad7b 464/486: rearrange II: Regexp variables and functions,
ELPA Syncer <=
- [nongnu] elpa/rust-mode bbb3792 473/486: Remove "-face" suffix from names of faces, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 3eb6d2f 485/486: Create rust-utils.el from existing code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode b81c723 467/486: Various cosmetic changes, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 1f8a763 446/486: Fix typos, ELPA Syncer, 2021/08/07