1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
" Vim syntax file for Baba Yaga programming language
" Language: Baba Yaga
" Maintainer: Your Name <your-email@example.com>
" Latest Revision: 2024
if exists("b:current_syntax")
finish
endif
" Keywords
syn keyword babaKeyword when then is Ok Err
syn keyword babaType Bool Int Float String List Table Result Number
syn keyword babaOperator append set merge shape
syn keyword babaIO io.out io.in io.emit io.listen
syn keyword babaFunction map filter reduce pipe
" Operators
syn match babaOperator "->"
syn match babaOperator "=>"
syn match babaOperator "\.\."
syn match babaOperator "="
syn match babaOperator ">"
syn match babaOperator "<"
syn match babaOperator ">="
syn match babaOperator "<="
syn match babaOperator "+"
syn match babaOperator "-"
syn match babaOperator "\*"
syn match babaOperator "/"
syn match babaOperator "%"
syn match babaOperator ":"
" Comments
syn match babaComment "//.*$"
syn region babaComment start="/\*" end="\*/"
" Strings
syn region babaString start='"' end='"' skip='\\"'
" Numbers
syn match babaNumber "\b\d\+\b"
syn match babaFloat "\b\d\+\.\d\+\b"
" Function definitions
syn match babaFunctionDef "\b[a-zA-Z_][a-zA-Z0-9_]*\s*:"
" Variables
syn match babaVariable "\b[a-zA-Z_][a-zA-Z0-9_]*\b"
" With blocks
syn keyword babaWith with
syn keyword babaWithRec rec
syn region babaWithBlock start="\bwith\b" end="->" contains=babaWith,babaWithRec,babaKeyword,babaOperator,babaString,babaNumber,babaVariable,babaComment,babaWithBlockEntry
syn region babaWithBlockEntry start="\b[a-zA-Z_][a-zA-Z0-9_]*\s*:" end=";" contains=babaVariable,babaOperator,babaString,babaNumber,babaComment,babaWhenExpr
" When expressions
syn region babaWhenExpr start="\bwhen\b" end=";" contains=babaKeyword,babaOperator,babaString,babaNumber,babaVariable
" Anonymous functions
syn region babaAnonFunc start="(" end=")" contains=babaVariable,babaOperator
" Lists
syn region babaList start="\[" end="\]" contains=ALL
" Tables
syn region babaTable start="{" end="}" contains=ALL
" Wildcard
syn match babaWildcard "\b_\b"
" Define highlighting
hi def link babaKeyword Keyword
hi def link babaType Type
hi def link babaOperator Operator
hi def link babaIO PreProc
hi def link babaFunction Function
hi def link babaComment Comment
hi def link babaString String
hi def link babaNumber Number
hi def link babaFloat Float
hi def link babaFunctionDef Function
hi def link babaVariable Identifier
hi def link babaWith Keyword
hi def link babaWithRec Keyword
hi def link babaWithBlock Special
hi def link babaWithBlockEntry Special
hi def link babaWhenExpr Special
hi def link babaAnonFunc Special
hi def link babaList Special
hi def link babaTable Special
hi def link babaWildcard Constant
let b:current_syntax = "baba"
|