pygments.rb 0.5.4 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +40 -0
  3. data/README.md +3 -0
  4. data/lexers +0 -0
  5. data/lib/pygments/popen.rb +3 -2
  6. data/lib/pygments/version.rb +1 -1
  7. data/pygments.rb.gemspec +2 -1
  8. data/vendor/pygments-main/AUTHORS +20 -1
  9. data/vendor/pygments-main/CHANGES +55 -3
  10. data/vendor/pygments-main/LICENSE +1 -1
  11. data/vendor/pygments-main/MANIFEST.in +1 -1
  12. data/vendor/pygments-main/Makefile +5 -8
  13. data/vendor/pygments-main/REVISION +1 -1
  14. data/vendor/pygments-main/doc/Makefile +153 -0
  15. data/vendor/pygments-main/doc/_static/favicon.ico +0 -0
  16. data/vendor/pygments-main/doc/_static/logo_new.png +0 -0
  17. data/vendor/pygments-main/doc/_static/logo_only.png +0 -0
  18. data/vendor/pygments-main/doc/_templates/docssidebar.html +3 -0
  19. data/vendor/pygments-main/doc/_templates/indexsidebar.html +25 -0
  20. data/vendor/pygments-main/doc/_themes/pygments14/layout.html +98 -0
  21. data/vendor/pygments-main/doc/_themes/pygments14/static/bodybg.png +0 -0
  22. data/vendor/pygments-main/doc/_themes/pygments14/static/docbg.png +0 -0
  23. data/vendor/pygments-main/doc/_themes/pygments14/static/listitem.png +0 -0
  24. data/vendor/pygments-main/doc/_themes/pygments14/static/logo.png +0 -0
  25. data/vendor/pygments-main/doc/_themes/pygments14/static/pocoo.png +0 -0
  26. data/vendor/pygments-main/doc/_themes/pygments14/static/pygments14.css_t +401 -0
  27. data/vendor/pygments-main/doc/_themes/pygments14/theme.conf +15 -0
  28. data/vendor/pygments-main/doc/conf.py +249 -0
  29. data/vendor/pygments-main/doc/docs/api.rst +316 -0
  30. data/vendor/pygments-main/doc/docs/authors.rst +4 -0
  31. data/vendor/pygments-main/doc/docs/changelog.rst +1 -0
  32. data/vendor/pygments-main/{docs/src/cmdline.txt → doc/docs/cmdline.rst} +9 -11
  33. data/vendor/pygments-main/{docs/src/filterdevelopment.txt → doc/docs/filterdevelopment.rst} +1 -1
  34. data/vendor/pygments-main/{docs/src/filters.txt → doc/docs/filters.rst} +4 -5
  35. data/vendor/pygments-main/{docs/src/formatterdevelopment.txt → doc/docs/formatterdevelopment.rst} +1 -1
  36. data/vendor/pygments-main/{docs/src/formatters.txt → doc/docs/formatters.rst} +6 -6
  37. data/vendor/pygments-main/doc/docs/index.rst +66 -0
  38. data/vendor/pygments-main/{docs/src/integrate.txt → doc/docs/integrate.rst} +3 -7
  39. data/vendor/pygments-main/{docs/src/java.txt → doc/docs/java.rst} +0 -0
  40. data/vendor/pygments-main/{docs/src/lexerdevelopment.txt → doc/docs/lexerdevelopment.rst} +13 -14
  41. data/vendor/pygments-main/{docs/src/lexers.txt → doc/docs/lexers.rst} +7 -5
  42. data/vendor/pygments-main/{docs/src/moinmoin.txt → doc/docs/moinmoin.rst} +0 -0
  43. data/vendor/pygments-main/{docs/src/plugins.txt → doc/docs/plugins.rst} +0 -0
  44. data/vendor/pygments-main/{docs/src/quickstart.txt → doc/docs/quickstart.rst} +22 -19
  45. data/vendor/pygments-main/{docs/src/rstdirective.txt → doc/docs/rstdirective.rst} +0 -0
  46. data/vendor/pygments-main/{docs/src/styles.txt → doc/docs/styles.rst} +2 -2
  47. data/vendor/pygments-main/{docs/src/tokens.txt → doc/docs/tokens.rst} +10 -7
  48. data/vendor/pygments-main/{docs/src/unicode.txt → doc/docs/unicode.rst} +8 -7
  49. data/vendor/pygments-main/doc/download.rst +41 -0
  50. data/vendor/pygments-main/doc/faq.rst +143 -0
  51. data/vendor/pygments-main/doc/index.rst +53 -0
  52. data/vendor/pygments-main/doc/languages.rst +151 -0
  53. data/vendor/pygments-main/doc/make.bat +190 -0
  54. data/vendor/pygments-main/{docs → doc}/pygmentize.1 +0 -0
  55. data/vendor/pygments-main/external/autopygmentize +65 -48
  56. data/vendor/pygments-main/external/markdown-processor.py +15 -15
  57. data/vendor/pygments-main/external/moin-parser.py +1 -1
  58. data/vendor/pygments-main/external/rst-directive.py +2 -3
  59. data/vendor/pygments-main/ez_setup.py +340 -234
  60. data/vendor/pygments-main/pygments/__init__.py +4 -4
  61. data/vendor/pygments-main/pygments/cmdline.py +81 -68
  62. data/vendor/pygments-main/pygments/console.py +1 -1
  63. data/vendor/pygments-main/pygments/filter.py +1 -1
  64. data/vendor/pygments-main/pygments/filters/__init__.py +11 -9
  65. data/vendor/pygments-main/pygments/formatter.py +3 -3
  66. data/vendor/pygments-main/pygments/formatters/__init__.py +5 -3
  67. data/vendor/pygments-main/pygments/formatters/_mapping.py +16 -5
  68. data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
  69. data/vendor/pygments-main/pygments/formatters/html.py +44 -26
  70. data/vendor/pygments-main/pygments/formatters/img.py +21 -14
  71. data/vendor/pygments-main/pygments/formatters/latex.py +104 -12
  72. data/vendor/pygments-main/pygments/formatters/other.py +53 -6
  73. data/vendor/pygments-main/pygments/formatters/rtf.py +30 -16
  74. data/vendor/pygments-main/pygments/formatters/svg.py +2 -2
  75. data/vendor/pygments-main/pygments/formatters/terminal.py +41 -1
  76. data/vendor/pygments-main/pygments/formatters/terminal256.py +2 -2
  77. data/vendor/pygments-main/pygments/lexer.py +59 -39
  78. data/vendor/pygments-main/pygments/lexers/__init__.py +38 -15
  79. data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1 -1
  80. data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +15 -15
  81. data/vendor/pygments-main/pygments/lexers/_cocoabuiltins.py +73 -0
  82. data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +11 -1
  83. data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +14 -8
  84. data/vendor/pygments-main/pygments/lexers/_mapping.py +81 -30
  85. data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +1 -1
  86. data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +1067 -95
  87. data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +7 -7
  88. data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +5 -4
  89. data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +1 -1
  90. data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +12 -7
  91. data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +112 -18
  92. data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +1 -1
  93. data/vendor/pygments-main/pygments/lexers/agile.py +644 -382
  94. data/vendor/pygments-main/pygments/lexers/asm.py +66 -29
  95. data/vendor/pygments-main/pygments/lexers/compiled.py +1643 -174
  96. data/vendor/pygments-main/pygments/lexers/dalvik.py +27 -6
  97. data/vendor/pygments-main/pygments/lexers/dotnet.py +45 -33
  98. data/vendor/pygments-main/pygments/lexers/foxpro.py +3 -3
  99. data/vendor/pygments-main/pygments/lexers/functional.py +1510 -570
  100. data/vendor/pygments-main/pygments/lexers/graph.py +81 -0
  101. data/vendor/pygments-main/pygments/lexers/hdl.py +29 -30
  102. data/vendor/pygments-main/pygments/lexers/inferno.py +96 -0
  103. data/vendor/pygments-main/pygments/lexers/jvm.py +622 -207
  104. data/vendor/pygments-main/pygments/lexers/math.py +438 -70
  105. data/vendor/pygments-main/pygments/lexers/other.py +885 -171
  106. data/vendor/pygments-main/pygments/lexers/parsers.py +24 -24
  107. data/vendor/pygments-main/pygments/lexers/qbasic.py +157 -0
  108. data/vendor/pygments-main/pygments/lexers/rdf.py +99 -0
  109. data/vendor/pygments-main/pygments/lexers/shell.py +28 -25
  110. data/vendor/pygments-main/pygments/lexers/special.py +7 -8
  111. data/vendor/pygments-main/pygments/lexers/sql.py +56 -23
  112. data/vendor/pygments-main/pygments/lexers/templates.py +377 -59
  113. data/vendor/pygments-main/pygments/lexers/text.py +208 -46
  114. data/vendor/pygments-main/pygments/lexers/web.py +729 -264
  115. data/vendor/pygments-main/pygments/modeline.py +1 -1
  116. data/vendor/pygments-main/pygments/plugin.py +1 -1
  117. data/vendor/pygments-main/pygments/scanner.py +1 -1
  118. data/vendor/pygments-main/pygments/sphinxext.py +153 -0
  119. data/vendor/pygments-main/pygments/style.py +3 -2
  120. data/vendor/pygments-main/pygments/styles/__init__.py +5 -1
  121. data/vendor/pygments-main/pygments/styles/autumn.py +1 -1
  122. data/vendor/pygments-main/pygments/styles/borland.py +1 -1
  123. data/vendor/pygments-main/pygments/styles/bw.py +1 -1
  124. data/vendor/pygments-main/pygments/styles/colorful.py +1 -1
  125. data/vendor/pygments-main/pygments/styles/default.py +1 -1
  126. data/vendor/pygments-main/pygments/styles/emacs.py +1 -1
  127. data/vendor/pygments-main/pygments/styles/friendly.py +1 -1
  128. data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
  129. data/vendor/pygments-main/pygments/styles/igor.py +29 -0
  130. data/vendor/pygments-main/pygments/styles/manni.py +1 -1
  131. data/vendor/pygments-main/pygments/styles/monokai.py +4 -4
  132. data/vendor/pygments-main/pygments/styles/murphy.py +1 -1
  133. data/vendor/pygments-main/pygments/styles/native.py +1 -1
  134. data/vendor/pygments-main/pygments/styles/paraiso_dark.py +125 -0
  135. data/vendor/pygments-main/pygments/styles/paraiso_light.py +125 -0
  136. data/vendor/pygments-main/pygments/styles/pastie.py +1 -1
  137. data/vendor/pygments-main/pygments/styles/perldoc.py +1 -1
  138. data/vendor/pygments-main/pygments/styles/rrt.py +1 -1
  139. data/vendor/pygments-main/pygments/styles/tango.py +1 -1
  140. data/vendor/pygments-main/pygments/styles/trac.py +1 -1
  141. data/vendor/pygments-main/pygments/styles/vim.py +1 -1
  142. data/vendor/pygments-main/pygments/styles/vs.py +1 -1
  143. data/vendor/pygments-main/pygments/styles/xcode.py +51 -0
  144. data/vendor/pygments-main/pygments/token.py +4 -1
  145. data/vendor/pygments-main/pygments/unistring.py +6 -5
  146. data/vendor/pygments-main/pygments/util.py +35 -21
  147. data/vendor/pygments-main/scripts/check_sources.py +28 -44
  148. data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +5 -4
  149. data/vendor/pygments-main/scripts/find_codetags.py +27 -19
  150. data/vendor/pygments-main/scripts/find_error.py +16 -13
  151. data/vendor/pygments-main/scripts/get_vimkw.py +3 -3
  152. data/vendor/pygments-main/scripts/vim2pygments.py +9 -7
  153. data/vendor/pygments-main/setup.py +19 -19
  154. data/vendor/pygments-main/tests/examplefiles/99_bottles_of_beer.chpl +118 -0
  155. data/vendor/pygments-main/tests/examplefiles/Error.pmod +38 -0
  156. data/vendor/pygments-main/tests/examplefiles/FakeFile.pike +360 -0
  157. data/vendor/pygments-main/tests/examplefiles/{ANTLRv3.g → antlr_ANTLRv3.g} +0 -0
  158. data/vendor/pygments-main/tests/examplefiles/clojure-weird-keywords.clj +5 -0
  159. data/vendor/pygments-main/tests/examplefiles/core.cljs +52 -0
  160. data/vendor/pygments-main/tests/examplefiles/demo.cfm +13 -1
  161. data/vendor/pygments-main/tests/examplefiles/demo.hbs +12 -0
  162. data/vendor/pygments-main/tests/examplefiles/ember.handlebars +33 -0
  163. data/vendor/pygments-main/tests/examplefiles/example.als +217 -0
  164. data/vendor/pygments-main/tests/examplefiles/example.c +1 -1
  165. data/vendor/pygments-main/tests/examplefiles/example.chai +6 -0
  166. data/vendor/pygments-main/tests/examplefiles/example.coffee +27 -0
  167. data/vendor/pygments-main/tests/examplefiles/example.e +124 -0
  168. data/vendor/pygments-main/tests/examplefiles/example.f90 +8 -0
  169. data/vendor/pygments-main/tests/examplefiles/example.feature +16 -0
  170. data/vendor/pygments-main/tests/examplefiles/example.gd +23 -0
  171. data/vendor/pygments-main/tests/examplefiles/example.gi +64 -0
  172. data/vendor/pygments-main/tests/examplefiles/example.groovy +2 -0
  173. data/vendor/pygments-main/tests/examplefiles/example.hs +27 -0
  174. data/vendor/pygments-main/tests/examplefiles/example.hx +44 -1
  175. data/vendor/pygments-main/tests/examplefiles/example.i6t +32 -0
  176. data/vendor/pygments-main/tests/examplefiles/example.i7x +45 -0
  177. data/vendor/pygments-main/tests/examplefiles/example.inf +374 -0
  178. data/vendor/pygments-main/tests/examplefiles/example.j +564 -0
  179. data/vendor/pygments-main/tests/examplefiles/example.java +16 -0
  180. data/vendor/pygments-main/tests/examplefiles/example.kal +75 -0
  181. data/vendor/pygments-main/tests/examplefiles/example.liquid +42 -0
  182. data/vendor/pygments-main/tests/examplefiles/example.ma +8 -0
  183. data/vendor/pygments-main/tests/examplefiles/example.mq4 +187 -0
  184. data/vendor/pygments-main/tests/examplefiles/example.mqh +123 -0
  185. data/vendor/pygments-main/tests/examplefiles/example.ni +57 -0
  186. data/vendor/pygments-main/tests/examplefiles/example.nix +80 -0
  187. data/vendor/pygments-main/tests/examplefiles/example.pp +8 -0
  188. data/vendor/pygments-main/tests/examplefiles/example.red +257 -0
  189. data/vendor/pygments-main/tests/examplefiles/example.reds +150 -0
  190. data/vendor/pygments-main/tests/examplefiles/example.rkt +677 -29
  191. data/vendor/pygments-main/tests/examplefiles/example.sh +22 -0
  192. data/vendor/pygments-main/tests/examplefiles/example.slim +31 -0
  193. data/vendor/pygments-main/tests/examplefiles/example.sls +51 -0
  194. data/vendor/pygments-main/tests/examplefiles/example.stan +2 -0
  195. data/vendor/pygments-main/tests/examplefiles/example.todotxt +9 -0
  196. data/vendor/pygments-main/tests/examplefiles/exampleScript.cfc +241 -0
  197. data/vendor/pygments-main/tests/examplefiles/exampleTag.cfc +18 -0
  198. data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +192 -350
  199. data/vendor/pygments-main/tests/examplefiles/hash_syntax.rb +5 -0
  200. data/vendor/pygments-main/tests/examplefiles/hello.at +6 -0
  201. data/vendor/pygments-main/tests/examplefiles/hello.golo +5 -0
  202. data/vendor/pygments-main/tests/examplefiles/hello.lsl +12 -0
  203. data/vendor/pygments-main/tests/examplefiles/{File.hy → hybris_File.hy} +0 -0
  204. data/vendor/pygments-main/tests/examplefiles/{mg_sample.pro → idl_sample.pro} +0 -0
  205. data/vendor/pygments-main/tests/examplefiles/iex_example +23 -0
  206. data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +24 -24
  207. data/vendor/pygments-main/tests/examplefiles/language.hy +165 -0
  208. data/vendor/pygments-main/tests/examplefiles/limbo.b +456 -0
  209. data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +3 -1
  210. data/vendor/pygments-main/tests/examplefiles/main.cmake +2 -0
  211. data/vendor/pygments-main/tests/examplefiles/objc_example.m +163 -16
  212. data/vendor/pygments-main/tests/examplefiles/{example.p → openedge_example} +0 -0
  213. data/vendor/pygments-main/tests/examplefiles/pawn_example +25 -0
  214. data/vendor/pygments-main/tests/examplefiles/qbasic_example +2 -0
  215. data/vendor/pygments-main/tests/examplefiles/r6rs-comments.scm +23 -0
  216. data/vendor/pygments-main/tests/examplefiles/{robotframework.txt → robotframework_test.txt} +0 -0
  217. data/vendor/pygments-main/tests/examplefiles/rql-queries.rql +34 -0
  218. data/vendor/pygments-main/tests/examplefiles/scope.cirru +43 -0
  219. data/vendor/pygments-main/tests/examplefiles/sparql.rq +23 -0
  220. data/vendor/pygments-main/tests/examplefiles/test.R +37 -5
  221. data/vendor/pygments-main/tests/examplefiles/test.apl +26 -0
  222. data/vendor/pygments-main/tests/examplefiles/test.cyp +123 -0
  223. data/vendor/pygments-main/tests/examplefiles/test.idr +93 -0
  224. data/vendor/pygments-main/tests/examplefiles/test.mask +41 -0
  225. data/vendor/pygments-main/tests/examplefiles/test.pan +54 -0
  226. data/vendor/pygments-main/tests/examplefiles/test.php +3 -1
  227. data/vendor/pygments-main/tests/examplefiles/test.pig +148 -0
  228. data/vendor/pygments-main/tests/examplefiles/test.pwn +253 -0
  229. data/vendor/pygments-main/tests/examplefiles/test.r3 +27 -7
  230. data/vendor/pygments-main/tests/examplefiles/test.rsl +111 -0
  231. data/vendor/pygments-main/tests/examplefiles/test.swift +65 -0
  232. data/vendor/pygments-main/tests/examplefiles/test.zep +33 -0
  233. data/vendor/pygments-main/tests/examplefiles/unicode.go +10 -0
  234. data/vendor/pygments-main/tests/examplefiles/{test.bas → vbnet_test.bas} +0 -0
  235. data/vendor/pygments-main/tests/examplefiles/vctreestatus_hg +4 -0
  236. data/vendor/pygments-main/tests/examplefiles/vimrc +21 -0
  237. data/vendor/pygments-main/tests/run.py +14 -19
  238. data/vendor/pygments-main/tests/string_asserts.py +22 -0
  239. data/vendor/pygments-main/tests/test_basic_api.py +28 -14
  240. data/vendor/pygments-main/tests/test_cfm.py +46 -0
  241. data/vendor/pygments-main/tests/test_clexer.py +208 -3
  242. data/vendor/pygments-main/tests/test_cmdline.py +6 -5
  243. data/vendor/pygments-main/tests/test_examplefiles.py +30 -19
  244. data/vendor/pygments-main/tests/test_html_formatter.py +15 -13
  245. data/vendor/pygments-main/tests/test_latex_formatter.py +4 -2
  246. data/vendor/pygments-main/tests/test_lexers_other.py +11 -11
  247. data/vendor/pygments-main/tests/test_objectiveclexer.py +81 -0
  248. data/vendor/pygments-main/tests/test_perllexer.py +1 -1
  249. data/vendor/pygments-main/tests/test_qbasiclexer.py +43 -0
  250. data/vendor/pygments-main/tests/test_regexlexer.py +8 -1
  251. data/vendor/pygments-main/tests/test_rtf_formatter.py +109 -0
  252. data/vendor/pygments-main/tests/test_string_asserts.py +39 -0
  253. data/vendor/pygments-main/tests/test_token.py +3 -3
  254. data/vendor/pygments-main/tests/test_using_api.py +1 -1
  255. data/vendor/pygments-main/tests/test_util.py +1 -1
  256. metadata +138 -51
  257. data/vendor/pygments-main/docs/generate.py +0 -472
  258. data/vendor/pygments-main/docs/src/api.txt +0 -270
  259. data/vendor/pygments-main/docs/src/authors.txt +0 -5
  260. data/vendor/pygments-main/docs/src/changelog.txt +0 -5
  261. data/vendor/pygments-main/docs/src/index.txt +0 -69
  262. data/vendor/pygments-main/docs/src/installation.txt +0 -71
  263. data/vendor/pygments-main/external/rst-directive-old.py +0 -77
  264. data/vendor/pygments-main/scripts/reindent.py +0 -291
  265. data/vendor/pygments-main/tests/examplefiles/import.hs +0 -4
  266. data/vendor/pygments-main/tests/examplefiles/objc_example2.m +0 -24
  267. data/vendor/pygments-main/tests/old_run.py +0 -138
