haku - first draft

This commit is contained in:
りき萌 2024-07-24 18:20:47 +02:00
parent 2a68cfbf63
commit d813675d47
5 changed files with 1205 additions and 0 deletions

10
static/syntax/ebnf.json Normal file
View file

@ -0,0 +1,10 @@
{
"patterns": [
{ "regex": "[a-zA-Z_][a-zA-Z0-9_]*", "is": "keyword2" },
{ "regex": "\"(\\\\\"|[^\"])*\"", "is": "string" },
{ "regex": "'('|[^'])*'", "is": "string" },
{ "regex": "[+*?=|,-]", "is": "operator" }
],
"keywords": {
}
}

26
static/syntax/haku.json Normal file
View file

@ -0,0 +1,26 @@
{
"patterns": [
{ "regex": ";.*", "is": "comment" },
{ "regex": "[0-9]+", "is": "literal" },
{
"regex": "\\((fn)\\s*\\(.*?\\)",
"is": {
"default": "default",
"captures": ["keyword1"]
}
},
{
"regex": "\\(([a-zA-Z0-9+~!@$%^&*=<>+?/.,:\\\\|-]+)",
"is": {
"default": "default",
"captures": ["function"]
}
},
{ "regex": "[a-zA-Z0-9+~!@$%^&*=<>+?/.,:\\\\|-]+", "is": "identifier" }
],
"keywords": {
"def": { "into": "keyword1" },
"if": { "into": "keyword1" }
}
}