[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/zig-mode 859a4dc 071/104: Use rx macro and add more possib
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/zig-mode 859a4dc 071/104: Use rx macro and add more possibilities for type annotations |
Date: |
Sun, 29 Aug 2021 11:37:05 -0400 (EDT) |
branch: elpa/zig-mode
commit 859a4dc4b71c6556bd3fadf61e0239ae72360aa2
Author: joachimschmidt557 <joachim.schmidt557@outlook.com>
Commit: joachimschmidt557 <joachim.schmidt557@outlook.com>
Use rx macro and add more possibilities for type annotations
---
zig-mode.el | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/zig-mode.el b/zig-mode.el
index f3b4c14..44e1179 100644
--- a/zig-mode.el
+++ b/zig-mode.el
@@ -128,23 +128,24 @@ If given a SOURCE, execute the CMD on it."
(compilation-mode))
(revert-buffer :ignore-auto :noconfirm)))))))
-(defun zig-re-word (inner)
- "Construct a regular expression for the word INNER."
- (concat "\\<" inner "\\>"))
+(defconst zig-re-identifier
+ (rx (any "_" word)
+ (* (any "_" word digit))))
-(defun zig-re-grab (inner)
- "Construct a group regular expression for INNER."
- (concat "\\(" inner "\\)"))
+(defconst zig-re-type
+ (rx (* (| "?" "[_]" "*" "[]"))
+ (regexp zig-re-identifier)))
-(defconst zig-re-identifier "[[:word:]_][[:word:]_[:digit:]]*")
(defconst zig-re-type-annotation
- (concat (zig-re-grab zig-re-identifier)
- "[[:space:]]*:[[:space:]]*"
- (zig-re-grab zig-re-identifier)))
+ (rx (group (regexp zig-re-identifier))
+ (* (any space)) ":" (* (any space))
+ (group (regexp zig-re-type))))
(defun zig-re-definition (dtype)
"Construct a regular expression for definitions of type DTYPE."
- (concat (zig-re-word dtype) "[[:space:]]+" (zig-re-grab zig-re-identifier)))
+ (rx bow (literal dtype) eow
+ (+ (any space))
+ (group (regexp zig-re-identifier))))
(defconst zig-mode-syntax-table
(let ((table (make-syntax-table)))
@@ -383,10 +384,10 @@ If given a SOURCE, execute the CMD on it."
;;; Imenu support
(defun zig-re-structure-def-imenu (stype)
"Construct a regular expression for strucutres definitions of type STYPE."
- (concat (zig-re-word "const") "[[:space:]]+"
- (zig-re-grab zig-re-identifier)
- ".*"
- (zig-re-word stype)))
+ (rx bow "const" eow (+ (any space))
+ (group (regexp zig-re-identifier))
+ (* not-newline)
+ bow (literal stype) eow))
(defvar zig-imenu-generic-expression
(append (mapcar (lambda (x)
- [nongnu] elpa/zig-mode ff0bc79 006/104: Full symbols., (continued)
- [nongnu] elpa/zig-mode ff0bc79 006/104: Full symbols., ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 814657c 018/104: Update syntax, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode a4f1e11 022/104: Just disable syntactic indentation (it's broken), ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 51a99d1 023/104: Add alternate install instructions to the README (#9), ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode cb485ff 034/104: Added anyerror keyword, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 1f4ebf1 035/104: section -> linksection, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 3cac32b 040/104: Drop #' since it's redundant, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode ab655a9 043/104: Add Commentary, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 1552e0e 058/104: Merge pull request #20 from mgxm/feat/add_zig_cli_integration, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 9d5b439 052/104: replace stdcallcc and nakedcc with callconv, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 859a4dc 071/104: Use rx macro and add more possibilities for type annotations,
ELPA Syncer <=
- [nongnu] elpa/zig-mode f28e0fa 067/104: var has been changed to anytype, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 9ca6876 072/104: Quote arguments passed to zig via the compile function, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 87841c7 082/104: fix broken multiline string highlighting, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 0c23862 003/104: Aestethics., ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode c298f91 019/104: Updated to latest keywords, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 4232704 013/104: Rewritten from scratch for better syntax highlighting., ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 87f4f16 038/104: Escape ) and ] to avoding breaking Emacs Lisp syntax table, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode a716bdd 041/104: Require Emacs v24.3 for setq-local, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode ef59edd 042/104: Prefer Homepage to URL, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 77202ac 044/104: update syntax keywords, ELPA Syncer, 2021/08/29