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

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

[nongnu] elpa/julia-mode 69bc337 270/352: add support for `where` keywor


From: ELPA Syncer
Subject: [nongnu] elpa/julia-mode 69bc337 270/352: add support for `where` keyword
Date: Sun, 29 Aug 2021 11:22:59 -0400 (EDT)

branch: elpa/julia-mode
commit 69bc337c08ea26dd8afa8f31d716feab156b2592
Author: Rafael Fourquet <fourquet.rafael@gmail.com>
Commit: Rafael Fourquet <fourquet.rafael@gmail.com>

    add support for `where` keyword
---
 julia-mode-tests.el | 26 +++++++++++++++++++++++---
 julia-mode.el       |  3 ++-
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/julia-mode-tests.el b/julia-mode-tests.el
index 3a0c8dd..f2320a3 100644
--- a/julia-mode-tests.el
+++ b/julia-mode-tests.el
@@ -246,12 +246,12 @@ qux"))
   (julia--should-indent
      "
 if foo
-        
+
 bar
 end"
      "
 if foo
-    
+
     bar
 end"))
 
@@ -390,7 +390,7 @@ end"))
   "indentation for ( following keywords"
   "if( a>0 )
 end
-    
+
     function( i=1:2 )
         for( j=1:2 )
             for( k=1:2 )
@@ -417,6 +417,26 @@ end")
   (let ((string "function \\(a, b)"))
     (julia--should-font-lock string (1- (length string)) nil)))
 
+(ert-deftest julia--test-function-assignment-font-locking ()
+  (julia--should-font-lock
+   "f(x) = 1" 1 'font-lock-function-name-face)
+  (julia--should-font-lock
+   "Base.f(x) = 1" 6 'font-lock-function-name-face)
+  (julia--should-font-lock
+   "f(x) where T = 1" 1 'font-lock-function-name-face)
+  (julia--should-font-lock
+   "f(x) where{T} = 1" 1 'font-lock-function-name-face))
+
+(ert-deftest julia--test-where-keyword-font-locking ()
+  (julia--should-font-lock
+   "f(x) where T = 1" 6 'font-lock-keyword-face)
+  (dolist (pos '(22 30))
+    (julia--should-font-lock
+     "function f(::T, ::Z) where T where Z
+          1
+      end"
+     pos 'font-lock-keyword-face)))
+
 (defun julia--run-tests ()
   (interactive)
   (if (featurep 'ert)
diff --git a/julia-mode.el b/julia-mode.el
index cd10242..f4b35a9 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -237,6 +237,7 @@ This function provides equivalent functionality, but makes 
no efforts to optimis
               (not (any "(" ")"))))
       ")"
       (* space)
+      (* (seq "where" (or "{" (+ space)) (+ (not (any "=")))))
       "="
       (not (any "="))))
 
@@ -261,7 +262,7 @@ This function provides equivalent functionality, but makes 
no efforts to optimis
   (julia--regexp-opt
    '("if" "else" "elseif" "while" "for" "begin" "end" "quote"
      "try" "catch" "return" "local" "function" "macro" "ccall"
-     "finally" "break" "continue" "global"
+     "finally" "break" "continue" "global" "where"
      "module" "using" "import" "export" "const" "let" "do" "in"
      "baremodule" "importall"
      "immutable" "type" "bitstype" "abstract" "typealias" ;; remove after 0.6



reply via email to

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