-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enh(scala) add Scala 3 end soft keyword
Add Scala 3 end of definition or expression. Simplified verion of /~https://github.com/scala/vscode-scala-syntax/blob/main/src/typescript/Scala.tmLanguage.ts#L599-L634. Here we only need one kind of keyword.
- Loading branch information
1 parent
bb1fa64
commit 8f2895d
Showing
4 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">foo</span> </span>= | ||
<span class="hljs-keyword">if</span> (<span class="hljs-literal">true</span>) | ||
() | ||
<span class="hljs-keyword">else</span> | ||
() | ||
<span class="hljs-keyword">end</span> <span class="hljs-keyword">if</span> | ||
|
||
<span class="hljs-keyword">while</span> <span class="hljs-literal">true</span> <span class="hljs-keyword">do</span> | ||
() | ||
<span class="hljs-keyword">end</span> <span class="hljs-keyword">while</span> | ||
|
||
<span class="hljs-keyword">for</span> x <- xs <span class="hljs-keyword">do</span> | ||
() | ||
<span class="hljs-keyword">end</span> <span class="hljs-keyword">for</span> | ||
|
||
x <span class="hljs-keyword">match</span> | ||
<span class="hljs-keyword">case</span> _ => | ||
<span class="hljs-keyword">end</span> <span class="hljs-keyword">match</span> | ||
<span class="hljs-keyword">end</span> foo | ||
|
||
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">bar</span> </span>= | ||
<span class="hljs-keyword">new</span> <span class="hljs-type">Foo</span>: | ||
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span> </span>= () | ||
<span class="hljs-keyword">end</span> <span class="hljs-keyword">new</span> | ||
<span class="hljs-keyword">end</span> | ||
|
||
<span class="hljs-keyword">val</span> baz = | ||
() | ||
<span class="hljs-keyword">end</span> <span class="hljs-keyword">val</span> | ||
|
||
<span class="hljs-keyword">var</span> baz2 = | ||
() | ||
<span class="hljs-keyword">end</span> <span class="hljs-keyword">var</span> | ||
|
||
<span class="hljs-keyword">extension</span> (x: <span class="hljs-type">Int</span>) | ||
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span> </span>= <span class="hljs-number">1</span> | ||
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span> </span>= <span class="hljs-number">2</span> | ||
<span class="hljs-keyword">end extension</span> | ||
|
||
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Foo</span></span>: | ||
<span class="hljs-keyword">end</span> <span class="hljs-type">Foo</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
def foo = | ||
if (true) | ||
() | ||
else | ||
() | ||
end if | ||
|
||
while true do | ||
() | ||
end while | ||
|
||
for x <- xs do | ||
() | ||
end for | ||
|
||
x match | ||
case _ => | ||
end match | ||
end foo | ||
|
||
def bar = | ||
new Foo: | ||
def f = () | ||
end new | ||
end | ||
|
||
val baz = | ||
() | ||
end val | ||
|
||
var baz2 = | ||
() | ||
end var | ||
|
||
extension (x: Int) | ||
def f = 1 | ||
def f = 2 | ||
end extension | ||
|
||
class Foo: | ||
end Foo |