2 " Language: erlang (ERicsson LANGuage)
4 " http://www.erlang.org
5 " Maintainer: Kre¹imir Mar¾iæ (Kresimir Marzic) <kmarzic@fly.srk.fer.hr>
6 " Last update: Fri, 27-Apr-2001
8 " URL: http://www.srk.fer.hr/~kmarzic/vim/syntax/erlang.vim
11 " There are three sets of highlighting in here:
12 " One is "erlang_characters", second is "erlang_functions" and third
13 " is "erlang_keywords".
14 " If you want to disable keywords highlighting, put in your .vimrc:
15 " let erlang_keywords=1
16 " If you want to disable erlang function highlighting, put in your .vimrc
18 " let erlang_functions=1
19 " If you want to disable special characters highlighting, put in
21 " let erlang_characters=1
24 " For version 5.x: Clear all syntax items
25 " For version 6.x: Quit when a syntax file was already loaded
28 elseif exists ("b:current_syntax")
36 if ! exists ("erlang_characters")
37 syn match erlangComment "%.*"
38 syn match erlangModifier "\~w\|\~n"
39 syn match erlangOperator "/=\|=/=\|=:=\|=<\|==\|>=\|<\|>"
40 " syn match erlangOperator "+\|-\|\*\|\/"
41 syn match erlangOperator "!\|->\|\."
42 syn keyword erlangOperator div rem band bor bxor bsl bsr
43 syn region erlangString start=+"+ skip=+\\"+ end=+"+ contains=erlangModifier
44 syn region erlangAtom start=+'+ skip=+\\'+ end=+'+
45 syn match erlangNumberInteger "\([+-]\)\d\+"
46 syn match erlangNumberFloat0 "[+-]\d\+.\d\+\|\d\+.\d\+"
47 syn match erlangNumberFloat1 "\d\+E\d\+\|\d\+E[+-]\d\+\|[+-]\d\+E\d\+\|[+-]\d\+E[+-]\d\+"
48 syn match erlangNumberFloat1 "\d\+E\d\+.\d\+\|\d\+E[+-]\d\+.\d\+\|[+-]\d\+E\d\+.\d\+\|[+-]\d\+E[+-]\d\+.\d\+"
49 syn match erlangNumberFloat1 "\d\+.\d\+E\d\+\|\d\+.\d\+E[+-]\d\+\|[+-]\d\+.\d\+E\d\+\|[+-]\d\+.\d\+E[+-]\d\+"
50 syn match erlangNumberFloat1 "\d\+.\d\+E\d\+.\d\+\|\d\+.\d\+E[+-]\d\+.\d\+\|[+-]\d\+.\d\+E\d\+.\d\+\|[+-]\d\+.\d\+E[+-]\d\+.\d\+"
51 syn match erlangNumberFloat2 "\d\+#[A-F0-9]\+"
52 syn match erlangNumberFloat2 "\E\d\+\|\E\+[+-]\d\+"
53 syn match erlangNumberFloat3 "$\x\+"
56 if ! exists ("erlang_functions")
57 syn keyword erlangFunction abs append apply atom_to_list binary
58 syn keyword erlangFunction concat_binary binary_to_list binary_to_term
59 syn keyword erlangFunction concat_binary date element erase exit float
60 syn keyword erlangFunction float_to_list get get_keys group_leader halt
61 syn keyword erlangFunction hash hd integer_to_list length link
62 syn keyword erlangFunction list_to_atom list_to_binary list_to_float
63 syn keyword erlangFunction list_to_integer list_to_pid list_to_touple
64 syn keyword erlangFunction make_ref now open_port pid_to_list
65 syn keyword erlangFunction process_flag process_info processes put
66 syn keyword erlangFunction register registered round self send
67 syn keyword erlangFunction setelement size spawn spawn_link split_binary
68 syn keyword erlangFunction throw time tl trunc tuple_to_list unlink
69 syn keyword erlangFunction unregister whereis
71 syn keyword erlangGuard atom constant float integer list number pid
72 syn keyword erlangGuard port reference tuple binary
74 syn keyword erlangBif element float hd length round self size
75 syn keyword erlangBif trunc tl abs node nodes
78 if ! exists ("erlang_keywords")
79 syn match erlangConstant "-author\|-behaviour\|-copyright\|-define"
80 syn match erlangConstant "-export\|-include\|-module\|-vsn"
82 syn keyword erlangKeyword alive check_process_code delete_module
83 syn keyword erlangKeyword disconnect_node get_cookie is_alive
84 syn keyword erlangKeyword load_module math module_load monitor_node
85 syn keyword erlangKeyword node nodes pre_load purge_module set_cookie
86 syn keyword erlangKeyword statistics term_to_binary
88 syn keyword erlangCondition end endif else elseif if of after
89 syn keyword erlangCondition receive when case case_clause
94 " Define the default highlighting.
95 " For version 5.7 and earlier: only when not done already
96 " For version 5.8 and later: only when an item doesn't have highlighting yet
97 if version >= 508 || !exists ("did_erlang_inits")
99 let did_erlang_inits = 1
100 command -nargs=+ HiLink hi link <args>
102 command -nargs=+ HiLink hi def link <args>
105 HiLink erlangComment Comment
106 HiLink erlangModifier Special
107 HiLink erlangOperator Operator
108 HiLink erlangString String
109 HiLink erlangAtom String
110 HiLink erlangNumberInteger Number
111 HiLink erlangNumberFloat0 Number
112 HiLink erlangNumberFloat1 Number
113 HiLink erlangNumberFloat2 Number
114 HiLink erlangNumberFloat3 Number
116 HiLink erlangFunction Function
117 HiLink erlangGuard Function
118 HiLink erlangBif Special
120 HiLink erlangConstant Type
121 HiLink erlangKeyword Keyword
122 HiLink erlangCondition Conditional
128 let b:current_syntax = "erlang"