From d84b93dc69522d8103e6772da2cbefbd397163ab Mon Sep 17 00:00:00 2001 From: Rohan Vashisht <81112205+RohanVashisht1234@users.noreply.github.com> Date: Mon, 27 May 2024 21:58:03 +0530 Subject: Add `language_bend` (#440) * Create language_bend.lua * Update manifest.json * Update language_bend.lua Co-authored-by: Guldoman * Update manifest.json --------- Co-authored-by: Guldoman --- manifest.json | 13 +++++++++- plugins/language_bend.lua | 65 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 plugins/language_bend.lua diff --git a/manifest.json b/manifest.json index 29490ab..f5bf49a 100644 --- a/manifest.json +++ b/manifest.json @@ -66,6 +66,7 @@ "language_autohotkey_v1": {}, "language_batch": {}, "language_bazel": {}, + "language_bend": {}, "language_bib": {}, "language_blade": {}, "language_blueprint": {}, @@ -165,7 +166,7 @@ "id": "meta_languages", "mod_version": "3", "type": "meta", - "version": "0.1.15" + "version": "0.1.16" }, { "description": "Align multiple carets and selections *([clip](https://user-images.githubusercontent.com/2798487/165631951-532f8d24-d596-4dd0-9d21-ff53c71ed32f.mp4))*", @@ -681,6 +682,16 @@ ], "version": "0.1" }, + { + "description": "Syntax for [Bend](https://higherorderco.com/) programming language files.", + "id": "language_bend", + "mod_version": "3", + "path": "plugins/language_bend.lua", + "tags": [ + "language" + ], + "version": "0.1" + }, { "description": "Syntax for [BibTex](https://en.wikipedia.org/wiki/BibTeX) files", "id": "language_bib", diff --git a/plugins/language_bend.lua b/plugins/language_bend.lua new file mode 100644 index 0000000..5792084 --- /dev/null +++ b/plugins/language_bend.lua @@ -0,0 +1,65 @@ +-- Author: Rohan Vashisht https://github.com/RohanVashisht1234 + +-- mod-version:3 + +local syntax = require "core.syntax" + +syntax.add { + name = "Bend", + files = { "%.bend$" }, + comment = "#", + patterns = { + { pattern = "#.*", type = "comment" }, + { pattern = { '"', '"' }, type = "string" }, + { pattern = { "'", "'" }, type = "string" }, + { pattern = "[%a_][%w_]*%f[(]", type = "function" }, + { pattern = "[%a_][%w_]*", type = "symbol" }, + { pattern = "[%+%-=/%*%^%%<>!|&]", type = "operator" }, + { pattern = "def()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok + { pattern = "data()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok + { pattern = "let()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok + { pattern = "Some()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok + { pattern = "bend()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok + { pattern = "object()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok + { pattern = "fold()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok + { pattern = "open()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok + { pattern = "do()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok + { pattern = "identity()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok + { pattern = "lambda()%s+()[%a_][%w_]*", type = { "keyword", "normal", "literal" } }, -- tested ok + { pattern = "0x[%da-fA-F]+", type = "number" }, + { pattern = "-?%d+[%d%.eE]*", type = "number" }, + { pattern = "-?%.?%d+", type = "number" }, + }, + symbols = { + ["def"] = "keyword", + ["switch"] = "keyword", + ["case"] = "keyword", + ["return"] = "keyword", + ["if"] = "keyword", + ["else"] = "keyword", + ["when"] = "keyword", + ["match"] = "keyword", + ["λ"] = "keyword", + ["Some"] = "keyword", + ["data"] = "keyword", + ["let"] = "keyword", + ["use"] = "keyword", + ["object"] = "keyword", + ["fold"] = "keyword", + ["open"] = "keyword", + ["do"] = "keyword", + ["bind"] = "keyword", + ["Name"] = "keyword", + ["identity"] = "keyword", + ["Bool"] = "keyword", + ["ask"] = "keyword", + ["with"] = "keyword", + ["bend"] = "keyword2", + ["None"] = "keyword2", + ["Nil"] = "keyword2", + ["Result"] = "keyword2", + ["type"] = "keyword2", + ["true"] = "literal", + ["false"] = "literal", + } +} -- cgit v1.2.3