pygments.rb 0.6.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (606) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +11 -0
  3. data/README.md +6 -6
  4. data/Rakefile +2 -1
  5. data/cache-lexers.rb +1 -1
  6. data/circle.yml +7 -0
  7. data/lib/pygments/lexer.rb +3 -3
  8. data/lib/pygments/popen.rb +67 -30
  9. data/lib/pygments/version.rb +1 -1
  10. data/pygments.rb.gemspec +2 -1
  11. data/test/test_pygments.rb +16 -16
  12. data/vendor/pygments-main/AUTHORS +54 -8
  13. data/vendor/pygments-main/CHANGES +247 -25
  14. data/vendor/pygments-main/LICENSE +1 -1
  15. data/vendor/pygments-main/Makefile +15 -6
  16. data/vendor/pygments-main/README.rst +39 -0
  17. data/vendor/pygments-main/REVISION +1 -1
  18. data/vendor/pygments-main/TODO +0 -3
  19. data/vendor/pygments-main/doc/_themes/pygments14/layout.html +1 -1
  20. data/vendor/pygments-main/doc/_themes/pygments14/static/pygments14.css_t +1 -1
  21. data/vendor/pygments-main/doc/conf.py +3 -11
  22. data/vendor/pygments-main/doc/docs/api.rst +15 -0
  23. data/vendor/pygments-main/doc/docs/cmdline.rst +6 -2
  24. data/vendor/pygments-main/doc/docs/filterdevelopment.rst +4 -3
  25. data/vendor/pygments-main/doc/docs/integrate.rst +11 -15
  26. data/vendor/pygments-main/doc/docs/java.rst +7 -7
  27. data/vendor/pygments-main/doc/docs/lexerdevelopment.rst +258 -171
  28. data/vendor/pygments-main/doc/docs/lexers.rst +2 -2
  29. data/vendor/pygments-main/doc/docs/styles.rst +58 -0
  30. data/vendor/pygments-main/doc/docs/tokens.rst +22 -2
  31. data/vendor/pygments-main/doc/docs/unicode.rst +15 -7
  32. data/vendor/pygments-main/doc/faq.rst +17 -21
  33. data/vendor/pygments-main/doc/index.rst +12 -11
  34. data/vendor/pygments-main/doc/languages.rst +10 -7
  35. data/vendor/pygments-main/external/autopygmentize +9 -6
  36. data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +70 -52
  37. data/vendor/pygments-main/external/markdown-processor.py +1 -1
  38. data/vendor/pygments-main/external/moin-parser.py +1 -1
  39. data/vendor/pygments-main/external/rst-directive.py +1 -1
  40. data/vendor/pygments-main/pygmentize +2 -1
  41. data/vendor/pygments-main/pygments/__init__.py +14 -15
  42. data/vendor/pygments-main/pygments/cmdline.py +188 -113
  43. data/vendor/pygments-main/pygments/console.py +13 -13
  44. data/vendor/pygments-main/pygments/filter.py +7 -7
  45. data/vendor/pygments-main/pygments/filters/__init__.py +24 -32
  46. data/vendor/pygments-main/pygments/formatter.py +5 -5
  47. data/vendor/pygments-main/pygments/formatters/__init__.py +92 -44
  48. data/vendor/pygments-main/pygments/formatters/_mapping.py +51 -69
  49. data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
  50. data/vendor/pygments-main/pygments/formatters/html.py +63 -51
  51. data/vendor/pygments-main/pygments/formatters/img.py +25 -22
  52. data/vendor/pygments-main/pygments/formatters/irc.py +182 -0
  53. data/vendor/pygments-main/pygments/formatters/latex.py +34 -22
  54. data/vendor/pygments-main/pygments/formatters/other.py +5 -7
  55. data/vendor/pygments-main/pygments/formatters/rtf.py +28 -31
  56. data/vendor/pygments-main/pygments/formatters/svg.py +1 -2
  57. data/vendor/pygments-main/pygments/formatters/terminal.py +29 -45
  58. data/vendor/pygments-main/pygments/formatters/terminal256.py +118 -31
  59. data/vendor/pygments-main/pygments/lexer.py +120 -34
  60. data/vendor/pygments-main/pygments/lexers/__init__.py +85 -53
  61. data/vendor/pygments-main/pygments/lexers/{_asybuiltins.py → _asy_builtins.py} +7 -7
  62. data/vendor/pygments-main/pygments/lexers/{_clbuiltins.py → _cl_builtins.py} +17 -17
  63. data/vendor/pygments-main/pygments/lexers/_cocoa_builtins.py +72 -0
  64. data/vendor/pygments-main/pygments/lexers/_csound_builtins.py +1346 -0
  65. data/vendor/pygments-main/pygments/lexers/{_lassobuiltins.py → _lasso_builtins.py} +4699 -4561
  66. data/vendor/pygments-main/pygments/lexers/{_luabuiltins.py → _lua_builtins.py} +91 -51
  67. data/vendor/pygments-main/pygments/lexers/_mapping.py +342 -242
  68. data/vendor/pygments-main/pygments/lexers/_mql_builtins.py +1172 -0
  69. data/vendor/pygments-main/pygments/lexers/_openedge_builtins.py +2547 -0
  70. data/vendor/pygments-main/pygments/lexers/{_phpbuiltins.py → _php_builtins.py} +350 -353
  71. data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +600 -212
  72. data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +3084 -30
  73. data/vendor/pygments-main/pygments/lexers/_sourcemod_builtins.py +1163 -0
  74. data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +91 -13
  75. data/vendor/pygments-main/pygments/lexers/_stata_builtins.py +419 -0
  76. data/vendor/pygments-main/pygments/lexers/_tsql_builtins.py +1004 -0
  77. data/vendor/pygments-main/pygments/lexers/_vim_builtins.py +1939 -0
  78. data/vendor/pygments-main/pygments/lexers/actionscript.py +240 -0
  79. data/vendor/pygments-main/pygments/lexers/agile.py +14 -2542
  80. data/vendor/pygments-main/pygments/lexers/algebra.py +221 -0
  81. data/vendor/pygments-main/pygments/lexers/ambient.py +76 -0
  82. data/vendor/pygments-main/pygments/lexers/ampl.py +87 -0
  83. data/vendor/pygments-main/pygments/lexers/apl.py +101 -0
  84. data/vendor/pygments-main/pygments/lexers/archetype.py +318 -0
  85. data/vendor/pygments-main/pygments/lexers/asm.py +276 -81
  86. data/vendor/pygments-main/pygments/lexers/automation.py +374 -0
  87. data/vendor/pygments-main/pygments/lexers/basic.py +500 -0
  88. data/vendor/pygments-main/pygments/lexers/bibtex.py +156 -0
  89. data/vendor/pygments-main/pygments/lexers/business.py +594 -0
  90. data/vendor/pygments-main/pygments/lexers/c_cpp.py +252 -0
  91. data/vendor/pygments-main/pygments/lexers/c_like.py +541 -0
  92. data/vendor/pygments-main/pygments/lexers/capnproto.py +79 -0
  93. data/vendor/pygments-main/pygments/lexers/chapel.py +101 -0
  94. data/vendor/pygments-main/pygments/lexers/clean.py +288 -0
  95. data/vendor/pygments-main/pygments/lexers/compiled.py +24 -5182
  96. data/vendor/pygments-main/pygments/lexers/configs.py +833 -0
  97. data/vendor/pygments-main/pygments/lexers/console.py +114 -0
  98. data/vendor/pygments-main/pygments/lexers/crystal.py +384 -0
  99. data/vendor/pygments-main/pygments/lexers/csound.py +366 -0
  100. data/vendor/pygments-main/pygments/lexers/css.py +689 -0
  101. data/vendor/pygments-main/pygments/lexers/d.py +251 -0
  102. data/vendor/pygments-main/pygments/lexers/dalvik.py +6 -6
  103. data/vendor/pygments-main/pygments/lexers/data.py +555 -0
  104. data/vendor/pygments-main/pygments/lexers/diff.py +165 -0
  105. data/vendor/pygments-main/pygments/lexers/dotnet.py +96 -88
  106. data/vendor/pygments-main/pygments/lexers/dsls.py +878 -0
  107. data/vendor/pygments-main/pygments/lexers/dylan.py +289 -0
  108. data/vendor/pygments-main/pygments/lexers/ecl.py +125 -0
  109. data/vendor/pygments-main/pygments/lexers/eiffel.py +65 -0
  110. data/vendor/pygments-main/pygments/lexers/elm.py +121 -0
  111. data/vendor/pygments-main/pygments/lexers/erlang.py +533 -0
  112. data/vendor/pygments-main/pygments/lexers/esoteric.py +275 -0
  113. data/vendor/pygments-main/pygments/lexers/ezhil.py +68 -0
  114. data/vendor/pygments-main/pygments/lexers/factor.py +344 -0
  115. data/vendor/pygments-main/pygments/lexers/fantom.py +250 -0
  116. data/vendor/pygments-main/pygments/lexers/felix.py +273 -0
  117. data/vendor/pygments-main/pygments/lexers/forth.py +177 -0
  118. data/vendor/pygments-main/pygments/lexers/fortran.py +205 -0
  119. data/vendor/pygments-main/pygments/lexers/foxpro.py +1 -1
  120. data/vendor/pygments-main/pygments/lexers/functional.py +11 -3661
  121. data/vendor/pygments-main/pygments/lexers/go.py +101 -0
  122. data/vendor/pygments-main/pygments/lexers/grammar_notation.py +213 -0
  123. data/vendor/pygments-main/pygments/lexers/graph.py +7 -8
  124. data/vendor/pygments-main/pygments/lexers/graphics.py +553 -0
  125. data/vendor/pygments-main/pygments/lexers/haskell.py +840 -0
  126. data/vendor/pygments-main/pygments/lexers/haxe.py +936 -0
  127. data/vendor/pygments-main/pygments/lexers/hdl.py +172 -145
  128. data/vendor/pygments-main/pygments/lexers/hexdump.py +97 -0
  129. data/vendor/pygments-main/pygments/lexers/html.py +602 -0
  130. data/vendor/pygments-main/pygments/lexers/idl.py +270 -0
  131. data/vendor/pygments-main/pygments/lexers/igor.py +288 -0
  132. data/vendor/pygments-main/pygments/lexers/inferno.py +3 -3
  133. data/vendor/pygments-main/pygments/lexers/installers.py +322 -0
  134. data/vendor/pygments-main/pygments/lexers/int_fiction.py +1343 -0
  135. data/vendor/pygments-main/pygments/lexers/iolang.py +63 -0
  136. data/vendor/pygments-main/pygments/lexers/j.py +146 -0
  137. data/vendor/pygments-main/pygments/lexers/javascript.py +1506 -0
  138. data/vendor/pygments-main/pygments/lexers/julia.py +333 -0
  139. data/vendor/pygments-main/pygments/lexers/jvm.py +232 -186
  140. data/vendor/pygments-main/pygments/lexers/lisp.py +2621 -0
  141. data/vendor/pygments-main/pygments/lexers/make.py +202 -0
  142. data/vendor/pygments-main/pygments/lexers/markup.py +595 -0
  143. data/vendor/pygments-main/pygments/lexers/math.py +11 -2276
  144. data/vendor/pygments-main/pygments/lexers/matlab.py +663 -0
  145. data/vendor/pygments-main/pygments/lexers/ml.py +769 -0
  146. data/vendor/pygments-main/pygments/lexers/modeling.py +358 -0
  147. data/vendor/pygments-main/pygments/lexers/modula2.py +1561 -0
  148. data/vendor/pygments-main/pygments/lexers/monte.py +203 -0
  149. data/vendor/pygments-main/pygments/lexers/ncl.py +1053 -0
  150. data/vendor/pygments-main/pygments/lexers/nimrod.py +159 -0
  151. data/vendor/pygments-main/pygments/lexers/nit.py +64 -0
  152. data/vendor/pygments-main/pygments/lexers/nix.py +136 -0
  153. data/vendor/pygments-main/pygments/lexers/oberon.py +105 -0
  154. data/vendor/pygments-main/pygments/lexers/objective.py +504 -0
  155. data/vendor/pygments-main/pygments/lexers/ooc.py +85 -0
  156. data/vendor/pygments-main/pygments/lexers/other.py +30 -4481
  157. data/vendor/pygments-main/pygments/lexers/parasail.py +79 -0
  158. data/vendor/pygments-main/pygments/lexers/parsers.py +171 -114
  159. data/vendor/pygments-main/pygments/lexers/pascal.py +644 -0
  160. data/vendor/pygments-main/pygments/lexers/pawn.py +199 -0
  161. data/vendor/pygments-main/pygments/lexers/perl.py +616 -0
  162. data/vendor/pygments-main/pygments/lexers/php.py +267 -0
  163. data/vendor/pygments-main/pygments/lexers/praat.py +294 -0
  164. data/vendor/pygments-main/pygments/lexers/prolog.py +306 -0
  165. data/vendor/pygments-main/pygments/lexers/python.py +938 -0
  166. data/vendor/pygments-main/pygments/lexers/qvt.py +152 -0
  167. data/vendor/pygments-main/pygments/lexers/r.py +453 -0
  168. data/vendor/pygments-main/pygments/lexers/rdf.py +195 -24
  169. data/vendor/pygments-main/pygments/lexers/rebol.py +431 -0
  170. data/vendor/pygments-main/pygments/lexers/resource.py +85 -0
  171. data/vendor/pygments-main/pygments/lexers/rnc.py +67 -0
  172. data/vendor/pygments-main/pygments/lexers/roboconf.py +82 -0
  173. data/vendor/pygments-main/pygments/lexers/{_robotframeworklexer.py → robotframework.py} +20 -18
  174. data/vendor/pygments-main/pygments/lexers/ruby.py +519 -0
  175. data/vendor/pygments-main/pygments/lexers/rust.py +209 -0
  176. data/vendor/pygments-main/pygments/lexers/sas.py +228 -0
  177. data/vendor/pygments-main/pygments/lexers/scripting.py +1222 -0
  178. data/vendor/pygments-main/pygments/lexers/shell.py +478 -115
  179. data/vendor/pygments-main/pygments/lexers/smalltalk.py +195 -0
  180. data/vendor/pygments-main/pygments/lexers/smv.py +75 -0
  181. data/vendor/pygments-main/pygments/lexers/snobol.py +83 -0
  182. data/vendor/pygments-main/pygments/lexers/special.py +6 -2
  183. data/vendor/pygments-main/pygments/lexers/sql.py +209 -120
  184. data/vendor/pygments-main/pygments/lexers/stata.py +106 -0
  185. data/vendor/pygments-main/pygments/lexers/supercollider.py +90 -0
  186. data/vendor/pygments-main/pygments/lexers/tcl.py +145 -0
  187. data/vendor/pygments-main/pygments/lexers/templates.py +282 -90
  188. data/vendor/pygments-main/pygments/lexers/testing.py +207 -0
  189. data/vendor/pygments-main/pygments/lexers/text.py +15 -2045
  190. data/vendor/pygments-main/pygments/lexers/textedit.py +169 -0
  191. data/vendor/pygments-main/pygments/lexers/textfmts.py +297 -0
  192. data/vendor/pygments-main/pygments/lexers/theorem.py +458 -0
  193. data/vendor/pygments-main/pygments/lexers/trafficscript.py +54 -0
  194. data/vendor/pygments-main/pygments/lexers/typoscript.py +225 -0
  195. data/vendor/pygments-main/pygments/lexers/urbi.py +133 -0
  196. data/vendor/pygments-main/pygments/lexers/varnish.py +190 -0
  197. data/vendor/pygments-main/pygments/lexers/verification.py +111 -0
  198. data/vendor/pygments-main/pygments/lexers/web.py +13 -4499
  199. data/vendor/pygments-main/pygments/lexers/webmisc.py +979 -0
  200. data/vendor/pygments-main/pygments/lexers/whiley.py +117 -0
  201. data/vendor/pygments-main/pygments/lexers/x10.py +69 -0
  202. data/vendor/pygments-main/pygments/modeline.py +5 -2
  203. data/vendor/pygments-main/pygments/plugin.py +1 -1
  204. data/vendor/pygments-main/pygments/regexopt.py +92 -0
  205. data/vendor/pygments-main/pygments/scanner.py +3 -2
  206. data/vendor/pygments-main/pygments/sphinxext.py +11 -6
  207. data/vendor/pygments-main/pygments/style.py +41 -4
  208. data/vendor/pygments-main/pygments/styles/__init__.py +5 -1
  209. data/vendor/pygments-main/pygments/styles/algol.py +63 -0
  210. data/vendor/pygments-main/pygments/styles/algol_nu.py +63 -0
  211. data/vendor/pygments-main/pygments/styles/arduino.py +98 -0
  212. data/vendor/pygments-main/pygments/styles/autumn.py +1 -1
  213. data/vendor/pygments-main/pygments/styles/borland.py +1 -1
  214. data/vendor/pygments-main/pygments/styles/bw.py +1 -1
  215. data/vendor/pygments-main/pygments/styles/colorful.py +1 -1
  216. data/vendor/pygments-main/pygments/styles/default.py +1 -1
  217. data/vendor/pygments-main/pygments/styles/emacs.py +1 -1
  218. data/vendor/pygments-main/pygments/styles/friendly.py +1 -1
  219. data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
  220. data/vendor/pygments-main/pygments/styles/igor.py +1 -1
  221. data/vendor/pygments-main/pygments/styles/lovelace.py +97 -0
  222. data/vendor/pygments-main/pygments/styles/manni.py +1 -1
  223. data/vendor/pygments-main/pygments/styles/monokai.py +1 -1
  224. data/vendor/pygments-main/pygments/styles/murphy.py +1 -1
  225. data/vendor/pygments-main/pygments/styles/native.py +1 -1
  226. data/vendor/pygments-main/pygments/styles/paraiso_dark.py +1 -1
  227. data/vendor/pygments-main/pygments/styles/paraiso_light.py +1 -1
  228. data/vendor/pygments-main/pygments/styles/pastie.py +1 -1
  229. data/vendor/pygments-main/pygments/styles/perldoc.py +2 -2
  230. data/vendor/pygments-main/pygments/styles/rrt.py +1 -1
  231. data/vendor/pygments-main/pygments/styles/sas.py +41 -0
  232. data/vendor/pygments-main/pygments/styles/stata.py +37 -0
  233. data/vendor/pygments-main/pygments/styles/tango.py +1 -1
  234. data/vendor/pygments-main/pygments/styles/trac.py +1 -1
  235. data/vendor/pygments-main/pygments/styles/vim.py +1 -1
  236. data/vendor/pygments-main/pygments/styles/vs.py +1 -1
  237. data/vendor/pygments-main/pygments/styles/xcode.py +1 -1
  238. data/vendor/pygments-main/pygments/token.py +31 -16
  239. data/vendor/pygments-main/pygments/unistring.py +141 -65
  240. data/vendor/pygments-main/pygments/util.py +129 -33
  241. data/vendor/pygments-main/requirements.txt +5 -0
  242. data/vendor/pygments-main/scripts/check_sources.py +25 -40
  243. data/vendor/pygments-main/scripts/debug_lexer.py +246 -0
  244. data/vendor/pygments-main/scripts/find_error.py +1 -0
  245. data/vendor/pygments-main/scripts/get_vimkw.py +35 -4
  246. data/vendor/pygments-main/setup.cfg +3 -0
  247. data/vendor/pygments-main/setup.py +17 -30
  248. data/vendor/pygments-main/tox.ini +7 -0
  249. metadata +159 -387
  250. data/vendor/pygments-main/ez_setup.py +0 -382
  251. data/vendor/pygments-main/pygments/lexers/_cocoabuiltins.py +0 -73
  252. data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +0 -562
  253. data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +0 -1077
  254. data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +0 -13
  255. data/vendor/pygments-main/pygments/lexers/qbasic.py +0 -157
  256. data/vendor/pygments-main/scripts/find_codetags.py +0 -213
  257. data/vendor/pygments-main/scripts/find_error.py +0 -173
  258. data/vendor/pygments-main/tests/dtds/HTML4-f.dtd +0 -37
  259. data/vendor/pygments-main/tests/dtds/HTML4-s.dtd +0 -869
  260. data/vendor/pygments-main/tests/dtds/HTML4.dcl +0 -88
  261. data/vendor/pygments-main/tests/dtds/HTML4.dtd +0 -1092
  262. data/vendor/pygments-main/tests/dtds/HTML4.soc +0 -9
  263. data/vendor/pygments-main/tests/dtds/HTMLlat1.ent +0 -195
  264. data/vendor/pygments-main/tests/dtds/HTMLspec.ent +0 -77
  265. data/vendor/pygments-main/tests/dtds/HTMLsym.ent +0 -241
  266. data/vendor/pygments-main/tests/examplefiles/99_bottles_of_beer.chpl +0 -118
  267. data/vendor/pygments-main/tests/examplefiles/AcidStateAdvanced.hs +0 -209
  268. data/vendor/pygments-main/tests/examplefiles/AlternatingGroup.mu +0 -102
  269. data/vendor/pygments-main/tests/examplefiles/BOM.js +0 -1
  270. data/vendor/pygments-main/tests/examplefiles/CPDictionary.j +0 -611
  271. data/vendor/pygments-main/tests/examplefiles/Config.in.cache +0 -1973
  272. data/vendor/pygments-main/tests/examplefiles/Constants.mo +0 -158
  273. data/vendor/pygments-main/tests/examplefiles/DancingSudoku.lhs +0 -411
  274. data/vendor/pygments-main/tests/examplefiles/Deflate.fs +0 -578
  275. data/vendor/pygments-main/tests/examplefiles/Error.pmod +0 -38
  276. data/vendor/pygments-main/tests/examplefiles/Errors.scala +0 -18
  277. data/vendor/pygments-main/tests/examplefiles/FakeFile.pike +0 -360
  278. data/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1 +0 -66
  279. data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +0 -104
  280. data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +0 -671
  281. data/vendor/pygments-main/tests/examplefiles/Intro.java +0 -1660
  282. data/vendor/pygments-main/tests/examplefiles/Makefile +0 -1131
  283. data/vendor/pygments-main/tests/examplefiles/Object.st +0 -4394
  284. data/vendor/pygments-main/tests/examplefiles/OrderedMap.hx +0 -584
  285. data/vendor/pygments-main/tests/examplefiles/RoleQ.pm6 +0 -23
  286. data/vendor/pygments-main/tests/examplefiles/SmallCheck.hs +0 -378
  287. data/vendor/pygments-main/tests/examplefiles/Sorting.mod +0 -470
  288. data/vendor/pygments-main/tests/examplefiles/Sudoku.lhs +0 -382
  289. data/vendor/pygments-main/tests/examplefiles/addressbook.proto +0 -30
  290. data/vendor/pygments-main/tests/examplefiles/antlr_ANTLRv3.g +0 -608
  291. data/vendor/pygments-main/tests/examplefiles/antlr_throws +0 -1
  292. data/vendor/pygments-main/tests/examplefiles/apache2.conf +0 -393
  293. data/vendor/pygments-main/tests/examplefiles/as3_test.as +0 -143
  294. data/vendor/pygments-main/tests/examplefiles/as3_test2.as +0 -46
  295. data/vendor/pygments-main/tests/examplefiles/as3_test3.as +0 -3
  296. data/vendor/pygments-main/tests/examplefiles/aspx-cs_example +0 -27
  297. data/vendor/pygments-main/tests/examplefiles/autoit_submit.au3 +0 -25
  298. data/vendor/pygments-main/tests/examplefiles/badcase.java +0 -2
  299. data/vendor/pygments-main/tests/examplefiles/batchfile.bat +0 -49
  300. data/vendor/pygments-main/tests/examplefiles/bigtest.nsi +0 -308
  301. data/vendor/pygments-main/tests/examplefiles/boot-9.scm +0 -1557
  302. data/vendor/pygments-main/tests/examplefiles/ca65_example +0 -284
  303. data/vendor/pygments-main/tests/examplefiles/cbmbas_example +0 -9
  304. data/vendor/pygments-main/tests/examplefiles/cells.ps +0 -515
  305. data/vendor/pygments-main/tests/examplefiles/ceval.c +0 -2604
  306. data/vendor/pygments-main/tests/examplefiles/cheetah_example.html +0 -13
  307. data/vendor/pygments-main/tests/examplefiles/classes.dylan +0 -125
  308. data/vendor/pygments-main/tests/examplefiles/clojure-weird-keywords.clj +0 -5
  309. data/vendor/pygments-main/tests/examplefiles/condensed_ruby.rb +0 -10
  310. data/vendor/pygments-main/tests/examplefiles/coq_RelationClasses +0 -447
  311. data/vendor/pygments-main/tests/examplefiles/core.cljs +0 -52
  312. data/vendor/pygments-main/tests/examplefiles/database.pytb +0 -20
  313. data/vendor/pygments-main/tests/examplefiles/de.MoinMoin.po +0 -2461
  314. data/vendor/pygments-main/tests/examplefiles/demo.ahk +0 -181
  315. data/vendor/pygments-main/tests/examplefiles/demo.cfm +0 -50
  316. data/vendor/pygments-main/tests/examplefiles/demo.hbs +0 -12
  317. data/vendor/pygments-main/tests/examplefiles/django_sample.html+django +0 -68
  318. data/vendor/pygments-main/tests/examplefiles/dwarf.cw +0 -17
  319. data/vendor/pygments-main/tests/examplefiles/ember.handlebars +0 -33
  320. data/vendor/pygments-main/tests/examplefiles/erl_session +0 -10
  321. data/vendor/pygments-main/tests/examplefiles/escape_semicolon.clj +0 -1
  322. data/vendor/pygments-main/tests/examplefiles/evil_regex.js +0 -48
  323. data/vendor/pygments-main/tests/examplefiles/example.Rd +0 -78
  324. data/vendor/pygments-main/tests/examplefiles/example.als +0 -217
  325. data/vendor/pygments-main/tests/examplefiles/example.bug +0 -54
  326. data/vendor/pygments-main/tests/examplefiles/example.c +0 -2080
  327. data/vendor/pygments-main/tests/examplefiles/example.ceylon +0 -52
  328. data/vendor/pygments-main/tests/examplefiles/example.chai +0 -6
  329. data/vendor/pygments-main/tests/examplefiles/example.clay +0 -33
  330. data/vendor/pygments-main/tests/examplefiles/example.cls +0 -15
  331. data/vendor/pygments-main/tests/examplefiles/example.cob +0 -3556
  332. data/vendor/pygments-main/tests/examplefiles/example.coffee +0 -27
  333. data/vendor/pygments-main/tests/examplefiles/example.cpp +0 -2363
  334. data/vendor/pygments-main/tests/examplefiles/example.e +0 -124
  335. data/vendor/pygments-main/tests/examplefiles/example.f90 +0 -8
  336. data/vendor/pygments-main/tests/examplefiles/example.feature +0 -16
  337. data/vendor/pygments-main/tests/examplefiles/example.gd +0 -23
  338. data/vendor/pygments-main/tests/examplefiles/example.gi +0 -64
  339. data/vendor/pygments-main/tests/examplefiles/example.groovy +0 -2
  340. data/vendor/pygments-main/tests/examplefiles/example.gs +0 -106
  341. data/vendor/pygments-main/tests/examplefiles/example.gst +0 -7
  342. data/vendor/pygments-main/tests/examplefiles/example.hs +0 -27
  343. data/vendor/pygments-main/tests/examplefiles/example.hx +0 -185
  344. data/vendor/pygments-main/tests/examplefiles/example.i6t +0 -32
  345. data/vendor/pygments-main/tests/examplefiles/example.i7x +0 -45
  346. data/vendor/pygments-main/tests/examplefiles/example.inf +0 -374
  347. data/vendor/pygments-main/tests/examplefiles/example.j +0 -564
  348. data/vendor/pygments-main/tests/examplefiles/example.jag +0 -48
  349. data/vendor/pygments-main/tests/examplefiles/example.java +0 -16
  350. data/vendor/pygments-main/tests/examplefiles/example.kal +0 -75
  351. data/vendor/pygments-main/tests/examplefiles/example.kt +0 -47
  352. data/vendor/pygments-main/tests/examplefiles/example.lagda +0 -19
  353. data/vendor/pygments-main/tests/examplefiles/example.liquid +0 -42
  354. data/vendor/pygments-main/tests/examplefiles/example.lua +0 -250
  355. data/vendor/pygments-main/tests/examplefiles/example.ma +0 -8
  356. data/vendor/pygments-main/tests/examplefiles/example.monkey +0 -152
  357. data/vendor/pygments-main/tests/examplefiles/example.moo +0 -26
  358. data/vendor/pygments-main/tests/examplefiles/example.moon +0 -629
  359. data/vendor/pygments-main/tests/examplefiles/example.mq4 +0 -187
  360. data/vendor/pygments-main/tests/examplefiles/example.mqh +0 -123
  361. data/vendor/pygments-main/tests/examplefiles/example.msc +0 -43
  362. data/vendor/pygments-main/tests/examplefiles/example.ni +0 -57
  363. data/vendor/pygments-main/tests/examplefiles/example.nim +0 -1010
  364. data/vendor/pygments-main/tests/examplefiles/example.nix +0 -80
  365. data/vendor/pygments-main/tests/examplefiles/example.ns2 +0 -69
  366. data/vendor/pygments-main/tests/examplefiles/example.pas +0 -2708
  367. data/vendor/pygments-main/tests/examplefiles/example.pp +0 -8
  368. data/vendor/pygments-main/tests/examplefiles/example.prg +0 -161
  369. data/vendor/pygments-main/tests/examplefiles/example.rb +0 -1852
  370. data/vendor/pygments-main/tests/examplefiles/example.red +0 -257
  371. data/vendor/pygments-main/tests/examplefiles/example.reds +0 -150
  372. data/vendor/pygments-main/tests/examplefiles/example.reg +0 -19
  373. data/vendor/pygments-main/tests/examplefiles/example.rexx +0 -50
  374. data/vendor/pygments-main/tests/examplefiles/example.rhtml +0 -561
  375. data/vendor/pygments-main/tests/examplefiles/example.rkt +0 -743
  376. data/vendor/pygments-main/tests/examplefiles/example.rpf +0 -4
  377. data/vendor/pygments-main/tests/examplefiles/example.sh +0 -22
  378. data/vendor/pygments-main/tests/examplefiles/example.sh-session +0 -19
  379. data/vendor/pygments-main/tests/examplefiles/example.shell-session +0 -45
  380. data/vendor/pygments-main/tests/examplefiles/example.slim +0 -31
  381. data/vendor/pygments-main/tests/examplefiles/example.sls +0 -51
  382. data/vendor/pygments-main/tests/examplefiles/example.sml +0 -156
  383. data/vendor/pygments-main/tests/examplefiles/example.snobol +0 -15
  384. data/vendor/pygments-main/tests/examplefiles/example.stan +0 -110
  385. data/vendor/pygments-main/tests/examplefiles/example.tea +0 -34
  386. data/vendor/pygments-main/tests/examplefiles/example.todotxt +0 -9
  387. data/vendor/pygments-main/tests/examplefiles/example.ts +0 -28
  388. data/vendor/pygments-main/tests/examplefiles/example.u +0 -548
  389. data/vendor/pygments-main/tests/examplefiles/example.weechatlog +0 -9
  390. data/vendor/pygments-main/tests/examplefiles/example.xhtml +0 -376
  391. data/vendor/pygments-main/tests/examplefiles/example.xtend +0 -34
  392. data/vendor/pygments-main/tests/examplefiles/example.yaml +0 -302
  393. data/vendor/pygments-main/tests/examplefiles/example2.aspx +0 -29
  394. data/vendor/pygments-main/tests/examplefiles/example2.msc +0 -79
  395. data/vendor/pygments-main/tests/examplefiles/exampleScript.cfc +0 -241
  396. data/vendor/pygments-main/tests/examplefiles/exampleTag.cfc +0 -18
  397. data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +0 -205
  398. data/vendor/pygments-main/tests/examplefiles/example_file.fy +0 -128
  399. data/vendor/pygments-main/tests/examplefiles/firefox.mak +0 -586
  400. data/vendor/pygments-main/tests/examplefiles/flipflop.sv +0 -19
  401. data/vendor/pygments-main/tests/examplefiles/foo.sce +0 -6
  402. data/vendor/pygments-main/tests/examplefiles/format.ml +0 -1213
  403. data/vendor/pygments-main/tests/examplefiles/fucked_up.rb +0 -77
  404. data/vendor/pygments-main/tests/examplefiles/function.mu +0 -1
  405. data/vendor/pygments-main/tests/examplefiles/functional.rst +0 -1472
  406. data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +0 -133
  407. data/vendor/pygments-main/tests/examplefiles/genclass.clj +0 -510
  408. data/vendor/pygments-main/tests/examplefiles/genshi_example.xml+genshi +0 -193
  409. data/vendor/pygments-main/tests/examplefiles/genshitext_example.genshitext +0 -33
  410. data/vendor/pygments-main/tests/examplefiles/glsl.frag +0 -7
  411. data/vendor/pygments-main/tests/examplefiles/glsl.vert +0 -13
  412. data/vendor/pygments-main/tests/examplefiles/grammar-test.p6 +0 -22
  413. data/vendor/pygments-main/tests/examplefiles/hash_syntax.rb +0 -5
  414. data/vendor/pygments-main/tests/examplefiles/hello.at +0 -6
  415. data/vendor/pygments-main/tests/examplefiles/hello.golo +0 -5
  416. data/vendor/pygments-main/tests/examplefiles/hello.lsl +0 -12
  417. data/vendor/pygments-main/tests/examplefiles/hello.smali +0 -40
  418. data/vendor/pygments-main/tests/examplefiles/hello.sp +0 -9
  419. data/vendor/pygments-main/tests/examplefiles/html+php_faulty.php +0 -1
  420. data/vendor/pygments-main/tests/examplefiles/http_request_example +0 -15
  421. data/vendor/pygments-main/tests/examplefiles/http_response_example +0 -29
  422. data/vendor/pygments-main/tests/examplefiles/hybris_File.hy +0 -174
  423. data/vendor/pygments-main/tests/examplefiles/idl_sample.pro +0 -73
  424. data/vendor/pygments-main/tests/examplefiles/iex_example +0 -23
  425. data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +0 -71
  426. data/vendor/pygments-main/tests/examplefiles/intro.ik +0 -24
  427. data/vendor/pygments-main/tests/examplefiles/ints.php +0 -10
  428. data/vendor/pygments-main/tests/examplefiles/intsyn.fun +0 -675
  429. data/vendor/pygments-main/tests/examplefiles/intsyn.sig +0 -286
  430. data/vendor/pygments-main/tests/examplefiles/irb_heredoc +0 -8
  431. data/vendor/pygments-main/tests/examplefiles/irc.lsp +0 -214
  432. data/vendor/pygments-main/tests/examplefiles/java.properties +0 -16
  433. data/vendor/pygments-main/tests/examplefiles/jbst_example1.jbst +0 -28
  434. data/vendor/pygments-main/tests/examplefiles/jbst_example2.jbst +0 -45
  435. data/vendor/pygments-main/tests/examplefiles/jinjadesignerdoc.rst +0 -713
  436. data/vendor/pygments-main/tests/examplefiles/json.lasso +0 -301
  437. data/vendor/pygments-main/tests/examplefiles/json.lasso9 +0 -213
  438. data/vendor/pygments-main/tests/examplefiles/language.hy +0 -165
  439. data/vendor/pygments-main/tests/examplefiles/lighttpd_config.conf +0 -13
  440. data/vendor/pygments-main/tests/examplefiles/limbo.b +0 -456
  441. data/vendor/pygments-main/tests/examplefiles/linecontinuation.py +0 -47
  442. data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +0 -43
  443. data/vendor/pygments-main/tests/examplefiles/logos_example.xm +0 -28
  444. data/vendor/pygments-main/tests/examplefiles/ltmain.sh +0 -2849
  445. data/vendor/pygments-main/tests/examplefiles/main.cmake +0 -44
  446. data/vendor/pygments-main/tests/examplefiles/markdown.lsp +0 -679
  447. data/vendor/pygments-main/tests/examplefiles/matlab_noreturn +0 -3
  448. data/vendor/pygments-main/tests/examplefiles/matlab_sample +0 -30
  449. data/vendor/pygments-main/tests/examplefiles/matlabsession_sample.txt +0 -37
  450. data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +0 -455
  451. data/vendor/pygments-main/tests/examplefiles/minehunt.qml +0 -112
  452. data/vendor/pygments-main/tests/examplefiles/minimal.ns2 +0 -4
  453. data/vendor/pygments-main/tests/examplefiles/moin_SyntaxReference.txt +0 -340
  454. data/vendor/pygments-main/tests/examplefiles/multiline_regexes.rb +0 -38
  455. data/vendor/pygments-main/tests/examplefiles/nanomsg.intr +0 -95
  456. data/vendor/pygments-main/tests/examplefiles/nasm_aoutso.asm +0 -96
  457. data/vendor/pygments-main/tests/examplefiles/nasm_objexe.asm +0 -30
  458. data/vendor/pygments-main/tests/examplefiles/nemerle_sample.n +0 -87
  459. data/vendor/pygments-main/tests/examplefiles/nginx_nginx.conf +0 -118
  460. data/vendor/pygments-main/tests/examplefiles/numbers.c +0 -12
  461. data/vendor/pygments-main/tests/examplefiles/objc_example.m +0 -179
  462. data/vendor/pygments-main/tests/examplefiles/openedge_example +0 -34
  463. data/vendor/pygments-main/tests/examplefiles/pawn_example +0 -25
  464. data/vendor/pygments-main/tests/examplefiles/perl_misc +0 -62
  465. data/vendor/pygments-main/tests/examplefiles/perl_perl5db +0 -998
  466. data/vendor/pygments-main/tests/examplefiles/perl_regex-delims +0 -120
  467. data/vendor/pygments-main/tests/examplefiles/perlfunc.1 +0 -856
  468. data/vendor/pygments-main/tests/examplefiles/phpMyAdmin.spec +0 -163
  469. data/vendor/pygments-main/tests/examplefiles/phpcomplete.vim +0 -567
  470. data/vendor/pygments-main/tests/examplefiles/pleac.in.rb +0 -1223
  471. data/vendor/pygments-main/tests/examplefiles/postgresql_test.txt +0 -47
  472. data/vendor/pygments-main/tests/examplefiles/pppoe.applescript +0 -10
  473. data/vendor/pygments-main/tests/examplefiles/psql_session.txt +0 -122
  474. data/vendor/pygments-main/tests/examplefiles/py3_test.txt +0 -2
  475. data/vendor/pygments-main/tests/examplefiles/py3tb_test.py3tb +0 -4
  476. data/vendor/pygments-main/tests/examplefiles/pycon_test.pycon +0 -14
  477. data/vendor/pygments-main/tests/examplefiles/pytb_test2.pytb +0 -2
  478. data/vendor/pygments-main/tests/examplefiles/pytb_test3.pytb +0 -4
  479. data/vendor/pygments-main/tests/examplefiles/python25-bsd.mak +0 -234
  480. data/vendor/pygments-main/tests/examplefiles/qbasic_example +0 -2
  481. data/vendor/pygments-main/tests/examplefiles/qsort.prolog +0 -13
  482. data/vendor/pygments-main/tests/examplefiles/r-console-transcript.Rout +0 -38
  483. data/vendor/pygments-main/tests/examplefiles/r6rs-comments.scm +0 -23
  484. data/vendor/pygments-main/tests/examplefiles/ragel-cpp_rlscan +0 -280
  485. data/vendor/pygments-main/tests/examplefiles/ragel-cpp_snippet +0 -2
  486. data/vendor/pygments-main/tests/examplefiles/regex.js +0 -22
  487. data/vendor/pygments-main/tests/examplefiles/reversi.lsp +0 -427
  488. data/vendor/pygments-main/tests/examplefiles/robotframework_test.txt +0 -39
  489. data/vendor/pygments-main/tests/examplefiles/rql-queries.rql +0 -34
  490. data/vendor/pygments-main/tests/examplefiles/ruby_func_def.rb +0 -11
  491. data/vendor/pygments-main/tests/examplefiles/rust_example.rs +0 -233
  492. data/vendor/pygments-main/tests/examplefiles/scilab.sci +0 -30
  493. data/vendor/pygments-main/tests/examplefiles/scope.cirru +0 -43
  494. data/vendor/pygments-main/tests/examplefiles/session.dylan-console +0 -9
  495. data/vendor/pygments-main/tests/examplefiles/sibling.prolog +0 -19
  496. data/vendor/pygments-main/tests/examplefiles/simple.md +0 -747
  497. data/vendor/pygments-main/tests/examplefiles/smarty_example.html +0 -209
  498. data/vendor/pygments-main/tests/examplefiles/source.lgt +0 -343
  499. data/vendor/pygments-main/tests/examplefiles/sources.list +0 -62
  500. data/vendor/pygments-main/tests/examplefiles/sparql.rq +0 -23
  501. data/vendor/pygments-main/tests/examplefiles/sphere.pov +0 -18
  502. data/vendor/pygments-main/tests/examplefiles/sqlite3.sqlite3-console +0 -27
  503. data/vendor/pygments-main/tests/examplefiles/squid.conf +0 -30
  504. data/vendor/pygments-main/tests/examplefiles/string.jl +0 -1031
  505. data/vendor/pygments-main/tests/examplefiles/string_delimiters.d +0 -21
  506. data/vendor/pygments-main/tests/examplefiles/stripheredoc.sh +0 -3
  507. data/vendor/pygments-main/tests/examplefiles/swig_java.swg +0 -1329
  508. data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +0 -225
  509. data/vendor/pygments-main/tests/examplefiles/test.R +0 -185
  510. data/vendor/pygments-main/tests/examplefiles/test.adb +0 -211
  511. data/vendor/pygments-main/tests/examplefiles/test.agda +0 -102
  512. data/vendor/pygments-main/tests/examplefiles/test.apl +0 -26
  513. data/vendor/pygments-main/tests/examplefiles/test.asy +0 -131
  514. data/vendor/pygments-main/tests/examplefiles/test.awk +0 -121
  515. data/vendor/pygments-main/tests/examplefiles/test.bb +0 -95
  516. data/vendor/pygments-main/tests/examplefiles/test.bmx +0 -145
  517. data/vendor/pygments-main/tests/examplefiles/test.boo +0 -39
  518. data/vendor/pygments-main/tests/examplefiles/test.bro +0 -250
  519. data/vendor/pygments-main/tests/examplefiles/test.cs +0 -374
  520. data/vendor/pygments-main/tests/examplefiles/test.css +0 -54
  521. data/vendor/pygments-main/tests/examplefiles/test.cu +0 -36
  522. data/vendor/pygments-main/tests/examplefiles/test.cyp +0 -123
  523. data/vendor/pygments-main/tests/examplefiles/test.d +0 -135
  524. data/vendor/pygments-main/tests/examplefiles/test.dart +0 -23
  525. data/vendor/pygments-main/tests/examplefiles/test.dtd +0 -89
  526. data/vendor/pygments-main/tests/examplefiles/test.ebnf +0 -31
  527. data/vendor/pygments-main/tests/examplefiles/test.ec +0 -605
  528. data/vendor/pygments-main/tests/examplefiles/test.ecl +0 -58
  529. data/vendor/pygments-main/tests/examplefiles/test.eh +0 -315
  530. data/vendor/pygments-main/tests/examplefiles/test.erl +0 -169
  531. data/vendor/pygments-main/tests/examplefiles/test.evoque +0 -33
  532. data/vendor/pygments-main/tests/examplefiles/test.fan +0 -818
  533. data/vendor/pygments-main/tests/examplefiles/test.flx +0 -57
  534. data/vendor/pygments-main/tests/examplefiles/test.gdc +0 -13
  535. data/vendor/pygments-main/tests/examplefiles/test.groovy +0 -97
  536. data/vendor/pygments-main/tests/examplefiles/test.html +0 -339
  537. data/vendor/pygments-main/tests/examplefiles/test.idr +0 -93
  538. data/vendor/pygments-main/tests/examplefiles/test.ini +0 -10
  539. data/vendor/pygments-main/tests/examplefiles/test.java +0 -653
  540. data/vendor/pygments-main/tests/examplefiles/test.jsp +0 -24
  541. data/vendor/pygments-main/tests/examplefiles/test.maql +0 -45
  542. data/vendor/pygments-main/tests/examplefiles/test.mask +0 -41
  543. data/vendor/pygments-main/tests/examplefiles/test.mod +0 -374
  544. data/vendor/pygments-main/tests/examplefiles/test.moo +0 -51
  545. data/vendor/pygments-main/tests/examplefiles/test.myt +0 -166
  546. data/vendor/pygments-main/tests/examplefiles/test.nim +0 -93
  547. data/vendor/pygments-main/tests/examplefiles/test.opa +0 -10
  548. data/vendor/pygments-main/tests/examplefiles/test.p6 +0 -252
  549. data/vendor/pygments-main/tests/examplefiles/test.pan +0 -54
  550. data/vendor/pygments-main/tests/examplefiles/test.pas +0 -743
  551. data/vendor/pygments-main/tests/examplefiles/test.php +0 -507
  552. data/vendor/pygments-main/tests/examplefiles/test.pig +0 -148
  553. data/vendor/pygments-main/tests/examplefiles/test.plot +0 -333
  554. data/vendor/pygments-main/tests/examplefiles/test.ps1 +0 -108
  555. data/vendor/pygments-main/tests/examplefiles/test.pwn +0 -253
  556. data/vendor/pygments-main/tests/examplefiles/test.pypylog +0 -1839
  557. data/vendor/pygments-main/tests/examplefiles/test.r3 +0 -114
  558. data/vendor/pygments-main/tests/examplefiles/test.rb +0 -177
  559. data/vendor/pygments-main/tests/examplefiles/test.rhtml +0 -43
  560. data/vendor/pygments-main/tests/examplefiles/test.rsl +0 -111
  561. data/vendor/pygments-main/tests/examplefiles/test.scaml +0 -8
  562. data/vendor/pygments-main/tests/examplefiles/test.ssp +0 -12
  563. data/vendor/pygments-main/tests/examplefiles/test.swift +0 -65
  564. data/vendor/pygments-main/tests/examplefiles/test.tcsh +0 -830
  565. data/vendor/pygments-main/tests/examplefiles/test.vb +0 -407
  566. data/vendor/pygments-main/tests/examplefiles/test.vhdl +0 -161
  567. data/vendor/pygments-main/tests/examplefiles/test.xqy +0 -138
  568. data/vendor/pygments-main/tests/examplefiles/test.xsl +0 -23
  569. data/vendor/pygments-main/tests/examplefiles/test.zep +0 -33
  570. data/vendor/pygments-main/tests/examplefiles/test2.pypylog +0 -120
  571. data/vendor/pygments-main/tests/examplefiles/truncated.pytb +0 -15
  572. data/vendor/pygments-main/tests/examplefiles/type.lisp +0 -1218
  573. data/vendor/pygments-main/tests/examplefiles/underscore.coffee +0 -603
  574. data/vendor/pygments-main/tests/examplefiles/unicode.applescript +0 -5
  575. data/vendor/pygments-main/tests/examplefiles/unicode.go +0 -10
  576. data/vendor/pygments-main/tests/examplefiles/unicodedoc.py +0 -11
  577. data/vendor/pygments-main/tests/examplefiles/unix-io.lid +0 -37
  578. data/vendor/pygments-main/tests/examplefiles/vbnet_test.bas +0 -29
  579. data/vendor/pygments-main/tests/examplefiles/vctreestatus_hg +0 -4
  580. data/vendor/pygments-main/tests/examplefiles/vimrc +0 -21
  581. data/vendor/pygments-main/tests/examplefiles/webkit-transition.css +0 -3
  582. data/vendor/pygments-main/tests/examplefiles/while.pov +0 -13
  583. data/vendor/pygments-main/tests/examplefiles/wiki.factor +0 -384
  584. data/vendor/pygments-main/tests/examplefiles/xml_example +0 -1897
  585. data/vendor/pygments-main/tests/examplefiles/zmlrpc.f90 +0 -798
  586. data/vendor/pygments-main/tests/run.py +0 -44
  587. data/vendor/pygments-main/tests/string_asserts.py +0 -22
  588. data/vendor/pygments-main/tests/support.py +0 -15
  589. data/vendor/pygments-main/tests/support/tags +0 -36
  590. data/vendor/pygments-main/tests/test_basic_api.py +0 -309
  591. data/vendor/pygments-main/tests/test_cfm.py +0 -46
  592. data/vendor/pygments-main/tests/test_clexer.py +0 -236
  593. data/vendor/pygments-main/tests/test_cmdline.py +0 -106
  594. data/vendor/pygments-main/tests/test_examplefiles.py +0 -110
  595. data/vendor/pygments-main/tests/test_html_formatter.py +0 -180
  596. data/vendor/pygments-main/tests/test_latex_formatter.py +0 -57
  597. data/vendor/pygments-main/tests/test_lexers_other.py +0 -68
  598. data/vendor/pygments-main/tests/test_objectiveclexer.py +0 -81
  599. data/vendor/pygments-main/tests/test_perllexer.py +0 -137
  600. data/vendor/pygments-main/tests/test_qbasiclexer.py +0 -43
  601. data/vendor/pygments-main/tests/test_regexlexer.py +0 -54
  602. data/vendor/pygments-main/tests/test_rtf_formatter.py +0 -109
  603. data/vendor/pygments-main/tests/test_string_asserts.py +0 -39
  604. data/vendor/pygments-main/tests/test_token.py +0 -46
  605. data/vendor/pygments-main/tests/test_using_api.py +0 -40
  606. data/vendor/pygments-main/tests/test_util.py +0 -135
