pygments.rb 2.3.1 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (324) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +1 -1
  3. data/.rubocop.yml +7 -0
  4. data/CHANGELOG.adoc +4 -0
  5. data/README.adoc +1 -1
  6. data/bench.rb +1 -1
  7. data/lib/pygments/popen.rb +3 -7
  8. data/lib/pygments/version.rb +1 -1
  9. data/pygments.rb.gemspec +2 -2
  10. data/test/test_pygments.rb +0 -19
  11. data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/AUTHORS +21 -1
  12. data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/LICENSE +1 -1
  13. data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/METADATA +19 -11
  14. data/vendor/pygments-main/Pygments-2.15.1.dist-info/RECORD +614 -0
  15. data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/WHEEL +1 -1
  16. data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/entry_points.txt +0 -1
  17. data/vendor/pygments-main/bin/pygmentize +1 -1
  18. data/vendor/pygments-main/pygments/__init__.py +20 -22
  19. data/vendor/pygments-main/pygments/__main__.py +1 -1
  20. data/vendor/pygments-main/pygments/cmdline.py +74 -8
  21. data/vendor/pygments-main/pygments/console.py +1 -1
  22. data/vendor/pygments-main/pygments/filter.py +1 -1
  23. data/vendor/pygments-main/pygments/filters/__init__.py +6 -3
  24. data/vendor/pygments-main/pygments/formatter.py +41 -11
  25. data/vendor/pygments-main/pygments/formatters/__init__.py +21 -16
  26. data/vendor/pygments-main/pygments/formatters/_mapping.py +5 -65
  27. data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
  28. data/vendor/pygments-main/pygments/formatters/groff.py +170 -0
  29. data/vendor/pygments-main/pygments/formatters/html.py +54 -32
  30. data/vendor/pygments-main/pygments/formatters/img.py +9 -5
  31. data/vendor/pygments-main/pygments/formatters/irc.py +6 -33
  32. data/vendor/pygments-main/pygments/formatters/latex.py +24 -14
  33. data/vendor/pygments-main/pygments/formatters/other.py +1 -1
  34. data/vendor/pygments-main/pygments/formatters/pangomarkup.py +1 -1
  35. data/vendor/pygments-main/pygments/formatters/rtf.py +1 -1
  36. data/vendor/pygments-main/pygments/formatters/svg.py +1 -1
  37. data/vendor/pygments-main/pygments/formatters/terminal.py +1 -3
  38. data/vendor/pygments-main/pygments/formatters/terminal256.py +2 -4
  39. data/vendor/pygments-main/pygments/lexer.py +101 -32
  40. data/vendor/pygments-main/pygments/lexers/__init__.py +50 -29
  41. data/vendor/pygments-main/pygments/lexers/_ada_builtins.py +103 -0
  42. data/vendor/pygments-main/pygments/lexers/_asy_builtins.py +1 -1
  43. data/vendor/pygments-main/pygments/lexers/_cl_builtins.py +1 -1
  44. data/vendor/pygments-main/pygments/lexers/_cocoa_builtins.py +2 -2
  45. data/vendor/pygments-main/pygments/lexers/_csound_builtins.py +21 -6
  46. data/vendor/pygments-main/pygments/lexers/_css_builtins.py +558 -0
  47. data/vendor/pygments-main/pygments/lexers/_julia_builtins.py +10 -0
  48. data/vendor/pygments-main/pygments/lexers/_lasso_builtins.py +1 -1
  49. data/vendor/pygments-main/pygments/lexers/_lilypond_builtins.py +4932 -0
  50. data/vendor/pygments-main/pygments/lexers/_lua_builtins.py +11 -18
  51. data/vendor/pygments-main/pygments/lexers/_mapping.py +71 -82
  52. data/vendor/pygments-main/pygments/lexers/_mql_builtins.py +1 -1
  53. data/vendor/pygments-main/pygments/lexers/_mysql_builtins.py +58 -4
  54. data/vendor/pygments-main/pygments/lexers/_openedge_builtins.py +1 -1
  55. data/vendor/pygments-main/pygments/lexers/_php_builtins.py +408 -1835
  56. data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +70 -8
  57. data/vendor/pygments-main/pygments/lexers/_qlik_builtins.py +666 -0
  58. data/vendor/pygments-main/pygments/lexers/_scheme_builtins.py +1609 -0
  59. data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +3 -3
  60. data/vendor/pygments-main/pygments/lexers/_sourcemod_builtins.py +9 -18
  61. data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +185 -94
  62. data/vendor/pygments-main/pygments/lexers/_stata_builtins.py +1 -1
  63. data/vendor/pygments-main/pygments/lexers/_tsql_builtins.py +1 -1
  64. data/vendor/pygments-main/pygments/lexers/_usd_builtins.py +1 -1
  65. data/vendor/pygments-main/pygments/lexers/_vbscript_builtins.py +1 -1
  66. data/vendor/pygments-main/pygments/lexers/_vim_builtins.py +1 -1
  67. data/vendor/pygments-main/pygments/lexers/actionscript.py +15 -14
  68. data/vendor/pygments-main/pygments/lexers/ada.py +144 -0
  69. data/vendor/pygments-main/pygments/lexers/agile.py +1 -1
  70. data/vendor/pygments-main/pygments/lexers/algebra.py +72 -9
  71. data/vendor/pygments-main/pygments/lexers/ambient.py +8 -7
  72. data/vendor/pygments-main/pygments/lexers/amdgpu.py +4 -3
  73. data/vendor/pygments-main/pygments/lexers/ampl.py +10 -8
  74. data/vendor/pygments-main/pygments/lexers/apdlexer.py +164 -20
  75. data/vendor/pygments-main/pygments/lexers/apl.py +6 -5
  76. data/vendor/pygments-main/pygments/lexers/archetype.py +23 -21
  77. data/vendor/pygments-main/pygments/lexers/arrow.py +10 -9
  78. data/vendor/pygments-main/pygments/lexers/arturo.py +250 -0
  79. data/vendor/pygments-main/pygments/lexers/asc.py +9 -5
  80. data/vendor/pygments-main/pygments/lexers/asm.py +68 -63
  81. data/vendor/pygments-main/pygments/lexers/automation.py +7 -5
  82. data/vendor/pygments-main/pygments/lexers/bare.py +20 -21
  83. data/vendor/pygments-main/pygments/lexers/basic.py +45 -41
  84. data/vendor/pygments-main/pygments/lexers/bdd.py +58 -0
  85. data/vendor/pygments-main/pygments/lexers/berry.py +99 -0
  86. data/vendor/pygments-main/pygments/lexers/bibtex.py +6 -6
  87. data/vendor/pygments-main/pygments/lexers/boa.py +4 -8
  88. data/vendor/pygments-main/pygments/lexers/business.py +18 -18
  89. data/vendor/pygments-main/pygments/lexers/c_cpp.py +80 -40
  90. data/vendor/pygments-main/pygments/lexers/c_like.py +21 -19
  91. data/vendor/pygments-main/pygments/lexers/capnproto.py +6 -8
  92. data/vendor/pygments-main/pygments/lexers/carbon.py +96 -0
  93. data/vendor/pygments-main/pygments/lexers/cddl.py +16 -33
  94. data/vendor/pygments-main/pygments/lexers/chapel.py +14 -9
  95. data/vendor/pygments-main/pygments/lexers/clean.py +3 -2
  96. data/vendor/pygments-main/pygments/lexers/comal.py +80 -0
  97. data/vendor/pygments-main/pygments/lexers/compiled.py +3 -2
  98. data/vendor/pygments-main/pygments/lexers/configs.py +235 -120
  99. data/vendor/pygments-main/pygments/lexers/console.py +5 -4
  100. data/vendor/pygments-main/pygments/lexers/cplint.py +44 -0
  101. data/vendor/pygments-main/pygments/lexers/crystal.py +22 -23
  102. data/vendor/pygments-main/pygments/lexers/csound.py +19 -17
  103. data/vendor/pygments-main/pygments/lexers/css.py +67 -159
  104. data/vendor/pygments-main/pygments/lexers/d.py +15 -12
  105. data/vendor/pygments-main/pygments/lexers/dalvik.py +14 -11
  106. data/vendor/pygments-main/pygments/lexers/data.py +119 -49
  107. data/vendor/pygments-main/pygments/lexers/dax.py +136 -0
  108. data/vendor/pygments-main/pygments/lexers/devicetree.py +9 -8
  109. data/vendor/pygments-main/pygments/lexers/diff.py +23 -19
  110. data/vendor/pygments-main/pygments/lexers/dotnet.py +216 -81
  111. data/vendor/pygments-main/pygments/lexers/dsls.py +86 -64
  112. data/vendor/pygments-main/pygments/lexers/dylan.py +16 -15
  113. data/vendor/pygments-main/pygments/lexers/ecl.py +46 -38
  114. data/vendor/pygments-main/pygments/lexers/eiffel.py +15 -10
  115. data/vendor/pygments-main/pygments/lexers/elm.py +12 -8
  116. data/vendor/pygments-main/pygments/lexers/elpi.py +165 -0
  117. data/vendor/pygments-main/pygments/lexers/email.py +21 -39
  118. data/vendor/pygments-main/pygments/lexers/erlang.py +21 -22
  119. data/vendor/pygments-main/pygments/lexers/esoteric.py +28 -30
  120. data/vendor/pygments-main/pygments/lexers/ezhil.py +10 -9
  121. data/vendor/pygments-main/pygments/lexers/factor.py +104 -83
  122. data/vendor/pygments-main/pygments/lexers/fantom.py +31 -29
  123. data/vendor/pygments-main/pygments/lexers/felix.py +18 -14
  124. data/vendor/pygments-main/pygments/lexers/fift.py +67 -0
  125. data/vendor/pygments-main/pygments/lexers/floscript.py +7 -7
  126. data/vendor/pygments-main/pygments/lexers/forth.py +8 -6
  127. data/vendor/pygments-main/pygments/lexers/fortran.py +16 -11
  128. data/vendor/pygments-main/pygments/lexers/foxpro.py +2 -2
  129. data/vendor/pygments-main/pygments/lexers/freefem.py +7 -10
  130. data/vendor/pygments-main/pygments/lexers/func.py +108 -0
  131. data/vendor/pygments-main/pygments/lexers/functional.py +1 -1
  132. data/vendor/pygments-main/pygments/lexers/futhark.py +12 -17
  133. data/vendor/pygments-main/pygments/lexers/gcodelexer.py +1 -2
  134. data/vendor/pygments-main/pygments/lexers/gdscript.py +76 -233
  135. data/vendor/pygments-main/pygments/lexers/go.py +12 -14
  136. data/vendor/pygments-main/pygments/lexers/grammar_notation.py +22 -26
  137. data/vendor/pygments-main/pygments/lexers/graph.py +36 -15
  138. data/vendor/pygments-main/pygments/lexers/graphics.py +37 -38
  139. data/vendor/pygments-main/pygments/lexers/graphviz.py +2 -1
  140. data/vendor/pygments-main/pygments/lexers/gsql.py +39 -27
  141. data/vendor/pygments-main/pygments/lexers/haskell.py +73 -71
  142. data/vendor/pygments-main/pygments/lexers/haxe.py +13 -11
  143. data/vendor/pygments-main/pygments/lexers/hdl.py +31 -34
  144. data/vendor/pygments-main/pygments/lexers/hexdump.py +21 -21
  145. data/vendor/pygments-main/pygments/lexers/html.py +11 -19
  146. data/vendor/pygments-main/pygments/lexers/idl.py +10 -5
  147. data/vendor/pygments-main/pygments/lexers/igor.py +3 -2
  148. data/vendor/pygments-main/pygments/lexers/inferno.py +9 -8
  149. data/vendor/pygments-main/pygments/lexers/installers.py +39 -33
  150. data/vendor/pygments-main/pygments/lexers/int_fiction.py +35 -20
  151. data/vendor/pygments-main/pygments/lexers/iolang.py +9 -9
  152. data/vendor/pygments-main/pygments/lexers/j.py +20 -13
  153. data/vendor/pygments-main/pygments/lexers/javascript.py +183 -149
  154. data/vendor/pygments-main/pygments/lexers/jmespath.py +68 -0
  155. data/vendor/pygments-main/pygments/lexers/jslt.py +4 -3
  156. data/vendor/pygments-main/pygments/lexers/jsonnet.py +168 -0
  157. data/vendor/pygments-main/pygments/lexers/julia.py +44 -32
  158. data/vendor/pygments-main/pygments/lexers/jvm.py +161 -140
  159. data/vendor/pygments-main/pygments/lexers/kuin.py +93 -59
  160. data/vendor/pygments-main/pygments/lexers/lilypond.py +226 -0
  161. data/vendor/pygments-main/pygments/lexers/lisp.py +244 -107
  162. data/vendor/pygments-main/pygments/lexers/macaulay2.py +1739 -0
  163. data/vendor/pygments-main/pygments/lexers/make.py +21 -16
  164. data/vendor/pygments-main/pygments/lexers/markup.py +752 -11
  165. data/vendor/pygments-main/pygments/lexers/math.py +1 -1
  166. data/vendor/pygments-main/pygments/lexers/matlab.py +18 -3
  167. data/vendor/pygments-main/pygments/lexers/maxima.py +85 -0
  168. data/vendor/pygments-main/pygments/lexers/meson.py +10 -25
  169. data/vendor/pygments-main/pygments/lexers/mime.py +2 -2
  170. data/vendor/pygments-main/pygments/lexers/minecraft.py +394 -0
  171. data/vendor/pygments-main/pygments/lexers/mips.py +128 -0
  172. data/vendor/pygments-main/pygments/lexers/ml.py +9 -6
  173. data/vendor/pygments-main/pygments/lexers/modeling.py +12 -8
  174. data/vendor/pygments-main/pygments/lexers/modula2.py +3 -2
  175. data/vendor/pygments-main/pygments/lexers/monte.py +3 -2
  176. data/vendor/pygments-main/pygments/lexers/mosel.py +1 -1
  177. data/vendor/pygments-main/pygments/lexers/ncl.py +1 -1
  178. data/vendor/pygments-main/pygments/lexers/nimrod.py +62 -20
  179. data/vendor/pygments-main/pygments/lexers/nit.py +3 -2
  180. data/vendor/pygments-main/pygments/lexers/nix.py +5 -5
  181. data/vendor/pygments-main/pygments/lexers/oberon.py +2 -2
  182. data/vendor/pygments-main/pygments/lexers/objective.py +6 -4
  183. data/vendor/pygments-main/pygments/lexers/ooc.py +3 -2
  184. data/vendor/pygments-main/pygments/lexers/other.py +1 -1
  185. data/vendor/pygments-main/pygments/lexers/parasail.py +3 -2
  186. data/vendor/pygments-main/pygments/lexers/parsers.py +23 -21
  187. data/vendor/pygments-main/pygments/lexers/pascal.py +196 -198
  188. data/vendor/pygments-main/pygments/lexers/pawn.py +1 -1
  189. data/vendor/pygments-main/pygments/lexers/perl.py +17 -15
  190. data/vendor/pygments-main/pygments/lexers/phix.py +364 -0
  191. data/vendor/pygments-main/pygments/lexers/php.py +35 -20
  192. data/vendor/pygments-main/pygments/lexers/pointless.py +3 -2
  193. data/vendor/pygments-main/pygments/lexers/pony.py +1 -1
  194. data/vendor/pygments-main/pygments/lexers/praat.py +41 -38
  195. data/vendor/pygments-main/pygments/lexers/procfile.py +2 -3
  196. data/vendor/pygments-main/pygments/lexers/prolog.py +7 -8
  197. data/vendor/pygments-main/pygments/lexers/promql.py +5 -12
  198. data/vendor/pygments-main/pygments/lexers/python.py +145 -119
  199. data/vendor/pygments-main/pygments/lexers/q.py +188 -0
  200. data/vendor/pygments-main/pygments/lexers/qlik.py +117 -0
  201. data/vendor/pygments-main/pygments/lexers/qvt.py +1 -1
  202. data/vendor/pygments-main/pygments/lexers/r.py +4 -4
  203. data/vendor/pygments-main/pygments/lexers/rdf.py +3 -3
  204. data/vendor/pygments-main/pygments/lexers/rebol.py +1 -12
  205. data/vendor/pygments-main/pygments/lexers/resource.py +1 -1
  206. data/vendor/pygments-main/pygments/lexers/ride.py +3 -2
  207. data/vendor/pygments-main/pygments/lexers/rita.py +43 -0
  208. data/vendor/pygments-main/pygments/lexers/rnc.py +3 -2
  209. data/vendor/pygments-main/pygments/lexers/roboconf.py +3 -3
  210. data/vendor/pygments-main/pygments/lexers/robotframework.py +6 -5
  211. data/vendor/pygments-main/pygments/lexers/ruby.py +24 -24
  212. data/vendor/pygments-main/pygments/lexers/rust.py +3 -2
  213. data/vendor/pygments-main/pygments/lexers/sas.py +2 -2
  214. data/vendor/pygments-main/pygments/lexers/savi.py +170 -0
  215. data/vendor/pygments-main/pygments/lexers/scdoc.py +4 -7
  216. data/vendor/pygments-main/pygments/lexers/scripting.py +24 -21
  217. data/vendor/pygments-main/pygments/lexers/sgf.py +6 -6
  218. data/vendor/pygments-main/pygments/lexers/shell.py +29 -21
  219. data/vendor/pygments-main/pygments/lexers/sieve.py +14 -4
  220. data/vendor/pygments-main/pygments/lexers/slash.py +1 -1
  221. data/vendor/pygments-main/pygments/lexers/smalltalk.py +5 -3
  222. data/vendor/pygments-main/pygments/lexers/smithy.py +5 -6
  223. data/vendor/pygments-main/pygments/lexers/smv.py +1 -1
  224. data/vendor/pygments-main/pygments/lexers/snobol.py +1 -1
  225. data/vendor/pygments-main/pygments/lexers/solidity.py +3 -7
  226. data/vendor/pygments-main/pygments/lexers/sophia.py +103 -0
  227. data/vendor/pygments-main/pygments/lexers/special.py +2 -5
  228. data/vendor/pygments-main/pygments/lexers/spice.py +71 -0
  229. data/vendor/pygments-main/pygments/lexers/sql.py +212 -17
  230. data/vendor/pygments-main/pygments/lexers/srcinfo.py +62 -0
  231. data/vendor/pygments-main/pygments/lexers/stata.py +4 -3
  232. data/vendor/pygments-main/pygments/lexers/supercollider.py +4 -3
  233. data/vendor/pygments-main/pygments/lexers/tal.py +74 -0
  234. data/vendor/pygments-main/pygments/lexers/tcl.py +21 -16
  235. data/vendor/pygments-main/pygments/lexers/teal.py +9 -8
  236. data/vendor/pygments-main/pygments/lexers/templates.py +62 -29
  237. data/vendor/pygments-main/pygments/lexers/teraterm.py +12 -20
  238. data/vendor/pygments-main/pygments/lexers/testing.py +6 -2
  239. data/vendor/pygments-main/pygments/lexers/text.py +3 -2
  240. data/vendor/pygments-main/pygments/lexers/textedit.py +41 -7
  241. data/vendor/pygments-main/pygments/lexers/textfmts.py +7 -5
  242. data/vendor/pygments-main/pygments/lexers/theorem.py +42 -36
  243. data/vendor/pygments-main/pygments/lexers/thingsdb.py +2 -4
  244. data/vendor/pygments-main/pygments/lexers/tlb.py +57 -0
  245. data/vendor/pygments-main/pygments/lexers/tnt.py +3 -4
  246. data/vendor/pygments-main/pygments/lexers/trafficscript.py +2 -4
  247. data/vendor/pygments-main/pygments/lexers/typoscript.py +2 -3
  248. data/vendor/pygments-main/pygments/lexers/ul4.py +267 -0
  249. data/vendor/pygments-main/pygments/lexers/unicon.py +1 -1
  250. data/vendor/pygments-main/pygments/lexers/urbi.py +4 -4
  251. data/vendor/pygments-main/pygments/lexers/usd.py +2 -1
  252. data/vendor/pygments-main/pygments/lexers/varnish.py +5 -5
  253. data/vendor/pygments-main/pygments/lexers/verification.py +4 -3
  254. data/vendor/pygments-main/pygments/lexers/web.py +1 -1
  255. data/vendor/pygments-main/pygments/lexers/webassembly.py +5 -5
  256. data/vendor/pygments-main/pygments/lexers/webidl.py +2 -1
  257. data/vendor/pygments-main/pygments/lexers/webmisc.py +90 -71
  258. data/vendor/pygments-main/pygments/lexers/wgsl.py +407 -0
  259. data/vendor/pygments-main/pygments/lexers/whiley.py +2 -1
  260. data/vendor/pygments-main/pygments/lexers/wowtoc.py +120 -0
  261. data/vendor/pygments-main/pygments/lexers/wren.py +99 -0
  262. data/vendor/pygments-main/pygments/lexers/x10.py +5 -6
  263. data/vendor/pygments-main/pygments/lexers/xorg.py +3 -2
  264. data/vendor/pygments-main/pygments/lexers/yang.py +6 -5
  265. data/vendor/pygments-main/pygments/lexers/zig.py +3 -2
  266. data/vendor/pygments-main/pygments/modeline.py +1 -1
  267. data/vendor/pygments-main/pygments/plugin.py +28 -9
  268. data/vendor/pygments-main/pygments/regexopt.py +1 -1
  269. data/vendor/pygments-main/pygments/scanner.py +2 -2
  270. data/vendor/pygments-main/pygments/sphinxext.py +63 -1
  271. data/vendor/pygments-main/pygments/style.py +7 -1
  272. data/vendor/pygments-main/pygments/styles/__init__.py +19 -5
  273. data/vendor/pygments-main/pygments/styles/abap.py +2 -2
  274. data/vendor/pygments-main/pygments/styles/algol.py +1 -2
  275. data/vendor/pygments-main/pygments/styles/algol_nu.py +1 -2
  276. data/vendor/pygments-main/pygments/styles/arduino.py +2 -3
  277. data/vendor/pygments-main/pygments/styles/autumn.py +1 -3
  278. data/vendor/pygments-main/pygments/styles/borland.py +1 -3
  279. data/vendor/pygments-main/pygments/styles/bw.py +1 -2
  280. data/vendor/pygments-main/pygments/styles/colorful.py +1 -3
  281. data/vendor/pygments-main/pygments/styles/default.py +13 -14
  282. data/vendor/pygments-main/pygments/styles/dracula.py +102 -0
  283. data/vendor/pygments-main/pygments/styles/emacs.py +1 -2
  284. data/vendor/pygments-main/pygments/styles/friendly.py +1 -2
  285. data/vendor/pygments-main/pygments/styles/friendly_grayscale.py +75 -0
  286. data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
  287. data/vendor/pygments-main/pygments/styles/gh_dark.py +107 -0
  288. data/vendor/pygments-main/pygments/styles/gruvbox.py +4 -2
  289. data/vendor/pygments-main/pygments/styles/igor.py +1 -2
  290. data/vendor/pygments-main/pygments/styles/inkpot.py +3 -2
  291. data/vendor/pygments-main/pygments/styles/lilypond.py +56 -0
  292. data/vendor/pygments-main/pygments/styles/lovelace.py +1 -3
  293. data/vendor/pygments-main/pygments/styles/manni.py +1 -1
  294. data/vendor/pygments-main/pygments/styles/material.py +1 -2
  295. data/vendor/pygments-main/pygments/styles/monokai.py +3 -3
  296. data/vendor/pygments-main/pygments/styles/murphy.py +1 -3
  297. data/vendor/pygments-main/pygments/styles/native.py +11 -11
  298. data/vendor/pygments-main/pygments/styles/nord.py +150 -0
  299. data/vendor/pygments-main/pygments/styles/onedark.py +59 -0
  300. data/vendor/pygments-main/pygments/styles/paraiso_dark.py +1 -6
  301. data/vendor/pygments-main/pygments/styles/paraiso_light.py +1 -6
  302. data/vendor/pygments-main/pygments/styles/pastie.py +1 -3
  303. data/vendor/pygments-main/pygments/styles/perldoc.py +1 -2
  304. data/vendor/pygments-main/pygments/styles/rainbow_dash.py +3 -3
  305. data/vendor/pygments-main/pygments/styles/rrt.py +3 -2
  306. data/vendor/pygments-main/pygments/styles/sas.py +2 -4
  307. data/vendor/pygments-main/pygments/styles/solarized.py +1 -1
  308. data/vendor/pygments-main/pygments/styles/staroffice.py +26 -0
  309. data/vendor/pygments-main/pygments/styles/stata_dark.py +4 -6
  310. data/vendor/pygments-main/pygments/styles/stata_light.py +1 -2
  311. data/vendor/pygments-main/pygments/styles/tango.py +2 -3
  312. data/vendor/pygments-main/pygments/styles/trac.py +1 -3
  313. data/vendor/pygments-main/pygments/styles/vim.py +1 -2
  314. data/vendor/pygments-main/pygments/styles/vs.py +1 -2
  315. data/vendor/pygments-main/pygments/styles/xcode.py +1 -3
  316. data/vendor/pygments-main/pygments/styles/zenburn.py +4 -6
  317. data/vendor/pygments-main/pygments/token.py +2 -1
  318. data/vendor/pygments-main/pygments/unistring.py +4 -6
  319. data/vendor/pygments-main/pygments/util.py +27 -5
  320. metadata +59 -14
  321. data/vendor/pygments-main/Pygments-2.10.0.dist-info/RECORD +0 -524
  322. /data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/INSTALLER +0 -0
  323. /data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/REQUESTED +0 -0
  324. /data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/top_level.txt +0 -0
