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

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

[nongnu] elpa/julia-mode c718e8c 145/352: Use regexp-opt for keyword and


From: ELPA Syncer
Subject: [nongnu] elpa/julia-mode c718e8c 145/352: Use regexp-opt for keyword and constant regexps, because it outputs
Date: Sun, 29 Aug 2021 11:22:33 -0400 (EDT)

branch: elpa/julia-mode
commit c718e8c24368ded1b03c40fbebca3c2eadcdd260
Author: Wilfred Hughes <me@wilfred.me.uk>
Commit: Yichao Yu <yyc1992@gmail.com>

    Use regexp-opt for keyword and constant regexps, because it outputs
    regexps that are more efficient.
---
 julia-mode.el | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/julia-mode.el b/julia-mode.el
index fea11dd..85488ec 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -85,21 +85,27 @@
 (defconst julia-type-regex
   (rx symbol-start "type" (1+ space) (group (1+ (or word ?_)))))
 
+(defconst julia-macro-regex
+  "@\\w+")
+
+(defconst julia-keyword-regex
+  (regexp-opt
+   '("if" "else" "elseif" "while" "for" "begin" "end" "quote"
+     "try" "catch" "return" "local" "abstract" "function" "macro" "ccall"
+     "finally" "typealias" "break" "continue" "type" "global"
+     "module" "using" "import" "export" "const" "let" "bitstype" "do"
+     "baremodule" "importall" "immutable")))
+
 (defconst julia-font-lock-keywords
-  (list 
'("\\<\\(\\|Uint\\(8\\|16\\|32\\|64\\|128\\)\\|Int\\(8\\|16\\|32\\|64\\|128\\)\\|BigInt\\|Integer\\|BigFloat\\|FloatingPoint\\|Float16\\|Float32\\|Float64\\|Complex128\\|Complex64\\|ComplexPair\\|Bool\\|Char\\|DataType\\|Number\\|Real\\|Int\\|Uint\\|Array\\|DArray\\|AbstractArray\\|AbstractVector\\|AbstractMatrix\\|AbstractSparseMatrix\\|SubArray\\|StridedArray\\|StridedVector\\|StridedMatrix\\|VecOrMat\\|StridedVecOrMat\\|DenseArray\\|Range\\|OrdinalRange\\|StepRange\\|UnitRange
 [...]
-      font-lock-type-face)
+  (list
+   
'("\\<\\(\\|Uint\\(8\\|16\\|32\\|64\\|128\\)\\|Int\\(8\\|16\\|32\\|64\\|128\\)\\|BigInt\\|Integer\\|BigFloat\\|FloatingPoint\\|Float16\\|Float32\\|Float64\\|Complex128\\|Complex64\\|ComplexPair\\|Bool\\|Char\\|DataType\\|Number\\|Real\\|Int\\|Uint\\|Array\\|DArray\\|AbstractArray\\|AbstractVector\\|AbstractMatrix\\|AbstractSparseMatrix\\|SubArray\\|StridedArray\\|StridedVector\\|StridedMatrix\\|VecOrMat\\|StridedVecOrMat\\|DenseArray\\|Range\\|OrdinalRange\\|StepRange\\|UnitRange\\|Fl
 [...]
+     font-lock-type-face)
+    (cons julia-keyword-regex 'font-lock-keyword-face)
+    (cons julia-macro-regex 'font-lock-keyword-face)
     (cons
-     (concat "\\<\\("
-         (mapconcat
-          'identity
-          '("if" "else" "elseif" "while" "for" "begin" "end" "quote"
-            "try" "catch" "return" "local" "abstract" "function" "macro" 
"ccall"
-           "finally" "typealias" "break" "continue" "type" "global" "@\\w+"
-           "module" "using" "import" "export" "const" "let" "bitstype" "do"
-           "baremodule" "importall" "immutable")
-          "\\|") "\\)\\>")
-     'font-lock-keyword-face)
-    
'("\\<\\(true\\|false\\|C_NULL\\|Inf\\|NaN\\|Inf32\\|NaN32\\|nothing\\)\\>" . 
font-lock-constant-face)
+     (regexp-opt
+      '("true" "false" "C_NULL" "Inf" "NaN" "Inf32" "NaN32" "nothing"))
+     'font-lock-constant-face)
     (list julia-unquote-regex 2 'font-lock-constant-face)
     (list julia-char-regex 2 'font-lock-string-face)
     (list julia-forloop-in-regex 1 'font-lock-keyword-face)



reply via email to

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