[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
- [nongnu] elpa/julia-mode 686bed3 309/352: remove unused lexical args that gave a warning, (continued)
- [nongnu] elpa/julia-mode 686bed3 309/352: remove unused lexical args that gave a warning, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 4515765 320/352: add a changelog (#96), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode bfa54b2 331/352: Minor point about preferring the rx macro for regexs., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 88d7d87 332/352: Merge pull request #121 from JuliaEditorSupport/tp/prefer-rx, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode d91f1d0 324/352: Remove regexp-opt workarounds for Emacs < 24 (#101), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode d69b095 342/352: Removed require statement for auctex that broke prettify. Fixes #99 (#116), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 8ea90c7 347/352: Rec/quoted quote (#143), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 5cccdbd 350/352: Fixed installation documentation (#147), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode fe6f6f7 348/352: Allow block indentation inside of parentheticals (#152), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode b5f5983 346/352: Indent lines after hanging operator even if previous line contains # (#115), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 69bc337 270/352: add support for `where` keyword,
ELPA Syncer <=