mortar-pygments.rb 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (472) hide show
  1. data/.gitignore +6 -0
  2. data/CHANGELOG.md +71 -0
  3. data/Gemfile +2 -0
  4. data/LICENSE +17 -0
  5. data/README.md +121 -0
  6. data/Rakefile +66 -0
  7. data/bench.rb +22 -0
  8. data/cache-lexers.rb +8 -0
  9. data/lexers +0 -0
  10. data/lib/pygments/lexer.rb +148 -0
  11. data/lib/pygments/mentos.py +351 -0
  12. data/lib/pygments/popen.rb +406 -0
  13. data/lib/pygments/version.rb +3 -0
  14. data/lib/pygments.rb +8 -0
  15. data/pygments.rb.gemspec +25 -0
  16. data/test/test_data.c +2581 -0
  17. data/test/test_data.py +514 -0
  18. data/test/test_data_generated +2582 -0
  19. data/test/test_pygments.rb +287 -0
  20. data/vendor/custom_lexers/github.py +565 -0
  21. data/vendor/pygments-main/AUTHORS +153 -0
  22. data/vendor/pygments-main/CHANGES +889 -0
  23. data/vendor/pygments-main/LICENSE +25 -0
  24. data/vendor/pygments-main/MANIFEST.in +6 -0
  25. data/vendor/pygments-main/Makefile +59 -0
  26. data/vendor/pygments-main/REVISION +1 -0
  27. data/vendor/pygments-main/TODO +15 -0
  28. data/vendor/pygments-main/docs/generate.py +472 -0
  29. data/vendor/pygments-main/docs/pygmentize.1 +94 -0
  30. data/vendor/pygments-main/docs/src/api.txt +270 -0
  31. data/vendor/pygments-main/docs/src/authors.txt +5 -0
  32. data/vendor/pygments-main/docs/src/changelog.txt +5 -0
  33. data/vendor/pygments-main/docs/src/cmdline.txt +147 -0
  34. data/vendor/pygments-main/docs/src/filterdevelopment.txt +70 -0
  35. data/vendor/pygments-main/docs/src/filters.txt +42 -0
  36. data/vendor/pygments-main/docs/src/formatterdevelopment.txt +169 -0
  37. data/vendor/pygments-main/docs/src/formatters.txt +48 -0
  38. data/vendor/pygments-main/docs/src/index.txt +69 -0
  39. data/vendor/pygments-main/docs/src/installation.txt +71 -0
  40. data/vendor/pygments-main/docs/src/integrate.txt +48 -0
  41. data/vendor/pygments-main/docs/src/java.txt +70 -0
  42. data/vendor/pygments-main/docs/src/lexerdevelopment.txt +603 -0
  43. data/vendor/pygments-main/docs/src/lexers.txt +67 -0
  44. data/vendor/pygments-main/docs/src/moinmoin.txt +39 -0
  45. data/vendor/pygments-main/docs/src/plugins.txt +93 -0
  46. data/vendor/pygments-main/docs/src/quickstart.txt +202 -0
  47. data/vendor/pygments-main/docs/src/rstdirective.txt +22 -0
  48. data/vendor/pygments-main/docs/src/styles.txt +143 -0
  49. data/vendor/pygments-main/docs/src/tokens.txt +349 -0
  50. data/vendor/pygments-main/docs/src/unicode.txt +49 -0
  51. data/vendor/pygments-main/external/autopygmentize +64 -0
  52. data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +144 -0
  53. data/vendor/pygments-main/external/markdown-processor.py +67 -0
  54. data/vendor/pygments-main/external/moin-parser.py +112 -0
  55. data/vendor/pygments-main/external/pygments.bashcomp +38 -0
  56. data/vendor/pygments-main/external/rst-directive-old.py +77 -0
  57. data/vendor/pygments-main/external/rst-directive.py +83 -0
  58. data/vendor/pygments-main/ez_setup.py +276 -0
  59. data/vendor/pygments-main/pygmentize +7 -0
  60. data/vendor/pygments-main/pygments/__init__.py +91 -0
  61. data/vendor/pygments-main/pygments/cmdline.py +441 -0
  62. data/vendor/pygments-main/pygments/console.py +74 -0
  63. data/vendor/pygments-main/pygments/filter.py +74 -0
  64. data/vendor/pygments-main/pygments/filters/__init__.py +356 -0
  65. data/vendor/pygments-main/pygments/formatter.py +95 -0
  66. data/vendor/pygments-main/pygments/formatters/__init__.py +68 -0
  67. data/vendor/pygments-main/pygments/formatters/_mapping.py +92 -0
  68. data/vendor/pygments-main/pygments/formatters/bbcode.py +109 -0
  69. data/vendor/pygments-main/pygments/formatters/html.py +821 -0
  70. data/vendor/pygments-main/pygments/formatters/img.py +553 -0
  71. data/vendor/pygments-main/pygments/formatters/latex.py +378 -0
  72. data/vendor/pygments-main/pygments/formatters/other.py +115 -0
  73. data/vendor/pygments-main/pygments/formatters/rtf.py +136 -0
  74. data/vendor/pygments-main/pygments/formatters/svg.py +154 -0
  75. data/vendor/pygments-main/pygments/formatters/terminal.py +112 -0
  76. data/vendor/pygments-main/pygments/formatters/terminal256.py +222 -0
  77. data/vendor/pygments-main/pygments/lexer.py +765 -0
  78. data/vendor/pygments-main/pygments/lexers/__init__.py +240 -0
  79. data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1645 -0
  80. data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +232 -0
  81. data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +5172 -0
  82. data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +249 -0
  83. data/vendor/pygments-main/pygments/lexers/_mapping.py +355 -0
  84. data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +562 -0
  85. data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +3787 -0
  86. data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +233 -0
  87. data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +557 -0
  88. data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +40 -0
  89. data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +1072 -0
  90. data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +360 -0
  91. data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +13 -0
  92. data/vendor/pygments-main/pygments/lexers/agile.py +2290 -0
  93. data/vendor/pygments-main/pygments/lexers/asm.py +398 -0
  94. data/vendor/pygments-main/pygments/lexers/compiled.py +3723 -0
  95. data/vendor/pygments-main/pygments/lexers/dalvik.py +104 -0
  96. data/vendor/pygments-main/pygments/lexers/dotnet.py +671 -0
  97. data/vendor/pygments-main/pygments/lexers/foxpro.py +428 -0
  98. data/vendor/pygments-main/pygments/lexers/functional.py +2731 -0
  99. data/vendor/pygments-main/pygments/lexers/github.py +565 -0
  100. data/vendor/pygments-main/pygments/lexers/hdl.py +356 -0
  101. data/vendor/pygments-main/pygments/lexers/jvm.py +1112 -0
  102. data/vendor/pygments-main/pygments/lexers/math.py +1918 -0
  103. data/vendor/pygments-main/pygments/lexers/other.py +3778 -0
  104. data/vendor/pygments-main/pygments/lexers/parsers.py +778 -0
  105. data/vendor/pygments-main/pygments/lexers/shell.py +424 -0
  106. data/vendor/pygments-main/pygments/lexers/special.py +100 -0
  107. data/vendor/pygments-main/pygments/lexers/sql.py +609 -0
  108. data/vendor/pygments-main/pygments/lexers/templates.py +1742 -0
  109. data/vendor/pygments-main/pygments/lexers/text.py +1893 -0
  110. data/vendor/pygments-main/pygments/lexers/web.py +4045 -0
  111. data/vendor/pygments-main/pygments/modeline.py +40 -0
  112. data/vendor/pygments-main/pygments/plugin.py +74 -0
  113. data/vendor/pygments-main/pygments/scanner.py +104 -0
  114. data/vendor/pygments-main/pygments/style.py +117 -0
  115. data/vendor/pygments-main/pygments/styles/__init__.py +70 -0
  116. data/vendor/pygments-main/pygments/styles/autumn.py +65 -0
  117. data/vendor/pygments-main/pygments/styles/borland.py +51 -0
  118. data/vendor/pygments-main/pygments/styles/bw.py +49 -0
  119. data/vendor/pygments-main/pygments/styles/colorful.py +81 -0
  120. data/vendor/pygments-main/pygments/styles/default.py +73 -0
  121. data/vendor/pygments-main/pygments/styles/emacs.py +72 -0
  122. data/vendor/pygments-main/pygments/styles/friendly.py +72 -0
  123. data/vendor/pygments-main/pygments/styles/fruity.py +42 -0
  124. data/vendor/pygments-main/pygments/styles/manni.py +75 -0
  125. data/vendor/pygments-main/pygments/styles/monokai.py +106 -0
  126. data/vendor/pygments-main/pygments/styles/murphy.py +80 -0
  127. data/vendor/pygments-main/pygments/styles/native.py +65 -0
  128. data/vendor/pygments-main/pygments/styles/pastie.py +75 -0
  129. data/vendor/pygments-main/pygments/styles/perldoc.py +69 -0
  130. data/vendor/pygments-main/pygments/styles/rrt.py +33 -0
  131. data/vendor/pygments-main/pygments/styles/tango.py +141 -0
  132. data/vendor/pygments-main/pygments/styles/trac.py +63 -0
  133. data/vendor/pygments-main/pygments/styles/vim.py +63 -0
  134. data/vendor/pygments-main/pygments/styles/vs.py +38 -0
  135. data/vendor/pygments-main/pygments/token.py +195 -0
  136. data/vendor/pygments-main/pygments/unistring.py +140 -0
  137. data/vendor/pygments-main/pygments/util.py +277 -0
  138. data/vendor/pygments-main/scripts/check_sources.py +242 -0
  139. data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +32 -0
  140. data/vendor/pygments-main/scripts/epydoc.css +280 -0
  141. data/vendor/pygments-main/scripts/find_codetags.py +205 -0
  142. data/vendor/pygments-main/scripts/find_error.py +170 -0
  143. data/vendor/pygments-main/scripts/get_vimkw.py +43 -0
  144. data/vendor/pygments-main/scripts/pylintrc +301 -0
  145. data/vendor/pygments-main/scripts/reindent.py +291 -0
  146. data/vendor/pygments-main/scripts/vim2pygments.py +933 -0
  147. data/vendor/pygments-main/setup.cfg +7 -0
  148. data/vendor/pygments-main/setup.py +90 -0
  149. data/vendor/pygments-main/tests/dtds/HTML4-f.dtd +37 -0
  150. data/vendor/pygments-main/tests/dtds/HTML4-s.dtd +869 -0
  151. data/vendor/pygments-main/tests/dtds/HTML4.dcl +88 -0
  152. data/vendor/pygments-main/tests/dtds/HTML4.dtd +1092 -0
  153. data/vendor/pygments-main/tests/dtds/HTML4.soc +9 -0
  154. data/vendor/pygments-main/tests/dtds/HTMLlat1.ent +195 -0
  155. data/vendor/pygments-main/tests/dtds/HTMLspec.ent +77 -0
  156. data/vendor/pygments-main/tests/dtds/HTMLsym.ent +241 -0
  157. data/vendor/pygments-main/tests/examplefiles/ANTLRv3.g +608 -0
  158. data/vendor/pygments-main/tests/examplefiles/AcidStateAdvanced.hs +209 -0
  159. data/vendor/pygments-main/tests/examplefiles/AlternatingGroup.mu +102 -0
  160. data/vendor/pygments-main/tests/examplefiles/BOM.js +1 -0
  161. data/vendor/pygments-main/tests/examplefiles/CPDictionary.j +611 -0
  162. data/vendor/pygments-main/tests/examplefiles/Config.in.cache +1973 -0
  163. data/vendor/pygments-main/tests/examplefiles/Constants.mo +158 -0
  164. data/vendor/pygments-main/tests/examplefiles/DancingSudoku.lhs +411 -0
  165. data/vendor/pygments-main/tests/examplefiles/Deflate.fs +578 -0
  166. data/vendor/pygments-main/tests/examplefiles/Errors.scala +18 -0
  167. data/vendor/pygments-main/tests/examplefiles/File.hy +174 -0
  168. data/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1 +66 -0
  169. data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +104 -0
  170. data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +671 -0
  171. data/vendor/pygments-main/tests/examplefiles/Intro.java +1660 -0
  172. data/vendor/pygments-main/tests/examplefiles/Makefile +1131 -0
  173. data/vendor/pygments-main/tests/examplefiles/Object.st +4394 -0
  174. data/vendor/pygments-main/tests/examplefiles/OrderedMap.hx +584 -0
  175. data/vendor/pygments-main/tests/examplefiles/RoleQ.pm6 +23 -0
  176. data/vendor/pygments-main/tests/examplefiles/SmallCheck.hs +378 -0
  177. data/vendor/pygments-main/tests/examplefiles/Sorting.mod +470 -0
  178. data/vendor/pygments-main/tests/examplefiles/Sudoku.lhs +382 -0
  179. data/vendor/pygments-main/tests/examplefiles/addressbook.proto +30 -0
  180. data/vendor/pygments-main/tests/examplefiles/antlr_throws +1 -0
  181. data/vendor/pygments-main/tests/examplefiles/apache2.conf +393 -0
  182. data/vendor/pygments-main/tests/examplefiles/as3_test.as +143 -0
  183. data/vendor/pygments-main/tests/examplefiles/as3_test2.as +46 -0
  184. data/vendor/pygments-main/tests/examplefiles/as3_test3.as +3 -0
  185. data/vendor/pygments-main/tests/examplefiles/aspx-cs_example +27 -0
  186. data/vendor/pygments-main/tests/examplefiles/autoit_submit.au3 +25 -0
  187. data/vendor/pygments-main/tests/examplefiles/badcase.java +2 -0
  188. data/vendor/pygments-main/tests/examplefiles/batchfile.bat +49 -0
  189. data/vendor/pygments-main/tests/examplefiles/bigtest.nsi +308 -0
  190. data/vendor/pygments-main/tests/examplefiles/boot-9.scm +1557 -0
  191. data/vendor/pygments-main/tests/examplefiles/ca65_example +284 -0
  192. data/vendor/pygments-main/tests/examplefiles/cbmbas_example +9 -0
  193. data/vendor/pygments-main/tests/examplefiles/cells.ps +515 -0
  194. data/vendor/pygments-main/tests/examplefiles/ceval.c +2604 -0
  195. data/vendor/pygments-main/tests/examplefiles/cheetah_example.html +13 -0
  196. data/vendor/pygments-main/tests/examplefiles/classes.dylan +125 -0
  197. data/vendor/pygments-main/tests/examplefiles/condensed_ruby.rb +10 -0
  198. data/vendor/pygments-main/tests/examplefiles/coq_RelationClasses +447 -0
  199. data/vendor/pygments-main/tests/examplefiles/database.pytb +20 -0
  200. data/vendor/pygments-main/tests/examplefiles/de.MoinMoin.po +2461 -0
  201. data/vendor/pygments-main/tests/examplefiles/demo.ahk +181 -0
  202. data/vendor/pygments-main/tests/examplefiles/demo.cfm +38 -0
  203. data/vendor/pygments-main/tests/examplefiles/django_sample.html+django +68 -0
  204. data/vendor/pygments-main/tests/examplefiles/dwarf.cw +17 -0
  205. data/vendor/pygments-main/tests/examplefiles/erl_session +10 -0
  206. data/vendor/pygments-main/tests/examplefiles/escape_semicolon.clj +1 -0
  207. data/vendor/pygments-main/tests/examplefiles/evil_regex.js +48 -0
  208. data/vendor/pygments-main/tests/examplefiles/example.Rd +78 -0
  209. data/vendor/pygments-main/tests/examplefiles/example.bug +54 -0
  210. data/vendor/pygments-main/tests/examplefiles/example.c +2080 -0
  211. data/vendor/pygments-main/tests/examplefiles/example.ceylon +52 -0
  212. data/vendor/pygments-main/tests/examplefiles/example.clay +33 -0
  213. data/vendor/pygments-main/tests/examplefiles/example.cls +15 -0
  214. data/vendor/pygments-main/tests/examplefiles/example.cob +3556 -0
  215. data/vendor/pygments-main/tests/examplefiles/example.cpp +2363 -0
  216. data/vendor/pygments-main/tests/examplefiles/example.gs +106 -0
  217. data/vendor/pygments-main/tests/examplefiles/example.gst +7 -0
  218. data/vendor/pygments-main/tests/examplefiles/example.hx +142 -0
  219. data/vendor/pygments-main/tests/examplefiles/example.jag +48 -0
  220. data/vendor/pygments-main/tests/examplefiles/example.kt +47 -0
  221. data/vendor/pygments-main/tests/examplefiles/example.lagda +19 -0
  222. data/vendor/pygments-main/tests/examplefiles/example.lua +250 -0
  223. data/vendor/pygments-main/tests/examplefiles/example.monkey +152 -0
  224. data/vendor/pygments-main/tests/examplefiles/example.moo +26 -0
  225. data/vendor/pygments-main/tests/examplefiles/example.moon +629 -0
  226. data/vendor/pygments-main/tests/examplefiles/example.msc +43 -0
  227. data/vendor/pygments-main/tests/examplefiles/example.nim +1010 -0
  228. data/vendor/pygments-main/tests/examplefiles/example.ns2 +69 -0
  229. data/vendor/pygments-main/tests/examplefiles/example.p +34 -0
  230. data/vendor/pygments-main/tests/examplefiles/example.pas +2708 -0
  231. data/vendor/pygments-main/tests/examplefiles/example.prg +161 -0
  232. data/vendor/pygments-main/tests/examplefiles/example.rb +1852 -0
  233. data/vendor/pygments-main/tests/examplefiles/example.reg +19 -0
  234. data/vendor/pygments-main/tests/examplefiles/example.rexx +50 -0
  235. data/vendor/pygments-main/tests/examplefiles/example.rhtml +561 -0
  236. data/vendor/pygments-main/tests/examplefiles/example.rkt +95 -0
  237. data/vendor/pygments-main/tests/examplefiles/example.rpf +4 -0
  238. data/vendor/pygments-main/tests/examplefiles/example.sh-session +19 -0
  239. data/vendor/pygments-main/tests/examplefiles/example.shell-session +45 -0
  240. data/vendor/pygments-main/tests/examplefiles/example.sml +156 -0
  241. data/vendor/pygments-main/tests/examplefiles/example.snobol +15 -0
  242. data/vendor/pygments-main/tests/examplefiles/example.stan +108 -0
  243. data/vendor/pygments-main/tests/examplefiles/example.tea +34 -0
  244. data/vendor/pygments-main/tests/examplefiles/example.ts +28 -0
  245. data/vendor/pygments-main/tests/examplefiles/example.u +548 -0
  246. data/vendor/pygments-main/tests/examplefiles/example.weechatlog +9 -0
  247. data/vendor/pygments-main/tests/examplefiles/example.xhtml +376 -0
  248. data/vendor/pygments-main/tests/examplefiles/example.xtend +34 -0
  249. data/vendor/pygments-main/tests/examplefiles/example.yaml +302 -0
  250. data/vendor/pygments-main/tests/examplefiles/example2.aspx +29 -0
  251. data/vendor/pygments-main/tests/examplefiles/example2.msc +79 -0
  252. data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +363 -0
  253. data/vendor/pygments-main/tests/examplefiles/example_file.fy +128 -0
  254. data/vendor/pygments-main/tests/examplefiles/firefox.mak +586 -0
  255. data/vendor/pygments-main/tests/examplefiles/flipflop.sv +19 -0
  256. data/vendor/pygments-main/tests/examplefiles/foo.sce +6 -0
  257. data/vendor/pygments-main/tests/examplefiles/format.ml +1213 -0
  258. data/vendor/pygments-main/tests/examplefiles/fucked_up.rb +77 -0
  259. data/vendor/pygments-main/tests/examplefiles/function.mu +1 -0
  260. data/vendor/pygments-main/tests/examplefiles/functional.rst +1472 -0
  261. data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +133 -0
  262. data/vendor/pygments-main/tests/examplefiles/genclass.clj +510 -0
  263. data/vendor/pygments-main/tests/examplefiles/genshi_example.xml+genshi +193 -0
  264. data/vendor/pygments-main/tests/examplefiles/genshitext_example.genshitext +33 -0
  265. data/vendor/pygments-main/tests/examplefiles/glsl.frag +7 -0
  266. data/vendor/pygments-main/tests/examplefiles/glsl.vert +13 -0
  267. data/vendor/pygments-main/tests/examplefiles/grammar-test.p6 +22 -0
  268. data/vendor/pygments-main/tests/examplefiles/hello.smali +40 -0
  269. data/vendor/pygments-main/tests/examplefiles/hello.sp +9 -0
  270. data/vendor/pygments-main/tests/examplefiles/html+php_faulty.php +1 -0
  271. data/vendor/pygments-main/tests/examplefiles/http_request_example +15 -0
  272. data/vendor/pygments-main/tests/examplefiles/http_response_example +29 -0
  273. data/vendor/pygments-main/tests/examplefiles/import.hs +4 -0
  274. data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +71 -0
  275. data/vendor/pygments-main/tests/examplefiles/intro.ik +24 -0
  276. data/vendor/pygments-main/tests/examplefiles/ints.php +10 -0
  277. data/vendor/pygments-main/tests/examplefiles/intsyn.fun +675 -0
  278. data/vendor/pygments-main/tests/examplefiles/intsyn.sig +286 -0
  279. data/vendor/pygments-main/tests/examplefiles/irb_heredoc +8 -0
  280. data/vendor/pygments-main/tests/examplefiles/irc.lsp +214 -0
  281. data/vendor/pygments-main/tests/examplefiles/java.properties +16 -0
  282. data/vendor/pygments-main/tests/examplefiles/jbst_example1.jbst +28 -0
  283. data/vendor/pygments-main/tests/examplefiles/jbst_example2.jbst +45 -0
  284. data/vendor/pygments-main/tests/examplefiles/jinjadesignerdoc.rst +713 -0
  285. data/vendor/pygments-main/tests/examplefiles/json.lasso +301 -0
  286. data/vendor/pygments-main/tests/examplefiles/json.lasso9 +213 -0
  287. data/vendor/pygments-main/tests/examplefiles/lighttpd_config.conf +13 -0
  288. data/vendor/pygments-main/tests/examplefiles/linecontinuation.py +47 -0
  289. data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +41 -0
  290. data/vendor/pygments-main/tests/examplefiles/logos_example.xm +28 -0
  291. data/vendor/pygments-main/tests/examplefiles/ltmain.sh +2849 -0
  292. data/vendor/pygments-main/tests/examplefiles/main.cmake +42 -0
  293. data/vendor/pygments-main/tests/examplefiles/markdown.lsp +679 -0
  294. data/vendor/pygments-main/tests/examplefiles/matlab_noreturn +3 -0
  295. data/vendor/pygments-main/tests/examplefiles/matlab_sample +30 -0
  296. data/vendor/pygments-main/tests/examplefiles/matlabsession_sample.txt +37 -0
  297. data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +455 -0
  298. data/vendor/pygments-main/tests/examplefiles/mg_sample.pro +73 -0
  299. data/vendor/pygments-main/tests/examplefiles/minehunt.qml +112 -0
  300. data/vendor/pygments-main/tests/examplefiles/minimal.ns2 +4 -0
  301. data/vendor/pygments-main/tests/examplefiles/moin_SyntaxReference.txt +340 -0
  302. data/vendor/pygments-main/tests/examplefiles/multiline_regexes.rb +38 -0
  303. data/vendor/pygments-main/tests/examplefiles/nanomsg.intr +95 -0
  304. data/vendor/pygments-main/tests/examplefiles/nasm_aoutso.asm +96 -0
  305. data/vendor/pygments-main/tests/examplefiles/nasm_objexe.asm +30 -0
  306. data/vendor/pygments-main/tests/examplefiles/nemerle_sample.n +87 -0
  307. data/vendor/pygments-main/tests/examplefiles/nginx_nginx.conf +118 -0
  308. data/vendor/pygments-main/tests/examplefiles/numbers.c +12 -0
  309. data/vendor/pygments-main/tests/examplefiles/objc_example.m +32 -0
  310. data/vendor/pygments-main/tests/examplefiles/objc_example2.m +24 -0
  311. data/vendor/pygments-main/tests/examplefiles/perl_misc +62 -0
  312. data/vendor/pygments-main/tests/examplefiles/perl_perl5db +998 -0
  313. data/vendor/pygments-main/tests/examplefiles/perl_regex-delims +120 -0
  314. data/vendor/pygments-main/tests/examplefiles/perlfunc.1 +856 -0
  315. data/vendor/pygments-main/tests/examplefiles/phpMyAdmin.spec +163 -0
  316. data/vendor/pygments-main/tests/examplefiles/phpcomplete.vim +567 -0
  317. data/vendor/pygments-main/tests/examplefiles/pleac.in.rb +1223 -0
  318. data/vendor/pygments-main/tests/examplefiles/postgresql_test.txt +47 -0
  319. data/vendor/pygments-main/tests/examplefiles/pppoe.applescript +10 -0
  320. data/vendor/pygments-main/tests/examplefiles/psql_session.txt +122 -0
  321. data/vendor/pygments-main/tests/examplefiles/py3_test.txt +2 -0
  322. data/vendor/pygments-main/tests/examplefiles/py3tb_test.py3tb +4 -0
  323. data/vendor/pygments-main/tests/examplefiles/pycon_test.pycon +14 -0
  324. data/vendor/pygments-main/tests/examplefiles/pytb_test2.pytb +2 -0
  325. data/vendor/pygments-main/tests/examplefiles/pytb_test3.pytb +4 -0
  326. data/vendor/pygments-main/tests/examplefiles/python25-bsd.mak +234 -0
  327. data/vendor/pygments-main/tests/examplefiles/qsort.prolog +13 -0
  328. data/vendor/pygments-main/tests/examplefiles/r-console-transcript.Rout +38 -0
  329. data/vendor/pygments-main/tests/examplefiles/ragel-cpp_rlscan +280 -0
  330. data/vendor/pygments-main/tests/examplefiles/ragel-cpp_snippet +2 -0
  331. data/vendor/pygments-main/tests/examplefiles/regex.js +22 -0
  332. data/vendor/pygments-main/tests/examplefiles/reversi.lsp +427 -0
  333. data/vendor/pygments-main/tests/examplefiles/robotframework.txt +39 -0
  334. data/vendor/pygments-main/tests/examplefiles/ruby_func_def.rb +11 -0
  335. data/vendor/pygments-main/tests/examplefiles/rust_example.rs +233 -0
  336. data/vendor/pygments-main/tests/examplefiles/scilab.sci +30 -0
  337. data/vendor/pygments-main/tests/examplefiles/session.dylan-console +9 -0
  338. data/vendor/pygments-main/tests/examplefiles/sibling.prolog +19 -0
  339. data/vendor/pygments-main/tests/examplefiles/simple.md +747 -0
  340. data/vendor/pygments-main/tests/examplefiles/smarty_example.html +209 -0
  341. data/vendor/pygments-main/tests/examplefiles/source.lgt +343 -0
  342. data/vendor/pygments-main/tests/examplefiles/sources.list +62 -0
  343. data/vendor/pygments-main/tests/examplefiles/sphere.pov +18 -0
  344. data/vendor/pygments-main/tests/examplefiles/sqlite3.sqlite3-console +27 -0
  345. data/vendor/pygments-main/tests/examplefiles/squid.conf +30 -0
  346. data/vendor/pygments-main/tests/examplefiles/string.jl +1031 -0
  347. data/vendor/pygments-main/tests/examplefiles/string_delimiters.d +21 -0
  348. data/vendor/pygments-main/tests/examplefiles/stripheredoc.sh +3 -0
  349. data/vendor/pygments-main/tests/examplefiles/swig_java.swg +1329 -0
  350. data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +225 -0
  351. data/vendor/pygments-main/tests/examplefiles/test.R +153 -0
  352. data/vendor/pygments-main/tests/examplefiles/test.adb +211 -0
  353. data/vendor/pygments-main/tests/examplefiles/test.agda +102 -0
  354. data/vendor/pygments-main/tests/examplefiles/test.asy +131 -0
  355. data/vendor/pygments-main/tests/examplefiles/test.awk +121 -0
  356. data/vendor/pygments-main/tests/examplefiles/test.bas +29 -0
  357. data/vendor/pygments-main/tests/examplefiles/test.bb +95 -0
  358. data/vendor/pygments-main/tests/examplefiles/test.bmx +145 -0
  359. data/vendor/pygments-main/tests/examplefiles/test.boo +39 -0
  360. data/vendor/pygments-main/tests/examplefiles/test.bro +250 -0
  361. data/vendor/pygments-main/tests/examplefiles/test.cs +374 -0
  362. data/vendor/pygments-main/tests/examplefiles/test.css +54 -0
  363. data/vendor/pygments-main/tests/examplefiles/test.cu +36 -0
  364. data/vendor/pygments-main/tests/examplefiles/test.d +135 -0
  365. data/vendor/pygments-main/tests/examplefiles/test.dart +23 -0
  366. data/vendor/pygments-main/tests/examplefiles/test.dtd +89 -0
  367. data/vendor/pygments-main/tests/examplefiles/test.ebnf +31 -0
  368. data/vendor/pygments-main/tests/examplefiles/test.ec +605 -0
  369. data/vendor/pygments-main/tests/examplefiles/test.ecl +58 -0
  370. data/vendor/pygments-main/tests/examplefiles/test.eh +315 -0
  371. data/vendor/pygments-main/tests/examplefiles/test.erl +169 -0
  372. data/vendor/pygments-main/tests/examplefiles/test.evoque +33 -0
  373. data/vendor/pygments-main/tests/examplefiles/test.fan +818 -0
  374. data/vendor/pygments-main/tests/examplefiles/test.flx +57 -0
  375. data/vendor/pygments-main/tests/examplefiles/test.gdc +13 -0
  376. data/vendor/pygments-main/tests/examplefiles/test.groovy +97 -0
  377. data/vendor/pygments-main/tests/examplefiles/test.html +339 -0
  378. data/vendor/pygments-main/tests/examplefiles/test.ini +10 -0
  379. data/vendor/pygments-main/tests/examplefiles/test.java +653 -0
  380. data/vendor/pygments-main/tests/examplefiles/test.jsp +24 -0
  381. data/vendor/pygments-main/tests/examplefiles/test.maql +45 -0
  382. data/vendor/pygments-main/tests/examplefiles/test.mod +374 -0
  383. data/vendor/pygments-main/tests/examplefiles/test.moo +51 -0
  384. data/vendor/pygments-main/tests/examplefiles/test.myt +166 -0
  385. data/vendor/pygments-main/tests/examplefiles/test.nim +93 -0
  386. data/vendor/pygments-main/tests/examplefiles/test.opa +10 -0
  387. data/vendor/pygments-main/tests/examplefiles/test.p6 +252 -0
  388. data/vendor/pygments-main/tests/examplefiles/test.pas +743 -0
  389. data/vendor/pygments-main/tests/examplefiles/test.php +505 -0
  390. data/vendor/pygments-main/tests/examplefiles/test.plot +333 -0
  391. data/vendor/pygments-main/tests/examplefiles/test.ps1 +108 -0
  392. data/vendor/pygments-main/tests/examplefiles/test.pypylog +1839 -0
  393. data/vendor/pygments-main/tests/examplefiles/test.r3 +94 -0
  394. data/vendor/pygments-main/tests/examplefiles/test.rb +177 -0
  395. data/vendor/pygments-main/tests/examplefiles/test.rhtml +43 -0
  396. data/vendor/pygments-main/tests/examplefiles/test.scaml +8 -0
  397. data/vendor/pygments-main/tests/examplefiles/test.ssp +12 -0
  398. data/vendor/pygments-main/tests/examplefiles/test.tcsh +830 -0
  399. data/vendor/pygments-main/tests/examplefiles/test.vb +407 -0
  400. data/vendor/pygments-main/tests/examplefiles/test.vhdl +161 -0
  401. data/vendor/pygments-main/tests/examplefiles/test.xqy +138 -0
  402. data/vendor/pygments-main/tests/examplefiles/test.xsl +23 -0
  403. data/vendor/pygments-main/tests/examplefiles/test2.pypylog +120 -0
  404. data/vendor/pygments-main/tests/examplefiles/truncated.pytb +15 -0
  405. data/vendor/pygments-main/tests/examplefiles/type.lisp +1218 -0
  406. data/vendor/pygments-main/tests/examplefiles/underscore.coffee +603 -0
  407. data/vendor/pygments-main/tests/examplefiles/unicode.applescript +5 -0
  408. data/vendor/pygments-main/tests/examplefiles/unicodedoc.py +11 -0
  409. data/vendor/pygments-main/tests/examplefiles/unix-io.lid +37 -0
  410. data/vendor/pygments-main/tests/examplefiles/webkit-transition.css +3 -0
  411. data/vendor/pygments-main/tests/examplefiles/while.pov +13 -0
  412. data/vendor/pygments-main/tests/examplefiles/wiki.factor +384 -0
  413. data/vendor/pygments-main/tests/examplefiles/xml_example +1897 -0
  414. data/vendor/pygments-main/tests/examplefiles/zmlrpc.f90 +798 -0
  415. data/vendor/pygments-main/tests/old_run.py +138 -0
  416. data/vendor/pygments-main/tests/run.py +49 -0
  417. data/vendor/pygments-main/tests/support/tags +36 -0
  418. data/vendor/pygments-main/tests/support.py +15 -0
  419. data/vendor/pygments-main/tests/test_basic_api.py +295 -0
  420. data/vendor/pygments-main/tests/test_clexer.py +31 -0
  421. data/vendor/pygments-main/tests/test_cmdline.py +105 -0
  422. data/vendor/pygments-main/tests/test_examplefiles.py +99 -0
  423. data/vendor/pygments-main/tests/test_html_formatter.py +178 -0
  424. data/vendor/pygments-main/tests/test_latex_formatter.py +55 -0
  425. data/vendor/pygments-main/tests/test_lexers_other.py +68 -0
  426. data/vendor/pygments-main/tests/test_perllexer.py +137 -0
  427. data/vendor/pygments-main/tests/test_regexlexer.py +47 -0
  428. data/vendor/pygments-main/tests/test_token.py +46 -0
  429. data/vendor/pygments-main/tests/test_using_api.py +40 -0
  430. data/vendor/pygments-main/tests/test_util.py +135 -0
  431. data/vendor/simplejson/.gitignore +10 -0
  432. data/vendor/simplejson/.travis.yml +5 -0
  433. data/vendor/simplejson/CHANGES.txt +291 -0
  434. data/vendor/simplejson/LICENSE.txt +19 -0
  435. data/vendor/simplejson/MANIFEST.in +5 -0
  436. data/vendor/simplejson/README.rst +19 -0
  437. data/vendor/simplejson/conf.py +179 -0
  438. data/vendor/simplejson/index.rst +628 -0
  439. data/vendor/simplejson/scripts/make_docs.py +18 -0
  440. data/vendor/simplejson/setup.py +104 -0
  441. data/vendor/simplejson/simplejson/__init__.py +510 -0
  442. data/vendor/simplejson/simplejson/_speedups.c +2745 -0
  443. data/vendor/simplejson/simplejson/decoder.py +425 -0
  444. data/vendor/simplejson/simplejson/encoder.py +567 -0
  445. data/vendor/simplejson/simplejson/ordered_dict.py +119 -0
  446. data/vendor/simplejson/simplejson/scanner.py +77 -0
  447. data/vendor/simplejson/simplejson/tests/__init__.py +67 -0
  448. data/vendor/simplejson/simplejson/tests/test_bigint_as_string.py +55 -0
  449. data/vendor/simplejson/simplejson/tests/test_check_circular.py +30 -0
  450. data/vendor/simplejson/simplejson/tests/test_decimal.py +66 -0
  451. data/vendor/simplejson/simplejson/tests/test_decode.py +83 -0
  452. data/vendor/simplejson/simplejson/tests/test_default.py +9 -0
  453. data/vendor/simplejson/simplejson/tests/test_dump.py +67 -0
  454. data/vendor/simplejson/simplejson/tests/test_encode_basestring_ascii.py +46 -0
  455. data/vendor/simplejson/simplejson/tests/test_encode_for_html.py +32 -0
  456. data/vendor/simplejson/simplejson/tests/test_errors.py +34 -0
  457. data/vendor/simplejson/simplejson/tests/test_fail.py +91 -0
  458. data/vendor/simplejson/simplejson/tests/test_float.py +19 -0
  459. data/vendor/simplejson/simplejson/tests/test_indent.py +86 -0
  460. data/vendor/simplejson/simplejson/tests/test_item_sort_key.py +20 -0
  461. data/vendor/simplejson/simplejson/tests/test_namedtuple.py +121 -0
  462. data/vendor/simplejson/simplejson/tests/test_pass1.py +76 -0
  463. data/vendor/simplejson/simplejson/tests/test_pass2.py +14 -0
  464. data/vendor/simplejson/simplejson/tests/test_pass3.py +20 -0
  465. data/vendor/simplejson/simplejson/tests/test_recursion.py +67 -0
  466. data/vendor/simplejson/simplejson/tests/test_scanstring.py +117 -0
  467. data/vendor/simplejson/simplejson/tests/test_separators.py +42 -0
  468. data/vendor/simplejson/simplejson/tests/test_speedups.py +20 -0
  469. data/vendor/simplejson/simplejson/tests/test_tuple.py +49 -0
  470. data/vendor/simplejson/simplejson/tests/test_unicode.py +109 -0
  471. data/vendor/simplejson/simplejson/tool.py +39 -0
  472. metadata +566 -0