@@ -4,15 +4,16 @@
4
4
 
5
5
  Lexers for configuration file formats.
6
6
 
7
- :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
7
+ :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
8
8
  :license: BSD, see LICENSE for details.
9
9
  """
10
10
 
11
11
  import re
12
12
 
13
- from pygments.lexer import RegexLexer, default, words, bygroups, include, using
13
+ from pygments.lexer import ExtendedRegexLexer, RegexLexer, default, words, \
14
+ bygroups, include, using, line_re
14
15
  from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
- Number, Punctuation, Whitespace, Literal, Generic
16
+ Number, Punctuation, Whitespace, Literal, Error, Generic
16
17
  from pygments.lexers.shell import BashLexer
17
18
  from pygments.lexers.data import JsonLexer
18
19
 
@@ -21,7 +22,7 @@ __all__ = ['IniLexer', 'RegeditLexer', 'PropertiesLexer', 'KconfigLexer',
21
22
  'NginxConfLexer', 'LighttpdConfLexer', 'DockerLexer',
22
23
  'TerraformLexer', 'TermcapLexer', 'TerminfoLexer',
23
24
  'PkgConfigLexer', 'PacmanConfLexer', 'AugeasLexer', 'TOMLLexer',
24
- 'NestedTextLexer', 'SingularityLexer']
25
+ 'NestedTextLexer', 'SingularityLexer', 'UnixConfigLexer']
25
26
 
26
27
 
27
28
  class IniLexer(RegexLexer):
@@ -32,7 +33,7 @@ class IniLexer(RegexLexer):
32
33
  name = 'INI'
33
34
  aliases = ['ini', 'cfg', 'dosini']
34
35
  filenames = [
35
- '*.ini', '*.cfg', '*.inf',
36
+ '*.ini', '*.cfg', '*.inf', '.editorconfig',
36
37
  # systemd unit files
37
38
  # https://www.freedesktop.org/software/systemd/man/systemd.unit.html
38
39
  '*.service', '*.socket', '*.device', '*.mount', '*.automount',
@@ -42,14 +43,24 @@ class IniLexer(RegexLexer):
42
43
 
43
44
  tokens = {
44
45
  'root': [
45
- (r'\s+', Text),
46
+ (r'\s+', Whitespace),
46
47
  (r'[;#].*', Comment.Single),
47
- (r'\[.*?\]$', Keyword),
48
- (r'(.*?)([ \t]*)(=)([ \t]*)([^\t\n]*)',
49
- bygroups(Name.Attribute, Text, Operator, Text, String)),
48
+ (r'(\[.*?\])([ \t]*)$', bygroups(Keyword, Whitespace)),
49
+ (r'(.*?)([  \t]*)([=:])([ \t]*)([^;#\n]*)(\\)(\s+)',
50
+ bygroups(Name.Attribute, Whitespace, Operator, Whitespace, String,
51
+ Text, Whitespace),
52
+ "value"),
53
+ (r'(.*?)([ \t]*)([=:])([  \t]*)([^ ;#\n]*(?: +[^ ;#\n]+)*)',
54
+ bygroups(Name.Attribute, Whitespace, Operator, Whitespace, String)),
50
55
  # standalone option, supported by some INI parsers
51
56
  (r'(.+?)$', Name.Attribute),
52
57
  ],
58
+ 'value': [ # line continuation
59
+ (r'\s+', Whitespace),
60
+ (r'(\s*)(.*)(\\)([ \t]*)',
61
+ bygroups(Whitespace, String, Text, Whitespace)),
62
+ (r'.*$', String, "#pop"),
63
+ ],
53
64
  }
54
65
 
55
66
  def analyse_text(text):
@@ -61,14 +72,13 @@ class IniLexer(RegexLexer):
61
72
 
62
73
  class RegeditLexer(RegexLexer):
63
74
  """
