Skip to content

Commit

Permalink
Add language_c7 and update language_fe (#328)
Browse files Browse the repository at this point in the history
* update lang_fe and add lang_c7

* actually add the files

* fixed language_fe

* add to meta_languages and bump

* space

* .*
  • Loading branch information
thacuber2a03 authored Oct 29, 2023
1 parent 02a5929 commit d765030
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 13 deletions.
13 changes: 11 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
{
"id": "meta_languages",
"type": "meta",
"version": "0.1.1",
"version": "0.1.2",
"mod_version": "3",
"description": "A metapackage containing all publically accessible language syntaxes.",
"dependencies": {
Expand All @@ -72,6 +72,7 @@
"language_batch": {},
"language_bib": {},
"language_blade": {},
"language_c7": {},
"language_caddyfile": {},
"language_cmake": {},
"language_containerfile": {},
Expand Down Expand Up @@ -599,6 +600,14 @@
"mod_version": "3",
"tags": ["language"]
},
{
"description": "Syntax for the modifications to [fe](https://github.com/rxi/fe/) used in [cel7](https://rxi.itch.io/cel7)",
"version": "0.1",
"path": "plugins/language_c7.lua",
"id": "language_c7",
"mod_version": "3",
"tags": ["language"]
},
{
"description": "Syntax for the Caddyfile used on the [Caddy](https://caddyserver.com/) web server",
"version": "0.1",
Expand Down Expand Up @@ -713,7 +722,7 @@
},
{
"description": "Syntax for the [fe](https://github.com/rxi/fe) programming language",
"version": "0.1",
"version": "0.2",
"path": "plugins/language_fe.lua",
"id": "language_fe",
"mod_version": "3",
Expand Down
80 changes: 80 additions & 0 deletions plugins/language_c7.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
-- mod-version:3
local syntax = require "core.syntax"

syntax.add {
name = "cel7",
files = "%.c7$",
comment = ";",
patterns = {
{ pattern = ";.*", type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = "0x4000", type = "literal" },
{ pattern = "0x4040", type = "literal" },
{ pattern = "0x52a0", type = "literal" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "'", type = "symbol" },
{ pattern = "=", type = "symbol" },
{ pattern = "<=?", type = "symbol" },
{ pattern = "[%+-%*/]", type = "symbol" },
{ pattern = "//", type = "keyword2" },
{ pattern = "%%", type = "keyword2" },
{ pattern = "%f[^(][^()'%s\"]+", type = "function" },
{ pattern = "[^()'%s\"]+", type = "symbol" },
},
symbols = {
["let"] = "keyword",
["="] = "operator",
["if"] = "keyword",
["fn"] = "keyword",
["mac"] = "keyword",
["while"] = "keyword",
["quote"] = "keyword",
["'"] = "keyword",
["and"] = "keyword",
["or"] = "keyword",
["do"] = "keyword",
["cons"] = "keyword",
["car"] = "keyword",
["cdr"] = "keyword",
["setcar"] = "keyword",
["setcdr"] = "keyword",
["list"] = "keyword",
["not"] = "keyword",
["is"] = "keyword",
["atom"] = "keyword",
["print"] = "keyword",
["<"] = "operator",
["<="] = "operator",
["="] = "operator",
["+"] = "operator",
["-"] = "operator",
["*"] = "operator",
["/"] = "operator",
["nil"] = "literal",
["t"] = "literal",

-- reserved variables (config)
["title"] = "keyword2",
["width"] = "keyword2",
["height"] = "keyword2",
["debug"] = "keyword2",

-- callbacks
["init"] = "keyword2",
["step"] = "keyword2",
["keydown"] = "keyword2",
["keyup"] = "keyword2",

-- built-in functions
["quit"] = "keyword2",
["rand"] = "keyword2",
["poke"] = "keyword2",
["peek"] = "keyword2",
["color"] = "keyword2",
["put"] = "keyword2",
["get"] = "keyword2",
["fill"] = "keyword2",
}
}
39 changes: 28 additions & 11 deletions plugins/language_fe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,46 @@ syntax.add {
files = "%.fe$",
comment = ";",
patterns = {
{ pattern = ";.-\n", type = "comment" },
{ pattern = ";.*", type = "comment" },
{ pattern = { '"', '"', '\\' }, type = "string" },
{ pattern = "0x[%da-fA-F]+", type = "number" },
{ pattern = "-?%d+[%d%.]*", type = "number" },
{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "'", type = "symbol" },
{ pattern = "'", type = "symbol" },
{ pattern = "=", type = "symbol" },
{ pattern = "<=?", type = "symbol" },
{ pattern = "[%+-%*/]", type = "symbol" },
{ pattern = "%f[^(][^()'%s\"]+", type = "function" },
{ pattern = "[^()'%s\"]+", type = "symbol" },
},
symbols = {
["if"] = "keyword2",
["let"] = "keyword2",
["do"] = "keyword2",
["fn"] = "keyword2",
["mac"] = "keyword2",
["'"] = "keyword2",
["print"] = "keyword",
["let"] = "keyword",
["if"] = "keyword",
["fn"] = "keyword",
["mac"] = "keyword",
["while"] = "keyword",
["quote"] = "keyword",
["'"] = "keyword",
["and"] = "keyword",
["or"] = "keyword",
["do"] = "keyword",
["cons"] = "keyword",
["car"] = "keyword",
["cdr"] = "keyword",
["not"] = "keyword",
["setcdr"] = "keyword",
["setcar"] = "keyword",
["setcdr"] = "keyword",
["list"] = "keyword",
["not"] = "keyword",
["is"] = "keyword",
["atom"] = "keyword",
["print"] = "keyword",
["<"] = "operator",
["<="] = "operator",
["="] = "operator",
["+"] = "operator",
["-"] = "operator",
["*"] = "operator",
["/"] = "operator",
["nil"] = "literal",
["t"] = "literal",
}
Expand Down

0 comments on commit d765030

Please sign in to comment.