~ubuntu-branches/ubuntu/vivid/vim/vivid

« back to all changes in this revision

Viewing changes to runtime/syntax/erlang.vim

  • Committer: Bazaar Package Importer
  • Author(s): Soren Hansen
  • Date: 2008-11-05 11:37:43 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20081105113743-9i4urcsm3n44mhqe
Tags: 2:7.2.025-2ubuntu1
* Merge from debian unstable, remaining changes:
  - runtime/syntax/debcontrol.vim:
    + Add "metapackages" to the list of valid sections.
  - runtime/syntax/debchangelog.vim:
    + Add "jaunty" to the list of valid suites.
  - Drop vim-lesstif package and lesstif2-dev build-dependency.
  - Enable Python interpreter on basic builds.
  - Create a .pot file for translations.
  - Disable autoindent, line-wrapping, and backup files by default.
  - runtime/syntax/debsources.vim:
    + Add "jaunty" to debsourcesDistrKeyword
  - runtime/syntax/grub.vim:
    + Add Ubuntu-specific 'quiet' keyword.

Show diffs side-by-side

added added

removed removed

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