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

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

[nongnu] elpa/julia-mode 46d2469 272/352: Merge pull request #39 from rf


From: ELPA Syncer
Subject: [nongnu] elpa/julia-mode 46d2469 272/352: Merge pull request #39 from rfourquet/rf/where
Date: Sun, 29 Aug 2021 11:23:00 -0400 (EDT)

branch: elpa/julia-mode
commit 46d2469c408888cfeeec27904116cfc22ceb1461
Merge: 04b97c4 c4a75b4
Author: Yichao Yu <yyc1992@gmail.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #39 from rfourquet/rf/where
    
    add support for `where` keyword
---
 julia-mode-tests.el | 26 +++++++++++++++++++++++---
 julia-mode.el       |  5 ++---
 2 files changed, 25 insertions(+), 6 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..737e44a 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -229,14 +229,13 @@ This function provides equivalent functionality, but 
makes no efforts to optimis
   (rx line-start (* (or space "@inline" "@noinline")) symbol-start
       (* (seq (1+ (or word (syntax symbol))) ".")) ; module name
       (group (1+ (or word (syntax symbol))))
-      (* space)
       (? "{" (* (not (any "}"))) "}")
-      (* space)
       "(" (* (or
               (seq "(" (* (not (any "(" ")"))) ")")
               (not (any "(" ")"))))
       ")"
       (* space)
+      (* (seq "where" (or "{" (+ space)) (+ (not (any "=")))))
       "="
       (not (any "="))))
 
@@ -261,7 +260,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]