@@ -5,10 +5,12 @@
5
5
 
6
6
  Lexers for math languages.
7
7
 
8
- :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
8
+ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
9
9
  :license: BSD, see LICENSE for details.
10
10
  """
11
11
 
12
+ from __future__ import print_function
13
+
12
14
  import re
13
15
 
14
16
  from pygments.util import shebang_matches
@@ -24,14 +26,14 @@ from pygments.lexers import _stan_builtins
24
26
  __all__ = ['JuliaLexer', 'JuliaConsoleLexer', 'MuPADLexer', 'MatlabLexer',
25
27
  'MatlabSessionLexer', 'OctaveLexer', 'ScilabLexer', 'NumPyLexer',
26
28
  'RConsoleLexer', 'SLexer', 'JagsLexer', 'BugsLexer', 'StanLexer',
27
- 'IDLLexer', 'RdLexer', 'IgorLexer']
29
+ 'IDLLexer', 'RdLexer', 'IgorLexer', 'MathematicaLexer', 'GAPLexer']
28
30
 
29
31
 
30
32
  class JuliaLexer(RegexLexer):
31
33
  """
32
34
  For `Julia <http://julialang.org/>`_ source code.
33
35
 
34
- *New in Pygments 1.6.*
36
+ .. versionadded:: 1.6
35
37
  """
36
38
  name = 'Julia'
37
39
  aliases = ['julia','jl']
@@ -95,16 +97,16 @@ class JuliaLexer(RegexLexer):
95
97
  (r'[E]?"', String, combined('stringescape', 'string')),
96
98
 
97
99
  # names
98
- (r'@[a-zA-Z0-9_.]+', Name.Decorator),
99
- (r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
100
+ (r'@[\w.]+', Name.Decorator),
101
+ (r'[a-zA-Z_]\w*', Name),
100
102
 
101
103
  # numbers
102
104
  (r'(\d+(_\d+)+\.\d*|\d*\.\d+(_\d+)+)([eEf][+-]?[0-9]+)?', Number.Float),
103
105
  (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
104
106
  (r'\d+(_\d+)+[eEf][+-]?[0-9]+', Number.Float),
105
107
  (r'\d+[eEf][+-]?[0-9]+', Number.Float),
106
- (r'0b[01]+(_[01]+)+', Number.Binary),
107
- (r'0b[01]+', Number.Binary),
108
+ (r'0b[01]+(_[01]+)+', Number.Bin),
109
+ (r'0b[01]+', Number.Bin),
108
110
  (r'0o[0-7]+(_[0-7]+)+', Number.Oct),
109
111
  (r'0o[0-7]+', Number.Oct),
110
112
  (r'0x[a-fA-F0-9]+(_[a-fA-F0-9]+)+', Number.Hex),
@@ -114,13 +116,13 @@ class JuliaLexer(RegexLexer):
114
116
  ],
115
117
 
116
118
  'funcname': [
117
- ('[a-zA-Z_][a-zA-Z0-9_]*', Name.Function, '#pop'),
119
+ ('[a-zA-Z_]\w*', Name.Function, '#pop'),
118
120
  ('\([^\s\w{]{1,2}\)', Operator, '#pop'),
119
121
  ('[^\s\w{]{1,2}', Operator, '#pop'),
120
122
  ],
121
123
 
122
124
  'typename': [
123
- ('[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
125
+ ('[a-zA-Z_]\w*', Name.Class, '#pop')
124
126
  ],
125
127
 
126
128
  'stringescape': [
@@ -131,7 +133,7 @@ class JuliaLexer(RegexLexer):
131
133
  'string': [
132
134
  (r'"', String, '#pop'),
133
135
  (r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings
134
- (r'\$(\([a-zA-Z0-9_]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?',
136
+ (r'\$(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?',
135
137
  String.Interpol),
136
138
  (r'[^\\"$]+', String),
137
139
  # quotes, dollar signs, and backslashes must be parsed one at a time
@@ -151,7 +153,7 @@ class JuliaConsoleLexer(Lexer):
151
153
  """
