diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-07-11 04:05:51 +0000 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-07-29 02:12:31 +0000 |
commit | a98a6996c291b3e300d27b791eded9eed333d677 (patch) | |
tree | 51d92f6cac128f938cd0aaa9a8dd0ce7a83d63a9 /runtime/syntax/asm.vim | |
parent | 66bc13163398786c88e20b7cdd61c66978b4d3fb (diff) | |
download | rneovim-a98a6996c291b3e300d27b791eded9eed333d677.tar.gz rneovim-a98a6996c291b3e300d27b791eded9eed333d677.tar.bz2 rneovim-a98a6996c291b3e300d27b791eded9eed333d677.zip |
re-integrate runtime/ vim-patch:0 #938
Vim runtime files based on 7.4.384 / hg changeset 7090d7f160f7
Excluding:
Amiga icons (*.info, icons/)
doc/hangulin.txt
tutor/
spell/
lang/ (only used for menu translations)
macros/maze/, macros/hanoi/, macros/life/, macros/urm/
These were used to test vi compatibility.
termcap
"Demonstration of a termcap file (for the Amiga and Archimedes)"
Helped-by: Rich Wareham <rjw57@cam.ac.uk>
Helped-by: John <john.schmidt.h@gmail.com>
Helped-by: Yann <yann@yann-salaun.com>
Helped-by: Christophe Badoit <c.badoit@lesiteimmo.com>
Helped-by: drasill <github@tof2k.com>
Helped-by: Tae Sandoval Murgan <taecilla@gmail.com>
Helped-by: Lowe Thiderman <lowe.thiderman@gmail.com>
Diffstat (limited to 'runtime/syntax/asm.vim')
-rw-r--r-- | runtime/syntax/asm.vim | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/runtime/syntax/asm.vim b/runtime/syntax/asm.vim new file mode 100644 index 0000000000..e5f16c5bdc --- /dev/null +++ b/runtime/syntax/asm.vim @@ -0,0 +1,143 @@ +" Vim syntax file +" Language: GNU Assembler +" Maintainer: Erik Wognsen <erik.wognsen@gmail.com> +" Previous maintainer: +" Kevin Dahlhausen <kdahlhaus@yahoo.com> +" Last Change: 2014 Feb 04 + +" Thanks to Ori Avtalion for feedback on the comment markers! + +" For version 5.x: Clear all syntax items +" For version 6.0 and later: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +syn case ignore + +" storage types +syn match asmType "\.long" +syn match asmType "\.ascii" +syn match asmType "\.asciz" +syn match asmType "\.byte" +syn match asmType "\.double" +syn match asmType "\.float" +syn match asmType "\.hword" +syn match asmType "\.int" +syn match asmType "\.octa" +syn match asmType "\.quad" +syn match asmType "\.short" +syn match asmType "\.single" +syn match asmType "\.space" +syn match asmType "\.string" +syn match asmType "\.word" + +syn match asmLabel "[a-z_][a-z0-9_]*:"he=e-1 +syn match asmIdentifier "[a-z_][a-z0-9_]*" + +" Various #'s as defined by GAS ref manual sec 3.6.2.1 +" Technically, the first decNumber def is actually octal, +" since the value of 0-7 octal is the same as 0-7 decimal, +" I (Kevin) prefer to map it as decimal: +syn match decNumber "0\+[1-7]\=[\t\n$,; ]" +syn match decNumber "[1-9]\d*" +syn match octNumber "0[0-7][0-7]\+" +syn match hexNumber "0[xX][0-9a-fA-F]\+" +syn match binNumber "0[bB][0-1]*" + +syn keyword asmTodo contained TODO + + +" GAS supports one type of multi line comments: +syn region asmComment start="/\*" end="\*/" contains=asmTodo + +" GAS (undocumentedly?) supports C++ style comments. Unlike in C/C++ however, +" a backslash ending a C++ style comment does not extend the comment to the +" next line (hence the syntax region does not define 'skip="\\$"') +syn region asmComment start="//" end="$" keepend contains=asmTodo + +" Line comment characters depend on the target architecture and command line +" options and some comments may double as logical line number directives or +" preprocessor commands. This situation is described at +" http://sourceware.org/binutils/docs-2.22/as/Comments.html +" Some line comment characters have other meanings for other targets. For +" example, .type directives may use the `@' character which is also an ARM +" comment marker. +" As a compromise to accommodate what I arbitrarily assume to be the most +" frequently used features of the most popular architectures (and also the +" non-GNU assembly languages that use this syntax file because their asm files +" are also named *.asm), the following are used as line comment characters: +syn match asmComment "[#;!|].*" contains=asmTodo + +" Side effects of this include: +" - When `;' is used to separate statements on the same line (many targets +" support this), all statements except the first get highlighted as +" comments. As a remedy, remove `;' from the above. +" - ARM comments are not highlighted correctly. For ARM, uncomment the +" following two lines and comment the one above. +"syn match asmComment "@.*" contains=asmTodo +"syn match asmComment "^#.*" contains=asmTodo + +" Advanced users of specific architectures will probably want to change the +" comment highlighting or use a specific, more comprehensive syntax file. + +syn match asmInclude "\.include" +syn match asmCond "\.if" +syn match asmCond "\.else" +syn match asmCond "\.endif" +syn match asmMacro "\.macro" +syn match asmMacro "\.endm" + +" Assembler directives start with a '.' and may contain upper case (e.g., +" .ABORT), numbers (e.g., .p2align), dash (e.g., .app-file) and underscore in +" CFI directives (e.g., .cfi_startproc). This will also match labels starting +" with '.', including the GCC auto-generated '.L' labels. +syn match asmDirective "\.[A-Za-z][0-9A-Za-z-_]*" + + +syn case match + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_asm_syntax_inits") + if version < 508 + let did_asm_syntax_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + " The default methods for highlighting. Can be overridden later + HiLink asmSection Special + HiLink asmLabel Label + HiLink asmComment Comment + HiLink asmTodo Todo + HiLink asmDirective Statement + + HiLink asmInclude Include + HiLink asmCond PreCondit + HiLink asmMacro Macro + + HiLink hexNumber Number + HiLink decNumber Number + HiLink octNumber Number + HiLink binNumber Number + + HiLink asmIdentifier Identifier + HiLink asmType Type + + delcommand HiLink +endif + +let b:current_syntax = "asm" + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: ts=8 |