pygments.rb 2.4.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (349) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +8 -8
  3. data/.github/workflows/release.yml +5 -5
  4. data/.gitignore +2 -0
  5. data/.rubocop.yml +1 -1
  6. data/CHANGELOG.adoc +12 -0
  7. data/README.adoc +2 -2
  8. data/lib/pygments/popen.rb +2 -2
  9. data/lib/pygments/version.rb +1 -1
  10. data/pygments.rb.gemspec +3 -3
  11. data/vendor/pygments-main/bin/pygmentize +1 -1
  12. data/vendor/pygments-main/pygments/__init__.py +2 -2
  13. data/vendor/pygments-main/pygments/__main__.py +1 -1
  14. data/vendor/pygments-main/pygments/cmdline.py +12 -12
  15. data/vendor/pygments-main/pygments/console.py +5 -5
  16. data/vendor/pygments-main/pygments/filter.py +2 -3
  17. data/vendor/pygments-main/pygments/filters/__init__.py +4 -4
  18. data/vendor/pygments-main/pygments/formatter.py +6 -1
  19. data/vendor/pygments-main/pygments/formatters/__init__.py +7 -8
  20. data/vendor/pygments-main/pygments/formatters/_mapping.py +0 -0
  21. data/vendor/pygments-main/pygments/formatters/bbcode.py +2 -2
  22. data/vendor/pygments-main/pygments/formatters/groff.py +3 -3
  23. data/vendor/pygments-main/pygments/formatters/html.py +38 -40
  24. data/vendor/pygments-main/pygments/formatters/img.py +51 -11
  25. data/vendor/pygments-main/pygments/formatters/irc.py +1 -1
  26. data/vendor/pygments-main/pygments/formatters/latex.py +24 -27
  27. data/vendor/pygments-main/pygments/formatters/other.py +3 -4
  28. data/vendor/pygments-main/pygments/formatters/pangomarkup.py +2 -2
  29. data/vendor/pygments-main/pygments/formatters/rtf.py +228 -25
  30. data/vendor/pygments-main/pygments/formatters/svg.py +17 -20
  31. data/vendor/pygments-main/pygments/formatters/terminal.py +1 -1
  32. data/vendor/pygments-main/pygments/formatters/terminal256.py +1 -1
  33. data/vendor/pygments-main/pygments/lexer.py +51 -33
  34. data/vendor/pygments-main/pygments/lexers/__init__.py +12 -12
  35. data/vendor/pygments-main/pygments/lexers/_ada_builtins.py +1 -1
  36. data/vendor/pygments-main/pygments/lexers/_asy_builtins.py +1 -1
  37. data/vendor/pygments-main/pygments/lexers/_cl_builtins.py +1 -1
  38. data/vendor/pygments-main/pygments/lexers/_cocoa_builtins.py +2 -2
  39. data/vendor/pygments-main/pygments/lexers/_csound_builtins.py +1 -1
  40. data/vendor/pygments-main/pygments/lexers/_css_builtins.py +1 -1
  41. data/vendor/pygments-main/pygments/lexers/_julia_builtins.py +1 -1
  42. data/vendor/pygments-main/pygments/lexers/_lasso_builtins.py +1 -1
  43. data/vendor/pygments-main/pygments/lexers/_lilypond_builtins.py +1 -1
  44. data/vendor/pygments-main/pygments/lexers/_lua_builtins.py +5 -5
  45. data/vendor/pygments-main/pygments/lexers/_luau_builtins.py +62 -0
  46. data/vendor/pygments-main/pygments/lexers/_mapping.py +41 -11
  47. data/vendor/pygments-main/pygments/lexers/_mql_builtins.py +1 -1
  48. data/vendor/pygments-main/pygments/lexers/_mysql_builtins.py +3 -3
  49. data/vendor/pygments-main/pygments/lexers/_openedge_builtins.py +1 -1
  50. data/vendor/pygments-main/pygments/lexers/_php_builtins.py +3 -3
  51. data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +5 -5
  52. data/vendor/pygments-main/pygments/lexers/_qlik_builtins.py +1 -1
  53. data/vendor/pygments-main/pygments/lexers/_scheme_builtins.py +1 -1
  54. data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +4 -4
  55. data/vendor/pygments-main/pygments/lexers/_sourcemod_builtins.py +3 -3
  56. data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +1 -1
  57. data/vendor/pygments-main/pygments/lexers/_stata_builtins.py +1 -1
  58. data/vendor/pygments-main/pygments/lexers/_tsql_builtins.py +1 -1
  59. data/vendor/pygments-main/pygments/lexers/_usd_builtins.py +1 -1
  60. data/vendor/pygments-main/pygments/lexers/_vbscript_builtins.py +1 -1
  61. data/vendor/pygments-main/pygments/lexers/_vim_builtins.py +1 -1
  62. data/vendor/pygments-main/pygments/lexers/actionscript.py +6 -8
  63. data/vendor/pygments-main/pygments/lexers/ada.py +3 -3
  64. data/vendor/pygments-main/pygments/lexers/agile.py +3 -1
  65. data/vendor/pygments-main/pygments/lexers/algebra.py +9 -13
  66. data/vendor/pygments-main/pygments/lexers/ambient.py +2 -3
  67. data/vendor/pygments-main/pygments/lexers/amdgpu.py +3 -3
  68. data/vendor/pygments-main/pygments/lexers/ampl.py +2 -3
  69. data/vendor/pygments-main/pygments/lexers/apdlexer.py +4 -3
  70. data/vendor/pygments-main/pygments/lexers/apl.py +2 -3
  71. data/vendor/pygments-main/pygments/lexers/archetype.py +8 -12
  72. data/vendor/pygments-main/pygments/lexers/arrow.py +2 -3
  73. data/vendor/pygments-main/pygments/lexers/arturo.py +2 -3
  74. data/vendor/pygments-main/pygments/lexers/asc.py +4 -4
  75. data/vendor/pygments-main/pygments/lexers/asm.py +28 -15
  76. data/vendor/pygments-main/pygments/lexers/asn1.py +178 -0
  77. data/vendor/pygments-main/pygments/lexers/automation.py +6 -8
  78. data/vendor/pygments-main/pygments/lexers/bare.py +2 -3
  79. data/vendor/pygments-main/pygments/lexers/basic.py +48 -57
  80. data/vendor/pygments-main/pygments/lexers/bdd.py +3 -4
  81. data/vendor/pygments-main/pygments/lexers/berry.py +4 -4
  82. data/vendor/pygments-main/pygments/lexers/bibtex.py +5 -5
  83. data/vendor/pygments-main/pygments/lexers/blueprint.py +173 -0
  84. data/vendor/pygments-main/pygments/lexers/boa.py +4 -4
  85. data/vendor/pygments-main/pygments/lexers/bqn.py +109 -0
  86. data/vendor/pygments-main/pygments/lexers/business.py +21 -22
  87. data/vendor/pygments-main/pygments/lexers/c_cpp.py +9 -4
  88. data/vendor/pygments-main/pygments/lexers/c_like.py +99 -27
  89. data/vendor/pygments-main/pygments/lexers/capnproto.py +2 -3
  90. data/vendor/pygments-main/pygments/lexers/carbon.py +10 -11
  91. data/vendor/pygments-main/pygments/lexers/cddl.py +8 -9
  92. data/vendor/pygments-main/pygments/lexers/chapel.py +2 -3
  93. data/vendor/pygments-main/pygments/lexers/clean.py +2 -1
  94. data/vendor/pygments-main/pygments/lexers/comal.py +2 -1
  95. data/vendor/pygments-main/pygments/lexers/compiled.py +2 -1
  96. data/vendor/pygments-main/pygments/lexers/configs.py +342 -108
  97. data/vendor/pygments-main/pygments/lexers/console.py +5 -5
  98. data/vendor/pygments-main/pygments/lexers/cplint.py +2 -3
  99. data/vendor/pygments-main/pygments/lexers/crystal.py +4 -5
  100. data/vendor/pygments-main/pygments/lexers/csound.py +6 -8
  101. data/vendor/pygments-main/pygments/lexers/css.py +5 -5
  102. data/vendor/pygments-main/pygments/lexers/d.py +4 -3
  103. data/vendor/pygments-main/pygments/lexers/dalvik.py +2 -3
  104. data/vendor/pygments-main/pygments/lexers/data.py +8 -12
  105. data/vendor/pygments-main/pygments/lexers/dax.py +2 -3
  106. data/vendor/pygments-main/pygments/lexers/devicetree.py +2 -3
  107. data/vendor/pygments-main/pygments/lexers/diff.py +7 -6
  108. data/vendor/pygments-main/pygments/lexers/dns.py +109 -0
  109. data/vendor/pygments-main/pygments/lexers/dotnet.py +19 -14
  110. data/vendor/pygments-main/pygments/lexers/dsls.py +24 -35
  111. data/vendor/pygments-main/pygments/lexers/dylan.py +8 -16
  112. data/vendor/pygments-main/pygments/lexers/ecl.py +2 -3
  113. data/vendor/pygments-main/pygments/lexers/eiffel.py +3 -4
  114. data/vendor/pygments-main/pygments/lexers/elm.py +3 -4
  115. data/vendor/pygments-main/pygments/lexers/elpi.py +28 -21
  116. data/vendor/pygments-main/pygments/lexers/email.py +3 -3
  117. data/vendor/pygments-main/pygments/lexers/erlang.py +22 -24
  118. data/vendor/pygments-main/pygments/lexers/esoteric.py +11 -12
  119. data/vendor/pygments-main/pygments/lexers/ezhil.py +2 -3
  120. data/vendor/pygments-main/pygments/lexers/factor.py +2 -3
  121. data/vendor/pygments-main/pygments/lexers/fantom.py +3 -3
  122. data/vendor/pygments-main/pygments/lexers/felix.py +9 -10
  123. data/vendor/pygments-main/pygments/lexers/fift.py +2 -1
  124. data/vendor/pygments-main/pygments/lexers/floscript.py +2 -3
  125. data/vendor/pygments-main/pygments/lexers/forth.py +2 -3
  126. data/vendor/pygments-main/pygments/lexers/fortran.py +6 -7
  127. data/vendor/pygments-main/pygments/lexers/foxpro.py +3 -3
  128. data/vendor/pygments-main/pygments/lexers/freefem.py +2 -3
  129. data/vendor/pygments-main/pygments/lexers/func.py +3 -1
  130. data/vendor/pygments-main/pygments/lexers/functional.py +2 -1
  131. data/vendor/pygments-main/pygments/lexers/futhark.py +6 -7
  132. data/vendor/pygments-main/pygments/lexers/gcodelexer.py +3 -3
  133. data/vendor/pygments-main/pygments/lexers/gdscript.py +2 -1
  134. data/vendor/pygments-main/pygments/lexers/go.py +3 -4
  135. data/vendor/pygments-main/pygments/lexers/grammar_notation.py +6 -9
  136. data/vendor/pygments-main/pygments/lexers/graph.py +12 -9
  137. data/vendor/pygments-main/pygments/lexers/graphics.py +13 -17
  138. data/vendor/pygments-main/pygments/lexers/graphql.py +176 -0
  139. data/vendor/pygments-main/pygments/lexers/graphviz.py +2 -3
  140. data/vendor/pygments-main/pygments/lexers/gsql.py +2 -3
  141. data/vendor/pygments-main/pygments/lexers/haskell.py +27 -32
  142. data/vendor/pygments-main/pygments/lexers/haxe.py +3 -5
  143. data/vendor/pygments-main/pygments/lexers/hdl.py +8 -7
  144. data/vendor/pygments-main/pygments/lexers/hexdump.py +3 -3
  145. data/vendor/pygments-main/pygments/lexers/html.py +34 -13
  146. data/vendor/pygments-main/pygments/lexers/idl.py +2 -3
  147. data/vendor/pygments-main/pygments/lexers/igor.py +305 -290
  148. data/vendor/pygments-main/pygments/lexers/inferno.py +2 -3
  149. data/vendor/pygments-main/pygments/lexers/installers.py +7 -9
  150. data/vendor/pygments-main/pygments/lexers/int_fiction.py +150 -162
  151. data/vendor/pygments-main/pygments/lexers/iolang.py +2 -3
  152. data/vendor/pygments-main/pygments/lexers/j.py +2 -3
  153. data/vendor/pygments-main/pygments/lexers/javascript.py +18 -19
  154. data/vendor/pygments-main/pygments/lexers/jmespath.py +2 -1
  155. data/vendor/pygments-main/pygments/lexers/jslt.py +2 -3
  156. data/vendor/pygments-main/pygments/lexers/jsonnet.py +4 -3
  157. data/vendor/pygments-main/pygments/lexers/jsx.py +75 -0
  158. data/vendor/pygments-main/pygments/lexers/julia.py +4 -5
  159. data/vendor/pygments-main/pygments/lexers/jvm.py +98 -116
  160. data/vendor/pygments-main/pygments/lexers/kuin.py +2 -3
  161. data/vendor/pygments-main/pygments/lexers/kusto.py +93 -0
  162. data/vendor/pygments-main/pygments/lexers/ldap.py +155 -0
  163. data/vendor/pygments-main/pygments/lexers/lean.py +241 -0
  164. data/vendor/pygments-main/pygments/lexers/lilypond.py +2 -3
  165. data/vendor/pygments-main/pygments/lexers/lisp.py +373 -65
  166. data/vendor/pygments-main/pygments/lexers/macaulay2.py +53 -4
  167. data/vendor/pygments-main/pygments/lexers/make.py +7 -5
  168. data/vendor/pygments-main/pygments/lexers/markup.py +242 -91
  169. data/vendor/pygments-main/pygments/lexers/math.py +2 -1
  170. data/vendor/pygments-main/pygments/lexers/matlab.py +10 -12
  171. data/vendor/pygments-main/pygments/lexers/maxima.py +2 -3
  172. data/vendor/pygments-main/pygments/lexers/meson.py +2 -3
  173. data/vendor/pygments-main/pygments/lexers/mime.py +4 -4
  174. data/vendor/pygments-main/pygments/lexers/minecraft.py +24 -27
  175. data/vendor/pygments-main/pygments/lexers/mips.py +3 -1
  176. data/vendor/pygments-main/pygments/lexers/ml.py +59 -61
  177. data/vendor/pygments-main/pygments/lexers/modeling.py +19 -22
  178. data/vendor/pygments-main/pygments/lexers/modula2.py +2 -3
  179. data/vendor/pygments-main/pygments/lexers/mojo.py +704 -0
  180. data/vendor/pygments-main/pygments/lexers/monte.py +2 -3
  181. data/vendor/pygments-main/pygments/lexers/mosel.py +3 -3
  182. data/vendor/pygments-main/pygments/lexers/ncl.py +4 -3
  183. data/vendor/pygments-main/pygments/lexers/nimrod.py +7 -8
  184. data/vendor/pygments-main/pygments/lexers/nit.py +2 -3
  185. data/vendor/pygments-main/pygments/lexers/nix.py +40 -31
  186. data/vendor/pygments-main/pygments/lexers/oberon.py +3 -3
  187. data/vendor/pygments-main/pygments/lexers/objective.py +14 -6
  188. data/vendor/pygments-main/pygments/lexers/ooc.py +2 -3
  189. data/vendor/pygments-main/pygments/lexers/openscad.py +96 -0
  190. data/vendor/pygments-main/pygments/lexers/other.py +2 -1
  191. data/vendor/pygments-main/pygments/lexers/parasail.py +2 -3
  192. data/vendor/pygments-main/pygments/lexers/parsers.py +41 -44
  193. data/vendor/pygments-main/pygments/lexers/pascal.py +6 -3
  194. data/vendor/pygments-main/pygments/lexers/pawn.py +5 -5
  195. data/vendor/pygments-main/pygments/lexers/perl.py +3 -3
  196. data/vendor/pygments-main/pygments/lexers/phix.py +2 -3
  197. data/vendor/pygments-main/pygments/lexers/php.py +4 -5
  198. data/vendor/pygments-main/pygments/lexers/pointless.py +2 -3
  199. data/vendor/pygments-main/pygments/lexers/pony.py +3 -3
  200. data/vendor/pygments-main/pygments/lexers/praat.py +2 -3
  201. data/vendor/pygments-main/pygments/lexers/procfile.py +2 -3
  202. data/vendor/pygments-main/pygments/lexers/prolog.py +23 -9
  203. data/vendor/pygments-main/pygments/lexers/promql.py +2 -1
  204. data/vendor/pygments-main/pygments/lexers/prql.py +251 -0
  205. data/vendor/pygments-main/pygments/lexers/ptx.py +119 -0
  206. data/vendor/pygments-main/pygments/lexers/python.py +24 -24
  207. data/vendor/pygments-main/pygments/lexers/q.py +5 -6
  208. data/vendor/pygments-main/pygments/lexers/qlik.py +3 -3
  209. data/vendor/pygments-main/pygments/lexers/qvt.py +5 -3
  210. data/vendor/pygments-main/pygments/lexers/r.py +8 -6
  211. data/vendor/pygments-main/pygments/lexers/rdf.py +19 -13
  212. data/vendor/pygments-main/pygments/lexers/rebol.py +7 -7
  213. data/vendor/pygments-main/pygments/lexers/resource.py +5 -6
  214. data/vendor/pygments-main/pygments/lexers/ride.py +4 -5
  215. data/vendor/pygments-main/pygments/lexers/rita.py +2 -3
  216. data/vendor/pygments-main/pygments/lexers/rnc.py +2 -3
  217. data/vendor/pygments-main/pygments/lexers/roboconf.py +5 -5
  218. data/vendor/pygments-main/pygments/lexers/robotframework.py +2 -3
  219. data/vendor/pygments-main/pygments/lexers/ruby.py +8 -13
  220. data/vendor/pygments-main/pygments/lexers/rust.py +9 -10
  221. data/vendor/pygments-main/pygments/lexers/sas.py +3 -3
  222. data/vendor/pygments-main/pygments/lexers/savi.py +131 -130
  223. data/vendor/pygments-main/pygments/lexers/scdoc.py +13 -7
  224. data/vendor/pygments-main/pygments/lexers/scripting.py +354 -42
  225. data/vendor/pygments-main/pygments/lexers/sgf.py +2 -3
  226. data/vendor/pygments-main/pygments/lexers/shell.py +107 -129
  227. data/vendor/pygments-main/pygments/lexers/sieve.py +3 -3
  228. data/vendor/pygments-main/pygments/lexers/slash.py +4 -5
  229. data/vendor/pygments-main/pygments/lexers/smalltalk.py +3 -5
  230. data/vendor/pygments-main/pygments/lexers/smithy.py +2 -3
  231. data/vendor/pygments-main/pygments/lexers/smv.py +3 -3
  232. data/vendor/pygments-main/pygments/lexers/snobol.py +3 -3
  233. data/vendor/pygments-main/pygments/lexers/solidity.py +3 -3
  234. data/vendor/pygments-main/pygments/lexers/soong.py +78 -0
  235. data/vendor/pygments-main/pygments/lexers/sophia.py +3 -4
  236. data/vendor/pygments-main/pygments/lexers/special.py +8 -3
  237. data/vendor/pygments-main/pygments/lexers/spice.py +15 -16
  238. data/vendor/pygments-main/pygments/lexers/sql.py +24 -18
  239. data/vendor/pygments-main/pygments/lexers/srcinfo.py +3 -3
  240. data/vendor/pygments-main/pygments/lexers/stata.py +2 -3
  241. data/vendor/pygments-main/pygments/lexers/supercollider.py +2 -3
  242. data/vendor/pygments-main/pygments/lexers/tact.py +303 -0
  243. data/vendor/pygments-main/pygments/lexers/tal.py +13 -10
  244. data/vendor/pygments-main/pygments/lexers/tcl.py +2 -3
  245. data/vendor/pygments-main/pygments/lexers/teal.py +2 -3
  246. data/vendor/pygments-main/pygments/lexers/templates.py +131 -72
  247. data/vendor/pygments-main/pygments/lexers/teraterm.py +2 -3
  248. data/vendor/pygments-main/pygments/lexers/testing.py +4 -5
  249. data/vendor/pygments-main/pygments/lexers/text.py +2 -1
  250. data/vendor/pygments-main/pygments/lexers/textedit.py +9 -6
  251. data/vendor/pygments-main/pygments/lexers/textfmts.py +20 -15
  252. data/vendor/pygments-main/pygments/lexers/theorem.py +41 -115
  253. data/vendor/pygments-main/pygments/lexers/thingsdb.py +50 -26
  254. data/vendor/pygments-main/pygments/lexers/tlb.py +3 -1
  255. data/vendor/pygments-main/pygments/lexers/tls.py +54 -0
  256. data/vendor/pygments-main/pygments/lexers/tnt.py +2 -3
  257. data/vendor/pygments-main/pygments/lexers/trafficscript.py +3 -3
  258. data/vendor/pygments-main/pygments/lexers/typoscript.py +6 -7
  259. data/vendor/pygments-main/pygments/lexers/typst.py +104 -0
  260. data/vendor/pygments-main/pygments/lexers/ul4.py +47 -5
  261. data/vendor/pygments-main/pygments/lexers/unicon.py +9 -7
  262. data/vendor/pygments-main/pygments/lexers/urbi.py +3 -3
  263. data/vendor/pygments-main/pygments/lexers/usd.py +6 -11
  264. data/vendor/pygments-main/pygments/lexers/varnish.py +5 -5
  265. data/vendor/pygments-main/pygments/lexers/verification.py +4 -5
  266. data/vendor/pygments-main/pygments/lexers/verifpal.py +65 -0
  267. data/vendor/pygments-main/pygments/lexers/vip.py +150 -0
  268. data/vendor/pygments-main/pygments/lexers/vyper.py +140 -0
  269. data/vendor/pygments-main/pygments/lexers/web.py +2 -1
  270. data/vendor/pygments-main/pygments/lexers/webassembly.py +2 -3
  271. data/vendor/pygments-main/pygments/lexers/webidl.py +2 -3
  272. data/vendor/pygments-main/pygments/lexers/webmisc.py +11 -15
  273. data/vendor/pygments-main/pygments/lexers/wgsl.py +6 -7
  274. data/vendor/pygments-main/pygments/lexers/whiley.py +2 -3
  275. data/vendor/pygments-main/pygments/lexers/wowtoc.py +3 -3
  276. data/vendor/pygments-main/pygments/lexers/wren.py +3 -4
  277. data/vendor/pygments-main/pygments/lexers/x10.py +6 -7
  278. data/vendor/pygments-main/pygments/lexers/xorg.py +2 -1
  279. data/vendor/pygments-main/pygments/lexers/yang.py +2 -3
  280. data/vendor/pygments-main/pygments/lexers/yara.py +69 -0
  281. data/vendor/pygments-main/pygments/lexers/zig.py +2 -1
  282. data/vendor/pygments-main/pygments/modeline.py +4 -4
  283. data/vendor/pygments-main/pygments/plugin.py +3 -19
  284. data/vendor/pygments-main/pygments/regexopt.py +1 -1
  285. data/vendor/pygments-main/pygments/scanner.py +1 -1
  286. data/vendor/pygments-main/pygments/sphinxext.py +38 -8
  287. data/vendor/pygments-main/pygments/style.py +8 -2
  288. data/vendor/pygments-main/pygments/styles/__init__.py +17 -59
  289. data/vendor/pygments-main/pygments/styles/_mapping.py +54 -0
  290. data/vendor/pygments-main/pygments/styles/abap.py +5 -1
  291. data/vendor/pygments-main/pygments/styles/algol.py +5 -1
  292. data/vendor/pygments-main/pygments/styles/algol_nu.py +5 -1
  293. data/vendor/pygments-main/pygments/styles/arduino.py +76 -72
  294. data/vendor/pygments-main/pygments/styles/autumn.py +6 -1
  295. data/vendor/pygments-main/pygments/styles/borland.py +6 -1
  296. data/vendor/pygments-main/pygments/styles/bw.py +6 -1
  297. data/vendor/pygments-main/pygments/styles/coffee.py +80 -0
  298. data/vendor/pygments-main/pygments/styles/colorful.py +6 -1
  299. data/vendor/pygments-main/pygments/styles/default.py +6 -1
  300. data/vendor/pygments-main/pygments/styles/dracula.py +68 -80
  301. data/vendor/pygments-main/pygments/styles/emacs.py +6 -1
  302. data/vendor/pygments-main/pygments/styles/friendly.py +6 -1
  303. data/vendor/pygments-main/pygments/styles/friendly_grayscale.py +6 -1
  304. data/vendor/pygments-main/pygments/styles/fruity.py +7 -1
  305. data/vendor/pygments-main/pygments/styles/gh_dark.py +7 -1
  306. data/vendor/pygments-main/pygments/styles/gruvbox.py +10 -1
  307. data/vendor/pygments-main/pygments/styles/igor.py +6 -1
  308. data/vendor/pygments-main/pygments/styles/inkpot.py +7 -2
  309. data/vendor/pygments-main/pygments/styles/lightbulb.py +110 -0
  310. data/vendor/pygments-main/pygments/styles/lilypond.py +8 -2
  311. data/vendor/pygments-main/pygments/styles/lovelace.py +16 -10
  312. data/vendor/pygments-main/pygments/styles/manni.py +7 -2
  313. data/vendor/pygments-main/pygments/styles/material.py +21 -14
  314. data/vendor/pygments-main/pygments/styles/monokai.py +16 -10
  315. data/vendor/pygments-main/pygments/styles/murphy.py +7 -2
  316. data/vendor/pygments-main/pygments/styles/native.py +10 -5
  317. data/vendor/pygments-main/pygments/styles/nord.py +9 -3
  318. data/vendor/pygments-main/pygments/styles/onedark.py +6 -2
  319. data/vendor/pygments-main/pygments/styles/paraiso_dark.py +7 -2
  320. data/vendor/pygments-main/pygments/styles/paraiso_light.py +7 -2
  321. data/vendor/pygments-main/pygments/styles/pastie.py +7 -1
  322. data/vendor/pygments-main/pygments/styles/perldoc.py +7 -1
  323. data/vendor/pygments-main/pygments/styles/rainbow_dash.py +26 -19
  324. data/vendor/pygments-main/pygments/styles/rrt.py +8 -2
  325. data/vendor/pygments-main/pygments/styles/sas.py +6 -1
  326. data/vendor/pygments-main/pygments/styles/solarized.py +9 -1
  327. data/vendor/pygments-main/pygments/styles/staroffice.py +6 -1
  328. data/vendor/pygments-main/pygments/styles/stata_dark.py +6 -2
  329. data/vendor/pygments-main/pygments/styles/stata_light.py +6 -1
  330. data/vendor/pygments-main/pygments/styles/tango.py +7 -3
  331. data/vendor/pygments-main/pygments/styles/trac.py +7 -1
  332. data/vendor/pygments-main/pygments/styles/vim.py +7 -1
  333. data/vendor/pygments-main/pygments/styles/vs.py +7 -2
  334. data/vendor/pygments-main/pygments/styles/xcode.py +6 -1
  335. data/vendor/pygments-main/pygments/styles/zenburn.py +6 -1
  336. data/vendor/pygments-main/pygments/token.py +2 -1
  337. data/vendor/pygments-main/pygments/unistring.py +5 -5
  338. data/vendor/pygments-main/pygments/util.py +13 -19
  339. data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info}/METADATA +14 -13
  340. data/vendor/pygments-main/pygments-2.18.0.dist-info/RECORD +663 -0
  341. data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info}/WHEEL +1 -2
  342. data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info/licenses}/AUTHORS +13 -0
  343. metadata +41 -17
  344. data/vendor/pygments-main/Pygments-2.15.1.dist-info/RECORD +0 -614
  345. data/vendor/pygments-main/Pygments-2.15.1.dist-info/top_level.txt +0 -1
  346. /data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info}/INSTALLER +0 -0
  347. /data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info}/REQUESTED +0 -0
  348. /data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info}/entry_points.txt +0 -0
  349. /data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info/licenses}/LICENSE +0 -0
