pygments.rb 0.5.4 → 0.6.0
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +40 -0
- data/README.md +3 -0
- data/lexers +0 -0
- data/lib/pygments/popen.rb +3 -2
- data/lib/pygments/version.rb +1 -1
- data/pygments.rb.gemspec +2 -1
- data/vendor/pygments-main/AUTHORS +20 -1
- data/vendor/pygments-main/CHANGES +55 -3
- data/vendor/pygments-main/LICENSE +1 -1
- data/vendor/pygments-main/MANIFEST.in +1 -1
- data/vendor/pygments-main/Makefile +5 -8
- data/vendor/pygments-main/REVISION +1 -1
- data/vendor/pygments-main/doc/Makefile +153 -0
- data/vendor/pygments-main/doc/_static/favicon.ico +0 -0
- data/vendor/pygments-main/doc/_static/logo_new.png +0 -0
- data/vendor/pygments-main/doc/_static/logo_only.png +0 -0
- data/vendor/pygments-main/doc/_templates/docssidebar.html +3 -0
- data/vendor/pygments-main/doc/_templates/indexsidebar.html +25 -0
- data/vendor/pygments-main/doc/_themes/pygments14/layout.html +98 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/bodybg.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/docbg.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/listitem.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/logo.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/pocoo.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/pygments14.css_t +401 -0
- data/vendor/pygments-main/doc/_themes/pygments14/theme.conf +15 -0
- data/vendor/pygments-main/doc/conf.py +249 -0
- data/vendor/pygments-main/doc/docs/api.rst +316 -0
- data/vendor/pygments-main/doc/docs/authors.rst +4 -0
- data/vendor/pygments-main/doc/docs/changelog.rst +1 -0
- data/vendor/pygments-main/{docs/src/cmdline.txt → doc/docs/cmdline.rst} +9 -11
- data/vendor/pygments-main/{docs/src/filterdevelopment.txt → doc/docs/filterdevelopment.rst} +1 -1
- data/vendor/pygments-main/{docs/src/filters.txt → doc/docs/filters.rst} +4 -5
- data/vendor/pygments-main/{docs/src/formatterdevelopment.txt → doc/docs/formatterdevelopment.rst} +1 -1
- data/vendor/pygments-main/{docs/src/formatters.txt → doc/docs/formatters.rst} +6 -6
- data/vendor/pygments-main/doc/docs/index.rst +66 -0
- data/vendor/pygments-main/{docs/src/integrate.txt → doc/docs/integrate.rst} +3 -7
- data/vendor/pygments-main/{docs/src/java.txt → doc/docs/java.rst} +0 -0
- data/vendor/pygments-main/{docs/src/lexerdevelopment.txt → doc/docs/lexerdevelopment.rst} +13 -14
- data/vendor/pygments-main/{docs/src/lexers.txt → doc/docs/lexers.rst} +7 -5
- data/vendor/pygments-main/{docs/src/moinmoin.txt → doc/docs/moinmoin.rst} +0 -0
- data/vendor/pygments-main/{docs/src/plugins.txt → doc/docs/plugins.rst} +0 -0
- data/vendor/pygments-main/{docs/src/quickstart.txt → doc/docs/quickstart.rst} +22 -19
- data/vendor/pygments-main/{docs/src/rstdirective.txt → doc/docs/rstdirective.rst} +0 -0
- data/vendor/pygments-main/{docs/src/styles.txt → doc/docs/styles.rst} +2 -2
- data/vendor/pygments-main/{docs/src/tokens.txt → doc/docs/tokens.rst} +10 -7
- data/vendor/pygments-main/{docs/src/unicode.txt → doc/docs/unicode.rst} +8 -7
- data/vendor/pygments-main/doc/download.rst +41 -0
- data/vendor/pygments-main/doc/faq.rst +143 -0
- data/vendor/pygments-main/doc/index.rst +53 -0
- data/vendor/pygments-main/doc/languages.rst +151 -0
- data/vendor/pygments-main/doc/make.bat +190 -0
- data/vendor/pygments-main/{docs → doc}/pygmentize.1 +0 -0
- data/vendor/pygments-main/external/autopygmentize +65 -48
- data/vendor/pygments-main/external/markdown-processor.py +15 -15
- data/vendor/pygments-main/external/moin-parser.py +1 -1
- data/vendor/pygments-main/external/rst-directive.py +2 -3
- data/vendor/pygments-main/ez_setup.py +340 -234
- data/vendor/pygments-main/pygments/__init__.py +4 -4
- data/vendor/pygments-main/pygments/cmdline.py +81 -68
- data/vendor/pygments-main/pygments/console.py +1 -1
- data/vendor/pygments-main/pygments/filter.py +1 -1
- data/vendor/pygments-main/pygments/filters/__init__.py +11 -9
- data/vendor/pygments-main/pygments/formatter.py +3 -3
- data/vendor/pygments-main/pygments/formatters/__init__.py +5 -3
- data/vendor/pygments-main/pygments/formatters/_mapping.py +16 -5
- data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
- data/vendor/pygments-main/pygments/formatters/html.py +44 -26
- data/vendor/pygments-main/pygments/formatters/img.py +21 -14
- data/vendor/pygments-main/pygments/formatters/latex.py +104 -12
- data/vendor/pygments-main/pygments/formatters/other.py +53 -6
- data/vendor/pygments-main/pygments/formatters/rtf.py +30 -16
- data/vendor/pygments-main/pygments/formatters/svg.py +2 -2
- data/vendor/pygments-main/pygments/formatters/terminal.py +41 -1
- data/vendor/pygments-main/pygments/formatters/terminal256.py +2 -2
- data/vendor/pygments-main/pygments/lexer.py +59 -39
- data/vendor/pygments-main/pygments/lexers/__init__.py +38 -15
- data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +15 -15
- data/vendor/pygments-main/pygments/lexers/_cocoabuiltins.py +73 -0
- data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +11 -1
- data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +14 -8
- data/vendor/pygments-main/pygments/lexers/_mapping.py +81 -30
- data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +1067 -95
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +7 -7
- data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +5 -4
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +12 -7
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +112 -18
- data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/agile.py +644 -382
- data/vendor/pygments-main/pygments/lexers/asm.py +66 -29
- data/vendor/pygments-main/pygments/lexers/compiled.py +1643 -174
- data/vendor/pygments-main/pygments/lexers/dalvik.py +27 -6
- data/vendor/pygments-main/pygments/lexers/dotnet.py +45 -33
- data/vendor/pygments-main/pygments/lexers/foxpro.py +3 -3
- data/vendor/pygments-main/pygments/lexers/functional.py +1510 -570
- data/vendor/pygments-main/pygments/lexers/graph.py +81 -0
- data/vendor/pygments-main/pygments/lexers/hdl.py +29 -30
- data/vendor/pygments-main/pygments/lexers/inferno.py +96 -0
- data/vendor/pygments-main/pygments/lexers/jvm.py +622 -207
- data/vendor/pygments-main/pygments/lexers/math.py +438 -70
- data/vendor/pygments-main/pygments/lexers/other.py +885 -171
- data/vendor/pygments-main/pygments/lexers/parsers.py +24 -24
- data/vendor/pygments-main/pygments/lexers/qbasic.py +157 -0
- data/vendor/pygments-main/pygments/lexers/rdf.py +99 -0
- data/vendor/pygments-main/pygments/lexers/shell.py +28 -25
- data/vendor/pygments-main/pygments/lexers/special.py +7 -8
- data/vendor/pygments-main/pygments/lexers/sql.py +56 -23
- data/vendor/pygments-main/pygments/lexers/templates.py +377 -59
- data/vendor/pygments-main/pygments/lexers/text.py +208 -46
- data/vendor/pygments-main/pygments/lexers/web.py +729 -264
- data/vendor/pygments-main/pygments/modeline.py +1 -1
- data/vendor/pygments-main/pygments/plugin.py +1 -1
- data/vendor/pygments-main/pygments/scanner.py +1 -1
- data/vendor/pygments-main/pygments/sphinxext.py +153 -0
- data/vendor/pygments-main/pygments/style.py +3 -2
- data/vendor/pygments-main/pygments/styles/__init__.py +5 -1
- data/vendor/pygments-main/pygments/styles/autumn.py +1 -1
- data/vendor/pygments-main/pygments/styles/borland.py +1 -1
- data/vendor/pygments-main/pygments/styles/bw.py +1 -1
- data/vendor/pygments-main/pygments/styles/colorful.py +1 -1
- data/vendor/pygments-main/pygments/styles/default.py +1 -1
- data/vendor/pygments-main/pygments/styles/emacs.py +1 -1
- data/vendor/pygments-main/pygments/styles/friendly.py +1 -1
- data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
- data/vendor/pygments-main/pygments/styles/igor.py +29 -0
- data/vendor/pygments-main/pygments/styles/manni.py +1 -1
- data/vendor/pygments-main/pygments/styles/monokai.py +4 -4
- data/vendor/pygments-main/pygments/styles/murphy.py +1 -1
- data/vendor/pygments-main/pygments/styles/native.py +1 -1
- data/vendor/pygments-main/pygments/styles/paraiso_dark.py +125 -0
- data/vendor/pygments-main/pygments/styles/paraiso_light.py +125 -0
- data/vendor/pygments-main/pygments/styles/pastie.py +1 -1
- data/vendor/pygments-main/pygments/styles/perldoc.py +1 -1
- data/vendor/pygments-main/pygments/styles/rrt.py +1 -1
- data/vendor/pygments-main/pygments/styles/tango.py +1 -1
- data/vendor/pygments-main/pygments/styles/trac.py +1 -1
- data/vendor/pygments-main/pygments/styles/vim.py +1 -1
- data/vendor/pygments-main/pygments/styles/vs.py +1 -1
- data/vendor/pygments-main/pygments/styles/xcode.py +51 -0
- data/vendor/pygments-main/pygments/token.py +4 -1
- data/vendor/pygments-main/pygments/unistring.py +6 -5
- data/vendor/pygments-main/pygments/util.py +35 -21
- data/vendor/pygments-main/scripts/check_sources.py +28 -44
- data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +5 -4
- data/vendor/pygments-main/scripts/find_codetags.py +27 -19
- data/vendor/pygments-main/scripts/find_error.py +16 -13
- data/vendor/pygments-main/scripts/get_vimkw.py +3 -3
- data/vendor/pygments-main/scripts/vim2pygments.py +9 -7
- data/vendor/pygments-main/setup.py +19 -19
- data/vendor/pygments-main/tests/examplefiles/99_bottles_of_beer.chpl +118 -0
- data/vendor/pygments-main/tests/examplefiles/Error.pmod +38 -0
- data/vendor/pygments-main/tests/examplefiles/FakeFile.pike +360 -0
- data/vendor/pygments-main/tests/examplefiles/{ANTLRv3.g → antlr_ANTLRv3.g} +0 -0
- data/vendor/pygments-main/tests/examplefiles/clojure-weird-keywords.clj +5 -0
- data/vendor/pygments-main/tests/examplefiles/core.cljs +52 -0
- data/vendor/pygments-main/tests/examplefiles/demo.cfm +13 -1
- data/vendor/pygments-main/tests/examplefiles/demo.hbs +12 -0
- data/vendor/pygments-main/tests/examplefiles/ember.handlebars +33 -0
- data/vendor/pygments-main/tests/examplefiles/example.als +217 -0
- data/vendor/pygments-main/tests/examplefiles/example.c +1 -1
- data/vendor/pygments-main/tests/examplefiles/example.chai +6 -0
- data/vendor/pygments-main/tests/examplefiles/example.coffee +27 -0
- data/vendor/pygments-main/tests/examplefiles/example.e +124 -0
- data/vendor/pygments-main/tests/examplefiles/example.f90 +8 -0
- data/vendor/pygments-main/tests/examplefiles/example.feature +16 -0
- data/vendor/pygments-main/tests/examplefiles/example.gd +23 -0
- data/vendor/pygments-main/tests/examplefiles/example.gi +64 -0
- data/vendor/pygments-main/tests/examplefiles/example.groovy +2 -0
- data/vendor/pygments-main/tests/examplefiles/example.hs +27 -0
- data/vendor/pygments-main/tests/examplefiles/example.hx +44 -1
- data/vendor/pygments-main/tests/examplefiles/example.i6t +32 -0
- data/vendor/pygments-main/tests/examplefiles/example.i7x +45 -0
- data/vendor/pygments-main/tests/examplefiles/example.inf +374 -0
- data/vendor/pygments-main/tests/examplefiles/example.j +564 -0
- data/vendor/pygments-main/tests/examplefiles/example.java +16 -0
- data/vendor/pygments-main/tests/examplefiles/example.kal +75 -0
- data/vendor/pygments-main/tests/examplefiles/example.liquid +42 -0
- data/vendor/pygments-main/tests/examplefiles/example.ma +8 -0
- data/vendor/pygments-main/tests/examplefiles/example.mq4 +187 -0
- data/vendor/pygments-main/tests/examplefiles/example.mqh +123 -0
- data/vendor/pygments-main/tests/examplefiles/example.ni +57 -0
- data/vendor/pygments-main/tests/examplefiles/example.nix +80 -0
- data/vendor/pygments-main/tests/examplefiles/example.pp +8 -0
- data/vendor/pygments-main/tests/examplefiles/example.red +257 -0
- data/vendor/pygments-main/tests/examplefiles/example.reds +150 -0
- data/vendor/pygments-main/tests/examplefiles/example.rkt +677 -29
- data/vendor/pygments-main/tests/examplefiles/example.sh +22 -0
- data/vendor/pygments-main/tests/examplefiles/example.slim +31 -0
- data/vendor/pygments-main/tests/examplefiles/example.sls +51 -0
- data/vendor/pygments-main/tests/examplefiles/example.stan +2 -0
- data/vendor/pygments-main/tests/examplefiles/example.todotxt +9 -0
- data/vendor/pygments-main/tests/examplefiles/exampleScript.cfc +241 -0
- data/vendor/pygments-main/tests/examplefiles/exampleTag.cfc +18 -0
- data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +192 -350
- data/vendor/pygments-main/tests/examplefiles/hash_syntax.rb +5 -0
- data/vendor/pygments-main/tests/examplefiles/hello.at +6 -0
- data/vendor/pygments-main/tests/examplefiles/hello.golo +5 -0
- data/vendor/pygments-main/tests/examplefiles/hello.lsl +12 -0
- data/vendor/pygments-main/tests/examplefiles/{File.hy → hybris_File.hy} +0 -0
- data/vendor/pygments-main/tests/examplefiles/{mg_sample.pro → idl_sample.pro} +0 -0
- data/vendor/pygments-main/tests/examplefiles/iex_example +23 -0
- data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +24 -24
- data/vendor/pygments-main/tests/examplefiles/language.hy +165 -0
- data/vendor/pygments-main/tests/examplefiles/limbo.b +456 -0
- data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +3 -1
- data/vendor/pygments-main/tests/examplefiles/main.cmake +2 -0
- data/vendor/pygments-main/tests/examplefiles/objc_example.m +163 -16
- data/vendor/pygments-main/tests/examplefiles/{example.p → openedge_example} +0 -0
- data/vendor/pygments-main/tests/examplefiles/pawn_example +25 -0
- data/vendor/pygments-main/tests/examplefiles/qbasic_example +2 -0
- data/vendor/pygments-main/tests/examplefiles/r6rs-comments.scm +23 -0
- data/vendor/pygments-main/tests/examplefiles/{robotframework.txt → robotframework_test.txt} +0 -0
- data/vendor/pygments-main/tests/examplefiles/rql-queries.rql +34 -0
- data/vendor/pygments-main/tests/examplefiles/scope.cirru +43 -0
- data/vendor/pygments-main/tests/examplefiles/sparql.rq +23 -0
- data/vendor/pygments-main/tests/examplefiles/test.R +37 -5
- data/vendor/pygments-main/tests/examplefiles/test.apl +26 -0
- data/vendor/pygments-main/tests/examplefiles/test.cyp +123 -0
- data/vendor/pygments-main/tests/examplefiles/test.idr +93 -0
- data/vendor/pygments-main/tests/examplefiles/test.mask +41 -0
- data/vendor/pygments-main/tests/examplefiles/test.pan +54 -0
- data/vendor/pygments-main/tests/examplefiles/test.php +3 -1
- data/vendor/pygments-main/tests/examplefiles/test.pig +148 -0
- data/vendor/pygments-main/tests/examplefiles/test.pwn +253 -0
- data/vendor/pygments-main/tests/examplefiles/test.r3 +27 -7
- data/vendor/pygments-main/tests/examplefiles/test.rsl +111 -0
- data/vendor/pygments-main/tests/examplefiles/test.swift +65 -0
- data/vendor/pygments-main/tests/examplefiles/test.zep +33 -0
- data/vendor/pygments-main/tests/examplefiles/unicode.go +10 -0
- data/vendor/pygments-main/tests/examplefiles/{test.bas → vbnet_test.bas} +0 -0
- data/vendor/pygments-main/tests/examplefiles/vctreestatus_hg +4 -0
- data/vendor/pygments-main/tests/examplefiles/vimrc +21 -0
- data/vendor/pygments-main/tests/run.py +14 -19
- data/vendor/pygments-main/tests/string_asserts.py +22 -0
- data/vendor/pygments-main/tests/test_basic_api.py +28 -14
- data/vendor/pygments-main/tests/test_cfm.py +46 -0
- data/vendor/pygments-main/tests/test_clexer.py +208 -3
- data/vendor/pygments-main/tests/test_cmdline.py +6 -5
- data/vendor/pygments-main/tests/test_examplefiles.py +30 -19
- data/vendor/pygments-main/tests/test_html_formatter.py +15 -13
- data/vendor/pygments-main/tests/test_latex_formatter.py +4 -2
- data/vendor/pygments-main/tests/test_lexers_other.py +11 -11
- data/vendor/pygments-main/tests/test_objectiveclexer.py +81 -0
- data/vendor/pygments-main/tests/test_perllexer.py +1 -1
- data/vendor/pygments-main/tests/test_qbasiclexer.py +43 -0
- data/vendor/pygments-main/tests/test_regexlexer.py +8 -1
- data/vendor/pygments-main/tests/test_rtf_formatter.py +109 -0
- data/vendor/pygments-main/tests/test_string_asserts.py +39 -0
- data/vendor/pygments-main/tests/test_token.py +3 -3
- data/vendor/pygments-main/tests/test_using_api.py +1 -1
- data/vendor/pygments-main/tests/test_util.py +1 -1
- metadata +138 -51
- data/vendor/pygments-main/docs/generate.py +0 -472
- data/vendor/pygments-main/docs/src/api.txt +0 -270
- data/vendor/pygments-main/docs/src/authors.txt +0 -5
- data/vendor/pygments-main/docs/src/changelog.txt +0 -5
- data/vendor/pygments-main/docs/src/index.txt +0 -69
- data/vendor/pygments-main/docs/src/installation.txt +0 -71
- data/vendor/pygments-main/external/rst-directive-old.py +0 -77
- data/vendor/pygments-main/scripts/reindent.py +0 -291
- data/vendor/pygments-main/tests/examplefiles/import.hs +0 -4
- data/vendor/pygments-main/tests/examplefiles/objc_example2.m +0 -24
- data/vendor/pygments-main/tests/old_run.py +0 -138
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
1
2
|
import sys
|
|
2
3
|
|
|
3
4
|
from pygments.lexers import get_all_lexers, find_lexer_class
|
|
@@ -9,22 +10,22 @@ def main():
|
|
|
9
10
|
for name, aliases, filenames, mimetypes in get_all_lexers():
|
|
10
11
|
cls = find_lexer_class(name)
|
|
11
12
|
if not cls.aliases:
|
|
12
|
-
print
|
|
13
|
+
print(cls, "has no aliases")
|
|
13
14
|
for f in filenames:
|
|
14
15
|
if f not in uses:
|
|
15
16
|
uses[f] = []
|
|
16
17
|
uses[f].append(cls)
|
|
17
18
|
|
|
18
19
|
ret = 0
|
|
19
|
-
for k, v in uses.
|
|
20
|
+
for k, v in uses.items():
|
|
20
21
|
if len(v) > 1:
|
|
21
22
|
#print "Multiple for", k, v
|
|
22
23
|
for i in v:
|
|
23
24
|
if i.analyse_text is None:
|
|
24
|
-
print
|
|
25
|
+
print(i, "has a None analyse_text")
|
|
25
26
|
ret |= 1
|
|
26
27
|
elif Lexer.analyse_text.__doc__ == i.analyse_text.__doc__:
|
|
27
|
-
print
|
|
28
|
+
print(i, "needs analyse_text, multiple lexers for", k)
|
|
28
29
|
ret |= 2
|
|
29
30
|
return ret
|
|
30
31
|
|
|
@@ -7,11 +7,15 @@
|
|
|
7
7
|
Find code tags in specified files and/or directories
|
|
8
8
|
and create a report in HTML format.
|
|
9
9
|
|
|
10
|
-
:copyright: Copyright 2006-
|
|
10
|
+
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
|
|
11
11
|
:license: BSD, see LICENSE for details.
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
from __future__ import print_function
|
|
15
|
+
|
|
16
|
+
import os
|
|
17
|
+
import re
|
|
18
|
+
import sys
|
|
15
19
|
import getopt
|
|
16
20
|
from os.path import join, abspath, isdir, isfile
|
|
17
21
|
|
|
@@ -73,8 +77,8 @@ def main():
|
|
|
73
77
|
try:
|
|
74
78
|
gopts, args = getopt.getopt(sys.argv[1:], "vo:i:")
|
|
75
79
|
except getopt.GetoptError:
|
|
76
|
-
print
|
|
77
|
-
"path ..." % sys.argv[0])
|
|
80
|
+
print(("Usage: %s [-v] [-i ignoredir]* [-o reportfile.html] "
|
|
81
|
+
"path ..." % sys.argv[0]))
|
|
78
82
|
return 2
|
|
79
83
|
opts = {}
|
|
80
84
|
for opt, val in gopts:
|
|
@@ -97,18 +101,18 @@ def main():
|
|
|
97
101
|
num = 0
|
|
98
102
|
|
|
99
103
|
for path in args:
|
|
100
|
-
print
|
|
104
|
+
print("Searching for code tags in %s, please wait." % path)
|
|
101
105
|
|
|
102
106
|
if isfile(path):
|
|
103
107
|
gnum += 1
|
|
104
108
|
if process_file(store, path):
|
|
105
109
|
if verbose:
|
|
106
|
-
print
|
|
107
|
-
(path in store and len(store[path]) or 0)
|
|
110
|
+
print(path + ": found %d tags" % \
|
|
111
|
+
(path in store and len(store[path]) or 0))
|
|
108
112
|
num += 1
|
|
109
113
|
else:
|
|
110
114
|
if verbose:
|
|
111
|
-
print
|
|
115
|
+
print(path + ": binary or not readable")
|
|
112
116
|
continue
|
|
113
117
|
elif not isdir(path):
|
|
114
118
|
continue
|
|
@@ -117,11 +121,15 @@ def main():
|
|
|
117
121
|
if '-i' in opts and abspath(root) in opts['-i']:
|
|
118
122
|
del dirs[:]
|
|
119
123
|
continue
|
|
120
|
-
if '.
|
|
121
|
-
dirs.remove('.
|
|
124
|
+
if '.hg' in dirs:
|
|
125
|
+
dirs.remove('.hg')
|
|
126
|
+
if 'examplefiles' in dirs:
|
|
127
|
+
dirs.remove('examplefiles')
|
|
128
|
+
if 'dist' in dirs:
|
|
129
|
+
dirs.remove('dist')
|
|
122
130
|
for fn in files:
|
|
123
131
|
gnum += 1
|
|
124
|
-
if gnum %
|
|
132
|
+
if gnum % 25 == 0 and not verbose:
|
|
125
133
|
sys.stdout.write('.')
|
|
126
134
|
sys.stdout.flush()
|
|
127
135
|
|
|
@@ -137,16 +145,16 @@ def main():
|
|
|
137
145
|
if fn[:2] == './': fn = fn[2:]
|
|
138
146
|
if process_file(store, fn):
|
|
139
147
|
if verbose:
|
|
140
|
-
print
|
|
141
|
-
(fn in store and len(store[fn]) or 0)
|
|
148
|
+
print(fn + ": found %d tags" % \
|
|
149
|
+
(fn in store and len(store[fn]) or 0))
|
|
142
150
|
num += 1
|
|
143
151
|
else:
|
|
144
152
|
if verbose:
|
|
145
|
-
print
|
|
146
|
-
print
|
|
153
|
+
print(fn + ": binary or not readable")
|
|
154
|
+
print()
|
|
147
155
|
|
|
148
|
-
print
|
|
149
|
-
num, gnum, sum(len(fitem) for fitem in store.
|
|
156
|
+
print("Processed %d of %d files. Found %d tags in %d files." % (
|
|
157
|
+
num, gnum, sum(len(fitem) for fitem in store.values()), len(store)))
|
|
150
158
|
|
|
151
159
|
if not store:
|
|
152
160
|
return 0
|
|
@@ -190,7 +198,7 @@ td { padding: 2px 5px 2px 5px;
|
|
|
190
198
|
'<td class="tag %%(tag)s">%%(tag)s</td>'
|
|
191
199
|
'<td class="who">%%(who)s</td><td class="what">%%(what)s</td></tr>')
|
|
192
200
|
|
|
193
|
-
f =
|
|
201
|
+
f = open(output, 'w')
|
|
194
202
|
table = '\n'.join(TABLE % fname +
|
|
195
203
|
'\n'.join(TR % (no % 2,) % entry
|
|
196
204
|
for no, entry in enumerate(store[fname]))
|
|
@@ -198,7 +206,7 @@ td { padding: 2px 5px 2px 5px;
|
|
|
198
206
|
f.write(HTML % (', '.join(map(abspath, args)), table))
|
|
199
207
|
f.close()
|
|
200
208
|
|
|
201
|
-
print
|
|
209
|
+
print("Report written to %s." % output)
|
|
202
210
|
return 0
|
|
203
211
|
|
|
204
212
|
if __name__ == '__main__':
|
|
@@ -8,11 +8,14 @@
|
|
|
8
8
|
the text where Error tokens are being generated, along
|
|
9
9
|
with some context.
|
|
10
10
|
|
|
11
|
-
:copyright: Copyright 2006-
|
|
11
|
+
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
|
|
12
12
|
:license: BSD, see LICENSE for details.
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
from __future__ import print_function
|
|
16
|
+
|
|
17
|
+
import os
|
|
18
|
+
import sys
|
|
16
19
|
|
|
17
20
|
# always prefer Pygments from source if exists
|
|
18
21
|
srcpath = os.path.join(os.path.dirname(__file__), '..')
|
|
@@ -104,36 +107,36 @@ def main(fn, lexer=None, options={}):
|
|
|
104
107
|
# already debugged before
|
|
105
108
|
debug_lexer = True
|
|
106
109
|
lno = 1
|
|
107
|
-
text =
|
|
110
|
+
text = open(fn, 'U').read()
|
|
108
111
|
text = text.strip('\n') + '\n'
|
|
109
112
|
tokens = []
|
|
110
113
|
states = []
|
|
111
114
|
|
|
112
115
|
def show_token(tok, state):
|
|
113
116
|
reprs = map(repr, tok)
|
|
114
|
-
print
|
|
117
|
+
print(' ' + reprs[1] + ' ' + ' ' * (29-len(reprs[1])) + reprs[0], end=' ')
|
|
115
118
|
if debug_lexer:
|
|
116
|
-
print
|
|
117
|
-
print
|
|
119
|
+
print(' ' + ' ' * (29-len(reprs[0])) + repr(state), end=' ')
|
|
120
|
+
print()
|
|
118
121
|
|
|
119
122
|
for type, val in lx.get_tokens(text):
|
|
120
123
|
lno += val.count('\n')
|
|
121
124
|
if type == Error:
|
|
122
|
-
print
|
|
123
|
-
print
|
|
125
|
+
print('Error parsing', fn, 'on line', lno)
|
|
126
|
+
print('Previous tokens' + (debug_lexer and ' and states' or '') + ':')
|
|
124
127
|
if showall:
|
|
125
128
|
for tok, state in map(None, tokens, states):
|
|
126
129
|
show_token(tok, state)
|
|
127
130
|
else:
|
|
128
131
|
for i in range(max(len(tokens) - num, 0), len(tokens)):
|
|
129
132
|
show_token(tokens[i], states[i])
|
|
130
|
-
print
|
|
133
|
+
print('Error token:')
|
|
131
134
|
l = len(repr(val))
|
|
132
|
-
print
|
|
135
|
+
print(' ' + repr(val), end=' ')
|
|
133
136
|
if debug_lexer and hasattr(lx, 'statestack'):
|
|
134
|
-
print
|
|
135
|
-
print
|
|
136
|
-
print
|
|
137
|
+
print(' ' * (60-l) + repr(lx.statestack), end=' ')
|
|
138
|
+
print()
|
|
139
|
+
print()
|
|
137
140
|
return 1
|
|
138
141
|
tokens.append((type, val))
|
|
139
142
|
if debug_lexer:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
1
2
|
import re
|
|
2
|
-
from pprint import pprint
|
|
3
3
|
|
|
4
4
|
r_line = re.compile(r"^(syn keyword vimCommand contained|syn keyword vimOption "
|
|
5
5
|
r"contained|syn keyword vimAutoEvent contained)\s+(.*)")
|
|
@@ -31,12 +31,12 @@ def getkw(input, output):
|
|
|
31
31
|
|
|
32
32
|
for a, b in output_info.items():
|
|
33
33
|
b.sort()
|
|
34
|
-
print
|
|
34
|
+
print('%s=[%s]' % (a, ','.join(b)), file=out)
|
|
35
35
|
|
|
36
36
|
def is_keyword(w, keywords):
|
|
37
37
|
for i in range(len(w), 0, -1):
|
|
38
38
|
if w[:i] in keywords:
|
|
39
|
-
return
|
|
39
|
+
return keywords[w[:i]][:len(w)] == w
|
|
40
40
|
return False
|
|
41
41
|
|
|
42
42
|
if __name__ == "__main__":
|
|
@@ -11,10 +11,12 @@
|
|
|
11
11
|
:license: BSD, see LICENSE for details.
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
|
+
from __future__ import print_function
|
|
15
|
+
|
|
14
16
|
import sys
|
|
15
17
|
import re
|
|
16
18
|
from os import path
|
|
17
|
-
from
|
|
19
|
+
from io import StringIO
|
|
18
20
|
|
|
19
21
|
split_re = re.compile(r'(?<!\\)\s+')
|
|
20
22
|
|
|
@@ -765,7 +767,7 @@ TOKENS = {
|
|
|
765
767
|
}
|
|
766
768
|
|
|
767
769
|
TOKEN_TYPES = set()
|
|
768
|
-
for token in TOKENS.
|
|
770
|
+
for token in TOKENS.values():
|
|
769
771
|
if not isinstance(token, tuple):
|
|
770
772
|
token = (token,)
|
|
771
773
|
for token in token:
|
|
@@ -836,7 +838,7 @@ def find_colors(code):
|
|
|
836
838
|
colors['Normal']['bgcolor'] = bg_color
|
|
837
839
|
|
|
838
840
|
color_map = {}
|
|
839
|
-
for token, styles in colors.
|
|
841
|
+
for token, styles in colors.items():
|
|
840
842
|
if token in TOKENS:
|
|
841
843
|
tmp = []
|
|
842
844
|
if styles.get('noinherit'):
|
|
@@ -879,7 +881,7 @@ class StyleWriter(object):
|
|
|
879
881
|
def write(self, out):
|
|
880
882
|
self.write_header(out)
|
|
881
883
|
default_token, tokens = find_colors(self.code)
|
|
882
|
-
tokens = tokens.items()
|
|
884
|
+
tokens = list(tokens.items())
|
|
883
885
|
tokens.sort(lambda a, b: cmp(len(a[0]), len(a[1])))
|
|
884
886
|
bg_color = [x[3:] for x in default_token.split() if x.startswith('bg:')]
|
|
885
887
|
if bg_color:
|
|
@@ -916,14 +918,14 @@ def convert(filename, stream=None):
|
|
|
916
918
|
|
|
917
919
|
def main():
|
|
918
920
|
if len(sys.argv) != 2 or sys.argv[1] in ('-h', '--help'):
|
|
919
|
-
print
|
|
921
|
+
print('Usage: %s <filename.vim>' % sys.argv[0])
|
|
920
922
|
return 2
|
|
921
923
|
if sys.argv[1] in ('-v', '--version'):
|
|
922
|
-
print
|
|
924
|
+
print('%s %s' % (SCRIPT_NAME, SCRIPT_VERSION))
|
|
923
925
|
return
|
|
924
926
|
filename = sys.argv[1]
|
|
925
927
|
if not (path.exists(filename) and path.isfile(filename)):
|
|
926
|
-
print
|
|
928
|
+
print('Error: %s not found' % filename)
|
|
927
929
|
return 1
|
|
928
930
|
convert(filename, sys.stdout)
|
|
929
931
|
sys.stdout.write('\n')
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
.. _Pygments tip:
|
|
24
24
|
http://bitbucket.org/birkenfeld/pygments-main/get/default.zip#egg=Pygments-dev
|
|
25
25
|
|
|
26
|
-
:copyright: Copyright 2006-
|
|
26
|
+
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
|
|
27
27
|
:license: BSD, see LICENSE for details.
|
|
28
28
|
"""
|
|
29
29
|
|
|
@@ -31,21 +31,22 @@ try:
|
|
|
31
31
|
from setuptools import setup, find_packages
|
|
32
32
|
have_setuptools = True
|
|
33
33
|
except ImportError:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
34
|
+
try:
|
|
35
|
+
import ez_setup
|
|
36
|
+
ez_setup.use_setuptools()
|
|
37
|
+
from setuptools import setup, find_packages
|
|
38
|
+
have_setuptools = True
|
|
39
|
+
except ImportError:
|
|
40
|
+
from distutils.core import setup
|
|
41
|
+
def find_packages(*args, **kwargs):
|
|
42
|
+
return [
|
|
43
|
+
'pygments',
|
|
44
|
+
'pygments.lexers',
|
|
45
|
+
'pygments.formatters',
|
|
46
|
+
'pygments.styles',
|
|
47
|
+
'pygments.filters',
|
|
48
|
+
]
|
|
49
|
+
have_setuptools = False
|
|
49
50
|
|
|
50
51
|
if have_setuptools:
|
|
51
52
|
add_keywords = dict(
|
|
@@ -60,7 +61,7 @@ else:
|
|
|
60
61
|
|
|
61
62
|
setup(
|
|
62
63
|
name = 'Pygments',
|
|
63
|
-
version = '
|
|
64
|
+
version = '2.0pre',
|
|
64
65
|
url = 'http://pygments.org/',
|
|
65
66
|
license = 'BSD License',
|
|
66
67
|
author = 'Georg Brandl',
|
|
@@ -68,7 +69,7 @@ setup(
|
|
|
68
69
|
description = 'Pygments is a syntax highlighting package written in Python.',
|
|
69
70
|
long_description = __doc__,
|
|
70
71
|
keywords = 'syntax highlighting',
|
|
71
|
-
packages = find_packages(),
|
|
72
|
+
packages = find_packages(exclude=['ez_setup']),
|
|
72
73
|
platforms = 'any',
|
|
73
74
|
zip_safe = False,
|
|
74
75
|
include_package_data = True,
|
|
@@ -85,6 +86,5 @@ setup(
|
|
|
85
86
|
'Topic :: Text Processing :: Filters',
|
|
86
87
|
'Topic :: Utilities',
|
|
87
88
|
],
|
|
88
|
-
cmdclass = {'build_py': build_py},
|
|
89
89
|
**add_keywords
|
|
90
90
|
)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/***********************************************************************
|
|
2
|
+
* Chapel implementation of "99 bottles of beer"
|
|
3
|
+
*
|
|
4
|
+
* by Brad Chamberlain and Steve Deitz
|
|
5
|
+
* 07/13/2006 in Knoxville airport while waiting for flight home from
|
|
6
|
+
* HPLS workshop
|
|
7
|
+
* compiles and runs with chpl compiler version 1.7.0
|
|
8
|
+
* for more information, contact: chapel_info@cray.com
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* Notes:
|
|
12
|
+
* o as in all good parallel computations, boundary conditions
|
|
13
|
+
* constitute the vast bulk of complexity in this code (invite Brad to
|
|
14
|
+
* tell you about his zany boundary condition simplification scheme)
|
|
15
|
+
* o uses type inference for variables, arguments
|
|
16
|
+
* o relies on integer->string coercions
|
|
17
|
+
* o uses named argument passing (for documentation purposes only)
|
|
18
|
+
***********************************************************************/
|
|
19
|
+
|
|
20
|
+
// allow executable command-line specification of number of bottles
|
|
21
|
+
// (e.g., ./a.out -snumBottles=999999)
|
|
22
|
+
config const numBottles = 99;
|
|
23
|
+
const numVerses = numBottles+1;
|
|
24
|
+
|
|
25
|
+
// a domain to describe the space of lyrics
|
|
26
|
+
var LyricsSpace: domain(1) = {1..numVerses};
|
|
27
|
+
|
|
28
|
+
// array of lyrics
|
|
29
|
+
var Lyrics: [LyricsSpace] string;
|
|
30
|
+
|
|
31
|
+
// parallel computation of lyrics array
|
|
32
|
+
[verse in LyricsSpace] Lyrics(verse) = computeLyric(verse);
|
|
33
|
+
|
|
34
|
+
// as in any good parallel language, I/O to stdout is serialized.
|
|
35
|
+
// (Note that I/O to a file could be parallelized using a parallel
|
|
36
|
+
// prefix computation on the verse strings' lengths with file seeking)
|
|
37
|
+
writeln(Lyrics);
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
// HELPER FUNCTIONS:
|
|
41
|
+
|
|
42
|
+
proc computeLyric(verseNum) {
|
|
43
|
+
var bottleNum = numBottles - (verseNum - 1);
|
|
44
|
+
var nextBottle = (bottleNum + numVerses - 1)%numVerses;
|
|
45
|
+
return "\n" // disguise space used to separate elements in array I/O
|
|
46
|
+
+ describeBottles(bottleNum, startOfVerse=true) + " on the wall, "
|
|
47
|
+
+ describeBottles(bottleNum) + ".\n"
|
|
48
|
+
+ computeAction(bottleNum)
|
|
49
|
+
+ describeBottles(nextBottle) + " on the wall.\n";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
proc describeBottles(bottleNum, startOfVerse:bool = false) {
|
|
54
|
+
// NOTE: bool should not be necessary here (^^^^); working around bug
|
|
55
|
+
var bottleDescription = if (bottleNum) then bottleNum:string
|
|
56
|
+
else (if startOfVerse then "N"
|
|
57
|
+
else "n")
|
|
58
|
+
+ "o more";
|
|
59
|
+
return bottleDescription
|
|
60
|
+
+ " bottle" + (if (bottleNum == 1) then "" else "s")
|
|
61
|
+
+ " of beer";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
proc computeAction(bottleNum) {
|
|
66
|
+
return if (bottleNum == 0) then "Go to the store and buy some more, "
|
|
67
|
+
else "Take one down and pass it around, ";
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
// Modules...
|
|
72
|
+
module M1 {
|
|
73
|
+
var x = 10;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
module M2 {
|
|
77
|
+
use M1;
|
|
78
|
+
proc main() {
|
|
79
|
+
writeln("M2 -> M1 -> x " + x);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
// Classes, records, unions...
|
|
85
|
+
const PI: real = 3.14159;
|
|
86
|
+
|
|
87
|
+
record Point {
|
|
88
|
+
var x, y: real;
|
|
89
|
+
}
|
|
90
|
+
var p: Point;
|
|
91
|
+
writeln("Distance from origin: " + sqrt(p.x ** 2 + p.y ** 2));
|
|
92
|
+
p = new Point(1.0, 2.0);
|
|
93
|
+
writeln("Distance from origin: " + sqrt(p.x ** 2 + p.y ** 2));
|
|
94
|
+
|
|
95
|
+
class Circle {
|
|
96
|
+
var p: Point;
|
|
97
|
+
var r: real;
|
|
98
|
+
}
|
|
99
|
+
var c = new Circle(r=2.0);
|
|
100
|
+
proc Circle.area()
|
|
101
|
+
return PI * r ** 2;
|
|
102
|
+
writeln("Area of circle: " + c.area());
|
|
103
|
+
|
|
104
|
+
class Oval: Circle {
|
|
105
|
+
var r2: real;
|
|
106
|
+
}
|
|
107
|
+
proc Oval.area()
|
|
108
|
+
return PI * r * r2;
|
|
109
|
+
|
|
110
|
+
delete c;
|
|
111
|
+
c = nil;
|
|
112
|
+
c = new Oval(r=1.0, r2=2.0);
|
|
113
|
+
writeln("Area of oval: " + c.area());
|
|
114
|
+
|
|
115
|
+
union U {
|
|
116
|
+
var i: int;
|
|
117
|
+
var r: real;
|
|
118
|
+
}
|