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
6 changes: 6 additions & 0 deletions ace-modes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,12 @@ declare module "ace-code/src/mode/erlang" {
declare module "ace-code/src/mode/erlang_highlight_rules" {
export const ErlangHighlightRules: new () => import(".").Ace.HighlightRules;
}
declare module "ace-code/src/mode/flix" {
export const Mode: new () => import(".").Ace.SyntaxMode;
}
declare module "ace-code/src/mode/flix_highlight_rules" {
export const FlixHighlightRules: new () => import(".").Ace.HighlightRules;
}
declare module "ace-code/src/mode/forth" {
export const Mode: new () => import(".").Ace.SyntaxMode;
}
Expand Down
35 changes: 35 additions & 0 deletions demo/kitchen-sink/docs/flix.flix
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
}
}
1 change: 1 addition & 0 deletions src/ext/modelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ var supportedModes = {
Elixir: ["ex|exs"],
Elm: ["elm"],
Erlang: ["erl|hrl"],
Flix: ["flix"],
Forth: ["frt|fs|ldr|fth|4th"],
Fortran: ["f|f90"],
FSharp: ["fsi|fs|ml|mli|fsx|fsscript"],
Expand Down
293 changes: 293 additions & 0 deletions src/mode/_test/tokens_flix.json
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"]
]]
16 changes: 16 additions & 0 deletions src/mode/flix.js
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;
Loading