64
- Lexer for `Windows Registry
65
- <http://en.wikipedia.org/wiki/Windows_Registry#.REG_files>`_ files produced
66
- by regedit.
75
+ Lexer for Windows Registry files produced by regedit.
67
76
 
68
77
  .. versionadded:: 1.6
69
78
  """
70
79
 
71
80
  name = 'reg'
81
+ url = 'http://en.wikipedia.org/wiki/Windows_Registry#.REG_files'
72
82
  aliases = ['registry']
73
83
  filenames = ['*.reg']
74
84
  mimetypes = ['text/x-windows-registry']
@@ -76,17 +86,17 @@ class RegeditLexer(RegexLexer):
76
86
  tokens = {
77
87
  'root': [
78
88
  (r'Windows Registry Editor.*', Text),
79
- (r'\s+', Text),
89
+ (r'\s+', Whitespace),
80
90
  (r'[;#].*', Comment.Single),
81
91
  (r'(\[)(-?)(HKEY_[A-Z_]+)(.*?\])$',
82
92
  bygroups(Keyword, Operator, Name.Builtin, Keyword)),
83
93
  # String keys, which obey somewhat normal escaping
84
94
  (r'("(?:\\"|\\\\|[^"])+")([ \t]*)(=)([ \t]*)',
85
- bygroups(Name.Attribute, Text, Operator, Text),
95
+ bygroups(Name.Attribute, Whitespace, Operator, Whitespace),
86
96
  'value'),
87
97
  # Bare keys (includes @)
88
98
  (r'(.*?)([ \t]*)(=)([ \t]*)',
89
- bygroups(Name.Attribute, Text, Operator, Text),
99
+ bygroups(Name.Attribute, Whitespace, Operator, Whitespace),
90
100
  'value'),
91
101
  ],
92
102
  'value': [
@@ -119,14 +129,42 @@ class PropertiesLexer(RegexLexer):
119
129
 
120
130
  tokens = {
121
131
  'root': [
122
- (r'^(\w+)([ \t])(\w+\s*)$', bygroups(Name.Attribute, Text, String)),
123
- (r'^\w+(\\[ \t]\w*)*$', Name.Attribute),
124
- (r'(^ *)([#!].*)', bygroups(Text, Comment)),
125
- # More controversial comments
126
- (r'(^ *)((?:;|//).*)', bygroups(Text, Comment)),
127
- (r'(.*?)([ \t]*)([=:])([ \t]*)(.*(?:(?<=\\)\n.*)*)',
128
- bygroups(Name.Attribute, Text, Operator, Text, String)),
129
- (r'\s', Text),
132
+ # comments
133
+ (r'[!#].*|/{2}.*', Comment.Single),
134
+ # ending a comment or whitespace-only line
135
+ (r'\n', Whitespace),
136
+ # eat whitespace at the beginning of a line
137
+ (r'^[^\S\n]+', Whitespace),
138
+ # start lexing a key
139
+ default('key'),
140
+ ],
141
+ 'key': [
142
+ # non-escaped key characters
143
+ (r'[^\\:=\s]+', Name.Attribute),
144
+ # escapes
145
+ include('escapes'),
146
+ # separator is the first non-escaped whitespace or colon or '=' on the line;
147
+ # if it's whitespace, = and : are gobbled after it
148
+ (r'([^\S\n]*)([:=])([^\S\n]*)',
149
+ bygroups(Whitespace, Operator, Whitespace),
150
+ ('#pop', 'value')),
151
+ (r'[^\S\n]+', Whitespace, ('#pop', 'value')),
152
+ # maybe we got no value after all
153
+ (r'\n', Whitespace, '#pop'),
154
+ ],
155
+ 'value': [
156
+ # non-escaped value characters
157
+ (r'[^\\\n]+', String),
158
+ # escapes
159
+ include('escapes'),
160
+ # end the value on an unescaped newline
161
+ (r'\n', Whitespace, '#pop'),
162
+ ],
163
+ 'escapes': [
164
+ # line continuations; these gobble whitespace at the beginning of the next line
165
+ (r'(\\\n)([^\S\n]*)', bygroups(String.Escape, Whitespace)),
166
+ # other escapes
167
+ (r'\\(.|\n)', String.Escape),
130
168
  ],
131
169
  }
132
170
 
@@ -182,7 +220,7 @@ class KconfigLexer(RegexLexer):
182
220
 
183
221
  tokens = {
184
222
  'root': [
185
- (r'\s+', Text),
223
+ (r'\s+', Whitespace),
186
224
  (r'#.*?\n', Comment.Single),
187
225
  (words((
188
226
  'mainmenu', 'config', 'menuconfig', 'choice', 'endchoice',
@@ -230,12 +268,13 @@ class KconfigLexer(RegexLexer):
230
268
 
231
269
  class Cfengine3Lexer(RegexLexer):
232
270
  """
