about summary refs log tree commit diff stats
path: root/js/baba-yaga/dev/vscode/syntaxes
diff options
context:
space:
mode:
Diffstat (limited to 'js/baba-yaga/dev/vscode/syntaxes')
-rw-r--r--js/baba-yaga/dev/vscode/syntaxes/baba-yaga-markdown.tmLanguage.json34
-rw-r--r--js/baba-yaga/dev/vscode/syntaxes/baba-yaga.tmLanguage.json252
2 files changed, 286 insertions, 0 deletions
diff --git a/js/baba-yaga/dev/vscode/syntaxes/baba-yaga-markdown.tmLanguage.json b/js/baba-yaga/dev/vscode/syntaxes/baba-yaga-markdown.tmLanguage.json
new file mode 100644
index 0000000..2537b2c
--- /dev/null
+++ b/js/baba-yaga/dev/vscode/syntaxes/baba-yaga-markdown.tmLanguage.json
@@ -0,0 +1,34 @@
+{
+  "scopeName": "markdown.baba-yaga.codeblock",
+  "patterns": [
+    {
+      "begin": "(^|\\G)(\\s*)(```)(baba|baba-yaga)(?:\\s*$|\\s+([^\\r\\n]*)$)",
+      "beginCaptures": {
+        "3": {
+          "name": "punctuation.definition.markdown"
+        },
+        "4": {
+          "name": "fenced_code.block.language"
+        },
+        "5": {
+          "name": "fenced_code.block.language.attributes"
+        }
+      },
+      "end": "(^|\\G)(\\s*)(```)",
+      "endCaptures": {
+        "3": {
+          "name": "punctuation.definition.markdown"
+        }
+      },
+      "name": "markup.fenced_code.block.markdown",
+      "contentName": "source.baba-yaga",
+      "patterns": [
+        {
+          "include": "source.baba-yaga"
+        }
+      ]
+    }
+  ]
+}
+
+
diff --git a/js/baba-yaga/dev/vscode/syntaxes/baba-yaga.tmLanguage.json b/js/baba-yaga/dev/vscode/syntaxes/baba-yaga.tmLanguage.json
new file mode 100644
index 0000000..9ecb3b0
--- /dev/null
+++ b/js/baba-yaga/dev/vscode/syntaxes/baba-yaga.tmLanguage.json
@@ -0,0 +1,252 @@
+{
+  "name": "Baba Yaga",
+  "scopeName": "source.baba-yaga",
+  "fileTypes": ["baba"],
+  "patterns": [
+    {
+      "include": "#comments"
+    },
+    {
+      "include": "#strings"
+    },
+    {
+      "include": "#numbers"
+    },
+    {
+      "include": "#function-types"
+    },
+    {
+      "include": "#with-blocks"
+    },
+    {
+      "include": "#keywords"
+    },
+    {
+      "include": "#operators"
+    },
+    {
+      "include": "#types"
+    },
+    {
+      "include": "#functions"
+    },
+    {
+      "include": "#identifiers"
+    }
+  ],
+  "repository": {
+    "comments": {
+      "patterns": [
+        {
+          "name": "comment.line.double-slash.baba-yaga",
+          "match": "//.*$"
+        }
+      ]
+    },
+    "strings": {
+      "patterns": [
+        {
+          "name": "string.quoted.double.baba-yaga",
+          "begin": "\"",
+          "end": "\"",
+          "patterns": [
+            {
+              "name": "constant.character.escape.baba-yaga",
+              "match": "\\\\."
+            }
+          ]
+        }
+      ]
+    },
+    "numbers": {
+      "patterns": [
+        {
+          "name": "constant.numeric.integer.baba-yaga",
+          "match": "\\b\\d+\\b"
+        },
+        {
+          "name": "constant.numeric.float.baba-yaga",
+          "match": "\\b\\d+\\.\\d+\\b"
+        }
+      ]
+    },
+    "keywords": {
+      "patterns": [
+        {
+          "name": "keyword.control.baba-yaga",
+          "match": "\\b(when|then|is|Ok|Err|true|false|PI|INFINITY|and|or|xor)\\b"
+        }
+      ]
+    },
+    "with-blocks": {
+      "patterns": [
+        {
+          "name": "keyword.control.with.baba-yaga",
+          "match": "\\bwith\\b"
+        },
+        {
+          "name": "keyword.control.with-rec.baba-yaga",
+          "match": "\\bwith\\s+rec\\b"
+        },
+        {
+          "name": "meta.with-block.baba-yaga",
+          "begin": "with\\s*\\(\\s*(?:rec\\s*)?",
+          "end": "\\)\\s*->",
+          "beginCaptures": {
+            "0": { "name": "keyword.control.with.baba-yaga" }
+          },
+          "endCaptures": {
+            "0": { "name": "keyword.operator.arrow.baba-yaga" }
+          },
+          "patterns": [
+            {
+              "include": "#comments"
+            },
+            {
+              "include": "#with-block-entries"
+            },
+            {
+              "include": "#types"
+            },
+            {
+              "include": "#operators"
+            },
+            {
+              "include": "#identifiers"
+            }
+          ]
+        }
+      ]
+    },
+    "with-block-entries": {
+      "patterns": [
+        {
+          "name": "meta.with-block-entry.baba-yaga",
+          "begin": "([a-zA-Z_][a-zA-Z0-9_]*)\\s*:",
+          "end": ";",
+          "beginCaptures": {
+            "1": { "name": "variable.other.with-local.baba-yaga" }
+          },
+          "endCaptures": {
+            "0": { "name": "punctuation.terminator.semicolon.baba-yaga" }
+          },
+          "patterns": [
+            {
+              "include": "#comments"
+            },
+            {
+              "include": "#when-expressions"
+            },
+            {
+              "include": "#types"
+            },
+            {
+              "include": "#operators"
+            },
+            {
+              "include": "#identifiers"
+            }
+          ]
+        }
+      ]
+    },
+    "when-expressions": {
+      "patterns": [
+        {
+          "name": "meta.when-expression.baba-yaga",
+          "begin": "when\\s+",
+          "end": ";",
+          "beginCaptures": {
+            "0": { "name": "keyword.control.when.baba-yaga" }
+          },
+          "endCaptures": {
+            "0": { "name": "punctuation.terminator.semicolon.baba-yaga" }
+          },
+          "patterns": [
+            {
+              "include": "#comments"
+            },
+            {
+              "include": "#types"
+            },
+            {
+              "include": "#operators"
+            },
+            {
+              "include": "#identifiers"
+            }
+          ]
+        }
+      ]
+    },
+    "operators": {
+      "patterns": [
+        {
+          "name": "keyword.operator.arrow.baba-yaga",
+          "match": "->"
+        },
+        {
+          "name": "keyword.operator.baba-yaga",
+          "match": "(\\+|-|\\*|/|%|=|!=|>|<|>=|<=|\\.\\.|:)"
+        }
+      ]
+    },
+    "function-types": {
+      "patterns": [
+        {
+          "name": "meta.function-type.baba-yaga",
+          "begin": "\\(",
+          "end": "\\)",
+          "beginCaptures": {
+            "0": { "name": "punctuation.definition.type.begin.baba-yaga" }
+          },
+          "endCaptures": {
+            "0": { "name": "punctuation.definition.type.end.baba-yaga" }
+          },
+          "patterns": [
+            {
+              "include": "#types"
+            },
+            {
+              "include": "#operators"
+            },
+            {
+              "include": "#function-types"
+            }
+          ]
+        }
+      ]
+    },
+    "types": {
+      "patterns": [
+        {
+          "name": "storage.type.baba-yaga",
+          "match": "\\b(Bool|Int|Float|String|List|Table|Result|Number)\\b"
+        }
+      ]
+    },
+    "functions": {
+      "patterns": [
+        {
+          "name": "entity.name.function.declaration.baba-yaga",
+          "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*:",
+          "captures": {
+            "1": { "name": "entity.name.function.baba-yaga" }
+          }
+        },
+        {
+          "name": "support.function.builtin.baba-yaga",
+          "match": "\\b(io\\.(out|in)|map|filter|reduce|append|set|merge|shape|str\\.(concat|split|join|length|substring|replace|trim|upper|lower)|math\\.(abs|sign|floor|ceil|round|trunc|min|max|clamp|pow|sqrt|exp|log|sin|cos|tan|asin|acos|atan|atan2|deg|rad|random|randomInt))\\b"
+        }
+      ]
+    },
+    "identifiers": {
+      "patterns": [
+        {
+          "name": "variable.other.baba-yaga",
+          "match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b"
+        }
+      ]
+    }
+  }
+}