-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I inlined usages of Chars since that part of scalameta is internal and not checked, so better to have these few small methods inside Metals. I also updated scalafix to latest snapshot to avoid OOM
- Loading branch information
Showing
10 changed files
with
57 additions
and
27 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
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
27 changes: 27 additions & 0 deletions
27
mtags/src/main/scala/scala/meta/internal/mtags/Chars.scala
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,27 @@ | ||
package scala.meta.internal.mtags | ||
|
||
object Chars { | ||
final val LF = '\u000A' | ||
final val FF = '\u000C' | ||
final val CR = '\u000D' | ||
final val SU = '\u001A' | ||
|
||
/** | ||
* Convert a character digit to an Int according to given base, -1 if no success | ||
*/ | ||
def digit2int(ch: Int, base: Int): Int = { | ||
val num = | ||
( | ||
if (ch <= '9') ch - '0' | ||
else if ('a' <= ch && ch <= 'z') ch - 'a' + 10 | ||
else if ('A' <= ch && ch <= 'Z') ch - 'A' + 10 | ||
else -1 | ||
) | ||
if (0 <= num && num < base) num else -1 | ||
} | ||
|
||
/** Can character form part of an alphanumeric Scala identifier? */ | ||
def isIdentifierPart(c: Int): Boolean = | ||
(c == '$') || Character.isUnicodeIdentifierPart(c) | ||
|
||
} |
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
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