annotate runtime/syntax/erlang.vim @ 3281:af1e8a1714c2

Update runtime files.
author Bram Moolenaar <bram@vim.org>
date Fri, 20 Jan 2012 21:08:56 +0100
parents 7bc41231fbc7
children eb6ab7e78925
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
2 " Language: Erlang
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
3 " Author: Oscar Hellström <oscar@oscarh.net> (http://oscar.hellstrom.st)
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
4 " Contributors: Ricardo Catalinas Jiménez <jimenezrick@gmail.com>
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
5 " License: Vim license
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
6 " Version: 2011/09/11
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
8 if exists("b:current_syntax")
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
9 finish
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
10 else
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
11 let b:current_syntax = "erlang"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
14 if !exists("g:erlang_highlight_bif")
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
15 let g:erlang_highlight_bif = 1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
18 " Erlang is case sensitive
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
19 syn case match
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
20
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
21 " Match groups
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
22 syn match erlangStringModifier /\\./ contained
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
23 syn match erlangStringModifier /\~\%(-\?[0-9*]\+\)\?\%(\.[0-9*]\+\..\?\)\?\%(c\|f\|e\|g\|s\|w\|p\|W\|P\|B\|X\|#\|b\|+\|n\|i\)/ contained
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
24 syn match erlangModifier /\$\\\?./
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
25
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
26 syn match erlangInteger /\<\%([0-9]\+#[0-9a-fA-F]\+\|[0-9]\+\)\>/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
27 syn match erlangFloat /\<[0-9]\+\.[0-9]\+\%(e-\?[0-9]\+\)\?\>/
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
29 syn keyword erlangTodo TODO FIXME XXX contained
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
30 syn match erlangComment /%.*$/ contains=@Spell,erlangTodo,erlangAnnotation
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
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
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
32 syn match erlangAnnotation /`[^']\+'/ contained
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
33
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
34 syn keyword erlangKeyword band bor bnot bsl bsr bxor div rem xor
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
35 syn keyword erlangKeyword try catch begin receive after cond fun let query
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
37 syn keyword erlangConditional case if of end
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
38 syn keyword erlangConditional not and or andalso orelse
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
39 syn keyword erlangConditional when
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
40
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
41 syn keyword erlangBoolean true false
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
42
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
45 syn match erlangOperator /\/\|*\|+\|-\|++\|--/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
46 syn match erlangOperator /->\|<-\|||\||\|!\|=/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
47 syn match erlangOperator /=:=\|==\|\/=\|=\/=\|<\|>\|=<\|>=/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
48 syn keyword erlangOperator div rem
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
50 syn region erlangString start=/"/ end=/"/ skip=/\\/ contains=@Spell,erlangStringModifier
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
52 syn match erlangVariable /\<[A-Z_]\w*\>/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
53 syn match erlangAtom /\%(\%(^-\)\|#\)\@<!\<[a-z][A-Za-z0-9_]*\>\%(\s*[(:]\)\@!/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
54 syn match erlangAtom /\\\@<!'[^']*\\\@<!'/
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
56 syn match erlangRecord /#\w\+/
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
58 syn match erlangTuple /{\|}/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
59 syn match erlangList /\[\|\]/
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
61 syn match erlangAttribute /^-\%(vsn\|author\|copyright\|compile\|deprecated\|module\|export\|import\|behaviour\|behavior\|export_type\|ignore_xref\|on_load\)\s*(\@=/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
62 syn match erlangInclude /^-include\%(_lib\)\?\s*(\@=/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
63 syn match erlangRecordDef /^-record\s*(\@=/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
64 syn match erlangDefine /^-\%(define\|undef\)\s*(\@=/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
65 syn match erlangPreCondit /^-\%(ifdef\|ifndef\|else\|endif\)\%(\s*(\@=\)\?/
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
67 syn match erlangType /^-\%(spec\|type\)[( ]\@=/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
68
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
69 syn match erlangMacro /\%(-define(\)\@<=\w\+/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
70 syn match erlangMacro /?\??\w\+/
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
72 syn match erlangBitType /\%(\/\|-\)\@<=\%(bits\|bitstring\|binary\|integer\|float\|unit\)\>/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
73 syn match erlangBitSize /:\@<=[0-9]\+/
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
75 syn match erlangBinary /<<\|>>/
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
77 " BIFs
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
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]\)\@=/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
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\)(\@=/
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
80 syn match erlangGBIF /erlang\%(:\w\)\@=/
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
82 " Link Erlang stuff to Vim groups
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
83 hi link erlangTodo Todo
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
84 hi link erlangString String
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
85 hi link erlangNoSpellString String
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
86 hi link erlangModifier SpecialChar
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
87 hi link erlangStringModifier SpecialChar
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
88 hi link erlangComment Comment
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
89 hi link erlangAnnotation Special
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
90 hi link erlangVariable Identifier
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
91 hi link erlangInclude Include
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
92 hi link erlangRecordDef Keyword
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
93 hi link erlangAttribute Keyword
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
94 hi link erlangKeyword Keyword
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
95 hi link erlangMacro Macro
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
96 hi link erlangDefine Define
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
97 hi link erlangPreCondit PreCondit
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
98 hi link erlangPreProc PreProc
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
99 hi link erlangDelimiter Delimiter
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
100 hi link erlangBitDelimiter Normal
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
101 hi link erlangOperator Operator
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
102 hi link erlangConditional Conditional
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
103 hi link erlangGuard Conditional
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
104 hi link erlangBoolean Boolean
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
105 hi link erlangAtom Constant
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
106 hi link erlangRecord Structure
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
107 hi link erlangInteger Number
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
108 hi link erlangFloat Number
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
109 hi link erlangFloat Number
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
110 hi link erlangFloat Number
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
111 hi link erlangFloat Number
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
112 hi link erlangHex Number
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
113 hi link erlangFun Keyword
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
114 hi link erlangList Delimiter
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
115 hi link erlangTuple Delimiter
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
116 hi link erlangBinary Keyword
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
117 hi link erlangBitVariable Identifier
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
118 hi link erlangBitType Type
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
119 hi link erlangType Type
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
120 hi link erlangBitSize Number
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
122 " Optional highlighting
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
123 if g:erlang_highlight_bif
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
124 hi link erlangBIF Keyword
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
125 hi link erlangGBIF Keyword
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 endif