annotate runtime/syntax/asm.vim @ 7012:0175e7cfea2e

Added tag v7-4-823 for changeset 6cde6404ff7c
author Bram Moolenaar <bram@vim.org>
date Tue, 11 Aug 2015 19:36:42 +0200
parents 1dea14d4c738
children 43efa4f5a8ea
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: GNU Assembler
2042
f3c987fb99b9 Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 7
diff changeset
3 " Maintainer: Erik Wognsen <erik.wognsen@gmail.com>
f3c987fb99b9 Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 7
diff changeset
4 " Previous maintainer:
f3c987fb99b9 Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 7
diff changeset
5 " Kevin Dahlhausen <kdahlhaus@yahoo.com>
5663
1dea14d4c738 Update runtime files. Add support for systemverilog.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6 " Last Change: 2014 Feb 04
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2042
diff changeset
7
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2042
diff changeset
8 " Thanks to Ori Avtalion for feedback on the comment markers!
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 " For version 5.x: Clear all syntax items
2042
f3c987fb99b9 Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 7
diff changeset
11 " For version 6.0 and later: Quit when a syntax file was already loaded
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 syntax clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 elseif exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
18 let s:cpo_save = &cpo
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
19 set cpo&vim
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
20
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 syn case ignore
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 " storage types
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 syn match asmType "\.long"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 syn match asmType "\.ascii"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 syn match asmType "\.asciz"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 syn match asmType "\.byte"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 syn match asmType "\.double"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 syn match asmType "\.float"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 syn match asmType "\.hword"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 syn match asmType "\.int"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 syn match asmType "\.octa"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 syn match asmType "\.quad"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 syn match asmType "\.short"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 syn match asmType "\.single"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 syn match asmType "\.space"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 syn match asmType "\.string"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 syn match asmType "\.word"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 syn match asmLabel "[a-z_][a-z0-9_]*:"he=e-1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 syn match asmIdentifier "[a-z_][a-z0-9_]*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 " Various #'s as defined by GAS ref manual sec 3.6.2.1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 " Technically, the first decNumber def is actually octal,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 " since the value of 0-7 octal is the same as 0-7 decimal,
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
46 " I (Kevin) prefer to map it as decimal:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 syn match decNumber "0\+[1-7]\=[\t\n$,; ]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 syn match decNumber "[1-9]\d*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 syn match octNumber "0[0-7][0-7]\+"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 syn match hexNumber "0[xX][0-9a-fA-F]\+"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 syn match binNumber "0[bB][0-1]*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2042
diff changeset
53 syn keyword asmTodo contained TODO
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2042
diff changeset
54
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
55
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
56 " GAS supports one type of multi line comments:
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2042
diff changeset
57 syn region asmComment start="/\*" end="\*/" contains=asmTodo
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
58
3465
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3256
diff changeset
59 " GAS (undocumentedly?) supports C++ style comments. Unlike in C/C++ however,
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3256
diff changeset
60 " a backslash ending a C++ style comment does not extend the comment to the
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3256
diff changeset
61 " next line (hence the syntax region does not define 'skip="\\$"')
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3256
diff changeset
62 syn region asmComment start="//" end="$" keepend contains=asmTodo
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3256
diff changeset
63
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
64 " Line comment characters depend on the target architecture and command line
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
65 " options and some comments may double as logical line number directives or
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
66 " preprocessor commands. This situation is described at
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
67 " http://sourceware.org/binutils/docs-2.22/as/Comments.html
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
68 " Some line comment characters have other meanings for other targets. For
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
69 " example, .type directives may use the `@' character which is also an ARM
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
70 " comment marker.
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
71 " As a compromise to accommodate what I arbitrarily assume to be the most
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
72 " frequently used features of the most popular architectures (and also the
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
73 " non-GNU assembly languages that use this syntax file because their asm files
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
74 " are also named *.asm), the following are used as line comment characters:
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2042
diff changeset
75 syn match asmComment "[#;!|].*" contains=asmTodo
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
76
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
77 " Side effects of this include:
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
78 " - When `;' is used to separate statements on the same line (many targets
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
79 " support this), all statements except the first get highlighted as
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
80 " comments. As a remedy, remove `;' from the above.
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
81 " - ARM comments are not highlighted correctly. For ARM, uncomment the
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
82 " following two lines and comment the one above.
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
83 "syn match asmComment "@.*" contains=asmTodo
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
84 "syn match asmComment "^#.*" contains=asmTodo
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
85
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
86 " Advanced users of specific architectures will probably want to change the
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
87 " comment highlighting or use a specific, more comprehensive syntax file.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 syn match asmInclude "\.include"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 syn match asmCond "\.if"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 syn match asmCond "\.else"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 syn match asmCond "\.endif"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 syn match asmMacro "\.macro"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 syn match asmMacro "\.endm"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95
5663
1dea14d4c738 Update runtime files. Add support for systemverilog.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
96 " Assembler directives start with a '.' and may contain upper case (e.g.,
1dea14d4c738 Update runtime files. Add support for systemverilog.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
97 " .ABORT), numbers (e.g., .p2align), dash (e.g., .app-file) and underscore in
1dea14d4c738 Update runtime files. Add support for systemverilog.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
98 " CFI directives (e.g., .cfi_startproc). This will also match labels starting
1dea14d4c738 Update runtime files. Add support for systemverilog.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
99 " with '.', including the GCC auto-generated '.L' labels.
1dea14d4c738 Update runtime files. Add support for systemverilog.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
100 syn match asmDirective "\.[A-Za-z][0-9A-Za-z-_]*"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 syn case match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 " Define the default highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 " For version 5.7 and earlier: only when not done already
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 " For version 5.8 and later: only when an item doesn't have highlighting yet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 if version >= 508 || !exists("did_asm_syntax_inits")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 if version < 508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 let did_asm_syntax_inits = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 command -nargs=+ HiLink hi link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 command -nargs=+ HiLink hi def link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 " The default methods for highlighting. Can be overridden later
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 HiLink asmSection Special
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 HiLink asmLabel Label
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 HiLink asmComment Comment
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2042
diff changeset
120 HiLink asmTodo Todo
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 HiLink asmDirective Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 HiLink asmInclude Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 HiLink asmCond PreCondit
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 HiLink asmMacro Macro
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 HiLink hexNumber Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 HiLink decNumber Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 HiLink octNumber Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 HiLink binNumber Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
132 HiLink asmIdentifier Identifier
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 HiLink asmType Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 delcommand HiLink
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 let b:current_syntax = "asm"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
140 let &cpo = s:cpo_save
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
141 unlet s:cpo_save
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
142
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 " vim: ts=8