@@ -4,7 +4,7 @@
4
4
 
5
5
  Lexers for configuration file formats.
6
6
 
7
- :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
7
+ :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
8
8
  :license: BSD, see LICENSE for details.
9
9
  """
10
10
 
@@ -17,8 +17,8 @@ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
17
17
  from pygments.lexers.shell import BashLexer
18
18
  from pygments.lexers.data import JsonLexer
19
19
 
20
- __all__ = ['IniLexer', 'RegeditLexer', 'PropertiesLexer', 'KconfigLexer',
21
- 'Cfengine3Lexer', 'ApacheConfLexer', 'SquidConfLexer',
20
+ __all__ = ['IniLexer', 'SystemdLexer', 'DesktopLexer', 'RegeditLexer', 'PropertiesLexer',
21
+ 'KconfigLexer', 'Cfengine3Lexer', 'ApacheConfLexer', 'SquidConfLexer',
22
22
  'NginxConfLexer', 'LighttpdConfLexer', 'DockerLexer',
23
23
  'TerraformLexer', 'TermcapLexer', 'TerminfoLexer',
24
24
  'PkgConfigLexer', 'PacmanConfLexer', 'AugeasLexer', 'TOMLLexer',
@@ -34,12 +34,10 @@ class IniLexer(RegexLexer):
34
34
  aliases = ['ini', 'cfg', 'dosini']
35
35
  filenames = [
36
36
  '*.ini', '*.cfg', '*.inf', '.editorconfig',
37
- # systemd unit files
38
- # https://www.freedesktop.org/software/systemd/man/systemd.unit.html
39
- '*.service', '*.socket', '*.device', '*.mount', '*.automount',
40
- '*.swap', '*.target', '*.path', '*.timer', '*.slice', '*.scope',
41
37
  ]
42
38
  mimetypes = ['text/x-ini', 'text/inf']
39
+ url = 'https://en.wikipedia.org/wiki/INI_file'
40
+ version_added = ''
43
41
 
44
42
  tokens = {
45
43
  'root': [
@@ -67,14 +65,88 @@ class IniLexer(RegexLexer):
67
65
  npos = text.find('\n')
68
66
  if npos < 3:
69
67
  return False
70
- return text[0] == '[' and text[npos-1] == ']'
68
+ if text[0] == '[' and text[npos-1] == ']':
69
+ return 0.8
70
+ return False
71
+
72
+
73
+ class DesktopLexer(RegexLexer):
74
+ """
75
+ Lexer for .desktop files.
76
+ """
77
+
78
+ name = 'Desktop file'
79
+ url = "https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html"
80
+ aliases = ['desktop']
81
+ filenames = ['*.desktop']
82
+ mimetypes = ['application/x-desktop']
83
+ version_added = '2.16'
84
+
85
+ tokens = {
86
+ 'root': [
87
+ (r'^[ \t]*\n', Whitespace),
88
+ (r'^(#.*)(\n)', bygroups(Comment.Single, Whitespace)),
89
+ (r'(\[[^\]\n]+\])(\n)', bygroups(Keyword, Whitespace)),
90
+ (r'([-A-Za-z0-9]+)(\[[^\] \t=]+\])?([ \t]*)(=)([ \t]*)([^\n]*)([ \t\n]*\n)',
91
+ bygroups(Name.Attribute, Name.Namespace, Whitespace, Operator, Whitespace, String, Whitespace)),
92
+ ],
93
+ }
94
+
95
+ def analyse_text(text):
96
+ if text.startswith("[Desktop Entry]"):
97
+ return 1.0
98
+ if re.search(r"^\[Desktop Entry\][ \t]*$", text[:500], re.MULTILINE) is not None:
99
+ return 0.9
100
+ return 0.0
101
+
102
+
103
+ class SystemdLexer(RegexLexer):
104
+ """
105
+ Lexer for systemd unit files.
106
+ """
107
+
108
+ name = 'Systemd'
109
+ url = "https://www.freedesktop.org/software/systemd/man/systemd.syntax.html"
110
+ aliases = ['systemd']
111
+ filenames = [
112
+ '*.service', '*.socket', '*.device', '*.mount', '*.automount',
113
+ '*.swap', '*.target', '*.path', '*.timer', '*.slice', '*.scope',
114
+ ]
115
+ version_added = '2.16'
116
+
117
+ tokens = {
118
+ 'root': [
119
+ (r'^[ \t]*\n', Whitespace),
120
+ (r'^([;#].*)(\n)', bygroups(Comment.Single, Whitespace)),
121
+ (r'(\[[^\]\n]+\])(\n)', bygroups(Keyword, Whitespace)),
122
+ (r'([^=]+)([ \t]*)(=)([ \t]*)([^\n]*)(\\)(\n)',
123
+ bygroups(Name.Attribute, Whitespace, Operator, Whitespace, String,
124
+ Text, Whitespace),
125
+ "value"),
126
+ (r'([^=]+)([ \t]*)(=)([ \t]*)([^\n]*)(\n)',
127
+ bygroups(Name.Attribute, Whitespace, Operator, Whitespace, String, Whitespace)),
128
+ ],
129
+ 'value': [
130
+ # line continuation
131
+ (r'^([;#].*)(\n)', bygroups(Comment.Single, Whitespace)),
132
+ (r'([ \t]*)([^\n]*)(\\)(\n)',
133
+ bygroups(Whitespace, String, Text, Whitespace)),
134
+ (r'([ \t]*)([^\n]*)(\n)',
135
+ bygroups(Whitespace, String, Whitespace), "#pop"),
136
+ ],
137
+ }
138
+
139
+ def analyse_text(text):
140
+ if text.startswith("[Unit]"):
141
+ return 1.0
142
+ if re.search(r"^\[Unit\][ \t]*$", text[:500], re.MULTILINE) is not None:
143
+ return 0.9
144
+ return 0.0
71
145
 
72
146
 
73
147
  class RegeditLexer(RegexLexer):
74
148
  """
