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

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

[nongnu] elpa/scala-mode a1ff6f3 202/217: feat: add Scala 3 keywords


From: ELPA Syncer
Subject: [nongnu] elpa/scala-mode a1ff6f3 202/217: feat: add Scala 3 keywords
Date: Sun, 29 Aug 2021 11:31:12 -0400 (EDT)

branch: elpa/scala-mode
commit a1ff6f38b6d5e3585ade3d466cdd6cc147ba7436
Author: Keith Pinson <keith.pinson@banno.com>
Commit: Keith Pinson <keith.pinson@banno.com>

    feat: add Scala 3 keywords
    
    Based on [the docs](https://dotty.epfl.ch/docs/internals/syntax.html).
    
    1. Scala 3 is not perfectly backwards compatible, but is significantly 
backwards
       compatible, with Scala 2. Therefore, it seems reasonable at a syntax 
level to
       begin with the assumption that they are sufficiently compatible that we 
can
       just start migrating towards the grammar of Scala 3.
    2. Scala 3 has reserved more keywords. Arguably it's a benefit, even if you 
are
       writing Scala 2 code, to be made aware of the Scala 3 keywords by way of
       syntax highlighting. That way you have an opportunity to rename your
       variables before ever upgrading to 3.
    3. The lack of highlighting new keywords is probably the most obvious lack 
of
       highlighting w.r.t. to the new syntax; i.e., this is a "do 20%, get 80%"
       scenario.
    
    Overall this seems to me like a fairly simple and safe step toward adopting
    Scala 3 syntax.
---
 scala-mode-syntax.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/scala-mode-syntax.el b/scala-mode-syntax.el
index 1817868..6d65008 100644
--- a/scala-mode-syntax.el
+++ b/scala-mode-syntax.el
@@ -283,11 +283,12 @@
   (concat "\\(^\\|[^`'_]\\)\\(" scala-syntax:value-keywords-unsafe-re "\\)"))
 
 (defconst scala-syntax:other-keywords-unsafe-re
-  (regexp-opt '("abstract" "case" "catch" "class" "def" "do" "else" "extends"
-                "final" "finally" "for" "forSome" "if" "implicit" "import"
-                "lazy" "match" "new" "object" "override" "package" "private"
-                "protected" "return" "sealed" "throw" "trait" "try" "type"
-                "val" "var" "while" "with" "yield" "inline") 'words))
+  (regexp-opt '("abstract" "case" "catch" "class" "def" "do" "else" "enum"
+                "export" "extends" "final" "finally" "for" "given" "forSome"
+                "if" "implicit" "import" "lazy" "match" "new" "object"
+                "override" "package" "private" "protected" "return" "sealed"
+                "then" "throw" "trait" "try" "type" "val" "var" "while"
+                "with" "yield" "inline") 'words))
 
 (defconst scala-syntax:other-keywords-re
   (concat "\\(^\\|[^`'_]\\)\\(" scala-syntax:other-keywords-unsafe-re "\\)"))



reply via email to

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