152
154
  For Julia console sessions. Modeled after MatlabSessionLexer.
153
155
 
154
- *New in Pygments 1.6.*
156
+ .. versionadded:: 1.6
155
157
  """
156
158
  name = 'Julia console'
157
159
  aliases = ['jlcon']
@@ -167,8 +169,8 @@ class JuliaConsoleLexer(Lexer):
167
169
 
168
170
  if line.startswith('julia>'):
169
171
  insertions.append((len(curcode),
170
- [(0, Generic.Prompt, line[:3])]))
171
- curcode += line[3:]
172
+ [(0, Generic.Prompt, line[:6])]))
173
+ curcode += line[6:]
172
174
 
173
175
  elif line.startswith(' '):
174
176
 
@@ -200,7 +202,7 @@ class MuPADLexer(RegexLexer):
200
202
  A `MuPAD <http://www.mupad.com>`_ lexer.
201
203
  Contributed by Christopher Creutzig <christopher@creutzig.de>.
202
204
 
203
- *New in Pygments 0.8.*
205
+ .. versionadded:: 0.8
204
206
  """
205
207
  name = 'MuPAD'
206
208
  aliases = ['mupad']
@@ -270,7 +272,7 @@ class MatlabLexer(RegexLexer):
270
272
  """
271
273
  For Matlab source code.
272
274
 
273
- *New in Pygments 0.10.*
275
+ .. versionadded:: 0.10
274
276
  """
275
277
  name = 'Matlab'
276
278
  aliases = ['matlab']
@@ -348,14 +350,14 @@ class MatlabLexer(RegexLexer):
348
350
 
349
351
  # quote can be transpose, instead of string:
350
352
  # (not great, but handles common cases...)
351
- (r'(?<=[\w\)\]])\'', Operator),
353
+ (r'(?<=[\w\)\].])\'+', Operator),
352
354
 
353
355
  (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
354
356
  (r'\d+[eEf][+-]?[0-9]+', Number.Float),
355
357
  (r'\d+', Number.Integer),
356
358
 
357
- (r'(?<![\w\)\]])\'', String, 'string'),
358
- ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
359
+ (r'(?<![\w\)\].])\'', String, 'string'),
360
+ ('[a-zA-Z_]\w*', Name),
359
361
  (r'.', Text),
360
362
  ],
