annotate runtime/syntax/asm.vim @ 3466:e34c620007be v7.3.497

updated for version 7.3.497 Problem: Crash when doing ":python print" and compiled with gcc and the optimizer enabled. Solution: Avoid the crash, doesn't really fix the problem. (Christian Brabandt)
author Bram Moolenaar <bram@vim.org>
date Fri, 20 Apr 2012 13:31:21 +0200
parents 161d01cbb165
children 1dea14d4c738
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>
3465
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3256
diff changeset
6 " Last Change: 2012 Apr 09
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 syn match asmDirective "\.[a-z][a-z]\+"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 syn case match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 " Define the default highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 " For version 5.7 and earlier: only when not done already
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 " 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
104 if version >= 508 || !exists("did_asm_syntax_inits")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 if version < 508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 let did_asm_syntax_inits = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 command -nargs=+ HiLink hi link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 command -nargs=+ HiLink hi def link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 " The default methods for highlighting. Can be overridden later
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 HiLink asmSection Special
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 HiLink asmLabel Label
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 HiLink asmComment Comment
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2042
diff changeset
116 HiLink asmTodo Todo
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 HiLink asmDirective Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 HiLink asmInclude Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 HiLink asmCond PreCondit
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 HiLink asmMacro Macro
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 HiLink hexNumber Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 HiLink decNumber Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 HiLink octNumber Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 HiLink binNumber Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
128 HiLink asmIdentifier Identifier
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 HiLink asmType Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 delcommand HiLink
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 let b:current_syntax = "asm"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
136 let &cpo = s:cpo_save
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
137 unlet s:cpo_save
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
138
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 " vim: ts=8