forked from 74hc595/dcpu16-vim-syntax
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdcpu.vim
More file actions
executable file
·96 lines (73 loc) · 2.51 KB
/
dcpu.vim
File metadata and controls
executable file
·96 lines (73 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
" Vim syntax file
" Language: DCPU-16 Assembler (Notch's virtual CPU, http://0x10c.com)
" Maintainer: Matt Sarnoff <msarnoff.org>
" Last Change: April 5, 2012
" URL: http://github.com/74hc595/dcpu16-vim-syntax
" Revision: 1
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn case match
syn keyword dcpuTodo NOTE TODO FIXME XXX contained
syn case ignore
" any valid identifier
syn match dcpuIdentifier "[a-z_][a-z0-9_]*"
" valid label
syn match dcpuLabel "^:?[A-Z_][A-Z0-9_]:?*"
syn match dcpuSubLabel "^\.[A-Z_][A-Z0-9_]:*"
" me=e-1
" one character
syn match dcpuASCII "'.'"
" numbers:
" octal
syn match dcpuNumber "\<0[0-7]*\>"
syn match dcpuNumber "\<[0-7]\+[oO]\>"
" decimal
syn match dcpuNumber "\<[1-9][0-9]*\>"
" hexadecimal
syn match dcpuNumber "\<0[Xx][0-9a-fA-F]\+\>"
syn match dcpuNumber "\<[0-9][0-9a-fA-F]*[Hh]\>"
syn match dcpuNumber "\$[0-9a-fA-F]\+\>"
" binary
syn match dcpuNumber "\<0[Bb][01]\+\>"
syn match dcpuNumber "\<[0-1]\+[bB]\>"
" string in double quotes
syn region dcpuString start=+"+ end=+"+
" comments with special marks
syn match dcpuComment ";.*" contains=dcpuTodo
syn region dcpuComment start="/\*" end="\*/"
" registers
syn keyword dcpuRegister a b c x y z i j sp pc ex pop peek push pick
" instruction opcodes
syn keyword dcpuOpcode set add sub mul mli div dvi mod and bor xor shr asr shl mvi ifb ifc ife ifn ifg ifa ifl ifu adx sux
syn keyword dcpuOpcode jsr int iag ias hwn hwq hwi
" directives
syn keyword dcpuDirective word
" 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_dcpu_syntax_inits")
if version < 508
let did_dcpu_syntax_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink dcpuTodo Todo
HiLink dcpuComment Comment
HiLink dcpuLabel Function
HiLink dcpuSubLabel Label
HiLink dcpuString String
HiLink dcpuASCII Character
HiLink dcpuNumber Number
HiLink dcpuOpcode Statement
HiLink dcpuRegister Type
HiLink dcpuDirective PreProc
delcommand HiLink
endif
let b:current_syntax = "dcpu"
" vim: ts=8 syntax=vim