361
363
  'string': [
@@ -376,10 +378,9 @@ class MatlabLexer(RegexLexer):
376
378
 
377
379
  def analyse_text(text):
378
380
  if re.match('^\s*%', text, re.M): # comment
379
- return 0.9
381
+ return 0.2
380
382
  elif re.match('^!\w+', text, re.M): # system cmd
381
- return 0.9
382
- return 0.1
383
+ return 0.2
383
384
 
384
385
 
385
386
  line_re = re.compile('.*?\n')
@@ -389,7 +390,7 @@ class MatlabSessionLexer(Lexer):
389
390
  For Matlab sessions. Modeled after PythonConsoleLexer.
390
391
  Contributed by Ken Schutte <kschutte@csail.mit.edu>.
391
392
 
392
- *New in Pygments 0.10.*
393
+ .. versionadded:: 0.10
393
394
  """
394
395
  name = 'Matlab session'
395
396
  aliases = ['matlabsession']
@@ -403,17 +404,22 @@ class MatlabSessionLexer(Lexer):
403
404
  for match in line_re.finditer(text):
404
405
  line = match.group()
405
406
 
406
- if line.startswith('>>'):
407
+ if line.startswith('>> '):
407
408
  insertions.append((len(curcode),
408
409
  [(0, Generic.Prompt, line[:3])]))
409
410
  curcode += line[3:]
410
411
 
412
+ elif line.startswith('>>'):
413
+ insertions.append((len(curcode),
414
+ [(0, Generic.Prompt, line[:2])]))
415
+ curcode += line[2:]
416
+
411
417
  elif line.startswith('???'):
412
418
 
413
419
  idx = len(curcode)
414
420
 
415
421
  # without is showing error on same line as before...?
416
- line = "\n" + line
422
+ #line = "\n" + line
417
423
  token = (0, Generic.Traceback, line)
418
424
  insertions.append((idx, [token]))
419
425
 
@@ -427,6 +433,7 @@ class MatlabSessionLexer(Lexer):
427
433
 
428
434
  yield match.start(), Generic.Output, line
429
435
 
436
+ print(insertions)
430
437
  if curcode: # or item:
431
438
  for item in do_insertions(
432
439
  insertions, mlexer.get_tokens_unprocessed(curcode)):
@@ -437,7 +444,7 @@ class OctaveLexer(RegexLexer):
437
444
  """
438
445
  For GNU Octave source code.
439
446
 
440
- *New in Pygments 1.5.*
447
+ .. versionadded:: 1.5
441
448
  """
442
449
  name = 'Octave'
443
450
  aliases = ['octave']
@@ -806,10 +813,10 @@ class OctaveLexer(RegexLexer):
806
813
 
807
814
  # quote can be transpose, instead of string:
808
815
  # (not great, but handles common cases...)
809
- (r'(?<=[\w\)\]])\'', Operator),
810
- (r'(?<![\w\)\]])\'', String, 'string'),
816
+ (r'(?<=[\w\)\].])\'+', Operator),
817
+ (r'(?<![\w\)\].])\'', String, 'string'),
811
818
 
812
- ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
819
+ ('[a-zA-Z_]\w*', Name),
813
820
  (r'.', Text),
814
821
  ],
815
822
  'string': [
@@ -823,16 +830,12 @@ class OctaveLexer(RegexLexer):
823
830
  ],
824
831
  }
825
832
 
826
- def analyse_text(text):
827
- if re.match('^\s*[%#]', text, re.M): #Comment
828
- return 0.1
829
-
830
833
 
831
834
  class ScilabLexer(RegexLexer):
832
835
  """
833
836
  For Scilab source code.
834
837
 
835
- *New in Pygments 1.5.*
838
+ .. versionadded:: 1.5
836
839
  """
837
840
  name = 'Scilab'
838
841
  aliases = ['scilab']
@@ -871,14 +874,14 @@ class ScilabLexer(RegexLexer):
871
874
 
872
875
  # quote can be transpose, instead of string:
873
876
  # (not great, but handles common cases...)
874
- (r'(?<=[\w\)\]])\'', Operator),
875
- (r'(?<![\w\)\]])\'', String, 'string'),
877
+ (r'(?<=[\w\)\].])\'+', Operator),
878
+ (r'(?<![\w\)\].])\'', String, 'string'),
876
879
 
877
880
  (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
878
881
  (r'\d+[eEf][+-]?[0-9]+', Number.Float),
879
882
  (r'\d+', Number.Integer),
880
883
 
881
- ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
884
+ ('[a-zA-Z_]\w*', Name),
882
885
  (r'.', Text),
883
886
  ],
884
887
  'string': [
@@ -898,7 +901,7 @@ class NumPyLexer(PythonLexer):
898
901
  """
899
902
  A Python lexer recognizing Numerical Python builtins.
900
903
 
901
- *New in Pygments 0.10.*
904
+ .. versionadded:: 0.10
902
905
  """
903
906
 
904
907
  name = 'NumPy'
@@ -1039,15 +1042,266 @@ class SLexer(RegexLexer):
1039
1042
  """
1040
1043
  For S, S-plus, and R source code.
1041
1044
 
1042
- *New in Pygments 0.10.*
1045
+ .. versionadded:: 0.10
1043
1046
  """
1044
1047
 
1045
1048
  name = 'S'
1046
1049
  aliases = ['splus', 's', 'r']
1047
- filenames = ['*.S', '*.R', '.Rhistory', '.Rprofile']
1050
+ filenames = ['*.S', '*.R', '.Rhistory', '.Rprofile', '.Renviron']
1048
1051
  mimetypes = ['text/S-plus', 'text/S', 'text/x-r-source', 'text/x-r',
1049
1052
  'text/x-R', 'text/x-r-history', 'text/x-r-profile']
1050
1053
 
1054
+ builtins_base = [
1055
+ 'Arg', 'Conj', 'Cstack_info', 'Encoding', 'FALSE',
1056
+ 'Filter', 'Find', 'I', 'ISOdate', 'ISOdatetime', 'Im', 'Inf',
1057
+ 'La\.svd', 'Map', 'Math\.Date', 'Math\.POSIXt', 'Math\.data\.frame',
1058
+ 'Math\.difftime', 'Math\.factor', 'Mod', 'NA_character_',
1059
+ 'NA_complex_', 'NA_real_', 'NCOL', 'NROW', 'NULLNA_integer_', 'NaN',
1060
+ 'Negate', 'NextMethod', 'Ops\.Date', 'Ops\.POSIXt', 'Ops\.data\.frame',
1061
+ 'Ops\.difftime', 'Ops\.factor', 'Ops\.numeric_version', 'Ops\.ordered',
1062
+ 'Position', 'R\.Version', 'R\.home', 'R\.version', 'R\.version\.string',
1063
+ 'RNGkind', 'RNGversion', 'R_system_version', 'Re', 'Recall',
1064
+ 'Reduce', 'Summary\.Date', 'Summary\.POSIXct', 'Summary\.POSIXlt',
1065
+ 'Summary\.data\.frame', 'Summary\.difftime', 'Summary\.factor',
1066
+ 'Summary\.numeric_version', 'Summary\.ordered', 'Sys\.Date',
1067
+ 'Sys\.chmod', 'Sys\.getenv', 'Sys\.getlocale', 'Sys\.getpid',
1068
+ 'Sys\.glob', 'Sys\.info', 'Sys\.localeconv', 'Sys\.readlink',
1069
+ 'Sys\.setFileTime', 'Sys\.setenv', 'Sys\.setlocale', 'Sys\.sleep',
1070
+ 'Sys\.time', 'Sys\.timezone', 'Sys\.umask', 'Sys\.unsetenv',
1071
+ 'Sys\.which', 'TRUE', 'UseMethod', 'Vectorize', 'abbreviate', 'abs',
1072
+ 'acos', 'acosh', 'addNA', 'addTaskCallback', 'agrep', 'alist',
1073
+ 'all', 'all\.equal', 'all\.equal\.POSIXct', 'all\.equal\.character',
1074
+ 'all\.equal\.default', 'all\.equal\.factor', 'all\.equal\.formula',
1075
+ 'all\.equal\.language', 'all\.equal\.list', 'all\.equal\.numeric',
1076
+ 'all\.equal\.raw', 'all\.names', 'all\.vars', 'any', 'anyDuplicated',
1077
+ 'anyDuplicated\.array', 'anyDuplicated\.data\.frame',
1078
+ 'anyDuplicated\.default', 'anyDuplicated\.matrix', 'aperm',
1079
+ 'aperm\.default', 'aperm\.table', 'append', 'apply', 'args',
1080
+ 'arrayInd', 'as\.Date', 'as\.Date\.POSIXct', 'as\.Date\.POSIXlt',
1081
+ 'as\.Date\.character', 'as\.Date\.date', 'as\.Date\.dates',
1082
+ 'as\.Date\.default', 'as\.Date\.factor', 'as\.Date\.numeric',
1083
+ 'as\.POSIXct', 'as\.POSIXct\.Date', 'as\.POSIXct\.POSIXlt',
1084
+ 'as\.POSIXct\.date', 'as\.POSIXct\.dates', 'as\.POSIXct\.default',
1085
+ 'as\.POSIXct\.numeric', 'as\.POSIXlt', 'as\.POSIXlt\.Date',
1086
+ 'as\.POSIXlt\.POSIXct', 'as\.POSIXlt\.character', 'as\.POSIXlt\.date',
1087
+ 'as\.POSIXlt\.dates', 'as\.POSIXlt\.default', 'as\.POSIXlt\.factor',
1088
+ 'as\.POSIXlt\.numeric', 'as\.array', 'as\.array\.default', 'as\.call',
1089
+ 'as\.character', 'as\.character\.Date', 'as\.character\.POSIXt',
1090
+ 'as\.character\.condition', 'as\.character\.default',
1091
+ 'as\.character\.error', 'as\.character\.factor', 'as\.character\.hexmode',
1092
+ 'as\.character\.numeric_version', 'as\.character\.octmode',
1093
+ 'as\.character\.srcref', 'as\.complex', 'as\.data\.frame',
1094
+ 'as\.data\.frame\.AsIs', 'as\.data\.frame\.Date', 'as\.data\.frame\.POSIXct',
1095
+ 'as\.data\.frame\.POSIXlt', 'as\.data\.frame\.array',
1096
+ 'as\.data\.frame\.character', 'as\.data\.frame\.complex',
1097
+ 'as\.data\.frame\.data\.frame', 'as\.data\.frame\.default',
1098
+ 'as\.data\.frame\.difftime', 'as\.data\.frame\.factor',
1099
+ 'as\.data\.frame\.integer', 'as\.data\.frame\.list',
1100
+ 'as\.data\.frame\.logical', 'as\.data\.frame\.matrix',
1101
+ 'as\.data\.frame\.model\.matrix', 'as\.data\.frame\.numeric',
1102
+ 'as\.data\.frame\.numeric_version', 'as\.data\.frame\.ordered',
1103
+ 'as\.data\.frame\.raw', 'as\.data\.frame\.table', 'as\.data\.frame\.ts',
1104
+ 'as\.data\.frame\.vector', 'as\.difftime', 'as\.double',
1105
+ 'as\.double\.POSIXlt', 'as\.double\.difftime', 'as\.environment',
1106
+ 'as\.expression', 'as\.expression\.default', 'as\.factor',
1107
+ 'as\.function', 'as\.function\.default', 'as\.hexmode', 'as\.integer',
1108
+ 'as\.list', 'as\.list\.Date', 'as\.list\.POSIXct', 'as\.list\.data\.frame',
1109
+ 'as\.list\.default', 'as\.list\.environment', 'as\.list\.factor',
1110
+ 'as\.list\.function', 'as\.list\.numeric_version', 'as\.logical',
1111
+ 'as\.logical\.factor', 'as\.matrix', 'as\.matrix\.POSIXlt',
1112
+ 'as\.matrix\.data\.frame', 'as\.matrix\.default', 'as\.matrix\.noquote',
1113
+ 'as\.name', 'as\.null', 'as\.null\.default', 'as\.numeric',
1114
+ 'as\.numeric_version', 'as\.octmode', 'as\.ordered',
1115
+ 'as\.package_version', 'as\.pairlist', 'as\.qr', 'as\.raw', 'as\.single',
1116
+ 'as\.single\.default', 'as\.symbol', 'as\.table', 'as\.table\.default',
1117
+ 'as\.vector', 'as\.vector\.factor', 'asNamespace', 'asS3', 'asS4',
1118
+ 'asin', 'asinh', 'assign', 'atan', 'atan2', 'atanh',
1119
+ 'attachNamespace', 'attr', 'attr\.all\.equal', 'attributes',
1120
+ 'autoload', 'autoloader', 'backsolve', 'baseenv', 'basename',
1121
+ 'besselI', 'besselJ', 'besselK', 'besselY', 'beta',
1122
+ 'bindingIsActive', 'bindingIsLocked', 'bindtextdomain', 'bitwAnd',
1123
+ 'bitwNot', 'bitwOr', 'bitwShiftL', 'bitwShiftR', 'bitwXor', 'body',
1124
+ 'bquote', 'browser', 'browserCondition', 'browserSetDebug',
1125
+ 'browserText', 'builtins', 'by', 'by\.data\.frame', 'by\.default',
1126
+ 'bzfile', 'c\.Date', 'c\.POSIXct', 'c\.POSIXlt', 'c\.noquote',
1127
+ 'c\.numeric_version', 'call', 'callCC', 'capabilities', 'casefold',
1128
+ 'cat', 'category', 'cbind', 'cbind\.data\.frame', 'ceiling',
1129
+ 'char\.expand', 'charToRaw', 'charmatch', 'chartr', 'check_tzones',
1130
+ 'chol', 'chol\.default', 'chol2inv', 'choose', 'class',
1131
+ 'clearPushBack', 'close', 'close\.connection', 'close\.srcfile',
1132
+ 'close\.srcfilealias', 'closeAllConnections', 'col', 'colMeans',
1133
+ 'colSums', 'colnames', 'commandArgs', 'comment', 'computeRestarts',
1134
+ 'conditionCall', 'conditionCall\.condition', 'conditionMessage',
1135
+ 'conditionMessage\.condition', 'conflicts', 'contributors', 'cos',
1136
+ 'cosh', 'crossprod', 'cummax', 'cummin', 'cumprod', 'cumsum', 'cut',
1137
+ 'cut\.Date', 'cut\.POSIXt', 'cut\.default', 'dQuote', 'data\.class',
1138
+ 'data\.matrix', 'date', 'debug', 'debugonce',
1139
+ 'default\.stringsAsFactors', 'delayedAssign', 'deparse', 'det',
1140
+ 'determinant', 'determinant\.matrix', 'dget', 'diag', 'diff',
1141
+ 'diff\.Date', 'diff\.POSIXt', 'diff\.default', 'difftime', 'digamma',
1142
+ 'dim', 'dim\.data\.frame', 'dimnames', 'dimnames\.data\.frame', 'dir',
1143
+ 'dir\.create', 'dirname', 'do\.call', 'dput', 'drop', 'droplevels',
1144
+ 'droplevels\.data\.frame', 'droplevels\.factor', 'dump', 'duplicated',
1145
+ 'duplicated\.POSIXlt', 'duplicated\.array', 'duplicated\.data\.frame',
1146
+ 'duplicated\.default', 'duplicated\.matrix',
1147
+ 'duplicated\.numeric_version', 'dyn\.load', 'dyn\.unload', 'eapply',
1148
+ 'eigen', 'else', 'emptyenv', 'enc2native', 'enc2utf8',
1149
+ 'encodeString', 'enquote', 'env\.profile', 'environment',
1150
+ 'environmentIsLocked', 'environmentName', 'eval', 'eval\.parent',
1151
+ 'evalq', 'exists', 'exp', 'expand\.grid', 'expm1', 'expression',
1152
+ 'factor', 'factorial', 'fifo', 'file', 'file\.access', 'file\.append',
1153
+ 'file\.choose', 'file\.copy', 'file\.create', 'file\.exists',
1154
+ 'file\.info', 'file\.link', 'file\.path', 'file\.remove', 'file\.rename',
1155
+ 'file\.show', 'file\.symlink', 'find\.package', 'findInterval',
1156
+ 'findPackageEnv', 'findRestart', 'floor', 'flush',
1157
+ 'flush\.connection', 'force', 'formals', 'format',
1158
+ 'format\.AsIs', 'format\.Date', 'format\.POSIXct', 'format\.POSIXlt',
1159
+ 'format\.data\.frame', 'format\.default', 'format\.difftime',
1160
+ 'format\.factor', 'format\.hexmode', 'format\.info',
1161
+ 'format\.libraryIQR', 'format\.numeric_version', 'format\.octmode',
1162
+ 'format\.packageInfo', 'format\.pval', 'format\.summaryDefault',
1163
+ 'formatC', 'formatDL', 'forwardsolve', 'gamma', 'gc', 'gc\.time',
1164
+ 'gcinfo', 'gctorture', 'gctorture2', 'get', 'getAllConnections',
1165
+ 'getCallingDLL', 'getCallingDLLe', 'getConnection',
1166
+ 'getDLLRegisteredRoutines', 'getDLLRegisteredRoutines\.DLLInfo',
1167
+ 'getDLLRegisteredRoutines\.character', 'getElement',
1168
+ 'getExportedValue', 'getHook', 'getLoadedDLLs', 'getNamespace',
1169
+ 'getNamespaceExports', 'getNamespaceImports', 'getNamespaceInfo',
1170
+ 'getNamespaceName', 'getNamespaceUsers', 'getNamespaceVersion',
1171
+ 'getNativeSymbolInfo', 'getOption', 'getRversion', 'getSrcLines',
1172
+ 'getTaskCallbackNames', 'geterrmessage', 'gettext', 'gettextf',
1173
+ 'getwd', 'gl', 'globalenv', 'gregexpr', 'grep', 'grepRaw', 'grepl',
1174
+ 'gsub', 'gzcon', 'gzfile', 'head', 'iconv', 'iconvlist',
1175
+ 'icuSetCollate', 'identical', 'identity', 'ifelse', 'importIntoEnv',
1176
+ 'in', 'inherits', 'intToBits', 'intToUtf8', 'interaction', 'interactive',
1177
+ 'intersect', 'inverse\.rle', 'invisible', 'invokeRestart',
1178
+ 'invokeRestartInteractively', 'is\.R', 'is\.array', 'is\.atomic',
1179
+ 'is\.call', 'is\.character', 'is\.complex', 'is\.data\.frame',
1180
+ 'is\.double', 'is\.element', 'is\.environment', 'is\.expression',
1181
+ 'is\.factor', 'is\.finite', 'is\.function', 'is\.infinite',
1182
+ 'is\.integer', 'is\.language', 'is\.list', 'is\.loaded', 'is\.logical',
1183
+ 'is\.matrix', 'is\.na', 'is\.na\.POSIXlt', 'is\.na\.data\.frame',
1184
+ 'is\.na\.numeric_version', 'is\.name', 'is\.nan', 'is\.null',
1185
+ 'is\.numeric', 'is\.numeric\.Date', 'is\.numeric\.POSIXt',
1186
+ 'is\.numeric\.difftime', 'is\.numeric_version', 'is\.object',
1187
+ 'is\.ordered', 'is\.package_version', 'is\.pairlist', 'is\.primitive',
1188
+ 'is\.qr', 'is\.raw', 'is\.recursive', 'is\.single', 'is\.symbol',
1189
+ 'is\.table', 'is\.unsorted', 'is\.vector', 'isBaseNamespace',
1190
+ 'isIncomplete', 'isNamespace', 'isOpen', 'isRestart', 'isS4',
1191
+ 'isSeekable', 'isSymmetric', 'isSymmetric\.matrix', 'isTRUE',
1192
+ 'isatty', 'isdebugged', 'jitter', 'julian', 'julian\.Date',
1193
+ 'julian\.POSIXt', 'kappa', 'kappa\.default', 'kappa\.lm', 'kappa\.qr',
1194
+ 'kronecker', 'l10n_info', 'labels', 'labels\.default', 'lapply',
1195
+ 'lazyLoad', 'lazyLoadDBexec', 'lazyLoadDBfetch', 'lbeta', 'lchoose',
1196
+ 'length', 'length\.POSIXlt', 'letters', 'levels', 'levels\.default',
1197
+ 'lfactorial', 'lgamma', 'library\.dynam', 'library\.dynam\.unload',
1198
+ 'licence', 'license', 'list\.dirs', 'list\.files', 'list2env', 'load',
1199
+ 'loadNamespace', 'loadedNamespaces', 'loadingNamespaceInfo',
1200
+ 'local', 'lockBinding', 'lockEnvironment', 'log', 'log10', 'log1p',
1201
+ 'log2', 'logb', 'lower\.tri', 'ls', 'make\.names', 'make\.unique',
1202
+ 'makeActiveBinding', 'mapply', 'margin\.table', 'mat\.or\.vec',
1203
+ 'match', 'match\.arg', 'match\.call', 'match\.fun', 'max', 'max\.col',
1204
+ 'mean', 'mean\.Date', 'mean\.POSIXct', 'mean\.POSIXlt', 'mean\.default',
1205
+ 'mean\.difftime', 'mem\.limits', 'memCompress', 'memDecompress',
1206
+ 'memory\.profile', 'merge', 'merge\.data\.frame', 'merge\.default',
1207
+ 'message', 'mget', 'min', 'missing', 'mode', 'month\.abb',
1208
+ 'month\.name', 'months', 'months\.Date', 'months\.POSIXt',
1209
+ 'months\.abb', 'months\.nameletters', 'names', 'names\.POSIXlt',
1210
+ 'namespaceExport', 'namespaceImport', 'namespaceImportClasses',
1211
+ 'namespaceImportFrom', 'namespaceImportMethods', 'nargs', 'nchar',
1212
+ 'ncol', 'new\.env', 'ngettext', 'nlevels', 'noquote', 'norm',
1213
+ 'normalizePath', 'nrow', 'numeric_version', 'nzchar', 'objects',
1214
+ 'oldClass', 'on\.exit', 'open', 'open\.connection', 'open\.srcfile',
1215
+ 'open\.srcfilealias', 'open\.srcfilecopy', 'options', 'order',
1216
+ 'ordered', 'outer', 'packBits', 'packageEvent',
1217
+ 'packageHasNamespace', 'packageStartupMessage', 'package_version',
1218
+ 'pairlist', 'parent\.env', 'parent\.frame', 'parse',
1219
+ 'parseNamespaceFile', 'paste', 'paste0', 'path\.expand',
1220
+ 'path\.package', 'pipe', 'pmatch', 'pmax', 'pmax\.int', 'pmin',
1221
+ 'pmin\.int', 'polyroot', 'pos\.to\.env', 'pretty', 'pretty\.default',
1222
+ 'prettyNum', 'print', 'print\.AsIs', 'print\.DLLInfo',
1223
+ 'print\.DLLInfoList', 'print\.DLLRegisteredRoutines', 'print\.Date',
1224
+ 'print\.NativeRoutineList', 'print\.POSIXct', 'print\.POSIXlt',
1225
+ 'print\.by', 'print\.condition', 'print\.connection',
1226
+ 'print\.data\.frame', 'print\.default', 'print\.difftime',
1227
+ 'print\.factor', 'print\.function', 'print\.hexmode',
1228
+ 'print\.libraryIQR', 'print\.listof', 'print\.noquote',
1229
+ 'print\.numeric_version', 'print\.octmode', 'print\.packageInfo',
1230
+ 'print\.proc_time', 'print\.restart', 'print\.rle',
1231
+ 'print\.simple\.list', 'print\.srcfile', 'print\.srcref',
1232
+ 'print\.summary\.table', 'print\.summaryDefault', 'print\.table',
1233
+ 'print\.warnings', 'prmatrix', 'proc\.time', 'prod', 'prop\.table',
1234
+ 'provideDimnames', 'psigamma', 'pushBack', 'pushBackLength', 'q',
1235
+ 'qr', 'qr\.Q', 'qr\.R', 'qr\.X', 'qr\.coef', 'qr\.default', 'qr\.fitted',
1236
+ 'qr\.qty', 'qr\.qy', 'qr\.resid', 'qr\.solve', 'quarters',
1237
+ 'quarters\.Date', 'quarters\.POSIXt', 'quit', 'quote', 'range',
1238
+ 'range\.default', 'rank', 'rapply', 'raw', 'rawConnection',
1239
+ 'rawConnectionValue', 'rawShift', 'rawToBits', 'rawToChar', 'rbind',
1240
+ 'rbind\.data\.frame', 'rcond', 'read\.dcf', 'readBin', 'readChar',
1241
+ 'readLines', 'readRDS', 'readRenviron', 'readline', 'reg\.finalizer',
1242
+ 'regexec', 'regexpr', 'registerS3method', 'registerS3methods',
1243
+ 'regmatches', 'remove', 'removeTaskCallback', 'rep', 'rep\.Date',
1244
+ 'rep\.POSIXct', 'rep\.POSIXlt', 'rep\.factor', 'rep\.int',
1245
+ 'rep\.numeric_version', 'rep_len', 'replace', 'replicate',
1246
+ 'requireNamespace', 'restartDescription', 'restartFormals',
1247
+ 'retracemem', 'rev', 'rev\.default', 'rle', 'rm', 'round',
1248
+ 'round\.Date', 'round\.POSIXt', 'row', 'row\.names',
1249
+ 'row\.names\.data\.frame', 'row\.names\.default', 'rowMeans', 'rowSums',
1250
+ 'rownames', 'rowsum', 'rowsum\.data\.frame', 'rowsum\.default',
1251
+ 'sQuote', 'sample', 'sample\.int', 'sapply', 'save', 'save\.image',
1252
+ 'saveRDS', 'scale', 'scale\.default', 'scan', 'search',
1253
+ 'searchpaths', 'seek', 'seek\.connection', 'seq', 'seq\.Date',
1254
+ 'seq\.POSIXt', 'seq\.default', 'seq\.int', 'seq_along', 'seq_len',
1255
+ 'sequence', 'serialize', 'set\.seed', 'setHook', 'setNamespaceInfo',
1256
+ 'setSessionTimeLimit', 'setTimeLimit', 'setdiff', 'setequal',
1257
+ 'setwd', 'shQuote', 'showConnections', 'sign', 'signalCondition',
1258
+ 'signif', 'simpleCondition', 'simpleError', 'simpleMessage',
1259
+ 'simpleWarning', 'simplify2array', 'sin', 'single',
1260
+ 'sinh', 'sink', 'sink\.number', 'slice\.index', 'socketConnection',
1261
+ 'socketSelect', 'solve', 'solve\.default', 'solve\.qr', 'sort',
1262
+ 'sort\.POSIXlt', 'sort\.default', 'sort\.int', 'sort\.list', 'split',
1263
+ 'split\.Date', 'split\.POSIXct', 'split\.data\.frame', 'split\.default',
1264
+ 'sprintf', 'sqrt', 'srcfile', 'srcfilealias', 'srcfilecopy',
1265
+ 'srcref', 'standardGeneric', 'stderr', 'stdin', 'stdout', 'stop',
1266
+ 'stopifnot', 'storage\.mode', 'strftime', 'strptime', 'strsplit',
1267
+ 'strtoi', 'strtrim', 'structure', 'strwrap', 'sub', 'subset',
1268
+ 'subset\.data\.frame', 'subset\.default', 'subset\.matrix',
1269
+ 'substitute', 'substr', 'substring', 'sum', 'summary',
1270
+ 'summary\.Date', 'summary\.POSIXct', 'summary\.POSIXlt',
1271
+ 'summary\.connection', 'summary\.data\.frame', 'summary\.default',
1272
+ 'summary\.factor', 'summary\.matrix', 'summary\.proc_time',
1273
+ 'summary\.srcfile', 'summary\.srcref', 'summary\.table',
1274
+ 'suppressMessages', 'suppressPackageStartupMessages',
1275
+ 'suppressWarnings', 'svd', 'sweep', 'sys\.call', 'sys\.calls',
1276
+ 'sys\.frame', 'sys\.frames', 'sys\.function', 'sys\.load\.image',
1277
+ 'sys\.nframe', 'sys\.on\.exit', 'sys\.parent', 'sys\.parents',
1278
+ 'sys\.save\.image', 'sys\.source', 'sys\.status', 'system',
1279
+ 'system\.file', 'system\.time', 'system2', 't', 't\.data\.frame',
1280
+ 't\.default', 'table', 'tabulate', 'tail', 'tan', 'tanh', 'tapply',
1281
+ 'taskCallbackManager', 'tcrossprod', 'tempdir', 'tempfile',
1282
+ 'testPlatformEquivalence', 'textConnection', 'textConnectionValue',
1283
+ 'toString', 'toString\.default', 'tolower', 'topenv', 'toupper',
1284
+ 'trace', 'traceback', 'tracemem', 'tracingState', 'transform',
1285
+ 'transform\.data\.frame', 'transform\.default', 'trigamma', 'trunc',
1286
+ 'trunc\.Date', 'trunc\.POSIXt', 'truncate', 'truncate\.connection',
1287
+ 'try', 'tryCatch', 'typeof', 'unclass', 'undebug', 'union',
1288
+ 'unique', 'unique\.POSIXlt', 'unique\.array', 'unique\.data\.frame',
1289
+ 'unique\.default', 'unique\.matrix', 'unique\.numeric_version',
1290
+ 'units', 'units\.difftime', 'unix\.time', 'unlink', 'unlist',
1291
+ 'unloadNamespace', 'unlockBinding', 'unname', 'unserialize',
1292
+ 'unsplit', 'untrace', 'untracemem', 'unz', 'upper\.tri', 'url',
1293
+ 'utf8ToInt', 'vapply', 'version', 'warning', 'warnings', 'weekdays',
1294
+ 'weekdays\.Date', 'weekdays\.POSIXt', 'which', 'which\.max',
1295
+ 'which\.min', 'with', 'with\.default', 'withCallingHandlers',
1296
+ 'withRestarts', 'withVisible', 'within', 'within\.data\.frame',
1297
+ 'within\.list', 'write', 'write\.dcf', 'writeBin', 'writeChar',
1298
+ 'writeLines', 'xor', 'xor\.hexmode', 'xor\.octmode',
1299
+ 'xpdrows\.data\.frame', 'xtfrm', 'xtfrm\.AsIs', 'xtfrm\.Date',
1300
+ 'xtfrm\.POSIXct', 'xtfrm\.POSIXlt', 'xtfrm\.Surv', 'xtfrm\.default',
1301
+ 'xtfrm\.difftime', 'xtfrm\.factor', 'xtfrm\.numeric_version', 'xzfile',
1302
+ 'zapsmall'
1303
+ ]
1304
+
1051
1305
  tokens = {
1052
1306
  'comments': [
1053
1307
  (r'#.*$', Comment.Single),
@@ -1061,9 +1315,19 @@ class SLexer(RegexLexer):
1061
1315
  (r'\[{1,2}|\]{1,2}|\(|\)|;|,', Punctuation),
1062
1316
  ],
1063
1317
  'keywords': [
1318
+ (r'(' + r'|'.join(builtins_base) + r')'
1319
+ r'(?![\w\. =])',
1320
+ Keyword.Pseudo),
1064
1321
  (r'(if|else|for|while|repeat|in|next|break|return|switch|function)'
1065
- r'(?![0-9a-zA-Z\._])',
1066
- Keyword.Reserved)
1322
+ r'(?![\w\.])',
1323
+ Keyword.Reserved),
1324
+ (r'(array|category|character|complex|double|function|integer|list|'
1325
+ r'logical|matrix|numeric|vector|data.frame|c)'
1326
+ r'(?![\w\.])',
1327
+ Keyword.Type),
1328
+ (r'(library|require|attach|detach|source)'
1329
+ r'(?![\w\.])',
1330
+ Keyword.Namespace)
1067
1331
  ],
1068
1332
  'operators': [
1069
1333
  (r'<<?-|->>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|\?', Operator),
@@ -1071,16 +1335,16 @@ class SLexer(RegexLexer):
1071
1335
  ],
1072
1336
  'builtin_symbols': [
1073
1337
  (r'(NULL|NA(_(integer|real|complex|character)_)?|'
1074
- r'Inf|TRUE|FALSE|NaN|\.\.(\.|[0-9]+))'
1338
+ r'letters|LETTERS|Inf|TRUE|FALSE|NaN|pi|\.\.(\.|[0-9]+))'
1075
1339
  r'(?![0-9a-zA-Z\._])',
1076
1340
  Keyword.Constant),
1077
- (r'(T|F)\b', Keyword.Variable),
1341
+ (r'(T|F)\b', Name.Builtin.Pseudo),
1078
1342
  ],
1079
1343
  'numbers': [
1080
1344
  # hex number
1081
1345
  (r'0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?', Number.Hex),
1082
1346
  # decimal number
1083
- (r'[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?[Li]?',
1347
+ (r'[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+|\.)([eE][+-]?[0-9]+)?[Li]?',
1084
1348
  Number),
1085
1349
  ],
1086
1350
  'statements': [
@@ -1127,7 +1391,7 @@ class BugsLexer(RegexLexer):
1127
1391
  Pygments Lexer for `OpenBugs <http://www.openbugs.info/w/>`_ and WinBugs
1128
1392
  models.
1129
1393
 
1130
- *New in Pygments 1.6.*
1394
+ .. versionadded:: 1.6
1131
1395
  """
1132
1396
 
1133
1397
  name = 'BUGS'
@@ -1197,7 +1461,7 @@ class BugsLexer(RegexLexer):
1197
1461
  % r'|'.join(_FUNCTIONS + _DISTRIBUTIONS),
1198
1462
  Name.Builtin),
