vim: Fix `ras.vim` syntax
24bcf96e022c33a0c52fbe424605265372418720c92fe461f91e62bca26f8d7d
1 parent
27ce65c6
vim/ras.vim
+8 -4
| 6 | 6 | endif |
|
| 7 | 7 | ||
| 8 | 8 | syntax clear |
|
| 9 | 9 | ||
| 10 | 10 | " Comments |
|
| 11 | - | syntax match rasComment "//.*$" |
|
| 12 | 11 | syntax keyword rasTodo TODO FIXME contained containedin=rasComment |
|
| 13 | 12 | ||
| 14 | 13 | " Directives |
|
| 15 | - | syntax match rasDirective "\.\%(align\|ascii\|byte\|constant\|data\|dword\|global\|space\|text\|word\)\>" |
|
| 14 | + | syntax match rasDirective "\.\%(align\|ascii\|byte\|constant\|data\|dword\|export\|space\|text\|word\)\>" |
|
| 16 | 15 | ||
| 17 | 16 | " Labels |
|
| 18 | 17 | syntax match rasLabel "@[A-Za-z_][A-Za-z0-9_]*\%(::[A-Za-z_][A-Za-z0-9_]*\)*" |
|
| 18 | + | syntax region rasLabel start=+@"+ skip=+\\.+ end=+"+ oneline |
|
| 19 | 19 | ||
| 20 | 20 | " Mnemonics |
|
| 21 | 21 | syntax keyword rasMnemonic add addi addiw addw and andi auipc |
|
| 22 | 22 | syntax keyword rasMnemonic beq beqz bge bgeu bgt ble blt bltu bne bnez |
|
| 23 | 23 | syntax keyword rasMnemonic call csrc csrr csrrw csrsi csrw |
|
| 24 | 24 | syntax keyword rasMnemonic div divu divuw divw |
|
| 25 | 25 | syntax keyword rasMnemonic ebreak ecall |
|
| 26 | + | syntax keyword rasMnemonic fence |
|
| 26 | 27 | syntax keyword rasMnemonic j jal jalr la lb lbu ld lh lhu li lui lw lwu |
|
| 27 | 28 | syntax keyword rasMnemonic mret mul mulh mulhsu mulhu mulw mv |
|
| 28 | 29 | syntax keyword rasMnemonic neg nop not or ori |
|
| 29 | 30 | syntax keyword rasMnemonic rem remu remuw remw ret |
|
| 30 | 31 | syntax keyword rasMnemonic sb sd seqz sh sll slli slliw sllw slt slti sltiu sltu snez |
| 38 | 39 | syntax keyword rasCsr mcause mepc mhartid mie mip mscratch mstatus mtval mtvec |
|
| 39 | 40 | ||
| 40 | 41 | " Numbers and literals |
|
| 41 | 42 | syntax match rasNumber "\%([+-]\)\=\<0[xX][0-9A-Fa-f]\+\>" |
|
| 42 | 43 | syntax match rasNumber "\%([+-]\)\=\<\d\+\>" |
|
| 43 | - | syntax region rasString start=+"+ skip=+\\"+ end=+"+ |
|
| 44 | - | syntax region rasChar start=+'+ skip=+\\'+ end=+'+ |
|
| 44 | + | syntax region rasString start=+"+ skip=+\\.+ end=+"+ oneline |
|
| 45 | + | syntax region rasChar start=+'+ skip=+\\.+ end=+'+ oneline |
|
| 45 | 46 | ||
| 46 | 47 | " Namespaced symbols and punctuation |
|
| 47 | 48 | syntax match rasNamespaceSep "::" |
|
| 48 | 49 | syntax match rasPunct "[(),;:+\-*/]" |
|
| 49 | 50 | ||
| 51 | + | " Comment delimiters take priority over punctuation. |
|
| 52 | + | syntax match rasComment "//.*$" contains=rasTodo |
|
| 53 | + | ||
| 50 | 54 | highlight default link rasComment Comment |
|
| 51 | 55 | highlight default link rasTodo Todo |
|
| 52 | 56 | highlight default link rasDirective Special |
|
| 53 | 57 | highlight default link rasLabel Label |
|
| 54 | 58 | highlight default link rasMnemonic Keyword |