pygments.rb 1.2.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (386) hide show
  1. checksums.yaml +5 -5
  2. data/.github/dependabot.yml +13 -0
  3. data/.github/workflows/ci.yml +40 -0
  4. data/.github/workflows/release.yml +24 -0
  5. data/.gitignore +4 -6
  6. data/.rubocop.yml +16 -0
  7. data/CHANGELOG.adoc +137 -0
  8. data/Gemfile +3 -1
  9. data/LICENSE +1 -1
  10. data/README.adoc +159 -0
  11. data/Rakefile +8 -32
  12. data/bench.rb +14 -8
  13. data/lib/pygments.rb +16 -14
  14. data/lib/pygments/lexer.rb +87 -65
  15. data/lib/pygments/mentos.py +23 -110
  16. data/lib/pygments/popen.rb +188 -284
  17. data/lib/pygments/version.rb +2 -2
  18. data/pygments.rb.gemspec +20 -13
  19. data/test/test_pygments.rb +50 -110
  20. data/vendor/pygments-main/{AUTHORS → Pygments-2.8.1.dist-info/AUTHORS} +26 -3
  21. data/vendor/pygments-main/Pygments-2.8.1.dist-info/INSTALLER +1 -0
  22. data/vendor/pygments-main/{LICENSE → Pygments-2.8.1.dist-info/LICENSE} +1 -1
  23. data/vendor/pygments-main/Pygments-2.8.1.dist-info/METADATA +48 -0
  24. data/vendor/pygments-main/Pygments-2.8.1.dist-info/RECORD +494 -0
  25. data/vendor/pygments-main/Pygments-2.8.1.dist-info/REQUESTED +0 -0
  26. data/vendor/pygments-main/Pygments-2.8.1.dist-info/WHEEL +5 -0
  27. data/vendor/pygments-main/Pygments-2.8.1.dist-info/entry_points.txt +3 -0
  28. data/vendor/pygments-main/Pygments-2.8.1.dist-info/top_level.txt +1 -0
  29. data/vendor/pygments-main/bin/pygmentize +8 -0
  30. data/vendor/pygments-main/pygments/__init__.py +6 -12
  31. data/vendor/pygments-main/pygments/__main__.py +17 -0
  32. data/vendor/pygments-main/pygments/cmdline.py +213 -184
  33. data/vendor/pygments-main/pygments/console.py +6 -10
  34. data/vendor/pygments-main/pygments/filter.py +4 -7
  35. data/vendor/pygments-main/pygments/filters/__init__.py +609 -22
  36. data/vendor/pygments-main/pygments/formatter.py +4 -5
  37. data/vendor/pygments-main/pygments/formatters/__init__.py +10 -10
  38. data/vendor/pygments-main/pygments/formatters/_mapping.py +1 -4
  39. data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -2
  40. data/vendor/pygments-main/pygments/formatters/html.py +242 -139
  41. data/vendor/pygments-main/pygments/formatters/img.py +91 -50
  42. data/vendor/pygments-main/pygments/formatters/irc.py +39 -40
  43. data/vendor/pygments-main/pygments/formatters/latex.py +62 -33
  44. data/vendor/pygments-main/pygments/formatters/other.py +18 -17
  45. data/vendor/pygments-main/pygments/formatters/rtf.py +29 -30
  46. data/vendor/pygments-main/pygments/formatters/svg.py +40 -5
  47. data/vendor/pygments-main/pygments/formatters/terminal.py +25 -32
  48. data/vendor/pygments-main/pygments/formatters/terminal256.py +45 -14
  49. data/vendor/pygments-main/pygments/lexer.py +47 -44
  50. data/vendor/pygments-main/pygments/lexers/__init__.py +341 -0
  51. data/vendor/pygments-main/pygments/lexers/_asy_builtins.py +1644 -0
  52. data/vendor/pygments-main/pygments/lexers/_cl_builtins.py +231 -0
  53. data/vendor/pygments-main/pygments/lexers/_cocoa_builtins.py +75 -0
  54. data/vendor/pygments-main/pygments/lexers/_csound_builtins.py +1724 -0
  55. data/vendor/pygments-main/pygments/lexers/_lasso_builtins.py +5326 -0
  56. data/vendor/pygments-main/pygments/lexers/_lua_builtins.py +292 -0
  57. data/vendor/pygments-main/pygments/lexers/_mapping.py +554 -0
  58. data/vendor/pygments-main/pygments/lexers/_mql_builtins.py +1171 -0
  59. data/vendor/pygments-main/pygments/lexers/_mysql_builtins.py +1281 -0
  60. data/vendor/pygments-main/pygments/lexers/_openedge_builtins.py +2600 -0
  61. data/vendor/pygments-main/pygments/lexers/_php_builtins.py +4752 -0
  62. data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +677 -0
  63. data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +3093 -0
  64. data/vendor/pygments-main/pygments/lexers/_sourcemod_builtins.py +1160 -0
  65. data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +557 -0
  66. data/vendor/pygments-main/pygments/lexers/_stata_builtins.py +457 -0
  67. data/vendor/pygments-main/pygments/lexers/_tsql_builtins.py +1003 -0
  68. data/vendor/pygments-main/pygments/lexers/_usd_builtins.py +112 -0
  69. data/vendor/pygments-main/pygments/lexers/_vbscript_builtins.py +279 -0
  70. data/vendor/pygments-main/pygments/lexers/_vim_builtins.py +1938 -0
  71. data/vendor/pygments-main/pygments/lexers/actionscript.py +244 -0
  72. data/vendor/pygments-main/pygments/lexers/agile.py +23 -0
  73. data/vendor/pygments-main/pygments/lexers/algebra.py +239 -0
  74. data/vendor/pygments-main/pygments/lexers/ambient.py +75 -0
  75. data/vendor/pygments-main/pygments/lexers/amdgpu.py +48 -0
  76. data/vendor/pygments-main/pygments/lexers/ampl.py +86 -0
  77. data/vendor/pygments-main/pygments/lexers/apl.py +100 -0
  78. data/vendor/pygments-main/pygments/lexers/archetype.py +317 -0
  79. data/vendor/pygments-main/pygments/lexers/arrow.py +116 -0
  80. data/vendor/pygments-main/pygments/lexers/asm.py +1004 -0
  81. data/vendor/pygments-main/pygments/lexers/automation.py +379 -0
  82. data/vendor/pygments-main/pygments/lexers/bare.py +103 -0
  83. data/vendor/pygments-main/pygments/lexers/basic.py +661 -0
  84. data/vendor/pygments-main/pygments/lexers/bibtex.py +159 -0
  85. data/vendor/pygments-main/pygments/lexers/boa.py +101 -0
  86. data/vendor/pygments-main/pygments/lexers/business.py +626 -0
  87. data/vendor/pygments-main/pygments/lexers/c_cpp.py +342 -0
  88. data/vendor/pygments-main/pygments/lexers/c_like.py +565 -0
  89. data/vendor/pygments-main/pygments/lexers/capnproto.py +77 -0
  90. data/vendor/pygments-main/pygments/lexers/cddl.py +190 -0
  91. data/vendor/pygments-main/pygments/lexers/chapel.py +111 -0
  92. data/vendor/pygments-main/pygments/lexers/clean.py +178 -0
  93. data/vendor/pygments-main/pygments/lexers/compiled.py +33 -0
  94. data/vendor/pygments-main/pygments/lexers/configs.py +985 -0
  95. data/vendor/pygments-main/pygments/lexers/console.py +113 -0
  96. data/vendor/pygments-main/pygments/lexers/crystal.py +366 -0
  97. data/vendor/pygments-main/pygments/lexers/csound.py +466 -0
  98. data/vendor/pygments-main/pygments/lexers/css.py +694 -0
  99. data/vendor/pygments-main/pygments/lexers/d.py +255 -0
  100. data/vendor/pygments-main/pygments/lexers/dalvik.py +124 -0
  101. data/vendor/pygments-main/pygments/lexers/data.py +697 -0
  102. data/vendor/pygments-main/pygments/lexers/devicetree.py +108 -0
  103. data/vendor/pygments-main/pygments/lexers/diff.py +164 -0
  104. data/vendor/pygments-main/pygments/lexers/dotnet.py +706 -0
  105. data/vendor/pygments-main/pygments/lexers/dsls.py +959 -0
  106. data/vendor/pygments-main/pygments/lexers/dylan.py +286 -0
  107. data/vendor/pygments-main/pygments/lexers/ecl.py +137 -0
  108. data/vendor/pygments-main/pygments/lexers/eiffel.py +64 -0
  109. data/vendor/pygments-main/pygments/lexers/elm.py +120 -0
  110. data/vendor/pygments-main/pygments/lexers/email.py +150 -0
  111. data/vendor/pygments-main/pygments/lexers/erlang.py +529 -0
  112. data/vendor/pygments-main/pygments/lexers/esoteric.py +303 -0
  113. data/vendor/pygments-main/pygments/lexers/ezhil.py +76 -0
  114. data/vendor/pygments-main/pygments/lexers/factor.py +343 -0
  115. data/vendor/pygments-main/pygments/lexers/fantom.py +249 -0
  116. data/vendor/pygments-main/pygments/lexers/felix.py +272 -0
  117. data/vendor/pygments-main/pygments/lexers/floscript.py +82 -0
  118. data/vendor/pygments-main/pygments/lexers/forth.py +177 -0
  119. data/vendor/pygments-main/pygments/lexers/fortran.py +208 -0
  120. data/vendor/pygments-main/pygments/lexers/foxpro.py +427 -0
  121. data/vendor/pygments-main/pygments/lexers/freefem.py +897 -0
  122. data/vendor/pygments-main/pygments/lexers/functional.py +20 -0
  123. data/vendor/pygments-main/pygments/lexers/futhark.py +110 -0
  124. data/vendor/pygments-main/pygments/lexers/gdscript.py +345 -0
  125. data/vendor/pygments-main/pygments/lexers/go.py +100 -0
  126. data/vendor/pygments-main/pygments/lexers/grammar_notation.py +269 -0
  127. data/vendor/pygments-main/pygments/lexers/graph.py +84 -0
  128. data/vendor/pygments-main/pygments/lexers/graphics.py +799 -0
  129. data/vendor/pygments-main/pygments/lexers/graphviz.py +57 -0
  130. data/vendor/pygments-main/pygments/lexers/haskell.py +869 -0
  131. data/vendor/pygments-main/pygments/lexers/haxe.py +935 -0
  132. data/vendor/pygments-main/pygments/lexers/hdl.py +468 -0
  133. data/vendor/pygments-main/pygments/lexers/hexdump.py +102 -0
  134. data/vendor/pygments-main/pygments/lexers/html.py +613 -0
  135. data/vendor/pygments-main/pygments/lexers/idl.py +280 -0
  136. data/vendor/pygments-main/pygments/lexers/igor.py +419 -0
  137. data/vendor/pygments-main/pygments/lexers/inferno.py +95 -0
  138. data/vendor/pygments-main/pygments/lexers/installers.py +321 -0
  139. data/vendor/pygments-main/pygments/lexers/int_fiction.py +1367 -0
  140. data/vendor/pygments-main/pygments/lexers/iolang.py +62 -0
  141. data/vendor/pygments-main/pygments/lexers/j.py +145 -0
  142. data/vendor/pygments-main/pygments/lexers/javascript.py +1536 -0
  143. data/vendor/pygments-main/pygments/lexers/julia.py +330 -0
  144. data/vendor/pygments-main/pygments/lexers/jvm.py +1739 -0
  145. data/vendor/pygments-main/pygments/lexers/lisp.py +2698 -0
  146. data/vendor/pygments-main/pygments/lexers/make.py +205 -0
  147. data/vendor/pygments-main/pygments/lexers/markup.py +762 -0
  148. data/vendor/pygments-main/pygments/lexers/math.py +20 -0
  149. data/vendor/pygments-main/pygments/lexers/matlab.py +3280 -0
  150. data/vendor/pygments-main/pygments/lexers/mime.py +225 -0
  151. data/vendor/pygments-main/pygments/lexers/ml.py +957 -0
  152. data/vendor/pygments-main/pygments/lexers/modeling.py +365 -0
  153. data/vendor/pygments-main/pygments/lexers/modula2.py +1579 -0
  154. data/vendor/pygments-main/pygments/lexers/monte.py +203 -0
  155. data/vendor/pygments-main/pygments/lexers/mosel.py +447 -0
  156. data/vendor/pygments-main/pygments/lexers/ncl.py +893 -0
  157. data/vendor/pygments-main/pygments/lexers/nimrod.py +158 -0
  158. data/vendor/pygments-main/pygments/lexers/nit.py +63 -0
  159. data/vendor/pygments-main/pygments/lexers/nix.py +135 -0
  160. data/vendor/pygments-main/pygments/lexers/oberon.py +120 -0
  161. data/vendor/pygments-main/pygments/lexers/objective.py +503 -0
  162. data/vendor/pygments-main/pygments/lexers/ooc.py +84 -0
  163. data/vendor/pygments-main/pygments/lexers/other.py +40 -0
  164. data/vendor/pygments-main/pygments/lexers/parasail.py +78 -0
  165. data/vendor/pygments-main/pygments/lexers/parsers.py +799 -0
  166. data/vendor/pygments-main/pygments/lexers/pascal.py +643 -0
  167. data/vendor/pygments-main/pygments/lexers/pawn.py +202 -0
  168. data/vendor/pygments-main/pygments/lexers/perl.py +731 -0
  169. data/vendor/pygments-main/pygments/lexers/php.py +320 -0
  170. data/vendor/pygments-main/pygments/lexers/pointless.py +70 -0
  171. data/vendor/pygments-main/pygments/lexers/pony.py +93 -0
  172. data/vendor/pygments-main/pygments/lexers/praat.py +301 -0
  173. data/vendor/pygments-main/pygments/lexers/prolog.py +305 -0
  174. data/vendor/pygments-main/pygments/lexers/promql.py +182 -0
  175. data/vendor/pygments-main/pygments/lexers/python.py +1158 -0
  176. data/vendor/pygments-main/pygments/lexers/qvt.py +151 -0
  177. data/vendor/pygments-main/pygments/lexers/r.py +190 -0
  178. data/vendor/pygments-main/pygments/lexers/rdf.py +462 -0
  179. data/vendor/pygments-main/pygments/lexers/rebol.py +430 -0
  180. data/vendor/pygments-main/pygments/lexers/resource.py +84 -0
  181. data/vendor/pygments-main/pygments/lexers/ride.py +138 -0
  182. data/vendor/pygments-main/pygments/lexers/rnc.py +66 -0
  183. data/vendor/pygments-main/pygments/lexers/roboconf.py +81 -0
  184. data/vendor/pygments-main/pygments/lexers/robotframework.py +551 -0
  185. data/vendor/pygments-main/pygments/lexers/ruby.py +523 -0
  186. data/vendor/pygments-main/pygments/lexers/rust.py +223 -0
  187. data/vendor/pygments-main/pygments/lexers/sas.py +227 -0
  188. data/vendor/pygments-main/pygments/lexers/scdoc.py +82 -0
  189. data/vendor/pygments-main/pygments/lexers/scripting.py +1283 -0
  190. data/vendor/pygments-main/pygments/lexers/sgf.py +60 -0
  191. data/vendor/pygments-main/pygments/lexers/shell.py +909 -0
  192. data/vendor/pygments-main/pygments/lexers/sieve.py +68 -0
  193. data/vendor/pygments-main/pygments/lexers/slash.py +184 -0
  194. data/vendor/pygments-main/pygments/lexers/smalltalk.py +194 -0
  195. data/vendor/pygments-main/pygments/lexers/smv.py +78 -0
  196. data/vendor/pygments-main/pygments/lexers/snobol.py +82 -0
  197. data/vendor/pygments-main/pygments/lexers/solidity.py +91 -0
  198. data/vendor/pygments-main/pygments/lexers/special.py +106 -0
  199. data/vendor/pygments-main/pygments/lexers/sql.py +832 -0
  200. data/vendor/pygments-main/pygments/lexers/stata.py +170 -0
  201. data/vendor/pygments-main/pygments/lexers/supercollider.py +94 -0
  202. data/vendor/pygments-main/pygments/lexers/tcl.py +144 -0
  203. data/vendor/pygments-main/pygments/lexers/templates.py +2263 -0
  204. data/vendor/pygments-main/pygments/lexers/teraterm.py +334 -0
  205. data/vendor/pygments-main/pygments/lexers/testing.py +206 -0
  206. data/vendor/pygments-main/pygments/lexers/text.py +25 -0
  207. data/vendor/pygments-main/pygments/lexers/textedit.py +168 -0
  208. data/vendor/pygments-main/pygments/lexers/textfmts.py +429 -0
  209. data/vendor/pygments-main/pygments/lexers/theorem.py +476 -0
  210. data/vendor/pygments-main/pygments/lexers/tnt.py +262 -0
  211. data/vendor/pygments-main/pygments/lexers/trafficscript.py +53 -0
  212. data/vendor/pygments-main/pygments/lexers/typoscript.py +218 -0
  213. data/vendor/pygments-main/pygments/lexers/unicon.py +411 -0
  214. data/vendor/pygments-main/pygments/lexers/urbi.py +145 -0
  215. data/vendor/pygments-main/pygments/lexers/usd.py +89 -0
  216. data/vendor/pygments-main/pygments/lexers/varnish.py +189 -0
  217. data/vendor/pygments-main/pygments/lexers/verification.py +113 -0
  218. data/vendor/pygments-main/pygments/lexers/web.py +23 -0
  219. data/vendor/pygments-main/pygments/lexers/webidl.py +298 -0
  220. data/vendor/pygments-main/pygments/lexers/webmisc.py +991 -0
  221. data/vendor/pygments-main/pygments/lexers/whiley.py +115 -0
  222. data/vendor/pygments-main/pygments/lexers/x10.py +68 -0
  223. data/vendor/pygments-main/pygments/lexers/xorg.py +36 -0
  224. data/vendor/pygments-main/pygments/lexers/yang.py +103 -0
  225. data/vendor/pygments-main/pygments/lexers/zig.py +123 -0
  226. data/vendor/pygments-main/pygments/modeline.py +1 -2
  227. data/vendor/pygments-main/pygments/plugin.py +4 -3
  228. data/vendor/pygments-main/pygments/regexopt.py +1 -2
  229. data/vendor/pygments-main/pygments/scanner.py +2 -3
  230. data/vendor/pygments-main/pygments/sphinxext.py +2 -5
  231. data/vendor/pygments-main/pygments/style.py +61 -25
  232. data/vendor/pygments-main/pygments/styles/__init__.py +12 -5
  233. data/vendor/pygments-main/pygments/styles/abap.py +1 -2
  234. data/vendor/pygments-main/pygments/styles/algol.py +1 -2
  235. data/vendor/pygments-main/pygments/styles/algol_nu.py +1 -2
  236. data/vendor/pygments-main/pygments/styles/arduino.py +2 -3
  237. data/vendor/pygments-main/pygments/styles/autumn.py +1 -2
  238. data/vendor/pygments-main/pygments/styles/borland.py +1 -2
  239. data/vendor/pygments-main/pygments/styles/bw.py +1 -2
  240. data/vendor/pygments-main/pygments/styles/colorful.py +1 -2
  241. data/vendor/pygments-main/pygments/styles/default.py +1 -2
  242. data/vendor/pygments-main/pygments/styles/emacs.py +1 -2
  243. data/vendor/pygments-main/pygments/styles/friendly.py +1 -2
  244. data/vendor/pygments-main/pygments/styles/fruity.py +1 -2
  245. data/vendor/pygments-main/pygments/styles/igor.py +1 -2
  246. data/vendor/pygments-main/pygments/styles/inkpot.py +66 -0
  247. data/vendor/pygments-main/pygments/styles/lovelace.py +1 -2
  248. data/vendor/pygments-main/pygments/styles/manni.py +1 -2
  249. data/vendor/pygments-main/pygments/styles/material.py +118 -0
  250. data/vendor/pygments-main/pygments/styles/monokai.py +4 -4
  251. data/vendor/pygments-main/pygments/styles/murphy.py +1 -2
  252. data/vendor/pygments-main/pygments/styles/native.py +1 -2
  253. data/vendor/pygments-main/pygments/styles/paraiso_dark.py +1 -2
  254. data/vendor/pygments-main/pygments/styles/paraiso_light.py +1 -2
  255. data/vendor/pygments-main/pygments/styles/pastie.py +1 -2
  256. data/vendor/pygments-main/pygments/styles/perldoc.py +1 -2
  257. data/vendor/pygments-main/pygments/styles/rainbow_dash.py +1 -2
  258. data/vendor/pygments-main/pygments/styles/rrt.py +1 -2
  259. data/vendor/pygments-main/pygments/styles/sas.py +1 -2
  260. data/vendor/pygments-main/pygments/styles/solarized.py +136 -0
  261. data/vendor/pygments-main/pygments/styles/stata_dark.py +40 -0
  262. data/vendor/pygments-main/pygments/styles/{stata.py → stata_light.py} +14 -16
  263. data/vendor/pygments-main/pygments/styles/tango.py +1 -2
  264. data/vendor/pygments-main/pygments/styles/trac.py +1 -2
  265. data/vendor/pygments-main/pygments/styles/vim.py +1 -2
  266. data/vendor/pygments-main/pygments/styles/vs.py +1 -2
  267. data/vendor/pygments-main/pygments/styles/xcode.py +1 -2
  268. data/vendor/pygments-main/pygments/styles/zenburn.py +80 -0
  269. data/vendor/pygments-main/pygments/token.py +1 -2
  270. data/vendor/pygments-main/pygments/unistring.py +47 -109
  271. data/vendor/pygments-main/pygments/util.py +16 -96
  272. metadata +81 -139
  273. data/CHANGELOG.md +0 -111
  274. data/README.md +0 -121
  275. data/cache-lexers.rb +0 -8
  276. data/circle.yml +0 -20
  277. data/test/test_data.c +0 -2581
  278. data/test/test_data.py +0 -514
  279. data/test/test_data_generated +0 -2582
  280. data/vendor/custom_lexers/github.py +0 -565
  281. data/vendor/pygments-main/CHANGES +0 -1186
  282. data/vendor/pygments-main/MANIFEST.in +0 -6
  283. data/vendor/pygments-main/Makefile +0 -65
  284. data/vendor/pygments-main/README.rst +0 -39
  285. data/vendor/pygments-main/REVISION +0 -1
  286. data/vendor/pygments-main/TODO +0 -12
  287. data/vendor/pygments-main/doc/Makefile +0 -153
  288. data/vendor/pygments-main/doc/_static/favicon.ico +0 -0
  289. data/vendor/pygments-main/doc/_static/logo_new.png +0 -0
  290. data/vendor/pygments-main/doc/_static/logo_only.png +0 -0
  291. data/vendor/pygments-main/doc/_templates/docssidebar.html +0 -3
  292. data/vendor/pygments-main/doc/_templates/indexsidebar.html +0 -25
  293. data/vendor/pygments-main/doc/_themes/pygments14/layout.html +0 -98
  294. data/vendor/pygments-main/doc/_themes/pygments14/static/bodybg.png +0 -0
  295. data/vendor/pygments-main/doc/_themes/pygments14/static/docbg.png +0 -0
  296. data/vendor/pygments-main/doc/_themes/pygments14/static/listitem.png +0 -0
  297. data/vendor/pygments-main/doc/_themes/pygments14/static/logo.png +0 -0
  298. data/vendor/pygments-main/doc/_themes/pygments14/static/pocoo.png +0 -0
  299. data/vendor/pygments-main/doc/_themes/pygments14/static/pygments14.css_t +0 -401
  300. data/vendor/pygments-main/doc/_themes/pygments14/theme.conf +0 -15
  301. data/vendor/pygments-main/doc/conf.py +0 -241
  302. data/vendor/pygments-main/doc/docs/api.rst +0 -354
  303. data/vendor/pygments-main/doc/docs/authors.rst +0 -4
  304. data/vendor/pygments-main/doc/docs/changelog.rst +0 -1
  305. data/vendor/pygments-main/doc/docs/cmdline.rst +0 -166
  306. data/vendor/pygments-main/doc/docs/filterdevelopment.rst +0 -71
  307. data/vendor/pygments-main/doc/docs/filters.rst +0 -41
  308. data/vendor/pygments-main/doc/docs/formatterdevelopment.rst +0 -169
  309. data/vendor/pygments-main/doc/docs/formatters.rst +0 -48
  310. data/vendor/pygments-main/doc/docs/index.rst +0 -66
  311. data/vendor/pygments-main/doc/docs/integrate.rst +0 -40
  312. data/vendor/pygments-main/doc/docs/java.rst +0 -70
  313. data/vendor/pygments-main/doc/docs/lexerdevelopment.rst +0 -728
  314. data/vendor/pygments-main/doc/docs/lexers.rst +0 -69
  315. data/vendor/pygments-main/doc/docs/moinmoin.rst +0 -39
  316. data/vendor/pygments-main/doc/docs/plugins.rst +0 -93
  317. data/vendor/pygments-main/doc/docs/quickstart.rst +0 -205
  318. data/vendor/pygments-main/doc/docs/rstdirective.rst +0 -22
  319. data/vendor/pygments-main/doc/docs/styles.rst +0 -201
  320. data/vendor/pygments-main/doc/docs/tokens.rst +0 -372
  321. data/vendor/pygments-main/doc/docs/unicode.rst +0 -58
  322. data/vendor/pygments-main/doc/download.rst +0 -41
  323. data/vendor/pygments-main/doc/faq.rst +0 -139
  324. data/vendor/pygments-main/doc/index.rst +0 -54
  325. data/vendor/pygments-main/doc/languages.rst +0 -154
  326. data/vendor/pygments-main/doc/make.bat +0 -190
  327. data/vendor/pygments-main/doc/pygmentize.1 +0 -94
  328. data/vendor/pygments-main/external/autopygmentize +0 -101
  329. data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +0 -162
  330. data/vendor/pygments-main/external/markdown-processor.py +0 -67
  331. data/vendor/pygments-main/external/moin-parser.py +0 -112
  332. data/vendor/pygments-main/external/pygments.bashcomp +0 -38
  333. data/vendor/pygments-main/external/rst-directive.py +0 -82
  334. data/vendor/pygments-main/pygmentize +0 -8
  335. data/vendor/pygments-main/requirements.txt +0 -5
  336. data/vendor/pygments-main/scripts/check_sources.py +0 -211
  337. data/vendor/pygments-main/scripts/debug_lexer.py +0 -246
  338. data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +0 -33
  339. data/vendor/pygments-main/scripts/epydoc.css +0 -280
  340. data/vendor/pygments-main/scripts/get_vimkw.py +0 -74
  341. data/vendor/pygments-main/scripts/pylintrc +0 -301
  342. data/vendor/pygments-main/scripts/vim2pygments.py +0 -935
  343. data/vendor/pygments-main/setup.cfg +0 -10
  344. data/vendor/pygments-main/setup.py +0 -77
  345. data/vendor/pygments-main/tox.ini +0 -7
  346. data/vendor/simplejson/.gitignore +0 -10
  347. data/vendor/simplejson/.travis.yml +0 -5
  348. data/vendor/simplejson/CHANGES.txt +0 -291
  349. data/vendor/simplejson/LICENSE.txt +0 -19
  350. data/vendor/simplejson/MANIFEST.in +0 -5
  351. data/vendor/simplejson/README.rst +0 -19
  352. data/vendor/simplejson/conf.py +0 -179
  353. data/vendor/simplejson/index.rst +0 -628
  354. data/vendor/simplejson/scripts/make_docs.py +0 -18
  355. data/vendor/simplejson/setup.py +0 -104
  356. data/vendor/simplejson/simplejson/__init__.py +0 -510
  357. data/vendor/simplejson/simplejson/_speedups.c +0 -2745
  358. data/vendor/simplejson/simplejson/decoder.py +0 -425
  359. data/vendor/simplejson/simplejson/encoder.py +0 -567
  360. data/vendor/simplejson/simplejson/ordered_dict.py +0 -119
  361. data/vendor/simplejson/simplejson/scanner.py +0 -77
  362. data/vendor/simplejson/simplejson/tests/__init__.py +0 -67
  363. data/vendor/simplejson/simplejson/tests/test_bigint_as_string.py +0 -55
  364. data/vendor/simplejson/simplejson/tests/test_check_circular.py +0 -30
  365. data/vendor/simplejson/simplejson/tests/test_decimal.py +0 -66
  366. data/vendor/simplejson/simplejson/tests/test_decode.py +0 -83
  367. data/vendor/simplejson/simplejson/tests/test_default.py +0 -9
  368. data/vendor/simplejson/simplejson/tests/test_dump.py +0 -67
  369. data/vendor/simplejson/simplejson/tests/test_encode_basestring_ascii.py +0 -46
  370. data/vendor/simplejson/simplejson/tests/test_encode_for_html.py +0 -32
  371. data/vendor/simplejson/simplejson/tests/test_errors.py +0 -34
  372. data/vendor/simplejson/simplejson/tests/test_fail.py +0 -91
  373. data/vendor/simplejson/simplejson/tests/test_float.py +0 -19
  374. data/vendor/simplejson/simplejson/tests/test_indent.py +0 -86
  375. data/vendor/simplejson/simplejson/tests/test_item_sort_key.py +0 -20
  376. data/vendor/simplejson/simplejson/tests/test_namedtuple.py +0 -121
  377. data/vendor/simplejson/simplejson/tests/test_pass1.py +0 -76
  378. data/vendor/simplejson/simplejson/tests/test_pass2.py +0 -14
  379. data/vendor/simplejson/simplejson/tests/test_pass3.py +0 -20
  380. data/vendor/simplejson/simplejson/tests/test_recursion.py +0 -67
  381. data/vendor/simplejson/simplejson/tests/test_scanstring.py +0 -117
  382. data/vendor/simplejson/simplejson/tests/test_separators.py +0 -42
  383. data/vendor/simplejson/simplejson/tests/test_speedups.py +0 -20
  384. data/vendor/simplejson/simplejson/tests/test_tuple.py +0 -49
  385. data/vendor/simplejson/simplejson/tests/test_unicode.py +0 -109
  386. data/vendor/simplejson/simplejson/tool.py +0 -39