1199
1463
  # Regular variable names
1200
- (r'[A-Za-z][A-Za-z0-9_.]*', Name),
1464
+ (r'[A-Za-z][\w.]*', Name),
1201
1465
  # Number Literals
1202
1466
  (r'[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?', Number),
1203
1467
  # Punctuation
@@ -1222,7 +1486,7 @@ class JagsLexer(RegexLexer):
1222
1486
  """
1223
1487
  Pygments Lexer for JAGS.
1224
1488
 
1225
- *New in Pygments 1.6.*
1489
+ .. versionadded:: 1.6
1226
1490
  """
1227
1491
 
1228
1492
  name = 'JAGS'
@@ -1257,7 +1521,7 @@ class JagsLexer(RegexLexer):
1257
1521
  ],
1258
1522
  'names' : [
1259
1523
  # Regular variable names
1260
- (r'[a-zA-Z][a-zA-Z0-9_.]*\b', Name),
1524
+ (r'[a-zA-Z][\w.]*\b', Name),
1261
1525
  ],
1262
1526
  'comments' : [
1263
1527
  # do not use stateful comments
@@ -1308,11 +1572,10 @@ class JagsLexer(RegexLexer):
1308
1572
  class StanLexer(RegexLexer):
1309
1573
  """Pygments Lexer for Stan models.
1310
1574
 
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>`_.
1575
+ The Stan modeling language is specified in the *Stan Modeling Language User's Guide and Reference Manual, v2.2.0*,
1576
+ `pdf <https://github.com/stan-dev/stan/releases/download/v2.2.0/stan-reference-2.2.0.pdf>`__.
1314
1577
 
1315
- *New in Pygments 1.6.*
1578
+ .. versionadded:: 1.6
1316
1579
  """
1317
1580
 
1318
1581
  name = 'Stan'
@@ -1355,10 +1618,10 @@ class StanLexer(RegexLexer):
1355
1618
  + _stan_builtins.DISTRIBUTIONS),