233
- Lexer for `CFEngine3 <http://cfengine.org>`_ policy files.
271
+ Lexer for CFEngine3 policy files.
234
272
 
235
273
  .. versionadded:: 1.5
236
274
  """
237
275
 
238
276
  name = 'CFEngine3'
277
+ url = 'http://cfengine.org'
239
278
  aliases = ['cfengine3', 'cf3']
240
279
  filenames = ['*.cf']
241
280
  mimetypes = []
@@ -244,17 +283,17 @@ class Cfengine3Lexer(RegexLexer):
244
283
  'root': [
245
284
  (r'#.*?\n', Comment),
246
285
  (r'(body)(\s+)(\S+)(\s+)(control)',
247
- bygroups(Keyword, Text, Keyword, Text, Keyword)),
286
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Keyword)),
248
287
  (r'(body|bundle)(\s+)(\S+)(\s+)(\w+)(\()',
249
- bygroups(Keyword, Text, Keyword, Text, Name.Function, Punctuation),
288
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Name.Function, Punctuation),
250
289
  'arglist'),
251
290
  (r'(body|bundle)(\s+)(\S+)(\s+)(\w+)',
252
- bygroups(Keyword, Text, Keyword, Text, Name.Function)),
291
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Name.Function)),
253
292
  (r'(")([^"]+)(")(\s+)(string|slist|int|real)(\s*)(=>)(\s*)',
254
293
  bygroups(Punctuation, Name.Variable, Punctuation,
255
- Text, Keyword.Type, Text, Operator, Text)),
294
+ Whitespace, Keyword.Type, Whitespace, Operator, Whitespace)),
256
295
  (r'(\S+)(\s*)(=>)(\s*)',
257
- bygroups(Keyword.Reserved, Text, Operator, Text)),
296
+ bygroups(Keyword.Reserved, Whitespace, Operator, Text)),
258
297
  (r'"', String, 'string'),
259
298
  (r'(\w+)(\()', bygroups(Name.Function, Punctuation)),
260
299
  (r'([\w.!&|()]+)(::)', bygroups(Name.Class, Punctuation)),
@@ -266,7 +305,7 @@ class Cfengine3Lexer(RegexLexer):
266
305
  (r'\d+\.\d+', Number.Float),
267
306
  (r'\d+', Number.Integer),
268
307
  (r'\w+', Name.Function),
269
- (r'\s+', Text),
308
+ (r'\s+', Whitespace),
270
309
  ],
271
310
  'string': [
272
311
  (r'\$[{(]', String.Interpol, 'interpol'),
@@ -284,7 +323,7 @@ class Cfengine3Lexer(RegexLexer):
284
323
  (r'\)', Punctuation, '#pop'),
285
324
  (r',', Punctuation),
286
325
  (r'\w+', Name.Variable),
287
- (r'\s+', Text),
326
+ (r'\s+', Whitespace),
288
327
  ],
289
328
  }
290
329
 
@@ -305,10 +344,10 @@ class ApacheConfLexer(RegexLexer):
305
344
 
306
345
  tokens = {
307
346
  'root': [
308
- (r'\s+', Text),
347
+ (r'\s+', Whitespace),
309
348
  (r'#(.*\\\n)+.*$|(#.*?)$', Comment),
310
349
  (r'(<[^\s>/][^\s>]*)(?:(\s+)(.*))?(>)',
311
- bygroups(Name.Tag, Text, String, Name.Tag)),
350
+ bygroups(Name.Tag, Whitespace, String, Name.Tag)),
312
351
  (r'(</[^\s>]+)(>)',
313
352
  bygroups(Name.Tag, Name.Tag)),
314
353
  (r'[a-z]\w*', Name.Builtin, 'value'),
@@ -316,9 +355,9 @@ class ApacheConfLexer(RegexLexer):
316
355
  ],
317
356
  'value': [
318
357
  (r'\\\n', Text),
319
- (r'$', Text, '#pop'),
358
+ (r'\n+', Whitespace, '#pop'),
320
359
  (r'\\', Text),
321
- (r'[^\S\n]+', Text),
360
+ (r'[^\S\n]+', Whitespace),
322
361
  (r'\d+\.\d+\.\d+\.\d+(?:/\d+)?', Number),
323
362
  (r'\d+', Number),
324
363
  (r'/([*a-z0-9][*\w./-]+)', String.Other),
@@ -334,12 +373,13 @@ class ApacheConfLexer(RegexLexer):
334
373
 
335
374
  class SquidConfLexer(RegexLexer):
336
375
  """