@@ -0,0 +1,675 @@
1
+ (* Internal Syntax *)
2
+ (* Author: Frank Pfenning, Carsten Schuermann *)
3
+ (* Modified: Roberto Virga *)
4
+
5
+ functor IntSyn (structure Global : GLOBAL) :> INTSYN =
6
+ struct
7
+
8
+ type cid = int (* Constant identifier *)
9
+ type name = string (* Variable name *)
10
+ type mid = int (* Structure identifier *)
11
+ type csid = int (* CS module identifier *)
12
+
13
+
14
+ (* Contexts *)
15
+ datatype 'a Ctx = (* Contexts *)
16
+ Null (* G ::= . *)
17
+ | Decl of 'a Ctx * 'a (* | G, D *)
18
+
19
+ (* ctxPop (G) => G'
20
+ Invariant: G = G',D
21
+ *)
22
+ fun ctxPop (Decl (G, D)) = G
23
+
24
+ exception Error of string (* raised if out of space *)
25
+ (* ctxLookup (G, k) = D, kth declaration in G from right to left
26
+ Invariant: 1 <= k <= |G|, where |G| is length of G
27
+ *)
28
+
29
+ fun ctxLookup (Decl (G', D), 1) = D
30
+ | ctxLookup (Decl (G', _), k') = ctxLookup (G', k'-1)
31
+ (* | ctxLookup (Null, k') = (print ("Looking up k' = " ^ Int.toString k' ^ "\n"); raise Error "Out of Bounce\n")*)
32
+ (* ctxLookup (Null, k') should not occur by invariant *)
33
+
34
+ (* ctxLength G = |G|, the number of declarations in G *)
35
+ fun ctxLength G =
36
+ let
37
+ fun ctxLength' (Null, n) = n
38
+ | ctxLength' (Decl(G, _), n)= ctxLength' (G, n+1)
39
+ in
40
+ ctxLength' (G, 0)
41
+ end
42
+
43
+ type FgnExp = exn (* foreign expression representation *)
44
+ exception UnexpectedFgnExp of FgnExp
45
+ (* raised by a constraint solver
46
+ if passed an incorrect arg *)
47
+
48
+ type FgnCnstr = exn (* foreign unification constraint
49
+ representation *)
50
+ exception UnexpectedFgnCnstr of FgnCnstr
51
+ (* raised by a constraint solver
52
+ if passed an incorrect arg *)
53
+
54
+ datatype Depend = (* Dependency information *)
55
+ No (* P ::= No *)
56
+ | Maybe (* | Maybe *)
57
+ | Meta (* | Meta *)
58
+
59
+ (* Expressions *)
60
+
61
+ datatype Uni = (* Universes: *)
62
+ Kind (* L ::= Kind *)
63
+ | Type (* | Type *)
64
+
65
+ datatype Exp = (* Expressions: *)
66
+ Uni of Uni (* U ::= L *)
67
+ | Pi of (Dec * Depend) * Exp (* | bPi (D, P). V *)
68
+ | Root of Head * Spine (* | C @ S *)
69
+ | Redex of Exp * Spine (* | U @ S *)
70
+ | Lam of Dec * Exp (* | lam D. U *)
71
+ | EVar of Exp option ref * Dec Ctx * Exp * (Cnstr ref) list ref
72
+ (* | X<I> : G|-V, Cnstr *)
73
+
74
+ | EClo of Exp * Sub (* | U[s] *)
75
+ | AVar of Exp option ref (* | A<I> *)
76
+ | NVar of int (* | n (linear, fully applied) *)
77
+ (* grafting variable *)
78
+
79
+ | FgnExp of csid * FgnExp
80
+ (* | (foreign expression) *)
81
+
82
+ and Head = (* Heads: *)
83
+ BVar of int (* H ::= k *)
84
+ | Const of cid (* | c *)
85
+ | Proj of Block * int (* | #k(b) *)
86
+ | Skonst of cid (* | c# *)
87
+ | Def of cid (* | d *)
88
+ | NSDef of cid (* | d (non strict) *)
89
+ | FVar of name * Exp * Sub (* | F[s] *)
90
+ | FgnConst of csid * ConDec (* | (foreign constant) *)
91
+
92
+ and Spine = (* Spines: *)
93
+ Nil (* S ::= Nil *)
94
+ | App of Exp * Spine (* | U ; S *)
95
+ | SClo of Spine * Sub (* | S[s] *)
96
+
97
+ and Sub = (* Explicit substitutions: *)
98
+ Shift of int (* s ::= ^n *)
99
+ | Dot of Front * Sub (* | Ft.s *)
100
+
101
+ and Front = (* Fronts: *)
102
+ Idx of int (* Ft ::= k *)
103
+ | Exp of Exp (* | U *)
104
+ | Axp of Exp (* | U (assignable) *)
105
+ | Block of Block (* | _x *)
106
+ | Undef (* | _ *)
107
+
108
+ and Dec = (* Declarations: *)
109
+ Dec of name option * Exp (* D ::= x:V *)
110
+ | BDec of name option * (cid * Sub) (* | v:l[s] *)
111
+ | ADec of name option * int (* | v[^-d] *)
112
+ | NDec of name option
113
+
114
+ and Block = (* Blocks: *)
115
+ Bidx of int (* b ::= v *)
116
+ | LVar of Block option ref * Sub * (cid * Sub)
117
+ (* | L(l[^k],t) *)
118
+ | Inst of Exp list (* | u1, ..., Un *)
119
+
120
+
121
+ (* Constraints *)
122
+
123
+ and Cnstr = (* Constraint: *)
124
+ Solved (* Cnstr ::= solved *)
125
+ | Eqn of Dec Ctx * Exp * Exp (* | G|-(U1 == U2) *)
126
+ | FgnCnstr of csid * FgnCnstr (* | (foreign) *)
127
+
128
+ and Status = (* Status of a constant: *)
129
+ Normal (* inert *)
130
+ | Constraint of csid * (Dec Ctx * Spine * int -> Exp option)
131
+ (* acts as constraint *)
132
+ | Foreign of csid * (Spine -> Exp) (* is converted to foreign *)
133
+
134
+ and FgnUnify = (* Result of foreign unify *)
135
+ Succeed of FgnUnifyResidual list
136
+ (* succeed with a list of residual operations *)
137
+ | Fail
138
+
139
+ and FgnUnifyResidual = (* Residual of foreign unify *)
140
+ Assign of Dec Ctx * Exp * Exp * Sub
141
+ (* perform the assignment G |- X = U [ss] *)
142
+ | Delay of Exp * Cnstr ref
143
+ (* delay cnstr, associating it with all the rigid EVars in U *)
144
+
145
+ (* Global signature *)
146
+
147
+ and ConDec = (* Constant declaration *)
148
+ ConDec of string * mid option * int * Status
149
+ (* a : K : kind or *)
150
+ * Exp * Uni (* c : A : type *)
151
+ | ConDef of string * mid option * int (* a = A : K : kind or *)
152
+ * Exp * Exp * Uni (* d = M : A : type *)
153
+ * Ancestor (* Ancestor info for d or a *)
154
+ | AbbrevDef of string * mid option * int
155
+ (* a = A : K : kind or *)
156
+ * Exp * Exp * Uni (* d = M : A : type *)
157
+ | BlockDec of string * mid option (* %block l : SOME G1 PI G2 *)
158
+ * Dec Ctx * Dec list
159
+
160
+ | BlockDef of string * mid option * cid list
161
+ (* %block l = (l1 | ... | ln) *)
162
+
163
+ | SkoDec of string * mid option * int (* sa: K : kind or *)
164
+ * Exp * Uni (* sc: A : type *)
165
+
166
+ and Ancestor = (* Ancestor of d or a *)
167
+ Anc of cid option * int * cid option (* head(expand(d)), height, head(expand[height](d)) *)
168
+ (* NONE means expands to {x:A}B *)
169
+
170
+ datatype StrDec = (* Structure declaration *)
171
+ StrDec of string * mid option
172
+
173
+ (* Form of constant declaration *)
174
+ datatype ConDecForm =
175
+ FromCS (* from constraint domain *)
176
+ | Ordinary (* ordinary declaration *)
177
+ | Clause (* %clause declaration *)
178
+
179
+ (* Type abbreviations *)
180
+ type dctx = Dec Ctx (* G = . | G,D *)
181
+ type eclo = Exp * Sub (* Us = U[s] *)
182
+ type bclo = Block * Sub (* Bs = B[s] *)
183
+ type cnstr = Cnstr ref
184
+
185
+ (* exception Error of string (* raised if out of space *) *)
186
+
187
+
188
+ structure FgnExpStd = struct
189
+
190
+ structure ToInternal = FgnOpnTable (type arg = unit
191
+ type result = Exp)
192
+
193
+ structure Map = FgnOpnTable (type arg = Exp -> Exp
194
+ type result = Exp)
195
+
196
+ structure App = FgnOpnTable (type arg = Exp -> unit
197
+ type result = unit)
198
+
199
+ structure EqualTo = FgnOpnTable (type arg = Exp
200
+ type result = bool)
201
+
202
+ structure UnifyWith = FgnOpnTable (type arg = Dec Ctx * Exp
203
+ type result = FgnUnify)
204
+
205
+
206
+
207
+ fun fold csfe f b = let
208
+ val r = ref b
209
+ fun g U = r := f (U,!r)
210
+ in
211
+ App.apply csfe g ; !r
212
+ end
213
+
214
+ end
215
+
216
+ structure FgnCnstrStd = struct
217
+
218
+ structure ToInternal = FgnOpnTable (type arg = unit
219
+ type result = (Dec Ctx * Exp) list)
220
+
221
+ structure Awake = FgnOpnTable (type arg = unit
222
+ type result = bool)
223
+
224
+ structure Simplify = FgnOpnTable (type arg = unit
225
+ type result = bool)
226
+
227
+ end
228
+
229
+ fun conDecName (ConDec (name, _, _, _, _, _)) = name
230
+ | conDecName (ConDef (name, _, _, _, _, _, _)) = name
231
+ | conDecName (AbbrevDef (name, _, _, _, _, _)) = name
232
+ | conDecName (SkoDec (name, _, _, _, _)) = name
233
+ | conDecName (BlockDec (name, _, _, _)) = name
234
+ | conDecName (BlockDef (name, _, _)) = name
235
+
236
+ fun conDecParent (ConDec (_, parent, _, _, _, _)) = parent
237
+ | conDecParent (ConDef (_, parent, _, _, _, _, _)) = parent
238
+ | conDecParent (AbbrevDef (_, parent, _, _, _, _)) = parent
239
+ | conDecParent (SkoDec (_, parent, _, _, _)) = parent
240
+ | conDecParent (BlockDec (_, parent, _, _)) = parent
241
+ | conDecParent (BlockDef (_, parent, _)) = parent
242
+
243
+
244
+ (* conDecImp (CD) = k
245
+
246
+ Invariant:
247
+ If CD is either a declaration, definition, abbreviation, or
248
+ a Skolem constant
249
+ then k stands for the number of implicit elements.
250
+ *)
251
+ fun conDecImp (ConDec (_, _, i, _, _, _)) = i
252
+ | conDecImp (ConDef (_, _, i, _, _, _, _)) = i
253
+ | conDecImp (AbbrevDef (_, _, i, _, _, _)) = i
254
+ | conDecImp (SkoDec (_, _, i, _, _)) = i
255
+ | conDecImp (BlockDec (_, _, _, _)) = 0 (* watch out -- carsten *)
256
+
257
+ fun conDecStatus (ConDec (_, _, _, status, _, _)) = status
258
+ | conDecStatus _ = Normal
259
+
260
+ (* conDecType (CD) = V
261
+
262
+ Invariant:
263
+ If CD is either a declaration, definition, abbreviation, or
264
+ a Skolem constant
265
+ then V is the respective type
266
+ *)
267
+ fun conDecType (ConDec (_, _, _, _, V, _)) = V
268
+ | conDecType (ConDef (_, _, _, _, V, _, _)) = V
269
+ | conDecType (AbbrevDef (_, _, _, _, V, _)) = V
270
+ | conDecType (SkoDec (_, _, _, V, _)) = V
271
+
272
+
273
+ (* conDecBlock (CD) = (Gsome, Lpi)
274
+
275
+ Invariant:
276
+ If CD is block definition
277
+ then Gsome is the context of some variables
278
+ and Lpi is the list of pi variables
279
+ *)
280
+ fun conDecBlock (BlockDec (_, _, Gsome, Lpi)) = (Gsome, Lpi)
281
+
282
+ (* conDecUni (CD) = L
283
+
284
+ Invariant:
285
+ If CD is either a declaration, definition, abbreviation, or
286
+ a Skolem constant
287
+ then L is the respective universe
288
+ *)
289
+ fun conDecUni (ConDec (_, _, _, _, _, L)) = L
290
+ | conDecUni (ConDef (_, _, _, _, _, L, _)) = L
291
+ | conDecUni (AbbrevDef (_, _, _, _, _, L)) = L
292
+ | conDecUni (SkoDec (_, _, _, _, L)) = L
293
+
294
+
295
+ fun strDecName (StrDec (name, _)) = name
296
+
297
+ fun strDecParent (StrDec (_, parent)) = parent
298
+
299
+ local
300
+ val maxCid = Global.maxCid
301
+ val dummyEntry = ConDec("", NONE, 0, Normal, Uni (Kind), Kind)
302
+ val sgnArray = Array.array (maxCid+1, dummyEntry)
303
+ : ConDec Array.array
304
+ val nextCid = ref(0)
305
+
306
+ val maxMid = Global.maxMid
307
+ val sgnStructArray = Array.array (maxMid+1, StrDec("", NONE))
308
+ : StrDec Array.array
309
+ val nextMid = ref (0)
310
+
311
+ in
312
+ (* Invariants *)
313
+ (* Constant declarations are all well-typed *)
314
+ (* Constant declarations are stored in beta-normal form *)
315
+ (* All definitions are strict in all their arguments *)
316
+ (* If Const(cid) is valid, then sgnArray(cid) = ConDec _ *)
317
+ (* If Def(cid) is valid, then sgnArray(cid) = ConDef _ *)
318
+
319
+ fun sgnClean (i) = if i >= !nextCid then ()
320
+ else (Array.update (sgnArray, i, dummyEntry);
321
+ sgnClean (i+1))
322
+
323
+ fun sgnReset () = ((* Fri Dec 20 12:04:24 2002 -fp *)
324
+ (* this circumvents a space leak *)
325
+ sgnClean (0);
326
+ nextCid := 0; nextMid := 0)
327
+ fun sgnSize () = (!nextCid, !nextMid)
328
+
329
+ fun sgnAdd (conDec) =
330
+ let
331
+ val cid = !nextCid
332
+ in
333
+ if cid > maxCid
334
+ then raise Error ("Global signature size " ^ Int.toString (maxCid+1) ^ " exceeded")
335
+ else (Array.update (sgnArray, cid, conDec) ;
336
+ nextCid := cid + 1;
337
+ cid)
338
+ end
339
+
340
+ (* 0 <= cid < !nextCid *)
341
+ fun sgnLookup (cid) = Array.sub (sgnArray, cid)
342
+
343
+ fun sgnApp (f) =
344
+ let
345
+ fun sgnApp' (cid) =
346
+ if cid = !nextCid then () else (f cid; sgnApp' (cid+1))
347
+ in
348
+ sgnApp' (0)
349
+ end
350
+
351
+ fun sgnStructAdd (strDec) =
352
+ let
353
+ val mid = !nextMid
354
+ in
355
+ if mid > maxMid
356
+ then raise Error ("Global signature size " ^ Int.toString (maxMid+1) ^ " exceeded")
357
+ else (Array.update (sgnStructArray, mid, strDec) ;
358
+ nextMid := mid + 1;
359
+ mid)
360
+ end
361
+
362
+ (* 0 <= mid < !nextMid *)
363
+ fun sgnStructLookup (mid) = Array.sub (sgnStructArray, mid)
364
+
365
+ (* A hack used in Flit - jcreed 6/05 *)
366
+ fun rename (cid, new) =
367
+ let
368
+ val newConDec = case sgnLookup cid of
369
+ ConDec (n,m,i,s,e,u) => ConDec(new,m,i,s,e,u)
370
+ | ConDef (n,m,i,e,e',u,a) => ConDef(new,m,i,e,e',u,a)
371
+ | AbbrevDef (n,m,i,e,e',u) => AbbrevDef (new,m,i,e,e',u)
372
+ | BlockDec (n,m,d,d') => BlockDec (new,m,d,d')
373
+ | SkoDec (n,m,i,e,u) => SkoDec (new,m,i,e,u)
374
+ in
375
+ Array.update (sgnArray, cid, newConDec)
376
+ end
377
+
378
+ end
379
+
380
+ fun constDef (d) =
381
+ (case sgnLookup (d)
382
+ of ConDef(_, _, _, U,_, _, _) => U
383
+ | AbbrevDef (_, _, _, U,_, _) => U)
384
+
385
+ fun constType (c) = conDecType (sgnLookup c)
386
+ fun constImp (c) = conDecImp (sgnLookup c)
387
+ fun constUni (c) = conDecUni (sgnLookup c)
388
+ fun constBlock (c) = conDecBlock (sgnLookup c)
389
+
390
+ fun constStatus (c) =
391
+ (case sgnLookup (c)
392
+ of ConDec (_, _, _, status, _, _) => status
393
+ | _ => Normal)
394
+
395
+
396
+ (* Explicit Substitutions *)
397
+
398
+ (* id = ^0
399
+
400
+ Invariant:
401
+ G |- id : G id is patsub
402
+ *)
403
+ val id = Shift(0)
404
+
405
+ (* shift = ^1
406
+
407
+ Invariant:
408
+ G, V |- ^ : G ^ is patsub
409
+ *)
410
+ val shift = Shift(1)
411
+
412
+ (* invShift = ^-1 = _.^0
413
+ Invariant:
414
+ G |- ^-1 : G, V ^-1 is patsub
415
+ *)
416
+ val invShift = Dot(Undef, id)
417
+
418
+
419
+ (* comp (s1, s2) = s'
420
+
421
+ Invariant:
422
+ If G' |- s1 : G
423
+ and G'' |- s2 : G'
424
+ then s' = s1 o s2
425
+ and G'' |- s1 o s2 : G
426
+
427
+ If s1, s2 patsub
428
+ then s' patsub
429
+ *)
430
+ fun comp (Shift (0), s) = s
431
+ (* next line is an optimization *)
432
+ (* roughly 15% on standard suite for Twelf 1.1 *)
433
+ (* Sat Feb 14 10:15:16 1998 -fp *)
434
+ | comp (s, Shift (0)) = s
435
+ | comp (Shift (n), Dot (Ft, s)) = comp (Shift (n-1), s)
436
+ | comp (Shift (n), Shift (m)) = Shift (n+m)
437
+ | comp (Dot (Ft, s), s') = Dot (frontSub (Ft, s'), comp (s, s'))
438
+
439
+ (* bvarSub (n, s) = Ft'
440
+
441
+ Invariant:
442
+ If G |- s : G' G' |- n : V
443
+ then Ft' = Ftn if s = Ft1 .. Ftn .. ^k
444
+ or Ft' = ^(n+k) if s = Ft1 .. Ftm ^k and m<n
445
+ and G |- Ft' : V [s]
446
+ *)
447
+ and bvarSub (1, Dot(Ft, s)) = Ft
448
+ | bvarSub (n, Dot(Ft, s)) = bvarSub (n-1, s)
449
+ | bvarSub (n, Shift(k)) = Idx (n+k)
450
+
451
+ (* blockSub (B, s) = B'
452
+
453
+ Invariant:
454
+ If G |- s : G'
455
+ and G' |- B block
456
+ then G |- B' block
457
+ and B [s] == B'
458
+ *)
459
+ (* in front of substitutions, first case is irrelevant *)
460
+ (* Sun Dec 2 11:56:41 2001 -fp *)
461
+ and blockSub (Bidx k, s) =
462
+ (case bvarSub (k, s)
463
+ of Idx k' => Bidx k'
464
+ | Block B => B)
465
+ | blockSub (LVar (ref (SOME B), sk, _), s) =
466
+ blockSub (B, comp (sk, s))
467
+ (* -fp Sun Dec 1 21:18:30 2002 *)
468
+ (* --cs Sun Dec 1 11:25:41 2002 *)
469
+ (* Since always . |- t : Gsome, discard s *)
470
+ (* where is this needed? *)
471
+ (* Thu Dec 6 20:30:26 2001 -fp !!! *)
472
+ | blockSub (LVar (r as ref NONE, sk, (l, t)), s) =
473
+ LVar(r, comp(sk, s), (l, t))
474
+ (* was:
475
+ LVar (r, comp(sk, s), (l, comp (t, s)))
476
+ July 22, 2010 -fp -cs
477
+ *)
478
+ (* comp(^k, s) = ^k' for some k' by invariant *)
479
+ | blockSub (L as Inst ULs, s') = Inst (map (fn U => EClo (U, s')) ULs)
480
+ (* this should be right but somebody should verify *)
481
+
482
+ (* frontSub (Ft, s) = Ft'
483
+
484
+ Invariant:
485
+ If G |- s : G' G' |- Ft : V
486
+ then Ft' = Ft [s]
487
+ and G |- Ft' : V [s]
488
+
489
+ NOTE: EClo (U, s) might be undefined, so if this is ever
490
+ computed eagerly, we must introduce an "Undefined" exception,
491
+ raise it in whnf and handle it here so Exp (EClo (U, s)) => Undef
492
+ *)
493
+ and frontSub (Idx (n), s) = bvarSub (n, s)
494
+ | frontSub (Exp (U), s) = Exp (EClo (U, s))
495
+ | frontSub (Undef, s) = Undef
496
+ | frontSub (Block (B), s) = Block (blockSub (B, s))
497
+
498
+ (* decSub (x:V, s) = D'
499
+
500
+ Invariant:
501
+ If G |- s : G' G' |- V : L
502
+ then D' = x:V[s]
503
+ and G |- V[s] : L
504
+ *)
505
+ (* First line is an optimization suggested by cs *)
506
+ (* D[id] = D *)
507
+ (* Sat Feb 14 18:37:44 1998 -fp *)
508
+ (* seems to have no statistically significant effect *)
509
+ (* undo for now Sat Feb 14 20:22:29 1998 -fp *)
510
+ (*
511
+ fun decSub (D, Shift(0)) = D
512
+ | decSub (Dec (x, V), s) = Dec (x, EClo (V, s))
513
+ *)
514
+ fun decSub (Dec (x, V), s) = Dec (x, EClo (V, s))
515
+ | decSub (NDec x, s) = NDec x
516
+ | decSub (BDec (n, (l, t)), s) = BDec (n, (l, comp (t, s)))
517
+
518
+ (* dot1 (s) = s'
519
+
520
+ Invariant:
521
+ If G |- s : G'
522
+ then s' = 1. (s o ^)
523
+ and for all V s.t. G' |- V : L
524
+ G, V[s] |- s' : G', V
525
+
526
+ If s patsub then s' patsub
527
+ *)
528
+ (* first line is an optimization *)
529
+ (* roughly 15% on standard suite for Twelf 1.1 *)
530
+ (* Sat Feb 14 10:16:16 1998 -fp *)
531
+ fun dot1 (s as Shift (0)) = s
532
+ | dot1 s = Dot (Idx(1), comp(s, shift))
533
+
534
+ (* invDot1 (s) = s'
535
+ invDot1 (1. s' o ^) = s'
536
+
537
+ Invariant:
538
+ s = 1 . s' o ^
539
+ If G' |- s' : G
540
+ (so G',V[s] |- s : G,V)
541
+ *)
542
+ fun invDot1 (s) = comp (comp(shift, s), invShift)
543
+
544
+
545
+ (* Declaration Contexts *)
546
+
547
+ (* ctxDec (G, k) = x:V
548
+ Invariant:
549
+ If |G| >= k, where |G| is size of G,
550
+ then G |- k : V and G |- V : L
551
+ *)
552
+ fun ctxDec (G, k) =
553
+ let (* ctxDec' (G'', k') = x:V
554
+ where G |- ^(k-k') : G'', 1 <= k' <= k
555
+ *)
556
+ fun ctxDec' (Decl (G', Dec (x, V')), 1) = Dec (x, EClo (V', Shift (k)))
557
+ | ctxDec' (Decl (G', BDec (n, (l, s))), 1) = BDec (n, (l, comp (s, Shift (k))))
558
+ | ctxDec' (Decl (G', _), k') = ctxDec' (G', k'-1)
559
+ (* ctxDec' (Null, k') should not occur by invariant *)
560
+ in
561
+ ctxDec' (G, k)
562
+ end
563
+
564
+ (* blockDec (G, v, i) = V
565
+
566
+ Invariant:
567
+ If G (v) = l[s]
568
+ and Sigma (l) = SOME Gsome BLOCK Lblock
569
+ and G |- s : Gsome
570
+ then G |- pi (v, i) : V
571
+ *)
572
+
573
+ fun blockDec (G, v as (Bidx k), i) =
574
+ let
575
+ val BDec (_, (l, s)) = ctxDec (G, k)
576
+ (* G |- s : Gsome *)
577
+ val (Gsome, Lblock) = conDecBlock (sgnLookup l)
578
+ fun blockDec' (t, D :: L, 1, j) = decSub (D, t)
579
+ | blockDec' (t, _ :: L, n, j) =
580
+ blockDec' (Dot (Exp (Root (Proj (v, j), Nil)), t),
581
+ L, n-1, j+1)
582
+ in
583
+ blockDec' (s, Lblock, i, 1)
584
+ end
585
+
586
+
587
+ (* EVar related functions *)
588
+
589
+ (* newEVar (G, V) = newEVarCnstr (G, V, nil) *)
590
+ fun newEVar (G, V) = EVar(ref NONE, G, V, ref nil)
591
+
592
+ (* newAVar G = new AVar (assignable variable) *)
593
+ (* AVars carry no type, ctx, or cnstr *)
594
+ fun newAVar () = AVar(ref NONE)
595
+
596
+ (* newTypeVar (G) = X, X new
597
+ where G |- X : type
598
+ *)
599
+ fun newTypeVar (G) = EVar(ref NONE, G, Uni(Type), ref nil)
600
+
601
+ (* newLVar (l, s) = (l[s]) *)
602
+ fun newLVar (sk, (cid, t)) = LVar (ref NONE, sk, (cid, t))
603
+
604
+ (* Definition related functions *)
605
+ (* headOpt (U) = SOME(H) or NONE, U should be strict, normal *)
606
+ fun headOpt (Root (H, _)) = SOME(H)
607
+ | headOpt (Lam (_, U)) = headOpt U
608
+ | headOpt _ = NONE
609
+
610
+ fun ancestor' (NONE) = Anc(NONE, 0, NONE)
611
+ | ancestor' (SOME(Const(c))) = Anc(SOME(c), 1, SOME(c))
612
+ | ancestor' (SOME(Def(d))) =
613
+ (case sgnLookup(d)
614
+ of ConDef(_, _, _, _, _, _, Anc(_, height, cOpt))
615
+ => Anc(SOME(d), height+1, cOpt))
616
+ | ancestor' (SOME _) = (* FgnConst possible, BVar impossible by strictness *)
617
+ Anc(NONE, 0, NONE)
618
+ (* ancestor(U) = ancestor info for d = U *)
619
+ fun ancestor (U) = ancestor' (headOpt U)
620
+
621
+ (* defAncestor(d) = ancestor of d, d must be defined *)
622
+ fun defAncestor (d) =
623
+ (case sgnLookup(d)
624
+ of ConDef(_, _, _, _, _, _, anc) => anc)
625
+
626
+ (* Type related functions *)
627
+
628
+ (* targetHeadOpt (V) = SOME(H) or NONE
629
+ where H is the head of the atomic target type of V,
630
+ NONE if V is a kind or object or have variable type.
631
+ Does not expand type definitions.
632
+ *)
633
+ (* should there possibly be a FgnConst case? also targetFamOpt -kw *)
634
+ fun targetHeadOpt (Root (H, _)) = SOME(H)
635
+ | targetHeadOpt (Pi(_, V)) = targetHeadOpt V
636
+ | targetHeadOpt (Redex (V, S)) = targetHeadOpt V
637
+ | targetHeadOpt (Lam (_, V)) = targetHeadOpt V
638
+ | targetHeadOpt (EVar (ref (SOME(V)),_,_,_)) = targetHeadOpt V
639
+ | targetHeadOpt (EClo (V, s)) = targetHeadOpt V
640
+ | targetHeadOpt _ = NONE
641
+ (* Root(Bvar _, _), Root(FVar _, _), Root(FgnConst _, _),
642
+ EVar(ref NONE,..), Uni, FgnExp _
643
+ *)
644
+ (* Root(Skonst _, _) can't occur *)
645
+ (* targetHead (A) = a
646
+ as in targetHeadOpt, except V must be a valid type
647
+ *)
648
+ fun targetHead (A) = valOf (targetHeadOpt A)
649
+
650
+ (* targetFamOpt (V) = SOME(cid) or NONE
651
+ where cid is the type family of the atomic target type of V,
652
+ NONE if V is a kind or object or have variable type.
653
+ Does expand type definitions.
654
+ *)
655
+ fun targetFamOpt (Root (Const(cid), _)) = SOME(cid)
656
+ | targetFamOpt (Pi(_, V)) = targetFamOpt V
657
+ | targetFamOpt (Root (Def(cid), _)) = targetFamOpt (constDef cid)
658
+ | targetFamOpt (Redex (V, S)) = targetFamOpt V
659
+ | targetFamOpt (Lam (_, V)) = targetFamOpt V
660
+ | targetFamOpt (EVar (ref (SOME(V)),_,_,_)) = targetFamOpt V
661
+ | targetFamOpt (EClo (V, s)) = targetFamOpt V
662
+ | targetFamOpt _ = NONE
663
+ (* Root(Bvar _, _), Root(FVar _, _), Root(FgnConst _, _),
664
+ EVar(ref NONE,..), Uni, FgnExp _
665
+ *)
666
+ (* Root(Skonst _, _) can't occur *)
667
+ (* targetFam (A) = a
668
+ as in targetFamOpt, except V must be a valid type
669
+ *)
670
+ fun targetFam (A) = valOf (targetFamOpt A)
671
+
672
+ end; (* functor IntSyn *)
673
+
674
+ structure IntSyn :> INTSYN =
675
+ IntSyn (structure Global = Global);