Skip to content
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 Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# To pick up grammar changes, bump the SHA below and run `make update-grammar`.
# The refreshed grammar lands in the working tree, where a partial or wrong
# download shows up as a diff before it can be committed.
GRAMMAR_COMMIT := befa883ecec4b0c84e436bdd176dec5475e584ab
GRAMMAR_COMMIT := f4d05bbfcd34342f76bcf135f7ae58ab7cd2dd58
GRAMMAR := syntaxes/flix.tmLanguage.json

.PHONY: build-site serve update-grammar
Expand Down
10 changes: 7 additions & 3 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ enabled = true
style = "class"
# The theme decides both the colours and -- since each span is named after the
# theme rule that matched it, not after the grammar scope -- how finely the code
# is split up. Catppuccin is the family tabi's own syntax stylesheet was derived
# from; Mocha is its darkest member, near the value tabi gave code blocks before.
theme = "catppuccin-mocha"
# is split up. Two things are worth checking in a candidate, because neither is
# visible from a screenshot of some other language: that no scope the Flix grammar
# emits resolves back to the plain-text foreground, which is how Dracula renders
# strings and Laserwave keywords -- unhighlighted, but only for grammars that lean
# on that scope -- and that comments clear 3:1 against the code background, which
# a fair number of the darker themes do not.
theme = "rose-pine-moon"
# The Flix grammar is not built in; `make` fetches it from flix/textmate.
extra_grammars = ["syntaxes/flix.tmLanguage.json"]

Expand Down
70 changes: 51 additions & 19 deletions syntaxes/flix.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
{
"include": "#constants"
},
{
"include": "#declarations"
},
{
"include": "#keywords"
},
Expand All @@ -33,6 +36,9 @@
{
"include": "#annotations"
},
{
"include": "#functions"
},
{
"include": "#types"
},
Expand All @@ -45,7 +51,7 @@
"patterns": [
{
"name": "constant.language.unit.flix",
"match": "\\b\\(\\)\\b"
"match": "(?<![a-zA-Z0-9_!])\\(\\)"
},
{
"name": "constant.language.bool.flix",
Expand Down Expand Up @@ -73,16 +79,27 @@
}
]
},
"declarations": {
"patterns": [
{
"match": "\\b(def|redef)\\s+([a-z][a-zA-Z0-9_]*!?)",
"captures": {
"1": {
"name": "keyword.declaration.flix"
},
"2": {
"name": "entity.name.function.flix"
}
}
}
]
},
"keywords": {
"patterns": [
{
"name": "keyword.control.choose.flix",
"match": "\\b(choose\\*|choose)\\b"
},
{
"name": "keyword.control.debug.flix",
"match": "\\b(dbg)\\b"
},
{
"name": "keyword.control.applicativefor.flix",
"match": "\\b(forA)\\b"
Expand All @@ -109,16 +126,12 @@
},
{
"name": "keyword.control.match.flix",
"match": "\\b(case|match|typematch|ematch)\\b"
"match": "\\b(case|match|ematch)\\b"
},
{
"name": "keyword.control.run.flix",
"match": "\\b(run)\\b"
},
{
"name": "keyword.control.resume.flix",
"match": "\\b(resume)\\b"
},
{
"name": "keyword.control.throw.flix",
"match": "\\b(throw)\\b"
Expand All @@ -139,10 +152,6 @@
"name": "keyword.control.unsafe.flix",
"match": "\\b(unsafe)\\b"
},
{
"name": "keyword.control.ast.flix",
"match": "\\b(branch|jumpto)\\b"
},
{
"name": "keyword.forall.flix",
"match": "\\b(forall)\\b"
Expand All @@ -161,7 +170,7 @@
},
{
"name": "keyword.declaration.flix",
"match": "\\b(eff|def|redef|law|enum|case|type|alias|trait|instance|with|without|opaque|mod|struct|handler|xvar)\\b"
"match": "\\b(eff|def|redef|enum|type|alias|trait|instance|with|mod|struct)\\b"
},
{
"name": "keyword.expression.cast.flix",
Expand Down Expand Up @@ -228,8 +237,12 @@
"match": ";"
},
{
"name": "storage.type.modifier.flix",
"match": "\\b(lawful|pub|sealed|static)\\b"
"name": "variable.language.super.flix",
"match": "\\b(super)\\b"
},
{
"name": "storage.modifier.flix",
"match": "\\b(pub|sealed|static)\\b"
}
]
},
Expand Down Expand Up @@ -335,11 +348,30 @@
}
]
},
"functions": {
"patterns": [
{
"match": "\\b([A-Z][a-zA-Z0-9_]*)\\.([a-z][a-zA-Z0-9_]*!?)",
"captures": {
"1": {
"name": "entity.name.type.flix"
},
"2": {
"name": "support.function.flix"
}
}
},
{
"name": "entity.name.function.flix",
"match": "\\b[a-z][a-zA-Z0-9_]*!?(?=\\s*\\()"
}
]
},
"types": {
"patterns": [
{
"name": "entity.name.type",
"match": "\\b(Unit|Bool|Char|Float32|Float64|Int8|Int16|Int32|Int64|BigInt|String)\\b"
"name": "entity.name.type.flix",
"match": "\\b[A-Z][a-zA-Z0-9_]*\\b"
}
]
},
Expand Down