Runtime files update
[MacVim.git] / runtime / syntax / erlang.vim
blob573e67f1ee5da8d5e13a71ffa3dfad0b92a8ac58
1 " Vim syntax file
2 " Language:    erlang (ERicsson LANGuage)
3 "              http://www.erlang.se
4 "              http://www.erlang.org
5 " Maintainer:  Csaba Hoch <csaba.hoch@gmail.com>
6 " Former Maintainer:  Kreąimir Marľić (Kresimir Marzic) <kmarzic@fly.srk.fer.hr>
7 " Last update: Sat, 08-Dec-2007
8 " Filenames:   .erl
9 " URL:         http://www.srk.fer.hr/~kmarzic/vim/syntax/erlang.vim
12 " There are three sets of highlighting in here:
13 " One is "erlang_characters", second is "erlang_functions" and third
14 " is "erlang_keywords".
15 " If you want to disable keywords highlighting, put in your .vimrc:
16 "       let erlang_keywords=1
17 " If you want to disable erlang BIF highlighting, put in your .vimrc
18 " this:
19 "       let erlang_functions=1
20 " If you want to disable special characters highlighting, put in
21 " your .vimrc:
22 "       let erlang_characters=1
25 " For version 5.x: Clear all syntax items
26 " For version 6.x: Quit when a syntax file was already loaded
27 if version < 600
28     syntax clear
29 elseif exists ("b:current_syntax")
30     finish
31 endif
34 " Case sensitive
35 syn case match
38 if ! exists ("erlang_characters")
40     " Basic elements
41     syn match   erlangComment          "%.*$" contains=erlangAnnotation,erlangTodo
42     syn match   erlangAnnotation       " \@<=@\%(type\|spec\|\)" contained
43     syn keyword erlangTodo             TODO FIXME XXX contained
44     syn match   erlangModifier         "\~\a\|\\\a\|\\\\" contained
45     syn match   erlangSpecialCharacter ":\|_\|@\|\\\|\"\|\."
46     syn match   erlangSeparator        "(\|)\|{\|}\|\[\|]\||\|||\|;\|,\|?\|->\|#" contained
47     syn region  erlangString           start=+"+ skip=+\\.+ end=+"+ contains=erlangModifier
48     syn region  erlangAtom             start=+'+ skip=+\\'+ end=+'+
50     " Operators
51     syn match   erlangOperator         "+\|-\|\*\|\/"
52     syn keyword erlangOperator         div rem or xor bor bxor bsl bsr
53     syn keyword erlangOperator         and band not bnot
54     syn match   erlangOperator         "==\|/=\|=:=\|=/=\|<\|=<\|>\|>="
55     syn match   erlangOperator         "++\|--\|=\|!\|<-"
57     " Numbers
58     syn match   erlangNumberInteger    "\d\+" contains=erlangSeparator
59     syn match   erlangNumberFloat1     "\d\+\.\d\+" contains=erlangSeparator
60     syn match   erlangNumberFloat2     "\d\+\(\.\d\+\)\=[eE][+-]\=\d\+\(\.\d\+\)\=" contains=erlangSeparator
61     syn match   erlangNumberFloat3     "\d\+[#]\x\+" contains=erlangSeparator
62     syn match   erlangNumberHex        "$\x\+" contains=erlangSeparator
64     " Ignore '_' and '-' in words
65     syn match   erlangWord             "\h\+\w*"
66     "TODELETE old: syn match   erlangWord             "\h\+[[:alnum:]-]*"
68     syn match   erlangChar             /\$./
69 endif
71 if ! exists ("erlang_functions")
72     " Functions call
73     syn match   erlangFCall      "\w\+\(\s\+\)\=[:@]\(\s\+\)\=\w\+"
75     " build-in-functions (BIFs)
76     syn keyword erlangBIF        abs alive apply atom_to_list
77     syn keyword erlangBIF        binary_to_list binary_to_term
78     syn keyword erlangBIF        concat_binary
79     syn keyword erlangBIF        date disconnect_node
80     syn keyword erlangBIF        element erase exit
81     syn keyword erlangBIF        float float_to_list
82     syn keyword erlangBIF        get get_keys group_leader
83     syn keyword erlangBIF        halt hd
84     syn keyword erlangBIF        integer_to_list is_alive
85     syn keyword erlangBIF        length link list_to_atom list_to_binary
86     syn keyword erlangBIF        list_to_float list_to_integer list_to_pid
87     syn keyword erlangBIF        list_to_tuple load_module
88     syn keyword erlangBIF        make_ref monitor_node
89     syn keyword erlangBIF        node nodes now
90     syn keyword erlangBIF        open_port
91     syn keyword erlangBIF        pid_to_list process_flag
92     syn keyword erlangBIF        process_info process put
93     syn keyword erlangBIF        register registered round
94     syn keyword erlangBIF        self setelement size spawn
95     syn keyword erlangBIF        spawn_link split_binary statistics
96     syn keyword erlangBIF        term_to_binary throw time tl trunc
97     syn keyword erlangBIF        tuple_to_list
98     syn keyword erlangBIF        unlink unregister
99     syn keyword erlangBIF        whereis
101     " Other BIFs
102     syn keyword erlangBIF        atom binary constant function integer
103     syn keyword erlangBIF        list number pid ports port_close port_info
104     syn keyword erlangBIF        reference record
106     " erlang:BIFs
107     syn keyword erlangBIF        check_process_code delete_module
108     syn keyword erlangBIF        get_cookie hash math module_loaded
109     syn keyword erlangBIF        preloaded processes purge_module set_cookie
110     syn keyword erlangBIF        set_node
112     " functions of math library
113     syn keyword erlangFunction   acos asin atan atan2 cos cosh exp
114     syn keyword erlangFunction   log log10 pi pow power sin sinh sqrt
115     syn keyword erlangFunction   tan tanh
117     " Other functions
118     syn keyword erlangFunction   call module_info parse_transform
119     syn keyword erlangFunction   undefined_function
121     " Modules
122     syn keyword erlangModule     error_handler
123 endif
125 if ! exists ("erlang_keywords")
126     " Constants and Directives
127     syn match   erlangDirective  "-behaviour\|-behaviour"
128     syn match   erlangDirective  "-compile\|-define\|-else\|-endif\|-export\|-file"
129     syn match   erlangDirective  "-ifdef\|-ifndef\|-import\|-include_lib\|-include"
130     syn match   erlangDirective  "-module\|-record\|-undef"
132     syn match   erlangConstant   "-author\|-copyright\|-doc\|-vsn"
134     " Keywords
135     syn keyword erlangKeyword    after begin case catch
136     syn keyword erlangKeyword    cond end fun if
137     syn keyword erlangKeyword    let of query receive
138     syn keyword erlangKeyword    when
139     syn keyword erlangKeyword    try
141     " Processes
142     syn keyword erlangProcess    creation current_function dictionary
143     syn keyword erlangProcess    group_leader heap_size high initial_call
144     syn keyword erlangProcess    linked low memory_in_use message_queue
145     syn keyword erlangProcess    net_kernel node normal priority
146     syn keyword erlangProcess    reductions registered_name runnable
147     syn keyword erlangProcess    running stack_trace status timer
148     syn keyword erlangProcess    trap_exit waiting
150     " Ports
151     syn keyword erlangPort       command count_in count_out creation in
152     syn keyword erlangPort       in_format linked node out owner packeting
154     " Nodes
155     syn keyword erlangNode       atom_tables communicating creation
156     syn keyword erlangNode       current_gc current_reductions current_runtime
157     syn keyword erlangNode       current_wall_clock distribution_port
158     syn keyword erlangNode       entry_points error_handler friends
159     syn keyword erlangNode       garbage_collection magic_cookie magic_cookies
160     syn keyword erlangNode       module_table monitored_nodes name next_ref
161     syn keyword erlangNode       ports preloaded processes reductions
162     syn keyword erlangNode       ref_state registry runtime wall_clock
164     " Reserved
165     syn keyword erlangReserved   apply_lambda module_info module_lambdas
166     syn keyword erlangReserved   record record_index record_info
168     " Extras
169     syn keyword erlangExtra      badarg nocookie false fun true
171     " Signals
172     syn keyword erlangSignal     badsig kill killed exit normal
173 endif
177 " Define the default highlighting.
178 " For version 5.7 and earlier: only when not done already
179 " For version 5.8 and later: only when an item doesn't have highlighting yet
180 if version >= 508 || !exists ("did_erlang_inits")
181     if version < 508
182         let did_erlang_inits = 1
183         command -nargs=+ HiLink hi link <args>
184     else
185         command -nargs=+ HiLink hi def link <args>
186     endif
188     " erlang_characters
189     HiLink erlangComment Comment
190     HiLink erlangAnnotation Special
191     HiLink erlangTodo Todo
192     HiLink erlangSpecialCharacter Special
193     HiLink erlangSeparator Normal
194     HiLink erlangModifier Special
195     HiLink erlangOperator Operator
196     HiLink erlangString String
197     HiLink erlangAtom Type
199     HiLink erlangNumberInteger Number
200     HiLink erlangNumberFloat1 Float
201     HiLink erlangNumberFloat2 Float
202     HiLink erlangNumberFloat3 Float
203     HiLink erlangNumberFloat4 Float
204     HiLink erlangNumberHex Number
206     HiLink erlangWord Normal
208     " erlang_functions
209     HiLink erlangFCall Function
210     HiLink erlangBIF Function
211     HiLink erlangFunction Function
212     HiLink erlangModuleFunction Function
214     " erlang_keywords
215     HiLink erlangDirective Type
216     HiLink erlangConstant Type
217     HiLink erlangKeyword Keyword
218     HiLink erlangProcess Special
219     HiLink erlangPort Special
220     HiLink erlangNode Special
221     HiLink erlangReserved Statement
222     HiLink erlangExtra Statement
223     HiLink erlangSignal Statement
225     delcommand HiLink
226 endif
229 let b:current_syntax = "erlang"