diff options
Diffstat (limited to 'js/baba-yaga/dev/sublime')
-rw-r--r-- | js/baba-yaga/dev/sublime/Baba Yaga.sublime-syntax | 140 | ||||
-rw-r--r-- | js/baba-yaga/dev/sublime/README.md | 36 |
2 files changed, 176 insertions, 0 deletions
diff --git a/js/baba-yaga/dev/sublime/Baba Yaga.sublime-syntax b/js/baba-yaga/dev/sublime/Baba Yaga.sublime-syntax new file mode 100644 index 0000000..5325651 --- /dev/null +++ b/js/baba-yaga/dev/sublime/Baba Yaga.sublime-syntax @@ -0,0 +1,140 @@ +%YAML 1.2 +--- +name: Baba Yaga +file_extensions: [baba] +scope: source.baba-yaga + +variables: + identifier: '[a-zA-Z_][a-zA-Z0-9_]*' + +contexts: + main: + - include: comments + - include: strings + - include: numbers + - include: keywords + - include: operators + - include: functions + - include: variables + - include: types + - include: with-blocks + - include: when-expressions + + comments: + - match: '//.*$' + scope: comment.line.double-slash.baba-yaga + - match: '/\*' + push: + - meta_scope: comment.block.baba-yaga + - match: '\*/' + pop: true + + strings: + - match: '"' + push: + - meta_scope: string.quoted.double.baba-yaga + - match: '\\\\.' + scope: constant.character.escape.baba-yaga + - match: '"' + pop: true + + numbers: + - match: '\b\d+\b' + scope: constant.numeric.integer.baba-yaga + - match: '\b\d+\.\d+\b' + scope: constant.numeric.float.baba-yaga + + keywords: + - match: '\b(when|then|is|Ok|Err|true|false|PI|INFINITY|and|or|xor)\b' + scope: keyword.control.baba-yaga + - match: '\b(append|set|merge|shape|map|filter|reduce)\b' + scope: keyword.operator.baba-yaga + - match: '\b(io\.out|io\.in|str\.concat|str\.split|str\.join|str\.length|str\.substring|str\.replace|str\.trim|str\.upper|str\.lower|math\.abs|math\.sign|math\.floor|math\.ceil|math\.round|math\.trunc|math\.min|math\.max|math\.clamp|math\.pow|math\.sqrt|math\.exp|math\.log|math\.sin|math\.cos|math\.tan|math\.asin|math\.acos|math\.atan|math\.atan2|math\.deg|math\.rad|math\.random|math\.randomInt)\b' + scope: keyword.other.baba-yaga + + operators: + - match: '(\+|-|\*|/|%)' + scope: keyword.operator.arithmetic.baba-yaga + - match: '(=|!=|>|<|>=|<=)' + scope: keyword.operator.comparison.baba-yaga + - match: ':' + scope: keyword.operator.assignment.baba-yaga + - match: '->' + scope: keyword.operator.function.baba-yaga + - match: '\.\.' + scope: keyword.operator.string.baba-yaga + + functions: + - match: '\b([a-zA-Z_][a-zA-Z0-9_]*)\s*:' + captures: + 1: entity.name.function.baba-yaga + - match: '\(' + push: + - meta_scope: meta.function.anonymous.baba-yaga + - match: '\b([a-zA-Z_][a-zA-Z0-9_]*)\b' + scope: variable.parameter.baba-yaga + - include: operators + - match: '\)' + pop: true + + variables: + - match: '\b([a-zA-Z_][a-zA-Z0-9_]*)\b' + scope: variable.other.baba-yaga + + types: + - match: '\b(Bool|Int|Float|String|List|Table|Result|Number)\b' + scope: storage.type.baba-yaga + + with-blocks: + - match: '\bwith\b' + push: + - meta_scope: meta.with-block.baba-yaga + - match: '\bwith\b' + scope: keyword.control.with.baba-yaga + - match: '\brec\b' + scope: keyword.control.with-rec.baba-yaga + - match: '\(' + scope: punctuation.definition.block.begin.baba-yaga + - match: '\)\s*->' + scope: keyword.operator.function.baba-yaga + pop: true + - include: with-block-entries + - include: comments + - include: strings + - include: numbers + - include: operators + - include: types + + with-block-entries: + - match: '\b([a-zA-Z_][a-zA-Z0-9_]*)\s*:' + captures: + 1: variable.other.with-local.baba-yaga + push: + - meta_scope: meta.with-block-entry.baba-yaga + - match: ';' + scope: punctuation.terminator.semicolon.baba-yaga + pop: true + - include: when-expressions + - include: comments + - include: strings + - include: numbers + - include: operators + - include: types + + when-expressions: + - match: '\bwhen\b' + push: + - meta_scope: meta.when-expression.baba-yaga + - match: '\bwhen\b' + scope: keyword.control.when.baba-yaga + - match: '\bthen\b' + scope: keyword.control.then.baba-yaga + - match: '\bis\b' + scope: keyword.control.is.baba-yaga + - match: '\b_\b' + scope: constant.language.wildcard.baba-yaga + - include: strings + - include: numbers + - include: variables + - match: ';' + pop: true diff --git a/js/baba-yaga/dev/sublime/README.md b/js/baba-yaga/dev/sublime/README.md new file mode 100644 index 0000000..4150566 --- /dev/null +++ b/js/baba-yaga/dev/sublime/README.md @@ -0,0 +1,36 @@ +# Baba Yaga Sublime Text Syntax + +Syntax highlighting for the Baba Yaga programming language in Sublime Text. + +## Installation + +### Method 1: Manual Installation +1. Copy `Baba Yaga.sublime-syntax` to your Sublime Text packages directory: + - Windows: `%APPDATA%\Sublime Text\Packages\User\` + - macOS: `~/Library/Application Support/Sublime Text/Packages/User/` + - Linux: `~/.config/sublime-text/Packages/User/` + +2. Restart Sublime Text + +### Method 2: Create a Package +1. Create a folder named `Baba Yaga` in your Packages directory +2. Copy the syntax file into that folder +3. Restart Sublime Text + +## Features +- Syntax highlighting for Baba Yaga language +- Support for `.baba` files +- Highlighting for: + - Keywords (when, then, is, with, etc.) + - Operators (->, =>, +, -, etc.) + - Functions and variables + - Strings and numbers + - Comments (// and /* */) + - When expressions + - Types (Bool, Int, Float, etc.) + +## Usage +Open any `.baba` file and Sublime Text should automatically detect the language and apply syntax highlighting. + +## Customization +You can customize the colors by modifying your color scheme or creating a custom theme that targets the `source.baba-yaga` scope. |