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,7 +4,7 @@
4
4
 
5
5
  Lexers for C/C++ languages.
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
 
@@ -25,9 +25,6 @@ class CFamilyLexer(RegexLexer):
25
25
  definitions.
26
26
  """
27
27
 
28
- #: optional Comment or Whitespace
29
- _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
30
-
31
28
  # The trailing ?, rather than *, avoids a geometric performance drop here.
32
29
  #: only one /* */ style comment
33
30
  _ws1 = r'\s*(?:/[*].*?[*]/\s*)?'
@@ -42,8 +39,19 @@ class CFamilyLexer(RegexLexer):
42
39
  _intsuffix = r'(([uU][lL]{0,2})|[lL]{1,2}[uU]?)?'
43
40
 
44
41
  # Identifier regex with C and C++ Universal Character Name (UCN) support.
45
- _ident = r'(?:[a-zA-Z_$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})*'
46
- _namespaced_ident = r'(?:[a-zA-Z_$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|::)*'
42
+ _ident = r'(?!\d)(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})+'
43
+ _namespaced_ident = r'(?!\d)(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|::)+'
44
+
45
+ # Single and multiline comment regexes
46
+ # Beware not to use *? for the inner content! When these regexes
47
+ # are embedded in larger regexes, that can cause the stuff*? to
48
+ # match more than it would have if the regex had been used in
49
+ # a standalone way ...
50
+ _comment_single = r'//(?:.|(?<=\\)\n)*\n'
51
+ _comment_multiline = r'/(?:\\\n)?[*](?:[^*]|[*](?!(?:\\\n)?/))*[*](?:\\\n)?/'
52
+
53
+ # Regex to match optional comments
54
+ _possible_comments = rf'\s*(?:(?:(?:{_comment_single})|(?:{_comment_multiline}))\s*)*'
47
55
 
48
56
  tokens = {
49
57
  'whitespace': [
@@ -55,12 +63,20 @@ class CFamilyLexer(RegexLexer):
55
63
  bygroups(using(this), Comment.Preproc), 'if0'),
56
64
  ('^(' + _ws1 + ')(#)',
57
65
  bygroups(using(this), Comment.Preproc), 'macro'),
66
+ # Labels:
67
+ # Line start and possible indentation.
68
+ (r'(^[ \t]*)'
69
+ # Not followed by keywords which can be mistaken as labels.
70
+ r'(?!(?:public|private|protected|default)\b)'
71
+ # Actual label, followed by a single colon.
72
+ r'(' + _ident + r')(\s*)(:)(?!:)',
73
+ bygroups(Whitespace, Name.Label, Whitespace, Punctuation)),
58
74
  (r'\n', Whitespace),
59
75
  (r'[^\S\n]+', Whitespace),
60
76
  (r'\\\n', Text), # line continuation
61
- (r'//(\n|[\w\W]*?[^\\]\n)', Comment.Single),
62
- (r'/(\\\n)?[*][\w\W]*?[*](\\\n)?/', Comment.Multiline),
63
- # Open until EOF, so no ending delimeter
77
+ (_comment_single, Comment.Single),
78
+ (_comment_multiline, Comment.Multiline),
79
+ # Open until EOF, so no ending delimiter
64
80
  (r'/(\\\n)?[*][\w\W]*', Comment.Multiline),
65
81
  ],
66
82
  'statements': [
@@ -71,10 +87,13 @@ class CFamilyLexer(RegexLexer):
71
87
  bygroups(String.Affix, String.Char, String.Char, String.Char)),
72
88
 
73
89
  # Hexadecimal floating-point literals (C11, C++17)
74
- (r'0[xX](' + _hexpart + r'\.' + _hexpart + r'|\.' + _hexpart + r'|' + _hexpart + r')[pP][+-]?' + _hexpart + r'[lL]?', Number.Float),
90
+ (r'0[xX](' + _hexpart + r'\.' + _hexpart + r'|\.' + _hexpart +
91
+ r'|' + _hexpart + r')[pP][+-]?' + _hexpart + r'[lL]?', Number.Float),
75
92
 
76
- (r'(-)?(' + _decpart + r'\.' + _decpart + r'|\.' + _decpart + r'|' + _decpart + r')[eE][+-]?' + _decpart + r'[fFlL]?', Number.Float),
77
- (r'(-)?((' + _decpart + r'\.(' + _decpart + r')?|\.' + _decpart + r')[fFlL]?)|(' + _decpart + r'[fFlL])', Number.Float),
93
+ (r'(-)?(' + _decpart + r'\.' + _decpart + r'|\.' + _decpart + r'|' +
94
+ _decpart + r')[eE][+-]?' + _decpart + r'[fFlL]?', Number.Float),
95
+ (r'(-)?((' + _decpart + r'\.(' + _decpart + r')?|\.' +
96
+ _decpart + r')[fFlL]?)|(' + _decpart + r'[fFlL])', Number.Float),
78
97
  (r'(-)?0[xX]' + _hexpart + _intsuffix, Number.Hex),
79
98
  (r'(-)?0[bB][01](\'?[01])*' + _intsuffix, Number.Bin),
80
99
  (r'(-)?0(\'?[0-7])+' + _intsuffix, Number.Oct),
@@ -82,7 +101,6 @@ class CFamilyLexer(RegexLexer):
82
101
  (r'[~!%^&*+=|?:<>/-]', Operator),
83
102
  (r'[()\[\],.]', Punctuation),
84
103
  (r'(true|false|NULL)\b', Name.Builtin),
85
- (r'(' + _ident + r')(\s*)(:)(?!:)', bygroups(Name.Label, Text, Punctuation)),
86
104
  (_ident, Name)
87
105
  ],
88
106
  'types': [
@@ -92,10 +110,11 @@ class CFamilyLexer(RegexLexer):
92
110
  'unsigned', 'signed', 'void'), suffix=r'\b'), Keyword.Type)
93
111
  ],
94
112
  'keywords': [
95
- (r'(struct|union)(\s+)', bygroups(Keyword, Text), 'classname'),
96
- (words(('asm', 'auto', 'break', 'case', 'const', 'continue',
97
- 'default', 'do', 'else', 'enum', 'extern', 'for', 'goto',
98
- 'if', 'register', 'restricted', 'return', 'sizeof', 'struct',
113
+ (r'(struct|union)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
114
+ (r'case\b', Keyword, 'case-value'),
115
+ (words(('asm', 'auto', 'break', 'const', 'continue', 'default',
116
+ 'do', 'else', 'enum', 'extern', 'for', 'goto', 'if',
117
+ 'register', 'restricted', 'return', 'sizeof', 'struct',
99
118
  'static', 'switch', 'typedef', 'volatile', 'while', 'union',
100
119
  'thread_local', 'alignas', 'alignof', 'static_assert', '_Pragma'),
101
120
  suffix=r'\b'), Keyword),
@@ -116,19 +135,30 @@ class CFamilyLexer(RegexLexer):
116
135
  include('keywords'),
117
136
  # functions
118
137
  (r'(' + _namespaced_ident + r'(?:[&*\s])+)' # return arguments
138
+ r'(' + _possible_comments + r')'
119
139
  r'(' + _namespaced_ident + r')' # method name
120
- r'(\s*\([^;]*?\))' # signature
121
- r'([^;{]*)(\{)',
122
- bygroups(using(this), Name.Function, using(this), using(this),
123
- Punctuation),
140
+ r'(' + _possible_comments + r')'
141
+ r'(\([^;"\')]*?\))' # signature
142
+ r'(' + _possible_comments + r')'
143
+ r'([^;{/"\']*)(\{)',
144
+ bygroups(using(this), using(this, state='whitespace'),
145
+ Name.Function, using(this, state='whitespace'),
146
+ using(this), using(this, state='whitespace'),
147
+ using(this), Punctuation),
124
148
  'function'),
125
149
  # function declarations
126
150
  (r'(' + _namespaced_ident + r'(?:[&*\s])+)' # return arguments
151
+ r'(' + _possible_comments + r')'
127
152
  r'(' + _namespaced_ident + r')' # method name
128
- r'(\s*\([^;]*?\))' # signature
129
- r'([^;]*)(;)',
130
- bygroups(using(this), Name.Function, using(this), using(this),
131
- Punctuation)),
153
+ r'(' + _possible_comments + r')'
154
+ r'(\([^;"\')]*?\))' # signature
155
+ r'(' + _possible_comments + r')'
156
+ r'([^;/"\']*)(;)',
157
+ bygroups(using(this), using(this, state='whitespace'),
158
+ Name.Function, using(this, state='whitespace'),
159
+ using(this), using(this, state='whitespace'),
160
+ using(this), Punctuation)),
161
+ include('types'),
132
162
  default('statement'),
133
163
  ],
134
164
  'statement': [
@@ -154,9 +184,11 @@ class CFamilyLexer(RegexLexer):
154
184
  ],
155
185
  'macro': [
156
186
  (r'('+_ws1+r')(include)('+_ws1+r')("[^"]+")([^\n]*)',
157
- bygroups(using(this), Comment.Preproc, using(this), Comment.PreprocFile, Comment.Single)),
187
+ bygroups(using(this), Comment.Preproc, using(this),
188
+ Comment.PreprocFile, Comment.Single)),
158
189
  (r'('+_ws1+r')(include)('+_ws1+r')(<[^>]+>)([^\n]*)',
159
- bygroups(using(this), Comment.Preproc, using(this), Comment.PreprocFile, Comment.Single)),
190
+ bygroups(using(this), Comment.Preproc, using(this),
191
+ Comment.PreprocFile, Comment.Single)),
160
192
  (r'[^/\n]+', Comment.Preproc),
161
193
  (r'/[*](.|\n)*?[*]/', Comment.Multiline),
162
194
  (r'//.*?\n', Comment.Single, '#pop'),
@@ -175,6 +207,13 @@ class CFamilyLexer(RegexLexer):
175
207
  # template specification
176
208
  (r'\s*(?=>)', Text, '#pop'),
177
209
  default('#pop')
210
+ ],
211
+ # Mark identifiers preceded by `case` keyword as constants.
212
+ 'case-value': [
213
+ (r'(?<!:)(:)(?!:)', Punctuation, '#pop'),
214
+ (_ident, Name.Constant),
215
+ include('whitespace'),
216
+ include('statements'),
178
217
  ]
179
218
  }
180
219
 
@@ -194,12 +233,12 @@ class CFamilyLexer(RegexLexer):
194
233
  'mode_t', 'nfds_t', 'pid_t', 'rlim_t', 'sig_t', 'sighandler_t', 'siginfo_t',
195
234
  'sigset_t', 'sigval_t', 'socklen_t', 'timer_t', 'uid_t'}
196
235
  c11_atomic_types = {
197
- 'atomic_bool', 'atomic_char', 'atomic_schar', 'atomic_uchar', 'atomic_short',
236
+ 'atomic_bool', 'atomic_char', 'atomic_schar', 'atomic_uchar', 'atomic_short',
198
237
  'atomic_ushort', 'atomic_int', 'atomic_uint', 'atomic_long', 'atomic_ulong',
199
- 'atomic_llong', 'atomic_ullong', 'atomic_char16_t', 'atomic_char32_t', 'atomic_wchar_t',
200
- 'atomic_int_least8_t', 'atomic_uint_least8_t', 'atomic_int_least16_t',
238
+ 'atomic_llong', 'atomic_ullong', 'atomic_char16_t', 'atomic_char32_t', 'atomic_wchar_t',
239
+ 'atomic_int_least8_t', 'atomic_uint_least8_t', 'atomic_int_least16_t',
201
240
  'atomic_uint_least16_t', 'atomic_int_least32_t', 'atomic_uint_least32_t',
202
- 'atomic_int_least64_t', 'atomic_uint_least64_t', 'atomic_int_fast8_t',
241
+ 'atomic_int_least64_t', 'atomic_uint_least64_t', 'atomic_int_fast8_t',
203
242
  'atomic_uint_fast8_t', 'atomic_int_fast16_t', 'atomic_uint_fast16_t',
204
243
  'atomic_int_fast32_t', 'atomic_uint_fast32_t', 'atomic_int_fast64_t',
205
244
  'atomic_uint_fast64_t', 'atomic_intptr_t', 'atomic_uintptr_t', 'atomic_size_t',
@@ -212,9 +251,9 @@ class CFamilyLexer(RegexLexer):
212
251
  self.platformhighlighting = get_bool_opt(options, 'platformhighlighting', True)
213
252
  RegexLexer.__init__(self, **options)
214
253
 
215
- def get_tokens_unprocessed(self, text):
254
+ def get_tokens_unprocessed(self, text, stack=('root',)):
216
255
  for index, token, value in \
217
- RegexLexer.get_tokens_unprocessed(self, text):
256
+ RegexLexer.get_tokens_unprocessed(self, text, stack):
218
257
  if token is Name:
219
258
  if self.stdlibhighlighting and value in self.stdlib_types:
220
259
  token = Keyword.Type
@@ -252,14 +291,14 @@ class CLexer(CFamilyLexer):
252
291
  """
