-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add syntax highlighting for Flix (#5356)
* Add mode for Flix language * Add Flix example to kitchen-sink * Add highlighting for Flix * Support highlighting of Flix holes * Remove `rel` and `lat` keywords from Flix * Add tests for Flix
- Loading branch information
1 parent
4fff99e
commit 1d06017
Showing
6 changed files
with
503 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/// Mooo's `n` times on channel `c`. | ||
def mooo(tx: Sender[String, r], n: Int32): Unit \ IO = | ||
match n { | ||
case 0 => () | ||
case x => Channel.send("Mooo!", tx); mooo(tx, x - 1) | ||
} | ||
|
||
/// Meow's `n` times on channel `c`. | ||
def meow(tx: Sender[String, r], n: Int32): Unit \ IO = | ||
match n { | ||
case 0 => () | ||
case x => Channel.send("Meow!", tx); meow(tx, x - 1) | ||
} | ||
|
||
/// Hiss'es `n` times on channel `c`. | ||
def hiss(tx: Sender[String, r], n: Int32): Unit \ IO = | ||
match n { | ||
case 0 => () | ||
case x => Channel.send("Hiss!", tx); hiss(tx, x - 1) | ||
} | ||
|
||
/// Start the animal farm... | ||
def main(): Unit \ IO = region rc { | ||
let (tx1, rx1) = Channel.buffered(rc, 10); | ||
let (tx2, rx2) = Channel.buffered(rc, 10); | ||
let (tx3, rx3) = Channel.buffered(rc, 10); | ||
spawn mooo(tx1, 0) @ rc; | ||
spawn meow(tx2, 3) @ rc; | ||
spawn hiss(tx3, 7) @ rc; | ||
select { | ||
case m <- recv(rx1) => m |> println | ||
case m <- recv(rx2) => m |> println | ||
case m <- recv(rx3) => m |> println | ||
} | ||
} |
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,293 @@ | ||
[[ | ||
"start", | ||
["text", " "] | ||
],[ | ||
"start", | ||
["comment.block", "/* Hello comment */"], | ||
["text", "\n"], | ||
["comment.block", "/* Hello \n comment */"], | ||
["text", "\n"], | ||
["comment.line", "// Hello comment"] | ||
],[ | ||
"start", | ||
["keyword", "use"], | ||
["text", " "], | ||
["identifier", "Add"], | ||
["text", "."], | ||
["identifier", "add"] | ||
],[ | ||
"start", | ||
["storage.type", "mod"], | ||
["text", " "], | ||
["paren.lparen", "{"], | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "Int32"], | ||
["text", " = "], | ||
["constant.numeric", "42"], | ||
["paren.rparen", "}"] | ||
],[ | ||
"start", | ||
["storage.type", "class"], | ||
["text", " "], | ||
["identifier", "Add"], | ||
["paren.lparen", "["], | ||
["identifier", "a"], | ||
["paren.rparen", "]"], | ||
["text", " "], | ||
["paren.lparen", "{"], | ||
["paren.rparen", "}"] | ||
],[ | ||
"start", | ||
["storage.type", "enum"], | ||
["text", " "], | ||
["identifier", "Down"], | ||
["paren.lparen", "["], | ||
["identifier", "a"], | ||
["paren.rparen", "]"], | ||
["text", " "], | ||
["storage.modifier", "with"], | ||
["text", " "], | ||
["identifier", "Sendable"], | ||
["text", " "], | ||
["paren.lparen", "{"], | ||
["storage.type", "case"], | ||
["text", " "], | ||
["identifier", "Down"], | ||
["paren.lparen", "("], | ||
["identifier", "a"], | ||
["paren.rparen", ")}"] | ||
],[ | ||
"start", | ||
["storage.type", "eff"], | ||
["text", " "], | ||
["identifier", "NonDet"] | ||
],[ | ||
"start", | ||
["storage.type", "type"], | ||
["text", " "], | ||
["storage.type", "alias"], | ||
["text", " "], | ||
["identifier", "Static"], | ||
["text", " = "], | ||
["identifier", "Impure"] | ||
],[ | ||
"start", | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "Int32"], | ||
["text", " = "], | ||
["paren.lparen", "{"], | ||
["constant.numeric", "42"], | ||
["paren.rparen", "}"] | ||
],[ | ||
"start", | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "Float64"], | ||
["text", " = "], | ||
["keyword.control", "if"], | ||
["paren.lparen", "("], | ||
["constant.language.boolean", "true"], | ||
["paren.rparen", ")"], | ||
["paren.lparen", "{"], | ||
["constant.numeric", "42.0"], | ||
["paren.rparen", "}"], | ||
["keyword.control", "else"], | ||
["paren.lparen", "{"], | ||
["constant.numeric", "43.0"], | ||
["paren.rparen", "}"] | ||
],[ | ||
"start", | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "String"], | ||
["text", " = "], | ||
["string", "\"Hello"], | ||
["constant.character.escape", "\\\""], | ||
["string", "World"], | ||
["constant.character.escape", "\\u0021"], | ||
["string", "\""] | ||
],[ | ||
"start", | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "Char"], | ||
["text", " = "], | ||
["constant.character", "'a'"] | ||
],[ | ||
"start", | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "Char"], | ||
["text", " = "], | ||
["constant.character", "'"], | ||
["constant.character.escape", "\\u0021"], | ||
["constant.character", "'"] | ||
],[ | ||
"start", | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "Char"], | ||
["text", " = "], | ||
["constant.character", "'"], | ||
["constant.character.escape", "\\'"], | ||
["constant.character", "'"] | ||
],[ | ||
"start", | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["identifier", "Regex"], | ||
["text", " = "], | ||
["string.regexp", "regex\"Hello"], | ||
["constant.character.escape", "\\\""], | ||
["string.regexp", "World"], | ||
["constant.character.escape", "\\u0021"], | ||
["string.regexp", "\""] | ||
],[ | ||
"start", | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "String"], | ||
["text", " = "], | ||
["keyword", "???"] | ||
],[ | ||
"start", | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "String"], | ||
["text", " = "], | ||
["keyword", "?someHole"] | ||
],[ | ||
"start", | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "Int32"], | ||
["text", " = "], | ||
["constant.numeric", "0x123i32"] | ||
],[ | ||
"start", | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "Int32"], | ||
["text", " = "], | ||
["constant.numeric", "42i32"] | ||
],[ | ||
"start", | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "Float64"], | ||
["text", " = "], | ||
["constant.numeric", "42.0f64"] | ||
],[ | ||
"start", | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "Bool"], | ||
["text", " = "], | ||
["constant.language.boolean", "true"] | ||
],[ | ||
"start", | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "Bool"], | ||
["text", " = "], | ||
["constant.language.boolean", "false"] | ||
],[ | ||
"start", | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["identifier", "Null"], | ||
["text", " = "], | ||
["constant.language", "null"] | ||
],[ | ||
"start", | ||
["storage.modifier", "@Lazy"], | ||
["text", "\n"], | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "Int32"], | ||
["text", " = "], | ||
["constant.numeric", "42"] | ||
],[ | ||
"start", | ||
["storage.modifier", "pub"], | ||
["text", " "], | ||
["storage.type", "def"], | ||
["text", " "], | ||
["identifier", "main"], | ||
["paren.lparen", "("], | ||
["paren.rparen", ")"], | ||
["text", ": "], | ||
["support.type", "Int32"], | ||
["text", " = "], | ||
["constant.numeric", "42"] | ||
]] |
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,16 @@ | ||
"use strict"; | ||
|
||
var oop = require("../lib/oop"); | ||
var TextMode = require("./text").Mode; | ||
var FlixHighlightRules = require("./flix_highlight_rules").FlixHighlightRules; | ||
|
||
var Mode = function() { | ||
this.HighlightRules = FlixHighlightRules; | ||
}; | ||
oop.inherits(Mode, TextMode); | ||
|
||
(function() { | ||
this.$id = "ace/mode/flix"; | ||
}).call(Mode.prototype); | ||
|
||
exports.Mode = Mode; |
Oops, something went wrong.