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,7 +5,7 @@
5
5
 
6
6
  Lexers for non-source code file types.
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
 
@@ -13,10 +13,11 @@ import re
13
13
  from bisect import bisect
14
14
 
15
15
  from pygments.lexer import Lexer, LexerContext, RegexLexer, ExtendedRegexLexer, \
16
- bygroups, include, using, this, do_insertions
16
+ bygroups, include, using, this, do_insertions, default
17
17
  from pygments.token import Punctuation, Text, Comment, Keyword, Name, String, \
18
18
  Generic, Operator, Number, Whitespace, Literal
19
19
  from pygments.util import get_bool_opt, ClassNotFound
20
+ from pygments.lexers.agile import PythonLexer
20
21
  from pygments.lexers.other import BashLexer
21
22
 
22
23
  __all__ = ['IniLexer', 'PropertiesLexer', 'SourcesListLexer', 'BaseMakefileLexer',
@@ -25,7 +26,8 @@ __all__ = ['IniLexer', 'PropertiesLexer', 'SourcesListLexer', 'BaseMakefileLexer
25
26
  'RstLexer', 'VimLexer', 'GettextLexer', 'SquidConfLexer',
26
27
  'DebianControlLexer', 'DarcsPatchLexer', 'YamlLexer',
27
28
  'LighttpdConfLexer', 'NginxConfLexer', 'CMakeLexer', 'HttpLexer',
28
- 'PyPyLogLexer', 'RegeditLexer', 'HxmlLexer', 'EbnfLexer']
29
+ 'PyPyLogLexer', 'RegeditLexer', 'HxmlLexer', 'EbnfLexer',
30
+ 'TodotxtLexer', 'DockerLexer']
29
31
 
30
32
 
31
33
  class IniLexer(RegexLexer):
@@ -61,7 +63,7 @@ class RegeditLexer(RegexLexer):
61
63
  <http://en.wikipedia.org/wiki/Windows_Registry#.REG_files>`_ files produced
62
64
  by regedit.
63
65
 
64
- *New in Pygments 1.6.*
66
+ .. versionadded:: 1.6
65
67
  """
66
68
 
67
69
  name = 'reg'
@@ -102,7 +104,7 @@ class PropertiesLexer(RegexLexer):
102
104
  """
103
105
  Lexer for configuration files in Java's properties format.
104
106
 
105
- *New in Pygments 1.4.*
107
+ .. versionadded:: 1.4
106
108
  """
107
109
 
108
110
  name = 'Properties'
@@ -124,7 +126,7 @@ class SourcesListLexer(RegexLexer):
124
126
  """
125
127
  Lexer that highlights debian sources.list files.
126
128
 
127
- *New in Pygments 0.7.*
129
+ .. versionadded:: 0.7
128
130
  """
129
131
 
130
132
  name = 'Debian Sourcelist'
@@ -180,7 +182,7 @@ class MakefileLexer(Lexer):
180
182
 
181
183
  name = 'Makefile'
182
184
  aliases = ['make', 'makefile', 'mf', 'bsdmake']
183
- filenames = ['*.mak', 'Makefile', 'makefile', 'Makefile.*', 'GNUmakefile']
185
+ filenames = ['*.mak', '*.mk', 'Makefile', 'makefile', 'Makefile.*', 'GNUmakefile']
184
186
  mimetypes = ['text/x-makefile']
185
187
 
186
188
  r_special = re.compile(r'^(?:'
@@ -207,12 +209,17 @@ class MakefileLexer(Lexer):
207
209
  for item in do_insertions(ins, lex.get_tokens_unprocessed(done)):
208
210
  yield item
209
211
 
212
+ def analyse_text(text):
213
+ # Many makefiles have $(BIG_CAPS) style variables
214
+ if re.search(r'\$\([A-Z_]+\)', text):
215
+ return 0.1
216
+
210
217
 
211
218
  class BaseMakefileLexer(RegexLexer):
212
219
  """
213
220
  Lexer for simple Makefiles (no preprocessing).
214
221
 
