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
@@ -0,0 +1,125 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ pygments.styles.paraiso_light
4
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
+
6
+ Paraíso (Light) by Jan T. Sott
7
+
8
+ Pygments template by Jan T. Sott (https://github.com/idleberg)
9
+ Created with Base16 Builder by Chris Kempson
10
+ (https://github.com/chriskempson/base16-builder).
11
+
12
+ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
13
+ :license: BSD, see LICENSE for details.
14
+ """
15
+
16
+ from pygments.style import Style
17
+ from pygments.token import Keyword, Name, Comment, String, Error, Text, \
18
+ Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
19
+
20
+
21
+ BACKGROUND = "#e7e9db"
22
+ CURRENT_LINE = "#b9b6b0"
23
+ SELECTION = "#a39e9b"
24
+ FOREGROUND = "#2f1e2e"
25
+ COMMENT = "#8d8687"
26
+ RED = "#ef6155"
27
+ ORANGE = "#f99b15"
28
+ YELLOW = "#fec418"
29
+ GREEN = "#48b685"
30
+ AQUA = "#5bc4bf"
31
+ BLUE = "#06b6ef"
32
+ PURPLE = "#815ba4"
33
+
34
+
35
+ class ParaisoLightStyle(Style):
36
+
37
+ default_style = ''
38
+
39
+ background_color = BACKGROUND
40
+ highlight_color = SELECTION
41
+
42
+ background_color = BACKGROUND
43
+ highlight_color = SELECTION
44
+
45
+ styles = {
46
+ # No corresponding class for the following:
47
+ Text: FOREGROUND, # class: ''
48
+ Whitespace: "", # class: 'w'
49
+ Error: RED, # class: 'err'
50
+ Other: "", # class 'x'
51
+
52
+ Comment: COMMENT, # class: 'c'
53
+ Comment.Multiline: "", # class: 'cm'
54
+ Comment.Preproc: "", # class: 'cp'
55
+ Comment.Single: "", # class: 'c1'
56
+ Comment.Special: "", # class: 'cs'
57
+
58
+ Keyword: PURPLE, # class: 'k'
59
+ Keyword.Constant: "", # class: 'kc'
60
+ Keyword.Declaration: "", # class: 'kd'
61
+ Keyword.Namespace: AQUA, # class: 'kn'
62
+ Keyword.Pseudo: "", # class: 'kp'
63
+ Keyword.Reserved: "", # class: 'kr'
64
+ Keyword.Type: YELLOW, # class: 'kt'
65
+
66
+ Operator: AQUA, # class: 'o'
67
+ Operator.Word: "", # class: 'ow' - like keywords
68
+
69
+ Punctuation: FOREGROUND, # class: 'p'
70
+
71
+ Name: FOREGROUND, # class: 'n'
72
+ Name.Attribute: BLUE, # class: 'na' - to be revised
73
+ Name.Builtin: "", # class: 'nb'
74
+ Name.Builtin.Pseudo: "", # class: 'bp'
75
+ Name.Class: YELLOW, # class: 'nc' - to be revised
76
+ Name.Constant: RED, # class: 'no' - to be revised
77
+ Name.Decorator: AQUA, # class: 'nd' - to be revised
78
+ Name.Entity: "", # class: 'ni'
79
+ Name.Exception: RED, # class: 'ne'
80
+ Name.Function: BLUE, # class: 'nf'
81
+ Name.Property: "", # class: 'py'
82
+ Name.Label: "", # class: 'nl'
83
+ Name.Namespace: YELLOW, # class: 'nn' - to be revised
84
+ Name.Other: BLUE, # class: 'nx'
85
+ Name.Tag: AQUA, # class: 'nt' - like a keyword
86
+ Name.Variable: RED, # class: 'nv' - to be revised
87
+ Name.Variable.Class: "", # class: 'vc' - to be revised
88
+ Name.Variable.Global: "", # class: 'vg' - to be revised
89
+ Name.Variable.Instance: "", # class: 'vi' - to be revised
90
+
91
+ Number: ORANGE, # class: 'm'
92
+ Number.Float: "", # class: 'mf'
93
+ Number.Hex: "", # class: 'mh'
94
+ Number.Integer: "", # class: 'mi'
95
+ Number.Integer.Long: "", # class: 'il'
96
+ Number.Oct: "", # class: 'mo'
97
+
98
+ Literal: ORANGE, # class: 'l'
99
+ Literal.Date: GREEN, # class: 'ld'
100
+
101
+ String: GREEN, # class: 's'
102
+ String.Backtick: "", # class: 'sb'
103
+ String.Char: FOREGROUND, # class: 'sc'
104
+ String.Doc: COMMENT, # class: 'sd' - like a comment
105
+ String.Double: "", # class: 's2'
106
+ String.Escape: ORANGE, # class: 'se'
107
+ String.Heredoc: "", # class: 'sh'
108
+ String.Interpol: ORANGE, # class: 'si'
109
+ String.Other: "", # class: 'sx'
110
+ String.Regex: "", # class: 'sr'
111
+ String.Single: "", # class: 's1'
112
+ String.Symbol: "", # class: 'ss'
113
+
114
+ Generic: "", # class: 'g'
115
+ Generic.Deleted: RED, # class: 'gd',
116
+ Generic.Emph: "italic", # class: 'ge'
117
+ Generic.Error: "", # class: 'gr'
118
+ Generic.Heading: "bold " + FOREGROUND, # class: 'gh'
119
+ Generic.Inserted: GREEN, # class: 'gi'
120
+ Generic.Output: "", # class: 'go'
121
+ Generic.Prompt: "bold " + COMMENT, # class: 'gp'
122
+ Generic.Strong: "bold", # class: 'gs'
123
+ Generic.Subheading: "bold " + AQUA, # class: 'gu'
124
+ Generic.Traceback: "", # class: 'gt'
125
+ }
@@ -7,7 +7,7 @@
7
7
 
8
8
  .. _pastie: http://pastie.caboo.se/
9
9
 
10
- :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
10
+ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
11
11
  :license: BSD, see LICENSE for details.
12
12
  """
13
13
 
@@ -7,7 +7,7 @@
7
7
 
8
8
  .. _perldoc: http://perldoc.perl.org/
9
9
 
10
- :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
10
+ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
11
11
  :license: BSD, see LICENSE for details.
12
12
  """
13
13
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  pygments "rrt" theme, based on Zap and Emacs defaults.
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
 
@@ -33,7 +33,7 @@
33
33
  have been chosen to have the same style. Similarly, keywords (Keyword.*),
34
34
  and Operator.Word (and, or, in) have been assigned the same style.
35
35
 
36
- :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
36
+ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
37
37
  :license: BSD, see LICENSE for details.
38
38
  """
39
39
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Port of the default trac highlighter design.
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
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  A highlighting style for Pygments, inspired by vim.
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
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Simple style with MS Visual Studio colors.
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
 
@@ -0,0 +1,51 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ pygments.styles.xcode
4
+ ~~~~~~~~~~~~~~~~~~~~~
5
+
6
+ Style similar to the `Xcode` default theme.
7
+
8
+ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
9
+ :license: BSD, see LICENSE for details.
10
+ """
11
+
12
+ from pygments.style import Style
13
+ from pygments.token import Keyword, Name, Comment, String, Error, \
14
+ Number, Operator, Literal
15
+
16
+
17
+ class XcodeStyle(Style):
18
+ """
19
+ Style similar to the Xcode default colouring theme.
20
+ """
21
+
22
+ default_style = ''
23
+
24
+ styles = {
25
+ Comment: '#177500',
26
+ Comment.Preproc: '#633820',
27
+
28
+ String: '#C41A16',
29
+ String.Char: '#2300CE',
30
+
31
+ Operator: '#000000',
32
+
33
+ Keyword: '#A90D91',
34
+
35
+ Name: '#000000',
36
+ Name.Attribute: '#836C28',
37
+ Name.Class: '#3F6E75',
38
+ Name.Function: '#000000',
39
+ Name.Builtin: '#A90D91',
40
+ # In Obj-C code this token is used to colour Cocoa types
41
+ Name.Builtin.Pseudo: '#5B269A',
42
+ Name.Variable: '#000000',
43
+ Name.Tag: '#000000',
44
+ Name.Decorator: '#000000',
45
+ # Workaround for a BUG here: lexer treats multiline method signatres as labels
46
+ Name.Label: '#000000',
47
+
48
+ Literal: '#1C01CE',
49
+ Number: '#1C01CE',
50
+ Error: '#000000',
51
+ }
@@ -5,7 +5,7 @@
5
5
 
6
6
  Basic token types and the standard tokens.
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
 
@@ -49,6 +49,7 @@ Token = _TokenType()
49
49
  # Special token types
50
50
  Text = Token.Text
51
51
  Whitespace = Text.Whitespace
52
+ Escape = Token.Escape
52
53
  Error = Token.Error
53
54
  # Text that doesn't belong to this lexer (e.g. HTML in PHP)
54
55
  Other = Token.Other
@@ -116,6 +117,7 @@ STANDARD_TYPES = {
116
117
 
117
118
  Text: '',
118
119
  Whitespace: 'w',
120
+ Escape: 'esc',
119
121
  Error: 'err',
120
122
  Other: 'x',
121
123
 
@@ -164,6 +166,7 @@ STANDARD_TYPES = {
164
166
  String.Symbol: 'ss',
165
167
 
166
168
  Number: 'm',
169
+ Number.Bin: 'mb',
167
170
  Number.Float: 'mf',
168
171
  Number.Hex: 'mh',
169
172
  Number.Integer: 'mi',
@@ -8,10 +8,11 @@
8
8
 
9
9
  Inspired by chartypes_create.py from the MoinMoin project.
10
10
 
11
- :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
11
+ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
12
12
  :license: BSD, see LICENSE for details.
13
13
  """
14
- from pygments.util import u_prefix
14
+
15
+ from pygments.util import u_prefix, unichr
15
16
 
16
17
  Cc = u'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f'
17
18
 
@@ -52,7 +53,7 @@ Pc = u'_\u203f\u2040\u2054\ufe33\ufe34\ufe4d\ufe4e\ufe4f\uff3f'
52
53
 
53
54
  Pd = u'\\-\u058a\u05be\u1400\u1806\u2010\u2011\u2012\u2013\u2014\u2015\u2e17\u2e1a\u301c\u3030\u30a0\ufe31\ufe32\ufe58\ufe63\uff0d'
54
55
 
55
- Pe = u')]}\u0f3b\u0f3d\u169c\u2046\u207e\u208e\u232a\u2769\u276b\u276d\u276f\u2771\u2773\u2775\u27c6\u27e7\u27e9\u27eb\u27ed\u27ef\u2984\u2986\u2988\u298a\u298c\u298e\u2990\u2992\u2994\u2996\u2998\u29d9\u29db\u29fd\u2e23\u2e25\u2e27\u2e29\u3009\u300b\u300d\u300f\u3011\u3015\u3017\u3019\u301b\u301e\u301f\ufd3f\ufe18\ufe36\ufe38\ufe3a\ufe3c\ufe3e\ufe40\ufe42\ufe44\ufe48\ufe5a\ufe5c\ufe5e\uff09\uff3d\uff5d\uff60\uff63'
56
+ Pe = u')\\]}\u0f3b\u0f3d\u169c\u2046\u207e\u208e\u232a\u2769\u276b\u276d\u276f\u2771\u2773\u2775\u27c6\u27e7\u27e9\u27eb\u27ed\u27ef\u2984\u2986\u2988\u298a\u298c\u298e\u2990\u2992\u2994\u2996\u2998\u29d9\u29db\u29fd\u2e23\u2e25\u2e27\u2e29\u3009\u300b\u300d\u300f\u3011\u3015\u3017\u3019\u301b\u301e\u301f\ufd3f\ufe18\ufe36\ufe38\ufe3a\ufe3c\ufe3e\ufe40\ufe42\ufe44\ufe48\ufe5a\ufe5c\ufe5e\uff09\uff3d\uff5d\uff60\uff63'
56
57
 
57
58
  Pf = u'\xbb\u2019\u201d\u203a\u2e03\u2e05\u2e0a\u2e0d\u2e1d\u2e21'
58
59
 
@@ -60,7 +61,7 @@ Pi = u'\xab\u2018\u201b\u201c\u201f\u2039\u2e02\u2e04\u2e09\u2e0c\u2e1c\u2e20'
60
61
 
61
62
  Po = u'!"#%&\'*,./:;?@\\\\\xa1\xb7\xbf\u037e\u0387\u055a\u055b\u055c\u055d\u055e\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a\u066b\u066c\u066d\u06d4\u0700\u0701\u0702\u0703\u0704\u0705\u0706\u0707\u0708\u0709\u070a\u070b\u070c\u070d\u07f7\u07f8\u07f9\u0830\u0831\u0832\u0833\u0834\u0835\u0836\u0837\u0838\u0839\u083a\u083b\u083c\u083d\u083e\u0964\u0965\u0970\u0df4\u0e4f\u0e5a\u0e5b\u0f04\u0f05\u0f06\u0f07\u0f08\u0f09\u0f0a\u0f0b\u0f0c\u0f0d\u0f0e\u0f0f\u0f10\u0f11\u0f12\u0f85\u0fd0\u0fd1\u0fd2\u0fd3\u0fd4\u104a\u104b\u104c\u104d\u104e\u104f\u10fb\u1361\u1362\u1363\u1364\u1365\u1366\u1367\u1368\u166d\u166e\u16eb\u16ec\u16ed\u1735\u1736\u17d4\u17d5\u17d6\u17d8\u17d9\u17da\u1800\u1801\u1802\u1803\u1804\u1805\u1807\u1808\u1809\u180a\u1944\u1945\u19de\u19df\u1a1e\u1a1f\u1aa0\u1aa1\u1aa2\u1aa3\u1aa4\u1aa5\u1aa6\u1aa8\u1aa9\u1aaa\u1aab\u1aac\u1aad\u1b5a\u1b5b\u1b5c\u1b5d\u1b5e\u1b5f\u1b60\u1c3b\u1c3c\u1c3d\u1c3e\u1c3f\u1c7e\u1c7f\u1cd3\u2016\u2017\u2020\u2021\u2022\u2023\u2024\u2025\u2026\u2027\u2030\u2031\u2032\u2033\u2034\u2035\u2036\u2037\u2038\u203b\u203c\u203d\u203e\u2041\u2042\u2043\u2047\u2048\u2049\u204a\u204b\u204c\u204d\u204e\u204f\u2050\u2051\u2053\u2055\u2056\u2057\u2058\u2059\u205a\u205b\u205c\u205d\u205e\u2cf9\u2cfa\u2cfb\u2cfc\u2cfe\u2cff\u2e00\u2e01\u2e06\u2e07\u2e08\u2e0b\u2e0e\u2e0f\u2e10\u2e11\u2e12\u2e13\u2e14\u2e15\u2e16\u2e18\u2e19\u2e1b\u2e1e\u2e1f\u2e2a\u2e2b\u2e2c\u2e2d\u2e2e\u2e30\u2e31\u3001\u3002\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d\ua60e\ua60f\ua673\ua67e\ua6f2\ua6f3\ua6f4\ua6f5\ua6f6\ua6f7\ua874\ua875\ua876\ua877\ua8ce\ua8cf\ua8f8\ua8f9\ua8fa\ua92e\ua92f\ua95f\ua9c1\ua9c2\ua9c3\ua9c4\ua9c5\ua9c6\ua9c7\ua9c8\ua9c9\ua9ca\ua9cb\ua9cc\ua9cd\ua9de\ua9df\uaa5c\uaa5d\uaa5e\uaa5f\uaade\uaadf\uabeb\ufe10\ufe11\ufe12\ufe13\ufe14\ufe15\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49\ufe4a\ufe4b\ufe4c\ufe50\ufe51\ufe52\ufe54\ufe55\ufe56\ufe57\ufe5f\ufe60\ufe61\ufe68\ufe6a\ufe6b\uff01\uff02\uff03\uff05\uff06\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65'
62
63
 
63
- Ps = u'([{\u0f3a\u0f3c\u169b\u201a\u201e\u2045\u207d\u208d\u2329\u2768\u276a\u276c\u276e\u2770\u2772\u2774\u27c5\u27e6\u27e8\u27ea\u27ec\u27ee\u2983\u2985\u2987\u2989\u298b\u298d\u298f\u2991\u2993\u2995\u2997\u29d8\u29da\u29fc\u2e22\u2e24\u2e26\u2e28\u3008\u300a\u300c\u300e\u3010\u3014\u3016\u3018\u301a\u301d\ufd3e\ufe17\ufe35\ufe37\ufe39\ufe3b\ufe3d\ufe3f\ufe41\ufe43\ufe47\ufe59\ufe5b\ufe5d\uff08\uff3b\uff5b\uff5f\uff62'
64
+ Ps = u'(\\[{\u0f3a\u0f3c\u169b\u201a\u201e\u2045\u207d\u208d\u2329\u2768\u276a\u276c\u276e\u2770\u2772\u2774\u27c5\u27e6\u27e8\u27ea\u27ec\u27ee\u2983\u2985\u2987\u2989\u298b\u298d\u298f\u2991\u2993\u2995\u2997\u29d8\u29da\u29fc\u2e22\u2e24\u2e26\u2e28\u3008\u300a\u300c\u300e\u3010\u3014\u3016\u3018\u301a\u301d\ufd3e\ufe17\ufe35\ufe37\ufe39\ufe3b\ufe3d\ufe3f\ufe41\ufe43\ufe47\ufe59\ufe5b\ufe5d\uff08\uff3b\uff5b\uff5f\uff62'
64
65
 
65
66
  Sc = u'$\xa2\xa3\xa4\xa5\u060b\u09f2\u09f3\u09fb\u0af1\u0bf9\u0e3f\u17db\u20a0\u20a1\u20a2\u20a3\u20a4\u20a5\u20a6\u20a7\u20a8\u20a9\u20aa\u20ab\u20ac\u20ad\u20ae\u20af\u20b0\u20b1\u20b2\u20b3\u20b4\u20b5\u20b6\u20b7\u20b8\ua838\ufdfc\ufe69\uff04\uffe0\uffe1\uffe5\uffe6'
66
67
 
@@ -133,7 +134,7 @@ except UnicodeDecodeError:
133
134
  Cs = '' # Jython can't handle isolated surrogates\n\n""" % repr(val).lstrip('u'))
134
135
  else:
135
136
  f.write('%s = %r\n\n' % (cat, val))
136
- f.write('cats = %r\n\n' % sorted(categories.keys()))
137
+ f.write('cats = %r\n\n' % sorted(categories))
137
138
  f.write('# Generated from unidata %s\n\n' % (unicodedata.unidata_version,))
138
139
 
139
140
  f.write(footer)
@@ -5,13 +5,12 @@
5
5
 
6
6
  Utility functions.
7
7
 
8
- :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
8
+ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
9
9
  :license: BSD, see LICENSE for details.
10
10
  """
11
11
 
12
12
  import re
13
13
  import sys
14
- import codecs
15
14
 
16
15
 
17
16
  split_path_re = re.compile(r'[/\\ ]')
@@ -52,7 +51,7 @@ def get_bool_opt(options, optname, default=None):
52
51
  return string
53
52
  elif isinstance(string, int):
54
53
  return bool(string)
55
- elif not isinstance(string, basestring):
54
+ elif not isinstance(string, string_types):
56
55
  raise OptionError('Invalid type %r for option %s; use '
57
56
  '1/0, yes/no, true/false, on/off' % (
58
57
  string, optname))
@@ -82,7 +81,7 @@ def get_int_opt(options, optname, default=None):
82
81
 
83
82
  def get_list_opt(options, optname, default=None):
84
83
  val = options.get(optname, default)
85
- if isinstance(val, basestring):
84
+ if isinstance(val, string_types):
86
85
  return val.split()
87
86
  elif isinstance(val, (list, tuple)):
88
87
  return list(val)
@@ -209,6 +208,11 @@ def looks_like_xml(text):
209
208
  # Python narrow build compatibility
210
209
 
211
210
  def _surrogatepair(c):
211
+ # Given a unicode character code
212
+ # with length greater than 16 bits,
213
+ # return the two 16 bit surrogate pair.
214
+ # From example D28 of:
215
+ # http://www.unicode.org/book/ch03.pdf
212
216
  return (0xd7c0 + (c >> 10), (0xdc00 + (c & 0x3ff)))
213
217
 
214
218
  def unirange(a, b):
@@ -253,25 +257,35 @@ def unirange(a, b):
253
257
 
254
258
  # Python 2/3 compatibility
255
259
 
256
- if sys.version_info < (3,0):
257
- b = bytes = str
260
+ if sys.version_info < (3, 0):
261
+ unichr = unichr
262
+ xrange = xrange
263
+ string_types = (str, unicode)
264
+ text_type = unicode
258
265
  u_prefix = 'u'
266
+ iteritems = dict.iteritems
267
+ itervalues = dict.itervalues
259
268
  import StringIO, cStringIO
260
- BytesIO = cStringIO.StringIO
269
+ # unfortunately, io.StringIO in Python 2 doesn't accept str at all
261
270
  StringIO = StringIO.StringIO
262
- uni_open = codecs.open
271
+ BytesIO = cStringIO.StringIO
263
272
  else:
264
- import builtins
265
- bytes = builtins.bytes
273
+ unichr = chr
274
+ xrange = range
275
+ string_types = (str,)
276
+ text_type = str
266
277
  u_prefix = ''
267
- def b(s):
268
- if isinstance(s, str):
269
- return bytes(map(ord, s))
270
- elif isinstance(s, bytes):
271
- return s
272
- else:
273
- raise TypeError("Invalid argument %r for b()" % (s,))
274
- import io
275
- BytesIO = io.BytesIO
276
- StringIO = io.StringIO
277
- uni_open = builtins.open
278
+ iteritems = dict.items
279
+ itervalues = dict.values
280
+ from io import StringIO, BytesIO
281
+
282
+ def add_metaclass(metaclass):
283
+ """Class decorator for creating a class with a metaclass."""
284
+ def wrapper(cls):
285
+ orig_vars = cls.__dict__.copy()
286
+ orig_vars.pop('__dict__', None)
287
+ orig_vars.pop('__weakref__', None)
288
+ for slots_var in orig_vars.get('__slots__', ()):
289
+ orig_vars.pop(slots_var)
290
+ return metaclass(cls.__name__, cls.__bases__, orig_vars)
291
+ return wrapper
@@ -7,13 +7,17 @@
7
7
  Make sure each Python file has a correct file header
8
8
  including copyright and license information.
9
9
 
10
- :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
10
+ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
11
11
  :license: BSD, see LICENSE for details.
12
12
  """
13
13
 
14
- import sys, os, re
14
+ from __future__ import print_function
15
+
16
+ import io
17
+ import os
18
+ import re
19
+ import sys
15
20
  import getopt
16
- import cStringIO
17
21
  from os.path import join, splitext, abspath
18
22
 
19
23
 
@@ -30,7 +34,7 @@ def checker(*suffixes, **kwds):
30
34
 
31
35
 
32
36
  name_mail_re = r'[\w ]+(<.*?>)?'
33
- copyright_re = re.compile(r'^ :copyright: Copyright 2006-2013 by '
37
+ copyright_re = re.compile(r'^ :copyright: Copyright 2006-2014 by '
34
38
  r'the Pygments team, see AUTHORS\.$', re.UNICODE)
35
39
  copyright_2_re = re.compile(r'^ %s(, %s)*[,.]$' %
36
40
  (name_mail_re, name_mail_re), re.UNICODE)
@@ -46,7 +50,7 @@ misspellings = ["developement", "adress", "verificate", # ALLOW-MISSPELLING
46
50
  def check_syntax(fn, lines):
47
51
  try:
48
52
  compile(''.join(lines), fn, "exec")
49
- except SyntaxError, err:
53
+ except SyntaxError as err:
50
54
  yield 0, "not compilable: %s" % err
51
55
 
52
56
 
@@ -67,9 +71,12 @@ def check_style_and_encoding(fn, lines):
67
71
  encoding = co.group(1)
68
72
  try:
69
73
  line.decode(encoding)
70
- except UnicodeDecodeError, err:
74
+ except AttributeError:
75
+ # Python 3 - encoding was already checked
76
+ pass
77
+ except UnicodeDecodeError as err:
71
78
  yield lno+1, "not decodable: %s\n Line: %r" % (err, line)
72
- except LookupError, err:
79
+ except LookupError as err:
73
80
  yield 0, "unknown encoding: %s" % encoding
74
81
  encoding = 'latin1'
75
82
 
@@ -130,7 +137,7 @@ def check_fileheader(fn, lines):
130
137
  yield 0, "no correct license info"
131
138
 
132
139
  ci = -3
133
- copyright = [s.decode('utf-8') for s in llist[ci:ci+1]]
140
+ copyright = llist[ci:ci+1]
134
141
  while copyright and copyright_2_re.match(copyright[0]):
135
142
  ci -= 1
136
143
  copyright = llist[ci:ci+1]
@@ -138,34 +145,11 @@ def check_fileheader(fn, lines):
138
145
  yield 0, "no correct copyright info"
139
146
 
140
147
 
141
- @checker('.py', '.html', '.js')
142
- def check_whitespace_and_spelling(fn, lines):
143
- for lno, line in enumerate(lines):
144
- if "\t" in line:
145
- yield lno+1, "OMG TABS!!!1 "
146
- if line[:-1].rstrip(' \t') != line[:-1]:
147
- yield lno+1, "trailing whitespace"
148
- for word in misspellings:
149
- if word in line and 'ALLOW-MISSPELLING' not in line:
150
- yield lno+1, '"%s" used' % word
151
-
152
-
153
- bad_tags = ('<b>', '<i>', '<u>', '<s>', '<strike>'
154
- '<center>', '<big>', '<small>', '<font')
155
-
156
- @checker('.html')
157
- def check_xhtml(fn, lines):
158
- for lno, line in enumerate(lines):
159
- for bad_tag in bad_tags:
160
- if bad_tag in line:
161
- yield lno+1, "used " + bad_tag
162
-
163
-
164
148
  def main(argv):
165
149
  try:
166
150
  gopts, args = getopt.getopt(argv[1:], "vi:")
167
151
  except getopt.GetoptError:
168
- print "Usage: %s [-v] [-i ignorepath]* [path]" % argv[0]
152
+ print("Usage: %s [-v] [-i ignorepath]* [path]" % argv[0])
169
153
  return 2
170
154
  opts = {}
171
155
  for opt, val in gopts:
@@ -178,20 +162,20 @@ def main(argv):
178
162
  elif len(args) == 1:
179
163
  path = args[0]
180
164
  else:
181
- print "Usage: %s [-v] [-i ignorepath]* [path]" % argv[0]
165
+ print("Usage: %s [-v] [-i ignorepath]* [path]" % argv[0])
182
166
  return 2
183
167
 
184
168
  verbose = '-v' in opts
185
169
 
186
170
  num = 0
187
- out = cStringIO.StringIO()
171
+ out = io.StringIO()
188
172
 
189
173
  # TODO: replace os.walk run with iteration over output of
190
174
  # `svn list -R`.
191
175
 
192
176
  for root, dirs, files in os.walk(path):
193
- if '.svn' in dirs:
194
- dirs.remove('.svn')
177
+ if '.hg' in dirs:
178
+ dirs.remove('.hg')
195
179
  if '-i' in opts and abspath(root) in opts['-i']:
196
180
  del dirs[:]
197
181
  continue
@@ -212,13 +196,13 @@ def main(argv):
212
196
  continue
213
197
 
214
198
  if verbose:
215
- print "Checking %s..." % fn
199
+ print("Checking %s..." % fn)
216
200
 
217
201
  try:
218
202
  f = open(fn, 'r')
219
203
  lines = list(f)
220
- except (IOError, OSError), err:
221
- print "%s: cannot open: %s" % (fn, err)
204
+ except (IOError, OSError) as err:
205
+ print("%s: cannot open: %s" % (fn, err))
222
206
  num += 1
223
207
  continue
224
208
 
@@ -226,15 +210,15 @@ def main(argv):
226
210
  if not in_pocoo_pkg and checker.only_pkg:
227
211
  continue
228
212
  for lno, msg in checker(fn, lines):
229
- print >>out, "%s:%d: %s" % (fn, lno, msg)
213
+ print(u"%s:%d: %s" % (fn, lno, msg), file=out)
230
214
  num += 1
231
215
  if verbose:
232
- print
216
+ print()
233
217
  if num == 0:
234
- print "No errors found."
218
+ print("No errors found.")
235
219
  else:
236
- print out.getvalue().rstrip('\n')
237
- print "%d error%s found." % (num, num > 1 and "s" or "")
220
+ print(out.getvalue().rstrip('\n'))
221
+ print("%d error%s found." % (num, num > 1 and "s" or ""))
238
222
  return int(num > 0)
239
223
 
240
224