7
|
1 " Vim syntax file
|
3281
|
2 " Language: Erlang
|
|
3 " Author: Oscar Hellström <oscar@oscarh.net> (http://oscar.hellstrom.st)
|
|
4 " Contributors: Ricardo Catalinas Jiménez <jimenezrick@gmail.com>
|
|
5 " License: Vim license
|
|
6 " Version: 2011/09/11
|
7
|
7
|
3281
|
8 if exists("b:current_syntax")
|
|
9 finish
|
|
10 else
|
|
11 let b:current_syntax = "erlang"
|
7
|
12 endif
|
|
13
|
3281
|
14 if !exists("g:erlang_highlight_bif")
|
|
15 let g:erlang_highlight_bif = 1
|
7
|
16 endif
|
|
17
|
3281
|
18 " Erlang is case sensitive
|
|
19 syn case match
|
|
20
|
|
21 " Match groups
|
|
22 syn match erlangStringModifier /\\./ contained
|
|
23 syn match erlangStringModifier /\~\%(-\?[0-9*]\+\)\?\%(\.[0-9*]\+\..\?\)\?\%(c\|f\|e\|g\|s\|w\|p\|W\|P\|B\|X\|#\|b\|+\|n\|i\)/ contained
|
|
24 syn match erlangModifier /\$\\\?./
|
|
25
|
|
26 syn match erlangInteger /\<\%([0-9]\+#[0-9a-fA-F]\+\|[0-9]\+\)\>/
|
|
27 syn match erlangFloat /\<[0-9]\+\.[0-9]\+\%(e-\?[0-9]\+\)\?\>/
|
7
|
28
|
3281
|
29 syn keyword erlangTodo TODO FIXME XXX contained
|
|
30 syn match erlangComment /%.*$/ contains=@Spell,erlangTodo,erlangAnnotation
|
|
31 syn match erlangAnnotation /\%(%\s\)\@<=@\%(author\|clear\|copyright\|deprecated\|doc\|docfile\|end\|equiv\|headerfile\|hidden\|private\|reference\|see\|since\|spec\|throws\|title\|todo\|TODO\|type\|version\)/ contained
|
|
32 syn match erlangAnnotation /`[^']\+'/ contained
|
|
33
|
|
34 syn keyword erlangKeyword band bor bnot bsl bsr bxor div rem xor
|
|
35 syn keyword erlangKeyword try catch begin receive after cond fun let query
|
7
|
36
|
3281
|
37 syn keyword erlangConditional case if of end
|
|
38 syn keyword erlangConditional not and or andalso orelse
|
|
39 syn keyword erlangConditional when
|
|
40
|
|
41 syn keyword erlangBoolean true false
|
|
42
|
|
43 syn keyword erlangGuard is_list is_alive is_atom is_binary is_bitstring is_boolean is_tuple is_number is_integer is_float is_function is_constant is_pid is_port is_reference is_record is_process_alive
|
7
|
44
|
3281
|
45 syn match erlangOperator /\/\|*\|+\|-\|++\|--/
|
|
46 syn match erlangOperator /->\|<-\|||\||\|!\|=/
|
|
47 syn match erlangOperator /=:=\|==\|\/=\|=\/=\|<\|>\|=<\|>=/
|
|
48 syn keyword erlangOperator div rem
|
7
|
49
|
3281
|
50 syn region erlangString start=/"/ end=/"/ skip=/\\/ contains=@Spell,erlangStringModifier
|
7
|
51
|
3281
|
52 syn match erlangVariable /\<[A-Z_]\w*\>/
|
|
53 syn match erlangAtom /\%(\%(^-\)\|#\)\@<!\<[a-z][A-Za-z0-9_]*\>\%(\s*[(:]\)\@!/
|
|
54 syn match erlangAtom /\\\@<!'[^']*\\\@<!'/
|
7
|
55
|
3281
|
56 syn match erlangRecord /#\w\+/
|
7
|
57
|
3281
|
58 syn match erlangTuple /{\|}/
|
|
59 syn match erlangList /\[\|\]/
|
7
|
60
|
3281
|
61 syn match erlangAttribute /^-\%(vsn\|author\|copyright\|compile\|deprecated\|module\|export\|import\|behaviour\|behavior\|export_type\|ignore_xref\|on_load\)\s*(\@=/
|
|
62 syn match erlangInclude /^-include\%(_lib\)\?\s*(\@=/
|
|
63 syn match erlangRecordDef /^-record\s*(\@=/
|
|
64 syn match erlangDefine /^-\%(define\|undef\)\s*(\@=/
|
|
65 syn match erlangPreCondit /^-\%(ifdef\|ifndef\|else\|endif\)\%(\s*(\@=\)\?/
|
7
|
66
|
3281
|
67 syn match erlangType /^-\%(spec\|type\)[( ]\@=/
|
|
68
|
|
69 syn match erlangMacro /\%(-define(\)\@<=\w\+/
|
|
70 syn match erlangMacro /?\??\w\+/
|
7
|
71
|
3281
|
72 syn match erlangBitType /\%(\/\|-\)\@<=\%(bits\|bitstring\|binary\|integer\|float\|unit\)\>/
|
|
73 syn match erlangBitSize /:\@<=[0-9]\+/
|
7
|
74
|
3281
|
75 syn match erlangBinary /<<\|>>/
|
7
|
76
|
3281
|
77 " BIFs
|
|
78 syn match erlangBIF /\%([^:0-9A-Za-z_]\|\<erlang:\)\@<=\%(abs\|apply\|atom_to_binary\|atom_to_list\|binary_part\|binary_to_atom\|binary_to_existing_atom\|binary_to_list\|binary_to_term\|bit_size\|bitstring_to_list\|byte_size\|check_process_code\|date\|delete_module\|demonitor\|disconnect_node\|element\|erase\|exit\|float\|float_to_list\|garbage_collect\|get\|get_keys\|group_leader\|hd\|integer_to_list\|iolist_size\|iolist_to_binary\|is_alive\|is_atom\|is_binary\|is_bitstring\|is_boolean\|is_float\|is_function\|is_integer\|is_list\|is_number\|is_pid\|is_port\|is_process_alive\|is_record\|is_reference\|is_tuple\|length\|link\|list_to_atom\|list_to_binary\|list_to_bitstring\|list_to_existing_atom\|list_to_float\|list_to_integer\|list_to_pid\|list_to_tuple\|load_module\|make_ref\|max\|min\|module_loaded\|monitor\|monitor_node\|node\|nodes\|now\|open_port\|pid_to_list\|port_close\|port_command\|port_connect\|port_control\|pre_loaded\|processes\|process_flag\|process_info\|purge_module\|put\|register\|registered\|round\|self\|setelement\|size\|spawn\|spawn_link\|spawn_monitor\|spawn_opt\|split_binary\|statistics\|term_to_binary\|time\|tl\|trunc\|tuple_size\|tuple_to_list\|unlink\|unregister\|whereis\)\%((\|\/[0-9]\)\@=/
|
|
79 syn match erlangBIF /\<\%(erlang:\)\@<=\%(append_element\|bump_reductions\|cancel_timer\|decode_packet\|display\|function_exported\|fun_info\|fun_to_list\|get_cookie\|get_stacktrace\|hash\|is_builtin\|loaded\|load_nif\|localtime\|localtime_to_universaltime\|make_tuple\|memory\|monitor_node\|phash\|port_call\|port_info\|ports\|port_to_list\|process_display\|read_timer\|ref_to_list\|resume_process\|send\|send_after\|send_nosuspend\|set_cookie\|start_timer\|suspend_process\|system_flag\|system_info\|system_monitor\|system_profile\|trace\|trace_delivered\|trace_info\|trace_pattern\|universaltime\|universaltime_to_localtime\|yield\)(\@=/
|
|
80 syn match erlangGBIF /erlang\%(:\w\)\@=/
|
7
|
81
|
3281
|
82 " Link Erlang stuff to Vim groups
|
|
83 hi link erlangTodo Todo
|
|
84 hi link erlangString String
|
|
85 hi link erlangNoSpellString String
|
|
86 hi link erlangModifier SpecialChar
|
|
87 hi link erlangStringModifier SpecialChar
|
|
88 hi link erlangComment Comment
|
|
89 hi link erlangAnnotation Special
|
|
90 hi link erlangVariable Identifier
|
|
91 hi link erlangInclude Include
|
|
92 hi link erlangRecordDef Keyword
|
|
93 hi link erlangAttribute Keyword
|
|
94 hi link erlangKeyword Keyword
|
|
95 hi link erlangMacro Macro
|
|
96 hi link erlangDefine Define
|
|
97 hi link erlangPreCondit PreCondit
|
|
98 hi link erlangPreProc PreProc
|
|
99 hi link erlangDelimiter Delimiter
|
|
100 hi link erlangBitDelimiter Normal
|
|
101 hi link erlangOperator Operator
|
|
102 hi link erlangConditional Conditional
|
|
103 hi link erlangGuard Conditional
|
|
104 hi link erlangBoolean Boolean
|
|
105 hi link erlangAtom Constant
|
|
106 hi link erlangRecord Structure
|
|
107 hi link erlangInteger Number
|
|
108 hi link erlangFloat Number
|
|
109 hi link erlangFloat Number
|
|
110 hi link erlangFloat Number
|
|
111 hi link erlangFloat Number
|
|
112 hi link erlangHex Number
|
|
113 hi link erlangFun Keyword
|
|
114 hi link erlangList Delimiter
|
|
115 hi link erlangTuple Delimiter
|
|
116 hi link erlangBinary Keyword
|
|
117 hi link erlangBitVariable Identifier
|
|
118 hi link erlangBitType Type
|
|
119 hi link erlangType Type
|
|
120 hi link erlangBitSize Number
|
7
|
121
|
3281
|
122 " Optional highlighting
|
|
123 if g:erlang_highlight_bif
|
|
124 hi link erlangBIF Keyword
|
|
125 hi link erlangGBIF Keyword
|
7
|
126 endif
|