Skip to content

Commit

Permalink
Scala: Updated keywords to support Scala 3 (#3506)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrf authored Jul 26, 2022
1 parent b9512b2 commit a090d06
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 19 deletions.
2 changes: 1 addition & 1 deletion components/prism-scala.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Prism.languages.scala = Prism.languages.extend('java', {
pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
'keyword': /<-|=>|\b(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|null|object|override|package|private|protected|return|sealed|self|super|this|throw|trait|try|type|val|var|while|with|yield)\b/,
'keyword': /<-|=>|\b(?:abstract|case|catch|class|def|derives|do|else|enum|extends|extension|final|finally|for|forSome|given|if|implicit|import|infix|inline|lazy|match|new|null|object|opaque|open|override|package|private|protected|return|sealed|self|super|this|throw|trait|transparent|try|type|using|val|var|while|with|yield)\b/,
'number': /\b0x(?:[\da-f]*\.)?[\da-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e\d+)?[dfl]?/i,
'builtin': /\b(?:Any|AnyRef|AnyVal|Boolean|Byte|Char|Double|Float|Int|Long|Nothing|Short|String|Unit)\b/,
'symbol': /'[^\d\s\\]\w*/
Expand Down
2 changes: 1 addition & 1 deletion components/prism-scala.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

90 changes: 73 additions & 17 deletions tests/languages/scala/keyword_feature.test
Original file line number Diff line number Diff line change
@@ -1,35 +1,91 @@
<- =>

abstract case catch
class def do else
extends final finally
for forSome if
implicit import; lazy
class def derives do
else enum extends extension
final finally
for forSome given if
implicit import;
infix inline lazy
match new null object
opaque open
override package private
protected return sealed
self super this throw
trait try type val
trait transparent try
type using val
var while with yield

----------------------------------------------------

[
["keyword", "<-"], ["keyword", "=>"],

["keyword", "abstract"], ["keyword", "case"], ["keyword", "catch"],
["keyword", "class"], ["keyword", "def"], ["keyword", "do"], ["keyword", "else"],
["keyword", "extends"], ["keyword", "final"], ["keyword", "finally"],
["keyword", "for"], ["keyword", "forSome"], ["keyword", "if"],
["keyword", "implicit"], ["keyword", "import"], ["punctuation", ";"], ["keyword", "lazy"],
["keyword", "match"], ["keyword", "new"], ["keyword", "null"], ["keyword", "object"],
["keyword", "override"], ["keyword", "package"], ["keyword", "private"],
["keyword", "protected"], ["keyword", "return"], ["keyword", "sealed"],
["keyword", "self"], ["keyword", "super"], ["keyword", "this"], ["keyword", "throw"],
["keyword", "trait"], ["keyword", "try"], ["keyword", "type"], ["keyword", "val"],
["keyword", "var"], ["keyword", "while"], ["keyword", "with"], ["keyword", "yield"]
["keyword", "abstract"],
["keyword", "case"],
["keyword", "catch"],

["keyword", "class"],
["keyword", "def"],
["keyword", "derives"],
["keyword", "do"],

["keyword", "else"],
["keyword", "enum"],
["keyword", "extends"],
["keyword", "extension"],

["keyword", "final"],
["keyword", "finally"],

["keyword", "for"],
["keyword", "forSome"],
["keyword", "given"],
["keyword", "if"],

["keyword", "implicit"],
["keyword", "import"],
["punctuation", ";"],

["keyword", "infix"],
["keyword", "inline"],
["keyword", "lazy"],

["keyword", "match"],
["keyword", "new"],
["keyword", "null"],
["keyword", "object"],

["keyword", "opaque"],
["keyword", "open"],

["namespace", ["override"]],
["keyword", "package"],
["keyword", "private"],

["keyword", "protected"],
["keyword", "return"],
["keyword", "sealed"],

["keyword", "self"],
["keyword", "super"],
["keyword", "this"],
["keyword", "throw"],

["keyword", "trait"],
["keyword", "transparent"],
["keyword", "try"],

["keyword", "type"],
["keyword", "using"],
["keyword", "val"],

["keyword", "var"],
["keyword", "while"],
["keyword", "with"],
["keyword", "yield"]
]

----------------------------------------------------

Checks for keywords.
Checks for keywords.

0 comments on commit a090d06

Please sign in to comment.