337
- Lexer for `squid <http://www.squid-cache.org/>`_ configuration files.
376
+ Lexer for squid configuration files.
338
377
 
339
378
  .. versionadded:: 0.9
340
379
  """
341
380
 
342
381
  name = 'SquidConf'
382
+ url = 'http://www.squid-cache.org/'
343
383
  aliases = ['squidconf', 'squid.conf', 'squid']
344
384
  filenames = ['squid.conf']
345
385
  mimetypes = ['text/x-squidconf']
@@ -464,18 +504,19 @@ class SquidConfLexer(RegexLexer):
464
504
 
465
505
  class NginxConfLexer(RegexLexer):
466
506
  """
467
- Lexer for `Nginx <http://nginx.net/>`_ configuration files.
507
+ Lexer for Nginx configuration files.
468
508
 
469
509
  .. versionadded:: 0.11
470
510
  """
471
511
  name = 'Nginx configuration file'
512
+ url = 'http://nginx.net/'
472
513
  aliases = ['nginx']
473
514
  filenames = ['nginx.conf']
474
515
  mimetypes = ['text/x-nginx-conf']
475
516
 
476
517
  tokens = {
477
518
  'root': [
478
- (r'(include)(\s+)([^\s;]+)', bygroups(Keyword, Text, Name)),
519
+ (r'(include)(\s+)([^\s;]+)', bygroups(Keyword, Whitespace, Name)),
479
520
  (r'[^\s;#]+', Keyword, 'stmt'),
480
521
  include('base'),
481
522
  ],
@@ -498,11 +539,11 @@ class NginxConfLexer(RegexLexer):
498
539
  (r'[a-z-]+/[a-z-+]+', String), # mimetype
499
540
  # (r'[a-zA-Z._-]+', Keyword),
500
541
  (r'[0-9]+[km]?\b', Number.Integer),
501
- (r'(~)(\s*)([^\s{]+)', bygroups(Punctuation, Text, String.Regex)),
542
+ (r'(~)(\s*)([^\s{]+)', bygroups(Punctuation, Whitespace, String.Regex)),
502
543
  (r'[:=~]', Punctuation),
503
544
  (r'[^\s;#{}$]+', String), # catch all
504
545
  (r'/[^\s;#]*', Name), # pathname
505
- (r'\s+', Text),
546
+ (r'\s+', Whitespace),
506
547
  (r'[$;]', Text), # leftover characters
507
548
  ],
508
549
  }
@@ -510,11 +551,12 @@ class NginxConfLexer(RegexLexer):
510
551
 
511
552
  class LighttpdConfLexer(RegexLexer):
512
553
  """
513
- Lexer for `Lighttpd <http://lighttpd.net/>`_ configuration files.
554
+ Lexer for Lighttpd configuration files.
514
555
 
515
556
  .. versionadded:: 0.11
516
557
  """
517
558
  name = 'Lighttpd configuration file'
559
+ url = 'http://lighttpd.net/'
518
560
  aliases = ['lighttpd', 'lighty']
519
561
  filenames = ['lighttpd.conf']
520
562
  mimetypes = ['text/x-lighttpd-conf']
@@ -530,7 +572,7 @@ class LighttpdConfLexer(RegexLexer):
530
572
  (r'\$[A-Z]+', Name.Builtin),
531
573
  (r'[(){}\[\],]', Punctuation),
532
574
  (r'"([^"\\]*(?:\\.[^"\\]*)*)"', String.Double),
533
- (r'\s+', Text),
575
+ (r'\s+', Whitespace),
534
576
  ],
535
577
 
536
578
  }
@@ -538,11 +580,12 @@ class LighttpdConfLexer(RegexLexer):
538
580
 
539
581
  class DockerLexer(RegexLexer):
540
582
  """
