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,1918 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ pygments.lexers.math
4
+ ~~~~~~~~~~~~~~~~~~~~
5
+
6
+ Lexers for math languages.
7
+
8
+ :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
9
+ :license: BSD, see LICENSE for details.
10
+ """
11
+
12
+ import re
13
+
14
+ from pygments.util import shebang_matches
15
+ from pygments.lexer import Lexer, RegexLexer, bygroups, include, \
16
+ combined, do_insertions
17
+ from pygments.token import Comment, String, Punctuation, Keyword, Name, \
18
+ Operator, Number, Text, Generic
19
+
20
+ from pygments.lexers.agile import PythonLexer
21
+ from pygments.lexers import _scilab_builtins
22
+ from pygments.lexers import _stan_builtins
23
+
24
+ __all__ = ['JuliaLexer', 'JuliaConsoleLexer', 'MuPADLexer', 'MatlabLexer',
25
+ 'MatlabSessionLexer', 'OctaveLexer', 'ScilabLexer', 'NumPyLexer',
26
+ 'RConsoleLexer', 'SLexer', 'JagsLexer', 'BugsLexer', 'StanLexer',
27
+ 'IDLLexer', 'RdLexer', 'IgorLexer']
28
+
29
+
30
+ class JuliaLexer(RegexLexer):
31
+ """
32
+ For `Julia <http://julialang.org/>`_ source code.
33
+
34
+ *New in Pygments 1.6.*
35
+ """
36
+ name = 'Julia'
37
+ aliases = ['julia','jl']
38
+ filenames = ['*.jl']
39
+ mimetypes = ['text/x-julia','application/x-julia']
40
+
41
+ builtins = [
42
+ 'exit','whos','edit','load','is','isa','isequal','typeof','tuple',
43
+ 'ntuple','uid','hash','finalizer','convert','promote','subtype',
44
+ 'typemin','typemax','realmin','realmax','sizeof','eps','promote_type',
45
+ 'method_exists','applicable','invoke','dlopen','dlsym','system',
46
+ 'error','throw','assert','new','Inf','Nan','pi','im',
47
+ ]
48
+
49
+ tokens = {
50
+ 'root': [
51
+ (r'\n', Text),
52
+ (r'[^\S\n]+', Text),
53
+ (r'#.*$', Comment),
54
+ (r'[]{}:(),;[@]', Punctuation),
55
+ (r'\\\n', Text),
56
+ (r'\\', Text),
57
+
58
+ # keywords
59
+ (r'(begin|while|for|in|return|break|continue|'
60
+ r'macro|quote|let|if|elseif|else|try|catch|end|'
61
+ r'bitstype|ccall|do|using|module|import|export|'
62
+ r'importall|baremodule|immutable)\b', Keyword),
63
+ (r'(local|global|const)\b', Keyword.Declaration),
64
+ (r'(Bool|Int|Int8|Int16|Int32|Int64|Uint|Uint8|Uint16|Uint32|Uint64'
65
+ r'|Float32|Float64|Complex64|Complex128|Any|Nothing|None)\b',
66
+ Keyword.Type),
67
+
68
+ # functions
69
+ (r'(function)((?:\s|\\\s)+)',
70
+ bygroups(Keyword,Name.Function), 'funcname'),
71
+
72
+ # types
73
+ (r'(type|typealias|abstract)((?:\s|\\\s)+)',
74
+ bygroups(Keyword,Name.Class), 'typename'),
75
+
76
+ # operators
77
+ (r'==|!=|<=|>=|->|&&|\|\||::|<:|[-~+/*%=<>&^|.?!$]', Operator),
78
+ (r'\.\*|\.\^|\.\\|\.\/|\\', Operator),
79
+
80
+ # builtins
81
+ ('(' + '|'.join(builtins) + r')\b', Name.Builtin),
82
+
83
+ # backticks
84
+ (r'`(?s).*?`', String.Backtick),
85
+
86
+ # chars
87
+ (r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,3}|\\u[a-fA-F0-9]{1,4}|"
88
+ r"\\U[a-fA-F0-9]{1,6}|[^\\\'\n])'", String.Char),
89
+
90
+ # try to match trailing transpose
91
+ (r'(?<=[.\w\)\]])\'+', Operator),
92
+
93
+ # strings
94
+ (r'(?:[IL])"', String, 'string'),
95
+ (r'[E]?"', String, combined('stringescape', 'string')),
96
+
97
+ # names
98
+ (r'@[a-zA-Z0-9_.]+', Name.Decorator),
99
+ (r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
100
+
101
+ # numbers
102
+ (r'(\d+(_\d+)+\.\d*|\d*\.\d+(_\d+)+)([eEf][+-]?[0-9]+)?', Number.Float),
103
+ (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
104
+ (r'\d+(_\d+)+[eEf][+-]?[0-9]+', Number.Float),
105
+ (r'\d+[eEf][+-]?[0-9]+', Number.Float),
106
+ (r'0b[01]+(_[01]+)+', Number.Binary),
107
+ (r'0b[01]+', Number.Binary),
108
+ (r'0o[0-7]+(_[0-7]+)+', Number.Oct),
109
+ (r'0o[0-7]+', Number.Oct),
110
+ (r'0x[a-fA-F0-9]+(_[a-fA-F0-9]+)+', Number.Hex),
111
+ (r'0x[a-fA-F0-9]+', Number.Hex),
112
+ (r'\d+(_\d+)+', Number.Integer),
113
+ (r'\d+', Number.Integer)
114
+ ],
115
+
116
+ 'funcname': [
117
+ ('[a-zA-Z_][a-zA-Z0-9_]*', Name.Function, '#pop'),
118
+ ('\([^\s\w{]{1,2}\)', Operator, '#pop'),
119
+ ('[^\s\w{]{1,2}', Operator, '#pop'),
120
+ ],
121
+
122
+ 'typename': [
123
+ ('[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
124
+ ],
125
+
126
+ 'stringescape': [
127
+ (r'\\([\\abfnrtv"\']|\n|N{.*?}|u[a-fA-F0-9]{4}|'
128
+ r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
129
+ ],
130
+
131
+ 'string': [
132
+ (r'"', String, '#pop'),
133
+ (r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings
134
+ (r'\$(\([a-zA-Z0-9_]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?',
135
+ String.Interpol),
136
+ (r'[^\\"$]+', String),
137
+ # quotes, dollar signs, and backslashes must be parsed one at a time
138
+ (r'["\\]', String),
139
+ # unhandled string formatting sign
140
+ (r'\$', String)
141
+ ],
142
+ }
143
+
144
+ def analyse_text(text):
145
+ return shebang_matches(text, r'julia')
146
+
147
+
148
+ line_re = re.compile('.*?\n')
149
+
150
+ class JuliaConsoleLexer(Lexer):
151
+ """
152
+ For Julia console sessions. Modeled after MatlabSessionLexer.
153
+
154
+ *New in Pygments 1.6.*
155
+ """
156
+ name = 'Julia console'
157
+ aliases = ['jlcon']
158
+
159
+ def get_tokens_unprocessed(self, text):
160
+ jllexer = JuliaLexer(**self.options)
161
+
162
+ curcode = ''
163
+ insertions = []
164
+
165
+ for match in line_re.finditer(text):
166
+ line = match.group()
167
+
168
+ if line.startswith('julia>'):
169
+ insertions.append((len(curcode),
170
+ [(0, Generic.Prompt, line[:3])]))
171
+ curcode += line[3:]
172
+
173
+ elif line.startswith(' '):
174
+
175
+ idx = len(curcode)
176
+
177
+ # without is showing error on same line as before...?
178
+ line = "\n" + line
179
+ token = (0, Generic.Traceback, line)
180
+ insertions.append((idx, [token]))
181
+
182
+ else:
183
+ if curcode:
184
+ for item in do_insertions(
185
+ insertions, jllexer.get_tokens_unprocessed(curcode)):
186
+ yield item
187
+ curcode = ''
188
+ insertions = []
189
+
190
+ yield match.start(), Generic.Output, line
191
+
192
+ if curcode: # or item:
193
+ for item in do_insertions(
194
+ insertions, jllexer.get_tokens_unprocessed(curcode)):
195
+ yield item
196
+
197
+
198
+ class MuPADLexer(RegexLexer):
199
+ """
200
+ A `MuPAD <http://www.mupad.com>`_ lexer.
201
+ Contributed by Christopher Creutzig <christopher@creutzig.de>.
202
+
203
+ *New in Pygments 0.8.*
204
+ """
205
+ name = 'MuPAD'
206
+ aliases = ['mupad']
207
+ filenames = ['*.mu']
208
+
209
+ tokens = {
210
+ 'root' : [
211
+ (r'//.*?$', Comment.Single),
212
+ (r'/\*', Comment.Multiline, 'comment'),
213
+ (r'"(?:[^"\\]|\\.)*"', String),
214
+ (r'\(|\)|\[|\]|\{|\}', Punctuation),
215
+ (r'''(?x)\b(?:
216
+ next|break|end|
217
+ axiom|end_axiom|category|end_category|domain|end_domain|inherits|
218
+ if|%if|then|elif|else|end_if|
219
+ case|of|do|otherwise|end_case|
220
+ while|end_while|
221
+ repeat|until|end_repeat|
222
+ for|from|to|downto|step|end_for|
223
+ proc|local|option|save|begin|end_proc|
224
+ delete|frame
225
+ )\b''', Keyword),
226
+ (r'''(?x)\b(?:
227
+ DOM_ARRAY|DOM_BOOL|DOM_COMPLEX|DOM_DOMAIN|DOM_EXEC|DOM_EXPR|
228
+ DOM_FAIL|DOM_FLOAT|DOM_FRAME|DOM_FUNC_ENV|DOM_HFARRAY|DOM_IDENT|
229
+ DOM_INT|DOM_INTERVAL|DOM_LIST|DOM_NIL|DOM_NULL|DOM_POLY|DOM_PROC|
230
+ DOM_PROC_ENV|DOM_RAT|DOM_SET|DOM_STRING|DOM_TABLE|DOM_VAR
231
+ )\b''', Name.Class),
232
+ (r'''(?x)\b(?:
233
+ PI|EULER|E|CATALAN|
234
+ NIL|FAIL|undefined|infinity|
235
+ TRUE|FALSE|UNKNOWN
236
+ )\b''',
237
+ Name.Constant),
238
+ (r'\b(?:dom|procname)\b', Name.Builtin.Pseudo),
239
+ (r'\.|,|:|;|=|\+|-|\*|/|\^|@|>|<|\$|\||!|\'|%|~=', Operator),
240
+ (r'''(?x)\b(?:
241
+ and|or|not|xor|
242
+ assuming|
243
+ div|mod|
244
+ union|minus|intersect|in|subset
245
+ )\b''',
246
+ Operator.Word),
247
+ (r'\b(?:I|RDN_INF|RD_NINF|RD_NAN)\b', Number),
248
+ #(r'\b(?:adt|linalg|newDomain|hold)\b', Name.Builtin),
249
+ (r'''(?x)
250
+ ((?:[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)
251
+ (?:::[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)*)(\s*)([(])''',
252
+ bygroups(Name.Function, Text, Punctuation)),
253
+ (r'''(?x)
254
+ (?:[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)
255
+ (?:::[a-zA-Z_#][a-zA-Z_#0-9]*|`[^`]*`)*''', Name.Variable),
256
+ (r'[0-9]+(?:\.[0-9]*)?(?:e[0-9]+)?', Number),
257
+ (r'\.[0-9]+(?:e[0-9]+)?', Number),
258
+ (r'.', Text)
259
+ ],
260
+ 'comment' : [
261
+ (r'[^*/]', Comment.Multiline),
262
+ (r'/\*', Comment.Multiline, '#push'),
263
+ (r'\*/', Comment.Multiline, '#pop'),
264
+ (r'[*/]', Comment.Multiline)
265
+ ]
266
+ }
267
+
268
+
269
+ class MatlabLexer(RegexLexer):
270
+ """
271
+ For Matlab source code.
272
+
273
+ *New in Pygments 0.10.*
274
+ """
275
+ name = 'Matlab'
276
+ aliases = ['matlab']
277
+ filenames = ['*.m']
278
+ mimetypes = ['text/matlab']
279
+
280
+ #
281
+ # These lists are generated automatically.
282
+ # Run the following in bash shell:
283
+ #
284
+ # for f in elfun specfun elmat; do
285
+ # echo -n "$f = "
286
+ # matlab -nojvm -r "help $f;exit;" | perl -ne \
287
+ # 'push(@c,$1) if /^ (\w+)\s+-/; END {print q{["}.join(q{","},@c).qq{"]\n};}'
288
+ # done
289
+ #
290
+ # elfun: Elementary math functions
291
+ # specfun: Special Math functions
292
+ # elmat: Elementary matrices and matrix manipulation
293
+ #
294
+ # taken from Matlab version 7.4.0.336 (R2007a)
295
+ #
296
+ elfun = ["sin","sind","sinh","asin","asind","asinh","cos","cosd","cosh",
297
+ "acos","acosd","acosh","tan","tand","tanh","atan","atand","atan2",
298
+ "atanh","sec","secd","sech","asec","asecd","asech","csc","cscd",
299
+ "csch","acsc","acscd","acsch","cot","cotd","coth","acot","acotd",
300
+ "acoth","hypot","exp","expm1","log","log1p","log10","log2","pow2",
301
+ "realpow","reallog","realsqrt","sqrt","nthroot","nextpow2","abs",
302
+ "angle","complex","conj","imag","real","unwrap","isreal","cplxpair",
303
+ "fix","floor","ceil","round","mod","rem","sign"]
304
+ specfun = ["airy","besselj","bessely","besselh","besseli","besselk","beta",
305
+ "betainc","betaln","ellipj","ellipke","erf","erfc","erfcx",
306
+ "erfinv","expint","gamma","gammainc","gammaln","psi","legendre",
307
+ "cross","dot","factor","isprime","primes","gcd","lcm","rat",
308
+ "rats","perms","nchoosek","factorial","cart2sph","cart2pol",
309
+ "pol2cart","sph2cart","hsv2rgb","rgb2hsv"]
310
+ elmat = ["zeros","ones","eye","repmat","rand","randn","linspace","logspace",
311
+ "freqspace","meshgrid","accumarray","size","length","ndims","numel",
312
+ "disp","isempty","isequal","isequalwithequalnans","cat","reshape",
313
+ "diag","blkdiag","tril","triu","fliplr","flipud","flipdim","rot90",
314
+ "find","end","sub2ind","ind2sub","bsxfun","ndgrid","permute",
315
+ "ipermute","shiftdim","circshift","squeeze","isscalar","isvector",
316
+ "ans","eps","realmax","realmin","pi","i","inf","nan","isnan",
317
+ "isinf","isfinite","j","why","compan","gallery","hadamard","hankel",
318
+ "hilb","invhilb","magic","pascal","rosser","toeplitz","vander",
319
+ "wilkinson"]
320
+
321
+ tokens = {
322
+ 'root': [
323
+ # line starting with '!' is sent as a system command. not sure what
324
+ # label to use...
325
+ (r'^!.*', String.Other),
326
+ (r'%\{\s*\n', Comment.Multiline, 'blockcomment'),
327
+ (r'%.*$', Comment),
328
+ (r'^\s*function', Keyword, 'deffunc'),
329
+
330
+ # from 'iskeyword' on version 7.11 (R2010):
331
+ (r'(break|case|catch|classdef|continue|else|elseif|end|enumerated|'
332
+ r'events|for|function|global|if|methods|otherwise|parfor|'
333
+ r'persistent|properties|return|spmd|switch|try|while)\b', Keyword),
334
+
335
+ ("(" + "|".join(elfun+specfun+elmat) + r')\b', Name.Builtin),
336
+
337
+ # line continuation with following comment:
338
+ (r'\.\.\..*$', Comment),
339
+
340
+ # operators:
341
+ (r'-|==|~=|<|>|<=|>=|&&|&|~|\|\|?', Operator),
342
+ # operators requiring escape for re:
343
+ (r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator),
344
+
345
+ # punctuation:
346
+ (r'\[|\]|\(|\)|\{|\}|:|@|\.|,', Punctuation),
347
+ (r'=|:|;', Punctuation),
348
+
349
+ # quote can be transpose, instead of string:
350
+ # (not great, but handles common cases...)
351
+ (r'(?<=[\w\)\]])\'', Operator),
352
+
353
+ (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
354
+ (r'\d+[eEf][+-]?[0-9]+', Number.Float),
355
+ (r'\d+', Number.Integer),
356
+
357
+ (r'(?<![\w\)\]])\'', String, 'string'),
358
+ ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
359
+ (r'.', Text),
360
+ ],
361
+ 'string': [
362
+ (r'[^\']*\'', String, '#pop')
363
+ ],
364
+ 'blockcomment': [
365
+ (r'^\s*%\}', Comment.Multiline, '#pop'),
366
+ (r'^.*\n', Comment.Multiline),
367
+ (r'.', Comment.Multiline),
368
+ ],
369
+ 'deffunc': [
370
+ (r'(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)',
371
+ bygroups(Text.Whitespace, Text, Text.Whitespace, Punctuation,
372
+ Text.Whitespace, Name.Function, Punctuation, Text,
373
+ Punctuation, Text.Whitespace), '#pop'),
374
+ ],
375
+ }
376
+
377
+ def analyse_text(text):
378
+ if re.match('^\s*%', text, re.M): # comment
379
+ return 0.9
380
+ elif re.match('^!\w+', text, re.M): # system cmd
381
+ return 0.9
382
+ return 0.1
383
+
384
+
385
+ line_re = re.compile('.*?\n')
386
+
387
+ class MatlabSessionLexer(Lexer):
388
+ """
389
+ For Matlab sessions. Modeled after PythonConsoleLexer.
390
+ Contributed by Ken Schutte <kschutte@csail.mit.edu>.
391
+
392
+ *New in Pygments 0.10.*
393
+ """
394
+ name = 'Matlab session'
395
+ aliases = ['matlabsession']
396
+
397
+ def get_tokens_unprocessed(self, text):
398
+ mlexer = MatlabLexer(**self.options)
399
+
400
+ curcode = ''
401
+ insertions = []
402
+
403
+ for match in line_re.finditer(text):
404
+ line = match.group()
405
+
406
+ if line.startswith('>>'):
407
+ insertions.append((len(curcode),
408
+ [(0, Generic.Prompt, line[:3])]))
409
+ curcode += line[3:]
410
+
411
+ elif line.startswith('???'):
412
+
413
+ idx = len(curcode)
414
+
415
+ # without is showing error on same line as before...?
416
+ line = "\n" + line
417
+ token = (0, Generic.Traceback, line)
418
+ insertions.append((idx, [token]))
419
+
420
+ else:
421
+ if curcode:
422
+ for item in do_insertions(
423
+ insertions, mlexer.get_tokens_unprocessed(curcode)):
424
+ yield item
425
+ curcode = ''
426
+ insertions = []
427
+
428
+ yield match.start(), Generic.Output, line
429
+
430
+ if curcode: # or item:
431
+ for item in do_insertions(
432
+ insertions, mlexer.get_tokens_unprocessed(curcode)):
433
+ yield item
434
+
435
+
436
+ class OctaveLexer(RegexLexer):
437
+ """
438
+ For GNU Octave source code.
439
+
440
+ *New in Pygments 1.5.*
441
+ """
442
+ name = 'Octave'
443
+ aliases = ['octave']
444
+ filenames = ['*.m']
445
+ mimetypes = ['text/octave']
446
+
447
+ # These lists are generated automatically.
448
+ # Run the following in bash shell:
449
+ #
450
+ # First dump all of the Octave manual into a plain text file:
451
+ #
452
+ # $ info octave --subnodes -o octave-manual
453
+ #
454
+ # Now grep through it:
455
+
456
+ # for i in \
457
+ # "Built-in Function" "Command" "Function File" \
458
+ # "Loadable Function" "Mapping Function";
459
+ # do
460
+ # perl -e '@name = qw('"$i"');
461
+ # print lc($name[0]),"_kw = [\n"';
462
+ #
463
+ # perl -n -e 'print "\"$1\",\n" if /-- '"$i"': .* (\w*) \(/;' \
464
+ # octave-manual | sort | uniq ;
465
+ # echo "]" ;
466
+ # echo;
467
+ # done
468
+
469
+ # taken from Octave Mercurial changeset 8cc154f45e37 (30-jan-2011)
470
+
471
+ builtin_kw = [ "addlistener", "addpath", "addproperty", "all",
472
+ "and", "any", "argnames", "argv", "assignin",
473
+ "atexit", "autoload",
474
+ "available_graphics_toolkits", "beep_on_error",
475
+ "bitand", "bitmax", "bitor", "bitshift", "bitxor",
476
+ "cat", "cell", "cellstr", "char", "class", "clc",
477
+ "columns", "command_line_path",
478
+ "completion_append_char", "completion_matches",
479
+ "complex", "confirm_recursive_rmdir", "cputime",
480
+ "crash_dumps_octave_core", "ctranspose", "cumprod",
481
+ "cumsum", "debug_on_error", "debug_on_interrupt",
482
+ "debug_on_warning", "default_save_options",
483
+ "dellistener", "diag", "diff", "disp",
484
+ "doc_cache_file", "do_string_escapes", "double",
485
+ "drawnow", "e", "echo_executing_commands", "eps",
486
+ "eq", "errno", "errno_list", "error", "eval",
487
+ "evalin", "exec", "exist", "exit", "eye", "false",
488
+ "fclear", "fclose", "fcntl", "fdisp", "feof",
489
+ "ferror", "feval", "fflush", "fgetl", "fgets",
490
+ "fieldnames", "file_in_loadpath", "file_in_path",
491
+ "filemarker", "filesep", "find_dir_in_path",
492
+ "fixed_point_format", "fnmatch", "fopen", "fork",
493
+ "formula", "fprintf", "fputs", "fread", "freport",
494
+ "frewind", "fscanf", "fseek", "fskipl", "ftell",
495
+ "functions", "fwrite", "ge", "genpath", "get",
496
+ "getegid", "getenv", "geteuid", "getgid",
497
+ "getpgrp", "getpid", "getppid", "getuid", "glob",
498
+ "gt", "gui_mode", "history_control",
499
+ "history_file", "history_size",
500
+ "history_timestamp_format_string", "home",
501
+ "horzcat", "hypot", "ifelse",
502
+ "ignore_function_time_stamp", "inferiorto",
503
+ "info_file", "info_program", "inline", "input",
504
+ "intmax", "intmin", "ipermute",
505
+ "is_absolute_filename", "isargout", "isbool",
506
+ "iscell", "iscellstr", "ischar", "iscomplex",
507
+ "isempty", "isfield", "isfloat", "isglobal",
508
+ "ishandle", "isieee", "isindex", "isinteger",
509
+ "islogical", "ismatrix", "ismethod", "isnull",
510
+ "isnumeric", "isobject", "isreal",
511
+ "is_rooted_relative_filename", "issorted",
512
+ "isstruct", "isvarname", "kbhit", "keyboard",
513
+ "kill", "lasterr", "lasterror", "lastwarn",
514
+ "ldivide", "le", "length", "link", "linspace",
515
+ "logical", "lstat", "lt", "make_absolute_filename",
516
+ "makeinfo_program", "max_recursion_depth", "merge",
517
+ "methods", "mfilename", "minus", "mislocked",
518
+ "mkdir", "mkfifo", "mkstemp", "mldivide", "mlock",
519
+ "mouse_wheel_zoom", "mpower", "mrdivide", "mtimes",
520
+ "munlock", "nargin", "nargout",
521
+ "native_float_format", "ndims", "ne", "nfields",
522
+ "nnz", "norm", "not", "numel", "nzmax",
523
+ "octave_config_info", "octave_core_file_limit",
524
+ "octave_core_file_name",
525
+ "octave_core_file_options", "ones", "or",
526
+ "output_max_field_width", "output_precision",
527
+ "page_output_immediately", "page_screen_output",
528
+ "path", "pathsep", "pause", "pclose", "permute",
529
+ "pi", "pipe", "plus", "popen", "power",
530
+ "print_empty_dimensions", "printf",
531
+ "print_struct_array_contents", "prod",
532
+ "program_invocation_name", "program_name",
533
+ "putenv", "puts", "pwd", "quit", "rats", "rdivide",
534
+ "readdir", "readlink", "read_readline_init_file",
535
+ "realmax", "realmin", "rehash", "rename",
536
+ "repelems", "re_read_readline_init_file", "reset",
537
+ "reshape", "resize", "restoredefaultpath",
538
+ "rethrow", "rmdir", "rmfield", "rmpath", "rows",
539
+ "save_header_format_string", "save_precision",
540
+ "saving_history", "scanf", "set", "setenv",
541
+ "shell_cmd", "sighup_dumps_octave_core",
542
+ "sigterm_dumps_octave_core", "silent_functions",
543
+ "single", "size", "size_equal", "sizemax",
544
+ "sizeof", "sleep", "source", "sparse_auto_mutate",
545
+ "split_long_rows", "sprintf", "squeeze", "sscanf",
546
+ "stat", "stderr", "stdin", "stdout", "strcmp",
547
+ "strcmpi", "string_fill_char", "strncmp",
548
+ "strncmpi", "struct", "struct_levels_to_print",
549
+ "strvcat", "subsasgn", "subsref", "sum", "sumsq",
550
+ "superiorto", "suppress_verbose_help_message",
551
+ "symlink", "system", "tic", "tilde_expand",
552
+ "times", "tmpfile", "tmpnam", "toc", "toupper",
553
+ "transpose", "true", "typeinfo", "umask", "uminus",
554
+ "uname", "undo_string_escapes", "unlink", "uplus",
555
+ "upper", "usage", "usleep", "vec", "vectorize",
556
+ "vertcat", "waitpid", "warning", "warranty",
557
+ "whos_line_format", "yes_or_no", "zeros",
558
+ "inf", "Inf", "nan", "NaN"]
559
+
560
+ command_kw = [ "close", "load", "who", "whos", ]
561
+
562
+ function_kw = [ "accumarray", "accumdim", "acosd", "acotd",
563
+ "acscd", "addtodate", "allchild", "ancestor",
564
+ "anova", "arch_fit", "arch_rnd", "arch_test",
565
+ "area", "arma_rnd", "arrayfun", "ascii", "asctime",
566
+ "asecd", "asind", "assert", "atand",
567
+ "autoreg_matrix", "autumn", "axes", "axis", "bar",
568
+ "barh", "bartlett", "bartlett_test", "beep",
569
+ "betacdf", "betainv", "betapdf", "betarnd",
570
+ "bicgstab", "bicubic", "binary", "binocdf",
571
+ "binoinv", "binopdf", "binornd", "bitcmp",
572
+ "bitget", "bitset", "blackman", "blanks",
573
+ "blkdiag", "bone", "box", "brighten", "calendar",
574
+ "cast", "cauchy_cdf", "cauchy_inv", "cauchy_pdf",
575
+ "cauchy_rnd", "caxis", "celldisp", "center", "cgs",
576
+ "chisquare_test_homogeneity",
577
+ "chisquare_test_independence", "circshift", "cla",
578
+ "clabel", "clf", "clock", "cloglog", "closereq",
579
+ "colon", "colorbar", "colormap", "colperm",
580
+ "comet", "common_size", "commutation_matrix",
581
+ "compan", "compare_versions", "compass",
582
+ "computer", "cond", "condest", "contour",
583
+ "contourc", "contourf", "contrast", "conv",
584
+ "convhull", "cool", "copper", "copyfile", "cor",
585
+ "corrcoef", "cor_test", "cosd", "cotd", "cov",
586
+ "cplxpair", "cross", "cscd", "cstrcat", "csvread",
587
+ "csvwrite", "ctime", "cumtrapz", "curl", "cut",
588
+ "cylinder", "date", "datenum", "datestr",
589
+ "datetick", "datevec", "dblquad", "deal",
590
+ "deblank", "deconv", "delaunay", "delaunayn",
591
+ "delete", "demo", "detrend", "diffpara", "diffuse",
592
+ "dir", "discrete_cdf", "discrete_inv",
593
+ "discrete_pdf", "discrete_rnd", "display",
594
+ "divergence", "dlmwrite", "dos", "dsearch",
595
+ "dsearchn", "duplication_matrix", "durbinlevinson",
596
+ "ellipsoid", "empirical_cdf", "empirical_inv",
597
+ "empirical_pdf", "empirical_rnd", "eomday",
598
+ "errorbar", "etime", "etreeplot", "example",
599
+ "expcdf", "expinv", "expm", "exppdf", "exprnd",
600
+ "ezcontour", "ezcontourf", "ezmesh", "ezmeshc",
601
+ "ezplot", "ezpolar", "ezsurf", "ezsurfc", "factor",
602
+ "factorial", "fail", "fcdf", "feather", "fftconv",
603
+ "fftfilt", "fftshift", "figure", "fileattrib",
604
+ "fileparts", "fill", "findall", "findobj",
605
+ "findstr", "finv", "flag", "flipdim", "fliplr",
606
+ "flipud", "fpdf", "fplot", "fractdiff", "freqz",
607
+ "freqz_plot", "frnd", "fsolve",
608
+ "f_test_regression", "ftp", "fullfile", "fzero",
609
+ "gamcdf", "gaminv", "gampdf", "gamrnd", "gca",
610
+ "gcbf", "gcbo", "gcf", "genvarname", "geocdf",
611
+ "geoinv", "geopdf", "geornd", "getfield", "ginput",
612
+ "glpk", "gls", "gplot", "gradient",
613
+ "graphics_toolkit", "gray", "grid", "griddata",
614
+ "griddatan", "gtext", "gunzip", "gzip", "hadamard",
615
+ "hamming", "hankel", "hanning", "hggroup",
616
+ "hidden", "hilb", "hist", "histc", "hold", "hot",
617
+ "hotelling_test", "housh", "hsv", "hurst",
618
+ "hygecdf", "hygeinv", "hygepdf", "hygernd",
619
+ "idivide", "ifftshift", "image", "imagesc",
620
+ "imfinfo", "imread", "imshow", "imwrite", "index",
621
+ "info", "inpolygon", "inputname", "interpft",
622
+ "interpn", "intersect", "invhilb", "iqr", "isa",
623
+ "isdefinite", "isdir", "is_duplicate_entry",
624
+ "isequal", "isequalwithequalnans", "isfigure",
625
+ "ishermitian", "ishghandle", "is_leap_year",
626
+ "isletter", "ismac", "ismember", "ispc", "isprime",
627
+ "isprop", "isscalar", "issquare", "isstrprop",
628
+ "issymmetric", "isunix", "is_valid_file_id",
629
+ "isvector", "jet", "kendall",
630
+ "kolmogorov_smirnov_cdf",
631
+ "kolmogorov_smirnov_test", "kruskal_wallis_test",
632
+ "krylov", "kurtosis", "laplace_cdf", "laplace_inv",
633
+ "laplace_pdf", "laplace_rnd", "legend", "legendre",
634
+ "license", "line", "linkprop", "list_primes",
635
+ "loadaudio", "loadobj", "logistic_cdf",
636
+ "logistic_inv", "logistic_pdf", "logistic_rnd",
637
+ "logit", "loglog", "loglogerr", "logm", "logncdf",
638
+ "logninv", "lognpdf", "lognrnd", "logspace",
639
+ "lookfor", "ls_command", "lsqnonneg", "magic",
640
+ "mahalanobis", "manova", "matlabroot",
641
+ "mcnemar_test", "mean", "meansq", "median", "menu",
642
+ "mesh", "meshc", "meshgrid", "meshz", "mexext",
643
+ "mget", "mkpp", "mode", "moment", "movefile",
644
+ "mpoles", "mput", "namelengthmax", "nargchk",
645
+ "nargoutchk", "nbincdf", "nbininv", "nbinpdf",
646
+ "nbinrnd", "nchoosek", "ndgrid", "newplot", "news",
647
+ "nonzeros", "normcdf", "normest", "norminv",
648
+ "normpdf", "normrnd", "now", "nthroot", "null",
649
+ "ocean", "ols", "onenormest", "optimget",
650
+ "optimset", "orderfields", "orient", "orth",
651
+ "pack", "pareto", "parseparams", "pascal", "patch",
652
+ "pathdef", "pcg", "pchip", "pcolor", "pcr",
653
+ "peaks", "periodogram", "perl", "perms", "pie",
654
+ "pink", "planerot", "playaudio", "plot",
655
+ "plotmatrix", "plotyy", "poisscdf", "poissinv",
656
+ "poisspdf", "poissrnd", "polar", "poly",
657
+ "polyaffine", "polyarea", "polyderiv", "polyfit",
658
+ "polygcd", "polyint", "polyout", "polyreduce",
659
+ "polyval", "polyvalm", "postpad", "powerset",
660
+ "ppder", "ppint", "ppjumps", "ppplot", "ppval",
661
+ "pqpnonneg", "prepad", "primes", "print",
662
+ "print_usage", "prism", "probit", "qp", "qqplot",
663
+ "quadcc", "quadgk", "quadl", "quadv", "quiver",
664
+ "qzhess", "rainbow", "randi", "range", "rank",
665
+ "ranks", "rat", "reallog", "realpow", "realsqrt",
666
+ "record", "rectangle_lw", "rectangle_sw",
667
+ "rectint", "refresh", "refreshdata",
668
+ "regexptranslate", "repmat", "residue", "ribbon",
669
+ "rindex", "roots", "rose", "rosser", "rotdim",
670
+ "rref", "run", "run_count", "rundemos", "run_test",
671
+ "runtests", "saveas", "saveaudio", "saveobj",
672
+ "savepath", "scatter", "secd", "semilogx",
673
+ "semilogxerr", "semilogy", "semilogyerr",
674
+ "setaudio", "setdiff", "setfield", "setxor",
675
+ "shading", "shift", "shiftdim", "sign_test",
676
+ "sinc", "sind", "sinetone", "sinewave", "skewness",
677
+ "slice", "sombrero", "sortrows", "spaugment",
678
+ "spconvert", "spdiags", "spearman", "spectral_adf",
679
+ "spectral_xdf", "specular", "speed", "spencer",
680
+ "speye", "spfun", "sphere", "spinmap", "spline",
681
+ "spones", "sprand", "sprandn", "sprandsym",
682
+ "spring", "spstats", "spy", "sqp", "stairs",
683
+ "statistics", "std", "stdnormal_cdf",
684
+ "stdnormal_inv", "stdnormal_pdf", "stdnormal_rnd",
685
+ "stem", "stft", "strcat", "strchr", "strjust",
686
+ "strmatch", "strread", "strsplit", "strtok",
687
+ "strtrim", "strtrunc", "structfun", "studentize",
688
+ "subplot", "subsindex", "subspace", "substr",
689
+ "substruct", "summer", "surf", "surface", "surfc",
690
+ "surfl", "surfnorm", "svds", "swapbytes",
691
+ "sylvester_matrix", "symvar", "synthesis", "table",
692
+ "tand", "tar", "tcdf", "tempdir", "tempname",
693
+ "test", "text", "textread", "textscan", "tinv",
694
+ "title", "toeplitz", "tpdf", "trace", "trapz",
695
+ "treelayout", "treeplot", "triangle_lw",
696
+ "triangle_sw", "tril", "trimesh", "triplequad",
697
+ "triplot", "trisurf", "triu", "trnd", "tsearchn",
698
+ "t_test", "t_test_regression", "type", "unidcdf",
699
+ "unidinv", "unidpdf", "unidrnd", "unifcdf",
700
+ "unifinv", "unifpdf", "unifrnd", "union", "unique",
701
+ "unix", "unmkpp", "unpack", "untabify", "untar",
702
+ "unwrap", "unzip", "u_test", "validatestring",
703
+ "vander", "var", "var_test", "vech", "ver",
704
+ "version", "view", "voronoi", "voronoin",
705
+ "waitforbuttonpress", "wavread", "wavwrite",
706
+ "wblcdf", "wblinv", "wblpdf", "wblrnd", "weekday",
707
+ "welch_test", "what", "white", "whitebg",
708
+ "wienrnd", "wilcoxon_test", "wilkinson", "winter",
709
+ "xlabel", "xlim", "ylabel", "yulewalker", "zip",
710
+ "zlabel", "z_test", ]
711
+
712
+ loadable_kw = [ "airy", "amd", "balance", "besselh", "besseli",
713
+ "besselj", "besselk", "bessely", "bitpack",
714
+ "bsxfun", "builtin", "ccolamd", "cellfun",
715
+ "cellslices", "chol", "choldelete", "cholinsert",
716
+ "cholinv", "cholshift", "cholupdate", "colamd",
717
+ "colloc", "convhulln", "convn", "csymamd",
718
+ "cummax", "cummin", "daspk", "daspk_options",
719
+ "dasrt", "dasrt_options", "dassl", "dassl_options",
720
+ "dbclear", "dbdown", "dbstack", "dbstatus",
721
+ "dbstop", "dbtype", "dbup", "dbwhere", "det",
722
+ "dlmread", "dmperm", "dot", "eig", "eigs",
723
+ "endgrent", "endpwent", "etree", "fft", "fftn",
724
+ "fftw", "filter", "find", "full", "gcd",
725
+ "getgrent", "getgrgid", "getgrnam", "getpwent",
726
+ "getpwnam", "getpwuid", "getrusage", "givens",
727
+ "gmtime", "gnuplot_binary", "hess", "ifft",
728
+ "ifftn", "inv", "isdebugmode", "issparse", "kron",
729
+ "localtime", "lookup", "lsode", "lsode_options",
730
+ "lu", "luinc", "luupdate", "matrix_type", "max",
731
+ "min", "mktime", "pinv", "qr", "qrdelete",
732
+ "qrinsert", "qrshift", "qrupdate", "quad",
733
+ "quad_options", "qz", "rand", "rande", "randg",
734
+ "randn", "randp", "randperm", "rcond", "regexp",
735
+ "regexpi", "regexprep", "schur", "setgrent",
736
+ "setpwent", "sort", "spalloc", "sparse", "spparms",
737
+ "sprank", "sqrtm", "strfind", "strftime",
738
+ "strptime", "strrep", "svd", "svd_driver", "syl",
739
+ "symamd", "symbfact", "symrcm", "time", "tsearch",
740
+ "typecast", "urlread", "urlwrite", ]
741
+
742
+ mapping_kw = [ "abs", "acos", "acosh", "acot", "acoth", "acsc",
743
+ "acsch", "angle", "arg", "asec", "asech", "asin",
744
+ "asinh", "atan", "atanh", "beta", "betainc",
745
+ "betaln", "bincoeff", "cbrt", "ceil", "conj", "cos",
746
+ "cosh", "cot", "coth", "csc", "csch", "erf", "erfc",
747
+ "erfcx", "erfinv", "exp", "finite", "fix", "floor",
748
+ "fmod", "gamma", "gammainc", "gammaln", "imag",
749
+ "isalnum", "isalpha", "isascii", "iscntrl",
750
+ "isdigit", "isfinite", "isgraph", "isinf",
751
+ "islower", "isna", "isnan", "isprint", "ispunct",
752
+ "isspace", "isupper", "isxdigit", "lcm", "lgamma",
753
+ "log", "lower", "mod", "real", "rem", "round",
754
+ "roundb", "sec", "sech", "sign", "sin", "sinh",
755
+ "sqrt", "tan", "tanh", "toascii", "tolower", "xor",
756
+ ]
757
+
758
+ builtin_consts = [ "EDITOR", "EXEC_PATH", "I", "IMAGE_PATH", "NA",
759
+ "OCTAVE_HOME", "OCTAVE_VERSION", "PAGER",
760
+ "PAGER_FLAGS", "SEEK_CUR", "SEEK_END", "SEEK_SET",
761
+ "SIG", "S_ISBLK", "S_ISCHR", "S_ISDIR", "S_ISFIFO",
762
+ "S_ISLNK", "S_ISREG", "S_ISSOCK", "WCONTINUE",
763
+ "WCOREDUMP", "WEXITSTATUS", "WIFCONTINUED",
764
+ "WIFEXITED", "WIFSIGNALED", "WIFSTOPPED", "WNOHANG",
765
+ "WSTOPSIG", "WTERMSIG", "WUNTRACED", ]
766
+
767
+ tokens = {
768
+ 'root': [
769
+ #We should look into multiline comments
770
+ (r'[%#].*$', Comment),
771
+ (r'^\s*function', Keyword, 'deffunc'),
772
+
773
+ # from 'iskeyword' on hg changeset 8cc154f45e37
774
+ (r'(__FILE__|__LINE__|break|case|catch|classdef|continue|do|else|'
775
+ r'elseif|end|end_try_catch|end_unwind_protect|endclassdef|'
776
+ r'endevents|endfor|endfunction|endif|endmethods|endproperties|'
777
+ r'endswitch|endwhile|events|for|function|get|global|if|methods|'
778
+ r'otherwise|persistent|properties|return|set|static|switch|try|'
779
+ r'until|unwind_protect|unwind_protect_cleanup|while)\b', Keyword),
780
+
781
+ ("(" + "|".join( builtin_kw + command_kw
782
+ + function_kw + loadable_kw
783
+ + mapping_kw) + r')\b', Name.Builtin),
784
+
785
+ ("(" + "|".join(builtin_consts) + r')\b', Name.Constant),
786
+
787
+ # operators in Octave but not Matlab:
788
+ (r'-=|!=|!|/=|--', Operator),
789
+ # operators:
790
+ (r'-|==|~=|<|>|<=|>=|&&|&|~|\|\|?', Operator),
791
+ # operators in Octave but not Matlab requiring escape for re:
792
+ (r'\*=|\+=|\^=|\/=|\\=|\*\*|\+\+|\.\*\*',Operator),
793
+ # operators requiring escape for re:
794
+ (r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator),
795
+
796
+
797
+ # punctuation:
798
+ (r'\[|\]|\(|\)|\{|\}|:|@|\.|,', Punctuation),
799
+ (r'=|:|;', Punctuation),
800
+
801
+ (r'"[^"]*"', String),
802
+
803
+ (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
804
+ (r'\d+[eEf][+-]?[0-9]+', Number.Float),
805
+ (r'\d+', Number.Integer),
806
+
807
+ # quote can be transpose, instead of string:
808
+ # (not great, but handles common cases...)
809
+ (r'(?<=[\w\)\]])\'', Operator),
810
+ (r'(?<![\w\)\]])\'', String, 'string'),
811
+
812
+ ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
813
+ (r'.', Text),
814
+ ],
815
+ 'string': [
816
+ (r"[^']*'", String, '#pop'),
817
+ ],
818
+ 'deffunc': [
819
+ (r'(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)',
820
+ bygroups(Text.Whitespace, Text, Text.Whitespace, Punctuation,
821
+ Text.Whitespace, Name.Function, Punctuation, Text,
822
+ Punctuation, Text.Whitespace), '#pop'),
823
+ ],
824
+ }
825
+
826
+ def analyse_text(text):
827
+ if re.match('^\s*[%#]', text, re.M): #Comment
828
+ return 0.1
829
+
830
+
831
+ class ScilabLexer(RegexLexer):
832
+ """
833
+ For Scilab source code.
834
+
835
+ *New in Pygments 1.5.*
836
+ """
837
+ name = 'Scilab'
838
+ aliases = ['scilab']
839
+ filenames = ['*.sci', '*.sce', '*.tst']
840
+ mimetypes = ['text/scilab']
841
+
842
+ tokens = {
843
+ 'root': [
844
+ (r'//.*?$', Comment.Single),
845
+ (r'^\s*function', Keyword, 'deffunc'),
846
+
847
+ (r'(__FILE__|__LINE__|break|case|catch|classdef|continue|do|else|'
848
+ r'elseif|end|end_try_catch|end_unwind_protect|endclassdef|'
849
+ r'endevents|endfor|endfunction|endif|endmethods|endproperties|'
850
+ r'endswitch|endwhile|events|for|function|get|global|if|methods|'
851
+ r'otherwise|persistent|properties|return|set|static|switch|try|'
852
+ r'until|unwind_protect|unwind_protect_cleanup|while)\b', Keyword),
853
+
854
+ ("(" + "|".join(_scilab_builtins.functions_kw +
855
+ _scilab_builtins.commands_kw +
856
+ _scilab_builtins.macros_kw
857
+ ) + r')\b', Name.Builtin),
858
+
859
+ (r'(%s)\b' % "|".join(map(re.escape, _scilab_builtins.builtin_consts)),
860
+ Name.Constant),
861
+
862
+ # operators:
863
+ (r'-|==|~=|<|>|<=|>=|&&|&|~|\|\|?', Operator),
864
+ # operators requiring escape for re:
865
+ (r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator),
866
+
867
+ # punctuation:
868
+ (r'[\[\](){}@.,=:;]', Punctuation),
869
+
870
+ (r'"[^"]*"', String),
871
+
872
+ # quote can be transpose, instead of string:
873
+ # (not great, but handles common cases...)
874
+ (r'(?<=[\w\)\]])\'', Operator),
875
+ (r'(?<![\w\)\]])\'', String, 'string'),
876
+
877
+ (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
878
+ (r'\d+[eEf][+-]?[0-9]+', Number.Float),
879
+ (r'\d+', Number.Integer),
880
+
881
+ ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
882
+ (r'.', Text),
883
+ ],
884
+ 'string': [
885
+ (r"[^']*'", String, '#pop'),
886
+ (r'.', String, '#pop'),
887
+ ],
888
+ 'deffunc': [
889
+ (r'(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)',
890
+ bygroups(Text.Whitespace, Text, Text.Whitespace, Punctuation,
891
+ Text.Whitespace, Name.Function, Punctuation, Text,
892
+ Punctuation, Text.Whitespace), '#pop'),
893
+ ],
894
+ }
895
+
896
+
897
+ class NumPyLexer(PythonLexer):
898
+ """
899
+ A Python lexer recognizing Numerical Python builtins.
900
+
901
+ *New in Pygments 0.10.*
902
+ """
903
+
904
+ name = 'NumPy'
905
+ aliases = ['numpy']
906
+
907
+ # override the mimetypes to not inherit them from python
908
+ mimetypes = []
909
+ filenames = []
910
+
911
+ EXTRA_KEYWORDS = set([
912
+ 'abs', 'absolute', 'accumulate', 'add', 'alen', 'all', 'allclose',
913
+ 'alltrue', 'alterdot', 'amax', 'amin', 'angle', 'any', 'append',
914
+ 'apply_along_axis', 'apply_over_axes', 'arange', 'arccos', 'arccosh',
915
+ 'arcsin', 'arcsinh', 'arctan', 'arctan2', 'arctanh', 'argmax', 'argmin',
916
+ 'argsort', 'argwhere', 'around', 'array', 'array2string', 'array_equal',
917
+ 'array_equiv', 'array_repr', 'array_split', 'array_str', 'arrayrange',
918
+ 'asanyarray', 'asarray', 'asarray_chkfinite', 'ascontiguousarray',
919
+ 'asfarray', 'asfortranarray', 'asmatrix', 'asscalar', 'astype',
920
+ 'atleast_1d', 'atleast_2d', 'atleast_3d', 'average', 'bartlett',
921
+ 'base_repr', 'beta', 'binary_repr', 'bincount', 'binomial',
922
+ 'bitwise_and', 'bitwise_not', 'bitwise_or', 'bitwise_xor', 'blackman',
923
+ 'bmat', 'broadcast', 'byte_bounds', 'bytes', 'byteswap', 'c_',
924
+ 'can_cast', 'ceil', 'choose', 'clip', 'column_stack', 'common_type',
925
+ 'compare_chararrays', 'compress', 'concatenate', 'conj', 'conjugate',
926
+ 'convolve', 'copy', 'corrcoef', 'correlate', 'cos', 'cosh', 'cov',
927
+ 'cross', 'cumprod', 'cumproduct', 'cumsum', 'delete', 'deprecate',
928
+ 'diag', 'diagflat', 'diagonal', 'diff', 'digitize', 'disp', 'divide',
929
+ 'dot', 'dsplit', 'dstack', 'dtype', 'dump', 'dumps', 'ediff1d', 'empty',
930
+ 'empty_like', 'equal', 'exp', 'expand_dims', 'expm1', 'extract', 'eye',
931
+ 'fabs', 'fastCopyAndTranspose', 'fft', 'fftfreq', 'fftshift', 'fill',
932
+ 'finfo', 'fix', 'flat', 'flatnonzero', 'flatten', 'fliplr', 'flipud',
933
+ 'floor', 'floor_divide', 'fmod', 'frexp', 'fromarrays', 'frombuffer',
934
+ 'fromfile', 'fromfunction', 'fromiter', 'frompyfunc', 'fromstring',
935
+ 'generic', 'get_array_wrap', 'get_include', 'get_numarray_include',
936
+ 'get_numpy_include', 'get_printoptions', 'getbuffer', 'getbufsize',
937
+ 'geterr', 'geterrcall', 'geterrobj', 'getfield', 'gradient', 'greater',
938
+ 'greater_equal', 'gumbel', 'hamming', 'hanning', 'histogram',
939
+ 'histogram2d', 'histogramdd', 'hsplit', 'hstack', 'hypot', 'i0',
940
+ 'identity', 'ifft', 'imag', 'index_exp', 'indices', 'inf', 'info',
941
+ 'inner', 'insert', 'int_asbuffer', 'interp', 'intersect1d',
942
+ 'intersect1d_nu', 'inv', 'invert', 'iscomplex', 'iscomplexobj',
943
+ 'isfinite', 'isfortran', 'isinf', 'isnan', 'isneginf', 'isposinf',
944
+ 'isreal', 'isrealobj', 'isscalar', 'issctype', 'issubclass_',
945
+ 'issubdtype', 'issubsctype', 'item', 'itemset', 'iterable', 'ix_',
946
+ 'kaiser', 'kron', 'ldexp', 'left_shift', 'less', 'less_equal', 'lexsort',
947
+ 'linspace', 'load', 'loads', 'loadtxt', 'log', 'log10', 'log1p', 'log2',
948
+ 'logical_and', 'logical_not', 'logical_or', 'logical_xor', 'logspace',
949
+ 'lstsq', 'mat', 'matrix', 'max', 'maximum', 'maximum_sctype',
950
+ 'may_share_memory', 'mean', 'median', 'meshgrid', 'mgrid', 'min',
951
+ 'minimum', 'mintypecode', 'mod', 'modf', 'msort', 'multiply', 'nan',
952
+ 'nan_to_num', 'nanargmax', 'nanargmin', 'nanmax', 'nanmin', 'nansum',
953
+ 'ndenumerate', 'ndim', 'ndindex', 'negative', 'newaxis', 'newbuffer',
954
+ 'newbyteorder', 'nonzero', 'not_equal', 'obj2sctype', 'ogrid', 'ones',
955
+ 'ones_like', 'outer', 'permutation', 'piecewise', 'pinv', 'pkgload',
956
+ 'place', 'poisson', 'poly', 'poly1d', 'polyadd', 'polyder', 'polydiv',
957
+ 'polyfit', 'polyint', 'polymul', 'polysub', 'polyval', 'power', 'prod',
958
+ 'product', 'ptp', 'put', 'putmask', 'r_', 'randint', 'random_integers',
959
+ 'random_sample', 'ranf', 'rank', 'ravel', 'real', 'real_if_close',
960
+ 'recarray', 'reciprocal', 'reduce', 'remainder', 'repeat', 'require',
961
+ 'reshape', 'resize', 'restoredot', 'right_shift', 'rint', 'roll',
962
+ 'rollaxis', 'roots', 'rot90', 'round', 'round_', 'row_stack', 's_',
963
+ 'sample', 'savetxt', 'sctype2char', 'searchsorted', 'seed', 'select',
964
+ 'set_numeric_ops', 'set_printoptions', 'set_string_function',
965
+ 'setbufsize', 'setdiff1d', 'seterr', 'seterrcall', 'seterrobj',
966
+ 'setfield', 'setflags', 'setmember1d', 'setxor1d', 'shape',
967
+ 'show_config', 'shuffle', 'sign', 'signbit', 'sin', 'sinc', 'sinh',
968
+ 'size', 'slice', 'solve', 'sometrue', 'sort', 'sort_complex', 'source',
969
+ 'split', 'sqrt', 'square', 'squeeze', 'standard_normal', 'std',
970
+ 'subtract', 'sum', 'svd', 'swapaxes', 'take', 'tan', 'tanh', 'tensordot',
971
+ 'test', 'tile', 'tofile', 'tolist', 'tostring', 'trace', 'transpose',
972
+ 'trapz', 'tri', 'tril', 'trim_zeros', 'triu', 'true_divide', 'typeDict',
973
+ 'typename', 'uniform', 'union1d', 'unique', 'unique1d', 'unravel_index',
974
+ 'unwrap', 'vander', 'var', 'vdot', 'vectorize', 'view', 'vonmises',
975
+ 'vsplit', 'vstack', 'weibull', 'where', 'who', 'zeros', 'zeros_like'
976
+ ])
977
+
978
+ def get_tokens_unprocessed(self, text):
979
+ for index, token, value in \
980
+ PythonLexer.get_tokens_unprocessed(self, text):
981
+ if token is Name and value in self.EXTRA_KEYWORDS:
982
+ yield index, Keyword.Pseudo, value
983
+ else:
984
+ yield index, token, value
985
+
986
+ def analyse_text(text):
987
+ return (shebang_matches(text, r'pythonw?(2(\.\d)?)?') or
988
+ 'import ' in text[:1000]) \
989
+ and ('import numpy' in text or 'from numpy import' in text)
990
+
991
+
992
+ class RConsoleLexer(Lexer):
993
+ """
994
+ For R console transcripts or R CMD BATCH output files.
995
+ """
996
+
997
+ name = 'RConsole'
998
+ aliases = ['rconsole', 'rout']
999
+ filenames = ['*.Rout']
1000
+
1001
+ def get_tokens_unprocessed(self, text):
1002
+ slexer = SLexer(**self.options)
1003
+
1004
+ current_code_block = ''
1005
+ insertions = []
1006
+
1007
+ for match in line_re.finditer(text):
1008
+ line = match.group()
1009
+ if line.startswith('>') or line.startswith('+'):
1010
+ # Colorize the prompt as such,
1011
+ # then put rest of line into current_code_block
1012
+ insertions.append((len(current_code_block),
1013
+ [(0, Generic.Prompt, line[:2])]))
1014
+ current_code_block += line[2:]
1015
+ else:
1016
+ # We have reached a non-prompt line!
1017
+ # If we have stored prompt lines, need to process them first.
1018
+ if current_code_block:
1019
+ # Weave together the prompts and highlight code.
1020
+ for item in do_insertions(insertions,
1021
+ slexer.get_tokens_unprocessed(current_code_block)):
1022
+ yield item
1023
+ # Reset vars for next code block.
1024
+ current_code_block = ''
1025
+ insertions = []
1026
+ # Now process the actual line itself, this is output from R.
1027
+ yield match.start(), Generic.Output, line
1028
+
1029
+ # If we happen to end on a code block with nothing after it, need to
1030
+ # process the last code block. This is neither elegant nor DRY so
1031
+ # should be changed.
1032
+ if current_code_block:
1033
+ for item in do_insertions(insertions,
1034
+ slexer.get_tokens_unprocessed(current_code_block)):
1035
+ yield item
1036
+
1037
+
1038
+ class SLexer(RegexLexer):
1039
+ """
1040
+ For S, S-plus, and R source code.
1041
+
1042
+ *New in Pygments 0.10.*
1043
+ """
1044
+
1045
+ name = 'S'
1046
+ aliases = ['splus', 's', 'r']
1047
+ filenames = ['*.S', '*.R', '.Rhistory', '.Rprofile']
1048
+ mimetypes = ['text/S-plus', 'text/S', 'text/x-r-source', 'text/x-r',
1049
+ 'text/x-R', 'text/x-r-history', 'text/x-r-profile']
1050
+
1051
+ tokens = {
1052
+ 'comments': [
1053
+ (r'#.*$', Comment.Single),
1054
+ ],
1055
+ 'valid_name': [
1056
+ (r'[a-zA-Z][0-9a-zA-Z\._]*', Text),
1057
+ # can begin with ., but not if that is followed by a digit
1058
+ (r'\.[a-zA-Z_][0-9a-zA-Z\._]*', Text),
1059
+ ],
1060
+ 'punctuation': [
1061
+ (r'\[{1,2}|\]{1,2}|\(|\)|;|,', Punctuation),
1062
+ ],
1063
+ 'keywords': [
1064
+ (r'(if|else|for|while|repeat|in|next|break|return|switch|function)'
1065
+ r'(?![0-9a-zA-Z\._])',
1066
+ Keyword.Reserved)
1067
+ ],
1068
+ 'operators': [
1069
+ (r'<<?-|->>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|\?', Operator),
1070
+ (r'\*|\+|\^|/|!|%[^%]*%|=|~|\$|@|:{1,3}', Operator)
1071
+ ],
1072
+ 'builtin_symbols': [
1073
+ (r'(NULL|NA(_(integer|real|complex|character)_)?|'
1074
+ r'Inf|TRUE|FALSE|NaN|\.\.(\.|[0-9]+))'
1075
+ r'(?![0-9a-zA-Z\._])',
1076
+ Keyword.Constant),
1077
+ (r'(T|F)\b', Keyword.Variable),
1078
+ ],
1079
+ 'numbers': [
1080
+ # hex number
1081
+ (r'0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?', Number.Hex),
1082
+ # decimal number
1083
+ (r'[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?[Li]?',
1084
+ Number),
1085
+ ],
1086
+ 'statements': [
1087
+ include('comments'),
1088
+ # whitespaces
1089
+ (r'\s+', Text),
1090
+ (r'`.*?`', String.Backtick),
1091
+ (r'\'', String, 'string_squote'),
1092
+ (r'\"', String, 'string_dquote'),
1093
+ include('builtin_symbols'),
1094
+ include('numbers'),
1095
+ include('keywords'),
1096
+ include('punctuation'),
1097
+ include('operators'),
1098
+ include('valid_name'),
1099
+ ],
1100
+ 'root': [
1101
+ include('statements'),
1102
+ # blocks:
1103
+ (r'\{|\}', Punctuation),
1104
+ #(r'\{', Punctuation, 'block'),
1105
+ (r'.', Text),
1106
+ ],
1107
+ #'block': [
1108
+ # include('statements'),
1109
+ # ('\{', Punctuation, '#push'),
1110
+ # ('\}', Punctuation, '#pop')
1111
+ #],
1112
+ 'string_squote': [
1113
+ (r'([^\'\\]|\\.)*\'', String, '#pop'),
1114
+ ],
1115
+ 'string_dquote': [
1116
+ (r'([^"\\]|\\.)*"', String, '#pop'),
1117
+ ],
1118
+ }
1119
+
1120
+ def analyse_text(text):
1121
+ if re.search(r'[a-z0-9_\])\s]<-(?!-)', text):
1122
+ return 0.11
1123
+
1124
+
1125
+ class BugsLexer(RegexLexer):
1126
+ """
1127
+ Pygments Lexer for `OpenBugs <http://www.openbugs.info/w/>`_ and WinBugs
1128
+ models.
1129
+
1130
+ *New in Pygments 1.6.*
1131
+ """
1132
+
1133
+ name = 'BUGS'
1134
+ aliases = ['bugs', 'winbugs', 'openbugs']
1135
+ filenames = ['*.bug']
1136
+
1137
+ _FUNCTIONS = [
1138
+ # Scalar functions
1139
+ 'abs', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctanh',
1140
+ 'cloglog', 'cos', 'cosh', 'cumulative', 'cut', 'density', 'deviance',
1141
+ 'equals', 'expr', 'gammap', 'ilogit', 'icloglog', 'integral', 'log',
1142
+ 'logfact', 'loggam', 'logit', 'max', 'min', 'phi', 'post.p.value',
1143
+ 'pow', 'prior.p.value', 'probit', 'replicate.post', 'replicate.prior',
1144
+ 'round', 'sin', 'sinh', 'solution', 'sqrt', 'step', 'tan', 'tanh',
1145
+ 'trunc',
1146
+ # Vector functions
1147
+ 'inprod', 'interp.lin', 'inverse', 'logdet', 'mean', 'eigen.vals',
1148
+ 'ode', 'prod', 'p.valueM', 'rank', 'ranked', 'replicate.postM',
1149
+ 'sd', 'sort', 'sum',
1150
+ ## Special
1151
+ 'D', 'I', 'F', 'T', 'C']
1152
+ """ OpenBUGS built-in functions
1153
+
1154
+ From http://www.openbugs.info/Manuals/ModelSpecification.html#ContentsAII
1155
+
1156
+ This also includes
1157
+
1158
+ - T, C, I : Truncation and censoring.
1159
+ ``T`` and ``C`` are in OpenBUGS. ``I`` in WinBUGS.
1160
+ - D : ODE
1161
+ - F : Functional http://www.openbugs.info/Examples/Functionals.html
1162
+
1163
+ """
1164
+
1165
+ _DISTRIBUTIONS = ['dbern', 'dbin', 'dcat', 'dnegbin', 'dpois',
1166
+ 'dhyper', 'dbeta', 'dchisqr', 'ddexp', 'dexp',
1167
+ 'dflat', 'dgamma', 'dgev', 'df', 'dggamma', 'dgpar',
1168
+ 'dloglik', 'dlnorm', 'dlogis', 'dnorm', 'dpar',
1169
+ 'dt', 'dunif', 'dweib', 'dmulti', 'ddirch', 'dmnorm',
1170
+ 'dmt', 'dwish']
1171
+ """ OpenBUGS built-in distributions
1172
+
1173
+ Functions from
1174
+ http://www.openbugs.info/Manuals/ModelSpecification.html#ContentsAI
1175
+ """
1176
+
1177
+
1178
+ tokens = {
1179
+ 'whitespace' : [
1180
+ (r"\s+", Text),
1181
+ ],
1182
+ 'comments' : [
1183
+ # Comments
1184
+ (r'#.*$', Comment.Single),
1185
+ ],
1186
+ 'root': [
1187
+ # Comments
1188
+ include('comments'),
1189
+ include('whitespace'),
1190
+ # Block start
1191
+ (r'(model)(\s+)({)',
1192
+ bygroups(Keyword.Namespace, Text, Punctuation)),
1193
+ # Reserved Words
1194
+ (r'(for|in)(?![0-9a-zA-Z\._])', Keyword.Reserved),
1195
+ # Built-in Functions
1196
+ (r'(%s)(?=\s*\()'
1197
+ % r'|'.join(_FUNCTIONS + _DISTRIBUTIONS),
1198
+ Name.Builtin),
1199
+ # Regular variable names
1200
+ (r'[A-Za-z][A-Za-z0-9_.]*', Name),
1201
+ # Number Literals
1202
+ (r'[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?', Number),
1203
+ # Punctuation
1204
+ (r'\[|\]|\(|\)|:|,|;', Punctuation),
1205
+ # Assignment operators
1206
+ # SLexer makes these tokens Operators.
1207
+ (r'<-|~', Operator),
1208
+ # Infix and prefix operators
1209
+ (r'\+|-|\*|/', Operator),
1210
+ # Block
1211
+ (r'[{}]', Punctuation),
1212
+ ]
1213
+ }
1214
+
1215
+ def analyse_text(text):
1216
+ if re.search(r"^\s*model\s*{", text, re.M):
1217
+ return 0.7
1218
+ else:
1219
+ return 0.0
1220
+
1221
+ class JagsLexer(RegexLexer):
1222
+ """
1223
+ Pygments Lexer for JAGS.
1224
+
1225
+ *New in Pygments 1.6.*
1226
+ """
1227
+
1228
+ name = 'JAGS'
1229
+ aliases = ['jags']
1230
+ filenames = ['*.jag', '*.bug']
1231
+
1232
+ ## JAGS
1233
+ _FUNCTIONS = [
1234
+ 'abs', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctanh',
1235
+ 'cos', 'cosh', 'cloglog',
1236
+ 'equals', 'exp', 'icloglog', 'ifelse', 'ilogit', 'log', 'logfact',
1237
+ 'loggam', 'logit', 'phi', 'pow', 'probit', 'round', 'sin', 'sinh',
1238
+ 'sqrt', 'step', 'tan', 'tanh', 'trunc', 'inprod', 'interp.lin',
1239
+ 'logdet', 'max', 'mean', 'min', 'prod', 'sum', 'sd', 'inverse',
1240
+ 'rank', 'sort', 't', 'acos', 'acosh', 'asin', 'asinh', 'atan',
1241
+ # Truncation/Censoring (should I include)
1242
+ 'T', 'I']
1243
+ # Distributions with density, probability and quartile functions
1244
+ _DISTRIBUTIONS = ['[dpq]%s' % x for x in
1245
+ ['bern', 'beta', 'dchiqsqr', 'ddexp', 'dexp',
1246
+ 'df', 'gamma', 'gen.gamma', 'logis', 'lnorm',
1247
+ 'negbin', 'nchisqr', 'norm', 'par', 'pois', 'weib']]
1248
+ # Other distributions without density and probability
1249
+ _OTHER_DISTRIBUTIONS = [
1250
+ 'dt', 'dunif', 'dbetabin', 'dbern', 'dbin', 'dcat', 'dhyper',
1251
+ 'ddirch', 'dmnorm', 'dwish', 'dmt', 'dmulti', 'dbinom', 'dchisq',
1252
+ 'dnbinom', 'dweibull', 'ddirich']
1253
+
1254
+ tokens = {
1255
+ 'whitespace' : [
1256
+ (r"\s+", Text),
1257
+ ],
1258
+ 'names' : [
1259
+ # Regular variable names
1260
+ (r'[a-zA-Z][a-zA-Z0-9_.]*\b', Name),
1261
+ ],
1262
+ 'comments' : [
1263
+ # do not use stateful comments
1264
+ (r'(?s)/\*.*?\*/', Comment.Multiline),
1265
+ # Comments
1266
+ (r'#.*$', Comment.Single),
1267
+ ],
1268
+ 'root': [
1269
+ # Comments
1270
+ include('comments'),
1271
+ include('whitespace'),
1272
+ # Block start
1273
+ (r'(model|data)(\s+)({)',
1274
+ bygroups(Keyword.Namespace, Text, Punctuation)),
1275
+ (r'var(?![0-9a-zA-Z\._])', Keyword.Declaration),
1276
+ # Reserved Words
1277
+ (r'(for|in)(?![0-9a-zA-Z\._])', Keyword.Reserved),
1278
+ # Builtins
1279
+ # Need to use lookahead because . is a valid char
1280
+ (r'(%s)(?=\s*\()' % r'|'.join(_FUNCTIONS
1281
+ + _DISTRIBUTIONS
1282
+ + _OTHER_DISTRIBUTIONS),
1283
+ Name.Builtin),
1284
+ # Names
1285
+ include('names'),
1286
+ # Number Literals
1287
+ (r'[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?', Number),
1288
+ (r'\[|\]|\(|\)|:|,|;', Punctuation),
1289
+ # Assignment operators
1290
+ (r'<-|~', Operator),
1291
+ # # JAGS includes many more than OpenBUGS
1292
+ (r'\+|-|\*|\/|\|\|[&]{2}|[<>=]=?|\^|%.*?%', Operator),
1293
+ (r'[{}]', Punctuation),
1294
+ ]
1295
+ }
1296
+
1297
+ def analyse_text(text):
1298
+ if re.search(r'^\s*model\s*\{', text, re.M):
1299
+ if re.search(r'^\s*data\s*\{', text, re.M):
1300
+ return 0.9
1301
+ elif re.search(r'^\s*var', text, re.M):
1302
+ return 0.9
1303
+ else:
1304
+ return 0.3
1305
+ else:
1306
+ return 0
1307
+
1308
+ class StanLexer(RegexLexer):
1309
+ """Pygments Lexer for Stan models.
1310
+
1311
+ The Stan modeling language is specified in the *Stan 1.3.0
1312
+ Modeling Language Manual* `pdf
1313
+ <http://code.google.com/p/stan/downloads/detail?name=stan-reference-1.3.0.pdf>`_.
1314
+
1315
+ *New in Pygments 1.6.*
1316
+ """
1317
+
1318
+ name = 'Stan'
1319
+ aliases = ['stan']
1320
+ filenames = ['*.stan']
1321
+
1322
+ tokens = {
1323
+ 'whitespace' : [
1324
+ (r"\s+", Text),
1325
+ ],
1326
+ 'comments' : [
1327
+ (r'(?s)/\*.*?\*/', Comment.Multiline),
1328
+ # Comments
1329
+ (r'(//|#).*$', Comment.Single),
1330
+ ],
1331
+ 'root': [
1332
+ # Stan is more restrictive on strings than this regex
1333
+ (r'"[^"]*"', String),
1334
+ # Comments
1335
+ include('comments'),
1336
+ # block start
1337
+ include('whitespace'),
1338
+ # Block start
1339
+ (r'(%s)(\s*)({)' %
1340
+ r'|'.join(('data', r'transformed\s+?data',
1341
+ 'parameters', r'transformed\s+parameters',
1342
+ 'model', r'generated\s+quantities')),
1343
+ bygroups(Keyword.Namespace, Text, Punctuation)),
1344
+ # Reserved Words
1345
+ (r'(%s)\b' % r'|'.join(_stan_builtins.KEYWORDS), Keyword),
1346
+ # Truncation
1347
+ (r'T(?=\s*\[)', Keyword),
1348
+ # Data types
1349
+ (r'(%s)\b' % r'|'.join(_stan_builtins.TYPES), Keyword.Type),
1350
+ # Punctuation
1351
+ (r"[;:,\[\]()]", Punctuation),
1352
+ # Builtin
1353
+ (r'(%s)(?=\s*\()'
1354
+ % r'|'.join(_stan_builtins.FUNCTIONS
1355
+ + _stan_builtins.DISTRIBUTIONS),
1356
+ Name.Builtin),
1357
+ # Special names ending in __, like lp__
1358
+ (r'[A-Za-z][A-Za-z0-9_]*__\b', Name.Builtin.Pseudo),
1359
+ (r'(%s)\b' % r'|'.join(_stan_builtins.RESERVED), Keyword.Reserved),
1360
+ # Regular variable names
1361
+ (r'[A-Za-z][A-Za-z0-9_]*\b', Name),
1362
+ # Real Literals
1363
+ (r'-?[0-9]+(\.[0-9]+)?[eE]-?[0-9]+', Number.Float),
1364
+ (r'-?[0-9]*\.[0-9]*', Number.Float),
1365
+ # Integer Literals
1366
+ (r'-?[0-9]+', Number.Integer),
1367
+ # Assignment operators
1368
+ # SLexer makes these tokens Operators.
1369
+ (r'<-|~', Operator),
1370
+ # Infix and prefix operators (and = )
1371
+ (r"\+|-|\.?\*|\.?/|\\|'|==?|!=?|<=?|>=?|\|\||&&", Operator),
1372
+ # Block delimiters
1373
+ (r'[{}]', Punctuation),
1374
+ ]
1375
+ }
1376
+
1377
+ def analyse_text(text):
1378
+ if re.search(r'^\s*parameters\s*\{', text, re.M):
1379
+ return 1.0
1380
+ else:
1381
+ return 0.0
1382
+
1383
+
1384
+ class IDLLexer(RegexLexer):
1385
+ """
1386
+ Pygments Lexer for IDL (Interactive Data Language).
1387
+
1388
+ *New in Pygments 1.6.*
1389
+ """
1390
+ name = 'IDL'
1391
+ aliases = ['idl']
1392
+ filenames = ['*.pro']
1393
+ mimetypes = ['text/idl']
1394
+
1395
+ _RESERVED = ['and', 'begin', 'break', 'case', 'common', 'compile_opt',
1396
+ 'continue', 'do', 'else', 'end', 'endcase', 'elseelse',
1397
+ 'endfor', 'endforeach', 'endif', 'endrep', 'endswitch',
1398
+ 'endwhile', 'eq', 'for', 'foreach', 'forward_function',
1399
+ 'function', 'ge', 'goto', 'gt', 'if', 'inherits', 'le',
1400
+ 'lt', 'mod', 'ne', 'not', 'of', 'on_ioerror', 'or', 'pro',
1401
+ 'repeat', 'switch', 'then', 'until', 'while', 'xor']
1402
+ """Reserved words from: http://www.exelisvis.com/docs/reswords.html"""
1403
+
1404
+ _BUILTIN_LIB = ['abs', 'acos', 'adapt_hist_equal', 'alog', 'alog10',
1405
+ 'amoeba', 'annotate', 'app_user_dir', 'app_user_dir_query',
1406
+ 'arg_present', 'array_equal', 'array_indices', 'arrow',
1407
+ 'ascii_template', 'asin', 'assoc', 'atan', 'axis',
1408
+ 'a_correlate', 'bandpass_filter', 'bandreject_filter',
1409
+ 'barplot', 'bar_plot', 'beseli', 'beselj', 'beselk',
1410
+ 'besely', 'beta', 'bilinear', 'binary_template', 'bindgen',
1411
+ 'binomial', 'bin_date', 'bit_ffs', 'bit_population',
1412
+ 'blas_axpy', 'blk_con', 'box_cursor', 'breakpoint',
1413
+ 'broyden', 'butterworth', 'bytarr', 'byte', 'byteorder',
1414
+ 'bytscl', 'caldat', 'calendar', 'call_external',
1415
+ 'call_function', 'call_method', 'call_procedure', 'canny',
1416
+ 'catch', 'cd', 'cdf_[0-9a-za-z_]*', 'ceil', 'chebyshev',
1417
+ 'check_math',
1418
+ 'chisqr_cvf', 'chisqr_pdf', 'choldc', 'cholsol', 'cindgen',
1419
+ 'cir_3pnt', 'close', 'cluster', 'cluster_tree', 'clust_wts',
1420
+ 'cmyk_convert', 'colorbar', 'colorize_sample',
1421
+ 'colormap_applicable', 'colormap_gradient',
1422
+ 'colormap_rotation', 'colortable', 'color_convert',
1423
+ 'color_exchange', 'color_quan', 'color_range_map', 'comfit',
1424
+ 'command_line_args', 'complex', 'complexarr', 'complexround',
1425
+ 'compute_mesh_normals', 'cond', 'congrid', 'conj',
1426
+ 'constrained_min', 'contour', 'convert_coord', 'convol',
1427
+ 'convol_fft', 'coord2to3', 'copy_lun', 'correlate', 'cos',
1428
+ 'cosh', 'cpu', 'cramer', 'create_cursor', 'create_struct',
1429
+ 'create_view', 'crossp', 'crvlength', 'cti_test',
1430
+ 'ct_luminance', 'cursor', 'curvefit', 'cvttobm', 'cv_coord',
1431
+ 'cw_animate', 'cw_animate_getp', 'cw_animate_load',
1432
+ 'cw_animate_run', 'cw_arcball', 'cw_bgroup', 'cw_clr_index',
1433
+ 'cw_colorsel', 'cw_defroi', 'cw_field', 'cw_filesel',
1434
+ 'cw_form', 'cw_fslider', 'cw_light_editor',
1435
+ 'cw_light_editor_get', 'cw_light_editor_set', 'cw_orient',
1436
+ 'cw_palette_editor', 'cw_palette_editor_get',
1437
+ 'cw_palette_editor_set', 'cw_pdmenu', 'cw_rgbslider',
1438
+ 'cw_tmpl', 'cw_zoom', 'c_correlate', 'dblarr', 'db_exists',
1439
+ 'dcindgen', 'dcomplex', 'dcomplexarr', 'define_key',
1440
+ 'define_msgblk', 'define_msgblk_from_file', 'defroi',
1441
+ 'defsysv', 'delvar', 'dendrogram', 'dendro_plot', 'deriv',
1442
+ 'derivsig', 'determ', 'device', 'dfpmin', 'diag_matrix',
1443
+ 'dialog_dbconnect', 'dialog_message', 'dialog_pickfile',
1444
+ 'dialog_printersetup', 'dialog_printjob',
1445
+ 'dialog_read_image', 'dialog_write_image', 'digital_filter',
1446
+ 'dilate', 'dindgen', 'dissolve', 'dist', 'distance_measure',
1447
+ 'dlm_load', 'dlm_register', 'doc_library', 'double',
1448
+ 'draw_roi', 'edge_dog', 'efont', 'eigenql', 'eigenvec',
1449
+ 'ellipse', 'elmhes', 'emboss', 'empty', 'enable_sysrtn',
1450
+ 'eof', 'eos_[0-9a-za-z_]*', 'erase', 'erf', 'erfc', 'erfcx',
1451
+ 'erode', 'errorplot', 'errplot', 'estimator_filter',
1452
+ 'execute', 'exit', 'exp', 'expand', 'expand_path', 'expint',
1453
+ 'extrac', 'extract_slice', 'factorial', 'fft', 'filepath',
1454
+ 'file_basename', 'file_chmod', 'file_copy', 'file_delete',
1455
+ 'file_dirname', 'file_expand_path', 'file_info',
1456
+ 'file_lines', 'file_link', 'file_mkdir', 'file_move',
1457
+ 'file_poll_input', 'file_readlink', 'file_same',
1458
+ 'file_search', 'file_test', 'file_which', 'findgen',
1459
+ 'finite', 'fix', 'flick', 'float', 'floor', 'flow3',
1460
+ 'fltarr', 'flush', 'format_axis_values', 'free_lun',
1461
+ 'fstat', 'fulstr', 'funct', 'fv_test', 'fx_root',
1462
+ 'fz_roots', 'f_cvf', 'f_pdf', 'gamma', 'gamma_ct',
1463
+ 'gauss2dfit', 'gaussfit', 'gaussian_function', 'gaussint',
1464
+ 'gauss_cvf', 'gauss_pdf', 'gauss_smooth', 'getenv',
1465
+ 'getwindows', 'get_drive_list', 'get_dxf_objects',
1466
+ 'get_kbrd', 'get_login_info', 'get_lun', 'get_screen_size',
1467
+ 'greg2jul', 'grib_[0-9a-za-z_]*', 'grid3', 'griddata',
1468
+ 'grid_input', 'grid_tps', 'gs_iter',
1469
+ 'h5[adfgirst]_[0-9a-za-z_]*', 'h5_browser', 'h5_close',
1470
+ 'h5_create', 'h5_get_libversion', 'h5_open', 'h5_parse',
1471
+ 'hanning', 'hash', 'hdf_[0-9a-za-z_]*', 'heap_free',
1472
+ 'heap_gc', 'heap_nosave', 'heap_refcount', 'heap_save',
1473
+ 'help', 'hilbert', 'histogram', 'hist_2d', 'hist_equal',
1474
+ 'hls', 'hough', 'hqr', 'hsv', 'h_eq_ct', 'h_eq_int',
1475
+ 'i18n_multibytetoutf8', 'i18n_multibytetowidechar',
1476
+ 'i18n_utf8tomultibyte', 'i18n_widechartomultibyte',
1477
+ 'ibeta', 'icontour', 'iconvertcoord', 'idelete', 'identity',
1478
+ 'idlexbr_assistant', 'idlitsys_createtool', 'idl_base64',
1479
+ 'idl_validname', 'iellipse', 'igamma', 'igetcurrent',
1480
+ 'igetdata', 'igetid', 'igetproperty', 'iimage', 'image',
1481
+ 'image_cont', 'image_statistics', 'imaginary', 'imap',
1482
+ 'indgen', 'intarr', 'interpol', 'interpolate',
1483
+ 'interval_volume', 'int_2d', 'int_3d', 'int_tabulated',
1484
+ 'invert', 'ioctl', 'iopen', 'iplot', 'ipolygon',
1485
+ 'ipolyline', 'iputdata', 'iregister', 'ireset', 'iresolve',
1486
+ 'irotate', 'ir_filter', 'isa', 'isave', 'iscale',
1487
+ 'isetcurrent', 'isetproperty', 'ishft', 'isocontour',
1488
+ 'isosurface', 'isurface', 'itext', 'itranslate', 'ivector',
1489
+ 'ivolume', 'izoom', 'i_beta', 'journal', 'json_parse',
1490
+ 'json_serialize', 'jul2greg', 'julday', 'keyword_set',
1491
+ 'krig2d', 'kurtosis', 'kw_test', 'l64indgen', 'label_date',
1492
+ 'label_region', 'ladfit', 'laguerre', 'laplacian',
1493
+ 'la_choldc', 'la_cholmprove', 'la_cholsol', 'la_determ',
1494
+ 'la_eigenproblem', 'la_eigenql', 'la_eigenvec', 'la_elmhes',
1495
+ 'la_gm_linear_model', 'la_hqr', 'la_invert',
1496
+ 'la_least_squares', 'la_least_square_equality',
1497
+ 'la_linear_equation', 'la_ludc', 'la_lumprove', 'la_lusol',
1498
+ 'la_svd', 'la_tridc', 'la_trimprove', 'la_triql',
1499
+ 'la_trired', 'la_trisol', 'least_squares_filter', 'leefilt',
1500
+ 'legend', 'legendre', 'linbcg', 'lindgen', 'linfit',
1501
+ 'linkimage', 'list', 'll_arc_distance', 'lmfit', 'lmgr',
1502
+ 'lngamma', 'lnp_test', 'loadct', 'locale_get',
1503
+ 'logical_and', 'logical_or', 'logical_true', 'lon64arr',
1504
+ 'lonarr', 'long', 'long64', 'lsode', 'ludc', 'lumprove',
1505
+ 'lusol', 'lu_complex', 'machar', 'make_array', 'make_dll',
1506
+ 'make_rt', 'map', 'mapcontinents', 'mapgrid', 'map_2points',
1507
+ 'map_continents', 'map_grid', 'map_image', 'map_patch',
1508
+ 'map_proj_forward', 'map_proj_image', 'map_proj_info',
1509
+ 'map_proj_init', 'map_proj_inverse', 'map_set',
1510
+ 'matrix_multiply', 'matrix_power', 'max', 'md_test',
1511
+ 'mean', 'meanabsdev', 'mean_filter', 'median', 'memory',
1512
+ 'mesh_clip', 'mesh_decimate', 'mesh_issolid', 'mesh_merge',
1513
+ 'mesh_numtriangles', 'mesh_obj', 'mesh_smooth',
1514
+ 'mesh_surfacearea', 'mesh_validate', 'mesh_volume',
1515
+ 'message', 'min', 'min_curve_surf', 'mk_html_help',
1516
+ 'modifyct', 'moment', 'morph_close', 'morph_distance',
1517
+ 'morph_gradient', 'morph_hitormiss', 'morph_open',
1518
+ 'morph_thin', 'morph_tophat', 'multi', 'm_correlate',
1519
+ 'ncdf_[0-9a-za-z_]*', 'newton', 'noise_hurl', 'noise_pick',
1520
+ 'noise_scatter', 'noise_slur', 'norm', 'n_elements',
1521
+ 'n_params', 'n_tags', 'objarr', 'obj_class', 'obj_destroy',
1522
+ 'obj_hasmethod', 'obj_isa', 'obj_new', 'obj_valid',
1523
+ 'online_help', 'on_error', 'open', 'oplot', 'oploterr',
1524
+ 'parse_url', 'particle_trace', 'path_cache', 'path_sep',
1525
+ 'pcomp', 'plot', 'plot3d', 'ploterr', 'plots', 'plot_3dbox',
1526
+ 'plot_field', 'pnt_line', 'point_lun', 'polarplot',
1527
+ 'polar_contour', 'polar_surface', 'poly', 'polyfill',
1528
+ 'polyfillv', 'polygon', 'polyline', 'polyshade', 'polywarp',
1529
+ 'poly_2d', 'poly_area', 'poly_fit', 'popd', 'powell',
1530
+ 'pref_commit', 'pref_get', 'pref_set', 'prewitt', 'primes',
1531
+ 'print', 'printd', 'product', 'profile', 'profiler',
1532
+ 'profiles', 'project_vol', 'psafm', 'pseudo',
1533
+ 'ps_show_fonts', 'ptrarr', 'ptr_free', 'ptr_new',
1534
+ 'ptr_valid', 'pushd', 'p_correlate', 'qgrid3', 'qhull',
1535
+ 'qromb', 'qromo', 'qsimp', 'query_ascii', 'query_bmp',
1536
+ 'query_csv', 'query_dicom', 'query_gif', 'query_image',
1537
+ 'query_jpeg', 'query_jpeg2000', 'query_mrsid', 'query_pict',
1538
+ 'query_png', 'query_ppm', 'query_srf', 'query_tiff',
1539
+ 'query_wav', 'radon', 'randomn', 'randomu', 'ranks',
1540
+ 'rdpix', 'read', 'reads', 'readu', 'read_ascii',
1541
+ 'read_binary', 'read_bmp', 'read_csv', 'read_dicom',
1542
+ 'read_gif', 'read_image', 'read_interfile', 'read_jpeg',
1543
+ 'read_jpeg2000', 'read_mrsid', 'read_pict', 'read_png',
1544
+ 'read_ppm', 'read_spr', 'read_srf', 'read_sylk',
1545
+ 'read_tiff', 'read_wav', 'read_wave', 'read_x11_bitmap',
1546
+ 'read_xwd', 'real_part', 'rebin', 'recall_commands',
1547
+ 'recon3', 'reduce_colors', 'reform', 'region_grow',
1548
+ 'register_cursor', 'regress', 'replicate',
1549
+ 'replicate_inplace', 'resolve_all', 'resolve_routine',
1550
+ 'restore', 'retall', 'return', 'reverse', 'rk4', 'roberts',
1551
+ 'rot', 'rotate', 'round', 'routine_filepath',
1552
+ 'routine_info', 'rs_test', 'r_correlate', 'r_test',
1553
+ 'save', 'savgol', 'scale3', 'scale3d', 'scope_level',
1554
+ 'scope_traceback', 'scope_varfetch', 'scope_varname',
1555
+ 'search2d', 'search3d', 'sem_create', 'sem_delete',
1556
+ 'sem_lock', 'sem_release', 'setenv', 'set_plot',
1557
+ 'set_shading', 'sfit', 'shade_surf', 'shade_surf_irr',
1558
+ 'shade_volume', 'shift', 'shift_diff', 'shmdebug', 'shmmap',
1559
+ 'shmunmap', 'shmvar', 'show3', 'showfont', 'simplex', 'sin',
1560
+ 'sindgen', 'sinh', 'size', 'skewness', 'skip_lun',
1561
+ 'slicer3', 'slide_image', 'smooth', 'sobel', 'socket',
1562
+ 'sort', 'spawn', 'spher_harm', 'sph_4pnt', 'sph_scat',
1563
+ 'spline', 'spline_p', 'spl_init', 'spl_interp', 'sprsab',
1564
+ 'sprsax', 'sprsin', 'sprstp', 'sqrt', 'standardize',
1565
+ 'stddev', 'stop', 'strarr', 'strcmp', 'strcompress',
1566
+ 'streamline', 'stregex', 'stretch', 'string', 'strjoin',
1567
+ 'strlen', 'strlowcase', 'strmatch', 'strmessage', 'strmid',
1568
+ 'strpos', 'strput', 'strsplit', 'strtrim', 'struct_assign',
1569
+ 'struct_hide', 'strupcase', 'surface', 'surfr', 'svdc',
1570
+ 'svdfit', 'svsol', 'swap_endian', 'swap_endian_inplace',
1571
+ 'symbol', 'systime', 's_test', 't3d', 'tag_names', 'tan',
1572
+ 'tanh', 'tek_color', 'temporary', 'tetra_clip',
1573
+ 'tetra_surface', 'tetra_volume', 'text', 'thin', 'threed',
1574
+ 'timegen', 'time_test2', 'tm_test', 'total', 'trace',
1575
+ 'transpose', 'triangulate', 'trigrid', 'triql', 'trired',
1576
+ 'trisol', 'tri_surf', 'truncate_lun', 'ts_coef', 'ts_diff',
1577
+ 'ts_fcast', 'ts_smooth', 'tv', 'tvcrs', 'tvlct', 'tvrd',
1578
+ 'tvscl', 'typename', 't_cvt', 't_pdf', 'uindgen', 'uint',
1579
+ 'uintarr', 'ul64indgen', 'ulindgen', 'ulon64arr', 'ulonarr',
1580
+ 'ulong', 'ulong64', 'uniq', 'unsharp_mask', 'usersym',
1581
+ 'value_locate', 'variance', 'vector', 'vector_field', 'vel',
1582
+ 'velovect', 'vert_t3d', 'voigt', 'voronoi', 'voxel_proj',
1583
+ 'wait', 'warp_tri', 'watershed', 'wdelete', 'wf_draw',
1584
+ 'where', 'widget_base', 'widget_button', 'widget_combobox',
1585
+ 'widget_control', 'widget_displaycontextmen', 'widget_draw',
1586
+ 'widget_droplist', 'widget_event', 'widget_info',
1587
+ 'widget_label', 'widget_list', 'widget_propertysheet',
1588
+ 'widget_slider', 'widget_tab', 'widget_table',
1589
+ 'widget_text', 'widget_tree', 'widget_tree_move',
1590
+ 'widget_window', 'wiener_filter', 'window', 'writeu',
1591
+ 'write_bmp', 'write_csv', 'write_gif', 'write_image',
1592
+ 'write_jpeg', 'write_jpeg2000', 'write_nrif', 'write_pict',
1593
+ 'write_png', 'write_ppm', 'write_spr', 'write_srf',
1594
+ 'write_sylk', 'write_tiff', 'write_wav', 'write_wave',
1595
+ 'wset', 'wshow', 'wtn', 'wv_applet', 'wv_cwt',
1596
+ 'wv_cw_wavelet', 'wv_denoise', 'wv_dwt', 'wv_fn_coiflet',
1597
+ 'wv_fn_daubechies', 'wv_fn_gaussian', 'wv_fn_haar',
1598
+ 'wv_fn_morlet', 'wv_fn_paul', 'wv_fn_symlet',
1599
+ 'wv_import_data', 'wv_import_wavelet', 'wv_plot3d_wps',
1600
+ 'wv_plot_multires', 'wv_pwt', 'wv_tool_denoise',
1601
+ 'xbm_edit', 'xdisplayfile', 'xdxf', 'xfont',
1602
+ 'xinteranimate', 'xloadct', 'xmanager', 'xmng_tmpl',
1603
+ 'xmtool', 'xobjview', 'xobjview_rotate',
1604
+ 'xobjview_write_image', 'xpalette', 'xpcolor', 'xplot3d',
1605
+ 'xregistered', 'xroi', 'xsq_test', 'xsurface', 'xvaredit',
1606
+ 'xvolume', 'xvolume_rotate', 'xvolume_write_image',
1607
+ 'xyouts', 'zoom', 'zoom_24']
1608
+ """Functions from: http://www.exelisvis.com/docs/routines-1.html"""
1609
+
1610
+ tokens = {
1611
+ 'root': [
1612
+ (r'^\s*;.*?\n', Comment.Singleline),
1613
+ (r'\b(' + '|'.join(_RESERVED) + r')\b', Keyword),
1614
+ (r'\b(' + '|'.join(_BUILTIN_LIB) + r')\b', Name.Builtin),
1615
+ (r'\+=|-=|\^=|\*=|/=|#=|##=|<=|>=|=', Operator),
1616
+ (r'\+\+|--|->|\+|-|##|#|\*|/|<|>|&&|\^|~|\|\|\?|:', Operator),
1617
+ (r'\b(mod=|lt=|le=|eq=|ne=|ge=|gt=|not=|and=|or=|xor=)', Operator),
1618
+ (r'\b(mod|lt|le|eq|ne|ge|gt|not|and|or|xor)\b', Operator),
1619
+ (r'\b[0-9](L|B|S|UL|ULL|LL)?\b', Number),
1620
+ (r'.', Text),
1621
+ ]
1622
+ }
1623
+
1624
+
1625
+ class RdLexer(RegexLexer):
1626
+ """
1627
+ Pygments Lexer for R documentation (Rd) files
1628
+
1629
+ This is a very minimal implementation, highlighting little more
1630
+ than the macros. A description of Rd syntax is found in `Writing R
1631
+ Extensions <http://cran.r-project.org/doc/manuals/R-exts.html>`_
1632
+ and `Parsing Rd files <developer.r-project.org/parseRd.pdf>`_.
1633
+
1634
+ *New in Pygments 1.6.*
1635
+ """
1636
+ name = 'Rd'
1637
+ aliases = ['rd']
1638
+ filenames = ['*.Rd']
1639
+ mimetypes = ['text/x-r-doc']
1640
+
1641
+ # To account for verbatim / LaTeX-like / and R-like areas
1642
+ # would require parsing.
1643
+ tokens = {
1644
+ 'root' : [
1645
+ # catch escaped brackets and percent sign
1646
+ (r'\\[\\{}%]', String.Escape),
1647
+ # comments
1648
+ (r'%.*$', Comment),
1649
+ # special macros with no arguments
1650
+ (r'\\(?:cr|l?dots|R|tab)\b', Keyword.Constant),
1651
+ # macros
1652
+ (r'\\[a-zA-Z]+\b', Keyword),
1653
+ # special preprocessor macros
1654
+ (r'^\s*#(?:ifn?def|endif).*\b', Comment.Preproc),
1655
+ # non-escaped brackets
1656
+ (r'[{}]', Name.Builtin),
1657
+ # everything else
1658
+ (r'[^\\%\n{}]+', Text),
1659
+ (r'.', Text),
1660
+ ]
1661
+ }
1662
+
1663
+
1664
+ class IgorLexer(RegexLexer):
1665
+ """
1666
+ Pygments Lexer for Igor Pro procedure files (.ipf).
1667
+ See http://www.wavemetrics.com/ and http://www.igorexchange.com/.
1668
+
1669
+ *New in Pygments 1.7.*
1670
+ """
1671
+
1672
+ name = 'Igor'
1673
+ aliases = ['igor', 'igorpro']
1674
+ filenames = ['*.ipf']
1675
+ mimetypes = ['text/ipf']
1676
+
1677
+ flags = re.IGNORECASE
1678
+
1679
+ flowControl = [
1680
+ 'if', 'else', 'elseif', 'endif', 'for', 'endfor', 'strswitch', 'switch',
1681
+ 'case', 'endswitch', 'do', 'while', 'try', 'catch', 'endtry', 'break',
1682
+ 'continue', 'return',
1683
+ ]
1684
+ types = [
1685
+ 'variable', 'string', 'constant', 'strconstant', 'NVAR', 'SVAR', 'WAVE',
1686
+ 'STRUCT', 'ThreadSafe', 'function', 'end', 'static', 'macro', 'window',
1687
+ 'graph', 'Structure', 'EndStructure', 'EndMacro', 'FuncFit', 'Proc',
1688
+ 'Picture', 'Menu', 'SubMenu', 'Prompt', 'DoPrompt',
1689
+ ]
1690
+ operations = [
1691
+ 'Abort', 'AddFIFOData', 'AddFIFOVectData', 'AddMovieAudio',
1692
+ 'AddMovieFrame', 'APMath', 'Append', 'AppendImage',
1693
+ 'AppendLayoutObject', 'AppendMatrixContour', 'AppendText',
1694
+ 'AppendToGraph', 'AppendToLayout', 'AppendToTable', 'AppendXYZContour',
1695
+ 'AutoPositionWindow', 'BackgroundInfo', 'Beep', 'BoundingBall',
1696
+ 'BrowseURL', 'BuildMenu', 'Button', 'cd', 'Chart', 'CheckBox',
1697
+ 'CheckDisplayed', 'ChooseColor', 'Close', 'CloseMovie', 'CloseProc',
1698
+ 'ColorScale', 'ColorTab2Wave', 'Concatenate', 'ControlBar',
1699
+ 'ControlInfo', 'ControlUpdate', 'ConvexHull', 'Convolve', 'CopyFile',
1700
+ 'CopyFolder', 'CopyScales', 'Correlate', 'CreateAliasShortcut', 'Cross',
1701
+ 'CtrlBackground', 'CtrlFIFO', 'CtrlNamedBackground', 'Cursor',
1702
+ 'CurveFit', 'CustomControl', 'CWT', 'Debugger', 'DebuggerOptions',
1703
+ 'DefaultFont', 'DefaultGuiControls', 'DefaultGuiFont', 'DefineGuide',
1704
+ 'DelayUpdate', 'DeleteFile', 'DeleteFolder', 'DeletePoints',
1705
+ 'Differentiate', 'dir', 'Display', 'DisplayHelpTopic',
1706
+ 'DisplayProcedure', 'DoAlert', 'DoIgorMenu', 'DoUpdate', 'DoWindow',
1707
+ 'DoXOPIdle', 'DrawAction', 'DrawArc', 'DrawBezier', 'DrawLine',
1708
+ 'DrawOval', 'DrawPICT', 'DrawPoly', 'DrawRect', 'DrawRRect', 'DrawText',
1709
+ 'DSPDetrend', 'DSPPeriodogram', 'Duplicate', 'DuplicateDataFolder',
1710
+ 'DWT', 'EdgeStats', 'Edit', 'ErrorBars', 'Execute', 'ExecuteScriptText',
1711
+ 'ExperimentModified', 'Extract', 'FastGaussTransform', 'FastOp',
1712
+ 'FBinRead', 'FBinWrite', 'FFT', 'FIFO2Wave', 'FIFOStatus', 'FilterFIR',
1713
+ 'FilterIIR', 'FindLevel', 'FindLevels', 'FindPeak', 'FindPointsInPoly',
1714
+ 'FindRoots', 'FindSequence', 'FindValue', 'FPClustering', 'fprintf',
1715
+ 'FReadLine', 'FSetPos', 'FStatus', 'FTPDelete', 'FTPDownload',
1716
+ 'FTPUpload', 'FuncFit', 'FuncFitMD', 'GetAxis', 'GetFileFolderInfo',
1717
+ 'GetLastUserMenuInfo', 'GetMarquee', 'GetSelection', 'GetWindow',
1718
+ 'GraphNormal', 'GraphWaveDraw', 'GraphWaveEdit', 'Grep', 'GroupBox',
1719
+ 'Hanning', 'HideIgorMenus', 'HideInfo', 'HideProcedures', 'HideTools',
1720
+ 'HilbertTransform', 'Histogram', 'IFFT', 'ImageAnalyzeParticles',
1721
+ 'ImageBlend', 'ImageBoundaryToMask', 'ImageEdgeDetection',
1722
+ 'ImageFileInfo', 'ImageFilter', 'ImageFocus', 'ImageGenerateROIMask',
1723
+ 'ImageHistModification', 'ImageHistogram', 'ImageInterpolate',
1724
+ 'ImageLineProfile', 'ImageLoad', 'ImageMorphology', 'ImageRegistration',
1725
+ 'ImageRemoveBackground', 'ImageRestore', 'ImageRotate', 'ImageSave',
1726
+ 'ImageSeedFill', 'ImageSnake', 'ImageStats', 'ImageThreshold',
1727
+ 'ImageTransform', 'ImageUnwrapPhase', 'ImageWindow', 'IndexSort',
1728
+ 'InsertPoints', 'Integrate', 'IntegrateODE', 'Interp3DPath',
1729
+ 'Interpolate3D', 'KillBackground', 'KillControl', 'KillDataFolder',
1730
+ 'KillFIFO', 'KillFreeAxis', 'KillPath', 'KillPICTs', 'KillStrings',
1731
+ 'KillVariables', 'KillWaves', 'KillWindow', 'KMeans', 'Label', 'Layout',
1732
+ 'Legend', 'LinearFeedbackShiftRegister', 'ListBox', 'LoadData',
1733
+ 'LoadPackagePreferences', 'LoadPICT', 'LoadWave', 'Loess',
1734
+ 'LombPeriodogram', 'Make', 'MakeIndex', 'MarkPerfTestTime',
1735
+ 'MatrixConvolve', 'MatrixCorr', 'MatrixEigenV', 'MatrixFilter',
1736
+ 'MatrixGaussJ', 'MatrixInverse', 'MatrixLinearSolve',
1737
+ 'MatrixLinearSolveTD', 'MatrixLLS', 'MatrixLUBkSub', 'MatrixLUD',
1738
+ 'MatrixMultiply', 'MatrixOP', 'MatrixSchur', 'MatrixSolve',
1739
+ 'MatrixSVBkSub', 'MatrixSVD', 'MatrixTranspose', 'MeasureStyledText',
1740
+ 'Modify', 'ModifyContour', 'ModifyControl', 'ModifyControlList',
1741
+ 'ModifyFreeAxis', 'ModifyGraph', 'ModifyImage', 'ModifyLayout',
1742
+ 'ModifyPanel', 'ModifyTable', 'ModifyWaterfall', 'MoveDataFolder',
1743
+ 'MoveFile', 'MoveFolder', 'MoveString', 'MoveSubwindow', 'MoveVariable',
1744
+ 'MoveWave', 'MoveWindow', 'NeuralNetworkRun', 'NeuralNetworkTrain',
1745
+ 'NewDataFolder', 'NewFIFO', 'NewFIFOChan', 'NewFreeAxis', 'NewImage',
1746
+ 'NewLayout', 'NewMovie', 'NewNotebook', 'NewPanel', 'NewPath',
1747
+ 'NewWaterfall', 'Note', 'Notebook', 'NotebookAction', 'Open',
1748
+ 'OpenNotebook', 'Optimize', 'ParseOperationTemplate', 'PathInfo',
1749
+ 'PauseForUser', 'PauseUpdate', 'PCA', 'PlayMovie', 'PlayMovieAction',
1750
+ 'PlaySnd', 'PlaySound', 'PopupContextualMenu', 'PopupMenu',
1751
+ 'Preferences', 'PrimeFactors', 'Print', 'printf', 'PrintGraphs',
1752
+ 'PrintLayout', 'PrintNotebook', 'PrintSettings', 'PrintTable',
1753
+ 'Project', 'PulseStats', 'PutScrapText', 'pwd', 'Quit',
1754
+ 'RatioFromNumber', 'Redimension', 'Remove', 'RemoveContour',
1755
+ 'RemoveFromGraph', 'RemoveFromLayout', 'RemoveFromTable', 'RemoveImage',
1756
+ 'RemoveLayoutObjects', 'RemovePath', 'Rename', 'RenameDataFolder',
1757
+ 'RenamePath', 'RenamePICT', 'RenameWindow', 'ReorderImages',
1758
+ 'ReorderTraces', 'ReplaceText', 'ReplaceWave', 'Resample',
1759
+ 'ResumeUpdate', 'Reverse', 'Rotate', 'Save', 'SaveData',
1760
+ 'SaveExperiment', 'SaveGraphCopy', 'SaveNotebook',
1761
+ 'SavePackagePreferences', 'SavePICT', 'SaveTableCopy',
1762
+ 'SetActiveSubwindow', 'SetAxis', 'SetBackground', 'SetDashPattern',
1763
+ 'SetDataFolder', 'SetDimLabel', 'SetDrawEnv', 'SetDrawLayer',
1764
+ 'SetFileFolderInfo', 'SetFormula', 'SetIgorHook', 'SetIgorMenuMode',
1765
+ 'SetIgorOption', 'SetMarquee', 'SetProcessSleep', 'SetRandomSeed',
1766
+ 'SetScale', 'SetVariable', 'SetWaveLock', 'SetWindow', 'ShowIgorMenus',
1767
+ 'ShowInfo', 'ShowTools', 'Silent', 'Sleep', 'Slider', 'Smooth',
1768
+ 'SmoothCustom', 'Sort', 'SoundInRecord', 'SoundInSet',
1769
+ 'SoundInStartChart', 'SoundInStatus', 'SoundInStopChart',
1770
+ 'SphericalInterpolate', 'SphericalTriangulate', 'SplitString',
1771
+ 'sprintf', 'sscanf', 'Stack', 'StackWindows',
1772
+ 'StatsAngularDistanceTest', 'StatsANOVA1Test', 'StatsANOVA2NRTest',
1773
+ 'StatsANOVA2RMTest', 'StatsANOVA2Test', 'StatsChiTest',
1774
+ 'StatsCircularCorrelationTest', 'StatsCircularMeans',
1775
+ 'StatsCircularMoments', 'StatsCircularTwoSampleTest',
1776
+ 'StatsCochranTest', 'StatsContingencyTable', 'StatsDIPTest',
1777
+ 'StatsDunnettTest', 'StatsFriedmanTest', 'StatsFTest',
1778
+ 'StatsHodgesAjneTest', 'StatsJBTest', 'StatsKendallTauTest',
1779
+ 'StatsKSTest', 'StatsKWTest', 'StatsLinearCorrelationTest',
1780
+ 'StatsLinearRegression', 'StatsMultiCorrelationTest',
1781
+ 'StatsNPMCTest', 'StatsNPNominalSRTest', 'StatsQuantiles',
1782
+ 'StatsRankCorrelationTest', 'StatsResample', 'StatsSample',
1783
+ 'StatsScheffeTest', 'StatsSignTest', 'StatsSRTest', 'StatsTTest',
1784
+ 'StatsTukeyTest', 'StatsVariancesTest', 'StatsWatsonUSquaredTest',
1785
+ 'StatsWatsonWilliamsTest', 'StatsWheelerWatsonTest',
1786
+ 'StatsWilcoxonRankTest', 'StatsWRCorrelationTest', 'String',
1787
+ 'StructGet', 'StructPut', 'TabControl', 'Tag', 'TextBox', 'Tile',
1788
+ 'TileWindows', 'TitleBox', 'ToCommandLine', 'ToolsGrid',
1789
+ 'Triangulate3d', 'Unwrap', 'ValDisplay', 'Variable', 'WaveMeanStdv',
1790
+ 'WaveStats', 'WaveTransform', 'wfprintf', 'WignerTransform',
1791
+ 'WindowFunction',
1792
+ ]
1793
+ functions = [
1794
+ 'abs', 'acos', 'acosh', 'AiryA', 'AiryAD', 'AiryB', 'AiryBD', 'alog',
1795
+ 'area', 'areaXY', 'asin', 'asinh', 'atan', 'atan2', 'atanh',
1796
+ 'AxisValFromPixel', 'Besseli', 'Besselj', 'Besselk', 'Bessely', 'bessi',
1797
+ 'bessj', 'bessk', 'bessy', 'beta', 'betai', 'BinarySearch',
1798
+ 'BinarySearchInterp', 'binomial', 'binomialln', 'binomialNoise', 'cabs',
1799
+ 'CaptureHistoryStart', 'ceil', 'cequal', 'char2num', 'chebyshev',
1800
+ 'chebyshevU', 'CheckName', 'cmplx', 'cmpstr', 'conj', 'ContourZ', 'cos',
1801
+ 'cosh', 'cot', 'CountObjects', 'CountObjectsDFR', 'cpowi',
1802
+ 'CreationDate', 'csc', 'DataFolderExists', 'DataFolderRefsEqual',
1803
+ 'DataFolderRefStatus', 'date2secs', 'datetime', 'DateToJulian',
1804
+ 'Dawson', 'DDEExecute', 'DDEInitiate', 'DDEPokeString', 'DDEPokeWave',
1805
+ 'DDERequestWave', 'DDEStatus', 'DDETerminate', 'deltax', 'digamma',
1806
+ 'DimDelta', 'DimOffset', 'DimSize', 'ei', 'enoise', 'equalWaves', 'erf',
1807
+ 'erfc', 'exists', 'exp', 'expInt', 'expNoise', 'factorial', 'fakedata',
1808
+ 'faverage', 'faverageXY', 'FindDimLabel', 'FindListItem', 'floor',
1809
+ 'FontSizeHeight', 'FontSizeStringWidth', 'FresnelCos', 'FresnelSin',
1810
+ 'gamma', 'gammaInc', 'gammaNoise', 'gammln', 'gammp', 'gammq', 'Gauss',
1811
+ 'Gauss1D', 'Gauss2D', 'gcd', 'GetDefaultFontSize',
1812
+ 'GetDefaultFontStyle', 'GetKeyState', 'GetRTError', 'gnoise',
1813
+ 'GrepString', 'hcsr', 'hermite', 'hermiteGauss', 'HyperG0F1',
1814
+ 'HyperG1F1', 'HyperG2F1', 'HyperGNoise', 'HyperGPFQ', 'IgorVersion',
1815
+ 'ilim', 'imag', 'Inf', 'Integrate1D', 'interp', 'Interp2D', 'Interp3D',
1816
+ 'inverseERF', 'inverseERFC', 'ItemsInList', 'jlim', 'Laguerre',
1817
+ 'LaguerreA', 'LaguerreGauss', 'leftx', 'LegendreA', 'limit', 'ln',
1818
+ 'log', 'logNormalNoise', 'lorentzianNoise', 'magsqr', 'MandelbrotPoint',
1819
+ 'MarcumQ', 'MatrixDet', 'MatrixDot', 'MatrixRank', 'MatrixTrace', 'max',
1820
+ 'mean', 'min', 'mod', 'ModDate', 'NaN', 'norm', 'NumberByKey',
1821
+ 'numpnts', 'numtype', 'NumVarOrDefault', 'NVAR_Exists', 'p2rect',
1822
+ 'ParamIsDefault', 'pcsr', 'Pi', 'PixelFromAxisVal', 'pnt2x',
1823
+ 'poissonNoise', 'poly', 'poly2D', 'PolygonArea', 'qcsr', 'r2polar',
1824
+ 'real', 'rightx', 'round', 'sawtooth', 'ScreenResolution', 'sec',
1825
+ 'SelectNumber', 'sign', 'sin', 'sinc', 'sinh', 'SphericalBessJ',
1826
+ 'SphericalBessJD', 'SphericalBessY', 'SphericalBessYD',
1827
+ 'SphericalHarmonics', 'sqrt', 'StartMSTimer', 'StatsBetaCDF',
1828
+ 'StatsBetaPDF', 'StatsBinomialCDF', 'StatsBinomialPDF',
1829
+ 'StatsCauchyCDF', 'StatsCauchyPDF', 'StatsChiCDF', 'StatsChiPDF',
1830
+ 'StatsCMSSDCDF', 'StatsCorrelation', 'StatsDExpCDF', 'StatsDExpPDF',
1831
+ 'StatsErlangCDF', 'StatsErlangPDF', 'StatsErrorPDF', 'StatsEValueCDF',
1832
+ 'StatsEValuePDF', 'StatsExpCDF', 'StatsExpPDF', 'StatsFCDF',
1833
+ 'StatsFPDF', 'StatsFriedmanCDF', 'StatsGammaCDF', 'StatsGammaPDF',
1834
+ 'StatsGeometricCDF', 'StatsGeometricPDF', 'StatsHyperGCDF',
1835
+ 'StatsHyperGPDF', 'StatsInvBetaCDF', 'StatsInvBinomialCDF',
1836
+ 'StatsInvCauchyCDF', 'StatsInvChiCDF', 'StatsInvCMSSDCDF',
1837
+ 'StatsInvDExpCDF', 'StatsInvEValueCDF', 'StatsInvExpCDF',
1838
+ 'StatsInvFCDF', 'StatsInvFriedmanCDF', 'StatsInvGammaCDF',
1839
+ 'StatsInvGeometricCDF', 'StatsInvKuiperCDF', 'StatsInvLogisticCDF',
1840
+ 'StatsInvLogNormalCDF', 'StatsInvMaxwellCDF', 'StatsInvMooreCDF',
1841
+ 'StatsInvNBinomialCDF', 'StatsInvNCChiCDF', 'StatsInvNCFCDF',
1842
+ 'StatsInvNormalCDF', 'StatsInvParetoCDF', 'StatsInvPoissonCDF',
1843
+ 'StatsInvPowerCDF', 'StatsInvQCDF', 'StatsInvQpCDF',
1844
+ 'StatsInvRayleighCDF', 'StatsInvRectangularCDF', 'StatsInvSpearmanCDF',
1845
+ 'StatsInvStudentCDF', 'StatsInvTopDownCDF', 'StatsInvTriangularCDF',
1846
+ 'StatsInvUsquaredCDF', 'StatsInvVonMisesCDF', 'StatsInvWeibullCDF',
1847
+ 'StatsKuiperCDF', 'StatsLogisticCDF', 'StatsLogisticPDF',
1848
+ 'StatsLogNormalCDF', 'StatsLogNormalPDF', 'StatsMaxwellCDF',
1849
+ 'StatsMaxwellPDF', 'StatsMedian', 'StatsMooreCDF', 'StatsNBinomialCDF',
1850
+ 'StatsNBinomialPDF', 'StatsNCChiCDF', 'StatsNCChiPDF', 'StatsNCFCDF',
1851
+ 'StatsNCFPDF', 'StatsNCTCDF', 'StatsNCTPDF', 'StatsNormalCDF',
1852
+ 'StatsNormalPDF', 'StatsParetoCDF', 'StatsParetoPDF', 'StatsPermute',
1853
+ 'StatsPoissonCDF', 'StatsPoissonPDF', 'StatsPowerCDF',
1854
+ 'StatsPowerNoise', 'StatsPowerPDF', 'StatsQCDF', 'StatsQpCDF',
1855
+ 'StatsRayleighCDF', 'StatsRayleighPDF', 'StatsRectangularCDF',
1856
+ 'StatsRectangularPDF', 'StatsRunsCDF', 'StatsSpearmanRhoCDF',
1857
+ 'StatsStudentCDF', 'StatsStudentPDF', 'StatsTopDownCDF',
1858
+ 'StatsTriangularCDF', 'StatsTriangularPDF', 'StatsTrimmedMean',
1859
+ 'StatsUSquaredCDF', 'StatsVonMisesCDF', 'StatsVonMisesNoise',
1860
+ 'StatsVonMisesPDF', 'StatsWaldCDF', 'StatsWaldPDF', 'StatsWeibullCDF',
1861
+ 'StatsWeibullPDF', 'StopMSTimer', 'str2num', 'stringCRC', 'stringmatch',
1862
+ 'strlen', 'strsearch', 'StudentA', 'StudentT', 'sum', 'SVAR_Exists',
1863
+ 'TagVal', 'tan', 'tanh', 'ThreadGroupCreate', 'ThreadGroupRelease',
1864
+ 'ThreadGroupWait', 'ThreadProcessorCount', 'ThreadReturnValue', 'ticks',
1865
+ 'trunc', 'Variance', 'vcsr', 'WaveCRC', 'WaveDims', 'WaveExists',
1866
+ 'WaveMax', 'WaveMin', 'WaveRefsEqual', 'WaveType', 'WhichListItem',
1867
+ 'WinType', 'WNoise', 'x', 'x2pnt', 'xcsr', 'y', 'z', 'zcsr', 'ZernikeR',
1868
+ ]
1869
+ functions += [
1870
+ 'AddListItem', 'AnnotationInfo', 'AnnotationList', 'AxisInfo',
1871
+ 'AxisList', 'CaptureHistory', 'ChildWindowList', 'CleanupName',
1872
+ 'ContourInfo', 'ContourNameList', 'ControlNameList', 'CsrInfo',
1873
+ 'CsrWave', 'CsrXWave', 'CTabList', 'DataFolderDir', 'date',
1874
+ 'DDERequestString', 'FontList', 'FuncRefInfo', 'FunctionInfo',
1875
+ 'FunctionList', 'FunctionPath', 'GetDataFolder', 'GetDefaultFont',
1876
+ 'GetDimLabel', 'GetErrMessage', 'GetFormula',
1877
+ 'GetIndependentModuleName', 'GetIndexedObjName', 'GetIndexedObjNameDFR',
1878
+ 'GetRTErrMessage', 'GetRTStackInfo', 'GetScrapText', 'GetUserData',
1879
+ 'GetWavesDataFolder', 'GrepList', 'GuideInfo', 'GuideNameList', 'Hash',
1880
+ 'IgorInfo', 'ImageInfo', 'ImageNameList', 'IndexedDir', 'IndexedFile',
1881
+ 'JulianToDate', 'LayoutInfo', 'ListMatch', 'LowerStr', 'MacroList',
1882
+ 'NameOfWave', 'note', 'num2char', 'num2istr', 'num2str',
1883
+ 'OperationList', 'PadString', 'ParseFilePath', 'PathList', 'PICTInfo',
1884
+ 'PICTList', 'PossiblyQuoteName', 'ProcedureText', 'RemoveByKey',
1885
+ 'RemoveEnding', 'RemoveFromList', 'RemoveListItem',
1886
+ 'ReplaceNumberByKey', 'ReplaceString', 'ReplaceStringByKey',
1887
+ 'Secs2Date', 'Secs2Time', 'SelectString', 'SortList',
1888
+ 'SpecialCharacterInfo', 'SpecialCharacterList', 'SpecialDirPath',
1889
+ 'StringByKey', 'StringFromList', 'StringList', 'StrVarOrDefault',
1890
+ 'TableInfo', 'TextFile', 'ThreadGroupGetDF', 'time', 'TraceFromPixel',
1891
+ 'TraceInfo', 'TraceNameList', 'UniqueName', 'UnPadString', 'UpperStr',
1892
+ 'VariableList', 'WaveInfo', 'WaveList', 'WaveName', 'WaveUnits',
1893
+ 'WinList', 'WinName', 'WinRecreation', 'XWaveName',
1894
+ 'ContourNameToWaveRef', 'CsrWaveRef', 'CsrXWaveRef',
1895
+ 'ImageNameToWaveRef', 'NewFreeWave', 'TagWaveRef', 'TraceNameToWaveRef',
1896
+ 'WaveRefIndexed', 'XWaveRefFromTrace', 'GetDataFolderDFR',
1897
+ 'GetWavesDataFolderDFR', 'NewFreeDataFolder', 'ThreadGroupGetDFR',
1898
+ ]
1899
+
1900
+ tokens = {
1901
+ 'root': [
1902
+ (r'//.*$', Comment.Single),
1903
+ (r'"([^"\\]|\\.)*"', String),
1904
+ # Flow Control.
1905
+ (r'\b(%s)\b' % '|'.join(flowControl), Keyword),
1906
+ # Types.
1907
+ (r'\b(%s)\b' % '|'.join(types), Keyword.Type),
1908
+ # Built-in operations.
1909
+ (r'\b(%s)\b' % '|'.join(operations), Name.Class),
1910
+ # Built-in functions.
1911
+ (r'\b(%s)\b' % '|'.join(functions), Name.Function),
1912
+ # Compiler directives.
1913
+ (r'^#(include|pragma|define|ifdef|ifndef|endif)',
1914
+ Name.Decorator),
1915
+ (r'[^a-zA-Z"/]+', Text),
1916
+ (r'.', Text),
1917
+ ],
1918
+ }