blob: e3e3d0dceed441a0dbe614e5f4d367c3823c2df5 [file] [log] [blame]
Serhii Khoma5ca8f222024-11-12 21:49:42 +01001" Vim syntax file
2" Language: Idris 2
3" Maintainer: Idris Hackers (https://github.com/edwinb/idris2-vim), Serhii Khoma <srghma@gmail.com>
4" Last Change: 2024 Nov 05
5" Original Author: raichoo (raichoo@googlemail.com)
6" License: Vim (see :h license)
7" Repository: https://github.com/ShinKage/idris2-nvim
8"
9
10if exists("b:current_syntax")
11 finish
12endif
13
14syn match idris2TypeDecl "[a-zA-Z][a-zA-z0-9_']*\s\+:\s\+" contains=idris2Identifier,idris2Operators
15syn region idris2Parens matchgroup=idris2Delimiter start="(" end=")" contains=TOP,idris2TypeDecl
16syn region idris2Brackets matchgroup=idris2Delimiter start="\[" end="]" contains=TOP,idris2TypeDecl
17syn region idris2Block matchgroup=idris2Delimiter start="{" end="}" contains=TOP,idris2TypeDecl
18syn region idris2SnocBrackets matchgroup=idris2Delimiter start="\[<" end="]" contains=TOP
19syn region idris2ListBrackets matchgroup=idris2Delimiter start="\[>" end="]" contains=TOP
20syn keyword idris2Module module namespace
21syn keyword idris2Import import
22syn keyword idris2Structure data record interface implementation
23syn keyword idris2Where where
24syn keyword idris2Visibility public abstract private export
25syn keyword idris2Block parameters mutual using
26syn keyword idris2Totality total partial covering
27syn keyword idris2Annotation auto impossible default constructor
28syn keyword idris2Statement do case of rewrite with proof
29syn keyword idris2Let let in
30syn keyword idris2Forall forall
31syn keyword idris2DataOpt noHints uniqueSearch search external noNewtype containedin=idris2Brackets
32syn keyword idris2Conditional if then else
33syn match idris2Number "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>"
34syn match idris2Float "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"
35syn match idris2Delimiter "[,;]"
36syn keyword idris2Infix prefix infix infixl infixr
37syn match idris2Operators "\([-!#$%&\*\+./<=>\?@\\^|~:]\|\<_\>\)"
38syn match idris2Type "\<[A-Z][a-zA-Z0-9_']*\>"
39syn keyword idris2Todo TODO FIXME XXX HACK contained
40syn match idris2LineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" contains=idris2Todo,@Spell
41syn match idris2DocComment "|||\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" contains=idris2Todo,@Spell
42syn match idris2MetaVar "?[a-zA-Z_][A-Za-z0-9_']*"
43syn match idris2Pragma "%\(hide\|logging\|auto_lazy\|unbound_implicits\|prefix_record_projections\|ambiguity_depth\|nf_metavar_threshold\|search_timeout\|pair\|rewrite\|integerLit\|stringLit\|charLit\|doubleLit\|name\|start\|allow_overloads\|language\|default\|transform\|hint\|globalhint\|defaulthint\|inline\|noinline\|extern\|macro\|spec\|foreign\|nomangle\|builtin\|MkWorld\|World\|search\|runElab\|tcinline\|auto_implicit_depth\)"
44syn match idris2Char "'[^'\\]'\|'\\.'\|'\\u[0-9a-fA-F]\{4}'"
45syn match idris2Backtick "`[A-Za-z][A-Za-z0-9_']*`"
46syn region idris2String start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell
47syn region idris2BlockComment start="{-" end="-}" contains=idris2BlockComment,idris2Todo,@Spell
48syn match idris2Identifier "[a-zA-Z][a-zA-z0-9_']*" contained
49
50" Default Highlighting {{{1
51
52highlight def link idris2Deprecated Error
53highlight def link idris2Identifier Identifier
54highlight def link idris2Import Structure
55highlight def link idris2Module Structure
56highlight def link idris2Structure Structure
57highlight def link idris2Statement Statement
58highlight def link idris2Forall Structure
59highlight def link idris2DataOpt Statement
60highlight def link idris2DSL Statement
61highlight def link idris2Block Statement
62highlight def link idris2Annotation Statement
63highlight def link idris2Where Structure
64highlight def link idris2Let Structure
65highlight def link idris2Totality Statement
66highlight def link idris2Visibility Statement
67highlight def link idris2Conditional Conditional
68highlight def link idris2Pragma Statement
69highlight def link idris2Number Number
70highlight def link idris2Float Float
71highlight def link idris2Delimiter Delimiter
72highlight def link idris2Infix PreProc
73highlight def link idris2Operators Operator
74highlight def link idris2Type Include
75highlight def link idris2DocComment Comment
76highlight def link idris2LineComment Comment
77highlight def link idris2BlockComment Comment
78highlight def link idris2Todo Todo
79highlight def link idris2MetaVar Macro
80highlight def link idris2String String
81highlight def link idris2Char String
82highlight def link idris2Backtick Operator
83
84let b:current_syntax = "idris2"
85
86" vim: nowrap sw=2 sts=2 ts=8 noexpandtab ft=vim