jal.vim 8.8 KB

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