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,935 @@
1
+ """
2
+ pygments.lexers.haxe
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Haxe and related stuff.
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 ExtendedRegexLexer, RegexLexer, include, bygroups, \
14
+ default
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Number, Punctuation, Generic, Whitespace
17
+
18
+ __all__ = ['HaxeLexer', 'HxmlLexer']
19
+
20
+
21
+ class HaxeLexer(ExtendedRegexLexer):
22
+ """
23
+ For Haxe source code (http://haxe.org/).
24
+
25
+ .. versionadded:: 1.3
26
+ """
27
+
28
+ name = 'Haxe'
29
+ aliases = ['hx', 'haxe', 'hxsl']
30
+ filenames = ['*.hx', '*.hxsl']
31
+ mimetypes = ['text/haxe', 'text/x-haxe', 'text/x-hx']
32
+
33
+ # keywords extracted from lexer.mll in the haxe compiler source
34
+ keyword = (r'(?:function|class|static|var|if|else|while|do|for|'
35
+ r'break|return|continue|extends|implements|import|'
36
+ r'switch|case|default|public|private|try|untyped|'
37
+ r'catch|new|this|throw|extern|enum|in|interface|'
38
+ r'cast|override|dynamic|typedef|package|'
39
+ r'inline|using|null|true|false|abstract)\b')
40
+
41
+ # idtype in lexer.mll
42
+ typeid = r'_*[A-Z]\w*'
43
+
44
+ # combined ident and dollar and idtype
45
+ ident = r'(?:_*[a-z]\w*|_+[0-9]\w*|' + typeid + r'|_+|\$\w+)'
46
+
47
+ binop = (r'(?:%=|&=|\|=|\^=|\+=|\-=|\*=|/=|<<=|>\s*>\s*=|>\s*>\s*>\s*=|==|'
48
+ r'!=|<=|>\s*=|&&|\|\||<<|>>>|>\s*>|\.\.\.|<|>|%|&|\||\^|\+|\*|'
49
+ r'/|\-|=>|=)')
50
+
51
+ # ident except keywords
52
+ ident_no_keyword = r'(?!' + keyword + ')' + ident
53
+
54
+ flags = re.DOTALL | re.MULTILINE
55
+
56
+ preproc_stack = []
57
+
58
+ def preproc_callback(self, match, ctx):
59
+ proc = match.group(2)
60
+
61
+ if proc == 'if':
62
+ # store the current stack
63
+ self.preproc_stack.append(ctx.stack[:])
64
+ elif proc in ['else', 'elseif']:
65
+ # restore the stack back to right before #if
66
+ if self.preproc_stack:
67
+ ctx.stack = self.preproc_stack[-1][:]
68
+ elif proc == 'end':
69
+ # remove the saved stack of previous #if
70
+ if self.preproc_stack:
71
+ self.preproc_stack.pop()
72
+
73
+ # #if and #elseif should follow by an expr
74
+ if proc in ['if', 'elseif']:
75
+ ctx.stack.append('preproc-expr')
76
+
77
+ # #error can be optionally follow by the error msg
78
+ if proc in ['error']:
79
+ ctx.stack.append('preproc-error')
80
+
81
+ yield match.start(), Comment.Preproc, '#' + proc
82
+ ctx.pos = match.end()
83
+
84
+ tokens = {
85
+ 'root': [
86
+ include('spaces'),
87
+ include('meta'),
88
+ (r'(?:package)\b', Keyword.Namespace, ('semicolon', 'package')),
89
+ (r'(?:import)\b', Keyword.Namespace, ('semicolon', 'import')),
90
+ (r'(?:using)\b', Keyword.Namespace, ('semicolon', 'using')),
91
+ (r'(?:extern|private)\b', Keyword.Declaration),
92
+ (r'(?:abstract)\b', Keyword.Declaration, 'abstract'),
93
+ (r'(?:class|interface)\b', Keyword.Declaration, 'class'),
94
+ (r'(?:enum)\b', Keyword.Declaration, 'enum'),
95
+ (r'(?:typedef)\b', Keyword.Declaration, 'typedef'),
96
+
97
+ # top-level expression
98
+ # although it is not supported in haxe, but it is common to write
99
+ # expression in web pages the positive lookahead here is to prevent
100
+ # an infinite loop at the EOF
101
+ (r'(?=.)', Text, 'expr-statement'),
102
+ ],
103
+
104
+ # space/tab/comment/preproc
105
+ 'spaces': [
106
+ (r'\s+', Text),
107
+ (r'//[^\n\r]*', Comment.Single),
108
+ (r'/\*.*?\*/', Comment.Multiline),
109
+ (r'(#)(if|elseif|else|end|error)\b', preproc_callback),
110
+ ],
111
+
112
+ 'string-single-interpol': [
113
+ (r'\$\{', String.Interpol, ('string-interpol-close', 'expr')),
114
+ (r'\$\$', String.Escape),
115
+ (r'\$(?=' + ident + ')', String.Interpol, 'ident'),
116
+ include('string-single'),
117
+ ],
118
+
119
+ 'string-single': [
120
+ (r"'", String.Single, '#pop'),
121
+ (r'\\.', String.Escape),
122
+ (r'.', String.Single),
123
+ ],
124
+
125
+ 'string-double': [
126
+ (r'"', String.Double, '#pop'),
127
+ (r'\\.', String.Escape),
128
+ (r'.', String.Double),
129
+ ],
130
+
131
+ 'string-interpol-close': [
132
+ (r'\$'+ident, String.Interpol),
133
+ (r'\}', String.Interpol, '#pop'),
134
+ ],
135
+
136
+ 'package': [
137
+ include('spaces'),
138
+ (ident, Name.Namespace),
139
+ (r'\.', Punctuation, 'import-ident'),
140
+ default('#pop'),
141
+ ],
142
+
143
+ 'import': [
144
+ include('spaces'),
145
+ (ident, Name.Namespace),
146
+ (r'\*', Keyword), # wildcard import
147
+ (r'\.', Punctuation, 'import-ident'),
148
+ (r'in', Keyword.Namespace, 'ident'),
149
+ default('#pop'),
150
+ ],
151
+
152
+ 'import-ident': [
153
+ include('spaces'),
154
+ (r'\*', Keyword, '#pop'), # wildcard import
155
+ (ident, Name.Namespace, '#pop'),
156
+ ],
157
+
158
+ 'using': [
159
+ include('spaces'),
160
+ (ident, Name.Namespace),
161
+ (r'\.', Punctuation, 'import-ident'),
162
+ default('#pop'),
163
+ ],
164
+
165
+ 'preproc-error': [
166
+ (r'\s+', Comment.Preproc),
167
+ (r"'", String.Single, ('#pop', 'string-single')),
168
+ (r'"', String.Double, ('#pop', 'string-double')),
169
+ default('#pop'),
170
+ ],
171
+
172
+ 'preproc-expr': [
173
+ (r'\s+', Comment.Preproc),
174
+ (r'\!', Comment.Preproc),
175
+ (r'\(', Comment.Preproc, ('#pop', 'preproc-parenthesis')),
176
+
177
+ (ident, Comment.Preproc, '#pop'),
178
+
179
+ # Float
180
+ (r'\.[0-9]+', Number.Float),
181
+ (r'[0-9]+[eE][+\-]?[0-9]+', Number.Float),
182
+ (r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float),
183
+ (r'[0-9]+\.[0-9]+', Number.Float),
184
+ (r'[0-9]+\.(?!' + ident + r'|\.\.)', Number.Float),
185
+
186
+ # Int
187
+ (r'0x[0-9a-fA-F]+', Number.Hex),
188
+ (r'[0-9]+', Number.Integer),
189
+
190
+ # String
191
+ (r"'", String.Single, ('#pop', 'string-single')),
192
+ (r'"', String.Double, ('#pop', 'string-double')),
193
+ ],
194
+
195
+ 'preproc-parenthesis': [
196
+ (r'\s+', Comment.Preproc),
197
+ (r'\)', Comment.Preproc, '#pop'),
198
+ default('preproc-expr-in-parenthesis'),
199
+ ],
200
+
201
+ 'preproc-expr-chain': [
202
+ (r'\s+', Comment.Preproc),
203
+ (binop, Comment.Preproc, ('#pop', 'preproc-expr-in-parenthesis')),
204
+ default('#pop'),
205
+ ],
206
+
207
+ # same as 'preproc-expr' but able to chain 'preproc-expr-chain'
208
+ 'preproc-expr-in-parenthesis': [
209
+ (r'\s+', Comment.Preproc),
210
+ (r'\!', Comment.Preproc),
211
+ (r'\(', Comment.Preproc,
212
+ ('#pop', 'preproc-expr-chain', 'preproc-parenthesis')),
213
+
214
+ (ident, Comment.Preproc, ('#pop', 'preproc-expr-chain')),
215
+
216
+ # Float
217
+ (r'\.[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
218
+ (r'[0-9]+[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
219
+ (r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
220
+ (r'[0-9]+\.[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
221
+ (r'[0-9]+\.(?!' + ident + r'|\.\.)', Number.Float, ('#pop', 'preproc-expr-chain')),
222
+
223
+ # Int
224
+ (r'0x[0-9a-fA-F]+', Number.Hex, ('#pop', 'preproc-expr-chain')),
225
+ (r'[0-9]+', Number.Integer, ('#pop', 'preproc-expr-chain')),
226
+
227
+ # String
228
+ (r"'", String.Single,
229
+ ('#pop', 'preproc-expr-chain', 'string-single')),
230
+ (r'"', String.Double,
231
+ ('#pop', 'preproc-expr-chain', 'string-double')),
232
+ ],
233
+
234
+ 'abstract': [
235
+ include('spaces'),
236
+ default(('#pop', 'abstract-body', 'abstract-relation',
237
+ 'abstract-opaque', 'type-param-constraint', 'type-name')),
238
+ ],
239
+
240
+ 'abstract-body': [
241
+ include('spaces'),
242
+ (r'\{', Punctuation, ('#pop', 'class-body')),
243
+ ],
244
+
245
+ 'abstract-opaque': [
246
+ include('spaces'),
247
+ (r'\(', Punctuation, ('#pop', 'parenthesis-close', 'type')),
248
+ default('#pop'),
249
+ ],
250
+
251
+ 'abstract-relation': [
252
+ include('spaces'),
253
+ (r'(?:to|from)', Keyword.Declaration, 'type'),
254
+ (r',', Punctuation),
255
+ default('#pop'),
256
+ ],
257
+
258
+ 'meta': [
259
+ include('spaces'),
260
+ (r'@', Name.Decorator, ('meta-body', 'meta-ident', 'meta-colon')),
261
+ ],
262
+
263
+ # optional colon
264
+ 'meta-colon': [
265
+ include('spaces'),
266
+ (r':', Name.Decorator, '#pop'),
267
+ default('#pop'),
268
+ ],
269
+
270
+ # same as 'ident' but set token as Name.Decorator instead of Name
271
+ 'meta-ident': [
272
+ include('spaces'),
273
+ (ident, Name.Decorator, '#pop'),
274
+ ],
275
+
276
+ 'meta-body': [
277
+ include('spaces'),
278
+ (r'\(', Name.Decorator, ('#pop', 'meta-call')),
279
+ default('#pop'),
280
+ ],
281
+
282
+ 'meta-call': [
283
+ include('spaces'),
284
+ (r'\)', Name.Decorator, '#pop'),
285
+ default(('#pop', 'meta-call-sep', 'expr')),
286
+ ],
287
+
288
+ 'meta-call-sep': [
289
+ include('spaces'),
290
+ (r'\)', Name.Decorator, '#pop'),
291
+ (r',', Punctuation, ('#pop', 'meta-call')),
292
+ ],
293
+
294
+ 'typedef': [
295
+ include('spaces'),
296
+ default(('#pop', 'typedef-body', 'type-param-constraint',
297
+ 'type-name')),
298
+ ],
299
+
300
+ 'typedef-body': [
301
+ include('spaces'),
302
+ (r'=', Operator, ('#pop', 'optional-semicolon', 'type')),
303
+ ],
304
+
305
+ 'enum': [
306
+ include('spaces'),
307
+ default(('#pop', 'enum-body', 'bracket-open',
308
+ 'type-param-constraint', 'type-name')),
309
+ ],
310
+
311
+ 'enum-body': [
312
+ include('spaces'),
313
+ include('meta'),
314
+ (r'\}', Punctuation, '#pop'),
315
+ (ident_no_keyword, Name, ('enum-member', 'type-param-constraint')),
316
+ ],
317
+
318
+ 'enum-member': [
319
+ include('spaces'),
320
+ (r'\(', Punctuation,
321
+ ('#pop', 'semicolon', 'flag', 'function-param')),
322
+ default(('#pop', 'semicolon', 'flag')),
323
+ ],
324
+
325
+ 'class': [
326
+ include('spaces'),
327
+ default(('#pop', 'class-body', 'bracket-open', 'extends',
328
+ 'type-param-constraint', 'type-name')),
329
+ ],
330
+
331
+ 'extends': [
332
+ include('spaces'),
333
+ (r'(?:extends|implements)\b', Keyword.Declaration, 'type'),
334
+ (r',', Punctuation), # the comma is made optional here, since haxe2
335
+ # requires the comma but haxe3 does not allow it
336
+ default('#pop'),
337
+ ],
338
+
339
+ 'bracket-open': [
340
+ include('spaces'),
341
+ (r'\{', Punctuation, '#pop'),
342
+ ],
343
+
344
+ 'bracket-close': [
345
+ include('spaces'),
346
+ (r'\}', Punctuation, '#pop'),
347
+ ],
348
+
349
+ 'class-body': [
350
+ include('spaces'),
351
+ include('meta'),
352
+ (r'\}', Punctuation, '#pop'),
353
+ (r'(?:static|public|private|override|dynamic|inline|macro)\b',
354
+ Keyword.Declaration),
355
+ default('class-member'),
356
+ ],
357
+
358
+ 'class-member': [
359
+ include('spaces'),
360
+ (r'(var)\b', Keyword.Declaration,
361
+ ('#pop', 'optional-semicolon', 'var')),
362
+ (r'(function)\b', Keyword.Declaration,
363
+ ('#pop', 'optional-semicolon', 'class-method')),
364
+ ],
365
+
366
+ # local function, anonymous or not
367
+ 'function-local': [
368
+ include('spaces'),
369
+ (ident_no_keyword, Name.Function,
370
+ ('#pop', 'optional-expr', 'flag', 'function-param',
371
+ 'parenthesis-open', 'type-param-constraint')),
372
+ default(('#pop', 'optional-expr', 'flag', 'function-param',
373
+ 'parenthesis-open', 'type-param-constraint')),
374
+ ],
375
+
376
+ 'optional-expr': [
377
+ include('spaces'),
378
+ include('expr'),
379
+ default('#pop'),
380
+ ],
381
+
382
+ 'class-method': [
383
+ include('spaces'),
384
+ (ident, Name.Function, ('#pop', 'optional-expr', 'flag',
385
+ 'function-param', 'parenthesis-open',
386
+ 'type-param-constraint')),
387
+ ],
388
+
389
+ # function arguments
390
+ 'function-param': [
391
+ include('spaces'),
392
+ (r'\)', Punctuation, '#pop'),
393
+ (r'\?', Punctuation),
394
+ (ident_no_keyword, Name,
395
+ ('#pop', 'function-param-sep', 'assign', 'flag')),
396
+ ],
397
+
398
+ 'function-param-sep': [
399
+ include('spaces'),
400
+ (r'\)', Punctuation, '#pop'),
401
+ (r',', Punctuation, ('#pop', 'function-param')),
402
+ ],
403
+
404
+ 'prop-get-set': [
405
+ include('spaces'),
406
+ (r'\(', Punctuation, ('#pop', 'parenthesis-close',
407
+ 'prop-get-set-opt', 'comma', 'prop-get-set-opt')),
408
+ default('#pop'),
409
+ ],
410
+
411
+ 'prop-get-set-opt': [
412
+ include('spaces'),
413
+ (r'(?:default|null|never|dynamic|get|set)\b', Keyword, '#pop'),
414
+ (ident_no_keyword, Text, '#pop'), # custom getter/setter
415
+ ],
416
+
417
+ 'expr-statement': [
418
+ include('spaces'),
419
+ # makes semicolon optional here, just to avoid checking the last
420
+ # one is bracket or not.
421
+ default(('#pop', 'optional-semicolon', 'expr')),
422
+ ],
423
+
424
+ 'expr': [
425
+ include('spaces'),
426
+ (r'@', Name.Decorator, ('#pop', 'optional-expr', 'meta-body',
427
+ 'meta-ident', 'meta-colon')),
428
+ (r'(?:\+\+|\-\-|~(?!/)|!|\-)', Operator),
429
+ (r'\(', Punctuation, ('#pop', 'expr-chain', 'parenthesis')),
430
+ (r'(?:static|public|private|override|dynamic|inline)\b',
431
+ Keyword.Declaration),
432
+ (r'(?:function)\b', Keyword.Declaration, ('#pop', 'expr-chain',
433
+ 'function-local')),
434
+ (r'\{', Punctuation, ('#pop', 'expr-chain', 'bracket')),
435
+ (r'(?:true|false|null)\b', Keyword.Constant, ('#pop', 'expr-chain')),
436
+ (r'(?:this)\b', Keyword, ('#pop', 'expr-chain')),
437
+ (r'(?:cast)\b', Keyword, ('#pop', 'expr-chain', 'cast')),
438
+ (r'(?:try)\b', Keyword, ('#pop', 'catch', 'expr')),
439
+ (r'(?:var)\b', Keyword.Declaration, ('#pop', 'var')),
440
+ (r'(?:new)\b', Keyword, ('#pop', 'expr-chain', 'new')),
441
+ (r'(?:switch)\b', Keyword, ('#pop', 'switch')),
442
+ (r'(?:if)\b', Keyword, ('#pop', 'if')),
443
+ (r'(?:do)\b', Keyword, ('#pop', 'do')),
444
+ (r'(?:while)\b', Keyword, ('#pop', 'while')),
445
+ (r'(?:for)\b', Keyword, ('#pop', 'for')),
446
+ (r'(?:untyped|throw)\b', Keyword),
447
+ (r'(?:return)\b', Keyword, ('#pop', 'optional-expr')),
448
+ (r'(?:macro)\b', Keyword, ('#pop', 'macro')),
449
+ (r'(?:continue|break)\b', Keyword, '#pop'),
450
+ (r'(?:\$\s*[a-z]\b|\$(?!'+ident+'))', Name, ('#pop', 'dollar')),
451
+ (ident_no_keyword, Name, ('#pop', 'expr-chain')),
452
+
453
+ # Float
454
+ (r'\.[0-9]+', Number.Float, ('#pop', 'expr-chain')),
455
+ (r'[0-9]+[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'expr-chain')),
456
+ (r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'expr-chain')),
457
+ (r'[0-9]+\.[0-9]+', Number.Float, ('#pop', 'expr-chain')),
458
+ (r'[0-9]+\.(?!' + ident + r'|\.\.)', Number.Float, ('#pop', 'expr-chain')),
459
+
460
+ # Int
461
+ (r'0x[0-9a-fA-F]+', Number.Hex, ('#pop', 'expr-chain')),
462
+ (r'[0-9]+', Number.Integer, ('#pop', 'expr-chain')),
463
+
464
+ # String
465
+ (r"'", String.Single, ('#pop', 'expr-chain', 'string-single-interpol')),
466
+ (r'"', String.Double, ('#pop', 'expr-chain', 'string-double')),
467
+
468
+ # EReg
469
+ (r'~/(\\\\|\\[^\\]|[^/\\\n])*/[gimsu]*', String.Regex, ('#pop', 'expr-chain')),
470
+
471
+ # Array
472
+ (r'\[', Punctuation, ('#pop', 'expr-chain', 'array-decl')),
473
+ ],
474
+
475
+ 'expr-chain': [
476
+ include('spaces'),
477
+ (r'(?:\+\+|\-\-)', Operator),
478
+ (binop, Operator, ('#pop', 'expr')),
479
+ (r'(?:in)\b', Keyword, ('#pop', 'expr')),
480
+ (r'\?', Operator, ('#pop', 'expr', 'ternary', 'expr')),
481
+ (r'(\.)(' + ident_no_keyword + ')', bygroups(Punctuation, Name)),
482
+ (r'\[', Punctuation, 'array-access'),
483
+ (r'\(', Punctuation, 'call'),
484
+ default('#pop'),
485
+ ],
486
+
487
+ # macro reification
488
+ 'macro': [
489
+ include('spaces'),
490
+ include('meta'),
491
+ (r':', Punctuation, ('#pop', 'type')),
492
+
493
+ (r'(?:extern|private)\b', Keyword.Declaration),
494
+ (r'(?:abstract)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'abstract')),
495
+ (r'(?:class|interface)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'macro-class')),
496
+ (r'(?:enum)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'enum')),
497
+ (r'(?:typedef)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'typedef')),
498
+
499
+ default(('#pop', 'expr')),
500
+ ],
501
+
502
+ 'macro-class': [
503
+ (r'\{', Punctuation, ('#pop', 'class-body')),
504
+ include('class')
505
+ ],
506
+
507
+ # cast can be written as "cast expr" or "cast(expr, type)"
508
+ 'cast': [
509
+ include('spaces'),
510
+ (r'\(', Punctuation, ('#pop', 'parenthesis-close',
511
+ 'cast-type', 'expr')),
512
+ default(('#pop', 'expr')),
513
+ ],
514
+
515
+ # optionally give a type as the 2nd argument of cast()
516
+ 'cast-type': [
517
+ include('spaces'),
518
+ (r',', Punctuation, ('#pop', 'type')),
519
+ default('#pop'),
520
+ ],
521
+
522
+ 'catch': [
523
+ include('spaces'),
524
+ (r'(?:catch)\b', Keyword, ('expr', 'function-param',
525
+ 'parenthesis-open')),
526
+ default('#pop'),
527
+ ],
528
+
529
+ # do-while loop
530
+ 'do': [
531
+ include('spaces'),
532
+ default(('#pop', 'do-while', 'expr')),
533
+ ],
534
+
535
+ # the while after do
536
+ 'do-while': [
537
+ include('spaces'),
538
+ (r'(?:while)\b', Keyword, ('#pop', 'parenthesis',
539
+ 'parenthesis-open')),
540
+ ],
541
+
542
+ 'while': [
543
+ include('spaces'),
544
+ (r'\(', Punctuation, ('#pop', 'expr', 'parenthesis')),
545
+ ],
546
+
547
+ 'for': [
548
+ include('spaces'),
549
+ (r'\(', Punctuation, ('#pop', 'expr', 'parenthesis')),
550
+ ],
551
+
552
+ 'if': [
553
+ include('spaces'),
554
+ (r'\(', Punctuation, ('#pop', 'else', 'optional-semicolon', 'expr',
555
+ 'parenthesis')),
556
+ ],
557
+
558
+ 'else': [
559
+ include('spaces'),
560
+ (r'(?:else)\b', Keyword, ('#pop', 'expr')),
561
+ default('#pop'),
562
+ ],
563
+
564
+ 'switch': [
565
+ include('spaces'),
566
+ default(('#pop', 'switch-body', 'bracket-open', 'expr')),
567
+ ],
568
+
569
+ 'switch-body': [
570
+ include('spaces'),
571
+ (r'(?:case|default)\b', Keyword, ('case-block', 'case')),
572
+ (r'\}', Punctuation, '#pop'),
573
+ ],
574
+
575
+ 'case': [
576
+ include('spaces'),
577
+ (r':', Punctuation, '#pop'),
578
+ default(('#pop', 'case-sep', 'case-guard', 'expr')),
579
+ ],
580
+
581
+ 'case-sep': [
582
+ include('spaces'),
583
+ (r':', Punctuation, '#pop'),
584
+ (r',', Punctuation, ('#pop', 'case')),
585
+ ],
586
+
587
+ 'case-guard': [
588
+ include('spaces'),
589
+ (r'(?:if)\b', Keyword, ('#pop', 'parenthesis', 'parenthesis-open')),
590
+ default('#pop'),
591
+ ],
592
+
593
+ # optional multiple expr under a case
594
+ 'case-block': [
595
+ include('spaces'),
596
+ (r'(?!(?:case|default)\b|\})', Keyword, 'expr-statement'),
597
+ default('#pop'),
598
+ ],
599
+
600
+ 'new': [
601
+ include('spaces'),
602
+ default(('#pop', 'call', 'parenthesis-open', 'type')),
603
+ ],
604
+
605
+ 'array-decl': [
606
+ include('spaces'),
607
+ (r'\]', Punctuation, '#pop'),
608
+ default(('#pop', 'array-decl-sep', 'expr')),
609
+ ],
610
+
611
+ 'array-decl-sep': [
612
+ include('spaces'),
613
+ (r'\]', Punctuation, '#pop'),
614
+ (r',', Punctuation, ('#pop', 'array-decl')),
615
+ ],
616
+
617
+ 'array-access': [
618
+ include('spaces'),
619
+ default(('#pop', 'array-access-close', 'expr')),
620
+ ],
621
+
622
+ 'array-access-close': [
623
+ include('spaces'),
624
+ (r'\]', Punctuation, '#pop'),
625
+ ],
626
+
627
+ 'comma': [
628
+ include('spaces'),
629
+ (r',', Punctuation, '#pop'),
630
+ ],
631
+
632
+ 'colon': [
633
+ include('spaces'),
634
+ (r':', Punctuation, '#pop'),
635
+ ],
636
+
637
+ 'semicolon': [
638
+ include('spaces'),
639
+ (r';', Punctuation, '#pop'),
640
+ ],
641
+
642
+ 'optional-semicolon': [
643
+ include('spaces'),
644
+ (r';', Punctuation, '#pop'),
645
+ default('#pop'),
646
+ ],
647
+
648
+ # identity that CAN be a Haxe keyword
649
+ 'ident': [
650
+ include('spaces'),
651
+ (ident, Name, '#pop'),
652
+ ],
653
+
654
+ 'dollar': [
655
+ include('spaces'),
656
+ (r'\{', Punctuation, ('#pop', 'expr-chain', 'bracket-close', 'expr')),
657
+ default(('#pop', 'expr-chain')),
658
+ ],
659
+
660
+ 'type-name': [
661
+ include('spaces'),
662
+ (typeid, Name, '#pop'),
663
+ ],
664
+
665
+ 'type-full-name': [
666
+ include('spaces'),
667
+ (r'\.', Punctuation, 'ident'),
668
+ default('#pop'),
669
+ ],
670
+
671
+ 'type': [
672
+ include('spaces'),
673
+ (r'\?', Punctuation),
674
+ (ident, Name, ('#pop', 'type-check', 'type-full-name')),
675
+ (r'\{', Punctuation, ('#pop', 'type-check', 'type-struct')),
676
+ (r'\(', Punctuation, ('#pop', 'type-check', 'type-parenthesis')),
677
+ ],
678
+
679
+ 'type-parenthesis': [
680
+ include('spaces'),
681
+ default(('#pop', 'parenthesis-close', 'type')),
682
+ ],
683
+
684
+ 'type-check': [
685
+ include('spaces'),
686
+ (r'->', Punctuation, ('#pop', 'type')),
687
+ (r'<(?!=)', Punctuation, 'type-param'),
688
+ default('#pop'),
689
+ ],
690
+
691
+ 'type-struct': [
692
+ include('spaces'),
693
+ (r'\}', Punctuation, '#pop'),
694
+ (r'\?', Punctuation),
695
+ (r'>', Punctuation, ('comma', 'type')),
696
+ (ident_no_keyword, Name, ('#pop', 'type-struct-sep', 'type', 'colon')),
697
+ include('class-body'),
698
+ ],
699
+
700
+ 'type-struct-sep': [
701
+ include('spaces'),
702
+ (r'\}', Punctuation, '#pop'),
703
+ (r',', Punctuation, ('#pop', 'type-struct')),
704
+ ],
705
+
706
+ # type-param can be a normal type or a constant literal...
707
+ 'type-param-type': [
708
+ # Float
709
+ (r'\.[0-9]+', Number.Float, '#pop'),
710
+ (r'[0-9]+[eE][+\-]?[0-9]+', Number.Float, '#pop'),
711
+ (r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float, '#pop'),
712
+ (r'[0-9]+\.[0-9]+', Number.Float, '#pop'),
713
+ (r'[0-9]+\.(?!' + ident + r'|\.\.)', Number.Float, '#pop'),
714
+
715
+ # Int
716
+ (r'0x[0-9a-fA-F]+', Number.Hex, '#pop'),
717
+ (r'[0-9]+', Number.Integer, '#pop'),
718
+
719
+ # String
720
+ (r"'", String.Single, ('#pop', 'string-single')),
721
+ (r'"', String.Double, ('#pop', 'string-double')),
722
+
723
+ # EReg
724
+ (r'~/(\\\\|\\[^\\]|[^/\\\n])*/[gim]*', String.Regex, '#pop'),
725
+
726
+ # Array
727
+ (r'\[', Operator, ('#pop', 'array-decl')),
728
+
729
+ include('type'),
730
+ ],
731
+
732
+ # type-param part of a type
733
+ # ie. the <A,B> path in Map<A,B>
734
+ 'type-param': [
735
+ include('spaces'),
736
+ default(('#pop', 'type-param-sep', 'type-param-type')),
737
+ ],
738
+
739
+ 'type-param-sep': [
740
+ include('spaces'),
741
+ (r'>', Punctuation, '#pop'),
742
+ (r',', Punctuation, ('#pop', 'type-param')),
743
+ ],
744
+
745
+ # optional type-param that may include constraint
746
+ # ie. <T:Constraint, T2:(ConstraintA,ConstraintB)>
747
+ 'type-param-constraint': [
748
+ include('spaces'),
749
+ (r'<(?!=)', Punctuation, ('#pop', 'type-param-constraint-sep',
750
+ 'type-param-constraint-flag', 'type-name')),
751
+ default('#pop'),
752
+ ],
753
+
754
+ 'type-param-constraint-sep': [
755
+ include('spaces'),
756
+ (r'>', Punctuation, '#pop'),
757
+ (r',', Punctuation, ('#pop', 'type-param-constraint-sep',
758
+ 'type-param-constraint-flag', 'type-name')),
759
+ ],
760
+
761
+ # the optional constraint inside type-param
762
+ 'type-param-constraint-flag': [
763
+ include('spaces'),
764
+ (r':', Punctuation, ('#pop', 'type-param-constraint-flag-type')),
765
+ default('#pop'),
766
+ ],
767
+
768
+ 'type-param-constraint-flag-type': [
769
+ include('spaces'),
770
+ (r'\(', Punctuation, ('#pop', 'type-param-constraint-flag-type-sep',
771
+ 'type')),
772
+ default(('#pop', 'type')),
773
+ ],
774
+
775
+ 'type-param-constraint-flag-type-sep': [
776
+ include('spaces'),
777
+ (r'\)', Punctuation, '#pop'),
778
+ (r',', Punctuation, 'type'),
779
+ ],
780
+
781
+ # a parenthesis expr that contain exactly one expr
782
+ 'parenthesis': [
783
+ include('spaces'),
784
+ default(('#pop', 'parenthesis-close', 'flag', 'expr')),
785
+ ],
786
+
787
+ 'parenthesis-open': [
788
+ include('spaces'),
789
+ (r'\(', Punctuation, '#pop'),
790
+ ],
791
+
792
+ 'parenthesis-close': [
793
+ include('spaces'),
794
+ (r'\)', Punctuation, '#pop'),
795
+ ],
796
+
797
+ 'var': [
798
+ include('spaces'),
799
+ (ident_no_keyword, Text, ('#pop', 'var-sep', 'assign', 'flag', 'prop-get-set')),
800
+ ],
801
+
802
+ # optional more var decl.
803
+ 'var-sep': [
804
+ include('spaces'),
805
+ (r',', Punctuation, ('#pop', 'var')),
806
+ default('#pop'),
807
+ ],
808
+
809
+ # optional assignment
810
+ 'assign': [
811
+ include('spaces'),
812
+ (r'=', Operator, ('#pop', 'expr')),
813
+ default('#pop'),
814
+ ],
815
+
816
+ # optional type flag
817
+ 'flag': [
818
+ include('spaces'),
819
+ (r':', Punctuation, ('#pop', 'type')),
820
+ default('#pop'),
821
+ ],
822
+
823
+ # colon as part of a ternary operator (?:)
824
+ 'ternary': [
825
+ include('spaces'),
826
+ (r':', Operator, '#pop'),
827
+ ],
828
+
829
+ # function call
830
+ 'call': [
831
+ include('spaces'),
832
+ (r'\)', Punctuation, '#pop'),
833
+ default(('#pop', 'call-sep', 'expr')),
834
+ ],
835
+
836
+ # after a call param
837
+ 'call-sep': [
838
+ include('spaces'),
839
+ (r'\)', Punctuation, '#pop'),
840
+ (r',', Punctuation, ('#pop', 'call')),
841
+ ],
842
+
843
+ # bracket can be block or object
844
+ 'bracket': [
845
+ include('spaces'),
846
+ (r'(?!(?:\$\s*[a-z]\b|\$(?!'+ident+')))' + ident_no_keyword, Name,
847
+ ('#pop', 'bracket-check')),
848
+ (r"'", String.Single, ('#pop', 'bracket-check', 'string-single')),
849
+ (r'"', String.Double, ('#pop', 'bracket-check', 'string-double')),
850
+ default(('#pop', 'block')),
851
+ ],
852
+
853
+ 'bracket-check': [
854
+ include('spaces'),
855
+ (r':', Punctuation, ('#pop', 'object-sep', 'expr')), # is object
856
+ default(('#pop', 'block', 'optional-semicolon', 'expr-chain')), # is block
857
+ ],
858
+
859
+ # code block
860
+ 'block': [
861
+ include('spaces'),
862
+ (r'\}', Punctuation, '#pop'),
863
+ default('expr-statement'),
864
+ ],
865
+
866
+ # object in key-value pairs
867
+ 'object': [
868
+ include('spaces'),
869
+ (r'\}', Punctuation, '#pop'),
870
+ default(('#pop', 'object-sep', 'expr', 'colon', 'ident-or-string'))
871
+ ],
872
+
873
+ # a key of an object
874
+ 'ident-or-string': [
875
+ include('spaces'),
876
+ (ident_no_keyword, Name, '#pop'),
877
+ (r"'", String.Single, ('#pop', 'string-single')),
878
+ (r'"', String.Double, ('#pop', 'string-double')),
879
+ ],
880
+
881
+ # after a key-value pair in object
882
+ 'object-sep': [
883
+ include('spaces'),
884
+ (r'\}', Punctuation, '#pop'),
885
+ (r',', Punctuation, ('#pop', 'object')),
886
+ ],
887
+
888
+
889
+
890
+ }
891
+
892
+ def analyse_text(text):
893
+ if re.match(r'\w+\s*:\s*\w', text):
894
+ return 0.3
895
+
896
+
897
+ class HxmlLexer(RegexLexer):
898
+ """
899
+ Lexer for `haXe build <http://haxe.org/doc/compiler>`_ files.
900
+
901
+ .. versionadded:: 1.6
902
+ """
903
+ name = 'Hxml'
904
+ aliases = ['haxeml', 'hxml']
905
+ filenames = ['*.hxml']
906
+
907
+ tokens = {
908
+ 'root': [
909
+ # Seperator
910
+ (r'(--)(next)', bygroups(Punctuation, Generic.Heading)),
911
+ # Compiler switches with one dash
912
+ (r'(-)(prompt|debug|v)', bygroups(Punctuation, Keyword.Keyword)),
913
+ # Compilerswitches with two dashes
914
+ (r'(--)(neko-source|flash-strict|flash-use-stage|no-opt|no-traces|'
915
+ r'no-inline|times|no-output)', bygroups(Punctuation, Keyword)),
916
+ # Targets and other options that take an argument
917
+ (r'(-)(cpp|js|neko|x|as3|swf9?|swf-lib|php|xml|main|lib|D|resource|'
918
+ r'cp|cmd)( +)(.+)',
919
+ bygroups(Punctuation, Keyword, Whitespace, String)),
920
+ # Options that take only numerical arguments
921
+ (r'(-)(swf-version)( +)(\d+)',
922
+ bygroups(Punctuation, Keyword, Number.Integer)),
923
+ # An Option that defines the size, the fps and the background
924
+ # color of an flash movie
925
+ (r'(-)(swf-header)( +)(\d+)(:)(\d+)(:)(\d+)(:)([A-Fa-f0-9]{6})',
926
+ bygroups(Punctuation, Keyword, Whitespace, Number.Integer,
927
+ Punctuation, Number.Integer, Punctuation, Number.Integer,
928
+ Punctuation, Number.Hex)),
929
+ # options with two dashes that takes arguments
930
+ (r'(--)(js-namespace|php-front|php-lib|remap|gen-hx-classes)( +)'
931
+ r'(.+)', bygroups(Punctuation, Keyword, Whitespace, String)),
932
+ # Single line comment, multiline ones are not allowed.
933
+ (r'#.*', Comment.Single)
934
+ ]
935
+ }