541
- Lexer for `Docker <http://docker.io>`_ configuration files.
583
+ Lexer for Docker configuration files.
542
584
 
543
585
  .. versionadded:: 2.0
544
586
  """
545
587
  name = 'Docker'
588
+ url = 'http://docker.io'
546
589
  aliases = ['docker', 'dockerfile']
547
590
  filenames = ['Dockerfile', '*.docker']
548
591
  mimetypes = ['text/x-dockerfile-config']
@@ -556,38 +599,39 @@ class DockerLexer(RegexLexer):
556
599
  'root': [
557
600
  (r'#.*', Comment),
558
601
  (r'(FROM)([ \t]*)(\S*)([ \t]*)(?:(AS)([ \t]*)(\S*))?',
559
- bygroups(Keyword, Text, String, Text, Keyword, Text, String)),
560
- (r'(ONBUILD)(%s)' % (_lb,), bygroups(Keyword, using(BashLexer))),
561
- (r'(HEALTHCHECK)((%s--\w+=\w+%s)*)' % (_lb, _lb),
562
- bygroups(Keyword, using(BashLexer))),
563
- (r'(VOLUME|ENTRYPOINT|CMD|SHELL)(%s)(\[.*?\])' % (_lb,),
564
- bygroups(Keyword, using(BashLexer), using(JsonLexer))),
565
- (r'(LABEL|ENV|ARG)((%s\w+=\w+%s)*)' % (_lb, _lb),
566
- bygroups(Keyword, using(BashLexer))),
567
- (r'(%s|VOLUME)\b(.*)' % (_keywords), bygroups(Keyword, String)),
568
- (r'(%s)' % (_bash_keywords,), Keyword),
602
+ 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),
605
+ bygroups(Keyword, Whitespace, using(BashLexer))),
606
+ (r'(VOLUME|ENTRYPOINT|CMD|SHELL)(\s+)(%s)(\[.*?\])' % (_lb,),
607
+ bygroups(Keyword, Whitespace, using(BashLexer), using(JsonLexer))),
608
+ (r'(LABEL|ENV|ARG)(\s+)((%s\w+=\w+%s)*)' % (_lb, _lb),
609
+ 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)),
569
612
  (r'(.*\\\n)*.+', using(BashLexer)),
570
613
  ]
571
614
  }
572
615
 
573
616
 
574
- class TerraformLexer(RegexLexer):
617
+ class TerraformLexer(ExtendedRegexLexer):
575
618
  """
576
- Lexer for `terraformi .tf files <https://www.terraform.io/>`_.
619
+ Lexer for terraformi ``.tf`` files.
577
620
 
578
621
  .. versionadded:: 2.1
579
622
  """
580
623
 
581
624
  name = 'Terraform'
582
- aliases = ['terraform', 'tf']
583
- filenames = ['*.tf']
625
+ url = 'https://www.terraform.io/'
626
+ aliases = ['terraform', 'tf', 'hcl']
627
+ filenames = ['*.tf', '*.hcl']
584
628
  mimetypes = ['application/x-tf', 'application/x-terraform']
585
629
 
586
630
  classes = ('backend', 'data', 'module', 'output', 'provider',
587
- 'provisioner', 'resource', 'variable')
631
+ 'provisioner', 'resource', 'variable')
588
632
  classes_re = "({})".format(('|').join(classes))
589
633
 
590
- types = ('string', 'number', 'bool', 'list', 'tuple', 'map', 'object', 'null')
634
+ types = ('string', 'number', 'bool', 'list', 'tuple', 'map', 'set', 'object', 'null')
591
635
 
592
636
  numeric_functions = ('abs', 'ceil', 'floor', 'log', 'max',
593
637
  'mix', 'parseint', 'pow', 'signum')
@@ -611,7 +655,6 @@ class TerraformLexer(RegexLexer):
611
655
  'csvdecode', 'jsondecode', 'jsonencode', 'textdecodebase64',
612
656
  'textencodebase64', 'urlencode', 'yamldecode', 'yamlencode')
613
657
 
614
-
615
658
  filesystem_functions = ('abspath', 'dirname', 'pathexpand', 'basename',
616
659
  'file', 'fileexists', 'fileset', 'filebase64', 'templatefile')
617
660
 
@@ -631,6 +674,43 @@ class TerraformLexer(RegexLexer):
631
674
  type_conversion_functions
632
675
  builtins_re = "({})".format(('|').join(builtins))
633
676
 
677
+ def heredoc_callback(self, match, ctx):
678
+ # Parse a terraform heredoc
679
+ # match: 1 = <<[-]?, 2 = name 3 = rest of line
680
+
681
+ start = match.start(1)
682
+ yield start, Operator, match.group(1) # <<[-]?
683
+ yield match.start(2), String.Delimiter, match.group(2) # heredoc name
684
+
685
+ ctx.pos = match.start(3)
686
+ ctx.end = match.end(3)
687
+ yield ctx.pos, String.Heredoc, match.group(3)
688
+ ctx.pos = match.end()
689
+
690
+ hdname = match.group(2)
691
+ tolerant = True # leading whitespace is always accepted
692
+
693
+ lines = []
694
+
695
+ for match in line_re.finditer(ctx.text, ctx.pos):
696
+ if tolerant:
697
+ check = match.group().strip()
698
+ else:
699
+ check = match.group().rstrip()
700
+ if check == hdname:
701
+ for amatch in lines:
702
+ yield amatch.start(), String.Heredoc, amatch.group()
703
+ yield match.start(), String.Delimiter, match.group()
704
+ ctx.pos = match.end()
705
+ break
706
+ else:
707
+ lines.append(match)
708
+ else:
709
+ # end of heredoc not found -- error!
710
+ for amatch in lines:
711
+ yield amatch.start(), Error, amatch.group()
712
+ ctx.end = len(ctx.text)
713
+
634
714
  tokens = {
635
715
  'root': [
636
716
  include('basic'),
@@ -651,22 +731,22 @@ class TerraformLexer(RegexLexer):
651
731
  ],
652
732
  'basic': [
653
733
  (r'\s*/\*', Comment.Multiline, 'comment'),
654
- (r'\s*#.*\n', Comment.Single),
734
+ (r'\s*(#|//).*\n', Comment.Single),
655
735
  include('whitespace'),
656
736
 
657
737
  # e.g. terraform {
658
738
  # e.g. egress {
659
739
  (r'(\s*)([0-9a-zA-Z-_]+)(\s*)(=?)(\s*)(\{)',
660
- bygroups(Text, Name.Builtin, Text, Operator, Text, Punctuation)),
740
+ bygroups(Whitespace, Name.Builtin, Whitespace, Operator, Whitespace, Punctuation)),
661
741
 
662
742
  # Assignment with attributes, e.g. something = ...
663
743
  (r'(\s*)([0-9a-zA-Z-_]+)(\s*)(=)(\s*)',
664
- bygroups(Text, Name.Attribute, Text, Operator, Text)),
744
+ bygroups(Whitespace, Name.Attribute, Whitespace, Operator, Whitespace)),
665
745
 
666
746
  # Assignment with environment variables and similar, e.g. "something" = ...
667
747
  # or key value assignment, e.g. "SlotName" : ...
668
748
  (r'(\s*)("\S+")(\s*)([=:])(\s*)',
669
- bygroups(Text, Literal.String.Double, Text, Operator, Text)),
749
+ bygroups(Whitespace, Literal.String.Double, Whitespace, Operator, Whitespace)),
670
750
 
671
751
  # Functions, e.g. jsonencode(element("value"))
672
752
  (builtins_re + r'(\()', bygroups(Name.Function, Punctuation)),
@@ -676,17 +756,16 @@ class TerraformLexer(RegexLexer):
676
756
 
677
757
  # e.g. resource "aws_security_group" "allow_tls" {
678
758
  # e.g. backend "consul" {
679
- (classes_re + r'(\s+)', bygroups(Keyword.Reserved, Text), 'blockname'),
680
- ],
681
- 'blockname': [
682
- # e.g. resource "aws_security_group" "allow_tls" {
683
- # e.g. backend "consul" {
684
- (r'(\s*)("[0-9a-zA-Z-_]+")?(\s*)("[0-9a-zA-Z-_]+")(\s+)(\{)',
685
- bygroups(Text, Name.Class, Text, Name.Variable, Text, Punctuation)),
759
+ (classes_re + r'(\s+)("[0-9a-zA-Z-_]+")?(\s*)("[0-9a-zA-Z-_]+")(\s+)(\{)',
760
+ bygroups(Keyword.Reserved, Whitespace, Name.Class, Whitespace, Name.Variable, Whitespace, Punctuation)),
761
+
762
+ # here-doc style delimited strings
763
+ (r'(<<-?)\s*([a-zA-Z_]\w*)(.*?\n)', heredoc_callback),
686
764
  ],
687
765
  'identifier': [
688
766
  (r'\b(var\.[0-9a-zA-Z-_\.\[\]]+)\b', bygroups(Name.Variable)),
689
- (r'\b([0-9a-zA-Z-_\[\]]+\.[0-9a-zA-Z-_\.\[\]]+)\b', bygroups(Name.Variable)),
767
+ (r'\b([0-9a-zA-Z-_\[\]]+\.[0-9a-zA-Z-_\.\[\]]+)\b',
768
+ bygroups(Name.Variable)),
690
769
  ],
691
770
  'punctuation': [
692
771
  (r'[\[\]()\{\},.?:!=]', Punctuation),
@@ -698,9 +777,9 @@ class TerraformLexer(RegexLexer):
698
777
  (r'[*/]', Comment.Multiline)
699
778
  ],
700
779
  'whitespace': [
701
- (r'\n', Text),
702
- (r'\s+', Text),
703
- (r'\\\n', Text),
780
+ (r'\n', Whitespace),
781
+ (r'\s+', Whitespace),
782
+ (r'(\\)(\n)', bygroups(Text, Whitespace)),
704
783
  ],
705
784
  }
706
785
 
@@ -725,18 +804,19 @@ class TermcapLexer(RegexLexer):
725
804
  # * space after separator is not allowed (mayve)
726
805
  tokens = {
727
806
  'root': [
728
- (r'^#.*$', Comment),
807
+ (r'^#.*', Comment),
729
808
  (r'^[^\s#:|]+', Name.Tag, 'names'),
809
+ (r'\s+', Whitespace),
730
810
  ],
731
811
  'names': [
732
- (r'\n', Text, '#pop'),
812
+ (r'\n', Whitespace, '#pop'),
733
813
  (r':', Punctuation, 'defs'),
734
814
  (r'\|', Punctuation),
735
815
  (r'[^:|]+', Name.Attribute),
736
816
  ],
737
817
  'defs': [
738
- (r'\\\n[ \t]*', Text),
739
- (r'\n[ \t]*', Text, '#pop:2'),
818
+ (r'(\\)(\n[ \t]*)', bygroups(Text, Whitespace)),
819
+ (r'\n[ \t]*', Whitespace, '#pop:2'),
740
820
  (r'(#)([0-9]+)', bygroups(Operator, Number)),
741
821
  (r'=', Operator, 'data'),
742
822
  (r':', Punctuation),
@@ -773,24 +853,25 @@ class TerminfoLexer(RegexLexer):
773
853
  'root': [
774
854
  (r'^#.*$', Comment),
775
855
  (r'^[^\s#,|]+', Name.Tag, 'names'),
856
+ (r'\s+', Whitespace),
776
857
  ],
777
858
  'names': [
778
- (r'\n', Text, '#pop'),
779
- (r'(,)([ \t]*)', bygroups(Punctuation, Text), 'defs'),
859
+ (r'\n', Whitespace, '#pop'),
860
+ (r'(,)([ \t]*)', bygroups(Punctuation, Whitespace), 'defs'),
780
861
  (r'\|', Punctuation),
781
862
  (r'[^,|]+', Name.Attribute),
782
863
  ],
783
864
  'defs': [
784
- (r'\n[ \t]+', Text),
785
- (r'\n', Text, '#pop:2'),
865
+ (r'\n[ \t]+', Whitespace),
866
+ (r'\n', Whitespace, '#pop:2'),
786
867
  (r'(#)([0-9]+)', bygroups(Operator, Number)),
787
868
  (r'=', Operator, 'data'),
788
- (r'(,)([ \t]*)', bygroups(Punctuation, Text)),
869
+ (r'(,)([ \t]*)', bygroups(Punctuation, Whitespace)),
789
870
  (r'[^\s,=#]+', Name.Class),
790
871
  ],
791
872
  'data': [
792
873
  (r'\\[,\\]', Literal),
793
- (r'(,)([ \t]*)', bygroups(Punctuation, Text), '#pop'),
874
+ (r'(,)([ \t]*)', bygroups(Punctuation, Whitespace), '#pop'),
794
875
  (r'[^\\,]+', Literal), # for performance
795
876
  (r'.', Literal),
796
877
  ],
@@ -799,14 +880,14 @@ class TerminfoLexer(RegexLexer):
799
880
 
800
881
  class PkgConfigLexer(RegexLexer):
801
882
  """