253
292
  name = 'C'
254
293
  aliases = ['c']
255
- filenames = ['*.c', '*.h', '*.idc']
256
- mimetypes = ['text/x-chdr', 'text/x-csrc']
294
+ filenames = ['*.c', '*.h', '*.idc', '*.x[bp]m']
295
+ mimetypes = ['text/x-chdr', 'text/x-csrc', 'image/x-xbitmap', 'image/x-xpixmap']
257
296
  priority = 0.1
258
297
 
259
298
  tokens = {
260
299
  'keywords': [
261
300
  (words((
262
- '_Alignas', '_Alignof', '_Noreturn', '_Generic', '_Thread_local',
301
+ '_Alignas', '_Alignof', '_Noreturn', '_Generic', '_Thread_local',
263
302
  '_Static_assert', '_Imaginary', 'noreturn', 'imaginary', 'complex'),
264
303
  suffix=r'\b'), Keyword),
265
304
  inherit
@@ -301,10 +340,11 @@ class CppLexer(CFamilyLexer):
301
340
  (default: ``True``).
302
341
  """
303
342
  name = 'C++'
343
+ url = 'https://isocpp.org/'
304
344
  aliases = ['cpp', 'c++']
305
345
  filenames = ['*.cpp', '*.hpp', '*.c++', '*.h++',
306
346
  '*.cc', '*.hh', '*.cxx', '*.hxx',
307
- '*.C', '*.H', '*.cp', '*.CPP']
347
+ '*.C', '*.H', '*.cp', '*.CPP', '*.tpp']
308
348
  mimetypes = ['text/x-c++hdr', 'text/x-c++src']
309
349
  priority = 0.1
310
350
 
@@ -335,19 +375,19 @@ class CppLexer(CFamilyLexer):
335
375
  default('#pop')
336
376
  ],
337
377
  'keywords': [
338
- (r'(class|concept|typename)(\s+)', bygroups(Keyword, Text), 'classname'),
378
+ (r'(class|concept|typename)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
339
379
  (words((
340
380
  'catch', 'const_cast', 'delete', 'dynamic_cast', 'explicit',
341
381
  'export', 'friend', 'mutable', 'new', 'operator',
342
382
  'private', 'protected', 'public', 'reinterpret_cast', 'class',
343
383
  'restrict', 'static_cast', 'template', 'this', 'throw', 'throws',
344
384
  'try', 'typeid', 'using', 'virtual', 'constexpr', 'nullptr', 'concept',
345
- 'decltype', 'noexcept', 'override', 'final', 'constinit', 'consteval',
385
+ 'decltype', 'noexcept', 'override', 'final', 'constinit', 'consteval',
346
386
  'co_await', 'co_return', 'co_yield', 'requires', 'import', 'module',
347
387
  'typename'),
348
388
  suffix=r'\b'), Keyword),
349
389
  (r'namespace\b', Keyword, 'namespace'),
350
- (r'(enum)(\s+)', bygroups(Keyword, Text), 'enumname'),
390
+ (r'(enum)(\s+)', bygroups(Keyword, Whitespace), 'enumname'),
351
391
  inherit
352
392
  ],
353
393
  'types': [
@@ -4,7 +4,7 @@
4
4
 
5
5
  Lexers for other C-like languages.
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
 
@@ -38,10 +38,11 @@ class PikeLexer(CppLexer):
38
38
  'statements': [
39
39
  (words((
40
40
  'catch', 'new', 'private', 'protected', 'public', 'gauge',
41
- 'throw', 'throws', 'class', 'interface', 'implement', 'abstract', 'extends', 'from',
42
- 'this', 'super', 'constant', 'final', 'static', 'import', 'use', 'extern',
43
- 'inline', 'proto', 'break', 'continue', 'if', 'else', 'for',
44
- 'while', 'do', 'switch', 'case', 'as', 'in', 'version', 'return', 'true', 'false', 'null',
41
+ 'throw', 'throws', 'class', 'interface', 'implement', 'abstract',
42
+ 'extends', 'from', 'this', 'super', 'constant', 'final', 'static',
43
+ 'import', 'use', 'extern', 'inline', 'proto', 'break', 'continue',
44
+ 'if', 'else', 'for', 'while', 'do', 'switch', 'case', 'as', 'in',
45
+ 'version', 'return', 'true', 'false', 'null',
45
46
  '__VERSION__', '__MAJOR__', '__MINOR__', '__BUILD__', '__REAL_VERSION__',
46
47
  '__REAL_MAJOR__', '__REAL_MINOR__', '__REAL_BUILD__', '__DATE__', '__TIME__',
47
48
  '__FILE__', '__DIR__', '__LINE__', '__AUTO_BIGNUM__', '__NT__', '__PIKE__',
@@ -51,14 +52,14 @@ class PikeLexer(CppLexer):
51
52
  r'array|multiset|program|function|lambda|mixed|'
52
53
  r'[a-z_][a-z0-9_]*_t)\b',
53
54
  Keyword.Type),
54
- (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'),
55
+ (r'(class)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
55
56
  (r'[~!%^&*+=|?:<>/@-]', Operator),
56
57
  inherit,
57
58
  ],
58
59
  'classname': [
59
60
  (r'[a-zA-Z_]\w*', Name.Class, '#pop'),
60
61
  # template specification
61
- (r'\s*(?=>)', Text, '#pop'),
62
+ (r'\s*(?=>)', Whitespace, '#pop'),
62
63
  ],
63
64
  }
64
65
 
@@ -104,7 +105,7 @@ class ClayLexer(RegexLexer):
104
105
  mimetypes = ['text/x-clay']
105
106
  tokens = {
106
107
  'root': [
107
- (r'\s', Text),
108
+ (r'\s+', Whitespace),
108
109
  (r'//.*?$', Comment.Single),
109
110
  (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
110
111
  (r'\b(public|private|import|as|record|variant|instance'
@@ -126,7 +127,7 @@ class ClayLexer(RegexLexer):
126
127
  ],
127
128
  'strings': [
128
129
  (r'(?i)\\(x[0-9a-f]{2}|.)', String.Escape),
129
- (r'.', String),
130
+ (r'[^\\"]+', String),
130
131
  ],
131
132
  'nl': [
132
133
  (r'\n', String),
@@ -169,7 +170,7 @@ class ECLexer(CLexer):
169
170
  (words(('uint', 'uint16', 'uint32', 'uint64', 'bool', 'byte',
170
171
  'unichar', 'int64'), suffix=r'\b'),
171
172
  Keyword.Type),
172
- (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'),
173
+ (r'(class)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
173
174
  (r'(null|value|this)\b', Name.Builtin),
174
175
  inherit,
175
176
  ]
@@ -190,8 +191,8 @@ class ValaLexer(RegexLexer):
190
191
  tokens = {
191
192
  'whitespace': [
192
193
  (r'^\s*#if\s+0', Comment.Preproc, 'if0'),
193
- (r'\n', Text),
194
- (r'\s+', Text),
194
+ (r'\n', Whitespace),
195
+ (r'\s+', Whitespace),
195
196
  (r'\\\n', Text), # line continuation
196
197
  (r'//(\n|(.|\n)*?[^\\]\n)', Comment.Single),
197
198
  (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
@@ -226,10 +227,10 @@ class ValaLexer(RegexLexer):
226
227
  'public', 'ref', 'requires', 'signal', 'static', 'throws', 'unowned',
227
228
  'var', 'virtual', 'volatile', 'weak', 'yields'), suffix=r'\b'),
228
229
  Keyword.Declaration),
229
- (r'(namespace|using)(\s+)', bygroups(Keyword.Namespace, Text),
230
+ (r'(namespace|using)(\s+)', bygroups(Keyword.Namespace, Whitespace),
230
231
  'namespace'),
231
232
  (r'(class|errordomain|interface|struct)(\s+)',
232
- bygroups(Keyword.Declaration, Text), 'class'),
233
+ bygroups(Keyword.Declaration, Whitespace), 'class'),
233
234
  (r'(\.)([a-zA-Z_]\w*)',
234
235
  bygroups(Operator, Name.Attribute)),
235
236
  # void is an actual keyword, others are in glib-2.0.vapi
@@ -304,8 +305,8 @@ class CudaLexer(CLexer):
304
305
  '__syncthreads_or'}
305
306
  execution_confs = {'<<<', '>>>'}
306
307
 
307
- def get_tokens_unprocessed(self, text):
308
- for index, token, value in CLexer.get_tokens_unprocessed(self, text):
308
+ def get_tokens_unprocessed(self, text, stack=('root',)):
309
+ for index, token, value in CLexer.get_tokens_unprocessed(self, text, stack):
309
310
  if token is Name:
310
311
  if value in self.variable_qualifiers:
311
312
  token = Keyword.Type
@@ -525,8 +526,8 @@ class ArduinoLexer(CppLexer):
525
526
  'typename', 'this', 'alignof', 'constexpr', 'decltype', 'noexcept',
526
527
  'static_assert', 'thread_local', 'restrict'}
527
528
 
528
- def get_tokens_unprocessed(self, text):
529
- for index, token, value in CppLexer.get_tokens_unprocessed(self, text):
529
+ def get_tokens_unprocessed(self, text, stack=('root',)):
530
+ for index, token, value in CppLexer.get_tokens_unprocessed(self, text, stack):
530
531
  if value in self.structure:
531
532
  yield index, Name.Builtin, value
532
533
  elif value in self.operators:
@@ -573,12 +574,13 @@ class CharmciLexer(CppLexer):
573
574
 
574
575
  class OmgIdlLexer(CLexer):
575
576
  """
576
- Lexer for `Object Management Group Interface Definition Language <https://www.omg.org/spec/IDL/About-IDL/>`_.
577
+ Lexer for Object Management Group Interface Definition Language.
577
578
 
578
579
  .. versionadded:: 2.9
579
580
  """
580
581
 
581
582
  name = 'OMG Interface Definition Language'
583
+ url = 'https://www.omg.org/spec/IDL/About-IDL/'
582
584
  aliases = ['omg-idl']
583
585
  filenames = ['*.idl', '*.pidl']
584
586
  mimetypes = []
@@ -4,30 +4,27 @@
4
4
 
5
5
  Lexers for the Cap'n Proto schema language.
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
- import re
12
-
13
11
  from pygments.lexer import RegexLexer, default
14
- from pygments.token import Text, Comment, Keyword, Name, Literal
12
+ from pygments.token import Text, Comment, Keyword, Name, Literal, Whitespace
15
13
 
16
14
  __all__ = ['CapnProtoLexer']
17
15
 
18
16
 
19
17
  class CapnProtoLexer(RegexLexer):
20
18
  """
21
- For `Cap'n Proto <https://capnproto.org>`_ source.
19
+ For Cap'n Proto source.
22
20
 
23
21
  .. versionadded:: 2.2
24
22
  """
25
23
  name = 'Cap\'n Proto'
24
+ url = 'https://capnproto.org'
26
25
  filenames = ['*.capnp']
27
26
  aliases = ['capnp']
28
27
 
29
- flags = re.MULTILINE | re.UNICODE
30
-
31
28
  tokens = {
32
29
  'root': [
33
30
  (r'#.*?$', Comment.Single),
@@ -39,7 +36,8 @@ class CapnProtoLexer(RegexLexer):
39
36
  r'extends|in|of|on|as|with|from|fixed)\b',
40
37
  Keyword),
41
38
  (r'[\w.]+', Name),
42
- (r'[^#@=:$\w]+', Text),
39
+ (r'[^#@=:$\w\s]+', Text),
40
+ (r'\s+', Whitespace),
43
41
  ],
44
42
  'type': [
45
43
  (r'[^][=;,(){}$]+', Name.Class),
@@ -0,0 +1,96 @@
1
+ """
2
+ pygments.lexers.carbon
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Carbon programming language.
6
+
7
+ :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+ import re
11
+
12
+ from pygments.lexer import RegexLexer, bygroups, words
13
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
14
+ Number, Punctuation, Whitespace
15
+
16
+ __all__ = ['CarbonLexer']
17
+
18
+
19
+ class CarbonLexer(RegexLexer):
20
+ """
21
+ For Carbon source.
22
+
23
+ .. versionadded:: 2.15
24
+ """
25
+ name = 'Carbon'
26
+ url = 'https://github.com/carbon-language/carbon-lang'
27
+ filenames = ['*.carbon']
28
+ aliases = ['carbon']
29
+ mimetypes = ['text/x-carbon']
30
+
31
+ flags = re.MULTILINE | re.DOTALL
32
+
33
+ tokens = {
34
+ 'root': [
35
+ (r'\n', Whitespace),
36
+ (r'\s+', Whitespace),
37
+ (r'\\\n', Text),
38
+ # comments
39
+ (r'//(.*?)\n', Comment.Single),
40
+ (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
41
+ # Declaration
42
+ (r'(package|import|api|namespace|library)\b', Keyword.Namespace),
43
+ (r'(abstract|alias|fn|class|interface|let|var|virtual|external|'
44
+ r'base|addr|extends|choice|constraint|impl)\b', Keyword.Declaration),
45
+ # Keywords
46
+ (words(('as', 'or', 'not', 'and', 'break', 'continue', 'case',
47
+ 'default', 'if', 'else', 'destructor', 'for', 'forall',
48
+ 'while', 'where', 'then', 'in', 'is', 'return', 'returned',
49
+ 'friend', 'partial', 'private', 'protected', 'observe', 'Self',
50
+ 'override', 'final', 'match', 'type', 'like'), suffix=r'\b'), Keyword),
51
+ (r'(self)\b', Keyword.Pseudo),
52
+ (r'(true|false)\b', Keyword.Constant),
53
+ (r'(auto|bool|string|i8|i16|i32|i64|u8|u16|u32|u64|'
54
+ r'f8|f16|f32|f64)\b', Keyword.Type),
55
+ # numeric literals
56
+ (r'[0-9]*[.][0-9]+?', Number.Double),
57
+ (r'0b[01]+?', Number.Bin),
58
+ (r'0o[0-7]+?', Number.Oct),
59
+ (r'0x[0-9a-fA-F]+?', Number.Hex),
60
+ (r'[0-9]+?', Number.Integer),
61
+ # string literal
62
+ (r'"(\\.|[^"\\])*"', String),
63
+ # char literal
64
+ (r'\'(\\.|[^\'\\])\'', String.Char),
65
+ # tokens
66
+ (r'<<=|>>=|<<|>>|<=|>=|\+=|-=|\*=|/=|\%=|\|=|&=|\^=|&&|\|\||&|\||'
67
+ r'\+\+|--|\%|\^|\~|==|!=|::|[.]{3}|->|=>|[+\-*/&]', Operator),
68
+ (r'[|<>=!()\[\]{}.,;:\?]', Punctuation),
69
+ # identifiers
70
+ (r'[^\W\d]\w*', Name.Other),
71
+ ]
72
+ }
73
+
74
+ def analyse_text(text):
75
+ result = 0
76
+ if 'forall' in text:
77
+ result += 0.1
78
+ if 'type' in text:
79
+ result += 0.1
80
+ if 'Self' in text:
81
+ result += 0.1
82
+ if 'observe' in text:
83
+ result += 0.1
84
+ if 'package' in text:
85
+ result += 0.1
86
+ if 'library' in text:
87
+ result += 0.1
88
+ if 'choice' in text:
89
+ result += 0.1
90
+ if 'addr' in text:
91
+ result += 0.1
92
+ if 'constraint' in text:
93
+ result += 0.1
94
+ if 'impl' in text:
95
+ result += 0.1
96
+ return result
@@ -8,27 +8,16 @@
8
8
  More information:
9
9
  https://datatracker.ietf.org/doc/rfc8610/
10
10
 
11
- :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
11
+ :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
12
12
  :license: BSD, see LICENSE for details.
13
13
  """
14
14
 
15
- import re
15
+ from pygments.lexer import RegexLexer, bygroups, include, words
16
+ from pygments.token import Comment, Error, Keyword, Name, Number, Operator, \
17
+ Punctuation, String, Whitespace
16
18
 
17
19
  __all__ = ['CddlLexer']
18
20
 
19
- from pygments.lexer import RegexLexer, bygroups, include, words
20
- from pygments.token import (
21
- Comment,
22
- Error,
23
- Keyword,
24
- Name,
25
- Number,
26
- Operator,
27
- Punctuation,
28
- String,
29
- Text,
30
- )
31
-
32
21
 
33
22
  class CddlLexer(RegexLexer):
34
23
  """
@@ -37,6 +26,7 @@ class CddlLexer(RegexLexer):
37
26
  .. versionadded:: 2.8
38
27
  """
39
28
  name = "CDDL"
29
+ url = 'https://datatracker.ietf.org/doc/rfc8610/'
40
30
  aliases = ["cddl"]
41
31
  filenames = ["*.cddl"]
42
32
  mimetypes = ["text/x-cddl"]
@@ -103,7 +93,8 @@ class CddlLexer(RegexLexer):
103
93
 
104
94
  _re_id = (
105
95
  r"[$@A-Z_a-z]"
106
- r"(?:[\-\.]*[$@0-9A-Z_a-z]|[$@0-9A-Z_a-z])*"
96
+ r"(?:[\-\.]+(?=[$@0-9A-Z_a-z])|[$@0-9A-Z_a-z])*"
97
+
107
98
  )
108
99
 
109
100
  # While the spec reads more like "an int must not start with 0" we use a
@@ -112,15 +103,13 @@ class CddlLexer(RegexLexer):
112
103
  _re_uint = r"(?:0b[01]+|0x[0-9a-fA-F]+|[1-9]\d*|0(?!\d))"
113
104
  _re_int = r"-?" + _re_uint
114
105
 
115
- flags = re.UNICODE | re.MULTILINE
116
-
117
106
  tokens = {
118
- "commentsandwhitespace": [(r"\s+", Text), (r";.+$", Comment.Single)],
107
+ "commentsandwhitespace": [(r"\s+", Whitespace), (r";.+$", Comment.Single)],
119
108
  "root": [
120
109
  include("commentsandwhitespace"),
121
110
  # tag types
122
111
  (r"#(\d\.{uint})?".format(uint=_re_uint), Keyword.Type), # type or any
123
- # occurence
112
+ # occurrence
124
113
  (
125
114
  r"({uint})?(\*)({uint})?".format(uint=_re_uint),
126
115
  bygroups(Number, Operator, Number),
@@ -142,15 +131,11 @@ class CddlLexer(RegexLexer):
142
131
  # Barewords as member keys (must be matched before values, types, typenames,
143
132
  # groupnames).
144
133
  # Token type is String as barewords are always interpreted as such.
145
- (
146
- r"({bareword})(\s*)(:)".format(bareword=_re_id),
147
- bygroups(String, Text, Punctuation),
148
- ),
134
+ (r"({bareword})(\s*)(:)".format(bareword=_re_id),
135
+ bygroups(String, Whitespace, Punctuation)),
149
136
  # predefined types
150
- (
151
- words(_prelude_types, prefix=r"(?![\-_$@])\b", suffix=r"\b(?![\-_$@])"),
152
- Name.Builtin,
153
- ),
137
+ (words(_prelude_types, prefix=r"(?![\-_$@])\b", suffix=r"\b(?![\-_$@])"),
138
+ Name.Builtin),
154
139
  # user-defined groupnames, typenames
155
140
  (_re_id, Name.Class),
156
141
  # values
@@ -159,10 +144,8 @@ class CddlLexer(RegexLexer):
159
144
  (r"0x[0-9a-fA-F]+(\.[0-9a-fA-F]+)?p[+-]?\d+", Number.Hex), # hexfloat
160
145
  (r"0x[0-9a-fA-F]+", Number.Hex), # hex
161
146
  # Float
162
- (
163
- r"{int}(?=(\.\d|e[+-]?\d))(?:\.\d+)?(?:e[+-]?\d+)?".format(int=_re_int),
164
- Number.Float,
165
- ),
147
+ (r"{int}(?=(\.\d|e[+-]?\d))(?:\.\d+)?(?:e[+-]?\d+)?".format(int=_re_int),
148
+ Number.Float),
166
149
  # Int
167
150
  (_re_int, Number.Integer),
168
151
  (r'"(\\\\|\\"|[^"])*"', String.Double),
@@ -185,6 +168,6 @@ class CddlLexer(RegexLexer):
185
168
  "bstr": [
186
169
  (r"'", String.Single, "#pop"),
187
170
  (r"\\.", String.Escape),
188
- (r"[^']", String.Single),
171
+ (r"[^'\\]+", String.Single),
189
172
  ],
190
173
  }