{ "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" } ] } } }