%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