@@ -0,0 +1,330 @@
1
+ """
2
+ pygments.lexers.julia
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Julia language.
6
+
7
+ :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import Lexer, RegexLexer, bygroups, do_insertions, \
14
+ words, include
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Number, Punctuation, Generic
17
+ from pygments.util import shebang_matches
18
+
19
+ __all__ = ['JuliaLexer', 'JuliaConsoleLexer']
20
+
21
+ allowed_variable = \
22
+ '(?:[a-zA-Z_\u00A1-\U0010ffff]|%s)(?:[a-zA-Z_0-9\u00A1-\U0010ffff])*!*'
23
+
24
+
25
+ class JuliaLexer(RegexLexer):
26
+ """
27
+ For `Julia <http://julialang.org/>`_ source code.
28
+
29
+ .. versionadded:: 1.6
30
+ """
31
+
32
+ name = 'Julia'
33
+ aliases = ['julia', 'jl']
34
+ filenames = ['*.jl']
35
+ mimetypes = ['text/x-julia', 'application/x-julia']
36
+
37
+ flags = re.MULTILINE | re.UNICODE
38
+
39
+ tokens = {
40
+ 'root': [
41
+ (r'\n', Text),
42
+ (r'[^\S\n]+', Text),
43
+ (r'#=', Comment.Multiline, "blockcomment"),
44
+ (r'#.*$', Comment),
45
+ (r'[\[\]{}(),;]', Punctuation),
46
+
47
+ # keywords
48
+ (r'in\b', Keyword.Pseudo),
49
+ (r'isa\b', Keyword.Pseudo),
50
+ (r'(true|false)\b', Keyword.Constant),
51
+ (r'(local|global|const)\b', Keyword.Declaration),
52
+ (words([
53
+ 'function', 'type', 'typealias', 'abstract', 'immutable',
54
+ 'baremodule', 'begin', 'bitstype', 'break', 'catch', 'ccall',
55
+ 'continue', 'do', 'else', 'elseif', 'end', 'export', 'finally',
56
+ 'for', 'if', 'import', 'importall', 'let', 'macro', 'module',
57
+ 'mutable', 'primitive', 'quote', 'return', 'struct', 'try',
58
+ 'using', 'while'],
59
+ suffix=r'\b'), Keyword),
60
+
61
+ # NOTE
62
+ # Patterns below work only for definition sites and thus hardly reliable.
63
+ #
64
+ # functions
65
+ # (r'(function)(\s+)(' + allowed_variable + ')',
66
+ # bygroups(Keyword, Text, Name.Function)),
67
+ #
68
+ # types
69
+ # (r'(type|typealias|abstract|immutable)(\s+)(' + allowed_variable + ')',
70
+ # bygroups(Keyword, Text, Name.Class)),
71
+
72
+ # type names
73
+ (words([
74
+ 'ANY', 'ASCIIString', 'AbstractArray', 'AbstractChannel',
75
+ 'AbstractFloat', 'AbstractMatrix', 'AbstractRNG',
76
+ 'AbstractSparseArray', 'AbstractSparseMatrix',
77
+ 'AbstractSparseVector', 'AbstractString', 'AbstractVecOrMat',
78
+ 'AbstractVector', 'Any', 'ArgumentError', 'Array',
79
+ 'AssertionError', 'Associative', 'Base64DecodePipe',
80
+ 'Base64EncodePipe', 'Bidiagonal', 'BigFloat', 'BigInt',
81
+ 'BitArray', 'BitMatrix', 'BitVector', 'Bool', 'BoundsError',
82
+ 'Box', 'BufferStream', 'CapturedException', 'CartesianIndex',
83
+ 'CartesianRange', 'Cchar', 'Cdouble', 'Cfloat', 'Channel',
84
+ 'Char', 'Cint', 'Cintmax_t', 'Clong', 'Clonglong',
85
+ 'ClusterManager', 'Cmd', 'Coff_t', 'Colon', 'Complex',
86
+ 'Complex128', 'Complex32', 'Complex64', 'CompositeException',
87
+ 'Condition', 'Cptrdiff_t', 'Cshort', 'Csize_t', 'Cssize_t',
88
+ 'Cstring', 'Cuchar', 'Cuint', 'Cuintmax_t', 'Culong',
89
+ 'Culonglong', 'Cushort', 'Cwchar_t', 'Cwstring', 'DataType',
90
+ 'Date', 'DateTime', 'DenseArray', 'DenseMatrix',
91
+ 'DenseVecOrMat', 'DenseVector', 'Diagonal', 'Dict',
92
+ 'DimensionMismatch', 'Dims', 'DirectIndexString', 'Display',
93
+ 'DivideError', 'DomainError', 'EOFError', 'EachLine', 'Enum',
94
+ 'Enumerate', 'ErrorException', 'Exception', 'Expr',
95
+ 'Factorization', 'FileMonitor', 'FileOffset', 'Filter',
96
+ 'Float16', 'Float32', 'Float64', 'FloatRange', 'Function',
97
+ 'GenSym', 'GlobalRef', 'GotoNode', 'HTML', 'Hermitian', 'IO',
98
+ 'IOBuffer', 'IOStream', 'IPv4', 'IPv6', 'InexactError',
99
+ 'InitError', 'Int', 'Int128', 'Int16', 'Int32', 'Int64', 'Int8',
100
+ 'IntSet', 'Integer', 'InterruptException', 'IntrinsicFunction',
101
+ 'InvalidStateException', 'Irrational', 'KeyError', 'LabelNode',
102
+ 'LambdaStaticData', 'LinSpace', 'LineNumberNode', 'LoadError',
103
+ 'LocalProcess', 'LowerTriangular', 'MIME', 'Matrix',
104
+ 'MersenneTwister', 'Method', 'MethodError', 'MethodTable',
105
+ 'Module', 'NTuple', 'NewvarNode', 'NullException', 'Nullable',
106
+ 'Number', 'ObjectIdDict', 'OrdinalRange', 'OutOfMemoryError',
107
+ 'OverflowError', 'Pair', 'ParseError', 'PartialQuickSort',
108
+ 'Pipe', 'PollingFileWatcher', 'ProcessExitedException',
109
+ 'ProcessGroup', 'Ptr', 'QuoteNode', 'RandomDevice', 'Range',
110
+ 'Rational', 'RawFD', 'ReadOnlyMemoryError', 'Real',
111
+ 'ReentrantLock', 'Ref', 'Regex', 'RegexMatch',
112
+ 'RemoteException', 'RemoteRef', 'RepString', 'RevString',
113
+ 'RopeString', 'RoundingMode', 'SegmentationFault',
114
+ 'SerializationState', 'Set', 'SharedArray', 'SharedMatrix',
115
+ 'SharedVector', 'Signed', 'SimpleVector', 'SparseMatrixCSC',
116
+ 'StackOverflowError', 'StatStruct', 'StepRange', 'StridedArray',
117
+ 'StridedMatrix', 'StridedVecOrMat', 'StridedVector', 'SubArray',
118
+ 'SubString', 'SymTridiagonal', 'Symbol', 'SymbolNode',
119
+ 'Symmetric', 'SystemError', 'TCPSocket', 'Task', 'Text',
120
+ 'TextDisplay', 'Timer', 'TopNode', 'Tridiagonal', 'Tuple',
121
+ 'Type', 'TypeConstructor', 'TypeError', 'TypeName', 'TypeVar',
122
+ 'UDPSocket', 'UInt', 'UInt128', 'UInt16', 'UInt32', 'UInt64',
123
+ 'UInt8', 'UTF16String', 'UTF32String', 'UTF8String',
124
+ 'UndefRefError', 'UndefVarError', 'UnicodeError', 'UniformScaling',
125
+ 'Union', 'UnitRange', 'Unsigned', 'UpperTriangular', 'Val',
126
+ 'Vararg', 'VecOrMat', 'Vector', 'VersionNumber', 'Void', 'WString',
127
+ 'WeakKeyDict', 'WeakRef', 'WorkerConfig', 'Zip'], suffix=r'\b'),
128
+ Keyword.Type),
129
+
130
+ # builtins
131
+ (words([
132
+ 'ARGS', 'CPU_CORES', 'C_NULL', 'DevNull', 'ENDIAN_BOM',
133
+ 'ENV', 'I', 'Inf', 'Inf16', 'Inf32', 'Inf64',
134
+ 'InsertionSort', 'JULIA_HOME', 'LOAD_PATH', 'MergeSort',
135
+ 'NaN', 'NaN16', 'NaN32', 'NaN64', 'OS_NAME',
136
+ 'QuickSort', 'RoundDown', 'RoundFromZero', 'RoundNearest',
137
+ 'RoundNearestTiesAway', 'RoundNearestTiesUp',
138
+ 'RoundToZero', 'RoundUp', 'STDERR', 'STDIN', 'STDOUT',
139
+ 'VERSION', 'WORD_SIZE', 'catalan', 'e', 'eu',
140
+ 'eulergamma', 'golden', 'im', 'nothing', 'pi', 'γ', 'π', 'φ'],
141
+ suffix=r'\b'), Name.Builtin),
142
+
143
+ # operators
144
+ # see: https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm
145
+ (words((
146
+ # prec-assignment
147
+ '=', ':=', '+=', '-=', '*=', '/=', '//=', './/=', '.*=', './=',
148
+ '\\=', '.\\=', '^=', '.^=', '÷=', '.÷=', '%=', '.%=', '|=', '&=',
149
+ '$=', '=>', '<<=', '>>=', '>>>=', '~', '.+=', '.-=',
150
+ # prec-conditional
151
+ '?',
152
+ # prec-arrow
153
+ '--', '-->',
154
+ # prec-lazy-or
155
+ '||',
156
+ # prec-lazy-and
157
+ '&&',
158
+ # prec-comparison
159
+ '>', '<', '>=', '≥', '<=', '≤', '==', '===', '≡', '!=', '≠',
160
+ '!==', '≢', '.>', '.<', '.>=', '.≥', '.<=', '.≤', '.==', '.!=',
161
+ '.≠', '.=', '.!', '<:', '>:', '∈', '∉', '∋', '∌', '⊆',
162
+ '⊈', '⊂',
163
+ '⊄', '⊊',
164
+ # prec-pipe
165
+ '|>', '<|',
166
+ # prec-colon
167
+ ':',
168
+ # prec-plus
169
+ '.+', '.-', '|', '∪', '$',
170
+ # prec-bitshift
171
+ '<<', '>>', '>>>', '.<<', '.>>', '.>>>',
172
+ # prec-times
173
+ '*', '/', './', '÷', '.÷', '%', '⋅', '.%', '.*', '\\', '.\\', '&', '∩',
174
+ # prec-rational
175
+ '//', './/',
176
+ # prec-power
177
+ '^', '.^',
178
+ # prec-decl
179
+ '::',
180
+ # prec-dot
181
+ '.',
182
+ # unary op
183
+ '+', '-', '!', '√', '∛', '∜',
184
+ )), Operator),
185
+
186
+ # chars
187
+ (r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,3}|\\u[a-fA-F0-9]{1,4}|"
188
+ r"\\U[a-fA-F0-9]{1,6}|[^\\\'\n])'", String.Char),
189
+
190
+ # try to match trailing transpose
191
+ (r'(?<=[.\w)\]])\'+', Operator),
192
+
193
+ # strings
194
+ (r'"""', String, 'tqstring'),
195
+ (r'"', String, 'string'),
196
+
197
+ # regular expressions
198
+ (r'r"""', String.Regex, 'tqregex'),
199
+ (r'r"', String.Regex, 'regex'),
200
+
201
+ # backticks
202
+ (r'`', String.Backtick, 'command'),
203
+
204
+ # names
205
+ (allowed_variable, Name),
206
+ (r'@' + allowed_variable, Name.Decorator),
207
+
208
+ # numbers
209
+ (r'(\d+(_\d+)+\.\d*|\d*\.\d+(_\d+)+)([eEf][+-]?[0-9]+)?', Number.Float),
210
+ (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
211
+ (r'\d+(_\d+)+[eEf][+-]?[0-9]+', Number.Float),
212
+ (r'\d+[eEf][+-]?[0-9]+', Number.Float),
213
+ (r'0b[01]+(_[01]+)+', Number.Bin),
214
+ (r'0b[01]+', Number.Bin),
215
+ (r'0o[0-7]+(_[0-7]+)+', Number.Oct),
216
+ (r'0o[0-7]+', Number.Oct),
217
+ (r'0x[a-fA-F0-9]+(_[a-fA-F0-9]+)+', Number.Hex),
218
+ (r'0x[a-fA-F0-9]+', Number.Hex),
219
+ (r'\d+(_\d+)+', Number.Integer),
220
+ (r'\d+', Number.Integer)
221
+ ],
222
+
223
+ "blockcomment": [
224
+ (r'[^=#]', Comment.Multiline),
225
+ (r'#=', Comment.Multiline, '#push'),
226
+ (r'=#', Comment.Multiline, '#pop'),
227
+ (r'[=#]', Comment.Multiline),
228
+ ],
229
+
230
+ 'string': [
231
+ (r'"', String, '#pop'),
232
+ # FIXME: This escape pattern is not perfect.
233
+ (r'\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)', String.Escape),
234
+ # Interpolation is defined as "$" followed by the shortest full
235
+ # expression, which is something we can't parse.
236
+ # Include the most common cases here: $word, and $(paren'd expr).
237
+ (r'\$' + allowed_variable, String.Interpol),
238
+ # (r'\$[a-zA-Z_]+', String.Interpol),
239
+ (r'(\$)(\()', bygroups(String.Interpol, Punctuation), 'in-intp'),
240
+ # @printf and @sprintf formats
241
+ (r'%[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]',
242
+ String.Interpol),
243
+ (r'.|\s', String),
244
+ ],
245
+
246
+ 'tqstring': [
247
+ (r'"""', String, '#pop'),
248
+ (r'\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)', String.Escape),
249
+ (r'\$' + allowed_variable, String.Interpol),
250
+ (r'(\$)(\()', bygroups(String.Interpol, Punctuation), 'in-intp'),
251
+ (r'.|\s', String),
252
+ ],
253
+
254
+ 'regex': [
255
+ (r'"', String.Regex, '#pop'),
256
+ (r'\\"', String.Regex),
257
+ (r'.|\s', String.Regex),
258
+ ],
259
+
260
+ 'tqregex': [
261
+ (r'"""', String.Regex, '#pop'),
262
+ (r'.|\s', String.Regex),
263
+ ],
264
+
265
+ 'command': [
266
+ (r'`', String.Backtick, '#pop'),
267
+ (r'\$' + allowed_variable, String.Interpol),
268
+ (r'(\$)(\()', bygroups(String.Interpol, Punctuation), 'in-intp'),
269
+ (r'.|\s', String.Backtick)
270
+ ],
271
+
272
+ 'in-intp': [
273
+ (r'\(', Punctuation, '#push'),
274
+ (r'\)', Punctuation, '#pop'),
275
+ include('root'),
276
+ ]
277
+ }
278
+
279
+ def analyse_text(text):
280
+ return shebang_matches(text, r'julia')
281
+
282
+
283
+ class JuliaConsoleLexer(Lexer):
284
+ """
285
+ For Julia console sessions. Modeled after MatlabSessionLexer.
286
+
287
+ .. versionadded:: 1.6
288
+ """
289
+ name = 'Julia console'
290
+ aliases = ['jlcon']
291
+
292
+ def get_tokens_unprocessed(self, text):
293
+ jllexer = JuliaLexer(**self.options)
294
+ start = 0
295
+ curcode = ''
296
+ insertions = []
297
+ output = False
298
+ error = False
299
+
300
+ for line in text.splitlines(True):
301
+ if line.startswith('julia>'):
302
+ insertions.append((len(curcode), [(0, Generic.Prompt, line[:6])]))
303
+ curcode += line[6:]
304
+ output = False
305
+ error = False
306
+ elif line.startswith('help?>') or line.startswith('shell>'):
307
+ yield start, Generic.Prompt, line[:6]
308
+ yield start + 6, Text, line[6:]
309
+ output = False
310
+ error = False
311
+ elif line.startswith(' ') and not output:
312
+ insertions.append((len(curcode), [(0, Text, line[:6])]))
313
+ curcode += line[6:]
314
+ else:
315
+ if curcode:
316
+ yield from do_insertions(
317
+ insertions, jllexer.get_tokens_unprocessed(curcode))
318
+ curcode = ''
319
+ insertions = []
320
+ if line.startswith('ERROR: ') or error:
321
+ yield start, Generic.Error, line
322
+ error = True
323
+ else:
324
+ yield start, Generic.Output, line
325
+ output = True
326
+ start += len(line)
327
+
328
+ if curcode:
329
+ yield from do_insertions(
330
+ insertions, jllexer.get_tokens_unprocessed(curcode))
@@ -0,0 +1,1739 @@
1
+ """
2
+ pygments.lexers.jvm
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Pygments lexers for JVM languages.
6
+
7
+ :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, \
14
+ this, combined, default, words
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Number, Punctuation
17
+ from pygments.util import shebang_matches
18
+ from pygments import unistring as uni
19
+
20
+ __all__ = ['JavaLexer', 'ScalaLexer', 'GosuLexer', 'GosuTemplateLexer',
21
+ 'GroovyLexer', 'IokeLexer', 'ClojureLexer', 'ClojureScriptLexer',
22
+ 'KotlinLexer', 'XtendLexer', 'AspectJLexer', 'CeylonLexer',
23
+ 'PigLexer', 'GoloLexer', 'JasminLexer', 'SarlLexer']
24
+
25
+
26
+ class JavaLexer(RegexLexer):
27
+ """
28
+ For `Java <https://www.oracle.com/technetwork/java/>`_ source code.
29
+ """
30
+
31
+ name = 'Java'
32
+ aliases = ['java']
33
+ filenames = ['*.java']
34
+ mimetypes = ['text/x-java']
35
+
36
+ flags = re.MULTILINE | re.DOTALL | re.UNICODE
37
+
38
+ tokens = {
39
+ 'root': [
40
+ (r'[^\S\n]+', Text),
41
+ (r'//.*?\n', Comment.Single),
42
+ (r'/\*.*?\*/', Comment.Multiline),
43
+ # keywords: go before method names to avoid lexing "throw new XYZ"
44
+ # as a method signature
45
+ (r'(assert|break|case|catch|continue|default|do|else|finally|for|'
46
+ r'if|goto|instanceof|new|return|switch|this|throw|try|while)\b',
47
+ Keyword),
48
+ # method names
49
+ (r'((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)' # return arguments
50
+ r'((?:[^\W\d]|\$)[\w$]*)' # method name
51
+ r'(\s*)(\()', # signature start
52
+ bygroups(using(this), Name.Function, Text, Punctuation)),
53
+ (r'@[^\W\d][\w.]*', Name.Decorator),
54
+ (r'(abstract|const|enum|extends|final|implements|native|private|'
55
+ r'protected|public|static|strictfp|super|synchronized|throws|'
56
+ r'transient|volatile)\b', Keyword.Declaration),
57
+ (r'(boolean|byte|char|double|float|int|long|short|void)\b',
58
+ Keyword.Type),
59
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
60
+ (r'(true|false|null)\b', Keyword.Constant),
61
+ (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text),
62
+ 'class'),
63
+ (r'(var)(\s+)', bygroups(Keyword.Declaration, Text),
64
+ 'var'),
65
+ (r'(import(?:\s+static)?)(\s+)', bygroups(Keyword.Namespace, Text),
66
+ 'import'),
67
+ (r'"', String, 'string'),
68
+ (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
69
+ (r'(\.)((?:[^\W\d]|\$)[\w$]*)', bygroups(Punctuation,
70
+ Name.Attribute)),
71
+ (r'^\s*([^\W\d]|\$)[\w$]*:', Name.Label),
72
+ (r'([^\W\d]|\$)[\w$]*', Name),
73
+ (r'([0-9][0-9_]*\.([0-9][0-9_]*)?|'
74
+ r'\.[0-9][0-9_]*)'
75
+ r'([eE][+\-]?[0-9][0-9_]*)?[fFdD]?|'
76
+ r'[0-9][eE][+\-]?[0-9][0-9_]*[fFdD]?|'
77
+ r'[0-9]([eE][+\-]?[0-9][0-9_]*)?[fFdD]|'
78
+ r'0[xX]([0-9a-fA-F][0-9a-fA-F_]*\.?|'
79
+ r'([0-9a-fA-F][0-9a-fA-F_]*)?\.[0-9a-fA-F][0-9a-fA-F_]*)'
80
+ r'[pP][+\-]?[0-9][0-9_]*[fFdD]?', Number.Float),
81
+ (r'0[xX][0-9a-fA-F][0-9a-fA-F_]*[lL]?', Number.Hex),
82
+ (r'0[bB][01][01_]*[lL]?', Number.Bin),
83
+ (r'0[0-7_]+[lL]?', Number.Oct),
84
+ (r'0|[1-9][0-9_]*[lL]?', Number.Integer),
85
+ (r'[~^*!%&\[\]<>|+=/?-]', Operator),
86
+ (r'[{}();:.,]', Punctuation),
87
+ (r'\n', Text)
88
+ ],
89
+ 'class': [
90
+ (r'([^\W\d]|\$)[\w$]*', Name.Class, '#pop')
91
+ ],
92
+ 'var': [
93
+ (r'([^\W\d]|\$)[\w$]*', Name, '#pop')
94
+ ],
95
+ 'import': [
96
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
97
+ ],
98
+ 'string': [
99
+ (r'[^\\"]+', String),
100
+ (r'\\\\', String), # Escaped backslash
101
+ (r'\\"', String), # Escaped quote
102
+ (r'\\', String), # Bare backslash
103
+ (r'"', String, '#pop'), # Closing quote
104
+ ],
105
+ }
106
+
107
+
108
+ class AspectJLexer(JavaLexer):
109
+ """
110
+ For `AspectJ <http://www.eclipse.org/aspectj/>`_ source code.
111
+
112
+ .. versionadded:: 1.6
113
+ """
114
+
115
+ name = 'AspectJ'
116
+ aliases = ['aspectj']
117
+ filenames = ['*.aj']
118
+ mimetypes = ['text/x-aspectj']
119
+
120
+ aj_keywords = {
121
+ 'aspect', 'pointcut', 'privileged', 'call', 'execution',
122
+ 'initialization', 'preinitialization', 'handler', 'get', 'set',
123
+ 'staticinitialization', 'target', 'args', 'within', 'withincode',
124
+ 'cflow', 'cflowbelow', 'annotation', 'before', 'after', 'around',
125
+ 'proceed', 'throwing', 'returning', 'adviceexecution', 'declare',
126
+ 'parents', 'warning', 'error', 'soft', 'precedence', 'thisJoinPoint',
127
+ 'thisJoinPointStaticPart', 'thisEnclosingJoinPointStaticPart',
128
+ 'issingleton', 'perthis', 'pertarget', 'percflow', 'percflowbelow',
129
+ 'pertypewithin', 'lock', 'unlock', 'thisAspectInstance'
130
+ }
131
+ aj_inter_type = {'parents:', 'warning:', 'error:', 'soft:', 'precedence:'}
132
+ aj_inter_type_annotation = {'@type', '@method', '@constructor', '@field'}
133
+
134
+ def get_tokens_unprocessed(self, text):
135
+ for index, token, value in JavaLexer.get_tokens_unprocessed(self, text):
136
+ if token is Name and value in self.aj_keywords:
137
+ yield index, Keyword, value
138
+ elif token is Name.Label and value in self.aj_inter_type:
139
+ yield index, Keyword, value[:-1]
140
+ yield index, Operator, value[-1]
141
+ elif token is Name.Decorator and value in self.aj_inter_type_annotation:
142
+ yield index, Keyword, value
143
+ else:
144
+ yield index, token, value
145
+
146
+
147
+ class ScalaLexer(RegexLexer):
148
+ """
149
+ For `Scala <http://www.scala-lang.org>`_ source code.
150
+ """
151
+
152
+ name = 'Scala'
153
+ aliases = ['scala']
154
+ filenames = ['*.scala']
155
+ mimetypes = ['text/x-scala']
156
+
157
+ flags = re.MULTILINE | re.DOTALL
158
+
159
+ # don't use raw unicode strings!
160
+ op = ('[-~\\^\\*!%&\\\\<>\\|+=:/?@\u00a6-\u00a7\u00a9\u00ac\u00ae\u00b0-\u00b1'
161
+ '\u00b6\u00d7\u00f7\u03f6\u0482\u0606-\u0608\u060e-\u060f\u06e9'
162
+ '\u06fd-\u06fe\u07f6\u09fa\u0b70\u0bf3-\u0bf8\u0bfa\u0c7f\u0cf1-\u0cf2'
163
+ '\u0d79\u0f01-\u0f03\u0f13-\u0f17\u0f1a-\u0f1f\u0f34\u0f36\u0f38'
164
+ '\u0fbe-\u0fc5\u0fc7-\u0fcf\u109e-\u109f\u1360\u1390-\u1399\u1940'
165
+ '\u19e0-\u19ff\u1b61-\u1b6a\u1b74-\u1b7c\u2044\u2052\u207a-\u207c'
166
+ '\u208a-\u208c\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118'
167
+ '\u211e-\u2123\u2125\u2127\u2129\u212e\u213a-\u213b\u2140-\u2144'
168
+ '\u214a-\u214d\u214f\u2190-\u2328\u232b-\u244a\u249c-\u24e9\u2500-\u2767'
169
+ '\u2794-\u27c4\u27c7-\u27e5\u27f0-\u2982\u2999-\u29d7\u29dc-\u29fb'
170
+ '\u29fe-\u2b54\u2ce5-\u2cea\u2e80-\u2ffb\u3004\u3012-\u3013\u3020'
171
+ '\u3036-\u3037\u303e-\u303f\u3190-\u3191\u3196-\u319f\u31c0-\u31e3'
172
+ '\u3200-\u321e\u322a-\u3250\u3260-\u327f\u328a-\u32b0\u32c0-\u33ff'
173
+ '\u4dc0-\u4dff\ua490-\ua4c6\ua828-\ua82b\ufb29\ufdfd\ufe62\ufe64-\ufe66'
174
+ '\uff0b\uff1c-\uff1e\uff5c\uff5e\uffe2\uffe4\uffe8-\uffee\ufffc-\ufffd]+')
175
+
176
+ letter = ('[a-zA-Z\\$_\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6'
177
+ '\u00f8-\u02af\u0370-\u0373\u0376-\u0377\u037b-\u037d\u0386'
178
+ '\u0388-\u03f5\u03f7-\u0481\u048a-\u0556\u0561-\u0587\u05d0-\u05f2'
179
+ '\u0621-\u063f\u0641-\u064a\u066e-\u066f\u0671-\u06d3\u06d5'
180
+ '\u06ee-\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5'
181
+ '\u07b1\u07ca-\u07ea\u0904-\u0939\u093d\u0950\u0958-\u0961'
182
+ '\u0972-\u097f\u0985-\u09b9\u09bd\u09ce\u09dc-\u09e1\u09f0-\u09f1'
183
+ '\u0a05-\u0a39\u0a59-\u0a5e\u0a72-\u0a74\u0a85-\u0ab9\u0abd'
184
+ '\u0ad0-\u0ae1\u0b05-\u0b39\u0b3d\u0b5c-\u0b61\u0b71\u0b83-\u0bb9'
185
+ '\u0bd0\u0c05-\u0c3d\u0c58-\u0c61\u0c85-\u0cb9\u0cbd\u0cde-\u0ce1'
186
+ '\u0d05-\u0d3d\u0d60-\u0d61\u0d7a-\u0d7f\u0d85-\u0dc6\u0e01-\u0e30'
187
+ '\u0e32-\u0e33\u0e40-\u0e45\u0e81-\u0eb0\u0eb2-\u0eb3\u0ebd-\u0ec4'
188
+ '\u0edc-\u0f00\u0f40-\u0f6c\u0f88-\u0f8b\u1000-\u102a\u103f'
189
+ '\u1050-\u1055\u105a-\u105d\u1061\u1065-\u1066\u106e-\u1070'
190
+ '\u1075-\u1081\u108e\u10a0-\u10fa\u1100-\u135a\u1380-\u138f'
191
+ '\u13a0-\u166c\u166f-\u1676\u1681-\u169a\u16a0-\u16ea\u16ee-\u1711'
192
+ '\u1720-\u1731\u1740-\u1751\u1760-\u1770\u1780-\u17b3\u17dc'
193
+ '\u1820-\u1842\u1844-\u18a8\u18aa-\u191c\u1950-\u19a9\u19c1-\u19c7'
194
+ '\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae-\u1baf'
195
+ '\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c77\u1d00-\u1d2b\u1d62-\u1d77'
196
+ '\u1d79-\u1d9a\u1e00-\u1fbc\u1fbe\u1fc2-\u1fcc\u1fd0-\u1fdb'
197
+ '\u1fe0-\u1fec\u1ff2-\u1ffc\u2071\u207f\u2102\u2107\u210a-\u2113'
198
+ '\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139'
199
+ '\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c7c'
200
+ '\u2c80-\u2ce4\u2d00-\u2d65\u2d80-\u2dde\u3006-\u3007\u3021-\u3029'
201
+ '\u3038-\u303a\u303c\u3041-\u3096\u309f\u30a1-\u30fa\u30ff-\u318e'
202
+ '\u31a0-\u31b7\u31f0-\u31ff\u3400-\u4db5\u4e00-\ua014\ua016-\ua48c'
203
+ '\ua500-\ua60b\ua610-\ua61f\ua62a-\ua66e\ua680-\ua697\ua722-\ua76f'
204
+ '\ua771-\ua787\ua78b-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822'
205
+ '\ua840-\ua873\ua882-\ua8b3\ua90a-\ua925\ua930-\ua946\uaa00-\uaa28'
206
+ '\uaa40-\uaa42\uaa44-\uaa4b\uac00-\ud7a3\uf900-\ufb1d\ufb1f-\ufb28'
207
+ '\ufb2a-\ufd3d\ufd50-\ufdfb\ufe70-\ufefc\uff21-\uff3a\uff41-\uff5a'
208
+ '\uff66-\uff6f\uff71-\uff9d\uffa0-\uffdc]')
209
+
210
+ upper = ('[A-Z\\$_\u00c0-\u00d6\u00d8-\u00de\u0100\u0102\u0104\u0106\u0108'
211
+ '\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c'
212
+ '\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130'
213
+ '\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145'
214
+ '\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a'
215
+ '\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e'
216
+ '\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182'
217
+ '\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194'
218
+ '\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7'
219
+ '\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc'
220
+ '\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9'
221
+ '\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee'
222
+ '\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204'
223
+ '\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218'
224
+ '\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c'
225
+ '\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246'
226
+ '\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u0386\u0388-\u038f'
227
+ '\u0391-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0'
228
+ '\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7'
229
+ '\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a'
230
+ '\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e'
231
+ '\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a'
232
+ '\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae'
233
+ '\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1'
234
+ '\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6'
235
+ '\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea'
236
+ '\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe'
237
+ '\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512'
238
+ '\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0531-\u0556'
239
+ '\u10a0-\u10c5\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e'
240
+ '\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22'
241
+ '\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36'
242
+ '\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a'
243
+ '\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e'
244
+ '\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72'
245
+ '\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86'
246
+ '\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2'
247
+ '\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6'
248
+ '\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca'
249
+ '\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede'
250
+ '\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2'
251
+ '\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d'
252
+ '\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59-\u1f5f'
253
+ '\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb'
254
+ '\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112'
255
+ '\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133'
256
+ '\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67'
257
+ '\u2c69\u2c6b\u2c6d-\u2c6f\u2c72\u2c75\u2c80\u2c82\u2c84\u2c86'
258
+ '\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a'
259
+ '\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae'
260
+ '\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2'
261
+ '\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6'
262
+ '\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\ua640\ua642\ua644\ua646'
263
+ '\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a'
264
+ '\ua65c\ua65e\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682'
265
+ '\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696'
266
+ '\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736'
267
+ '\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a'
268
+ '\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e'
269
+ '\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b'
270
+ '\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\uff21-\uff3a]')
271
+
272
+ idrest = '%s(?:%s|[0-9])*(?:(?<=_)%s)?' % (letter, letter, op)
273
+ letter_letter_digit = '%s(?:%s|\\d)*' % (letter, letter)
274
+
275
+ tokens = {
276
+ 'root': [
277
+ # method names
278
+ (r'(class|trait|object)(\s+)', bygroups(Keyword, Text), 'class'),
279
+ (r'[^\S\n]+', Text),
280
+ include('comments'),
281
+ (r'@%s' % idrest, Name.Decorator),
282
+ (r'(abstract|ca(?:se|tch)|d(?:ef|o)|e(?:lse|xtends)|'
283
+ r'f(?:inal(?:ly)?|or(?:Some)?)|i(?:f|mplicit)|'
284
+ r'lazy|match|new|override|pr(?:ivate|otected)'
285
+ r'|re(?:quires|turn)|s(?:ealed|uper)|'
286
+ r't(?:h(?:is|row)|ry)|va[lr]|w(?:hile|ith)|yield)\b|'
287
+ r'(<[%:-]|=>|>:|[#=@_\u21D2\u2190])\b', Keyword),
288
+ (r':(?!%s)' % op, Keyword, 'type'),
289
+ (r'%s%s\b' % (upper, idrest), Name.Class),
290
+ (r'(true|false|null)\b', Keyword.Constant),
291
+ (r'(import|package)(\s+)', bygroups(Keyword, Text), 'import'),
292
+ (r'(type)(\s+)', bygroups(Keyword, Text), 'type'),
293
+ (r'""".*?"""(?!")', String),
294
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
295
+ (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
296
+ (r"'%s" % idrest, Text.Symbol),
297
+ (r'[fs]"""', String, 'interptriplestring'), # interpolated strings
298
+ (r'[fs]"', String, 'interpstring'), # interpolated strings
299
+ (r'raw"(\\\\|\\[^\\]|[^"\\])*"', String), # raw strings
300
+ # (r'(\.)(%s|%s|`[^`]+`)' % (idrest, op), bygroups(Operator,
301
+ # Name.Attribute)),
302
+ (idrest, Name),
303
+ (r'`[^`]+`', Name),
304
+ (r'\[', Operator, 'typeparam'),
305
+ (r'[(){};,.#]', Operator),
306
+ (op, Operator),
307
+ (r'([0-9][0-9]*\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?',
308
+ Number.Float),
309
+ (r'0x[0-9a-fA-F]+', Number.Hex),
310
+ (r'[0-9]+L?', Number.Integer),
311
+ (r'\n', Text)
312
+ ],
313
+ 'class': [
314
+ (r'(%s|%s|`[^`]+`)(\s*)(\[)' % (idrest, op),
315
+ bygroups(Name.Class, Text, Operator), ('#pop', 'typeparam')),
316
+ (r'\s+', Text),
317
+ include('comments'),
318
+ (r'\{', Operator, '#pop'),
319
+ (r'\(', Operator, '#pop'),
320
+ (r'%s|%s|`[^`]+`' % (idrest, op), Name.Class, '#pop'),
321
+ ],
322
+ 'type': [
323
+ (r'\s+', Text),
324
+ include('comments'),
325
+ (r'<[%:]|>:|[#_]|\bforSome\b|\btype\b', Keyword),
326
+ (r'([,);}]|=>|=|\u21d2)(\s*)', bygroups(Operator, Text), '#pop'),
327
+ (r'[({]', Operator, '#push'),
328
+ (r'((?:%s|%s|`[^`]+`)(?:\.(?:%s|%s|`[^`]+`))*)(\s*)(\[)' %
329
+ (idrest, op, idrest, op),
330
+ bygroups(Keyword.Type, Text, Operator), ('#pop', 'typeparam')),
331
+ (r'((?:%s|%s|`[^`]+`)(?:\.(?:%s|%s|`[^`]+`))*)(\s*)$' %
332
+ (idrest, op, idrest, op),
333
+ bygroups(Keyword.Type, Text), '#pop'),
334
+ (r'\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type)
335
+ ],
336
+ 'typeparam': [
337
+ (r'\s+', Text),
338
+ include('comments'),
339
+ (r',+', Punctuation),
340
+ (r'<[%:]|=>|>:|[#_\u21D2]|\bforSome\b|\btype\b', Keyword),
341
+ (r'([\])}])', Operator, '#pop'),
342
+ (r'[(\[{]', Operator, '#push'),
343
+ (r'\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type)
344
+ ],
345
+ 'comments': [
346
+ (r'//.*?\n', Comment.Single),
347
+ (r'/\*', Comment.Multiline, 'comment'),
348
+ ],
349
+ 'comment': [
350
+ (r'[^/*]+', Comment.Multiline),
351
+ (r'/\*', Comment.Multiline, '#push'),
352
+ (r'\*/', Comment.Multiline, '#pop'),
353
+ (r'[*/]', Comment.Multiline)
354
+ ],
355
+ 'import': [
356
+ (r'(%s|\.)+' % idrest, Name.Namespace, '#pop')
357
+ ],
358
+ 'interpstringcommon': [
359
+ (r'[^"$\\]+', String),
360
+ (r'\$\$', String),
361
+ (r'\$' + letter_letter_digit, String.Interpol),
362
+ (r'\$\{', String.Interpol, 'interpbrace'),
363
+ (r'\\.', String),
364
+ ],
365
+ 'interptriplestring': [
366
+ (r'"""(?!")', String, '#pop'),
367
+ (r'"', String),
368
+ include('interpstringcommon'),
369
+ ],
370
+ 'interpstring': [
371
+ (r'"', String, '#pop'),
372
+ include('interpstringcommon'),
373
+ ],
374
+ 'interpbrace': [
375
+ (r'\}', String.Interpol, '#pop'),
376
+ (r'\{', String.Interpol, '#push'),
377
+ include('root'),
378
+ ],
379
+ }
380
+
381
+
382
+ class GosuLexer(RegexLexer):
383
+ """
384
+ For Gosu source code.
385
+
386
+ .. versionadded:: 1.5
387
+ """
388
+
389
+ name = 'Gosu'
390
+ aliases = ['gosu']
391
+ filenames = ['*.gs', '*.gsx', '*.gsp', '*.vark']
392
+ mimetypes = ['text/x-gosu']
393
+
394
+ flags = re.MULTILINE | re.DOTALL
395
+
396
+ tokens = {
397
+ 'root': [
398
+ # method names
399
+ (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # modifiers etc.
400
+ r'([a-zA-Z_]\w*)' # method name
401
+ r'(\s*)(\()', # signature start
402
+ bygroups(using(this), Name.Function, Text, Operator)),
403
+ (r'[^\S\n]+', Text),
404
+ (r'//.*?\n', Comment.Single),
405
+ (r'/\*.*?\*/', Comment.Multiline),
406
+ (r'@[a-zA-Z_][\w.]*', Name.Decorator),
407
+ (r'(in|as|typeof|statictypeof|typeis|typeas|if|else|foreach|for|'
408
+ r'index|while|do|continue|break|return|try|catch|finally|this|'
409
+ r'throw|new|switch|case|default|eval|super|outer|classpath|'
410
+ r'using)\b', Keyword),
411
+ (r'(var|delegate|construct|function|private|internal|protected|'
412
+ r'public|abstract|override|final|static|extends|transient|'
413
+ r'implements|represents|readonly)\b', Keyword.Declaration),
414
+ (r'(property\s+)(get|set)?', Keyword.Declaration),
415
+ (r'(boolean|byte|char|double|float|int|long|short|void|block)\b',
416
+ Keyword.Type),
417
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
418
+ (r'(true|false|null|NaN|Infinity)\b', Keyword.Constant),
419
+ (r'(class|interface|enhancement|enum)(\s+)([a-zA-Z_]\w*)',
420
+ bygroups(Keyword.Declaration, Text, Name.Class)),
421
+ (r'(uses)(\s+)([\w.]+\*?)',
422
+ bygroups(Keyword.Namespace, Text, Name.Namespace)),
423
+ (r'"', String, 'string'),
424
+ (r'(\??[.#])([a-zA-Z_]\w*)',
425
+ bygroups(Operator, Name.Attribute)),
426
+ (r'(:)([a-zA-Z_]\w*)',
427
+ bygroups(Operator, Name.Attribute)),
428
+ (r'[a-zA-Z_$]\w*', Name),
429
+ (r'and|or|not|[\\~^*!%&\[\](){}<>|+=:;,./?-]', Operator),
430
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
431
+ (r'[0-9]+', Number.Integer),
432
+ (r'\n', Text)
433
+ ],
434
+ 'templateText': [
435
+ (r'(\\<)|(\\\$)', String),
436
+ (r'(<%@\s+)(extends|params)',
437
+ bygroups(Operator, Name.Decorator), 'stringTemplate'),
438
+ (r'<%!--.*?--%>', Comment.Multiline),
439
+ (r'(<%)|(<%=)', Operator, 'stringTemplate'),
440
+ (r'\$\{', Operator, 'stringTemplateShorthand'),
441
+ (r'.', String)
442
+ ],
443
+ 'string': [
444
+ (r'"', String, '#pop'),
445
+ include('templateText')
446
+ ],
447
+ 'stringTemplate': [
448
+ (r'"', String, 'string'),
449
+ (r'%>', Operator, '#pop'),
450
+ include('root')
451
+ ],
452
+ 'stringTemplateShorthand': [
453
+ (r'"', String, 'string'),
454
+ (r'\{', Operator, 'stringTemplateShorthand'),
455
+ (r'\}', Operator, '#pop'),
456
+ include('root')
457
+ ],
458
+ }
459
+
460
+
461
+ class GosuTemplateLexer(Lexer):
462
+ """
463
+ For Gosu templates.
464
+
465
+ .. versionadded:: 1.5
466
+ """
467
+
468
+ name = 'Gosu Template'
469
+ aliases = ['gst']
470
+ filenames = ['*.gst']
471
+ mimetypes = ['text/x-gosu-template']
472
+
473
+ def get_tokens_unprocessed(self, text):
474
+ lexer = GosuLexer()
475
+ stack = ['templateText']
476
+ yield from lexer.get_tokens_unprocessed(text, stack)
477
+
478
+
479
+ class GroovyLexer(RegexLexer):
480
+ """
481
+ For `Groovy <http://groovy.codehaus.org/>`_ source code.
482
+
483
+ .. versionadded:: 1.5
484
+ """
485
+
486
+ name = 'Groovy'
487
+ aliases = ['groovy']
488
+ filenames = ['*.groovy','*.gradle']
489
+ mimetypes = ['text/x-groovy']
490
+
491
+ flags = re.MULTILINE | re.DOTALL
492
+
493
+ tokens = {
494
+ 'root': [
495
+ # Groovy allows a file to start with a shebang
496
+ (r'#!(.*?)$', Comment.Preproc, 'base'),
497
+ default('base'),
498
+ ],
499
+ 'base': [
500
+ # method names
501
+ (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments
502
+ r'([a-zA-Z_]\w*)' # method name
503
+ r'(\s*)(\()', # signature start
504
+ bygroups(using(this), Name.Function, Text, Operator)),
505
+ (r'[^\S\n]+', Text),
506
+ (r'//.*?\n', Comment.Single),
507
+ (r'/\*.*?\*/', Comment.Multiline),
508
+ (r'@[a-zA-Z_][\w.]*', Name.Decorator),
509
+ (r'(assert|break|case|catch|continue|default|do|else|finally|for|'
510
+ r'if|goto|instanceof|new|return|switch|this|throw|try|while|in|as)\b',
511
+ Keyword),
512
+ (r'(abstract|const|enum|extends|final|implements|native|private|'
513
+ r'protected|public|static|strictfp|super|synchronized|throws|'
514
+ r'transient|volatile)\b', Keyword.Declaration),
515
+ (r'(def|boolean|byte|char|double|float|int|long|short|void)\b',
516
+ Keyword.Type),
517
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
518
+ (r'(true|false|null)\b', Keyword.Constant),
519
+ (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text),
520
+ 'class'),
521
+ (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
522
+ (r'""".*?"""', String.Double),
523
+ (r"'''.*?'''", String.Single),
524
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
525
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
526
+ (r'\$/((?!/\$).)*/\$', String),
527
+ (r'/(\\\\|\\[^\\]|[^/\\])*/', String),
528
+ (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
529
+ (r'(\.)([a-zA-Z_]\w*)', bygroups(Operator, Name.Attribute)),
530
+ (r'[a-zA-Z_]\w*:', Name.Label),
531
+ (r'[a-zA-Z_$]\w*', Name),
532
+ (r'[~^*!%&\[\](){}<>|+=:;,./?-]', Operator),
533
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
534
+ (r'0x[0-9a-fA-F]+', Number.Hex),
535
+ (r'[0-9]+L?', Number.Integer),
536
+ (r'\n', Text)
537
+ ],
538
+ 'class': [
539
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
540
+ ],
541
+ 'import': [
542
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
543
+ ],
544
+ }
545
+
546
+ def analyse_text(text):
547
+ return shebang_matches(text, r'groovy')
548
+
549
+
550
+ class IokeLexer(RegexLexer):
551
+ """
552
+ For `Ioke <http://ioke.org/>`_ (a strongly typed, dynamic,
553
+ prototype based programming language) source.
554
+
555
+ .. versionadded:: 1.4
556
+ """
557
+ name = 'Ioke'
558
+ filenames = ['*.ik']
559
+ aliases = ['ioke', 'ik']
560
+ mimetypes = ['text/x-iokesrc']
561
+ tokens = {
562
+ 'interpolatableText': [
563
+ (r'(\\b|\\e|\\t|\\n|\\f|\\r|\\"|\\\\|\\#|\\\Z|\\u[0-9a-fA-F]{1,4}'
564
+ r'|\\[0-3]?[0-7]?[0-7])', String.Escape),
565
+ (r'#\{', Punctuation, 'textInterpolationRoot')
566
+ ],
567
+
568
+ 'text': [
569
+ (r'(?<!\\)"', String, '#pop'),
570
+ include('interpolatableText'),
571
+ (r'[^"]', String)
572
+ ],
573
+
574
+ 'documentation': [
575
+ (r'(?<!\\)"', String.Doc, '#pop'),
576
+ include('interpolatableText'),
577
+ (r'[^"]', String.Doc)
578
+ ],
579
+
580
+ 'textInterpolationRoot': [
581
+ (r'\}', Punctuation, '#pop'),
582
+ include('root')
583
+ ],
584
+
585
+ 'slashRegexp': [
586
+ (r'(?<!\\)/[im-psux]*', String.Regex, '#pop'),
587
+ include('interpolatableText'),
588
+ (r'\\/', String.Regex),
589
+ (r'[^/]', String.Regex)
590
+ ],
591
+
592
+ 'squareRegexp': [
593
+ (r'(?<!\\)][im-psux]*', String.Regex, '#pop'),
594
+ include('interpolatableText'),
595
+ (r'\\]', String.Regex),
596
+ (r'[^\]]', String.Regex)
597
+ ],
598
+
599
+ 'squareText': [
600
+ (r'(?<!\\)]', String, '#pop'),
601
+ include('interpolatableText'),
602
+ (r'[^\]]', String)
603
+ ],
604
+
605
+ 'root': [
606
+ (r'\n', Text),
607
+ (r'\s+', Text),
608
+
609
+ # Comments
610
+ (r';(.*?)\n', Comment),
611
+ (r'\A#!(.*?)\n', Comment),
612
+
613
+ # Regexps
614
+ (r'#/', String.Regex, 'slashRegexp'),
615
+ (r'#r\[', String.Regex, 'squareRegexp'),
616
+
617
+ # Symbols
618
+ (r':[\w!:?]+', String.Symbol),
619
+ (r'[\w!:?]+:(?![\w!?])', String.Other),
620
+ (r':"(\\\\|\\[^\\]|[^"\\])*"', String.Symbol),
621
+
622
+ # Documentation
623
+ (r'((?<=fn\()|(?<=fnx\()|(?<=method\()|(?<=macro\()|(?<=lecro\()'
624
+ r'|(?<=syntax\()|(?<=dmacro\()|(?<=dlecro\()|(?<=dlecrox\()'
625
+ r'|(?<=dsyntax\())\s*"', String.Doc, 'documentation'),
626
+
627
+ # Text
628
+ (r'"', String, 'text'),
629
+ (r'#\[', String, 'squareText'),
630
+
631
+ # Mimic
632
+ (r'\w[\w!:?]+(?=\s*=.*mimic\s)', Name.Entity),
633
+
634
+ # Assignment
635
+ (r'[a-zA-Z_][\w!:?]*(?=[\s]*[+*/-]?=[^=].*($|\.))',
636
+ Name.Variable),
637
+
638
+ # keywords
639
+ (r'(break|cond|continue|do|ensure|for|for:dict|for:set|if|let|'
640
+ r'loop|p:for|p:for:dict|p:for:set|return|unless|until|while|'
641
+ r'with)(?![\w!:?])', Keyword.Reserved),
642
+
643
+ # Origin
644
+ (r'(eval|mimic|print|println)(?![\w!:?])', Keyword),
645
+
646
+ # Base
647
+ (r'(cell\?|cellNames|cellOwner\?|cellOwner|cells|cell|'
648
+ r'documentation|hash|identity|mimic|removeCell\!|undefineCell\!)'
649
+ r'(?![\w!:?])', Keyword),
650
+
651
+ # Ground
652
+ (r'(stackTraceAsText)(?![\w!:?])', Keyword),
653
+
654
+ # DefaultBehaviour Literals
655
+ (r'(dict|list|message|set)(?![\w!:?])', Keyword.Reserved),
656
+
657
+ # DefaultBehaviour Case
658
+ (r'(case|case:and|case:else|case:nand|case:nor|case:not|case:or|'
659
+ r'case:otherwise|case:xor)(?![\w!:?])', Keyword.Reserved),
660
+
661
+ # DefaultBehaviour Reflection
662
+ (r'(asText|become\!|derive|freeze\!|frozen\?|in\?|is\?|kind\?|'
663
+ r'mimic\!|mimics|mimics\?|prependMimic\!|removeAllMimics\!|'
664
+ r'removeMimic\!|same\?|send|thaw\!|uniqueHexId)'
665
+ r'(?![\w!:?])', Keyword),
666
+
667
+ # DefaultBehaviour Aspects
668
+ (r'(after|around|before)(?![\w!:?])', Keyword.Reserved),
669
+
670
+ # DefaultBehaviour
671
+ (r'(kind|cellDescriptionDict|cellSummary|genSym|inspect|notice)'
672
+ r'(?![\w!:?])', Keyword),
673
+ (r'(use|destructuring)', Keyword.Reserved),
674
+
675
+ # DefaultBehavior BaseBehavior
676
+ (r'(cell\?|cellOwner\?|cellOwner|cellNames|cells|cell|'
677
+ r'documentation|identity|removeCell!|undefineCell)'
678
+ r'(?![\w!:?])', Keyword),
679
+
680
+ # DefaultBehavior Internal
681
+ (r'(internal:compositeRegexp|internal:concatenateText|'
682
+ r'internal:createDecimal|internal:createNumber|'
683
+ r'internal:createRegexp|internal:createText)'
684
+ r'(?![\w!:?])', Keyword.Reserved),
685
+
686
+ # DefaultBehaviour Conditions
687
+ (r'(availableRestarts|bind|error\!|findRestart|handle|'
688
+ r'invokeRestart|rescue|restart|signal\!|warn\!)'
689
+ r'(?![\w!:?])', Keyword.Reserved),
690
+
691
+ # constants
692
+ (r'(nil|false|true)(?![\w!:?])', Name.Constant),
693
+
694
+ # names
695
+ (r'(Arity|Base|Call|Condition|DateTime|Aspects|Pointcut|'
696
+ r'Assignment|BaseBehavior|Boolean|Case|AndCombiner|Else|'
697
+ r'NAndCombiner|NOrCombiner|NotCombiner|OrCombiner|XOrCombiner|'
698
+ r'Conditions|Definitions|FlowControl|Internal|Literals|'
699
+ r'Reflection|DefaultMacro|DefaultMethod|DefaultSyntax|Dict|'
700
+ r'FileSystem|Ground|Handler|Hook|IO|IokeGround|Struct|'
701
+ r'LexicalBlock|LexicalMacro|List|Message|Method|Mixins|'
702
+ r'NativeMethod|Number|Origin|Pair|Range|Reflector|Regexp Match|'
703
+ r'Regexp|Rescue|Restart|Runtime|Sequence|Set|Symbol|'
704
+ r'System|Text|Tuple)(?![\w!:?])', Name.Builtin),
705
+
706
+ # functions
707
+ ('(generateMatchMethod|aliasMethod|\u03bb|\u028E|fnx|fn|method|'
708
+ 'dmacro|dlecro|syntax|macro|dlecrox|lecrox|lecro|syntax)'
709
+ '(?![\\w!:?])', Name.Function),
710
+
711
+ # Numbers
712
+ (r'-?0[xX][0-9a-fA-F]+', Number.Hex),
713
+ (r'-?(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
714
+ (r'-?\d+', Number.Integer),
715
+
716
+ (r'#\(', Punctuation),
717
+
718
+ # Operators
719
+ (r'(&&>>|\|\|>>|\*\*>>|:::|::|\.\.\.|===|\*\*>|\*\*=|&&>|&&=|'
720
+ r'\|\|>|\|\|=|\->>|\+>>|!>>|<>>>|<>>|&>>|%>>|#>>|@>>|/>>|\*>>|'
721
+ r'\?>>|\|>>|\^>>|~>>|\$>>|=>>|<<=|>>=|<=>|<\->|=~|!~|=>|\+\+|'
722
+ r'\-\-|<=|>=|==|!=|&&|\.\.|\+=|\-=|\*=|\/=|%=|&=|\^=|\|=|<\-|'
723
+ r'\+>|!>|<>|&>|%>|#>|\@>|\/>|\*>|\?>|\|>|\^>|~>|\$>|<\->|\->|'
724
+ r'<<|>>|\*\*|\?\||\?&|\|\||>|<|\*|\/|%|\+|\-|&|\^|\||=|\$|!|~|'
725
+ r'\?|#|\u2260|\u2218|\u2208|\u2209)', Operator),
726
+ (r'(and|nand|or|xor|nor|return|import)(?![\w!?])',
727
+ Operator),
728
+
729
+ # Punctuation
730
+ (r'(\`\`|\`|\'\'|\'|\.|\,|@@|@|\[|\]|\(|\)|\{|\})', Punctuation),
731
+
732
+ # kinds
733
+ (r'[A-Z][\w!:?]*', Name.Class),
734
+
735
+ # default cellnames
736
+ (r'[a-z_][\w!:?]*', Name)
737
+ ]
738
+ }
739
+
740
+
741
+ class ClojureLexer(RegexLexer):
742
+ """
743
+ Lexer for `Clojure <http://clojure.org/>`_ source code.
744
+
745
+ .. versionadded:: 0.11
746
+ """
747
+ name = 'Clojure'
748
+ aliases = ['clojure', 'clj']
749
+ filenames = ['*.clj']
750
+ mimetypes = ['text/x-clojure', 'application/x-clojure']
751
+
752
+ special_forms = (
753
+ '.', 'def', 'do', 'fn', 'if', 'let', 'new', 'quote', 'var', 'loop'
754
+ )
755
+
756
+ # It's safe to consider 'ns' a declaration thing because it defines a new
757
+ # namespace.
758
+ declarations = (
759
+ 'def-', 'defn', 'defn-', 'defmacro', 'defmulti', 'defmethod',
760
+ 'defstruct', 'defonce', 'declare', 'definline', 'definterface',
761
+ 'defprotocol', 'defrecord', 'deftype', 'defproject', 'ns'
762
+ )
763
+
764
+ builtins = (
765
+ '*', '+', '-', '->', '/', '<', '<=', '=', '==', '>', '>=', '..',
766
+ 'accessor', 'agent', 'agent-errors', 'aget', 'alength', 'all-ns',
767
+ 'alter', 'and', 'append-child', 'apply', 'array-map', 'aset',
768
+ 'aset-boolean', 'aset-byte', 'aset-char', 'aset-double', 'aset-float',
769
+ 'aset-int', 'aset-long', 'aset-short', 'assert', 'assoc', 'await',
770
+ 'await-for', 'bean', 'binding', 'bit-and', 'bit-not', 'bit-or',
771
+ 'bit-shift-left', 'bit-shift-right', 'bit-xor', 'boolean', 'branch?',
772
+ 'butlast', 'byte', 'cast', 'char', 'children', 'class',
773
+ 'clear-agent-errors', 'comment', 'commute', 'comp', 'comparator',
774
+ 'complement', 'concat', 'conj', 'cons', 'constantly', 'cond', 'if-not',
775
+ 'construct-proxy', 'contains?', 'count', 'create-ns', 'create-struct',
776
+ 'cycle', 'dec', 'deref', 'difference', 'disj', 'dissoc', 'distinct',
777
+ 'doall', 'doc', 'dorun', 'doseq', 'dosync', 'dotimes', 'doto',
778
+ 'double', 'down', 'drop', 'drop-while', 'edit', 'end?', 'ensure',
779
+ 'eval', 'every?', 'false?', 'ffirst', 'file-seq', 'filter', 'find',
780
+ 'find-doc', 'find-ns', 'find-var', 'first', 'float', 'flush', 'for',
781
+ 'fnseq', 'frest', 'gensym', 'get-proxy-class', 'get',
782
+ 'hash-map', 'hash-set', 'identical?', 'identity', 'if-let', 'import',
783
+ 'in-ns', 'inc', 'index', 'insert-child', 'insert-left', 'insert-right',
784
+ 'inspect-table', 'inspect-tree', 'instance?', 'int', 'interleave',
785
+ 'intersection', 'into', 'into-array', 'iterate', 'join', 'key', 'keys',
786
+ 'keyword', 'keyword?', 'last', 'lazy-cat', 'lazy-cons', 'left',
787
+ 'lefts', 'line-seq', 'list*', 'list', 'load', 'load-file',
788
+ 'locking', 'long', 'loop', 'macroexpand', 'macroexpand-1',
789
+ 'make-array', 'make-node', 'map', 'map-invert', 'map?', 'mapcat',
790
+ 'max', 'max-key', 'memfn', 'merge', 'merge-with', 'meta', 'min',
791
+ 'min-key', 'name', 'namespace', 'neg?', 'new', 'newline', 'next',
792
+ 'nil?', 'node', 'not', 'not-any?', 'not-every?', 'not=', 'ns-imports',
793
+ 'ns-interns', 'ns-map', 'ns-name', 'ns-publics', 'ns-refers',
794
+ 'ns-resolve', 'ns-unmap', 'nth', 'nthrest', 'or', 'parse', 'partial',
795
+ 'path', 'peek', 'pop', 'pos?', 'pr', 'pr-str', 'print', 'print-str',
796
+ 'println', 'println-str', 'prn', 'prn-str', 'project', 'proxy',
797
+ 'proxy-mappings', 'quot', 'rand', 'rand-int', 'range', 're-find',
798
+ 're-groups', 're-matcher', 're-matches', 're-pattern', 're-seq',
799
+ 'read', 'read-line', 'reduce', 'ref', 'ref-set', 'refer', 'rem',
800
+ 'remove', 'remove-method', 'remove-ns', 'rename', 'rename-keys',
801
+ 'repeat', 'replace', 'replicate', 'resolve', 'rest', 'resultset-seq',
802
+ 'reverse', 'rfirst', 'right', 'rights', 'root', 'rrest', 'rseq',
803
+ 'second', 'select', 'select-keys', 'send', 'send-off', 'seq',
804
+ 'seq-zip', 'seq?', 'set', 'short', 'slurp', 'some', 'sort',
805
+ 'sort-by', 'sorted-map', 'sorted-map-by', 'sorted-set',
806
+ 'special-symbol?', 'split-at', 'split-with', 'str', 'string?',
807
+ 'struct', 'struct-map', 'subs', 'subvec', 'symbol', 'symbol?',
808
+ 'sync', 'take', 'take-nth', 'take-while', 'test', 'time', 'to-array',
809
+ 'to-array-2d', 'tree-seq', 'true?', 'union', 'up', 'update-proxy',
810
+ 'val', 'vals', 'var-get', 'var-set', 'var?', 'vector', 'vector-zip',
811
+ 'vector?', 'when', 'when-first', 'when-let', 'when-not',
812
+ 'with-local-vars', 'with-meta', 'with-open', 'with-out-str',
813
+ 'xml-seq', 'xml-zip', 'zero?', 'zipmap', 'zipper')
814
+
815
+ # valid names for identifiers
816
+ # well, names can only not consist fully of numbers
817
+ # but this should be good enough for now
818
+
819
+ # TODO / should divide keywords/symbols into namespace/rest
820
+ # but that's hard, so just pretend / is part of the name
821
+ valid_name = r'(?!#)[\w!$%*+<=>?/.#|-]+'
822
+
823
+ tokens = {
824
+ 'root': [
825
+ # the comments - always starting with semicolon
826
+ # and going to the end of the line
827
+ (r';.*$', Comment.Single),
828
+
829
+ # whitespaces - usually not relevant
830
+ (r'[,\s]+', Text),
831
+
832
+ # numbers
833
+ (r'-?\d+\.\d+', Number.Float),
834
+ (r'-?\d+', Number.Integer),
835
+ (r'0x-?[abcdef\d]+', Number.Hex),
836
+
837
+ # strings, symbols and characters
838
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
839
+ (r"'" + valid_name, String.Symbol),
840
+ (r"\\(.|[a-z]+)", String.Char),
841
+
842
+ # keywords
843
+ (r'::?#?' + valid_name, String.Symbol),
844
+
845
+ # special operators
846
+ (r'~@|[`\'#^~&@]', Operator),
847
+
848
+ # highlight the special forms
849
+ (words(special_forms, suffix=' '), Keyword),
850
+
851
+ # Technically, only the special forms are 'keywords'. The problem
852
+ # is that only treating them as keywords means that things like
853
+ # 'defn' and 'ns' need to be highlighted as builtins. This is ugly
854
+ # and weird for most styles. So, as a compromise we're going to
855
+ # highlight them as Keyword.Declarations.
856
+ (words(declarations, suffix=' '), Keyword.Declaration),
857
+
858
+ # highlight the builtins
859
+ (words(builtins, suffix=' '), Name.Builtin),
860
+
861
+ # the remaining functions
862
+ (r'(?<=\()' + valid_name, Name.Function),
863
+
864
+ # find the remaining variables
865
+ (valid_name, Name.Variable),
866
+
867
+ # Clojure accepts vector notation
868
+ (r'(\[|\])', Punctuation),
869
+
870
+ # Clojure accepts map notation
871
+ (r'(\{|\})', Punctuation),
872
+
873
+ # the famous parentheses!
874
+ (r'(\(|\))', Punctuation),
875
+ ],
876
+ }
877
+
878
+
879
+ class ClojureScriptLexer(ClojureLexer):
880
+ """
881
+ Lexer for `ClojureScript <http://clojure.org/clojurescript>`_
882
+ source code.
883
+
884
+ .. versionadded:: 2.0
885
+ """
886
+ name = 'ClojureScript'
887
+ aliases = ['clojurescript', 'cljs']
888
+ filenames = ['*.cljs']
889
+ mimetypes = ['text/x-clojurescript', 'application/x-clojurescript']
890
+
891
+
892
+ class TeaLangLexer(RegexLexer):
893
+ """
894
+ For `Tea <http://teatrove.org/>`_ source code. Only used within a
895
+ TeaTemplateLexer.
896
+
897
+ .. versionadded:: 1.5
898
+ """
899
+
900
+ flags = re.MULTILINE | re.DOTALL
901
+
902
+ tokens = {
903
+ 'root': [
904
+ # method names
905
+ (r'^(\s*(?:[a-zA-Z_][\w\.\[\]]*\s+)+?)' # return arguments
906
+ r'([a-zA-Z_]\w*)' # method name
907
+ r'(\s*)(\()', # signature start
908
+ bygroups(using(this), Name.Function, Text, Operator)),
909
+ (r'[^\S\n]+', Text),
910
+ (r'//.*?\n', Comment.Single),
911
+ (r'/\*.*?\*/', Comment.Multiline),
912
+ (r'@[a-zA-Z_][\w\.]*', Name.Decorator),
913
+ (r'(and|break|else|foreach|if|in|not|or|reverse)\b',
914
+ Keyword),
915
+ (r'(as|call|define)\b', Keyword.Declaration),
916
+ (r'(true|false|null)\b', Keyword.Constant),
917
+ (r'(template)(\s+)', bygroups(Keyword.Declaration, Text), 'template'),
918
+ (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
919
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
920
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
921
+ (r'(\.)([a-zA-Z_]\w*)', bygroups(Operator, Name.Attribute)),
922
+ (r'[a-zA-Z_]\w*:', Name.Label),
923
+ (r'[a-zA-Z_\$]\w*', Name),
924
+ (r'(isa|[.]{3}|[.]{2}|[=#!<>+-/%&;,.\*\\\(\)\[\]\{\}])', Operator),
925
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
926
+ (r'0x[0-9a-fA-F]+', Number.Hex),
927
+ (r'[0-9]+L?', Number.Integer),
928
+ (r'\n', Text)
929
+ ],
930
+ 'template': [
931
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
932
+ ],
933
+ 'import': [
934
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
935
+ ],
936
+ }
937
+
938
+
939
+ class CeylonLexer(RegexLexer):
940
+ """
941
+ For `Ceylon <http://ceylon-lang.org/>`_ source code.
942
+
943
+ .. versionadded:: 1.6
944
+ """
945
+
946
+ name = 'Ceylon'
947
+ aliases = ['ceylon']
948
+ filenames = ['*.ceylon']
949
+ mimetypes = ['text/x-ceylon']
950
+
951
+ flags = re.MULTILINE | re.DOTALL
952
+
953
+ #: optional Comment or Whitespace
954
+ _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
955
+
956
+ tokens = {
957
+ 'root': [
958
+ # method names
959
+ (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments
960
+ r'([a-zA-Z_]\w*)' # method name
961
+ r'(\s*)(\()', # signature start
962
+ bygroups(using(this), Name.Function, Text, Operator)),
963
+ (r'[^\S\n]+', Text),
964
+ (r'//.*?\n', Comment.Single),
965
+ (r'/\*', Comment.Multiline, 'comment'),
966
+ (r'(shared|abstract|formal|default|actual|variable|deprecated|small|'
967
+ r'late|literal|doc|by|see|throws|optional|license|tagged|final|native|'
968
+ r'annotation|sealed)\b', Name.Decorator),
969
+ (r'(break|case|catch|continue|else|finally|for|in|'
970
+ r'if|return|switch|this|throw|try|while|is|exists|dynamic|'
971
+ r'nonempty|then|outer|assert|let)\b', Keyword),
972
+ (r'(abstracts|extends|satisfies|'
973
+ r'super|given|of|out|assign)\b', Keyword.Declaration),
974
+ (r'(function|value|void|new)\b',
975
+ Keyword.Type),
976
+ (r'(assembly|module|package)(\s+)', bygroups(Keyword.Namespace, Text)),
977
+ (r'(true|false|null)\b', Keyword.Constant),
978
+ (r'(class|interface|object|alias)(\s+)',
979
+ bygroups(Keyword.Declaration, Text), 'class'),
980
+ (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
981
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
982
+ (r"'\\.'|'[^\\]'|'\\\{#[0-9a-fA-F]{4}\}'", String.Char),
983
+ (r'(\.)([a-z_]\w*)',
984
+ bygroups(Operator, Name.Attribute)),
985
+ (r'[a-zA-Z_]\w*:', Name.Label),
986
+ (r'[a-zA-Z_]\w*', Name),
987
+ (r'[~^*!%&\[\](){}<>|+=:;,./?-]', Operator),
988
+ (r'\d{1,3}(_\d{3})+\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float),
989
+ (r'\d{1,3}(_\d{3})+\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?',
990
+ Number.Float),
991
+ (r'[0-9][0-9]*\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float),
992
+ (r'[0-9][0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?',
993
+ Number.Float),
994
+ (r'#([0-9a-fA-F]{4})(_[0-9a-fA-F]{4})+', Number.Hex),
995
+ (r'#[0-9a-fA-F]+', Number.Hex),
996
+ (r'\$([01]{4})(_[01]{4})+', Number.Bin),
997
+ (r'\$[01]+', Number.Bin),
998
+ (r'\d{1,3}(_\d{3})+[kMGTP]?', Number.Integer),
999
+ (r'[0-9]+[kMGTP]?', Number.Integer),
1000
+ (r'\n', Text)
1001
+ ],
1002
+ 'class': [
1003
+ (r'[A-Za-z_]\w*', Name.Class, '#pop')
1004
+ ],
1005
+ 'import': [
1006
+ (r'[a-z][\w.]*',
1007
+ Name.Namespace, '#pop')
1008
+ ],
1009
+ 'comment': [
1010
+ (r'[^*/]', Comment.Multiline),
1011
+ (r'/\*', Comment.Multiline, '#push'),
1012
+ (r'\*/', Comment.Multiline, '#pop'),
1013
+ (r'[*/]', Comment.Multiline)
1014
+ ],
1015
+ }
1016
+
1017
+
1018
+ class KotlinLexer(RegexLexer):
1019
+ """
1020
+ For `Kotlin <http://kotlinlang.org/>`_
1021
+ source code.
1022
+
1023
+ .. versionadded:: 1.5
1024
+ """
1025
+
1026
+ name = 'Kotlin'
1027
+ aliases = ['kotlin']
1028
+ filenames = ['*.kt', '*.kts']
1029
+ mimetypes = ['text/x-kotlin']
1030
+
1031
+ flags = re.MULTILINE | re.DOTALL | re.UNICODE
1032
+
1033
+ kt_name = ('@?[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' +
1034
+ '[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc', 'Cf',
1035
+ 'Mn', 'Mc') + ']*')
1036
+
1037
+ kt_space_name = ('@?[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' +
1038
+ '[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc', 'Cf',
1039
+ 'Mn', 'Mc', 'Zs')
1040
+ + r'\'~!%^&*()+=|\[\]:;,.<>/\?-]*')
1041
+
1042
+ kt_id = '(' + kt_name + '|`' + kt_space_name + '`)'
1043
+
1044
+ modifiers = (r'actual|abstract|annotation|companion|const|crossinline|'
1045
+ r'data|enum|expect|external|final|infix|inline|inner|'
1046
+ r'internal|lateinit|noinline|open|operator|override|private|'
1047
+ r'protected|public|sealed|suspend|tailrec')
1048
+
1049
+ tokens = {
1050
+ 'root': [
1051
+ # Whitespaces
1052
+ (r'[^\S\n]+', Text),
1053
+ (r'\s+', Text),
1054
+ (r'\\\n', Text), # line continuation
1055
+ (r'\n', Text),
1056
+ # Comments
1057
+ (r'//.*?\n', Comment.Single),
1058
+ (r'^#!/.+?\n', Comment.Single), # shebang for kotlin scripts
1059
+ (r'/[*].*?[*]/', Comment.Multiline),
1060
+ # Keywords
1061
+ (r'as\?', Keyword),
1062
+ (r'(as|break|by|catch|constructor|continue|do|dynamic|else|finally|'
1063
+ r'get|for|if|init|[!]*in|[!]*is|out|reified|return|set|super|this|'
1064
+ r'throw|try|typealias|typeof|vararg|when|where|while)\b', Keyword),
1065
+ (r'it\b', Name.Builtin),
1066
+ # Built-in types
1067
+ (words(('Boolean?', 'Byte?', 'Char?', 'Double?', 'Float?',
1068
+ 'Int?', 'Long?', 'Short?', 'String?', 'Any?', 'Unit?')), Keyword.Type),
1069
+ (words(('Boolean', 'Byte', 'Char', 'Double', 'Float',
1070
+ 'Int', 'Long', 'Short', 'String', 'Any', 'Unit'), suffix=r'\b'), Keyword.Type),
1071
+ # Constants
1072
+ (r'(true|false|null)\b', Keyword.Constant),
1073
+ # Imports
1074
+ (r'(package|import)(\s+)(\S+)', bygroups(Keyword, Text, Name.Namespace)),
1075
+ # Dot access
1076
+ (r'(\?\.)((?:[^\W\d]|\$)[\w$]*)', bygroups(Operator, Name.Attribute)),
1077
+ (r'(\.)((?:[^\W\d]|\$)[\w$]*)', bygroups(Punctuation, Name.Attribute)),
1078
+ # Annotations
1079
+ (r'@[^\W\d][\w.]*', Name.Decorator),
1080
+ # Labels
1081
+ (r'[^\W\d][\w.]+@', Name.Decorator),
1082
+ # Object expression
1083
+ (r'(object)(\s+)(:)(\s+)', bygroups(Keyword, Text, Punctuation, Text), 'class'),
1084
+ # Types
1085
+ (r'((?:(?:' + modifiers + r'|fun)\s+)*)(class|interface|object)(\s+)',
1086
+ bygroups(using(this, state='modifiers'), Keyword.Declaration, Text), 'class'),
1087
+ # Variables
1088
+ (r'(var|val)(\s+)(\()', bygroups(Keyword.Declaration, Text, Punctuation),
1089
+ 'destructuring_assignment'),
1090
+ (r'((?:(?:' + modifiers + r')\s+)*)(var|val)(\s+)',
1091
+ bygroups(using(this, state='modifiers'), Keyword.Declaration, Text), 'variable'),
1092
+ # Functions
1093
+ (r'((?:(?:' + modifiers + r')\s+)*)(fun)(\s+)',
1094
+ bygroups(using(this, state='modifiers'), Keyword.Declaration, Text), 'function'),
1095
+ # Operators
1096
+ (r'::|!!|\?[:.]', Operator),
1097
+ (r'[~^*!%&\[\]<>|+=/?-]', Operator),
1098
+ # Punctuation
1099
+ (r'[{}();:.,]', Punctuation),
1100
+ # Strings
1101
+ (r'"""', String, 'multiline_string'),
1102
+ (r'"', String, 'string'),
1103
+ (r"'\\.'|'[^\\]'", String.Char),
1104
+ # Numbers
1105
+ (r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?[flFL]?|"
1106
+ r"0[xX][0-9a-fA-F]+[Ll]?", Number),
1107
+ # Identifiers
1108
+ (r'' + kt_id + r'((\?[^.])?)', Name) # additionally handle nullable types
1109
+ ],
1110
+ 'class': [
1111
+ (kt_id, Name.Class, '#pop')
1112
+ ],
1113
+ 'variable': [
1114
+ (kt_id, Name.Variable, '#pop')
1115
+ ],
1116
+ 'destructuring_assignment': [
1117
+ (r',', Punctuation),
1118
+ (r'\s+', Text),
1119
+ (kt_id, Name.Variable),
1120
+ (r'(:)(\s+)(' + kt_id + ')', bygroups(Punctuation, Text, Name)),
1121
+ (r'<', Operator, 'generic'),
1122
+ (r'\)', Punctuation, '#pop')
1123
+ ],
1124
+ 'function': [
1125
+ (r'<', Operator, 'generic'),
1126
+ (r'' + kt_id + r'(\.)' + kt_id, bygroups(Name, Punctuation, Name.Function), '#pop'),
1127
+ (kt_id, Name.Function, '#pop')
1128
+ ],
1129
+ 'generic': [
1130
+ (r'(>)(\s*)', bygroups(Operator, Text), '#pop'),
1131
+ (r':', Punctuation),
1132
+ (r'(reified|out|in)\b', Keyword),
1133
+ (r',', Punctuation),
1134
+ (r'\s+', Text),
1135
+ (kt_id, Name)
1136
+ ],
1137
+ 'modifiers': [
1138
+ (r'\w+', Keyword.Declaration),
1139
+ (r'\s+', Text),
1140
+ default('#pop')
1141
+ ],
1142
+ 'string': [
1143
+ (r'"', String, '#pop'),
1144
+ include('string_common')
1145
+ ],
1146
+ 'multiline_string': [
1147
+ (r'"""', String, '#pop'),
1148
+ (r'"', String),
1149
+ include('string_common')
1150
+ ],
1151
+ 'string_common': [
1152
+ (r'\\\\', String), # escaped backslash
1153
+ (r'\\"', String), # escaped quote
1154
+ (r'\\', String), # bare backslash
1155
+ (r'\$\{', String.Interpol, 'interpolation'),
1156
+ (r'(\$)(\w+)', bygroups(String.Interpol, Name)),
1157
+ (r'[^\\"$]+', String)
1158
+ ],
1159
+ 'interpolation': [
1160
+ (r'"', String),
1161
+ (r'\$\{', String.Interpol, 'interpolation'),
1162
+ (r'\{', Punctuation, 'scope'),
1163
+ (r'\}', String.Interpol, '#pop'),
1164
+ include('root')
1165
+ ],
1166
+ 'scope': [
1167
+ (r'\{', Punctuation, 'scope'),
1168
+ (r'\}', Punctuation, '#pop'),
1169
+ include('root')
1170
+ ]
1171
+ }
1172
+
1173
+
1174
+ class XtendLexer(RegexLexer):
1175
+ """
1176
+ For `Xtend <http://xtend-lang.org/>`_ source code.
1177
+
1178
+ .. versionadded:: 1.6
1179
+ """
1180
+
1181
+ name = 'Xtend'
1182
+ aliases = ['xtend']
1183
+ filenames = ['*.xtend']
1184
+ mimetypes = ['text/x-xtend']
1185
+
1186
+ flags = re.MULTILINE | re.DOTALL
1187
+
1188
+ tokens = {
1189
+ 'root': [
1190
+ # method names
1191
+ (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments
1192
+ r'([a-zA-Z_$][\w$]*)' # method name
1193
+ r'(\s*)(\()', # signature start
1194
+ bygroups(using(this), Name.Function, Text, Operator)),
1195
+ (r'[^\S\n]+', Text),
1196
+ (r'//.*?\n', Comment.Single),
1197
+ (r'/\*.*?\*/', Comment.Multiline),
1198
+ (r'@[a-zA-Z_][\w.]*', Name.Decorator),
1199
+ (r'(assert|break|case|catch|continue|default|do|else|finally|for|'
1200
+ r'if|goto|instanceof|new|return|switch|this|throw|try|while|IF|'
1201
+ r'ELSE|ELSEIF|ENDIF|FOR|ENDFOR|SEPARATOR|BEFORE|AFTER)\b',
1202
+ Keyword),
1203
+ (r'(def|abstract|const|enum|extends|final|implements|native|private|'
1204
+ r'protected|public|static|strictfp|super|synchronized|throws|'
1205
+ r'transient|volatile)\b', Keyword.Declaration),
1206
+ (r'(boolean|byte|char|double|float|int|long|short|void)\b',
1207
+ Keyword.Type),
1208
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
1209
+ (r'(true|false|null)\b', Keyword.Constant),
1210
+ (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text),
1211
+ 'class'),
1212
+ (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
1213
+ (r"(''')", String, 'template'),
1214
+ (r'(\u00BB)', String, 'template'),
1215
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
1216
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
1217
+ (r'[a-zA-Z_]\w*:', Name.Label),
1218
+ (r'[a-zA-Z_$]\w*', Name),
1219
+ (r'[~^*!%&\[\](){}<>\|+=:;,./?-]', Operator),
1220
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
1221
+ (r'0x[0-9a-fA-F]+', Number.Hex),
1222
+ (r'[0-9]+L?', Number.Integer),
1223
+ (r'\n', Text)
1224
+ ],
1225
+ 'class': [
1226
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
1227
+ ],
1228
+ 'import': [
1229
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
1230
+ ],
1231
+ 'template': [
1232
+ (r"'''", String, '#pop'),
1233
+ (r'\u00AB', String, '#pop'),
1234
+ (r'.', String)
1235
+ ],
1236
+ }
1237
+
1238
+
1239
+ class PigLexer(RegexLexer):
1240
+ """
1241
+ For `Pig Latin <https://pig.apache.org/>`_ source code.
1242
+
1243
+ .. versionadded:: 2.0
1244
+ """
1245
+
1246
+ name = 'Pig'
1247
+ aliases = ['pig']
1248
+ filenames = ['*.pig']
1249
+ mimetypes = ['text/x-pig']
1250
+
1251
+ flags = re.MULTILINE | re.IGNORECASE
1252
+
1253
+ tokens = {
1254
+ 'root': [
1255
+ (r'\s+', Text),
1256
+ (r'--.*', Comment),
1257
+ (r'/\*[\w\W]*?\*/', Comment.Multiline),
1258
+ (r'\\\n', Text),
1259
+ (r'\\', Text),
1260
+ (r'\'(?:\\[ntbrf\\\']|\\u[0-9a-f]{4}|[^\'\\\n\r])*\'', String),
1261
+ include('keywords'),
1262
+ include('types'),
1263
+ include('builtins'),
1264
+ include('punct'),
1265
+ include('operators'),
1266
+ (r'[0-9]*\.[0-9]+(e[0-9]+)?[fd]?', Number.Float),
1267
+ (r'0x[0-9a-f]+', Number.Hex),
1268
+ (r'[0-9]+L?', Number.Integer),
1269
+ (r'\n', Text),
1270
+ (r'([a-z_]\w*)(\s*)(\()',
1271
+ bygroups(Name.Function, Text, Punctuation)),
1272
+ (r'[()#:]', Text),
1273
+ (r'[^(:#\'")\s]+', Text),
1274
+ (r'\S+\s+', Text) # TODO: make tests pass without \s+
1275
+ ],
1276
+ 'keywords': [
1277
+ (r'(assert|and|any|all|arrange|as|asc|bag|by|cache|CASE|cat|cd|cp|'
1278
+ r'%declare|%default|define|dense|desc|describe|distinct|du|dump|'
1279
+ r'eval|exex|explain|filter|flatten|foreach|full|generate|group|'
1280
+ r'help|if|illustrate|import|inner|input|into|is|join|kill|left|'
1281
+ r'limit|load|ls|map|matches|mkdir|mv|not|null|onschema|or|order|'
1282
+ r'outer|output|parallel|pig|pwd|quit|register|returns|right|rm|'
1283
+ r'rmf|rollup|run|sample|set|ship|split|stderr|stdin|stdout|store|'
1284
+ r'stream|through|union|using|void)\b', Keyword)
1285
+ ],
1286
+ 'builtins': [
1287
+ (r'(AVG|BinStorage|cogroup|CONCAT|copyFromLocal|copyToLocal|COUNT|'
1288
+ r'cross|DIFF|MAX|MIN|PigDump|PigStorage|SIZE|SUM|TextLoader|'
1289
+ r'TOKENIZE)\b', Name.Builtin)
1290
+ ],
1291
+ 'types': [
1292
+ (r'(bytearray|BIGINTEGER|BIGDECIMAL|chararray|datetime|double|float|'
1293
+ r'int|long|tuple)\b', Keyword.Type)
1294
+ ],
1295
+ 'punct': [
1296
+ (r'[;(){}\[\]]', Punctuation),
1297
+ ],
1298
+ 'operators': [
1299
+ (r'[#=,./%+\-?]', Operator),
1300
+ (r'(eq|gt|lt|gte|lte|neq|matches)\b', Operator),
1301
+ (r'(==|<=|<|>=|>|!=)', Operator),
1302
+ ],
1303
+ }
1304
+
1305
+
1306
+ class GoloLexer(RegexLexer):
1307
+ """
1308
+ For `Golo <http://golo-lang.org/>`_ source code.
1309
+
1310
+ .. versionadded:: 2.0
1311
+ """
1312
+
1313
+ name = 'Golo'
1314
+ filenames = ['*.golo']
1315
+ aliases = ['golo']
1316
+
1317
+ tokens = {
1318
+ 'root': [
1319
+ (r'[^\S\n]+', Text),
1320
+
1321
+ (r'#.*$', Comment),
1322
+
1323
+ (r'(\^|\.\.\.|:|\?:|->|==|!=|=|\+|\*|%|/|<=|<|>=|>|=|\.)',
1324
+ Operator),
1325
+ (r'(?<=[^-])(-)(?=[^-])', Operator),
1326
+
1327
+ (r'(?<=[^`])(is|isnt|and|or|not|oftype|in|orIfNull)\b', Operator.Word),
1328
+ (r'[]{}|(),[]', Punctuation),
1329
+
1330
+ (r'(module|import)(\s+)',
1331
+ bygroups(Keyword.Namespace, Text),
1332
+ 'modname'),
1333
+ (r'\b([a-zA-Z_][\w$.]*)(::)', bygroups(Name.Namespace, Punctuation)),
1334
+ (r'\b([a-zA-Z_][\w$]*(?:\.[a-zA-Z_][\w$]*)+)\b', Name.Namespace),
1335
+
1336
+ (r'(let|var)(\s+)',
1337
+ bygroups(Keyword.Declaration, Text),
1338
+ 'varname'),
1339
+ (r'(struct)(\s+)',
1340
+ bygroups(Keyword.Declaration, Text),
1341
+ 'structname'),
1342
+ (r'(function)(\s+)',
1343
+ bygroups(Keyword.Declaration, Text),
1344
+ 'funcname'),
1345
+
1346
+ (r'(null|true|false)\b', Keyword.Constant),
1347
+ (r'(augment|pimp'
1348
+ r'|if|else|case|match|return'
1349
+ r'|case|when|then|otherwise'
1350
+ r'|while|for|foreach'
1351
+ r'|try|catch|finally|throw'
1352
+ r'|local'
1353
+ r'|continue|break)\b', Keyword),
1354
+
1355
+ (r'(map|array|list|set|vector|tuple)(\[)',
1356
+ bygroups(Name.Builtin, Punctuation)),
1357
+ (r'(print|println|readln|raise|fun'
1358
+ r'|asInterfaceInstance)\b', Name.Builtin),
1359
+ (r'(`?[a-zA-Z_][\w$]*)(\()',
1360
+ bygroups(Name.Function, Punctuation)),
1361
+
1362
+ (r'-?[\d_]*\.[\d_]*([eE][+-]?\d[\d_]*)?F?', Number.Float),
1363
+ (r'0[0-7]+j?', Number.Oct),
1364
+ (r'0[xX][a-fA-F0-9]+', Number.Hex),
1365
+ (r'-?\d[\d_]*L', Number.Integer.Long),
1366
+ (r'-?\d[\d_]*', Number.Integer),
1367
+
1368
+ (r'`?[a-zA-Z_][\w$]*', Name),
1369
+ (r'@[a-zA-Z_][\w$.]*', Name.Decorator),
1370
+
1371
+ (r'"""', String, combined('stringescape', 'triplestring')),
1372
+ (r'"', String, combined('stringescape', 'doublestring')),
1373
+ (r"'", String, combined('stringescape', 'singlestring')),
1374
+ (r'----((.|\n)*?)----', String.Doc)
1375
+
1376
+ ],
1377
+
1378
+ 'funcname': [
1379
+ (r'`?[a-zA-Z_][\w$]*', Name.Function, '#pop'),
1380
+ ],
1381
+ 'modname': [
1382
+ (r'[a-zA-Z_][\w$.]*\*?', Name.Namespace, '#pop')
1383
+ ],
1384
+ 'structname': [
1385
+ (r'`?[\w.]+\*?', Name.Class, '#pop')
1386
+ ],
1387
+ 'varname': [
1388
+ (r'`?[a-zA-Z_][\w$]*', Name.Variable, '#pop'),
1389
+ ],
1390
+ 'string': [
1391
+ (r'[^\\\'"\n]+', String),
1392
+ (r'[\'"\\]', String)
1393
+ ],
1394
+ 'stringescape': [
1395
+ (r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|'
1396
+ r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
1397
+ ],
1398
+ 'triplestring': [
1399
+ (r'"""', String, '#pop'),
1400
+ include('string'),
1401
+ (r'\n', String),
1402
+ ],
1403
+ 'doublestring': [
1404
+ (r'"', String.Double, '#pop'),
1405
+ include('string'),
1406
+ ],
1407
+ 'singlestring': [
1408
+ (r"'", String, '#pop'),
1409
+ include('string'),
1410
+ ],
1411
+ 'operators': [
1412
+ (r'[#=,./%+\-?]', Operator),
1413
+ (r'(eq|gt|lt|gte|lte|neq|matches)\b', Operator),
1414
+ (r'(==|<=|<|>=|>|!=)', Operator),
1415
+ ],
1416
+ }
1417
+
1418
+
1419
+ class JasminLexer(RegexLexer):
1420
+ """
1421
+ For `Jasmin <http://jasmin.sourceforge.net/>`_ assembly code.
1422
+
1423
+ .. versionadded:: 2.0
1424
+ """
1425
+
1426
+ name = 'Jasmin'
1427
+ aliases = ['jasmin', 'jasminxt']
1428
+ filenames = ['*.j']
1429
+
1430
+ _whitespace = r' \n\t\r'
1431
+ _ws = r'(?:[%s]+)' % _whitespace
1432
+ _separator = r'%s:=' % _whitespace
1433
+ _break = r'(?=[%s]|$)' % _separator
1434
+ _name = r'[^%s]+' % _separator
1435
+ _unqualified_name = r'(?:[^%s.;\[/]+)' % _separator
1436
+
1437
+ tokens = {
1438
+ 'default': [
1439
+ (r'\n', Text, '#pop'),
1440
+ (r"'", String.Single, ('#pop', 'quote')),
1441
+ (r'"', String.Double, 'string'),
1442
+ (r'=', Punctuation),
1443
+ (r':', Punctuation, 'label'),
1444
+ (_ws, Text),
1445
+ (r';.*', Comment.Single),
1446
+ (r'(\$[-+])?0x-?[\da-fA-F]+%s' % _break, Number.Hex),
1447
+ (r'(\$[-+]|\+)?-?\d+%s' % _break, Number.Integer),
1448
+ (r'-?(\d+\.\d*|\.\d+)([eE][-+]?\d+)?[fFdD]?'
1449
+ r'[\x00-\x08\x0b\x0c\x0e-\x1f]*%s' % _break, Number.Float),
1450
+ (r'\$%s' % _name, Name.Variable),
1451
+
1452
+ # Directives
1453
+ (r'\.annotation%s' % _break, Keyword.Reserved, 'annotation'),
1454
+ (r'(\.attribute|\.bytecode|\.debug|\.deprecated|\.enclosing|'
1455
+ r'\.interface|\.line|\.signature|\.source|\.stack|\.var|abstract|'
1456
+ r'annotation|bridge|class|default|enum|field|final|fpstrict|'
1457
+ r'interface|native|private|protected|public|signature|static|'
1458
+ r'synchronized|synthetic|transient|varargs|volatile)%s' % _break,
1459
+ Keyword.Reserved),
1460
+ (r'\.catch%s' % _break, Keyword.Reserved, 'caught-exception'),
1461
+ (r'(\.class|\.implements|\.inner|\.super|inner|invisible|'
1462
+ r'invisibleparam|outer|visible|visibleparam)%s' % _break,
1463
+ Keyword.Reserved, 'class/convert-dots'),
1464
+ (r'\.field%s' % _break, Keyword.Reserved,
1465
+ ('descriptor/convert-dots', 'field')),
1466
+ (r'(\.end|\.limit|use)%s' % _break, Keyword.Reserved,
1467
+ 'no-verification'),
1468
+ (r'\.method%s' % _break, Keyword.Reserved, 'method'),
1469
+ (r'\.set%s' % _break, Keyword.Reserved, 'var'),
1470
+ (r'\.throws%s' % _break, Keyword.Reserved, 'exception'),
1471
+ (r'(from|offset|to|using)%s' % _break, Keyword.Reserved, 'label'),
1472
+ (r'is%s' % _break, Keyword.Reserved,
1473
+ ('descriptor/convert-dots', 'var')),
1474
+ (r'(locals|stack)%s' % _break, Keyword.Reserved, 'verification'),
1475
+ (r'method%s' % _break, Keyword.Reserved, 'enclosing-method'),
1476
+
1477
+ # Instructions
1478
+ (words((
1479
+ 'aaload', 'aastore', 'aconst_null', 'aload', 'aload_0', 'aload_1', 'aload_2',
1480
+ 'aload_3', 'aload_w', 'areturn', 'arraylength', 'astore', 'astore_0', 'astore_1',
1481
+ 'astore_2', 'astore_3', 'astore_w', 'athrow', 'baload', 'bastore', 'bipush',
1482
+ 'breakpoint', 'caload', 'castore', 'd2f', 'd2i', 'd2l', 'dadd', 'daload', 'dastore',
1483
+ 'dcmpg', 'dcmpl', 'dconst_0', 'dconst_1', 'ddiv', 'dload', 'dload_0', 'dload_1',
1484
+ 'dload_2', 'dload_3', 'dload_w', 'dmul', 'dneg', 'drem', 'dreturn', 'dstore', 'dstore_0',
1485
+ 'dstore_1', 'dstore_2', 'dstore_3', 'dstore_w', 'dsub', 'dup', 'dup2', 'dup2_x1',
1486
+ 'dup2_x2', 'dup_x1', 'dup_x2', 'f2d', 'f2i', 'f2l', 'fadd', 'faload', 'fastore', 'fcmpg',
1487
+ 'fcmpl', 'fconst_0', 'fconst_1', 'fconst_2', 'fdiv', 'fload', 'fload_0', 'fload_1',
1488
+ 'fload_2', 'fload_3', 'fload_w', 'fmul', 'fneg', 'frem', 'freturn', 'fstore', 'fstore_0',
1489
+ 'fstore_1', 'fstore_2', 'fstore_3', 'fstore_w', 'fsub', 'i2b', 'i2c', 'i2d', 'i2f', 'i2l',
1490
+ 'i2s', 'iadd', 'iaload', 'iand', 'iastore', 'iconst_0', 'iconst_1', 'iconst_2',
1491
+ 'iconst_3', 'iconst_4', 'iconst_5', 'iconst_m1', 'idiv', 'iinc', 'iinc_w', 'iload',
1492
+ 'iload_0', 'iload_1', 'iload_2', 'iload_3', 'iload_w', 'imul', 'ineg', 'int2byte',
1493
+ 'int2char', 'int2short', 'ior', 'irem', 'ireturn', 'ishl', 'ishr', 'istore', 'istore_0',
1494
+ 'istore_1', 'istore_2', 'istore_3', 'istore_w', 'isub', 'iushr', 'ixor', 'l2d', 'l2f',
1495
+ 'l2i', 'ladd', 'laload', 'land', 'lastore', 'lcmp', 'lconst_0', 'lconst_1', 'ldc2_w',
1496
+ 'ldiv', 'lload', 'lload_0', 'lload_1', 'lload_2', 'lload_3', 'lload_w', 'lmul', 'lneg',
1497
+ 'lookupswitch', 'lor', 'lrem', 'lreturn', 'lshl', 'lshr', 'lstore', 'lstore_0',
1498
+ 'lstore_1', 'lstore_2', 'lstore_3', 'lstore_w', 'lsub', 'lushr', 'lxor',
1499
+ 'monitorenter', 'monitorexit', 'nop', 'pop', 'pop2', 'ret', 'ret_w', 'return', 'saload',
1500
+ 'sastore', 'sipush', 'swap'), suffix=_break), Keyword.Reserved),
1501
+ (r'(anewarray|checkcast|instanceof|ldc|ldc_w|new)%s' % _break,
1502
+ Keyword.Reserved, 'class/no-dots'),
1503
+ (r'invoke(dynamic|interface|nonvirtual|special|'
1504
+ r'static|virtual)%s' % _break, Keyword.Reserved,
1505
+ 'invocation'),
1506
+ (r'(getfield|putfield)%s' % _break, Keyword.Reserved,
1507
+ ('descriptor/no-dots', 'field')),
1508
+ (r'(getstatic|putstatic)%s' % _break, Keyword.Reserved,
1509
+ ('descriptor/no-dots', 'static')),
1510
+ (words((
1511
+ 'goto', 'goto_w', 'if_acmpeq', 'if_acmpne', 'if_icmpeq',
1512
+ 'if_icmpge', 'if_icmpgt', 'if_icmple', 'if_icmplt', 'if_icmpne',
1513
+ 'ifeq', 'ifge', 'ifgt', 'ifle', 'iflt', 'ifne', 'ifnonnull',
1514
+ 'ifnull', 'jsr', 'jsr_w'), suffix=_break),
1515
+ Keyword.Reserved, 'label'),
1516
+ (r'(multianewarray|newarray)%s' % _break, Keyword.Reserved,
1517
+ 'descriptor/convert-dots'),
1518
+ (r'tableswitch%s' % _break, Keyword.Reserved, 'table')
1519
+ ],
1520
+ 'quote': [
1521
+ (r"'", String.Single, '#pop'),
1522
+ (r'\\u[\da-fA-F]{4}', String.Escape),
1523
+ (r"[^'\\]+", String.Single)
1524
+ ],
1525
+ 'string': [
1526
+ (r'"', String.Double, '#pop'),
1527
+ (r'\\([nrtfb"\'\\]|u[\da-fA-F]{4}|[0-3]?[0-7]{1,2})',
1528
+ String.Escape),
1529
+ (r'[^"\\]+', String.Double)
1530
+ ],
1531
+ 'root': [
1532
+ (r'\n+', Text),
1533
+ (r"'", String.Single, 'quote'),
1534
+ include('default'),
1535
+ (r'(%s)([ \t\r]*)(:)' % _name,
1536
+ bygroups(Name.Label, Text, Punctuation)),
1537
+ (_name, String.Other)
1538
+ ],
1539
+ 'annotation': [
1540
+ (r'\n', Text, ('#pop', 'annotation-body')),
1541
+ (r'default%s' % _break, Keyword.Reserved,
1542
+ ('#pop', 'annotation-default')),
1543
+ include('default')
1544
+ ],
1545
+ 'annotation-body': [
1546
+ (r'\n+', Text),
1547
+ (r'\.end%s' % _break, Keyword.Reserved, '#pop'),
1548
+ include('default'),
1549
+ (_name, String.Other, ('annotation-items', 'descriptor/no-dots'))
1550
+ ],
1551
+ 'annotation-default': [
1552
+ (r'\n+', Text),
1553
+ (r'\.end%s' % _break, Keyword.Reserved, '#pop'),
1554
+ include('default'),
1555
+ default(('annotation-items', 'descriptor/no-dots'))
1556
+ ],
1557
+ 'annotation-items': [
1558
+ (r"'", String.Single, 'quote'),
1559
+ include('default'),
1560
+ (_name, String.Other)
1561
+ ],
1562
+ 'caught-exception': [
1563
+ (r'all%s' % _break, Keyword, '#pop'),
1564
+ include('exception')
1565
+ ],
1566
+ 'class/convert-dots': [
1567
+ include('default'),
1568
+ (r'(L)((?:%s[/.])*)(%s)(;)' % (_unqualified_name, _name),
1569
+ bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
1570
+ '#pop'),
1571
+ (r'((?:%s[/.])*)(%s)' % (_unqualified_name, _name),
1572
+ bygroups(Name.Namespace, Name.Class), '#pop')
1573
+ ],
1574
+ 'class/no-dots': [
1575
+ include('default'),
1576
+ (r'\[+', Punctuation, ('#pop', 'descriptor/no-dots')),
1577
+ (r'(L)((?:%s/)*)(%s)(;)' % (_unqualified_name, _name),
1578
+ bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
1579
+ '#pop'),
1580
+ (r'((?:%s/)*)(%s)' % (_unqualified_name, _name),
1581
+ bygroups(Name.Namespace, Name.Class), '#pop')
1582
+ ],
1583
+ 'descriptor/convert-dots': [
1584
+ include('default'),
1585
+ (r'\[+', Punctuation),
1586
+ (r'(L)((?:%s[/.])*)(%s?)(;)' % (_unqualified_name, _name),
1587
+ bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
1588
+ '#pop'),
1589
+ (r'[^%s\[)L]+' % _separator, Keyword.Type, '#pop'),
1590
+ default('#pop')
1591
+ ],
1592
+ 'descriptor/no-dots': [
1593
+ include('default'),
1594
+ (r'\[+', Punctuation),
1595
+ (r'(L)((?:%s/)*)(%s)(;)' % (_unqualified_name, _name),
1596
+ bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
1597
+ '#pop'),
1598
+ (r'[^%s\[)L]+' % _separator, Keyword.Type, '#pop'),
1599
+ default('#pop')
1600
+ ],
1601
+ 'descriptors/convert-dots': [
1602
+ (r'\)', Punctuation, '#pop'),
1603
+ default('descriptor/convert-dots')
1604
+ ],
1605
+ 'enclosing-method': [
1606
+ (_ws, Text),
1607
+ (r'(?=[^%s]*\()' % _separator, Text, ('#pop', 'invocation')),
1608
+ default(('#pop', 'class/convert-dots'))
1609
+ ],
1610
+ 'exception': [
1611
+ include('default'),
1612
+ (r'((?:%s[/.])*)(%s)' % (_unqualified_name, _name),
1613
+ bygroups(Name.Namespace, Name.Exception), '#pop')
1614
+ ],
1615
+ 'field': [
1616
+ (r'static%s' % _break, Keyword.Reserved, ('#pop', 'static')),
1617
+ include('default'),
1618
+ (r'((?:%s[/.](?=[^%s]*[/.]))*)(%s[/.])?(%s)' %
1619
+ (_unqualified_name, _separator, _unqualified_name, _name),
1620
+ bygroups(Name.Namespace, Name.Class, Name.Variable.Instance),
1621
+ '#pop')
1622
+ ],
1623
+ 'invocation': [
1624
+ include('default'),
1625
+ (r'((?:%s[/.](?=[^%s(]*[/.]))*)(%s[/.])?(%s)(\()' %
1626
+ (_unqualified_name, _separator, _unqualified_name, _name),
1627
+ bygroups(Name.Namespace, Name.Class, Name.Function, Punctuation),
1628
+ ('#pop', 'descriptor/convert-dots', 'descriptors/convert-dots',
1629
+ 'descriptor/convert-dots'))
1630
+ ],
1631
+ 'label': [
1632
+ include('default'),
1633
+ (_name, Name.Label, '#pop')
1634
+ ],
1635
+ 'method': [
1636
+ include('default'),
1637
+ (r'(%s)(\()' % _name, bygroups(Name.Function, Punctuation),
1638
+ ('#pop', 'descriptor/convert-dots', 'descriptors/convert-dots',
1639
+ 'descriptor/convert-dots'))
1640
+ ],
1641
+ 'no-verification': [
1642
+ (r'(locals|method|stack)%s' % _break, Keyword.Reserved, '#pop'),
1643
+ include('default')
1644
+ ],
1645
+ 'static': [
1646
+ include('default'),
1647
+ (r'((?:%s[/.](?=[^%s]*[/.]))*)(%s[/.])?(%s)' %
1648
+ (_unqualified_name, _separator, _unqualified_name, _name),
1649
+ bygroups(Name.Namespace, Name.Class, Name.Variable.Class), '#pop')
1650
+ ],
1651
+ 'table': [
1652
+ (r'\n+', Text),
1653
+ (r'default%s' % _break, Keyword.Reserved, '#pop'),
1654
+ include('default'),
1655
+ (_name, Name.Label)
1656
+ ],
1657
+ 'var': [
1658
+ include('default'),
1659
+ (_name, Name.Variable, '#pop')
1660
+ ],
1661
+ 'verification': [
1662
+ include('default'),
1663
+ (r'(Double|Float|Integer|Long|Null|Top|UninitializedThis)%s' %
1664
+ _break, Keyword, '#pop'),
1665
+ (r'Object%s' % _break, Keyword, ('#pop', 'class/no-dots')),
1666
+ (r'Uninitialized%s' % _break, Keyword, ('#pop', 'label'))
1667
+ ]
1668
+ }
1669
+
1670
+ def analyse_text(text):
1671
+ score = 0
1672
+ if re.search(r'^\s*\.class\s', text, re.MULTILINE):
1673
+ score += 0.5
1674
+ if re.search(r'^\s*[a-z]+_[a-z]+\b', text, re.MULTILINE):
1675
+ score += 0.3
1676
+ if re.search(r'^\s*\.(attribute|bytecode|debug|deprecated|enclosing|'
1677
+ r'inner|interface|limit|set|signature|stack)\b', text,
1678
+ re.MULTILINE):
1679
+ score += 0.6
1680
+ return score
1681
+
1682
+
1683
+ class SarlLexer(RegexLexer):
1684
+ """
1685
+ For `SARL <http://www.sarl.io>`_ source code.
1686
+
1687
+ .. versionadded:: 2.4
1688
+ """
1689
+
1690
+ name = 'SARL'
1691
+ aliases = ['sarl']
1692
+ filenames = ['*.sarl']
1693
+ mimetypes = ['text/x-sarl']
1694
+
1695
+ flags = re.MULTILINE | re.DOTALL
1696
+
1697
+ tokens = {
1698
+ 'root': [
1699
+ # method names
1700
+ (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments
1701
+ r'([a-zA-Z_$][\w$]*)' # method name
1702
+ r'(\s*)(\()', # signature start
1703
+ bygroups(using(this), Name.Function, Text, Operator)),
1704
+ (r'[^\S\n]+', Text),
1705
+ (r'//.*?\n', Comment.Single),
1706
+ (r'/\*.*?\*/', Comment.Multiline),
1707
+ (r'@[a-zA-Z_][\w.]*', Name.Decorator),
1708
+ (r'(as|break|case|catch|default|do|else|extends|extension|finally|'
1709
+ r'fires|for|if|implements|instanceof|new|on|requires|return|super|'
1710
+ r'switch|throw|throws|try|typeof|uses|while|with)\b',
1711
+ Keyword),
1712
+ (r'(abstract|def|dispatch|final|native|override|private|protected|'
1713
+ r'public|static|strictfp|synchronized|transient|val|var|volatile)\b',
1714
+ Keyword.Declaration),
1715
+ (r'(boolean|byte|char|double|float|int|long|short|void)\b',
1716
+ Keyword.Type),
1717
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
1718
+ (r'(false|it|null|occurrence|this|true|void)\b', Keyword.Constant),
1719
+ (r'(agent|annotation|artifact|behavior|capacity|class|enum|event|'
1720
+ r'interface|skill|space)(\s+)', bygroups(Keyword.Declaration, Text),
1721
+ 'class'),
1722
+ (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
1723
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
1724
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
1725
+ (r'[a-zA-Z_]\w*:', Name.Label),
1726
+ (r'[a-zA-Z_$]\w*', Name),
1727
+ (r'[~^*!%&\[\](){}<>\|+=:;,./?-]', Operator),
1728
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
1729
+ (r'0x[0-9a-fA-F]+', Number.Hex),
1730
+ (r'[0-9]+L?', Number.Integer),
1731
+ (r'\n', Text)
1732
+ ],
1733
+ 'class': [
1734
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
1735
+ ],
1736
+ 'import': [
1737
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
1738
+ ],
1739
+ }