75
149
  Lexer for Windows Registry files produced by regedit.
76
-
77
- .. versionadded:: 1.6
78
150
  """
79
151
 
80
152
  name = 'reg'
@@ -82,6 +154,7 @@ class RegeditLexer(RegexLexer):
82
154
  aliases = ['registry']
83
155
  filenames = ['*.reg']
84
156
  mimetypes = ['text/x-windows-registry']
157
+ version_added = '1.6'
85
158
 
86
159
  tokens = {
87
160
  'root': [
@@ -118,14 +191,14 @@ class PropertiesLexer(RegexLexer):
118
191
  Lexer for configuration files in Java's properties format.
119
192
 
120
193
  Note: trailing whitespace counts as part of the value as per spec
121
-
122
- .. versionadded:: 1.4
123
194
  """
124
195
 
125
196
  name = 'Properties'
126
197
  aliases = ['properties', 'jproperties']
127
198
  filenames = ['*.properties']
128
199
  mimetypes = ['text/x-java-properties']
200
+ url = 'https://en.wikipedia.org/wiki/.properties'
201
+ version_added = '1.4'
129
202
 
130
203
  tokens = {
131
204
  'root': [
@@ -185,29 +258,30 @@ def _rx_indent(level):
185
258
  if level == 1:
186
259
  level_repeat = ''
187
260
  else:
188
- level_repeat = '{%s}' % level
189
- return r'(?:\t| %s\t| {%s})%s.*\n' % (space_repeat, tab_width, level_repeat)
261
+ level_repeat = f'{{{level}}}'
262
+ return rf'(?:\t| {space_repeat}\t| {{{tab_width}}}){level_repeat}.*\n'
190
263
 
191
264
 
192
265
  class KconfigLexer(RegexLexer):
193
266
  """
194
267
  For Linux-style Kconfig files.
195
-
196
- .. versionadded:: 1.6
197
268
  """
198
269
 
199
270
  name = 'Kconfig'
200
271
  aliases = ['kconfig', 'menuconfig', 'linux-config', 'kernel-config']
272
+ version_added = '1.6'
201
273
  # Adjust this if new kconfig file names appear in your environment
202
274
  filenames = ['Kconfig*', '*Config.in*', 'external.in*',
203
275
  'standard-modules.in']
204
276
  mimetypes = ['text/x-kconfig']
277
+ url = 'https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html'
278
+
205
279
  # No re.MULTILINE, indentation-aware help text needs line-by-line handling
206
280
  flags = 0
207
281
 
208
282
  def call_indent(level):
209
283
  # If indentation >= {level} is detected, enter state 'indent{level}'
210
- return (_rx_indent(level), String.Doc, 'indent%s' % level)
284
+ return (_rx_indent(level), String.Doc, f'indent{level}')
211
285
 
212
286
  def do_indent(level):
213
287
  # Print paragraphs of indentation level >= {level} as String.Doc,
@@ -269,8 +343,6 @@ class KconfigLexer(RegexLexer):
269
343
  class Cfengine3Lexer(RegexLexer):
270
344
  """
271
345
  Lexer for CFEngine3 policy files.
272
-
273
- .. versionadded:: 1.5
274
346
  """
275
347
 
276
348
  name = 'CFEngine3'
@@ -278,6 +350,7 @@ class Cfengine3Lexer(RegexLexer):
278
350
  aliases = ['cfengine3', 'cf3']
279
351
  filenames = ['*.cf']
280
352
  mimetypes = []
353
+ version_added = '1.5'
281
354
 
282
355
  tokens = {
283
356
  'root': [
@@ -332,14 +405,14 @@ class ApacheConfLexer(RegexLexer):
332
405
  """
333
406
  Lexer for configuration files following the Apache config file
334
407
  format.
335
-
336
- .. versionadded:: 0.6
337
408
  """
338
409
 
339
410
  name = 'ApacheConf'
340
411
  aliases = ['apacheconf', 'aconf', 'apache']
341
412
  filenames = ['.htaccess', 'apache.conf', 'apache2.conf']
342
413
  mimetypes = ['text/x-apacheconf']
414
+ url = 'https://httpd.apache.org/docs/current/configuring.html'
415
+ version_added = '0.6'
343
416
  flags = re.MULTILINE | re.IGNORECASE
344
417
 
345
418
  tokens = {
@@ -374,8 +447,6 @@ class ApacheConfLexer(RegexLexer):
374
447
  class SquidConfLexer(RegexLexer):
375
448
  """
376
449
  Lexer for squid configuration files.
377
-
378
- .. versionadded:: 0.9
379
450
  """
380
451
 
381
452
  name = 'SquidConf'
@@ -383,6 +454,7 @@ class SquidConfLexer(RegexLexer):
383
454
  aliases = ['squidconf', 'squid.conf', 'squid']
384
455
  filenames = ['squid.conf']
385
456
  mimetypes = ['text/x-squidconf']
457
+ version_added = '0.9'
386
458
  flags = re.IGNORECASE
387
459
 
388
460
  keywords = (
@@ -469,15 +541,14 @@ class SquidConfLexer(RegexLexer):
469
541
  "dst", "time", "dstdomain", "ident", "snmp_community",
470
542
  )
471
543
 
472
- ip_re = (
473
- r'(?:(?:(?:[3-9]\d?|2(?:5[0-5]|[0-4]?\d)?|1\d{0,2}|0x0*[0-9a-f]{1,2}|'
474
- r'0+[1-3]?[0-7]{0,2})(?:\.(?:[3-9]\d?|2(?:5[0-5]|[0-4]?\d)?|1\d{0,2}|'
475
- r'0x0*[0-9a-f]{1,2}|0+[1-3]?[0-7]{0,2})){3})|(?!.*::.*::)(?:(?!:)|'
476
- r':(?=:))(?:[0-9a-f]{0,4}(?:(?<=::)|(?<!::):)){6}(?:[0-9a-f]{0,4}'
477
- r'(?:(?<=::)|(?<!::):)[0-9a-f]{0,4}(?:(?<=::)|(?<!:)|(?<=:)(?<!::):)|'
478
- r'(?:25[0-4]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-4]|2[0-4]\d|1\d\d|'
479
- r'[1-9]?\d)){3}))'
480
- )
544
+ ipv4_group = r'(\d+|0x[0-9a-f]+)'
545
+ ipv4 = rf'({ipv4_group}(\.{ipv4_group}){{3}})'
546
+ ipv6_group = r'([0-9a-f]{0,4})'
547
+ ipv6 = rf'({ipv6_group}(:{ipv6_group}){{1,7}})'
548
+ bare_ip = rf'({ipv4}|{ipv6})'
549
+ # XXX: /integer is a subnet mark, but what is /IP ?
550
+ # There is no test where it is used.
551
+ ip = rf'{bare_ip}(/({bare_ip}|\d+))?'
481
552
 
482
553
  tokens = {
483
554
  'root': [
@@ -490,7 +561,7 @@ class SquidConfLexer(RegexLexer):
490
561
  (words(actions_stats, prefix=r'stats/', suffix=r'\b'), String),
491
562
  (words(actions_log, prefix=r'log/', suffix=r'='), String),
492
563
  (words(acls, prefix=r'\b', suffix=r'\b'), Keyword),
493
- (ip_re + r'(?:/(?:' + ip_re + r'|\b\d+\b))?', Number.Float),
564
+ (ip, Number.Float),
494
565
  (r'(?:\b\d+\b(?:-\b\d+|%)?)', Number),
495
566
  (r'\S+', Text),
496
567
  ],
@@ -505,14 +576,13 @@ class SquidConfLexer(RegexLexer):
505
576
  class NginxConfLexer(RegexLexer):
506
577
  """
507
578
  Lexer for Nginx configuration files.
508
-
509
- .. versionadded:: 0.11
510
579
  """
511
580
  name = 'Nginx configuration file'
512
581
  url = 'http://nginx.net/'
513
582
  aliases = ['nginx']
514
583
  filenames = ['nginx.conf']
515
584
  mimetypes = ['text/x-nginx-conf']
585
+ version_added = '0.11'
516
586
 
517
587
  tokens = {
518
588
  'root': [
@@ -552,14 +622,13 @@ class NginxConfLexer(RegexLexer):
552
622
  class LighttpdConfLexer(RegexLexer):
553
623
  """
554
624
  Lexer for Lighttpd configuration files.
555
-
556
- .. versionadded:: 0.11
557
625
  """
558
626
  name = 'Lighttpd configuration file'
559
627
  url = 'http://lighttpd.net/'
560
628
  aliases = ['lighttpd', 'lighty']
561
629
  filenames = ['lighttpd.conf']
562
630
  mimetypes = ['text/x-lighttpd-conf']
631
+ version_added = '0.11'
563
632
 
564
633
  tokens = {
565
634
  'root': [
@@ -581,14 +650,13 @@ class LighttpdConfLexer(RegexLexer):
581
650
  class DockerLexer(RegexLexer):
582
651
  """
583
652
  Lexer for Docker configuration files.
584
-
585
- .. versionadded:: 2.0
586
653
  """
587
654
  name = 'Docker'
588
655
  url = 'http://docker.io'
589
656
  aliases = ['docker', 'dockerfile']
590
657
  filenames = ['Dockerfile', '*.docker']
591
658
  mimetypes = ['text/x-dockerfile-config']
659
+ version_added = '2.0'
592
660
 
593
661
  _keywords = (r'(?:MAINTAINER|EXPOSE|WORKDIR|USER|STOPSIGNAL)')
594
662
  _bash_keywords = (r'(?:RUN|CMD|ENTRYPOINT|ENV|ARG|LABEL|ADD|COPY)')
@@ -600,15 +668,15 @@ class DockerLexer(RegexLexer):
600
668
  (r'#.*', Comment),
601
669
  (r'(FROM)([ \t]*)(\S*)([ \t]*)(?:(AS)([ \t]*)(\S*))?',
602
670
  bygroups(Keyword, Whitespace, String, Whitespace, Keyword, Whitespace, String)),
603
- (r'(ONBUILD)(\s+)(%s)' % (_lb,), bygroups(Keyword, Whitespace, using(BashLexer))),
604
- (r'(HEALTHCHECK)(\s+)((%s--\w+=\w+%s)*)' % (_lb, _lb),
671
+ (rf'(ONBUILD)(\s+)({_lb})', bygroups(Keyword, Whitespace, using(BashLexer))),
672
+ (rf'(HEALTHCHECK)(\s+)(({_lb}--\w+=\w+{_lb})*)',
605
673
  bygroups(Keyword, Whitespace, using(BashLexer))),
606
- (r'(VOLUME|ENTRYPOINT|CMD|SHELL)(\s+)(%s)(\[.*?\])' % (_lb,),
674
+ (rf'(VOLUME|ENTRYPOINT|CMD|SHELL)(\s+)({_lb})(\[.*?\])',
607
675
  bygroups(Keyword, Whitespace, using(BashLexer), using(JsonLexer))),
608
- (r'(LABEL|ENV|ARG)(\s+)((%s\w+=\w+%s)*)' % (_lb, _lb),
676
+ (rf'(LABEL|ENV|ARG)(\s+)(({_lb}\w+=\w+{_lb})*)',
609
677
  bygroups(Keyword, Whitespace, using(BashLexer))),
610
- (r'(%s|VOLUME)\b(\s+)(.*)' % (_keywords), bygroups(Keyword, Whitespace, String)),
611
- (r'(%s)(\s+)' % (_bash_keywords,), bygroups(Keyword, Whitespace)),
678
+ (rf'({_keywords}|VOLUME)\b(\s+)(.*)', bygroups(Keyword, Whitespace, String)),
679
+ (rf'({_bash_keywords})(\s+)', bygroups(Keyword, Whitespace)),
612
680
  (r'(.*\\\n)*.+', using(BashLexer)),
613
681
  ]
614
682
  }
@@ -617,8 +685,6 @@ class DockerLexer(RegexLexer):
617
685
  class TerraformLexer(ExtendedRegexLexer):
618
686
  """
619
687
  Lexer for terraformi ``.tf`` files.
620
-
621
- .. versionadded:: 2.1
622
688
  """
623
689
 
624
690
  name = 'Terraform'
@@ -626,6 +692,7 @@ class TerraformLexer(ExtendedRegexLexer):
626
692
  aliases = ['terraform', 'tf', 'hcl']
627
693
  filenames = ['*.tf', '*.hcl']
628
694
  mimetypes = ['application/x-tf', 'application/x-terraform']
695
+ version_added = '2.1'
629
696
 
630
697
  classes = ('backend', 'data', 'module', 'output', 'provider',
631
698
  'provisioner', 'resource', 'variable')
@@ -789,13 +856,13 @@ class TermcapLexer(RegexLexer):
789
856
  Lexer for termcap database source.
790
857
 
791
858
  This is very simple and minimal.
792
-
793
- .. versionadded:: 2.1
794
859
  """
795
860
  name = 'Termcap'
796
861
  aliases = ['termcap']
797
862
  filenames = ['termcap', 'termcap.src']
798
863
  mimetypes = []
864
+ url = 'https://en.wikipedia.org/wiki/Termcap'
865
+ version_added = '2.1'
799
866
 
800
867
  # NOTE:
801
868
  # * multiline with trailing backslash
@@ -836,13 +903,13 @@ class TerminfoLexer(RegexLexer):
836
903
  Lexer for terminfo database source.
837
904
 
838
905
  This is very simple and minimal.
839
-
840
- .. versionadded:: 2.1
841
906
  """
842
907
  name = 'Terminfo'
843
908
  aliases = ['terminfo']
844
909
  filenames = ['terminfo', 'terminfo.src']
845
910
  mimetypes = []
911
+ url = 'https://en.wikipedia.org/wiki/Terminfo'
912
+ version_added = '2.1'
846
913
 
847
914
  # NOTE:
848
915
  # * multiline with leading whitespace
@@ -882,8 +949,6 @@ class PkgConfigLexer(RegexLexer):
882
949
  """
883
950
  Lexer for pkg-config
884
951
  (see also `manual page <http://linux.die.net/man/1/pkg-config>`_).
885
-
886
- .. versionadded:: 2.1
887
952
  """
888
953
 
889
954
  name = 'PkgConfig'
@@ -891,6 +956,7 @@ class PkgConfigLexer(RegexLexer):
891
956
  aliases = ['pkgconfig']
892
957
  filenames = ['*.pc']
893
958
  mimetypes = []
959
+ version_added = '2.1'
894
960
 
895
961
  tokens = {
896
962
  'root': [
@@ -951,8 +1017,6 @@ class PacmanConfLexer(RegexLexer):
951
1017
  VerbosePkgLists
952
1018
 
953
1019
  These are flags to switch on.
954
-
955
- .. versionadded:: 2.1
956
1020
  """
957
1021
 
958
1022
  name = 'PacmanConf'
@@ -960,6 +1024,7 @@ class PacmanConfLexer(RegexLexer):
960
1024
  aliases = ['pacmanconf']
961
1025
  filenames = ['pacman.conf']
962
1026
  mimetypes = []
1027
+ version_added = '2.1'
963
1028
 
964
1029
  tokens = {
965
1030
  'root': [
@@ -997,13 +1062,12 @@ class PacmanConfLexer(RegexLexer):
997
1062
  class AugeasLexer(RegexLexer):
998
1063
  """
999
1064
  Lexer for Augeas.
1000
-
1001
- .. versionadded:: 2.4
1002
1065
  """
1003
1066
  name = 'Augeas'
1004
1067
  url = 'http://augeas.net'
1005
1068
  aliases = ['augeas']
1006
1069
  filenames = ['*.aug']
1070
+ version_added = '2.4'
1007
1071
 
1008
1072
  tokens = {
1009
1073
  'root': [
@@ -1041,79 +1105,250 @@ class AugeasLexer(RegexLexer):
1041
1105
 
1042
1106
  class TOMLLexer(RegexLexer):
1043
1107
  """
1044
- Lexer for TOML, a simple language
1045
- for config files.
1046
-
1047
- .. versionadded:: 2.4
1108
+ Lexer for TOML, a simple language for config files.
1048
1109
  """
1049
1110
 
1050
1111
  name = 'TOML'
1051
- url = 'https://github.com/toml-lang/toml'
1052
1112
  aliases = ['toml']
1053
1113
  filenames = ['*.toml', 'Pipfile', 'poetry.lock']
1114
+ mimetypes = ['application/toml']
1115
+ url = 'https://toml.io'
1116
+ version_added = '2.4'
1117
+
1118
+ # Based on the TOML spec: https://toml.io/en/v1.0.0
1119
+
1120
+ # The following is adapted from CPython's tomllib:
1121
+ _time = r"\d\d:\d\d:\d\d(\.\d+)?"
1122
+ _datetime = rf"""(?x)
1123
+ \d\d\d\d-\d\d-\d\d # date, e.g., 1988-10-27
1124
+ (
1125
+ [Tt ] {_time} # optional time
1126
+ (
1127
+ [Zz]|[+-]\d\d:\d\d # optional time offset
1128
+ )?
1129
+ )?
1130
+ """
1054
1131
 
1055
1132
  tokens = {
1056
1133
  'root': [
1057
- # Table
1058
- (r'^(\s*)(\[.*?\])$', bygroups(Whitespace, Keyword)),
1134
+ # Note that we make an effort in order to distinguish
1135
+ # moments at which we're parsing a key and moments at
1136
+ # which we're parsing a value. In the TOML code
1137
+ #
1138
+ # 1234 = 1234
1139
+ #
1140
+ # the first "1234" should be Name, the second Integer.
1141
+
1142
+ # Whitespace
1143
+ (r'\s+', Whitespace),
1059
1144
 
1060
- # Basics, comments, strings
1061
- (r'[ \t]+', Whitespace),
1062
- (r'\n', Whitespace),
1063
- (r'#.*?$', Comment.Single),
1064
- # Basic string
1065
- (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
1066
- # Literal string
1067
- (r'\'\'\'(.*)\'\'\'', String),
1068
- (r'\'[^\']*\'', String),
1069
- (r'(true|false)$', Keyword.Constant),
1070
- (r'[a-zA-Z_][\w\-]*', Name),
1071
-
1072
- # Datetime
1073
- # TODO this needs to be expanded, as TOML is rather flexible:
1074
- # https://github.com/toml-lang/toml#offset-date-time
1075
- (r'\d{4}-\d{2}-\d{2}(?:T| )\d{2}:\d{2}:\d{2}(?:Z|[-+]\d{2}:\d{2})', Number.Integer),
1076
-
1077
- # Numbers
1078
- (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float),
1079
- (r'\d+[eE][+-]?[0-9]+j?', Number.Float),
1080
- # Handle +-inf, +-infinity, +-nan
1081
- (r'[+-]?(?:(inf(?:inity)?)|nan)', Number.Float),
1082
- (r'[+-]?\d+', Number.Integer),
1083
-
1084
- # Punctuation
1085
- (r'[]{}:(),;[]', Punctuation),
1145
+ # Comment
1146
+ (r'#.*', Comment.Single),
1147
+
1148
+ # Assignment keys
1149
+ include('key'),
1150
+
1151
+ # After "=", find a value
1152
+ (r'(=)(\s*)', bygroups(Operator, Whitespace), 'value'),
1153
+
1154
+ # Table header
1155
+ (r'\[\[?', Keyword, 'table-key'),
1156
+ ],
1157
+ 'key': [
1158
+ # Start of bare key (only ASCII is allowed here).
1159
+ (r'[A-Za-z0-9_-]+', Name),
1160
+ # Quoted key
1161
+ (r'"', String.Double, 'basic-string'),
1162
+ (r"'", String.Single, 'literal-string'),
1163
+ # Dots act as separators in keys
1086
1164
  (r'\.', Punctuation),
1165
+ ],
1166
+ 'table-key': [
1167
+ # This is like 'key', but highlights the name components
1168
+ # and separating dots as Keyword because it looks better
1169
+ # when the whole table header is Keyword. We do highlight
1170
+ # strings as strings though.
1171
+ # Start of bare key (only ASCII is allowed here).
1172
+ (r'[A-Za-z0-9_-]+', Keyword),
1173
+ (r'"', String.Double, 'basic-string'),
1174
+ (r"'", String.Single, 'literal-string'),
1175
+ (r'\.', Keyword),
1176
+ (r'\]\]?', Keyword, '#pop'),
1177
+
1178
+ # Inline whitespace allowed
1179
+ (r'[ \t]+', Whitespace),
1180
+ ],
1181
+ 'value': [
1182
+ # Datetime, baretime
1183
+ (_datetime, Literal.Date, '#pop'),
1184
+ (_time, Literal.Date, '#pop'),
1087
1185
 
1088
- # Operators
1089
- (r'=', Operator)
1186
+ # Recognize as float if there is a fractional part
1187
+ # and/or an exponent.
1188
+ (r'[+-]?\d[0-9_]*[eE][+-]?\d[0-9_]*', Number.Float, '#pop'),
1189
+ (r'[+-]?\d[0-9_]*\.\d[0-9_]*([eE][+-]?\d[0-9_]*)?',
1190
+ Number.Float, '#pop'),
1090
1191
 
1091
- ]
1192
+ # Infinities and NaN
1193
+ (r'[+-]?(inf|nan)', Number.Float, '#pop'),
1194
+
1195
+ # Integers
1196
+ (r'-?0b[01_]+', Number.Bin, '#pop'),
1197
+ (r'-?0o[0-7_]+', Number.Oct, '#pop'),
1198
+ (r'-?0x[0-9a-fA-F_]+', Number.Hex, '#pop'),
1199
+ (r'[+-]?[0-9_]+', Number.Integer, '#pop'),
1200
+
1201
+ # Strings
1202
+ (r'"""', String.Double, ('#pop', 'multiline-basic-string')),
1203
+ (r'"', String.Double, ('#pop', 'basic-string')),
1204
+ (r"'''", String.Single, ('#pop', 'multiline-literal-string')),
1205
+ (r"'", String.Single, ('#pop', 'literal-string')),
1206
+
1207
+ # Booleans
1208
+ (r'true|false', Keyword.Constant, '#pop'),
1209
+
1210
+ # Start of array
1211
+ (r'\[', Punctuation, ('#pop', 'array')),
1212
+
1213
+ # Start of inline table
1214
+ (r'\{', Punctuation, ('#pop', 'inline-table')),
1215
+ ],
1216
+ 'array': [
1217
+ # Whitespace, including newlines, is ignored inside arrays,
1218
+ # and comments are allowed.
1219
+ (r'\s+', Whitespace),
1220
+ (r'#.*', Comment.Single),
1221
+
1222
+ # Delimiters
1223
+ (r',', Punctuation),
1224
+
1225
+ # End of array
1226
+ (r'\]', Punctuation, '#pop'),
1227
+
1228
+ # Parse a value and come back
1229
+ default('value'),
1230
+ ],
1231
+ 'inline-table': [
1232
+ # Note that unlike inline arrays, inline tables do not
1233
+ # allow newlines or comments.
1234
+ (r'[ \t]+', Whitespace),
1235
+
1236
+ # Keys
1237
+ include('key'),
1238
+
1239
+ # Values
1240
+ (r'(=)(\s*)', bygroups(Punctuation, Whitespace), 'value'),
1241
+
1242
+ # Delimiters
1243
+ (r',', Punctuation),
1244
+
1245
+ # End of inline table
1246
+ (r'\}', Punctuation, '#pop'),
1247
+ ],
1248
+ 'basic-string': [
1249
+ (r'"', String.Double, '#pop'),
1250
+ include('escapes'),
1251
+ (r'[^"\\]+', String.Double),
1252
+ ],
1253
+ 'literal-string': [
1254
+ (r".*?'", String.Single, '#pop'),
1255
+ ],
1256
+ 'multiline-basic-string': [
1257
+ (r'"""', String.Double, '#pop'),
1258
+ (r'(\\)(\n)', bygroups(String.Escape, Whitespace)),
1259
+ include('escapes'),
1260
+ (r'[^"\\]+', String.Double),
1261
+ (r'"', String.Double),
1262
+ ],
1263
+ 'multiline-literal-string': [
1264
+ (r"'''", String.Single, '#pop'),
1265
+ (r"[^']+", String.Single),
1266
+ (r"'", String.Single),
1267
+ ],
1268
+ 'escapes': [
1269
+ (r'\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}', String.Escape),
1270
+ (r'\\.', String.Escape),
1271
+ ],
1092
1272
  }
1093
1273
 
1094
1274
  class NestedTextLexer(RegexLexer):
1095
1275
  """
1096
- Lexer for NextedText, a human-friendly data
1097
- format.
1276
+ Lexer for *NextedText*, a human-friendly data format.
1098
1277
 
1099
- .. versionadded:: 2.9
1278
+ .. versionchanged:: 2.16
1279
+ Added support for *NextedText* v3.0.
1100
1280
  """
1101
1281
 
1102
1282
  name = 'NestedText'
1103
1283
  url = 'https://nestedtext.org'
1104
1284
  aliases = ['nestedtext', 'nt']
1105
1285
  filenames = ['*.nt']
1106
-
1107
- _quoted_dict_item = r'^(\s*)({0})(.*?)({0}: ?)(.*?)(\s*)$'
1286
+ version_added = '2.9'
1108
1287
 
1109
1288
  tokens = {
1110
1289
  'root': [
1111
- (r'^(\s*)(#.*?)$', bygroups(Whitespace, Comment)),
1112
- (r'^(\s*)(>)( ?)(.*?)(\s*)$', bygroups(Whitespace, Punctuation, Whitespace, String, Whitespace)),
1113
- (r'^(\s*)(-)( ?)(.*?)(\s*)$', bygroups(Whitespace, Punctuation, Whitespace, String, Whitespace)),
1114
- (_quoted_dict_item.format("'"), bygroups(Whitespace, Punctuation, Name, Punctuation, String, Whitespace)),
1115
- (_quoted_dict_item.format('"'), bygroups(Whitespace, Punctuation, Name, Punctuation, String, Whitespace)),
1116
- (r'^(\s*)(.*?)(:)( ?)(.*?)(\s*)$', bygroups(Whitespace, Name, Punctuation, Whitespace, String, Whitespace)),
1290
+ # Comment: # ...
1291
+ (r'^([ ]*)(#.*)$', bygroups(Whitespace, Comment)),
1292
+
1293
+ # Inline dictionary: {...}
1294
+ (r'^([ ]*)(\{)', bygroups(Whitespace, Punctuation), 'inline_dict'),
1295
+
1296
+ # Inline list: [...]
1297
+ (r'^([ ]*)(\[)', bygroups(Whitespace, Punctuation), 'inline_list'),
1298
+
1299
+ # empty multiline string item: >
1300
+ (r'^([ ]*)(>)$', bygroups(Whitespace, Punctuation)),
1301
+
1302
+ # multiline string item: > ...
1303
+ (r'^([ ]*)(>)( )(.*?)([ \t]*)$', bygroups(Whitespace, Punctuation, Whitespace, Text, Whitespace)),
1304
+
1305
+ # empty list item: -
1306
+ (r'^([ ]*)(-)$', bygroups(Whitespace, Punctuation)),
1307
+
1308
+ # list item: - ...
1309
+ (r'^([ ]*)(-)( )(.*?)([ \t]*)$', bygroups(Whitespace, Punctuation, Whitespace, Text, Whitespace)),
1310
+
1311
+ # empty multiline key item: :
1312
+ (r'^([ ]*)(:)$', bygroups(Whitespace, Punctuation)),
1313
+
1314
+ # multiline key item: : ...
1315
+ (r'^([ ]*)(:)( )([^\n]*?)([ \t]*)$', bygroups(Whitespace, Punctuation, Whitespace, Name.Tag, Whitespace)),
1316
+
1317
+ # empty dict key item: ...:
1318
+ (r'^([ ]*)([^\{\[\s].*?)(:)$', bygroups(Whitespace, Name.Tag, Punctuation)),
1319
+
1320
+ # dict key item: ...: ...
1321
+ (r'^([ ]*)([^\{\[\s].*?)(:)( )(.*?)([ \t]*)$', bygroups(Whitespace, Name.Tag, Punctuation, Whitespace, Text, Whitespace)),
1322
+ ],
1323
+ 'inline_list': [
1324
+ include('whitespace'),
1325
+ (r'[^\{\}\[\],\s]+', Text),
1326
+ include('inline_value'),
1327
+ (r',', Punctuation),
1328
+ (r'\]', Punctuation, '#pop'),
1329
+ (r'\n', Error, '#pop'),
1330
+ ],
1331
+ 'inline_dict': [
1332
+ include('whitespace'),
1333
+ (r'[^\{\}\[\],:\s]+', Name.Tag),
1334
+ (r':', Punctuation, 'inline_dict_value'),
1335
+ (r'\}', Punctuation, '#pop'),
1336
+ (r'\n', Error, '#pop'),
1337
+ ],
1338
+ 'inline_dict_value': [
1339
+ include('whitespace'),
1340
+ (r'[^\{\}\[\],:\s]+', Text),
1341
+ include('inline_value'),
1342
+ (r',', Punctuation, '#pop'),
1343
+ (r'\}', Punctuation, '#pop:2'),
1344
+ ],
1345
+ 'inline_value': [
1346
+ include('whitespace'),
1347
+ (r'\{', Punctuation, 'inline_dict'),
1348
+ (r'\[', Punctuation, 'inline_list'),
1349
+ ],
1350
+ 'whitespace': [
1351
+ (r'[ \t]+', Whitespace),
1117
1352
  ],
1118
1353
  }
1119
1354
 
@@ -1121,14 +1356,13 @@ class NestedTextLexer(RegexLexer):
1121
1356
  class SingularityLexer(RegexLexer):
1122
1357
  """
1123
1358
  Lexer for Singularity definition files.
1124
-
1125
- .. versionadded:: 2.6
1126
1359
  """
1127
1360
 
1128
1361
  name = 'Singularity'
1129
1362
  url = 'https://www.sylabs.io/guides/3.0/user-guide/definition_files.html'
1130
1363
  aliases = ['singularity']
1131
1364
  filenames = ['*.def', 'Singularity']
1365
+ version_added = '2.6'
1132
1366
  flags = re.IGNORECASE | re.MULTILINE | re.DOTALL
1133
1367
 
1134
1368
  _headers = r'^(\s*)(bootstrap|from|osversion|mirrorurl|include|registry|namespace|includecmd)(:)'
@@ -1170,13 +1404,13 @@ class UnixConfigLexer(RegexLexer):
1170
1404
  * ``/etc/group``
1171
1405
  * ``/etc/passwd``
1172
1406
  * ``/etc/shadow``
1173
-
1174
- .. versionadded:: 2.12
1175
1407
  """
1176
1408
 
1177
1409
  name = 'Unix/Linux config files'
1178
1410
  aliases = ['unixconfig', 'linuxconfig']
1179
1411
  filenames = []
1412
+ url = 'https://en.wikipedia.org/wiki/Configuration_file#Unix_and_Unix-like_operating_systems'
1413
+ version_added = '2.12'
1180
1414
 
1181
1415
  tokens = {
1182
1416
  'root': [