Mercurial > vim
comparison runtime/syntax/erlang.vim @ 4437:eb6ab7e78925
Update runtime files.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Fri, 17 May 2013 18:14:19 +0200 |
parents | af1e8a1714c2 |
children | 2b11ac90d9e9 |
comparison
equal
deleted
inserted
replaced
4436:a4fb812810e3 | 4437:eb6ab7e78925 |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: Erlang | 2 " Language: Erlang (http://www.erlang.org) |
3 " Author: Oscar Hellström <oscar@oscarh.net> (http://oscar.hellstrom.st) | 3 " Maintainer: Csaba Hoch <csaba.hoch@gmail.com> |
4 " Contributors: Ricardo Catalinas Jiménez <jimenezrick@gmail.com> | 4 " Former Maintainer: KreÄ…imir Marľić (Kresimir Marzic) <kmarzic@fly.srk.fer.hr> |
5 " Last Update: 2013-Mar-07 | |
5 " License: Vim license | 6 " License: Vim license |
6 " Version: 2011/09/11 | 7 " URL: https://github.com/hcs42/vim-erlang |
7 | 8 |
8 if exists("b:current_syntax") | 9 " Customization: |
9 finish | 10 " |
10 else | 11 " There are two optional sets of highlighting: |
11 let b:current_syntax = "erlang" | 12 " |
13 " 1. The BIFs (built-in functions) are highlighted by default. To disable | |
14 " this, put the following line in your vimrc: | |
15 " | |
16 " let g:erlang_highlight_bifs = 0 | |
17 " | |
18 " 2. To enable highlighting some special atoms, put this in your vimrc: | |
19 " | |
20 " let g:erlang_highlight_special_atoms = 1 | |
21 | |
22 " For version 5.x: Clear all syntax items | |
23 " For version 6.x: Quit when a syntax file was already loaded | |
24 if version < 600 | |
25 syntax clear | |
26 elseif exists("b:current_syntax") | |
27 finish | |
12 endif | 28 endif |
13 | 29 |
14 if !exists("g:erlang_highlight_bif") | 30 " Case sensitive |
15 let g:erlang_highlight_bif = 1 | 31 syn case match |
32 | |
33 if version >= 600 | |
34 setlocal iskeyword+=$,@-@ | |
16 endif | 35 endif |
17 | 36 |
18 " Erlang is case sensitive | 37 " Comments |
19 syn case match | 38 syn match erlangComment '%.*$' contains=erlangCommentAnnotation,erlangTodo |
39 syn match erlangCommentAnnotation ' \@<=@\%(clear\|docfile\|end\|headerfile\|todo\|TODO\|type\|author\|copyright\|doc\|reference\|see\|since\|title\|version\|deprecated\|hidden\|private\|equiv\|spec\|throws\)' contained | |
40 syn match erlangCommentAnnotation /`[^']*'/ contained | |
41 syn keyword erlangTodo TODO FIXME XXX contained | |
20 | 42 |
21 " Match groups | 43 " Numbers (minimum base is 2, maximum is 36.) |
22 syn match erlangStringModifier /\\./ contained | 44 syn match erlangNumberInteger '\<\d\+\>' |
23 syn match erlangStringModifier /\~\%(-\?[0-9*]\+\)\?\%(\.[0-9*]\+\..\?\)\?\%(c\|f\|e\|g\|s\|w\|p\|W\|P\|B\|X\|#\|b\|+\|n\|i\)/ contained | 45 syn match erlangNumberInteger '\<\%([2-9]\|[12]\d\|3[0-6]\)\+#[[:alnum:]]\+\>' |
24 syn match erlangModifier /\$\\\?./ | 46 syn match erlangNumberFloat '\<\d\+\.\d\+\%([eE][+-]\=\d\+\)\=\>' |
25 | 47 |
26 syn match erlangInteger /\<\%([0-9]\+#[0-9a-fA-F]\+\|[0-9]\+\)\>/ | 48 " Strings, atoms, characters |
27 syn match erlangFloat /\<[0-9]\+\.[0-9]\+\%(e-\?[0-9]\+\)\?\>/ | 49 syn region erlangString start=/"/ end=/"/ contains=erlangStringModifier |
50 syn region erlangQuotedAtom start=/'/ end=/'/ contains=erlangQuotedAtomModifier | |
51 syn match erlangStringModifier '\~\a\|\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)' contained | |
52 syn match erlangQuotedAtomModifier '\~\a\|\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)' contained | |
53 syn match erlangModifier '\$\%([^\\]\|\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)\)' | |
28 | 54 |
29 syn keyword erlangTodo TODO FIXME XXX contained | 55 " Operators |
30 syn match erlangComment /%.*$/ contains=@Spell,erlangTodo,erlangAnnotation | 56 syn match erlangOperator '==\|=:=\|/=\|=/=\|<\|=<\|>\|>=\|++\|--\|=\|!\|<-\|+\|-\|\*\|\/' |
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 | 57 syn keyword erlangOperator div rem or xor bor bxor bsl bsr and band not bnot andalso orelse |
32 syn match erlangAnnotation /`[^']\+'/ contained | |
33 | 58 |
34 syn keyword erlangKeyword band bor bnot bsl bsr bxor div rem xor | 59 " Separators |
35 syn keyword erlangKeyword try catch begin receive after cond fun let query | 60 syn match erlangSeparator '(\|)\|{\|}\|\[\|]\||\|||\|;\|,\|?\|#' |
61 syn match erlangRightArrow '->' | |
36 | 62 |
37 syn keyword erlangConditional case if of end | 63 " Functions call |
38 syn keyword erlangConditional not and or andalso orelse | 64 syn match erlangFCall '\<\%(\a[[:alnum:]@]*\s*\.\s*\)*\a[[:alnum:]@]*\s*:\s*\a[[:alnum:]@]*\>' |
39 syn keyword erlangConditional when | |
40 | 65 |
41 syn keyword erlangBoolean true false | 66 " Constants and Directives |
67 syn match erlangDirective '-\%(behaviour\|behavior\|compile\|define\|else\|endif\|export\|file\|ifdef\|ifndef\|import\|include_lib\|include\|module\|record\|undef\|author\|copyright\|doc\|vsn\|on_load\|export_type\)\>' | |
42 | 68 |
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 | 69 " Keywords |
70 syn keyword erlangKeyword after begin case catch cond end fun if let of query receive when try | |
71 syn keyword erlangExtra true false | |
44 | 72 |
45 syn match erlangOperator /\/\|*\|+\|-\|++\|--/ | |
46 syn match erlangOperator /->\|<-\|||\||\|!\|=/ | |
47 syn match erlangOperator /=:=\|==\|\/=\|=\/=\|<\|>\|=<\|>=/ | |
48 syn keyword erlangOperator div rem | |
49 | 73 |
50 syn region erlangString start=/"/ end=/"/ skip=/\\/ contains=@Spell,erlangStringModifier | 74 if !exists("g:erlang_highlight_bifs") || g:erlang_highlight_bifs == 1 |
51 | 75 |
52 syn match erlangVariable /\<[A-Z_]\w*\>/ | 76 " build-in-functions (BIFs) |
53 syn match erlangAtom /\%(\%(^-\)\|#\)\@<!\<[a-z][A-Za-z0-9_]*\>\%(\s*[(:]\)\@!/ | 77 syn keyword erlangBIF abs alive apply atom_to_binary atom_to_list binary_part binary_to_atom binary_to_existing_atom binary_to_float binary_to_integer bitstring_to_list binary_to_list binary_to_term bit_size byte_size check_old_code check_process_code concat_binary date delete_module demonitor disconnect_node element erase error exit float float_to_binary float_to_list garbage_collect get get_keys group_leader halt hd integer_to_binary integer_to_list iolist_to_binary iolist_size 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 pre_loaded process_flag process_flag process_info process purge_module put register registered round self setelement size spawn spawn_link spawn_monitor spawn_opt split_binary statistics term_to_binary throw time tl trunc tuple_size tuple_to_list unlink unregister whereis |
54 syn match erlangAtom /\\\@<!'[^']*\\\@<!'/ | |
55 | 78 |
56 syn match erlangRecord /#\w\+/ | 79 endif |
57 | 80 |
58 syn match erlangTuple /{\|}/ | |
59 syn match erlangList /\[\|\]/ | |
60 | 81 |
61 syn match erlangAttribute /^-\%(vsn\|author\|copyright\|compile\|deprecated\|module\|export\|import\|behaviour\|behavior\|export_type\|ignore_xref\|on_load\)\s*(\@=/ | 82 if exists("g:erlang_highlight_special_atoms") && g:erlang_highlight_special_atoms == 1 |
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*(\@=\)\?/ | |
66 | 83 |
67 syn match erlangType /^-\%(spec\|type\)[( ]\@=/ | 84 " Processes |
85 syn keyword erlangProcess creation current_function dictionary | |
86 syn keyword erlangProcess group_leader heap_size high initial_call | |
87 syn keyword erlangProcess linked low memory_in_use message_queue | |
88 syn keyword erlangProcess net_kernel node normal priority | |
89 syn keyword erlangProcess reductions registered_name runnable | |
90 syn keyword erlangProcess running stack_trace status timer | |
91 syn keyword erlangProcess trap_exit waiting | |
68 | 92 |
69 syn match erlangMacro /\%(-define(\)\@<=\w\+/ | 93 " Ports |
70 syn match erlangMacro /?\??\w\+/ | 94 syn keyword erlangPort command count_in count_out creation in |
95 syn keyword erlangPort in_format linked node out owner packeting | |
71 | 96 |
72 syn match erlangBitType /\%(\/\|-\)\@<=\%(bits\|bitstring\|binary\|integer\|float\|unit\)\>/ | 97 " Nodes |
73 syn match erlangBitSize /:\@<=[0-9]\+/ | 98 syn keyword erlangNode atom_tables communicating creation |
99 syn keyword erlangNode current_gc current_reductions current_runtime | |
100 syn keyword erlangNode current_wall_clock distribution_port | |
101 syn keyword erlangNode entry_points error_handler friends | |
102 syn keyword erlangNode garbage_collection magic_cookie magic_cookies | |
103 syn keyword erlangNode module_table monitored_nodes name next_ref | |
104 syn keyword erlangNode ports preloaded processes reductions | |
105 syn keyword erlangNode ref_state registry runtime wall_clock | |
74 | 106 |
75 syn match erlangBinary /<<\|>>/ | 107 " Reserved |
108 syn keyword erlangReserved apply_lambda module_info module_lambdas | |
109 syn keyword erlangReserved record record_index record_info | |
76 | 110 |
77 " BIFs | 111 " Extras |
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]\)\@=/ | 112 syn keyword erlangExtra badarg nocookie |
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\)\@=/ | |
81 | 113 |
82 " Link Erlang stuff to Vim groups | 114 " Signals |
83 hi link erlangTodo Todo | 115 syn keyword erlangSignal badsig kill killed exit normal |
84 hi link erlangString String | 116 endif |
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 | |
121 | 117 |
122 " Optional highlighting | 118 " Sync at the beginning of functions: if this is not used, multiline string |
123 if g:erlang_highlight_bif | 119 " are not always recognized |
124 hi link erlangBIF Keyword | 120 syn sync match erlangSync grouphere NONE "^[a-z]\s*(" |
125 hi link erlangGBIF Keyword | 121 |
122 " Define the default highlighting. | |
123 " For version 5.7 and earlier: only when not done already | |
124 " For version 5.8 and later: only when an item doesn't have highlighting yet | |
125 if version >= 508 || !exists ("did_erlang_inits") | |
126 if version < 508 | |
127 let did_erlang_inits = 1 | |
128 command -nargs=+ HiLink hi link <args> | |
129 else | |
130 command -nargs=+ HiLink hi def link <args> | |
131 endif | |
132 | |
133 " erlang_characters | |
134 HiLink erlangComment Comment | |
135 HiLink erlangCommentAnnotation Special | |
136 HiLink erlangTodo Todo | |
137 HiLink erlangSeparator Normal | |
138 HiLink erlangOperator Operator | |
139 HiLink erlangRightArrow Operator | |
140 | |
141 HiLink erlangStartString String | |
142 HiLink erlangString String | |
143 HiLink erlangStringModifier Special | |
144 | |
145 HiLink erlangStartQuotedAtom Type | |
146 HiLink erlangQuotedAtom Type | |
147 HiLink erlangQuotedAtomModifier Special | |
148 | |
149 HiLink erlangNumberInteger Number | |
150 HiLink erlangNumberFloat Float | |
151 HiLink erlangNumberHex Number | |
152 | |
153 HiLink erlangModifier Special | |
154 | |
155 " erlang_functions | |
156 HiLink erlangFCall Function | |
157 HiLink erlangBIF Function | |
158 | |
159 " erlang_keywords | |
160 HiLink erlangDirective Type | |
161 HiLink erlangKeyword Keyword | |
162 HiLink erlangProcess Special | |
163 HiLink erlangPort Special | |
164 HiLink erlangNode Special | |
165 HiLink erlangReserved Statement | |
166 HiLink erlangExtra Statement | |
167 HiLink erlangSignal Statement | |
168 | |
169 delcommand HiLink | |
126 endif | 170 endif |
171 | |
172 | |
173 let b:current_syntax = "erlang" | |
174 | |
175 " vim: sw=2 et |