@@ -1,1223 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- # Local variables:
4
- # indent-tabs-mode: nil
5
- # ruby-indent-level: 4
6
- # End:
7
-
8
- # @@PLEAC@@_NAME
9
- # @@SKIP@@ Ruby
10
-
11
- # @@PLEAC@@_WEB
12
- # @@SKIP@@ http://www.ruby-lang.org
13
-
14
-
15
- # @@PLEAC@@_1.0
16
- string = '\n' # two characters, \ and an n
17
- string = 'Jon \'Maddog\' Orwant' # literal single quotes
18
-
19
- string = "\n" # a "newline" character
20
- string = "Jon \"Maddog\" Orwant" # literal double quotes
21
-
22
- string = %q/Jon 'Maddog' Orwant/ # literal single quotes
23
-
24
- string = %q[Jon 'Maddog' Orwant] # literal single quotes
25
- string = %q{Jon 'Maddog' Orwant} # literal single quotes
26
- string = %q(Jon 'Maddog' Orwant) # literal single quotes
27
- string = %q<Jon 'Maddog' Orwant> # literal single quotes
28
-
29
- a = <<"EOF"
30
- This is a multiline here document
31
- terminated by EOF on a line by itself
32
- EOF
33
-
34
-
35
- # @@PLEAC@@_1.1
36
- value = string[offset,count]
37
- value = string[offset..-1]
38
-
39
- string[offset,count] = newstring
40
- string[offset..-1] = newtail
41
-
42
- # in Ruby we can also specify intervals by their two offsets
43
- value = string[offset..offs2]
44
- string[offset..offs2] = newstring
45
-
46
- leading, s1, s2, trailing = data.unpack("A5 x3 A8 A8 A*")
47
-
48
- fivers = string.unpack("A5" * (string.length/5))
49
-
50
- chars = string.unpack("A1" * string.length)
51
-
52
- string = "This is what you have"
53
- # +012345678901234567890 Indexing forwards (left to right)
54
- # 109876543210987654321- Indexing backwards (right to left)
55
- # note that 0 means 10 or 20, etc. above
56
-
57
- first = string[0, 1] # "T"
58
- start = string[5, 2] # "is"
59
- rest = string[13..-1] # "you have"
60
- last = string[-1, 1] # "e"
61
- end_ = string[-4..-1] # "have"
62
- piece = string[-8, 3] # "you"
63
-
64
- string[5, 2] = "wasn't" # change "is" to "wasn't"
65
- string[-12..-1] = "ondrous" # "This wasn't wondrous"
66
- string[0, 1] = "" # delete first character
67
- string[-10..-1] = "" # delete last 10 characters
68
-
69
- if string[-10..-1] =~ /pattern/
70
- puts "Pattern matches in last 10 characters"
71
- end
72
-
73
- string[0, 5].gsub!(/is/, 'at')
74
-
75
- a = "make a hat"
76
- a[0, 1], a[-1, 1] = a[-1, 1], a[0, 1]
77
-
78
- a = "To be or not to be"
79
- b = a.unpack("x6 A6")
80
-
81
- b, c = a.unpack("x6 A2 X5 A2")
82
- puts "#{b}\n#{c}\n"
83
-
84
- def cut2fmt(*args)
85
- template = ''
86
- lastpos = 1
87
- for place in args
88
- template += "A" + (place - lastpos).to_s + " "
89
- lastpos = place
90
- end
91
- template += "A*"
92
- return template
93
- end
94
-
95
- fmt = cut2fmt(8, 14, 20, 26, 30)
96
-
97
-
98
- # @@PLEAC@@_1.2
99
- # careful! "b is true" doesn't mean "b != 0" (0 is true in Ruby)
100
- # thus no problem of "defined" later since only nil is false
101
- # the following sets to `c' if `b' is nil or false
102
- a = b || c
103
-
104
- # if you need Perl's behaviour (setting to `c' if `b' is 0) the most
105
- # effective way is to use Numeric#nonzero? (thanks to Dave Thomas!)
106
- a = b.nonzero? || c
107
-
108
- # you will still want to use defined? in order to test
109
- # for scope existence of a given object
110
- a = defined?(b) ? b : c
111
-
112
- dir = ARGV.shift || "/tmp"
113
-
114
-
115
- # @@PLEAC@@_1.3
116
- v1, v2 = v2, v1
117
-
118
- alpha, beta, production = %w(January March August)
119
- alpha, beta, production = beta, production, alpha
120
-
121
-
122
- # @@PLEAC@@_1.4
123
- num = char[0]
124
- char = num.chr
125
-
126
- # Ruby also supports having a char from character constant
127
- num = ?r
128
-
129
- char = sprintf("%c", num)
130
- printf("Number %d is character %c\n", num, num)
131
-
132
- ascii = string.unpack("C*")
133
- string = ascii.pack("C*")
134
-
135
- hal = "HAL"
136
- ascii = hal.unpack("C*")
137
- # We can't use Array#each since we can't mutate a Fixnum
138
- ascii.collect! { |i|
139
- i + 1 # add one to each ASCII value
140
- }
141
- ibm = ascii.pack("C*")
142
- puts ibm
143
-
144
-
145
- # @@PLEAC@@_1.5
146
- array = string.split('')
147
-
148
- array = string.unpack("C*")
149
-
150
- string.scan(/./) { |b|
151
- # do something with b
152
- }
153
-
154
- string = "an apple a day"
155
- print "unique chars are: ", string.split('').uniq.sort, "\n"
156
-
157
- sum = 0
158
- for ascval in string.unpack("C*") # or use Array#each for a pure OO style :)
159
- sum += ascval
160
- end
161
- puts "sum is #{sum & 0xffffffff}" # since Ruby will go Bignum if necessary
162
-
163
- # @@INCLUDE@@ include/ruby/slowcat.rb
164
-
165
-
166
- # @@PLEAC@@_1.6
167
- revbytes = string.reverse
168
-
169
- revwords = string.split(" ").reverse.join(" ")
170
-
171
- revwords = string.split(/(\s+)/).reverse.join
172
-
173
- # using the fact that IO is Enumerable, you can directly "select" it
174
- long_palindromes = File.open("/usr/share/dict/words").
175
- select { |w| w.chomp!; w.reverse == w && w.length > 5 }
176
-
177
-
178
- # @@PLEAC@@_1.7
179
- while string.sub!("\t+") { ' ' * ($&.length * 8 - $`.length % 8) }
180
- end
181
-
182
-
183
- # @@PLEAC@@_1.8
184
- 'You owe #{debt} to me'.gsub(/\#{(\w+)}/) { eval($1) }
185
-
186
- rows, cols = 24, 80
187
- text = %q(I am #{rows} high and #{cols} long)
188
- text.gsub!(/\#{(\w+)}/) { eval("#{$1}") }
189
- puts text
190
-
191
- 'I am 17 years old'.gsub(/\d+/) { 2 * $&.to_i }
192
-
193
-
194
- # @@PLEAC@@_1.9
195
- e = "bo peep".upcase
196
- e.downcase!
197
- e.capitalize!
198
-
199
- "thIS is a loNG liNE".gsub!(/\w+/) { $&.capitalize }
200
-
201
-
202
- # @@PLEAC@@_1.10
203
- "I have #{n+1} guanacos."
204
- print "I have ", n+1, " guanacos."
205
-
206
-
207
- # @@PLEAC@@_1.11
208
- var = <<'EOF'.gsub(/^\s+/, '')
209
- your text
210
- goes here
211
- EOF
212
-
213
-
214
- # @@PLEAC@@_1.12
215
- string = "Folding and splicing is the work of an editor,\n"+
216
- "not a mere collection of silicon\n"+
217
- "and\n"+
218
- "mobile electrons!"
219
-
220
- def wrap(str, max_size)
221
- all = []
222
- line = ''
223
- for l in str.split
224
- if (line+l).length >= max_size
225
- all.push(line)
226
- line = ''
227
- end
228
- line += line == '' ? l : ' ' + l
229
- end
230
- all.push(line).join("\n")
231
- end
232
-
233
- print wrap(string, 20)
234
- #=> Folding and
235
- #=> splicing is the
236
- #=> work of an editor,
237
- #=> not a mere
238
- #=> collection of
239
- #=> silicon and mobile
240
- #=> electrons!
241
-
242
-
243
- # @@PLEAC@@_1.13
244
- string = %q(Mom said, "Don't do that.")
245
- string.gsub(/['"]/) { '\\'+$& }
246
- string.gsub(/['"]/, '\&\&')
247
- string.gsub(/[^A-Z]/) { '\\'+$& }
248
- "is a test!".gsub(/\W/) { '\\'+$& } # no function like quotemeta?
249
-
250
-
251
- # @@PLEAC@@_1.14
252
- string.strip!
253
-
254
-
255
- # @@PLEAC@@_1.15
256
- def parse_csv(text)
257
- new = text.scan(/"([^\"\\]*(?:\\.[^\"\\]*)*)",?|([^,]+),?|,/)
258
- new << nil if text[-1] == ?,
259
- new.flatten.compact
260
- end
261
-
262
- line = %q<XYZZY,"","O'Reilly, Inc","Wall, Larry","a \"glug\" bit,",5,"Error, Core Dumped">
263
- fields = parse_csv(line)
264
- fields.each_with_index { |v,i|
265
- print "#{i} : #{v}\n";
266
- }
267
-
268
-
269
- # @@PLEAC@@_1.16
270
- # Use the soundex.rb Library from Michael Neumann.
271
- # http://www.s-direktnet.de/homepages/neumann/rb_prgs/Soundex.rb
272
- require 'Soundex'
273
-
274
- code = Text::Soundex.soundex(string)
275
- codes = Text::Soundex.soundex(array)
276
-
277
- # substitution function for getpwent():
278
- # returns an array of user entries,
279
- # each entry contains the username and the full name
280
- def login_names
281
- result = []
282
- File.open("/etc/passwd") { |file|
283
- file.each_line { |line|
284
- next if line.match(/^#/)
285
- cols = line.split(":")
286
- result.push([cols[0], cols[4]])
287
- }
288
- }
289
- result
290
- end
291
-
292
- puts "Lookup user: "
293
- user = STDIN.gets
294
- user.chomp!
295
- exit unless user
296
- name_code = Text::Soundex.soundex(user)
297
-
298
- splitter = Regexp.new('(\w+)[^,]*\b(\w+)')
299
- for username, fullname in login_names do
300
- firstname, lastname = splitter.match(fullname)[1,2]
301
- if name_code == Text::Soundex.soundex(username)
302
- || name_code == Text::Soundex.soundex(firstname)
303
- || name_code == Text::Soundex.soundex(lastname)
304
- then
305
- puts "#{username}: #{firstname} #{lastname}"
306
- end
307
- end
308
-
309
-
310
- # @@PLEAC@@_1.17
311
- # @@INCLUDE@@ include/ruby/fixstyle.rb
312
-
313
-
314
- # @@PLEAC@@_1.18
315
- # @@INCLUDE@@ include/ruby/psgrep.rb
316
-
317
-
318
- # @@PLEAC@@_2.1
319
- # Matz tells that you can use Integer() for strict checked conversion.
320
- Integer("abc")
321
- #=> `Integer': invalid value for Integer: "abc" (ArgumentError)
322
- Integer("567")
323
- #=> 567
324
-
325
- # You may use Float() for floating point stuff
326
- Integer("56.7")
327
- #=> `Integer': invalid value for Integer: "56.7" (ArgumentError)
328
- Float("56.7")
329
- #=> 56.7
330
-
331
- # You may also use a regexp for that
332
- if string =~ /^[+-]?\d+$/
333
- p 'is an integer'
334
- else
335
- p 'is not'
336
- end
337
-
338
- if string =~ /^-?(?:\d+(?:\.\d*)?|\.\d+)$/
339
- p 'is a decimal number'
340
- else
341
- p 'is not'
342
- end
343
-
344
-
345
- # @@PLEAC@@_2.2
346
- # equal(num1, num2, accuracy) : returns true if num1 and num2 are
347
- # equal to accuracy number of decimal places
348
- def equal(i, j, a)
349
- sprintf("%.#{a}g", i) == sprintf("%.#{a}g", j)
350
- end
351
-
352
- wage = 536 # $5.36/hour
353
- week = 40 * wage # $214.40
354
- printf("One week's wage is: \$%.2f\n", week/100.0)
355
-
356
-
357
- # @@PLEAC@@_2.3
358
- num.round # rounds to integer
359
-
360
- a = 0.255
361
- b = sprintf("%.2f", a)
362
- print "Unrounded: #{a}\nRounded: #{b}\n"
363
- printf "Unrounded: #{a}\nRounded: %.2f\n", a
364
-
365
- print "number\tint\tfloor\tceil\n"
366
- a = [ 3.3 , 3.5 , 3.7, -3.3 ]
367
- for n in a
368
- printf("% .1f\t% .1f\t% .1f\t% .1f\n", # at least I don't fake my output :)
369
- n, n.to_i, n.floor, n.ceil)
370
- end
371
-
372
-
373
- # @@PLEAC@@_2.4
374
- def dec2bin(n)
375
- [n].pack("N").unpack("B32")[0].sub(/^0+(?=\d)/, '')
376
- end
377
-
378
- def bin2dec(n)
379
- [("0"*32+n.to_s)[-32..-1]].pack("B32").unpack("N")[0]
380
- end
381
-
382
-
383
- # @@PLEAC@@_2.5
384
- for i in x .. y
385
- # i is set to every integer from x to y, inclusive
386
- end
387
-
388
- x.step(y,7) { |i|
389
- # i is set to every integer from x to y, stepsize = 7
390
- }
391
-
392
- print "Infancy is: "
393
- (0..2).each { |i|
394
- print i, " "
395
- }
396
- print "\n"
397
-
398
-
399
- # @@PLEAC@@_2.6
400
- # We can add conversion methods to the Integer class,
401
- # this makes a roman number just a representation for normal numbers.
402
- class Integer
403
-
404
- @@romanlist = [["M", 1000],
405
- ["CM", 900],
406
- ["D", 500],
407
- ["CD", 400],
408
- ["C", 100],
409
- ["XC", 90],
410
- ["L", 50],
411
- ["XL", 40],
412
- ["X", 10],
413
- ["IX", 9],
414
- ["V", 5],
415
- ["IV", 4],
416
- ["I", 1]]
417
-
418
- def to_roman
419
- remains = self
420
- roman = ""
421
- for sym, num in @@romanlist
422
- while remains >= num
423
- remains -= num
424
- roman << sym
425
- end
426
- end
427
- roman
428
- end
429
-
430
- def Integer.from_roman(roman)
431
- ustr = roman.upcase
432
- sum = 0
433
- for entry in @@romanlist
434
- sym, num = entry[0], entry[1]
435
- while sym == ustr[0, sym.length]
436
- sum += num
437
- ustr.slice!(0, sym.length)
438
- end
439
- end
440
- sum
441
- end
442
-
443
- end
444
-
445
-
446
- roman_fifteen = 15.to_roman
447
- puts "Roman for fifteen is #{roman_fifteen}"
448
- i = Integer.from_roman(roman_fifteen)
449
- puts "Converted back, #{roman_fifteen} is #{i}"
450
-
451
- # check
452
- for i in (1..3900)
453
- r = i.to_roman
454
- j = Integer.from_roman(r)
455
- if i != j
456
- puts "error: #{i} : #{r} - #{j}"
457
- end
458
- end
459
-
460
-
461
- # @@PLEAC@@_2.7
462
- random = rand(y-x+1)+x
463
-
464
- chars = ["A".."Z","a".."z","0".."9"].collect { |r| r.to_a }.join + %q(!@$%^&*)
465
- password = (1..8).collect { chars[rand(chars.size)] }.pack("C*")
466
-
467
-
468
- # @@PLEAC@@_2.8
469
- srand # uses a combination of the time, the process id, and a sequence number
470
- srand(val) # for repeatable behaviour
471
-
472
-
473
- # @@PLEAC@@_2.9
474
- # from the randomr lib:
475
- # http://raa.ruby-lang.org/project/randomr/
476
- ----> http://raa.ruby-lang.org/project/randomr/
477
-
478
- require 'random/mersenne_twister'
479
- mers = Random::MersenneTwister.new 123456789
480
- puts mers.rand(0) # 0.550321932544541
481
- puts mers.rand(10) # 2
482
-
483
- # using online sources of random data via the realrand package:
484
- # http://raa.ruby-lang.org/project/realrand/
485
- # **Note**
486
- # The following online services are used in this package:
487
- # http://www.random.org - source: atmospheric noise
488
- # http://www.fourmilab.ch/hotbits - source: radioactive decay timings
489
- # http://random.hd.org - source: entropy from local and network noise
490
- # Please visit the sites and respect the rules of each service.
491
-
492
- require 'random/online'
493
-
494
- generator1 = Random::RandomOrg.new
495
- puts generator1.randbyte(5).join(",")
496
- puts generator1.randnum(10, 1, 6).join(",") # Roll dice 10 times.
497
-
498
- generator2 = Random::FourmiLab.new
499
- puts generator2.randbyte(5).join(",")
500
- # randnum is not supported.
501
-
502
- generator3 = Random::EntropyPool.new
503
- puts generator3.randbyte(5).join(",")
504
- # randnum is not supported.
505
-
506
-
507
- # @@PLEAC@@_2.10
508
- def gaussian_rand
509
- begin
510
- u1 = 2 * rand() - 1
511
- u2 = 2 * rand() - 1
512
- w = u1*u1 + u2*u2
513
- end while (w >= 1)
514
- w = Math.sqrt((-2*Math.log(w))/w)
515
- [ u2*w, u1*w ]
516
- end
517
-
518
- mean = 25
519
- sdev = 2
520
- salary = gaussian_rand[0] * sdev + mean
521
- printf("You have been hired at \$%.2f\n", salary)
522
-
523
-
524
- # @@PLEAC@@_2.11
525
- def deg2rad(d)
526
- (d/180.0)*Math::PI
527
- end
528
-
529
- def rad2deg(r)
530
- (r/Math::PI)*180
531
- end
532
-
533
-
534
- # @@PLEAC@@_2.12
535
- sin_val = Math.sin(angle)
536
- cos_val = Math.cos(angle)
537
- tan_val = Math.tan(angle)
538
-
539
- # AFAIK Ruby's Math module doesn't provide acos/asin
540
- # While we're at it, let's also define missing hyperbolic functions
541
- module Math
542
- def Math.asin(x)
543
- atan2(x, sqrt(1 - x**2))
544
- end
545
- def Math.acos(x)
546
- atan2(sqrt(1 - x**2), x)
547
- end
548
- def Math.atan(x)
549
- atan2(x, 1)
550
- end
551
- def Math.sinh(x)
552
- (exp(x) - exp(-x)) / 2
553
- end
554
- def Math.cosh(x)
555
- (exp(x) + exp(-x)) / 2
556
- end
557
- def Math.tanh(x)
558
- sinh(x) / cosh(x)
559
- end
560
- end
561
-
562
- # The support for Complex numbers is not built-in
563
- y = Math.acos(3.7)
564
- #=> in `sqrt': square root for negative number (ArgumentError)
565
-
566
- # There is an implementation of Complex numbers in 'complex.rb' in current
567
- # Ruby distro, but it doesn't support atan2 with complex args, so it doesn't
568
- # solve this problem.
569
-
570
-
571
- # @@PLEAC@@_2.13
572
- log_e = Math.log(val)
573
- log_10 = Math.log10(val)
574
-
575
- def log_base(base, val)
576
- Math.log(val)/Math.log(base)
577
- end
578
-
579
- answer = log_base(10, 10_000)
580
- puts "log10(10,000) = #{answer}"
581
-
582
-
583
- # @@PLEAC@@_2.14
584
- require 'matrix.rb'
585
-
586
- a = Matrix[[3, 2, 3], [5, 9, 8]]
587
- b = Matrix[[4, 7], [9, 3], [8, 1]]
588
- c = a * b
589
-
590
- a.row_size
591
- a.column_size
592
-
593
- c.det
594
- a.transpose
595
-
596
-
597
- # @@PLEAC@@_2.15
598
- require 'complex.rb'
599
- require 'rational.rb'
600
-
601
- a = Complex(3, 5) # 3 + 5i
602
- b = Complex(2, -2) # 2 - 2i
603
- puts "c = #{a*b}"
604
-
605
- c = a * b
606
- d = 3 + 4*Complex::I
607
-
608
- printf "sqrt(#{d}) = %s\n", Math.sqrt(d)
609
-
610
-
611
- # @@PLEAC@@_2.16
612
- number = hexadecimal.hex
613
- number = octal.oct
614
-
615
- print "Gimme a number in decimal, octal, or hex: "
616
- num = gets.chomp
617
- exit unless defined?(num)
618
- num = num.oct if num =~ /^0/ # does both oct and hex
619
- printf "%d %x %o\n", num, num, num
620
-
621
- print "Enter file permission in octal: "
622
- permissions = gets.chomp
623
- raise "Exiting ...\n" unless defined?(permissions)
624
- puts "The decimal value is #{permissions.oct}"
625
-
626
-
627
- # @@PLEAC@@_2.17
628
- def commify(n)
629
- n.to_s =~ /([^\.]*)(\..*)?/
630
- int, dec = $1.reverse, $2 ? $2 : ""
631
- while int.gsub!(/(,|\.|^)(\d{3})(\d)/, '\1\2,\3')
632
- end
633
- int.reverse + dec
634
- end
635
-
636
-
637
- # @@PLEAC@@_2.18
638
- printf "It took %d hour%s\n", time, time == 1 ? "" : "s"
639
-
640
- # dunno if an equivalent to Lingua::EN::Inflect exists...
641
-
642
-
643
- # @@PLEAC@@_2.19
644
- #-----------------------------
645
- #!/usr/bin/ruby
646
- # bigfact - calculating prime factors
647
- def factorize(orig)
648
- factors = {}
649
- factors.default = 0 # return 0 instead nil if key not found in hash
650
- n = orig
651
- i = 2
652
- sqi = 4 # square of i
653
- while sqi <= n do
654
- while n.modulo(i) == 0 do
655
- n /= i
656
- factors[i] += 1
657
- # puts "Found factor #{i}"
658
- end
659
- # we take advantage of the fact that (i +1)**2 = i**2 + 2*i +1
660
- sqi += 2 * i + 1
661
- i += 1
662
- end
663
-
664
- if (n != 1) && (n != orig)
665
- factors[n] += 1
666
- end
667
- factors
668
- end
669
-
670
- def printfactorhash(orig, factorcount)
671
- print format("%-10d ", orig)
672
- if factorcount.length == 0
673
- print "PRIME"
674
- else
675
- # sorts after number, because the hash keys are numbers
676
- factorcount.sort.each { |factor,exponent|
677
- print factor
678
- if exponent > 1
679
- print "**", exponent
680
- end
681
- print " "
682
- }
683
- end
684
- puts
685
- end
686
-
687
- for arg in ARGV
688
- n = arg.to_i
689
- mfactors = factorize(n)
690
- printfactorhash(n, mfactors)
691
- end
692
- #-----------------------------
693
-
694
-
695
- # @@PLEAC@@_3.0
696
- puts Time.now
697
-
698
- print "Today is day ", Time.now.yday, " of the current year.\n"
699
- print "Today is day ", Time.now.day, " of the current month.\n"
700
-
701
-
702
- # @@PLEAC@@_3.1
703
- day, month, year = Time.now.day, Time.now.month, Time.now.year
704
- # or
705
- day, month, year = Time.now.to_a[3..5]
706
-
707
- tl = Time.now.localtime
708
- printf("The current date is %04d %02d %02d\n", tl.year, tl.month, tl.day)
709
-
710
- Time.now.localtime.strftime("%Y-%m-%d")
711
-
712
-
713
- # @@PLEAC@@_3.2
714
- Time.local(year, month, day, hour, minute, second).tv_sec
715
- Time.gm(year, month, day, hour, minute, second).tv_sec
716
-
717
-
718
- # @@PLEAC@@_3.3
719
- sec, min, hour, day, month, year, wday, yday, isdst, zone = Time.at(epoch_secs).to_a
720
-
721
-
722
- # @@PLEAC@@_3.4
723
- when_ = now + difference # now -> Time ; difference -> Numeric (delta in seconds)
724
- then_ = now - difference
725
-
726
-
727
- # @@PLEAC@@_3.5
728
- bree = 361535725
729
- nat = 96201950
730
-
731
- difference = bree - nat
732
- puts "There were #{difference} seconds between Nat and Bree"
733
-
734
- seconds = difference % 60
735
- difference = (difference - seconds) / 60
736
- minutes = difference % 60
737
- difference = (difference - minutes) / 60
738
- hours = difference % 24
739
- difference = (difference - hours) / 24
740
- days = difference % 7
741
- weeks = (difference - days) / 7
742
-
743
- puts "(#{weeks} weeks, #{days} days, #{hours}:#{minutes}:#{seconds})"
744
-
745
-
746
- # @@PLEAC@@_3.6
747
- monthday, weekday, yearday = date.mday, date.wday, date.yday
748
-
749
- # AFAIK the week number is not just a division since week boundaries are on sundays
750
- weeknum = d.strftime("%U").to_i + 1
751
-
752
- year = 1981
753
- month = "jun" # or `6' if you want to emulate a broken language
754
- day = 16
755
- t = Time.mktime(year, month, day)
756
- print "#{month}/#{day}/#{year} was a ", t.strftime("%A"), "\n"
757
-
758
-
759
- # @@PLEAC@@_3.7
760
- yyyy, mm, dd = $1, $2, $3 if "1998-06-25" =~ /(\d+)-(\d+)-(\d+)/
761
-
762
- epoch_seconds = Time.mktime(yyyy, mm, dd).tv_sec
763
-
764
- # dunno an equivalent to Date::Manip#ParseDate
765
-
766
-
767
- # @@PLEAC@@_3.8
768
- string = Time.at(epoch_secs)
769
- Time.at(1234567890).gmtime # gives: Fri Feb 13 23:31:30 UTC 2009
770
-
771
- time = Time.mktime(1973, "jan", 18, 3, 45, 50)
772
- print "In localtime it gives: ", time.localtime, "\n"
773
-
774
-
775
- # @@PLEAC@@_3.9
776
- # Ruby provides micro-seconds in Time object
777
- Time.now.usec
778
-
779
- # Ruby gives the seconds in floating format when substracting two Time objects
780
- before = Time.now
781
- line = gets
782
- elapsed = Time.now - before
783
- puts "You took #{elapsed} seconds."
784
-
785
- # On my Celeron-400 with Linux-2.2.19-14mdk, average for three execs are:
786
- # This Ruby version: average 0.00321 sec
787
- # Cookbook's Perl version: average 0.00981 sec
788
- size = 500
789
- number_of_times = 100
790
- total_time = 0
791
- number_of_times.times {
792
- # populate array
793
- array = []
794
- size.times { array << rand }
795
- # sort it
796
- begin_ = Time.now
797
- array.sort!
798
- time = Time.now - begin_
799
- total_time += time
800
- }
801
- printf "On average, sorting %d random numbers takes %.5f seconds\n",
802
- size, (total_time/Float(number_of_times))
803
-
804
-
805
- # @@PLEAC@@_3.10
806
- sleep(0.005) # Ruby is definitely not as broken as Perl :)
807
- # (may be interrupted by sending the process a SIGALRM)
808
-
809
-
810
- # @@PLEAC@@_3.11
811
- #!/usr/bin/ruby -w
812
- # hopdelta - feed mail header, produce lines
813
- # showing delay at each hop.
814
- require 'time'
815
- class MailHopDelta
816
-
817
- def initialize(mail)
818
- @head = mail.gsub(/\n\s+/,' ')
819
- @topline = %w-Sender Recipient Time Delta-
820
- @start_from = mail.match(/^From.*\@([^\s>]*)/)[1]
821
- @date = Time.parse(mail.match(/^Date:\s+(.*)/)[1])
822
- end
823
-
824
- def out(line)
825
- "%-20.20s %-20.20s %-20.20s %s" % line
826
- end
827
-
828
- def hop_date(day)
829
- day.strftime("%I:%M:%S %Y/%m/%d")
830
- end
831
-
832
- def puts_hops
833
- puts out(@topline)
834
- puts out(['Start', @start_from, hop_date(@date),''])
835
- @head.split(/\n/).reverse.grep(/^Received:/).each do |hop|
836
- hop.gsub!(/\bon (.*?) (id.*)/,'; \1')
837
- whence = hop.match(/;\s+(.*)$/)[1]
838
- unless whence
839
- warn "Bad received line: #{hop}"
840
- next
841
- end
842
- from = $+ if hop =~ /from\s+(\S+)|\((.*?)\)/
843
- by = $1 if hop =~ /by\s+(\S+\.\S+)/
844
- next unless now = Time.parse(whence).localtime
845
- delta = now - @date
846
- puts out([from, by, hop_date(now), hop_time(delta)])
847
- @date = now
848
- end
849
- end
850
-
851
- def hop_time(secs)
852
- sign = secs < 0 ? -1 : 1
853
- days, secs = secs.abs.divmod(60 * 60 * 24)
854
- hours,secs = secs.abs.divmod(60 * 60)
855
- mins, secs = secs.abs.divmod(60)
856
- rtn = "%3ds" % [secs * sign]
857
- rtn << "%3dm" % [mins * sign] if mins != 0
858
- rtn << "%3dh" % [hours * sign] if hours != 0
859
- rtn << "%3dd" % [days * sign] if days != 0
860
- rtn
861
- end
862
- end
863
-
864
- $/ = ""
865
- mail = MailHopDelta.new(ARGF.gets).puts_hops
866
-
867
-
868
- # @@PLEAC@@_4.0
869
- single_level = [ "this", "that", "the", "other" ]
870
-
871
- # Ruby directly supports nested arrays
872
- double_level = [ "this", "that", [ "the", "other" ] ]
873
- still_single_level = [ "this", "that", [ "the", "other" ] ].flatten
874
-
875
-
876
- # @@PLEAC@@_4.1
877
- a = [ "quick", "brown", "fox" ]
878
- a = %w(Why are you teasing me?)
879
-
880
- lines = <<"END_OF_HERE_DOC".gsub(/^\s*(.+)/, '\1')
881
- The boy stood on the burning deck,
882
- It was as hot as glass.
883
- END_OF_HERE_DOC
884
-
885
- bigarray = IO.readlines("mydatafile").collect { |l| l.chomp }
886
-
887
- name = "Gandalf"
888
- banner = %Q(Speak, #{name}, and welcome!)
889
-
890
- host_info = `host #{his_host}`
891
-
892
- %x(ps #{$$})
893
-
894
- banner = 'Costs only $4.95'.split(' ')
895
-
896
- rax = %w! ( ) < > { } [ ] !
897
-
898
-
899
- # @@PLEAC@@_4.2
900
- def commify_series(arr)
901
- return '' if not arr
902
- case arr.size
903
- when 0 then ''
904
- when 1 then arr[0]
905
- when 2 then arr.join(' and ')
906
- else arr[0..-2].join(', ') + ', and ' + arr[-1]
907
- end
908
- end
909
-
910
- array = [ "red", "yellow", "green" ]
911
-
912
- print "I have ", array, " marbles\n"
913
- # -> I have redyellowgreen marbles
914
-
915
- # But unlike Perl:
916
- print "I have #{array} marbles\n"
917
- # -> I have redyellowgreen marbles
918
- # So, needs:
919
- print "I have #{array.join(' ')} marbles\n"
920
- # -> I have red yellow green marbles
921
-
922
- #!/usr/bin/ruby
923
- # communify_series - show proper comma insertion in list output
924
-
925
- def commify_series(arr)
926
- return '' if not arr
927
- sepchar = arr.find { |p| p =~ /,/ } ? '; ' : ', '
928
- case arr.size
929
- when 0 then ''
930
- when 1 then arr[0]
931
- when 2 then arr.join(' and ')
932
- else arr[0..-2].join(sepchar) + sepchar + 'and ' + arr[-1]
933
- end
934
- end
935
-
936
- lists = [
937
- [ 'just one thing' ],
938
- %w(Mutt Jeff),
939
- %w(Peter Paul Mary),
940
- [ 'To our parents', 'Mother Theresa', 'God' ],
941
- [ 'pastrami', 'ham and cheese', 'peanut butter and jelly', 'tuna' ],
942
- [ 'recycle tired, old phrases', 'ponder big, happy thoughts' ],
943
- [ 'recycle tired, old phrases',
944
- 'ponder big, happy thoughts',
945
- 'sleep and dream peacefully' ],
946
- ]
947
-
948
- for list in lists do
949
- puts "The list is: #{commify_series(list)}."
950
- end
951
-
952
-
953
- # @@PLEAC@@_4.3
954
- # (note: AFAIK Ruby doesn't allow gory change of Array length)
955
- # grow the array by assigning nil to past the end of array
956
- ary[new_size-1] = nil
957
- # shrink the array by slicing it down
958
- ary.slice!(new_size..-1)
959
- # init the array with given size
960
- Array.new(number_of_elems)
961
- # assign to an element past the original end enlarges the array
962
- ary[index_new_last_elem] = value
963
-
964
- def what_about_that_array(a)
965
- print "The array now has ", a.size, " elements.\n"
966
- # Index of last element is not really interesting in Ruby
967
- print "Element #3 is `#{a[3]}'.\n"
968
- end
969
- people = %w(Crosby Stills Nash Young)
970
- what_about_that_array(people)
971
-
972
-
973
- # @@PLEAC@@_4.4
974
- # OO style
975
- bad_users.each { |user|
976
- complain(user)
977
- }
978
- # or, functional style
979
- for user in bad_users
980
- complain(user)
981
- end
982
-
983
- for var in ENV.keys.sort
984
- puts "#{var}=#{ENV[var]}"
985
- end
986
-
987
- for user in all_users
988
- disk_space = get_usage(user)
989
- if (disk_space > MAX_QUOTA)
990
- complain(user)
991
- end
992
- end
993
-
994
- for l in IO.popen("who").readlines
995
- print l if l =~ /^gc/
996
- end
997
-
998
- # we can mimic the obfuscated Perl way
999
- while fh.gets # $_ is set to the line just read
1000
- chomp # $_ has a trailing \n removed, if it had one
1001
- split.each { |w| # $_ is split on whitespace
1002
- # but $_ is not set to each chunk as in Perl
1003
- print w.reverse
1004
- }
1005
- end
1006
- # ...or use a cleaner way
1007
- for l in fh.readlines
1008
- l.chomp.split.each { |w| print w.reverse }
1009
- end
1010
-
1011
- # same drawback as in problem 1.4, we can't mutate a Numeric...
1012
- array.collect! { |v| v - 1 }
1013
-
1014
- a = [ .5, 3 ]; b = [ 0, 1 ]
1015
- for ary in [ a, b ]
1016
- ary.collect! { |v| v * 7 }
1017
- end
1018
- puts "#{a.join(' ')} #{b.join(' ')}"
1019
-
1020
- # we can mutate Strings, cool; we need a trick for the scalar
1021
- for ary in [ [ scalar ], array, hash.values ]
1022
- ary.each { |v| v.strip! } # String#strip rules :)
1023
- end
1024
-
1025
-
1026
- # @@PLEAC@@_4.5
1027
- # not relevant in Ruby since we have always references
1028
- for item in array
1029
- # do somethingh with item
1030
- end
1031
-
1032
-
1033
- # @@PLEAC@@_4.6
1034
- unique = list.uniq
1035
-
1036
- # generate a list of users logged in, removing duplicates
1037
- users = `who`.collect { |l| l =~ /(\w+)/; $1 }.sort.uniq
1038
- puts("users logged in: #{commify_series(users)}") # see 4.2 for commify_series
1039
-
1040
-
1041
- # @@PLEAC@@_4.7
1042
- a - b
1043
- # [ 1, 1, 2, 2, 3, 3, 3, 4, 5 ] - [ 1, 2, 4 ] -> [3, 5]
1044
-
1045
-
1046
- # @@PLEAC@@_4.8
1047
- union = a | b
1048
- intersection = a & b
1049
- difference = a - b
1050
-
1051
-
1052
- # @@PLEAC@@_4.9
1053
- array1.concat(array2)
1054
- # if you will assign to another object, better use:
1055
- new_ary = array1 + array2
1056
-
1057
- members = [ "Time", "Flies" ]
1058
- initiates = [ "An", "Arrow" ]
1059
- members += initiates
1060
-
1061
- members = [ "Time", "Flies" ]
1062
- initiates = [ "An", "Arrow" ]
1063
- members[2,0] = [ "Like", initiates ].flatten
1064
-
1065
- members[0] = "Fruit"
1066
- members[3,2] = "A", "Banana"
1067
-
1068
-
1069
- # @@PLEAC@@_4.10
1070
- reversed = ary.reverse
1071
-
1072
- ary.reverse_each { |e|
1073
- # do something with e
1074
- }
1075
-
1076
- descending = ary.sort.reverse
1077
- descending = ary.sort { |a,b| b <=> a }
1078
-
1079
-
1080
- # @@PLEAC@@_4.11
1081
- # remove n elements from front of ary (shift n)
1082
- front = ary.slice!(0, n)
1083
-
1084
- # remove n elements from the end of ary (pop n)
1085
- end_ = ary.slice!(-n .. -1)
1086
-
1087
- # let's extend the Array class, to make that useful
1088
- class Array
1089
- def shift2()
1090
- slice!(0 .. 1) # more symetric with pop2...
1091
- end
1092
- def pop2()
1093
- slice!(-2 .. -1)
1094
- end
1095
- end
1096
-
1097
- friends = %w(Peter Paul Mary Jim Tim)
1098
- this, that = friends.shift2
1099
-
1100
- beverages = %w(Dew Jolt Cola Sprite Fresca)
1101
- pair = beverages.pop2
1102
-
1103
-
1104
- # @@PLEAC@@_4.12
1105
- # use Enumerable#detect (or the synonym Enumerable#find)
1106
- highest_eng = employees.detect { |emp| emp.category == 'engineer' }
1107
-
1108
-
1109
- # @@PLEAC@@_4.13
1110
- # use Enumerable#select (or the synonym Enumerable#find_all)
1111
- bigs = nums.select { |i| i > 1_000_000 }
1112
- pigs = users.keys.select { |k| users[k] > 1e7 }
1113
-
1114
- matching = `who`.select { |u| u =~ /^gnat / }
1115
-
1116
- engineers = employees.select { |e| e.position == 'Engineer' }
1117
-
1118
- secondary_assistance = applicants.select { |a|
1119
- a.income >= 26_000 && a.income < 30_000
1120
- }
1121
-
1122
-
1123
- # @@PLEAC@@_4.14
1124
- # normally you would have an array of Numeric (Float or
1125
- # Fixnum or Bignum), so you would use:
1126
- sorted = unsorted.sort
1127
- # if you have strings representing Integers or Floats
1128
- # you may specify another sort method:
1129
- sorted = unsorted.sort { |a,b| a.to_f <=> b.to_f }
1130
-
1131
- # let's use the list of my own PID's
1132
- `ps ux`.split("\n")[1..-1].
1133
- select { |i| i =~ /^#{ENV['USER']}/ }.
1134
- collect { |i| i.split[1] }.
1135
- sort { |a,b| a.to_i <=> b.to_i }.each { |i| puts i }
1136
- puts "Select a process ID to kill:"
1137
- pid = gets.chomp
1138
- raise "Exiting ... \n" unless pid && pid =~ /^\d+$/
1139
- Process.kill('TERM', pid.to_i)
1140
- sleep 2
1141
- Process.kill('KILL', pid.to_i)
1142
-
1143
- descending = unsorted.sort { |a,b| b.to_f <=> a.to_f }
1144
-
1145
-
1146
- # @@PLEAC@@_4.15
1147
- ordered = unordered.sort { |a,b| compare(a,b) }
1148
-
1149
- precomputed = unordered.collect { |e| [compute, e] }
1150
- ordered_precomputed = precomputed.sort { |a,b| a[0] <=> b[0] }
1151
- ordered = ordered_precomputed.collect { |e| e[1] }
1152
-
1153
- ordered = unordered.collect { |e| [compute, e] }.
1154
- sort { |a,b| a[0] <=> b[0] }.
1155
- collect { |e| e[1] }
1156
-
1157
- for employee in employees.sort { |a,b| a.name <=> b.name }
1158
- print employee.name, " earns \$ ", employee.salary, "\n"
1159
- end
1160
-
1161
- # Beware! `0' is true in Ruby.
1162
- # For chaining comparisons, you may use Numeric#nonzero?, which
1163
- # returns num if num is not zero, nil otherwise
1164
- sorted = employees.sort { |a,b| (a.name <=> b.name).nonzero? || b.age <=> a.age }
1165
-
1166
- users = []
1167
- # getpwent is not wrapped in Ruby... let's fallback
1168
- IO.readlines('/etc/passwd').each { |u| users << u.split(':') }
1169
- users.sort! { |a,b| a[0] <=> b[0] }
1170
- for user in users
1171
- puts user[0]
1172
- end
1173
-
1174
- sorted = names.sort { |a,b| a[1, 1] <=> b[1, 1] }
1175
- sorted = strings.sort { |a,b| a.length <=> b.length }
1176
-
1177
- # let's show only the compact version
1178
- ordered = strings.collect { |e| [e.length, e] }.
1179
- sort { |a,b| a[0] <=> b[0] }.
1180
- collect { |e| e[1] }
1181
-
1182
- ordered = strings.collect { |e| [/\d+/.match(e)[0].to_i, e] }.
1183
- sort { |a,b| a[0] <=> b[0] }.
1184
- collect { |e| e[1] }
1185
-
1186
- print `cat /etc/passwd`.collect { |e| [e, e.split(':').indexes(3,2,0)].flatten }.
1187
- sort { |a,b| (a[1] <=> b[1]).nonzero? || (a[2] <=> b[2]).nonzero? || a[3] <=> b[3] }.
1188
- collect { |e| e[0] }
1189
-
1190
-
1191
- # @@PLEAC@@_4.16
1192
- circular.unshift(circular.pop) # the last shall be first
1193
- circular.push(circular.shift) # and vice versa
1194
-
1195
- def grab_and_rotate(l)
1196
- l.push(ret = l.shift)
1197
- ret
1198
- end
1199
-
1200
- processes = [1, 2, 3, 4, 5]
1201
- while (1)
1202
- process = grab_and_rotate(processes)
1203
- puts "Handling process #{process}"
1204
- sleep 1
1205
- end
1206
-
1207
-
1208
- # @@PLEAC@@_4.17
1209
- def fisher_yates_shuffle(a)
1210
- (a.size-1).downto(1) { |i|
1211
- j = rand(i+1)
1212
- a[i], a[j] = a[j], a[i] if i != j
1213
- }
1214
- end
1215
-
1216
- def naive_shuffle(a)
1217
- for i in 0...a.size
1218
- j = rand(a.size)
1219
- a[i], a[j] = a[j], a[i]
1220
- end
1221
- end
1222
-
1223
-