215
- *New in Pygments 0.10.*
222
+ .. versionadded:: 0.10
216
223
  """
217
224
 
218
225
  name = 'Base Makefile'
@@ -222,15 +229,17 @@ class BaseMakefileLexer(RegexLexer):
222
229
 
223
230
  tokens = {
224
231
  'root': [
232
+ # recipes (need to allow spaces because of expandtabs)
225
233
  (r'^(?:[\t ]+.*\n|\n)+', using(BashLexer)),
226
- (r'\$\((?:.*\\\n|.*\n)+', using(BashLexer)),
234
+ # special variables
235
+ (r'\$[<@$+%?|*]', Keyword),
227
236
  (r'\s+', Text),
228
237
  (r'#.*?\n', Comment),
229
- (r'(export)(\s+)(?=[a-zA-Z0-9_${}\t -]+\n)',
238
+ (r'(export)(\s+)(?=[\w${}\t -]+\n)',
230
239
  bygroups(Keyword, Text), 'export'),
231
240
  (r'export\s+', Keyword),
232
241
  # assignment
233
- (r'([a-zA-Z0-9_${}.-]+)(\s*)([!?:+]?=)([ \t]*)((?:.*\\\n)+|.*\n)',
242
+ (r'([\w${}.-]+)(\s*)([!?:+]?=)([ \t]*)((?:.*\\\n)+|.*\n)',
234
243
  bygroups(Name.Variable, Text, Operator, Text, using(BashLexer))),
235
244
  # strings
236
245
  (r'(?s)"(\\\\|\\.|[^"\\])*"', String.Double),
@@ -238,20 +247,29 @@ class BaseMakefileLexer(RegexLexer):
238
247
  # targets
239
248
  (r'([^\n:]+)(:+)([ \t]*)', bygroups(Name.Function, Operator, Text),
240
249
  'block-header'),
241
- # TODO: add paren handling (grr)
250
+ # expansions
251
+ (r'\$\(', Keyword, 'expansion'),
252
+ ],
253
+ 'expansion': [
254
+ (r'[^$a-zA-Z_)]+', Text),
255
+ (r'[a-zA-Z_]+', Name.Variable),
256
+ (r'\$', Keyword),
257
+ (r'\(', Keyword, '#push'),
258
+ (r'\)', Keyword, '#pop'),
242
259
  ],
243
260
  'export': [
244
- (r'[a-zA-Z0-9_${}-]+', Name.Variable),
261
+ (r'[\w${}-]+', Name.Variable),
245
262
  (r'\n', Text, '#pop'),
246
263
  (r'\s+', Text),
247
264
  ],
248
265
  'block-header': [
249
- (r'[^,\\\n#]+', Number),
250
- (r',', Punctuation),
251
- (r'#.*?\n', Comment),
266
+ (r'[,|]', Punctuation),
267
+ (r'#.*?\n', Comment, '#pop'),
252
268
  (r'\\\n', Text), # line continuation
253
- (r'\\.', Text),
254
- (r'(?:[\t ]+.*\n|\n)+', using(BashLexer), '#pop'),
269
+ (r'\$\(', Keyword, 'expansion'),
270
+ (r'[a-zA-Z_]+', Name),
271
+ (r'\n', Text, '#pop'),
272
+ (r'.', Text),
255
273
  ],
256
274
  }
257
275
 
@@ -297,7 +315,7 @@ class DarcsPatchLexer(RegexLexer):
297
315
  format. Examples of this format are derived by commands such as
298
316
  ``darcs annotate --patch`` and ``darcs send``.
299
317
 
300
- *New in Pygments 0.10.*
318
+ .. versionadded:: 0.10
301
319
  """
302
320
  name = 'Darcs Patch'
303
321
  aliases = ['dpatch']
@@ -410,7 +428,7 @@ class BBCodeLexer(RegexLexer):
410
428
  """
411
429
  A lexer that highlights BBCode(-like) syntax.
412
430
 
413
- *New in Pygments 0.6.*
431
+ .. versionadded:: 0.6
414
432
  """
415
433
 
416
434
  name = 'BBCode'
@@ -485,7 +503,7 @@ class TexLexer(RegexLexer):
485
503
  'command': [
486
504
  (r'\[.*?\]', Name.Attribute),
487
505
  (r'\*', Keyword),
488
- (r'', Text, '#pop'),
506
+ default('#pop'),
489
507
  ],
490
508
  }
491
509
 
@@ -501,7 +519,7 @@ class GroffLexer(RegexLexer):
501
519
  Lexer for the (g)roff typesetting language, supporting groff
502
520
  extensions. Mainly useful for highlighting manpage sources.
503
521
 
504
- *New in Pygments 0.6.*
522
+ .. versionadded:: 0.6
505
523
  """
506
524
 
507
525
  name = 'Groff'
@@ -556,7 +574,7 @@ class ApacheConfLexer(RegexLexer):
556
574
  Lexer for configuration files following the Apache config file
557
575
  format.
558
576
 
559
- *New in Pygments 0.6.*
577
+ .. versionadded:: 0.6
560
578
  """