802
- Lexer for `pkg-config
803
- <http://www.freedesktop.org/wiki/Software/pkg-config/>`_
883
+ Lexer for pkg-config
804
884
  (see also `manual page <http://linux.die.net/man/1/pkg-config>`_).
805
885
 
806
886
  .. versionadded:: 2.1
807
887
  """
808
888
 
809
889
  name = 'PkgConfig'
890
+ url = 'http://www.freedesktop.org/wiki/Software/pkg-config/'
810
891
  aliases = ['pkgconfig']
811
892
  filenames = ['*.pc']
812
893
  mimetypes = []
@@ -826,6 +907,7 @@ class PkgConfigLexer(RegexLexer):
826
907
  include('interp'),
827
908
 
828
909
  # fallback
910
+ (r'\s+', Whitespace),
829
911
  (r'[^${}#=:\n.]+', Text),
830
912
  (r'.', Text),
831
913
  ],
@@ -844,10 +926,11 @@ class PkgConfigLexer(RegexLexer):
844
926
  include('interp'),
845
927
 
846
928
  (r'#.*$', Comment.Single, '#pop'),
847
- (r'\n', Text, '#pop'),
929
+ (r'\n', Whitespace, '#pop'),
848
930
 
849
931
  # fallback
850
- (r'[^${}#\n]+', Text),
932
+ (r'\s+', Whitespace),
933
+ (r'[^${}#\n\s]+', Text),
851
934
  (r'.', Text),
852
935
  ],
853
936
  }
@@ -855,8 +938,7 @@ class PkgConfigLexer(RegexLexer):
855
938
 
856
939
  class PacmanConfLexer(RegexLexer):
857
940
  """
858
- Lexer for `pacman.conf
859
- <https://www.archlinux.org/pacman/pacman.conf.5.html>`_.
941
+ Lexer for pacman.conf.
860
942
 
861
943
  Actually, IniLexer works almost fine for this format,
862
944
  but it yield error token. It is because pacman.conf has
@@ -874,6 +956,7 @@ class PacmanConfLexer(RegexLexer):
874
956
  """
875
957
 
876
958
  name = 'PacmanConf'
959
+ url = 'https://www.archlinux.org/pacman/pacman.conf.5.html'
877
960
  aliases = ['pacmanconf']
878
961
  filenames = ['pacman.conf']
879
962
  mimetypes = []
@@ -884,16 +967,16 @@ class PacmanConfLexer(RegexLexer):
884
967
  (r'#.*$', Comment.Single),
885
968
 
886
969
  # section header
887
- (r'^\s*\[.*?\]\s*$', Keyword),
970
+ (r'^(\s*)(\[.*?\])(\s*)$', bygroups(Whitespace, Keyword, Whitespace)),
888
971
 
889
972
  # variable definitions
890
973
  # (Leading space is allowed...)
891
974
  (r'(\w+)(\s*)(=)',
892
- bygroups(Name.Attribute, Text, Operator)),
975
+ bygroups(Name.Attribute, Whitespace, Operator)),
893
976
 
894
977
  # flags to on
895
978
  (r'^(\s*)(\w+)(\s*)$',
896
- bygroups(Text, Name.Attribute, Text)),
979
+ bygroups(Whitespace, Name.Attribute, Whitespace)),
897
980
 
898
981
  # built-in special values
899
982
  (words((
@@ -905,6 +988,7 @@ class PacmanConfLexer(RegexLexer):
905
988
  Name.Variable),
906
989
 
907
990
  # fallback
991
+ (r'\s+', Whitespace),
908
992
  (r'.', Text),
909
993
  ],
910
994
  }
@@ -912,19 +996,20 @@ class PacmanConfLexer(RegexLexer):
912
996
 
913
997
  class AugeasLexer(RegexLexer):
914
998
  """
