arm-syntax-vim/syntax/include/arm_base_syntax.vim

69 lines
2.7 KiB
VimL
Raw Permalink Normal View History

2015-03-08 06:48:56 -07:00
setlocal iskeyword +=.,_,\$
2015-10-14 08:02:35 -07:00
2015-03-08 06:48:56 -07:00
syn keyword armTodo contained todo fixme danger note notice bug author date
syn match armNumericOp "[+-/*%<>=&|^!]"
2015-07-15 10:40:39 -07:00
" Assembler identifiers/labels
syn match armIdentifier "\<[.\$_A-Za-z0-9]\+\>"
syn match armLabel "\<[.\$_A-Za-z0-9]\+:"
2015-03-08 06:48:56 -07:00
" dec
2015-10-17 08:12:59 -07:00
syn match armNumber "[#\$]\?\d\+\>"
2015-09-09 08:28:42 -07:00
" hex
2015-10-17 08:12:59 -07:00
syn match armNumber "[#\$]\?0x\x\+\>"
2015-03-08 06:48:56 -07:00
" bin
2015-10-17 08:12:59 -07:00
syn match armNumber "[#\$]\?0b[01]\+\>"
2015-03-08 06:48:56 -07:00
" floats
2015-10-17 08:12:59 -07:00
syn match armNumber "\%(\d\+\.\d*\|\d*\.\d\+\)\%([eE]\?[-+]\?\d\+\)\?\>"
2015-03-08 06:48:56 -07:00
" Comments
2015-07-15 10:59:45 -07:00
syn region armComment start="//\|@" end="$" contains=armTodo
2015-03-08 06:48:56 -07:00
" syn region armComment start="^#\|//\|@" end="$" contains=armTodo
syn region armComment start="/\*" end="\*/" contains=armTodo
" String literal
2016-02-25 03:04:38 -08:00
syn region armString start=/"/ skip=/\\"/ end=/"/
" Ascii character literal
syn match armString "'\\\?[\d32-~]'\?"
2015-03-08 06:48:56 -07:00
2015-03-08 07:04:25 -07:00
so <sfile>:p:h/gas_directives.vim
so <sfile>:p:h/arm_directives.vim
2015-03-08 06:48:56 -07:00
2015-07-30 08:09:46 -07:00
syn match armCPreProc "^\s*#\s*\(include\|define\|undef\|if\|ifdef\|ifndef\|elif\|else\|endif\|error\|pragma\)\>"
2015-03-08 06:48:56 -07:00
" Registers
2015-10-17 08:12:59 -07:00
syn match armRegister "\<R\%(1[0-5]\|[0-9]\)\>"
syn match armRegister "\<C\%(1[0-5]\|[0-9]\)\>"
syn match armRegister "\<P\%(1[0-5]\|[0-9]\)\>"
syn keyword armRegister FP SP LR PC SPSR CPSR CPSR_c CPSR_cxsf BP
2015-10-17 08:12:59 -07:00
syn match armRegister "\<A[1-3]\>"
syn match armRegister "\<V[1-8]\>"
2015-03-08 06:48:56 -07:00
" Conditional field to avoid repetition
let armCond = '\%(AL\|CC\|CS\|EQ\|GE\|GT\|HI\|HS\|LE\|LO\|LS\|LT\|MI\|NE\|PL\|VC\|VS\)\?'
"
" ARMv4 and thumb instructions
"
exec 'syn match armv4Instr "\%(ADC\|ADD\|AND\|ASR\|BIC\|EOR\|LSL\|LSR\|MLA\|MOV\|MUL\|MVN\|NEG\|ORR\|ROR\|RRX\|RSB\|RSC\|SBC\|SMLAL\|SMULL\|SUB\|UMLAL\|UMULL\)' . armCond . 'S\?\>"'
exec 'syn match armv4Instr "\%(ADC\|ADD\|AND\|ASR\|BIC\|EOR\|LSL\|LSR\|MLA\|MOV\|MUL\|MVN\|NEG\|ORR\|ROR\|RRX\|RSB\|RSC\|SBC\|SMLAL\|SMULL\|SUB\|UMLAL\|UMULL\)S' . armCond . '\>"'
2015-03-08 06:48:56 -07:00
2015-07-30 08:09:46 -07:00
exec 'syn match armv4InstrCond "\%(B\|BL\|BX\|CDP\|CMN\|CMP\|LDC\|MCR\|MRC\|MRS\|MSR\|NOP\|POP\|PUSH\|STC\|SWI\|TEQ\|TST\)' . armCond . '\>"'
exec 'syn match armv4InstrCond "ADR' . armCond . 'L\?\>"'
exec 'syn match armv4InstrCond "ADRL' . armCond . '\>"'
2015-03-08 06:48:56 -07:00
exec 'syn match armv4LDR "\%(LDR\)' . armCond . '\%(B\?T\?\|H\|S[BH]\)\?\>"'
exec 'syn match armv4LDR "LDR\%(B\?T\?\|H\|S[BH]\)' . armCond . '\>"'
2015-03-08 06:48:56 -07:00
exec 'syn match armv4STR "\%(STR\)' . armCond . '\%(B\?T\?\|H\)\?\>"'
exec 'syn match armv4STR "STR\%(B\?T\?\|H\)' . armCond . '\>"'
2015-03-08 06:48:56 -07:00
exec 'syn match armv4Stack "\%(LDM\|STM\)' . armCond . '\%([ID][BA]\|[EF][DA]\)\>"'
exec 'syn match armv4Stack "\%(LDM\|STM\)\%([ID][BA]\|[EF][DA]\)' . armCond . '\>"'
2015-03-08 06:48:56 -07:00
exec 'syn match armv4SWP "SWP' . armCond . 'B\?\>"'
exec 'syn match armv4SWP "SWPB' . armCond . '\>"'
2015-03-08 06:48:56 -07:00
"syn match armRelative "@R[0-7]\|@a\s*+\s*dptr\|@[ab]"