pygments.rb-jruby 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (473) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +6 -0
  3. data/CHANGELOG.md +71 -0
  4. data/Gemfile +2 -0
  5. data/LICENSE +17 -0
  6. data/README.md +118 -0
  7. data/Rakefile +66 -0
  8. data/bench.rb +22 -0
  9. data/cache-lexers.rb +8 -0
  10. data/lexers +0 -0
  11. data/lib/pygments.rb +8 -0
  12. data/lib/pygments/lexer.rb +148 -0
  13. data/lib/pygments/mentos.py +351 -0
  14. data/lib/pygments/popen.rb +404 -0
  15. data/lib/pygments/version.rb +3 -0
  16. data/pygments.rb.gemspec +24 -0
  17. data/test/test_data.c +2581 -0
  18. data/test/test_data.py +514 -0
  19. data/test/test_data_generated +2582 -0
  20. data/test/test_pygments.rb +287 -0
  21. data/vendor/custom_lexers/github.py +565 -0
  22. data/vendor/pygments-main/AUTHORS +153 -0
  23. data/vendor/pygments-main/CHANGES +889 -0
  24. data/vendor/pygments-main/LICENSE +25 -0
  25. data/vendor/pygments-main/MANIFEST.in +6 -0
  26. data/vendor/pygments-main/Makefile +59 -0
  27. data/vendor/pygments-main/REVISION +1 -0
  28. data/vendor/pygments-main/TODO +15 -0
  29. data/vendor/pygments-main/docs/generate.py +472 -0
  30. data/vendor/pygments-main/docs/pygmentize.1 +94 -0
  31. data/vendor/pygments-main/docs/src/api.txt +270 -0
  32. data/vendor/pygments-main/docs/src/authors.txt +5 -0
  33. data/vendor/pygments-main/docs/src/changelog.txt +5 -0
  34. data/vendor/pygments-main/docs/src/cmdline.txt +147 -0
  35. data/vendor/pygments-main/docs/src/filterdevelopment.txt +70 -0
  36. data/vendor/pygments-main/docs/src/filters.txt +42 -0
  37. data/vendor/pygments-main/docs/src/formatterdevelopment.txt +169 -0
  38. data/vendor/pygments-main/docs/src/formatters.txt +48 -0
  39. data/vendor/pygments-main/docs/src/index.txt +69 -0
  40. data/vendor/pygments-main/docs/src/installation.txt +71 -0
  41. data/vendor/pygments-main/docs/src/integrate.txt +48 -0
  42. data/vendor/pygments-main/docs/src/java.txt +70 -0
  43. data/vendor/pygments-main/docs/src/lexerdevelopment.txt +603 -0
  44. data/vendor/pygments-main/docs/src/lexers.txt +67 -0
  45. data/vendor/pygments-main/docs/src/moinmoin.txt +39 -0
  46. data/vendor/pygments-main/docs/src/plugins.txt +93 -0
  47. data/vendor/pygments-main/docs/src/quickstart.txt +202 -0
  48. data/vendor/pygments-main/docs/src/rstdirective.txt +22 -0
  49. data/vendor/pygments-main/docs/src/styles.txt +143 -0
  50. data/vendor/pygments-main/docs/src/tokens.txt +349 -0
  51. data/vendor/pygments-main/docs/src/unicode.txt +49 -0
  52. data/vendor/pygments-main/external/autopygmentize +64 -0
  53. data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +144 -0
  54. data/vendor/pygments-main/external/markdown-processor.py +67 -0
  55. data/vendor/pygments-main/external/moin-parser.py +112 -0
  56. data/vendor/pygments-main/external/pygments.bashcomp +38 -0
  57. data/vendor/pygments-main/external/rst-directive-old.py +77 -0
  58. data/vendor/pygments-main/external/rst-directive.py +83 -0
  59. data/vendor/pygments-main/ez_setup.py +276 -0
  60. data/vendor/pygments-main/pygmentize +7 -0
  61. data/vendor/pygments-main/pygments/__init__.py +91 -0
  62. data/vendor/pygments-main/pygments/cmdline.py +441 -0
  63. data/vendor/pygments-main/pygments/console.py +74 -0
  64. data/vendor/pygments-main/pygments/filter.py +74 -0
  65. data/vendor/pygments-main/pygments/filters/__init__.py +356 -0
  66. data/vendor/pygments-main/pygments/formatter.py +95 -0
  67. data/vendor/pygments-main/pygments/formatters/__init__.py +68 -0
  68. data/vendor/pygments-main/pygments/formatters/_mapping.py +92 -0
  69. data/vendor/pygments-main/pygments/formatters/bbcode.py +109 -0
  70. data/vendor/pygments-main/pygments/formatters/html.py +821 -0
  71. data/vendor/pygments-main/pygments/formatters/img.py +553 -0
  72. data/vendor/pygments-main/pygments/formatters/latex.py +378 -0
  73. data/vendor/pygments-main/pygments/formatters/other.py +115 -0
  74. data/vendor/pygments-main/pygments/formatters/rtf.py +136 -0
  75. data/vendor/pygments-main/pygments/formatters/svg.py +154 -0
  76. data/vendor/pygments-main/pygments/formatters/terminal.py +112 -0
  77. data/vendor/pygments-main/pygments/formatters/terminal256.py +222 -0
  78. data/vendor/pygments-main/pygments/lexer.py +765 -0
  79. data/vendor/pygments-main/pygments/lexers/__init__.py +240 -0
  80. data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1645 -0
  81. data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +232 -0
  82. data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +5172 -0
  83. data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +249 -0
  84. data/vendor/pygments-main/pygments/lexers/_mapping.py +354 -0
  85. data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +562 -0
  86. data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +3787 -0
  87. data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +233 -0
  88. data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +557 -0
  89. data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +40 -0
  90. data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +1072 -0
  91. data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +360 -0
  92. data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +13 -0
  93. data/vendor/pygments-main/pygments/lexers/agile.py +2290 -0
  94. data/vendor/pygments-main/pygments/lexers/asm.py +398 -0
  95. data/vendor/pygments-main/pygments/lexers/compiled.py +3723 -0
  96. data/vendor/pygments-main/pygments/lexers/dalvik.py +104 -0
  97. data/vendor/pygments-main/pygments/lexers/dotnet.py +671 -0
  98. data/vendor/pygments-main/pygments/lexers/foxpro.py +428 -0
  99. data/vendor/pygments-main/pygments/lexers/functional.py +2731 -0
  100. data/vendor/pygments-main/pygments/lexers/github.py +565 -0
  101. data/vendor/pygments-main/pygments/lexers/hdl.py +356 -0
  102. data/vendor/pygments-main/pygments/lexers/jvm.py +1112 -0
  103. data/vendor/pygments-main/pygments/lexers/math.py +1918 -0
  104. data/vendor/pygments-main/pygments/lexers/other.py +3778 -0
  105. data/vendor/pygments-main/pygments/lexers/parsers.py +778 -0
  106. data/vendor/pygments-main/pygments/lexers/shell.py +424 -0
  107. data/vendor/pygments-main/pygments/lexers/special.py +100 -0
  108. data/vendor/pygments-main/pygments/lexers/sql.py +559 -0
  109. data/vendor/pygments-main/pygments/lexers/templates.py +1742 -0
  110. data/vendor/pygments-main/pygments/lexers/text.py +1893 -0
  111. data/vendor/pygments-main/pygments/lexers/web.py +4045 -0
  112. data/vendor/pygments-main/pygments/modeline.py +40 -0
  113. data/vendor/pygments-main/pygments/plugin.py +74 -0
  114. data/vendor/pygments-main/pygments/scanner.py +104 -0
  115. data/vendor/pygments-main/pygments/style.py +117 -0
  116. data/vendor/pygments-main/pygments/styles/__init__.py +70 -0
  117. data/vendor/pygments-main/pygments/styles/autumn.py +65 -0
  118. data/vendor/pygments-main/pygments/styles/borland.py +51 -0
  119. data/vendor/pygments-main/pygments/styles/bw.py +49 -0
  120. data/vendor/pygments-main/pygments/styles/colorful.py +81 -0
  121. data/vendor/pygments-main/pygments/styles/default.py +73 -0
  122. data/vendor/pygments-main/pygments/styles/emacs.py +72 -0
  123. data/vendor/pygments-main/pygments/styles/friendly.py +72 -0
  124. data/vendor/pygments-main/pygments/styles/fruity.py +42 -0
  125. data/vendor/pygments-main/pygments/styles/manni.py +75 -0
  126. data/vendor/pygments-main/pygments/styles/monokai.py +106 -0
  127. data/vendor/pygments-main/pygments/styles/murphy.py +80 -0
  128. data/vendor/pygments-main/pygments/styles/native.py +65 -0
  129. data/vendor/pygments-main/pygments/styles/pastie.py +75 -0
  130. data/vendor/pygments-main/pygments/styles/perldoc.py +69 -0
  131. data/vendor/pygments-main/pygments/styles/rrt.py +33 -0
  132. data/vendor/pygments-main/pygments/styles/tango.py +141 -0
  133. data/vendor/pygments-main/pygments/styles/trac.py +63 -0
  134. data/vendor/pygments-main/pygments/styles/vim.py +63 -0
  135. data/vendor/pygments-main/pygments/styles/vs.py +38 -0
  136. data/vendor/pygments-main/pygments/token.py +195 -0
  137. data/vendor/pygments-main/pygments/unistring.py +140 -0
  138. data/vendor/pygments-main/pygments/util.py +277 -0
  139. data/vendor/pygments-main/scripts/check_sources.py +242 -0
  140. data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +32 -0
  141. data/vendor/pygments-main/scripts/epydoc.css +280 -0
  142. data/vendor/pygments-main/scripts/find_codetags.py +205 -0
  143. data/vendor/pygments-main/scripts/find_error.py +170 -0
  144. data/vendor/pygments-main/scripts/get_vimkw.py +43 -0
  145. data/vendor/pygments-main/scripts/pylintrc +301 -0
  146. data/vendor/pygments-main/scripts/reindent.py +291 -0
  147. data/vendor/pygments-main/scripts/vim2pygments.py +933 -0
  148. data/vendor/pygments-main/setup.cfg +7 -0
  149. data/vendor/pygments-main/setup.py +90 -0
  150. data/vendor/pygments-main/tests/dtds/HTML4-f.dtd +37 -0
  151. data/vendor/pygments-main/tests/dtds/HTML4-s.dtd +869 -0
  152. data/vendor/pygments-main/tests/dtds/HTML4.dcl +88 -0
  153. data/vendor/pygments-main/tests/dtds/HTML4.dtd +1092 -0
  154. data/vendor/pygments-main/tests/dtds/HTML4.soc +9 -0
  155. data/vendor/pygments-main/tests/dtds/HTMLlat1.ent +195 -0
  156. data/vendor/pygments-main/tests/dtds/HTMLspec.ent +77 -0
  157. data/vendor/pygments-main/tests/dtds/HTMLsym.ent +241 -0
  158. data/vendor/pygments-main/tests/examplefiles/ANTLRv3.g +608 -0
  159. data/vendor/pygments-main/tests/examplefiles/AcidStateAdvanced.hs +209 -0
  160. data/vendor/pygments-main/tests/examplefiles/AlternatingGroup.mu +102 -0
  161. data/vendor/pygments-main/tests/examplefiles/BOM.js +1 -0
  162. data/vendor/pygments-main/tests/examplefiles/CPDictionary.j +611 -0
  163. data/vendor/pygments-main/tests/examplefiles/Config.in.cache +1973 -0
  164. data/vendor/pygments-main/tests/examplefiles/Constants.mo +158 -0
  165. data/vendor/pygments-main/tests/examplefiles/DancingSudoku.lhs +411 -0
  166. data/vendor/pygments-main/tests/examplefiles/Deflate.fs +578 -0
  167. data/vendor/pygments-main/tests/examplefiles/Errors.scala +18 -0
  168. data/vendor/pygments-main/tests/examplefiles/File.hy +174 -0
  169. data/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1 +66 -0
  170. data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +104 -0
  171. data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +671 -0
  172. data/vendor/pygments-main/tests/examplefiles/Intro.java +1660 -0
  173. data/vendor/pygments-main/tests/examplefiles/Makefile +1131 -0
  174. data/vendor/pygments-main/tests/examplefiles/Object.st +4394 -0
  175. data/vendor/pygments-main/tests/examplefiles/OrderedMap.hx +584 -0
  176. data/vendor/pygments-main/tests/examplefiles/RoleQ.pm6 +23 -0
  177. data/vendor/pygments-main/tests/examplefiles/SmallCheck.hs +378 -0
  178. data/vendor/pygments-main/tests/examplefiles/Sorting.mod +470 -0
  179. data/vendor/pygments-main/tests/examplefiles/Sudoku.lhs +382 -0
  180. data/vendor/pygments-main/tests/examplefiles/addressbook.proto +30 -0
  181. data/vendor/pygments-main/tests/examplefiles/antlr_throws +1 -0
  182. data/vendor/pygments-main/tests/examplefiles/apache2.conf +393 -0
  183. data/vendor/pygments-main/tests/examplefiles/as3_test.as +143 -0
  184. data/vendor/pygments-main/tests/examplefiles/as3_test2.as +46 -0
  185. data/vendor/pygments-main/tests/examplefiles/as3_test3.as +3 -0
  186. data/vendor/pygments-main/tests/examplefiles/aspx-cs_example +27 -0
  187. data/vendor/pygments-main/tests/examplefiles/autoit_submit.au3 +25 -0
  188. data/vendor/pygments-main/tests/examplefiles/badcase.java +2 -0
  189. data/vendor/pygments-main/tests/examplefiles/batchfile.bat +49 -0
  190. data/vendor/pygments-main/tests/examplefiles/bigtest.nsi +308 -0
  191. data/vendor/pygments-main/tests/examplefiles/boot-9.scm +1557 -0
  192. data/vendor/pygments-main/tests/examplefiles/ca65_example +284 -0
  193. data/vendor/pygments-main/tests/examplefiles/cbmbas_example +9 -0
  194. data/vendor/pygments-main/tests/examplefiles/cells.ps +515 -0
  195. data/vendor/pygments-main/tests/examplefiles/ceval.c +2604 -0
  196. data/vendor/pygments-main/tests/examplefiles/cheetah_example.html +13 -0
  197. data/vendor/pygments-main/tests/examplefiles/classes.dylan +125 -0
  198. data/vendor/pygments-main/tests/examplefiles/condensed_ruby.rb +10 -0
  199. data/vendor/pygments-main/tests/examplefiles/coq_RelationClasses +447 -0
  200. data/vendor/pygments-main/tests/examplefiles/database.pytb +20 -0
  201. data/vendor/pygments-main/tests/examplefiles/de.MoinMoin.po +2461 -0
  202. data/vendor/pygments-main/tests/examplefiles/demo.ahk +181 -0
  203. data/vendor/pygments-main/tests/examplefiles/demo.cfm +38 -0
  204. data/vendor/pygments-main/tests/examplefiles/django_sample.html+django +68 -0
  205. data/vendor/pygments-main/tests/examplefiles/dwarf.cw +17 -0
  206. data/vendor/pygments-main/tests/examplefiles/erl_session +10 -0
  207. data/vendor/pygments-main/tests/examplefiles/escape_semicolon.clj +1 -0
  208. data/vendor/pygments-main/tests/examplefiles/evil_regex.js +48 -0
  209. data/vendor/pygments-main/tests/examplefiles/example.Rd +78 -0
  210. data/vendor/pygments-main/tests/examplefiles/example.bug +54 -0
  211. data/vendor/pygments-main/tests/examplefiles/example.c +2080 -0
  212. data/vendor/pygments-main/tests/examplefiles/example.ceylon +52 -0
  213. data/vendor/pygments-main/tests/examplefiles/example.clay +33 -0
  214. data/vendor/pygments-main/tests/examplefiles/example.cls +15 -0
  215. data/vendor/pygments-main/tests/examplefiles/example.cob +3556 -0
  216. data/vendor/pygments-main/tests/examplefiles/example.cpp +2363 -0
  217. data/vendor/pygments-main/tests/examplefiles/example.gs +106 -0
  218. data/vendor/pygments-main/tests/examplefiles/example.gst +7 -0
  219. data/vendor/pygments-main/tests/examplefiles/example.hx +142 -0
  220. data/vendor/pygments-main/tests/examplefiles/example.jag +48 -0
  221. data/vendor/pygments-main/tests/examplefiles/example.kt +47 -0
  222. data/vendor/pygments-main/tests/examplefiles/example.lagda +19 -0
  223. data/vendor/pygments-main/tests/examplefiles/example.lua +250 -0
  224. data/vendor/pygments-main/tests/examplefiles/example.monkey +152 -0
  225. data/vendor/pygments-main/tests/examplefiles/example.moo +26 -0
  226. data/vendor/pygments-main/tests/examplefiles/example.moon +629 -0
  227. data/vendor/pygments-main/tests/examplefiles/example.msc +43 -0
  228. data/vendor/pygments-main/tests/examplefiles/example.nim +1010 -0
  229. data/vendor/pygments-main/tests/examplefiles/example.ns2 +69 -0
  230. data/vendor/pygments-main/tests/examplefiles/example.p +34 -0
  231. data/vendor/pygments-main/tests/examplefiles/example.pas +2708 -0
  232. data/vendor/pygments-main/tests/examplefiles/example.prg +161 -0
  233. data/vendor/pygments-main/tests/examplefiles/example.rb +1852 -0
  234. data/vendor/pygments-main/tests/examplefiles/example.reg +19 -0
  235. data/vendor/pygments-main/tests/examplefiles/example.rexx +50 -0
  236. data/vendor/pygments-main/tests/examplefiles/example.rhtml +561 -0
  237. data/vendor/pygments-main/tests/examplefiles/example.rkt +95 -0
  238. data/vendor/pygments-main/tests/examplefiles/example.rpf +4 -0
  239. data/vendor/pygments-main/tests/examplefiles/example.sh-session +19 -0
  240. data/vendor/pygments-main/tests/examplefiles/example.shell-session +45 -0
  241. data/vendor/pygments-main/tests/examplefiles/example.sml +156 -0
  242. data/vendor/pygments-main/tests/examplefiles/example.snobol +15 -0
  243. data/vendor/pygments-main/tests/examplefiles/example.stan +108 -0
  244. data/vendor/pygments-main/tests/examplefiles/example.tea +34 -0
  245. data/vendor/pygments-main/tests/examplefiles/example.ts +28 -0
  246. data/vendor/pygments-main/tests/examplefiles/example.u +548 -0
  247. data/vendor/pygments-main/tests/examplefiles/example.weechatlog +9 -0
  248. data/vendor/pygments-main/tests/examplefiles/example.xhtml +376 -0
  249. data/vendor/pygments-main/tests/examplefiles/example.xtend +34 -0
  250. data/vendor/pygments-main/tests/examplefiles/example.yaml +302 -0
  251. data/vendor/pygments-main/tests/examplefiles/example2.aspx +29 -0
  252. data/vendor/pygments-main/tests/examplefiles/example2.msc +79 -0
  253. data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +363 -0
  254. data/vendor/pygments-main/tests/examplefiles/example_file.fy +128 -0
  255. data/vendor/pygments-main/tests/examplefiles/firefox.mak +586 -0
  256. data/vendor/pygments-main/tests/examplefiles/flipflop.sv +19 -0
  257. data/vendor/pygments-main/tests/examplefiles/foo.sce +6 -0
  258. data/vendor/pygments-main/tests/examplefiles/format.ml +1213 -0
  259. data/vendor/pygments-main/tests/examplefiles/fucked_up.rb +77 -0
  260. data/vendor/pygments-main/tests/examplefiles/function.mu +1 -0
  261. data/vendor/pygments-main/tests/examplefiles/functional.rst +1472 -0
  262. data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +133 -0
  263. data/vendor/pygments-main/tests/examplefiles/genclass.clj +510 -0
  264. data/vendor/pygments-main/tests/examplefiles/genshi_example.xml+genshi +193 -0
  265. data/vendor/pygments-main/tests/examplefiles/genshitext_example.genshitext +33 -0
  266. data/vendor/pygments-main/tests/examplefiles/glsl.frag +7 -0
  267. data/vendor/pygments-main/tests/examplefiles/glsl.vert +13 -0
  268. data/vendor/pygments-main/tests/examplefiles/grammar-test.p6 +22 -0
  269. data/vendor/pygments-main/tests/examplefiles/hello.smali +40 -0
  270. data/vendor/pygments-main/tests/examplefiles/hello.sp +9 -0
  271. data/vendor/pygments-main/tests/examplefiles/html+php_faulty.php +1 -0
  272. data/vendor/pygments-main/tests/examplefiles/http_request_example +15 -0
  273. data/vendor/pygments-main/tests/examplefiles/http_response_example +29 -0
  274. data/vendor/pygments-main/tests/examplefiles/import.hs +4 -0
  275. data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +71 -0
  276. data/vendor/pygments-main/tests/examplefiles/intro.ik +24 -0
  277. data/vendor/pygments-main/tests/examplefiles/ints.php +10 -0
  278. data/vendor/pygments-main/tests/examplefiles/intsyn.fun +675 -0
  279. data/vendor/pygments-main/tests/examplefiles/intsyn.sig +286 -0
  280. data/vendor/pygments-main/tests/examplefiles/irb_heredoc +8 -0
  281. data/vendor/pygments-main/tests/examplefiles/irc.lsp +214 -0
  282. data/vendor/pygments-main/tests/examplefiles/java.properties +16 -0
  283. data/vendor/pygments-main/tests/examplefiles/jbst_example1.jbst +28 -0
  284. data/vendor/pygments-main/tests/examplefiles/jbst_example2.jbst +45 -0
  285. data/vendor/pygments-main/tests/examplefiles/jinjadesignerdoc.rst +713 -0
  286. data/vendor/pygments-main/tests/examplefiles/json.lasso +301 -0
  287. data/vendor/pygments-main/tests/examplefiles/json.lasso9 +213 -0
  288. data/vendor/pygments-main/tests/examplefiles/lighttpd_config.conf +13 -0
  289. data/vendor/pygments-main/tests/examplefiles/linecontinuation.py +47 -0
  290. data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +41 -0
  291. data/vendor/pygments-main/tests/examplefiles/logos_example.xm +28 -0
  292. data/vendor/pygments-main/tests/examplefiles/ltmain.sh +2849 -0
  293. data/vendor/pygments-main/tests/examplefiles/main.cmake +42 -0
  294. data/vendor/pygments-main/tests/examplefiles/markdown.lsp +679 -0
  295. data/vendor/pygments-main/tests/examplefiles/matlab_noreturn +3 -0
  296. data/vendor/pygments-main/tests/examplefiles/matlab_sample +30 -0
  297. data/vendor/pygments-main/tests/examplefiles/matlabsession_sample.txt +37 -0
  298. data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +455 -0
  299. data/vendor/pygments-main/tests/examplefiles/mg_sample.pro +73 -0
  300. data/vendor/pygments-main/tests/examplefiles/minehunt.qml +112 -0
  301. data/vendor/pygments-main/tests/examplefiles/minimal.ns2 +4 -0
  302. data/vendor/pygments-main/tests/examplefiles/moin_SyntaxReference.txt +340 -0
  303. data/vendor/pygments-main/tests/examplefiles/multiline_regexes.rb +38 -0
  304. data/vendor/pygments-main/tests/examplefiles/nanomsg.intr +95 -0
  305. data/vendor/pygments-main/tests/examplefiles/nasm_aoutso.asm +96 -0
  306. data/vendor/pygments-main/tests/examplefiles/nasm_objexe.asm +30 -0
  307. data/vendor/pygments-main/tests/examplefiles/nemerle_sample.n +87 -0
  308. data/vendor/pygments-main/tests/examplefiles/nginx_nginx.conf +118 -0
  309. data/vendor/pygments-main/tests/examplefiles/numbers.c +12 -0
  310. data/vendor/pygments-main/tests/examplefiles/objc_example.m +32 -0
  311. data/vendor/pygments-main/tests/examplefiles/objc_example2.m +24 -0
  312. data/vendor/pygments-main/tests/examplefiles/perl_misc +62 -0
  313. data/vendor/pygments-main/tests/examplefiles/perl_perl5db +998 -0
  314. data/vendor/pygments-main/tests/examplefiles/perl_regex-delims +120 -0
  315. data/vendor/pygments-main/tests/examplefiles/perlfunc.1 +856 -0
  316. data/vendor/pygments-main/tests/examplefiles/phpMyAdmin.spec +163 -0
  317. data/vendor/pygments-main/tests/examplefiles/phpcomplete.vim +567 -0
  318. data/vendor/pygments-main/tests/examplefiles/pleac.in.rb +1223 -0
  319. data/vendor/pygments-main/tests/examplefiles/postgresql_test.txt +47 -0
  320. data/vendor/pygments-main/tests/examplefiles/pppoe.applescript +10 -0
  321. data/vendor/pygments-main/tests/examplefiles/psql_session.txt +122 -0
  322. data/vendor/pygments-main/tests/examplefiles/py3_test.txt +2 -0
  323. data/vendor/pygments-main/tests/examplefiles/py3tb_test.py3tb +4 -0
  324. data/vendor/pygments-main/tests/examplefiles/pycon_test.pycon +14 -0
  325. data/vendor/pygments-main/tests/examplefiles/pytb_test2.pytb +2 -0
  326. data/vendor/pygments-main/tests/examplefiles/pytb_test3.pytb +4 -0
  327. data/vendor/pygments-main/tests/examplefiles/python25-bsd.mak +234 -0
  328. data/vendor/pygments-main/tests/examplefiles/qsort.prolog +13 -0
  329. data/vendor/pygments-main/tests/examplefiles/r-console-transcript.Rout +38 -0
  330. data/vendor/pygments-main/tests/examplefiles/ragel-cpp_rlscan +280 -0
  331. data/vendor/pygments-main/tests/examplefiles/ragel-cpp_snippet +2 -0
  332. data/vendor/pygments-main/tests/examplefiles/regex.js +22 -0
  333. data/vendor/pygments-main/tests/examplefiles/reversi.lsp +427 -0
  334. data/vendor/pygments-main/tests/examplefiles/robotframework.txt +39 -0
  335. data/vendor/pygments-main/tests/examplefiles/ruby_func_def.rb +11 -0
  336. data/vendor/pygments-main/tests/examplefiles/rust_example.rs +233 -0
  337. data/vendor/pygments-main/tests/examplefiles/scilab.sci +30 -0
  338. data/vendor/pygments-main/tests/examplefiles/session.dylan-console +9 -0
  339. data/vendor/pygments-main/tests/examplefiles/sibling.prolog +19 -0
  340. data/vendor/pygments-main/tests/examplefiles/simple.md +747 -0
  341. data/vendor/pygments-main/tests/examplefiles/smarty_example.html +209 -0
  342. data/vendor/pygments-main/tests/examplefiles/source.lgt +343 -0
  343. data/vendor/pygments-main/tests/examplefiles/sources.list +62 -0
  344. data/vendor/pygments-main/tests/examplefiles/sphere.pov +18 -0
  345. data/vendor/pygments-main/tests/examplefiles/sqlite3.sqlite3-console +27 -0
  346. data/vendor/pygments-main/tests/examplefiles/squid.conf +30 -0
  347. data/vendor/pygments-main/tests/examplefiles/string.jl +1031 -0
  348. data/vendor/pygments-main/tests/examplefiles/string_delimiters.d +21 -0
  349. data/vendor/pygments-main/tests/examplefiles/stripheredoc.sh +3 -0
  350. data/vendor/pygments-main/tests/examplefiles/swig_java.swg +1329 -0
  351. data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +225 -0
  352. data/vendor/pygments-main/tests/examplefiles/test.R +153 -0
  353. data/vendor/pygments-main/tests/examplefiles/test.adb +211 -0
  354. data/vendor/pygments-main/tests/examplefiles/test.agda +102 -0
  355. data/vendor/pygments-main/tests/examplefiles/test.asy +131 -0
  356. data/vendor/pygments-main/tests/examplefiles/test.awk +121 -0
  357. data/vendor/pygments-main/tests/examplefiles/test.bas +29 -0
  358. data/vendor/pygments-main/tests/examplefiles/test.bb +95 -0
  359. data/vendor/pygments-main/tests/examplefiles/test.bmx +145 -0
  360. data/vendor/pygments-main/tests/examplefiles/test.boo +39 -0
  361. data/vendor/pygments-main/tests/examplefiles/test.bro +250 -0
  362. data/vendor/pygments-main/tests/examplefiles/test.cs +374 -0
  363. data/vendor/pygments-main/tests/examplefiles/test.css +54 -0
  364. data/vendor/pygments-main/tests/examplefiles/test.cu +36 -0
  365. data/vendor/pygments-main/tests/examplefiles/test.d +135 -0
  366. data/vendor/pygments-main/tests/examplefiles/test.dart +23 -0
  367. data/vendor/pygments-main/tests/examplefiles/test.dtd +89 -0
  368. data/vendor/pygments-main/tests/examplefiles/test.ebnf +31 -0
  369. data/vendor/pygments-main/tests/examplefiles/test.ec +605 -0
  370. data/vendor/pygments-main/tests/examplefiles/test.ecl +58 -0
  371. data/vendor/pygments-main/tests/examplefiles/test.eh +315 -0
  372. data/vendor/pygments-main/tests/examplefiles/test.erl +169 -0
  373. data/vendor/pygments-main/tests/examplefiles/test.evoque +33 -0
  374. data/vendor/pygments-main/tests/examplefiles/test.fan +818 -0
  375. data/vendor/pygments-main/tests/examplefiles/test.flx +57 -0
  376. data/vendor/pygments-main/tests/examplefiles/test.gdc +13 -0
  377. data/vendor/pygments-main/tests/examplefiles/test.groovy +97 -0
  378. data/vendor/pygments-main/tests/examplefiles/test.html +339 -0
  379. data/vendor/pygments-main/tests/examplefiles/test.ini +10 -0
  380. data/vendor/pygments-main/tests/examplefiles/test.java +653 -0
  381. data/vendor/pygments-main/tests/examplefiles/test.jsp +24 -0
  382. data/vendor/pygments-main/tests/examplefiles/test.maql +45 -0
  383. data/vendor/pygments-main/tests/examplefiles/test.mod +374 -0
  384. data/vendor/pygments-main/tests/examplefiles/test.moo +51 -0
  385. data/vendor/pygments-main/tests/examplefiles/test.myt +166 -0
  386. data/vendor/pygments-main/tests/examplefiles/test.nim +93 -0
  387. data/vendor/pygments-main/tests/examplefiles/test.opa +10 -0
  388. data/vendor/pygments-main/tests/examplefiles/test.p6 +252 -0
  389. data/vendor/pygments-main/tests/examplefiles/test.pas +743 -0
  390. data/vendor/pygments-main/tests/examplefiles/test.php +505 -0
  391. data/vendor/pygments-main/tests/examplefiles/test.plot +333 -0
  392. data/vendor/pygments-main/tests/examplefiles/test.ps1 +108 -0
  393. data/vendor/pygments-main/tests/examplefiles/test.pypylog +1839 -0
  394. data/vendor/pygments-main/tests/examplefiles/test.r3 +94 -0
  395. data/vendor/pygments-main/tests/examplefiles/test.rb +177 -0
  396. data/vendor/pygments-main/tests/examplefiles/test.rhtml +43 -0
  397. data/vendor/pygments-main/tests/examplefiles/test.scaml +8 -0
  398. data/vendor/pygments-main/tests/examplefiles/test.ssp +12 -0
  399. data/vendor/pygments-main/tests/examplefiles/test.tcsh +830 -0
  400. data/vendor/pygments-main/tests/examplefiles/test.vb +407 -0
  401. data/vendor/pygments-main/tests/examplefiles/test.vhdl +161 -0
  402. data/vendor/pygments-main/tests/examplefiles/test.xqy +138 -0
  403. data/vendor/pygments-main/tests/examplefiles/test.xsl +23 -0
  404. data/vendor/pygments-main/tests/examplefiles/test2.pypylog +120 -0
  405. data/vendor/pygments-main/tests/examplefiles/truncated.pytb +15 -0
  406. data/vendor/pygments-main/tests/examplefiles/type.lisp +1218 -0
  407. data/vendor/pygments-main/tests/examplefiles/underscore.coffee +603 -0
  408. data/vendor/pygments-main/tests/examplefiles/unicode.applescript +5 -0
  409. data/vendor/pygments-main/tests/examplefiles/unicodedoc.py +11 -0
  410. data/vendor/pygments-main/tests/examplefiles/unix-io.lid +37 -0
  411. data/vendor/pygments-main/tests/examplefiles/webkit-transition.css +3 -0
  412. data/vendor/pygments-main/tests/examplefiles/while.pov +13 -0
  413. data/vendor/pygments-main/tests/examplefiles/wiki.factor +384 -0
  414. data/vendor/pygments-main/tests/examplefiles/xml_example +1897 -0
  415. data/vendor/pygments-main/tests/examplefiles/zmlrpc.f90 +798 -0
  416. data/vendor/pygments-main/tests/old_run.py +138 -0
  417. data/vendor/pygments-main/tests/run.py +49 -0
  418. data/vendor/pygments-main/tests/support.py +15 -0
  419. data/vendor/pygments-main/tests/support/tags +36 -0
  420. data/vendor/pygments-main/tests/test_basic_api.py +295 -0
  421. data/vendor/pygments-main/tests/test_clexer.py +31 -0
  422. data/vendor/pygments-main/tests/test_cmdline.py +105 -0
  423. data/vendor/pygments-main/tests/test_examplefiles.py +99 -0
  424. data/vendor/pygments-main/tests/test_html_formatter.py +178 -0
  425. data/vendor/pygments-main/tests/test_latex_formatter.py +55 -0
  426. data/vendor/pygments-main/tests/test_lexers_other.py +68 -0
  427. data/vendor/pygments-main/tests/test_perllexer.py +137 -0
  428. data/vendor/pygments-main/tests/test_regexlexer.py +47 -0
  429. data/vendor/pygments-main/tests/test_token.py +46 -0
  430. data/vendor/pygments-main/tests/test_using_api.py +40 -0
  431. data/vendor/pygments-main/tests/test_util.py +135 -0
  432. data/vendor/simplejson/.gitignore +10 -0
  433. data/vendor/simplejson/.travis.yml +5 -0
  434. data/vendor/simplejson/CHANGES.txt +291 -0
  435. data/vendor/simplejson/LICENSE.txt +19 -0
  436. data/vendor/simplejson/MANIFEST.in +5 -0
  437. data/vendor/simplejson/README.rst +19 -0
  438. data/vendor/simplejson/conf.py +179 -0
  439. data/vendor/simplejson/index.rst +628 -0
  440. data/vendor/simplejson/scripts/make_docs.py +18 -0
  441. data/vendor/simplejson/setup.py +104 -0
  442. data/vendor/simplejson/simplejson/__init__.py +510 -0
  443. data/vendor/simplejson/simplejson/_speedups.c +2745 -0
  444. data/vendor/simplejson/simplejson/decoder.py +425 -0
  445. data/vendor/simplejson/simplejson/encoder.py +567 -0
  446. data/vendor/simplejson/simplejson/ordered_dict.py +119 -0
  447. data/vendor/simplejson/simplejson/scanner.py +77 -0
  448. data/vendor/simplejson/simplejson/tests/__init__.py +67 -0
  449. data/vendor/simplejson/simplejson/tests/test_bigint_as_string.py +55 -0
  450. data/vendor/simplejson/simplejson/tests/test_check_circular.py +30 -0
  451. data/vendor/simplejson/simplejson/tests/test_decimal.py +66 -0
  452. data/vendor/simplejson/simplejson/tests/test_decode.py +83 -0
  453. data/vendor/simplejson/simplejson/tests/test_default.py +9 -0
  454. data/vendor/simplejson/simplejson/tests/test_dump.py +67 -0
  455. data/vendor/simplejson/simplejson/tests/test_encode_basestring_ascii.py +46 -0
  456. data/vendor/simplejson/simplejson/tests/test_encode_for_html.py +32 -0
  457. data/vendor/simplejson/simplejson/tests/test_errors.py +34 -0
  458. data/vendor/simplejson/simplejson/tests/test_fail.py +91 -0
  459. data/vendor/simplejson/simplejson/tests/test_float.py +19 -0
  460. data/vendor/simplejson/simplejson/tests/test_indent.py +86 -0
  461. data/vendor/simplejson/simplejson/tests/test_item_sort_key.py +20 -0
  462. data/vendor/simplejson/simplejson/tests/test_namedtuple.py +121 -0
  463. data/vendor/simplejson/simplejson/tests/test_pass1.py +76 -0
  464. data/vendor/simplejson/simplejson/tests/test_pass2.py +14 -0
  465. data/vendor/simplejson/simplejson/tests/test_pass3.py +20 -0
  466. data/vendor/simplejson/simplejson/tests/test_recursion.py +67 -0
  467. data/vendor/simplejson/simplejson/tests/test_scanstring.py +117 -0
  468. data/vendor/simplejson/simplejson/tests/test_separators.py +42 -0
  469. data/vendor/simplejson/simplejson/tests/test_speedups.py +20 -0
  470. data/vendor/simplejson/simplejson/tests/test_tuple.py +49 -0
  471. data/vendor/simplejson/simplejson/tests/test_unicode.py +109 -0
  472. data/vendor/simplejson/simplejson/tool.py +39 -0
  473. metadata +557 -0
