Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Scala keywords to support Scala 3 #3506

Merged
merged 3 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.