-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #133: Highlight inline as a soft keyword
If it is part of an inline `if` or `match` it is highlighted as a control flow keyword. If it is part of a `def` or `val` definition it is highlighted as a declaration keyword. Otherwise, it is not highlighted.
- Loading branch information
1 parent
40dc063
commit 2dd5afd
Showing
2 changed files
with
65 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// SYNTAX TEST "source.scala" | ||
|
||
|
||
inline val c = 0 | ||
// ^^^^^^ storage.modifier.other | ||
|
||
inline def power(x: Double, inline n: Int): Double = | ||
// ^^^^^^ storage.modifier.other | ||
// ^^^^^^ storage.modifier.other | ||
inline if (n == 0) 1.0 | ||
// ^^^^^^ keyword.control.flow.scala | ||
else inline if (n % 2 == 1) x * power(x, n - 1) | ||
// ^^^^^^ keyword.control.flow.scala | ||
else power(x * x, n / 2) | ||
|
||
|
||
inline x match { | ||
// ^^^^^^ keyword.control.flow.scala | ||
// ^^^^^ keyword.control.flow.scala | ||
|
||
|
||
inline def power(x: Double, inline N: Int): Double = | ||
// ^^^^^^ storage.modifier.other | ||
// ^^^^^^ storage.modifier.other | ||
|
||
inline def power(x: Double, inline `n`: Int): Double = | ||
// ^^^^^^ storage.modifier.other | ||
// ^^^^^^ storage.modifier.other | ||
|
||
val x = inline + 2 | ||
// ^^^^^^ - storage.modifier.other keyword.control.flow.scala | ||
val x = inline(x) | ||
// ^^^^^^ - storage.modifier.other keyword.control.flow.scala | ||
val x = inline[T] | ||
// ^^^^^^ - storage.modifier.other keyword.control.flow.scala | ||
|
||
inline def inline(inline inline: Int): Double = | ||
// ^^^^^^ storage.modifier.other | ||
// ^^^^^^ entity.name.function.declaration | ||
// ^^^^^^ storage.modifier.other | ||
// ^^^^^^ variable.parameter.scala |