@@ -0,0 +1,1742 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ pygments.lexers.templates
4
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
5
+
6
+ Lexers for various template engines' markup.
7
+
8
+ :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
9
+ :license: BSD, see LICENSE for details.
10
+ """
11
+
12
+ import re
13
+
14
+ from pygments.lexers.web import \
15
+ PhpLexer, HtmlLexer, XmlLexer, JavascriptLexer, CssLexer, LassoLexer
16
+ from pygments.lexers.agile import PythonLexer, PerlLexer
17
+ from pygments.lexers.compiled import JavaLexer
18
+ from pygments.lexers.jvm import TeaLangLexer
19
+ from pygments.lexer import Lexer, DelegatingLexer, RegexLexer, bygroups, \
20
+ include, using, this
21
+ from pygments.token import Error, Punctuation, \
22
+ Text, Comment, Operator, Keyword, Name, String, Number, Other, Token
23
+ from pygments.util import html_doctype_matches, looks_like_xml
24
+
25
+ __all__ = ['HtmlPhpLexer', 'XmlPhpLexer', 'CssPhpLexer',
26
+ 'JavascriptPhpLexer', 'ErbLexer', 'RhtmlLexer',
27
+ 'XmlErbLexer', 'CssErbLexer', 'JavascriptErbLexer',
28
+ 'SmartyLexer', 'HtmlSmartyLexer', 'XmlSmartyLexer',
29
+ 'CssSmartyLexer', 'JavascriptSmartyLexer', 'DjangoLexer',
30
+ 'HtmlDjangoLexer', 'CssDjangoLexer', 'XmlDjangoLexer',
31
+ 'JavascriptDjangoLexer', 'GenshiLexer', 'HtmlGenshiLexer',
32
+ 'GenshiTextLexer', 'CssGenshiLexer', 'JavascriptGenshiLexer',
33
+ 'MyghtyLexer', 'MyghtyHtmlLexer', 'MyghtyXmlLexer',
34
+ 'MyghtyCssLexer', 'MyghtyJavascriptLexer', 'MasonLexer', 'MakoLexer',
35
+ 'MakoHtmlLexer', 'MakoXmlLexer', 'MakoJavascriptLexer',
36
+ 'MakoCssLexer', 'JspLexer', 'CheetahLexer', 'CheetahHtmlLexer',
37
+ 'CheetahXmlLexer', 'CheetahJavascriptLexer', 'EvoqueLexer',
38
+ 'EvoqueHtmlLexer', 'EvoqueXmlLexer', 'ColdfusionLexer',
39
+ 'ColdfusionHtmlLexer', 'VelocityLexer', 'VelocityHtmlLexer',
40
+ 'VelocityXmlLexer', 'SspLexer', 'TeaTemplateLexer', 'LassoHtmlLexer',
41
+ 'LassoXmlLexer', 'LassoCssLexer', 'LassoJavascriptLexer']
42
+
43
+
44
+ class ErbLexer(Lexer):
45
+ """
46
+ Generic `ERB <http://ruby-doc.org/core/classes/ERB.html>`_ (Ruby Templating)
47
+ lexer.
48
+
49
+ Just highlights ruby code between the preprocessor directives, other data
50
+ is left untouched by the lexer.
51
+
52
+ All options are also forwarded to the `RubyLexer`.
53
+ """
54
+
55
+ name = 'ERB'
56
+ aliases = ['erb']
57
+ mimetypes = ['application/x-ruby-templating']
58
+
59
+ _block_re = re.compile(r'(<%%|%%>|<%=|<%#|<%-|<%|-%>|%>|^%[^%].*?$)', re.M)
60
+
61
+ def __init__(self, **options):
62
+ from pygments.lexers.agile import RubyLexer
63
+ self.ruby_lexer = RubyLexer(**options)
64
+ Lexer.__init__(self, **options)
65
+
66
+ def get_tokens_unprocessed(self, text):
67
+ """
68
+ Since ERB doesn't allow "<%" and other tags inside of ruby
69
+ blocks we have to use a split approach here that fails for
70
+ that too.
71
+ """
72
+ tokens = self._block_re.split(text)
73
+ tokens.reverse()
74
+ state = idx = 0
75
+ try:
76
+ while True:
77
+ # text
78
+ if state == 0:
79
+ val = tokens.pop()
80
+ yield idx, Other, val
81
+ idx += len(val)
82
+ state = 1
83
+ # block starts
84
+ elif state == 1:
85
+ tag = tokens.pop()
86
+ # literals
87
+ if tag in ('<%%', '%%>'):
88
+ yield idx, Other, tag
89
+ idx += 3
90
+ state = 0
91
+ # comment
92
+ elif tag == '<%#':
93
+ yield idx, Comment.Preproc, tag
94
+ val = tokens.pop()
95
+ yield idx + 3, Comment, val
96
+ idx += 3 + len(val)
97
+ state = 2
98
+ # blocks or output
99
+ elif tag in ('<%', '<%=', '<%-'):
100
+ yield idx, Comment.Preproc, tag
101
+ idx += len(tag)
102
+ data = tokens.pop()
103
+ r_idx = 0
104
+ for r_idx, r_token, r_value in \
105
+ self.ruby_lexer.get_tokens_unprocessed(data):
106
+ yield r_idx + idx, r_token, r_value
107
+ idx += len(data)
108
+ state = 2
109
+ elif tag in ('%>', '-%>'):
110
+ yield idx, Error, tag
111
+ idx += len(tag)
112
+ state = 0
113
+ # % raw ruby statements
114
+ else:
115
+ yield idx, Comment.Preproc, tag[0]
116
+ r_idx = 0
117
+ for r_idx, r_token, r_value in \
118
+ self.ruby_lexer.get_tokens_unprocessed(tag[1:]):
119
+ yield idx + 1 + r_idx, r_token, r_value
120
+ idx += len(tag)
121
+ state = 0
122
+ # block ends
123
+ elif state == 2:
124
+ tag = tokens.pop()
125
+ if tag not in ('%>', '-%>'):
126
+ yield idx, Other, tag
127
+ else:
128
+ yield idx, Comment.Preproc, tag
129
+ idx += len(tag)
130
+ state = 0
131
+ except IndexError:
132
+ return
133
+
134
+ def analyse_text(text):
135
+ if '<%' in text and '%>' in text:
136
+ return 0.4
137
+
138
+
139
+ class SmartyLexer(RegexLexer):
140
+ """
141
+ Generic `Smarty <http://smarty.php.net/>`_ template lexer.
142
+
143
+ Just highlights smarty code between the preprocessor directives, other
144
+ data is left untouched by the lexer.
145
+ """
146
+
147
+ name = 'Smarty'
148
+ aliases = ['smarty']
149
+ filenames = ['*.tpl']
150
+ mimetypes = ['application/x-smarty']
151
+
152
+ flags = re.MULTILINE | re.DOTALL
153
+
154
+ tokens = {
155
+ 'root': [
156
+ (r'[^{]+', Other),
157
+ (r'(\{)(\*.*?\*)(\})',
158
+ bygroups(Comment.Preproc, Comment, Comment.Preproc)),
159
+ (r'(\{php\})(.*?)(\{/php\})',
160
+ bygroups(Comment.Preproc, using(PhpLexer, startinline=True),
161
+ Comment.Preproc)),
162
+ (r'(\{)(/?[a-zA-Z_][a-zA-Z0-9_]*)(\s*)',
163
+ bygroups(Comment.Preproc, Name.Function, Text), 'smarty'),
164
+ (r'\{', Comment.Preproc, 'smarty')
165
+ ],
166
+ 'smarty': [
167
+ (r'\s+', Text),
168
+ (r'\}', Comment.Preproc, '#pop'),
169
+ (r'#[a-zA-Z_][a-zA-Z0-9_]*#', Name.Variable),
170
+ (r'\$[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z0-9_]+)*', Name.Variable),
171
+ (r'[~!%^&*()+=|\[\]:;,.<>/?{}@-]', Operator),
172
+ (r'(true|false|null)\b', Keyword.Constant),
173
+ (r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|"
174
+ r"0[xX][0-9a-fA-F]+[Ll]?", Number),
175
+ (r'"(\\\\|\\"|[^"])*"', String.Double),
176
+ (r"'(\\\\|\\'|[^'])*'", String.Single),
177
+ (r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Attribute)
178
+ ]
179
+ }
180
+
181
+ def analyse_text(text):
182
+ rv = 0.0
183
+ if re.search('\{if\s+.*?\}.*?\{/if\}', text):
184
+ rv += 0.15
185
+ if re.search('\{include\s+file=.*?\}', text):
186
+ rv += 0.15
187
+ if re.search('\{foreach\s+.*?\}.*?\{/foreach\}', text):
188
+ rv += 0.15
189
+ if re.search('\{\$.*?\}', text):
190
+ rv += 0.01
191
+ return rv
192
+
193
+
194
+ class VelocityLexer(RegexLexer):
195
+ """
196
+ Generic `Velocity <http://velocity.apache.org/>`_ template lexer.
197
+
198
+ Just highlights velocity directives and variable references, other
199
+ data is left untouched by the lexer.
200
+ """
201
+
202
+ name = 'Velocity'
203
+ aliases = ['velocity']
204
+ filenames = ['*.vm','*.fhtml']
205
+
206
+ flags = re.MULTILINE | re.DOTALL
207
+
208
+ identifier = r'[a-zA-Z_][a-zA-Z0-9_]*'
209
+
210
+ tokens = {
211
+ 'root': [
212
+ (r'[^{#$]+', Other),
213
+ (r'(#)(\*.*?\*)(#)',
214
+ bygroups(Comment.Preproc, Comment, Comment.Preproc)),
215
+ (r'(##)(.*?$)',
216
+ bygroups(Comment.Preproc, Comment)),
217
+ (r'(#\{?)(' + identifier + r')(\}?)(\s?\()',
218
+ bygroups(Comment.Preproc, Name.Function, Comment.Preproc, Punctuation),
219
+ 'directiveparams'),
220
+ (r'(#\{?)(' + identifier + r')(\}|\b)',
221
+ bygroups(Comment.Preproc, Name.Function, Comment.Preproc)),
222
+ (r'\$\{?', Punctuation, 'variable')
223
+ ],
224
+ 'variable': [
225
+ (identifier, Name.Variable),
226
+ (r'\(', Punctuation, 'funcparams'),
227
+ (r'(\.)(' + identifier + r')',
228
+ bygroups(Punctuation, Name.Variable), '#push'),
229
+ (r'\}', Punctuation, '#pop'),
230
+ (r'', Other, '#pop')
231
+ ],
232
+ 'directiveparams': [
233
+ (r'(&&|\|\||==?|!=?|[-<>+*%&\|\^/])|\b(eq|ne|gt|lt|ge|le|not|in)\b',
234
+ Operator),
235
+ (r'\[', Operator, 'rangeoperator'),
236
+ (r'\b' + identifier + r'\b', Name.Function),
237
+ include('funcparams')
238
+ ],
239
+ 'rangeoperator': [
240
+ (r'\.\.', Operator),
241
+ include('funcparams'),
242
+ (r'\]', Operator, '#pop')
243
+ ],
244
+ 'funcparams': [
245
+ (r'\$\{?', Punctuation, 'variable'),
246
+ (r'\s+', Text),
247
+ (r',', Punctuation),
248
+ (r'"(\\\\|\\"|[^"])*"', String.Double),
249
+ (r"'(\\\\|\\'|[^'])*'", String.Single),
250
+ (r"0[xX][0-9a-fA-F]+[Ll]?", Number),
251
+ (r"\b[0-9]+\b", Number),
252
+ (r'(true|false|null)\b', Keyword.Constant),
253
+ (r'\(', Punctuation, '#push'),
254
+ (r'\)', Punctuation, '#pop')
255
+ ]
256
+ }
257
+
258
+ def analyse_text(text):
259
+ rv = 0.0
260
+ if re.search(r'#\{?macro\}?\(.*?\).*?#\{?end\}?', text):
261
+ rv += 0.25
262
+ if re.search(r'#\{?if\}?\(.+?\).*?#\{?end\}?', text):
263
+ rv += 0.15
264
+ if re.search(r'#\{?foreach\}?\(.+?\).*?#\{?end\}?', text):
265
+ rv += 0.15
266
+ if re.search(r'\$\{?[a-zA-Z_][a-zA-Z0-9_]*(\([^)]*\))?'
267
+ r'(\.[a-zA-Z0-9_]+(\([^)]*\))?)*\}?', text):
268
+ rv += 0.01
269
+ return rv
270
+
271
+
272
+ class VelocityHtmlLexer(DelegatingLexer):
273
+ """
274
+ Subclass of the `VelocityLexer` that highlights unlexer data
275
+ with the `HtmlLexer`.
276
+
277
+ """
278
+
279
+ name = 'HTML+Velocity'
280
+ aliases = ['html+velocity']
281
+ alias_filenames = ['*.html','*.fhtml']
282
+ mimetypes = ['text/html+velocity']
283
+
284
+ def __init__(self, **options):
285
+ super(VelocityHtmlLexer, self).__init__(HtmlLexer, VelocityLexer,
286
+ **options)
287
+
288
+
289
+ class VelocityXmlLexer(DelegatingLexer):
290
+ """
291
+ Subclass of the `VelocityLexer` that highlights unlexer data
292
+ with the `XmlLexer`.
293
+
294
+ """
295
+
296
+ name = 'XML+Velocity'
297
+ aliases = ['xml+velocity']
298
+ alias_filenames = ['*.xml','*.vm']
299
+ mimetypes = ['application/xml+velocity']
300
+
301
+ def __init__(self, **options):
302
+ super(VelocityXmlLexer, self).__init__(XmlLexer, VelocityLexer,
303
+ **options)
304
+
305
+ def analyse_text(text):
306
+ rv = VelocityLexer.analyse_text(text) - 0.01
307
+ if looks_like_xml(text):
308
+ rv += 0.5
309
+ return rv
310
+
311
+
312
+ class DjangoLexer(RegexLexer):
313
+ """
314
+ Generic `django <http://www.djangoproject.com/documentation/templates/>`_
315
+ and `jinja <http://wsgiarea.pocoo.org/jinja/>`_ template lexer.
316
+
317
+ It just highlights django/jinja code between the preprocessor directives,
318
+ other data is left untouched by the lexer.
319
+ """
320
+
321
+ name = 'Django/Jinja'
322
+ aliases = ['django', 'jinja']
323
+ mimetypes = ['application/x-django-templating', 'application/x-jinja']
324
+
325
+ flags = re.M | re.S
326
+
327
+ tokens = {
328
+ 'root': [
329
+ (r'[^{]+', Other),
330
+ (r'\{\{', Comment.Preproc, 'var'),
331
+ # jinja/django comments
332
+ (r'\{[*#].*?[*#]\}', Comment),
333
+ # django comments
334
+ (r'(\{%)(-?\s*)(comment)(\s*-?)(%\})(.*?)'
335
+ r'(\{%)(-?\s*)(endcomment)(\s*-?)(%\})',
336
+ bygroups(Comment.Preproc, Text, Keyword, Text, Comment.Preproc,
337
+ Comment, Comment.Preproc, Text, Keyword, Text,
338
+ Comment.Preproc)),
339
+ # raw jinja blocks
340
+ (r'(\{%)(-?\s*)(raw)(\s*-?)(%\})(.*?)'
341
+ r'(\{%)(-?\s*)(endraw)(\s*-?)(%\})',
342
+ bygroups(Comment.Preproc, Text, Keyword, Text, Comment.Preproc,
343
+ Text, Comment.Preproc, Text, Keyword, Text,
344
+ Comment.Preproc)),
345
+ # filter blocks
346
+ (r'(\{%)(-?\s*)(filter)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)',
347
+ bygroups(Comment.Preproc, Text, Keyword, Text, Name.Function),
348
+ 'block'),
349
+ (r'(\{%)(-?\s*)([a-zA-Z_][a-zA-Z0-9_]*)',
350
+ bygroups(Comment.Preproc, Text, Keyword), 'block'),
351
+ (r'\{', Other)
352
+ ],
353
+ 'varnames': [
354
+ (r'(\|)(\s*)([a-zA-Z_][a-zA-Z0-9_]*)',
355
+ bygroups(Operator, Text, Name.Function)),
356
+ (r'(is)(\s+)(not)?(\s+)?([a-zA-Z_][a-zA-Z0-9_]*)',
357
+ bygroups(Keyword, Text, Keyword, Text, Name.Function)),
358
+ (r'(_|true|false|none|True|False|None)\b', Keyword.Pseudo),
359
+ (r'(in|as|reversed|recursive|not|and|or|is|if|else|import|'
360
+ r'with(?:(?:out)?\s*context)?|scoped|ignore\s+missing)\b',
361
+ Keyword),
362
+ (r'(loop|block|super|forloop)\b', Name.Builtin),
363
+ (r'[a-zA-Z][a-zA-Z0-9_-]*', Name.Variable),
364
+ (r'\.[a-zA-Z0-9_]+', Name.Variable),
365
+ (r':?"(\\\\|\\"|[^"])*"', String.Double),
366
+ (r":?'(\\\\|\\'|[^'])*'", String.Single),
367
+ (r'([{}()\[\]+\-*/,:~]|[><=]=?)', Operator),
368
+ (r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|"
369
+ r"0[xX][0-9a-fA-F]+[Ll]?", Number),
370
+ ],
371
+ 'var': [
372
+ (r'\s+', Text),
373
+ (r'(-?)(\}\})', bygroups(Text, Comment.Preproc), '#pop'),
374
+ include('varnames')
375
+ ],
376
+ 'block': [
377
+ (r'\s+', Text),
378
+ (r'(-?)(%\})', bygroups(Text, Comment.Preproc), '#pop'),
379
+ include('varnames'),
380
+ (r'.', Punctuation)
381
+ ]
382
+ }
383
+
384
+ def analyse_text(text):
385
+ rv = 0.0
386
+ if re.search(r'\{%\s*(block|extends)', text) is not None:
387
+ rv += 0.4
388
+ if re.search(r'\{%\s*if\s*.*?%\}', text) is not None:
389
+ rv += 0.1
390
+ if re.search(r'\{\{.*?\}\}', text) is not None:
391
+ rv += 0.1
392
+ return rv
393
+
394
+
395
+ class MyghtyLexer(RegexLexer):
396
+ """
397
+ Generic `myghty templates`_ lexer. Code that isn't Myghty
398
+ markup is yielded as `Token.Other`.
399
+
400
+ *New in Pygments 0.6.*
401
+
402
+ .. _myghty templates: http://www.myghty.org/
403
+ """
404
+
405
+ name = 'Myghty'
406
+ aliases = ['myghty']
407
+ filenames = ['*.myt', 'autodelegate']
408
+ mimetypes = ['application/x-myghty']
409
+
410
+ tokens = {
411
+ 'root': [
412
+ (r'\s+', Text),
413
+ (r'(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)(?s)',
414
+ bygroups(Name.Tag, Text, Name.Function, Name.Tag,
415
+ using(this), Name.Tag)),
416
+ (r'(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)(?s)',
417
+ bygroups(Name.Tag, Name.Function, Name.Tag,
418
+ using(PythonLexer), Name.Tag)),
419
+ (r'(<&[^|])(.*?)(,.*?)?(&>)',
420
+ bygroups(Name.Tag, Name.Function, using(PythonLexer), Name.Tag)),
421
+ (r'(<&\|)(.*?)(,.*?)?(&>)(?s)',
422
+ bygroups(Name.Tag, Name.Function, using(PythonLexer), Name.Tag)),
423
+ (r'</&>', Name.Tag),
424
+ (r'(<%!?)(.*?)(%>)(?s)',
425
+ bygroups(Name.Tag, using(PythonLexer), Name.Tag)),
426
+ (r'(?<=^)#[^\n]*(\n|\Z)', Comment),
427
+ (r'(?<=^)(%)([^\n]*)(\n|\Z)',
428
+ bygroups(Name.Tag, using(PythonLexer), Other)),
429
+ (r"""(?sx)
430
+ (.+?) # anything, followed by:
431
+ (?:
432
+ (?<=\n)(?=[%#]) | # an eval or comment line
433
+ (?=</?[%&]) | # a substitution or block or
434
+ # call start or end
435
+ # - don't consume
436
+ (\\\n) | # an escaped newline
437
+ \Z # end of string
438
+ )""", bygroups(Other, Operator)),
439
+ ]
440
+ }
441
+
442
+
443
+ class MyghtyHtmlLexer(DelegatingLexer):
444
+ """
445
+ Subclass of the `MyghtyLexer` that highlights unlexer data
446
+ with the `HtmlLexer`.
447
+
448
+ *New in Pygments 0.6.*
449
+ """
450
+
451
+ name = 'HTML+Myghty'
452
+ aliases = ['html+myghty']
453
+ mimetypes = ['text/html+myghty']
454
+
455
+ def __init__(self, **options):
456
+ super(MyghtyHtmlLexer, self).__init__(HtmlLexer, MyghtyLexer,
457
+ **options)
458
+
459
+
460
+ class MyghtyXmlLexer(DelegatingLexer):
461
+ """
462
+ Subclass of the `MyghtyLexer` that highlights unlexer data
463
+ with the `XmlLexer`.
464
+
465
+ *New in Pygments 0.6.*
466
+ """
467
+
468
+ name = 'XML+Myghty'
469
+ aliases = ['xml+myghty']
470
+ mimetypes = ['application/xml+myghty']
471
+
472
+ def __init__(self, **options):
473
+ super(MyghtyXmlLexer, self).__init__(XmlLexer, MyghtyLexer,
474
+ **options)
475
+
476
+
477
+ class MyghtyJavascriptLexer(DelegatingLexer):
478
+ """
479
+ Subclass of the `MyghtyLexer` that highlights unlexer data
480
+ with the `JavascriptLexer`.
481
+
482
+ *New in Pygments 0.6.*
483
+ """
484
+
485
+ name = 'JavaScript+Myghty'
486
+ aliases = ['js+myghty', 'javascript+myghty']
487
+ mimetypes = ['application/x-javascript+myghty',
488
+ 'text/x-javascript+myghty',
489
+ 'text/javascript+mygthy']
490
+
491
+ def __init__(self, **options):
492
+ super(MyghtyJavascriptLexer, self).__init__(JavascriptLexer,
493
+ MyghtyLexer, **options)
494
+
495
+
496
+ class MyghtyCssLexer(DelegatingLexer):
497
+ """
498
+ Subclass of the `MyghtyLexer` that highlights unlexer data
499
+ with the `CssLexer`.
500
+
501
+ *New in Pygments 0.6.*
502
+ """
503
+
504
+ name = 'CSS+Myghty'
505
+ aliases = ['css+myghty']
506
+ mimetypes = ['text/css+myghty']
507
+
508
+ def __init__(self, **options):
509
+ super(MyghtyCssLexer, self).__init__(CssLexer, MyghtyLexer,
510
+ **options)
511
+
512
+
513
+ class MasonLexer(RegexLexer):
514
+ """
515
+ Generic `mason templates`_ lexer. Stolen from Myghty lexer. Code that isn't
516
+ Mason markup is HTML.
517
+
518
+ .. _mason templates: http://www.masonhq.com/
519
+
520
+ *New in Pygments 1.4.*
521
+ """
522
+ name = 'Mason'
523
+ aliases = ['mason']
524
+ filenames = ['*.m', '*.mhtml', '*.mc', '*.mi', 'autohandler', 'dhandler']
525
+ mimetypes = ['application/x-mason']
526
+
527
+ tokens = {
528
+ 'root': [
529
+ (r'\s+', Text),
530
+ (r'(<%doc>)(.*?)(</%doc>)(?s)',
531
+ bygroups(Name.Tag, Comment.Multiline, Name.Tag)),
532
+ (r'(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)(?s)',
533
+ bygroups(Name.Tag, Text, Name.Function, Name.Tag,
534
+ using(this), Name.Tag)),
535
+ (r'(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)(?s)',
536
+ bygroups(Name.Tag, Name.Function, Name.Tag,
537
+ using(PerlLexer), Name.Tag)),
538
+ (r'(<&[^|])(.*?)(,.*?)?(&>)(?s)',
539
+ bygroups(Name.Tag, Name.Function, using(PerlLexer), Name.Tag)),
540
+ (r'(<&\|)(.*?)(,.*?)?(&>)(?s)',
541
+ bygroups(Name.Tag, Name.Function, using(PerlLexer), Name.Tag)),
542
+ (r'</&>', Name.Tag),
543
+ (r'(<%!?)(.*?)(%>)(?s)',
544
+ bygroups(Name.Tag, using(PerlLexer), Name.Tag)),
545
+ (r'(?<=^)#[^\n]*(\n|\Z)', Comment),
546
+ (r'(?<=^)(%)([^\n]*)(\n|\Z)',
547
+ bygroups(Name.Tag, using(PerlLexer), Other)),
548
+ (r"""(?sx)
549
+ (.+?) # anything, followed by:
550
+ (?:
551
+ (?<=\n)(?=[%#]) | # an eval or comment line
552
+ (?=</?[%&]) | # a substitution or block or
553
+ # call start or end
554
+ # - don't consume
555
+ (\\\n) | # an escaped newline
556
+ \Z # end of string
557
+ )""", bygroups(using(HtmlLexer), Operator)),
558
+ ]
559
+ }
560
+
561
+ def analyse_text(text):
562
+ rv = 0.0
563
+ if re.search('<&', text) is not None:
564
+ rv = 1.0
565
+ return rv
566
+
567
+
568
+ class MakoLexer(RegexLexer):
569
+ """
570
+ Generic `mako templates`_ lexer. Code that isn't Mako
571
+ markup is yielded as `Token.Other`.
572
+
573
+ *New in Pygments 0.7.*
574
+
575
+ .. _mako templates: http://www.makotemplates.org/
576
+ """
577
+
578
+ name = 'Mako'
579
+ aliases = ['mako']
580
+ filenames = ['*.mao']
581
+ mimetypes = ['application/x-mako']
582
+
583
+ tokens = {
584
+ 'root': [
585
+ (r'(\s*)(%)(\s*end(?:\w+))(\n|\Z)',
586
+ bygroups(Text, Comment.Preproc, Keyword, Other)),
587
+ (r'(\s*)(%)([^\n]*)(\n|\Z)',
588
+ bygroups(Text, Comment.Preproc, using(PythonLexer), Other)),
589
+ (r'(\s*)(##[^\n]*)(\n|\Z)',
590
+ bygroups(Text, Comment.Preproc, Other)),
591
+ (r'(?s)<%doc>.*?</%doc>', Comment.Preproc),
592
+ (r'(<%)([\w\.\:]+)',
593
+ bygroups(Comment.Preproc, Name.Builtin), 'tag'),
594
+ (r'(</%)([\w\.\:]+)(>)',
595
+ bygroups(Comment.Preproc, Name.Builtin, Comment.Preproc)),
596
+ (r'<%(?=([\w\.\:]+))', Comment.Preproc, 'ondeftags'),
597
+ (r'(<%(?:!?))(.*?)(%>)(?s)',
598
+ bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
599
+ (r'(\$\{)(.*?)(\})',
600
+ bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
601
+ (r'''(?sx)
602
+ (.+?) # anything, followed by:
603
+ (?:
604
+ (?<=\n)(?=%|\#\#) | # an eval or comment line
605
+ (?=\#\*) | # multiline comment
606
+ (?=</?%) | # a python block
607
+ # call start or end
608
+ (?=\$\{) | # a substitution
609
+ (?<=\n)(?=\s*%) |
610
+ # - don't consume
611
+ (\\\n) | # an escaped newline
612
+ \Z # end of string
613
+ )
614
+ ''', bygroups(Other, Operator)),
615
+ (r'\s+', Text),
616
+ ],
617
+ 'ondeftags': [
618
+ (r'<%', Comment.Preproc),
619
+ (r'(?<=<%)(include|inherit|namespace|page)', Name.Builtin),
620
+ include('tag'),
621
+ ],
622
+ 'tag': [
623
+ (r'((?:\w+)\s*=)(\s*)(".*?")',
624
+ bygroups(Name.Attribute, Text, String)),
625
+ (r'/?\s*>', Comment.Preproc, '#pop'),
626
+ (r'\s+', Text),
627
+ ],
628
+ 'attr': [
629
+ ('".*?"', String, '#pop'),
630
+ ("'.*?'", String, '#pop'),
631
+ (r'[^\s>]+', String, '#pop'),
632
+ ],
633
+ }
634
+
635
+
636
+ class MakoHtmlLexer(DelegatingLexer):
637
+ """
638
+ Subclass of the `MakoLexer` that highlights unlexed data
639
+ with the `HtmlLexer`.
640
+
641
+ *New in Pygments 0.7.*
642
+ """
643
+
644
+ name = 'HTML+Mako'
645
+ aliases = ['html+mako']
646
+ mimetypes = ['text/html+mako']
647
+
648
+ def __init__(self, **options):
649
+ super(MakoHtmlLexer, self).__init__(HtmlLexer, MakoLexer,
650
+ **options)
651
+
652
+ class MakoXmlLexer(DelegatingLexer):
653
+ """
654
+ Subclass of the `MakoLexer` that highlights unlexer data
655
+ with the `XmlLexer`.
656
+
657
+ *New in Pygments 0.7.*
658
+ """
659
+
660
+ name = 'XML+Mako'
661
+ aliases = ['xml+mako']
662
+ mimetypes = ['application/xml+mako']
663
+
664
+ def __init__(self, **options):
665
+ super(MakoXmlLexer, self).__init__(XmlLexer, MakoLexer,
666
+ **options)
667
+
668
+ class MakoJavascriptLexer(DelegatingLexer):
669
+ """
670
+ Subclass of the `MakoLexer` that highlights unlexer data
671
+ with the `JavascriptLexer`.
672
+
673
+ *New in Pygments 0.7.*
674
+ """
675
+
676
+ name = 'JavaScript+Mako'
677
+ aliases = ['js+mako', 'javascript+mako']
678
+ mimetypes = ['application/x-javascript+mako',
679
+ 'text/x-javascript+mako',
680
+ 'text/javascript+mako']
681
+
682
+ def __init__(self, **options):
683
+ super(MakoJavascriptLexer, self).__init__(JavascriptLexer,
684
+ MakoLexer, **options)
685
+
686
+ class MakoCssLexer(DelegatingLexer):
687
+ """
688
+ Subclass of the `MakoLexer` that highlights unlexer data
689
+ with the `CssLexer`.
690
+
691
+ *New in Pygments 0.7.*
692
+ """
693
+
694
+ name = 'CSS+Mako'
695
+ aliases = ['css+mako']
696
+ mimetypes = ['text/css+mako']
697
+
698
+ def __init__(self, **options):
699
+ super(MakoCssLexer, self).__init__(CssLexer, MakoLexer,
700
+ **options)
701
+
702
+
703
+ # Genshi and Cheetah lexers courtesy of Matt Good.
704
+
705
+ class CheetahPythonLexer(Lexer):
706
+ """
707
+ Lexer for handling Cheetah's special $ tokens in Python syntax.
708
+ """
709
+
710
+ def get_tokens_unprocessed(self, text):
711
+ pylexer = PythonLexer(**self.options)
712
+ for pos, type_, value in pylexer.get_tokens_unprocessed(text):
713
+ if type_ == Token.Error and value == '$':
714
+ type_ = Comment.Preproc
715
+ yield pos, type_, value
716
+
717
+
718
+ class CheetahLexer(RegexLexer):
719
+ """
720
+ Generic `cheetah templates`_ lexer. Code that isn't Cheetah
721
+ markup is yielded as `Token.Other`. This also works for
722
+ `spitfire templates`_ which use the same syntax.
723
+
724
+ .. _cheetah templates: http://www.cheetahtemplate.org/
725
+ .. _spitfire templates: http://code.google.com/p/spitfire/
726
+ """
727
+
728
+ name = 'Cheetah'
729
+ aliases = ['cheetah', 'spitfire']
730
+ filenames = ['*.tmpl', '*.spt']
731
+ mimetypes = ['application/x-cheetah', 'application/x-spitfire']
732
+
733
+ tokens = {
734
+ 'root': [
735
+ (r'(##[^\n]*)$',
736
+ (bygroups(Comment))),
737
+ (r'#[*](.|\n)*?[*]#', Comment),
738
+ (r'#end[^#\n]*(?:#|$)', Comment.Preproc),
739
+ (r'#slurp$', Comment.Preproc),
740
+ (r'(#[a-zA-Z]+)([^#\n]*)(#|$)',
741
+ (bygroups(Comment.Preproc, using(CheetahPythonLexer),
742
+ Comment.Preproc))),
743
+ # TODO support other Python syntax like $foo['bar']
744
+ (r'(\$)([a-zA-Z_][a-zA-Z0-9_\.]*[a-zA-Z0-9_])',
745
+ bygroups(Comment.Preproc, using(CheetahPythonLexer))),
746
+ (r'(\$\{!?)(.*?)(\})(?s)',
747
+ bygroups(Comment.Preproc, using(CheetahPythonLexer),
748
+ Comment.Preproc)),
749
+ (r'''(?sx)
750
+ (.+?) # anything, followed by:
751
+ (?:
752
+ (?=[#][#a-zA-Z]*) | # an eval comment
753
+ (?=\$[a-zA-Z_{]) | # a substitution
754
+ \Z # end of string
755
+ )
756
+ ''', Other),
757
+ (r'\s+', Text),
758
+ ],
759
+ }
760
+
761
+
762
+ class CheetahHtmlLexer(DelegatingLexer):
763
+ """
764
+ Subclass of the `CheetahLexer` that highlights unlexer data
765
+ with the `HtmlLexer`.
766
+ """
767
+
768
+ name = 'HTML+Cheetah'
769
+ aliases = ['html+cheetah', 'html+spitfire', 'htmlcheetah']
770
+ mimetypes = ['text/html+cheetah', 'text/html+spitfire']
771
+
772
+ def __init__(self, **options):
773
+ super(CheetahHtmlLexer, self).__init__(HtmlLexer, CheetahLexer,
774
+ **options)
775
+
776
+
777
+ class CheetahXmlLexer(DelegatingLexer):
778
+ """
779
+ Subclass of the `CheetahLexer` that highlights unlexer data
780
+ with the `XmlLexer`.
781
+ """
782
+
783
+ name = 'XML+Cheetah'
784
+ aliases = ['xml+cheetah', 'xml+spitfire']
785
+ mimetypes = ['application/xml+cheetah', 'application/xml+spitfire']
786
+
787
+ def __init__(self, **options):
788
+ super(CheetahXmlLexer, self).__init__(XmlLexer, CheetahLexer,
789
+ **options)
790
+
791
+
792
+ class CheetahJavascriptLexer(DelegatingLexer):
793
+ """
794
+ Subclass of the `CheetahLexer` that highlights unlexer data
795
+ with the `JavascriptLexer`.
796
+ """
797
+
798
+ name = 'JavaScript+Cheetah'
799
+ aliases = ['js+cheetah', 'javascript+cheetah',
800
+ 'js+spitfire', 'javascript+spitfire']
801
+ mimetypes = ['application/x-javascript+cheetah',
802
+ 'text/x-javascript+cheetah',
803
+ 'text/javascript+cheetah',
804
+ 'application/x-javascript+spitfire',
805
+ 'text/x-javascript+spitfire',
806
+ 'text/javascript+spitfire']
807
+
808
+ def __init__(self, **options):
809
+ super(CheetahJavascriptLexer, self).__init__(JavascriptLexer,
810
+ CheetahLexer, **options)
811
+
812
+
813
+ class GenshiTextLexer(RegexLexer):
814
+ """
815
+ A lexer that highlights `genshi <http://genshi.edgewall.org/>`_ text
816
+ templates.
817
+ """
818
+
819
+ name = 'Genshi Text'
820
+ aliases = ['genshitext']
821
+ mimetypes = ['application/x-genshi-text', 'text/x-genshi']
822
+
823
+ tokens = {
824
+ 'root': [
825
+ (r'[^#\$\s]+', Other),
826
+ (r'^(\s*)(##.*)$', bygroups(Text, Comment)),
827
+ (r'^(\s*)(#)', bygroups(Text, Comment.Preproc), 'directive'),
828
+ include('variable'),
829
+ (r'[#\$\s]', Other),
830
+ ],
831
+ 'directive': [
832
+ (r'\n', Text, '#pop'),
833
+ (r'(?:def|for|if)\s+.*', using(PythonLexer), '#pop'),
834
+ (r'(choose|when|with)([^\S\n]+)(.*)',
835
+ bygroups(Keyword, Text, using(PythonLexer)), '#pop'),
836
+ (r'(choose|otherwise)\b', Keyword, '#pop'),
837
+ (r'(end\w*)([^\S\n]*)(.*)', bygroups(Keyword, Text, Comment), '#pop'),
838
+ ],
839
+ 'variable': [
840
+ (r'(?<!\$)(\$\{)(.+?)(\})',
841
+ bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
842
+ (r'(?<!\$)(\$)([a-zA-Z_][a-zA-Z0-9_\.]*)',
843
+ Name.Variable),
844
+ ]
845
+ }
846
+
847
+
848
+ class GenshiMarkupLexer(RegexLexer):
849
+ """
850
+ Base lexer for Genshi markup, used by `HtmlGenshiLexer` and
851
+ `GenshiLexer`.
852
+ """
853
+
854
+ flags = re.DOTALL
855
+
856
+ tokens = {
857
+ 'root': [
858
+ (r'[^<\$]+', Other),
859
+ (r'(<\?python)(.*?)(\?>)',
860
+ bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
861
+ # yield style and script blocks as Other
862
+ (r'<\s*(script|style)\s*.*?>.*?<\s*/\1\s*>', Other),
863
+ (r'<\s*py:[a-zA-Z0-9]+', Name.Tag, 'pytag'),
864
+ (r'<\s*[a-zA-Z0-9:]+', Name.Tag, 'tag'),
865
+ include('variable'),
866
+ (r'[<\$]', Other),
867
+ ],
868
+ 'pytag': [
869
+ (r'\s+', Text),
870
+ (r'[a-zA-Z0-9_:-]+\s*=', Name.Attribute, 'pyattr'),
871
+ (r'/?\s*>', Name.Tag, '#pop'),
872
+ ],
873
+ 'pyattr': [
874
+ ('(")(.*?)(")', bygroups(String, using(PythonLexer), String), '#pop'),
875
+ ("(')(.*?)(')", bygroups(String, using(PythonLexer), String), '#pop'),
876
+ (r'[^\s>]+', String, '#pop'),
877
+ ],
878
+ 'tag': [
879
+ (r'\s+', Text),
880
+ (r'py:[a-zA-Z0-9_-]+\s*=', Name.Attribute, 'pyattr'),
881
+ (r'[a-zA-Z0-9_:-]+\s*=', Name.Attribute, 'attr'),
882
+ (r'/?\s*>', Name.Tag, '#pop'),
883
+ ],
884
+ 'attr': [
885
+ ('"', String, 'attr-dstring'),
886
+ ("'", String, 'attr-sstring'),
887
+ (r'[^\s>]*', String, '#pop')
888
+ ],
889
+ 'attr-dstring': [
890
+ ('"', String, '#pop'),
891
+ include('strings'),
892
+ ("'", String)
893
+ ],
894
+ 'attr-sstring': [
895
+ ("'", String, '#pop'),
896
+ include('strings'),
897
+ ("'", String)
898
+ ],
899
+ 'strings': [
900
+ ('[^"\'$]+', String),
901
+ include('variable')
902
+ ],
903
+ 'variable': [
904
+ (r'(?<!\$)(\$\{)(.+?)(\})',
905
+ bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
906
+ (r'(?<!\$)(\$)([a-zA-Z_][a-zA-Z0-9_\.]*)',
907
+ Name.Variable),
908
+ ]
909
+ }
910
+
911
+
912
+ class HtmlGenshiLexer(DelegatingLexer):
913
+ """
914
+ A lexer that highlights `genshi <http://genshi.edgewall.org/>`_ and
915
+ `kid <http://kid-templating.org/>`_ kid HTML templates.
916
+ """
917
+
918
+ name = 'HTML+Genshi'
919
+ aliases = ['html+genshi', 'html+kid']
920
+ alias_filenames = ['*.html', '*.htm', '*.xhtml']
921
+ mimetypes = ['text/html+genshi']
922
+
923
+ def __init__(self, **options):
924
+ super(HtmlGenshiLexer, self).__init__(HtmlLexer, GenshiMarkupLexer,
925
+ **options)
926
+
927
+ def analyse_text(text):
928
+ rv = 0.0
929
+ if re.search('\$\{.*?\}', text) is not None:
930
+ rv += 0.2
931
+ if re.search('py:(.*?)=["\']', text) is not None:
932
+ rv += 0.2
933
+ return rv + HtmlLexer.analyse_text(text) - 0.01
934
+
935
+
936
+ class GenshiLexer(DelegatingLexer):
937
+ """
938
+ A lexer that highlights `genshi <http://genshi.edgewall.org/>`_ and
939
+ `kid <http://kid-templating.org/>`_ kid XML templates.
940
+ """
941
+
942
+ name = 'Genshi'
943
+ aliases = ['genshi', 'kid', 'xml+genshi', 'xml+kid']
944
+ filenames = ['*.kid']
945
+ alias_filenames = ['*.xml']
946
+ mimetypes = ['application/x-genshi', 'application/x-kid']
947
+
948
+ def __init__(self, **options):
949
+ super(GenshiLexer, self).__init__(XmlLexer, GenshiMarkupLexer,
950
+ **options)
951
+
952
+ def analyse_text(text):
953
+ rv = 0.0
954
+ if re.search('\$\{.*?\}', text) is not None:
955
+ rv += 0.2
956
+ if re.search('py:(.*?)=["\']', text) is not None:
957
+ rv += 0.2
958
+ return rv + XmlLexer.analyse_text(text) - 0.01
959
+
960
+
961
+ class JavascriptGenshiLexer(DelegatingLexer):
962
+ """
963
+ A lexer that highlights javascript code in genshi text templates.
964
+ """
965
+
966
+ name = 'JavaScript+Genshi Text'
967
+ aliases = ['js+genshitext', 'js+genshi', 'javascript+genshitext',
968
+ 'javascript+genshi']
969
+ alias_filenames = ['*.js']
970
+ mimetypes = ['application/x-javascript+genshi',
971
+ 'text/x-javascript+genshi',
972
+ 'text/javascript+genshi']
973
+
974
+ def __init__(self, **options):
975
+ super(JavascriptGenshiLexer, self).__init__(JavascriptLexer,
976
+ GenshiTextLexer,
977
+ **options)
978
+
979
+ def analyse_text(text):
980
+ return GenshiLexer.analyse_text(text) - 0.05
981
+
982
+
983
+ class CssGenshiLexer(DelegatingLexer):
984
+ """
985
+ A lexer that highlights CSS definitions in genshi text templates.
986
+ """
987
+
988
+ name = 'CSS+Genshi Text'
989
+ aliases = ['css+genshitext', 'css+genshi']
990
+ alias_filenames = ['*.css']
991
+ mimetypes = ['text/css+genshi']
992
+
993
+ def __init__(self, **options):
994
+ super(CssGenshiLexer, self).__init__(CssLexer, GenshiTextLexer,
995
+ **options)
996
+
997
+ def analyse_text(text):
998
+ return GenshiLexer.analyse_text(text) - 0.05
999
+
1000
+
1001
+ class RhtmlLexer(DelegatingLexer):
1002
+ """
1003
+ Subclass of the ERB lexer that highlights the unlexed data with the
1004
+ html lexer.
1005
+
1006
+ Nested Javascript and CSS is highlighted too.
1007
+ """
1008
+
1009
+ name = 'RHTML'
1010
+ aliases = ['rhtml', 'html+erb', 'html+ruby']
1011
+ filenames = ['*.rhtml']
1012
+ alias_filenames = ['*.html', '*.htm', '*.xhtml']
1013
+ mimetypes = ['text/html+ruby']
1014
+
1015
+ def __init__(self, **options):
1016
+ super(RhtmlLexer, self).__init__(HtmlLexer, ErbLexer, **options)
1017
+
1018
+ def analyse_text(text):
1019
+ rv = ErbLexer.analyse_text(text) - 0.01
1020
+ if html_doctype_matches(text):
1021
+ # one more than the XmlErbLexer returns
1022
+ rv += 0.5
1023
+ return rv
1024
+
1025
+
1026
+ class XmlErbLexer(DelegatingLexer):
1027
+ """
1028
+ Subclass of `ErbLexer` which highlights data outside preprocessor
1029
+ directives with the `XmlLexer`.
1030
+ """
1031
+
1032
+ name = 'XML+Ruby'
1033
+ aliases = ['xml+erb', 'xml+ruby']
1034
+ alias_filenames = ['*.xml']
1035
+ mimetypes = ['application/xml+ruby']
1036
+
1037
+ def __init__(self, **options):
1038
+ super(XmlErbLexer, self).__init__(XmlLexer, ErbLexer, **options)
1039
+
1040
+ def analyse_text(text):
1041
+ rv = ErbLexer.analyse_text(text) - 0.01
1042
+ if looks_like_xml(text):
1043
+ rv += 0.4
1044
+ return rv
1045
+
1046
+
1047
+ class CssErbLexer(DelegatingLexer):
1048
+ """
1049
+ Subclass of `ErbLexer` which highlights unlexed data with the `CssLexer`.
1050
+ """
1051
+
1052
+ name = 'CSS+Ruby'
1053
+ aliases = ['css+erb', 'css+ruby']
1054
+ alias_filenames = ['*.css']
1055
+ mimetypes = ['text/css+ruby']
1056
+
1057
+ def __init__(self, **options):
1058
+ super(CssErbLexer, self).__init__(CssLexer, ErbLexer, **options)
1059
+
1060
+ def analyse_text(text):
1061
+ return ErbLexer.analyse_text(text) - 0.05
1062
+
1063
+
1064
+ class JavascriptErbLexer(DelegatingLexer):
1065
+ """
1066
+ Subclass of `ErbLexer` which highlights unlexed data with the
1067
+ `JavascriptLexer`.
1068
+ """
1069
+
1070
+ name = 'JavaScript+Ruby'
1071
+ aliases = ['js+erb', 'javascript+erb', 'js+ruby', 'javascript+ruby']
1072
+ alias_filenames = ['*.js']
1073
+ mimetypes = ['application/x-javascript+ruby',
1074
+ 'text/x-javascript+ruby',
1075
+ 'text/javascript+ruby']
1076
+
1077
+ def __init__(self, **options):
1078
+ super(JavascriptErbLexer, self).__init__(JavascriptLexer, ErbLexer,
1079
+ **options)
1080
+
1081
+ def analyse_text(text):
1082
+ return ErbLexer.analyse_text(text) - 0.05
1083
+
1084
+
1085
+ class HtmlPhpLexer(DelegatingLexer):
1086
+ """
1087
+ Subclass of `PhpLexer` that highlights unhandled data with the `HtmlLexer`.
1088
+
1089
+ Nested Javascript and CSS is highlighted too.
1090
+ """
1091
+
1092
+ name = 'HTML+PHP'
1093
+ aliases = ['html+php']
1094
+ filenames = ['*.phtml']
1095
+ alias_filenames = ['*.php', '*.html', '*.htm', '*.xhtml',
1096
+ '*.php[345]']
1097
+ mimetypes = ['application/x-php',
1098
+ 'application/x-httpd-php', 'application/x-httpd-php3',
1099
+ 'application/x-httpd-php4', 'application/x-httpd-php5']
1100
+
1101
+ def __init__(self, **options):
1102
+ super(HtmlPhpLexer, self).__init__(HtmlLexer, PhpLexer, **options)
1103
+
1104
+ def analyse_text(text):
1105
+ rv = PhpLexer.analyse_text(text) - 0.01
1106
+ if html_doctype_matches(text):
1107
+ rv += 0.5
1108
+ return rv
1109
+
1110
+
1111
+ class XmlPhpLexer(DelegatingLexer):
1112
+ """
1113
+ Subclass of `PhpLexer` that higlights unhandled data with the `XmlLexer`.
1114
+ """
1115
+
1116
+ name = 'XML+PHP'
1117
+ aliases = ['xml+php']
1118
+ alias_filenames = ['*.xml', '*.php', '*.php[345]']
1119
+ mimetypes = ['application/xml+php']
1120
+
1121
+ def __init__(self, **options):
1122
+ super(XmlPhpLexer, self).__init__(XmlLexer, PhpLexer, **options)
1123
+
1124
+ def analyse_text(text):
1125
+ rv = PhpLexer.analyse_text(text) - 0.01
1126
+ if looks_like_xml(text):
1127
+ rv += 0.4
1128
+ return rv
1129
+
1130
+
1131
+ class CssPhpLexer(DelegatingLexer):
1132
+ """
1133
+ Subclass of `PhpLexer` which highlights unmatched data with the `CssLexer`.
1134
+ """
1135
+
1136
+ name = 'CSS+PHP'
1137
+ aliases = ['css+php']
1138
+ alias_filenames = ['*.css']
1139
+ mimetypes = ['text/css+php']
1140
+
1141
+ def __init__(self, **options):
1142
+ super(CssPhpLexer, self).__init__(CssLexer, PhpLexer, **options)
1143
+
1144
+ def analyse_text(text):
1145
+ return PhpLexer.analyse_text(text) - 0.05
1146
+
1147
+
1148
+ class JavascriptPhpLexer(DelegatingLexer):
1149
+ """
1150
+ Subclass of `PhpLexer` which highlights unmatched data with the
1151
+ `JavascriptLexer`.
1152
+ """
1153
+
1154
+ name = 'JavaScript+PHP'
1155
+ aliases = ['js+php', 'javascript+php']
1156
+ alias_filenames = ['*.js']
1157
+ mimetypes = ['application/x-javascript+php',
1158
+ 'text/x-javascript+php',
1159
+ 'text/javascript+php']
1160
+
1161
+ def __init__(self, **options):
1162
+ super(JavascriptPhpLexer, self).__init__(JavascriptLexer, PhpLexer,
1163
+ **options)
1164
+
1165
+ def analyse_text(text):
1166
+ return PhpLexer.analyse_text(text)
1167
+
1168
+
1169
+ class HtmlSmartyLexer(DelegatingLexer):
1170
+ """
1171
+ Subclass of the `SmartyLexer` that highighlights unlexed data with the
1172
+ `HtmlLexer`.
1173
+
1174
+ Nested Javascript and CSS is highlighted too.
1175
+ """
1176
+
1177
+ name = 'HTML+Smarty'
1178
+ aliases = ['html+smarty']
1179
+ alias_filenames = ['*.html', '*.htm', '*.xhtml', '*.tpl']
1180
+ mimetypes = ['text/html+smarty']
1181
+
1182
+ def __init__(self, **options):
1183
+ super(HtmlSmartyLexer, self).__init__(HtmlLexer, SmartyLexer, **options)
1184
+
1185
+ def analyse_text(text):
1186
+ rv = SmartyLexer.analyse_text(text) - 0.01
1187
+ if html_doctype_matches(text):
1188
+ rv += 0.5
1189
+ return rv
1190
+
1191
+
1192
+ class XmlSmartyLexer(DelegatingLexer):
1193
+ """
1194
+ Subclass of the `SmartyLexer` that highlights unlexed data with the
1195
+ `XmlLexer`.
1196
+ """
1197
+
1198
+ name = 'XML+Smarty'
1199
+ aliases = ['xml+smarty']
1200
+ alias_filenames = ['*.xml', '*.tpl']
1201
+ mimetypes = ['application/xml+smarty']
1202
+
1203
+ def __init__(self, **options):
1204
+ super(XmlSmartyLexer, self).__init__(XmlLexer, SmartyLexer, **options)
1205
+
1206
+ def analyse_text(text):
1207
+ rv = SmartyLexer.analyse_text(text) - 0.01
1208
+ if looks_like_xml(text):
1209
+ rv += 0.4
1210
+ return rv
1211
+
1212
+
1213
+ class CssSmartyLexer(DelegatingLexer):
1214
+ """
1215
+ Subclass of the `SmartyLexer` that highlights unlexed data with the
1216
+ `CssLexer`.
1217
+ """
1218
+
1219
+ name = 'CSS+Smarty'
1220
+ aliases = ['css+smarty']
1221
+ alias_filenames = ['*.css', '*.tpl']
1222
+ mimetypes = ['text/css+smarty']
1223
+
1224
+ def __init__(self, **options):
1225
+ super(CssSmartyLexer, self).__init__(CssLexer, SmartyLexer, **options)
1226
+
1227
+ def analyse_text(text):
1228
+ return SmartyLexer.analyse_text(text) - 0.05
1229
+
1230
+
1231
+ class JavascriptSmartyLexer(DelegatingLexer):
1232
+ """
1233
+ Subclass of the `SmartyLexer` that highlights unlexed data with the
1234
+ `JavascriptLexer`.
1235
+ """
1236
+
1237
+ name = 'JavaScript+Smarty'
1238
+ aliases = ['js+smarty', 'javascript+smarty']
1239
+ alias_filenames = ['*.js', '*.tpl']
1240
+ mimetypes = ['application/x-javascript+smarty',
1241
+ 'text/x-javascript+smarty',
1242
+ 'text/javascript+smarty']
1243
+
1244
+ def __init__(self, **options):
1245
+ super(JavascriptSmartyLexer, self).__init__(JavascriptLexer, SmartyLexer,
1246
+ **options)
1247
+
1248
+ def analyse_text(text):
1249
+ return SmartyLexer.analyse_text(text) - 0.05
1250
+
1251
+
1252
+ class HtmlDjangoLexer(DelegatingLexer):
1253
+ """
1254
+ Subclass of the `DjangoLexer` that highighlights unlexed data with the
1255
+ `HtmlLexer`.
1256
+
1257
+ Nested Javascript and CSS is highlighted too.
1258
+ """
1259
+
1260
+ name = 'HTML+Django/Jinja'
1261
+ aliases = ['html+django', 'html+jinja', 'htmldjango']
1262
+ alias_filenames = ['*.html', '*.htm', '*.xhtml']
1263
+ mimetypes = ['text/html+django', 'text/html+jinja']
1264
+
1265
+ def __init__(self, **options):
1266
+ super(HtmlDjangoLexer, self).__init__(HtmlLexer, DjangoLexer, **options)
1267
+
1268
+ def analyse_text(text):
1269
+ rv = DjangoLexer.analyse_text(text) - 0.01
1270
+ if html_doctype_matches(text):
1271
+ rv += 0.5
1272
+ return rv
1273
+
1274
+
1275
+ class XmlDjangoLexer(DelegatingLexer):
1276
+ """
1277
+ Subclass of the `DjangoLexer` that highlights unlexed data with the
1278
+ `XmlLexer`.
1279
+ """
1280
+
1281
+ name = 'XML+Django/Jinja'
1282
+ aliases = ['xml+django', 'xml+jinja']
1283
+ alias_filenames = ['*.xml']
1284
+ mimetypes = ['application/xml+django', 'application/xml+jinja']
1285
+
1286
+ def __init__(self, **options):
1287
+ super(XmlDjangoLexer, self).__init__(XmlLexer, DjangoLexer, **options)
1288
+
1289
+ def analyse_text(text):
1290
+ rv = DjangoLexer.analyse_text(text) - 0.01
1291
+ if looks_like_xml(text):
1292
+ rv += 0.4
1293
+ return rv
1294
+
1295
+
1296
+ class CssDjangoLexer(DelegatingLexer):
1297
+ """
1298
+ Subclass of the `DjangoLexer` that highlights unlexed data with the
1299
+ `CssLexer`.
1300
+ """
1301
+
1302
+ name = 'CSS+Django/Jinja'
1303
+ aliases = ['css+django', 'css+jinja']
1304
+ alias_filenames = ['*.css']
1305
+ mimetypes = ['text/css+django', 'text/css+jinja']
1306
+
1307
+ def __init__(self, **options):
1308
+ super(CssDjangoLexer, self).__init__(CssLexer, DjangoLexer, **options)
1309
+
1310
+ def analyse_text(text):
1311
+ return DjangoLexer.analyse_text(text) - 0.05
1312
+
1313
+
1314
+ class JavascriptDjangoLexer(DelegatingLexer):
1315
+ """
1316
+ Subclass of the `DjangoLexer` that highlights unlexed data with the
1317
+ `JavascriptLexer`.
1318
+ """
1319
+
1320
+ name = 'JavaScript+Django/Jinja'
1321
+ aliases = ['js+django', 'javascript+django',
1322
+ 'js+jinja', 'javascript+jinja']
1323
+ alias_filenames = ['*.js']
1324
+ mimetypes = ['application/x-javascript+django',
1325
+ 'application/x-javascript+jinja',
1326
+ 'text/x-javascript+django',
1327
+ 'text/x-javascript+jinja',
1328
+ 'text/javascript+django',
1329
+ 'text/javascript+jinja']
1330
+
1331
+ def __init__(self, **options):
1332
+ super(JavascriptDjangoLexer, self).__init__(JavascriptLexer, DjangoLexer,
1333
+ **options)
1334
+
1335
+ def analyse_text(text):
1336
+ return DjangoLexer.analyse_text(text) - 0.05
1337
+
1338
+
1339
+ class JspRootLexer(RegexLexer):
1340
+ """
1341
+ Base for the `JspLexer`. Yields `Token.Other` for area outside of
1342
+ JSP tags.
1343
+
1344
+ *New in Pygments 0.7.*
1345
+ """
1346
+
1347
+ tokens = {
1348
+ 'root': [
1349
+ (r'<%\S?', Keyword, 'sec'),
1350
+ # FIXME: I want to make these keywords but still parse attributes.
1351
+ (r'</?jsp:(forward|getProperty|include|plugin|setProperty|useBean).*?>',
1352
+ Keyword),
1353
+ (r'[^<]+', Other),
1354
+ (r'<', Other),
1355
+ ],
1356
+ 'sec': [
1357
+ (r'%>', Keyword, '#pop'),
1358
+ # note: '\w\W' != '.' without DOTALL.
1359
+ (r'[\w\W]+?(?=%>|\Z)', using(JavaLexer)),
1360
+ ],
1361
+ }
1362
+
1363
+
1364
+ class JspLexer(DelegatingLexer):
1365
+ """
1366
+ Lexer for Java Server Pages.
1367
+
1368
+ *New in Pygments 0.7.*
1369
+ """
1370
+ name = 'Java Server Page'
1371
+ aliases = ['jsp']
1372
+ filenames = ['*.jsp']
1373
+ mimetypes = ['application/x-jsp']
1374
+
1375
+ def __init__(self, **options):
1376
+ super(JspLexer, self).__init__(XmlLexer, JspRootLexer, **options)
1377
+
1378
+ def analyse_text(text):
1379
+ rv = JavaLexer.analyse_text(text) - 0.01
1380
+ if looks_like_xml(text):
1381
+ rv += 0.4
1382
+ if '<%' in text and '%>' in text:
1383
+ rv += 0.1
1384
+ return rv
1385
+
1386
+
1387
+ class EvoqueLexer(RegexLexer):
1388
+ """
1389
+ For files using the Evoque templating system.
1390
+
1391
+ *New in Pygments 1.1.*
1392
+ """
1393
+ name = 'Evoque'
1394
+ aliases = ['evoque']
1395
+ filenames = ['*.evoque']
1396
+ mimetypes = ['application/x-evoque']
1397
+
1398
+ flags = re.DOTALL
1399
+
1400
+ tokens = {
1401
+ 'root': [
1402
+ (r'[^#$]+', Other),
1403
+ (r'#\[', Comment.Multiline, 'comment'),
1404
+ (r'\$\$', Other),
1405
+ # svn keywords
1406
+ (r'\$\w+:[^$\n]*\$', Comment.Multiline),
1407
+ # directives: begin, end
1408
+ (r'(\$)(begin|end)(\{(%)?)(.*?)((?(4)%)\})',
1409
+ bygroups(Punctuation, Name.Builtin, Punctuation, None,
1410
+ String, Punctuation)),
1411
+ # directives: evoque, overlay
1412
+ # see doc for handling first name arg: /directives/evoque/
1413
+ #+ minor inconsistency: the "name" in e.g. $overlay{name=site_base}
1414
+ # should be using(PythonLexer), not passed out as String
1415
+ (r'(\$)(evoque|overlay)(\{(%)?)(\s*[#\w\-"\'.]+[^=,%}]+?)?'
1416
+ r'(.*?)((?(4)%)\})',
1417
+ bygroups(Punctuation, Name.Builtin, Punctuation, None,
1418
+ String, using(PythonLexer), Punctuation)),
1419
+ # directives: if, for, prefer, test
1420
+ (r'(\$)(\w+)(\{(%)?)(.*?)((?(4)%)\})',
1421
+ bygroups(Punctuation, Name.Builtin, Punctuation, None,
1422
+ using(PythonLexer), Punctuation)),
1423
+ # directive clauses (no {} expression)
1424
+ (r'(\$)(else|rof|fi)', bygroups(Punctuation, Name.Builtin)),
1425
+ # expressions
1426
+ (r'(\$\{(%)?)(.*?)((!)(.*?))?((?(2)%)\})',
1427
+ bygroups(Punctuation, None, using(PythonLexer),
1428
+ Name.Builtin, None, None, Punctuation)),
1429
+ (r'#', Other),
1430
+ ],
1431
+ 'comment': [
1432
+ (r'[^\]#]', Comment.Multiline),
1433
+ (r'#\[', Comment.Multiline, '#push'),
1434
+ (r'\]#', Comment.Multiline, '#pop'),
1435
+ (r'[\]#]', Comment.Multiline)
1436
+ ],
1437
+ }
1438
+
1439
+ class EvoqueHtmlLexer(DelegatingLexer):
1440
+ """
1441
+ Subclass of the `EvoqueLexer` that highlights unlexed data with the
1442
+ `HtmlLexer`.
1443
+
1444
+ *New in Pygments 1.1.*
1445
+ """
1446
+ name = 'HTML+Evoque'
1447
+ aliases = ['html+evoque']
1448
+ filenames = ['*.html']
1449
+ mimetypes = ['text/html+evoque']
1450
+
1451
+ def __init__(self, **options):
1452
+ super(EvoqueHtmlLexer, self).__init__(HtmlLexer, EvoqueLexer,
1453
+ **options)
1454
+
1455
+ class EvoqueXmlLexer(DelegatingLexer):
1456
+ """
1457
+ Subclass of the `EvoqueLexer` that highlights unlexed data with the
1458
+ `XmlLexer`.
1459
+
1460
+ *New in Pygments 1.1.*
1461
+ """
1462
+ name = 'XML+Evoque'
1463
+ aliases = ['xml+evoque']
1464
+ filenames = ['*.xml']
1465
+ mimetypes = ['application/xml+evoque']
1466
+
1467
+ def __init__(self, **options):
1468
+ super(EvoqueXmlLexer, self).__init__(XmlLexer, EvoqueLexer,
1469
+ **options)
1470
+
1471
+ class ColdfusionLexer(RegexLexer):
1472
+ """
1473
+ Coldfusion statements
1474
+ """
1475
+ name = 'cfstatement'
1476
+ aliases = ['cfs']
1477
+ filenames = []
1478
+ mimetypes = []
1479
+ flags = re.IGNORECASE | re.MULTILINE
1480
+
1481
+ tokens = {
1482
+ 'root': [
1483
+ (r'//.*', Comment),
1484
+ (r'\+\+|--', Operator),
1485
+ (r'[-+*/^&=!]', Operator),
1486
+ (r'<=|>=|<|>', Operator),
1487
+ (r'mod\b', Operator),
1488
+ (r'(eq|lt|gt|lte|gte|not|is|and|or)\b', Operator),
1489
+ (r'\|\||&&', Operator),
1490
+ (r'"', String.Double, 'string'),
1491
+ # There is a special rule for allowing html in single quoted
1492
+ # strings, evidently.
1493
+ (r"'.*?'", String.Single),
1494
+ (r'\d+', Number),
1495
+ (r'(if|else|len|var|case|default|break|switch)\b', Keyword),
1496
+ (r'([A-Za-z_$][A-Za-z0-9_.]*)(\s*)(\()',
1497
+ bygroups(Name.Function, Text, Punctuation)),
1498
+ (r'[A-Za-z_$][A-Za-z0-9_.]*', Name.Variable),
1499
+ (r'[()\[\]{};:,.\\]', Punctuation),
1500
+ (r'\s+', Text),
1501
+ ],
1502
+ 'string': [
1503
+ (r'""', String.Double),
1504
+ (r'#.+?#', String.Interp),
1505
+ (r'[^"#]+', String.Double),
1506
+ (r'#', String.Double),
1507
+ (r'"', String.Double, '#pop'),
1508
+ ],
1509
+ }
1510
+
1511
+
1512
+ class ColdfusionMarkupLexer(RegexLexer):
1513
+ """
1514
+ Coldfusion markup only
1515
+ """
1516
+ name = 'Coldfusion'
1517
+ aliases = ['cf']
1518
+ filenames = []
1519
+ mimetypes = []
1520
+
1521
+ tokens = {
1522
+ 'root': [
1523
+ (r'[^<]+', Other),
1524
+ include('tags'),
1525
+ (r'<[^<>]*', Other),
1526
+ ],
1527
+ 'tags': [
1528
+ (r'(?s)<!---.*?--->', Comment.Multiline),
1529
+ (r'(?s)<!--.*?-->', Comment),
1530
+ (r'<cfoutput.*?>', Name.Builtin, 'cfoutput'),
1531
+ (r'(?s)(<cfscript.*?>)(.+?)(</cfscript.*?>)',
1532
+ bygroups(Name.Builtin, using(ColdfusionLexer), Name.Builtin)),
1533
+ # negative lookbehind is for strings with embedded >
1534
+ (r'(?s)(</?cf(?:component|include|if|else|elseif|loop|return|'
1535
+ r'dbinfo|dump|abort|location|invoke|throw|file|savecontent|'
1536
+ r'mailpart|mail|header|content|zip|image|lock|argument|try|'
1537
+ r'catch|break|directory|http|set|function|param)\b)(.*?)((?<!\\)>)',
1538
+ bygroups(Name.Builtin, using(ColdfusionLexer), Name.Builtin)),
1539
+ ],
1540
+ 'cfoutput': [
1541
+ (r'[^#<]+', Other),
1542
+ (r'(#)(.*?)(#)', bygroups(Punctuation, using(ColdfusionLexer),
1543
+ Punctuation)),
1544
+ #(r'<cfoutput.*?>', Name.Builtin, '#push'),
1545
+ (r'</cfoutput.*?>', Name.Builtin, '#pop'),
1546
+ include('tags'),
1547
+ (r'(?s)<[^<>]*', Other),
1548
+ (r'#', Other),
1549
+ ],
1550
+ }
1551
+
1552
+
1553
+ class ColdfusionHtmlLexer(DelegatingLexer):
1554
+ """
1555
+ Coldfusion markup in html
1556
+ """
1557
+ name = 'Coldfusion HTML'
1558
+ aliases = ['cfm']
1559
+ filenames = ['*.cfm', '*.cfml', '*.cfc']
1560
+ mimetypes = ['application/x-coldfusion']
1561
+
1562
+ def __init__(self, **options):
1563
+ super(ColdfusionHtmlLexer, self).__init__(HtmlLexer, ColdfusionMarkupLexer,
1564
+ **options)
1565
+
1566
+
1567
+ class SspLexer(DelegatingLexer):
1568
+ """
1569
+ Lexer for Scalate Server Pages.
1570
+
1571
+ *New in Pygments 1.4.*
1572
+ """
1573
+ name = 'Scalate Server Page'
1574
+ aliases = ['ssp']
1575
+ filenames = ['*.ssp']
1576
+ mimetypes = ['application/x-ssp']
1577
+
1578
+ def __init__(self, **options):
1579
+ super(SspLexer, self).__init__(XmlLexer, JspRootLexer, **options)
1580
+
1581
+ def analyse_text(text):
1582
+ rv = 0.0
1583
+ if re.search('val \w+\s*:', text):
1584
+ rv += 0.6
1585
+ if looks_like_xml(text):
1586
+ rv += 0.2
1587
+ if '<%' in text and '%>' in text:
1588
+ rv += 0.1
1589
+ return rv
1590
+
1591
+
1592
+ class TeaTemplateRootLexer(RegexLexer):
1593
+ """
1594
+ Base for the `TeaTemplateLexer`. Yields `Token.Other` for area outside of
1595
+ code blocks.
1596
+
1597
+ *New in Pygments 1.5.*
1598
+ """
1599
+
1600
+ tokens = {
1601
+ 'root': [
1602
+ (r'<%\S?', Keyword, 'sec'),
1603
+ (r'[^<]+', Other),
1604
+ (r'<', Other),
1605
+ ],
1606
+ 'sec': [
1607
+ (r'%>', Keyword, '#pop'),
1608
+ # note: '\w\W' != '.' without DOTALL.
1609
+ (r'[\w\W]+?(?=%>|\Z)', using(TeaLangLexer)),
1610
+ ],
1611
+ }
1612
+
1613
+
1614
+ class TeaTemplateLexer(DelegatingLexer):
1615
+ """
1616
+ Lexer for `Tea Templates <http://teatrove.org/>`_.
1617
+
1618
+ *New in Pygments 1.5.*
1619
+ """
1620
+ name = 'Tea'
1621
+ aliases = ['tea']
1622
+ filenames = ['*.tea']
1623
+ mimetypes = ['text/x-tea']
1624
+
1625
+ def __init__(self, **options):
1626
+ super(TeaTemplateLexer, self).__init__(XmlLexer,
1627
+ TeaTemplateRootLexer, **options)
1628
+
1629
+ def analyse_text(text):
1630
+ rv = TeaLangLexer.analyse_text(text) - 0.01
1631
+ if looks_like_xml(text):
1632
+ rv += 0.4
1633
+ if '<%' in text and '%>' in text:
1634
+ rv += 0.1
1635
+ return rv
1636
+
1637
+
1638
+ class LassoHtmlLexer(DelegatingLexer):
1639
+ """
1640
+ Subclass of the `LassoLexer` which highlights unhandled data with the
1641
+ `HtmlLexer`.
1642
+
1643
+ Nested JavaScript and CSS is also highlighted.
1644
+
1645
+ *New in Pygments 1.6.*
1646
+ """
1647
+
1648
+ name = 'HTML+Lasso'
1649
+ aliases = ['html+lasso']
1650
+ alias_filenames = ['*.html', '*.htm', '*.xhtml', '*.lasso', '*.lasso[89]',
1651
+ '*.incl', '*.inc', '*.las']
1652
+ mimetypes = ['text/html+lasso',
1653
+ 'application/x-httpd-lasso',
1654
+ 'application/x-httpd-lasso[89]']
1655
+
1656
+ def __init__(self, **options):
1657
+ super(LassoHtmlLexer, self).__init__(HtmlLexer, LassoLexer, **options)
1658
+
1659
+ def analyse_text(text):
1660
+ rv = LassoLexer.analyse_text(text) - 0.01
1661
+ if re.search(r'<\w+>', text, re.I):
1662
+ rv += 0.2
1663
+ if html_doctype_matches(text):
1664
+ rv += 0.5
1665
+ return rv
1666
+
1667
+
1668
+ class LassoXmlLexer(DelegatingLexer):
1669
+ """
1670
+ Subclass of the `LassoLexer` which highlights unhandled data with the
1671
+ `XmlLexer`.
1672
+
1673
+ *New in Pygments 1.6.*
1674
+ """
1675
+
1676
+ name = 'XML+Lasso'
1677
+ aliases = ['xml+lasso']
1678
+ alias_filenames = ['*.xml', '*.lasso', '*.lasso[89]',
1679
+ '*.incl', '*.inc', '*.las']
1680
+ mimetypes = ['application/xml+lasso']
1681
+
1682
+ def __init__(self, **options):
1683
+ super(LassoXmlLexer, self).__init__(XmlLexer, LassoLexer, **options)
1684
+
1685
+ def analyse_text(text):
1686
+ rv = LassoLexer.analyse_text(text) - 0.01
1687
+ if looks_like_xml(text):
1688
+ rv += 0.4
1689
+ return rv
1690
+
1691
+
1692
+ class LassoCssLexer(DelegatingLexer):
1693
+ """
1694
+ Subclass of the `LassoLexer` which highlights unhandled data with the
1695
+ `CssLexer`.
1696
+
1697
+ *New in Pygments 1.6.*
1698
+ """
1699
+
1700
+ name = 'CSS+Lasso'
1701
+ aliases = ['css+lasso']
1702
+ alias_filenames = ['*.css']
1703
+ mimetypes = ['text/css+lasso']
1704
+
1705
+ def __init__(self, **options):
1706
+ options['requiredelimiters'] = True
1707
+ super(LassoCssLexer, self).__init__(CssLexer, LassoLexer, **options)
1708
+
1709
+ def analyse_text(text):
1710
+ rv = LassoLexer.analyse_text(text) - 0.05
1711
+ if re.search(r'\w+:.+?;', text):
1712
+ rv += 0.1
1713
+ if 'padding:' in text:
1714
+ rv += 0.1
1715
+ return rv
1716
+
1717
+
1718
+ class LassoJavascriptLexer(DelegatingLexer):
1719
+ """
1720
+ Subclass of the `LassoLexer` which highlights unhandled data with the
1721
+ `JavascriptLexer`.
1722
+
1723
+ *New in Pygments 1.6.*
1724
+ """
1725
+
1726
+ name = 'JavaScript+Lasso'
1727
+ aliases = ['js+lasso', 'javascript+lasso']
1728
+ alias_filenames = ['*.js']
1729
+ mimetypes = ['application/x-javascript+lasso',
1730
+ 'text/x-javascript+lasso',
1731
+ 'text/javascript+lasso']
1732
+
1733
+ def __init__(self, **options):
1734
+ options['requiredelimiters'] = True
1735
+ super(LassoJavascriptLexer, self).__init__(JavascriptLexer, LassoLexer,
1736
+ **options)
1737
+
1738
+ def analyse_text(text):
1739
+ rv = LassoLexer.analyse_text(text) - 0.05
1740
+ if 'function' in text:
1741
+ rv += 0.2
1742
+ return rv