915
- Lexer for `Augeas <http://augeas.net>`_.
999
+ Lexer for Augeas.
916
1000
 
917
1001
  .. versionadded:: 2.4
918
1002
  """
919
1003
  name = 'Augeas'
1004
+ url = 'http://augeas.net'
920
1005
  aliases = ['augeas']
921
1006
  filenames = ['*.aug']
922
1007
 
923
1008
  tokens = {
924
1009
  'root': [
925
- (r'(module)(\s*)([^\s=]+)', bygroups(Keyword.Namespace, Text, Name.Namespace)),
926
- (r'(let)(\s*)([^\s=]+)', bygroups(Keyword.Declaration, Text, Name.Variable)),
927
- (r'(del|store|value|counter|seq|key|label|autoload|incl|excl|transform|test|get|put)(\s+)', bygroups(Name.Builtin, Text)),
1010
+ (r'(module)(\s*)([^\s=]+)', bygroups(Keyword.Namespace, Whitespace, Name.Namespace)),
1011
+ (r'(let)(\s*)([^\s=]+)', bygroups(Keyword.Declaration, Whitespace, Name.Variable)),
1012
+ (r'(del|store|value|counter|seq|key|label|autoload|incl|excl|transform|test|get|put)(\s+)', bygroups(Name.Builtin, Whitespace)),
928
1013
  (r'(\()([^:]+)(\:)(unit|string|regexp|lens|tree|filter)(\))', bygroups(Punctuation, Name.Variable, Punctuation, Keyword.Type, Punctuation)),
929
1014
  (r'\(\*', Comment.Multiline, 'comment'),
930
1015
  (r'[*+\-.;=?|]', Operator),
@@ -933,7 +1018,7 @@ class AugeasLexer(RegexLexer):
933
1018
  (r'\/', String.Regex, 'regex'),
934
1019
  (r'([A-Z]\w*)(\.)(\w+)', bygroups(Name.Namespace, Punctuation, Name.Variable)),
935
1020
  (r'.', Name.Variable),
936
- (r'\s', Text),
1021
+ (r'\s+', Whitespace),
937
1022
  ],
938
1023
  'string': [
939
1024
  (r'\\.', String.Escape),
@@ -956,24 +1041,25 @@ class AugeasLexer(RegexLexer):
956
1041
 
957
1042
  class TOMLLexer(RegexLexer):
958
1043
  """
959
- Lexer for `TOML <https://github.com/toml-lang/toml>`_, a simple language
1044
+ Lexer for TOML, a simple language
960
1045
  for config files.
961
1046
 
962
1047
  .. versionadded:: 2.4
963
1048
  """
964
1049
 
965
1050
  name = 'TOML'
1051
+ url = 'https://github.com/toml-lang/toml'
966
1052
  aliases = ['toml']
967
1053
  filenames = ['*.toml', 'Pipfile', 'poetry.lock']
968
1054
 
969
1055
  tokens = {
970
1056
  'root': [
971
1057
  # Table
972
- (r'^(\s*)(\[.*?\])$', bygroups(Text, Keyword)),
1058
+ (r'^(\s*)(\[.*?\])$', bygroups(Whitespace, Keyword)),
973
1059
 
974
1060
  # Basics, comments, strings
975
- (r'[ \t]+', Text),
976
- (r'\n', Text),
1061
+ (r'[ \t]+', Whitespace),
1062
+ (r'\n', Whitespace),
977
1063
  (r'#.*?$', Comment.Single),
978
1064
  # Basic string
979
1065
  (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
@@ -1007,13 +1093,14 @@ class TOMLLexer(RegexLexer):
1007
1093
 
1008
1094
  class NestedTextLexer(RegexLexer):
1009
1095
  """
1010
- Lexer for `NextedText <https://nestedtext.org>`_, a human-friendly data
1096
+ Lexer for NextedText, a human-friendly data
1011
1097
  format.
1012
-
1098
+
1013
1099
  .. versionadded:: 2.9
1014
1100
  """
1015
1101
 
1016
1102
  name = 'NestedText'
1103
+ url = 'https://nestedtext.org'
1017
1104
  aliases = ['nestedtext', 'nt']
1018
1105
  filenames = ['*.nt']
1019
1106
 
@@ -1021,40 +1108,41 @@ class NestedTextLexer(RegexLexer):
1021
1108
 
1022
1109
  tokens = {
1023
1110
  'root': [
1024
- (r'^(\s*)(#.*?)$', bygroups(Text, Comment)),
1025
- (r'^(\s*)(> ?)(.*?)(\s*)$', bygroups(Text, Punctuation, String, Whitespace)),
1026
- (r'^(\s*)(- ?)(.*?)(\s*)$', bygroups(Text, Punctuation, String, Whitespace)),
1027
- (_quoted_dict_item.format("'"), bygroups(Text, Punctuation, Name, Punctuation, String, Whitespace)),
1028
- (_quoted_dict_item.format('"'), bygroups(Text, Punctuation, Name, Punctuation, String, Whitespace)),
1029
- (r'^(\s*)(.*?)(: ?)(.*?)(\s*)$', bygroups(Text, Name, Punctuation, String, Whitespace)),
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)),
1030
1117
  ],
1031
1118
  }
1032
-
1119
+
1033
1120
 
1034
1121
  class SingularityLexer(RegexLexer):
1035
1122
  """
1036
- Lexer for `Singularity definition files
1037
- <https://www.sylabs.io/guides/3.0/user-guide/definition_files.html>`_.
1123
+ Lexer for Singularity definition files.
1038
1124
 
1039
1125
  .. versionadded:: 2.6
1040
1126
  """
1041
1127
 
1042
1128
  name = 'Singularity'
1129
+ url = 'https://www.sylabs.io/guides/3.0/user-guide/definition_files.html'
1043
1130
  aliases = ['singularity']
1044
1131
  filenames = ['*.def', 'Singularity']
1045
1132
  flags = re.IGNORECASE | re.MULTILINE | re.DOTALL
1046
1133
 
1047
1134
  _headers = r'^(\s*)(bootstrap|from|osversion|mirrorurl|include|registry|namespace|includecmd)(:)'
1048
- _section = r'^%(?:pre|post|setup|environment|help|labels|test|runscript|files|startscript)\b'
1049
- _appsect = r'^%app(?:install|help|run|labels|env|test|files)\b'
1135
+ _section = r'^(%(?:pre|post|setup|environment|help|labels|test|runscript|files|startscript))(\s*)'
1136
+ _appsect = r'^(%app(?:install|help|run|labels|env|test|files))(\s*)'
1050
1137
 
1051
1138
  tokens = {
1052
1139
  'root': [
1053
- (_section, Generic.Heading, 'script'),
1054
- (_appsect, Generic.Heading, 'script'),
1055
- (_headers, bygroups(Text, Keyword, Text)),
1140
+ (_section, bygroups(Generic.Heading, Whitespace), 'script'),
1141
+ (_appsect, bygroups(Generic.Heading, Whitespace), 'script'),
1142
+ (_headers, bygroups(Whitespace, Keyword, Text)),
1056
1143
  (r'\s*#.*?\n', Comment),
1057
1144
  (r'\b(([0-9]+\.?[0-9]*)|(\.[0-9]+))\b', Number),
1145
+ (r'[ \t]+', Whitespace),
1058
1146
  (r'(?!^\s*%).', Text),
1059
1147
  ],
1060
1148
  'script': [
@@ -1073,3 +1161,30 @@ class SingularityLexer(RegexLexer):
1073
1161
  result += 0.49
1074
1162
 
1075
1163
  return result
1164
+
1165
+
1166
+ class UnixConfigLexer(RegexLexer):
1167
+ """
1168
+ Lexer for Unix/Linux config files using colon-separated values, e.g.
1169
+
1170
+ * ``/etc/group``
1171
+ * ``/etc/passwd``
1172
+ * ``/etc/shadow``
1173
+
1174
+ .. versionadded:: 2.12
1175
+ """
1176
+
1177
+ name = 'Unix/Linux config files'
1178
+ aliases = ['unixconfig', 'linuxconfig']
1179
+ filenames = []
1180
+
1181
+ tokens = {
1182
+ 'root': [
1183
+ (r'^#.*', Comment),
1184
+ (r'\n', Whitespace),
1185
+ (r':', Punctuation),
1186
+ (r'[0-9]+', Number),
1187
+ (r'((?!\n)[a-zA-Z0-9\_\-\s\(\),]){2,}', Text),
1188
+ (r'[^:\n]+', String),
1189
+ ],
1190
+ }