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,1557 +0,0 @@
1
- ;;; installed-scm-file
2
-
3
- ;;;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4
- ;;;;
5
- ;;;; This program is free software; you can redistribute it and/or modify
6
- ;;;; it under the terms of the GNU General Public License as published by
7
- ;;;; the Free Software Foundation; either version 2, or (at your option)
8
- ;;;; any later version.
9
- ;;;;
10
- ;;;; This program is distributed in the hope that it will be useful,
11
- ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- ;;;; GNU General Public License for more details.
14
- ;;;;
15
- ;;;; You should have received a copy of the GNU General Public License
16
- ;;;; along with this software; see the file COPYING. If not, write to
17
- ;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18
- ;;;; Boston, MA 02111-1307 USA
19
- ;;;;
20
- ;;;; As a special exception, the Free Software Foundation gives permission
21
- ;;;; for additional uses of the text contained in its release of GUILE.
22
- ;;;;
23
- ;;;; The exception is that, if you link the GUILE library with other files
24
- ;;;; to produce an executable, this does not by itself cause the
25
- ;;;; resulting executable to be covered by the GNU General Public License.
26
- ;;;; Your use of that executable is in no way restricted on account of
27
- ;;;; linking the GUILE library code into it.
28
- ;;;;
29
- ;;;; This exception does not however invalidate any other reasons why
30
- ;;;; the executable file might be covered by the GNU General Public License.
31
- ;;;;
32
- ;;;; This exception applies only to the code released by the
33
- ;;;; Free Software Foundation under the name GUILE. If you copy
34
- ;;;; code from other Free Software Foundation releases into a copy of
35
- ;;;; GUILE, as the General Public License permits, the exception does
36
- ;;;; not apply to the code that you add in this way. To avoid misleading
37
- ;;;; anyone as to the status of such modified files, you must delete
38
- ;;;; this exception notice from them.
39
- ;;;;
40
- ;;;; If you write modifications of your own for GUILE, it is your choice
41
- ;;;; whether to permit this exception to apply to your modifications.
42
- ;;;; If you do not wish that, delete this exception notice.
43
- ;;;;
44
-
45
-
46
- ;;; Commentary:
47
-
48
- ;;; This file is the first thing loaded into Guile. It adds many mundane
49
- ;;; definitions and a few that are interesting.
50
- ;;;
51
- ;;; The module system (hence the hierarchical namespace) are defined in this
52
- ;;; file.
53
- ;;;
54
-
55
- ;;; Code:
56
-
57
-
58
- ;;; {Deprecation}
59
- ;;;
60
-
61
- ;; We don't have macros here, but we do want to define
62
- ;; `begin-deprecated' early.
63
-
64
- (define begin-deprecated
65
- (procedure->memoizing-macro
66
- (lambda (exp env)
67
- (if (include-deprecated-features)
68
- `(begin ,@(cdr exp))
69
- `#f))))
70
-
71
-
72
- ;;; {Features}
73
- ;;
74
-
75
- (define (provide sym)
76
- (if (not (memq sym *features*))
77
- (set! *features* (cons sym *features*))))
78
-
79
- ;;; Return #t iff FEATURE is available to this Guile interpreter.
80
- ;;; In SLIB, provided? also checks to see if the module is available.
81
- ;;; We should do that too, but don't.
82
- (define (provided? feature)
83
- (and (memq feature *features*) #t))
84
-
85
- (begin-deprecated
86
- (define (feature? sym)
87
- (issue-deprecation-warning
88
- "`feature?' is deprecated. Use `provided?' instead.")
89
- (provided? sym)))
90
-
91
- ;;; let format alias simple-format until the more complete version is loaded
92
- (define format simple-format)
93
-
94
-
95
- ;;; {R4RS compliance}
96
-
97
- (primitive-load-path "ice-9/r4rs.scm")
98
-
99
-
100
- ;;; {Simple Debugging Tools}
101
- ;;
102
-
103
-
104
- ;; peek takes any number of arguments, writes them to the
105
- ;; current ouput port, and returns the last argument.
106
- ;; It is handy to wrap around an expression to look at
107
- ;; a value each time is evaluated, e.g.:
108
- ;;
109
- ;; (+ 10 (troublesome-fn))
110
- ;; => (+ 10 (pk 'troublesome-fn-returned (troublesome-fn)))
111
- ;;
112
-
113
- (define (peek . stuff)
114
- (newline)
115
- (display ";;; ")
116
- (write stuff)
117
- (newline)
118
- (car (last-pair stuff)))
119
-
120
- (define pk peek)
121
-
122
- (define (warn . stuff)
123
- (with-output-to-port (current-error-port)
124
- (lambda ()
125
- (newline)
126
- (display ";;; WARNING ")
127
- (display stuff)
128
- (newline)
129
- (car (last-pair stuff)))))
130
-
131
-
132
- ;;; {Trivial Functions}
133
- ;;;
134
-
135
- (define (identity x) x)
136
- (define (1+ n) (+ n 1))
137
- (define (1- n) (+ n -1))
138
- (define (and=> value procedure) (and value (procedure value)))
139
- (define (make-hash-table k) (make-vector k '()))
140
-
141
- (begin-deprecated
142
- (define (id x)
143
- (issue-deprecation-warning "`id' is deprecated. Use `identity' instead.")
144
- (identity x))
145
- (define (-1+ n)
146
- (issue-deprecation-warning "`-1+' is deprecated. Use `1-' instead.")
147
- (1- n))
148
- (define (return-it . args)
149
- (issue-deprecation-warning "`return-it' is deprecated. Use `noop' instead.")
150
- (apply noop args)))
151
-
152
- ;;; apply-to-args is functionally redundant with apply and, worse,
153
- ;;; is less general than apply since it only takes two arguments.
154
- ;;;
155
- ;;; On the other hand, apply-to-args is a syntacticly convenient way to
156
- ;;; perform binding in many circumstances when the "let" family of
157
- ;;; of forms don't cut it. E.g.:
158
- ;;;
159
- ;;; (apply-to-args (return-3d-mouse-coords)
160
- ;;; (lambda (x y z)
161
- ;;; ...))
162
- ;;;
163
-
164
- (define (apply-to-args args fn) (apply fn args))
165
-
166
-
167
-
168
- ;;; {Integer Math}
169
- ;;;
170
-
171
- (define (ipow-by-squaring x k acc proc)
172
- (cond ((zero? k) acc)
173
- ((= 1 k) (proc acc x))
174
- (else (ipow-by-squaring (proc x x)
175
- (quotient k 2)
176
- (if (even? k) acc (proc acc x))
177
- proc))))
178
-
179
- (begin-deprecated
180
- (define (string-character-length s)
181
- (issue-deprecation-warning "`string-character-length' is deprecated. Use `string-length' instead.")
182
- (string-length s))
183
- (define (flags . args)
184
- (issue-deprecation-warning "`flags' is deprecated. Use `logior' instead.")
185
- (apply logior args)))
186
-
187
-
188
- ;;; {Symbol Properties}
189
- ;;;
190
-
191
- (define (symbol-property sym prop)
192
- (let ((pair (assoc prop (symbol-pref sym))))
193
- (and pair (cdr pair))))
194
-
195
- (define (set-symbol-property! sym prop val)
196
- (let ((pair (assoc prop (symbol-pref sym))))
197
- (if pair
198
- (set-cdr! pair val)
199
- (symbol-pset! sym (acons prop val (symbol-pref sym))))))
200
-
201
- (define (symbol-property-remove! sym prop)
202
- (let ((pair (assoc prop (symbol-pref sym))))
203
- (if pair
204
- (symbol-pset! sym (delq! pair (symbol-pref sym))))))
205
-
206
- ;;; {General Properties}
207
- ;;;
208
-
209
- ;; This is a more modern interface to properties. It will replace all
210
- ;; other property-like things eventually.
211
-
212
- (define (make-object-property)
213
- (let ((prop (primitive-make-property #f)))
214
- (make-procedure-with-setter
215
- (lambda (obj) (primitive-property-ref prop obj))
216
- (lambda (obj val) (primitive-property-set! prop obj val)))))
217
-
218
-
219
-
220
- ;;; {Arrays}
221
- ;;;
222
-
223
- (if (provided? 'array)
224
- (primitive-load-path "ice-9/arrays.scm"))
225
-
226
-
227
- ;;; {Keywords}
228
- ;;;
229
-
230
- (define (symbol->keyword symbol)
231
- (make-keyword-from-dash-symbol (symbol-append '- symbol)))
232
-
233
- (define (keyword->symbol kw)
234
- (let ((sym (symbol->string (keyword-dash-symbol kw))))
235
- (string->symbol (substring sym 1 (string-length sym)))))
236
-
237
- (define (kw-arg-ref args kw)
238
- (let ((rem (member kw args)))
239
- (and rem (pair? (cdr rem)) (cadr rem))))
240
-
241
-
242
-
243
- ;;; {Structs}
244
-
245
- (define (struct-layout s)
246
- (struct-ref (struct-vtable s) vtable-index-layout))
247
-
248
-
249
-
250
- ;;; Environments
251
-
252
- (define the-environment
253
- (procedure->syntax
254
- (lambda (x e)
255
- e)))
256
-
257
- (define the-root-environment (the-environment))
258
-
259
- (define (environment-module env)
260
- (let ((closure (and (pair? env) (car (last-pair env)))))
261
- (and closure (procedure-property closure 'module))))
262
-
263
-
264
- ;;; {Records}
265
- ;;;
266
-
267
- ;; Printing records: by default, records are printed as
268
- ;;
269
- ;; #<type-name field1: val1 field2: val2 ...>
270
- ;;
271
- ;; You can change that by giving a custom printing function to
272
- ;; MAKE-RECORD-TYPE (after the list of field symbols). This function
273
- ;; will be called like
274
- ;;
275
- ;; (<printer> object port)
276
- ;;
277
- ;; It should print OBJECT to PORT.
278
-
279
- (define (inherit-print-state old-port new-port)
280
- (if (get-print-state old-port)
281
- (port-with-print-state new-port (get-print-state old-port))
282
- new-port))
283
-
284
- ;; 0: type-name, 1: fields
285
- (define record-type-vtable
286
- (make-vtable-vtable "prpr" 0
287
- (lambda (s p)
288
- (cond ((eq? s record-type-vtable)
289
- (display "#<record-type-vtable>" p))
290
- (else
291
- (display "#<record-type " p)
292
- (display (record-type-name s) p)
293
- (display ">" p))))))
294
-
295
- (define (record-type? obj)
296
- (and (struct? obj) (eq? record-type-vtable (struct-vtable obj))))
297
-
298
- (define (make-record-type type-name fields . opt)
299
- (let ((printer-fn (and (pair? opt) (car opt))))
300
- (let ((struct (make-struct record-type-vtable 0
301
- (make-struct-layout
302
- (apply string-append
303
- (map (lambda (f) "pw") fields)))
304
- (or printer-fn
305
- (lambda (s p)
306
- (display "#<" p)
307
- (display type-name p)
308
- (let loop ((fields fields)
309
- (off 0))
310
- (cond
311
- ((not (null? fields))
312
- (display " " p)
313
- (display (car fields) p)
314
- (display ": " p)
315
- (display (struct-ref s off) p)
316
- (loop (cdr fields) (+ 1 off)))))
317
- (display ">" p)))
318
- type-name
319
- (copy-tree fields))))
320
- ;; Temporary solution: Associate a name to the record type descriptor
321
- ;; so that the object system can create a wrapper class for it.
322
- (set-struct-vtable-name! struct (if (symbol? type-name)
323
- type-name
324
- (string->symbol type-name)))
325
- struct)))
326
-
327
- (define (record-type-name obj)
328
- (if (record-type? obj)
329
- (struct-ref obj vtable-offset-user)
330
- (error 'not-a-record-type obj)))
331
-
332
- (define (record-type-fields obj)
333
- (if (record-type? obj)
334
- (struct-ref obj (+ 1 vtable-offset-user))
335
- (error 'not-a-record-type obj)))
336
-
337
- (define (record-constructor rtd . opt)
338
- (let ((field-names (if (pair? opt) (car opt) (record-type-fields rtd))))
339
- (local-eval `(lambda ,field-names
340
- (make-struct ',rtd 0 ,@(map (lambda (f)
341
- (if (memq f field-names)
342
- f
343
- #f))
344
- (record-type-fields rtd))))
345
- the-root-environment)))
346
-
347
- (define (record-predicate rtd)
348
- (lambda (obj) (and (struct? obj) (eq? rtd (struct-vtable obj)))))
349
-
350
- (define (record-accessor rtd field-name)
351
- (let* ((pos (list-index (record-type-fields rtd) field-name)))
352
- (if (not pos)
353
- (error 'no-such-field field-name))
354
- (local-eval `(lambda (obj)
355
- (and (eq? ',rtd (record-type-descriptor obj))
356
- (struct-ref obj ,pos)))
357
- the-root-environment)))
358
-
359
- (define (record-modifier rtd field-name)
360
- (let* ((pos (list-index (record-type-fields rtd) field-name)))
361
- (if (not pos)
362
- (error 'no-such-field field-name))
363
- (local-eval `(lambda (obj val)
364
- (and (eq? ',rtd (record-type-descriptor obj))
365
- (struct-set! obj ,pos val)))
366
- the-root-environment)))
367
-
368
-
369
- (define (record? obj)
370
- (and (struct? obj) (record-type? (struct-vtable obj))))
371
-
372
- (define (record-type-descriptor obj)
373
- (if (struct? obj)
374
- (struct-vtable obj)
375
- (error 'not-a-record obj)))
376
-
377
- (provide 'record)
378
-
379
-
380
- ;;; {Booleans}
381
- ;;;
382
-
383
- (define (->bool x) (not (not x)))
384
-
385
-
386
- ;;; {Symbols}
387
- ;;;
388
-
389
- (define (symbol-append . args)
390
- (string->symbol (apply string-append (map symbol->string args))))
391
-
392
- (define (list->symbol . args)
393
- (string->symbol (apply list->string args)))
394
-
395
- (define (symbol . args)
396
- (string->symbol (apply string args)))
397
-
398
-
399
- ;;; {Lists}
400
- ;;;
401
-
402
- (define (list-index l k)
403
- (let loop ((n 0)
404
- (l l))
405
- (and (not (null? l))
406
- (if (eq? (car l) k)
407
- n
408
- (loop (+ n 1) (cdr l))))))
409
-
410
- (define (make-list n . init)
411
- (if (pair? init) (set! init (car init)))
412
- (let loop ((answer '())
413
- (n n))
414
- (if (<= n 0)
415
- answer
416
- (loop (cons init answer) (- n 1)))))
417
-
418
-
419
- ;;; {and-map and or-map}
420
- ;;;
421
- ;;; (and-map fn lst) is like (and (fn (car lst)) (fn (cadr lst)) (fn...) ...)
422
- ;;; (or-map fn lst) is like (or (fn (car lst)) (fn (cadr lst)) (fn...) ...)
423
- ;;;
424
-
425
- ;; and-map f l
426
- ;;
427
- ;; Apply f to successive elements of l until exhaustion or f returns #f.
428
- ;; If returning early, return #f. Otherwise, return the last value returned
429
- ;; by f. If f has never been called because l is empty, return #t.
430
- ;;
431
- (define (and-map f lst)
432
- (let loop ((result #t)
433
- (l lst))
434
- (and result
435
- (or (and (null? l)
436
- result)
437
- (loop (f (car l)) (cdr l))))))
438
-
439
- ;; or-map f l
440
- ;;
441
- ;; Apply f to successive elements of l until exhaustion or while f returns #f.
442
- ;; If returning early, return the return value of f.
443
- ;;
444
- (define (or-map f lst)
445
- (let loop ((result #f)
446
- (l lst))
447
- (or result
448
- (and (not (null? l))
449
- (loop (f (car l)) (cdr l))))))
450
-
451
-
452
-
453
- (if (provided? 'posix)
454
- (primitive-load-path "ice-9/posix.scm"))
455
-
456
- (if (provided? 'socket)
457
- (primitive-load-path "ice-9/networking.scm"))
458
-
459
- (define file-exists?
460
- (if (provided? 'posix)
461
- (lambda (str)
462
- (->bool (false-if-exception (stat str))))
463
- (lambda (str)
464
- (let ((port (catch 'system-error (lambda () (open-file str OPEN_READ))
465
- (lambda args #f))))
466
- (if port (begin (close-port port) #t)
467
- #f)))))
468
-
469
- (define file-is-directory?
470
- (if (provided? 'posix)
471
- (lambda (str)
472
- (eq? (stat:type (stat str)) 'directory))
473
- (lambda (str)
474
- (let ((port (catch 'system-error
475
- (lambda () (open-file (string-append str "/.")
476
- OPEN_READ))
477
- (lambda args #f))))
478
- (if port (begin (close-port port) #t)
479
- #f)))))
480
-
481
- (define (has-suffix? str suffix)
482
- (let ((sufl (string-length suffix))
483
- (sl (string-length str)))
484
- (and (> sl sufl)
485
- (string=? (substring str (- sl sufl) sl) suffix))))
486
-
487
- (define (system-error-errno args)
488
- (if (eq? (car args) 'system-error)
489
- (car (list-ref args 4))
490
- #f))
491
-
492
-
493
- ;;; {Error Handling}
494
- ;;;
495
-
496
- (define (error . args)
497
- (save-stack)
498
- (if (null? args)
499
- (scm-error 'misc-error #f "?" #f #f)
500
- (let loop ((msg "~A")
501
- (rest (cdr args)))
502
- (if (not (null? rest))
503
- (loop (string-append msg " ~S")
504
- (cdr rest))
505
- (scm-error 'misc-error #f msg args #f)))))
506
-
507
- ;; bad-throw is the hook that is called upon a throw to a an unhandled
508
- ;; key (unless the throw has four arguments, in which case
509
- ;; it's usually interpreted as an error throw.)
510
- ;; If the key has a default handler (a throw-handler-default property),
511
- ;; it is applied to the throw.
512
- ;;
513
- (define (bad-throw key . args)
514
- (let ((default (symbol-property key 'throw-handler-default)))
515
- (or (and default (apply default key args))
516
- (apply error "unhandled-exception:" key args))))
517
-
518
-
519
-
520
- (define (tm:sec obj) (vector-ref obj 0))
521
- (define (tm:min obj) (vector-ref obj 1))
522
- (define (tm:hour obj) (vector-ref obj 2))
523
- (define (tm:mday obj) (vector-ref obj 3))
524
- (define (tm:mon obj) (vector-ref obj 4))
525
- (define (tm:year obj) (vector-ref obj 5))
526
- (define (tm:wday obj) (vector-ref obj 6))
527
- (define (tm:yday obj) (vector-ref obj 7))
528
- (define (tm:isdst obj) (vector-ref obj 8))
529
- (define (tm:gmtoff obj) (vector-ref obj 9))
530
- (define (tm:zone obj) (vector-ref obj 10))
531
-
532
- (define (set-tm:sec obj val) (vector-set! obj 0 val))
533
- (define (set-tm:min obj val) (vector-set! obj 1 val))
534
- (define (set-tm:hour obj val) (vector-set! obj 2 val))
535
- (define (set-tm:mday obj val) (vector-set! obj 3 val))
536
- (define (set-tm:mon obj val) (vector-set! obj 4 val))
537
- (define (set-tm:year obj val) (vector-set! obj 5 val))
538
- (define (set-tm:wday obj val) (vector-set! obj 6 val))
539
- (define (set-tm:yday obj val) (vector-set! obj 7 val))
540
- (define (set-tm:isdst obj val) (vector-set! obj 8 val))
541
- (define (set-tm:gmtoff obj val) (vector-set! obj 9 val))
542
- (define (set-tm:zone obj val) (vector-set! obj 10 val))
543
-
544
- (define (tms:clock obj) (vector-ref obj 0))
545
- (define (tms:utime obj) (vector-ref obj 1))
546
- (define (tms:stime obj) (vector-ref obj 2))
547
- (define (tms:cutime obj) (vector-ref obj 3))
548
- (define (tms:cstime obj) (vector-ref obj 4))
549
-
550
- (define file-position ftell)
551
- (define (file-set-position port offset . whence)
552
- (let ((whence (if (eq? whence '()) SEEK_SET (car whence))))
553
- (seek port offset whence)))
554
-
555
- (define (move->fdes fd/port fd)
556
- (cond ((integer? fd/port)
557
- (dup->fdes fd/port fd)
558
- (close fd/port)
559
- fd)
560
- (else
561
- (primitive-move->fdes fd/port fd)
562
- (set-port-revealed! fd/port 1)
563
- fd/port)))
564
-
565
- (define (release-port-handle port)
566
- (let ((revealed (port-revealed port)))
567
- (if (> revealed 0)
568
- (set-port-revealed! port (- revealed 1)))))
569
-
570
- (define (dup->port port/fd mode . maybe-fd)
571
- (let ((port (fdopen (apply dup->fdes port/fd maybe-fd)
572
- mode)))
573
- (if (pair? maybe-fd)
574
- (set-port-revealed! port 1))
575
- port))
576
-
577
- (define (dup->inport port/fd . maybe-fd)
578
- (apply dup->port port/fd "r" maybe-fd))
579
-
580
- (define (dup->outport port/fd . maybe-fd)
581
- (apply dup->port port/fd "w" maybe-fd))
582
-
583
- (define (dup port/fd . maybe-fd)
584
- (if (integer? port/fd)
585
- (apply dup->fdes port/fd maybe-fd)
586
- (apply dup->port port/fd (port-mode port/fd) maybe-fd)))
587
-
588
- (define (duplicate-port port modes)
589
- (dup->port port modes))
590
-
591
- (define (fdes->inport fdes)
592
- (let loop ((rest-ports (fdes->ports fdes)))
593
- (cond ((null? rest-ports)
594
- (let ((result (fdopen fdes "r")))
595
- (set-port-revealed! result 1)
596
- result))
597
- ((input-port? (car rest-ports))
598
- (set-port-revealed! (car rest-ports)
599
- (+ (port-revealed (car rest-ports)) 1))
600
- (car rest-ports))
601
- (else
602
- (loop (cdr rest-ports))))))
603
-
604
- (define (fdes->outport fdes)
605
- (let loop ((rest-ports (fdes->ports fdes)))
606
- (cond ((null? rest-ports)
607
- (let ((result (fdopen fdes "w")))
608
- (set-port-revealed! result 1)
609
- result))
610
- ((output-port? (car rest-ports))
611
- (set-port-revealed! (car rest-ports)
612
- (+ (port-revealed (car rest-ports)) 1))
613
- (car rest-ports))
614
- (else
615
- (loop (cdr rest-ports))))))
616
-
617
- (define (port->fdes port)
618
- (set-port-revealed! port (+ (port-revealed port) 1))
619
- (fileno port))
620
-
621
- (define (setenv name value)
622
- (if value
623
- (putenv (string-append name "=" value))
624
- (putenv name)))
625
-
626
-
627
- ;;; {Load Paths}
628
- ;;;
629
-
630
- ;;; Here for backward compatability
631
- ;;
632
- (define scheme-file-suffix (lambda () ".scm"))
633
-
634
- (define (in-vicinity vicinity file)
635
- (let ((tail (let ((len (string-length vicinity)))
636
- (if (zero? len)
637
- #f
638
- (string-ref vicinity (- len 1))))))
639
- (string-append vicinity
640
- (if (or (not tail)
641
- (eq? tail #\/))
642
- ""
643
- "/")
644
- file)))
645
-
646
-
647
- ;;; {Help for scm_shell}
648
- ;;; The argument-processing code used by Guile-based shells generates
649
- ;;; Scheme code based on the argument list. This page contains help
650
- ;;; functions for the code it generates.
651
-
652
- (define (command-line) (program-arguments))
653
-
654
- ;; This is mostly for the internal use of the code generated by
655
- ;; scm_compile_shell_switches.
656
- (define (load-user-init)
657
- (let* ((home (or (getenv "HOME")
658
- (false-if-exception (passwd:dir (getpwuid (getuid))))
659
- "/")) ;; fallback for cygwin etc.
660
- (init-file (in-vicinity home ".guile")))
661
- (if (file-exists? init-file)
662
- (primitive-load init-file))))
663
-
664
-
665
- ;;; {Loading by paths}
666
-
667
- ;;; Load a Scheme source file named NAME, searching for it in the
668
- ;;; directories listed in %load-path, and applying each of the file
669
- ;;; name extensions listed in %load-extensions.
670
- (define (load-from-path name)
671
- (start-stack 'load-stack
672
- (primitive-load-path name)))
673
-
674
-
675
-
676
- ;;; {Transcendental Functions}
677
- ;;;
678
- ;;; Derived from "Transcen.scm", Complex trancendental functions for SCM.
679
- ;;; Written by Jerry D. Hedden, (C) FSF.
680
- ;;; See the file `COPYING' for terms applying to this program.
681
- ;;;
682
-
683
- (define (exp z)
684
- (if (real? z) ($exp z)
685
- (make-polar ($exp (real-part z)) (imag-part z))))
686
-
687
- (define (log z)
688
- (if (and (real? z) (>= z 0))
689
- ($log z)
690
- (make-rectangular ($log (magnitude z)) (angle z))))
691
-
692
- (define (sqrt z)
693
- (if (real? z)
694
- (if (negative? z) (make-rectangular 0 ($sqrt (- z)))
695
- ($sqrt z))
696
- (make-polar ($sqrt (magnitude z)) (/ (angle z) 2))))
697
-
698
- (define expt
699
- (let ((integer-expt integer-expt))
700
- (lambda (z1 z2)
701
- (cond ((integer? z2)
702
- (if (negative? z2)
703
- (/ 1 (integer-expt z1 (- z2)))
704
- (integer-expt z1 z2)))
705
- ((and (real? z2) (real? z1) (>= z1 0))
706
- ($expt z1 z2))
707
- (else
708
- (exp (* z2 (log z1))))))))
709
-
710
- (define (sinh z)
711
- (if (real? z) ($sinh z)
712
- (let ((x (real-part z)) (y (imag-part z)))
713
- (make-rectangular (* ($sinh x) ($cos y))
714
- (* ($cosh x) ($sin y))))))
715
- (define (cosh z)
716
- (if (real? z) ($cosh z)
717
- (let ((x (real-part z)) (y (imag-part z)))
718
- (make-rectangular (* ($cosh x) ($cos y))
719
- (* ($sinh x) ($sin y))))))
720
- (define (tanh z)
721
- (if (real? z) ($tanh z)
722
- (let* ((x (* 2 (real-part z)))
723
- (y (* 2 (imag-part z)))
724
- (w (+ ($cosh x) ($cos y))))
725
- (make-rectangular (/ ($sinh x) w) (/ ($sin y) w)))))
726
-
727
- (define (asinh z)
728
- (if (real? z) ($asinh z)
729
- (log (+ z (sqrt (+ (* z z) 1))))))
730
-
731
- (define (acosh z)
732
- (if (and (real? z) (>= z 1))
733
- ($acosh z)
734
- (log (+ z (sqrt (- (* z z) 1))))))
735
-
736
- (define (atanh z)
737
- (if (and (real? z) (> z -1) (< z 1))
738
- ($atanh z)
739
- (/ (log (/ (+ 1 z) (- 1 z))) 2)))
740
-
741
- (define (sin z)
742
- (if (real? z) ($sin z)
743
- (let ((x (real-part z)) (y (imag-part z)))
744
- (make-rectangular (* ($sin x) ($cosh y))
745
- (* ($cos x) ($sinh y))))))
746
- (define (cos z)
747
- (if (real? z) ($cos z)
748
- (let ((x (real-part z)) (y (imag-part z)))
749
- (make-rectangular (* ($cos x) ($cosh y))
750
- (- (* ($sin x) ($sinh y)))))))
751
- (define (tan z)
752
- (if (real? z) ($tan z)
753
- (let* ((x (* 2 (real-part z)))
754
- (y (* 2 (imag-part z)))
755
- (w (+ ($cos x) ($cosh y))))
756
- (make-rectangular (/ ($sin x) w) (/ ($sinh y) w)))))
757
-
758
- (define (asin z)
759
- (if (and (real? z) (>= z -1) (<= z 1))
760
- ($asin z)
761
- (* -i (asinh (* +i z)))))
762
-
763
- (define (acos z)
764
- (if (and (real? z) (>= z -1) (<= z 1))
765
- ($acos z)
766
- (+ (/ (angle -1) 2) (* +i (asinh (* +i z))))))
767
-
768
- (define (atan z . y)
769
- (if (null? y)
770
- (if (real? z) ($atan z)
771
- (/ (log (/ (- +i z) (+ +i z))) +2i))
772
- ($atan2 z (car y))))
773
-
774
- (define (log10 arg)
775
- (/ (log arg) (log 10)))
776
-
777
-
778
-
779
- ;;; {Reader Extensions}
780
- ;;;
781
-
782
- ;;; Reader code for various "#c" forms.
783
- ;;;
784
-
785
- (read-hash-extend #\' (lambda (c port)
786
- (read port)))
787
-
788
- (define read-eval? (make-fluid))
789
- (fluid-set! read-eval? #f)
790
- (read-hash-extend #\.
791
- (lambda (c port)
792
- (if (fluid-ref read-eval?)
793
- (eval (read port) (interaction-environment))
794
- (error
795
- "#. read expansion found and read-eval? is #f."))))
796
-
797
-
798
- ;;; {Command Line Options}
799
- ;;;
800
-
801
- (define (get-option argv kw-opts kw-args return)
802
- (cond
803
- ((null? argv)
804
- (return #f #f argv))
805
-
806
- ((or (not (eq? #\- (string-ref (car argv) 0)))
807
- (eq? (string-length (car argv)) 1))
808
- (return 'normal-arg (car argv) (cdr argv)))
809
-
810
- ((eq? #\- (string-ref (car argv) 1))
811
- (let* ((kw-arg-pos (or (string-index (car argv) #\=)
812
- (string-length (car argv))))
813
- (kw (symbol->keyword (substring (car argv) 2 kw-arg-pos)))
814
- (kw-opt? (member kw kw-opts))
815
- (kw-arg? (member kw kw-args))
816
- (arg (or (and (not (eq? kw-arg-pos (string-length (car argv))))
817
- (substring (car argv)
818
- (+ kw-arg-pos 1)
819
- (string-length (car argv))))
820
- (and kw-arg?
821
- (begin (set! argv (cdr argv)) (car argv))))))
822
- (if (or kw-opt? kw-arg?)
823
- (return kw arg (cdr argv))
824
- (return 'usage-error kw (cdr argv)))))
825
-
826
- (else
827
- (let* ((char (substring (car argv) 1 2))
828
- (kw (symbol->keyword char)))
829
- (cond
830
-
831
- ((member kw kw-opts)
832
- (let* ((rest-car (substring (car argv) 2 (string-length (car argv))))
833
- (new-argv (if (= 0 (string-length rest-car))
834
- (cdr argv)
835
- (cons (string-append "-" rest-car) (cdr argv)))))
836
- (return kw #f new-argv)))
837
-
838
- ((member kw kw-args)
839
- (let* ((rest-car (substring (car argv) 2 (string-length (car argv))))
840
- (arg (if (= 0 (string-length rest-car))
841
- (cadr argv)
842
- rest-car))
843
- (new-argv (if (= 0 (string-length rest-car))
844
- (cddr argv)
845
- (cdr argv))))
846
- (return kw arg new-argv)))
847
-
848
- (else (return 'usage-error kw argv)))))))
849
-
850
- (define (for-next-option proc argv kw-opts kw-args)
851
- (let loop ((argv argv))
852
- (get-option argv kw-opts kw-args
853
- (lambda (opt opt-arg argv)
854
- (and opt (proc opt opt-arg argv loop))))))
855
-
856
- (define (display-usage-report kw-desc)
857
- (for-each
858
- (lambda (kw)
859
- (or (eq? (car kw) #t)
860
- (eq? (car kw) 'else)
861
- (let* ((opt-desc kw)
862
- (help (cadr opt-desc))
863
- (opts (car opt-desc))
864
- (opts-proper (if (string? (car opts)) (cdr opts) opts))
865
- (arg-name (if (string? (car opts))
866
- (string-append "<" (car opts) ">")
867
- ""))
868
- (left-part (string-append
869
- (with-output-to-string
870
- (lambda ()
871
- (map (lambda (x) (display (keyword->symbol x)) (display " "))
872
- opts-proper)))
873
- arg-name))
874
- (middle-part (if (and (< (string-length left-part) 30)
875
- (< (string-length help) 40))
876
- (make-string (- 30 (string-length left-part)) #\ )
877
- "\n\t")))
878
- (display left-part)
879
- (display middle-part)
880
- (display help)
881
- (newline))))
882
- kw-desc))
883
-
884
-
885
-
886
- (define (transform-usage-lambda cases)
887
- (let* ((raw-usage (delq! 'else (map car cases)))
888
- (usage-sans-specials (map (lambda (x)
889
- (or (and (not (list? x)) x)
890
- (and (symbol? (car x)) #t)
891
- (and (boolean? (car x)) #t)
892
- x))
893
- raw-usage))
894
- (usage-desc (delq! #t usage-sans-specials))
895
- (kw-desc (map car usage-desc))
896
- (kw-opts (apply append (map (lambda (x) (and (not (string? (car x))) x)) kw-desc)))
897
- (kw-args (apply append (map (lambda (x) (and (string? (car x)) (cdr x))) kw-desc)))
898
- (transmogrified-cases (map (lambda (case)
899
- (cons (let ((opts (car case)))
900
- (if (or (boolean? opts) (eq? 'else opts))
901
- opts
902
- (cond
903
- ((symbol? (car opts)) opts)
904
- ((boolean? (car opts)) opts)
905
- ((string? (caar opts)) (cdar opts))
906
- (else (car opts)))))
907
- (cdr case)))
908
- cases)))
909
- `(let ((%display-usage (lambda () (display-usage-report ',usage-desc))))
910
- (lambda (%argv)
911
- (let %next-arg ((%argv %argv))
912
- (get-option %argv
913
- ',kw-opts
914
- ',kw-args
915
- (lambda (%opt %arg %new-argv)
916
- (case %opt
917
- ,@ transmogrified-cases))))))))
918
-
919
-
920
-
921
-
922
- ;;; {Low Level Modules}
923
- ;;;
924
- ;;; These are the low level data structures for modules.
925
- ;;;
926
- ;;; !!! warning: The interface to lazy binder procedures is going
927
- ;;; to be changed in an incompatible way to permit all the basic
928
- ;;; module ops to be virtualized.
929
- ;;;
930
- ;;; (make-module size use-list lazy-binding-proc) => module
931
- ;;; module-{obarray,uses,binder}[|-set!]
932
- ;;; (module? obj) => [#t|#f]
933
- ;;; (module-locally-bound? module symbol) => [#t|#f]
934
- ;;; (module-bound? module symbol) => [#t|#f]
935
- ;;; (module-symbol-locally-interned? module symbol) => [#t|#f]
936
- ;;; (module-symbol-interned? module symbol) => [#t|#f]
937
- ;;; (module-local-variable module symbol) => [#<variable ...> | #f]
938
- ;;; (module-variable module symbol) => [#<variable ...> | #f]
939
- ;;; (module-symbol-binding module symbol opt-value)
940
- ;;; => [ <obj> | opt-value | an error occurs ]
941
- ;;; (module-make-local-var! module symbol) => #<variable...>
942
- ;;; (module-add! module symbol var) => unspecified
943
- ;;; (module-remove! module symbol) => unspecified
944
- ;;; (module-for-each proc module) => unspecified
945
- ;;; (make-scm-module) => module ; a lazy copy of the symhash module
946
- ;;; (set-current-module module) => unspecified
947
- ;;; (current-module) => #<module...>
948
- ;;;
949
- ;;;
950
-
951
-
952
- ;;; {Printing Modules}
953
- ;; This is how modules are printed. You can re-define it.
954
- ;; (Redefining is actually more complicated than simply redefining
955
- ;; %print-module because that would only change the binding and not
956
- ;; the value stored in the vtable that determines how record are
957
- ;; printed. Sigh.)
958
-
959
- (define (%print-module mod port) ; unused args: depth length style table)
960
- (display "#<" port)
961
- (display (or (module-kind mod) "module") port)
962
- (let ((name (module-name mod)))
963
- (if name
964
- (begin
965
- (display " " port)
966
- (display name port))))
967
- (display " " port)
968
- (display (number->string (object-address mod) 16) port)
969
- (display ">" port))
970
-
971
- ;; module-type
972
- ;;
973
- ;; A module is characterized by an obarray in which local symbols
974
- ;; are interned, a list of modules, "uses", from which non-local
975
- ;; bindings can be inherited, and an optional lazy-binder which
976
- ;; is a (CLOSURE module symbol) which, as a last resort, can provide
977
- ;; bindings that would otherwise not be found locally in the module.
978
- ;;
979
- ;; NOTE: If you change here, you also need to change libguile/modules.h.
980
- ;;
981
- (define module-type
982
- (make-record-type 'module
983
- '(obarray uses binder eval-closure transformer name kind
984
- observers weak-observers observer-id)
985
- %print-module))
986
-
987
- ;; make-module &opt size uses binder
988
- ;;
989
- ;; Create a new module, perhaps with a particular size of obarray,
990
- ;; initial uses list, or binding procedure.
991
- ;;
992
- (define make-module
993
- (lambda args
994
-
995
- (define (parse-arg index default)
996
- (if (> (length args) index)
997
- (list-ref args index)
998
- default))
999
-
1000
- (if (> (length args) 3)
1001
- (error "Too many args to make-module." args))
1002
-
1003
- (let ((size (parse-arg 0 1021))
1004
- (uses (parse-arg 1 '()))
1005
- (binder (parse-arg 2 #f)))
1006
-
1007
- (if (not (integer? size))
1008
- (error "Illegal size to make-module." size))
1009
- (if (not (and (list? uses)
1010
- (and-map module? uses)))
1011
- (error "Incorrect use list." uses))
1012
- (if (and binder (not (procedure? binder)))
1013
- (error
1014
- "Lazy-binder expected to be a procedure or #f." binder))
1015
-
1016
- (let ((module (module-constructor (make-vector size '())
1017
- uses binder #f #f #f #f
1018
- '()
1019
- (make-weak-value-hash-table 31)
1020
- 0)))
1021
-
1022
- ;; We can't pass this as an argument to module-constructor,
1023
- ;; because we need it to close over a pointer to the module
1024
- ;; itself.
1025
- (set-module-eval-closure! module (standard-eval-closure module))
1026
-
1027
- module))))
1028
-
1029
- (define module-constructor (record-constructor module-type))
1030
- (define module-obarray (record-accessor module-type 'obarray))
1031
- (define set-module-obarray! (record-modifier module-type 'obarray))
1032
- (define module-uses (record-accessor module-type 'uses))
1033
- (define set-module-uses! (record-modifier module-type 'uses))
1034
- (define module-binder (record-accessor module-type 'binder))
1035
- (define set-module-binder! (record-modifier module-type 'binder))
1036
-
1037
- ;; NOTE: This binding is used in libguile/modules.c.
1038
- (define module-eval-closure (record-accessor module-type 'eval-closure))
1039
-
1040
- (define module-transformer (record-accessor module-type 'transformer))
1041
- (define set-module-transformer! (record-modifier module-type 'transformer))
1042
- (define module-name (record-accessor module-type 'name))
1043
- (define set-module-name! (record-modifier module-type 'name))
1044
- (define module-kind (record-accessor module-type 'kind))
1045
- (define set-module-kind! (record-modifier module-type 'kind))
1046
- (define module-observers (record-accessor module-type 'observers))
1047
- (define set-module-observers! (record-modifier module-type 'observers))
1048
- (define module-weak-observers (record-accessor module-type 'weak-observers))
1049
- (define module-observer-id (record-accessor module-type 'observer-id))
1050
- (define set-module-observer-id! (record-modifier module-type 'observer-id))
1051
- (define module? (record-predicate module-type))
1052
-
1053
- (define set-module-eval-closure!
1054
- (let ((setter (record-modifier module-type 'eval-closure)))
1055
- (lambda (module closure)
1056
- (setter module closure)
1057
- ;; Make it possible to lookup the module from the environment.
1058
- ;; This implementation is correct since an eval closure can belong
1059
- ;; to maximally one module.
1060
- (set-procedure-property! closure 'module module))))
1061
-
1062
- (begin-deprecated
1063
- (define (eval-in-module exp mod)
1064
- (issue-deprecation-warning
1065
- "`eval-in-module' is deprecated. Use `eval' instead.")
1066
- (eval exp mod)))
1067
-
1068
-
1069
- ;;; {Observer protocol}
1070
- ;;;
1071
-
1072
- (define (module-observe module proc)
1073
- (set-module-observers! module (cons proc (module-observers module)))
1074
- (cons module proc))
1075
-
1076
- (define (module-observe-weak module proc)
1077
- (let ((id (module-observer-id module)))
1078
- (hash-set! (module-weak-observers module) id proc)
1079
- (set-module-observer-id! module (+ 1 id))
1080
- (cons module id)))
1081
-
1082
- (define (module-unobserve token)
1083
- (let ((module (car token))
1084
- (id (cdr token)))
1085
- (if (integer? id)
1086
- (hash-remove! (module-weak-observers module) id)
1087
- (set-module-observers! module (delq1! id (module-observers module)))))
1088
- *unspecified*)
1089
-
1090
- (define (module-modified m)
1091
- (for-each (lambda (proc) (proc m)) (module-observers m))
1092
- (hash-fold (lambda (id proc res) (proc m)) #f (module-weak-observers m)))
1093
-
1094
-
1095
- ;;; {Module Searching in General}
1096
- ;;;
1097
- ;;; We sometimes want to look for properties of a symbol
1098
- ;;; just within the obarray of one module. If the property
1099
- ;;; holds, then it is said to hold ``locally'' as in, ``The symbol
1100
- ;;; DISPLAY is locally rebound in the module `safe-guile'.''
1101
- ;;;
1102
- ;;;
1103
- ;;; Other times, we want to test for a symbol property in the obarray
1104
- ;;; of M and, if it is not found there, try each of the modules in the
1105
- ;;; uses list of M. This is the normal way of testing for some
1106
- ;;; property, so we state these properties without qualification as
1107
- ;;; in: ``The symbol 'fnord is interned in module M because it is
1108
- ;;; interned locally in module M2 which is a member of the uses list
1109
- ;;; of M.''
1110
- ;;;
1111
-
1112
- ;; module-search fn m
1113
- ;;
1114
- ;; return the first non-#f result of FN applied to M and then to
1115
- ;; the modules in the uses of m, and so on recursively. If all applications
1116
- ;; return #f, then so does this function.
1117
- ;;
1118
- (define (module-search fn m v)
1119
- (define (loop pos)
1120
- (and (pair? pos)
1121
- (or (module-search fn (car pos) v)
1122
- (loop (cdr pos)))))
1123
- (or (fn m v)
1124
- (loop (module-uses m))))
1125
-
1126
-
1127
- ;;; {Is a symbol bound in a module?}
1128
- ;;;
1129
- ;;; Symbol S in Module M is bound if S is interned in M and if the binding
1130
- ;;; of S in M has been set to some well-defined value.
1131
- ;;;
1132
-
1133
- ;; module-locally-bound? module symbol
1134
- ;;
1135
- ;; Is a symbol bound (interned and defined) locally in a given module?
1136
- ;;
1137
- (define (module-locally-bound? m v)
1138
- (let ((var (module-local-variable m v)))
1139
- (and var
1140
- (variable-bound? var))))
1141
-
1142
- ;; module-bound? module symbol
1143
- ;;
1144
- ;; Is a symbol bound (interned and defined) anywhere in a given module
1145
- ;; or its uses?
1146
- ;;
1147
- (define (module-bound? m v)
1148
- (module-search module-locally-bound? m v))
1149
-
1150
- ;;; {Is a symbol interned in a module?}
1151
- ;;;
1152
- ;;; Symbol S in Module M is interned if S occurs in
1153
- ;;; of S in M has been set to some well-defined value.
1154
- ;;;
1155
- ;;; It is possible to intern a symbol in a module without providing
1156
- ;;; an initial binding for the corresponding variable. This is done
1157
- ;;; with:
1158
- ;;; (module-add! module symbol (make-undefined-variable))
1159
- ;;;
1160
- ;;; In that case, the symbol is interned in the module, but not
1161
- ;;; bound there. The unbound symbol shadows any binding for that
1162
- ;;; symbol that might otherwise be inherited from a member of the uses list.
1163
- ;;;
1164
-
1165
- (define (module-obarray-get-handle ob key)
1166
- ((if (symbol? key) hashq-get-handle hash-get-handle) ob key))
1167
-
1168
- (define (module-obarray-ref ob key)
1169
- ((if (symbol? key) hashq-ref hash-ref) ob key))
1170
-
1171
- (define (module-obarray-set! ob key val)
1172
- ((if (symbol? key) hashq-set! hash-set!) ob key val))
1173
-
1174
- (define (module-obarray-remove! ob key)
1175
- ((if (symbol? key) hashq-remove! hash-remove!) ob key))
1176
-
1177
- ;; module-symbol-locally-interned? module symbol
1178
- ;;
1179
- ;; is a symbol interned (not neccessarily defined) locally in a given module
1180
- ;; or its uses? Interned symbols shadow inherited bindings even if
1181
- ;; they are not themselves bound to a defined value.
1182
- ;;
1183
- (define (module-symbol-locally-interned? m v)
1184
- (not (not (module-obarray-get-handle (module-obarray m) v))))
1185
-
1186
- ;; module-symbol-interned? module symbol
1187
- ;;
1188
- ;; is a symbol interned (not neccessarily defined) anywhere in a given module
1189
- ;; or its uses? Interned symbols shadow inherited bindings even if
1190
- ;; they are not themselves bound to a defined value.
1191
- ;;
1192
- (define (module-symbol-interned? m v)
1193
- (module-search module-symbol-locally-interned? m v))
1194
-
1195
-
1196
- ;;; {Mapping modules x symbols --> variables}
1197
- ;;;
1198
-
1199
- ;; module-local-variable module symbol
1200
- ;; return the local variable associated with a MODULE and SYMBOL.
1201
- ;;
1202
- ;;; This function is very important. It is the only function that can
1203
- ;;; return a variable from a module other than the mutators that store
1204
- ;;; new variables in modules. Therefore, this function is the location
1205
- ;;; of the "lazy binder" hack.
1206
- ;;;
1207
- ;;; If symbol is defined in MODULE, and if the definition binds symbol
1208
- ;;; to a variable, return that variable object.
1209
- ;;;
1210
- ;;; If the symbols is not found at first, but the module has a lazy binder,
1211
- ;;; then try the binder.
1212
- ;;;
1213
- ;;; If the symbol is not found at all, return #f.
1214
- ;;;
1215
- (define (module-local-variable m v)
1216
- ; (caddr
1217
- ; (list m v
1218
- (let ((b (module-obarray-ref (module-obarray m) v)))
1219
- (or (and (variable? b) b)
1220
- (and (module-binder m)
1221
- ((module-binder m) m v #f)))))
1222
- ;))
1223
-
1224
- ;; module-variable module symbol
1225
- ;;
1226
- ;; like module-local-variable, except search the uses in the
1227
- ;; case V is not found in M.
1228
- ;;
1229
- ;; NOTE: This function is superseded with C code (see modules.c)
1230
- ;;; when using the standard eval closure.
1231
- ;;
1232
- (define (module-variable m v)
1233
- (module-search module-local-variable m v))
1234
-
1235
-
1236
- ;;; {Mapping modules x symbols --> bindings}
1237
- ;;;
1238
- ;;; These are similar to the mapping to variables, except that the
1239
- ;;; variable is dereferenced.
1240
- ;;;
1241
-
1242
- ;; module-symbol-binding module symbol opt-value
1243
- ;;
1244
- ;; return the binding of a variable specified by name within
1245
- ;; a given module, signalling an error if the variable is unbound.
1246
- ;; If the OPT-VALUE is passed, then instead of signalling an error,
1247
- ;; return OPT-VALUE.
1248
- ;;
1249
- (define (module-symbol-local-binding m v . opt-val)
1250
- (let ((var (module-local-variable m v)))
1251
- (if var
1252
- (variable-ref var)
1253
- (if (not (null? opt-val))
1254
- (car opt-val)
1255
- (error "Locally unbound variable." v)))))
1256
-
1257
- ;; module-symbol-binding module symbol opt-value
1258
- ;;
1259
- ;; return the binding of a variable specified by name within
1260
- ;; a given module, signalling an error if the variable is unbound.
1261
- ;; If the OPT-VALUE is passed, then instead of signalling an error,
1262
- ;; return OPT-VALUE.
1263
- ;;
1264
- (define (module-symbol-binding m v . opt-val)
1265
- (let ((var (module-variable m v)))
1266
- (if var
1267
- (variable-ref var)
1268
- (if (not (null? opt-val))
1269
- (car opt-val)
1270
- (error "Unbound variable." v)))))
1271
-
1272
-
1273
-
1274
- ;;; {Adding Variables to Modules}
1275
- ;;;
1276
- ;;;
1277
-
1278
-
1279
- ;; module-make-local-var! module symbol
1280
- ;;
1281
- ;; ensure a variable for V in the local namespace of M.
1282
- ;; If no variable was already there, then create a new and uninitialzied
1283
- ;; variable.
1284
- ;;
1285
- (define (module-make-local-var! m v)
1286
- (or (let ((b (module-obarray-ref (module-obarray m) v)))
1287
- (and (variable? b)
1288
- (begin
1289
- (module-modified m)
1290
- b)))
1291
- (and (module-binder m)
1292
- ((module-binder m) m v #t))
1293
- (begin
1294
- (let ((answer (make-undefined-variable)))
1295
- (variable-set-name-hint! answer v)
1296
- (module-obarray-set! (module-obarray m) v answer)
1297
- (module-modified m)
1298
- answer))))
1299
-
1300
- ;; module-ensure-local-variable! module symbol
1301
- ;;
1302
- ;; Ensure that there is a local variable in MODULE for SYMBOL. If
1303
- ;; there is no binding for SYMBOL, create a new uninitialized
1304
- ;; variable. Return the local variable.
1305
- ;;
1306
- (define (module-ensure-local-variable! module symbol)
1307
- (or (module-local-variable module symbol)
1308
- (let ((var (make-undefined-variable)))
1309
- (variable-set-name-hint! var symbol)
1310
- (module-add! module symbol var)
1311
- var)))
1312
-
1313
- ;; module-add! module symbol var
1314
- ;;
1315
- ;; ensure a particular variable for V in the local namespace of M.
1316
- ;;
1317
- (define (module-add! m v var)
1318
- (if (not (variable? var))
1319
- (error "Bad variable to module-add!" var))
1320
- (module-obarray-set! (module-obarray m) v var)
1321
- (module-modified m))
1322
-
1323
- ;; module-remove!
1324
- ;;
1325
- ;; make sure that a symbol is undefined in the local namespace of M.
1326
- ;;
1327
- (define (module-remove! m v)
1328
- (module-obarray-remove! (module-obarray m) v)
1329
- (module-modified m))
1330
-
1331
- (define (module-clear! m)
1332
- (vector-fill! (module-obarray m) '())
1333
- (module-modified m))
1334
-
1335
- ;; MODULE-FOR-EACH -- exported
1336
- ;;
1337
- ;; Call PROC on each symbol in MODULE, with arguments of (SYMBOL VARIABLE).
1338
- ;;
1339
- (define (module-for-each proc module)
1340
- (let ((obarray (module-obarray module)))
1341
- (do ((index 0 (+ index 1))
1342
- (end (vector-length obarray)))
1343
- ((= index end))
1344
- (for-each
1345
- (lambda (bucket)
1346
- (proc (car bucket) (cdr bucket)))
1347
- (vector-ref obarray index)))))
1348
-
1349
-
1350
- (define (module-map proc module)
1351
- (let* ((obarray (module-obarray module))
1352
- (end (vector-length obarray)))
1353
-
1354
- (let loop ((i 0)
1355
- (answer '()))
1356
- (if (= i end)
1357
- answer
1358
- (loop (+ 1 i)
1359
- (append!
1360
- (map (lambda (bucket)
1361
- (proc (car bucket) (cdr bucket)))
1362
- (vector-ref obarray i))
1363
- answer))))))
1364
-
1365
-
1366
- ;;; {Low Level Bootstrapping}
1367
- ;;;
1368
-
1369
- ;; make-root-module
1370
-
1371
- ;; A root module uses the pre-modules-obarray as its obarray. This
1372
- ;; special obarray accumulates all bindings that have been established
1373
- ;; before the module system is fully booted.
1374
- ;;
1375
- ;; (The obarray continues to be used by code that has been closed over
1376
- ;; before the module system has been booted.)
1377
-
1378
- (define (make-root-module)
1379
- (let ((m (make-module 0)))
1380
- (set-module-obarray! m (%get-pre-modules-obarray))
1381
- m))
1382
-
1383
- ;; make-scm-module
1384
-
1385
- ;; The root interface is a module that uses the same obarray as the
1386
- ;; root module. It does not allow new definitions, tho.
1387
-
1388
- (define (make-scm-module)
1389
- (let ((m (make-module 0)))
1390
- (set-module-obarray! m (%get-pre-modules-obarray))
1391
- (set-module-eval-closure! m (standard-interface-eval-closure m))
1392
- m))
1393
-
1394
-
1395
-
1396
- ;;; {Module-based Loading}
1397
- ;;;
1398
-
1399
- (define (save-module-excursion thunk)
1400
- (let ((inner-module (current-module))
1401
- (outer-module #f))
1402
- (dynamic-wind (lambda ()
1403
- (set! outer-module (current-module))
1404
- (set-current-module inner-module)
1405
- (set! inner-module #f))
1406
- thunk
1407
- (lambda ()
1408
- (set! inner-module (current-module))
1409
- (set-current-module outer-module)
1410
- (set! outer-module #f)))))
1411
-
1412
- (define basic-load load)
1413
-
1414
- (define (load-module filename)
1415
- (save-module-excursion
1416
- (lambda ()
1417
- (let ((oldname (and (current-load-port)
1418
- (port-filename (current-load-port)))))
1419
- (basic-load (if (and oldname
1420
- (> (string-length filename) 0)
1421
- (not (char=? (string-ref filename 0) #\/))
1422
- (not (string=? (dirname oldname) ".")))
1423
- (string-append (dirname oldname) "/" filename)
1424
- filename))))))
1425
-
1426
-
1427
-
1428
- ;;; {MODULE-REF -- exported}
1429
- ;;
1430
- ;; Returns the value of a variable called NAME in MODULE or any of its
1431
- ;; used modules. If there is no such variable, then if the optional third
1432
- ;; argument DEFAULT is present, it is returned; otherwise an error is signaled.
1433
- ;;
1434
- (define (module-ref module name . rest)
1435
- (let ((variable (module-variable module name)))
1436
- (if (and variable (variable-bound? variable))
1437
- (variable-ref variable)
1438
- (if (null? rest)
1439
- (error "No variable named" name 'in module)
1440
- (car rest) ; default value
1441
- ))))
1442
-
1443
- ;; MODULE-SET! -- exported
1444
- ;;
1445
- ;; Sets the variable called NAME in MODULE (or in a module that MODULE uses)
1446
- ;; to VALUE; if there is no such variable, an error is signaled.
1447
- ;;
1448
- (define (module-set! module name value)
1449
- (let ((variable (module-variable module name)))
1450
- (if variable
1451
- (variable-set! variable value)
1452
- (error "No variable named" name 'in module))))
1453
-
1454
- ;; MODULE-DEFINE! -- exported
1455
- ;;
1456
- ;; Sets the variable called NAME in MODULE to VALUE; if there is no such
1457
- ;; variable, it is added first.
1458
- ;;
1459
- (define (module-define! module name value)
1460
- (let ((variable (module-local-variable module name)))
1461
- (if variable
1462
- (begin
1463
- (variable-set! variable value)
1464
- (module-modified module))
1465
- (let ((variable (make-variable value)))
1466
- (variable-set-name-hint! variable name)
1467
- (module-add! module name variable)))))
1468
-
1469
- ;; MODULE-DEFINED? -- exported
1470
- ;;
1471
- ;; Return #t iff NAME is defined in MODULE (or in a module that MODULE
1472
- ;; uses)
1473
- ;;
1474
- (define (module-defined? module name)
1475
- (let ((variable (module-variable module name)))
1476
- (and variable (variable-bound? variable))))
1477
-
1478
- ;; MODULE-USE! module interface
1479
- ;;
1480
- ;; Add INTERFACE to the list of interfaces used by MODULE.
1481
- ;;
1482
- (define (module-use! module interface)
1483
- (set-module-uses! module
1484
- (cons interface (delq! interface (module-uses module))))
1485
- (module-modified module))
1486
-
1487
-
1488
- ;;; {Recursive Namespaces}
1489
- ;;;
1490
- ;;;
1491
- ;;; A hierarchical namespace emerges if we consider some module to be
1492
- ;;; root, and variables bound to modules as nested namespaces.
1493
- ;;;
1494
- ;;; The routines in this file manage variable names in hierarchical namespace.
1495
- ;;; Each variable name is a list of elements, looked up in successively nested
1496
- ;;; modules.
1497
- ;;;
1498
- ;;; (nested-ref some-root-module '(foo bar baz))
1499
- ;;; => <value of a variable named baz in the module bound to bar in
1500
- ;;; the module bound to foo in some-root-module>
1501
- ;;;
1502
- ;;;
1503
- ;;; There are:
1504
- ;;;
1505
- ;;; ;; a-root is a module
1506
- ;;; ;; name is a list of symbols
1507
- ;;;
1508
- ;;; nested-ref a-root name
1509
- ;;; nested-set! a-root name val
1510
- ;;; nested-define! a-root name val
1511
- ;;; nested-remove! a-root name
1512
- ;;;
1513
- ;;;
1514
- ;;; (current-module) is a natural choice for a-root so for convenience there are
1515
- ;;; also:
1516
- ;;;
1517
- ;;; local-ref name == nested-ref (current-module) name
1518
- ;;; local-set! name val == nested-set! (current-module) name val
1519
- ;;; local-define! name val == nested-define! (current-module) name val
1520
- ;;; local-remove! name == nested-remove! (current-module) name
1521
- ;;;
1522
-
1523
-
1524
- (define (nested-ref root names)
1525
- (let loop ((cur root)
1526
- (elts names))
1527
- (cond
1528
- ((null? elts) cur)
1529
- ((not (module? cur)) #f)
1530
- (else (loop (module-ref cur (car elts) #f) (cdr elts))))))
1531
-
1532
- (define (nested-set! root names val)
1533
- (let loop ((cur root)
1534
- (elts names))
1535
- (if (null? (cdr elts))
1536
- (module-set! cur (car elts) val)
1537
- (loop (module-ref cur (car elts)) (cdr elts)))))
1538
-
1539
- (define (nested-define! root names val)
1540
- (let loop ((cur root)
1541
- (elts names))
1542
- (if (null? (cdr elts))
1543
- (module-define! cur (car elts) val)
1544
- (loop (module-ref cur (car elts)) (cdr elts)))))
1545
-
1546
- (define (nested-remove! root names)
1547
- (let loop ((cur root)
1548
- (elts names))
1549
- (if (null? (cdr elts))
1550
- (module-remove! cur (car elts))
1551
- (loop (module-ref cur (car elts)) (cdr elts)))))
1552
-
1553
- (define (local-ref names) (nested-ref (current-module) names))
1554
- (define (local-set! names val) (nested-set! (current-module) names val))
1555
- (define (local-define names val) (nested-define! (current-module) names val))
1556
- (define (local-remove names) (nested-remove! (current-module) names))
1557
- ;;; boot-9.scm ends here