1356
1619
  Name.Builtin),
1357
1620
  # Special names ending in __, like lp__
1358
- (r'[A-Za-z][A-Za-z0-9_]*__\b', Name.Builtin.Pseudo),
1621
+ (r'[A-Za-z]\w*__\b', Name.Builtin.Pseudo),
1359
1622
  (r'(%s)\b' % r'|'.join(_stan_builtins.RESERVED), Keyword.Reserved),
1360
1623
  # Regular variable names
1361
- (r'[A-Za-z][A-Za-z0-9_]*\b', Name),
1624
+ (r'[A-Za-z]\w*\b', Name),
1362
1625
  # Real Literals
1363
1626
  (r'-?[0-9]+(\.[0-9]+)?[eE]-?[0-9]+', Number.Float),
1364
1627
  (r'-?[0-9]*\.[0-9]*', Number.Float),
@@ -1385,13 +1648,15 @@ class IDLLexer(RegexLexer):
1385
1648
  """
1386
1649
  Pygments Lexer for IDL (Interactive Data Language).
1387
1650
 
1388
- *New in Pygments 1.6.*
1651
+ .. versionadded:: 1.6
1389
1652
  """
1390
1653
  name = 'IDL'
1391
1654
  aliases = ['idl']
1392
1655
  filenames = ['*.pro']