561
579
 
562
580
  name = 'ApacheConf'
@@ -571,7 +589,7 @@ class ApacheConfLexer(RegexLexer):
571
589
  (r'(#.*?)$', Comment),
572
590
  (r'(<[^\s>]+)(?:(\s+)(.*?))?(>)',
573
591
  bygroups(Name.Tag, Text, String, Name.Tag)),
574
- (r'([a-zA-Z][a-zA-Z0-9_]*)(\s+)',
592
+ (r'([a-z]\w*)(\s+)',
575
593
  bygroups(Name.Builtin, Text), 'value'),
576
594
  (r'\.+', Text),
577
595
  ],
@@ -580,7 +598,7 @@ class ApacheConfLexer(RegexLexer):
580
598
  (r'[^\S\n]+', Text),
581
599
  (r'\d+\.\d+\.\d+\.\d+(?:/\d+)?', Number),
582
600
  (r'\d+', Number),
583
- (r'/([a-zA-Z0-9][a-zA-Z0-9_./-]+)', String.Other),
601
+ (r'/([a-z0-9][\w./-]+)', String.Other),
584
602
  (r'(on|off|none|any|all|double|email|dns|min|minimal|'
585
603
  r'os|productonly|full|emerg|alert|crit|error|warn|'
586
604
  r'notice|info|debug|registry|script|inetd|standalone|'
@@ -595,7 +613,7 @@ class MoinWikiLexer(RegexLexer):
595
613
  """
596
614
  For MoinMoin (and Trac) Wiki markup.
597
615
 
598
- *New in Pygments 0.7.*
616
+ .. versionadded:: 0.7
599
617
  """
600
618
 
601
619
  name = 'MoinMoin/Trac Wiki markup'
@@ -640,14 +658,17 @@ class RstLexer(RegexLexer):
640
658
  """
641
659
  For `reStructuredText <http://docutils.sf.net/rst.html>`_ markup.
642
660
 
643
- *New in Pygments 0.7.*
661
+ .. versionadded:: 0.7
644
662
 
645
663
  Additional options accepted:
646
664
 
647
665
  `handlecodeblocks`
648
- Highlight the contents of ``.. sourcecode:: langauge`` and
649
- ``.. code:: language`` directives with a lexer for the given
650
- language (default: ``True``). *New in Pygments 0.8.*
666
+ Highlight the contents of ``.. sourcecode:: language``,
667
+ ``.. code:: language`` and ``.. code-block:: language``
668
+ directives with a lexer for the given language (default:
669
+ ``True``).
670
+
671
+ .. versionadded:: 0.8
651
672
  """
652
673
  name = 'reStructuredText'
653
674
  aliases = ['rst', 'rest', 'restructuredtext']
@@ -731,7 +752,7 @@ class RstLexer(RegexLexer):
731
752
  (r'^(\s*)(\|)( .+\n(?:\| .+\n)*)',
732
753
  bygroups(Text, Operator, using(this, state='inline'))),
733
754
  # Sourcecode directives
734
- (r'^( *\.\.)(\s*)((?:source)?code)(::)([ \t]*)([^\n]+)'
755
+ (r'^( *\.\.)(\s*)((?:source)?code(?:-block)?)(::)([ \t]*)([^\n]+)'
735
756
  r'(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\8.*|)\n)+)',
736
757
  _handle_sourcecode),
737
758
  # A directive
@@ -755,7 +776,7 @@ class RstLexer(RegexLexer):
755
776
  (r'^( *)(:.*?:)([ \t]+)(.*?)$',
756
777
  bygroups(Text, Name.Class, Text, Name.Function)),
757
778
  # Definition list
758
- (r'^([^ ].*(?<!::)\n)((?:(?: +.*)\n)+)',
779
+ (r'^(\S.*(?<!::)\n)((?:(?: +.*)\n)+)',
759
780
  bygroups(using(this, state='inline'), using(this, state='inline'))),
760
781
  # Code blocks
761
782
  (r'(::)(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\3.*|)\n)+)',
@@ -806,7 +827,7 @@ class VimLexer(RegexLexer):
806
827
  """
807
828
  Lexer for VimL script files.
808
829
 
809
- *New in Pygments 0.8.*
830
+ .. versionadded:: 0.8
810
831
  """
811
832
  name = 'VimL'
812
833
  aliases = ['vim']
@@ -815,15 +836,23 @@ class VimLexer(RegexLexer):
815
836
  mimetypes = ['text/x-vim']
816
837
  flags = re.MULTILINE
817
838
 
839
+ _python = r'py(?:t(?:h(?:o(?:n)?)?)?)?'
840
+
818
841
  tokens = {
819
842
  'root': [
843
+ (r'^([ \t:]*)(' + _python + r')([ \t]*)(<<)([ \t]*)(.*)((?:\n|.)*)(\6)',
844
+ bygroups(using(this), Keyword, Text, Operator, Text, Text,
845
+ using(PythonLexer), Text)),
846
+ (r'^([ \t:]*)(' + _python + r')([ \t])(.*)',
847
+ bygroups(using(this), Keyword, Text, using(PythonLexer))),
848
+
820
849
  (r'^\s*".*', Comment),
821
850
 
822
851
  (r'[ \t]+', Text),
823
852
  # TODO: regexes can have other delims
824
853
  (r'/(\\\\|\\/|[^\n/])*/', String.Regex),
825
854
  (r'"(\\\\|\\"|[^\n"])*"', String.Double),
826
- (r"'(\\\\|\\'|[^\n'])*'", String.Single),
855
+ (r"'(''|[^\n'])*'", String.Single),
827
856
 
828
857
  # Who decided that doublequote was a good comment character??
829
858
  (r'(?<=\s)"[^\-:.%#=*].*', Comment),
@@ -890,7 +919,7 @@ class GettextLexer(RegexLexer):
890
919
  """
891
920
  Lexer for Gettext catalog files.
892
921
 
893
- *New in Pygments 0.9.*
922
+ .. versionadded:: 0.9
894
923
  """
895
924
  name = 'Gettext Catalog'
896
925
  aliases = ['pot', 'po']
@@ -918,7 +947,7 @@ class SquidConfLexer(RegexLexer):
918
947
  """
919
948
  Lexer for `squid <http://www.squid-cache.org/>`_ configuration files.
920
949
 
921
- *New in Pygments 0.9.*
950
+ .. versionadded:: 0.9
922
951
  """
923
952
 
924
953
  name = 'SquidConf'
@@ -1050,7 +1079,7 @@ class DebianControlLexer(RegexLexer):
1050
1079
  """
1051
1080
  Lexer for Debian ``control`` files and ``apt-cache show <pkg>`` outputs.
1052
1081
 
1053
- *New in Pygments 0.9.*
1082
+ .. versionadded:: 0.9
1054
1083
  """
1055
1084
  name = 'Debian Control file'
1056
1085
  aliases = ['control', 'debcontrol']
@@ -1120,7 +1149,7 @@ class YamlLexer(ExtendedRegexLexer):
1120
1149
  Lexer for `YAML <http://yaml.org/>`_, a human-friendly data serialization
1121
1150
  language.
1122
1151
 
1123
- *New in Pygments 0.11.*
1152
+ .. versionadded:: 0.11
1124
1153
  """
1125
1154
 
1126
1155
  name = 'YAML'
@@ -1522,7 +1551,7 @@ class LighttpdConfLexer(RegexLexer):
1522
1551
  """
1523
1552
  Lexer for `Lighttpd <http://lighttpd.net/>`_ configuration files.
1524
1553
 
1525
- *New in Pygments 0.11.*
1554
+ .. versionadded:: 0.11
1526
1555
  """
1527
1556
  name = 'Lighttpd configuration file'
1528
1557
  aliases = ['lighty', 'lighttpd']
@@ -1550,7 +1579,7 @@ class NginxConfLexer(RegexLexer):
1550
1579
  """
1551
1580
  Lexer for `Nginx <http://nginx.net/>`_ configuration files.
1552
1581
 
1553
- *New in Pygments 0.11.*
1582
+ .. versionadded:: 0.11
1554
1583
  """
1555
1584
  name = 'Nginx configuration file'
1556
1585
  aliases = ['nginx']
@@ -1596,7 +1625,7 @@ class CMakeLexer(RegexLexer):
1596
1625
  """
1597
1626
  Lexer for `CMake <http://cmake.org/Wiki/CMake>`_ files.
1598
1627
 
1599
- *New in Pygments 1.2.*
1628
+ .. versionadded:: 1.2
1600
1629
  """
1601
1630
  name = 'CMake'
1602
1631
  aliases = ['cmake']
@@ -1640,6 +1669,7 @@ class CMakeLexer(RegexLexer):
1640
1669
  (r'\(', Punctuation, '#push'),
1641
1670
  (r'\)', Punctuation, '#pop'),
1642
1671
  (r'(\${)(.+?)(})', bygroups(Operator, Name.Variable, Operator)),
1672
+ (r'(\$<)(.+?)(>)', bygroups(Operator, Name.Variable, Operator)),
1643
1673
  (r'(?s)".*?"', String.Double),
1644
1674
  (r'\\\S+', String),
1645
1675
  (r'[^\)$"# \t\n]+', String),
@@ -1656,16 +1686,22 @@ class CMakeLexer(RegexLexer):
1656
1686
  ],
1657
1687
  'ws': [
1658
1688
  (r'[ \t]+', Text),
1659
- (r'#.+\n', Comment),
1689
+ (r'#.*\n', Comment),
1660
1690
  ]
1661
1691
  }
1662
1692
 
1693
+ def analyse_text(text):
1694
+ exp = r'^ *CMAKE_MINIMUM_REQUIRED *\( *VERSION *\d(\.\d)* *( FATAL_ERROR)? *\) *$'
1695
+ if re.search(exp, text, flags=re.MULTILINE | re.IGNORECASE):
1696
+ return 0.8
1697
+ return 0.0
1698
+
1663
1699
 
1664
1700
  class HttpLexer(RegexLexer):
1665
1701
  """
1666
1702
  Lexer for HTTP sessions.
1667
1703
 
1668
- *New in Pygments 1.5.*
1704
+ .. versionadded:: 1.5
1669
1705
  """
1670
1706
 
1671
1707
  name = 'HTTP'
@@ -1734,7 +1770,7 @@ class PyPyLogLexer(RegexLexer):
1734
1770
  """
1735
1771
  Lexer for PyPy log files.
1736
1772
 
1737
- *New in Pygments 1.5.*
1773
+ .. versionadded:: 1.5
1738
1774
  """
1739
1775
  name = "PyPy Log"
1740
1776
  aliases = ["pypylog", "pypy"]
@@ -1806,7 +1842,7 @@ class HxmlLexer(RegexLexer):
1806
1842
  """
1807
1843
  Lexer for `haXe build <http://haxe.org/doc/compiler>`_ files.
1808
1844
 
1809
- *New in Pygments 1.6.*
1845
+ .. versionadded:: 1.6
1810
1846
  """
1811
1847
  name = 'Hxml'
1812
1848
  aliases = ['haxeml', 'hxml']
@@ -1849,7 +1885,7 @@ class EbnfLexer(RegexLexer):
1849
1885
  <http://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form>`_
1850
1886
  grammars.
1851
1887
 
1852
- *New in Pygments 1.7.*
1888
+ .. versionadded:: 2.0
1853
1889
  """
1854
1890
 
1855
1891
  name = 'EBNF'
@@ -1891,3 +1927,129 @@ class EbnfLexer(RegexLexer):
1891
1927
  (r'([a-zA-Z][a-zA-Z0-9 \-]*)', Keyword),
1892
1928
  ],
1893
1929
  }
1930
+
1931
+ class TodotxtLexer(RegexLexer):
1932
+ """
1933
+ Lexer for `Todo.txt <http://todotxt.com/>`_ todo list format.
1934
+
1935
+ .. versionadded:: 2.0
1936
+ """
1937
+
1938
+ name = 'Todotxt'
1939
+ aliases = ['todotxt']
1940
+ # *.todotxt is not a standard extension for Todo.txt files; including it
1941
+ # makes testing easier, and also makes autodetecting file type easier.
1942
+ filenames = ['todo.txt', '*.todotxt']
1943
+ mimetypes = ['text/x-todo']
1944
+
1945
+ ## Aliases mapping standard token types of Todo.txt format concepts
1946
+ CompleteTaskText = Operator # Chosen to de-emphasize complete tasks
1947
+ IncompleteTaskText = Text # Incomplete tasks should look like plain text
1948
+
1949
+ # Priority should have most emphasis to indicate importance of tasks
1950
+ Priority = Generic.Heading
1951
+ # Dates should have next most emphasis because time is important
1952
+ Date = Generic.Subheading
1953
+
1954
+ # Project and context should have equal weight, and be in different colors
1955
+ Project = Generic.Error
1956
+ Context = String
1957
+
1958
+ # If tag functionality is added, it should have the same weight as Project
1959
+ # and Context, and a different color. Generic.Traceback would work well.
1960
+
1961
+ # Regex patterns for building up rules; dates, priorities, projects, and
1962
+ # contexts are all atomic
1963
+ # TODO: Make date regex more ISO 8601 compliant
1964
+ date_regex = r'\d{4,}-\d{2}-\d{2}'
1965
+ priority_regex = r'\([A-Z]\)'
1966
+ project_regex = r'\+\S+'
1967
+ context_regex = r'@\S+'
1968
+
1969
+ # Compound regex expressions
1970
+ complete_one_date_regex = r'(x )(' + date_regex + r')'
1971
+ complete_two_date_regex = (complete_one_date_regex + r'( )(' +
1972
+ date_regex + r')')
1973
+ priority_date_regex = r'(' + priority_regex + r')( )(' + date_regex + r')'
1974
+
1975
+ tokens = {
1976
+ # Should parse starting at beginning of line; each line is a task
1977
+ 'root': [
1978
+ ## Complete task entry points: two total:
1979
+ # 1. Complete task with two dates
1980
+ (complete_two_date_regex, bygroups(CompleteTaskText, Date,
1981
+ CompleteTaskText, Date),
1982
+ 'complete'),
1983
+ # 2. Complete task with one date
1984
+ (complete_one_date_regex, bygroups(CompleteTaskText, Date),
1985
+ 'complete'),
1986
+
1987
+ ## Incomplete task entry points: six total:
1988
+ # 1. Priority plus date
1989
+ (priority_date_regex, bygroups(Priority, IncompleteTaskText, Date),
1990
+ 'incomplete'),
1991
+ # 2. Priority only
1992
+ (priority_regex, Priority, 'incomplete'),
1993
+ # 3. Leading date
1994
+ (date_regex, Date, 'incomplete'),
1995
+ # 4. Leading context
1996
+ (context_regex, Context, 'incomplete'),
1997
+ # 5. Leading project
1998
+ (project_regex, Project, 'incomplete'),
1999
+ # 6. Non-whitespace catch-all
2000
+ ('\S+', IncompleteTaskText, 'incomplete'),
2001
+ ],
2002
+
2003
+ # Parse a complete task
2004
+ 'complete': [
2005
+ # Newline indicates end of task, should return to root
2006
+ (r'\s*\n', CompleteTaskText, '#pop'),
2007
+ # Tokenize contexts and projects
2008
+ (context_regex, Context),
2009
+ (project_regex, Project),
2010
+ # Tokenize non-whitespace text
2011
+ ('\S+', CompleteTaskText),
2012
+ # Tokenize whitespace not containing a newline
2013
+ ('\s+', CompleteTaskText),
2014
+ ],
2015
+
2016
+ # Parse an incomplete task
2017
+ 'incomplete': [
2018
+ # Newline indicates end of task, should return to root
2019
+ (r'\s*\n', IncompleteTaskText, '#pop'),
2020
+ # Tokenize contexts and projects
2021
+ (context_regex, Context),
2022
+ (project_regex, Project),
2023
+ # Tokenize non-whitespace text
2024
+ ('\S+', IncompleteTaskText),
2025
+ # Tokenize whitespace not containing a newline
2026
+ ('\s+', IncompleteTaskText),
2027
+ ],
2028
+ }
2029
+
2030
+
2031
+ class DockerLexer(RegexLexer):
2032
+ """
2033
+ Lexer for `Docker <http://docker.io>`_ configuration files.
2034
+
2035
+ .. versionadded:: 2.0
2036
+ """
2037
+ name = 'Docker'
2038
+ aliases = ['docker', 'dockerfile']
2039
+ filenames = ['Dockerfile', '*.docker']
2040
+ mimetypes = ['text/x-dockerfile-config']
2041
+
2042
+ _keywords = (r'(?:FROM|MAINTAINER|RUN|CMD|EXPOSE|ENV|ADD|ENTRYPOINT|'
2043
+ r'VOLUME|WORKDIR)')
2044
+
2045
+ flags = re.IGNORECASE | re.MULTILINE
2046
+
2047
+ tokens = {
2048
+ 'root': [
2049
+ (r'^(ONBUILD)(\s+)(%s)\b' % (_keywords,),
2050
+ bygroups(Name.Keyword, Whitespace, Keyword)),
2051
+ (_keywords + r'\b', Keyword),
2052
+ (r'#.*', Comment),
2053
+ (r'.+', using(BashLexer)),
2054
+ ],
2055
+ }