annotate runtime/syntax/asm.vim @ 13918:9cef228c53d6

Added tag v8.0.1829 for changeset f6dcc1a8d5846b6904f38a5b40d0df9e40fe5592
author Christian Brabandt <cb@256bit.org>
date Sun, 13 May 2018 15:00:07 +0200
parents 46763b01cd9a
children 8dad79c661d1
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
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 5663
diff changeset
10 " quit when a syntax file was already loaded
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 5663
diff changeset
11 if exists("b:current_syntax")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
15 let s:cpo_save = &cpo
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
16 set cpo&vim
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
17
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 syn case ignore
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 " storage types
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 syn match asmType "\.long"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 syn match asmType "\.ascii"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 syn match asmType "\.asciz"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 syn match asmType "\.byte"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 syn match asmType "\.double"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 syn match asmType "\.float"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 syn match asmType "\.hword"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 syn match asmType "\.int"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 syn match asmType "\.octa"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 syn match asmType "\.quad"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 syn match asmType "\.short"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 syn match asmType "\.single"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 syn match asmType "\.space"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 syn match asmType "\.string"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 syn match asmType "\.word"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 syn match asmLabel "[a-z_][a-z0-9_]*:"he=e-1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 syn match asmIdentifier "[a-z_][a-z0-9_]*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 " Various #'s as defined by GAS ref manual sec 3.6.2.1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 " Technically, the first decNumber def is actually octal,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 " 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
43 " I (Kevin) prefer to map it as decimal:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 syn match decNumber "0\+[1-7]\=[\t\n$,; ]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 syn match decNumber "[1-9]\d*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 syn match octNumber "0[0-7][0-7]\+"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 syn match hexNumber "0[xX][0-9a-fA-F]\+"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 syn match binNumber "0[bB][0-1]*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2042
diff changeset
50 syn keyword asmTodo contained TODO
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2042
diff changeset
51
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
52
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
53 " GAS supports one type of multi line comments:
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2042
diff changeset
54 syn region asmComment start="/\*" end="\*/" contains=asmTodo
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
55
3465
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3256
diff changeset
56 " GAS (undocumentedly?) supports C++ style comments. Unlike in C/C++ however,
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3256
diff changeset
57 " 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
58 " next line (hence the syntax region does not define 'skip="\\$"')
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3256
diff changeset
59 syn region asmComment start="//" end="$" keepend contains=asmTodo
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3256
diff changeset
60
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
61 " Line comment characters depend on the target architecture and command line
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
62 " 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
63 " preprocessor commands. This situation is described at
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
64 " http://sourceware.org/binutils/docs-2.22/as/Comments.html
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
65 " Some line comment characters have other meanings for other targets. For
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
66 " 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
67 " comment marker.
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
68 " 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
69 " frequently used features of the most popular architectures (and also the
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
70 " 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
71 " 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
72 syn match asmComment "[#;!|].*" contains=asmTodo
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
73
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
74 " Side effects of this include:
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
75 " - 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
76 " support this), all statements except the first get highlighted as
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
77 " comments. As a remedy, remove `;' from the above.
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
78 " - ARM comments are not highlighted correctly. For ARM, uncomment the
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
79 " following two lines and comment the one above.
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
80 "syn match asmComment "@.*" contains=asmTodo
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
81 "syn match asmComment "^#.*" contains=asmTodo
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
82
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
83 " Advanced users of specific architectures will probably want to change the
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
84 " comment highlighting or use a specific, more comprehensive syntax file.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 syn match asmInclude "\.include"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 syn match asmCond "\.if"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 syn match asmCond "\.else"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 syn match asmCond "\.endif"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 syn match asmMacro "\.macro"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 syn match asmMacro "\.endm"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
5663
1dea14d4c738 Update runtime files. Add support for systemverilog.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
93 " 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
94 " .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
95 " 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
96 " 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
97 syn match asmDirective "\.[A-Za-z][0-9A-Za-z-_]*"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 syn case match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 " Define the default highlighting.
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 5663
diff changeset
103 " Only when an item doesn't have highlighting yet
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 5663
diff changeset
104
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 5663
diff changeset
105 " The default methods for highlighting. Can be overridden later
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
106 hi def link asmSection Special
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
107 hi def link asmLabel Label
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
108 hi def link asmComment Comment
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
109 hi def link asmTodo Todo
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
110 hi def link asmDirective Statement
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
112 hi def link asmInclude Include
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
113 hi def link asmCond PreCondit
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
114 hi def link asmMacro Macro
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
116 hi def link hexNumber Number
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
117 hi def link decNumber Number
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
118 hi def link octNumber Number
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
119 hi def link binNumber Number
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
121 hi def link asmIdentifier Identifier
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
122 hi def link asmType Type
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
123
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 let b:current_syntax = "asm"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
127 let &cpo = s:cpo_save
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
128 unlet s:cpo_save
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
129
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 " vim: ts=8