1393
1656
  mimetypes = ['text/idl']
1394
1657
 
1658
+ flags = re.IGNORECASE | re.MULTILINE
1659
+
1395
1660
  _RESERVED = ['and', 'begin', 'break', 'case', 'common', 'compile_opt',
1396
1661
  'continue', 'do', 'else', 'end', 'endcase', 'elseelse',
1397
1662
  'endfor', 'endforeach', 'endif', 'endrep', 'endswitch',
@@ -1413,7 +1678,7 @@ class IDLLexer(RegexLexer):
1413
1678
  'broyden', 'butterworth', 'bytarr', 'byte', 'byteorder',
1414
1679
  'bytscl', 'caldat', 'calendar', 'call_external',
1415
1680
  'call_function', 'call_method', 'call_procedure', 'canny',
1416
- 'catch', 'cd', 'cdf_[0-9a-za-z_]*', 'ceil', 'chebyshev',
1681
+ 'catch', 'cd', 'cdf_\w*', 'ceil', 'chebyshev',
1417
1682
  'check_math',
1418
1683
  'chisqr_cvf', 'chisqr_pdf', 'choldc', 'cholsol', 'cindgen',
1419
1684
  'cir_3pnt', 'close', 'cluster', 'cluster_tree', 'clust_wts',
@@ -1447,7 +1712,7 @@ class IDLLexer(RegexLexer):
1447
1712
  'dlm_load', 'dlm_register', 'doc_library', 'double',
1448
1713
  'draw_roi', 'edge_dog', 'efont', 'eigenql', 'eigenvec',
1449
1714
  'ellipse', 'elmhes', 'emboss', 'empty', 'enable_sysrtn',
1450
- 'eof', 'eos_[0-9a-za-z_]*', 'erase', 'erf', 'erfc', 'erfcx',
1715
+ 'eof', 'eos_\w*', 'erase', 'erf', 'erfc', 'erfcx',
1451
1716
  'erode', 'errorplot', 'errplot', 'estimator_filter',
1452
1717
  'execute', 'exit', 'exp', 'expand', 'expand_path', 'expint',
1453
1718
  'extrac', 'extract_slice', 'factorial', 'fft', 'filepath',
@@ -1464,11 +1729,11 @@ class IDLLexer(RegexLexer):
1464
1729
  'gauss_cvf', 'gauss_pdf', 'gauss_smooth', 'getenv',
1465
1730
  'getwindows', 'get_drive_list', 'get_dxf_objects',
1466
1731
  'get_kbrd', 'get_login_info', 'get_lun', 'get_screen_size',
1467
- 'greg2jul', 'grib_[0-9a-za-z_]*', 'grid3', 'griddata',
1732
+ 'greg2jul', 'grib_\w*', 'grid3', 'griddata',
1468
1733
  'grid_input', 'grid_tps', 'gs_iter',
1469
- 'h5[adfgirst]_[0-9a-za-z_]*', 'h5_browser', 'h5_close',
1734
+ 'h5[adfgirst]_\w*', 'h5_browser', 'h5_close',
1470
1735
  'h5_create', 'h5_get_libversion', 'h5_open', 'h5_parse',
1471
- 'hanning', 'hash', 'hdf_[0-9a-za-z_]*', 'heap_free',
1736
+ 'hanning', 'hash', 'hdf_\w*', 'heap_free',
1472
1737
  'heap_gc', 'heap_nosave', 'heap_refcount', 'heap_save',
1473
1738
  'help', 'hilbert', 'histogram', 'hist_2d', 'hist_equal',
1474
1739
  'hls', 'hough', 'hqr', 'hsv', 'h_eq_ct', 'h_eq_int',
@@ -1516,7 +1781,7 @@ class IDLLexer(RegexLexer):
1516
1781
  'modifyct', 'moment', 'morph_close', 'morph_distance',
1517
1782
  'morph_gradient', 'morph_hitormiss', 'morph_open',
1518
1783
  'morph_thin', 'morph_tophat', 'multi', 'm_correlate',
1519
- 'ncdf_[0-9a-za-z_]*', 'newton', 'noise_hurl', 'noise_pick',
1784
+ 'ncdf_\w*', 'newton', 'noise_hurl', 'noise_pick',
1520
1785
  'noise_scatter', 'noise_slur', 'norm', 'n_elements',
1521
1786
  'n_params', 'n_tags', 'objarr', 'obj_class', 'obj_destroy',
1522
1787
  'obj_hasmethod', 'obj_isa', 'obj_new', 'obj_valid',
@@ -1631,7 +1896,7 @@ class RdLexer(RegexLexer):
1631
1896
  Extensions <http://cran.r-project.org/doc/manuals/R-exts.html>`_
1632
1897
  and `Parsing Rd files <developer.r-project.org/parseRd.pdf>`_.
1633
1898
 
1634
- *New in Pygments 1.6.*
1899
+ .. versionadded:: 1.6
1635
1900
  """
1636
1901
  name = 'Rd'
1637
1902
  aliases = ['rd']
@@ -1666,7 +1931,7 @@ class IgorLexer(RegexLexer):
1666
1931
  Pygments Lexer for Igor Pro procedure files (.ipf).
1667
1932
  See http://www.wavemetrics.com/ and http://www.igorexchange.com/.
1668
1933
 
1669
- *New in Pygments 1.7.*
1934
+ .. versionadded:: 2.0
1670
1935
  """
1671
1936
 
1672
1937
  name = 'Igor'
@@ -1674,18 +1939,22 @@ class IgorLexer(RegexLexer):
1674
1939
  filenames = ['*.ipf']
1675
1940
  mimetypes = ['text/ipf']
1676
1941
 
1677
- flags = re.IGNORECASE
1942
+ flags = re.IGNORECASE | re.MULTILINE
1678
1943
 
1679
1944
  flowControl = [
1680
1945
  'if', 'else', 'elseif', 'endif', 'for', 'endfor', 'strswitch', 'switch',
1681
- 'case', 'endswitch', 'do', 'while', 'try', 'catch', 'endtry', 'break',
1682
- 'continue', 'return',
1946
+ 'case', 'default', 'endswitch', 'do', 'while', 'try', 'catch', 'endtry',
1947
+ 'break', 'continue', 'return',
1683
1948
  ]
1684
1949
  types = [
1685
1950
  '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',
1951
+ 'STRUCT', 'dfref'
1952
+ ]
1953
+ keywords = [
1954
+ 'override', 'ThreadSafe', 'static', 'FuncFit', 'Proc', 'Picture',
1955
+ 'Prompt', 'DoPrompt', 'macro', 'window', 'graph', 'function', 'end',
1956
+ 'Structure', 'EndStructure', 'EndMacro', 'Menu', 'SubMenu', 'Prompt',
1957
+ 'DoPrompt',
1689
1958
  ]
1690
1959
  operations = [
1691
1960
  'Abort', 'AddFIFOData', 'AddFIFOVectData', 'AddMovieAudio',
@@ -1905,6 +2174,8 @@ class IgorLexer(RegexLexer):
1905
2174
  (r'\b(%s)\b' % '|'.join(flowControl), Keyword),
1906
2175
  # Types.
1907
2176
  (r'\b(%s)\b' % '|'.join(types), Keyword.Type),
2177
+ # Keywords.
2178
+ (r'\b(%s)\b' % '|'.join(keywords), Keyword.Reserved),
1908
2179
  # Built-in operations.
1909
2180
  (r'\b(%s)\b' % '|'.join(operations), Name.Class),
1910
2181
  # Built-in functions.
@@ -1912,7 +2183,104 @@ class IgorLexer(RegexLexer):
1912
2183
  # Compiler directives.
1913
2184
  (r'^#(include|pragma|define|ifdef|ifndef|endif)',
1914
2185
  Name.Decorator),
1915
- (r'[^a-zA-Z"/]+', Text),
2186
+ (r'[^a-z"/]+$', Text),
1916
2187
  (r'.', Text),
1917
2188
  ],
1918
2189
  }
