JOE (Joe's Own Editor) syntax coloring and highlighting files - improved ones
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

249 lines
4.0 KiB

  1. # JOE syntax highlight file for Python
  2. # TODO:
  3. # * octal escape sequences
  4. # * highlight function and class names?
  5. =Idle
  6. =Comment green
  7. =CommentLabel bold green
  8. =Docstring green
  9. =DocstringLabel bold green
  10. =DocEscape bold cyan
  11. =Constant cyan
  12. =Escape bold cyan
  13. =Keyword bold
  14. =Bad bold red
  15. =Brace magenta
  16. =PrivateMember fg_310 # brown
  17. =Decorator red
  18. :idle Idle
  19. * idle
  20. "#" comment recolor=-1
  21. "0-9" first_digit recolor=-1
  22. "'" string_sq_1 recolor=-1
  23. "\"" string_dq_1 recolor=-1
  24. "a-zA-Z_" ident noeat
  25. "{}" brace recolor=-1
  26. "@" decorator recolor=-1
  27. :brace Brace
  28. * idle noeat
  29. # annotations
  30. :decorator Decorator
  31. * decorator
  32. " (\t\r\n" idle noeat
  33. :comment Comment
  34. * comment
  35. # might be TODO label
  36. "BFHNTX" comment noeat call=.comment_todo()
  37. "\n" idle
  38. :string_sq_1 Constant
  39. * string_sq noeat
  40. "'" string_sq_2
  41. :string_sq_2 Constant
  42. * idle noeat
  43. "'" docstr_sq recolor=-3
  44. :string_sq Constant
  45. * string_sq
  46. "\'" idle
  47. "\\" string_sq_esc recolor=-1
  48. :string_sq_esc Escape
  49. * string_sq
  50. "\n" string_sq recolor=-2
  51. :docstr_sq Docstring
  52. * docstr_sq
  53. # might be TODO label
  54. "BFHNTX" docstr_sq noeat call=.comment_todo_docstr()
  55. "\\" docstr_sq_esc recolor=-1
  56. "'" docstr_sq_1
  57. :docstr_sq_1 Docstring
  58. * docstr_sq noeat
  59. "'" docstr_sq_2
  60. :docstr_sq_2 Docstring
  61. * docstr_sq noeat
  62. "'" idle
  63. :docstr_sq_esc DocEscape
  64. * docstr_sq
  65. "\n" docstr_sq recolor=-2
  66. :string_dq_1 Constant
  67. * string_dq noeat
  68. "\"" string_dq_2
  69. :string_dq_2 Constant
  70. * idle noeat
  71. "\"" docstr_dq recolor=-3
  72. :string_dq Constant
  73. * string_dq
  74. "\"" idle
  75. "\\" string_dq_esc recolor=-1
  76. :string_dq_esc Escape
  77. * string_dq
  78. "\n" string_dq recolor=-2
  79. :docstr_dq Docstring
  80. * docstr_dq
  81. # might be TODO label
  82. "BFHNTX" docstr_dq noeat call=.comment_todo_docstr()
  83. "\\" docstr_dq_esc recolor=-1
  84. "\"" docstr_dq_1
  85. :docstr_dq_1 Docstring
  86. * docstr_dq noeat
  87. "\"" docstr_dq_2
  88. :docstr_dq_2 Docstring
  89. * docstr_dq noeat
  90. "\"" idle
  91. :docstr_dq_esc DocEscape
  92. * docstr_dq
  93. "\n" docstr_dq recolor=-2
  94. :first_digit Constant
  95. * idle noeat
  96. "xX" hex
  97. "." float
  98. "0-9" first_number
  99. :hex Constant
  100. * idle noeat
  101. "0-9A-Fa-f" hex
  102. :first_number Constant
  103. * idle noeat
  104. "0-9" first_number
  105. "." float
  106. :maybe_float Constant
  107. * idle recolor=-2 noeat
  108. "0-9" float recolor=-2
  109. :float Constant
  110. * idle noeat
  111. "eE" epart
  112. "0-9" float
  113. :epart Constant
  114. * idle noeat
  115. "0-9+\-" enum
  116. :enum Constant
  117. * idle noeat
  118. "0-9" enum
  119. :ident Idle
  120. * ident1 noeat buffer
  121. "_" priv_member recolor=-1
  122. :ident1 Idle
  123. * idle noeat strings
  124. "and" kw
  125. "assert" kw
  126. "break" kw
  127. "class" kw
  128. "continue" kw
  129. "def" kw
  130. "del" kw
  131. "elif" kw
  132. "else" kw
  133. "except" kw
  134. "exec" kw
  135. "finally" kw
  136. "for" kw
  137. "from" kw
  138. "global" kw
  139. "if" kw
  140. "import" kw
  141. "in" kw
  142. "is" kw
  143. "lambda" kw
  144. "not" kw
  145. "or" kw
  146. "pass" kw
  147. "print" kw
  148. "raise" kw
  149. "return" kw
  150. "try" kw
  151. "while" kw
  152. "yield" kw
  153. # quasi-keywords
  154. "False" lit
  155. "None" lit
  156. "True" lit
  157. done
  158. "a-zA-Z0-9_" ident1
  159. :kw Keyword
  160. * idle noeat
  161. :lit Keyword
  162. * idle noeat
  163. :priv_member PrivateMember
  164. * idle noeat
  165. "a-zA-Z0-9_" priv_member
  166. .subr comment_todo
  167. # initial state
  168. :comment_todo_init Comment
  169. * comment_todo_guess buffer
  170. # highlight common TODO labels
  171. :comment_todo_guess Comment
  172. * comment_todo_unknown noeat strings
  173. "BUG" comment_todo
  174. "FIXME" comment_todo
  175. "HACK" comment_todo
  176. "NOTE" comment_todo
  177. "TODO" comment_todo
  178. "XXX" comment_todo
  179. done
  180. "A-Z" comment_todo_guess
  181. :comment_todo_unknown Comment
  182. * NULL noeat return
  183. :comment_todo CommentLabel
  184. * NULL noeat return
  185. .end
  186. .subr comment_todo_docstr
  187. # initial state
  188. :comment_todo_init Docstring
  189. * comment_todo_guess buffer
  190. # highlight common TODO labels
  191. :comment_todo_guess Docstring
  192. * comment_todo_unknown noeat strings
  193. "BUG" comment_todo
  194. "FIXME" comment_todo
  195. "HACK" comment_todo
  196. "NOTE" comment_todo
  197. "TODO" comment_todo
  198. "XXX" comment_todo
  199. done
  200. "A-Z" comment_todo_guess
  201. :comment_todo_unknown Docstring
  202. * NULL noeat return
  203. :comment_todo DocstringLabel
  204. * NULL noeat return
  205. .end