jal.vim (8963B)
1 " Vim syntax file 2 " Language: JAL 3 " Version: 0.1 4 " Last Change: 2003 May 11 5 " Maintainer: Mark Gross <mark@thegnar.org> 6 " This is a syntax definition for the JAL language. 7 " It is based on the Source Forge compiler source code. 8 " https://sourceforge.net/projects/jal/ 9 " 10 " TODO test. 11 12 " quit when a syntax file was already loaded 13 if exists("b:current_syntax") 14 finish 15 endif 16 17 syn case ignore 18 syn sync lines=250 19 20 syn keyword picTodo NOTE TODO XXX contained 21 22 syn match picIdentifier "[a-z_$][a-z0-9_$]*" 23 syn match picLabel "^[A-Z_$][A-Z0-9_$]*" 24 syn match picLabel "^[A-Z_$][A-Z0-9_$]*:"me=e-1 25 26 syn match picASCII "A\='.'" 27 syn match picBinary "B'[0-1]\+'" 28 syn match picDecimal "D'\d\+'" 29 syn match picDecimal "\d\+" 30 syn match picHexadecimal "0x\x\+" 31 syn match picHexadecimal "H'\x\+'" 32 syn match picHexadecimal "[0-9]\x*h" 33 syn match picOctal "O'[0-7]\o*'" 34 35 syn match picComment ";.*" contains=picTodo 36 37 syn region picString start=+"+ end=+"+ 38 39 syn keyword picRegister indf tmr0 pcl status fsr port_a port_b port_c port_d port_e x84_eedata x84_eeadr pclath intcon 40 syn keyword picRegister f877_tmr1l f877_tmr1h f877_t1con f877_t2con f877_ccpr1l f877_ccpr1h f877_ccp1con 41 syn keyword picRegister f877_pir1 f877_pir2 f877_pie1 f877_adcon1 f877_adcon0 f877_pr2 f877_adresl f877_adresh 42 syn keyword picRegister f877_eeadr f877_eedath f877_eeadrh f877_eedata f877_eecon1 f877_eecon2 f628_EECON2 43 syn keyword picRegister f877_rcsta f877_txsta f877_spbrg f877_txreg f877_rcreg f628_EEDATA f628_EEADR f628_EECON1 44 45 " Register --- bits 46 " STATUS 47 syn keyword picRegisterPart status_c status_dc status_z status_pd 48 syn keyword picRegisterPart status_to status_rp0 status_rp1 status_irp 49 50 " pins 51 syn keyword picRegisterPart pin_a0 pin_a1 pin_a2 pin_a3 pin_a4 pin_a5 52 syn keyword picRegisterPart pin_b0 pin_b1 pin_b2 pin_b3 pin_b4 pin_b5 pin_b6 pin_b7 53 syn keyword picRegisterPart pin_c0 pin_c1 pin_c2 pin_c3 pin_c4 pin_c5 pin_c6 pin_c7 54 syn keyword picRegisterPart pin_d0 pin_d1 pin_d2 pin_d3 pin_d4 pin_d5 pin_d6 pin_d7 55 syn keyword picRegisterPart pin_e0 pin_e1 pin_e2 56 57 syn keyword picPortDir port_a_direction port_b_direction port_c_direction port_d_direction port_e_direction 58 59 syn match picPinDir "pin_a[012345]_direction" 60 syn match picPinDir "pin_b[01234567]_direction" 61 syn match picPinDir "pin_c[01234567]_direction" 62 syn match picPinDir "pin_d[01234567]_direction" 63 syn match picPinDir "pin_e[012]_direction" 64 65 66 " INTCON 67 syn keyword picRegisterPart intcon_gie intcon_eeie intcon_peie intcon_t0ie intcon_inte 68 syn keyword picRegisterPart intcon_rbie intcon_t0if intcon_intf intcon_rbif 69 70 " TIMER 71 syn keyword picRegisterPart t1ckps1 t1ckps0 t1oscen t1sync tmr1cs tmr1on tmr1ie tmr1if 72 73 "cpp bits 74 syn keyword picRegisterPart ccp1x ccp1y 75 76 " adcon bits 77 syn keyword picRegisterPart adcon0_go adcon0_ch0 adcon0_ch1 adcon0_ch2 78 79 " EECON 80 syn keyword picRegisterPart eecon1_rd eecon1_wr eecon1_wren eecon1_wrerr eecon1_eepgd 81 syn keyword picRegisterPart f628_eecon1_rd f628_eecon1_wr f628_eecon1_wren f628_eecon1_wrerr 82 83 " usart 84 syn keyword picRegisterPart tx9 txen sync brgh tx9d 85 syn keyword picRegisterPart spen rx9 cren ferr oerr rx9d 86 syn keyword picRegisterPart TXIF RCIF 87 88 " OpCodes... 89 syn keyword picOpcode addlw andlw call clrwdt goto iorlw movlw option retfie retlw return sleep sublw tris 90 syn keyword picOpcode xorlw addwf andwf clrf clrw comf decf decfsz incf incfsz retiw iorwf movf movwf nop 91 syn keyword picOpcode rlf rrf subwf swapf xorwf bcf bsf btfsc btfss skpz skpnz setz clrz skpc skpnc setc clrc 92 syn keyword picOpcode skpdc skpndc setdc clrdc movfw tstf bank page HPAGE mullw mulwf cpfseq cpfsgt cpfslt banka bankb 93 94 95 syn keyword jalBoolean true false 96 syn keyword jalBoolean off on 97 syn keyword jalBit high low 98 syn keyword jalConstant Input Output all_input all_output 99 syn keyword jalConditional if else then elsif end if 100 syn keyword jalLabel goto 101 syn keyword jalRepeat for while forever loop 102 syn keyword jalStatement procedure function 103 syn keyword jalStatement return end volatile const var 104 syn keyword jalType bit byte 105 106 syn keyword jalModifier interrupt assembler asm put get 107 syn keyword jalStatement out in is begin at 108 syn keyword jalDirective pragma jump_table target target_clock target_chip name error test assert 109 syn keyword jalPredefined hs xt rc lp internal 16c84 16f84 16f877 sx18 sx28 12c509a 12c508 110 syn keyword jalPredefined 12ce674 16f628 18f252 18f242 18f442 18f452 12f629 12f675 16f88 111 syn keyword jalPredefined 16f876 16f873 sx_12 sx18 sx28 pic_12 pic_14 pic_16 112 113 syn keyword jalDirective chip osc clock fuses cpu watchdog powerup protection 114 115 syn keyword jalFunction bank_0 bank_1 bank_2 bank_3 bank_4 bank_5 bank_6 bank_7 trisa trisb trisc trisd trise 116 syn keyword jalFunction _trisa_flush _trisb_flush _trisc_flush _trisd_flush _trise_flush 117 118 syn keyword jalPIC local idle_loop 119 120 syn region jalAsm matchgroup=jalAsmKey start="\<assembler\>" end="\<end assembler\>" contains=jalComment,jalPreProc,jalLabel,picIdentifier, picLabel,picASCII,picDecimal,picHexadecimal,picOctal,picComment,picString,picRegister,picRigisterPart,picOpcode,picDirective,jalPIC 121 syn region jalAsm matchgroup=jalAsmKey start="\<asm\>" end=/$/ contains=jalComment,jalPreProc,jalLabel,picIdentifier, picLabel,picASCII,picDecimal,picHexadecimal,picOctal,picComment,picString,picRegister,picRigisterPart,picOpcode,picDirective,jalPIC 122 123 syn region jalPsudoVars matchgroup=jalPsudoVarsKey start="\<'put\>" end="/<is/>" contains=jalComment 124 125 syn match jalStringEscape contained "#[12][0-9]\=[0-9]\=" 126 syn match jalIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>" 127 syn match jalSymbolOperator "[+\-/*=]" 128 syn match jalSymbolOperator "!" 129 syn match jalSymbolOperator "<" 130 syn match jalSymbolOperator ">" 131 syn match jalSymbolOperator "<=" 132 syn match jalSymbolOperator ">=" 133 syn match jalSymbolOperator "!=" 134 syn match jalSymbolOperator "==" 135 syn match jalSymbolOperator "<<" 136 syn match jalSymbolOperator ">>" 137 syn match jalSymbolOperator "|" 138 syn match jalSymbolOperator "&" 139 syn match jalSymbolOperator "%" 140 syn match jalSymbolOperator "?" 141 syn match jalSymbolOperator "[()]" 142 syn match jalSymbolOperator "[\^.]" 143 syn match jalLabel "[\^]*:" 144 145 syn match jalNumber "-\=\<\d[0-9_]\+\>" 146 syn match jalHexNumber "0x[0-9A-Fa-f_]\+\>" 147 syn match jalBinNumber "0b[01_]\+\>" 148 149 " String 150 "wrong strings 151 syn region jalStringError matchgroup=jalStringError start=+"+ end=+"+ end=+$+ contains=jalStringEscape 152 153 "right strings 154 syn region jalString matchgroup=jalString start=+'+ end=+'+ oneline contains=jalStringEscape 155 " To see the start and end of strings: 156 syn region jalString matchgroup=jalString start=+"+ end=+"+ oneline contains=jalStringEscapeGPC 157 158 syn keyword jalTodo contained TODO 159 syn region jalComment start=/-- / end=/$/ oneline contains=jalTodo 160 syn region jalComment start=/--\t/ end=/$/ oneline contains=jalTodo 161 syn match jalComment /--\_$/ 162 syn region jalPreProc start="include" end=/$/ contains=JalComment,jalToDo 163 164 165 if exists("jal_no_tabs") 166 syn match jalShowTab "\t" 167 endif 168 169 170 " Define the default highlighting. 171 " Only when an item doesn't have highlighting yet 172 173 hi def link jalAcces jalStatement 174 hi def link jalBoolean Boolean 175 hi def link jalBit Boolean 176 hi def link jalComment Comment 177 hi def link jalConditional Conditional 178 hi def link jalConstant Constant 179 hi def link jalDelimiter Identifier 180 hi def link jalDirective PreProc 181 hi def link jalException Exception 182 hi def link jalFloat Float 183 hi def link jalFunction Function 184 hi def link jalPsudoVarsKey Function 185 hi def link jalLabel Label 186 hi def link jalMatrixDelimiter Identifier 187 hi def link jalModifier Type 188 hi def link jalNumber Number 189 hi def link jalBinNumber Number 190 hi def link jalHexNumber Number 191 hi def link jalOperator Operator 192 hi def link jalPredefined Constant 193 hi def link jalPreProc PreProc 194 hi def link jalRepeat Repeat 195 hi def link jalStatement Statement 196 hi def link jalString String 197 hi def link jalStringEscape Special 198 hi def link jalStringEscapeGPC Special 199 hi def link jalStringError Error 200 hi def link jalStruct jalStatement 201 hi def link jalSymbolOperator jalOperator 202 hi def link jalTodo Todo 203 hi def link jalType Type 204 hi def link jalUnclassified Statement 205 hi def link jalAsm Assembler 206 hi def link jalError Error 207 hi def link jalAsmKey Statement 208 hi def link jalPIC Statement 209 210 hi def link jalShowTab Error 211 212 hi def link picTodo Todo 213 hi def link picComment Comment 214 hi def link picDirective Statement 215 hi def link picLabel Label 216 hi def link picString String 217 218 hi def link picOpcode Keyword 219 hi def link picRegister Structure 220 hi def link picRegisterPart Special 221 hi def link picPinDir SPecial 222 hi def link picPortDir SPecial 223 224 hi def link picASCII String 225 hi def link picBinary Number 226 hi def link picDecimal Number 227 hi def link picHexadecimal Number 228 hi def link picOctal Number 229 230 hi def link picIdentifier Identifier 231 232 233 234 let b:current_syntax = "jal" 235 236 " vim: ts=8 sw=2