2190
+
2191
+
2192
+ class MathematicaLexer(RegexLexer):
2193
+ """
2194
+ Lexer for `Mathematica <http://www.wolfram.com/mathematica/>`_ source code.
2195
+
2196
+ .. versionadded:: 2.0
2197
+ """
2198
+ name = 'Mathematica'
2199
+ aliases = ['mathematica', 'mma', 'nb']
2200
+ filenames = ['*.nb', '*.cdf', '*.nbp', '*.ma']
2201
+ mimetypes = ['application/mathematica',
2202
+ 'application/vnd.wolfram.mathematica',
2203
+ 'application/vnd.wolfram.mathematica.package',
2204
+ 'application/vnd.wolfram.cdf']
2205
+
2206
+ # http://reference.wolfram.com/mathematica/guide/Syntax.html
2207
+ operators = [
2208
+ ";;", "=", "=.", "!=" "==", ":=", "->", ":>", "/.", "+", "-", "*", "/",
2209
+ "^", "&&", "||", "!", "<>", "|", "/;", "?", "@", "//", "/@", "@@",
2210
+ "@@@", "~~", "===", "&"]
2211
+ operators.sort(reverse=True)
2212
+
2213
+ punctuation = [",", ";", "(", ")", "[", "]", "{", "}"]
2214
+
2215
+ def _multi_escape(entries):
2216
+ return '(%s)' % ('|'.join(re.escape(entry) for entry in entries))
2217
+
2218
+ tokens = {
2219
+ 'root': [
2220
+ (r'(?s)\(\*.*?\*\)', Comment),
2221
+
2222
+ (r'([a-zA-Z]+[A-Za-z0-9]*`)', Name.Namespace),
2223
+ (r'([A-Za-z0-9]*_+[A-Za-z0-9]*)', Name.Variable),
2224
+ (r'#\d*', Name.Variable),
2225
+ (r'([a-zA-Z]+[a-zA-Z0-9]*)', Name),
2226
+
2227
+ (r'-?[0-9]+\.[0-9]*', Number.Float),
2228
+ (r'-?[0-9]*\.[0-9]+', Number.Float),
2229
+ (r'-?[0-9]+', Number.Integer),
2230
+
2231
+ (_multi_escape(operators), Operator),
2232
+ (_multi_escape(punctuation), Punctuation),
2233
+ (r'".*?"', String),
2234
+ (r'\s+', Text.Whitespace),
2235
+ ],
2236
+ }
2237
+
2238
+ class GAPLexer(RegexLexer):
2239
+ """
2240
+ For `GAP <http://www.gap-system.org>`_ source code.
2241
+
2242
+ .. versionadded:: 2.0
2243
+ """
2244
+ name = 'GAP'
2245
+ aliases = ['gap']
2246
+ filenames = ['*.g', '*.gd', '*.gi', '*.gap']
2247
+
2248
+ tokens = {
2249
+ 'root' : [
2250
+ (r'#.*$', Comment.Single),
2251
+ (r'"(?:[^"\\]|\\.)*"', String),
2252
+ (r'\(|\)|\[|\]|\{|\}', Punctuation),
2253
+ (r'''(?x)\b(?:
2254
+ if|then|elif|else|fi|
2255
+ for|while|do|od|
2256
+ repeat|until|
2257
+ break|continue|
2258
+ function|local|return|end|
2259
+ rec|
2260
+ quit|QUIT|
2261
+ IsBound|Unbind|
2262
+ TryNextMethod|
2263
+ Info|Assert
2264
+ )\b''', Keyword),
2265
+ (r'''(?x)\b(?:
2266
+ true|false|fail|infinity
2267
+ )\b''',
2268
+ Name.Constant),
2269
+ (r'''(?x)\b(?:
2270
+ (Declare|Install)([A-Z][A-Za-z]+)|
2271
+ BindGlobal|BIND_GLOBAL
2272
+ )\b''',
2273
+ Name.Builtin),
2274
+ (r'\.|,|:=|;|=|\+|-|\*|/|\^|>|<', Operator),
2275
+ (r'''(?x)\b(?:
2276
+ and|or|not|mod|in
2277
+ )\b''',
2278
+ Operator.Word),
2279
+ (r'''(?x)
2280
+ (?:[a-zA-Z_0-9]+|`[^`]*`)
2281
+ (?:::[a-zA-Z_0-9]+|`[^`]*`)*''', Name.Variable),
2282
+ (r'[0-9]+(?:\.[0-9]*)?(?:e[0-9]+)?', Number),
2283
+ (r'\.[0-9]+(?:e[0-9]+)?', Number),
2284
+ (r'.', Text)
2285
+ ]
2286
+ }