emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/nix-mode e744c602fd 304/500: Replace regex operations with


From: ELPA Syncer
Subject: [nongnu] elpa/nix-mode e744c602fd 304/500: Replace regex operations with faster alternatives in the lexer.
Date: Sat, 29 Jan 2022 08:27:16 -0500 (EST)

branch: elpa/nix-mode
commit e744c602fdcb505021d36f00238a1c09ab6f8bc2
Author: Jakub Piecuch <j.piecuch96@gmail.com>
Commit: Jakub Piecuch <j.piecuch96@gmail.com>

    Replace regex operations with faster alternatives in the lexer.
---
 nix-mode.el | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/nix-mode.el b/nix-mode.el
index c08ca91e24..ffdbcb1477 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -401,9 +401,7 @@ STRING-TYPE type of string based off of Emacs syntax table 
types"
        (right " -bseqskip- ")
        (left " -fseqskip- "))))))
 
-(defconst nix-smie--symbols-re
-  (regexp-opt '(":" "->" "||" "&&" "==" "!=" "<" "<=" ">" ">="
-     "//" "-" "+" "*" "/" "++" "?" "=" "," ";" "!")))
+(defconst nix-smie--symbol-chars ":->|&=!</-+*?,;!")
 
 (defconst nix-smie--infix-symbols-re
   (regexp-opt '(":" "->" "||" "&&" "==" "!=" "<" "<=" ">" ">="
@@ -516,8 +514,8 @@ STRING-TYPE type of string based off of Emacs syntax table 
types"
        (point)
        (progn
          (or (/= 0 (skip-syntax-forward "'w_"))
-             (and (looking-at nix-smie--symbols-re)
-                  (goto-char (match-end 0))))
+             (/= 0 (skip-chars-forward nix-smie--symbol-chars))
+             (skip-syntax-forward ".'"))
          (point)))))
 
 (defun nix-smie--forward-token ()
@@ -536,8 +534,8 @@ STRING-TYPE type of string based off of Emacs syntax table 
types"
        (point)
        (progn
          (or (/= 0 (skip-syntax-backward "'w_"))
-             (and (looking-back nix-smie--symbols-re (- (point) 2) t)
-                  (goto-char (match-beginning 0))))
+             (/= 0 (skip-chars-backward nix-smie--symbol-chars))
+             (skip-syntax-backward ".'"))
          (point)))))
 
 (defun nix-smie--backward-token ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]