~otheb/o-vim

a8d2b98fd05d5245a377ea1483fa9e03fa28beb1 — Olie Ayre 4 years ago 0f2ee8f
Fixed syntax errors

Also added comment matching and number matching.
1 files changed, 25 insertions(+), 7 deletions(-)

M syntax/oa.vim
M syntax/oa.vim => syntax/oa.vim +25 -7
@@ 4,6 4,9 @@ if exists("b:current_syntax")
	finish
endif

" comments
syntax match Comment "#.*$"

" sections
syntax keyword Label .exec .data



@@ 12,7 15,7 @@ syntax match Label "\v[a-zA-Z0-9!<>(){}.]+:"
syntax match oaGoto "\v[a-zA-Z0-9!<>(){}.]+"
hi def link oaGoto Label

" values
" strings
syntax region String start=/\v"/ end=/\v"/ contains=oaEscape
syntax match oaEscape "\v\\['"{}\\nrt]" contained
syntax match oaEscape "\v\\x[a-fA-F0-9]{2}" contained


@@ 20,13 23,28 @@ syntax match oaEscape "\v\\u[a-fA-F0-9]{4}" contained
syntax match oaEscape "\v\\U[a-fA-F0-9]{8}" contained
hi def link oaEscape SpecialChar

" numbers
syntax match Number "\v-?[0-9]+"
syntax match Number "\v-?[0-9][0-9_]*[0-9]"
syntax match Number "\v-?b[01]+"
syntax match Number "\v-?b[01][01_]*[01]"
syntax match Number "\v-?0x[a-fA-F0-9]+"
syntax match Number "\v-?0x[a-fA-F0-9][a-fA-F0-9_]*[a-fA-F0-9]"
syntax match Float "\v-?[0-9]+\.[0-9]+"
syntax match Float "\v-?[0-9][0-9_]*[0-9]\.[0-9]+"
syntax match Float "\v-?[0-9]+\.[0-9][0-9_]*[0-9]"
syntax match Float "\v-?[0-9][0-9_]*[0-9]\.[0-9][0-9_]*[0-9]"
" bytes
syntax match Number "\vX[a-fA-F0-9]{2}"
syntax match Number "\vB[01]{8}"

" instructions
syntax keyword Identifier popn shuf dupn yank rev ldc anew new get set sys \
                          nextgroup=Number
syntax keyword Identifier popn shuf dupn yank rev ldc anew new nextgroup=Number
syntax keyword Identifier get set sys nextgroup=Number
syntax keyword Identifier ifgt ifge ifle iflt ifeq gto nextgroup=oaGoto
syntax keyword Identifier nop pop swap dup add sub mul div mod inv inc dec and \
                          or xor toi8 toi16 toi32 toi64 tou8 tou16 tou32 tou64 \
                          tof tod top toB send pull free aget aset adel alget \
                          alset arot ajoin exit abort
syntax keyword Identifier nop pop swap dup add sub mul div mod inv inc dec and
syntax keyword Identifier or xor toi8 toi16 toi32 toi64 tou8 tou16 tou32 tou64
syntax keyword Identifier tof tod top toB send pull free aget aset adel alget
syntax keyword Identifier alset arot ajoin exit abort

let b:current_syntax = "oa"