Permalink
Please sign in to comment.
Showing
with
24,337 additions
and 1,431 deletions.
- +18 −2 vendor/pygments/AUTHORS
- +74 −14 vendor/pygments/CHANGES
- +1 −1 vendor/pygments/LICENSE
- +1 −1 vendor/pygments/Makefile
- +46 −0 vendor/pygments/PKG-INFO
- +46 −0 vendor/pygments/Pygments.egg-info/PKG-INFO
- +416 −0 vendor/pygments/Pygments.egg-info/SOURCES.txt
- +1 −0 vendor/pygments/Pygments.egg-info/dependency_links.txt
- +3 −0 vendor/pygments/Pygments.egg-info/entry_points.txt
- +1 −0 vendor/pygments/Pygments.egg-info/not-zip-safe
- +1 −0 vendor/pygments/Pygments.egg-info/top_level.txt
- +458 −0 vendor/pygments/docs/build/api.html
- +355 −0 vendor/pygments/docs/build/authors.html
- +930 −0 vendor/pygments/docs/build/changelog.html
- +353 −0 vendor/pygments/docs/build/cmdline.html
- +282 −0 vendor/pygments/docs/build/filterdevelopment.html
- +412 −0 vendor/pygments/docs/build/filters.html
- +374 −0 vendor/pygments/docs/build/formatterdevelopment.html
- +927 −0 vendor/pygments/docs/build/formatters.html
- +261 −0 vendor/pygments/docs/build/index.html
- +281 −0 vendor/pygments/docs/build/installation.html
- +268 −0 vendor/pygments/docs/build/integrate.html
- +271 −0 vendor/pygments/docs/build/java.html
- +691 −0 vendor/pygments/docs/build/lexerdevelopment.html
- +5,359 −0 vendor/pygments/docs/build/lexers.html
- +245 −0 vendor/pygments/docs/build/moinmoin.html
- +294 −0 vendor/pygments/docs/build/plugins.html
- +390 −0 vendor/pygments/docs/build/quickstart.html
- +229 −0 vendor/pygments/docs/build/rstdirective.html
- +341 −0 vendor/pygments/docs/build/styles.html
- +541 −0 vendor/pygments/docs/build/tokens.html
- +249 −0 vendor/pygments/docs/build/unicode.html
- +1 −1 vendor/pygments/docs/generate.py
- +1 −1 vendor/pygments/docs/src/api.txt
- +1 −1 vendor/pygments/docs/src/index.txt
- +5 −0 vendor/pygments/docs/src/integrate.txt
- +70 −0 vendor/pygments/docs/src/java.txt
- +64 −0 vendor/pygments/external/autopygmentize
- +2 −2 vendor/pygments/external/markdown-processor.py
- +1 −1 vendor/pygments/external/moin-parser.py
- +1 −1 vendor/pygments/external/rst-directive-old.py
- +1 −1 vendor/pygments/external/rst-directive.py
- +2 −2 vendor/pygments/pygments/__init__.py
- +14 −6 vendor/pygments/pygments/cmdline.py
- +1 −1 vendor/pygments/pygments/console.py
- +1 −1 vendor/pygments/pygments/filter.py
- +1 −2 vendor/pygments/pygments/filters/__init__.py
- +1 −1 vendor/pygments/pygments/formatter.py
- +1 −1 vendor/pygments/pygments/formatters/__init__.py
- +1 −1 vendor/pygments/pygments/formatters/_mapping.py
- +1 −1 vendor/pygments/pygments/formatters/bbcode.py
- +73 −2 vendor/pygments/pygments/formatters/html.py
- +1 −1 vendor/pygments/pygments/formatters/img.py
- +1 −1 vendor/pygments/pygments/formatters/latex.py
- +1 −3 vendor/pygments/pygments/formatters/other.py
- +1 −1 vendor/pygments/pygments/formatters/rtf.py
- +1 −1 vendor/pygments/pygments/formatters/svg.py
- +1 −1 vendor/pygments/pygments/formatters/terminal.py
- +1 −1 vendor/pygments/pygments/formatters/terminal256.py
- +78 −10 vendor/pygments/pygments/lexer.py
- +2 −2 vendor/pygments/pygments/lexers/__init__.py
- +1 −1 vendor/pygments/pygments/lexers/_asybuiltins.py
- +1 −1 vendor/pygments/pygments/lexers/_clbuiltins.py
- +4 −1 vendor/pygments/pygments/lexers/_lassobuiltins.py
- +1 −1 vendor/pygments/pygments/lexers/_luabuiltins.py
- +33 −10 vendor/pygments/pygments/lexers/_mapping.py
- +11 −0 vendor/pygments/pygments/lexers/_openedgebuiltins.py
- +2 −2 vendor/pygments/pygments/lexers/_phpbuiltins.py
- +4 −3 vendor/pygments/pygments/lexers/_postgres_builtins.py
- +557 −0 vendor/pygments/pygments/lexers/_robotframeworklexer.py
- +11 −0 vendor/pygments/pygments/lexers/_scilab_builtins.py
- +2 −2 vendor/pygments/pygments/lexers/_sourcemodbuiltins.py
- +6 −6 vendor/pygments/pygments/lexers/_stan_builtins.py
- +107 −7 vendor/pygments/pygments/lexers/agile.py
- +42 −4 vendor/pygments/pygments/lexers/asm.py
- +873 −429 vendor/pygments/pygments/lexers/compiled.py
- +104 −0 vendor/pygments/pygments/lexers/dalvik.py
- +1 −1 vendor/pygments/pygments/lexers/dotnet.py
- +428 −0 vendor/pygments/pygments/lexers/foxpro.py
- +8 −6 vendor/pygments/pygments/lexers/functional.py
- +3 −3 vendor/pygments/pygments/lexers/hdl.py
- +142 −28 vendor/pygments/pygments/lexers/jvm.py
- +278 −15 vendor/pygments/pygments/lexers/math.py
- +520 −13 vendor/pygments/pygments/lexers/other.py
- +85 −2 vendor/pygments/pygments/lexers/parsers.py
- +48 −2 vendor/pygments/pygments/lexers/shell.py
- +1 −1 vendor/pygments/pygments/lexers/special.py
- +1 −1 vendor/pygments/pygments/lexers/sql.py
- +15 −6 vendor/pygments/pygments/lexers/templates.py
- +90 −6 vendor/pygments/pygments/lexers/text.py
- +264 −51 vendor/pygments/pygments/lexers/web.py
- +1 −1 vendor/pygments/pygments/plugin.py
- +1 −1 vendor/pygments/pygments/scanner.py
- +1 −1 vendor/pygments/pygments/style.py
- +1 −1 vendor/pygments/pygments/styles/__init__.py
- +1 −1 vendor/pygments/pygments/styles/autumn.py
- +1 −1 vendor/pygments/pygments/styles/borland.py
- +1 −1 vendor/pygments/pygments/styles/bw.py
- +1 −1 vendor/pygments/pygments/styles/colorful.py
- +1 −1 vendor/pygments/pygments/styles/default.py
- +1 −1 vendor/pygments/pygments/styles/emacs.py
- +1 −1 vendor/pygments/pygments/styles/friendly.py
- +1 −1 vendor/pygments/pygments/styles/fruity.py
- +1 −1 vendor/pygments/pygments/styles/manni.py
- +1 −1 vendor/pygments/pygments/styles/monokai.py
- +1 −1 vendor/pygments/pygments/styles/murphy.py
- +1 −1 vendor/pygments/pygments/styles/native.py
- +1 −1 vendor/pygments/pygments/styles/pastie.py
- +1 −1 vendor/pygments/pygments/styles/perldoc.py
- +1 −1 vendor/pygments/pygments/styles/rrt.py
- +1 −1 vendor/pygments/pygments/styles/tango.py
- +1 −1 vendor/pygments/pygments/styles/trac.py
- +1 −1 vendor/pygments/pygments/styles/vim.py
- +1 −1 vendor/pygments/pygments/styles/vs.py
- +1 −1 vendor/pygments/pygments/token.py
- +1 −1 vendor/pygments/pygments/unistring.py
- +1 −1 vendor/pygments/pygments/util.py
- +2 −2 vendor/pygments/scripts/check_sources.py
- +2 −0 vendor/pygments/scripts/detect_missing_analyse_text.py
- +1 −1 vendor/pygments/scripts/find_codetags.py
- +5 −6 vendor/pygments/scripts/find_error.py
- +4 −2 vendor/pygments/setup.cfg
- +6 −4 vendor/pygments/setup.py
- +1 −0 vendor/pygments/tests/examplefiles/BOM.js
- +25 −0 vendor/pygments/tests/examplefiles/autoit_submit.au3
- +308 −0 vendor/pygments/tests/examplefiles/bigtest.nsi
- +284 −0 vendor/pygments/tests/examplefiles/ca65_example
- +9 −0 vendor/pygments/tests/examplefiles/cbmbas_example
- +89 −4 vendor/pygments/tests/examplefiles/classes.dylan
- +3,556 −0 vendor/pygments/tests/examplefiles/example.cob
- +152 −0 vendor/pygments/tests/examplefiles/example.monkey
- +161 −0 vendor/pygments/tests/examplefiles/example.prg
- +19 −0 vendor/pygments/tests/examplefiles/example.reg
- +45 −0 vendor/pygments/tests/examplefiles/example.shell-session
- +28 −0 vendor/pygments/tests/examplefiles/example.ts
- +40 −0 vendor/pygments/tests/examplefiles/hello.smali
- +71 −0 vendor/pygments/tests/examplefiles/inet_pton6.dg
- +28 −0 vendor/pygments/tests/examplefiles/logos_example.xm
- +455 −0 vendor/pygments/tests/examplefiles/metagrammar.treetop
- +73 −0 vendor/pygments/tests/examplefiles/mg_sample.pro
- +112 −0 vendor/pygments/tests/examplefiles/minehunt.qml
- +95 −0 vendor/pygments/tests/examplefiles/nanomsg.intr
- +163 −0 vendor/pygments/tests/examplefiles/phpMyAdmin.spec
- +4 −0 vendor/pygments/tests/examplefiles/pytb_test3.pytb
- +39 −0 vendor/pygments/tests/examplefiles/robotframework.txt
- +191 −701 vendor/pygments/tests/examplefiles/rust_example.rs
- +9 −0 vendor/pygments/tests/examplefiles/session.dylan-console
- +10 −0 vendor/pygments/tests/examplefiles/test.opa
- +120 −0 vendor/pygments/tests/examplefiles/test2.pypylog
- +37 −0 vendor/pygments/tests/examplefiles/unix-io.lid
- +1 −1 vendor/pygments/tests/old_run.py
- +3 −2 vendor/pygments/tests/run.py
- +36 −0 vendor/pygments/tests/support/tags
- +3 −2 vendor/pygments/tests/test_basic_api.py
- +1 −1 vendor/pygments/tests/test_clexer.py
- +1 −1 vendor/pygments/tests/test_cmdline.py
- +3 −1 vendor/pygments/tests/test_examplefiles.py
- +17 −1 vendor/pygments/tests/test_html_formatter.py
- +1 −1 vendor/pygments/tests/test_latex_formatter.py
- +1 −1 vendor/pygments/tests/test_perllexer.py
- +1 −1 vendor/pygments/tests/test_regexlexer.py
- +1 −1 vendor/pygments/tests/test_token.py
- +1 −1 vendor/pygments/tests/test_using_api.py
- +5 −4 vendor/pygments/tests/test_util.py
20
vendor/pygments/AUTHORS
88
vendor/pygments/CHANGES
2
vendor/pygments/LICENSE
2
vendor/pygments/Makefile
46
vendor/pygments/PKG-INFO
| @@ -0,0 +1,46 @@ | |||
| +Metadata-Version: 1.1 | |||
| +Name: Pygments | |||
| +Version: 1.6 | |||
| +Summary: Pygments is a syntax highlighting package written in Python. | |||
| +Home-page: http://pygments.org/ | |||
| +Author: Georg Brandl | |||
| +Author-email: georg@python.org | |||
| +License: BSD License | |||
| +Description: | |||
| + Pygments | |||
| + ~~~~~~~~ | |||
| + | |||
| + Pygments is a syntax highlighting package written in Python. | |||
| + | |||
| + It is a generic syntax highlighter for general use in all kinds of software | |||
| + such as forum systems, wikis or other applications that need to prettify | |||
| + source code. Highlights are: | |||
| + | |||
| + * a wide range of common languages and markup formats is supported | |||
| + * special attention is paid to details, increasing quality by a fair amount | |||
| + * support for new languages and formats are added easily | |||
| + * a number of output formats, presently HTML, LaTeX, RTF, SVG, all image formats that PIL supports and ANSI sequences | |||
| + * it is usable as a command-line tool and as a library | |||
| + * ... and it highlights even Brainfuck! | |||
| + | |||
| + The `Pygments tip`_ is installable with ``easy_install Pygments==dev``. | |||
| + | |||
| + .. _Pygments tip: | |||
| + http://bitbucket.org/birkenfeld/pygments-main/get/default.zip#egg=Pygments-dev | |||
| + | |||
| + :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. | |||
| + :license: BSD, see LICENSE for details. | |||
| + | |||
| +Keywords: syntax highlighting | |||
| +Platform: any | |||
| +Classifier: License :: OSI Approved :: BSD License | |||
| +Classifier: Intended Audience :: Developers | |||
| +Classifier: Intended Audience :: End Users/Desktop | |||
| +Classifier: Intended Audience :: System Administrators | |||
| +Classifier: Development Status :: 6 - Mature | |||
| +Classifier: Programming Language :: Python | |||
| +Classifier: Programming Language :: Python :: 2 | |||
| +Classifier: Programming Language :: Python :: 3 | |||
| +Classifier: Operating System :: OS Independent | |||
| +Classifier: Topic :: Text Processing :: Filters | |||
| +Classifier: Topic :: Utilities | |||
46
vendor/pygments/Pygments.egg-info/PKG-INFO
| @@ -0,0 +1,46 @@ | |||
| +Metadata-Version: 1.1 | |||
| +Name: Pygments | |||
| +Version: 1.6 | |||
| +Summary: Pygments is a syntax highlighting package written in Python. | |||
| +Home-page: http://pygments.org/ | |||
| +Author: Georg Brandl | |||
| +Author-email: georg@python.org | |||
| +License: BSD License | |||
| +Description: | |||
| + Pygments | |||
| + ~~~~~~~~ | |||
| + | |||
| + Pygments is a syntax highlighting package written in Python. | |||
| + | |||
| + It is a generic syntax highlighter for general use in all kinds of software | |||
| + such as forum systems, wikis or other applications that need to prettify | |||
| + source code. Highlights are: | |||
| + | |||
| + * a wide range of common languages and markup formats is supported | |||
| + * special attention is paid to details, increasing quality by a fair amount | |||
| + * support for new languages and formats are added easily | |||
| + * a number of output formats, presently HTML, LaTeX, RTF, SVG, all image formats that PIL supports and ANSI sequences | |||
| + * it is usable as a command-line tool and as a library | |||
| + * ... and it highlights even Brainfuck! | |||
| + | |||
| + The `Pygments tip`_ is installable with ``easy_install Pygments==dev``. | |||
| + | |||
| + .. _Pygments tip: | |||
| + http://bitbucket.org/birkenfeld/pygments-main/get/default.zip#egg=Pygments-dev | |||
| + | |||
| + :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. | |||
| + :license: BSD, see LICENSE for details. | |||
| + | |||
| +Keywords: syntax highlighting | |||
| +Platform: any | |||
| +Classifier: License :: OSI Approved :: BSD License | |||
| +Classifier: Intended Audience :: Developers | |||
| +Classifier: Intended Audience :: End Users/Desktop | |||
| +Classifier: Intended Audience :: System Administrators | |||
| +Classifier: Development Status :: 6 - Mature | |||
| +Classifier: Programming Language :: Python | |||
| +Classifier: Programming Language :: Python :: 2 | |||
| +Classifier: Programming Language :: Python :: 3 | |||
| +Classifier: Operating System :: OS Independent | |||
| +Classifier: Topic :: Text Processing :: Filters | |||
| +Classifier: Topic :: Utilities | |||
416
vendor/pygments/Pygments.egg-info/SOURCES.txt
| @@ -0,0 +1,416 @@ | |||
| +AUTHORS | |||
| +CHANGES | |||
| +LICENSE | |||
| +MANIFEST.in | |||
| +Makefile | |||
| +TODO | |||
| +ez_setup.py | |||
| +pygmentize | |||
| +setup.cfg | |||
| +setup.py | |||
| +Pygments.egg-info/PKG-INFO | |||
| +Pygments.egg-info/SOURCES.txt | |||
| +Pygments.egg-info/dependency_links.txt | |||
| +Pygments.egg-info/entry_points.txt | |||
| +Pygments.egg-info/not-zip-safe | |||
| +Pygments.egg-info/top_level.txt | |||
| +docs/generate.py | |||
| +docs/pygmentize.1 | |||
| +docs/build/api.html | |||
| +docs/build/authors.html | |||
| +docs/build/changelog.html | |||
| +docs/build/cmdline.html | |||
| +docs/build/filterdevelopment.html | |||
| +docs/build/filters.html | |||
| +docs/build/formatterdevelopment.html | |||
| +docs/build/formatters.html | |||
| +docs/build/index.html | |||
| +docs/build/installation.html | |||
| +docs/build/integrate.html | |||
| +docs/build/java.html | |||
| +docs/build/lexerdevelopment.html | |||
| +docs/build/lexers.html | |||
| +docs/build/moinmoin.html | |||
| +docs/build/plugins.html | |||
| +docs/build/quickstart.html | |||
| +docs/build/rstdirective.html | |||
| +docs/build/styles.html | |||
| +docs/build/tokens.html | |||
| +docs/build/unicode.html | |||
| +docs/src/api.txt | |||
| +docs/src/authors.txt | |||
| +docs/src/changelog.txt | |||
| +docs/src/cmdline.txt | |||
| +docs/src/filterdevelopment.txt | |||
| +docs/src/filters.txt | |||
| +docs/src/formatterdevelopment.txt | |||
| +docs/src/formatters.txt | |||
| +docs/src/index.txt | |||
| +docs/src/installation.txt | |||
| +docs/src/integrate.txt | |||
| +docs/src/java.txt | |||
| +docs/src/lexerdevelopment.txt | |||
| +docs/src/lexers.txt | |||
| +docs/src/moinmoin.txt | |||
| +docs/src/plugins.txt | |||
| +docs/src/quickstart.txt | |||
| +docs/src/rstdirective.txt | |||
| +docs/src/styles.txt | |||
| +docs/src/tokens.txt | |||
| +docs/src/unicode.txt | |||
| +external/autopygmentize | |||
| +external/lasso-builtins-generator-9.lasso | |||
| +external/markdown-processor.py | |||
| +external/moin-parser.py | |||
| +external/pygments.bashcomp | |||
| +external/rst-directive-old.py | |||
| +external/rst-directive.py | |||
| +pygments/__init__.py | |||
| +pygments/cmdline.py | |||
| +pygments/console.py | |||
| +pygments/filter.py | |||
| +pygments/formatter.py | |||
| +pygments/lexer.py | |||
| +pygments/plugin.py | |||
| +pygments/scanner.py | |||
| +pygments/style.py | |||
| +pygments/token.py | |||
| +pygments/unistring.py | |||
| +pygments/util.py | |||
| +pygments/filters/__init__.py | |||
| +pygments/formatters/__init__.py | |||
| +pygments/formatters/_mapping.py | |||
| +pygments/formatters/bbcode.py | |||
| +pygments/formatters/html.py | |||
| +pygments/formatters/img.py | |||
| +pygments/formatters/latex.py | |||
| +pygments/formatters/other.py | |||
| +pygments/formatters/rtf.py | |||
| +pygments/formatters/svg.py | |||
| +pygments/formatters/terminal.py | |||
| +pygments/formatters/terminal256.py | |||
| +pygments/lexers/__init__.py | |||
| +pygments/lexers/_asybuiltins.py | |||
| +pygments/lexers/_clbuiltins.py | |||
| +pygments/lexers/_lassobuiltins.py | |||
| +pygments/lexers/_luabuiltins.py | |||
| +pygments/lexers/_mapping.py | |||
| +pygments/lexers/_openedgebuiltins.py | |||
| +pygments/lexers/_phpbuiltins.py | |||
| +pygments/lexers/_postgres_builtins.py | |||
| +pygments/lexers/_robotframeworklexer.py | |||
| +pygments/lexers/_scilab_builtins.py | |||
| +pygments/lexers/_sourcemodbuiltins.py | |||
| +pygments/lexers/_stan_builtins.py | |||
| +pygments/lexers/_vimbuiltins.py | |||
| +pygments/lexers/agile.py | |||
| +pygments/lexers/asm.py | |||
| +pygments/lexers/compiled.py | |||
| +pygments/lexers/dalvik.py | |||
| +pygments/lexers/dotnet.py | |||
| +pygments/lexers/foxpro.py | |||
| +pygments/lexers/functional.py | |||
| +pygments/lexers/hdl.py | |||
| +pygments/lexers/jvm.py | |||
| +pygments/lexers/math.py | |||
| +pygments/lexers/other.py | |||
| +pygments/lexers/parsers.py | |||
| +pygments/lexers/shell.py | |||
| +pygments/lexers/special.py | |||
| +pygments/lexers/sql.py | |||
| +pygments/lexers/templates.py | |||
| +pygments/lexers/text.py | |||
| +pygments/lexers/web.py | |||
| +pygments/styles/__init__.py | |||
| +pygments/styles/autumn.py | |||
| +pygments/styles/borland.py | |||
| +pygments/styles/bw.py | |||
| +pygments/styles/colorful.py | |||
| +pygments/styles/default.py | |||
| +pygments/styles/emacs.py | |||
| +pygments/styles/friendly.py | |||
| +pygments/styles/fruity.py | |||
| +pygments/styles/manni.py | |||
| +pygments/styles/monokai.py | |||
| +pygments/styles/murphy.py | |||
| +pygments/styles/native.py | |||
| +pygments/styles/pastie.py | |||
| +pygments/styles/perldoc.py | |||
| +pygments/styles/rrt.py | |||
| +pygments/styles/tango.py | |||
| +pygments/styles/trac.py | |||
| +pygments/styles/vim.py | |||
| +pygments/styles/vs.py | |||
| +scripts/check_sources.py | |||
| +scripts/detect_missing_analyse_text.py | |||
| +scripts/epydoc.css | |||
| +scripts/find_codetags.py | |||
| +scripts/find_error.py | |||
| +scripts/get_vimkw.py | |||
| +scripts/pylintrc | |||
| +scripts/reindent.py | |||
| +scripts/vim2pygments.py | |||
| +tests/old_run.py | |||
| +tests/run.py | |||
| +tests/support.py | |||
| +tests/test_basic_api.py | |||
| +tests/test_clexer.py | |||
| +tests/test_cmdline.py | |||
| +tests/test_examplefiles.py | |||
| +tests/test_html_formatter.py | |||
| +tests/test_latex_formatter.py | |||
| +tests/test_perllexer.py | |||
| +tests/test_regexlexer.py | |||
| +tests/test_token.py | |||
| +tests/test_using_api.py | |||
| +tests/test_util.py | |||
| +tests/dtds/HTML4-f.dtd | |||
| +tests/dtds/HTML4-s.dtd | |||
| +tests/dtds/HTML4.dcl | |||
| +tests/dtds/HTML4.dtd | |||
| +tests/dtds/HTML4.soc | |||
| +tests/dtds/HTMLlat1.ent | |||
| +tests/dtds/HTMLspec.ent | |||
| +tests/dtds/HTMLsym.ent | |||
| +tests/examplefiles/ANTLRv3.g | |||
| +tests/examplefiles/AcidStateAdvanced.hs | |||
| +tests/examplefiles/AlternatingGroup.mu | |||
| +tests/examplefiles/BOM.js | |||
| +tests/examplefiles/CPDictionary.j | |||
| +tests/examplefiles/Config.in.cache | |||
| +tests/examplefiles/Constants.mo | |||
| +tests/examplefiles/DancingSudoku.lhs | |||
| +tests/examplefiles/Errors.scala | |||
| +tests/examplefiles/File.hy | |||
| +tests/examplefiles/Intro.java | |||
| +tests/examplefiles/Makefile | |||
| +tests/examplefiles/Object.st | |||
| +tests/examplefiles/OrderedMap.hx | |||
| +tests/examplefiles/SmallCheck.hs | |||
| +tests/examplefiles/Sorting.mod | |||
| +tests/examplefiles/Sudoku.lhs | |||
| +tests/examplefiles/addressbook.proto | |||
| +tests/examplefiles/antlr_throws | |||
| +tests/examplefiles/apache2.conf | |||
| +tests/examplefiles/as3_test.as | |||
| +tests/examplefiles/as3_test2.as | |||
| +tests/examplefiles/as3_test3.as | |||
| +tests/examplefiles/aspx-cs_example | |||
| +tests/examplefiles/autoit_submit.au3 | |||
| +tests/examplefiles/badcase.java | |||
| +tests/examplefiles/batchfile.bat | |||
| +tests/examplefiles/bigtest.nsi | |||
| +tests/examplefiles/boot-9.scm | |||
| +tests/examplefiles/ca65_example | |||
| +tests/examplefiles/cbmbas_example | |||
| +tests/examplefiles/cells.ps | |||
| +tests/examplefiles/ceval.c | |||
| +tests/examplefiles/cheetah_example.html | |||
| +tests/examplefiles/classes.dylan | |||
| +tests/examplefiles/condensed_ruby.rb | |||
| +tests/examplefiles/coq_RelationClasses | |||
| +tests/examplefiles/database.pytb | |||
| +tests/examplefiles/de.MoinMoin.po | |||
| +tests/examplefiles/demo.ahk | |||
| +tests/examplefiles/demo.cfm | |||
| +tests/examplefiles/django_sample.html+django | |||
| +tests/examplefiles/dwarf.cw | |||
| +tests/examplefiles/erl_session | |||
| +tests/examplefiles/escape_semicolon.clj | |||
| +tests/examplefiles/evil_regex.js | |||
| +tests/examplefiles/example.Rd | |||
| +tests/examplefiles/example.bug | |||
| +tests/examplefiles/example.c | |||
| +tests/examplefiles/example.ceylon | |||
| +tests/examplefiles/example.cls | |||
| +tests/examplefiles/example.cob | |||
| +tests/examplefiles/example.cpp | |||
| +tests/examplefiles/example.gs | |||
| +tests/examplefiles/example.gst | |||
| +tests/examplefiles/example.jag | |||
| +tests/examplefiles/example.kt | |||
| +tests/examplefiles/example.lua | |||
| +tests/examplefiles/example.monkey | |||
| +tests/examplefiles/example.moo | |||
| +tests/examplefiles/example.moon | |||
| +tests/examplefiles/example.msc | |||
| +tests/examplefiles/example.nim | |||
| +tests/examplefiles/example.ns2 | |||
| +tests/examplefiles/example.p | |||
| +tests/examplefiles/example.pas | |||
| +tests/examplefiles/example.prg | |||
| +tests/examplefiles/example.rb | |||
| +tests/examplefiles/example.reg | |||
| +tests/examplefiles/example.rhtml | |||
| +tests/examplefiles/example.rkt | |||
| +tests/examplefiles/example.rpf | |||
| +tests/examplefiles/example.sh-session | |||
| +tests/examplefiles/example.shell-session | |||
| +tests/examplefiles/example.sml | |||
| +tests/examplefiles/example.snobol | |||
| +tests/examplefiles/example.stan | |||
| +tests/examplefiles/example.tea | |||
| +tests/examplefiles/example.ts | |||
| +tests/examplefiles/example.u | |||
| +tests/examplefiles/example.weechatlog | |||
| +tests/examplefiles/example.xhtml | |||
| +tests/examplefiles/example.xtend | |||
| +tests/examplefiles/example.yaml | |||
| +tests/examplefiles/example2.aspx | |||
| +tests/examplefiles/example2.msc | |||
| +tests/examplefiles/example_elixir.ex | |||
| +tests/examplefiles/example_file.fy | |||
| +tests/examplefiles/firefox.mak | |||
| +tests/examplefiles/flipflop.sv | |||
| +tests/examplefiles/foo.sce | |||
| +tests/examplefiles/format.ml | |||
| +tests/examplefiles/fucked_up.rb | |||
| +tests/examplefiles/function.mu | |||
| +tests/examplefiles/functional.rst | |||
| +tests/examplefiles/garcia-wachs.kk | |||
| +tests/examplefiles/genclass.clj | |||
| +tests/examplefiles/genshi_example.xml+genshi | |||
| +tests/examplefiles/genshitext_example.genshitext | |||
| +tests/examplefiles/glsl.frag | |||
| +tests/examplefiles/glsl.vert | |||
| +tests/examplefiles/hello.smali | |||
| +tests/examplefiles/hello.sp | |||
| +tests/examplefiles/html+php_faulty.php | |||
| +tests/examplefiles/http_request_example | |||
| +tests/examplefiles/http_response_example | |||
| +tests/examplefiles/import.hs | |||
| +tests/examplefiles/inet_pton6.dg | |||
| +tests/examplefiles/intro.ik | |||
| +tests/examplefiles/ints.php | |||
| +tests/examplefiles/intsyn.fun | |||
| +tests/examplefiles/intsyn.sig | |||
| +tests/examplefiles/irb_heredoc | |||
| +tests/examplefiles/irc.lsp | |||
| +tests/examplefiles/java.properties | |||
| +tests/examplefiles/jbst_example1.jbst | |||
| +tests/examplefiles/jbst_example2.jbst | |||
| +tests/examplefiles/jinjadesignerdoc.rst | |||
| +tests/examplefiles/json.lasso | |||
| +tests/examplefiles/json.lasso9 | |||
| +tests/examplefiles/lighttpd_config.conf | |||
| +tests/examplefiles/linecontinuation.py | |||
| +tests/examplefiles/livescript-demo.ls | |||
| +tests/examplefiles/logos_example.xm | |||
| +tests/examplefiles/ltmain.sh | |||
| +tests/examplefiles/main.cmake | |||
| +tests/examplefiles/markdown.lsp | |||
| +tests/examplefiles/matlab_noreturn | |||
| +tests/examplefiles/matlab_sample | |||
| +tests/examplefiles/matlabsession_sample.txt | |||
| +tests/examplefiles/metagrammar.treetop | |||
| +tests/examplefiles/mg_sample.pro | |||
| +tests/examplefiles/minehunt.qml | |||
| +tests/examplefiles/minimal.ns2 | |||
| +tests/examplefiles/moin_SyntaxReference.txt | |||
| +tests/examplefiles/multiline_regexes.rb | |||
| +tests/examplefiles/nanomsg.intr | |||
| +tests/examplefiles/nasm_aoutso.asm | |||
| +tests/examplefiles/nasm_objexe.asm | |||
| +tests/examplefiles/nemerle_sample.n | |||
| +tests/examplefiles/nginx_nginx.conf | |||
| +tests/examplefiles/numbers.c | |||
| +tests/examplefiles/objc_example.m | |||
| +tests/examplefiles/objc_example2.m | |||
| +tests/examplefiles/perl_misc | |||
| +tests/examplefiles/perl_perl5db | |||
| +tests/examplefiles/perl_regex-delims | |||
| +tests/examplefiles/perlfunc.1 | |||
| +tests/examplefiles/phpMyAdmin.spec | |||
| +tests/examplefiles/phpcomplete.vim | |||
| +tests/examplefiles/pleac.in.rb | |||
| +tests/examplefiles/postgresql_test.txt | |||
| +tests/examplefiles/pppoe.applescript | |||
| +tests/examplefiles/psql_session.txt | |||
| +tests/examplefiles/py3_test.txt | |||
| +tests/examplefiles/pycon_test.pycon | |||
| +tests/examplefiles/pytb_test2.pytb | |||
| +tests/examplefiles/pytb_test3.pytb | |||
| +tests/examplefiles/python25-bsd.mak | |||
| +tests/examplefiles/qsort.prolog | |||
| +tests/examplefiles/r-console-transcript.Rout | |||
| +tests/examplefiles/ragel-cpp_rlscan | |||
| +tests/examplefiles/ragel-cpp_snippet | |||
| +tests/examplefiles/regex.js | |||
| +tests/examplefiles/reversi.lsp | |||
| +tests/examplefiles/robotframework.txt | |||
| +tests/examplefiles/ruby_func_def.rb | |||
| +tests/examplefiles/rust_example.rs | |||
| +tests/examplefiles/scilab.sci | |||
| +tests/examplefiles/session.dylan-console | |||
| +tests/examplefiles/sibling.prolog | |||
| +tests/examplefiles/simple.md | |||
| +tests/examplefiles/smarty_example.html | |||
| +tests/examplefiles/source.lgt | |||
| +tests/examplefiles/sources.list | |||
| +tests/examplefiles/sphere.pov | |||
| +tests/examplefiles/sqlite3.sqlite3-console | |||
| +tests/examplefiles/squid.conf | |||
| +tests/examplefiles/string.jl | |||
| +tests/examplefiles/string_delimiters.d | |||
| +tests/examplefiles/stripheredoc.sh | |||
| +tests/examplefiles/test.R | |||
| +tests/examplefiles/test.adb | |||
| +tests/examplefiles/test.asy | |||
| +tests/examplefiles/test.awk | |||
| +tests/examplefiles/test.bas | |||
| +tests/examplefiles/test.bmx | |||
| +tests/examplefiles/test.boo | |||
| +tests/examplefiles/test.bro | |||
| +tests/examplefiles/test.cs | |||
| +tests/examplefiles/test.css | |||
| +tests/examplefiles/test.cu | |||
| +tests/examplefiles/test.d | |||
| +tests/examplefiles/test.dart | |||
| +tests/examplefiles/test.dtd | |||
| +tests/examplefiles/test.ec | |||
| +tests/examplefiles/test.ecl | |||
| +tests/examplefiles/test.eh | |||
| +tests/examplefiles/test.erl | |||
| +tests/examplefiles/test.evoque | |||
| +tests/examplefiles/test.fan | |||
| +tests/examplefiles/test.flx | |||
| +tests/examplefiles/test.gdc | |||
| +tests/examplefiles/test.groovy | |||
| +tests/examplefiles/test.html | |||
| +tests/examplefiles/test.ini | |||
| +tests/examplefiles/test.java | |||
| +tests/examplefiles/test.jsp | |||
| +tests/examplefiles/test.maql | |||
| +tests/examplefiles/test.mod | |||
| +tests/examplefiles/test.moo | |||
| +tests/examplefiles/test.myt | |||
| +tests/examplefiles/test.nim | |||
| +tests/examplefiles/test.opa | |||
| +tests/examplefiles/test.pas | |||
| +tests/examplefiles/test.php | |||
| +tests/examplefiles/test.plot | |||
| +tests/examplefiles/test.ps1 | |||
| +tests/examplefiles/test.pypylog | |||
| +tests/examplefiles/test.r3 | |||
| +tests/examplefiles/test.rb | |||
| +tests/examplefiles/test.rhtml | |||
| +tests/examplefiles/test.scaml | |||
| +tests/examplefiles/test.ssp | |||
| +tests/examplefiles/test.tcsh | |||
| +tests/examplefiles/test.vb | |||
| +tests/examplefiles/test.vhdl | |||
| +tests/examplefiles/test.xqy | |||
| +tests/examplefiles/test.xsl | |||
| +tests/examplefiles/test2.pypylog | |||
| +tests/examplefiles/truncated.pytb | |||
| +tests/examplefiles/type.lisp | |||
| +tests/examplefiles/underscore.coffee | |||
| +tests/examplefiles/unicode.applescript | |||
| +tests/examplefiles/unicodedoc.py | |||
| +tests/examplefiles/unix-io.lid | |||
| +tests/examplefiles/webkit-transition.css | |||
| +tests/examplefiles/while.pov | |||
| +tests/examplefiles/wiki.factor | |||
| +tests/examplefiles/xml_example | |||
| +tests/examplefiles/zmlrpc.f90 | |||
| +tests/support/tags | |||
1
vendor/pygments/Pygments.egg-info/dependency_links.txt
| @@ -0,0 +1 @@ | |||
| + | |||
3
vendor/pygments/Pygments.egg-info/entry_points.txt
| @@ -0,0 +1,3 @@ | |||
| +[console_scripts] | |||
| +pygmentize = pygments.cmdline:main | |||
| + | |||
1
vendor/pygments/Pygments.egg-info/not-zip-safe
| @@ -0,0 +1 @@ | |||
| + | |||
1
vendor/pygments/Pygments.egg-info/top_level.txt
| @@ -0,0 +1 @@ | |||
| +pygments | |||
458
vendor/pygments/docs/build/api.html
| @@ -0,0 +1,458 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>The full Pygments API — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">The full Pygments API</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <div class="toc"> | |||
| + <h2>Contents</h2> | |||
| + <ul class="contents"> | |||
| + | |||
| + <li><a href="#high-level-api">High-level API</a></li> | |||
| + | |||
| + <li><a href="#lexers">Lexers</a></li> | |||
| + | |||
| + <li><a href="#formatters">Formatters</a></li> | |||
| + | |||
| + <li><a href="#option-processing">Option processing</a></li> | |||
| + | |||
| + </ul> | |||
| + </div> | |||
| + | |||
| + <!-- -*- mode: rst -*- --> | |||
| +<p>This page describes the Pygments API.</p> | |||
| +<div class="section" id="high-level-api"> | |||
| +<h3>High-level API</h3> | |||
| +<p>Functions from the <cite>pygments</cite> module:</p> | |||
| +<dl class="docutils"> | |||
| +<dt>def <cite>lex(code, lexer):</cite></dt> | |||
| +<dd>Lex <cite>code</cite> with the <cite>lexer</cite> (must be a <cite>Lexer</cite> instance) | |||
| +and return an iterable of tokens. Currently, this only calls | |||
| +<cite>lexer.get_tokens()</cite>.</dd> | |||
| +<dt>def <cite>format(tokens, formatter, outfile=None):</cite></dt> | |||
| +<dd>Format a token stream (iterable of tokens) <cite>tokens</cite> with the | |||
| +<cite>formatter</cite> (must be a <cite>Formatter</cite> instance). The result is | |||
| +written to <cite>outfile</cite>, or if that is <tt class="docutils literal">None</tt>, returned as a | |||
| +string.</dd> | |||
| +<dt>def <cite>highlight(code, lexer, formatter, outfile=None):</cite></dt> | |||
| +<dd>This is the most high-level highlighting function. | |||
| +It combines <cite>lex</cite> and <cite>format</cite> in one function.</dd> | |||
| +</dl> | |||
| +<p>Functions from <cite>pygments.lexers</cite>:</p> | |||
| +<dl class="docutils"> | |||
| +<dt>def <cite>get_lexer_by_name(alias, **options):</cite></dt> | |||
| +<dd><p class="first">Return an instance of a <cite>Lexer</cite> subclass that has <cite>alias</cite> in its | |||
| +aliases list. The lexer is given the <cite>options</cite> at its | |||
| +instantiation.</p> | |||
| +<p class="last">Will raise <cite>pygments.util.ClassNotFound</cite> if no lexer with that alias is | |||
| +found.</p> | |||
| +</dd> | |||
| +<dt>def <cite>get_lexer_for_filename(fn, **options):</cite></dt> | |||
| +<dd><p class="first">Return a <cite>Lexer</cite> subclass instance that has a filename pattern | |||
| +matching <cite>fn</cite>. The lexer is given the <cite>options</cite> at its | |||
| +instantiation.</p> | |||
| +<p class="last">Will raise <cite>pygments.util.ClassNotFound</cite> if no lexer for that filename is | |||
| +found.</p> | |||
| +</dd> | |||
| +<dt>def <cite>get_lexer_for_mimetype(mime, **options):</cite></dt> | |||
| +<dd><p class="first">Return a <cite>Lexer</cite> subclass instance that has <cite>mime</cite> in its mimetype | |||
| +list. The lexer is given the <cite>options</cite> at its instantiation.</p> | |||
| +<p class="last">Will raise <cite>pygments.util.ClassNotFound</cite> if not lexer for that mimetype is | |||
| +found.</p> | |||
| +</dd> | |||
| +<dt>def <cite>guess_lexer(text, **options):</cite></dt> | |||
| +<dd><p class="first">Return a <cite>Lexer</cite> subclass instance that's guessed from the text | |||
| +in <cite>text</cite>. For that, the <cite>analyse_text()</cite> method of every known | |||
| +lexer class is called with the text as argument, and the lexer | |||
| +which returned the highest value will be instantiated and returned.</p> | |||
| +<p class="last"><cite>pygments.util.ClassNotFound</cite> is raised if no lexer thinks it can handle the | |||
| +content.</p> | |||
| +</dd> | |||
| +<dt>def <cite>guess_lexer_for_filename(filename, text, **options):</cite></dt> | |||
| +<dd><p class="first">As <cite>guess_lexer()</cite>, but only lexers which have a pattern in <cite>filenames</cite> | |||
| +or <cite>alias_filenames</cite> that matches <cite>filename</cite> are taken into consideration.</p> | |||
| +<p class="last"><cite>pygments.util.ClassNotFound</cite> is raised if no lexer thinks it can handle the | |||
| +content.</p> | |||
| +</dd> | |||
| +<dt>def <cite>get_all_lexers():</cite></dt> | |||
| +<dd><p class="first">Return an iterable over all registered lexers, yielding tuples in the | |||
| +format:</p> | |||
| +<pre class="literal-block"> | |||
| +(longname, tuple of aliases, tuple of filename patterns, tuple of mimetypes) | |||
| +</pre> | |||
| +<p class="last"><em>New in Pygments 0.6.</em></p> | |||
| +</dd> | |||
| +</dl> | |||
| +<p>Functions from <cite>pygments.formatters</cite>:</p> | |||
| +<dl class="docutils"> | |||
| +<dt>def <cite>get_formatter_by_name(alias, **options):</cite></dt> | |||
| +<dd><p class="first">Return an instance of a <cite>Formatter</cite> subclass that has <cite>alias</cite> in its | |||
| +aliases list. The formatter is given the <cite>options</cite> at its | |||
| +instantiation.</p> | |||
| +<p class="last">Will raise <cite>pygments.util.ClassNotFound</cite> if no formatter with that alias is | |||
| +found.</p> | |||
| +</dd> | |||
| +<dt>def <cite>get_formatter_for_filename(fn, **options):</cite></dt> | |||
| +<dd><p class="first">Return a <cite>Formatter</cite> subclass instance that has a filename pattern | |||
| +matching <cite>fn</cite>. The formatter is given the <cite>options</cite> at its | |||
| +instantiation.</p> | |||
| +<p class="last">Will raise <cite>pygments.util.ClassNotFound</cite> if no formatter for that filename | |||
| +is found.</p> | |||
| +</dd> | |||
| +</dl> | |||
| +<p>Functions from <cite>pygments.styles</cite>:</p> | |||
| +<dl class="docutils"> | |||
| +<dt>def <cite>get_style_by_name(name):</cite></dt> | |||
| +<dd><p class="first">Return a style class by its short name. The names of the builtin styles | |||
| +are listed in <cite>pygments.styles.STYLE_MAP</cite>.</p> | |||
| +<p class="last">Will raise <cite>pygments.util.ClassNotFound</cite> if no style of that name is found.</p> | |||
| +</dd> | |||
| +<dt>def <cite>get_all_styles():</cite></dt> | |||
| +<dd><p class="first">Return an iterable over all registered styles, yielding their names.</p> | |||
| +<p class="last"><em>New in Pygments 0.6.</em></p> | |||
| +</dd> | |||
| +</dl> | |||
| +</div> | |||
| +<div class="section" id="lexers"> | |||
| +<h3>Lexers</h3> | |||
| +<p>A lexer (derived from <cite>pygments.lexer.Lexer</cite>) has the following functions:</p> | |||
| +<dl class="docutils"> | |||
| +<dt>def <cite>__init__(self, **options):</cite></dt> | |||
| +<dd><p class="first">The constructor. Takes a **keywords dictionary of options. | |||
| +Every subclass must first process its own options and then call | |||
| +the <cite>Lexer</cite> constructor, since it processes the <cite>stripnl</cite>, | |||
| +<cite>stripall</cite> and <cite>tabsize</cite> options.</p> | |||
| +<p>An example looks like this:</p> | |||
| +<div class="syntax"><pre><span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">options</span><span class="p">):</span> | |||
| + <span class="bp">self</span><span class="o">.</span><span class="n">compress</span> <span class="o">=</span> <span class="n">options</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">'compress'</span><span class="p">,</span> <span class="s">''</span><span class="p">)</span> | |||
| + <span class="n">Lexer</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">options</span><span class="p">)</span> | |||
| +</pre></div> | |||
| +<p class="last">As these options must all be specifiable as strings (due to the | |||
| +command line usage), there are various utility functions | |||
| +available to help with that, see <a class="reference internal" href="#option-processing">Option processing</a>.</p> | |||
| +</dd> | |||
| +<dt>def <cite>get_tokens(self, text):</cite></dt> | |||
| +<dd><p class="first">This method is the basic interface of a lexer. It is called by | |||
| +the <cite>highlight()</cite> function. It must process the text and return an | |||
| +iterable of <tt class="docutils literal">(tokentype, value)</tt> pairs from <cite>text</cite>.</p> | |||
| +<p class="last">Normally, you don't need to override this method. The default | |||
| +implementation processes the <cite>stripnl</cite>, <cite>stripall</cite> and <cite>tabsize</cite> | |||
| +options and then yields all tokens from <cite>get_tokens_unprocessed()</cite>, | |||
| +with the <tt class="docutils literal">index</tt> dropped.</p> | |||
| +</dd> | |||
| +<dt>def <cite>get_tokens_unprocessed(self, text):</cite></dt> | |||
| +<dd><p class="first">This method should process the text and return an iterable of | |||
| +<tt class="docutils literal">(index, tokentype, value)</tt> tuples where <tt class="docutils literal">index</tt> is the starting | |||
| +position of the token within the input text.</p> | |||
| +<p class="last">This method must be overridden by subclasses.</p> | |||
| +</dd> | |||
| +<dt>def <cite>analyse_text(text):</cite></dt> | |||
| +<dd>A static method which is called for lexer guessing. It should analyse | |||
| +the text and return a float in the range from <tt class="docutils literal">0.0</tt> to <tt class="docutils literal">1.0</tt>. | |||
| +If it returns <tt class="docutils literal">0.0</tt>, the lexer will not be selected as the most | |||
| +probable one, if it returns <tt class="docutils literal">1.0</tt>, it will be selected immediately.</dd> | |||
| +</dl> | |||
| +<p>For a list of known tokens have a look at the <a class="reference external" href="./tokens.html">Tokens</a> page.</p> | |||
| +<p>A lexer also can have the following attributes (in fact, they are mandatory | |||
| +except <cite>alias_filenames</cite>) that are used by the builtin lookup mechanism.</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>name</cite></dt> | |||
| +<dd>Full name for the lexer, in human-readable form.</dd> | |||
| +<dt><cite>aliases</cite></dt> | |||
| +<dd>A list of short, unique identifiers that can be used to lookup | |||
| +the lexer from a list, e.g. using <cite>get_lexer_by_name()</cite>.</dd> | |||
| +<dt><cite>filenames</cite></dt> | |||
| +<dd>A list of <cite>fnmatch</cite> patterns that match filenames which contain | |||
| +content for this lexer. The patterns in this list should be unique among | |||
| +all lexers.</dd> | |||
| +<dt><cite>alias_filenames</cite></dt> | |||
| +<dd>A list of <cite>fnmatch</cite> patterns that match filenames which may or may not | |||
| +contain content for this lexer. This list is used by the | |||
| +<cite>guess_lexer_for_filename()</cite> function, to determine which lexers are | |||
| +then included in guessing the correct one. That means that e.g. every | |||
| +lexer for HTML and a template language should include <tt class="docutils literal"><span class="pre">\*.html</span></tt> in | |||
| +this list.</dd> | |||
| +<dt><cite>mimetypes</cite></dt> | |||
| +<dd>A list of MIME types for content that can be lexed with this | |||
| +lexer.</dd> | |||
| +</dl> | |||
| +</div> | |||
| +<div class="section" id="formatters"> | |||
| +<h3>Formatters</h3> | |||
| +<p>A formatter (derived from <cite>pygments.formatter.Formatter</cite>) has the following | |||
| +functions:</p> | |||
| +<dl class="docutils"> | |||
| +<dt>def <cite>__init__(self, **options):</cite></dt> | |||
| +<dd><p class="first">As with lexers, this constructor processes options and then must call | |||
| +the base class <cite>__init__</cite>.</p> | |||
| +<p class="last">The <cite>Formatter</cite> class recognizes the options <cite>style</cite>, <cite>full</cite> and | |||
| +<cite>title</cite>. It is up to the formatter class whether it uses them.</p> | |||
| +</dd> | |||
| +<dt>def <cite>get_style_defs(self, arg=''):</cite></dt> | |||
| +<dd><p class="first">This method must return statements or declarations suitable to define | |||
| +the current style for subsequent highlighted text (e.g. CSS classes | |||
| +in the <cite>HTMLFormatter</cite>).</p> | |||
| +<p>The optional argument <cite>arg</cite> can be used to modify the generation and | |||
| +is formatter dependent (it is standardized because it can be given on | |||
| +the command line).</p> | |||
| +<p class="last">This method is called by the <tt class="docutils literal"><span class="pre">-S</span></tt> <a class="reference external" href="./cmdline.html">command-line option</a>, the <cite>arg</cite> | |||
| +is then given by the <tt class="docutils literal"><span class="pre">-a</span></tt> option.</p> | |||
| +</dd> | |||
| +<dt>def <cite>format(self, tokensource, outfile):</cite></dt> | |||
| +<dd><p class="first">This method must format the tokens from the <cite>tokensource</cite> iterable and | |||
| +write the formatted version to the file object <cite>outfile</cite>.</p> | |||
| +<p class="last">Formatter options can control how exactly the tokens are converted.</p> | |||
| +</dd> | |||
| +</dl> | |||
| +<p>A formatter must have the following attributes that are used by the | |||
| +builtin lookup mechanism. (<em>New in Pygments 0.7.</em>)</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>name</cite></dt> | |||
| +<dd>Full name for the formatter, in human-readable form.</dd> | |||
| +<dt><cite>aliases</cite></dt> | |||
| +<dd>A list of short, unique identifiers that can be used to lookup | |||
| +the formatter from a list, e.g. using <cite>get_formatter_by_name()</cite>.</dd> | |||
| +<dt><cite>filenames</cite></dt> | |||
| +<dd>A list of <cite>fnmatch</cite> patterns that match filenames for which this formatter | |||
| +can produce output. The patterns in this list should be unique among | |||
| +all formatters.</dd> | |||
| +</dl> | |||
| +</div> | |||
| +<div class="section" id="option-processing"> | |||
| +<h3>Option processing</h3> | |||
| +<p>The <cite>pygments.util</cite> module has some utility functions usable for option | |||
| +processing:</p> | |||
| +<dl class="docutils"> | |||
| +<dt>class <cite>OptionError</cite></dt> | |||
| +<dd>This exception will be raised by all option processing functions if | |||
| +the type or value of the argument is not correct.</dd> | |||
| +<dt>def <cite>get_bool_opt(options, optname, default=None):</cite></dt> | |||
| +<dd><p class="first">Interpret the key <cite>optname</cite> from the dictionary <cite>options</cite> | |||
| +as a boolean and return it. Return <cite>default</cite> if <cite>optname</cite> | |||
| +is not in <cite>options</cite>.</p> | |||
| +<p class="last">The valid string values for <tt class="docutils literal">True</tt> are <tt class="docutils literal">1</tt>, <tt class="docutils literal">yes</tt>, | |||
| +<tt class="docutils literal">true</tt> and <tt class="docutils literal">on</tt>, the ones for <tt class="docutils literal">False</tt> are <tt class="docutils literal">0</tt>, | |||
| +<tt class="docutils literal">no</tt>, <tt class="docutils literal">false</tt> and <tt class="docutils literal">off</tt> (matched case-insensitively).</p> | |||
| +</dd> | |||
| +<dt>def <cite>get_int_opt(options, optname, default=None):</cite></dt> | |||
| +<dd>As <cite>get_bool_opt</cite>, but interpret the value as an integer.</dd> | |||
| +<dt>def <cite>get_list_opt(options, optname, default=None):</cite></dt> | |||
| +<dd>If the key <cite>optname</cite> from the dictionary <cite>options</cite> is a string, | |||
| +split it at whitespace and return it. If it is already a list | |||
| +or a tuple, it is returned as a list.</dd> | |||
| +<dt>def <cite>get_choice_opt(options, optname, allowed, default=None):</cite></dt> | |||
| +<dd>If the key <cite>optname</cite> from the dictionary is not in the sequence | |||
| +<cite>allowed</cite>, raise an error, otherwise return it. <em>New in Pygments 0.8.</em></dd> | |||
| +</dl> | |||
| +</div> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-02-03 10:39:02.580045 | |||
| + file id: api --> | |||
| +</html> | |||
355
vendor/pygments/docs/build/authors.html
| @@ -0,0 +1,355 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Authors — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Authors</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <p>Pygments is written and maintained by Georg Brandl <<a class="reference external" href="mailto:georg@python.org">georg@python.org</a>>.</p> | |||
| +<p>Major developers are Tim Hatch <<a class="reference external" href="mailto:tim@timhatch.com">tim@timhatch.com</a>> and Armin Ronacher | |||
| +<<a class="reference external" href="mailto:armin.ronacher@active-4.com">armin.ronacher@active-4.com</a>>.</p> | |||
| +<p>Other contributors, listed alphabetically, are:</p> | |||
| +<ul class="simple"> | |||
| +<li>Sam Aaron -- Ioke lexer</li> | |||
| +<li>Kumar Appaiah -- Debian control lexer</li> | |||
| +<li>Ali Afshar -- image formatter</li> | |||
| +<li>Andreas Amann -- AppleScript lexer</li> | |||
| +<li>Jeffrey Arnold -- R/S, Rd, BUGS, Jags, and Stan lexers</li> | |||
| +<li>Jeremy Ashkenas -- CoffeeScript lexer</li> | |||
| +<li>Stefan Matthias Aust -- Smalltalk lexer</li> | |||
| +<li>Ben Bangert -- Mako lexers</li> | |||
| +<li>Max Battcher -- Darcs patch lexer</li> | |||
| +<li>Paul Baumgart, 280 North, Inc. -- Objective-J lexer</li> | |||
| +<li>Michael Bayer -- Myghty lexers</li> | |||
| +<li>John Benediktsson -- Factor lexer</li> | |||
| +<li>Christopher Bertels -- Fancy lexer</li> | |||
| +<li>Jarrett Billingsley -- MiniD lexer</li> | |||
| +<li>Adam Blinkinsop -- Haskell, Redcode lexers</li> | |||
| +<li>Frits van Bommel -- assembler lexers</li> | |||
| +<li>Pierre Bourdon -- bugfixes</li> | |||
| +<li>Hiram Chirino -- Scaml and Jade lexers</li> | |||
| +<li>Ian Cooper -- VGL lexer</li> | |||
| +<li>Leaf Corcoran -- MoonScript lexer</li> | |||
| +<li>Christopher Creutzig -- MuPAD lexer</li> | |||
| +<li>Pete Curry -- bugfixes</li> | |||
| +<li>Owen Durni -- haXe lexer</li> | |||
| +<li>Nick Efford -- Python 3 lexer</li> | |||
| +<li>Sven Efftinge -- Xtend lexer</li> | |||
| +<li>Artem Egorkine -- terminal256 formatter</li> | |||
| +<li>James H. Fisher -- PostScript lexer</li> | |||
| +<li>Carlos Galdino -- Elixir and Elixir Console lexers</li> | |||
| +<li>Michael Galloy -- IDL lexer</li> | |||
| +<li>Naveen Garg -- Autohotkey lexer</li> | |||
| +<li>Laurent Gautier -- R/S lexer</li> | |||
| +<li>Alex Gaynor -- PyPy log lexer</li> | |||
| +<li>Alain Gilbert -- TypeScript lexer</li> | |||
| +<li>Bertrand Goetzmann -- Groovy lexer</li> | |||
| +<li>Krzysiek Goj -- Scala lexer</li> | |||
| +<li>Matt Good -- Genshi, Cheetah lexers</li> | |||
| +<li>Patrick Gotthardt -- PHP namespaces support</li> | |||
| +<li>Olivier Guibe -- Asymptote lexer</li> | |||
| +<li>Jordi Gutiérrez Hermoso -- Octave lexer</li> | |||
| +<li>Martin Harriman -- SNOBOL lexer</li> | |||
| +<li>Matthew Harrison -- SVG formatter</li> | |||
| +<li>Steven Hazel -- Tcl lexer</li> | |||
| +<li>Aslak Hellesøy -- Gherkin lexer</li> | |||
| +<li>Greg Hendershott -- Racket lexer</li> | |||
| +<li>David Hess, Fish Software, Inc. -- Objective-J lexer</li> | |||
| +<li>Varun Hiremath -- Debian control lexer</li> | |||
| +<li>Doug Hogan -- Mscgen lexer</li> | |||
| +<li>Ben Hollis -- Mason lexer</li> | |||
| +<li>Alastair Houghton -- Lexer inheritance facility</li> | |||
| +<li>Tim Howard -- BlitzMax lexer</li> | |||
| +<li>Ivan Inozemtsev -- Fantom lexer</li> | |||
| +<li>Brian R. Jackson -- Tea lexer</li> | |||
| +<li>Dennis Kaarsemaker -- sources.list lexer</li> | |||
| +<li>Igor Kalnitsky -- vhdl lexer</li> | |||
| +<li>Pekka Klärck -- Robot Framework lexer</li> | |||
| +<li>Eric Knibbe -- Lasso lexer</li> | |||
| +<li>Adam Koprowski -- Opa lexer</li> | |||
| +<li>Benjamin Kowarsch -- Modula-2 lexer</li> | |||
| +<li>Alexander Kriegisch -- Kconfig and AspectJ lexers</li> | |||
| +<li>Marek Kubica -- Scheme lexer</li> | |||
| +<li>Jochen Kupperschmidt -- Markdown processor</li> | |||
| +<li>Gerd Kurzbach -- Modelica lexer</li> | |||
| +<li>Jon Larimer, Google Inc. -- Smali lexer</li> | |||
| +<li>Olov Lassus -- Dart lexer</li> | |||
| +<li>Sylvestre Ledru -- Scilab lexer</li> | |||
| +<li>Mark Lee -- Vala lexer</li> | |||
| +<li>Ben Mabey -- Gherkin lexer</li> | |||
| +<li>Angus MacArthur -- QML lexer</li> | |||
| +<li>Simone Margaritelli -- Hybris lexer</li> | |||
| +<li>Kirk McDonald -- D lexer</li> | |||
| +<li>Gordon McGregor -- SystemVerilog lexer</li> | |||
| +<li>Stephen McKamey -- Duel/JBST lexer</li> | |||
| +<li>Brian McKenna -- F# lexer</li> | |||
| +<li>Charles McLaughlin -- Puppet lexer</li> | |||
| +<li>Lukas Meuser -- BBCode formatter, Lua lexer</li> | |||
| +<li>Paul Miller -- LiveScript lexer</li> | |||
| +<li>Hong Minhee -- HTTP lexer</li> | |||
| +<li>Michael Mior -- Awk lexer</li> | |||
| +<li>Bruce Mitchener -- Dylan lexer rewrite</li> | |||
| +<li>Reuben Morais -- SourcePawn lexer</li> | |||
| +<li>Jon Morton -- Rust lexer</li> | |||
| +<li>Paulo Moura -- Logtalk lexer</li> | |||
| +<li>Mher Movsisyan -- DTD lexer</li> | |||
| +<li>Ana Nelson -- Ragel, ANTLR, R console lexers</li> | |||
| +<li>Nam T. Nguyen -- Monokai style</li> | |||
| +<li>Jesper Noehr -- HTML formatter "anchorlinenos"</li> | |||
| +<li>Mike Nolta -- Julia lexer</li> | |||
| +<li>Jonas Obrist -- BBCode lexer</li> | |||
| +<li>David Oliva -- Rebol lexer</li> | |||
| +<li>Jon Parise -- Protocol buffers lexer</li> | |||
| +<li>Ronny Pfannschmidt -- BBCode lexer</li> | |||
| +<li>Benjamin Peterson -- Test suite refactoring</li> | |||
| +<li>Dominik Picheta -- Nimrod lexer</li> | |||
| +<li>Clément Prévost -- UrbiScript lexer</li> | |||
| +<li>Kashif Rasul -- CUDA lexer</li> | |||
| +<li>Justin Reidy -- MXML lexer</li> | |||
| +<li>Norman Richards -- JSON lexer</li> | |||
| +<li>Lubomir Rintel -- GoodData MAQL and CL lexers</li> | |||
| +<li>Andre Roberge -- Tango style</li> | |||
| +<li>Konrad Rudolph -- LaTeX formatter enhancements</li> | |||
| +<li>Mario Ruggier -- Evoque lexers</li> | |||
| +<li>Stou Sandalski -- NumPy, FORTRAN, tcsh and XSLT lexers</li> | |||
| +<li>Matteo Sasso -- Common Lisp lexer</li> | |||
| +<li>Joe Schafer -- Ada lexer</li> | |||
| +<li>Ken Schutte -- Matlab lexers</li> | |||
| +<li>Tassilo Schweyer -- Io, MOOCode lexers</li> | |||
| +<li>Ted Shaw -- AutoIt lexer</li> | |||
| +<li>Joerg Sieker -- ABAP lexer</li> | |||
| +<li>Robert Simmons -- Standard ML lexer</li> | |||
| +<li>Kirill Simonov -- YAML lexer</li> | |||
| +<li>Alexander Smishlajev -- Visual FoxPro lexer</li> | |||
| +<li>Steve Spigarelli -- XQuery lexer</li> | |||
| +<li>Jerome St-Louis -- eC lexer</li> | |||
| +<li>James Strachan -- Kotlin lexer</li> | |||
| +<li>Tom Stuart -- Treetop lexer</li> | |||
| +<li>Tiberius Teng -- default style overhaul</li> | |||
| +<li>Jeremy Thurgood -- Erlang, Squid config lexers</li> | |||
| +<li>Brian Tiffin -- OpenCOBOL lexer</li> | |||
| +<li>Erick Tryzelaar -- Felix lexer</li> | |||
| +<li>Daniele Varrazzo -- PostgreSQL lexers</li> | |||
| +<li>Abe Voelker -- OpenEdge ABL lexer</li> | |||
| +<li>Pepijn de Vos -- HTML formatter CTags support</li> | |||
| +<li>Whitney Young -- ObjectiveC lexer</li> | |||
| +<li>Matthias Vallentin -- Bro lexer</li> | |||
| +<li>Nathan Weizenbaum -- Haml and Sass lexers</li> | |||
| +<li>Dietmar Winkler -- Modelica lexer</li> | |||
| +<li>Nils Winter -- Smalltalk lexer</li> | |||
| +<li>Davy Wybiral -- Clojure lexer</li> | |||
| +<li>Diego Zamboni -- CFengine3 lexer</li> | |||
| +<li>Enrique Zamudio -- Ceylon lexer</li> | |||
| +<li>Alex Zimin -- Nemerle lexer</li> | |||
| +</ul> | |||
| +<p>Many thanks for all contributions!</p> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:43.283022 | |||
| + file id: authors --> | |||
| +</html> | |||
930
vendor/pygments/docs/build/changelog.html
| @@ -0,0 +1,930 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Changelog — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Changelog</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <div class="toc"> | |||
| + <h2>Contents</h2> | |||
| + <ul class="contents"> | |||
| + | |||
| + <li><a href="#version-1-6rc1">Version 1.6rc1</a></li> | |||
| + | |||
| + <li><a href="#version-1-5">Version 1.5</a></li> | |||
| + | |||
| + <li><a href="#version-1-4">Version 1.4</a></li> | |||
| + | |||
| + <li><a href="#version-1-3-1">Version 1.3.1</a></li> | |||
| + | |||
| + <li><a href="#version-1-3">Version 1.3</a></li> | |||
| + | |||
| + <li><a href="#version-1-2-2">Version 1.2.2</a></li> | |||
| + | |||
| + <li><a href="#version-1-2-1">Version 1.2.1</a></li> | |||
| + | |||
| + <li><a href="#version-1-2">Version 1.2</a></li> | |||
| + | |||
| + <li><a href="#version-1-1-1">Version 1.1.1</a></li> | |||
| + | |||
| + <li><a href="#version-1-1">Version 1.1</a></li> | |||
| + | |||
| + <li><a href="#version-1-0">Version 1.0</a></li> | |||
| + | |||
| + <li><a href="#version-0-11-1">Version 0.11.1</a></li> | |||
| + | |||
| + <li><a href="#version-0-11">Version 0.11</a></li> | |||
| + | |||
| + <li><a href="#version-0-10">Version 0.10</a></li> | |||
| + | |||
| + <li><a href="#version-0-9">Version 0.9</a></li> | |||
| + | |||
| + <li><a href="#version-0-8-1">Version 0.8.1</a></li> | |||
| + | |||
| + <li><a href="#version-0-8">Version 0.8</a></li> | |||
| + | |||
| + <li><a href="#version-0-7-1">Version 0.7.1</a></li> | |||
| + | |||
| + <li><a href="#version-0-7">Version 0.7</a></li> | |||
| + | |||
| + <li><a href="#version-0-6">Version 0.6</a></li> | |||
| + | |||
| + <li><a href="#version-0-5-1">Version 0.5.1</a></li> | |||
| + | |||
| + <li><a href="#version-0-5">Version 0.5</a></li> | |||
| + | |||
| + </ul> | |||
| + </div> | |||
| + | |||
| + <p>Issue numbers refer to the tracker at | |||
| +<<a class="reference external" href="http://bitbucket.org/birkenfeld/pygments-main/issues">http://bitbucket.org/birkenfeld/pygments-main/issues</a>>, | |||
| +pull request numbers to the requests at | |||
| +<<a class="reference external" href="http://bitbucket.org/birkenfeld/pygments-main/pull-requests/merged">http://bitbucket.org/birkenfeld/pygments-main/pull-requests/merged</a>>.</p> | |||
| +<div class="section" id="version-1-6rc1"> | |||
| +<h3>Version 1.6rc1</h3> | |||
| +<p>(released Jan 9, 2013)</p> | |||
| +<ul class="simple"> | |||
| +<li>Lexers added:<ul> | |||
| +<li>AspectJ (PR#90)</li> | |||
| +<li>AutoIt (PR#122)</li> | |||
| +<li>BUGS-like languages (PR#89)</li> | |||
| +<li>Ceylon (PR#86)</li> | |||
| +<li>Croc (new name for MiniD)</li> | |||
| +<li>CUDA (PR#75)</li> | |||
| +<li>Dg (PR#116)</li> | |||
| +<li>IDL (PR#115)</li> | |||
| +<li>Jags (PR#89)</li> | |||
| +<li>Julia (PR#61)</li> | |||
| +<li>Kconfig (#711)</li> | |||
| +<li>Lasso (PR#95, PR#113)</li> | |||
| +<li>LiveScript (PR#84)</li> | |||
| +<li>Monkey (PR#117)</li> | |||
| +<li>Mscgen (PR#80)</li> | |||
| +<li>NSIS scripts (PR#136)</li> | |||
| +<li>OpenCOBOL (PR#72)</li> | |||
| +<li>QML (PR#123)</li> | |||
| +<li>Puppet (PR#133)</li> | |||
| +<li>Racket (PR#94)</li> | |||
| +<li>Rdoc (PR#99)</li> | |||
| +<li>Robot Framework (PR#137)</li> | |||
| +<li>RPM spec files (PR#124)</li> | |||
| +<li>Rust (PR#67)</li> | |||
| +<li>Smali (Dalvik assembly)</li> | |||
| +<li>SourcePawn (PR#39)</li> | |||
| +<li>Stan (PR#89)</li> | |||
| +<li>Treetop (PR#125)</li> | |||
| +<li>TypeScript (PR#114)</li> | |||
| +<li>VGL (PR#12)</li> | |||
| +<li>Visual FoxPro (#762)</li> | |||
| +<li>Windows Registry (#819)</li> | |||
| +<li>Xtend (PR#68)</li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>The HTML formatter now supports linking to tags using CTags files, when the | |||
| +python-ctags package is installed (PR#87).</li> | |||
| +<li>The HTML formatter now has a "linespans" option that wraps every line in a | |||
| +<span> tag with a specific id (PR#82).</li> | |||
| +<li>When deriving a lexer from another lexer with token definitions, definitions | |||
| +for states not in the child lexer are now inherited. If you override a state | |||
| +in the child lexer, an "inherit" keyword has been added to insert the base | |||
| +state at that position (PR#141).</li> | |||
| +<li>The C family lexers now inherit token definitions from a common base class, | |||
| +removing code duplication (PR#141).</li> | |||
| +<li>Use "colorama" on Windows for console color output (PR#142).</li> | |||
| +<li>Fix Template Haskell highlighting (PR#63).</li> | |||
| +<li>Fix some S/R lexer errors (PR#91).</li> | |||
| +<li>Fix a bug in the Prolog lexer with names that start with 'is' (#810).</li> | |||
| +<li>Rewrite Dylan lexer, add Dylan LID lexer (PR#147).</li> | |||
| +<li>Add a Java quickstart document (PR#146).</li> | |||
| +<li>Add a "external/autopygmentize" file that can be used as .lessfilter (#802).</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-1-5"> | |||
| +<h3>Version 1.5</h3> | |||
| +<p>(codename Zeitdilatation, released Mar 10, 2012)</p> | |||
| +<ul class="simple"> | |||
| +<li>Lexers added:<ul> | |||
| +<li>Awk (#630)</li> | |||
| +<li>Fancy (#633)</li> | |||
| +<li>PyPy Log</li> | |||
| +<li>eC</li> | |||
| +<li>Nimrod</li> | |||
| +<li>Nemerle (#667)</li> | |||
| +<li>F# (#353)</li> | |||
| +<li>Groovy (#501)</li> | |||
| +<li>PostgreSQL (#660)</li> | |||
| +<li>DTD</li> | |||
| +<li>Gosu (#634)</li> | |||
| +<li>Octave (PR#22)</li> | |||
| +<li>Standard ML (PR#14)</li> | |||
| +<li>CFengine3 (#601)</li> | |||
| +<li>Opa (PR#37)</li> | |||
| +<li>HTTP sessions (PR#42)</li> | |||
| +<li>JSON (PR#31)</li> | |||
| +<li>SNOBOL (PR#30)</li> | |||
| +<li>MoonScript (PR#43)</li> | |||
| +<li>ECL (PR#29)</li> | |||
| +<li>Urbiscript (PR#17)</li> | |||
| +<li>OpenEdge ABL (PR#27)</li> | |||
| +<li>SystemVerilog (PR#35)</li> | |||
| +<li>Coq (#734)</li> | |||
| +<li>PowerShell (#654)</li> | |||
| +<li>Dart (#715)</li> | |||
| +<li>Fantom (PR#36)</li> | |||
| +<li>Bro (PR#5)</li> | |||
| +<li>NewLISP (PR#26)</li> | |||
| +<li>VHDL (PR#45)</li> | |||
| +<li>Scilab (#740)</li> | |||
| +<li>Elixir (PR#57)</li> | |||
| +<li>Tea (PR#56)</li> | |||
| +<li>Kotlin (PR#58)</li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>Fix Python 3 terminal highlighting with pygmentize (#691).</li> | |||
| +<li>In the LaTeX formatter, escape special &, < and > chars (#648).</li> | |||
| +<li>In the LaTeX formatter, fix display problems for styles with token | |||
| +background colors (#670).</li> | |||
| +<li>Enhancements to the Squid conf lexer (#664).</li> | |||
| +<li>Several fixes to the reStructuredText lexer (#636).</li> | |||
| +<li>Recognize methods in the ObjC lexer (#638).</li> | |||
| +<li>Fix Lua "class" highlighting: it does not have classes (#665).</li> | |||
| +<li>Fix degenerate regex in Scala lexer (#671) and highlighting bugs (#713, 708).</li> | |||
| +<li>Fix number pattern order in Ocaml lexer (#647).</li> | |||
| +<li>Fix generic type highlighting in ActionScript 3 (#666).</li> | |||
| +<li>Fixes to the Clojure lexer (PR#9).</li> | |||
| +<li>Fix degenerate regex in Nemerle lexer (#706).</li> | |||
| +<li>Fix infinite looping in CoffeeScript lexer (#729).</li> | |||
| +<li>Fix crashes and analysis with ObjectiveC lexer (#693, #696).</li> | |||
| +<li>Add some Fortran 2003 keywords.</li> | |||
| +<li>Fix Boo string regexes (#679).</li> | |||
| +<li>Add "rrt" style (#727).</li> | |||
| +<li>Fix infinite looping in Darcs Patch lexer.</li> | |||
| +<li>Lots of misc fixes to character-eating bugs and ordering problems in many | |||
| +different lexers.</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-1-4"> | |||
| +<h3>Version 1.4</h3> | |||
| +<p>(codename Unschärfe, released Jan 03, 2011)</p> | |||
| +<ul class="simple"> | |||
| +<li>Lexers added:<ul> | |||
| +<li>Factor (#520)</li> | |||
| +<li>PostScript (#486)</li> | |||
| +<li>Verilog (#491)</li> | |||
| +<li>BlitzMax Basic (#478)</li> | |||
| +<li>Ioke (#465)</li> | |||
| +<li>Java properties, split out of the INI lexer (#445)</li> | |||
| +<li>Scss (#509)</li> | |||
| +<li>Duel/JBST</li> | |||
| +<li>XQuery (#617)</li> | |||
| +<li>Mason (#615)</li> | |||
| +<li>GoodData (#609)</li> | |||
| +<li>SSP (#473)</li> | |||
| +<li>Autohotkey (#417)</li> | |||
| +<li>Google Protocol Buffers</li> | |||
| +<li>Hybris (#506)</li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>Do not fail in analyse_text methods (#618).</li> | |||
| +<li>Performance improvements in the HTML formatter (#523).</li> | |||
| +<li>With the <tt class="docutils literal">noclasses</tt> option in the HTML formatter, some styles | |||
| +present in the stylesheet were not added as inline styles.</li> | |||
| +<li>Four fixes to the Lua lexer (#480, #481, #482, #497).</li> | |||
| +<li>More context-sensitive Gherkin lexer with support for more i18n translations.</li> | |||
| +<li>Support new OO keywords in Matlab lexer (#521).</li> | |||
| +<li>Small fix in the CoffeeScript lexer (#519).</li> | |||
| +<li>A bugfix for backslashes in ocaml strings (#499).</li> | |||
| +<li>Fix unicode/raw docstrings in the Python lexer (#489).</li> | |||
| +<li>Allow PIL to work without PIL.pth (#502).</li> | |||
| +<li>Allow seconds as a unit in CSS (#496).</li> | |||
| +<li>Support <tt class="docutils literal">application/javascript</tt> as a JavaScript mime type (#504).</li> | |||
| +<li>Support <a class="reference external" href="http://offload.codeplay.com">Offload</a> C++ Extensions as | |||
| +keywords in the C++ lexer (#484).</li> | |||
| +<li>Escape more characters in LaTeX output (#505).</li> | |||
| +<li>Update Haml/Sass lexers to version 3 (#509).</li> | |||
| +<li>Small PHP lexer string escaping fix (#515).</li> | |||
| +<li>Support comments before preprocessor directives, and unsigned/ | |||
| +long long literals in C/C++ (#613, #616).</li> | |||
| +<li>Support line continuations in the INI lexer (#494).</li> | |||
| +<li>Fix lexing of Dylan string and char literals (#628).</li> | |||
| +<li>Fix class/procedure name highlighting in VB.NET lexer (#624).</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-1-3-1"> | |||
| +<h3>Version 1.3.1</h3> | |||
| +<p>(bugfix release, released Mar 05, 2010)</p> | |||
| +<ul class="simple"> | |||
| +<li>The <tt class="docutils literal">pygmentize</tt> script was missing from the distribution.</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-1-3"> | |||
| +<h3>Version 1.3</h3> | |||
| +<p>(codename Schneeglöckchen, released Mar 01, 2010)</p> | |||
| +<ul class="simple"> | |||
| +<li>Added the <tt class="docutils literal">ensurenl</tt> lexer option, which can be used to suppress the | |||
| +automatic addition of a newline to the lexer input.</li> | |||
| +<li>Lexers added:<ul> | |||
| +<li>Ada</li> | |||
| +<li>Coldfusion</li> | |||
| +<li>Modula-2</li> | |||
| +<li>haXe</li> | |||
| +<li>R console</li> | |||
| +<li>Objective-J</li> | |||
| +<li>Haml and Sass</li> | |||
| +<li>CoffeeScript</li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>Enhanced reStructuredText highlighting.</li> | |||
| +<li>Added support for PHP 5.3 namespaces in the PHP lexer.</li> | |||
| +<li>Added a bash completion script for <cite>pygmentize</cite>, to the external/ | |||
| +directory (#466).</li> | |||
| +<li>Fixed a bug in <cite>do_insertions()</cite> used for multi-lexer languages.</li> | |||
| +<li>Fixed a Ruby regex highlighting bug (#476).</li> | |||
| +<li>Fixed regex highlighting bugs in Perl lexer (#258).</li> | |||
| +<li>Add small enhancements to the C lexer (#467) and Bash lexer (#469).</li> | |||
| +<li>Small fixes for the Tcl, Debian control file, Nginx config, | |||
| +Smalltalk, Objective-C, Clojure, Lua lexers.</li> | |||
| +<li>Gherkin lexer: Fixed single apostrophe bug and added new i18n keywords.</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-1-2-2"> | |||
| +<h3>Version 1.2.2</h3> | |||
| +<p>(bugfix release, released Jan 02, 2010)</p> | |||
| +<ul class="simple"> | |||
| +<li>Removed a backwards incompatibility in the LaTeX formatter that caused | |||
| +Sphinx to produce invalid commands when writing LaTeX output (#463).</li> | |||
| +<li>Fixed a forever-backtracking regex in the BashLexer (#462).</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-1-2-1"> | |||
| +<h3>Version 1.2.1</h3> | |||
| +<p>(bugfix release, released Jan 02, 2010)</p> | |||
| +<ul class="simple"> | |||
| +<li>Fixed mishandling of an ellipsis in place of the frames in a Python | |||
| +console traceback, resulting in clobbered output.</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-1-2"> | |||
| +<h3>Version 1.2</h3> | |||
| +<p>(codename Neujahr, released Jan 01, 2010)</p> | |||
| +<ul class="simple"> | |||
| +<li>Dropped Python 2.3 compatibility.</li> | |||
| +<li>Lexers added:<ul> | |||
| +<li>Asymptote</li> | |||
| +<li>Go</li> | |||
| +<li>Gherkin (Cucumber)</li> | |||
| +<li>CMake</li> | |||
| +<li>Ooc</li> | |||
| +<li>Coldfusion</li> | |||
| +<li>haXe</li> | |||
| +<li>R console</li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>Added options for rendering LaTeX in source code comments in the | |||
| +LaTeX formatter (#461).</li> | |||
| +<li>Updated the Logtalk lexer.</li> | |||
| +<li>Added <cite>line_number_start</cite> option to image formatter (#456).</li> | |||
| +<li>Added <cite>hl_lines</cite> and <cite>hl_color</cite> options to image formatter (#457).</li> | |||
| +<li>Fixed the HtmlFormatter's handling of noclasses=True to not output any | |||
| +classes (#427).</li> | |||
| +<li>Added the Monokai style (#453).</li> | |||
| +<li>Fixed LLVM lexer identifier syntax and added new keywords (#442).</li> | |||
| +<li>Fixed the PythonTracebackLexer to handle non-traceback data in header or | |||
| +trailer, and support more partial tracebacks that start on line 2 (#437).</li> | |||
| +<li>Fixed the CLexer to not highlight ternary statements as labels.</li> | |||
| +<li>Fixed lexing of some Ruby quoting peculiarities (#460).</li> | |||
| +<li>A few ASM lexer fixes (#450).</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-1-1-1"> | |||
| +<h3>Version 1.1.1</h3> | |||
| +<p>(bugfix release, released Sep 15, 2009)</p> | |||
| +<ul class="simple"> | |||
| +<li>Fixed the BBCode lexer (#435).</li> | |||
| +<li>Added support for new Jinja2 keywords.</li> | |||
| +<li>Fixed test suite failures.</li> | |||
| +<li>Added Gentoo-specific suffixes to Bash lexer.</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-1-1"> | |||
| +<h3>Version 1.1</h3> | |||
| +<p>(codename Brillouin, released Sep 11, 2009)</p> | |||
| +<ul class="simple"> | |||
| +<li>Ported Pygments to Python 3. This needed a few changes in the way | |||
| +encodings are handled; they may affect corner cases when used with | |||
| +Python 2 as well.</li> | |||
| +<li>Lexers added:<ul> | |||
| +<li>Antlr/Ragel, thanks to Ana Nelson</li> | |||
| +<li>(Ba)sh shell</li> | |||
| +<li>Erlang shell</li> | |||
| +<li>GLSL</li> | |||
| +<li>Prolog</li> | |||
| +<li>Evoque</li> | |||
| +<li>Modelica</li> | |||
| +<li>Rebol</li> | |||
| +<li>MXML</li> | |||
| +<li>Cython</li> | |||
| +<li>ABAP</li> | |||
| +<li>ASP.net (VB/C#)</li> | |||
| +<li>Vala</li> | |||
| +<li>Newspeak</li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>Fixed the LaTeX formatter's output so that output generated for one style | |||
| +can be used with the style definitions of another (#384).</li> | |||
| +<li>Added "anchorlinenos" and "noclobber_cssfile" (#396) options to HTML | |||
| +formatter.</li> | |||
| +<li>Support multiline strings in Lua lexer.</li> | |||
| +<li>Rewrite of the JavaScript lexer by Pumbaa80 to better support regular | |||
| +expression literals (#403).</li> | |||
| +<li>When pygmentize is asked to highlight a file for which multiple lexers | |||
| +match the filename, use the analyse_text guessing engine to determine the | |||
| +winner (#355).</li> | |||
| +<li>Fixed minor bugs in the JavaScript lexer (#383), the Matlab lexer (#378), | |||
| +the Scala lexer (#392), the INI lexer (#391), the Clojure lexer (#387) | |||
| +and the AS3 lexer (#389).</li> | |||
| +<li>Fixed three Perl heredoc lexing bugs (#379, #400, #422).</li> | |||
| +<li>Fixed a bug in the image formatter which misdetected lines (#380).</li> | |||
| +<li>Fixed bugs lexing extended Ruby strings and regexes.</li> | |||
| +<li>Fixed a bug when lexing git diffs.</li> | |||
| +<li>Fixed a bug lexing the empty commit in the PHP lexer (#405).</li> | |||
| +<li>Fixed a bug causing Python numbers to be mishighlighted as floats (#397).</li> | |||
| +<li>Fixed a bug when backslashes are used in odd locations in Python (#395).</li> | |||
| +<li>Fixed various bugs in Matlab and S-Plus lexers, thanks to Winston Chang (#410, | |||
| +#411, #413, #414) and fmarc (#419).</li> | |||
| +<li>Fixed a bug in Haskell single-line comment detection (#426).</li> | |||
| +<li>Added new-style reStructuredText directive for docutils 0.5+ (#428).</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-1-0"> | |||
| +<h3>Version 1.0</h3> | |||
| +<p>(codename Dreiundzwanzig, released Nov 23, 2008)</p> | |||
| +<ul> | |||
| +<li><p class="first">Don't use join(splitlines()) when converting newlines to <tt class="docutils literal">\n</tt>, | |||
| +because that doesn't keep all newlines at the end when the | |||
| +<tt class="docutils literal">stripnl</tt> lexer option is False.</p> | |||
| +</li> | |||
| +<li><p class="first">Added <tt class="docutils literal"><span class="pre">-N</span></tt> option to command-line interface to get a lexer name | |||
| +for a given filename.</p> | |||
| +</li> | |||
| +<li><p class="first">Added Tango style, written by Andre Roberge for the Crunchy project.</p> | |||
| +</li> | |||
| +<li><p class="first">Added Python3TracebackLexer and <tt class="docutils literal">python3</tt> option to | |||
| +PythonConsoleLexer.</p> | |||
| +</li> | |||
| +<li><p class="first">Fixed a few bugs in the Haskell lexer.</p> | |||
| +</li> | |||
| +<li><p class="first">Fixed PythonTracebackLexer to be able to recognize SyntaxError and | |||
| +KeyboardInterrupt (#360).</p> | |||
| +</li> | |||
| +<li><p class="first">Provide one formatter class per image format, so that surprises like:</p> | |||
| +<pre class="literal-block"> | |||
| +pygmentize -f gif -o foo.gif foo.py | |||
| +</pre> | |||
| +<p>creating a PNG file are avoided.</p> | |||
| +</li> | |||
| +<li><p class="first">Actually use the <cite>font_size</cite> option of the image formatter.</p> | |||
| +</li> | |||
| +<li><p class="first">Fixed numpy lexer that it doesn't listen for <cite>*.py</cite> any longer.</p> | |||
| +</li> | |||
| +<li><p class="first">Fixed HTML formatter so that text options can be Unicode | |||
| +strings (#371).</p> | |||
| +</li> | |||
| +<li><p class="first">Unified Diff lexer supports the "udiff" alias now.</p> | |||
| +</li> | |||
| +<li><p class="first">Fixed a few issues in Scala lexer (#367).</p> | |||
| +</li> | |||
| +<li><p class="first">RubyConsoleLexer now supports simple prompt mode (#363).</p> | |||
| +</li> | |||
| +<li><p class="first">JavascriptLexer is smarter about what constitutes a regex (#356).</p> | |||
| +</li> | |||
| +<li><p class="first">Add Applescript lexer, thanks to Andreas Amann (#330).</p> | |||
| +</li> | |||
| +<li><p class="first">Make the codetags more strict about matching words (#368).</p> | |||
| +</li> | |||
| +<li><p class="first">NginxConfLexer is a little more accurate on mimetypes and | |||
| +variables (#370).</p> | |||
| +</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-0-11-1"> | |||
| +<h3>Version 0.11.1</h3> | |||
| +<p>(released Aug 24, 2008)</p> | |||
| +<ul class="simple"> | |||
| +<li>Fixed a Jython compatibility issue in pygments.unistring (#358).</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-0-11"> | |||
| +<h3>Version 0.11</h3> | |||
| +<p>(codename Straußenei, released Aug 23, 2008)</p> | |||
| +<p>Many thanks go to Tim Hatch for writing or integrating most of the bug | |||
| +fixes and new features.</p> | |||
| +<ul class="simple"> | |||
| +<li>Lexers added:<ul> | |||
| +<li>Nasm-style assembly language, thanks to delroth</li> | |||
| +<li>YAML, thanks to Kirill Simonov</li> | |||
| +<li>ActionScript 3, thanks to Pierre Bourdon</li> | |||
| +<li>Cheetah/Spitfire templates, thanks to Matt Good</li> | |||
| +<li>Lighttpd config files</li> | |||
| +<li>Nginx config files</li> | |||
| +<li>Gnuplot plotting scripts</li> | |||
| +<li>Clojure</li> | |||
| +<li>POV-Ray scene files</li> | |||
| +<li>Sqlite3 interactive console sessions</li> | |||
| +<li>Scala source files, thanks to Krzysiek Goj</li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>Lexers improved:<ul> | |||
| +<li>C lexer highlights standard library functions now and supports C99 | |||
| +types.</li> | |||
| +<li>Bash lexer now correctly highlights heredocs without preceding | |||
| +whitespace.</li> | |||
| +<li>Vim lexer now highlights hex colors properly and knows a couple | |||
| +more keywords.</li> | |||
| +<li>Irc logs lexer now handles xchat's default time format (#340) and | |||
| +correctly highlights lines ending in <tt class="docutils literal">></tt>.</li> | |||
| +<li>Support more delimiters for perl regular expressions (#258).</li> | |||
| +<li>ObjectiveC lexer now supports 2.0 features.</li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>Added "Visual Studio" style.</li> | |||
| +<li>Updated markdown processor to Markdown 1.7.</li> | |||
| +<li>Support roman/sans/mono style defs and use them in the LaTeX | |||
| +formatter.</li> | |||
| +<li>The RawTokenFormatter is no longer registered to <tt class="docutils literal">*.raw</tt> and it's | |||
| +documented that tokenization with this lexer may raise exceptions.</li> | |||
| +<li>New option <tt class="docutils literal">hl_lines</tt> to HTML formatter, to highlight certain | |||
| +lines.</li> | |||
| +<li>New option <tt class="docutils literal">prestyles</tt> to HTML formatter.</li> | |||
| +<li>New option <em>-g</em> to pygmentize, to allow lexer guessing based on | |||
| +filetext (can be slowish, so file extensions are still checked | |||
| +first).</li> | |||
| +<li><tt class="docutils literal">guess_lexer()</tt> now makes its decision much faster due to a cache | |||
| +of whether data is xml-like (a check which is used in several | |||
| +versions of <tt class="docutils literal">analyse_text()</tt>. Several lexers also have more | |||
| +accurate <tt class="docutils literal">analyse_text()</tt> now.</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-0-10"> | |||
| +<h3>Version 0.10</h3> | |||
| +<p>(codename Malzeug, released May 06, 2008)</p> | |||
| +<ul class="simple"> | |||
| +<li>Lexers added:<ul> | |||
| +<li>Io</li> | |||
| +<li>Smalltalk</li> | |||
| +<li>Darcs patches</li> | |||
| +<li>Tcl</li> | |||
| +<li>Matlab</li> | |||
| +<li>Matlab sessions</li> | |||
| +<li>FORTRAN</li> | |||
| +<li>XSLT</li> | |||
| +<li>tcsh</li> | |||
| +<li>NumPy</li> | |||
| +<li>Python 3</li> | |||
| +<li>S, S-plus, R statistics languages</li> | |||
| +<li>Logtalk</li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>In the LatexFormatter, the <em>commandprefix</em> option is now by default | |||
| +'PY' instead of 'C', since the latter resulted in several collisions | |||
| +with other packages. Also, the special meaning of the <em>arg</em> | |||
| +argument to <tt class="docutils literal">get_style_defs()</tt> was removed.</li> | |||
| +<li>Added ImageFormatter, to format code as PNG, JPG, GIF or BMP. | |||
| +(Needs the Python Imaging Library.)</li> | |||
| +<li>Support doc comments in the PHP lexer.</li> | |||
| +<li>Handle format specifications in the Perl lexer.</li> | |||
| +<li>Fix comment handling in the Batch lexer.</li> | |||
| +<li>Add more file name extensions for the C++, INI and XML lexers.</li> | |||
| +<li>Fixes in the IRC and MuPad lexers.</li> | |||
| +<li>Fix function and interface name highlighting in the Java lexer.</li> | |||
| +<li>Fix at-rule handling in the CSS lexer.</li> | |||
| +<li>Handle KeyboardInterrupts gracefully in pygmentize.</li> | |||
| +<li>Added BlackWhiteStyle.</li> | |||
| +<li>Bash lexer now correctly highlights math, does not require | |||
| +whitespace after semicolons, and correctly highlights boolean | |||
| +operators.</li> | |||
| +<li>Makefile lexer is now capable of handling BSD and GNU make syntax.</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-0-9"> | |||
| +<h3>Version 0.9</h3> | |||
| +<p>(codename Herbstzeitlose, released Oct 14, 2007)</p> | |||
| +<ul class="simple"> | |||
| +<li>Lexers added:<ul> | |||
| +<li>Erlang</li> | |||
| +<li>ActionScript</li> | |||
| +<li>Literate Haskell</li> | |||
| +<li>Common Lisp</li> | |||
| +<li>Various assembly languages</li> | |||
| +<li>Gettext catalogs</li> | |||
| +<li>Squid configuration</li> | |||
| +<li>Debian control files</li> | |||
| +<li>MySQL-style SQL</li> | |||
| +<li>MOOCode</li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>Lexers improved:<ul> | |||
| +<li>Greatly improved the Haskell and OCaml lexers.</li> | |||
| +<li>Improved the Bash lexer's handling of nested constructs.</li> | |||
| +<li>The C# and Java lexers exhibited abysmal performance with some | |||
| +input code; this should now be fixed.</li> | |||
| +<li>The IRC logs lexer is now able to colorize weechat logs too.</li> | |||
| +<li>The Lua lexer now recognizes multi-line comments.</li> | |||
| +<li>Fixed bugs in the D and MiniD lexer.</li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>The encoding handling of the command line mode (pygmentize) was | |||
| +enhanced. You shouldn't get UnicodeErrors from it anymore if you | |||
| +don't give an encoding option.</li> | |||
| +<li>Added a <tt class="docutils literal"><span class="pre">-P</span></tt> option to the command line mode which can be used to | |||
| +give options whose values contain commas or equals signs.</li> | |||
| +<li>Added 256-color terminal formatter.</li> | |||
| +<li>Added an experimental SVG formatter.</li> | |||
| +<li>Added the <tt class="docutils literal">lineanchors</tt> option to the HTML formatter, thanks to | |||
| +Ian Charnas for the idea.</li> | |||
| +<li>Gave the line numbers table a CSS class in the HTML formatter.</li> | |||
| +<li>Added a Vim 7-like style.</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-0-8-1"> | |||
| +<h3>Version 0.8.1</h3> | |||
| +<p>(released Jun 27, 2007)</p> | |||
| +<ul class="simple"> | |||
| +<li>Fixed POD highlighting in the Ruby lexer.</li> | |||
| +<li>Fixed Unicode class and namespace name highlighting in the C# lexer.</li> | |||
| +<li>Fixed Unicode string prefix highlighting in the Python lexer.</li> | |||
| +<li>Fixed a bug in the D and MiniD lexers.</li> | |||
| +<li>Fixed the included MoinMoin parser.</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-0-8"> | |||
| +<h3>Version 0.8</h3> | |||
| +<p>(codename Maikäfer, released May 30, 2007)</p> | |||
| +<ul class="simple"> | |||
| +<li>Lexers added:<ul> | |||
| +<li>Haskell, thanks to Adam Blinkinsop</li> | |||
| +<li>Redcode, thanks to Adam Blinkinsop</li> | |||
| +<li>D, thanks to Kirk McDonald</li> | |||
| +<li>MuPad, thanks to Christopher Creutzig</li> | |||
| +<li>MiniD, thanks to Jarrett Billingsley</li> | |||
| +<li>Vim Script, by Tim Hatch</li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>The HTML formatter now has a second line-numbers mode in which it | |||
| +will just integrate the numbers in the same <tt class="docutils literal"><pre></tt> tag as the | |||
| +code.</li> | |||
| +<li>The <cite>CSharpLexer</cite> now is Unicode-aware, which means that it has an | |||
| +option that can be set so that it correctly lexes Unicode | |||
| +identifiers allowed by the C# specs.</li> | |||
| +<li>Added a <cite>RaiseOnErrorTokenFilter</cite> that raises an exception when the | |||
| +lexer generates an error token, and a <cite>VisibleWhitespaceFilter</cite> that | |||
| +converts whitespace (spaces, tabs, newlines) into visible | |||
| +characters.</li> | |||
| +<li>Fixed the <cite>do_insertions()</cite> helper function to yield correct | |||
| +indices.</li> | |||
| +<li>The ReST lexer now automatically highlights source code blocks in | |||
| +".. sourcecode:: language" and ".. code:: language" directive | |||
| +blocks.</li> | |||
| +<li>Improved the default style (thanks to Tiberius Teng). The old | |||
| +default is still available as the "emacs" style (which was an alias | |||
| +before).</li> | |||
| +<li>The <cite>get_style_defs</cite> method of HTML formatters now uses the | |||
| +<cite>cssclass</cite> option as the default selector if it was given.</li> | |||
| +<li>Improved the ReST and Bash lexers a bit.</li> | |||
| +<li>Fixed a few bugs in the Makefile and Bash lexers, thanks to Tim | |||
| +Hatch.</li> | |||
| +<li>Fixed a bug in the command line code that disallowed <tt class="docutils literal"><span class="pre">-O</span></tt> options | |||
| +when using the <tt class="docutils literal"><span class="pre">-S</span></tt> option.</li> | |||
| +<li>Fixed a bug in the <cite>RawTokenFormatter</cite>.</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-0-7-1"> | |||
| +<h3>Version 0.7.1</h3> | |||
| +<p>(released Feb 15, 2007)</p> | |||
| +<ul class="simple"> | |||
| +<li>Fixed little highlighting bugs in the Python, Java, Scheme and | |||
| +Apache Config lexers.</li> | |||
| +<li>Updated the included manpage.</li> | |||
| +<li>Included a built version of the documentation in the source tarball.</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-0-7"> | |||
| +<h3>Version 0.7</h3> | |||
| +<p>(codename Faschingskrapfn, released Feb 14, 2007)</p> | |||
| +<ul class="simple"> | |||
| +<li>Added a MoinMoin parser that uses Pygments. With it, you get | |||
| +Pygments highlighting in Moin Wiki pages.</li> | |||
| +<li>Changed the exception raised if no suitable lexer, formatter etc. is | |||
| +found in one of the <cite>get_*_by_*</cite> functions to a custom exception, | |||
| +<cite>pygments.util.ClassNotFound</cite>. It is, however, a subclass of | |||
| +<cite>ValueError</cite> in order to retain backwards compatibility.</li> | |||
| +<li>Added a <cite>-H</cite> command line option which can be used to get the | |||
| +docstring of a lexer, formatter or filter.</li> | |||
| +<li>Made the handling of lexers and formatters more consistent. The | |||
| +aliases and filename patterns of formatters are now attributes on | |||
| +them.</li> | |||
| +<li>Added an OCaml lexer, thanks to Adam Blinkinsop.</li> | |||
| +<li>Made the HTML formatter more flexible, and easily subclassable in | |||
| +order to make it easy to implement custom wrappers, e.g. alternate | |||
| +line number markup. See the documentation.</li> | |||
| +<li>Added an <cite>outencoding</cite> option to all formatters, making it possible | |||
| +to override the <cite>encoding</cite> (which is used by lexers and formatters) | |||
| +when using the command line interface. Also, if using the terminal | |||
| +formatter and the output file is a terminal and has an encoding | |||
| +attribute, use it if no encoding is given.</li> | |||
| +<li>Made it possible to just drop style modules into the <cite>styles</cite> | |||
| +subpackage of the Pygments installation.</li> | |||
| +<li>Added a "state" keyword argument to the <cite>using</cite> helper.</li> | |||
| +<li>Added a <cite>commandprefix</cite> option to the <cite>LatexFormatter</cite> which allows | |||
| +to control how the command names are constructed.</li> | |||
| +<li>Added quite a few new lexers, thanks to Tim Hatch:<ul> | |||
| +<li>Java Server Pages</li> | |||
| +<li>Windows batch files</li> | |||
| +<li>Trac Wiki markup</li> | |||
| +<li>Python tracebacks</li> | |||
| +<li>ReStructuredText</li> | |||
| +<li>Dylan</li> | |||
| +<li>and the Befunge esoteric programming language (yay!)</li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>Added Mako lexers by Ben Bangert.</li> | |||
| +<li>Added "fruity" style, another dark background originally vim-based | |||
| +theme.</li> | |||
| +<li>Added sources.list lexer by Dennis Kaarsemaker.</li> | |||
| +<li>Added token stream filters, and a pygmentize option to use them.</li> | |||
| +<li>Changed behavior of <cite>in</cite> Operator for tokens.</li> | |||
| +<li>Added mimetypes for all lexers.</li> | |||
| +<li>Fixed some problems lexing Python strings.</li> | |||
| +<li>Fixed tickets: #167, #178, #179, #180, #185, #201.</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-0-6"> | |||
| +<h3>Version 0.6</h3> | |||
| +<p>(codename Zimtstern, released Dec 20, 2006)</p> | |||
| +<ul class="simple"> | |||
| +<li>Added option for the HTML formatter to write the CSS to an external | |||
| +file in "full document" mode.</li> | |||
| +<li>Added RTF formatter.</li> | |||
| +<li>Added Bash and Apache configuration lexers (thanks to Tim Hatch).</li> | |||
| +<li>Improved guessing methods for various lexers.</li> | |||
| +<li>Added <cite>@media</cite> support to CSS lexer (thanks to Tim Hatch).</li> | |||
| +<li>Added a Groff lexer (thanks to Tim Hatch).</li> | |||
| +<li>License change to BSD.</li> | |||
| +<li>Added lexers for the Myghty template language.</li> | |||
| +<li>Added a Scheme lexer (thanks to Marek Kubica).</li> | |||
| +<li>Added some functions to iterate over existing lexers, formatters and | |||
| +lexers.</li> | |||
| +<li>The HtmlFormatter's <cite>get_style_defs()</cite> can now take a list as an | |||
| +argument to generate CSS with multiple prefixes.</li> | |||
| +<li>Support for guessing input encoding added.</li> | |||
| +<li>Encoding support added: all processing is now done with Unicode | |||
| +strings, input and output are converted from and optionally to byte | |||
| +strings (see the <tt class="docutils literal">encoding</tt> option of lexers and formatters).</li> | |||
| +<li>Some improvements in the C(++) lexers handling comments and line | |||
| +continuations.</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-0-5-1"> | |||
| +<h3>Version 0.5.1</h3> | |||
| +<p>(released Oct 30, 2006)</p> | |||
| +<ul class="simple"> | |||
| +<li>Fixed traceback in <tt class="docutils literal">pygmentize <span class="pre">-L</span></tt> (thanks to Piotr Ozarowski).</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="version-0-5"> | |||
| +<h3>Version 0.5</h3> | |||
| +<p>(codename PyKleur, released Oct 30, 2006)</p> | |||
| +<ul class="simple"> | |||
| +<li>Initial public release.</li> | |||
| +</ul> | |||
| +</div> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:44.022954 | |||
| + file id: changelog --> | |||
| +</html> | |||
353
vendor/pygments/docs/build/cmdline.html
| @@ -0,0 +1,353 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Command Line Interface — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Command Line Interface</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <div class="toc"> | |||
| + <h2>Contents</h2> | |||
| + <ul class="contents"> | |||
| + | |||
| + <li><a href="#options-and-filters">Options and filters</a></li> | |||
| + | |||
| + <li><a href="#generating-styles">Generating styles</a></li> | |||
| + | |||
| + <li><a href="#getting-lexer-names">Getting lexer names</a></li> | |||
| + | |||
| + <li><a href="#getting-help">Getting help</a></li> | |||
| + | |||
| + <li><a href="#a-note-on-encodings">A note on encodings</a></li> | |||
| + | |||
| + </ul> | |||
| + </div> | |||
| + | |||
| + <!-- -*- mode: rst -*- --> | |||
| +<p>You can use Pygments from the shell, provided you installed the <cite>pygmentize</cite> | |||
| +script:</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize test.py | |||
| +print "Hello World" | |||
| +</pre> | |||
| +<p>will print the file test.py to standard output, using the Python lexer | |||
| +(inferred from the file name extension) and the terminal formatter (because | |||
| +you didn't give an explicit formatter name).</p> | |||
| +<p>If you want HTML output:</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize -f html -l python -o test.html test.py | |||
| +</pre> | |||
| +<p>As you can see, the -l option explicitly selects a lexer. As seen above, if you | |||
| +give an input file name and it has an extension that Pygments recognizes, you can | |||
| +omit this option.</p> | |||
| +<p>The <tt class="docutils literal"><span class="pre">-o</span></tt> option gives an output file name. If it is not given, output is | |||
| +written to stdout.</p> | |||
| +<p>The <tt class="docutils literal"><span class="pre">-f</span></tt> option selects a formatter (as with <tt class="docutils literal"><span class="pre">-l</span></tt>, it can also be omitted | |||
| +if an output file name is given and has a supported extension). | |||
| +If no output file name is given and <tt class="docutils literal"><span class="pre">-f</span></tt> is omitted, the | |||
| +<cite>TerminalFormatter</cite> is used.</p> | |||
| +<p>The above command could therefore also be given as:</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize -o test.html test.py | |||
| +</pre> | |||
| +<p>To create a full HTML document, including line numbers and stylesheet (using the | |||
| +"emacs" style), highlighting the Python file <tt class="docutils literal">test.py</tt> to <tt class="docutils literal">test.html</tt>:</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize -O full,style=emacs -o test.html test.py | |||
| +</pre> | |||
| +<div class="section" id="options-and-filters"> | |||
| +<h3>Options and filters</h3> | |||
| +<p>Lexer and formatter options can be given using the <tt class="docutils literal"><span class="pre">-O</span></tt> option:</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize -f html -O style=colorful,linenos=1 -l python test.py | |||
| +</pre> | |||
| +<p>Be sure to enclose the option string in quotes if it contains any special shell | |||
| +characters, such as spaces or expansion wildcards like <tt class="docutils literal">*</tt>. If an option | |||
| +expects a list value, separate the list entries with spaces (you'll have to | |||
| +quote the option value in this case too, so that the shell doesn't split it).</p> | |||
| +<p>Since the <tt class="docutils literal"><span class="pre">-O</span></tt> option argument is split at commas and expects the split values | |||
| +to be of the form <tt class="docutils literal">name=value</tt>, you can't give an option value that contains | |||
| +commas or equals signs. Therefore, an option <tt class="docutils literal"><span class="pre">-P</span></tt> is provided (as of Pygments | |||
| +0.9) that works like <tt class="docutils literal"><span class="pre">-O</span></tt> but can only pass one option per <tt class="docutils literal"><span class="pre">-P</span></tt>. Its value | |||
| +can then contain all characters:</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize -P "heading=Pygments, the Python highlighter" ... | |||
| +</pre> | |||
| +<p>Filters are added to the token stream using the <tt class="docutils literal"><span class="pre">-F</span></tt> option:</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize -f html -l pascal -F keywordcase:case=upper main.pas | |||
| +</pre> | |||
| +<p>As you see, options for the filter are given after a colon. As for <tt class="docutils literal"><span class="pre">-O</span></tt>, the | |||
| +filter name and options must be one shell word, so there may not be any spaces | |||
| +around the colon.</p> | |||
| +</div> | |||
| +<div class="section" id="generating-styles"> | |||
| +<h3>Generating styles</h3> | |||
| +<p>Formatters normally don't output full style information. For example, the HTML | |||
| +formatter by default only outputs <tt class="docutils literal"><span></tt> tags with <tt class="docutils literal">class</tt> attributes. | |||
| +Therefore, there's a special <tt class="docutils literal"><span class="pre">-S</span></tt> option for generating style definitions. | |||
| +Usage is as follows:</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize -f html -S colorful -a .syntax | |||
| +</pre> | |||
| +<p>generates a CSS style sheet (because you selected the HTML formatter) for | |||
| +the "colorful" style prepending a ".syntax" selector to all style rules.</p> | |||
| +<p>For an explanation what <tt class="docutils literal"><span class="pre">-a</span></tt> means for <a class="reference external" href="./formatters.html">a particular formatter</a>, look for | |||
| +the <cite>arg</cite> argument for the formatter's <cite>get_style_defs()</cite> method.</p> | |||
| +</div> | |||
| +<div class="section" id="getting-lexer-names"> | |||
| +<h3>Getting lexer names</h3> | |||
| +<p><em>New in Pygments 1.0.</em></p> | |||
| +<p>The <tt class="docutils literal"><span class="pre">-N</span></tt> option guesses a lexer name for a given filename, so that</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize -N setup.py | |||
| +</pre> | |||
| +<p>will print out <tt class="docutils literal">python</tt>. It won't highlight anything yet. If no specific | |||
| +lexer is known for that filename, <tt class="docutils literal">text</tt> is printed.</p> | |||
| +</div> | |||
| +<div class="section" id="getting-help"> | |||
| +<h3>Getting help</h3> | |||
| +<p>The <tt class="docutils literal"><span class="pre">-L</span></tt> option lists lexers, formatters, along with their short | |||
| +names and supported file name extensions, styles and filters. If you want to see | |||
| +only one category, give it as an argument:</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize -L filters | |||
| +</pre> | |||
| +<p>will list only all installed filters.</p> | |||
| +<p>The <tt class="docutils literal"><span class="pre">-H</span></tt> option will give you detailed information (the same that can be found | |||
| +in this documentation) about a lexer, formatter or filter. Usage is as follows:</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize -H formatter html | |||
| +</pre> | |||
| +<p>will print the help for the HTML formatter, while</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize -H lexer python | |||
| +</pre> | |||
| +<p>will print the help for the Python lexer, etc.</p> | |||
| +</div> | |||
| +<div class="section" id="a-note-on-encodings"> | |||
| +<h3>A note on encodings</h3> | |||
| +<p><em>New in Pygments 0.9.</em></p> | |||
| +<p>Pygments tries to be smart regarding encodings in the formatting process:</p> | |||
| +<ul class="simple"> | |||
| +<li>If you give an <tt class="docutils literal">encoding</tt> option, it will be used as the input and | |||
| +output encoding.</li> | |||
| +<li>If you give an <tt class="docutils literal">outencoding</tt> option, it will override <tt class="docutils literal">encoding</tt> | |||
| +as the output encoding.</li> | |||
| +<li>If you don't give an encoding and have given an output file, the default | |||
| +encoding for lexer and formatter is <tt class="docutils literal">latin1</tt> (which will pass through | |||
| +all non-ASCII characters).</li> | |||
| +<li>If you don't give an encoding and haven't given an output file (that means | |||
| +output is written to the console), the default encoding for lexer and | |||
| +formatter is the terminal encoding (<cite>sys.stdout.encoding</cite>).</li> | |||
| +</ul> | |||
| +</div> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:42.595138 | |||
| + file id: cmdline --> | |||
| +</html> | |||
282
vendor/pygments/docs/build/filterdevelopment.html
| @@ -0,0 +1,282 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Write your own filter — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Write your own filter</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <div class="toc"> | |||
| + <h2>Contents</h2> | |||
| + <ul class="contents"> | |||
| + | |||
| + <li><a href="#subclassing-filters">Subclassing Filters</a></li> | |||
| + | |||
| + <li><a href="#using-a-decorator">Using a decorator</a></li> | |||
| + | |||
| + </ul> | |||
| + </div> | |||
| + | |||
| + <!-- -*- mode: rst -*- --> | |||
| +<p><em>New in Pygments 0.7.</em></p> | |||
| +<p>Writing own filters is very easy. All you have to do is to subclass | |||
| +the <cite>Filter</cite> class and override the <cite>filter</cite> method. Additionally a | |||
| +filter is instanciated with some keyword arguments you can use to | |||
| +adjust the behavior of your filter.</p> | |||
| +<div class="section" id="subclassing-filters"> | |||
| +<h3>Subclassing Filters</h3> | |||
| +<p>As an example, we write a filter that converts all <cite>Name.Function</cite> tokens | |||
| +to normal <cite>Name</cite> tokens to make the output less colorful.</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.util</span> <span class="kn">import</span> <span class="n">get_bool_opt</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="n">Name</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.filter</span> <span class="kn">import</span> <span class="n">Filter</span> | |||
| + | |||
| +<span class="k">class</span> <span class="nc">UncolorFilter</span><span class="p">(</span><span class="n">Filter</span><span class="p">):</span> | |||
| + | |||
| + <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">options</span><span class="p">):</span> | |||
| + <span class="n">Filter</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">options</span><span class="p">)</span> | |||
| + <span class="bp">self</span><span class="o">.</span><span class="n">class_too</span> <span class="o">=</span> <span class="n">get_bool_opt</span><span class="p">(</span><span class="n">options</span><span class="p">,</span> <span class="s">'classtoo'</span><span class="p">)</span> | |||
| + | |||
| + <span class="k">def</span> <span class="nf">filter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">lexer</span><span class="p">,</span> <span class="n">stream</span><span class="p">):</span> | |||
| + <span class="k">for</span> <span class="n">ttype</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">stream</span><span class="p">:</span> | |||
| + <span class="k">if</span> <span class="n">ttype</span> <span class="ow">is</span> <span class="n">Name</span><span class="o">.</span><span class="n">Function</span> <span class="ow">or</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">class_too</span> <span class="ow">and</span> | |||
| + <span class="n">ttype</span> <span class="ow">is</span> <span class="n">Name</span><span class="o">.</span><span class="n">Class</span><span class="p">):</span> | |||
| + <span class="n">ttype</span> <span class="o">=</span> <span class="n">Name</span> | |||
| + <span class="k">yield</span> <span class="n">ttype</span><span class="p">,</span> <span class="n">value</span> | |||
| +</pre></div> | |||
| +<p>Some notes on the <cite>lexer</cite> argument: that can be quite confusing since it doesn't | |||
| +need to be a lexer instance. If a filter was added by using the <cite>add_filter()</cite> | |||
| +function of lexers, that lexer is registered for the filter. In that case | |||
| +<cite>lexer</cite> will refer to the lexer that has registered the filter. It <em>can</em> be used | |||
| +to access options passed to a lexer. Because it could be <cite>None</cite> you always have | |||
| +to check for that case if you access it.</p> | |||
| +</div> | |||
| +<div class="section" id="using-a-decorator"> | |||
| +<h3>Using a decorator</h3> | |||
| +<p>You can also use the <cite>simplefilter</cite> decorator from the <cite>pygments.filter</cite> module:</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.util</span> <span class="kn">import</span> <span class="n">get_bool_opt</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="n">Name</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.filter</span> <span class="kn">import</span> <span class="n">simplefilter</span> | |||
| + | |||
| + | |||
| +<span class="nd">@simplefilter</span> | |||
| +<span class="k">def</span> <span class="nf">uncolor</span><span class="p">(</span><span class="n">lexer</span><span class="p">,</span> <span class="n">stream</span><span class="p">,</span> <span class="n">options</span><span class="p">):</span> | |||
| + <span class="n">class_too</span> <span class="o">=</span> <span class="n">get_bool_opt</span><span class="p">(</span><span class="n">options</span><span class="p">,</span> <span class="s">'classtoo'</span><span class="p">)</span> | |||
| + <span class="k">for</span> <span class="n">ttype</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">stream</span><span class="p">:</span> | |||
| + <span class="k">if</span> <span class="n">ttype</span> <span class="ow">is</span> <span class="n">Name</span><span class="o">.</span><span class="n">Function</span> <span class="ow">or</span> <span class="p">(</span><span class="n">class_too</span> <span class="ow">and</span> | |||
| + <span class="n">ttype</span> <span class="ow">is</span> <span class="n">Name</span><span class="o">.</span><span class="n">Class</span><span class="p">):</span> | |||
| + <span class="n">ttype</span> <span class="o">=</span> <span class="n">Name</span> | |||
| + <span class="k">yield</span> <span class="n">ttype</span><span class="p">,</span> <span class="n">value</span> | |||
| +</pre></div> | |||
| +<p>The decorator automatically subclasses an internal filter class and uses the | |||
| +decorated function for filtering.</p> | |||
| +</div> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:43.509423 | |||
| + file id: filterdevelopment --> | |||
| +</html> | |||
412
vendor/pygments/docs/build/filters.html
| @@ -0,0 +1,412 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Filters — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Filters</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <div class="toc"> | |||
| + <h2>Contents</h2> | |||
| + <ul class="contents"> | |||
| + | |||
| + <li><a href="#builtin-filters">Builtin Filters</a></li> | |||
| + | |||
| + </ul> | |||
| + </div> | |||
| + | |||
| + <!-- -*- mode: rst -*- --> | |||
| +<p><em>New in Pygments 0.7.</em></p> | |||
| +<p>You can filter token streams coming from lexers to improve or annotate the | |||
| +output. For example, you can highlight special words in comments, convert | |||
| +keywords to upper or lowercase to enforce a style guide etc.</p> | |||
| +<p>To apply a filter, you can use the <cite>add_filter()</cite> method of a lexer:</p> | |||
| +<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.lexers</span> <span class="kn">import</span> <span class="n">PythonLexer</span> | |||
| +<span class="gp">>>> </span><span class="n">l</span> <span class="o">=</span> <span class="n">PythonLexer</span><span class="p">()</span> | |||
| +<span class="gp">>>> </span><span class="c"># add a filter given by a string and options</span> | |||
| +<span class="gp">>>> </span><span class="n">l</span><span class="o">.</span><span class="n">add_filter</span><span class="p">(</span><span class="s">'codetagify'</span><span class="p">,</span> <span class="n">case</span><span class="o">=</span><span class="s">'lower'</span><span class="p">)</span> | |||
| +<span class="gp">>>> </span><span class="n">l</span><span class="o">.</span><span class="n">filters</span> | |||
| +<span class="go">[<pygments.filters.CodeTagFilter object at 0xb785decc>]</span> | |||
| +<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.filters</span> <span class="kn">import</span> <span class="n">KeywordCaseFilter</span> | |||
| +<span class="gp">>>> </span><span class="c"># or give an instance</span> | |||
| +<span class="gp">>>> </span><span class="n">l</span><span class="o">.</span><span class="n">add_filter</span><span class="p">(</span><span class="n">KeywordCaseFilter</span><span class="p">(</span><span class="n">case</span><span class="o">=</span><span class="s">'lower'</span><span class="p">))</span> | |||
| +</pre></div> | |||
| +<p>The <cite>add_filter()</cite> method takes keyword arguments which are forwarded to | |||
| +the constructor of the filter.</p> | |||
| +<p>To get a list of all registered filters by name, you can use the | |||
| +<cite>get_all_filters()</cite> function from the <cite>pygments.filters</cite> module that returns an | |||
| +iterable for all known filters.</p> | |||
| +<p>If you want to write your own filter, have a look at <a class="reference external" href="./filterdevelopment.html">Write your own filter</a>.</p> | |||
| +<div class="section" id="builtin-filters"> | |||
| +<h3>Builtin Filters</h3> | |||
| +<p><cite>RaiseOnErrorTokenFilter</cite></p> | |||
| +<blockquote> | |||
| +<p>Raise an exception when the lexer generates an error token.</p> | |||
| +<p>Options accepted:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>excclass</cite> <span class="classifier-delimiter">:</span> <span class="classifier">Exception class</span></dt> | |||
| +<dd>The exception class to raise. | |||
| +The default is <cite>pygments.filters.ErrorToken</cite>.</dd> | |||
| +</dl> | |||
| +<p><em>New in Pygments 0.8.</em></p> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Name:</th><td class="field-body">raiseonerror</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +<p><cite>VisibleWhitespaceFilter</cite></p> | |||
| +<blockquote> | |||
| +<p>Convert tabs, newlines and/or spaces to visible characters.</p> | |||
| +<p>Options accepted:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>spaces</cite> <span class="classifier-delimiter">:</span> <span class="classifier">string or bool</span></dt> | |||
| +<dd>If this is a one-character string, spaces will be replaces by this string. | |||
| +If it is another true value, spaces will be replaced by <tt class="docutils literal">·</tt> (unicode | |||
| +MIDDLE DOT). If it is a false value, spaces will not be replaced. The | |||
| +default is <tt class="docutils literal">False</tt>.</dd> | |||
| +<dt><cite>tabs</cite> <span class="classifier-delimiter">:</span> <span class="classifier">string or bool</span></dt> | |||
| +<dd>The same as for <cite>spaces</cite>, but the default replacement character is <tt class="docutils literal">»</tt> | |||
| +(unicode RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK). The default value | |||
| +is <tt class="docutils literal">False</tt>. Note: this will not work if the <cite>tabsize</cite> option for the | |||
| +lexer is nonzero, as tabs will already have been expanded then.</dd> | |||
| +<dt><cite>tabsize</cite> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt> | |||
| +<dd>If tabs are to be replaced by this filter (see the <cite>tabs</cite> option), this | |||
| +is the total number of characters that a tab should be expanded to. | |||
| +The default is <tt class="docutils literal">8</tt>.</dd> | |||
| +<dt><cite>newlines</cite> <span class="classifier-delimiter">:</span> <span class="classifier">string or bool</span></dt> | |||
| +<dd>The same as for <cite>spaces</cite>, but the default replacement character is <tt class="docutils literal">¶</tt> | |||
| +(unicode PILCROW SIGN). The default value is <tt class="docutils literal">False</tt>.</dd> | |||
| +<dt><cite>wstokentype</cite> <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt> | |||
| +<dd>If true, give whitespace the special <cite>Whitespace</cite> token type. This allows | |||
| +styling the visible whitespace differently (e.g. greyed out), but it can | |||
| +disrupt background colors. The default is <tt class="docutils literal">True</tt>.</dd> | |||
| +</dl> | |||
| +<p><em>New in Pygments 0.8.</em></p> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Name:</th><td class="field-body">whitespace</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +<p><cite>TokenMergeFilter</cite></p> | |||
| +<blockquote> | |||
| +<p>Merges consecutive tokens with the same token type in the output stream of a | |||
| +lexer.</p> | |||
| +<p><em>New in Pygments 1.2.</em></p> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Name:</th><td class="field-body">tokenmerge</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +<p><cite>NameHighlightFilter</cite></p> | |||
| +<blockquote> | |||
| +<p>Highlight a normal Name token with a different token type.</p> | |||
| +<p>Example:</p> | |||
| +<pre class="literal-block"> | |||
| +filter = NameHighlightFilter( | |||
| + names=['foo', 'bar', 'baz'], | |||
| + tokentype=Name.Function, | |||
| +) | |||
| +</pre> | |||
| +<p>This would highlight the names "foo", "bar" and "baz" | |||
| +as functions. <cite>Name.Function</cite> is the default token type.</p> | |||
| +<p>Options accepted:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>names</cite> <span class="classifier-delimiter">:</span> <span class="classifier">list of strings</span></dt> | |||
| +<dd>A list of names that should be given the different token type. | |||
| +There is no default.</dd> | |||
| +<dt><cite>tokentype</cite> <span class="classifier-delimiter">:</span> <span class="classifier">TokenType or string</span></dt> | |||
| +<dd>A token type or a string containing a token type name that is | |||
| +used for highlighting the strings in <cite>names</cite>. The default is | |||
| +<cite>Name.Function</cite>.</dd> | |||
| +</dl> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Name:</th><td class="field-body">highlight</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +<p><cite>GobbleFilter</cite></p> | |||
| +<blockquote> | |||
| +<p>Gobbles source code lines (eats initial characters).</p> | |||
| +<p>This filter drops the first <tt class="docutils literal">n</tt> characters off every line of code. This | |||
| +may be useful when the source code fed to the lexer is indented by a fixed | |||
| +amount of space that isn't desired in the output.</p> | |||
| +<p>Options accepted:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>n</cite> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt> | |||
| +<dd>The number of characters to gobble.</dd> | |||
| +</dl> | |||
| +<p><em>New in Pygments 1.2.</em></p> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Name:</th><td class="field-body">gobble</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +<p><cite>CodeTagFilter</cite></p> | |||
| +<blockquote> | |||
| +<p>Highlight special code tags in comments and docstrings.</p> | |||
| +<p>Options accepted:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>codetags</cite> <span class="classifier-delimiter">:</span> <span class="classifier">list of strings</span></dt> | |||
| +<dd>A list of strings that are flagged as code tags. The default is to | |||
| +highlight <tt class="docutils literal">XXX</tt>, <tt class="docutils literal">TODO</tt>, <tt class="docutils literal">BUG</tt> and <tt class="docutils literal">NOTE</tt>.</dd> | |||
| +</dl> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Name:</th><td class="field-body">codetagify</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +<p><cite>KeywordCaseFilter</cite></p> | |||
| +<blockquote> | |||
| +<p>Convert keywords to lowercase or uppercase or capitalize them, which | |||
| +means first letter uppercase, rest lowercase.</p> | |||
| +<p>This can be useful e.g. if you highlight Pascal code and want to adapt the | |||
| +code to your styleguide.</p> | |||
| +<p>Options accepted:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>case</cite> <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt> | |||
| +<dd>The casing to convert keywords to. Must be one of <tt class="docutils literal">'lower'</tt>, | |||
| +<tt class="docutils literal">'upper'</tt> or <tt class="docutils literal">'capitalize'</tt>. The default is <tt class="docutils literal">'lower'</tt>.</dd> | |||
| +</dl> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Name:</th><td class="field-body">keywordcase</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +</div> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:43.414990 | |||
| + file id: filters --> | |||
| +</html> | |||
374
vendor/pygments/docs/build/formatterdevelopment.html
| @@ -0,0 +1,374 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Write your own formatter — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Write your own formatter</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <div class="toc"> | |||
| + <h2>Contents</h2> | |||
| + <ul class="contents"> | |||
| + | |||
| + <li><a href="#quickstart">Quickstart</a></li> | |||
| + | |||
| + <li><a href="#styles">Styles</a></li> | |||
| + | |||
| + <li><a href="#html-3-2-formatter">HTML 3.2 Formatter</a></li> | |||
| + | |||
| + <li><a href="#generating-style-definitions">Generating Style Definitions</a></li> | |||
| + | |||
| + </ul> | |||
| + </div> | |||
| + | |||
| + <!-- -*- mode: rst -*- --> | |||
| +<p>As well as creating <a class="reference external" href="./lexerdevelopment.html">your own lexer</a>, writing a new | |||
| +formatter for Pygments is easy and straightforward.</p> | |||
| +<p>A formatter is a class that is initialized with some keyword arguments (the | |||
| +formatter options) and that must provides a <cite>format()</cite> method. | |||
| +Additionally a formatter should provide a <cite>get_style_defs()</cite> method that | |||
| +returns the style definitions from the style in a form usable for the | |||
| +formatter's output format.</p> | |||
| +<div class="section" id="quickstart"> | |||
| +<h3>Quickstart</h3> | |||
| +<p>The most basic formatter shipped with Pygments is the <cite>NullFormatter</cite>. It just | |||
| +sends the value of a token to the output stream:</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.formatter</span> <span class="kn">import</span> <span class="n">Formatter</span> | |||
| + | |||
| +<span class="k">class</span> <span class="nc">NullFormatter</span><span class="p">(</span><span class="n">Formatter</span><span class="p">):</span> | |||
| + <span class="k">def</span> <span class="nf">format</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tokensource</span><span class="p">,</span> <span class="n">outfile</span><span class="p">):</span> | |||
| + <span class="k">for</span> <span class="n">ttype</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">tokensource</span><span class="p">:</span> | |||
| + <span class="n">outfile</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> | |||
| +</pre></div> | |||
| +<p>As you can see, the <cite>format()</cite> method is passed two parameters: <cite>tokensource</cite> | |||
| +and <cite>outfile</cite>. The first is an iterable of <tt class="docutils literal">(token_type, value)</tt> tuples, | |||
| +the latter a file like object with a <cite>write()</cite> method.</p> | |||
| +<p>Because the formatter is that basic it doesn't overwrite the <cite>get_style_defs()</cite> | |||
| +method.</p> | |||
| +</div> | |||
| +<div class="section" id="styles"> | |||
| +<h3>Styles</h3> | |||
| +<p>Styles aren't instantiated but their metaclass provides some class functions | |||
| +so that you can access the style definitions easily.</p> | |||
| +<p>Styles are iterable and yield tuples in the form <tt class="docutils literal">(ttype, d)</tt> where <cite>ttype</cite> | |||
| +is a token and <cite>d</cite> is a dict with the following keys:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><tt class="docutils literal">'color'</tt></dt> | |||
| +<dd>Hexadecimal color value (eg: <tt class="docutils literal">'ff0000'</tt> for red) or <cite>None</cite> if not | |||
| +defined.</dd> | |||
| +<dt><tt class="docutils literal">'bold'</tt></dt> | |||
| +<dd><cite>True</cite> if the value should be bold</dd> | |||
| +<dt><tt class="docutils literal">'italic'</tt></dt> | |||
| +<dd><cite>True</cite> if the value should be italic</dd> | |||
| +<dt><tt class="docutils literal">'underline'</tt></dt> | |||
| +<dd><cite>True</cite> if the value should be underlined</dd> | |||
| +<dt><tt class="docutils literal">'bgcolor'</tt></dt> | |||
| +<dd>Hexadecimal color value for the background (eg: <tt class="docutils literal">'eeeeeee'</tt> for light | |||
| +gray) or <cite>None</cite> if not defined.</dd> | |||
| +<dt><tt class="docutils literal">'border'</tt></dt> | |||
| +<dd>Hexadecimal color value for the border (eg: <tt class="docutils literal">'0000aa'</tt> for a dark | |||
| +blue) or <cite>None</cite> for no border.</dd> | |||
| +</dl> | |||
| +<p>Additional keys might appear in the future, formatters should ignore all keys | |||
| +they don't support.</p> | |||
| +</div> | |||
| +<div class="section" id="html-3-2-formatter"> | |||
| +<h3>HTML 3.2 Formatter</h3> | |||
| +<p>For an more complex example, let's implement a HTML 3.2 Formatter. We don't | |||
| +use CSS but inline markup (<tt class="docutils literal"><u></tt>, <tt class="docutils literal"><font></tt>, etc). Because this isn't good | |||
| +style this formatter isn't in the standard library ;-)</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.formatter</span> <span class="kn">import</span> <span class="n">Formatter</span> | |||
| + | |||
| +<span class="k">class</span> <span class="nc">OldHtmlFormatter</span><span class="p">(</span><span class="n">Formatter</span><span class="p">):</span> | |||
| + | |||
| + <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">options</span><span class="p">):</span> | |||
| + <span class="n">Formatter</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">options</span><span class="p">)</span> | |||
| + | |||
| + <span class="c"># create a dict of (start, end) tuples that wrap the</span> | |||
| + <span class="c"># value of a token so that we can use it in the format</span> | |||
| + <span class="c"># method later</span> | |||
| + <span class="bp">self</span><span class="o">.</span><span class="n">styles</span> <span class="o">=</span> <span class="p">{}</span> | |||
| + | |||
| + <span class="c"># we iterate over the `_styles` attribute of a style item</span> | |||
| + <span class="c"># that contains the parsed style values.</span> | |||
| + <span class="k">for</span> <span class="n">token</span><span class="p">,</span> <span class="n">style</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">style</span><span class="p">:</span> | |||
| + <span class="n">start</span> <span class="o">=</span> <span class="n">end</span> <span class="o">=</span> <span class="s">''</span> | |||
| + <span class="c"># a style item is a tuple in the following form:</span> | |||
| + <span class="c"># colors are readily specified in hex: 'RRGGBB'</span> | |||
| + <span class="k">if</span> <span class="n">style</span><span class="p">[</span><span class="s">'color'</span><span class="p">]:</span> | |||
| + <span class="n">start</span> <span class="o">+=</span> <span class="s">'<font color="#</span><span class="si">%s</span><span class="s">">'</span> <span class="o">%</span> <span class="n">style</span><span class="p">[</span><span class="s">'color'</span><span class="p">]</span> | |||
| + <span class="n">end</span> <span class="o">=</span> <span class="s">'</font>'</span> <span class="o">+</span> <span class="n">end</span> | |||
| + <span class="k">if</span> <span class="n">style</span><span class="p">[</span><span class="s">'bold'</span><span class="p">]:</span> | |||
| + <span class="n">start</span> <span class="o">+=</span> <span class="s">'<b>'</span> | |||
| + <span class="n">end</span> <span class="o">=</span> <span class="s">'</b>'</span> <span class="o">+</span> <span class="n">end</span> | |||
| + <span class="k">if</span> <span class="n">style</span><span class="p">[</span><span class="s">'italic'</span><span class="p">]:</span> | |||
| + <span class="n">start</span> <span class="o">+=</span> <span class="s">'<i>'</span> | |||
| + <span class="n">end</span> <span class="o">=</span> <span class="s">'</i>'</span> <span class="o">+</span> <span class="n">end</span> | |||
| + <span class="k">if</span> <span class="n">style</span><span class="p">[</span><span class="s">'underline'</span><span class="p">]:</span> | |||
| + <span class="n">start</span> <span class="o">+=</span> <span class="s">'<u>'</span> | |||
| + <span class="n">end</span> <span class="o">=</span> <span class="s">'</u>'</span> <span class="o">+</span> <span class="n">end</span> | |||
| + <span class="bp">self</span><span class="o">.</span><span class="n">styles</span><span class="p">[</span><span class="n">token</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> | |||
| + | |||
| + <span class="k">def</span> <span class="nf">format</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tokensource</span><span class="p">,</span> <span class="n">outfile</span><span class="p">):</span> | |||
| + <span class="c"># lastval is a string we use for caching</span> | |||
| + <span class="c"># because it's possible that an lexer yields a number</span> | |||
| + <span class="c"># of consecutive tokens with the same token type.</span> | |||
| + <span class="c"># to minimize the size of the generated html markup we</span> | |||
| + <span class="c"># try to join the values of same-type tokens here</span> | |||
| + <span class="n">lastval</span> <span class="o">=</span> <span class="s">''</span> | |||
| + <span class="n">lasttype</span> <span class="o">=</span> <span class="bp">None</span> | |||
| + | |||
| + <span class="c"># wrap the whole output with <pre></span> | |||
| + <span class="n">outfile</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">'<pre>'</span><span class="p">)</span> | |||
| + | |||
| + <span class="k">for</span> <span class="n">ttype</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">tokensource</span><span class="p">:</span> | |||
| + <span class="c"># if the token type doesn't exist in the stylemap</span> | |||
| + <span class="c"># we try it with the parent of the token type</span> | |||
| + <span class="c"># eg: parent of Token.Literal.String.Double is</span> | |||
| + <span class="c"># Token.Literal.String</span> | |||
| + <span class="k">while</span> <span class="n">ttype</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">styles</span><span class="p">:</span> | |||
| + <span class="n">ttype</span> <span class="o">=</span> <span class="n">ttype</span><span class="o">.</span><span class="n">parent</span> | |||
| + <span class="k">if</span> <span class="n">ttype</span> <span class="o">==</span> <span class="n">lasttype</span><span class="p">:</span> | |||
| + <span class="c"># the current token type is the same of the last</span> | |||
| + <span class="c"># iteration. cache it</span> | |||
| + <span class="n">lastval</span> <span class="o">+=</span> <span class="n">value</span> | |||
| + <span class="k">else</span><span class="p">:</span> | |||
| + <span class="c"># not the same token as last iteration, but we</span> | |||
| + <span class="c"># have some data in the buffer. wrap it with the</span> | |||
| + <span class="c"># defined style and write it to the output file</span> | |||
| + <span class="k">if</span> <span class="n">lastval</span><span class="p">:</span> | |||
| + <span class="n">stylebegin</span><span class="p">,</span> <span class="n">styleend</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">styles</span><span class="p">[</span><span class="n">lasttype</span><span class="p">]</span> | |||
| + <span class="n">outfile</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">stylebegin</span> <span class="o">+</span> <span class="n">lastval</span> <span class="o">+</span> <span class="n">styleend</span><span class="p">)</span> | |||
| + <span class="c"># set lastval/lasttype to current values</span> | |||
| + <span class="n">lastval</span> <span class="o">=</span> <span class="n">value</span> | |||
| + <span class="n">lasttype</span> <span class="o">=</span> <span class="n">ttype</span> | |||
| + | |||
| + <span class="c"># if something is left in the buffer, write it to the</span> | |||
| + <span class="c"># output file, then close the opened <pre> tag</span> | |||
| + <span class="k">if</span> <span class="n">lastval</span><span class="p">:</span> | |||
| + <span class="n">stylebegin</span><span class="p">,</span> <span class="n">styleend</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">styles</span><span class="p">[</span><span class="n">lasttype</span><span class="p">]</span> | |||
| + <span class="n">outfile</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">stylebegin</span> <span class="o">+</span> <span class="n">lastval</span> <span class="o">+</span> <span class="n">styleend</span><span class="p">)</span> | |||
| + <span class="n">outfile</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">'</pre></span><span class="se">\n</span><span class="s">'</span><span class="p">)</span> | |||
| +</pre></div> | |||
| +<p>The comments should explain it. Again, this formatter doesn't override the | |||
| +<cite>get_style_defs()</cite> method. If we would have used CSS classes instead of | |||
| +inline HTML markup, we would need to generate the CSS first. For that | |||
| +purpose the <cite>get_style_defs()</cite> method exists:</p> | |||
| +</div> | |||
| +<div class="section" id="generating-style-definitions"> | |||
| +<h3>Generating Style Definitions</h3> | |||
| +<p>Some formatters like the <cite>LatexFormatter</cite> and the <cite>HtmlFormatter</cite> don't | |||
| +output inline markup but reference either macros or css classes. Because | |||
| +the definitions of those are not part of the output, the <cite>get_style_defs()</cite> | |||
| +method exists. It is passed one parameter (if it's used and how it's used | |||
| +is up to the formatter) and has to return a string or <tt class="docutils literal">None</tt>.</p> | |||
| +</div> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:42.995351 | |||
| + file id: formatterdevelopment --> | |||
| +</html> | |||
927
vendor/pygments/docs/build/formatters.html
| @@ -0,0 +1,927 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Available formatters — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Available formatters</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <div class="toc"> | |||
| + <h2>Contents</h2> | |||
| + <ul class="contents"> | |||
| + | |||
| + <li><a href="#common-options">Common options</a></li> | |||
| + | |||
| + <li><a href="#formatter-classes">Formatter classes</a></li> | |||
| + | |||
| + </ul> | |||
| + </div> | |||
| + | |||
| + <!-- -*- mode: rst -*- --> | |||
| +<p>This page lists all builtin formatters.</p> | |||
| +<div class="section" id="common-options"> | |||
| +<h3>Common options</h3> | |||
| +<p>All formatters support these options:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>encoding</cite></dt> | |||
| +<dd><p class="first"><em>New in Pygments 0.6.</em></p> | |||
| +<p>If given, must be an encoding name (such as <tt class="docutils literal"><span class="pre">"utf-8"</span></tt>). This will | |||
| +be used to convert the token strings (which are Unicode strings) | |||
| +to byte strings in the output (default: <tt class="docutils literal">None</tt>). | |||
| +It will also be written in an encoding declaration suitable for the | |||
| +document format if the <cite>full</cite> option is given (e.g. a <tt class="docutils literal">meta | |||
| +<span class="pre">content-type</span></tt> directive in HTML or an invocation of the <cite>inputenc</cite> | |||
| +package in LaTeX).</p> | |||
| +<p class="last">If this is <tt class="docutils literal">""</tt> or <tt class="docutils literal">None</tt>, Unicode strings will be written | |||
| +to the output file, which most file-like objects do not support. | |||
| +For example, <cite>pygments.highlight()</cite> will return a Unicode string if | |||
| +called with no <cite>outfile</cite> argument and a formatter that has <cite>encoding</cite> | |||
| +set to <tt class="docutils literal">None</tt> because it uses a <cite>StringIO.StringIO</cite> object that | |||
| +supports Unicode arguments to <cite>write()</cite>. Using a regular file object | |||
| +wouldn't work.</p> | |||
| +</dd> | |||
| +<dt><cite>outencoding</cite></dt> | |||
| +<dd><p class="first"><em>New in Pygments 0.7.</em></p> | |||
| +<p class="last">When using Pygments from the command line, any <cite>encoding</cite> option given is | |||
| +passed to the lexer and the formatter. This is sometimes not desirable, | |||
| +for example if you want to set the input encoding to <tt class="docutils literal">"guess"</tt>. | |||
| +Therefore, <cite>outencoding</cite> has been introduced which overrides <cite>encoding</cite> | |||
| +for the formatter if given.</p> | |||
| +</dd> | |||
| +</dl> | |||
| +</div> | |||
| +<div class="section" id="formatter-classes"> | |||
| +<h3>Formatter classes</h3> | |||
| +<p>All these classes are importable from <cite>pygments.formatters</cite>.</p> | |||
| +<div class="section" id="bbcodeformatter"> | |||
| +<h4><cite>BBCodeFormatter</cite></h4> | |||
| +<blockquote> | |||
| +<p>Format tokens with BBcodes. These formatting codes are used by many | |||
| +bulletin boards, so you can highlight your sourcecode with pygments before | |||
| +posting it there.</p> | |||
| +<p>This formatter has no support for background colors and borders, as there | |||
| +are no common BBcode tags for that.</p> | |||
| +<p>Some board systems (e.g. phpBB) don't support colors in their [code] tag, | |||
| +so you can't use the highlighting together with that tag. | |||
| +Text in a [code] tag usually is shown with a monospace font (which this | |||
| +formatter can do with the <tt class="docutils literal">monofont</tt> option) and no spaces (which you | |||
| +need for indentation) are removed.</p> | |||
| +<p>Additional options accepted:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>style</cite></dt> | |||
| +<dd>The style to use, can be a string or a Style subclass (default: | |||
| +<tt class="docutils literal">'default'</tt>).</dd> | |||
| +<dt><cite>codetag</cite></dt> | |||
| +<dd>If set to true, put the output into <tt class="docutils literal">[code]</tt> tags (default: | |||
| +<tt class="docutils literal">false</tt>)</dd> | |||
| +<dt><cite>monofont</cite></dt> | |||
| +<dd>If set to true, add a tag to show the code with a monospace font | |||
| +(default: <tt class="docutils literal">false</tt>).</dd> | |||
| +</dl> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Short names:</th><td class="field-body">bbcode, bb</td> | |||
| +</tr> | |||
| +<tr class="field"><th class="field-name">Filename patterns:</th><td class="field-body">None</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +</div> | |||
| +<div class="section" id="bmpimageformatter"> | |||
| +<h4><cite>BmpImageFormatter</cite></h4> | |||
| +<blockquote> | |||
| +<p>Create a bitmap image from source code. This uses the Python Imaging Library to | |||
| +generate a pixmap from the source code.</p> | |||
| +<p><em>New in Pygments 1.0.</em> (You could create bitmap images before by passing a | |||
| +suitable <cite>image_format</cite> option to the <cite>ImageFormatter</cite>.)</p> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Short names:</th><td class="field-body">bmp, bitmap</td> | |||
| +</tr> | |||
| +<tr class="field"><th class="field-name">Filename patterns:</th><td class="field-body">*.bmp</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +</div> | |||
| +<div class="section" id="gifimageformatter"> | |||
| +<h4><cite>GifImageFormatter</cite></h4> | |||
| +<blockquote> | |||
| +<p>Create a GIF image from source code. This uses the Python Imaging Library to | |||
| +generate a pixmap from the source code.</p> | |||
| +<p><em>New in Pygments 1.0.</em> (You could create GIF images before by passing a | |||
| +suitable <cite>image_format</cite> option to the <cite>ImageFormatter</cite>.)</p> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Short names:</th><td class="field-body">gif</td> | |||
| +</tr> | |||
| +<tr class="field"><th class="field-name">Filename patterns:</th><td class="field-body">*.gif</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +</div> | |||
| +<div class="section" id="htmlformatter"> | |||
| +<h4><cite>HtmlFormatter</cite></h4> | |||
| +<blockquote> | |||
| +<p>Format tokens as HTML 4 <tt class="docutils literal"><span></tt> tags within a <tt class="docutils literal"><pre></tt> tag, wrapped | |||
| +in a <tt class="docutils literal"><div></tt> tag. The <tt class="docutils literal"><div></tt>'s CSS class can be set by the <cite>cssclass</cite> | |||
| +option.</p> | |||
| +<p>If the <cite>linenos</cite> option is set to <tt class="docutils literal">"table"</tt>, the <tt class="docutils literal"><pre></tt> is | |||
| +additionally wrapped inside a <tt class="docutils literal"><table></tt> which has one row and two | |||
| +cells: one containing the line numbers and one containing the code. | |||
| +Example:</p> | |||
| +<div class="syntax"><pre><span class="nt"><div</span> <span class="na">class=</span><span class="s">"highlight"</span> <span class="nt">></span> | |||
| +<span class="nt"><table><tr></span> | |||
| + <span class="nt"><td</span> <span class="na">class=</span><span class="s">"linenos"</span> <span class="na">title=</span><span class="s">"click to toggle"</span> | |||
| + <span class="na">onclick=</span><span class="s">"with (this.firstChild.style)</span> | |||
| +<span class="s"> { display = (display == '') ? 'none' : '' }"</span><span class="nt">></span> | |||
| + <span class="nt"><pre></span>1 | |||
| + 2<span class="nt"></pre></span> | |||
| + <span class="nt"></td></span> | |||
| + <span class="nt"><td</span> <span class="na">class=</span><span class="s">"code"</span><span class="nt">></span> | |||
| + <span class="nt"><pre><span</span> <span class="na">class=</span><span class="s">"Ke"</span><span class="nt">></span>def <span class="nt"></span><span</span> <span class="na">class=</span><span class="s">"NaFu"</span><span class="nt">></span>foo<span class="nt"></span></span>(bar): | |||
| + <span class="nt"><span</span> <span class="na">class=</span><span class="s">"Ke"</span><span class="nt">></span>pass<span class="nt"></span></span> | |||
| + <span class="nt"></pre></span> | |||
| + <span class="nt"></td></span> | |||
| +<span class="nt"></tr></table></div></span> | |||
| +</pre></div> | |||
| +<p>(whitespace added to improve clarity).</p> | |||
| +<p>Wrapping can be disabled using the <cite>nowrap</cite> option.</p> | |||
| +<p>A list of lines can be specified using the <cite>hl_lines</cite> option to make these | |||
| +lines highlighted (as of Pygments 0.11).</p> | |||
| +<p>With the <cite>full</cite> option, a complete HTML 4 document is output, including | |||
| +the style definitions inside a <tt class="docutils literal"><style></tt> tag, or in a separate file if | |||
| +the <cite>cssfile</cite> option is given.</p> | |||
| +<p>When <cite>tagsfile</cite> is set to the path of a ctags index file, it is used to | |||
| +generate hyperlinks from names to their definition. You must enable | |||
| +<cite>anchorlines</cite> and run ctags with the <cite>-n</cite> option for this to work. The | |||
| +<cite>python-ctags</cite> module from PyPI must be installed to use this feature; | |||
| +otherwise a <cite>RuntimeError</cite> will be raised.</p> | |||
| +<p>The <cite>get_style_defs(arg='')</cite> method of a <cite>HtmlFormatter</cite> returns a string | |||
| +containing CSS rules for the CSS classes used by the formatter. The | |||
| +argument <cite>arg</cite> can be used to specify additional CSS selectors that | |||
| +are prepended to the classes. A call <cite>fmter.get_style_defs('td .code')</cite> | |||
| +would result in the following CSS classes:</p> | |||
| +<div class="syntax"><pre><span class="nt">td</span> <span class="nc">.code</span> <span class="nc">.kw</span> <span class="p">{</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span><span class="p">;</span> <span class="k">color</span><span class="o">:</span> <span class="m">#00FF00</span> <span class="p">}</span> | |||
| +<span class="nt">td</span> <span class="nc">.code</span> <span class="nc">.cm</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#999999</span> <span class="p">}</span> | |||
| +<span class="o">...</span> | |||
| +</pre></div> | |||
| +<p>If you have Pygments 0.6 or higher, you can also pass a list or tuple to the | |||
| +<cite>get_style_defs()</cite> method to request multiple prefixes for the tokens:</p> | |||
| +<div class="syntax"><pre><span class="n">formatter</span><span class="o">.</span><span class="n">get_style_defs</span><span class="p">([</span><span class="s">'div.syntax pre'</span><span class="p">,</span> <span class="s">'pre.syntax'</span><span class="p">])</span> | |||
| +</pre></div> | |||
| +<p>The output would then look like this:</p> | |||
| +<div class="syntax"><pre><span class="nt">div</span><span class="nc">.syntax</span> <span class="nt">pre</span> <span class="nc">.kw</span><span class="o">,</span> | |||
| +<span class="nt">pre</span><span class="nc">.syntax</span> <span class="nc">.kw</span> <span class="p">{</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span><span class="p">;</span> <span class="k">color</span><span class="o">:</span> <span class="m">#00FF00</span> <span class="p">}</span> | |||
| +<span class="nt">div</span><span class="nc">.syntax</span> <span class="nt">pre</span> <span class="nc">.cm</span><span class="o">,</span> | |||
| +<span class="nt">pre</span><span class="nc">.syntax</span> <span class="nc">.cm</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#999999</span> <span class="p">}</span> | |||
| +<span class="o">...</span> | |||
| +</pre></div> | |||
| +<p>Additional options accepted:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>nowrap</cite></dt> | |||
| +<dd>If set to <tt class="docutils literal">True</tt>, don't wrap the tokens at all, not even inside a <tt class="docutils literal"><pre></tt> | |||
| +tag. This disables most other options (default: <tt class="docutils literal">False</tt>).</dd> | |||
| +<dt><cite>full</cite></dt> | |||
| +<dd>Tells the formatter to output a "full" document, i.e. a complete | |||
| +self-contained document (default: <tt class="docutils literal">False</tt>).</dd> | |||
| +<dt><cite>title</cite></dt> | |||
| +<dd>If <cite>full</cite> is true, the title that should be used to caption the | |||
| +document (default: <tt class="docutils literal">''</tt>).</dd> | |||
| +<dt><cite>style</cite></dt> | |||
| +<dd>The style to use, can be a string or a Style subclass (default: | |||
| +<tt class="docutils literal">'default'</tt>). This option has no effect if the <cite>cssfile</cite> | |||
| +and <cite>noclobber_cssfile</cite> option are given and the file specified in | |||
| +<cite>cssfile</cite> exists.</dd> | |||
| +<dt><cite>noclasses</cite></dt> | |||
| +<dd>If set to true, token <tt class="docutils literal"><span></tt> tags will not use CSS classes, but | |||
| +inline styles. This is not recommended for larger pieces of code since | |||
| +it increases output size by quite a bit (default: <tt class="docutils literal">False</tt>).</dd> | |||
| +<dt><cite>classprefix</cite></dt> | |||
| +<dd>Since the token types use relatively short class names, they may clash | |||
| +with some of your own class names. In this case you can use the | |||
| +<cite>classprefix</cite> option to give a string to prepend to all Pygments-generated | |||
| +CSS class names for token types. | |||
| +Note that this option also affects the output of <cite>get_style_defs()</cite>.</dd> | |||
| +<dt><cite>cssclass</cite></dt> | |||
| +<dd><p class="first">CSS class for the wrapping <tt class="docutils literal"><div></tt> tag (default: <tt class="docutils literal">'highlight'</tt>). | |||
| +If you set this option, the default selector for <cite>get_style_defs()</cite> | |||
| +will be this class.</p> | |||
| +<p class="last"><em>New in Pygments 0.9:</em> If you select the <tt class="docutils literal">'table'</tt> line numbers, the | |||
| +wrapping table will have a CSS class of this string plus <tt class="docutils literal">'table'</tt>, | |||
| +the default is accordingly <tt class="docutils literal">'highlighttable'</tt>.</p> | |||
| +</dd> | |||
| +<dt><cite>cssstyles</cite></dt> | |||
| +<dd>Inline CSS styles for the wrapping <tt class="docutils literal"><div></tt> tag (default: <tt class="docutils literal">''</tt>).</dd> | |||
| +<dt><cite>prestyles</cite></dt> | |||
| +<dd>Inline CSS styles for the <tt class="docutils literal"><pre></tt> tag (default: <tt class="docutils literal">''</tt>). <em>New in | |||
| +Pygments 0.11.</em></dd> | |||
| +<dt><cite>cssfile</cite></dt> | |||
| +<dd>If the <cite>full</cite> option is true and this option is given, it must be the | |||
| +name of an external file. If the filename does not include an absolute | |||
| +path, the file's path will be assumed to be relative to the main output | |||
| +file's path, if the latter can be found. The stylesheet is then written | |||
| +to this file instead of the HTML file. <em>New in Pygments 0.6.</em></dd> | |||
| +<dt><cite>noclobber_cssfile</cite></dt> | |||
| +<dd>If <cite>cssfile</cite> is given and the specified file exists, the css file will | |||
| +not be overwritten. This allows the use of the <cite>full</cite> option in | |||
| +combination with a user specified css file. Default is <tt class="docutils literal">False</tt>. | |||
| +<em>New in Pygments 1.1.</em></dd> | |||
| +<dt><cite>linenos</cite></dt> | |||
| +<dd><p class="first">If set to <tt class="docutils literal">'table'</tt>, output line numbers as a table with two cells, | |||
| +one containing the line numbers, the other the whole code. This is | |||
| +copy-and-paste-friendly, but may cause alignment problems with some | |||
| +browsers or fonts. If set to <tt class="docutils literal">'inline'</tt>, the line numbers will be | |||
| +integrated in the <tt class="docutils literal"><pre></tt> tag that contains the code (that setting | |||
| +is <em>new in Pygments 0.8</em>).</p> | |||
| +<p>For compatibility with Pygments 0.7 and earlier, every true value | |||
| +except <tt class="docutils literal">'inline'</tt> means the same as <tt class="docutils literal">'table'</tt> (in particular, that | |||
| +means also <tt class="docutils literal">True</tt>).</p> | |||
| +<p>The default value is <tt class="docutils literal">False</tt>, which means no line numbers at all.</p> | |||
| +<p class="last"><strong>Note:</strong> with the default ("table") line number mechanism, the line | |||
| +numbers and code can have different line heights in Internet Explorer | |||
| +unless you give the enclosing <tt class="docutils literal"><pre></tt> tags an explicit <tt class="docutils literal"><span class="pre">line-height</span></tt> | |||
| +CSS property (you get the default line spacing with <tt class="docutils literal"><span class="pre">line-height:</span> | |||
| +125%</tt>).</p> | |||
| +</dd> | |||
| +<dt><cite>hl_lines</cite></dt> | |||
| +<dd>Specify a list of lines to be highlighted. <em>New in Pygments 0.11.</em></dd> | |||
| +<dt><cite>linenostart</cite></dt> | |||
| +<dd>The line number for the first line (default: <tt class="docutils literal">1</tt>).</dd> | |||
| +<dt><cite>linenostep</cite></dt> | |||
| +<dd>If set to a number n > 1, only every nth line number is printed.</dd> | |||
| +<dt><cite>linenospecial</cite></dt> | |||
| +<dd>If set to a number n > 0, every nth line number is given the CSS | |||
| +class <tt class="docutils literal">"special"</tt> (default: <tt class="docutils literal">0</tt>).</dd> | |||
| +<dt><cite>nobackground</cite></dt> | |||
| +<dd>If set to <tt class="docutils literal">True</tt>, the formatter won't output the background color | |||
| +for the wrapping element (this automatically defaults to <tt class="docutils literal">False</tt> | |||
| +when there is no wrapping element [eg: no argument for the | |||
| +<cite>get_syntax_defs</cite> method given]) (default: <tt class="docutils literal">False</tt>). <em>New in | |||
| +Pygments 0.6.</em></dd> | |||
| +<dt><cite>lineseparator</cite></dt> | |||
| +<dd>This string is output between lines of code. It defaults to <tt class="docutils literal">"\n"</tt>, | |||
| +which is enough to break a line inside <tt class="docutils literal"><pre></tt> tags, but you can | |||
| +e.g. set it to <tt class="docutils literal">"<br>"</tt> to get HTML line breaks. <em>New in Pygments | |||
| +0.7.</em></dd> | |||
| +<dt><cite>lineanchors</cite></dt> | |||
| +<dd>If set to a nonempty string, e.g. <tt class="docutils literal">foo</tt>, the formatter will wrap each | |||
| +output line in an anchor tag with a <tt class="docutils literal">name</tt> of <tt class="docutils literal"><span class="pre">foo-linenumber</span></tt>. | |||
| +This allows easy linking to certain lines. <em>New in Pygments 0.9.</em></dd> | |||
| +<dt><cite>linespans</cite></dt> | |||
| +<dd>If set to a nonempty string, e.g. <tt class="docutils literal">foo</tt>, the formatter will wrap each | |||
| +output line in a span tag with an <tt class="docutils literal">id</tt> of <tt class="docutils literal"><span class="pre">foo-linenumber</span></tt>. | |||
| +This allows easy access to lines via javascript. <em>New in Pygments 1.6.</em></dd> | |||
| +<dt><cite>anchorlinenos</cite></dt> | |||
| +<dd>If set to <cite>True</cite>, will wrap line numbers in <a> tags. Used in | |||
| +combination with <cite>linenos</cite> and <cite>lineanchors</cite>.</dd> | |||
| +<dt><cite>tagsfile</cite></dt> | |||
| +<dd>If set to the path of a ctags file, wrap names in anchor tags that | |||
| +link to their definitions. <cite>lineanchors</cite> should be used, and the | |||
| +tags file should specify line numbers (see the <cite>-n</cite> option to ctags). | |||
| +<em>New in Pygments 1.6.</em></dd> | |||
| +<dt><cite>tagurlformat</cite></dt> | |||
| +<dd>A string formatting pattern used to generate links to ctags definitions. | |||
| +Avaliabe variable are <cite>%(path)s</cite>, <cite>%(fname)s</cite> and <cite>%(fext)s</cite>. | |||
| +Defaults to an empty string, resulting in just <cite>#prefix-number</cite> links. | |||
| +<em>New in Pygments 1.6.</em></dd> | |||
| +</dl> | |||
| +<p><strong>Subclassing the HTML formatter</strong></p> | |||
| +<p><em>New in Pygments 0.7.</em></p> | |||
| +<p>The HTML formatter is now built in a way that allows easy subclassing, thus | |||
| +customizing the output HTML code. The <cite>format()</cite> method calls | |||
| +<cite>self._format_lines()</cite> which returns a generator that yields tuples of <tt class="docutils literal">(1, | |||
| +line)</tt>, where the <tt class="docutils literal">1</tt> indicates that the <tt class="docutils literal">line</tt> is a line of the | |||
| +formatted source code.</p> | |||
| +<p>If the <cite>nowrap</cite> option is set, the generator is the iterated over and the | |||
| +resulting HTML is output.</p> | |||
| +<p>Otherwise, <cite>format()</cite> calls <cite>self.wrap()</cite>, which wraps the generator with | |||
| +other generators. These may add some HTML code to the one generated by | |||
| +<cite>_format_lines()</cite>, either by modifying the lines generated by the latter, | |||
| +then yielding them again with <tt class="docutils literal">(1, line)</tt>, and/or by yielding other HTML | |||
| +code before or after the lines, with <tt class="docutils literal">(0, html)</tt>. The distinction between | |||
| +source lines and other code makes it possible to wrap the generator multiple | |||
| +times.</p> | |||
| +<p>The default <cite>wrap()</cite> implementation adds a <tt class="docutils literal"><div></tt> and a <tt class="docutils literal"><pre></tt> tag.</p> | |||
| +<p>A custom <cite>HtmlFormatter</cite> subclass could look like this:</p> | |||
| +<div class="syntax"><pre><span class="k">class</span> <span class="nc">CodeHtmlFormatter</span><span class="p">(</span><span class="n">HtmlFormatter</span><span class="p">):</span> | |||
| + | |||
| + <span class="k">def</span> <span class="nf">wrap</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="p">,</span> <span class="n">outfile</span><span class="p">):</span> | |||
| + <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_wrap_code</span><span class="p">(</span><span class="n">source</span><span class="p">)</span> | |||
| + | |||
| + <span class="k">def</span> <span class="nf">_wrap_code</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="p">):</span> | |||
| + <span class="k">yield</span> <span class="mi">0</span><span class="p">,</span> <span class="s">'<code>'</span> | |||
| + <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">source</span><span class="p">:</span> | |||
| + <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> | |||
| + <span class="c"># it's a line of formatted code</span> | |||
| + <span class="n">t</span> <span class="o">+=</span> <span class="s">'<br>'</span> | |||
| + <span class="k">yield</span> <span class="n">i</span><span class="p">,</span> <span class="n">t</span> | |||
| + <span class="k">yield</span> <span class="mi">0</span><span class="p">,</span> <span class="s">'</code>'</span> | |||
| +</pre></div> | |||
| +<p>This results in wrapping the formatted lines with a <tt class="docutils literal"><code></tt> tag, where the | |||
| +source lines are broken using <tt class="docutils literal"><br></tt> tags.</p> | |||
| +<p>After calling <cite>wrap()</cite>, the <cite>format()</cite> method also adds the "line numbers" | |||
| +and/or "full document" wrappers if the respective options are set. Then, all | |||
| +HTML yielded by the wrapped generator is output.</p> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Short names:</th><td class="field-body">html</td> | |||
| +</tr> | |||
| +<tr class="field"><th class="field-name">Filename patterns:</th><td class="field-body">*.html, *.htm</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +</div> | |||
| +<div class="section" id="imageformatter"> | |||
| +<h4><cite>ImageFormatter</cite></h4> | |||
| +<blockquote> | |||
| +<p>Create a PNG image from source code. This uses the Python Imaging Library to | |||
| +generate a pixmap from the source code.</p> | |||
| +<p><em>New in Pygments 0.10.</em></p> | |||
| +<p>Additional options accepted:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>image_format</cite></dt> | |||
| +<dd><p class="first">An image format to output to that is recognised by PIL, these include:</p> | |||
| +<ul class="last simple"> | |||
| +<li>"PNG" (default)</li> | |||
| +<li>"JPEG"</li> | |||
| +<li>"BMP"</li> | |||
| +<li>"GIF"</li> | |||
| +</ul> | |||
| +</dd> | |||
| +<dt><cite>line_pad</cite></dt> | |||
| +<dd><p class="first">The extra spacing (in pixels) between each line of text.</p> | |||
| +<p class="last">Default: 2</p> | |||
| +</dd> | |||
| +<dt><cite>font_name</cite></dt> | |||
| +<dd><p class="first">The font name to be used as the base font from which others, such as | |||
| +bold and italic fonts will be generated. This really should be a | |||
| +monospace font to look sane.</p> | |||
| +<p class="last">Default: "Bitstream Vera Sans Mono"</p> | |||
| +</dd> | |||
| +<dt><cite>font_size</cite></dt> | |||
| +<dd><p class="first">The font size in points to be used.</p> | |||
| +<p class="last">Default: 14</p> | |||
| +</dd> | |||
| +<dt><cite>image_pad</cite></dt> | |||
| +<dd><p class="first">The padding, in pixels to be used at each edge of the resulting image.</p> | |||
| +<p class="last">Default: 10</p> | |||
| +</dd> | |||
| +<dt><cite>line_numbers</cite></dt> | |||
| +<dd><p class="first">Whether line numbers should be shown: True/False</p> | |||
| +<p class="last">Default: True</p> | |||
| +</dd> | |||
| +<dt><cite>line_number_start</cite></dt> | |||
| +<dd><p class="first">The line number of the first line.</p> | |||
| +<p class="last">Default: 1</p> | |||
| +</dd> | |||
| +<dt><cite>line_number_step</cite></dt> | |||
| +<dd><p class="first">The step used when printing line numbers.</p> | |||
| +<p class="last">Default: 1</p> | |||
| +</dd> | |||
| +<dt><cite>line_number_bg</cite></dt> | |||
| +<dd><p class="first">The background colour (in "#123456" format) of the line number bar, or | |||
| +None to use the style background color.</p> | |||
| +<p class="last">Default: "#eed"</p> | |||
| +</dd> | |||
| +<dt><cite>line_number_fg</cite></dt> | |||
| +<dd><p class="first">The text color of the line numbers (in "#123456"-like format).</p> | |||
| +<p class="last">Default: "#886"</p> | |||
| +</dd> | |||
| +<dt><cite>line_number_chars</cite></dt> | |||
| +<dd><p class="first">The number of columns of line numbers allowable in the line number | |||
| +margin.</p> | |||
| +<p class="last">Default: 2</p> | |||
| +</dd> | |||
| +<dt><cite>line_number_bold</cite></dt> | |||
| +<dd><p class="first">Whether line numbers will be bold: True/False</p> | |||
| +<p class="last">Default: False</p> | |||
| +</dd> | |||
| +<dt><cite>line_number_italic</cite></dt> | |||
| +<dd><p class="first">Whether line numbers will be italicized: True/False</p> | |||
| +<p class="last">Default: False</p> | |||
| +</dd> | |||
| +<dt><cite>line_number_separator</cite></dt> | |||
| +<dd><p class="first">Whether a line will be drawn between the line number area and the | |||
| +source code area: True/False</p> | |||
| +<p class="last">Default: True</p> | |||
| +</dd> | |||
| +<dt><cite>line_number_pad</cite></dt> | |||
| +<dd><p class="first">The horizontal padding (in pixels) between the line number margin, and | |||
| +the source code area.</p> | |||
| +<p class="last">Default: 6</p> | |||
| +</dd> | |||
| +<dt><cite>hl_lines</cite></dt> | |||
| +<dd><p class="first">Specify a list of lines to be highlighted. <em>New in Pygments 1.2.</em></p> | |||
| +<p class="last">Default: empty list</p> | |||
| +</dd> | |||
| +<dt><cite>hl_color</cite></dt> | |||
| +<dd><p class="first">Specify the color for highlighting lines. <em>New in Pygments 1.2.</em></p> | |||
| +<p class="last">Default: highlight color of the selected style</p> | |||
| +</dd> | |||
| +</dl> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Short names:</th><td class="field-body">img, IMG, png</td> | |||
| +</tr> | |||
| +<tr class="field"><th class="field-name">Filename patterns:</th><td class="field-body">*.png</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +</div> | |||
| +<div class="section" id="jpgimageformatter"> | |||
| +<h4><cite>JpgImageFormatter</cite></h4> | |||
| +<blockquote> | |||
| +<p>Create a JPEG image from source code. This uses the Python Imaging Library to | |||
| +generate a pixmap from the source code.</p> | |||
| +<p><em>New in Pygments 1.0.</em> (You could create JPEG images before by passing a | |||
| +suitable <cite>image_format</cite> option to the <cite>ImageFormatter</cite>.)</p> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Short names:</th><td class="field-body">jpg, jpeg</td> | |||
| +</tr> | |||
| +<tr class="field"><th class="field-name">Filename patterns:</th><td class="field-body">*.jpg</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +</div> | |||
| +<div class="section" id="latexformatter"> | |||
| +<h4><cite>LatexFormatter</cite></h4> | |||
| +<blockquote> | |||
| +<p>Format tokens as LaTeX code. This needs the <cite>fancyvrb</cite> and <cite>color</cite> | |||
| +standard packages.</p> | |||
| +<p>Without the <cite>full</cite> option, code is formatted as one <tt class="docutils literal">Verbatim</tt> | |||
| +environment, like this:</p> | |||
| +<div class="syntax"><pre><span class="k">\begin</span><span class="nb">{</span>Verbatim<span class="nb">}</span>[commandchars=<span class="k">\\</span><span class="nb">{</span><span class="k">\}</span>] | |||
| +<span class="k">\PY</span><span class="nb">{</span>k<span class="nb">}{</span>def <span class="nb">}</span><span class="k">\PY</span><span class="nb">{</span>n+nf<span class="nb">}{</span>foo<span class="nb">}</span>(<span class="k">\PY</span><span class="nb">{</span>n<span class="nb">}{</span>bar<span class="nb">}</span>): | |||
| + <span class="k">\PY</span><span class="nb">{</span>k<span class="nb">}{</span>pass<span class="nb">}</span> | |||
| +<span class="k">\end</span><span class="nb">{</span>Verbatim<span class="nb">}</span> | |||
| +</pre></div> | |||
| +<p>The special command used here (<tt class="docutils literal">\PY</tt>) and all the other macros it needs | |||
| +are output by the <cite>get_style_defs</cite> method.</p> | |||
| +<p>With the <cite>full</cite> option, a complete LaTeX document is output, including | |||
| +the command definitions in the preamble.</p> | |||
| +<p>The <cite>get_style_defs()</cite> method of a <cite>LatexFormatter</cite> returns a string | |||
| +containing <tt class="docutils literal">\def</tt> commands defining the macros needed inside the | |||
| +<tt class="docutils literal">Verbatim</tt> environments.</p> | |||
| +<p>Additional options accepted:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>style</cite></dt> | |||
| +<dd>The style to use, can be a string or a Style subclass (default: | |||
| +<tt class="docutils literal">'default'</tt>).</dd> | |||
| +<dt><cite>full</cite></dt> | |||
| +<dd>Tells the formatter to output a "full" document, i.e. a complete | |||
| +self-contained document (default: <tt class="docutils literal">False</tt>).</dd> | |||
| +<dt><cite>title</cite></dt> | |||
| +<dd>If <cite>full</cite> is true, the title that should be used to caption the | |||
| +document (default: <tt class="docutils literal">''</tt>).</dd> | |||
| +<dt><cite>docclass</cite></dt> | |||
| +<dd>If the <cite>full</cite> option is enabled, this is the document class to use | |||
| +(default: <tt class="docutils literal">'article'</tt>).</dd> | |||
| +<dt><cite>preamble</cite></dt> | |||
| +<dd>If the <cite>full</cite> option is enabled, this can be further preamble commands, | |||
| +e.g. <tt class="docutils literal">\usepackage</tt> (default: <tt class="docutils literal">''</tt>).</dd> | |||
| +<dt><cite>linenos</cite></dt> | |||
| +<dd>If set to <tt class="docutils literal">True</tt>, output line numbers (default: <tt class="docutils literal">False</tt>).</dd> | |||
| +<dt><cite>linenostart</cite></dt> | |||
| +<dd>The line number for the first line (default: <tt class="docutils literal">1</tt>).</dd> | |||
| +<dt><cite>linenostep</cite></dt> | |||
| +<dd>If set to a number n > 1, only every nth line number is printed.</dd> | |||
| +<dt><cite>verboptions</cite></dt> | |||
| +<dd>Additional options given to the Verbatim environment (see the <em>fancyvrb</em> | |||
| +docs for possible values) (default: <tt class="docutils literal">''</tt>).</dd> | |||
| +<dt><cite>commandprefix</cite></dt> | |||
| +<dd><p class="first">The LaTeX commands used to produce colored output are constructed | |||
| +using this prefix and some letters (default: <tt class="docutils literal">'PY'</tt>). | |||
| +<em>New in Pygments 0.7.</em></p> | |||
| +<p class="last"><em>New in Pygments 0.10:</em> the default is now <tt class="docutils literal">'PY'</tt> instead of <tt class="docutils literal">'C'</tt>.</p> | |||
| +</dd> | |||
| +<dt><cite>texcomments</cite></dt> | |||
| +<dd>If set to <tt class="docutils literal">True</tt>, enables LaTeX comment lines. That is, LaTex markup | |||
| +in comment tokens is not escaped so that LaTeX can render it (default: | |||
| +<tt class="docutils literal">False</tt>). <em>New in Pygments 1.2.</em></dd> | |||
| +<dt><cite>mathescape</cite></dt> | |||
| +<dd>If set to <tt class="docutils literal">True</tt>, enables LaTeX math mode escape in comments. That | |||
| +is, <tt class="docutils literal"><span class="pre">'$...$'</span></tt> inside a comment will trigger math mode (default: | |||
| +<tt class="docutils literal">False</tt>). <em>New in Pygments 1.2.</em></dd> | |||
| +</dl> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Short names:</th><td class="field-body">latex, tex</td> | |||
| +</tr> | |||
| +<tr class="field"><th class="field-name">Filename patterns:</th><td class="field-body">*.tex</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +</div> | |||
| +<div class="section" id="nullformatter"> | |||
| +<h4><cite>NullFormatter</cite></h4> | |||
| +<blockquote> | |||
| +<p>Output the text unchanged without any formatting.</p> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Short names:</th><td class="field-body">text, null</td> | |||
| +</tr> | |||
| +<tr class="field"><th class="field-name">Filename patterns:</th><td class="field-body">*.txt</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +</div> | |||
| +<div class="section" id="rawtokenformatter"> | |||
| +<h4><cite>RawTokenFormatter</cite></h4> | |||
| +<blockquote> | |||
| +<p>Format tokens as a raw representation for storing token streams.</p> | |||
| +<p>The format is <tt class="docutils literal"><span class="pre">tokentype<TAB>repr(tokenstring)\n</span></tt>. The output can later | |||
| +be converted to a token stream with the <cite>RawTokenLexer</cite>, described in the | |||
| +<a class="reference external" href="./lexers.html">lexer list</a>.</p> | |||
| +<p>Only two options are accepted:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>compress</cite></dt> | |||
| +<dd>If set to <tt class="docutils literal">'gz'</tt> or <tt class="docutils literal">'bz2'</tt>, compress the output with the given | |||
| +compression algorithm after encoding (default: <tt class="docutils literal">''</tt>).</dd> | |||
| +<dt><cite>error_color</cite></dt> | |||
| +<dd>If set to a color name, highlight error tokens using that color. If | |||
| +set but with no value, defaults to <tt class="docutils literal">'red'</tt>. | |||
| +<em>New in Pygments 0.11.</em></dd> | |||
| +</dl> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Short names:</th><td class="field-body">raw, tokens</td> | |||
| +</tr> | |||
| +<tr class="field"><th class="field-name">Filename patterns:</th><td class="field-body">*.raw</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +</div> | |||
| +<div class="section" id="rtfformatter"> | |||
| +<h4><cite>RtfFormatter</cite></h4> | |||
| +<blockquote> | |||
| +<p>Format tokens as RTF markup. This formatter automatically outputs full RTF | |||
| +documents with color information and other useful stuff. Perfect for Copy and | |||
| +Paste into Microsoft® Word® documents.</p> | |||
| +<p><em>New in Pygments 0.6.</em></p> | |||
| +<p>Additional options accepted:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>style</cite></dt> | |||
| +<dd>The style to use, can be a string or a Style subclass (default: | |||
| +<tt class="docutils literal">'default'</tt>).</dd> | |||
| +<dt><cite>fontface</cite></dt> | |||
| +<dd>The used font famliy, for example <tt class="docutils literal">Bitstream Vera Sans</tt>. Defaults to | |||
| +some generic font which is supposed to have fixed width.</dd> | |||
| +</dl> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Short names:</th><td class="field-body">rtf</td> | |||
| +</tr> | |||
| +<tr class="field"><th class="field-name">Filename patterns:</th><td class="field-body">*.rtf</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +</div> | |||
| +<div class="section" id="svgformatter"> | |||
| +<h4><cite>SvgFormatter</cite></h4> | |||
| +<blockquote> | |||
| +<p>Format tokens as an SVG graphics file. This formatter is still experimental. | |||
| +Each line of code is a <tt class="docutils literal"><text></tt> element with explicit <tt class="docutils literal">x</tt> and <tt class="docutils literal">y</tt> | |||
| +coordinates containing <tt class="docutils literal"><tspan></tt> elements with the individual token styles.</p> | |||
| +<p>By default, this formatter outputs a full SVG document including doctype | |||
| +declaration and the <tt class="docutils literal"><svg></tt> root element.</p> | |||
| +<p><em>New in Pygments 0.9.</em></p> | |||
| +<p>Additional options accepted:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>nowrap</cite></dt> | |||
| +<dd>Don't wrap the SVG <tt class="docutils literal"><text></tt> elements in <tt class="docutils literal"><span class="pre"><svg><g></span></tt> elements and | |||
| +don't add a XML declaration and a doctype. If true, the <cite>fontfamily</cite> | |||
| +and <cite>fontsize</cite> options are ignored. Defaults to <tt class="docutils literal">False</tt>.</dd> | |||
| +<dt><cite>fontfamily</cite></dt> | |||
| +<dd>The value to give the wrapping <tt class="docutils literal"><g></tt> element's <tt class="docutils literal"><span class="pre">font-family</span></tt> | |||
| +attribute, defaults to <tt class="docutils literal">"monospace"</tt>.</dd> | |||
| +<dt><cite>fontsize</cite></dt> | |||
| +<dd>The value to give the wrapping <tt class="docutils literal"><g></tt> element's <tt class="docutils literal"><span class="pre">font-size</span></tt> | |||
| +attribute, defaults to <tt class="docutils literal">"14px"</tt>.</dd> | |||
| +<dt><cite>xoffset</cite></dt> | |||
| +<dd>Starting offset in X direction, defaults to <tt class="docutils literal">0</tt>.</dd> | |||
| +<dt><cite>yoffset</cite></dt> | |||
| +<dd>Starting offset in Y direction, defaults to the font size if it is given | |||
| +in pixels, or <tt class="docutils literal">20</tt> else. (This is necessary since text coordinates | |||
| +refer to the text baseline, not the top edge.)</dd> | |||
| +<dt><cite>ystep</cite></dt> | |||
| +<dd>Offset to add to the Y coordinate for each subsequent line. This should | |||
| +roughly be the text size plus 5. It defaults to that value if the text | |||
| +size is given in pixels, or <tt class="docutils literal">25</tt> else.</dd> | |||
| +<dt><cite>spacehack</cite></dt> | |||
| +<dd>Convert spaces in the source to <tt class="docutils literal">&#160;</tt>, which are non-breaking | |||
| +spaces. SVG provides the <tt class="docutils literal">xml:space</tt> attribute to control how | |||
| +whitespace inside tags is handled, in theory, the <tt class="docutils literal">preserve</tt> value | |||
| +could be used to keep all whitespace as-is. However, many current SVG | |||
| +viewers don't obey that rule, so this option is provided as a workaround | |||
| +and defaults to <tt class="docutils literal">True</tt>.</dd> | |||
| +</dl> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Short names:</th><td class="field-body">svg</td> | |||
| +</tr> | |||
| +<tr class="field"><th class="field-name">Filename patterns:</th><td class="field-body">*.svg</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +</div> | |||
| +<div class="section" id="terminal256formatter"> | |||
| +<h4><cite>Terminal256Formatter</cite></h4> | |||
| +<blockquote> | |||
| +<p>Format tokens with ANSI color sequences, for output in a 256-color | |||
| +terminal or console. Like in <cite>TerminalFormatter</cite> color sequences | |||
| +are terminated at newlines, so that paging the output works correctly.</p> | |||
| +<p>The formatter takes colors from a style defined by the <cite>style</cite> option | |||
| +and converts them to nearest ANSI 256-color escape sequences. Bold and | |||
| +underline attributes from the style are preserved (and displayed).</p> | |||
| +<p><em>New in Pygments 0.9.</em></p> | |||
| +<p>Options accepted:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>style</cite></dt> | |||
| +<dd>The style to use, can be a string or a Style subclass (default: | |||
| +<tt class="docutils literal">'default'</tt>).</dd> | |||
| +</dl> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Short names:</th><td class="field-body">terminal256, console256, 256</td> | |||
| +</tr> | |||
| +<tr class="field"><th class="field-name">Filename patterns:</th><td class="field-body">None</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +</div> | |||
| +<div class="section" id="terminalformatter"> | |||
| +<h4><cite>TerminalFormatter</cite></h4> | |||
| +<blockquote> | |||
| +<p>Format tokens with ANSI color sequences, for output in a text console. | |||
| +Color sequences are terminated at newlines, so that paging the output | |||
| +works correctly.</p> | |||
| +<p>The <cite>get_style_defs()</cite> method doesn't do anything special since there is | |||
| +no support for common styles.</p> | |||
| +<p>Options accepted:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>bg</cite></dt> | |||
| +<dd>Set to <tt class="docutils literal">"light"</tt> or <tt class="docutils literal">"dark"</tt> depending on the terminal's background | |||
| +(default: <tt class="docutils literal">"light"</tt>).</dd> | |||
| +<dt><cite>colorscheme</cite></dt> | |||
| +<dd>A dictionary mapping token types to (lightbg, darkbg) color names or | |||
| +<tt class="docutils literal">None</tt> (default: <tt class="docutils literal">None</tt> = use builtin colorscheme).</dd> | |||
| +</dl> | |||
| +<table class="docutils field-list" frame="void" rules="none"> | |||
| +<col class="field-name" /> | |||
| +<col class="field-body" /> | |||
| +<tbody valign="top"> | |||
| +<tr class="field"><th class="field-name">Short names:</th><td class="field-body">terminal, console</td> | |||
| +</tr> | |||
| +<tr class="field"><th class="field-name">Filename patterns:</th><td class="field-body">None</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +</blockquote> | |||
| +</div> | |||
| +</div> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:42.651509 | |||
| + file id: formatters --> | |||
| +</html> | |||
261
vendor/pygments/docs/build/index.html
| @@ -0,0 +1,261 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Overview — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Overview</h2> | |||
| + | |||
| + | |||
| + <!-- -*- mode: rst -*- --> | |||
| +<p>Welcome to the Pygments documentation.</p> | |||
| +<ul class="simple"> | |||
| +<li>Starting with Pygments<ul> | |||
| +<li><a class="reference external" href="./installation.html">Installation</a></li> | |||
| +<li><a class="reference external" href="./quickstart.html">Introduction and Quickstart</a></li> | |||
| +<li><a class="reference external" href="./cmdline.html">Command line interface</a></li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>Builtin components<ul> | |||
| +<li><a class="reference external" href="./lexers.html">Lexers</a></li> | |||
| +<li><a class="reference external" href="./formatters.html">Formatters</a></li> | |||
| +<li><a class="reference external" href="./filters.html">Filters</a></li> | |||
| +<li><a class="reference external" href="./styles.html">Styles</a></li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>Reference<ul> | |||
| +<li><a class="reference external" href="./unicode.html">Unicode and encodings</a></li> | |||
| +<li><a class="reference external" href="./tokens.html">Builtin tokens</a></li> | |||
| +<li><a class="reference external" href="./api.html">API documentation</a></li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>Hacking for Pygments<ul> | |||
| +<li><a class="reference external" href="./lexerdevelopment.html">Write your own lexer</a></li> | |||
| +<li><a class="reference external" href="./formatterdevelopment.html">Write your own formatter</a></li> | |||
| +<li><a class="reference external" href="./filterdevelopment.html">Write your own filter</a></li> | |||
| +<li><a class="reference external" href="./plugins.html">Register plugins</a></li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>Hints and Tricks<ul> | |||
| +<li><a class="reference external" href="./rstdirective.html">Using Pygments in ReST documents</a></li> | |||
| +<li><a class="reference external" href="./moinmoin.html">Using Pygments with MoinMoin</a></li> | |||
| +<li><a class="reference external" href="./integrate.html">Using Pygments in other contexts</a></li> | |||
| +</ul> | |||
| +</li> | |||
| +<li>About Pygments<ul> | |||
| +<li><a class="reference external" href="./changelog.html">Changelog</a></li> | |||
| +<li><a class="reference external" href="./authors.html">Authors</a></li> | |||
| +</ul> | |||
| +</li> | |||
| +</ul> | |||
| +<hr class="docutils" /> | |||
| +<p>If you find bugs or have suggestions for the documentation, please | |||
| +look <a class="reference external" href="http://pygments.org/contribute/">here</a> for info on how to contact the team.</p> | |||
| +<p>You can download an offline version of this documentation from the | |||
| +<a class="reference external" href="http://pygments.org/download/">download page</a>.</p> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-02-03 10:39:02.732660 | |||
| + file id: index --> | |||
| +</html> | |||
281
vendor/pygments/docs/build/installation.html
| @@ -0,0 +1,281 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Installation — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Installation</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <div class="toc"> | |||
| + <h2>Contents</h2> | |||
| + <ul class="contents"> | |||
| + | |||
| + <li><a href="#installing-a-released-version">Installing a released version</a></li> | |||
| + | |||
| + <li><a href="#installing-the-development-version">Installing the development version</a></li> | |||
| + | |||
| + </ul> | |||
| + </div> | |||
| + | |||
| + <!-- -*- mode: rst -*- --> | |||
| +<p>Pygments requires at least Python 2.4 to work correctly. Just to clarify: | |||
| +there <em>won't</em> ever be support for Python versions below 2.4. However, there | |||
| +are no other dependencies.</p> | |||
| +<div class="section" id="installing-a-released-version"> | |||
| +<h3>Installing a released version</h3> | |||
| +<div class="section" id="as-a-python-egg-via-easy-install"> | |||
| +<h4>As a Python egg (via easy_install)</h4> | |||
| +<p>You can install the most recent Pygments version using <a class="reference external" href="http://peak.telecommunity.com/DevCenter/EasyInstall">easy_install</a>:</p> | |||
| +<pre class="literal-block"> | |||
| +sudo easy_install Pygments | |||
| +</pre> | |||
| +<p>This will install a Pygments egg in your Python installation's site-packages | |||
| +directory.</p> | |||
| +</div> | |||
| +<div class="section" id="from-the-tarball-release"> | |||
| +<h4>From the tarball release</h4> | |||
| +<ol class="arabic simple"> | |||
| +<li>Download the most recent tarball from the <a class="reference external" href="http://pygments.org/download/">download page</a></li> | |||
| +<li>Unpack the tarball</li> | |||
| +<li><tt class="docutils literal">sudo python setup.py install</tt></li> | |||
| +</ol> | |||
| +<p>Note that the last command will automatically download and install | |||
| +<a class="reference external" href="http://peak.telecommunity.com/DevCenter/setuptools">setuptools</a> if you don't already have it installed. This requires a working | |||
| +internet connection.</p> | |||
| +<p>This will install Pygments into your Python installation's site-packages directory.</p> | |||
| +</div> | |||
| +</div> | |||
| +<div class="section" id="installing-the-development-version"> | |||
| +<h3>Installing the development version</h3> | |||
| +<div class="section" id="if-you-want-to-play-around-with-the-code"> | |||
| +<h4>If you want to play around with the code</h4> | |||
| +<ol class="arabic simple"> | |||
| +<li>Install <a class="reference external" href="http://selenic.com/mercurial/">Mercurial</a></li> | |||
| +<li><tt class="docutils literal">hg clone <span class="pre">http://bitbucket.org/birkenfeld/pygments-main</span> pygments</tt></li> | |||
| +<li><tt class="docutils literal">cd pygments</tt></li> | |||
| +<li><tt class="docutils literal">ln <span class="pre">-s</span> pygments <span class="pre">/usr/lib/python2.X/site-packages</span></tt></li> | |||
| +<li><tt class="docutils literal">ln <span class="pre">-s</span> pygmentize /usr/local/bin</tt></li> | |||
| +</ol> | |||
| +<p>As an alternative to steps 4 and 5 you can also do <tt class="docutils literal">python setup.py develop</tt> | |||
| +which will install the package via setuptools in development mode.</p> | |||
| +<!-- If you just want the latest features and use them | |||
| +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |||
| + | |||
| +:: | |||
| + | |||
| + sudo easy_install Pygments==dev | |||
| + | |||
| +This will install a Pygments egg containing the latest Subversion trunk code | |||
| +in your Python installation's site-packages directory. Every time the command | |||
| +is run, the sources are updated from Subversion. --> | |||
| +</div> | |||
| +</div> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:43.375552 | |||
| + file id: installation --> | |||
| +</html> | |||
268
vendor/pygments/docs/build/integrate.html
| @@ -0,0 +1,268 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Using Pygments in various scenarios — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Using Pygments in various scenarios</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <div class="toc"> | |||
| + <h2>Contents</h2> | |||
| + <ul class="contents"> | |||
| + | |||
| + <li><a href="#pygtk">PyGtk</a></li> | |||
| + | |||
| + <li><a href="#wordpress">Wordpress</a></li> | |||
| + | |||
| + <li><a href="#markdown">Markdown</a></li> | |||
| + | |||
| + <li><a href="#textmate">TextMate</a></li> | |||
| + | |||
| + <li><a href="#bash-completion">Bash completion</a></li> | |||
| + | |||
| + <li><a href="#java">Java</a></li> | |||
| + | |||
| + </ul> | |||
| + </div> | |||
| + | |||
| + <!-- -*- mode: rst -*- --> | |||
| +<div class="section" id="pygtk"> | |||
| +<h3>PyGtk</h3> | |||
| +<p>Armin has written a piece of sample code that shows how to create a Gtk | |||
| +<cite>TextBuffer</cite> object containing Pygments-highlighted text.</p> | |||
| +<p>See the article here: <a class="reference external" href="http://lucumr.pocoo.org/cogitations/2007/05/30/pygments-gtk-rendering/">http://lucumr.pocoo.org/cogitations/2007/05/30/pygments-gtk-rendering/</a></p> | |||
| +</div> | |||
| +<div class="section" id="wordpress"> | |||
| +<h3>Wordpress</h3> | |||
| +<p>He also has a snippet that shows how to use Pygments in WordPress:</p> | |||
| +<p><a class="reference external" href="http://lucumr.pocoo.org/cogitations/2007/05/30/pygments-in-wordpress/">http://lucumr.pocoo.org/cogitations/2007/05/30/pygments-in-wordpress/</a></p> | |||
| +</div> | |||
| +<div class="section" id="markdown"> | |||
| +<h3>Markdown</h3> | |||
| +<p>Since Pygments 0.9, the distribution ships <a class="reference external" href="http://www.freewisdom.org/projects/python-markdown/">Markdown</a> preprocessor sample code | |||
| +that uses Pygments to render source code in <cite>external/markdown-processor.py</cite>. | |||
| +You can copy and adapt it to your liking.</p> | |||
| +</div> | |||
| +<div class="section" id="textmate"> | |||
| +<h3>TextMate</h3> | |||
| +<p>Antonio Cangiano has created a Pygments bundle for TextMate that allows to | |||
| +colorize code via a simple menu option. It can be found <a class="reference external" href="http://antoniocangiano.com/2008/10/28/pygments-textmate-bundle/">here</a>.</p> | |||
| +</div> | |||
| +<div class="section" id="bash-completion"> | |||
| +<h3>Bash completion</h3> | |||
| +<p>The source distribution contains a file <tt class="docutils literal">external/pygments.bashcomp</tt> that | |||
| +sets up completion for the <tt class="docutils literal">pygmentize</tt> command in bash.</p> | |||
| +</div> | |||
| +<div class="section" id="java"> | |||
| +<h3>Java</h3> | |||
| +<p>See the <a class="reference external" href="./java.html">Java quickstart</a> document.</p> | |||
| +</div> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-02-03 10:39:02.461007 | |||
| + file id: integrate --> | |||
| +</html> | |||
271
vendor/pygments/docs/build/java.html
| @@ -0,0 +1,271 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Use Pygments in Java — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Use Pygments in Java</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <p>Thanks to <a class="reference external" href="http://www.jython.org">Jython</a> it is possible to use Pygments in | |||
| +Java.</p> | |||
| +<p>This page is a simple tutorial to get an idea of how this is working. You can | |||
| +then look at the <a class="reference external" href="http://www.jython.org/docs/">Jython documentation</a> for more | |||
| +advanced use.</p> | |||
| +<p>Since version 1.5, Pygments is deployed on <a class="reference external" href="http://repo1.maven.org/maven2/org/pygments/pygments/">Maven Central</a> as a JAR so is Jython | |||
| +which makes it a lot easier to create the Java project.</p> | |||
| +<p>Here is an example of a <a class="reference external" href="http://www.maven.org">Maven</a> <tt class="docutils literal">pom.xml</tt> file for a | |||
| +project running Pygments:</p> | |||
| +<div class="syntax"><pre><span class="cp"><?xml version="1.0" encoding="UTF-8"?></span> | |||
| + | |||
| +<span class="nt"><project</span> <span class="na">xmlns=</span><span class="s">"http://maven.apache.org/POM/4.0.0"</span> | |||
| + <span class="na">xmlns:xsi=</span><span class="s">"http://www.w3.org/2001/XMLSchema-instance"</span> | |||
| + <span class="na">xsi:schemaLocation=</span><span class="s">"http://maven.apache.org/POM/4.0.0</span> | |||
| +<span class="s"> http://maven.apache.org/maven-v4_0_0.xsd"</span><span class="nt">></span> | |||
| + <span class="nt"><modelVersion></span>4.0.0<span class="nt"></modelVersion></span> | |||
| + <span class="nt"><groupId></span>example<span class="nt"></groupId></span> | |||
| + <span class="nt"><artifactId></span>example<span class="nt"></artifactId></span> | |||
| + <span class="nt"><version></span>1.0-SNAPSHOT<span class="nt"></version></span> | |||
| + <span class="nt"><dependencies></span> | |||
| + <span class="nt"><dependency></span> | |||
| + <span class="nt"><groupId></span>org.python<span class="nt"></groupId></span> | |||
| + <span class="nt"><artifactId></span>jython-standalone<span class="nt"></artifactId></span> | |||
| + <span class="nt"><version></span>2.5.3<span class="nt"></version></span> | |||
| + <span class="nt"></dependency></span> | |||
| + <span class="nt"><dependency></span> | |||
| + <span class="nt"><groupId></span>org.pygments<span class="nt"></groupId></span> | |||
| + <span class="nt"><artifactId></span>pygments<span class="nt"></artifactId></span> | |||
| + <span class="nt"><version></span>1.5<span class="nt"></version></span> | |||
| + <span class="nt"><scope></span>runtime<span class="nt"></scope></span> | |||
| + <span class="nt"></dependency></span> | |||
| + <span class="nt"></dependencies></span> | |||
| +<span class="nt"></project></span> | |||
| +</pre></div> | |||
| +<p>The following Java example:</p> | |||
| +<div class="syntax"><pre><span class="n">PythonInterpreter</span> <span class="n">interpreter</span> <span class="o">=</span> <span class="k">new</span> <span class="n">PythonInterpreter</span><span class="o">();</span> | |||
| + | |||
| +<span class="c1">// Set a variable with the content you want to work with</span> | |||
| +<span class="n">interpreter</span><span class="o">.</span><span class="na">set</span><span class="o">(</span><span class="s">"code"</span><span class="o">,</span> <span class="n">code</span><span class="o">);</span> | |||
| + | |||
| +<span class="c1">// Simple use Pygments as you would in Python</span> | |||
| +<span class="n">interpreter</span><span class="o">.</span><span class="na">exec</span><span class="o">(</span><span class="s">"from pygments import highlight\n"</span> | |||
| + <span class="o">+</span> <span class="s">"from pygments.lexers import PythonLexer\n"</span> | |||
| + <span class="o">+</span> <span class="s">"from pygments.formatters import HtmlFormatter\n"</span> | |||
| + <span class="o">+</span> <span class="s">"\nresult = highlight(code, PythonLexer(), HtmlFormatter())"</span><span class="o">);</span> | |||
| + | |||
| +<span class="c1">// Get the result that has been set in a variable</span> | |||
| +<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">interpreter</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="s">"result"</span><span class="o">,</span> <span class="n">String</span><span class="o">.</span><span class="na">class</span><span class="o">));</span> | |||
| +</pre></div> | |||
| +<p>will print something like:</p> | |||
| +<div class="syntax"><pre><span class="nt"><div</span> <span class="na">class=</span><span class="s">"highlight"</span><span class="nt">></span> | |||
| +<span class="nt"><pre><span</span> <span class="na">class=</span><span class="s">"k"</span><span class="nt">></span>print<span class="nt"></span></span> <span class="nt"><span</span> <span class="na">class=</span><span class="s">"s"</span><span class="nt">></span><span class="ni">&quot;</span>Hello World<span class="ni">&quot;</span><span class="nt"></span></pre></span> | |||
| +<span class="nt"></div></span> | |||
| +</pre></div> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-02-03 10:39:02.521367 | |||
| + file id: java --> | |||
| +</html> | |||
691
vendor/pygments/docs/build/lexerdevelopment.html
| @@ -0,0 +1,691 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Write your own lexer — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Write your own lexer</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <div class="toc"> | |||
| + <h2>Contents</h2> | |||
| + <ul class="contents"> | |||
| + | |||
| + <li><a href="#regexlexer">RegexLexer</a></li> | |||
| + | |||
| + <li><a href="#regex-flags">Regex Flags</a></li> | |||
| + | |||
| + <li><a href="#scanning-multiple-tokens-at-once">Scanning multiple tokens at once</a></li> | |||
| + | |||
| + <li><a href="#changing-states">Changing states</a></li> | |||
| + | |||
| + <li><a href="#advanced-state-tricks">Advanced state tricks</a></li> | |||
| + | |||
| + <li><a href="#using-multiple-lexers">Using multiple lexers</a></li> | |||
| + | |||
| + <li><a href="#delegating-lexer">Delegating Lexer</a></li> | |||
| + | |||
| + <li><a href="#callbacks">Callbacks</a></li> | |||
| + | |||
| + <li><a href="#the-extendedregexlexer-class">The ExtendedRegexLexer class</a></li> | |||
| + | |||
| + <li><a href="#filtering-token-streams">Filtering Token Streams</a></li> | |||
| + | |||
| + </ul> | |||
| + </div> | |||
| + | |||
| + <!-- -*- mode: rst -*- --> | |||
| +<p>If a lexer for your favorite language is missing in the Pygments package, you can | |||
| +easily write your own and extend Pygments.</p> | |||
| +<p>All you need can be found inside the <cite>pygments.lexer</cite> module. As you can read in | |||
| +the <a class="reference external" href="./api.html">API documentation</a>, a lexer is a class that is initialized with | |||
| +some keyword arguments (the lexer options) and that provides a | |||
| +<cite>get_tokens_unprocessed()</cite> method which is given a string or unicode object with | |||
| +the data to parse.</p> | |||
| +<p>The <cite>get_tokens_unprocessed()</cite> method must return an iterator or iterable | |||
| +containing tuples in the form <tt class="docutils literal">(index, token, value)</tt>. Normally you don't need | |||
| +to do this since there are numerous base lexers you can subclass.</p> | |||
| +<div class="section" id="regexlexer"> | |||
| +<h3>RegexLexer</h3> | |||
| +<p>A very powerful (but quite easy to use) lexer is the <cite>RegexLexer</cite>. This lexer | |||
| +base class allows you to define lexing rules in terms of <em>regular expressions</em> | |||
| +for different <em>states</em>.</p> | |||
| +<p>States are groups of regular expressions that are matched against the input | |||
| +string at the <em>current position</em>. If one of these expressions matches, a | |||
| +corresponding action is performed (normally yielding a token with a specific | |||
| +type), the current position is set to where the last match ended and the | |||
| +matching process continues with the first regex of the current state.</p> | |||
| +<p>Lexer states are kept in a state stack: each time a new state is entered, the | |||
| +new state is pushed onto the stack. The most basic lexers (like the | |||
| +<cite>DiffLexer</cite>) just need one state.</p> | |||
| +<p>Each state is defined as a list of tuples in the form (<cite>regex</cite>, <cite>action</cite>, | |||
| +<cite>new_state</cite>) where the last item is optional. In the most basic form, <cite>action</cite> | |||
| +is a token type (like <cite>Name.Builtin</cite>). That means: When <cite>regex</cite> matches, emit a | |||
| +token with the match text and type <cite>tokentype</cite> and push <cite>new_state</cite> on the state | |||
| +stack. If the new state is <tt class="docutils literal">'#pop'</tt>, the topmost state is popped from the | |||
| +stack instead. (To pop more than one state, use <tt class="docutils literal">'#pop:2'</tt> and so on.) | |||
| +<tt class="docutils literal">'#push'</tt> is a synonym for pushing the current state on the | |||
| +stack.</p> | |||
| +<p>The following example shows the <cite>DiffLexer</cite> from the builtin lexers. Note that | |||
| +it contains some additional attributes <cite>name</cite>, <cite>aliases</cite> and <cite>filenames</cite> which | |||
| +aren't required for a lexer. They are used by the builtin lexer lookup | |||
| +functions.</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.lexer</span> <span class="kn">import</span> <span class="n">RegexLexer</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="o">*</span> | |||
| + | |||
| +<span class="k">class</span> <span class="nc">DiffLexer</span><span class="p">(</span><span class="n">RegexLexer</span><span class="p">):</span> | |||
| + <span class="n">name</span> <span class="o">=</span> <span class="s">'Diff'</span> | |||
| + <span class="n">aliases</span> <span class="o">=</span> <span class="p">[</span><span class="s">'diff'</span><span class="p">]</span> | |||
| + <span class="n">filenames</span> <span class="o">=</span> <span class="p">[</span><span class="s">'*.diff'</span><span class="p">]</span> | |||
| + | |||
| + <span class="n">tokens</span> <span class="o">=</span> <span class="p">{</span> | |||
| + <span class="s">'root'</span><span class="p">:</span> <span class="p">[</span> | |||
| + <span class="p">(</span><span class="s">r' .*\n'</span><span class="p">,</span> <span class="n">Text</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'\+.*\n'</span><span class="p">,</span> <span class="n">Generic</span><span class="o">.</span><span class="n">Inserted</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'-.*\n'</span><span class="p">,</span> <span class="n">Generic</span><span class="o">.</span><span class="n">Deleted</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'@.*\n'</span><span class="p">,</span> <span class="n">Generic</span><span class="o">.</span><span class="n">Subheading</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'Index.*\n'</span><span class="p">,</span> <span class="n">Generic</span><span class="o">.</span><span class="n">Heading</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'=.*\n'</span><span class="p">,</span> <span class="n">Generic</span><span class="o">.</span><span class="n">Heading</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'.*\n'</span><span class="p">,</span> <span class="n">Text</span><span class="p">),</span> | |||
| + <span class="p">]</span> | |||
| + <span class="p">}</span> | |||
| +</pre></div> | |||
| +<p>As you can see this lexer only uses one state. When the lexer starts scanning | |||
| +the text, it first checks if the current character is a space. If this is true | |||
| +it scans everything until newline and returns the parsed data as <cite>Text</cite> token.</p> | |||
| +<p>If this rule doesn't match, it checks if the current char is a plus sign. And | |||
| +so on.</p> | |||
| +<p>If no rule matches at the current position, the current char is emitted as an | |||
| +<cite>Error</cite> token that indicates a parsing error, and the position is increased by | |||
| +1.</p> | |||
| +</div> | |||
| +<div class="section" id="regex-flags"> | |||
| +<h3>Regex Flags</h3> | |||
| +<p>You can either define regex flags in the regex (<tt class="docutils literal"><span class="pre">r'(?x)foo</span> bar'</tt>) or by adding | |||
| +a <cite>flags</cite> attribute to your lexer class. If no attribute is defined, it defaults | |||
| +to <cite>re.MULTILINE</cite>. For more informations about regular expression flags see the | |||
| +<a class="reference external" href="http://docs.python.org/lib/re-syntax.html">regular expressions</a> help page in the python documentation.</p> | |||
| +</div> | |||
| +<div class="section" id="scanning-multiple-tokens-at-once"> | |||
| +<h3>Scanning multiple tokens at once</h3> | |||
| +<p>Here is a more complex lexer that highlights INI files. INI files consist of | |||
| +sections, comments and key = value pairs:</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.lexer</span> <span class="kn">import</span> <span class="n">RegexLexer</span><span class="p">,</span> <span class="n">bygroups</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="o">*</span> | |||
| + | |||
| +<span class="k">class</span> <span class="nc">IniLexer</span><span class="p">(</span><span class="n">RegexLexer</span><span class="p">):</span> | |||
| + <span class="n">name</span> <span class="o">=</span> <span class="s">'INI'</span> | |||
| + <span class="n">aliases</span> <span class="o">=</span> <span class="p">[</span><span class="s">'ini'</span><span class="p">,</span> <span class="s">'cfg'</span><span class="p">]</span> | |||
| + <span class="n">filenames</span> <span class="o">=</span> <span class="p">[</span><span class="s">'*.ini'</span><span class="p">,</span> <span class="s">'*.cfg'</span><span class="p">]</span> | |||
| + | |||
| + <span class="n">tokens</span> <span class="o">=</span> <span class="p">{</span> | |||
| + <span class="s">'root'</span><span class="p">:</span> <span class="p">[</span> | |||
| + <span class="p">(</span><span class="s">r'\s+'</span><span class="p">,</span> <span class="n">Text</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r';.*?$'</span><span class="p">,</span> <span class="n">Comment</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'\[.*?\]$'</span><span class="p">,</span> <span class="n">Keyword</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'(.*?)(\s*)(=)(\s*)(.*?)$'</span><span class="p">,</span> | |||
| + <span class="n">bygroups</span><span class="p">(</span><span class="n">Name</span><span class="o">.</span><span class="n">Attribute</span><span class="p">,</span> <span class="n">Text</span><span class="p">,</span> <span class="n">Operator</span><span class="p">,</span> <span class="n">Text</span><span class="p">,</span> <span class="n">String</span><span class="p">))</span> | |||
| + <span class="p">]</span> | |||
| + <span class="p">}</span> | |||
| +</pre></div> | |||
| +<p>The lexer first looks for whitespace, comments and section names. And later it | |||
| +looks for a line that looks like a key, value pair, separated by an <tt class="docutils literal">'='</tt> | |||
| +sign, and optional whitespace.</p> | |||
| +<p>The <cite>bygroups</cite> helper makes sure that each group is yielded with a different | |||
| +token type. First the <cite>Name.Attribute</cite> token, then a <cite>Text</cite> token for the | |||
| +optional whitespace, after that a <cite>Operator</cite> token for the equals sign. Then a | |||
| +<cite>Text</cite> token for the whitespace again. The rest of the line is returned as | |||
| +<cite>String</cite>.</p> | |||
| +<p>Note that for this to work, every part of the match must be inside a capturing | |||
| +group (a <tt class="docutils literal"><span class="pre">(...)</span></tt>), and there must not be any nested capturing groups. If you | |||
| +nevertheless need a group, use a non-capturing group defined using this syntax: | |||
| +<tt class="docutils literal"><span class="pre">r'(?:some|words|here)'</span></tt> (note the <tt class="docutils literal"><span class="pre">?:</span></tt> after the beginning parenthesis).</p> | |||
| +<p>If you find yourself needing a capturing group inside the regex which | |||
| +shouldn't be part of the output but is used in the regular expressions for | |||
| +backreferencing (eg: <tt class="docutils literal"><span class="pre">r'(<(foo|bar)>)(.*?)(</\2>)'</span></tt>), you can pass <cite>None</cite> | |||
| +to the bygroups function and it will skip that group will be skipped in the | |||
| +output.</p> | |||
| +</div> | |||
| +<div class="section" id="changing-states"> | |||
| +<h3>Changing states</h3> | |||
| +<p>Many lexers need multiple states to work as expected. For example, some | |||
| +languages allow multiline comments to be nested. Since this is a recursive | |||
| +pattern it's impossible to lex just using regular expressions.</p> | |||
| +<p>Here is the solution:</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.lexer</span> <span class="kn">import</span> <span class="n">RegexLexer</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="o">*</span> | |||
| + | |||
| +<span class="k">class</span> <span class="nc">ExampleLexer</span><span class="p">(</span><span class="n">RegexLexer</span><span class="p">):</span> | |||
| + <span class="n">name</span> <span class="o">=</span> <span class="s">'Example Lexer with states'</span> | |||
| + | |||
| + <span class="n">tokens</span> <span class="o">=</span> <span class="p">{</span> | |||
| + <span class="s">'root'</span><span class="p">:</span> <span class="p">[</span> | |||
| + <span class="p">(</span><span class="s">r'[^/]+'</span><span class="p">,</span> <span class="n">Text</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'/\*'</span><span class="p">,</span> <span class="n">Comment</span><span class="o">.</span><span class="n">Multiline</span><span class="p">,</span> <span class="s">'comment'</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'//.*?$'</span><span class="p">,</span> <span class="n">Comment</span><span class="o">.</span><span class="n">Singleline</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'/'</span><span class="p">,</span> <span class="n">Text</span><span class="p">)</span> | |||
| + <span class="p">],</span> | |||
| + <span class="s">'comment'</span><span class="p">:</span> <span class="p">[</span> | |||
| + <span class="p">(</span><span class="s">r'[^*/]'</span><span class="p">,</span> <span class="n">Comment</span><span class="o">.</span><span class="n">Multiline</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'/\*'</span><span class="p">,</span> <span class="n">Comment</span><span class="o">.</span><span class="n">Multiline</span><span class="p">,</span> <span class="s">'#push'</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'\*/'</span><span class="p">,</span> <span class="n">Comment</span><span class="o">.</span><span class="n">Multiline</span><span class="p">,</span> <span class="s">'#pop'</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'[*/]'</span><span class="p">,</span> <span class="n">Comment</span><span class="o">.</span><span class="n">Multiline</span><span class="p">)</span> | |||
| + <span class="p">]</span> | |||
| + <span class="p">}</span> | |||
| +</pre></div> | |||
| +<p>This lexer starts lexing in the <tt class="docutils literal">'root'</tt> state. It tries to match as much as | |||
| +possible until it finds a slash (<tt class="docutils literal">'/'</tt>). If the next character after the slash | |||
| +is a star (<tt class="docutils literal">'*'</tt>) the <cite>RegexLexer</cite> sends those two characters to the output | |||
| +stream marked as <cite>Comment.Multiline</cite> and continues parsing with the rules | |||
| +defined in the <tt class="docutils literal">'comment'</tt> state.</p> | |||
| +<p>If there wasn't a star after the slash, the <cite>RegexLexer</cite> checks if it's a | |||
| +singleline comment (eg: followed by a second slash). If this also wasn't the | |||
| +case it must be a single slash (the separate regex for a single slash must also | |||
| +be given, else the slash would be marked as an error token).</p> | |||
| +<p>Inside the <tt class="docutils literal">'comment'</tt> state, we do the same thing again. Scan until the lexer | |||
| +finds a star or slash. If it's the opening of a multiline comment, push the | |||
| +<tt class="docutils literal">'comment'</tt> state on the stack and continue scanning, again in the | |||
| +<tt class="docutils literal">'comment'</tt> state. Else, check if it's the end of the multiline comment. If | |||
| +yes, pop one state from the stack.</p> | |||
| +<p>Note: If you pop from an empty stack you'll get an <cite>IndexError</cite>. (There is an | |||
| +easy way to prevent this from happening: don't <tt class="docutils literal">'#pop'</tt> in the root state).</p> | |||
| +<p>If the <cite>RegexLexer</cite> encounters a newline that is flagged as an error token, the | |||
| +stack is emptied and the lexer continues scanning in the <tt class="docutils literal">'root'</tt> state. This | |||
| +helps producing error-tolerant highlighting for erroneous input, e.g. when a | |||
| +single-line string is not closed.</p> | |||
| +</div> | |||
| +<div class="section" id="advanced-state-tricks"> | |||
| +<h3>Advanced state tricks</h3> | |||
| +<p>There are a few more things you can do with states:</p> | |||
| +<ul> | |||
| +<li><p class="first">You can push multiple states onto the stack if you give a tuple instead of a | |||
| +simple string as the third item in a rule tuple. For example, if you want to | |||
| +match a comment containing a directive, something like:</p> | |||
| +<pre class="literal-block"> | |||
| +/* <processing directive> rest of comment */ | |||
| +</pre> | |||
| +<p>you can use this rule:</p> | |||
| +<div class="syntax"><pre><span class="n">tokens</span> <span class="o">=</span> <span class="p">{</span> | |||
| + <span class="s">'root'</span><span class="p">:</span> <span class="p">[</span> | |||
| + <span class="p">(</span><span class="s">r'/\* <'</span><span class="p">,</span> <span class="n">Comment</span><span class="p">,</span> <span class="p">(</span><span class="s">'comment'</span><span class="p">,</span> <span class="s">'directive'</span><span class="p">)),</span> | |||
| + <span class="o">...</span> | |||
| + <span class="p">],</span> | |||
| + <span class="s">'directive'</span><span class="p">:</span> <span class="p">[</span> | |||
| + <span class="p">(</span><span class="s">r'[^>]*'</span><span class="p">,</span> <span class="n">Comment</span><span class="o">.</span><span class="n">Directive</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'>'</span><span class="p">,</span> <span class="n">Comment</span><span class="p">,</span> <span class="s">'#pop'</span><span class="p">),</span> | |||
| + <span class="p">],</span> | |||
| + <span class="s">'comment'</span><span class="p">:</span> <span class="p">[</span> | |||
| + <span class="p">(</span><span class="s">r'[^*]+'</span><span class="p">,</span> <span class="n">Comment</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'\*/'</span><span class="p">,</span> <span class="n">Comment</span><span class="p">,</span> <span class="s">'#pop'</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'\*'</span><span class="p">,</span> <span class="n">Comment</span><span class="p">),</span> | |||
| + <span class="p">]</span> | |||
| +<span class="p">}</span> | |||
| +</pre></div> | |||
| +<p>When this encounters the above sample, first <tt class="docutils literal">'comment'</tt> and <tt class="docutils literal">'directive'</tt> | |||
| +are pushed onto the stack, then the lexer continues in the directive state | |||
| +until it finds the closing <tt class="docutils literal">></tt>, then it continues in the comment state until | |||
| +the closing <tt class="docutils literal">*/</tt>. Then, both states are popped from the stack again and | |||
| +lexing continues in the root state.</p> | |||
| +<p><em>New in Pygments 0.9:</em> The tuple can contain the special <tt class="docutils literal">'#push'</tt> and | |||
| +<tt class="docutils literal">'#pop'</tt> (but not <tt class="docutils literal">'#pop:n'</tt>) directives.</p> | |||
| +</li> | |||
| +<li><p class="first">You can include the rules of a state in the definition of another. This is | |||
| +done by using <cite>include</cite> from <cite>pygments.lexer</cite>:</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.lexer</span> <span class="kn">import</span> <span class="n">RegexLexer</span><span class="p">,</span> <span class="n">bygroups</span><span class="p">,</span> <span class="n">include</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="o">*</span> | |||
| + | |||
| +<span class="k">class</span> <span class="nc">ExampleLexer</span><span class="p">(</span><span class="n">RegexLexer</span><span class="p">):</span> | |||
| + <span class="n">tokens</span> <span class="o">=</span> <span class="p">{</span> | |||
| + <span class="s">'comments'</span><span class="p">:</span> <span class="p">[</span> | |||
| + <span class="p">(</span><span class="s">r'/\*.*?\*/'</span><span class="p">,</span> <span class="n">Comment</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'//.*?\n'</span><span class="p">,</span> <span class="n">Comment</span><span class="p">),</span> | |||
| + <span class="p">],</span> | |||
| + <span class="s">'root'</span><span class="p">:</span> <span class="p">[</span> | |||
| + <span class="n">include</span><span class="p">(</span><span class="s">'comments'</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'(function )(\w+)( {)'</span><span class="p">,</span> | |||
| + <span class="n">bygroups</span><span class="p">(</span><span class="n">Keyword</span><span class="p">,</span> <span class="n">Name</span><span class="p">,</span> <span class="n">Keyword</span><span class="p">),</span> <span class="s">'function'</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'.'</span><span class="p">,</span> <span class="n">Text</span><span class="p">),</span> | |||
| + <span class="p">],</span> | |||
| + <span class="s">'function'</span><span class="p">:</span> <span class="p">[</span> | |||
| + <span class="p">(</span><span class="s">r'[^}/]+'</span><span class="p">,</span> <span class="n">Text</span><span class="p">),</span> | |||
| + <span class="n">include</span><span class="p">(</span><span class="s">'comments'</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'/'</span><span class="p">,</span> <span class="n">Text</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'}'</span><span class="p">,</span> <span class="n">Keyword</span><span class="p">,</span> <span class="s">'#pop'</span><span class="p">),</span> | |||
| + <span class="p">]</span> | |||
| + <span class="p">}</span> | |||
| +</pre></div> | |||
| +<p>This is a hypothetical lexer for a language that consist of functions and | |||
| +comments. Because comments can occur at toplevel and in functions, we need | |||
| +rules for comments in both states. As you can see, the <cite>include</cite> helper saves | |||
| +repeating rules that occur more than once (in this example, the state | |||
| +<tt class="docutils literal">'comment'</tt> will never be entered by the lexer, as it's only there to be | |||
| +included in <tt class="docutils literal">'root'</tt> and <tt class="docutils literal">'function'</tt>).</p> | |||
| +</li> | |||
| +<li><p class="first">Sometimes, you may want to "combine" a state from existing ones. This is | |||
| +possible with the <cite>combine</cite> helper from <cite>pygments.lexer</cite>.</p> | |||
| +<p>If you, instead of a new state, write <tt class="docutils literal"><span class="pre">combined('state1',</span> 'state2')</tt> as the | |||
| +third item of a rule tuple, a new anonymous state will be formed from state1 | |||
| +and state2 and if the rule matches, the lexer will enter this state.</p> | |||
| +<p>This is not used very often, but can be helpful in some cases, such as the | |||
| +<cite>PythonLexer</cite>'s string literal processing.</p> | |||
| +</li> | |||
| +<li><p class="first">If you want your lexer to start lexing in a different state you can modify | |||
| +the stack by overloading the <cite>get_tokens_unprocessed()</cite> method:</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.lexer</span> <span class="kn">import</span> <span class="n">RegexLexer</span> | |||
| + | |||
| +<span class="k">class</span> <span class="nc">MyLexer</span><span class="p">(</span><span class="n">RegexLexer</span><span class="p">):</span> | |||
| + <span class="n">tokens</span> <span class="o">=</span> <span class="p">{</span><span class="o">...</span><span class="p">}</span> | |||
| + | |||
| + <span class="k">def</span> <span class="nf">get_tokens_unprocessed</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">text</span><span class="p">):</span> | |||
| + <span class="n">stack</span> <span class="o">=</span> <span class="p">[</span><span class="s">'root'</span><span class="p">,</span> <span class="s">'otherstate'</span><span class="p">]</span> | |||
| + <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">RegexLexer</span><span class="o">.</span><span class="n">get_tokens_unprocessed</span><span class="p">(</span><span class="n">text</span><span class="p">,</span> <span class="n">stack</span><span class="p">):</span> | |||
| + <span class="k">yield</span> <span class="n">item</span> | |||
| +</pre></div> | |||
| +<p>Some lexers like the <cite>PhpLexer</cite> use this to make the leading <tt class="docutils literal"><span class="pre"><?php</span></tt> | |||
| +preprocessor comments optional. Note that you can crash the lexer easily | |||
| +by putting values into the stack that don't exist in the token map. Also | |||
| +removing <tt class="docutils literal">'root'</tt> from the stack can result in strange errors!</p> | |||
| +</li> | |||
| +<li><p class="first">An empty regex at the end of a state list, combined with <tt class="docutils literal">'#pop'</tt>, can | |||
| +act as a return point from a state that doesn't have a clear end marker.</p> | |||
| +</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="using-multiple-lexers"> | |||
| +<h3>Using multiple lexers</h3> | |||
| +<p>Using multiple lexers for the same input can be tricky. One of the easiest | |||
| +combination techniques is shown here: You can replace the token type entry in a | |||
| +rule tuple (the second item) with a lexer class. The matched text will then be | |||
| +lexed with that lexer, and the resulting tokens will be yielded.</p> | |||
| +<p>For example, look at this stripped-down HTML lexer:</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.lexer</span> <span class="kn">import</span> <span class="n">RegexLexer</span><span class="p">,</span> <span class="n">bygroups</span><span class="p">,</span> <span class="n">using</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="o">*</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.lexers.web</span> <span class="kn">import</span> <span class="n">JavascriptLexer</span> | |||
| + | |||
| +<span class="k">class</span> <span class="nc">HtmlLexer</span><span class="p">(</span><span class="n">RegexLexer</span><span class="p">):</span> | |||
| + <span class="n">name</span> <span class="o">=</span> <span class="s">'HTML'</span> | |||
| + <span class="n">aliases</span> <span class="o">=</span> <span class="p">[</span><span class="s">'html'</span><span class="p">]</span> | |||
| + <span class="n">filenames</span> <span class="o">=</span> <span class="p">[</span><span class="s">'*.html'</span><span class="p">,</span> <span class="s">'*.htm'</span><span class="p">]</span> | |||
| + | |||
| + <span class="n">flags</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">IGNORECASE</span> <span class="o">|</span> <span class="n">re</span><span class="o">.</span><span class="n">DOTALL</span> | |||
| + <span class="n">tokens</span> <span class="o">=</span> <span class="p">{</span> | |||
| + <span class="s">'root'</span><span class="p">:</span> <span class="p">[</span> | |||
| + <span class="p">(</span><span class="s">'[^<&]+'</span><span class="p">,</span> <span class="n">Text</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">'&.*?;'</span><span class="p">,</span> <span class="n">Name</span><span class="o">.</span><span class="n">Entity</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'<\s*script\s*'</span><span class="p">,</span> <span class="n">Name</span><span class="o">.</span><span class="n">Tag</span><span class="p">,</span> <span class="p">(</span><span class="s">'script-content'</span><span class="p">,</span> <span class="s">'tag'</span><span class="p">)),</span> | |||
| + <span class="p">(</span><span class="s">r'<\s*[a-zA-Z0-9:]+'</span><span class="p">,</span> <span class="n">Name</span><span class="o">.</span><span class="n">Tag</span><span class="p">,</span> <span class="s">'tag'</span><span class="p">),</span> | |||
| + <span class="p">(</span><span class="s">r'<\s*/\s*[a-zA-Z0-9:]+\s*>'</span><span class="p">,</span> <span class="n">Name</span><span class="o">.</span><span class="n">Tag</span><span class="p">),</span> | |||
| + <span class="p">],</span> | |||
| + <span class="s">'script-content'</span><span class="p">:</span> <span class="p">[</span> | |||
| + <span class="p">(</span><span class="s">r'(.+?)(<\s*/\s*script\s*>)'</span><span class="p">,</span> | |||
| + <span class="n">bygroups</span><span class="p">(</span><span class="n">using</span><span class="p">(</span><span class="n">JavascriptLexer</span><span class="p">),</span> <span class="n">Name</span><span class="o">.</span><span class="n">Tag</span><span class="p">),</span> | |||
| + <span class="s">'#pop'</span><span class="p">),</span> | |||
| + <span class="p">]</span> | |||
| + <span class="p">}</span> | |||
| +</pre></div> | |||
| +<p>Here the content of a <tt class="docutils literal"><script></tt> tag is passed to a newly created instance of | |||
| +a <cite>JavascriptLexer</cite> and not processed by the <cite>HtmlLexer</cite>. This is done using the | |||
| +<cite>using</cite> helper that takes the other lexer class as its parameter.</p> | |||
| +<p>Note the combination of <cite>bygroups</cite> and <cite>using</cite>. This makes sure that the content | |||
| +up to the <tt class="docutils literal"></script></tt> end tag is processed by the <cite>JavascriptLexer</cite>, while the | |||
| +end tag is yielded as a normal token with the <cite>Name.Tag</cite> type.</p> | |||
| +<p>As an additional goodie, if the lexer class is replaced by <cite>this</cite> (imported from | |||
| +<cite>pygments.lexer</cite>), the "other" lexer will be the current one (because you cannot | |||
| +refer to the current class within the code that runs at class definition time).</p> | |||
| +<p>Also note the <tt class="docutils literal"><span class="pre">(r'<\s*script\s*',</span> Name.Tag, <span class="pre">('script-content',</span> <span class="pre">'tag'))</span></tt> rule. | |||
| +Here, two states are pushed onto the state stack, <tt class="docutils literal"><span class="pre">'script-content'</span></tt> and | |||
| +<tt class="docutils literal">'tag'</tt>. That means that first <tt class="docutils literal">'tag'</tt> is processed, which will parse | |||
| +attributes and the closing <tt class="docutils literal">></tt>, then the <tt class="docutils literal">'tag'</tt> state is popped and the | |||
| +next state on top of the stack will be <tt class="docutils literal"><span class="pre">'script-content'</span></tt>.</p> | |||
| +<p>The <cite>using()</cite> helper has a special keyword argument, <cite>state</cite>, which works as | |||
| +follows: if given, the lexer to use initially is not in the <tt class="docutils literal">"root"</tt> state, | |||
| +but in the state given by this argument. This <em>only</em> works with a <cite>RegexLexer</cite>.</p> | |||
| +<p>Any other keywords arguments passed to <cite>using()</cite> are added to the keyword | |||
| +arguments used to create the lexer.</p> | |||
| +</div> | |||
| +<div class="section" id="delegating-lexer"> | |||
| +<h3>Delegating Lexer</h3> | |||
| +<p>Another approach for nested lexers is the <cite>DelegatingLexer</cite> which is for | |||
| +example used for the template engine lexers. It takes two lexers as | |||
| +arguments on initialisation: a <cite>root_lexer</cite> and a <cite>language_lexer</cite>.</p> | |||
| +<p>The input is processed as follows: First, the whole text is lexed with the | |||
| +<cite>language_lexer</cite>. All tokens yielded with a type of <tt class="docutils literal">Other</tt> are then | |||
| +concatenated and given to the <cite>root_lexer</cite>. The language tokens of the | |||
| +<cite>language_lexer</cite> are then inserted into the <cite>root_lexer</cite>'s token stream | |||
| +at the appropriate positions.</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.lexer</span> <span class="kn">import</span> <span class="n">DelegatingLexer</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.lexers.web</span> <span class="kn">import</span> <span class="n">HtmlLexer</span><span class="p">,</span> <span class="n">PhpLexer</span> | |||
| + | |||
| +<span class="k">class</span> <span class="nc">HtmlPhpLexer</span><span class="p">(</span><span class="n">DelegatingLexer</span><span class="p">):</span> | |||
| + <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">options</span><span class="p">):</span> | |||
| + <span class="nb">super</span><span class="p">(</span><span class="n">HtmlPhpLexer</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="n">HtmlLexer</span><span class="p">,</span> <span class="n">PhpLexer</span><span class="p">,</span> <span class="o">**</span><span class="n">options</span><span class="p">)</span> | |||
| +</pre></div> | |||
| +<p>This procedure ensures that e.g. HTML with template tags in it is highlighted | |||
| +correctly even if the template tags are put into HTML tags or attributes.</p> | |||
| +<p>If you want to change the needle token <tt class="docutils literal">Other</tt> to something else, you can | |||
| +give the lexer another token type as the third parameter:</p> | |||
| +<div class="syntax"><pre><span class="n">DelegatingLexer</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="n">MyLexer</span><span class="p">,</span> <span class="n">OtherLexer</span><span class="p">,</span> <span class="n">Text</span><span class="p">,</span> <span class="o">**</span><span class="n">options</span><span class="p">)</span> | |||
| +</pre></div> | |||
| +</div> | |||
| +<div class="section" id="callbacks"> | |||
| +<h3>Callbacks</h3> | |||
| +<p>Sometimes the grammar of a language is so complex that a lexer would be unable | |||
| +to parse it just by using regular expressions and stacks.</p> | |||
| +<p>For this, the <cite>RegexLexer</cite> allows callbacks to be given in rule tuples, instead | |||
| +of token types (<cite>bygroups</cite> and <cite>using</cite> are nothing else but preimplemented | |||
| +callbacks). The callback must be a function taking two arguments:</p> | |||
| +<ul class="simple"> | |||
| +<li>the lexer itself</li> | |||
| +<li>the match object for the last matched rule</li> | |||
| +</ul> | |||
| +<p>The callback must then return an iterable of (or simply yield) <tt class="docutils literal">(index, | |||
| +tokentype, value)</tt> tuples, which are then just passed through by | |||
| +<cite>get_tokens_unprocessed()</cite>. The <tt class="docutils literal">index</tt> here is the position of the token in | |||
| +the input string, <tt class="docutils literal">tokentype</tt> is the normal token type (like <cite>Name.Builtin</cite>), | |||
| +and <tt class="docutils literal">value</tt> the associated part of the input string.</p> | |||
| +<p>You can see an example here:</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.lexer</span> <span class="kn">import</span> <span class="n">RegexLexer</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="n">Generic</span> | |||
| + | |||
| +<span class="k">class</span> <span class="nc">HypotheticLexer</span><span class="p">(</span><span class="n">RegexLexer</span><span class="p">):</span> | |||
| + | |||
| + <span class="k">def</span> <span class="nf">headline_callback</span><span class="p">(</span><span class="n">lexer</span><span class="p">,</span> <span class="n">match</span><span class="p">):</span> | |||
| + <span class="n">equal_signs</span> <span class="o">=</span> <span class="n">match</span><span class="o">.</span><span class="n">group</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> | |||
| + <span class="n">text</span> <span class="o">=</span> <span class="n">match</span><span class="o">.</span><span class="n">group</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> | |||
| + <span class="k">yield</span> <span class="n">match</span><span class="o">.</span><span class="n">start</span><span class="p">(),</span> <span class="n">Generic</span><span class="o">.</span><span class="n">Headline</span><span class="p">,</span> <span class="n">equal_signs</span> <span class="o">+</span> <span class="n">text</span> <span class="o">+</span> <span class="n">equal_signs</span> | |||
| + | |||
| + <span class="n">tokens</span> <span class="o">=</span> <span class="p">{</span> | |||
| + <span class="s">'root'</span><span class="p">:</span> <span class="p">[</span> | |||
| + <span class="p">(</span><span class="s">r'(=+)(.*?)(\1)'</span><span class="p">,</span> <span class="n">headline_callback</span><span class="p">)</span> | |||
| + <span class="p">]</span> | |||
| + <span class="p">}</span> | |||
| +</pre></div> | |||
| +<p>If the regex for the <cite>headline_callback</cite> matches, the function is called with the | |||
| +match object. Note that after the callback is done, processing continues | |||
| +normally, that is, after the end of the previous match. The callback has no | |||
| +possibility to influence the position.</p> | |||
| +<p>There are not really any simple examples for lexer callbacks, but you can see | |||
| +them in action e.g. in the <a class="reference external" href="http://bitbucket.org/birkenfeld/pygments-main/src/tip/pygments/lexers/compiled.py">compiled.py</a> source code in the <cite>CLexer</cite> and | |||
| +<cite>JavaLexer</cite> classes.</p> | |||
| +</div> | |||
| +<div class="section" id="the-extendedregexlexer-class"> | |||
| +<h3>The ExtendedRegexLexer class</h3> | |||
| +<p>The <cite>RegexLexer</cite>, even with callbacks, unfortunately isn't powerful enough for | |||
| +the funky syntax rules of some languages that will go unnamed, such as Ruby.</p> | |||
| +<p>But fear not; even then you don't have to abandon the regular expression | |||
| +approach. For Pygments has a subclass of <cite>RegexLexer</cite>, the <cite>ExtendedRegexLexer</cite>. | |||
| +All features known from RegexLexers are available here too, and the tokens are | |||
| +specified in exactly the same way, <em>except</em> for one detail:</p> | |||
| +<p>The <cite>get_tokens_unprocessed()</cite> method holds its internal state data not as local | |||
| +variables, but in an instance of the <cite>pygments.lexer.LexerContext</cite> class, and | |||
| +that instance is passed to callbacks as a third argument. This means that you | |||
| +can modify the lexer state in callbacks.</p> | |||
| +<p>The <cite>LexerContext</cite> class has the following members:</p> | |||
| +<ul class="simple"> | |||
| +<li><cite>text</cite> -- the input text</li> | |||
| +<li><cite>pos</cite> -- the current starting position that is used for matching regexes</li> | |||
| +<li><cite>stack</cite> -- a list containing the state stack</li> | |||
| +<li><cite>end</cite> -- the maximum position to which regexes are matched, this defaults to | |||
| +the length of <cite>text</cite></li> | |||
| +</ul> | |||
| +<p>Additionally, the <cite>get_tokens_unprocessed()</cite> method can be given a | |||
| +<cite>LexerContext</cite> instead of a string and will then process this context instead of | |||
| +creating a new one for the string argument.</p> | |||
| +<p>Note that because you can set the current position to anything in the callback, | |||
| +it won't be automatically be set by the caller after the callback is finished. | |||
| +For example, this is how the hypothetical lexer above would be written with the | |||
| +<cite>ExtendedRegexLexer</cite>:</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.lexer</span> <span class="kn">import</span> <span class="n">ExtendedRegexLexer</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="n">Generic</span> | |||
| + | |||
| +<span class="k">class</span> <span class="nc">ExHypotheticLexer</span><span class="p">(</span><span class="n">ExtendedRegexLexer</span><span class="p">):</span> | |||
| + | |||
| + <span class="k">def</span> <span class="nf">headline_callback</span><span class="p">(</span><span class="n">lexer</span><span class="p">,</span> <span class="n">match</span><span class="p">,</span> <span class="n">ctx</span><span class="p">):</span> | |||
| + <span class="n">equal_signs</span> <span class="o">=</span> <span class="n">match</span><span class="o">.</span><span class="n">group</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> | |||
| + <span class="n">text</span> <span class="o">=</span> <span class="n">match</span><span class="o">.</span><span class="n">group</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> | |||
| + <span class="k">yield</span> <span class="n">match</span><span class="o">.</span><span class="n">start</span><span class="p">(),</span> <span class="n">Generic</span><span class="o">.</span><span class="n">Headline</span><span class="p">,</span> <span class="n">equal_signs</span> <span class="o">+</span> <span class="n">text</span> <span class="o">+</span> <span class="n">equal_signs</span> | |||
| + <span class="n">ctx</span><span class="o">.</span><span class="n">pos</span> <span class="o">=</span> <span class="n">match</span><span class="o">.</span><span class="n">end</span><span class="p">()</span> | |||
| + | |||
| + <span class="n">tokens</span> <span class="o">=</span> <span class="p">{</span> | |||
| + <span class="s">'root'</span><span class="p">:</span> <span class="p">[</span> | |||
| + <span class="p">(</span><span class="s">r'(=+)(.*?)(\1)'</span><span class="p">,</span> <span class="n">headline_callback</span><span class="p">)</span> | |||
| + <span class="p">]</span> | |||
| + <span class="p">}</span> | |||
| +</pre></div> | |||
| +<p>This might sound confusing (and it can really be). But it is needed, and for an | |||
| +example look at the Ruby lexer in <a class="reference external" href="https://bitbucket.org/birkenfeld/pygments-main/src/tip/pygments/lexers/agile.py">agile.py</a>.</p> | |||
| +</div> | |||
| +<div class="section" id="filtering-token-streams"> | |||
| +<h3>Filtering Token Streams</h3> | |||
| +<p>Some languages ship a lot of builtin functions (for example PHP). The total | |||
| +amount of those functions differs from system to system because not everybody | |||
| +has every extension installed. In the case of PHP there are over 3000 builtin | |||
| +functions. That's an incredible huge amount of functions, much more than you | |||
| +can put into a regular expression.</p> | |||
| +<p>But because only <cite>Name</cite> tokens can be function names it's solvable by overriding | |||
| +the <tt class="docutils literal">get_tokens_unprocessed()</tt> method. The following lexer subclasses the | |||
| +<cite>PythonLexer</cite> so that it highlights some additional names as pseudo keywords:</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.lexers.agile</span> <span class="kn">import</span> <span class="n">PythonLexer</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="n">Name</span><span class="p">,</span> <span class="n">Keyword</span> | |||
| + | |||
| +<span class="k">class</span> <span class="nc">MyPythonLexer</span><span class="p">(</span><span class="n">PythonLexer</span><span class="p">):</span> | |||
| + <span class="n">EXTRA_KEYWORDS</span> <span class="o">=</span> <span class="p">[</span><span class="s">'foo'</span><span class="p">,</span> <span class="s">'bar'</span><span class="p">,</span> <span class="s">'foobar'</span><span class="p">,</span> <span class="s">'barfoo'</span><span class="p">,</span> <span class="s">'spam'</span><span class="p">,</span> <span class="s">'eggs'</span><span class="p">]</span> | |||
| + | |||
| + <span class="k">def</span> <span class="nf">get_tokens_unprocessed</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">text</span><span class="p">):</span> | |||
| + <span class="k">for</span> <span class="n">index</span><span class="p">,</span> <span class="n">token</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">PythonLexer</span><span class="o">.</span><span class="n">get_tokens_unprocessed</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">text</span><span class="p">):</span> | |||
| + <span class="k">if</span> <span class="n">token</span> <span class="ow">is</span> <span class="n">Name</span> <span class="ow">and</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">EXTRA_KEYWORDS</span><span class="p">:</span> | |||
| + <span class="k">yield</span> <span class="n">index</span><span class="p">,</span> <span class="n">Keyword</span><span class="o">.</span><span class="n">Pseudo</span><span class="p">,</span> <span class="n">value</span> | |||
| + <span class="k">else</span><span class="p">:</span> | |||
| + <span class="k">yield</span> <span class="n">index</span><span class="p">,</span> <span class="n">token</span><span class="p">,</span> <span class="n">value</span> | |||
| +</pre></div> | |||
| +<p>The <cite>PhpLexer</cite> and <cite>LuaLexer</cite> use this method to resolve builtin functions.</p> | |||
| +<p><strong>Note</strong> Do not confuse this with the <a class="reference external" href="./filters.html">filter</a> system.</p> | |||
| +</div> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:42.356609 | |||
| + file id: lexerdevelopment --> | |||
| +</html> | |||
5,359
vendor/pygments/docs/build/lexers.html
5,359 additions,
0 deletions
not shown because the diff is too large. Please use a local Git client to view these changes.
245
vendor/pygments/docs/build/moinmoin.html
| @@ -0,0 +1,245 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Using Pygments with MoinMoin — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Using Pygments with MoinMoin</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <!-- -*- mode: rst -*- --> | |||
| +<p>From Pygments 0.7, the source distribution ships a <a class="reference external" href="http://moinmoin.wikiwikiweb.de/">Moin</a> parser plugin that | |||
| +can be used to get Pygments highlighting in Moin wiki pages.</p> | |||
| +<p>To use it, copy the file <cite>external/moin-parser.py</cite> from the Pygments | |||
| +distribution to the <cite>data/plugin/parser</cite> subdirectory of your Moin instance. | |||
| +Edit the options at the top of the file (currently <tt class="docutils literal">ATTACHMENTS</tt> and | |||
| +<tt class="docutils literal">INLINESTYLES</tt>) and rename the file to the name that the parser directive | |||
| +should have. For example, if you name the file <tt class="docutils literal">code.py</tt>, you can get a | |||
| +highlighted Python code sample with this Wiki markup:</p> | |||
| +<pre class="literal-block"> | |||
| +{{{ | |||
| +#!code python | |||
| +[...] | |||
| +}}} | |||
| +</pre> | |||
| +<p>where <tt class="docutils literal">python</tt> is the Pygments name of the lexer to use.</p> | |||
| +<p>Additionally, if you set the <tt class="docutils literal">ATTACHMENTS</tt> option to True, Pygments will also | |||
| +be called for all attachments for whose filenames there is no other parser | |||
| +registered.</p> | |||
| +<p>You are responsible for including CSS rules that will map the Pygments CSS | |||
| +classes to colors. You can output a stylesheet file with <cite>pygmentize</cite>, put it | |||
| +into the <cite>htdocs</cite> directory of your Moin instance and then include it in the | |||
| +<cite>stylesheets</cite> configuration option in the Moin config, e.g.:</p> | |||
| +<pre class="literal-block"> | |||
| +stylesheets = [('screen', '/htdocs/pygments.css')] | |||
| +</pre> | |||
| +<p>If you do not want to do that and are willing to accept larger HTML output, you | |||
| +can set the <tt class="docutils literal">INLINESTYLES</tt> option to True.</p> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:43.122842 | |||
| + file id: moinmoin --> | |||
| +</html> | |||
294
vendor/pygments/docs/build/plugins.html
| @@ -0,0 +1,294 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Register Plugins — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Register Plugins</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <div class="toc"> | |||
| + <h2>Contents</h2> | |||
| + <ul class="contents"> | |||
| + | |||
| + <li><a href="#entrypoints">Entrypoints</a></li> | |||
| + | |||
| + <li><a href="#how-to-use-entrypoints">How To Use Entrypoints</a></li> | |||
| + | |||
| + <li><a href="#extending-the-core">Extending The Core</a></li> | |||
| + | |||
| + </ul> | |||
| + </div> | |||
| + | |||
| + <p>If you want to extend Pygments without hacking the sources, but want to | |||
| +use the lexer/formatter/style/filter lookup functions (<cite>lexers.get_lexer_by_name</cite> | |||
| +et al.), you can use <a class="reference external" href="http://peak.telecommunity.com/DevCenter/setuptools">setuptools</a> entrypoints to add new lexers, formatters | |||
| +or styles as if they were in the Pygments core.</p> | |||
| +<p>That means you can use your highlighter modules with the <cite>pygmentize</cite> script, | |||
| +which relies on the mentioned functions.</p> | |||
| +<div class="section" id="entrypoints"> | |||
| +<h3>Entrypoints</h3> | |||
| +<p>Here is a list of setuptools entrypoints that Pygments understands:</p> | |||
| +<p><cite>pygments.lexers</cite></p> | |||
| +<blockquote> | |||
| +<p>This entrypoint is used for adding new lexers to the Pygments core. | |||
| +The name of the entrypoint values doesn't really matter, Pygments extracts | |||
| +required metadata from the class definition:</p> | |||
| +<div class="syntax"><pre><span class="k">[pygments.lexers]</span> | |||
| +<span class="na">yourlexer</span> <span class="o">=</span> <span class="s">yourmodule:YourLexer</span> | |||
| +</pre></div> | |||
| +<p>Note that you have to define <tt class="docutils literal">name</tt>, <tt class="docutils literal">aliases</tt> and <tt class="docutils literal">filename</tt> | |||
| +attributes so that you can use the highlighter from the command line:</p> | |||
| +<div class="syntax"><pre><span class="k">class</span> <span class="nc">YourLexer</span><span class="p">(</span><span class="o">...</span><span class="p">):</span> | |||
| + <span class="n">name</span> <span class="o">=</span> <span class="s">'Name Of Your Lexer'</span> | |||
| + <span class="n">aliases</span> <span class="o">=</span> <span class="p">[</span><span class="s">'alias'</span><span class="p">]</span> | |||
| + <span class="n">filenames</span> <span class="o">=</span> <span class="p">[</span><span class="s">'*.ext'</span><span class="p">]</span> | |||
| +</pre></div> | |||
| +</blockquote> | |||
| +<p><cite>pygments.formatters</cite></p> | |||
| +<blockquote> | |||
| +<p>You can use this entrypoint to add new formatters to Pygments. The | |||
| +name of an entrypoint item is the name of the formatter. If you | |||
| +prefix the name with a slash it's used as a filename pattern:</p> | |||
| +<div class="syntax"><pre><span class="k">[pygments.formatters]</span> | |||
| +<span class="na">yourformatter</span> <span class="o">=</span> <span class="s">yourmodule:YourFormatter</span> | |||
| +<span class="na">/.ext</span> <span class="o">=</span> <span class="s">yourmodule:YourFormatter</span> | |||
| +</pre></div> | |||
| +</blockquote> | |||
| +<p><cite>pygments.styles</cite></p> | |||
| +<blockquote> | |||
| +<p>To add a new style you can use this entrypoint. The name of the entrypoint | |||
| +is the name of the style:</p> | |||
| +<div class="syntax"><pre><span class="k">[pygments.styles]</span> | |||
| +<span class="na">yourstyle</span> <span class="o">=</span> <span class="s">yourmodule:YourStyle</span> | |||
| +</pre></div> | |||
| +</blockquote> | |||
| +<p><cite>pygments.filters</cite></p> | |||
| +<blockquote> | |||
| +<p>Use this entrypoint to register a new filter. The name of the | |||
| +entrypoint is the name of the filter:</p> | |||
| +<div class="syntax"><pre><span class="k">[pygments.filters]</span> | |||
| +<span class="na">yourfilter</span> <span class="o">=</span> <span class="s">yourmodule:YourFilter</span> | |||
| +</pre></div> | |||
| +</blockquote> | |||
| +</div> | |||
| +<div class="section" id="how-to-use-entrypoints"> | |||
| +<h3>How To Use Entrypoints</h3> | |||
| +<p>This documentation doesn't explain how to use those entrypoints because this is | |||
| +covered in the <a class="reference external" href="http://peak.telecommunity.com/DevCenter/setuptools">setuptools documentation</a>. That page should cover everything | |||
| +you need to write a plugin.</p> | |||
| +</div> | |||
| +<div class="section" id="extending-the-core"> | |||
| +<h3>Extending The Core</h3> | |||
| +<p>If you have written a Pygments plugin that is open source, please inform us | |||
| +about that. There is a high chance that we'll add it to the Pygments | |||
| +distribution.</p> | |||
| +</div> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:43.232227 | |||
| + file id: plugins --> | |||
| +</html> | |||
390
vendor/pygments/docs/build/quickstart.html
| @@ -0,0 +1,390 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Introduction and Quickstart — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Introduction and Quickstart</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <div class="toc"> | |||
| + <h2>Contents</h2> | |||
| + <ul class="contents"> | |||
| + | |||
| + <li><a href="#architecture">Architecture</a></li> | |||
| + | |||
| + <li><a href="#example">Example</a></li> | |||
| + | |||
| + <li><a href="#options">Options</a></li> | |||
| + | |||
| + <li><a href="#lexer-and-formatter-lookup">Lexer and formatter lookup</a></li> | |||
| + | |||
| + <li><a href="#guessing-lexers">Guessing lexers</a></li> | |||
| + | |||
| + <li><a href="#command-line-usage">Command line usage</a></li> | |||
| + | |||
| + </ul> | |||
| + </div> | |||
| + | |||
| + <!-- -*- mode: rst -*- --> | |||
| +<p>Welcome to Pygments! This document explains the basic concepts and terms and | |||
| +gives a few examples of how to use the library.</p> | |||
| +<div class="section" id="architecture"> | |||
| +<h3>Architecture</h3> | |||
| +<p>There are four types of components that work together highlighting a piece of | |||
| +code:</p> | |||
| +<ul class="simple"> | |||
| +<li>A <strong>lexer</strong> splits the source into tokens, fragments of the source that | |||
| +have a token type that determines what the text represents semantically | |||
| +(e.g., keyword, string, or comment). There is a lexer for every language | |||
| +or markup format that Pygments supports.</li> | |||
| +<li>The token stream can be piped through <strong>filters</strong>, which usually modify | |||
| +the token types or text fragments, e.g. uppercasing all keywords.</li> | |||
| +<li>A <strong>formatter</strong> then takes the token stream and writes it to an output | |||
| +file, in a format such as HTML, LaTeX or RTF.</li> | |||
| +<li>While writing the output, a <strong>style</strong> determines how to highlight all the | |||
| +different token types. It maps them to attributes like "red and bold".</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="example"> | |||
| +<h3>Example</h3> | |||
| +<p>Here is a small example for highlighting Python code:</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments</span> <span class="kn">import</span> <span class="n">highlight</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.lexers</span> <span class="kn">import</span> <span class="n">PythonLexer</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.formatters</span> <span class="kn">import</span> <span class="n">HtmlFormatter</span> | |||
| + | |||
| +<span class="n">code</span> <span class="o">=</span> <span class="s">'print "Hello World"'</span> | |||
| +<span class="k">print</span> <span class="n">highlight</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="n">PythonLexer</span><span class="p">(),</span> <span class="n">HtmlFormatter</span><span class="p">())</span> | |||
| +</pre></div> | |||
| +<p>which prints something like this:</p> | |||
| +<div class="syntax"><pre><span class="nt"><div</span> <span class="na">class=</span><span class="s">"highlight"</span><span class="nt">></span> | |||
| +<span class="nt"><pre><span</span> <span class="na">class=</span><span class="s">"k"</span><span class="nt">></span>print<span class="nt"></span></span> <span class="nt"><span</span> <span class="na">class=</span><span class="s">"s"</span><span class="nt">></span><span class="ni">&quot;</span>Hello World<span class="ni">&quot;</span><span class="nt"></span></pre></span> | |||
| +<span class="nt"></div></span> | |||
| +</pre></div> | |||
| +<p>As you can see, Pygments uses CSS classes (by default, but you can change that) | |||
| +instead of inline styles in order to avoid outputting redundant style information over | |||
| +and over. A CSS stylesheet that contains all CSS classes possibly used in the output | |||
| +can be produced by:</p> | |||
| +<div class="syntax"><pre><span class="k">print</span> <span class="n">HtmlFormatter</span><span class="p">()</span><span class="o">.</span><span class="n">get_style_defs</span><span class="p">(</span><span class="s">'.highlight'</span><span class="p">)</span> | |||
| +</pre></div> | |||
| +<p>The argument to <cite>get_style_defs</cite> is used as an additional CSS selector: the output | |||
| +may look like this:</p> | |||
| +<div class="syntax"><pre><span class="nc">.highlight</span> <span class="nc">.k</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#AA22FF</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> | |||
| +<span class="nc">.highlight</span> <span class="nc">.s</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#BB4444</span> <span class="p">}</span> | |||
| +<span class="o">...</span> | |||
| +</pre></div> | |||
| +</div> | |||
| +<div class="section" id="options"> | |||
| +<h3>Options</h3> | |||
| +<p>The <cite>highlight()</cite> function supports a fourth argument called <cite>outfile</cite>, it must be | |||
| +a file object if given. The formatted output will then be written to this file | |||
| +instead of being returned as a string.</p> | |||
| +<p>Lexers and formatters both support options. They are given to them as keyword | |||
| +arguments either to the class or to the lookup method:</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments</span> <span class="kn">import</span> <span class="n">highlight</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.lexers</span> <span class="kn">import</span> <span class="n">get_lexer_by_name</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.formatters</span> <span class="kn">import</span> <span class="n">HtmlFormatter</span> | |||
| + | |||
| +<span class="n">lexer</span> <span class="o">=</span> <span class="n">get_lexer_by_name</span><span class="p">(</span><span class="s">"python"</span><span class="p">,</span> <span class="n">stripall</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span> | |||
| +<span class="n">formatter</span> <span class="o">=</span> <span class="n">HtmlFormatter</span><span class="p">(</span><span class="n">linenos</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">cssclass</span><span class="o">=</span><span class="s">"source"</span><span class="p">)</span> | |||
| +<span class="n">result</span> <span class="o">=</span> <span class="n">highlight</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="n">lexer</span><span class="p">,</span> <span class="n">formatter</span><span class="p">)</span> | |||
| +</pre></div> | |||
| +<p>This makes the lexer strip all leading and trailing whitespace from the input | |||
| +(<cite>stripall</cite> option), lets the formatter output line numbers (<cite>linenos</cite> option), | |||
| +and sets the wrapping <tt class="docutils literal"><div></tt>'s class to <tt class="docutils literal">source</tt> (instead of | |||
| +<tt class="docutils literal">highlight</tt>).</p> | |||
| +<p>Important options include:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>encoding</cite> <span class="classifier-delimiter">:</span> <span class="classifier">for lexers and formatters</span></dt> | |||
| +<dd>Since Pygments uses Unicode strings internally, this determines which | |||
| +encoding will be used to convert to or from byte strings.</dd> | |||
| +<dt><cite>style</cite> <span class="classifier-delimiter">:</span> <span class="classifier">for formatters</span></dt> | |||
| +<dd>The name of the style to use when writing the output.</dd> | |||
| +</dl> | |||
| +<p>For an overview of builtin lexers and formatters and their options, visit the | |||
| +<a class="reference external" href="./lexers.html">lexer</a> and <a class="reference external" href="./formatters.html">formatters</a> lists.</p> | |||
| +<p>For a documentation on filters, see <a class="reference external" href="./filters.html">this page</a>.</p> | |||
| +</div> | |||
| +<div class="section" id="lexer-and-formatter-lookup"> | |||
| +<h3>Lexer and formatter lookup</h3> | |||
| +<p>If you want to lookup a built-in lexer by its alias or a filename, you can use | |||
| +one of the following methods:</p> | |||
| +<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.lexers</span> <span class="kn">import</span> <span class="p">(</span><span class="n">get_lexer_by_name</span><span class="p">,</span> | |||
| +<span class="gp">... </span> <span class="n">get_lexer_for_filename</span><span class="p">,</span> <span class="n">get_lexer_for_mimetype</span><span class="p">)</span> | |||
| + | |||
| +<span class="gp">>>> </span><span class="n">get_lexer_by_name</span><span class="p">(</span><span class="s">'python'</span><span class="p">)</span> | |||
| +<span class="go"><pygments.lexers.PythonLexer></span> | |||
| + | |||
| +<span class="gp">>>> </span><span class="n">get_lexer_for_filename</span><span class="p">(</span><span class="s">'spam.rb'</span><span class="p">)</span> | |||
| +<span class="go"><pygments.lexers.RubyLexer></span> | |||
| + | |||
| +<span class="gp">>>> </span><span class="n">get_lexer_for_mimetype</span><span class="p">(</span><span class="s">'text/x-perl'</span><span class="p">)</span> | |||
| +<span class="go"><pygments.lexers.PerlLexer></span> | |||
| +</pre></div> | |||
| +<p>All these functions accept keyword arguments; they will be passed to the lexer | |||
| +as options.</p> | |||
| +<p>A similar API is available for formatters: use <cite>get_formatter_by_name()</cite> and | |||
| +<cite>get_formatter_for_filename()</cite> from the <cite>pygments.formatters</cite> module | |||
| +for this purpose.</p> | |||
| +</div> | |||
| +<div class="section" id="guessing-lexers"> | |||
| +<h3>Guessing lexers</h3> | |||
| +<p>If you don't know the content of the file, or you want to highlight a file | |||
| +whose extension is ambiguous, such as <tt class="docutils literal">.html</tt> (which could contain plain HTML | |||
| +or some template tags), use these functions:</p> | |||
| +<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.lexers</span> <span class="kn">import</span> <span class="n">guess_lexer</span><span class="p">,</span> <span class="n">guess_lexer_for_filename</span> | |||
| + | |||
| +<span class="gp">>>> </span><span class="n">guess_lexer</span><span class="p">(</span><span class="s">'#!/usr/bin/python</span><span class="se">\n</span><span class="s">print "Hello World!"'</span><span class="p">)</span> | |||
| +<span class="go"><pygments.lexers.PythonLexer></span> | |||
| + | |||
| +<span class="gp">>>> </span><span class="n">guess_lexer_for_filename</span><span class="p">(</span><span class="s">'test.py'</span><span class="p">,</span> <span class="s">'print "Hello World!"'</span><span class="p">)</span> | |||
| +<span class="go"><pygments.lexers.PythonLexer></span> | |||
| +</pre></div> | |||
| +<p><cite>guess_lexer()</cite> passes the given content to the lexer classes' <cite>analyse_text()</cite> | |||
| +method and returns the one for which it returns the highest number.</p> | |||
| +<p>All lexers have two different filename pattern lists: the primary and the | |||
| +secondary one. The <cite>get_lexer_for_filename()</cite> function only uses the primary | |||
| +list, whose entries are supposed to be unique among all lexers. | |||
| +<cite>guess_lexer_for_filename()</cite>, however, will first loop through all lexers and | |||
| +look at the primary and secondary filename patterns if the filename matches. | |||
| +If only one lexer matches, it is returned, else the guessing mechanism of | |||
| +<cite>guess_lexer()</cite> is used with the matching lexers.</p> | |||
| +<p>As usual, keyword arguments to these functions are given to the created lexer | |||
| +as options.</p> | |||
| +</div> | |||
| +<div class="section" id="command-line-usage"> | |||
| +<h3>Command line usage</h3> | |||
| +<p>You can use Pygments from the command line, using the <cite>pygmentize</cite> script:</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize test.py | |||
| +</pre> | |||
| +<p>will highlight the Python file test.py using ANSI escape sequences | |||
| +(a.k.a. terminal colors) and print the result to standard output.</p> | |||
| +<p>To output HTML, use the <tt class="docutils literal"><span class="pre">-f</span></tt> option:</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize -f html -o test.html test.py | |||
| +</pre> | |||
| +<p>to write an HTML-highlighted version of test.py to the file test.html. | |||
| +Note that it will only be a snippet of HTML, if you want a full HTML document, | |||
| +use the "full" option:</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize -f html -O full -o test.html test.py | |||
| +</pre> | |||
| +<p>This will produce a full HTML document with included stylesheet.</p> | |||
| +<p>A style can be selected with <tt class="docutils literal"><span class="pre">-O</span> <span class="pre">style=<name></span></tt>.</p> | |||
| +<p>If you need a stylesheet for an existing HTML file using Pygments CSS classes, | |||
| +it can be created with:</p> | |||
| +<pre class="literal-block"> | |||
| +$ pygmentize -S default -f html > style.css | |||
| +</pre> | |||
| +<p>where <tt class="docutils literal">default</tt> is the style name.</p> | |||
| +<p>More options and tricks and be found in the <a class="reference external" href="./cmdline.html">command line reference</a>.</p> | |||
| +</div> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:43.152015 | |||
| + file id: quickstart --> | |||
| +</html> | |||
229
vendor/pygments/docs/build/rstdirective.html
| @@ -0,0 +1,229 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Using Pygments in ReST documents — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Using Pygments in ReST documents</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <!-- -*- mode: rst -*- --> | |||
| +<p>Many Python people use <a class="reference external" href="http://docutils.sf.net/rst.html">ReST</a> for documentation their sourcecode, programs, | |||
| +scripts et cetera. This also means that documentation often includes sourcecode | |||
| +samples or snippets.</p> | |||
| +<p>You can easily enable Pygments support for your ReST texts using a custom | |||
| +directive -- this is also how this documentation displays source code.</p> | |||
| +<p>From Pygments 0.9, the directive is shipped in the distribution as | |||
| +<cite>external/rst-directive.py</cite>. You can copy and adapt this code to your liking.</p> | |||
| +<!-- removed - - too confusing | |||
| +*Loosely related note:* The ReST lexer now recognizes ``.. sourcecode::`` and | |||
| +``.. code::`` directives and highlights the contents in the specified language | |||
| +if the `handlecodeblocks` option is true. --> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:43.959525 | |||
| + file id: rstdirective --> | |||
| +</html> | |||
341
vendor/pygments/docs/build/styles.html
| @@ -0,0 +1,341 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Styles — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Styles</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <div class="toc"> | |||
| + <h2>Contents</h2> | |||
| + <ul class="contents"> | |||
| + | |||
| + <li><a href="#creating-own-styles">Creating Own Styles</a></li> | |||
| + | |||
| + <li><a href="#style-rules">Style Rules</a></li> | |||
| + | |||
| + <li><a href="#builtin-styles">Builtin Styles</a></li> | |||
| + | |||
| + <li><a href="#getting-a-list-of-available-styles">Getting a list of available styles</a></li> | |||
| + | |||
| + </ul> | |||
| + </div> | |||
| + | |||
| + <!-- -*- mode: rst -*- --> | |||
| +<p>Pygments comes with some builtin styles that work for both the HTML and | |||
| +LaTeX formatter.</p> | |||
| +<p>The builtin styles can be looked up with the <cite>get_style_by_name</cite> function:</p> | |||
| +<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.styles</span> <span class="kn">import</span> <span class="n">get_style_by_name</span> | |||
| +<span class="gp">>>> </span><span class="n">get_style_by_name</span><span class="p">(</span><span class="s">'colorful'</span><span class="p">)</span> | |||
| +<span class="go"><class 'pygments.styles.colorful.ColorfulStyle'></span> | |||
| +</pre></div> | |||
| +<p>You can pass a instance of a <cite>Style</cite> class to a formatter as the <cite>style</cite> | |||
| +option in form of a string:</p> | |||
| +<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.styles</span> <span class="kn">import</span> <span class="n">get_style_by_name</span> | |||
| +<span class="gp">>>> </span><span class="n">HtmlFormatter</span><span class="p">(</span><span class="n">style</span><span class="o">=</span><span class="s">'colorful'</span><span class="p">)</span><span class="o">.</span><span class="n">style</span> | |||
| +<span class="go"><class 'pygments.styles.colorful.ColorfulStyle'></span> | |||
| +</pre></div> | |||
| +<p>Or you can also import your own style (which must be a subclass of | |||
| +<cite>pygments.style.Style</cite>) and pass it to the formatter:</p> | |||
| +<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">yourapp.yourmodule</span> <span class="kn">import</span> <span class="n">YourStyle</span> | |||
| +<span class="gp">>>> </span><span class="n">HtmlFormatter</span><span class="p">(</span><span class="n">style</span><span class="o">=</span><span class="n">YourStyle</span><span class="p">)</span><span class="o">.</span><span class="n">style</span> | |||
| +<span class="go"><class 'yourapp.yourmodule.YourStyle'></span> | |||
| +</pre></div> | |||
| +<div class="section" id="creating-own-styles"> | |||
| +<h3>Creating Own Styles</h3> | |||
| +<p>So, how to create a style? All you have to do is to subclass <cite>Style</cite> and | |||
| +define some styles:</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.style</span> <span class="kn">import</span> <span class="n">Style</span> | |||
| +<span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="n">Keyword</span><span class="p">,</span> <span class="n">Name</span><span class="p">,</span> <span class="n">Comment</span><span class="p">,</span> <span class="n">String</span><span class="p">,</span> <span class="n">Error</span><span class="p">,</span> \ | |||
| + <span class="n">Number</span><span class="p">,</span> <span class="n">Operator</span><span class="p">,</span> <span class="n">Generic</span> | |||
| + | |||
| +<span class="k">class</span> <span class="nc">YourStyle</span><span class="p">(</span><span class="n">Style</span><span class="p">):</span> | |||
| + <span class="n">default_style</span> <span class="o">=</span> <span class="s">""</span> | |||
| + <span class="n">styles</span> <span class="o">=</span> <span class="p">{</span> | |||
| + <span class="n">Comment</span><span class="p">:</span> <span class="s">'italic #888'</span><span class="p">,</span> | |||
| + <span class="n">Keyword</span><span class="p">:</span> <span class="s">'bold #005'</span><span class="p">,</span> | |||
| + <span class="n">Name</span><span class="p">:</span> <span class="s">'#f00'</span><span class="p">,</span> | |||
| + <span class="n">Name</span><span class="o">.</span><span class="n">Function</span><span class="p">:</span> <span class="s">'#0f0'</span><span class="p">,</span> | |||
| + <span class="n">Name</span><span class="o">.</span><span class="n">Class</span><span class="p">:</span> <span class="s">'bold #0f0'</span><span class="p">,</span> | |||
| + <span class="n">String</span><span class="p">:</span> <span class="s">'bg:#eee #111'</span> | |||
| + <span class="p">}</span> | |||
| +</pre></div> | |||
| +<p>That's it. There are just a few rules. When you define a style for <cite>Name</cite> | |||
| +the style automatically also affects <cite>Name.Function</cite> and so on. If you | |||
| +defined <tt class="docutils literal">'bold'</tt> and you don't want boldface for a subtoken use <tt class="docutils literal">'nobold'</tt>.</p> | |||
| +<p>(Philosophy: the styles aren't written in CSS syntax since this way | |||
| +they can be used for a variety of formatters.)</p> | |||
| +<p><cite>default_style</cite> is the style inherited by all token types.</p> | |||
| +<p>To make the style usable for Pygments, you must</p> | |||
| +<ul class="simple"> | |||
| +<li>either register it as a plugin (see <a class="reference external" href="./plugins.html">the plugin docs</a>)</li> | |||
| +<li>or drop it into the <cite>styles</cite> subpackage of your Pygments distribution one style | |||
| +class per style, where the file name is the style name and the class name is | |||
| +<cite>StylenameClass</cite>. For example, if your style should be called | |||
| +<tt class="docutils literal">"mondrian"</tt>, name the class <cite>MondrianStyle</cite>, put it into the file | |||
| +<tt class="docutils literal">mondrian.py</tt> and this file into the <tt class="docutils literal">pygments.styles</tt> subpackage | |||
| +directory.</li> | |||
| +</ul> | |||
| +</div> | |||
| +<div class="section" id="style-rules"> | |||
| +<h3>Style Rules</h3> | |||
| +<p>Here a small overview of all allowed styles:</p> | |||
| +<dl class="docutils"> | |||
| +<dt><tt class="docutils literal">bold</tt></dt> | |||
| +<dd>render text as bold</dd> | |||
| +<dt><tt class="docutils literal">nobold</tt></dt> | |||
| +<dd>don't render text as bold (to prevent subtokens being highlighted bold)</dd> | |||
| +<dt><tt class="docutils literal">italic</tt></dt> | |||
| +<dd>render text italic</dd> | |||
| +<dt><tt class="docutils literal">noitalic</tt></dt> | |||
| +<dd>don't render text as italic</dd> | |||
| +<dt><tt class="docutils literal">underline</tt></dt> | |||
| +<dd>render text underlined</dd> | |||
| +<dt><tt class="docutils literal">nounderline</tt></dt> | |||
| +<dd>don't render text underlined</dd> | |||
| +<dt><tt class="docutils literal">bg:</tt></dt> | |||
| +<dd>transparent background</dd> | |||
| +<dt><tt class="docutils literal"><span class="pre">bg:#000000</span></tt></dt> | |||
| +<dd>background color (black)</dd> | |||
| +<dt><tt class="docutils literal">border:</tt></dt> | |||
| +<dd>no border</dd> | |||
| +<dt><tt class="docutils literal"><span class="pre">border:#ffffff</span></tt></dt> | |||
| +<dd>border color (white)</dd> | |||
| +<dt><tt class="docutils literal">#ff0000</tt></dt> | |||
| +<dd>text color (red)</dd> | |||
| +<dt><tt class="docutils literal">noinherit</tt></dt> | |||
| +<dd>don't inherit styles from supertoken</dd> | |||
| +</dl> | |||
| +<p>Note that there may not be a space between <tt class="docutils literal">bg:</tt> and the color value | |||
| +since the style definition string is split at whitespace. | |||
| +Also, using named colors is not allowed since the supported color names | |||
| +vary for different formatters.</p> | |||
| +<p>Furthermore, not all lexers might support every style.</p> | |||
| +</div> | |||
| +<div class="section" id="builtin-styles"> | |||
| +<h3>Builtin Styles</h3> | |||
| +<p>Pygments ships some builtin styles which are maintained by the Pygments team.</p> | |||
| +<p>To get a list of known styles you can use this snippet:</p> | |||
| +<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.styles</span> <span class="kn">import</span> <span class="n">STYLE_MAP</span> | |||
| +<span class="gp">>>> </span><span class="n">STYLE_MAP</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span> | |||
| +<span class="go">['default', 'emacs', 'friendly', 'colorful']</span> | |||
| +</pre></div> | |||
| +</div> | |||
| +<div class="section" id="getting-a-list-of-available-styles"> | |||
| +<h3>Getting a list of available styles</h3> | |||
| +<p><em>New in Pygments 0.6.</em></p> | |||
| +<p>Because it could be that a plugin registered a style, there is | |||
| +a way to iterate over all styles:</p> | |||
| +<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.styles</span> <span class="kn">import</span> <span class="n">get_all_styles</span> | |||
| +<span class="gp">>>> </span><span class="n">styles</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">get_all_styles</span><span class="p">())</span> | |||
| +</pre></div> | |||
| +</div> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:43.728566 | |||
| + file id: styles --> | |||
| +</html> | |||
541
vendor/pygments/docs/build/tokens.html
| @@ -0,0 +1,541 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Builtin Tokens — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Builtin Tokens</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <div class="toc"> | |||
| + <h2>Contents</h2> | |||
| + <ul class="contents"> | |||
| + | |||
| + <li><a href="#keyword-tokens">Keyword Tokens</a></li> | |||
| + | |||
| + <li><a href="#name-tokens">Name Tokens</a></li> | |||
| + | |||
| + <li><a href="#literals">Literals</a></li> | |||
| + | |||
| + <li><a href="#operators">Operators</a></li> | |||
| + | |||
| + <li><a href="#punctuation">Punctuation</a></li> | |||
| + | |||
| + <li><a href="#comments">Comments</a></li> | |||
| + | |||
| + <li><a href="#generic-tokens">Generic Tokens</a></li> | |||
| + | |||
| + </ul> | |||
| + </div> | |||
| + | |||
| + <!-- -*- mode: rst -*- --> | |||
| +<p>Inside the <cite>pygments.token</cite> module, there is a special object called <cite>Token</cite> | |||
| +that is used to create token types.</p> | |||
| +<p>You can create a new token type by accessing an attribute of <cite>Token</cite>:</p> | |||
| +<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="n">Token</span> | |||
| +<span class="gp">>>> </span><span class="n">Token</span><span class="o">.</span><span class="n">String</span> | |||
| +<span class="go">Token.String</span> | |||
| +<span class="gp">>>> </span><span class="n">Token</span><span class="o">.</span><span class="n">String</span> <span class="ow">is</span> <span class="n">Token</span><span class="o">.</span><span class="n">String</span> | |||
| +<span class="go">True</span> | |||
| +</pre></div> | |||
| +<p>Note that tokens are singletons so you can use the <tt class="docutils literal">is</tt> operator for comparing | |||
| +token types.</p> | |||
| +<p>As of Pygments 0.7 you can also use the <tt class="docutils literal">in</tt> operator to perform set tests:</p> | |||
| +<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="n">Comment</span> | |||
| +<span class="gp">>>> </span><span class="n">Comment</span><span class="o">.</span><span class="n">Single</span> <span class="ow">in</span> <span class="n">Comment</span> | |||
| +<span class="go">True</span> | |||
| +<span class="gp">>>> </span><span class="n">Comment</span> <span class="ow">in</span> <span class="n">Comment</span><span class="o">.</span><span class="n">Multi</span> | |||
| +<span class="go">False</span> | |||
| +</pre></div> | |||
| +<p>This can be useful in <a class="reference external" href="./filters.html">filters</a> and if you write lexers on your own without | |||
| +using the base lexers.</p> | |||
| +<p>You can also split a token type into a hierarchy, and get the parent of it:</p> | |||
| +<div class="syntax"><pre><span class="gp">>>> </span><span class="n">String</span><span class="o">.</span><span class="n">split</span><span class="p">()</span> | |||
| +<span class="go">[Token, Token.Literal, Token.Literal.String]</span> | |||
| +<span class="gp">>>> </span><span class="n">String</span><span class="o">.</span><span class="n">parent</span> | |||
| +<span class="go">Token.Literal</span> | |||
| +</pre></div> | |||
| +<p>In principle, you can create an unlimited number of token types but nobody can | |||
| +guarantee that a style would define style rules for a token type. Because of | |||
| +that, Pygments proposes some global token types defined in the | |||
| +<cite>pygments.token.STANDARD_TYPES</cite> dict.</p> | |||
| +<p>For some tokens aliases are already defined:</p> | |||
| +<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="n">String</span> | |||
| +<span class="gp">>>> </span><span class="n">String</span> | |||
| +<span class="go">Token.Literal.String</span> | |||
| +</pre></div> | |||
| +<p>Inside the <cite>pygments.token</cite> module the following aliases are defined:</p> | |||
| +<table border="1" class="docutils"> | |||
| +<colgroup> | |||
| +<col width="17%" /> | |||
| +<col width="36%" /> | |||
| +<col width="47%" /> | |||
| +</colgroup> | |||
| +<tbody valign="top"> | |||
| +<tr><td><cite>Text</cite></td> | |||
| +<td><cite>Token.Text</cite></td> | |||
| +<td>for any type of text data</td> | |||
| +</tr> | |||
| +<tr><td><cite>Whitespace</cite></td> | |||
| +<td><cite>Token.Text.Whitespace</cite></td> | |||
| +<td>for specially highlighted whitespace</td> | |||
| +</tr> | |||
| +<tr><td><cite>Error</cite></td> | |||
| +<td><cite>Token.Error</cite></td> | |||
| +<td>represents lexer errors</td> | |||
| +</tr> | |||
| +<tr><td><cite>Other</cite></td> | |||
| +<td><cite>Token.Other</cite></td> | |||
| +<td>special token for data not | |||
| +matched by a parser (e.g. HTML | |||
| +markup in PHP code)</td> | |||
| +</tr> | |||
| +<tr><td><cite>Keyword</cite></td> | |||
| +<td><cite>Token.Keyword</cite></td> | |||
| +<td>any kind of keywords</td> | |||
| +</tr> | |||
| +<tr><td><cite>Name</cite></td> | |||
| +<td><cite>Token.Name</cite></td> | |||
| +<td>variable/function names</td> | |||
| +</tr> | |||
| +<tr><td><cite>Literal</cite></td> | |||
| +<td><cite>Token.Literal</cite></td> | |||
| +<td>Any literals</td> | |||
| +</tr> | |||
| +<tr><td><cite>String</cite></td> | |||
| +<td><cite>Token.Literal.String</cite></td> | |||
| +<td>string literals</td> | |||
| +</tr> | |||
| +<tr><td><cite>Number</cite></td> | |||
| +<td><cite>Token.Literal.Number</cite></td> | |||
| +<td>number literals</td> | |||
| +</tr> | |||
| +<tr><td><cite>Operator</cite></td> | |||
| +<td><cite>Token.Operator</cite></td> | |||
| +<td>operators (<tt class="docutils literal">+</tt>, <tt class="docutils literal">not</tt>...)</td> | |||
| +</tr> | |||
| +<tr><td><cite>Punctuation</cite></td> | |||
| +<td><cite>Token.Punctuation</cite></td> | |||
| +<td>punctuation (<tt class="docutils literal">[</tt>, <tt class="docutils literal">(</tt>...)</td> | |||
| +</tr> | |||
| +<tr><td><cite>Comment</cite></td> | |||
| +<td><cite>Token.Comment</cite></td> | |||
| +<td>any kind of comments</td> | |||
| +</tr> | |||
| +<tr><td><cite>Generic</cite></td> | |||
| +<td><cite>Token.Generic</cite></td> | |||
| +<td>generic tokens (have a look at | |||
| +the explanation below)</td> | |||
| +</tr> | |||
| +</tbody> | |||
| +</table> | |||
| +<p>The <cite>Whitespace</cite> token type is new in Pygments 0.8. It is used only by the | |||
| +<cite>VisibleWhitespaceFilter</cite> currently.</p> | |||
| +<p>Normally you just create token types using the already defined aliases. For each | |||
| +of those token aliases, a number of subtypes exists (excluding the special tokens | |||
| +<cite>Token.Text</cite>, <cite>Token.Error</cite> and <cite>Token.Other</cite>)</p> | |||
| +<p>The <cite>is_token_subtype()</cite> function in the <cite>pygments.token</cite> module can be used to | |||
| +test if a token type is a subtype of another (such as <cite>Name.Tag</cite> and <cite>Name</cite>). | |||
| +(This is the same as <tt class="docutils literal">Name.Tag in Name</tt>. The overloaded <cite>in</cite> operator was newly | |||
| +introduced in Pygments 0.7, the function still exists for backwards | |||
| +compatiblity.)</p> | |||
| +<p>With Pygments 0.7, it's also possible to convert strings to token types (for example | |||
| +if you want to supply a token from the command line):</p> | |||
| +<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="n">String</span><span class="p">,</span> <span class="n">string_to_tokentype</span> | |||
| +<span class="gp">>>> </span><span class="n">string_to_tokentype</span><span class="p">(</span><span class="s">"String"</span><span class="p">)</span> | |||
| +<span class="go">Token.Literal.String</span> | |||
| +<span class="gp">>>> </span><span class="n">string_to_tokentype</span><span class="p">(</span><span class="s">"Token.Literal.String"</span><span class="p">)</span> | |||
| +<span class="go">Token.Literal.String</span> | |||
| +<span class="gp">>>> </span><span class="n">string_to_tokentype</span><span class="p">(</span><span class="n">String</span><span class="p">)</span> | |||
| +<span class="go">Token.Literal.String</span> | |||
| +</pre></div> | |||
| +<div class="section" id="keyword-tokens"> | |||
| +<h3>Keyword Tokens</h3> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>Keyword</cite></dt> | |||
| +<dd>For any kind of keyword (especially if it doesn't match any of the | |||
| +subtypes of course).</dd> | |||
| +<dt><cite>Keyword.Constant</cite></dt> | |||
| +<dd>For keywords that are constants (e.g. <tt class="docutils literal">None</tt> in future Python versions).</dd> | |||
| +<dt><cite>Keyword.Declaration</cite></dt> | |||
| +<dd>For keywords used for variable declaration (e.g. <tt class="docutils literal">var</tt> in some programming | |||
| +languages like JavaScript).</dd> | |||
| +<dt><cite>Keyword.Namespace</cite></dt> | |||
| +<dd>For keywords used for namespace declarations (e.g. <tt class="docutils literal">import</tt> in Python and | |||
| +Java and <tt class="docutils literal">package</tt> in Java).</dd> | |||
| +<dt><cite>Keyword.Pseudo</cite></dt> | |||
| +<dd>For keywords that aren't really keywords (e.g. <tt class="docutils literal">None</tt> in old Python | |||
| +versions).</dd> | |||
| +<dt><cite>Keyword.Reserved</cite></dt> | |||
| +<dd>For reserved keywords.</dd> | |||
| +<dt><cite>Keyword.Type</cite></dt> | |||
| +<dd>For builtin types that can't be used as identifiers (e.g. <tt class="docutils literal">int</tt>, | |||
| +<tt class="docutils literal">char</tt> etc. in C).</dd> | |||
| +</dl> | |||
| +</div> | |||
| +<div class="section" id="name-tokens"> | |||
| +<h3>Name Tokens</h3> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>Name</cite></dt> | |||
| +<dd>For any name (variable names, function names, classes).</dd> | |||
| +<dt><cite>Name.Attribute</cite></dt> | |||
| +<dd>For all attributes (e.g. in HTML tags).</dd> | |||
| +<dt><cite>Name.Builtin</cite></dt> | |||
| +<dd>Builtin names; names that are available in the global namespace.</dd> | |||
| +<dt><cite>Name.Builtin.Pseudo</cite></dt> | |||
| +<dd>Builtin names that are implicit (e.g. <tt class="docutils literal">self</tt> in Ruby, <tt class="docutils literal">this</tt> in Java).</dd> | |||
| +<dt><cite>Name.Class</cite></dt> | |||
| +<dd>Class names. Because no lexer can know if a name is a class or a function | |||
| +or something else this token is meant for class declarations.</dd> | |||
| +<dt><cite>Name.Constant</cite></dt> | |||
| +<dd>Token type for constants. In some languages you can recognise a token by the | |||
| +way it's defined (the value after a <tt class="docutils literal">const</tt> keyword for example). In | |||
| +other languages constants are uppercase by definition (Ruby).</dd> | |||
| +<dt><cite>Name.Decorator</cite></dt> | |||
| +<dd>Token type for decorators. Decorators are synatic elements in the Python | |||
| +language. Similar syntax elements exist in C# and Java.</dd> | |||
| +<dt><cite>Name.Entity</cite></dt> | |||
| +<dd>Token type for special entities. (e.g. <tt class="docutils literal">&nbsp;</tt> in HTML).</dd> | |||
| +<dt><cite>Name.Exception</cite></dt> | |||
| +<dd>Token type for exception names (e.g. <tt class="docutils literal">RuntimeError</tt> in Python). Some languages | |||
| +define exceptions in the function signature (Java). You can highlight | |||
| +the name of that exception using this token then.</dd> | |||
| +<dt><cite>Name.Function</cite></dt> | |||
| +<dd>Token type for function names.</dd> | |||
| +<dt><cite>Name.Label</cite></dt> | |||
| +<dd>Token type for label names (e.g. in languages that support <tt class="docutils literal">goto</tt>).</dd> | |||
| +<dt><cite>Name.Namespace</cite></dt> | |||
| +<dd>Token type for namespaces. (e.g. import paths in Java/Python), names following | |||
| +the <tt class="docutils literal">module</tt>/<tt class="docutils literal">namespace</tt> keyword in other languages.</dd> | |||
| +<dt><cite>Name.Other</cite></dt> | |||
| +<dd>Other names. Normally unused.</dd> | |||
| +<dt><cite>Name.Tag</cite></dt> | |||
| +<dd>Tag names (in HTML/XML markup or configuration files).</dd> | |||
| +<dt><cite>Name.Variable</cite></dt> | |||
| +<dd>Token type for variables. Some languages have prefixes for variable names | |||
| +(PHP, Ruby, Perl). You can highlight them using this token.</dd> | |||
| +<dt><cite>Name.Variable.Class</cite></dt> | |||
| +<dd>same as <cite>Name.Variable</cite> but for class variables (also static variables).</dd> | |||
| +<dt><cite>Name.Variable.Global</cite></dt> | |||
| +<dd>same as <cite>Name.Variable</cite> but for global variables (used in Ruby, for | |||
| +example).</dd> | |||
| +<dt><cite>Name.Variable.Instance</cite></dt> | |||
| +<dd>same as <cite>Name.Variable</cite> but for instance variables.</dd> | |||
| +</dl> | |||
| +</div> | |||
| +<div class="section" id="literals"> | |||
| +<h3>Literals</h3> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>Literal</cite></dt> | |||
| +<dd>For any literal (if not further defined).</dd> | |||
| +<dt><cite>Literal.Date</cite></dt> | |||
| +<dd>for date literals (e.g. <tt class="docutils literal">42d</tt> in Boo).</dd> | |||
| +<dt><cite>String</cite></dt> | |||
| +<dd>For any string literal.</dd> | |||
| +<dt><cite>String.Backtick</cite></dt> | |||
| +<dd>Token type for strings enclosed in backticks.</dd> | |||
| +<dt><cite>String.Char</cite></dt> | |||
| +<dd>Token type for single characters (e.g. Java, C).</dd> | |||
| +<dt><cite>String.Doc</cite></dt> | |||
| +<dd>Token type for documentation strings (for example Python).</dd> | |||
| +<dt><cite>String.Double</cite></dt> | |||
| +<dd>Double quoted strings.</dd> | |||
| +<dt><cite>String.Escape</cite></dt> | |||
| +<dd>Token type for escape sequences in strings.</dd> | |||
| +<dt><cite>String.Heredoc</cite></dt> | |||
| +<dd>Token type for "heredoc" strings (e.g. in Ruby or Perl).</dd> | |||
| +<dt><cite>String.Interpol</cite></dt> | |||
| +<dd>Token type for interpolated parts in strings (e.g. <tt class="docutils literal">#{foo}</tt> in Ruby).</dd> | |||
| +<dt><cite>String.Other</cite></dt> | |||
| +<dd>Token type for any other strings (for example <tt class="docutils literal">%q{foo}</tt> string constructs | |||
| +in Ruby).</dd> | |||
| +<dt><cite>String.Regex</cite></dt> | |||
| +<dd>Token type for regular expression literals (e.g. <tt class="docutils literal">/foo/</tt> in JavaScript).</dd> | |||
| +<dt><cite>String.Single</cite></dt> | |||
| +<dd>Token type for single quoted strings.</dd> | |||
| +<dt><cite>String.Symbol</cite></dt> | |||
| +<dd>Token type for symbols (e.g. <tt class="docutils literal">:foo</tt> in LISP or Ruby).</dd> | |||
| +<dt><cite>Number</cite></dt> | |||
| +<dd>Token type for any number literal.</dd> | |||
| +<dt><cite>Number.Float</cite></dt> | |||
| +<dd>Token type for float literals (e.g. <tt class="docutils literal">42.0</tt>).</dd> | |||
| +<dt><cite>Number.Hex</cite></dt> | |||
| +<dd>Token type for hexadecimal number literals (e.g. <tt class="docutils literal">0xdeadbeef</tt>).</dd> | |||
| +<dt><cite>Number.Integer</cite></dt> | |||
| +<dd>Token type for integer literals (e.g. <tt class="docutils literal">42</tt>).</dd> | |||
| +<dt><cite>Number.Integer.Long</cite></dt> | |||
| +<dd>Token type for long integer literals (e.g. <tt class="docutils literal">42L</tt> in Python).</dd> | |||
| +<dt><cite>Number.Oct</cite></dt> | |||
| +<dd>Token type for octal literals.</dd> | |||
| +</dl> | |||
| +</div> | |||
| +<div class="section" id="operators"> | |||
| +<h3>Operators</h3> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>Operator</cite></dt> | |||
| +<dd>For any punctuation operator (e.g. <tt class="docutils literal">+</tt>, <tt class="docutils literal">-</tt>).</dd> | |||
| +<dt><cite>Operator.Word</cite></dt> | |||
| +<dd>For any operator that is a word (e.g. <tt class="docutils literal">not</tt>).</dd> | |||
| +</dl> | |||
| +</div> | |||
| +<div class="section" id="punctuation"> | |||
| +<h3>Punctuation</h3> | |||
| +<p><em>New in Pygments 0.7.</em></p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>Punctuation</cite></dt> | |||
| +<dd>For any punctuation which is not an operator (e.g. <tt class="docutils literal">[</tt>, <tt class="docutils literal">(</tt>...)</dd> | |||
| +</dl> | |||
| +</div> | |||
| +<div class="section" id="comments"> | |||
| +<h3>Comments</h3> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>Comment</cite></dt> | |||
| +<dd>Token type for any comment.</dd> | |||
| +<dt><cite>Comment.Multiline</cite></dt> | |||
| +<dd>Token type for multiline comments.</dd> | |||
| +<dt><cite>Comment.Preproc</cite></dt> | |||
| +<dd>Token type for preprocessor comments (also <tt class="docutils literal"><span class="pre"><?php</span></tt>/<tt class="docutils literal"><%</tt> constructs).</dd> | |||
| +<dt><cite>Comment.Single</cite></dt> | |||
| +<dd>Token type for comments that end at the end of a line (e.g. <tt class="docutils literal"># foo</tt>).</dd> | |||
| +<dt><cite>Comment.Special</cite></dt> | |||
| +<dd>Special data in comments. For example code tags, author and license | |||
| +information, etc.</dd> | |||
| +</dl> | |||
| +</div> | |||
| +<div class="section" id="generic-tokens"> | |||
| +<h3>Generic Tokens</h3> | |||
| +<p>Generic tokens are for special lexers like the <cite>DiffLexer</cite> that doesn't really | |||
| +highlight a programming language but a patch file.</p> | |||
| +<dl class="docutils"> | |||
| +<dt><cite>Generic</cite></dt> | |||
| +<dd>A generic, unstyled token. Normally you don't use this token type.</dd> | |||
| +<dt><cite>Generic.Deleted</cite></dt> | |||
| +<dd>Marks the token value as deleted.</dd> | |||
| +<dt><cite>Generic.Emph</cite></dt> | |||
| +<dd>Marks the token value as emphasized.</dd> | |||
| +<dt><cite>Generic.Error</cite></dt> | |||
| +<dd>Marks the token value as an error message.</dd> | |||
| +<dt><cite>Generic.Heading</cite></dt> | |||
| +<dd>Marks the token value as headline.</dd> | |||
| +<dt><cite>Generic.Inserted</cite></dt> | |||
| +<dd>Marks the token value as inserted.</dd> | |||
| +<dt><cite>Generic.Output</cite></dt> | |||
| +<dd>Marks the token value as program output (e.g. for python cli lexer).</dd> | |||
| +<dt><cite>Generic.Prompt</cite></dt> | |||
| +<dd>Marks the token value as command prompt (e.g. bash lexer).</dd> | |||
| +<dt><cite>Generic.Strong</cite></dt> | |||
| +<dd>Marks the token value as bold (e.g. for rst lexer).</dd> | |||
| +<dt><cite>Generic.Subheading</cite></dt> | |||
| +<dd>Marks the token value as subheadline.</dd> | |||
| +<dt><cite>Generic.Traceback</cite></dt> | |||
| +<dd>Marks the token value as a part of an error traceback.</dd> | |||
| +</dl> | |||
| +</div> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:43.797189 | |||
| + file id: tokens --> | |||
| +</html> | |||
249
vendor/pygments/docs/build/unicode.html
| @@ -0,0 +1,249 @@ | |||
| +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |||
| + "http://www.w3.org/TR/html4/strict.dtd"> | |||
| +<html> | |||
| +<head> | |||
| + <title>Unicode and Encodings — Pygments</title> | |||
| + <meta http-equiv="content-type" content="text/html; charset=utf-8"> | |||
| + <style type="text/css"> | |||
| + body { | |||
| + background-color: #f2f2f2; | |||
| + margin: 0; | |||
| + padding: 0; | |||
| + font-family: 'Georgia', serif; | |||
| + color: #111; | |||
| +} | |||
| + | |||
| +#content { | |||
| + background-color: white; | |||
| + padding: 20px; | |||
| + margin: 20px auto 20px auto; | |||
| + max-width: 800px; | |||
| + border: 4px solid #ddd; | |||
| +} | |||
| + | |||
| +h1 { | |||
| + font-weight: normal; | |||
| + font-size: 40px; | |||
| + color: #09839A; | |||
| +} | |||
| + | |||
| +h2 { | |||
| + font-weight: normal; | |||
| + font-size: 30px; | |||
| + color: #C73F00; | |||
| +} | |||
| + | |||
| +h1.heading { | |||
| + margin: 0 0 30px 0; | |||
| +} | |||
| + | |||
| +h2.subheading { | |||
| + margin: -30px 0 0 45px; | |||
| +} | |||
| + | |||
| +h3 { | |||
| + margin-top: 30px; | |||
| +} | |||
| + | |||
| +table.docutils { | |||
| + border-collapse: collapse; | |||
| + border: 2px solid #aaa; | |||
| + margin: 0.5em 1.5em 0.5em 1.5em; | |||
| +} | |||
| + | |||
| +table.docutils td { | |||
| + padding: 2px; | |||
| + border: 1px solid #ddd; | |||
| +} | |||
| + | |||
| +p, li, dd, dt, blockquote { | |||
| + font-size: 15px; | |||
| + color: #333; | |||
| +} | |||
| + | |||
| +p { | |||
| + line-height: 150%; | |||
| + margin-bottom: 0; | |||
| + margin-top: 10px; | |||
| +} | |||
| + | |||
| +hr { | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 0; | |||
| + border-right: 0; | |||
| + border-left: 0; | |||
| + margin-bottom: 10px; | |||
| + margin-top: 20px; | |||
| +} | |||
| + | |||
| +dl { | |||
| + margin-left: 10px; | |||
| +} | |||
| + | |||
| +li, dt { | |||
| + margin-top: 5px; | |||
| +} | |||
| + | |||
| +dt { | |||
| + font-weight: bold; | |||
| +} | |||
| + | |||
| +th { | |||
| + text-align: left; | |||
| +} | |||
| + | |||
| +a { | |||
| + color: #990000; | |||
| +} | |||
| + | |||
| +a:hover { | |||
| + color: #c73f00; | |||
| +} | |||
| + | |||
| +pre { | |||
| + background-color: #f9f9f9; | |||
| + border-top: 1px solid #ccc; | |||
| + border-bottom: 1px solid #ccc; | |||
| + padding: 5px; | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| +} | |||
| + | |||
| +tt { | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + color: black; | |||
| + padding: 1px 2px 1px 2px; | |||
| + background-color: #f0f0f0; | |||
| +} | |||
| + | |||
| +cite { | |||
| + /* abusing <cite>, it's generated by ReST for `x` */ | |||
| + font-size: 13px; | |||
| + font-family: Bitstream Vera Sans Mono,monospace; | |||
| + font-weight: bold; | |||
| + font-style: normal; | |||
| +} | |||
| + | |||
| +#backlink { | |||
| + float: right; | |||
| + font-size: 11px; | |||
| + color: #888; | |||
| +} | |||
| + | |||
| +div.toc { | |||
| + margin: 0 0 10px 0; | |||
| +} | |||
| + | |||
| +div.toc h2 { | |||
| + font-size: 20px; | |||
| +} | |||
| +.syntax .hll { background-color: #ffffcc } | |||
| +.syntax { background: #ffffff; } | |||
| +.syntax .c { color: #888888 } /* Comment */ | |||
| +.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |||
| +.syntax .k { color: #008800; font-weight: bold } /* Keyword */ | |||
| +.syntax .cm { color: #888888 } /* Comment.Multiline */ | |||
| +.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |||
| +.syntax .c1 { color: #888888 } /* Comment.Single */ | |||
| +.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |||
| +.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |||
| +.syntax .ge { font-style: italic } /* Generic.Emph */ | |||
| +.syntax .gr { color: #aa0000 } /* Generic.Error */ | |||
| +.syntax .gh { color: #333333 } /* Generic.Heading */ | |||
| +.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |||
| +.syntax .go { color: #888888 } /* Generic.Output */ | |||
| +.syntax .gp { color: #555555 } /* Generic.Prompt */ | |||
| +.syntax .gs { font-weight: bold } /* Generic.Strong */ | |||
| +.syntax .gu { color: #666666 } /* Generic.Subheading */ | |||
| +.syntax .gt { color: #aa0000 } /* Generic.Traceback */ | |||
| +.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ | |||
| +.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ | |||
| +.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ | |||
| +.syntax .kp { color: #008800 } /* Keyword.Pseudo */ | |||
| +.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ | |||
| +.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */ | |||
| +.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |||
| +.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |||
| +.syntax .na { color: #336699 } /* Name.Attribute */ | |||
| +.syntax .nb { color: #003388 } /* Name.Builtin */ | |||
| +.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */ | |||
| +.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */ | |||
| +.syntax .nd { color: #555555 } /* Name.Decorator */ | |||
| +.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ | |||
| +.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */ | |||
| +.syntax .nl { color: #336699; font-style: italic } /* Name.Label */ | |||
| +.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ | |||
| +.syntax .py { color: #336699; font-weight: bold } /* Name.Property */ | |||
| +.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ | |||
| +.syntax .nv { color: #336699 } /* Name.Variable */ | |||
| +.syntax .ow { color: #008800 } /* Operator.Word */ | |||
| +.syntax .w { color: #bbbbbb } /* Text.Whitespace */ | |||
| +.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |||
| +.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |||
| +.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ | |||
| +.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |||
| +.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |||
| +.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ | |||
| +.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |||
| +.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ | |||
| +.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ | |||
| +.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ | |||
| +.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ | |||
| +.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ | |||
| +.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ | |||
| +.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ | |||
| +.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ | |||
| +.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |||
| +.syntax .vc { color: #336699 } /* Name.Variable.Class */ | |||
| +.syntax .vg { color: #dd7700 } /* Name.Variable.Global */ | |||
| +.syntax .vi { color: #3333bb } /* Name.Variable.Instance */ | |||
| +.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ | |||
| + </style> | |||
| +</head> | |||
| +<body> | |||
| + <div id="content"> | |||
| + <h1 class="heading">Pygments</h1> | |||
| + <h2 class="subheading">Unicode and Encodings</h2> | |||
| + | |||
| + <a id="backlink" href="index.html">« Back To Index</a> | |||
| + | |||
| + | |||
| + <p>Since Pygments 0.6, all lexers use unicode strings internally. Because of that | |||
| +you might encounter the occasional <cite>UnicodeDecodeError</cite> if you pass strings with the | |||
| +wrong encoding.</p> | |||
| +<p>Per default all lexers have their input encoding set to <cite>latin1</cite>. | |||
| +If you pass a lexer a string object (not unicode), it tries to decode the data | |||
| +using this encoding. | |||
| +You can override the encoding using the <cite>encoding</cite> lexer option. If you have the | |||
| +<a class="reference external" href="http://chardet.feedparser.org/">chardet</a> library installed and set the encoding to <tt class="docutils literal">chardet</tt> if will ananlyse | |||
| +the text and use the encoding it thinks is the right one automatically:</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.lexers</span> <span class="kn">import</span> <span class="n">PythonLexer</span> | |||
| +<span class="n">lexer</span> <span class="o">=</span> <span class="n">PythonLexer</span><span class="p">(</span><span class="n">encoding</span><span class="o">=</span><span class="s">'chardet'</span><span class="p">)</span> | |||
| +</pre></div> | |||
| +<p>The best way is to pass Pygments unicode objects. In that case you can't get | |||
| +unexpected output.</p> | |||
| +<p>The formatters now send Unicode objects to the stream if you don't set the | |||
| +output encoding. You can do so by passing the formatters an <cite>encoding</cite> option:</p> | |||
| +<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.formatters</span> <span class="kn">import</span> <span class="n">HtmlFormatter</span> | |||
| +<span class="n">f</span> <span class="o">=</span> <span class="n">HtmlFormatter</span><span class="p">(</span><span class="n">encoding</span><span class="o">=</span><span class="s">'utf-8'</span><span class="p">)</span> | |||
| +</pre></div> | |||
| +<p><strong>You will have to set this option if you have non-ASCII characters in the | |||
| +source and the output stream does not accept Unicode written to it!</strong> | |||
| +This is the case for all regular files and for terminals.</p> | |||
| +<p>Note: The Terminal formatter tries to be smart: if its output stream has an | |||
| +<cite>encoding</cite> attribute, and you haven't set the option, it will encode any | |||
| +Unicode string with this encoding before writing it. This is the case for | |||
| +<cite>sys.stdout</cite>, for example. The other formatters don't have that behavior.</p> | |||
| +<p>Another note: If you call Pygments via the command line (<cite>pygmentize</cite>), | |||
| +encoding is handled differently, see <a class="reference external" href="./cmdline.html">the command line docs</a>.</p> | |||
| +<p><em>New in Pygments 0.7</em>: the formatters now also accept an <cite>outencoding</cite> option | |||
| +which will override the <cite>encoding</cite> option if given. This makes it possible to | |||
| +use a single options dict with lexers and formatters, and still have different | |||
| +input and output encodings.</p> | |||
| + | |||
| + </div> | |||
| +</body> | |||
| +<!-- generated on: 2013-01-09 17:48:43.988472 | |||
| + file id: unicode --> | |||
| +</html> | |||
2
vendor/pygments/docs/generate.py
2
vendor/pygments/docs/src/api.txt
2
vendor/pygments/docs/src/index.txt
5
vendor/pygments/docs/src/integrate.txt
70
vendor/pygments/docs/src/java.txt
| @@ -0,0 +1,70 @@ | |||
| +===================== | |||
| +Use Pygments in Java | |||
| +===================== | |||
| + | |||
| +Thanks to `Jython <http://www.jython.org>`__ it is possible to use Pygments in | |||
| +Java. | |||
| + | |||
| +This page is a simple tutorial to get an idea of how this is working. You can | |||
| +then look at the `Jython documentation <http://www.jython.org/docs/>`__ for more | |||
| +advanced use. | |||
| + | |||
| +Since version 1.5, Pygments is deployed on `Maven Central | |||
| +<http://repo1.maven.org/maven2/org/pygments/pygments/>`__ as a JAR so is Jython | |||
| +which makes it a lot easier to create the Java project. | |||
| + | |||
| +Here is an example of a `Maven <http://www.maven.org>`__ ``pom.xml`` file for a | |||
| +project running Pygments: | |||
| + | |||
| +.. sourcecode:: xml | |||
| + | |||
| + <?xml version="1.0" encoding="UTF-8"?> | |||
| + | |||
| + <project xmlns="http://maven.apache.org/POM/4.0.0" | |||
| + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | |||
| + http://maven.apache.org/maven-v4_0_0.xsd"> | |||
| + <modelVersion>4.0.0</modelVersion> | |||
| + <groupId>example</groupId> | |||
| + <artifactId>example</artifactId> | |||
| + <version>1.0-SNAPSHOT</version> | |||
| + <dependencies> | |||
| + <dependency> | |||
| + <groupId>org.python</groupId> | |||
| + <artifactId>jython-standalone</artifactId> | |||
| + <version>2.5.3</version> | |||
| + </dependency> | |||
| + <dependency> | |||
| + <groupId>org.pygments</groupId> | |||
| + <artifactId>pygments</artifactId> | |||
| + <version>1.5</version> | |||
| + <scope>runtime</scope> | |||
| + </dependency> | |||
| + </dependencies> | |||
| + </project> | |||
| + | |||
| +The following Java example: | |||
| + | |||
| +.. sourcecode:: java | |||
| + | |||
| + PythonInterpreter interpreter = new PythonInterpreter(); | |||
| + | |||
| + // Set a variable with the content you want to work with | |||
| + interpreter.set("code", code); | |||
| + | |||
| + // Simple use Pygments as you would in Python | |||
| + interpreter.exec("from pygments import highlight\n" | |||
| + + "from pygments.lexers import PythonLexer\n" | |||
| + + "from pygments.formatters import HtmlFormatter\n" | |||
| + + "\nresult = highlight(code, PythonLexer(), HtmlFormatter())"); | |||
| + | |||
| + // Get the result that has been set in a variable | |||
| + System.out.println(interpreter.get("result", String.class)); | |||
| + | |||
| +will print something like: | |||
| + | |||
| +.. sourcecode:: html | |||
| + | |||
| + <div class="highlight"> | |||
| + <pre><span class="k">print</span> <span class="s">"Hello World"</span></pre> | |||
| + </div> | |||
64
vendor/pygments/external/autopygmentize
| @@ -0,0 +1,64 @@ | |||
| +#!/bin/sh | |||
| +# Best effort auto-pygmentization with transparent decompression | |||
| +# (c) Reuben Thomas 2012-2013 | |||
| +# This program is in the public domain. | |||
| + | |||
| +# Strategy: first see if pygmentize can find a lexer; if not, ask file; if that finds nothing, fail | |||
| +# Set the environment variable PYGMENTIZE_OPTS to configure pygments. | |||
| + | |||
| +# This program can be used as a .lessfilter for the less pager to auto-color less's output | |||
| + | |||
| +lexer=`pygmentize -N "$1"` | |||
| +if [ "$lexer" = "text" ]; then | |||
| + file_common_opts="--brief --dereference --uncompress" | |||
| + | |||
| + unset lexer | |||
| + case `file --mime-type $file_common_opts "$1"` in | |||
| + application/xml|image/svg+xml) lexer=xml;; | |||
| + text/html) lexer=html;; | |||
| + text/troff) lexer=nroff;; | |||
| + text/x-asm) lexer=nasm;; | |||
| + text/x-awk) lexer=awk;; | |||
| + text/x-c) lexer=c;; | |||
| + text/x-c++) lexer=cpp;; | |||
| + text/x-diff) lexer=diff;; | |||
| + text/x-fortran) lexer=fortran;; | |||
| + text/x-gawk) lexer=gawk;; | |||
| + text/x-java) lexer=java;; | |||
| + text/x-lisp) lexer=common-lisp;; | |||
| + text/x-lua) lexer=lua;; | |||
| + text/x-makefile) lexer=make;; | |||
| + text/x-msdos-batch) lexer=bat;; | |||
| + text/x-nawk) lexer=nawk;; | |||
| + text/x-pascal) lexer=pascal;; | |||
| + text/x-perl) lexer=perl;; | |||
| + text/x-php) lexer=php;; | |||
| + text/x-po) lexer=po;; | |||
| + text/x-python) lexer=python;; | |||
| + text/x-ruby) lexer=ruby;; | |||
| + text/x-shellscript) lexer=sh;; | |||
| + text/x-tcl) lexer=tcl;; | |||
| + text/x-tex|text/x-texinfo) lexer=latex;; # FIXME: texinfo really needs its own lexer | |||
| + | |||
| + # Types that file outputs which pygmentize didn't support as of file 5.11, pygments 1.6rc1 | |||
| + # text/calendar | |||
| + # text/PGP | |||
| + # text/rtf | |||
| + # text/texmacs | |||
| + # text/x-bcpl | |||
| + # text/x-info | |||
| + # text/x-m4 | |||
| + # text/x-vcard | |||
| + # text/x-xmcd | |||
| + esac | |||
| +fi | |||
| + | |||
| +encoding=`file --brief --mime-encoding $file_common_opts "$1"` | |||
| + | |||
| +if [ -n "$lexer" ]; then | |||
| + # FIXME: Specify input encoding rather than output encoding https://bitbucket.org/birkenfeld/pygments-main/issue/800 | |||
| + zcat "$1" | pygmentize -O encoding=$encoding,outencoding=UTF-8 $PYGMENTIZE_OPTS -l $lexer | |||
| + exit 0 | |||
| +fi | |||
| + | |||
| +exit 1 | |||
4
vendor/pygments/external/markdown-processor.py
2
vendor/pygments/external/moin-parser.py
2
vendor/pygments/external/rst-directive-old.py
2
vendor/pygments/external/rst-directive.py
4
vendor/pygments/pygments/__init__.py
20
vendor/pygments/pygments/cmdline.py
2
vendor/pygments/pygments/console.py
2
vendor/pygments/pygments/filter.py
3
vendor/pygments/pygments/filters/__init__.py
2
vendor/pygments/pygments/formatter.py
2
vendor/pygments/pygments/formatters/__init__.py
2
vendor/pygments/pygments/formatters/_mapping.py
2
vendor/pygments/pygments/formatters/bbcode.py
75
vendor/pygments/pygments/formatters/html.py
2
vendor/pygments/pygments/formatters/img.py
2
vendor/pygments/pygments/formatters/latex.py
4
vendor/pygments/pygments/formatters/other.py
2
vendor/pygments/pygments/formatters/rtf.py
2
vendor/pygments/pygments/formatters/svg.py
2
vendor/pygments/pygments/formatters/terminal.py
2
vendor/pygments/pygments/formatters/terminal256.py
88
vendor/pygments/pygments/lexer.py
4
vendor/pygments/pygments/lexers/__init__.py
2
vendor/pygments/pygments/lexers/_asybuiltins.py
2
vendor/pygments/pygments/lexers/_clbuiltins.py
5
vendor/pygments/pygments/lexers/_lassobuiltins.py
2
vendor/pygments/pygments/lexers/_luabuiltins.py
43
vendor/pygments/pygments/lexers/_mapping.py
11
vendor/pygments/pygments/lexers/_openedgebuiltins.py
4
vendor/pygments/pygments/lexers/_phpbuiltins.py
7
vendor/pygments/pygments/lexers/_postgres_builtins.py
557
vendor/pygments/pygments/lexers/_robotframeworklexer.py
| @@ -0,0 +1,557 @@ | |||
| +# -*- coding: utf-8 -*- | |||
| +""" | |||
| + pygments.lexers._robotframeworklexer | |||
| + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |||
| + | |||
| + Lexer for Robot Framework. | |||
| + | |||
| + :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. | |||
| + :license: BSD, see LICENSE for details. | |||
| +""" | |||
| + | |||
| +# Copyright 2012 Nokia Siemens Networks Oyj | |||
| +# | |||
| +# Licensed under the Apache License, Version 2.0 (the "License"); | |||
| +# you may not use this file except in compliance with the License. | |||
| +# You may obtain a copy of the License at | |||
| +# | |||
| +# http://www.apache.org/licenses/LICENSE-2.0 | |||
| +# | |||
| +# Unless required by applicable law or agreed to in writing, software | |||
| +# distributed under the License is distributed on an "AS IS" BASIS, | |||
| +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| +# See the License for the specific language governing permissions and | |||
| +# limitations under the License. | |||
| + | |||
| +import re | |||
| + | |||
| +from pygments.lexer import Lexer | |||
| +from pygments.token import Token | |||
| + | |||
| + | |||
| +HEADING = Token.Generic.Heading | |||
| +SETTING = Token.Keyword.Namespace | |||
| +IMPORT = Token.Name.Namespace | |||
| +TC_KW_NAME = Token.Generic.Subheading | |||
| +KEYWORD = Token.Name.Function | |||
| +ARGUMENT = Token.String | |||
| +VARIABLE = Token.Name.Variable | |||
| +COMMENT = Token.Comment | |||
| +SEPARATOR = Token.Punctuation | |||
| +SYNTAX = Token.Punctuation | |||
| +GHERKIN = Token.Generic.Emph | |||
| +ERROR = Token.Error | |||
| + | |||
| + | |||
| +def normalize(string, remove=''): | |||
| + string = string.lower() | |||
| + for char in remove + ' ': | |||
| + if char in string: | |||
| + string = string.replace(char, '') | |||
| + return string | |||
| + | |||
| + | |||
| +class RobotFrameworkLexer(Lexer): | |||
| + """ | |||
| + For `Robot Framework <http://robotframework.org>`_ test data. | |||
| + | |||
| + Supports both space and pipe separated plain text formats. | |||
| + | |||
| + *New in Pygments 1.6.* | |||
| + """ | |||
| + name = 'RobotFramework' | |||
| + aliases = ['RobotFramework', 'robotframework'] | |||
| + filenames = ['*.txt', '*.robot'] | |||
| + mimetypes = ['text/x-robotframework'] | |||
| + | |||
| + def __init__(self, **options): | |||
| + options['tabsize'] = 2 | |||
| + options['encoding'] = 'UTF-8' | |||
| + Lexer.__init__(self, **options) | |||
| + | |||
| + def get_tokens_unprocessed(self, text): | |||
| + row_tokenizer = RowTokenizer() | |||
| + var_tokenizer = VariableTokenizer() | |||
| + index = 0 | |||
| + for row in text.splitlines(): | |||
| + for value, token in row_tokenizer.tokenize(row): | |||
| + for value, token in var_tokenizer.tokenize(value, token): | |||
| + if value: | |||
| + yield index, token, unicode(value) | |||
| + index += len(value) | |||
| + | |||
| + | |||
| +class VariableTokenizer(object): | |||
| + | |||
| + def tokenize(self, string, token): | |||
| + var = VariableSplitter(string, identifiers='$@%') | |||
| + if var.start < 0 or token in (COMMENT, ERROR): | |||
| + yield string, token | |||
| + return | |||
| + for value, token in self._tokenize(var, string, token): | |||
| + if value: | |||
| + yield value, token | |||
| + | |||
| + def _tokenize(self, var, string, orig_token): | |||
| + before = string[:var.start] | |||
| + yield before, orig_token | |||
| + yield var.identifier + '{', SYNTAX | |||
| + for value, token in self.tokenize(var.base, VARIABLE): | |||
| + yield value, token | |||
| + yield '}', SYNTAX | |||
| + if var.index: | |||
| + yield '[', SYNTAX | |||
| + for value, token in self.tokenize(var.index, VARIABLE): | |||
| + yield value, token | |||
| + yield ']', SYNTAX | |||
| + for value, token in self.tokenize(string[var.end:], orig_token): | |||
| + yield value, token | |||
| + | |||
| + | |||
| +class RowTokenizer(object): | |||
| + | |||
| + def __init__(self): | |||
| + self._table = UnknownTable() | |||
| + self._splitter = RowSplitter() | |||
| + testcases = TestCaseTable() | |||
| + settings = SettingTable(testcases.set_default_template) | |||
| + variables = VariableTable() | |||
| + keywords = KeywordTable() | |||
| + self._tables = {'settings': settings, 'setting': settings, | |||
| + 'metadata': settings, | |||
| + 'variables': variables, 'variable': variables, | |||
| + 'testcases': testcases, 'testcase': testcases, | |||
| + 'keywords': keywords, 'keyword': keywords, | |||
| + 'userkeywords': keywords, 'userkeyword': keywords} | |||
| + | |||
| + def tokenize(self, row): | |||
| + commented = False | |||
| + heading = False | |||
| + for index, value in enumerate(self._splitter.split(row)): | |||
| + # First value, and every second after that, is a separator. | |||
| + index, separator = divmod(index-1, 2) | |||
| + if value.startswith('#'): | |||
| + commented = True | |||
| + elif index == 0 and value.startswith('*'): | |||
| + self._table = self._start_table(value) | |||
| + heading = True | |||
| + for value, token in self._tokenize(value, index, commented, | |||
| + separator, heading): | |||
| + yield value, token | |||
| + self._table.end_row() | |||
| + | |||
| + def _start_table(self, header): | |||
| + name = normalize(header, remove='*') | |||
| + return self._tables.get(name, UnknownTable()) | |||
| + | |||
| + def _tokenize(self, value, index, commented, separator, heading): | |||
| + if commented: | |||
| + yield value, COMMENT | |||
| + elif separator: | |||
| + yield value, SEPARATOR | |||
| + elif heading: | |||
| + yield value, HEADING | |||
| + else: | |||
| + for value, token in self._table.tokenize(value, index): | |||
| + yield value, token | |||
| + | |||
| + | |||
| +class RowSplitter(object): | |||
| + _space_splitter = re.compile('( {2,})') | |||
| + _pipe_splitter = re.compile('((?:^| +)\|(?: +|$))') | |||
| + | |||
| + def split(self, row): | |||
| + splitter = (row.startswith('| ') and self._split_from_pipes | |||
| + or self._split_from_spaces) | |||
| + for value in splitter(row.rstrip()): | |||
| + yield value | |||
| + yield '\n' | |||
| + | |||
| + def _split_from_spaces(self, row): | |||
| + yield '' # Start with (pseudo)separator similarly as with pipes | |||
| + for value in self._space_splitter.split(row): | |||
| + yield value | |||
| + | |||
| + def _split_from_pipes(self, row): | |||
| + _, separator, rest = self._pipe_splitter.split(row, 1) | |||
| + yield separator | |||
| + while self._pipe_splitter.search(rest): | |||
| + cell, separator, rest = self._pipe_splitter.split(rest, 1) | |||
| + yield cell | |||
| + yield separator | |||
| + yield rest | |||
| + | |||
| + | |||
| +class Tokenizer(object): | |||
| + _tokens = None | |||
| + | |||
| + def __init__(self): | |||
| + self._index = 0 | |||
| + | |||
| + def tokenize(self, value): | |||
| + values_and_tokens = self._tokenize(value, self._index) | |||
| + self._index += 1 | |||
| + if isinstance(values_and_tokens, type(Token)): | |||
| + values_and_tokens = [(value, values_and_tokens)] | |||
| + return values_and_tokens | |||
| + | |||
| + def _tokenize(self, value, index): | |||
| + index = min(index, len(self._tokens) - 1) | |||
| + return self._tokens[index] | |||
| + | |||
| + def _is_assign(self, value): | |||
| + if value.endswith('='): | |||
| + value = value[:-1].strip() | |||
| + var = VariableSplitter(value, identifiers='$@') | |||
| + return var.start == 0 and var.end == len(value) | |||
| + | |||
| + | |||
| +class Comment(Tokenizer): | |||
| + _tokens = (COMMENT,) | |||
| + | |||
| + | |||
| +class Setting(Tokenizer): | |||
| + _tokens = (SETTING, ARGUMENT) | |||
| + _keyword_settings = ('suitesetup', 'suiteprecondition', 'suiteteardown', | |||
| + 'suitepostcondition', 'testsetup', 'testprecondition', | |||
| + 'testteardown', 'testpostcondition', 'testtemplate') | |||
| + _import_settings = ('library', 'resource', 'variables') | |||
| + _other_settings = ('documentation', 'metadata', 'forcetags', 'defaulttags', | |||
| + 'testtimeout') | |||
| + _custom_tokenizer = None | |||
| + | |||
| + def __init__(self, template_setter=None): | |||
| + Tokenizer.__init__(self) | |||
| + self._template_setter = template_setter | |||
| + | |||
| + def _tokenize(self, value, index): | |||
| + if index == 1 and self._template_setter: | |||
| + self._template_setter(value) | |||
| + if index == 0: | |||
| + normalized = normalize(value) | |||
| + if normalized in self._keyword_settings: | |||
| + self._custom_tokenizer = KeywordCall(support_assign=False) | |||
| + elif normalized in self._import_settings: | |||
| + self._custom_tokenizer = ImportSetting() | |||
| + elif normalized not in self._other_settings: | |||
| + return ERROR | |||
| + elif self._custom_tokenizer: | |||
| + return self._custom_tokenizer.tokenize(value) | |||
| + return Tokenizer._tokenize(self, value, index) | |||
| + | |||
| + | |||
| +class ImportSetting(Tokenizer): | |||
| + _tokens = (IMPORT, ARGUMENT) | |||
| + | |||
| + | |||
| +class TestCaseSetting(Setting): | |||
| + _keyword_settings = ('setup', 'precondition', 'teardown', 'postcondition', | |||
| + 'template') | |||
| + _import_settings = () | |||
| + _other_settings = ('documentation', 'tags', 'timeout') | |||
| + | |||
| + def _tokenize(self, value, index): | |||
| + if index == 0: | |||
| + type = Setting._tokenize(self, value[1:-1], index) | |||
| + return [('[', SYNTAX), (value[1:-1], type), (']', SYNTAX)] | |||
| + return Setting._tokenize(self, value, index) | |||
| + | |||
| + | |||
| +class KeywordSetting(TestCaseSetting): | |||
| + _keyword_settings = ('teardown',) | |||
| + _other_settings = ('documentation', 'arguments', 'return', 'timeout') | |||
| + | |||
| + | |||
| +class Variable(Tokenizer): | |||
| + _tokens = (SYNTAX, ARGUMENT) | |||
| + | |||
| + def _tokenize(self, value, index): | |||
| + if index == 0 and not self._is_assign(value): | |||
| + return ERROR | |||
| + return Tokenizer._tokenize(self, value, index) | |||
| + | |||
| + | |||
| +class KeywordCall(Tokenizer): | |||
| + _tokens = (KEYWORD, ARGUMENT) | |||
| + | |||
| + def __init__(self, support_assign=True): | |||
| + Tokenizer.__init__(self) | |||
| + self._keyword_found = not support_assign | |||
| + self._assigns = 0 | |||
| + | |||
| + def _tokenize(self, value, index): | |||
| + if not self._keyword_found and self._is_assign(value): | |||
| + self._assigns += 1 | |||
| + return SYNTAX # VariableTokenizer tokenizes this later. | |||
| + if self._keyword_found: | |||
| + return Tokenizer._tokenize(self, value, index - self._assigns) | |||
| + self._keyword_found = True | |||
| + return GherkinTokenizer().tokenize(value, KEYWORD) | |||
| + | |||
| + | |||
| +class GherkinTokenizer(object): | |||
| + _gherkin_prefix = re.compile('^(Given|When|Then|And) ', re.IGNORECASE) | |||
| + | |||
| + def tokenize(self, value, token): | |||
| + match = self._gherkin_prefix.match(value) | |||
| + if not match: | |||
| + return [(value, token)] | |||
| + end = match.end() | |||
| + return [(value[:end], GHERKIN), (value[end:], token)] | |||
| + | |||
| + | |||
| +class TemplatedKeywordCall(Tokenizer): | |||
| + _tokens = (ARGUMENT,) | |||
| + | |||
| + | |||
| +class ForLoop(Tokenizer): | |||
| + | |||
| + def __init__(self): | |||
| + Tokenizer.__init__(self) | |||
| + self._in_arguments = False | |||
| + | |||
| + def _tokenize(self, value, index): | |||
| + token = self._in_arguments and ARGUMENT or SYNTAX | |||
| + if value.upper() in ('IN', 'IN RANGE'): | |||
| + self._in_arguments = True | |||
| + return token | |||
| + | |||
| + | |||
| +class _Table(object): | |||
| + _tokenizer_class = None | |||
| + | |||
| + def __init__(self, prev_tokenizer=None): | |||
| + self._tokenizer = self._tokenizer_class() | |||
| + self._prev_tokenizer = prev_tokenizer | |||
| + self._prev_values_on_row = [] | |||
| + | |||
| + def tokenize(self, value, index): | |||
| + if self._continues(value, index): | |||
| + self._tokenizer = self._prev_tokenizer | |||
| + yield value, SYNTAX | |||
| + else: | |||
| + for value_and_token in self._tokenize(value, index): | |||
| + yield value_and_token | |||
| + self._prev_values_on_row.append(value) | |||
| + | |||
| + def _continues(self, value, index): | |||
| + return value == '...' and all(self._is_empty(t) | |||
| + for t in self._prev_values_on_row) | |||
| + | |||
| + def _is_empty(self, value): | |||
| + return value in ('', '\\') | |||
| + | |||
| + def _tokenize(self, value, index): | |||
| + return self._tokenizer.tokenize(value) | |||
| + | |||
| + def end_row(self): | |||
| + self.__init__(prev_tokenizer=self._tokenizer) | |||
| + | |||
| + | |||
| +class UnknownTable(_Table): | |||
| + _tokenizer_class = Comment | |||
| + | |||
| + def _continues(self, value, index): | |||
| + return False | |||
| + | |||
| + | |||
| +class VariableTable(_Table): | |||
| + _tokenizer_class = Variable | |||
| + | |||
| + | |||
| +class SettingTable(_Table): | |||
| + _tokenizer_class = Setting | |||
| + | |||
| + def __init__(self, template_setter, prev_tokenizer=None): | |||
| + _Table.__init__(self, prev_tokenizer) | |||
| + self._template_setter = template_setter | |||
| + | |||
| + def _tokenize(self, value, index): | |||
| + if index == 0 and normalize(value) == 'testtemplate': | |||
| + self._tokenizer = Setting(self._template_setter) | |||
| + return _Table._tokenize(self, value, index) | |||
| + | |||
| + def end_row(self): | |||
| + self.__init__(self._template_setter, prev_tokenizer=self._tokenizer) | |||
| + | |||
| + | |||
| +class TestCaseTable(_Table): | |||
| + _setting_class = TestCaseSetting | |||
| + _test_template = None | |||
| + _default_template = None | |||
| + | |||
| + @property | |||
| + def _tokenizer_class(self): | |||
| + if self._test_template or (self._default_template and | |||
| + self._test_template is not False): | |||
| + return TemplatedKeywordCall | |||
| + return KeywordCall | |||
| + | |||
| + def _continues(self, value, index): | |||
| + return index > 0 and _Table._continues(self, value, index) | |||
| + | |||
| + def _tokenize(self, value, index): | |||
| + if index == 0: | |||
| + if value: | |||
| + self._test_template = None | |||
| + return GherkinTokenizer().tokenize(value, TC_KW_NAME) | |||
| + if index == 1 and self._is_setting(value): | |||
| + if self._is_template(value): | |||
| + self._test_template = False | |||
| + self._tokenizer = self._setting_class(self.set_test_template) | |||
| + else: | |||
| + self._tokenizer = self._setting_class() | |||
| + if index == 1 and self._is_for_loop(value): | |||
| + self._tokenizer = ForLoop() | |||
| + if index == 1 and self._is_empty(value): | |||
| + return [(value, SYNTAX)] | |||
| + return _Table._tokenize(self, value, index) | |||
| + | |||
| + def _is_setting(self, value): | |||
| + return value.startswith('[') and value.endswith(']') | |||
| + | |||
| + def _is_template(self, value): | |||
| + return normalize(value) == '[template]' | |||
| + | |||
| + def _is_for_loop(self, value): | |||
| + return value.startswith(':') and normalize(value, remove=':') == 'for' | |||
| + | |||
| + def set_test_template(self, template): | |||
| + self._test_template = self._is_template_set(template) | |||
| + | |||
| + def set_default_template(self, template): | |||
| + self._default_template = self._is_template_set(template) | |||
| + | |||
| + def _is_template_set(self, template): | |||
| + return normalize(template) not in ('', '\\', 'none', '${empty}') | |||
| + | |||
| + | |||
| +class KeywordTable(TestCaseTable): | |||
| + _tokenizer_class = KeywordCall | |||
| + _setting_class = KeywordSetting | |||
| + | |||
| + def _is_template(self, value): | |||
| + return False | |||
| + | |||
| + | |||
| +# Following code copied directly from Robot Framework 2.7.5. | |||
| + | |||
| +class VariableSplitter: | |||
| + | |||
| + def __init__(self, string, identifiers): | |||
| + self.identifier = None | |||
| + self.base = None | |||
| + self.index = None | |||
| + self.start = -1 | |||
| + self.end = -1 | |||
| + self._identifiers = identifiers | |||
| + self._may_have_internal_variables = False | |||
| + try: | |||
| + self._split(string) | |||
| + except ValueError: | |||
| + pass | |||
| + else: | |||
| + self._finalize() | |||
| + | |||
| + def get_replaced_base(self, variables): | |||
| + if self._may_have_internal_variables: | |||
| + return variables.replace_string(self.base) | |||
| + return self.base | |||
| + | |||
| + def _finalize(self): | |||
| + self.identifier = self._variable_chars[0] | |||
| + self.base = ''.join(self._variable_chars[2:-1]) | |||
| + self.end = self.start + len(self._variable_chars) | |||
| + if self._has_list_variable_index(): | |||
| + self.index = ''.join(self._list_variable_index_chars[1:-1]) | |||
| + self.end += len(self._list_variable_index_chars) | |||
| + | |||
| + def _has_list_variable_index(self): | |||
| + return self._list_variable_index_chars\ | |||
| + and self._list_variable_index_chars[-1] == ']' | |||
| + | |||
| + def _split(self, string): | |||
| + start_index, max_index = self._find_variable(string) | |||
| + self.start = start_index | |||
| + self._open_curly = 1 | |||
| + self._state = self._variable_state | |||
| + self._variable_chars = [string[start_index], '{'] | |||
| + self._list_variable_index_chars = [] | |||
| + self._string = string | |||
| + start_index += 2 | |||
| + for index, char in enumerate(string[start_index:]): | |||
| + index += start_index # Giving start to enumerate only in Py 2.6+ | |||
| + try: | |||
| + self._state(char, index) | |||
| + except StopIteration: | |||
| + return | |||
| + if index == max_index and not self._scanning_list_variable_index(): | |||
| + return | |||
| + | |||
| + def _scanning_list_variable_index(self): | |||
| + return self._state in [self._waiting_list_variable_index_state, | |||
| + self._list_variable_index_state] | |||
| + | |||
| + def _find_variable(self, string): | |||
| + max_end_index = string.rfind('}') | |||
| + if max_end_index == -1: | |||
| + raise ValueError('No variable end found') | |||
| + if self._is_escaped(string, max_end_index): | |||
| + return self._find_variable(string[:max_end_index]) | |||
| + start_index = self._find_start_index(string, 1, max_end_index) | |||
| + if start_index == -1: | |||
| + raise ValueError('No variable start found') | |||
| + return start_index, max_end_index | |||
| + | |||
| + def _find_start_index(self, string, start, end): | |||
| + index = string.find('{', start, end) - 1 | |||
| + if index < 0: | |||
| + return -1 | |||
| + if self._start_index_is_ok(string, index): | |||
| + return index | |||
| + return self._find_start_index(string, index+2, end) | |||
| + | |||
| + def _start_index_is_ok(self, string, index): | |||
| + return string[index] in self._identifiers\ | |||
| + and not self._is_escaped(string, index) | |||
| + | |||
| + def _is_escaped(self, string, index): | |||
| + escaped = False | |||
| + while index > 0 and string[index-1] == '\\': | |||
| + index -= 1 | |||
| + escaped = not escaped | |||
| + return escaped | |||
| + | |||
| + def _variable_state(self, char, index): | |||
| + self._variable_chars.append(char) | |||
| + if char == '}' and not self._is_escaped(self._string, index): | |||
| + self._open_curly -= 1 | |||
| + if self._open_curly == 0: | |||
| + if not self._is_list_variable(): | |||
| + raise StopIteration | |||
| + self._state = self._waiting_list_variable_index_state | |||
| + elif char in self._identifiers: | |||
| + self._state = self._internal_variable_start_state | |||
| + | |||
| + def _is_list_variable(self): | |||
| + return self._variable_chars[0] == '@' | |||
| + | |||
| + def _internal_variable_start_state(self, char, index): | |||
| + self._state = self._variable_state | |||
| + if char == '{': | |||
| + self._variable_chars.append(char) | |||
| + self._open_curly += 1 | |||
| + self._may_have_internal_variables = True | |||
| + else: | |||
| + self._variable_state(char, index) | |||
| + | |||
| + def _waiting_list_variable_index_state(self, char, index): | |||
| + if char != '[': | |||
| + raise StopIteration | |||
| + self._list_variable_index_chars.append(char) | |||
| + self._state = self._list_variable_index_state | |||
| + | |||
| + def _list_variable_index_state(self, char, index): | |||
| + self._list_variable_index_chars.append(char) | |||
| + if char == ']': | |||
| + raise StopIteration | |||
11
vendor/pygments/pygments/lexers/_scilab_builtins.py
4
vendor/pygments/pygments/lexers/_sourcemodbuiltins.py
12
vendor/pygments/pygments/lexers/_stan_builtins.py
114
vendor/pygments/pygments/lexers/agile.py
46
vendor/pygments/pygments/lexers/asm.py
1,302
vendor/pygments/pygments/lexers/compiled.py
104
vendor/pygments/pygments/lexers/dalvik.py
| @@ -0,0 +1,104 @@ | |||
| +# -*- coding: utf-8 -*- | |||
| +""" | |||
| + pygments.lexers.dalvik | |||
| + ~~~~~~~~~~~~~~~~~~~~~~ | |||
| + | |||
| + Pygments lexers for Dalvik VM-related languages. | |||
| + | |||
| + :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. | |||
| + :license: BSD, see LICENSE for details. | |||
| +""" | |||
| + | |||
| +from pygments.lexer import RegexLexer, include, bygroups | |||
| +from pygments.token import Keyword, Text, Comment, Name, String, Number, \ | |||
| + Punctuation | |||
| + | |||
| +__all__ = ['SmaliLexer'] | |||
| + | |||
| + | |||
| +class SmaliLexer(RegexLexer): | |||
| + """ | |||
| + For `Smali <http://code.google.com/p/smali/>`_ (Android/Dalvik) assembly | |||
| + code. | |||
| + | |||
| + *New in Pygments 1.6.* | |||
| + """ | |||
| + name = 'Smali' | |||
| + aliases = ['smali'] | |||
| + filenames = ['*.smali'] | |||
| + mimetypes = ['text/smali'] | |||
| + | |||
| + tokens = { | |||
| + 'root': [ | |||
| + include('comment'), | |||
| + include('label'), | |||
| + include('field'), | |||
| + include('method'), | |||
| + include('class'), | |||
| + include('directive'), | |||
| + include('access-modifier'), | |||
| + include('instruction'), | |||
| + include('literal'), | |||
| + include('punctuation'), | |||
| + include('type'), | |||
| + include('whitespace') | |||
| + ], | |||
| + 'directive': [ | |||
| + (r'^[ \t]*\.(class|super|implements|field|subannotation|annotation|' | |||
| + r'enum|method|registers|locals|array-data|packed-switch|' | |||
| + r'sparse-switch|catchall|catch|line|parameter|local|prologue|' | |||
| + r'epilogue|source)', Keyword), | |||
| + (r'^[ \t]*\.end (field|subannotation|annotation|method|array-data|' | |||
| + 'packed-switch|sparse-switch|parameter|local)', Keyword), | |||
| + (r'^[ \t]*\.restart local', Keyword), | |||
| + ], | |||
| + 'access-modifier': [ | |||
| + (r'(public|private|protected|static|final|synchronized|bridge|' | |||
| + r'varargs|native|abstract|strictfp|synthetic|constructor|' | |||
| + r'declared-synchronized|interface|enum|annotation|volatile|' | |||
| + r'transient)', Keyword), | |||
| + ], | |||
| + 'whitespace': [ | |||
| + (r'\n', Text), | |||
| + (r'\s+', Text), | |||
| + ], | |||
| + 'instruction': [ | |||
| + (r'\b[vp]\d+\b', Name.Builtin), # registers | |||
| + (r'\b[a-z][A-Za-z0-9/-]+\s+', Text), # instructions | |||
| + ], | |||
| + 'literal': [ | |||
| + (r'".*"', String), | |||
| + (r'0x[0-9A-Fa-f]+t?', Number.Hex), | |||
| + (r'[0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), | |||
| + (r'[0-9]+L?', Number.Integer), | |||
| + ], | |||
| + 'field': [ | |||
| + (r'(\$?\b)([A-Za-z0-9_$]*)(:)', | |||
| + bygroups(Punctuation, Name.Variable, Punctuation)), | |||
| + ], | |||
| + 'method': [ | |||
| + (r'<(?:cl)?init>', Name.Function), # constructor | |||
| + (r'(\$?\b)([A-Za-z0-9_$]*)(\()', | |||
| + bygroups(Punctuation, Name.Function, Punctuation)), | |||
| + ], | |||
| + 'label': [ | |||
| + (r':[A-Za-z0-9_]+', Name.Label), | |||
| + ], | |||
| + 'class': [ | |||
| + # class names in the form Lcom/namespace/ClassName; | |||
| + # I only want to color the ClassName part, so the namespace part is | |||
| + # treated as 'Text' | |||
| + (r'(L)((?:[A-Za-z0-9_$]+/)*)([A-Za-z0-9_$]+)(;)', | |||
| + bygroups(Keyword.Type, Text, Name.Class, Text)), | |||
| + ], | |||
| + 'punctuation': [ | |||
| + (r'->', Punctuation), | |||
| + (r'[{},\(\):=\.-]', Punctuation), | |||
| + ], | |||
| + 'type': [ | |||
| + (r'[ZBSCIJFDV\[]+', Keyword.Type), | |||
| + ], | |||
| + 'comment': [ | |||
| + (r'#.*?\n', Comment), | |||
| + ], | |||
| + } | |||
2
vendor/pygments/pygments/lexers/dotnet.py
428
vendor/pygments/pygments/lexers/foxpro.py
| @@ -0,0 +1,428 @@ | |||
| +# -*- coding: utf-8 -*- | |||
| +""" | |||
| + pygments.lexers.foxpro | |||
| + ~~~~~~~~~~~~~~~~~~~~~~ | |||
| + | |||
| + Simple lexer for Microsoft Visual FoxPro source code. | |||
| + | |||
| + :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. | |||
| + :license: BSD, see LICENSE for details. | |||
| +""" | |||
| + | |||
| +import re | |||
| + | |||
| +from pygments.lexer import RegexLexer | |||
| +from pygments.token import Punctuation, Text, Comment, Operator, Keyword, \ | |||
| + Name, String | |||
| + | |||
| +__all__ = ['FoxProLexer'] | |||
| + | |||
| + | |||
| +class FoxProLexer(RegexLexer): | |||
| + """Lexer for Microsoft Visual FoxPro language. | |||
| + | |||
| + FoxPro syntax allows to shorten all keywords and function names | |||
| + to 4 characters. Shortened forms are not recognized by this lexer. | |||
| + | |||
| + *New in Pygments 1.6.* | |||
| + """ | |||
| + | |||
| + name = 'FoxPro' | |||
| + aliases = ['Clipper', 'XBase'] | |||
| + filenames = ['*.PRG', '*.prg'] | |||
| + mimetype = [] | |||
| + | |||
| + flags = re.IGNORECASE | re.MULTILINE | |||
| + | |||
| + tokens = { | |||
| + 'root': [ | |||
| + (r';\s*\n', Punctuation), # consume newline | |||
| + (r'(^|\n)\s*', Text, 'newline'), | |||
| + | |||
| + # Square brackets may be used for array indices | |||
| + # and for string literal. Look for arrays | |||
| + # before matching string literals. | |||
| + (r'(?<=\w)\[[0-9, ]+\]', Text), | |||
| + (r'\'[^\'\n]*\'|"[^"\n]*"|\[[^]*]\]', String), | |||
| + (r'(^\s*\*|&&|&&).*?\n', Comment.Single), | |||
| + | |||
| + (r'(ABS|ACLASS|ACOPY|ACOS|ADATABASES|ADBOBJECTS|ADDBS|' | |||
| + r'ADDPROPERTY|ADEL|ADIR|ADLLS|ADOCKSTATE|AELEMENT|AERROR|' | |||
| + r'AEVENTS|AFIELDS|AFONT|AGETCLASS|AGETFILEVERSION|AINS|' | |||
| + r'AINSTANCE|ALANGUAGE|ALEN|ALIAS|ALINES|ALLTRIM|' | |||
| + r'AMEMBERS|AMOUSEOBJ|ANETRESOURCES|APRINTERS|APROCINFO|' | |||
| + r'ASC|ASCAN|ASELOBJ|ASESSIONS|ASIN|ASORT|ASQLHANDLES|' | |||
| + r'ASTACKINFO|ASUBSCRIPT|AT|AT_C|ATAGINFO|ATAN|ATC|ATCC|' | |||
| + r'ATCLINE|ATLINE|ATN2|AUSED|AVCXCLASSES|BAR|BARCOUNT|' | |||
| + r'BARPROMPT|BETWEEN|BINDEVENT|BINTOC|BITAND|BITCLEAR|' | |||
| + r'BITLSHIFT|BITNOT|BITOR|BITRSHIFT|BITSET|BITTEST|BITXOR|' | |||
| + r'BOF|CANDIDATE|CAPSLOCK|CAST|CDOW|CDX|CEILING|CHR|CHRSAW|' | |||
| + r'CHRTRAN|CHRTRANC|CLEARRESULTSET|CMONTH|CNTBAR|CNTPAD|COL|' | |||
| + r'COM|Functions|COMARRAY|COMCLASSINFO|COMPOBJ|COMPROP|' | |||
| + r'COMRETURNERROR|COS|CPCONVERT|CPCURRENT|CPDBF|CREATEBINARY|' | |||
| + r'CREATEOBJECT|CREATEOBJECTEX|CREATEOFFLINE|CTOBIN|CTOD|' | |||
| + r'CTOT|CURDIR|CURSORGETPROP|CURSORSETPROP|CURSORTOXML|' | |||
| + r'CURVAL|DATE|DATETIME|DAY|DBC|DBF|DBGETPROP|DBSETPROP|' | |||
| + r'DBUSED|DDEAbortTrans|DDEAdvise|DDEEnabled|DDEExecute|' | |||
| + r'DDEInitiate|DDELastError|DDEPoke|DDERequest|DDESetOption|' | |||
| + r'DDESetService|DDESetTopic|DDETerminate|DEFAULTEXT|' | |||
| + r'DELETED|DESCENDING|DIFFERENCE|DIRECTORY|DISKSPACE|' | |||
| + r'DisplayPath|DMY|DODEFAULT|DOW|DRIVETYPE|DROPOFFLINE|' | |||
| + r'DTOC|DTOR|DTOS|DTOT|EDITSOURCE|EMPTY|EOF|ERROR|EVAL(UATE)?|' | |||
| + r'EVENTHANDLER|EVL|EXECSCRIPT|EXP|FCHSIZE|FCLOSE|FCOUNT|' | |||
| + r'FCREATE|FDATE|FEOF|FERROR|FFLUSH|FGETS|FIELD|FILE|' | |||
| + r'FILETOSTR|FILTER|FKLABEL|FKMAX|FLDLIST|FLOCK|FLOOR|' | |||
| + r'FONTMETRIC|FOPEN|FOR|FORCEEXT|FORCEPATH|FOUND|FPUTS|' | |||
| + r'FREAD|FSEEK|FSIZE|FTIME|FULLPATH|FV|FWRITE|' | |||
| + r'GETAUTOINCVALUE|GETBAR|GETCOLOR|GETCP|GETDIR|GETENV|' | |||
| + r'GETFILE|GETFLDSTATE|GETFONT|GETINTERFACE|' | |||
| + r'GETNEXTMODIFIED|GETOBJECT|GETPAD|GETPEM|GETPICT|' | |||
| + r'GETPRINTER|GETRESULTSET|GETWORDCOUNT|GETWORDNUM|' | |||
| + r'GETCURSORADAPTER|GOMONTH|HEADER|HOME|HOUR|ICASE|' | |||
| + r'IDXCOLLATE|IIF|IMESTATUS|INDBC|INDEXSEEK|INKEY|INLIST|' | |||
| + r'INPUTBOX|INSMODE|INT|ISALPHA|ISBLANK|ISCOLOR|ISDIGIT|' | |||
| + r'ISEXCLUSIVE|ISFLOCKED|ISLEADBYTE|ISLOWER|ISMEMOFETCHED|' | |||
| + r'ISMOUSE|ISNULL|ISPEN|ISREADONLY|ISRLOCKED|' | |||
| + r'ISTRANSACTABLE|ISUPPER|JUSTDRIVE|JUSTEXT|JUSTFNAME|' | |||
| + r'JUSTPATH|JUSTSTEM|KEY|KEYMATCH|LASTKEY|LEFT|LEFTC|LEN|' | |||
| + r'LENC|LIKE|LIKEC|LINENO|LOADPICTURE|LOCFILE|LOCK|LOG|' | |||
| + r'LOG10|LOOKUP|LOWER|LTRIM|LUPDATE|MAKETRANSACTABLE|MAX|' | |||
| + r'MCOL|MDOWN|MDX|MDY|MEMLINES|MEMORY|MENU|MESSAGE|' | |||
| + r'MESSAGEBOX|MIN|MINUTE|MLINE|MOD|MONTH|MRKBAR|MRKPAD|' | |||
| + r'MROW|MTON|MWINDOW|NDX|NEWOBJECT|NORMALIZE|NTOM|NUMLOCK|' | |||
| + r'NVL|OBJNUM|OBJTOCLIENT|OBJVAR|OCCURS|OEMTOANSI|OLDVAL|' | |||
| + r'ON|ORDER|OS|PAD|PADL|PARAMETERS|PAYMENT|PCOL|PCOUNT|' | |||
| + r'PEMSTATUS|PI|POPUP|PRIMARY|PRINTSTATUS|PRMBAR|PRMPAD|' | |||
| + r'PROGRAM|PROMPT|PROPER|PROW|PRTINFO|PUTFILE|PV|QUARTER|' | |||
| + r'RAISEEVENT|RAND|RAT|RATC|RATLINE|RDLEVEL|READKEY|RECCOUNT|' | |||
| + r'RECNO|RECSIZE|REFRESH|RELATION|REPLICATE|REQUERY|RGB|' | |||
| + r'RGBSCHEME|RIGHT|RIGHTC|RLOCK|ROUND|ROW|RTOD|RTRIM|' | |||
| + r'SAVEPICTURE|SCHEME|SCOLS|SEC|SECONDS|SEEK|SELECT|SET|' | |||
| + r'SETFLDSTATE|SETRESULTSET|SIGN|SIN|SKPBAR|SKPPAD|SOUNDEX|' | |||
| + r'SPACE|SQLCANCEL|SQLCOLUMNS|SQLCOMMIT|SQLCONNECT|' | |||
| + r'SQLDISCONNECT|SQLEXEC|SQLGETPROP|SQLIDLEDISCONNECT|' | |||
| + r'SQLMORERESULTS|SQLPREPARE|SQLROLLBACK|SQLSETPROP|' | |||
| + r'SQLSTRINGCONNECT|SQLTABLES|SQRT|SROWS|STR|STRCONV|' | |||
| + r'STREXTRACT|STRTOFILE|STRTRAN|STUFF|STUFFC|SUBSTR|' | |||
| + r'SUBSTRC|SYS|SYSMETRIC|TABLEREVERT|TABLEUPDATE|TAG|' | |||
| + r'TAGCOUNT|TAGNO|TAN|TARGET|TEXTMERGE|TIME|TRANSFORM|' | |||
| + r'TRIM|TTOC|TTOD|TXNLEVEL|TXTWIDTH|TYPE|UNBINDEVENTS|' | |||
| + r'UNIQUE|UPDATED|UPPER|USED|VAL|VARREAD|VARTYPE|VERSION|' | |||
| + r'WBORDER|WCHILD|WCOLS|WDOCKABLE|WEEK|WEXIST|WFONT|WLAST|' | |||
| + r'WLCOL|WLROW|WMAXIMUM|WMINIMUM|WONTOP|WOUTPUT|WPARENT|' | |||
| + r'WREAD|WROWS|WTITLE|WVISIBLE|XMLTOCURSOR|XMLUPDATEGRAM|' | |||
| + r'YEAR)(?=\s*\()', Name.Function), | |||
| + | |||
| + (r'_ALIGNMENT|_ASCIICOLS|_ASCIIROWS|_ASSIST|_BEAUTIFY|_BOX|' | |||
| + r'_BROWSER|_BUILDER|_CALCMEM|_CALCVALUE|_CLIPTEXT|_CONVERTER|' | |||
| + r'_COVERAGE|_CUROBJ|_DBLCLICK|_DIARYDATE|_DOS|_FOXDOC|_FOXREF|' | |||
| + r'_GALLERY|_GENGRAPH|_GENHTML|_GENMENU|_GENPD|_GENSCRN|' | |||
| + r'_GENXTAB|_GETEXPR|_INCLUDE|_INCSEEK|_INDENT|_LMARGIN|_MAC|' | |||
| + r'_MENUDESIGNER|_MLINE|_PADVANCE|_PAGENO|_PAGETOTAL|_PBPAGE|' | |||
| + r'_PCOLNO|_PCOPIES|_PDRIVER|_PDSETUP|_PECODE|_PEJECT|_PEPAGE|' | |||
| + r'_PLENGTH|_PLINENO|_PLOFFSET|_PPITCH|_PQUALITY|_PRETEXT|' | |||
| + r'_PSCODE|_PSPACING|_PWAIT|_RMARGIN|_REPORTBUILDER|' | |||
| + r'_REPORTOUTPUT|_REPORTPREVIEW|_SAMPLES|_SCCTEXT|_SCREEN|' | |||
| + r'_SHELL|_SPELLCHK|_STARTUP|_TABS|_TALLY|_TASKPANE|_TEXT|' | |||
| + r'_THROTTLE|_TOOLBOX|_TOOLTIPTIMEOUT|_TRANSPORT|_TRIGGERLEVEL|' | |||
| + r'_UNIX|_VFP|_WINDOWS|_WIZARD|_WRAP', Keyword.Pseudo), | |||
| + | |||
| + (r'THISFORMSET|THISFORM|THIS', Name.Builtin), | |||
| + | |||
| + (r'Application|CheckBox|Collection|Column|ComboBox|' | |||
| + r'CommandButton|CommandGroup|Container|Control|CursorAdapter|' | |||
| + r'Cursor|Custom|DataEnvironment|DataObject|EditBox|' | |||
| + r'Empty|Exception|Fields|Files|File|FormSet|Form|FoxCode|' | |||
| + r'Grid|Header|Hyperlink|Image|Label|Line|ListBox|Objects|' | |||
| + r'OptionButton|OptionGroup|PageFrame|Page|ProjectHook|Projects|' | |||
| + r'Project|Relation|ReportListener|Separator|Servers|Server|' | |||
| + r'Session|Shape|Spinner|Tables|TextBox|Timer|ToolBar|' | |||
| + r'XMLAdapter|XMLField|XMLTable', Name.Class), | |||
| + | |||
| + (r'm\.[a-z_]\w*', Name.Variable), | |||
| + (r'\.(F|T|AND|OR|NOT|NULL)\.|\b(AND|OR|NOT|NULL)\b', Operator.Word), | |||
| + | |||
| + (r'\.(ActiveColumn|ActiveControl|ActiveForm|ActivePage|' | |||
| + r'ActiveProject|ActiveRow|AddLineFeeds|ADOCodePage|Alias|' | |||
| + r'Alignment|Align|AllowAddNew|AllowAutoColumnFit|' | |||
| + r'AllowCellSelection|AllowDelete|AllowHeaderSizing|' | |||
| + r'AllowInsert|AllowModalMessages|AllowOutput|AllowRowSizing|' | |||
| + r'AllowSimultaneousFetch|AllowTabs|AllowUpdate|' | |||
| + r'AlwaysOnBottom|AlwaysOnTop|Anchor|Application|' | |||
| + r'AutoActivate|AutoCenter|AutoCloseTables|AutoComplete|' | |||
| + r'AutoCompSource|AutoCompTable|AutoHideScrollBar|' | |||
| + r'AutoIncrement|AutoOpenTables|AutoRelease|AutoSize|' | |||
| + r'AutoVerbMenu|AutoYield|BackColor|ForeColor|BackStyle|' | |||
| + r'BaseClass|BatchUpdateCount|BindControls|BorderColor|' | |||
| + r'BorderStyle|BorderWidth|BoundColumn|BoundTo|Bound|' | |||
| + r'BreakOnError|BufferModeOverride|BufferMode|' | |||
| + r'BuildDateTime|ButtonCount|Buttons|Cancel|Caption|' | |||
| + r'Centered|Century|ChildAlias|ChildOrder|ChildTable|' | |||
| + r'ClassLibrary|Class|ClipControls|Closable|CLSID|CodePage|' | |||
| + r'ColorScheme|ColorSource|ColumnCount|ColumnLines|' | |||
| + r'ColumnOrder|Columns|ColumnWidths|CommandClauses|' | |||
| + r'Comment|CompareMemo|ConflictCheckCmd|ConflictCheckType|' | |||
| + r'ContinuousScroll|ControlBox|ControlCount|Controls|' | |||
| + r'ControlSource|ConversionFunc|Count|CurrentControl|' | |||
| + r'CurrentDataSession|CurrentPass|CurrentX|CurrentY|' | |||
| + r'CursorSchema|CursorSource|CursorStatus|Curvature|' | |||
| + r'Database|DataSessionID|DataSession|DataSourceType|' | |||
| + r'DataSource|DataType|DateFormat|DateMark|Debug|' | |||
| + r'DeclareXMLPrefix|DEClassLibrary|DEClass|DefaultFilePath|' | |||
| + r'Default|DefOLELCID|DeleteCmdDataSourceType|DeleteCmdDataSource|' | |||
| + r'DeleteCmd|DeleteMark|Description|Desktop|' | |||
| + r'Details|DisabledBackColor|DisabledForeColor|' | |||
| + r'DisabledItemBackColor|DisabledItemForeColor|' | |||
| + r'DisabledPicture|DisableEncode|DisplayCount|' | |||
| + r'DisplayValue|Dockable|Docked|DockPosition|' | |||
| + r'DocumentFile|DownPicture|DragIcon|DragMode|DrawMode|' | |||
| + r'DrawStyle|DrawWidth|DynamicAlignment|DynamicBackColor|' | |||
| + r'DynamicForeColor|DynamicCurrentControl|DynamicFontBold|' | |||
| + r'DynamicFontItalic|DynamicFontStrikethru|' | |||
| + r'DynamicFontUnderline|DynamicFontName|DynamicFontOutline|' | |||
| + r'DynamicFontShadow|DynamicFontSize|DynamicInputMask|' | |||
| + r'DynamicLineHeight|EditorOptions|Enabled|' | |||
| + r'EnableHyperlinks|Encrypted|ErrorNo|Exclude|Exclusive|' | |||
| + r'FetchAsNeeded|FetchMemoCmdList|FetchMemoDataSourceType|' | |||
| + r'FetchMemoDataSource|FetchMemo|FetchSize|' | |||
| + r'FileClassLibrary|FileClass|FillColor|FillStyle|Filter|' | |||
| + r'FirstElement|FirstNestedTable|Flags|FontBold|FontItalic|' | |||
| + r'FontStrikethru|FontUnderline|FontCharSet|FontCondense|' | |||
| + r'FontExtend|FontName|FontOutline|FontShadow|FontSize|' | |||
| + r'ForceCloseTag|Format|FormCount|FormattedOutput|Forms|' | |||
| + r'FractionDigits|FRXDataSession|FullName|GDIPlusGraphics|' | |||
| + r'GridLineColor|GridLines|GridLineWidth|HalfHeightCaption|' | |||
| + r'HeaderClassLibrary|HeaderClass|HeaderHeight|Height|' | |||
| + r'HelpContextID|HideSelection|HighlightBackColor|' | |||
| + r'HighlightForeColor|HighlightStyle|HighlightRowLineWidth|' | |||
| + r'HighlightRow|Highlight|HomeDir|Hours|HostName|' | |||
| + r'HScrollSmallChange|hWnd|Icon|IncrementalSearch|Increment|' | |||
| + r'InitialSelectedAlias|InputMask|InsertCmdDataSourceType|' | |||
| + r'InsertCmdDataSource|InsertCmdRefreshCmd|' | |||
| + r'InsertCmdRefreshFieldList|InsertCmdRefreshKeyFieldList|' | |||
| + r'InsertCmd|Instancing|IntegralHeight|' | |||
| + r'Interval|IMEMode|IsAttribute|IsBase64|IsBinary|IsNull|' | |||
| + r'IsDiffGram|IsLoaded|ItemBackColor,|ItemData|ItemIDData|' | |||
| + r'ItemTips|IXMLDOMElement|KeyboardHighValue|KeyboardLowValue|' | |||
| + r'Keyfield|KeyFieldList|KeyPreview|KeySort|LanguageOptions|' | |||
| + r'LeftColumn|Left|LineContents|LineNo|LineSlant|LinkMaster|' | |||
| + r'ListCount|ListenerType|ListIndex|ListItemID|ListItem|' | |||
| + r'List|LockColumnsLeft|LockColumns|LockScreen|MacDesktop|' | |||
| + r'MainFile|MapN19_4ToCurrency|MapBinary|MapVarchar|Margin|' | |||
| + r'MaxButton|MaxHeight|MaxLeft|MaxLength|MaxRecords|MaxTop|' | |||
| + r'MaxWidth|MDIForm|MemberClassLibrary|MemberClass|' | |||
| + r'MemoWindow|Message|MinButton|MinHeight|MinWidth|' | |||
| + r'MouseIcon|MousePointer|Movable|MoverBars|MultiSelect|' | |||
| + r'Name|NestedInto|NewIndex|NewItemID|NextSiblingTable|' | |||
| + r'NoCpTrans|NoDataOnLoad|NoData|NullDisplay|' | |||
| + r'NumberOfElements|Object|OLEClass|OLEDragMode|' | |||
| + r'OLEDragPicture|OLEDropEffects|OLEDropHasData|' | |||
| + r'OLEDropMode|OLEDropTextInsertion|OLELCID|' | |||
| + r'OLERequestPendingTimeout|OLEServerBusyRaiseError|' | |||
| + r'OLEServerBusyTimeout|OLETypeAllowed|OneToMany|' | |||
| + r'OpenViews|OpenWindow|Optimize|OrderDirection|Order|' | |||
| + r'OutputPageCount|OutputType|PageCount|PageHeight|' | |||
| + r'PageNo|PageOrder|Pages|PageTotal|PageWidth|' | |||
| + r'PanelLink|Panel|ParentAlias|ParentClass|ParentTable|' | |||
| + r'Parent|Partition|PasswordChar|PictureMargin|' | |||
| + r'PicturePosition|PictureSpacing|PictureSelectionDisplay|' | |||
| + r'PictureVal|Picture|Prepared|' | |||
| + r'PolyPoints|PreserveWhiteSpace|PreviewContainer|' | |||
| + r'PrintJobName|Procedure|PROCESSID|ProgID|ProjectHookClass|' | |||
| + r'ProjectHookLibrary|ProjectHook|QuietMode|' | |||
| + r'ReadCycle|ReadLock|ReadMouse|ReadObject|ReadOnly|' | |||
| + r'ReadSave|ReadTimeout|RecordMark|RecordSourceType|' | |||
| + r'RecordSource|RefreshAlias|' | |||
| + r'RefreshCmdDataSourceType|RefreshCmdDataSource|RefreshCmd|' | |||
| + r'RefreshIgnoreFieldList|RefreshTimeStamp|RelationalExpr|' | |||
| + r'RelativeColumn|RelativeRow|ReleaseType|Resizable|' | |||
| + r'RespectCursorCP|RespectNesting|RightToLeft|RotateFlip|' | |||
| + r'Rotation|RowColChange|RowHeight|RowSourceType|' | |||
| + r'RowSource|ScaleMode|SCCProvider|SCCStatus|ScrollBars|' | |||
| + r'Seconds|SelectCmd|SelectedID|' | |||
| + r'SelectedItemBackColor|SelectedItemForeColor|Selected|' | |||
| + r'SelectionNamespaces|SelectOnEntry|SelLength|SelStart|' | |||
| + r'SelText|SendGDIPlusImage|SendUpdates|ServerClassLibrary|' | |||
| + r'ServerClass|ServerHelpFile|ServerName|' | |||
| + r'ServerProject|ShowTips|ShowInTaskbar|ShowWindow|' | |||
| + r'Sizable|SizeBox|SOM|Sorted|Sparse|SpecialEffect|' | |||
| + r'SpinnerHighValue|SpinnerLowValue|SplitBar|StackLevel|' | |||
| + r'StartMode|StatusBarText|StatusBar|Stretch|StrictDateEntry|' | |||
| + r'Style|TabIndex|Tables|TabOrientation|Tabs|TabStop|' | |||
| + r'TabStretch|TabStyle|Tag|TerminateRead|Text|Themes|' | |||
| + r'ThreadID|TimestampFieldList|TitleBar|ToolTipText|' | |||
| + r'TopIndex|TopItemID|Top|TwoPassProcess|TypeLibCLSID|' | |||
| + r'TypeLibDesc|TypeLibName|Type|Unicode|UpdatableFieldList|' | |||
| + r'UpdateCmdDataSourceType|UpdateCmdDataSource|' | |||
| + r'UpdateCmdRefreshCmd|UpdateCmdRefreshFieldList|' | |||
| + r'UpdateCmdRefreshKeyFieldList|UpdateCmd|' | |||
| + r'UpdateGramSchemaLocation|UpdateGram|UpdateNameList|UpdateType|' | |||
| + r'UseCodePage|UseCursorSchema|UseDeDataSource|UseMemoSize|' | |||
| + r'UserValue|UseTransactions|UTF8Encoded|Value|VersionComments|' | |||
| + r'VersionCompany|VersionCopyright|VersionDescription|' | |||
| + r'VersionNumber|VersionProduct|VersionTrademarks|Version|' | |||
| + r'VFPXMLProgID|ViewPortHeight|ViewPortLeft|' | |||
| + r'ViewPortTop|ViewPortWidth|VScrollSmallChange|View|Visible|' | |||
| + r'VisualEffect|WhatsThisButton|WhatsThisHelpID|WhatsThisHelp|' | |||
| + r'WhereType|Width|WindowList|WindowState|WindowType|WordWrap|' | |||
| + r'WrapCharInCDATA|WrapInCDATA|WrapMemoInCDATA|XMLAdapter|' | |||
| + r'XMLConstraints|XMLNameIsXPath|XMLNamespace|XMLName|' | |||
| + r'XMLPrefix|XMLSchemaLocation|XMLTable|XMLType|' | |||
| + r'XSDfractionDigits|XSDmaxLength|XSDtotalDigits|' | |||
| + r'XSDtype|ZoomBox)', Name.Attribute), | |||
| + | |||
| + (r'\.(ActivateCell|AddColumn|AddItem|AddListItem|AddObject|' | |||
| + r'AddProperty|AddTableSchema|AddToSCC|Add|' | |||
| + r'ApplyDiffgram|Attach|AutoFit|AutoOpen|Box|Build|' | |||
| + r'CancelReport|ChangesToCursor|CheckIn|CheckOut|Circle|' | |||
| + r'CleanUp|ClearData|ClearStatus|Clear|CloneObject|CloseTables|' | |||
| + r'Close|Cls|CursorAttach|CursorDetach|CursorFill|' | |||
| + r'CursorRefresh|DataToClip|DelayedMemoFetch|DeleteColumn|' | |||
| + r'Dock|DoMessage|DoScroll|DoStatus|DoVerb|Drag|Draw|Eval|' | |||
| + r'GetData|GetDockState|GetFormat|GetKey|GetLatestVersion|' | |||
| + r'GetPageHeight|GetPageWidth|Help|Hide|IncludePageInOutput|' | |||
| + r'IndexToItemID|ItemIDToIndex|Item|LoadXML|Line|Modify|' | |||
| + r'MoveItem|Move|Nest|OLEDrag|OnPreviewClose|OutputPage|' | |||
| + r'Point|Print|PSet|Quit|ReadExpression|ReadMethod|' | |||
| + r'RecordRefresh|Refresh|ReleaseXML|Release|RemoveFromSCC|' | |||
| + r'RemoveItem|RemoveListItem|RemoveObject|Remove|' | |||
| + r'Render|Requery|RequestData|ResetToDefault|Reset|Run|' | |||
| + r'SaveAsClass|SaveAs|SetAll|SetData|SetFocus|SetFormat|' | |||
| + r'SetMain|SetVar|SetViewPort|ShowWhatsThis|Show|' | |||
| + r'SupportsListenerType|TextHeight|TextWidth|ToCursor|' | |||
| + r'ToXML|UndoCheckOut|Unnest|UpdateStatus|WhatsThisMode|' | |||
| + r'WriteExpression|WriteMethod|ZOrder)', Name.Function), | |||
| + | |||
| + (r'\.(Activate|AdjustObjectSize|AfterBand|AfterBuild|' | |||
| + r'AfterCloseTables|AfterCursorAttach|AfterCursorClose|' | |||
| + r'AfterCursorDetach|AfterCursorFill|AfterCursorRefresh|' | |||
| + r'AfterCursorUpdate|AfterDelete|AfterInsert|' | |||
| + r'AfterRecordRefresh|AfterUpdate|AfterDock|AfterReport|' | |||
| + r'AfterRowColChange|BeforeBand|BeforeCursorAttach|' | |||
| + r'BeforeCursorClose|BeforeCursorDetach|BeforeCursorFill|' | |||
| + r'BeforeCursorRefresh|BeforeCursorUpdate|BeforeDelete|' | |||
| + r'BeforeInsert|BeforeDock|BeforeOpenTables|' | |||
| + r'BeforeRecordRefresh|BeforeReport|BeforeRowColChange|' | |||
| + r'BeforeUpdate|Click|dbc_Activate|dbc_AfterAddTable|' | |||
| + r'dbc_AfterAppendProc|dbc_AfterCloseTable|dbc_AfterCopyProc|' | |||
| + r'dbc_AfterCreateConnection|dbc_AfterCreateOffline|' | |||
| + r'dbc_AfterCreateTable|dbc_AfterCreateView|dbc_AfterDBGetProp|' | |||
| + r'dbc_AfterDBSetProp|dbc_AfterDeleteConnection|' | |||
| + r'dbc_AfterDropOffline|dbc_AfterDropTable|' | |||
| + r'dbc_AfterModifyConnection|dbc_AfterModifyProc|' | |||
| + r'dbc_AfterModifyTable|dbc_AfterModifyView|dbc_AfterOpenTable|' | |||
| + r'dbc_AfterRemoveTable|dbc_AfterRenameConnection|' | |||
| + r'dbc_AfterRenameTable|dbc_AfterRenameView|' | |||
| + r'dbc_AfterValidateData|dbc_BeforeAddTable|' | |||
| + r'dbc_BeforeAppendProc|dbc_BeforeCloseTable|' | |||
| + r'dbc_BeforeCopyProc|dbc_BeforeCreateConnection|' | |||
| + r'dbc_BeforeCreateOffline|dbc_BeforeCreateTable|' | |||
| + r'dbc_BeforeCreateView|dbc_BeforeDBGetProp|' | |||
| + r'dbc_BeforeDBSetProp|dbc_BeforeDeleteConnection|' | |||
| + r'dbc_BeforeDropOffline|dbc_BeforeDropTable|' | |||
| + r'dbc_BeforeModifyConnection|dbc_BeforeModifyProc|' | |||
| + r'dbc_BeforeModifyTable|dbc_BeforeModifyView|' | |||
| + r'dbc_BeforeOpenTable|dbc_BeforeRemoveTable|' | |||
| + r'dbc_BeforeRenameConnection|dbc_BeforeRenameTable|' | |||
| + r'dbc_BeforeRenameView|dbc_BeforeValidateData|' | |||
| + r'dbc_CloseData|dbc_Deactivate|dbc_ModifyData|dbc_OpenData|' | |||
| + r'dbc_PackData|DblClick|Deactivate|Deleted|Destroy|DoCmd|' | |||
| + r'DownClick|DragDrop|DragOver|DropDown|ErrorMessage|Error|' | |||
| + r'EvaluateContents|GotFocus|Init|InteractiveChange|KeyPress|' | |||
| + r'LoadReport|Load|LostFocus|Message|MiddleClick|MouseDown|' | |||
| + r'MouseEnter|MouseLeave|MouseMove|MouseUp|MouseWheel|Moved|' | |||
| + r'OLECompleteDrag|OLEDragOver|OLEGiveFeedback|OLESetData|' | |||
| + r'OLEStartDrag|OnMoveItem|Paint|ProgrammaticChange|' | |||
| + r'QueryAddFile|QueryModifyFile|QueryNewFile|QueryRemoveFile|' | |||
| + r'QueryRunFile|QueryUnload|RangeHigh|RangeLow|ReadActivate|' | |||
| + r'ReadDeactivate|ReadShow|ReadValid|ReadWhen|Resize|' | |||
| + r'RightClick|SCCInit|SCCDestroy|Scrolled|Timer|UIEnable|' | |||
| + r'UnDock|UnloadReport|Unload|UpClick|Valid|When)', Name.Function), | |||
| + | |||
| + (r'\s+', Text), | |||
| + # everything else is not colored | |||
| + (r'.', Text), | |||
| + ], | |||
| + 'newline': [ | |||
| + (r'\*.*?$', Comment.Single, '#pop'), | |||
| + (r'(ACCEPT|ACTIVATE\s*MENU|ACTIVATE\s*POPUP|ACTIVATE\s*SCREEN|' | |||
| + r'ACTIVATE\s*WINDOW|APPEND|APPEND\s*FROM|APPEND\s*FROM\s*ARRAY|' | |||
| + r'APPEND\s*GENERAL|APPEND\s*MEMO|ASSIST|AVERAGE|BLANK|BROWSE|' | |||
| + r'BUILD\s*APP|BUILD\s*EXE|BUILD\s*PROJECT|CALCULATE|CALL|' | |||
| + r'CANCEL|CHANGE|CLEAR|CLOSE|CLOSE\s*MEMO|COMPILE|CONTINUE|' | |||
| + r'COPY\s*FILE|COPY\s*INDEXES|COPY\s*MEMO|COPY\s*STRUCTURE|' | |||
| + r'COPY\s*STRUCTURE\s*EXTENDED|COPY\s*TAG|COPY\s*TO|' | |||
| + r'COPY\s*TO\s*ARRAY|COUNT|CREATE|CREATE\s*COLOR\s*SET|' | |||
| + r'CREATE\s*CURSOR|CREATE\s*FROM|CREATE\s*LABEL|CREATE\s*MENU|' | |||
| + r'CREATE\s*PROJECT|CREATE\s*QUERY|CREATE\s*REPORT|' | |||
| + r'CREATE\s*SCREEN|CREATE\s*TABLE|CREATE\s*VIEW|DDE|' | |||
| + r'DEACTIVATE\s*MENU|DEACTIVATE\s*POPUP|DEACTIVATE\s*WINDOW|' | |||
| + r'DECLARE|DEFINE\s*BAR|DEFINE\s*BOX|DEFINE\s*MENU|' | |||
| + r'DEFINE\s*PAD|DEFINE\s*POPUP|DEFINE\s*WINDOW|DELETE|' | |||
| + r'DELETE\s*FILE|DELETE\s*TAG|DIMENSION|DIRECTORY|DISPLAY|' | |||
| + r'DISPLAY\s*FILES|DISPLAY\s*MEMORY|DISPLAY\s*STATUS|' | |||
| + r'DISPLAY\s*STRUCTURE|DO|EDIT|EJECT|EJECT\s*PAGE|ERASE|' | |||
| + r'EXIT|EXPORT|EXTERNAL|FILER|FIND|FLUSH|FUNCTION|GATHER|' | |||
| + r'GETEXPR|GO|GOTO|HELP|HIDE\s*MENU|HIDE\s*POPUP|' | |||
| + r'HIDE\s*WINDOW|IMPORT|INDEX|INPUT|INSERT|JOIN|KEYBOARD|' | |||
| + r'LABEL|LIST|LOAD|LOCATE|LOOP|MENU|MENU\s*TO|MODIFY\s*COMMAND|' | |||
| + r'MODIFY\s*FILE|MODIFY\s*GENERAL|MODIFY\s*LABEL|MODIFY\s*MEMO|' | |||
| + r'MODIFY\s*MENU|MODIFY\s*PROJECT|MODIFY\s*QUERY|' | |||
| + r'MODIFY\s*REPORT|MODIFY\s*SCREEN|MODIFY\s*STRUCTURE|' | |||
| + r'MODIFY\s*WINDOW|MOVE\s*POPUP|MOVE\s*WINDOW|NOTE|' | |||
| + r'ON\s*APLABOUT|ON\s*BAR|ON\s*ERROR|ON\s*ESCAPE|' | |||
| + r'ON\s*EXIT\s*BAR|ON\s*EXIT\s*MENU|ON\s*EXIT\s*PAD|' | |||
| + r'ON\s*EXIT\s*POPUP|ON\s*KEY|ON\s*KEY\s*=|ON\s*KEY\s*LABEL|' | |||
| + r'ON\s*MACHELP|ON\s*PAD|ON\s*PAGE|ON\s*READERROR|' | |||
| + r'ON\s*SELECTION\s*BAR|ON\s*SELECTION\s*MENU|' | |||
| + r'ON\s*SELECTION\s*PAD|ON\s*SELECTION\s*POPUP|ON\s*SHUTDOWN|' | |||
| + r'PACK|PARAMETERS|PLAY\s*MACRO|POP\s*KEY|POP\s*MENU|' | |||
| + r'POP\s*POPUP|PRIVATE|PROCEDURE|PUBLIC|PUSH\s*KEY|' | |||
| + r'PUSH\s*MENU|PUSH\s*POPUP|QUIT|READ|READ\s*MENU|RECALL|' | |||
| + r'REINDEX|RELEASE|RELEASE\s*MODULE|RENAME|REPLACE|' | |||
| + r'REPLACE\s*FROM\s*ARRAY|REPORT|RESTORE\s*FROM|' | |||
| + r'RESTORE\s*MACROS|RESTORE\s*SCREEN|RESTORE\s*WINDOW|' | |||
| + r'RESUME|RETRY|RETURN|RUN|RUN\s*\/N"|RUNSCRIPT|' | |||
| + r'SAVE\s*MACROS|SAVE\s*SCREEN|SAVE\s*TO|SAVE\s*WINDOWS|' | |||
| + r'SCATTER|SCROLL|SEEK|SELECT|SET|SET\s*ALTERNATE|' | |||
| + r'SET\s*ANSI|SET\s*APLABOUT|SET\s*AUTOSAVE|SET\s*BELL|' | |||
| + r'SET\s*BLINK|SET\s*BLOCKSIZE|SET\s*BORDER|SET\s*BRSTATUS|' | |||
| + r'SET\s*CARRY|SET\s*CENTURY|SET\s*CLEAR|SET\s*CLOCK|' | |||
| + r'SET\s*COLLATE|SET\s*COLOR\s*OF|SET\s*COLOR\s*OF\s*SCHEME|' | |||
| + r'SET\s*COLOR\s*SET|SET\s*COLOR\s*TO|SET\s*COMPATIBLE|' | |||
| + r'SET\s*CONFIRM|SET\s*CONSOLE|SET\s*CURRENCY|SET\s*CURSOR|' | |||
| + r'SET\s*DATE|SET\s*DEBUG|SET\s*DECIMALS|SET\s*DEFAULT|' | |||
| + r'SET\s*DELETED|SET\s*DELIMITERS|SET\s*DEVELOPMENT|' | |||
| + r'SET\s*DEVICE|SET\s*DISPLAY|SET\s*DOHISTORY|SET\s*ECHO|' | |||
| + r'SET\s*ESCAPE|SET\s*EXACT|SET\s*EXCLUSIVE|SET\s*FIELDS|' | |||
| + r'SET\s*FILTER|SET\s*FIXED|SET\s*FORMAT|SET\s*FULLPATH|' | |||
| + r'SET\s*FUNCTION|SET\s*HEADINGS|SET\s*HELP|SET\s*HELPFILTER|' | |||
| + r'SET\s*HOURS|SET\s*INDEX|SET\s*INTENSITY|SET\s*KEY|' | |||
| + r'SET\s*KEYCOMP|SET\s*LIBRARY|SET\s*LOCK|SET\s*LOGERRORS|' | |||
| + r'SET\s*MACDESKTOP|SET\s*MACHELP|SET\s*MACKEY|SET\s*MARGIN|' | |||
| + r'SET\s*MARK\s*OF|SET\s*MARK\s*TO|SET\s*MEMOWIDTH|' | |||
| + r'SET\s*MESSAGE|SET\s*MOUSE|SET\s*MULTILOCKS|SET\s*NEAR|' | |||
| + r'SET\s*NOCPTRANS|SET\s*NOTIFY|SET\s*ODOMETER|SET\s*OPTIMIZE|' | |||
| + r'SET\s*ORDER|SET\s*PALETTE|SET\s*PATH|SET\s*PDSETUP|' | |||
| + r'SET\s*POINT|SET\s*PRINTER|SET\s*PROCEDURE|SET\s*READBORDER|' | |||
| + r'SET\s*REFRESH|SET\s*RELATION|SET\s*RELATION\s*OFF|' | |||
| + r'SET\s*REPROCESS|SET\s*RESOURCE|SET\s*SAFETY|SET\s*SCOREBOARD|' | |||
| + r'SET\s*SEPARATOR|SET\s*SHADOWS|SET\s*SKIP|SET\s*SKIP\s*OF|' | |||
| + r'SET\s*SPACE|SET\s*STATUS|SET\s*STATUS\s*BAR|SET\s*STEP|' | |||
| + r'SET\s*STICKY|SET\s*SYSMENU|SET\s*TALK|SET\s*TEXTMERGE|' | |||
| + r'SET\s*TEXTMERGE\s*DELIMITERS|SET\s*TOPIC|SET\s*TRBETWEEN|' | |||
| + r'SET\s*TYPEAHEAD|SET\s*UDFPARMS|SET\s*UNIQUE|SET\s*VIEW|' | |||
| + r'SET\s*VOLUME|SET\s*WINDOW\s*OF\s*MEMO|SET\s*XCMDFILE|' | |||
| + r'SHOW\s*GET|SHOW\s*GETS|SHOW\s*MENU|SHOW\s*OBJECT|' | |||
| + r'SHOW\s*POPUP|SHOW\s*WINDOW|SIZE\s*POPUP|SKIP|SORT|' | |||
| + r'STORE|SUM|SUSPEND|TOTAL|TYPE|UNLOCK|UPDATE|USE|WAIT|' | |||
| + r'ZAP|ZOOM\s*WINDOW|DO\s*CASE|CASE|OTHERWISE|ENDCASE|' | |||
| + r'DO\s*WHILE|ENDDO|FOR|ENDFOR|NEXT|IF|ELSE|ENDIF|PRINTJOB|' | |||
| + r'ENDPRINTJOB|SCAN|ENDSCAN|TEXT|ENDTEXT|=)', | |||
| + Keyword.Reserved, '#pop'), | |||
| + (r'#\s*(IF|ELIF|ELSE|ENDIF|DEFINE|IFDEF|IFNDEF|INCLUDE)', | |||
| + Comment.Preproc, '#pop'), | |||
| + (r'(m\.)?[a-z_]\w*', Name.Variable, '#pop'), | |||
| + (r'.', Text, '#pop'), | |||
| + ], | |||
| + } | |||
14
vendor/pygments/pygments/lexers/functional.py
6
vendor/pygments/pygments/lexers/hdl.py
170
vendor/pygments/pygments/lexers/jvm.py
293
vendor/pygments/pygments/lexers/math.py
533
vendor/pygments/pygments/lexers/other.py
87
vendor/pygments/pygments/lexers/parsers.py
50
vendor/pygments/pygments/lexers/shell.py
2
vendor/pygments/pygments/lexers/special.py
2
vendor/pygments/pygments/lexers/sql.py
21
vendor/pygments/pygments/lexers/templates.py
96
vendor/pygments/pygments/lexers/text.py
315
vendor/pygments/pygments/lexers/web.py
2
vendor/pygments/pygments/plugin.py
2
vendor/pygments/pygments/scanner.py
2
vendor/pygments/pygments/style.py
2
vendor/pygments/pygments/styles/__init__.py
2
vendor/pygments/pygments/styles/autumn.py
2
vendor/pygments/pygments/styles/borland.py
2
vendor/pygments/pygments/styles/bw.py
2
vendor/pygments/pygments/styles/colorful.py
2
vendor/pygments/pygments/styles/default.py
2
vendor/pygments/pygments/styles/emacs.py
2
vendor/pygments/pygments/styles/friendly.py
2
vendor/pygments/pygments/styles/fruity.py
2
vendor/pygments/pygments/styles/manni.py
2
vendor/pygments/pygments/styles/monokai.py
2
vendor/pygments/pygments/styles/murphy.py
2
vendor/pygments/pygments/styles/native.py
2
vendor/pygments/pygments/styles/pastie.py
2
vendor/pygments/pygments/styles/perldoc.py
2
vendor/pygments/pygments/styles/rrt.py
2
vendor/pygments/pygments/styles/tango.py
2
vendor/pygments/pygments/styles/trac.py
2
vendor/pygments/pygments/styles/vim.py
2
vendor/pygments/pygments/styles/vs.py
2
vendor/pygments/pygments/token.py
2
vendor/pygments/pygments/unistring.py
2
vendor/pygments/pygments/util.py
4
vendor/pygments/scripts/check_sources.py
2
vendor/pygments/scripts/detect_missing_analyse_text.py
2
vendor/pygments/scripts/find_codetags.py
11
vendor/pygments/scripts/find_error.py
6
vendor/pygments/setup.cfg
| @@ -1,6 +1,8 @@ | |||
| [egg_info] | [egg_info] | ||
| -tag_build = dev | +tag_build = | ||
| -tag_date = true | +tag_date = 0 | ||
| +tag_svn_revision = 0 | |||
| [aliases] | [aliases] | ||
| release = egg_info -RDb '' | release = egg_info -RDb '' | ||
| + | |||
10
vendor/pygments/setup.py
1
vendor/pygments/tests/examplefiles/BOM.js
| @@ -0,0 +1 @@ | |||
| +/* There is a BOM at the beginning of this file. */ | |||
25
vendor/pygments/tests/examplefiles/autoit_submit.au3
| @@ -0,0 +1,25 @@ | |||
| +#include <IE.au3> | |||
| +;http://msdn.microsoft.com/en-us/library/Aa752084.aspx | |||
| +$ourl="http://localhost:5000/" | |||
| + | |||
| +$oIE = _IEAttach ($ourl,"url") | |||
| +If @error = $_IEStatus_NoMatch Then | |||
| + $oIE = _IECreate ($ourl & "sample.html") | |||
| +endIf | |||
| + | |||
| +$oForm = _IEFormGetObjByName ($oIE, "form1") | |||
| +;username, call DOM directly | |||
| +$oIE.document.getElementById("username").value="helloAutoIT" | |||
| +;state select | |||
| +$oSelect = _IEFormElementGetObjByName ($oForm, "state") | |||
| +_IEFormElementOptionSelect ($oSelect, "S2", 1, "byText") | |||
| +;options raido | |||
| +_IEFormElementRadioSelect($oForm, "2nd", "type", 1, "byValue") | |||
| + | |||
| +ConsoleWrite(@Error) | |||
| +Sleep(10000) | |||
| +_IEFormSubmit($oForm, 0) | |||
| +_IELoadWait($oIE) | |||
| +Sleep(60000) | |||
| +_IEQuit($oIE) | |||
| + | |||
308
vendor/pygments/tests/examplefiles/bigtest.nsi
| @@ -0,0 +1,308 @@ | |||
| +; bigtest.nsi | |||
| +; | |||
| +; This script attempts to test most of the functionality of the NSIS exehead. | |||
| + | |||
| +;-------------------------------- | |||
| + | |||
| +!ifdef HAVE_UPX | |||
| +!packhdr tmp.dat "upx\upx -9 tmp.dat" | |||
| +!endif | |||
| + | |||
| +!ifdef NOCOMPRESS | |||
| +SetCompress off | |||
| +!endif | |||
| + | |||
| +;-------------------------------- | |||
| + | |||
| +Name "BigNSISTest" | |||
| +Caption "NSIS Big Test" | |||
| +Icon "${NSISDIR}\Contrib\Graphics\Icons\nsis1-install.ico" | |||
| +OutFile "bigtest.exe" | |||
| + | |||
| +SetDateSave on | |||
| +SetDatablockOptimize on | |||
| +CRCCheck on | |||
| +SilentInstall normal | |||
| +BGGradient 000000 800000 FFFFFF | |||
| +InstallColors FF8080 000030 | |||
| +XPStyle on | |||
| + | |||
| +InstallDir "$PROGRAMFILES\NSISTest\BigNSISTest" | |||
| +InstallDirRegKey HKLM "Software\NSISTest\BigNSISTest" "Install_Dir" | |||
| + | |||
| +CheckBitmap "${NSISDIR}\Contrib\Graphics\Checks\classic-cross.bmp" | |||
| + | |||
| +LicenseText "A test text, make sure it's all there" | |||
| +LicenseData "bigtest.nsi" | |||
| + | |||
| +RequestExecutionLevel admin | |||
| + | |||
| +;-------------------------------- | |||
| + | |||
| +Page license | |||
| +Page components | |||
| +Page directory | |||
| +Page instfiles | |||
| + | |||
| +UninstPage uninstConfirm | |||
| +UninstPage instfiles | |||
| + | |||
| +;-------------------------------- | |||
| + | |||
| +!ifndef NOINSTTYPES ; only if not defined | |||
| + InstType "Most" | |||
| + InstType "Full" | |||
| + InstType "More" | |||
| + InstType "Base" | |||
| + ;InstType /NOCUSTOM | |||
| + ;InstType /COMPONENTSONLYONCUSTOM | |||
| +!endif | |||
| + | |||
| +AutoCloseWindow false | |||
| +ShowInstDetails show | |||
| + | |||
| +;-------------------------------- | |||
| + | |||
| +Section "" ; empty string makes it hidden, so would starting with - | |||
| + | |||
| + ; write reg info | |||
| + StrCpy $1 "POOOOOOOOOOOP" | |||
| + DetailPrint "I like to be able to see what is going on (debug) $1" | |||
| + WriteRegStr HKLM SOFTWARE\NSISTest\BigNSISTest "Install_Dir" "$INSTDIR" | |||
| + | |||
| + ; write uninstall strings | |||
| + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest" "DisplayName" "BigNSISTest (remove only)" | |||
| + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest" "UninstallString" '"$INSTDIR\bt-uninst.exe"' | |||
| + | |||
| + SetOutPath $INSTDIR | |||
| + File /a "silent.nsi" | |||
| + CreateDirectory "$INSTDIR\MyProjectFamily\MyProject" ; 2 recursively create a directory for fun. | |||
| + WriteUninstaller "bt-uninst.exe" | |||
| + | |||
| + Nop ; for fun | |||
| + | |||
| +SectionEnd | |||
| + | |||
| +Section "TempTest" | |||
| + | |||
| +SectionIn 1 2 3 | |||
| + Start: MessageBox MB_OK "Start:" | |||
| + | |||
| + MessageBox MB_YESNO "Goto MyLabel" IDYES MyLabel | |||
| + | |||
| + MessageBox MB_OK "Right before MyLabel:" | |||
| + | |||
| + MyLabel: MessageBox MB_OK "MyLabel:" | |||
| + | |||
| + MessageBox MB_OK "Right after MyLabel:" | |||
| + | |||
| + MessageBox MB_YESNO "Goto Start:?" IDYES Start | |||
| + | |||
| +SectionEnd | |||
| + | |||
| +SectionGroup /e SectionGroup1 | |||
| + | |||
| +Section "Test Registry/INI functions" | |||
| + | |||
| +SectionIn 1 4 3 | |||
| + | |||
| + WriteRegStr HKLM SOFTWARE\NSISTest\BigNSISTest "StrTest_INSTDIR" "$INSTDIR" | |||
| + WriteRegDword HKLM SOFTWARE\NSISTest\BigNSISTest "DwordTest_0xDEADBEEF" 0xdeadbeef | |||
| + WriteRegDword HKLM SOFTWARE\NSISTest\BigNSISTest "DwordTest_123456" 123456 | |||
| + WriteRegDword HKLM SOFTWARE\NSISTest\BigNSISTest "DwordTest_0123" 0123 | |||
| + WriteRegBin HKLM SOFTWARE\NSISTest\BigNSISTest "BinTest_deadbeef01f00dbeef" "DEADBEEF01F00DBEEF" | |||
| + StrCpy $8 "$SYSDIR\IniTest" | |||
| + WriteINIStr "$INSTDIR\test.ini" "MySection" "Value1" $8 | |||
| + WriteINIStr "$INSTDIR\test.ini" "MySectionIni" "Value1" $8 | |||
| + WriteINIStr "$INSTDIR\test.ini" "MySectionIni" "Value2" $8 | |||
| + WriteINIStr "$INSTDIR\test.ini" "IniOn" "Value1" $8 | |||
| + | |||
| + Call MyFunctionTest | |||
| + | |||
| + DeleteINIStr "$INSTDIR\test.ini" "IniOn" "Value1" | |||
| + DeleteINISec "$INSTDIR\test.ini" "MySectionIni" | |||
| + | |||
| + ReadINIStr $1 "$INSTDIR\test.ini" "MySectionIni" "Value1" | |||
| + StrCmp $1 "" INIDelSuccess | |||
| + MessageBox MB_OK "DeleteINISec failed" | |||
| + INIDelSuccess: | |||
| + | |||
| + ClearErrors | |||
| + ReadRegStr $1 HKCR "software\microsoft" xyz_cc_does_not_exist | |||
| + IfErrors 0 NoError | |||
| + MessageBox MB_OK "could not read from HKCR\software\microsoft\xyz_cc_does_not_exist" | |||
| + Goto ErrorYay | |||
| + NoError: | |||
| + MessageBox MB_OK "read '$1' from HKCR\software\microsoft\xyz_cc_does_not_exist" | |||
| + ErrorYay: | |||
| + | |||
| +SectionEnd | |||
| + | |||
| +Section "Test CreateShortCut" | |||
| + | |||
| + SectionIn 1 2 3 | |||
| + | |||
| + Call CSCTest | |||
| + | |||
| +SectionEnd | |||
| + | |||
| +SectionGroup Group2 | |||
| + | |||
| +Section "Test Branching" | |||
| + | |||
| + BeginTestSection: | |||
| + SectionIn 1 2 3 | |||
| + | |||
| + SetOutPath $INSTDIR | |||
| + | |||
| + IfFileExists "$INSTDIR\LogicLib.nsi" 0 BranchTest69 | |||
| + | |||
| + MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to overwrite $INSTDIR\LogicLib.nsi?" IDNO NoOverwrite ; skipped if file doesn't exist | |||
| + | |||
| + BranchTest69: | |||
| + | |||
| + SetOverwrite ifnewer ; NOT AN INSTRUCTION, NOT COUNTED IN SKIPPINGS | |||
| + | |||
| + NoOverwrite: | |||
| + | |||
| + File "LogicLib.nsi" ; skipped if answered no | |||
| + SetOverwrite try ; NOT AN INSTRUCTION, NOT COUNTED IN SKIPPINGS | |||
| + | |||
| + MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to skip the rest of this section?" IDYES EndTestBranch | |||
| + MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to go back to the beginning of this section?" IDYES BeginTestSection | |||
| + MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to hide the installer and wait five seconds?" IDNO NoHide | |||
| + | |||
| + HideWindow | |||
| + Sleep 5000 | |||
| + BringToFront | |||
| + | |||
| + NoHide: | |||
| + | |||
| + MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to call the function 5 times?" IDNO NoRecurse | |||
| + | |||
| + StrCpy $1 "x" | |||
| + | |||
| + LoopTest: | |||
| + | |||
| + Call myfunc | |||
| + StrCpy $1 "x$1" | |||
| + StrCmp $1 "xxxxxx" 0 LoopTest | |||
| + | |||
| + NoRecurse: | |||
| + | |||
| + EndTestBranch: | |||
| + | |||
| +SectionEnd | |||
| + | |||
| +SectionGroupEnd | |||
| + | |||
| +Section "Test CopyFiles" | |||
| + | |||
| + SectionIn 1 2 3 | |||
| + | |||
| + SetOutPath $INSTDIR\cpdest | |||
| + CopyFiles "$WINDIR\*.ini" "$INSTDIR\cpdest" 0 | |||
| + | |||
| +SectionEnd | |||
| + | |||
| +SectionGroupEnd | |||
| + | |||
| +Section "Test Exec functions" TESTIDX | |||
| + | |||
| + SectionIn 1 2 3 | |||
| + | |||
| + SearchPath $1 notepad.exe | |||
| + | |||
| + MessageBox MB_OK "notepad.exe=$1" | |||
| + Exec '"$1"' | |||
| + ExecShell "open" '"$INSTDIR"' | |||
| + Sleep 500 | |||
| + BringToFront | |||
| + | |||
| +SectionEnd | |||
| + | |||
| +Section "Test ActiveX control registration" | |||
| + | |||
| + SectionIn 2 | |||
| + | |||
| + UnRegDLL "$SYSDIR\spin32.ocx" | |||
| + Sleep 1000 | |||
| + RegDLL "$SYSDIR\spin32.ocx" | |||
| + Sleep 1000 | |||
| + | |||
| +SectionEnd | |||
| + | |||
| +;-------------------------------- | |||
| + | |||
| +Function "CSCTest" | |||
| + | |||
| + CreateDirectory "$SMPROGRAMS\Big NSIS Test" | |||
| + SetOutPath $INSTDIR ; for working directory | |||
| + CreateShortCut "$SMPROGRAMS\Big NSIS Test\Uninstall BIG NSIS Test.lnk" "$INSTDIR\bt-uninst.exe" ; use defaults for parameters, icon, etc. | |||
| + ; this one will use notepad's icon, start it minimized, and give it a hotkey (of Ctrl+Shift+Q) | |||
| + CreateShortCut "$SMPROGRAMS\Big NSIS Test\silent.nsi.lnk" "$INSTDIR\silent.nsi" "" "$WINDIR\notepad.exe" 0 SW_SHOWMINIMIZED CONTROL|SHIFT|Q | |||
| + CreateShortCut "$SMPROGRAMS\Big NSIS Test\TheDir.lnk" "$INSTDIR\" "" "" 0 SW_SHOWMAXIMIZED CONTROL|SHIFT|Z | |||
| + | |||
| +FunctionEnd | |||
| + | |||
| +Function myfunc | |||
| + | |||
| + StrCpy $2 "MyTestVar=$1" | |||
| + MessageBox MB_OK "myfunc: $2" | |||
| + | |||
| +FunctionEnd | |||
| + | |||
| +Function MyFunctionTest | |||
| + | |||
| + ReadINIStr $1 "$INSTDIR\test.ini" "MySectionIni" "Value1" | |||
| + StrCmp $1 $8 NoFailedMsg | |||
| + MessageBox MB_OK "WriteINIStr failed" | |||
| + | |||
| + NoFailedMsg: | |||
| + | |||
| +FunctionEnd | |||
| + | |||
| +Function .onSelChange | |||
| + | |||
| + SectionGetText ${TESTIDX} $0 | |||
| + StrCmp $0 "" e | |||
| + SectionSetText ${TESTIDX} "" | |||
| + Goto e2 | |||
| +e: | |||
| + SectionSetText ${TESTIDX} "TextInSection" | |||
| +e2: | |||
| + | |||
| +FunctionEnd | |||
| + | |||
| +;-------------------------------- | |||
| + | |||
| +; Uninstaller | |||
| + | |||
| +UninstallText "This will uninstall example2. Hit next to continue." | |||
| +UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\nsis1-uninstall.ico" | |||
| + | |||
| +Section "Uninstall" | |||
| + | |||
| + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest" | |||
| + DeleteRegKey HKLM "SOFTWARE\NSISTest\BigNSISTest" | |||
| + Delete "$INSTDIR\silent.nsi" | |||
| + Delete "$INSTDIR\LogicLib.nsi" | |||
| + Delete "$INSTDIR\bt-uninst.exe" | |||
| + Delete "$INSTDIR\test.ini" | |||
| + Delete "$SMPROGRAMS\Big NSIS Test\*.*" | |||
| + RMDir "$SMPROGRAMS\BiG NSIS Test" | |||
| + | |||
| + MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to remove the directory $INSTDIR\cpdest?" IDNO NoDelete | |||
| + Delete "$INSTDIR\cpdest\*.*" | |||
| + RMDir "$INSTDIR\cpdest" ; skipped if no | |||
| + NoDelete: | |||
| + | |||
| + RMDir "$INSTDIR\MyProjectFamily\MyProject" | |||
| + RMDir "$INSTDIR\MyProjectFamily" | |||
| + RMDir "$INSTDIR" | |||
| + | |||
| + IfFileExists "$INSTDIR" 0 NoErrorMsg | |||
| + MessageBox MB_OK "Note: $INSTDIR could not be removed!" IDOK 0 ; skipped if file doesn't exist | |||
| + NoErrorMsg: | |||
| + | |||
| +SectionEnd | |||
284
vendor/pygments/tests/examplefiles/ca65_example
| @@ -0,0 +1,284 @@ | |||
| +;-------------------------------------- | |||
| +; Lychrel numbers. | |||
| +; | |||
| +; :author: Marc 'BlackJack' Rintsch | |||
| +; :date: 2008-03-07 | |||
| +; :version: 0.1 | |||
| +; | |||
| +; Prints all `Lychrel numbers`_ between 1 and 100000. | |||
| +; | |||
| +; The numbers are stored as array of "digits" in little endian | |||
| +; order. Each digit is a byte with a value between 0 and 9. | |||
| +; | |||
| +; Runtime on C64: 00:21:01 | |||
| +; | |||
| +; .. _Lychrel numbers: http://en.wikipedia.org/wiki/Lychrel_number | |||
| +; | |||
| +; .. cl65 -l -tnone -C simple.cfg lychrel.s -o lychrel.prg | |||
| +;-------------------------------------- | |||
| + | |||
| +;-------------------------------------- | |||
| +; External addresses. | |||
| +;-------------------------------------- | |||
| + chrout = $ffd2 | |||
| + | |||
| +;-------------------------------------- | |||
| +; Constants. | |||
| +;-------------------------------------- | |||
| + TO = 100000 | |||
| + TO_DIGITS = 10 | |||
| + ITERATIONS = 100 | |||
| + MAX_DIGITS = TO_DIGITS + ITERATIONS | |||
| + | |||
| +;-------------------------------------- | |||
| +; Global variables. | |||
| +;-------------------------------------- | |||
| +.zeropage | |||
| +; | |||
| +; Length of the currently tested `n` in digits. | |||
| +; | |||
| +n_length: | |||
| + .res 1 | |||
| +; | |||
| +; Length of the number(s) `xa` and `xb` while testing. | |||
| +; | |||
| +length: | |||
| + .res 1 | |||
| + | |||
| +.bss | |||
| +; | |||
| +; Number to be tested as digits i.e. bytes with values between | |||
| +; 0 and 9. The length is stored in `n_length`. | |||
| +; | |||
| +n: | |||
| + .res TO_DIGITS | |||
| +; | |||
| +; Space for calculating the reversed and added values. | |||
| +; In the `main` code the current number is copied into `xa` | |||
| +; and then repeatedly `reverse_add`\ed to itself with the | |||
| +; result of that adding stored in `xb`. | |||
| +; | |||
| +xa: | |||
| + .res MAX_DIGITS | |||
| +xb: | |||
| + .res MAX_DIGITS | |||
| + | |||
| +;-------------------------------------- | |||
| +; BASIC header. | |||
| +;-------------------------------------- | |||
| +.code | |||
| + .word 0800h ; Load address. | |||
| + .byte 0 | |||
| + .word @line_end | |||
| + .word 2008 ; Line number. | |||
| + .byte $9e ; SYS token. | |||
| + .byte "2080 " ; SYS argument. | |||
| + .byte "LYCHREL NUMBERS/BJ" | |||
| +@line_end: | |||
| + .byte 0, 0, 0 ; Line and program end marker. | |||
| + | |||
| +;-------------------------------------- | |||
| +; Main program. | |||
| +;-------------------------------------- | |||
| +.proc main | |||
| + | |||
| +.zeropage | |||
| +; | |||
| +; Three byte counter for `TO` iterations (100000 = $0186a0). | |||
| +; | |||
| +i: | |||
| + .res 3 | |||
| + | |||
| +.code | |||
| +; | |||
| +; Clear and set `n` and `i` to 1. | |||
| +; | |||
| + lda #0 ; n := 0; n := 1; i := 1 | |||
| + sta i+1 | |||
| + sta i+2 | |||
| + ldx #TO_DIGITS | |||
| +clear_n: | |||
| + sta n-1,x | |||
| + dex | |||
| + bne clear_n | |||
| + inx | |||
| + stx i | |||
| + stx n | |||
| + stx n_length | |||
| + | |||
| +mainloop: | |||
| + jsr is_lychrel | |||
| + bcc no_lychrel | |||
| + jsr print_n | |||
| +no_lychrel: | |||
| + jsr increase_n | |||
| + | |||
| + inc i ; INC(i) | |||
| + bne skip | |||
| + inc i+1 | |||
| + bne skip | |||
| + inc i+2 | |||
| +skip: | |||
| + lda i | |||
| + cmp #<TO | |||
| + bne mainloop | |||
| + lda i+1 | |||
| + cmp #>TO | |||
| + bne mainloop | |||
| + lda i+2 | |||
| + cmp #^TO | |||
| + bne mainloop | |||
| + | |||
| + rts | |||
| +.endproc | |||
| + | |||
| +;-------------------------------------- | |||
| +; Print `n` and a trailing newline. | |||
| +; | |||
| +; :in: `n_length`, `n` | |||
| +;-------------------------------------- | |||
| +.proc print_n | |||
| + ldy n_length | |||
| +L1: | |||
| + lda n-1,y | |||
| + ora #%110000 ; = '0' | |||
| + jsr chrout | |||
| + dey | |||
| + bne L1 | |||
| + | |||
| + lda #13 | |||
| + jmp chrout | |||
| +.endproc | |||
| + | |||
| +;-------------------------------------- | |||
| +; Increase `n` by one. | |||
| +; | |||
| +; This procedure expects n[n_length] == 0 in case the number gets | |||
| +; one digit longer. | |||
| +; | |||
| +; :in: `n`, `n_length` | |||
| +; :out: `n`, `n_length` | |||
| +;-------------------------------------- | |||
| +.proc increase_n | |||
| + ldx #0 | |||
| +L1: | |||
| + inc n,x ; Increase digit. | |||
| + lda n,x | |||
| + cmp #10 ; If "carry", store 0 and go to next digit. | |||
| + bne return | |||
| + lda #0 | |||
| + sta n,x | |||
| + inx | |||
| + bne L1 | |||
| +return: | |||
| + cpx n_length ; If "carry" after last digit, increase length. | |||
| + bcc skip | |||
| + inc n_length | |||
| +skip: | |||
| + rts | |||
| +.endproc | |||
| + | |||
| +;-------------------------------------- | |||
| +; Tests if `n` is a Lychrel number. | |||
| +; | |||
| +; :in: `n`, `n_length` | |||
| +; :out: C is set if yes, cleared otherwise. | |||
| +; :uses: `length`, `xa`, `xb` | |||
| +;-------------------------------------- | |||
| +.proc is_lychrel | |||
| +.zeropage | |||
| +i: | |||
| + .res 1 | |||
| + | |||
| +.code | |||
| + ldx n_length ; xa := n; length := n_length | |||
| + stx length | |||
| +L1: | |||
| + lda n-1,x | |||
| + sta xa-1,x | |||
| + dex | |||
| + bne L1 | |||
| + | |||
| + lda #ITERATIONS ; i := ITERATIONS | |||
| + sta i | |||
| +L2: | |||
| + jsr reverse_add | |||
| + jsr is_palindrome | |||
| + bne no_palindrome | |||
| + clc | |||
| + rts | |||
| +no_palindrome: | |||
| + ldx length ; a := b | |||
| +L3: | |||
| + lda xb-1,x | |||
| + sta xa-1,x | |||
| + dex | |||
| + bne L3 | |||
| + | |||
| + dec i ; Loop body end. | |||
| + bne L2 | |||
| + | |||
| + sec | |||
| + rts | |||
| +.endproc | |||
| + | |||
| +;-------------------------------------- | |||
| +; Add the reverse to `xa` to itself and store the result in `xb`. | |||
| +; | |||
| +; :in: `length`, `xa` | |||
| +; :out: `length`, `xb` | |||
| +;-------------------------------------- | |||
| +.proc reverse_add | |||
| +.code | |||
| + ldx #0 | |||
| + ldy length | |||
| + clc | |||
| +L1: | |||
| + lda xa,x | |||
| + adc xa-1,y | |||
| + | |||
| + cmp #10 | |||
| + bcc no_adjust | |||
| + sbc #10 | |||
| +no_adjust: | |||
| + sta xb,x | |||
| + | |||
| + dey | |||
| + inx | |||
| + txa ; ``eor`` instead of ``cpx`` to keep the carry flag | |||
| + eor length ; of the addition above. | |||
| + bne L1 | |||
| + | |||
| + bcc no_carry | |||
| + lda #1 | |||
| + sta xb,x | |||
| + inc length | |||
| +no_carry: | |||
| + rts | |||
| +.endproc | |||
| + | |||
| +;-------------------------------------- | |||
| +; Checks if `xb` is a palindrome. | |||
| +; | |||
| +; :in: `length`, `xb` | |||
| +; :out: Z flag set if `xb` is a palindrome, cleared otherwise. | |||
| +;-------------------------------------- | |||
| +.proc is_palindrome | |||
| +.code | |||
| + ldx #0 | |||
| + lda length | |||
| + tay | |||
| + lsr | |||
| + sta L1+1 ; Self modifying code! | |||
| +L1: | |||
| + cpx #0 ; <<< 0 replaced by (`length` / 2). | |||
| + beq return | |||
| + lda xb,x | |||
| + cmp xb-1,y | |||
| + bne return | |||
| + dey | |||
| + inx | |||
| + bne L1 | |||
| +return: | |||
| + rts | |||
| +.endproc | |||
9
vendor/pygments/tests/examplefiles/cbmbas_example
| @@ -0,0 +1,9 @@ | |||
| +10 rem cbm basic v2 example | |||
| +20 rem comment with keywords: for, data | |||
| +30 dim a$(20) | |||
| +35 rem the typical space efficient form of leaving spaces out: | |||
| +40 fort=0to15:poke646,t:print"{revers on} ";:next | |||
| +50 geta$:ifa$=chr$(0):goto40 | |||
| +55 rem it is legal to omit the closing " on line end | |||
| +60 print"{white}":print"bye... | |||
| +70 end | |||
93
vendor/pygments/tests/examplefiles/classes.dylan
3,556
vendor/pygments/tests/examplefiles/example.cob
3,556 additions,
0 deletions
not shown because the diff is too large. Please use a local Git client to view these changes.
152
vendor/pygments/tests/examplefiles/example.monkey
| @@ -0,0 +1,152 @@ | |||
| +Strict | |||
| + | |||
| +' single line comment | |||
| + | |||
| +#rem | |||
| +multi | |||
| +line | |||
| +comment | |||
| +#end | |||
| + | |||
| +#rem | |||
| +nested | |||
| +#rem | |||
| +multi | |||
| +line | |||
| +#end | |||
| +comment | |||
| +#end | |||
| + | |||
| +Import mojo | |||
| + | |||
| +Const ONECONST:Int = 1 | |||
| +Const TWOCONST := 2 | |||
| +Const THREECONST := 3, FOURCONST:Int = 4 | |||
| + | |||
| +Global someVariable:Int = 4 | |||
| + | |||
| +' sample class from the documentation | |||
| +Class Game Extends App | |||
| + | |||
| + Function New() | |||
| + End | |||
| + | |||
| + Function DrawSpiral(clock) | |||
| + Local w=DeviceWidth/2 | |||
| + For Local i#=0 Until w*1.5 Step .2 | |||
| + Local x#,y# | |||
| + x=w+i*Sin(i*3+clock) | |||
| + y=w+i*Cos(i*2+clock) | |||
| + DrawRect x,y,1,1 | |||
| + Next | |||
| + hitbox.Collide(event.pos) | |||
| + End | |||
| + | |||
| + Field updateCount | |||
| + | |||
| + Method OnCreate() | |||
| + Print "spiral" | |||
| + | |||
| + SetUpdateRate 60 | |||
| + End | |||
| + | |||
| + Method OnUpdate() | |||
| + updateCount+=1 | |||
| + End | |||
| + | |||
| + Method OnRender() | |||
| + Cls | |||
| + DrawSpiral updateCount | |||
| + DrawSpiral updateCount*1.1 | |||
| + End | |||
| + | |||
| +End | |||
| + | |||
| +Class Enemy | |||
| + Method Die () Abstract | |||
| +End | |||
| + | |||
| +' extending | |||
| +Class Hoodlum Extends Enemy | |||
| + ' field | |||
| + Field testField:Bool = True | |||
| + | |||
| + ' naming class with modulepath | |||
| + Local currentNode:list.Node<Vector2D> | |||
| + | |||
| + Method Die () | |||
| + Print "B'oss, he-- he killed me, b'oss!" | |||
| + End | |||
| +End | |||
| + | |||
| +' extending with generics | |||
| +Class VectorNode Extends Node<Vector2D> | |||
| +End | |||
| + | |||
| +' interfaces | |||
| +Interface Computer | |||
| + Method Boot () | |||
| + Method Process () | |||
| + Method Display () | |||
| +End | |||
| + | |||
| +Class PC Implements Computer | |||
| +End | |||
| + | |||
| +' array syntax | |||
| +Global listOfStuff:String[42] | |||
| +Global lessStuff:String[5] = listOfStuff[4..8] | |||
| +Global oneStuff:String = listOfStuff[23] | |||
| + | |||
| +'a comma separated sequence | |||
| +Global scores:Int[]=[10,20,30] | |||
| +'a comma separated sequence | |||
| +Global text:String[]=["Hello","There","World"] | |||
| +Global worstCase:worst.List<String[]> | |||
| + | |||
| +' string type | |||
| +Global string1:String = "Hello world" | |||
| +Global string2$ = "Hello world" | |||
| + | |||
| +' escape characers in strings | |||
| +Global string3 := "Hello~zWorld" | |||
| +Global string4 := "~qHello World~q" | |||
| +Global string5 := "~tIndented~n" | |||
| +Global string6 := "tilda is wavey... ~~" | |||
| + | |||
| +' string pseudofunctions | |||
| +Print " Hello World ~n".Trim() ' prints "Hello World" | |||
| +Print "Hello World".ToUpper() ' prints "HELLO WORLD" | |||
| + | |||
| +' Boolean shorttype | |||
| +Global boolVariable1:Bool = True | |||
| +Global boolVariable2? = False | |||
| + | |||
| +' number formats | |||
| +Global hexNum1:Int = $3d0dead | |||
| +Global hexNum2% = $CAFEBABE | |||
| + | |||
| +Global floatNum1:Float = 3.141516 | |||
| +Global floatNum2# = 3.141516 | |||
| +Global floatNum3 := .141516 | |||
| + | |||
| +' preprocessor keywords | |||
| +#If TARGET = "android" | |||
| +DoStuff() | |||
| +#ElseIf TARGET = "ios" | |||
| +DoOtherStuff() | |||
| +#End | |||
| + | |||
| +' preprocessor variable | |||
| +#SOMETHING = True | |||
| +#Print SOMETHING | |||
| +#If SOMETHING | |||
| +#End | |||
| + | |||
| +' operators | |||
| +Global a = 32 | |||
| +Global b = 32 ~ 0 | |||
| +b ~= 16 | |||
| +b |= 16 | |||
| +b &= 16 | |||
| +Global c = a | b | |||
161
vendor/pygments/tests/examplefiles/example.prg
| @@ -0,0 +1,161 @@ | |||
| +&& This is a concatenation of all VFP examples on Wikipedia. | |||
| +&& Copyright 2013 Wikimedia, under the GFDL. | |||
| + | |||
| +FOR i = 1 to 10 | |||
| + x = x + 6.5 | |||
| +ENDFOR | |||
| + | |||
| +IF i = 25 | |||
| + i = i + 1 | |||
| +ELSE | |||
| + i = i + 3 | |||
| +ENDIF | |||
| + | |||
| +x = 1 | |||
| +DO WHILE x < 50 | |||
| + x = x + 1 | |||
| +ENDDO | |||
| + | |||
| +x = 1 | |||
| +DO WHILE .T. | |||
| + x = x + 1 | |||
| + IF x < 50 | |||
| + LOOP | |||
| + ELSE | |||
| + EXIT | |||
| + ENDIF | |||
| +ENDDO | |||
| + | |||
| +nMonth = MONTH(DATE()) | |||
| +DO CASE | |||
| + CASE nMonth <= 3 | |||
| + MESSAGEBOX("Q1") | |||
| + | |||
| + CASE nMonth <= 6 | |||
| + MESSAGEBOX("Q2") | |||
| + | |||
| + CASE nMonth <= 9 | |||
| + MESSAGEBOX("Q3") | |||
| + | |||
| + OTHERWISE | |||
| + MESSAGEBOX("Q4") | |||
| +ENDCASE | |||
| + | |||
| +FOR EACH oControl IN THISFORM.Controls | |||
| + MESSAGEBOX(oControl.Name) | |||
| +ENDFOR | |||
| + | |||
| +f = Factorial(10) | |||
| + | |||
| +FUNCTION Factorial(n) | |||
| + LOCAL i,r | |||
| + r = 1 | |||
| + FOR i = n TO 1 STEP -1 | |||
| + r = r * n | |||
| + ENDFOR | |||
| + RETURN r | |||
| +ENDFUNC | |||
| + | |||
| +loForm = CREATEOBJECT("HiForm") | |||
| +loForm.Show(1) | |||
| + | |||
| +DEFINE CLASS HiForm AS Form | |||
| + AutoCenter = .T. | |||
| + Caption = "Hello, World" | |||
| + | |||
| + ADD OBJECT lblHi as Label WITH ; | |||
| + Caption = "Hello, World!" | |||
| +ENDDEFINE | |||
| + | |||
| +loMine = CREATEOBJECT("MyClass") | |||
| +? loMine.cProp1 && This will work. (Double-ampersand marks an end-of-line comment) | |||
| +? loMine.cProp2 && Program Error: Property CPROP2 is not found. | |||
| + | |||
| +? loMine.MyMethod1() && This will work. | |||
| +? loMine.MyMethod2() && Program Error: Property MYMETHOD2 is not found. | |||
| + | |||
| +DEFINE CLASS MyClass AS Custom | |||
| + cProp1 = "My Property" && This is a public property | |||
| + HIDDEN cProp2 && This is a private (hidden) property | |||
| + dProp3 = {} && Another public property | |||
| + | |||
| + PROCEDURE Init() && Class constructor | |||
| + This.cProp2 = "This is a hidden property." | |||
| + ENDPROC | |||
| + | |||
| + PROCEDURE dProp3_Access && Property Getter | |||
| + RETURN DATE() | |||
| + ENDPROC | |||
| + PROCEDURE dProp3_Assign(vNewVal) && Property Setter | |||
| + IF VARTYPE(vNewVal) = "D" | |||
| + THIS.dProp3 = vNewVal | |||
| + ENDIF | |||
| + ENDPROC | |||
| + | |||
| + PROCEDURE MyMethod1() | |||
| + * This is a public method, calling a hidden method that returns | |||
| + * the value of a hidden property. | |||
| + RETURN This.MyMethod2() | |||
| + ENDPROC | |||
| + | |||
| + HIDDEN PROCEDURE MyMethod2() && This is a private (hidden) method | |||
| + RETURN This.cProp2 | |||
| + ENDPROC | |||
| +ENDDEFINE | |||
| + | |||
| +&& Create a table | |||
| +CREATE TABLE randData (iData I) | |||
| + | |||
| +&& Populate with random data using xBase and SQL DML commands | |||
| +FOR i = 1 TO 50 | |||
| + APPEND BLANK | |||
| + REPLACE iData WITH (RAND() * 100) | |||
| + | |||
| + INSERT INTO randData (iData) VALUES (RAND() * 100) | |||
| +ENDFOR | |||
| + | |||
| +&& Place a structural index on the data | |||
| +INDEX ON iData TAG iData | |||
| +CLOSE ALL | |||
| + | |||
| +&& Display ordered data using xBase-style commands | |||
| +USE randData | |||
| +SET ORDER TO iData | |||
| +GO TOP | |||
| +LIST NEXT 10 && First 10 | |||
| +GO BOTTOM | |||
| +SKIP -10 | |||
| +LIST REST && Last 10 | |||
| +CLOSE ALL | |||
| + | |||
| +&& Browse ordered data using SQL DML commands | |||
| +SELECT * ; | |||
| + FROM randData ; | |||
| + ORDER BY iData DESCENDING | |||
| + | |||
| + | |||
| +&& Connect to an ODBC data source | |||
| +LOCAL nHnd | |||
| +nHnd = SQLCONNECT ("ODBCDSN", "user", "pwd") | |||
| + | |||
| +&& Execute a SQL command | |||
| +LOCAL nResult | |||
| +nResult = SQLEXEC (nHnd, "USE master") | |||
| +IF nResult < 0 | |||
| + MESSAGEBOX ("MASTER database does not exist!") | |||
| + RETURN | |||
| +ENDIF | |||
| + | |||
| +&& Retrieve data from the remote server and stores it in | |||
| +&& a local data cursor | |||
| +nResult = SQLEXEC (nHnd, "SELECT * FROM authors", "QAUTHORS") | |||
| + | |||
| +&& Update a record in a remote table using parameters | |||
| +PRIVATE cAuthorID, cAuthorName | |||
| +cAuthorID = "1001" | |||
| +cAuthorName = "New name" | |||
| +nResult = SQLEXEC (nHnd, "UPDATE authors SET auth_name = ?cAuthorName WHERE auth_id = ?cAuthorID") | |||
| + | |||
| +&& Close the connection | |||
| +SQLDISCONNECT(nHnd) | |||
| + | |||
19
vendor/pygments/tests/examplefiles/example.reg
| @@ -0,0 +1,19 @@ | |||
| +Windows Registry Editor Version 5.00 | |||
| +; comment | |||
| + | |||
| +[HKEY_CURRENT_USER\SOFTWARE\Pygments] | |||
| +@="Hello" | |||
| +"Key With Spaces"="Something" | |||
| +"Key With ="="With Quotes" | |||
| +"Key With = 2"=dword:123 | |||
| +"Key" = "Value" | |||
| +"Hex"=hex(0):1,2,3,a,b,f | |||
| +"Hex 2"=hex(5):80,00,00,ff | |||
| + | |||
| +[-HKEY_CURRENT_USER\SOFTWARE\Pygments\Subkey] | |||
| + | |||
| +[HKEY_CURRENT_USER\SOFTWARE\Pygments\Subkey2] | |||
| +; comment | |||
| +@=- | |||
| +"Foo"=- | |||
| +"Foo"="Value" | |||
45
vendor/pygments/tests/examplefiles/example.shell-session
| @@ -0,0 +1,45 @@ | |||
| +[user@linuxbox imx-bootlets-src-10.05.02]$ make CROSS_COMPILE=arm-none-eabi- clean | |||
| +rm -rf *.sb | |||
| +rm -f sd_mmc_bootstream.raw | |||
| +rm -f linux_prep/board/*.o | |||
| +... | |||
| +Files: | |||
| +rm -f power_prep.o eabi.o | |||
| +Build output: | |||
| +make[1]: Leaving directory `/home/...' | |||
| +[user@linuxbox imx-bootlets-src-10.05.02]$ make CROSS_COMPILE=arm-none-eabi- | |||
| +make[1]: Entering directory `/home/...' | |||
| +... | |||
| +#@echo "generating U-Boot boot stream image" | |||
| +#elftosb2 -z -c ./uboot_prebuilt.db -o imx23_uboot.sb | |||
| +echo "generating kernel bootstream file sd_mmc_bootstream.raw" | |||
| +generating kernel bootstream file sd_mmc_bootstream.raw | |||
| +#Please use cfimager to burn xxx_linux.sb. The below way will no | |||
| +#work at imx28 platform. | |||
| +> test | |||
| +$ test | |||
| +rm -f sd_mmc_bootstream.raw | |||
| +[user@linuxbox imx-bootlets-src-10.05.02]$ | |||
| +pi@raspberrypi ~ $ sudo sh -c "echo 17 > /sys/class/gpio/export" | |||
| +pi@raspberrypi ~ $ sudo sh -c "echo out > /sys/class/gpio/gpio17/direction" | |||
| +pi@raspberrypi ~ $ sudo sh -c "echo 1 > /sys/class/gpio/gpio17/value" | |||
| +pi@raspberrypi ~ $ sudo sh -c "echo 0 > /sys/class/gpio/gpio17/value" | |||
| +pi@raspberrypi ~ $ | |||
| +[user@linuxbox ~]$ # copy other stuff to the SD card | |||
| +root@imx233-olinuxino-micro:~# lsmod | |||
| + Not tainted | |||
| +[user@linuxbox ~]$ tail -n 2 /mnt/rpi/etc/inittab | |||
| +#Spawn a getty on Raspberry Pi serial line | |||
| +T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100 | |||
| +pi@raspberrypi:~/Adafruit-WebIDE$ mkdir tmp | |||
| +pi@raspberrypi:~/Adafruit-WebIDE$ npm config set tmp tmp | |||
| +pi@raspberrypi:~/Adafruit-WebIDE$ npm install | |||
| +pi@raspberrypi ~/Adafruit-WebIDE $ ifconfig eth0 | |||
| +eth0 Link encap:Ethernet HWaddr b5:33:ff:33:ee:aq | |||
| + inet addr:10.42.0.60 Bcast:10.42.0.255 Mask:255.255.255.0 | |||
| + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 | |||
| + RX packets:21867 errors:0 dropped:0 overruns:0 frame:0 | |||
| + TX packets:8684 errors:0 dropped:0 overruns:0 carrier:0 | |||
| + collisions:0 txqueuelen:1000 | |||
| + RX bytes:27338495 (26.0 MiB) TX bytes:1268356 (1.2 MiB) | |||
| + | |||
28
vendor/pygments/tests/examplefiles/example.ts
| @@ -0,0 +1,28 @@ | |||
| +class Animal { | |||
| + constructor(public name) { } | |||
| + move(meters) { | |||
| + alert(this.name + " moved " + meters + "m."); | |||
| + } | |||
| +} | |||
| + | |||
| +class Snake extends Animal { | |||
| + constructor(name) { super(name); } | |||
| + move() { | |||
| + alert("Slithering..."); | |||
| + super.move(5); | |||
| + } | |||
| +} | |||
| + | |||
| +class Horse extends Animal { | |||
| + constructor(name) { super(name); } | |||
| + move() { | |||
| + alert("Galloping..."); | |||
| + super.move(45); | |||
| + } | |||
| +} | |||
| + | |||
| +var sam = new Snake("Sammy the Python") | |||
| +var tom: Animal = new Horse("Tommy the Palomino") | |||
| + | |||
| +sam.move() | |||
| +tom.move(34) | |||
40
vendor/pygments/tests/examplefiles/hello.smali
| @@ -0,0 +1,40 @@ | |||
| +# To Recreate: | |||
| +# | |||
| +# echo -e 'class hello {\n public static void main(String[] args) {\n | |||
| +# System.out.println("hi");\n }\n}\n' > hello.java | |||
| +# javac -target 1.4 -source 1.4 hello.java | |||
| +# dx --dex --output=hello.dex hello.class | |||
| +# baksmali hello.dex | |||
| +# cat out/hello.smali | |||
| + | |||
| +.class Lhello; | |||
| +.super Ljava/lang/Object; | |||
| +.source "hello.java" | |||
| + | |||
| + | |||
| +# direct methods | |||
| +.method constructor <init>()V | |||
| + .registers 1 | |||
| + | |||
| + .prologue | |||
| + .line 1 | |||
| + invoke-direct {p0}, Ljava/lang/Object;-><init>()V | |||
| + | |||
| + return-void | |||
| +.end method | |||
| + | |||
| +.method public static main([Ljava/lang/String;)V | |||
| + .registers 3 | |||
| + .parameter | |||
| + | |||
| + .prologue | |||
| + .line 3 | |||
| + sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; | |||
| + | |||
| + const-string v1, "hi" | |||
| + | |||
| + invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V | |||
| + | |||
| + .line 4 | |||
| + return-void | |||
| +.end method | |||
71
vendor/pygments/tests/examplefiles/inet_pton6.dg
| @@ -0,0 +1,71 @@ | |||
| +re = import! | |||
| +sys = import! | |||
| + | |||
| + | |||
| +# IPv6address = hexpart [ ":" IPv4address ] | |||
| +# IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT | |||
| +# hexpart = [ hexseq ] [ "::" [ hexseq ] ] | |||
| +# hexseq = hex4 *( ":" hex4) | |||
| +# hex4 = 1*4HEXDIG | |||
| +hexpart = r'({0}|)(?:::({0}|)|)'.format r'(?:[\da-f]{1,4})(?::[\da-f]{1,4})*' | |||
| +addrv4 = r'(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})' | |||
| +addrv6 = re.compile $ r'(?i)(?:{})(?::{})?$'.format hexpart addrv4 | |||
| + | |||
| + | |||
| +# Parse a base-N number given a list of its digits. | |||
| +# | |||
| +# :param q: the number of digits in that numeral system | |||
| +# | |||
| +# :param digits: an iterable of integers in range [0..q] | |||
| +# | |||
| +# :return: a decimal integer | |||
| +# | |||
| +base_n = (q digits) -> foldl (x y) -> (x * q + y) 0 digits | |||
| + | |||
| + | |||
| +# Parse a sequence of hexadecimal numbers | |||
| +# | |||
| +# :param q: a string of colon-separated base-16 integers | |||
| +# | |||
| +# :return: an iterable of Python ints | |||
| +# | |||
| +unhex = q -> q and map p -> (int p 16) (q.split ':') | |||
| + | |||
| + | |||
| +# Parse an IPv6 address as specified in RFC 4291. | |||
| +# | |||
| +# :param address: a string, obviously. | |||
| +# | |||
| +# :return: an integer which, written in binary form, points to the same node. | |||
| +# | |||
| +inet_pton6 = address -> | |||
| + raise $ ValueError 'not a valid IPv6 address' if not (match = addrv6.match address) | |||
| + start, end, *ipv4 = match.groups! | |||
| + | |||
| + is_ipv4 = not $ None in ipv4 | |||
| + shift = (7 - start.count ':' - 2 * is_ipv4) * 16 | |||
| + | |||
| + raise $ ValueError 'not a valid IPv6 address' if (end is None and shift) or shift < 0 | |||
| + hexaddr = (base_n 0x10000 (unhex start) << shift) + base_n 0x10000 (unhex $ end or '') | |||
| + (hexaddr << 32) + base_n 0x100 (map int ipv4) if is_ipv4 else hexaddr | |||
| + | |||
| + | |||
| +inet6_type = q -> switch | |||
| + not q = 'unspecified' | |||
| + q == 1 = 'loopback' | |||
| + (q >> 32) == 0x000000000000ffff = 'IPv4-mapped' | |||
| + (q >> 64) == 0xfe80000000000000 = 'link-local' | |||
| + (q >> 120) != 0x00000000000000ff = 'general unicast' | |||
| + (q >> 112) % (1 << 4) == 0x0000000000000000 = 'multicast w/ reserved scope value' | |||
| + (q >> 112) % (1 << 4) == 0x000000000000000f = 'multicast w/ reserved scope value' | |||
| + (q >> 112) % (1 << 4) == 0x0000000000000001 = 'interface-local multicast' | |||
| + (q >> 112) % (1 << 4) == 0x0000000000000004 = 'admin-local multicast' | |||
| + (q >> 112) % (1 << 4) == 0x0000000000000005 = 'site-local multicast' | |||
| + (q >> 112) % (1 << 4) == 0x0000000000000008 = 'organization-local multicast' | |||
| + (q >> 112) % (1 << 4) == 0x000000000000000e = 'global multicast' | |||
| + (q >> 112) % (1 << 4) != 0x0000000000000002 = 'multicast w/ unknown scope value' | |||
| + (q >> 24) % (1 << 112) == 0x00000000000001ff = 'solicited-node multicast' | |||
| + True = 'link-local multicast' | |||
| + | |||
| + | |||
| +print $ (x -> (inet6_type x, hex x)) $ inet_pton6 $ sys.stdin.read!.strip! | |||
28
vendor/pygments/tests/examplefiles/logos_example.xm
| @@ -0,0 +1,28 @@ | |||
| +%hook ABC | |||
| +- (id)a:(B)b { | |||
| + %log; | |||
| + return %orig(nil); | |||
| +} | |||
| +%end | |||
| + | |||
| +%subclass DEF: NSObject | |||
| +- (id)init { | |||
| + [%c(RuntimeAccessibleClass) alloc]; | |||
| + return nil; | |||
| +} | |||
| +%end | |||
| + | |||
| +%group OptionalHooks | |||
| +%hook ABC | |||
| +- (void)release { | |||
| + [self retain]; | |||
| + %orig; | |||
| +} | |||
| +%end | |||
| +%end | |||
| + | |||
| +%ctor { | |||
| + %init; | |||
| + if(OptionalCondition) | |||
| + %init(OptionalHooks); | |||
| +} | |||
455
vendor/pygments/tests/examplefiles/metagrammar.treetop
| @@ -0,0 +1,455 @@ | |||
| +module Treetop | |||
| + module Compiler | |||
| + grammar Metagrammar | |||
| + rule treetop_file | |||
| + requires:(space? require_statement)* prefix:space? module_or_grammar suffix:space? { | |||
| + def compile | |||
| + requires.text_value + prefix.text_value + module_or_grammar.compile + suffix.text_value | |||
| + end | |||
| + } | |||
| + end | |||
| + | |||
| + rule require_statement | |||
| + prefix:space? "require" [ \t]+ [^\n\r]+ [\n\r] | |||
| + end | |||
| + | |||
| + rule module_or_grammar | |||
| + module_declaration / grammar | |||
| + end | |||
| + | |||
| + rule module_declaration | |||
| + prefix:('module' space name:([A-Z] alphanumeric_char* ('::' [A-Z] alphanumeric_char*)*) space) module_contents:(module_declaration / grammar) suffix:(space 'end') { | |||
| + def compile | |||
| + prefix.text_value + module_contents.compile + suffix.text_value | |||
| + end | |||
| + | |||
| + def parser_name | |||
| + prefix.name.text_value+'::'+module_contents.parser_name | |||
| + end | |||
| + } | |||
| + end | |||
| + | |||
| + rule grammar | |||
| + 'grammar' space grammar_name space ('do' space)? declaration_sequence space? 'end' <Grammar> | |||
| + end | |||
| + | |||
| + rule grammar_name | |||
| + ([A-Z] alphanumeric_char*) | |||
| + end | |||
| + | |||
| + rule declaration_sequence | |||
| + head:declaration tail:(space declaration)* <DeclarationSequence> { | |||
| + def declarations | |||
| + [head] + tail | |||
| + end | |||
| + | |||
| + def tail | |||
| + super.elements.map { |elt| elt.declaration } | |||
| + end | |||
| + } | |||
| + / | |||
| + '' { | |||
| + def compile(builder) | |||
| + end | |||
| + } | |||
| + end | |||
| + | |||
| + rule declaration | |||
| + parsing_rule / include_declaration | |||
| + end | |||
| + | |||
| + rule include_declaration | |||
| + 'include' space [A-Z] (alphanumeric_char / '::')* { | |||
| + def compile(builder) | |||
| + builder << text_value | |||
| + end | |||
| + } | |||
| + end | |||
| + | |||
| + rule parsing_rule | |||
| + 'rule' space nonterminal space ('do' space)? parsing_expression space 'end' <ParsingRule> | |||
| + end | |||
| + | |||
| + rule parsing_expression | |||
| + choice / sequence / primary | |||
| + end | |||
| + | |||
| + rule choice | |||
| + head:alternative tail:(space? '/' space? alternative)+ <Choice> { | |||
| + def alternatives | |||
| + [head] + tail | |||
| + end | |||
| + | |||
| + def tail | |||
| + super.elements.map {|elt| elt.alternative} | |||
| + end | |||
| + | |||
| + def inline_modules | |||
| + (alternatives.map {|alt| alt.inline_modules }).flatten | |||
| + end | |||
| + } | |||
| + end | |||
| + | |||
| + rule sequence | |||
| + head:labeled_sequence_primary tail:(space labeled_sequence_primary)+ node_class_declarations <Sequence> { | |||
| + def sequence_elements | |||
| + [head] + tail | |||
| + end | |||
| + | |||
| + def tail | |||
| + super.elements.map {|elt| elt.labeled_sequence_primary } | |||
| + end | |||
| + | |||
| + def inline_modules | |||
| + (sequence_elements.map {|elt| elt.inline_modules}).flatten + | |||
| + [sequence_element_accessor_module] + | |||
| + node_class_declarations.inline_modules | |||
| + end | |||
| + | |||
| + def inline_module_name | |||
| + node_class_declarations.inline_module_name | |||
| + end | |||
| + } | |||
| + end | |||
| + | |||
| + rule alternative | |||
| + sequence / primary | |||
| + end | |||
| + | |||
| + rule primary | |||
| + prefix atomic { | |||
| + def compile(address, builder, parent_expression=nil) | |||
| + prefix.compile(address, builder, self) | |||
| + end | |||
| + | |||
| + def prefixed_expression | |||
| + atomic | |||
| + end | |||
| + | |||
| + def inline_modules | |||
| + atomic.inline_modules | |||
| + end | |||
| + | |||
| + def inline_module_name | |||
| + nil | |||
| + end | |||
| + } | |||
| + / | |||
| + prefix space? predicate_block { | |||
| + def compile(address, builder, parent_expression=nil) | |||
| + prefix.compile(address, builder, self) | |||
| + end | |||
| + def prefixed_expression | |||
| + predicate_block | |||
| + end | |||
| + def inline_modules | |||
| + [] | |||
| + end | |||
| + } | |||
| + / | |||
| + atomic suffix node_class_declarations { | |||
| + def compile(address, builder, parent_expression=nil) | |||
| + suffix.compile(address, builder, self) | |||
| + end | |||
| + | |||
| + def optional_expression | |||
| + atomic | |||
| + end | |||
| + | |||
| + def node_class_name | |||
| + node_class_declarations.node_class_name | |||
| + end | |||
| + | |||
| + def inline_modules | |||
| + atomic.inline_modules + node_class_declarations.inline_modules | |||
| + end | |||
| + | |||
| + def inline_module_name | |||
| + node_class_declarations.inline_module_name | |||
| + end | |||
| + } | |||
| + / | |||
| + atomic node_class_declarations { | |||
| + def compile(address, builder, parent_expression=nil) | |||
| + atomic.compile(address, builder, self) | |||
| + end | |||
| + | |||
| + def node_class_name | |||
| + node_class_declarations.node_class_name | |||
| + end | |||
| + | |||
| + def inline_modules | |||
| + atomic.inline_modules + node_class_declarations.inline_modules | |||
| + end | |||
| + | |||
| + def inline_module_name | |||
| + node_class_declarations.inline_module_name | |||
| + end | |||
| + } | |||
| + end | |||
| + | |||
| + rule labeled_sequence_primary | |||
| + label sequence_primary { | |||
| + def compile(lexical_address, builder) | |||
| + sequence_primary.compile(lexical_address, builder) | |||
| + end | |||
| + | |||
| + def inline_modules | |||
| + sequence_primary.inline_modules | |||
| + end | |||
| + | |||
| + def label_name | |||
| + if label.name | |||
| + label.name | |||
| + elsif sequence_primary.instance_of?(Nonterminal) | |||
| + sequence_primary.text_value | |||
| + else | |||
| + nil | |||
| + end | |||
| + end | |||
| + } | |||
| + end | |||
| + | |||
| + rule label | |||
| + (alpha_char alphanumeric_char*) ':' { | |||
| + def name | |||
| + elements[0].text_value | |||
| + end | |||
| + } | |||
| + / | |||
| + '' { | |||
| + def name | |||
| + nil | |||
| + end | |||
| + } | |||
| + end | |||
| + | |||
| + rule sequence_primary | |||
| + prefix atomic { | |||
| + def compile(lexical_address, builder) | |||
| + prefix.compile(lexical_address, builder, self) | |||
| + end | |||
| + | |||
| + def prefixed_expression | |||
| + elements[1] | |||
| + end | |||
| + | |||
| + def inline_modules | |||
| + atomic.inline_modules | |||
| + end | |||
| + | |||
| + def inline_module_name | |||
| + nil | |||
| + end | |||
| + } | |||
| + / | |||
| + prefix space? predicate_block { | |||
| + def compile(address, builder, parent_expression=nil) | |||
| + prefix.compile(address, builder, self) | |||
| + end | |||
| + def prefixed_expression | |||
| + predicate_block | |||
| + end | |||
| + def inline_modules | |||
| + [] | |||
| + end | |||
| + } | |||
| + / | |||
| + atomic suffix { | |||
| + def compile(lexical_address, builder) | |||
| + suffix.compile(lexical_address, builder, self) | |||
| + end | |||
| + | |||
| + def node_class_name | |||
| + nil | |||
| + end | |||
| + | |||
| + def inline_modules | |||
| + atomic.inline_modules | |||
| + end | |||
| + | |||
| + def inline_module_name | |||
| + nil | |||
| + end | |||
| + } | |||
| + / | |||
| + atomic | |||
| + end | |||
| + | |||
| + rule suffix | |||
| + repetition_suffix / optional_suffix | |||
| + end | |||
| + | |||
| + rule optional_suffix | |||
| + '?' <Optional> | |||
| + end | |||
| + | |||
| + rule node_class_declarations | |||
| + node_class_expression trailing_inline_module { | |||
| + def node_class_name | |||
| + node_class_expression.node_class_name | |||
| + end | |||
| + | |||
| + def inline_modules | |||
| + trailing_inline_module.inline_modules | |||
| + end | |||
| + | |||
| + def inline_module | |||
| + trailing_inline_module.inline_module | |||
| + end | |||
| + | |||
| + def inline_module_name | |||
| + inline_module.module_name if inline_module | |||
| + end | |||
| + } | |||
| + end | |||
| + | |||
| + rule repetition_suffix | |||
| + '+' <OneOrMore> / '*' <ZeroOrMore> / occurrence_range | |||
| + end | |||
| + | |||
| + rule occurrence_range | |||
| + space? min:([0-9])* '..' max:([0-9])* <OccurrenceRange> | |||
| + end | |||
| + | |||
| + rule prefix | |||
| + '&' <AndPredicate> / '!' <NotPredicate> / '~' <TransientPrefix> | |||
| + end | |||
| + | |||
| + rule atomic | |||
| + terminal | |||
| + / | |||
| + nonterminal | |||
| + / | |||
| + parenthesized_expression | |||
| + end | |||
| + | |||
| + rule parenthesized_expression | |||
| + '(' space? parsing_expression space? ')' <ParenthesizedExpression> { | |||
| + def inline_modules | |||
| + parsing_expression.inline_modules | |||
| + end | |||
| + } | |||
| + end | |||
| + | |||
| + rule nonterminal | |||
| + !keyword_inside_grammar (alpha_char alphanumeric_char*) <Nonterminal> | |||
| + end | |||
| + | |||
| + rule terminal | |||
| + quoted_string / character_class / anything_symbol | |||
| + end | |||
| + | |||
| + rule quoted_string | |||
| + (single_quoted_string / double_quoted_string) { | |||
| + def string | |||
| + super.text_value | |||
| + end | |||
| + } | |||
| + end | |||
| + | |||
| + rule double_quoted_string | |||
| + '"' string:(!'"' ("\\\\" / '\"' / .))* '"' <Terminal> | |||
| + end | |||
| + | |||
| + rule single_quoted_string | |||
| + "'" string:(!"'" ("\\\\" / "\\'" / .))* "'" <Terminal> | |||
| + end | |||
| + | |||
| + rule character_class | |||
| + '[' characters:(!']' ('\\' . / bracket_expression / !'\\' .))+ ']' <CharacterClass> { | |||
| + def characters | |||
| + super.text_value | |||
| + end | |||
| + } | |||
| + end | |||
| + | |||
| + rule bracket_expression | |||
| + '[:' '^'? ( | |||
| + 'alnum' / 'alpha' / 'blank' / 'cntrl' / 'digit' / 'graph' / 'lower' / | |||
| + 'print' / 'punct' / 'space' / 'upper' / 'xdigit' / 'word' | |||
| + ) ':]' | |||
| + end | |||
| + | |||
| + rule anything_symbol | |||
| + '.' <AnythingSymbol> | |||
| + end | |||
| + | |||
| + rule node_class_expression | |||
| + space '<' (!'>' .)+ '>' { | |||
| + def node_class_name | |||
| + elements[2].text_value | |||
| + end | |||
| + } | |||
| + / | |||
| + '' { | |||
| + def node_class_name | |||
| + nil | |||
| + end | |||
| + } | |||
| + end | |||
| + | |||
| + rule trailing_inline_module | |||
| + space inline_module { | |||
| + def inline_modules | |||
| + [inline_module] | |||
| + end | |||
| + | |||
| + def inline_module_name | |||
| + inline_module.module_name | |||
| + end | |||
| + } | |||
| + / | |||
| + '' { | |||
| + def inline_modules | |||
| + [] | |||
| + end | |||
| + | |||
| + def inline_module | |||
| + nil | |||
| + end | |||
| + | |||
| + def inline_module_name | |||
| + nil | |||
| + end | |||
| + } | |||
| + end | |||
| + | |||
| + rule predicate_block | |||
| + '' inline_module <PredicateBlock> | |||
| + end | |||
| + | |||
| + rule inline_module | |||
| + '{' (inline_module / ![{}] .)* '}' <InlineModule> | |||
| + end | |||
| + | |||
| + rule keyword_inside_grammar | |||
| + ('rule' / 'end') !non_space_char | |||
| + end | |||
| + | |||
| + rule non_space_char | |||
| + !space . | |||
| + end | |||
| + | |||
| + rule alpha_char | |||
| + [A-Za-z_] | |||
| + end | |||
| + | |||
| + rule alphanumeric_char | |||
| + alpha_char / [0-9] | |||
| + end | |||
| + | |||
| + rule space | |||
| + (white / comment_to_eol)+ | |||
| + end | |||
| + | |||
| + rule comment_to_eol | |||
| + '#' (!"\n" .)* | |||
| + end | |||
| + | |||
| + rule white | |||
| + [ \t\n\r] | |||
| + end | |||
| + end | |||
| + end | |||
| +end | |||
73
vendor/pygments/tests/examplefiles/mg_sample.pro
| @@ -0,0 +1,73 @@ | |||
| +; docformat = 'rst' | |||
| + | |||
| +; Example IDL (Interactive Data Language) source code. | |||
| + | |||
| +;+ | |||
| +; Get `nIndices` random indices for an array of size `nValues` (without | |||
| +; repeating an index). | |||
| +; | |||
| +; :Examples: | |||
| +; Try:: | |||
| +; | |||
| +; IDL> r = randomu(seed, 10) | |||
| +; IDL> print, r, format='(4F)' | |||
| +; 0.6297589 0.7815896 0.2508559 0.7546844 | |||
| +; 0.1353382 0.1245834 0.8733745 0.0753110 | |||
| +; 0.8054136 0.9513228 | |||
| +; IDL> ind = mg_sample(10, 3, seed=seed) | |||
| +; IDL> print, ind | |||
| +; 2 4 7 | |||
| +; IDL> print, r[ind] | |||
| +; 0.250856 0.135338 0.0753110 | |||
| +; | |||
| +; :Returns: | |||
| +; lonarr(`nIndices`) | |||
| +; | |||
| +; :Params: | |||
| +; nValues : in, required, type=long | |||
| +; size of array to choose indices from | |||
| +; nIndices : in, required, type=long | |||
| +; number of indices needed | |||
| +; | |||
| +; :Keywords: | |||
| +; seed : in, out, optional, type=integer or lonarr(36) | |||
| +; seed to use for random number generation, leave undefined to use a | |||
| +; seed generated from the system clock; new seed will be output | |||
| +;- | |||
| +function mg_sample, nValues, nIndices, seed=seed | |||
| + compile_opt strictarr | |||
| + | |||
| + ; get random nIndices by finding the indices of the smallest nIndices in a | |||
| + ; array of random values | |||
| + values = randomu(seed, nValues) | |||
| + | |||
| + ; our random values are uniformly distributed, so ideally the nIndices | |||
| + ; smallest values are in the first bin of the below histogram | |||
| + nBins = nValues / nIndices | |||
| + h = histogram(values, nbins=nBins, reverse_indices=ri) | |||
| + | |||
| + ; the candidates for being in the first nIndices will live in bins 0..bin | |||
| + nCandidates = 0L | |||
| + for bin = 0L, nBins - 1L do begin | |||
| + nCandidates += h[bin] | |||
| + if (nCandidates ge nIndices) then break | |||
| + endfor | |||
| + | |||
| + ; get the candidates and sort them | |||
| + candidates = ri[ri[0] : ri[bin + 1L] - 1L] | |||
| + sortedCandidates = sort(values[candidates]) | |||
| + | |||
| + ; return the first nIndices of them | |||
| + return, (candidates[sortedCandidates])[0:nIndices-1L] | |||
| +end | |||
| + | |||
| + | |||
| +; main-level example program | |||
| + | |||
| +r = randomu(seed, 10) | |||
| +print, r | |||
| +ind = mg_sample(10, 3, seed=seed) | |||
| +print, ind | |||
| +print, r[ind] | |||
| + | |||
| +end | |||
112
vendor/pygments/tests/examplefiles/minehunt.qml
| @@ -0,0 +1,112 @@ | |||
| + /**************************************************************************** | |||
| + ** | |||
| + ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). | |||
| + ** All rights reserved. | |||
| + ** Contact: Nokia Corporation (qt-info@nokia.com) | |||
| + ** | |||
| + ** This file is part of the QtDeclarative module of the Qt Toolkit. | |||
| + ** | |||
| + ** $QT_BEGIN_LICENSE:LGPL$ | |||
| + ** GNU Lesser General Public License Usage | |||
| + ** This file may be used under the terms of the GNU Lesser General Public | |||
| + ** License version 2.1 as published by the Free Software Foundation and | |||
| + ** appearing in the file LICENSE.LGPL included in the packaging of this | |||
| + ** file. Please review the following information to ensure the GNU Lesser | |||
| + ** General Public License version 2.1 requirements will be met: | |||
| + ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | |||
| + ** | |||
| + ** In addition, as a special exception, Nokia gives you certain additional | |||
| + ** rights. These rights are described in the Nokia Qt LGPL Exception | |||
| + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | |||
| + ** | |||
| + ** GNU General Public License Usage | |||
| + ** Alternatively, this file may be used under the terms of the GNU General | |||
| + ** Public License version 3.0 as published by the Free Software Foundation | |||
| + ** and appearing in the file LICENSE.GPL included in the packaging of this | |||
| + ** file. Please review the following information to ensure the GNU General | |||
| + ** Public License version 3.0 requirements will be met: | |||
| + ** http://www.gnu.org/copyleft/gpl.html. | |||
| + ** | |||
| + ** Other Usage | |||
| + ** Alternatively, this file may be used in accordance with the terms and | |||
| + ** conditions contained in a signed written agreement between you and Nokia. | |||
| + ** | |||
| + ** | |||
| + ** | |||
| + ** | |||
| + ** | |||
| + ** $QT_END_LICENSE$ | |||
| + ** | |||
| + ****************************************************************************/ | |||
| + | |||
| + import QtQuick 1.0 | |||
| + import "MinehuntCore" 1.0 | |||
| + | |||
| + Item { | |||
| + id: field | |||
| + property int clickx: 0 | |||
| + property int clicky: 0 | |||
| + | |||
| + width: 450; height: 450 | |||
| + | |||
| + Image { source: "MinehuntCore/pics/background.png"; anchors.fill: parent; fillMode: Image.Tile } | |||
| + | |||
| + Grid { | |||
| + anchors.horizontalCenter: parent.horizontalCenter | |||
| + columns: 9; spacing: 1 | |||
| + | |||
| + Repeater { | |||
| + id: repeater | |||
| + model: tiles | |||
| + delegate: Tile {} | |||
| + } | |||
| + } | |||
| + | |||
| + Row { | |||
| + id: gamedata | |||
| + x: 20; spacing: 20 | |||
| + anchors.bottom: field.bottom; anchors.bottomMargin: 15 | |||
| + | |||
| + Image { | |||
| + source: "MinehuntCore/pics/quit.png" | |||
| + scale: quitMouse.pressed ? 0.8 : 1.0 | |||
| + smooth: quitMouse.pressed | |||
| + y: 10 | |||
| + MouseArea { | |||
| + id: quitMouse | |||
| + anchors.fill: parent | |||
| + anchors.margins: -20 | |||
| + onClicked: Qt.quit() | |||
| + } | |||
| + } | |||
| + Column { | |||
| + spacing: 2 | |||
| + Image { source: "MinehuntCore/pics/bomb-color.png" } | |||
| + Text { anchors.horizontalCenter: parent.horizontalCenter; color: "white"; text: numMines } | |||
| + } | |||
| + | |||
| + Column { | |||
| + spacing: 2 | |||
| + Image { source: "MinehuntCore/pics/flag-color.png" } | |||
| + Text { anchors.horizontalCenter: parent.horizontalCenter; color: "white"; text: numFlags } | |||
| + } | |||
| + } | |||
| + | |||
| + Image { | |||
| + anchors.bottom: field.bottom; anchors.bottomMargin: 15 | |||
| + anchors.right: field.right; anchors.rightMargin: 20 | |||
| + source: isPlaying ? 'MinehuntCore/pics/face-smile.png' : | |||
| + hasWon ? 'MinehuntCore/pics/face-smile-big.png': 'MinehuntCore/pics/face-sad.png' | |||
| + | |||
| + MouseArea { anchors.fill: parent; onPressed: reset() } | |||
| + } | |||
| + Text { | |||
| + anchors.centerIn: parent; width: parent.width - 20 | |||
| + horizontalAlignment: Text.AlignHCenter | |||
| + wrapMode: Text.WordWrap | |||
| + text: "Minehunt demo has to be compiled to run.\n\nPlease see README." | |||
| + color: "white"; font.bold: true; font.pixelSize: 14 | |||
| + visible: tiles == undefined | |||
| + } | |||
| + | |||
| + } | |||
95
vendor/pygments/tests/examplefiles/nanomsg.intr
| @@ -0,0 +1,95 @@ | |||
| +module: nanomsg | |||
| +synopsis: generated bindings for the nanomsg library | |||
| +author: Bruce Mitchener, Jr. | |||
| +copyright: See LICENSE file in this distribution. | |||
| + | |||
| +define simple-C-mapped-subtype <C-buffer-offset> (<C-char*>) | |||
| + export-map <machine-word>, export-function: identity; | |||
| +end; | |||
| + | |||
| +define interface | |||
| + #include { | |||
| + "sp/sp.h", | |||
| + "sp/fanin.h", | |||
| + "sp/inproc.h", | |||
| + "sp/pair.h", | |||
| + "sp/reqrep.h", | |||
| + "sp/survey.h", | |||
| + "sp/fanout.h", | |||
| + "sp/ipc.h", | |||
| + "sp/pubsub.h", | |||
| + "sp/tcp.h" | |||
| + }, | |||
| + | |||
| + exclude: { | |||
| + "SP_HAUSNUMERO", | |||
| + "SP_PAIR_ID", | |||
| + "SP_PUBSUB_ID", | |||
| + "SP_REQREP_ID", | |||
| + "SP_FANIN_ID", | |||
| + "SP_FANOUT_ID", | |||
| + "SP_SURVEY_ID" | |||
| + }, | |||
| + | |||
| + equate: {"char *" => <c-string>}, | |||
| + | |||
| + rename: { | |||
| + "sp_recv" => %sp-recv, | |||
| + "sp_send" => %sp-send, | |||
| + "sp_setsockopt" => %sp-setsockopt | |||
| + }; | |||
| + | |||
| + function "sp_version", | |||
| + output-argument: 1, | |||
| + output-argument: 2, | |||
| + output-argument: 3; | |||
| + | |||
| + function "sp_send", | |||
| + map-argument: { 2 => <C-buffer-offset> }; | |||
| + | |||
| + function "sp_recv", | |||
| + map-argument: { 2 => <C-buffer-offset> }; | |||
| + | |||
| +end interface; | |||
| + | |||
| +// Function for adding the base address of the repeated slots of a <buffer> | |||
| +// to an offset and returning the result as a <machine-word>. This is | |||
| +// necessary for passing <buffer> contents across the FFI. | |||
| + | |||
| +define function buffer-offset | |||
| + (the-buffer :: <buffer>, data-offset :: <integer>) | |||
| + => (result-offset :: <machine-word>) | |||
| + u%+(data-offset, | |||
| + primitive-wrap-machine-word | |||
| + (primitive-repeated-slot-as-raw | |||
| + (the-buffer, primitive-repeated-slot-offset(the-buffer)))) | |||
| +end function; | |||
| + | |||
| +define inline function sp-send (socket :: <integer>, data :: <buffer>, flags :: <integer>) => (res :: <integer>) | |||
| + %sp-send(socket, buffer-offset(data, 0), data.size, flags) | |||
| +end; | |||
| + | |||
| +define inline function sp-recv (socket :: <integer>, data :: <buffer>, flags :: <integer>) => (res :: <integer>) | |||
| + %sp-recv(socket, buffer-offset(data, 0), data.size, flags); | |||
| +end; | |||
| + | |||
| +define inline method sp-setsockopt (socket :: <integer>, level :: <integer>, option :: <integer>, value :: <integer>) | |||
| + with-stack-structure (int :: <C-int*>) | |||
| + pointer-value(int) := value; | |||
| + let setsockopt-result = | |||
| + %sp-setsockopt(socket, level, option, int, size-of(<C-int*>)); | |||
| + if (setsockopt-result < 0) | |||
| + // Check error! | |||
| + end; | |||
| + setsockopt-result | |||
| + end; | |||
| +end; | |||
| + | |||
| +define inline method sp-setsockopt (socket :: <integer>, level :: <integer>, option :: <integer>, data :: <byte-string>) | |||
| + let setsockopt-result = | |||
| + %sp-setsockopt(socket, level, option, as(<c-string>, data), data.size); | |||
| + if (setsockopt-result < 0) | |||
| + // Check error! | |||
| + end; | |||
| + setsockopt-result | |||
| +end; | |||
163
vendor/pygments/tests/examplefiles/phpMyAdmin.spec
| @@ -0,0 +1,163 @@ | |||
| +%define _myadminpath /var/www/myadmin | |||
| +%define pkgrelease rc1 | |||
| +%define microrelease 1 | |||
| + | |||
| +Name: phpMyAdmin | |||
| +Version: 3.1.1 | |||
| +Release: %{pkgrelease}.%{microrelease} | |||
| +License: GPL | |||
| +Group: Applications/Databases/Interfaces | |||
| +Source0: http://prdownloads.sourceforge.net/phpmyadmin/%{name}-%{version}-%{pkgrelease}.tar.bz2 | |||
| +Source1: phpMyAdmin-http.conf | |||
| +URL: http://sourceforge.net/projects/phpmyadmin/ | |||
| +Requires: mysql | |||
| +Requires: php-mysql | |||
| +Buildarch: noarch | |||
| +#BuildRoot: %{_tmppath}/%{name}-root | |||
| + | |||
| +Summary: phpMyAdmin - web-based MySQL administration | |||
| + | |||
| +%description | |||
| +phpMyAdmin can manage a whole MySQL-server (needs a super-user) but | |||
| +also a single database. To accomplish the latter you'll need a | |||
| +properly set up MySQL-user which can read/write only the desired | |||
| +database. It's up to you to look up the appropiate part in the MySQL | |||
| +manual. Currently phpMyAdmin can: | |||
| + - create and drop databases | |||
| + - create, copy, drop and alter tables | |||
| + - delete, edit and add fields | |||
| + - execute any SQL-statement, even batch-queries | |||
| + - manage keys on fields | |||
| + - load text files into tables | |||
| + - create (*) and read dumps of tables | |||
| + - export (*) and import data to CSV values | |||
| + - administer multiple servers and single databases | |||
| + - check referencial integrity | |||
| + - create complex queries automatically connecting required tables | |||
| + - create PDF graphics of your database layout | |||
| + - communicate in more than 38 different languages | |||
| + | |||
| + | |||
| +%prep | |||
| +%setup -q -n %{name}-%{version}-%{pkgrelease} | |||
| + | |||
| + | |||
| +%build | |||
| + | |||
| + | |||
| +%install | |||
| +[ "${RPM_BUILD_ROOT}" != "/" ] && [ -d "${RPM_BUILD_ROOT}" ] && \ | |||
| + rm -rf "${RPM_BUILD_ROOT}" | |||
| + | |||
| +# Create directories. | |||
| + | |||
| +install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/{css,js,lang,libraries,themes} | |||
| +install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/libraries/{auth,dbg,dbi,engines} | |||
| +install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/libraries/{export,tcpdf,import} | |||
| +install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/libraries/transformations | |||
| +install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/libraries/tcpdf/font | |||
| +install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/themes/{darkblue_orange,original} | |||
| +install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/themes/darkblue_orange/{css,img} | |||
| +install -d "${RPM_BUILD_ROOT}%{_myadminpath}"/themes/original/{css,img} | |||
| + | |||
| +# Install files. | |||
| + | |||
| +install libraries/config.default.php \ | |||
| + "${RPM_BUILD_ROOT}%{_myadminpath}"/config.inc.php | |||
| +install *.{php,ico} "${RPM_BUILD_ROOT}%{_myadminpath}"/ | |||
| +install ChangeLog LICENSE README "${RPM_BUILD_ROOT}%{_myadminpath}"/ | |||
| +install Documentation.html docs.css "${RPM_BUILD_ROOT}%{_myadminpath}"/ | |||
| +install css/* "${RPM_BUILD_ROOT}%{_myadminpath}/css"/ | |||
| +install js/* "${RPM_BUILD_ROOT}%{_myadminpath}/js"/ | |||
| +install lang/*.php "${RPM_BUILD_ROOT}%{_myadminpath}/lang"/ | |||
| +install libraries/*.php "${RPM_BUILD_ROOT}%{_myadminpath}/libraries"/ | |||
| +install libraries/auth/*.php "${RPM_BUILD_ROOT}%{_myadminpath}/libraries/auth"/ | |||
| +install libraries/dbg/*.php "${RPM_BUILD_ROOT}%{_myadminpath}/libraries/dbg"/ | |||
| +install libraries/dbi/*.php "${RPM_BUILD_ROOT}%{_myadminpath}/libraries/dbi"/ | |||
| +install libraries/engines/*.php \ | |||
| + "${RPM_BUILD_ROOT}%{_myadminpath}/libraries/engines"/ | |||
| +install libraries/export/*.php \ | |||
| + "${RPM_BUILD_ROOT}%{_myadminpath}/libraries/export"/ | |||
| +install libraries/tcpdf/*.php "${RPM_BUILD_ROOT}%{_myadminpath}/libraries/tcpdf"/ | |||
| +install libraries/tcpdf/font/*.{php,z} \ | |||
| + "${RPM_BUILD_ROOT}%{_myadminpath}/libraries/tcpdf/font"/ | |||
| +install libraries/import/*.php \ | |||
| + "${RPM_BUILD_ROOT}%{_myadminpath}/libraries/import"/ | |||
| +install libraries/transformations/*.php \ | |||
| + "${RPM_BUILD_ROOT}%{_myadminpath}/libraries/transformations"/ | |||
| +install themes/darkblue_orange/*.{php,png} \ | |||
| + "${RPM_BUILD_ROOT}%{_myadminpath}/themes/darkblue_orange"/ | |||
| +install themes/darkblue_orange/css/*.php \ | |||
| + "${RPM_BUILD_ROOT}%{_myadminpath}/themes/darkblue_orange/css"/ | |||
| +install themes/darkblue_orange/img/*.{png,ico} \ | |||
| + "${RPM_BUILD_ROOT}%{_myadminpath}/themes/darkblue_orange/img"/ | |||
| +install themes/original/*.{php,png} \ | |||
| + "${RPM_BUILD_ROOT}%{_myadminpath}/themes/original"/ | |||
| +install themes/original/css/*.php \ | |||
| + "${RPM_BUILD_ROOT}%{_myadminpath}/themes/original/css"/ | |||
| +install themes/original/img/*.{png,ico} \ | |||
| + "${RPM_BUILD_ROOT}%{_myadminpath}/themes/original/img"/ | |||
| + | |||
| +# Create documentation directories. | |||
| + | |||
| +DOCROOT="${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}" | |||
| +install -d "${DOCROOT}" | |||
| +install -d "${DOCROOT}"/{lang,scripts,transformations} | |||
| + | |||
| +# Install documentation files. | |||
| + | |||
| +install RELEASE-DATE-* "${DOCROOT}"/ | |||
| +install CREDITS ChangeLog INSTALL LICENSE "${DOCROOT}"/ | |||
| +install README TODO "${DOCROOT}"/ | |||
| +install Documentation.* docs.css "${DOCROOT}"/ | |||
| +install translators.html "${DOCROOT}"/ | |||
| +install lang/*.sh "${DOCROOT}"/lang/ | |||
| +install scripts/* "${DOCROOT}"/scripts/ | |||
| +install libraries/tcpdf/README "${DOCROOT}"/README.tcpdf | |||
| +install libraries/import/README "${DOCROOT}"/README.import | |||
| +install libraries/transformations/README "${DOCROOT}"/transformations/ | |||
| +install libraries/transformations/TEMPLATE* "${DOCROOT}"/transformations/ | |||
| +install libraries/transformations/*.sh "${DOCROOT}"/transformations/ | |||
| + | |||
| +# Install configuration file for Apache. | |||
| + | |||
| +install -d "${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf.d" | |||
| +install "%{SOURCE1}" \ | |||
| + "${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf.d/phpMyAdmin.conf" | |||
| + | |||
| +# Generate non-configuration file list. | |||
| + | |||
| +(cd "${RPM_BUILD_ROOT}"; ls -d ."%{_myadminpath}"/*) | | |||
| + sed -e '/\/config\.inc\.php$/d' -e 's/^.//' > files.list | |||
| + | |||
| + | |||
| + | |||
| +%clean | |||
| +[ "${RPM_BUILD_ROOT}" != "/" ] && [ -d "${RPM_BUILD_ROOT}" ] && \ | |||
| + rm -rf "${RPM_BUILD_ROOT}" | |||
| + | |||
| + | |||
| +%files -f files.list | |||
| +%defattr(644, root, root, 755) | |||
| +%doc %{_docdir}/%{name}-%{version} | |||
| +%dir %{_myadminpath} | |||
| +%attr(640,root,apache) %config(noreplace) %verify(not size mtime md5) %{_myadminpath}/config.inc.php | |||
| +%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/httpd/conf.d/* | |||
| + | |||
| + | |||
| +%changelog | |||
| +* Thu Feb 23 2006 Patrick Monnerat <pm@datasphere.ch> | |||
| +- Version 2.8.0-rc1.1. | |||
| + | |||
| +* Thu Dec 22 2005 Patrick Monnerat <patrick.monnerat@econophone.ch> | |||
| +- Path "nullpw" to allow trying connection with null password after failure. | |||
| +- Version 2.7.0-pl1.1. | |||
| + | |||
| +* Mon Aug 22 2005 Patrick Monnerat <patrick.monnerat@econophone.ch> | |||
| +- Version 2.6.3-pl1. | |||
| + | |||
| +* Wed Jul 21 2004 Patrick Monnerat <patrick.monnerat@econophone.ch> | |||
| +- Version 2.5.7-pl1. | |||
| + | |||
| +* Fri Nov 22 2002 Patrick Monnerat <patrick.monnerat@econophone.ch> | |||
| +- Version 2.3.0-rc1. | |||
4
vendor/pygments/tests/examplefiles/pytb_test3.pytb
| @@ -0,0 +1,4 @@ | |||
| +>>> 3/"3" | |||
| +Traceback (most recent call last): | |||
| + File "<stdin>", line 1, in <module> | |||
| +TypeError: unsupported operand type(s) for /: 'int' and 'str' | |||
39
vendor/pygments/tests/examplefiles/robotframework.txt
| @@ -0,0 +1,39 @@ | |||
| +*** Settings *** | |||
| +Documentation Simple example demonstrating syntax highlighting. | |||
| +Library ExampleLibrary | |||
| +Test Setup Keyword argument argument with ${VARIABLE} | |||
| + | |||
| +*** Variables *** | |||
| +${VARIABLE} Variable value | |||
| +@{LIST} List variable here | |||
| + | |||
| +*** Test Cases *** | |||
| +Keyword-driven example | |||
| + Initialize System | |||
| + Do Something | |||
| + Result Should Be 42 | |||
| + [Teardown] Cleanup System | |||
| + | |||
| +Data-driven example | |||
| + [Template] Keyword | |||
| + argument1 argument2 | |||
| + argument ${VARIABLE} | |||
| + @{LIST} | |||
| + | |||
| +Gherkin | |||
| + Given system is initialized | |||
| + When something is done | |||
| + Then result should be "42" | |||
| + | |||
| +| Pipes | | |||
| +| | [Documentation] | Also pipe separated format is supported. | | |||
| +| | Log | As this example demonstrates. | | |||
| + | |||
| +*** Keywords *** | |||
| +Result Should Be | |||
| + [Arguments] ${expected} | |||
| + ${actual} = Get Value | |||
| + Should be Equal ${actual} ${expected} | |||
| + | |||
| +Then result should be "${expected}" | |||
| + Result Should Be ${expected} | |||
892
vendor/pygments/tests/examplefiles/rust_example.rs
| @@ -1,743 +1,233 @@ | |||
| - | +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT | ||
| -#[doc = "json serialization"]; | +// file at the top-level directory of this distribution and at | ||
| - | +// http://rust-lang.org/COPYRIGHT. | ||
| -import result::{result, ok, err}; | +// | ||
| -import io; | +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
| -import io::{reader_util, writer_util}; | +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
| -import map; | +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
| -import map::hashmap; | +// option. This file may not be copied, modified, or distributed | ||
| - | +// except according to those terms. | ||
| -export json; | + | ||
| -export error; | +// based on: | ||
| -export to_writer; | +// http://shootout.alioth.debian.org/u32/benchmark.php?test=nbody&lang=java | ||
| -export to_str; | + | ||
| -export from_reader; | +extern mod std; | ||
| -export from_str; | + | ||
| -export eq; | +use core::os; | ||
| - | + | ||
| -export num; | +// Using sqrt from the standard library is way slower than using libc | ||
| -export string; | +// directly even though std just calls libc, I guess it must be | ||
| -export boolean; | +// because the the indirection through another dynamic linker | ||
| -export list; | +// stub. Kind of shocking. Might be able to make it faster still with | ||
| -export dict; | +// an llvm intrinsic. | ||
| -export null; | +#[nolink] | ||
| - | +extern mod libc { | ||
| -#[doc = "Represents a json value"] | + #[legacy_exports]; | ||
| -enum json { | + fn sqrt(n: float) -> float; | ||
| - num(float), | |||
| - string(str), | |||
| - boolean(bool), | |||
| - list([json]), | |||
| - dict(map::hashmap<str,json>), | |||
| - null, | |||
| } | } | ||
| -type error = { | +fn main() { | ||
| - line: uint, | + let args = os::args(); | ||
| - col: uint, | + let args = if os::getenv(~"RUST_BENCH").is_some() { | ||
| - msg: str, | + ~[~"", ~"4000000"] | ||
| -}; | + } else if args.len() <= 1u { | ||
| - | + ~[~"", ~"100000"] | ||
| -#[doc = "Serializes a json value into a io::writer"] | + } else { | ||
| -fn to_writer(wr: io::writer, j: json) { | + args | ||
| - alt j { | + }; | ||
| - num(n) { wr.write_str(float::to_str(n, 6u)); } | + let n = int::from_str(args[1]).get(); | ||
| - string(s) { | + let mut bodies: ~[Body::props] = NBodySystem::make(); | ||
| - wr.write_char('"'); | + io::println(fmt!("%f", NBodySystem::energy(bodies))); | ||
| - let mut escaped = ""; | + let mut i = 0; | ||
| - str::chars_iter(s) { |c| | + while i < n { | ||
| - alt c { | + NBodySystem::advance(bodies, 0.01); | ||
| - '"' { escaped += "\\\""; } | + i += 1; | ||
| - '\\' { escaped += "\\\\"; } | + } | ||
| - '\x08' { escaped += "\\b"; } | + io::println(fmt!("%f", NBodySystem::energy(bodies))); | ||
| - '\x0c' { escaped += "\\f"; } | |||
| - '\n' { escaped += "\\n"; } | |||
| - '\r' { escaped += "\\r"; } | |||
| - '\t' { escaped += "\\t"; } | |||
| - _ { escaped += str::from_char(c); } | |||
| - } | |||
| - }; | |||
| - wr.write_str(escaped); | |||
| - wr.write_char('"'); | |||
| - } | |||
| - boolean(b) { | |||
| - wr.write_str(if b { "true" } else { "false" }); | |||
| - } | |||
| - list(v) { | |||
| - wr.write_char('['); | |||
| - let mut first = true; | |||
| - vec::iter(v) { |item| | |||
| - if !first { | |||
| - wr.write_str(", "); | |||
| - } | |||
| - first = false; | |||
| - to_writer(wr, item); | |||
| - }; | |||
| - wr.write_char(']'); | |||
| - } | |||
| - dict(d) { | |||
| - if d.size() == 0u { | |||
| - wr.write_str("{}"); | |||
| - ret; | |||
| - } | |||
| - | |||
| - wr.write_str("{ "); | |||
| - let mut first = true; | |||
| - d.items { |key, value| | |||
| - if !first { | |||
| - wr.write_str(", "); | |||
| - } | |||
| - first = false; | |||
| - to_writer(wr, string(key)); | |||
| - wr.write_str(": "); | |||
| - to_writer(wr, value); | |||
| - }; | |||
| - wr.write_str(" }"); | |||
| - } | |||
| - null { | |||
| - wr.write_str("null"); | |||
| - } | |||
| - } | |||
| } | } | ||
| -#[doc = "Serializes a json value into a string"] | +mod NBodySystem { | ||
| -fn to_str(j: json) -> str { | + use Body; | ||
| - io::with_str_writer { |wr| to_writer(wr, j) } | |||
| -} | |||
| -type parser = { | + pub fn make() -> ~[Body::props] { | ||
| - rdr: io::reader, | + let mut bodies: ~[Body::props] = | ||
| - mut ch: char, | + ~[Body::sun(), | ||
| - mut line: uint, | + Body::jupiter(), | ||
| - mut col: uint, | + Body::saturn(), | ||
| -}; | + Body::uranus(), | ||
| + Body::neptune()]; | |||
| -impl parser for parser { | + let mut px = 0.0; | ||
| - fn eof() -> bool { self.ch == -1 as char } | + let mut py = 0.0; | ||
| + let mut pz = 0.0; | |||
| - fn bump() { | + let mut i = 0; | ||
| - self.ch = self.rdr.read_char(); | + while i < 5 { | ||
| + px += bodies[i].vx * bodies[i].mass; | |||
| + py += bodies[i].vy * bodies[i].mass; | |||
| + pz += bodies[i].vz * bodies[i].mass; | |||
| - if self.ch == '\n' { | + i += 1; | ||
| - self.line += 1u; | |||
| - self.col = 1u; | |||
| - } else { | |||
| - self.col += 1u; | |||
| } | } | ||
| - } | |||
| - fn next_char() -> char { | + // side-effecting | ||
| - self.bump(); | + Body::offset_momentum(&mut bodies[0], px, py, pz); | ||
| - self.ch | |||
| - } | |||
| - fn error<T>(msg: str) -> result<T, error> { | + return bodies; | ||
| - err({ line: self.line, col: self.col, msg: msg }) | |||
| } | } | ||
| - fn parse() -> result<json, error> { | + pub fn advance(bodies: &mut [Body::props], dt: float) { | ||
| - alt self.parse_value() { | + let mut i = 0; | ||
| - ok(value) { | + while i < 5 { | ||
| - // Skip trailing whitespaces. | + let mut j = i + 1; | ||
| - self.parse_whitespace(); | + while j < 5 { | ||
| - // Make sure there is no trailing characters. | + advance_one(&mut bodies[i], | ||
| - if self.eof() { | + &mut bodies[j], dt); | ||
| - ok(value) | + j += 1; | ||
| - } else { | |||
| - self.error("trailing characters") | |||
| } | } | ||
| - } | |||
| - e { e } | |||
| - } | |||
| - } | |||
| - fn parse_value() -> result<json, error> { | + i += 1; | ||
| - self.parse_whitespace(); | |||
| - | |||
| - if self.eof() { ret self.error("EOF while parsing value"); } | |||
| - | |||
| - alt self.ch { | |||
| - 'n' { self.parse_ident("ull", null) } | |||
| - 't' { self.parse_ident("rue", boolean(true)) } | |||
| - 'f' { self.parse_ident("alse", boolean(false)) } | |||
| - '0' to '9' | '-' { self.parse_number() } | |||
| - '"' { | |||
| - alt self.parse_str() { | |||
| - ok(s) { ok(string(s)) } | |||
| - err(e) { err(e) } | |||
| - } | |||
| - } | |||
| - '[' { self.parse_list() } | |||
| - '{' { self.parse_object() } | |||
| - _ { self.error("invalid syntax") } | |||
| } | } | ||
| - } | |||
| - fn parse_whitespace() { | + i = 0; | ||
| - while char::is_whitespace(self.ch) { self.bump(); } | + while i < 5 { | ||
| - } | + move_(&mut bodies[i], dt); | ||
| - | + i += 1; | ||
| - fn parse_ident(ident: str, value: json) -> result<json, error> { | |||
| - if str::all(ident, { |c| c == self.next_char() }) { | |||
| - self.bump(); | |||
| - ok(value) | |||
| - } else { | |||
| - self.error("invalid syntax") | |||
| } | } | ||
| } | } | ||
| - fn parse_number() -> result<json, error> { | + pub fn advance_one(bi: &mut Body::props, | ||
| - let mut neg = 1f; | + bj: &mut Body::props, | ||
| + dt: float) unsafe { | |||
| + let dx = bi.x - bj.x; | |||
| + let dy = bi.y - bj.y; | |||
| + let dz = bi.z - bj.z; | |||
| - if self.ch == '-' { | + let dSquared = dx * dx + dy * dy + dz * dz; | ||
| - self.bump(); | |||
| - neg = -1f; | |||
| - } | |||
| - let mut res = alt self.parse_integer() { | + let distance = ::libc::sqrt(dSquared); | ||
| - ok(res) { res } | + let mag = dt / (dSquared * distance); | ||
| - err(e) { ret err(e); } | |||
| - }; | |||
| - if self.ch == '.' { | + bi.vx -= dx * bj.mass * mag; | ||
| - alt self.parse_decimal(res) { | + bi.vy -= dy * bj.mass * mag; | ||
| - ok(r) { res = r; } | + bi.vz -= dz * bj.mass * mag; | ||
| - err(e) { ret err(e); } | |||
| - } | |||
| - } | |||
| - | |||
| - if self.ch == 'e' || self.ch == 'E' { | |||
| - alt self.parse_exponent(res) { | |||
| - ok(r) { res = r; } | |||
| - err(e) { ret err(e); } | |||
| - } | |||
| - } | |||
| - ok(num(neg * res)) | + bj.vx += dx * bi.mass * mag; | ||
| + bj.vy += dy * bi.mass * mag; | |||
| + bj.vz += dz * bi.mass * mag; | |||
| } | } | ||
| - fn parse_integer() -> result<float, error> { | + pub fn move_(b: &mut Body::props, dt: float) { | ||
| - let mut res = 0f; | + b.x += dt * b.vx; | ||
| - | + b.y += dt * b.vy; | ||
| - alt self.ch { | + b.z += dt * b.vz; | ||
| - '0' { | |||
| - self.bump(); | |||
| - | |||
| - // There can be only one leading '0'. | |||
| - alt self.ch { | |||
| - '0' to '9' { ret self.error("invalid number"); } | |||
| - _ {} | |||
| - } | |||
| - } | |||
| - '1' to '9' { | |||
| - while !self.eof() { | |||
| - alt self.ch { | |||
| - '0' to '9' { | |||
| - res *= 10f; | |||
| - res += ((self.ch as int) - ('0' as int)) as float; | |||
| - | |||
| - self.bump(); | |||
| - } | |||
| - _ { break; } | |||
| - } | |||
| - } | |||
| - } | |||
| - _ { ret self.error("invalid number"); } | |||
| - } | |||
| - | |||
| - ok(res) | |||
| } | } | ||
| - fn parse_decimal(res: float) -> result<float, error> { | + pub fn energy(bodies: &[Body::props]) -> float unsafe { | ||
| - self.bump(); | + let mut dx; | ||
| + let mut dy; | |||
| + let mut dz; | |||
| + let mut distance; | |||
| + let mut e = 0.0; | |||
| - // Make sure a digit follows the decimal place. | + let mut i = 0; | ||
| - alt self.ch { | + while i < 5 { | ||
| - '0' to '9' {} | + e += | ||
| - _ { ret self.error("invalid number"); } | + 0.5 * bodies[i].mass * | ||
| - } | + (bodies[i].vx * bodies[i].vx + bodies[i].vy * bodies[i].vy | ||
| - | + + bodies[i].vz * bodies[i].vz); | ||
| - let mut res = res; | |||
| - let mut dec = 1f; | |||
| - while !self.eof() { | |||
| - alt self.ch { | |||
| - '0' to '9' { | |||
| - dec /= 10f; | |||
| - res += (((self.ch as int) - ('0' as int)) as float) * dec; | |||
| - | |||
| - self.bump(); | |||
| - } | |||
| - _ { break; } | |||
| - } | |||
| - } | |||
| - | |||
| - ok(res) | |||
| - } | |||
| - | |||
| - fn parse_exponent(res: float) -> result<float, error> { | |||
| - self.bump(); | |||
| - let mut res = res; | + let mut j = i + 1; | ||
| - let mut exp = 0u; | + while j < 5 { | ||
| - let mut neg_exp = false; | + dx = bodies[i].x - bodies[j].x; | ||
| + dy = bodies[i].y - bodies[j].y; | |||
| + dz = bodies[i].z - bodies[j].z; | |||
| - alt self.ch { | + distance = ::libc::sqrt(dx * dx + dy * dy + dz * dz); | ||
| - '+' { self.bump(); } | + e -= bodies[i].mass * bodies[j].mass / distance; | ||
| - '-' { self.bump(); neg_exp = true; } | |||
| - _ {} | |||
| - } | |||
| - | |||
| - // Make sure a digit follows the exponent place. | |||
| - alt self.ch { | |||
| - '0' to '9' {} | |||
| - _ { ret self.error("invalid number"); } | |||
| - } | |||
| - | |||
| - while !self.eof() { | |||
| - alt self.ch { | |||
| - '0' to '9' { | |||
| - exp *= 10u; | |||
| - exp += (self.ch as uint) - ('0' as uint); | |||
| - self.bump(); | + j += 1; | ||
| - } | |||
| - _ { break; } | |||
| } | } | ||
| - } | |||
| - let exp = float::pow_with_uint(10u, exp); | + i += 1; | ||
| - if neg_exp { | |||
| - res /= exp; | |||
| - } else { | |||
| - res *= exp; | |||
| } | } | ||
| + return e; | |||
| - ok(res) | |||
| - } | |||
| - | |||
| - fn parse_str() -> result<str, error> { | |||
| - let mut escape = false; | |||
| - let mut res = ""; | |||
| - | |||
| - while !self.eof() { | |||
| - self.bump(); | |||
| - | |||
| - if (escape) { | |||
| - alt self.ch { | |||
| - '"' { str::push_char(res, '"'); } | |||
| - '\\' { str::push_char(res, '\\'); } | |||
| - '/' { str::push_char(res, '/'); } | |||
| - 'b' { str::push_char(res, '\x08'); } | |||
| - 'f' { str::push_char(res, '\x0c'); } | |||
| - 'n' { str::push_char(res, '\n'); } | |||
| - 'r' { str::push_char(res, '\r'); } | |||
| - 't' { str::push_char(res, '\t'); } | |||
| - 'u' { | |||
| - // Parse \u1234. | |||
| - let mut i = 0u; | |||
| - let mut n = 0u; | |||
| - while i < 4u { | |||
| - alt self.next_char() { | |||
| - '0' to '9' { | |||
| - n = n * 10u + | |||
| - (self.ch as uint) - ('0' as uint); | |||
| - } | |||
| - _ { ret self.error("invalid \\u escape"); } | |||
| - } | |||
| - i += 1u; | |||
| - } | |||
| - | |||
| - // Error out if we didn't parse 4 digits. | |||
| - if i != 4u { | |||
| - ret self.error("invalid \\u escape"); | |||
| - } | |||
| - | |||
| - str::push_char(res, n as char); | |||
| - } | |||
| - _ { ret self.error("invalid escape"); } | |||
| - } | |||
| - escape = false; | |||
| - } else if self.ch == '\\' { | |||
| - escape = true; | |||
| - } else { | |||
| - if self.ch == '"' { | |||
| - self.bump(); | |||
| - ret ok(res); | |||
| - } | |||
| - str::push_char(res, self.ch); | |||
| - } | |||
| - } | |||
| - | |||
| - self.error("EOF while parsing string") | |||
| - } | |||
| - | |||
| - fn parse_list() -> result<json, error> { | |||
| - self.bump(); | |||
| - self.parse_whitespace(); | |||
| - | |||
| - let mut values = []; | |||
| - | |||
| - if self.ch == ']' { | |||
| - self.bump(); | |||
| - ret ok(list(values)); | |||
| - } | |||
| - | |||
| - loop { | |||
| - alt self.parse_value() { | |||
| - ok(v) { vec::push(values, v); } | |||
| - e { ret e; } | |||
| - } | |||
| - | |||
| - self.parse_whitespace(); | |||
| - if self.eof() { | |||
| - ret self.error("EOF while parsing list"); | |||
| - } | |||
| - | |||
| - alt self.ch { | |||
| - ',' { self.bump(); } | |||
| - ']' { self.bump(); ret ok(list(values)); } | |||
| - _ { ret self.error("expecting ',' or ']'"); } | |||
| - } | |||
| - }; | |||
| - } | |||
| - | |||
| - fn parse_object() -> result<json, error> { | |||
| - self.bump(); | |||
| - self.parse_whitespace(); | |||
| - | |||
| - let values = map::str_hash(); | |||
| - | |||
| - if self.ch == '}' { | |||
| - self.bump(); | |||
| - ret ok(dict(values)); | |||
| - } | |||
| - | |||
| - while !self.eof() { | |||
| - self.parse_whitespace(); | |||
| - | |||
| - if self.ch != '"' { | |||
| - ret self.error("key must be a string"); | |||
| - } | |||
| - | |||
| - let key = alt self.parse_str() { | |||
| - ok(key) { key } | |||
| - err(e) { ret err(e); } | |||
| - }; | |||
| - | |||
| - self.parse_whitespace(); | |||
| - | |||
| - if self.ch != ':' { | |||
| - if self.eof() { break; } | |||
| - ret self.error("expecting ':'"); | |||
| - } | |||
| - self.bump(); | |||
| - | |||
| - alt self.parse_value() { | |||
| - ok(value) { values.insert(key, value); } | |||
| - e { ret e; } | |||
| - } | |||
| - self.parse_whitespace(); | |||
| - | |||
| - alt self.ch { | |||
| - ',' { self.bump(); } | |||
| - '}' { self.bump(); ret ok(dict(values)); } | |||
| - _ { | |||
| - if self.eof() { break; } | |||
| - ret self.error("expecting ',' or '}'"); | |||
| - } | |||
| - } | |||
| - } | |||
| - | |||
| - ret self.error("EOF while parsing object"); | |||
| - } | |||
| -} | |||
| - | |||
| -#[doc = "Deserializes a json value from an io::reader"] | |||
| -fn from_reader(rdr: io::reader) -> result<json, error> { | |||
| - let parser = { | |||
| - rdr: rdr, | |||
| - mut ch: rdr.read_char(), | |||
| - mut line: 1u, | |||
| - mut col: 1u, | |||
| - }; | |||
| - | |||
| - parser.parse() | |||
| -} | |||
| - | |||
| -#[doc = "Deserializes a json value from a string"] | |||
| -fn from_str(s: str) -> result<json, error> { | |||
| - io::with_str_reader(s, from_reader) | |||
| -} | |||
| - | |||
| -#[doc = "Test if two json values are equal"] | |||
| -fn eq(value0: json, value1: json) -> bool { | |||
| - alt (value0, value1) { | |||
| - (num(f0), num(f1)) { f0 == f1 } | |||
| - (string(s0), string(s1)) { s0 == s1 } | |||
| - (boolean(b0), boolean(b1)) { b0 == b1 } | |||
| - (list(l0), list(l1)) { vec::all2(l0, l1, eq) } | |||
| - (dict(d0), dict(d1)) { | |||
| - if d0.size() == d1.size() { | |||
| - let mut equal = true; | |||
| - d0.items { |k, v0| | |||
| - alt d1.find(k) { | |||
| - some(v1) { | |||
| - if !eq(v0, v1) { equal = false; } } | |||
| - none { equal = false; } | |||
| - } | |||
| - }; | |||
| - equal | |||
| - } else { | |||
| - false | |||
| - } | |||
| - } | |||
| - (null, null) { true } | |||
| - _ { false } | |||
| } | } | ||
| } | } | ||
| -#[cfg(test)] | +mod Body { | ||
| -mod tests { | + use Body; | ||
| - fn mk_dict(items: [(str, json)]) -> json { | + | ||
| - let d = map::str_hash(); | + pub const PI: float = 3.141592653589793; | ||
| - | + pub const SOLAR_MASS: float = 39.478417604357432; | ||
| - vec::iter(items) { |item| | + // was 4 * PI * PI originally | ||
| - let (key, value) = item; | + pub const DAYS_PER_YEAR: float = 365.24; | ||
| - d.insert(key, value); | + | ||
| - }; | + pub type props = | ||
| - | + {mut x: float, | ||
| - dict(d) | + mut y: float, | ||
| - } | + mut z: float, | ||
| - | + mut vx: float, | ||
| - #[test] | + mut vy: float, | ||
| - fn test_write_null() { | + mut vz: float, | ||
| - assert to_str(null) == "null"; | + mass: float}; | ||
| - } | + | ||
| - | + pub fn jupiter() -> Body::props { | ||
| - #[test] | + return {mut x: 4.84143144246472090e+00, | ||
| - fn test_write_num() { | + mut y: -1.16032004402742839e+00, | ||
| - assert to_str(num(3f)) == "3"; | + mut z: -1.03622044471123109e-01, | ||
| - assert to_str(num(3.1f)) == "3.1"; | + mut vx: 1.66007664274403694e-03 * DAYS_PER_YEAR, | ||
| - assert to_str(num(-1.5f)) == "-1.5"; | + mut vy: 7.69901118419740425e-03 * DAYS_PER_YEAR, | ||
| - assert to_str(num(0.5f)) == "0.5"; | + mut vz: -6.90460016972063023e-05 * DAYS_PER_YEAR, | ||
| - } | + mass: 9.54791938424326609e-04 * SOLAR_MASS}; | ||
| - | + } | ||
| - #[test] | + | ||
| - fn test_write_str() { | + pub fn saturn() -> Body::props { | ||
| - assert to_str(string("")) == "\"\""; | + return {mut x: 8.34336671824457987e+00, | ||
| - assert to_str(string("foo")) == "\"foo\""; | + mut y: 4.12479856412430479e+00, | ||
| - } | + mut z: -4.03523417114321381e-01, | ||
| - | + mut vx: -2.76742510726862411e-03 * DAYS_PER_YEAR, | ||
| - #[test] | + mut vy: 4.99852801234917238e-03 * DAYS_PER_YEAR, | ||
| - fn test_write_bool() { | + mut vz: 2.30417297573763929e-05 * DAYS_PER_YEAR, | ||
| - assert to_str(boolean(true)) == "true"; | + mass: 2.85885980666130812e-04 * SOLAR_MASS}; | ||
| - assert to_str(boolean(false)) == "false"; | + } | ||
| - } | + | ||
| - | + pub fn uranus() -> Body::props { | ||
| - #[test] | + return {mut x: 1.28943695621391310e+01, | ||
| - fn test_write_list() { | + mut y: -1.51111514016986312e+01, | ||
| - assert to_str(list([])) == "[]"; | + mut z: -2.23307578892655734e-01, | ||
| - assert to_str(list([boolean(true)])) == "[true]"; | + mut vx: 2.96460137564761618e-03 * DAYS_PER_YEAR, | ||
| - assert to_str(list([ | + mut vy: 2.37847173959480950e-03 * DAYS_PER_YEAR, | ||
| - boolean(false), | + mut vz: -2.96589568540237556e-05 * DAYS_PER_YEAR, | ||
| - null, | + mass: 4.36624404335156298e-05 * SOLAR_MASS}; | ||
| - list([string("foo\nbar"), num(3.5f)]) | + } | ||
| - ])) == "[false, null, [\"foo\\nbar\", 3.5]]"; | + | ||
| - } | + pub fn neptune() -> Body::props { | ||
| - | + return {mut x: 1.53796971148509165e+01, | ||
| - #[test] | + mut y: -2.59193146099879641e+01, | ||
| - fn test_write_dict() { | + mut z: 1.79258772950371181e-01, | ||
| - assert to_str(mk_dict([])) == "{}"; | + mut vx: 2.68067772490389322e-03 * DAYS_PER_YEAR, | ||
| - assert to_str(mk_dict([("a", boolean(true))])) == "{ \"a\": true }"; | + mut vy: 1.62824170038242295e-03 * DAYS_PER_YEAR, | ||
| - assert to_str(mk_dict([ | + mut vz: -9.51592254519715870e-05 * DAYS_PER_YEAR, | ||
| - ("a", boolean(true)), | + mass: 5.15138902046611451e-05 * SOLAR_MASS}; | ||
| - ("b", list([ | + } | ||
| - mk_dict([("c", string("\x0c\r"))]), | + | ||
| - mk_dict([("d", string(""))]) | + pub fn sun() -> Body::props { | ||
| - ])) | + return {mut x: 0.0, | ||
| - ])) == | + mut y: 0.0, | ||
| - "{ " + | + mut z: 0.0, | ||
| - "\"a\": true, " + | + mut vx: 0.0, | ||
| - "\"b\": [" + | + mut vy: 0.0, | ||
| - "{ \"c\": \"\\f\\r\" }, " + | + mut vz: 0.0, | ||
| - "{ \"d\": \"\" }" + | + mass: SOLAR_MASS}; | ||
| - "]" + | + } | ||
| - " }"; | + | ||
| + pub fn offset_momentum(props: &mut Body::props, | |||
| + px: float, py: float, pz: float) { | |||
| + props.vx = -px / SOLAR_MASS; | |||
| + props.vy = -py / SOLAR_MASS; | |||
| + props.vz = -pz / SOLAR_MASS; | |||
| } | } | ||
| - #[test] | |||
| - fn test_trailing_characters() { | |||
| - assert from_str("nulla") == | |||
| - err({line: 1u, col: 5u, msg: "trailing characters"}); | |||
| - assert from_str("truea") == | |||
| - err({line: 1u, col: 5u, msg: "trailing characters"}); | |||
| - assert from_str("falsea") == | |||
| - err({line: 1u, col: 6u, msg: "trailing characters"}); | |||
| - assert from_str("1a") == | |||
| - err({line: 1u, col: 2u, msg: "trailing characters"}); | |||
| - assert from_str("[]a") == | |||
| - err({line: 1u, col: 3u, msg: "trailing characters"}); | |||
| - assert from_str("{}a") == | |||
| - err({line: 1u, col: 3u, msg: "trailing characters"}); | |||
| - } | |||
| - | |||
| - #[test] | |||
| - fn test_read_identifiers() { | |||
| - assert from_str("n") == | |||
| - err({line: 1u, col: 2u, msg: "invalid syntax"}); | |||
| - assert from_str("nul") == | |||
| - err({line: 1u, col: 4u, msg: "invalid syntax"}); | |||
| - | |||
| - assert from_str("t") == | |||
| - err({line: 1u, col: 2u, msg: "invalid syntax"}); | |||
| - assert from_str("truz") == | |||
| - err({line: 1u, col: 4u, msg: "invalid syntax"}); | |||
| - | |||
| - assert from_str("f") == | |||
| - err({line: 1u, col: 2u, msg: "invalid syntax"}); | |||
| - assert from_str("faz") == | |||
| - err({line: 1u, col: 3u, msg: "invalid syntax"}); | |||
| - | |||
| - assert from_str("null") == ok(null); | |||
| - assert from_str("true") == ok(boolean(true)); | |||
| - assert from_str("false") == ok(boolean(false)); | |||
| - assert from_str(" null ") == ok(null); | |||
| - assert from_str(" true ") == ok(boolean(true)); | |||
| - assert from_str(" false ") == ok(boolean(false)); | |||
| - } | |||
| - | |||
| - #[test] | |||
| - fn test_read_num() { | |||
| - assert from_str("+") == | |||
| - err({line: 1u, col: 1u, msg: "invalid syntax"}); | |||
| - assert from_str(".") == | |||
| - err({line: 1u, col: 1u, msg: "invalid syntax"}); | |||
| - | |||
| - assert from_str("-") == | |||
| - err({line: 1u, col: 2u, msg: "invalid number"}); | |||
| - assert from_str("00") == | |||
| - err({line: 1u, col: 2u, msg: "invalid number"}); | |||
| - assert from_str("1.") == | |||
| - err({line: 1u, col: 3u, msg: "invalid number"}); | |||
| - assert from_str("1e") == | |||
| - err({line: 1u, col: 3u, msg: "invalid number"}); | |||
| - assert from_str("1e+") == | |||
| - err({line: 1u, col: 4u, msg: "invalid number"}); | |||
| - | |||
| - assert from_str("3") == ok(num(3f)); | |||
| - assert from_str("3.1") == ok(num(3.1f)); | |||
| - assert from_str("-1.2") == ok(num(-1.2f)); | |||
| - assert from_str("0.4") == ok(num(0.4f)); | |||
| - assert from_str("0.4e5") == ok(num(0.4e5f)); | |||
| - assert from_str("0.4e+15") == ok(num(0.4e15f)); | |||
| - assert from_str("0.4e-01") == ok(num(0.4e-01f)); | |||
| - assert from_str(" 3 ") == ok(num(3f)); | |||
| - } | |||
| - | |||
| - #[test] | |||
| - fn test_read_str() { | |||
| - assert from_str("\"") == | |||
| - err({line: 1u, col: 2u, msg: "EOF while parsing string"}); | |||
| - assert from_str("\"lol") == | |||
| - err({line: 1u, col: 5u, msg: "EOF while parsing string"}); | |||
| - | |||
| - assert from_str("\"\"") == ok(string("")); | |||
| - assert from_str("\"foo\"") == ok(string("foo")); | |||
| - assert from_str("\"\\\"\"") == ok(string("\"")); | |||
| - assert from_str("\"\\b\"") == ok(string("\x08")); | |||
| - assert from_str("\"\\n\"") == ok(string("\n")); | |||
| - assert from_str("\"\\r\"") == ok(string("\r")); | |||
| - assert from_str("\"\\t\"") == ok(string("\t")); | |||
| - assert from_str(" \"foo\" ") == ok(string("foo")); | |||
| - } | |||
| - | |||
| - #[test] | |||
| - fn test_read_list() { | |||
| - assert from_str("[") == | |||
| - err({line: 1u, col: 2u, msg: "EOF while parsing value"}); | |||
| - assert from_str("[1") == | |||
| - err({line: 1u, col: 3u, msg: "EOF while parsing list"}); | |||
| - assert from_str("[1,") == | |||
| - err({line: 1u, col: 4u, msg: "EOF while parsing value"}); | |||
| - assert from_str("[1,]") == | |||
| - err({line: 1u, col: 4u, msg: "invalid syntax"}); | |||
| - assert from_str("[6 7]") == | |||
| - err({line: 1u, col: 4u, msg: "expecting ',' or ']'"}); | |||
| - | |||
| - assert from_str("[]") == ok(list([])); | |||
| - assert from_str("[ ]") == ok(list([])); | |||
| - assert from_str("[true]") == ok(list([boolean(true)])); | |||
| - assert from_str("[ false ]") == ok(list([boolean(false)])); | |||
| - assert from_str("[null]") == ok(list([null])); | |||
| - assert from_str("[3, 1]") == ok(list([num(3f), num(1f)])); | |||
| - assert from_str("\n[3, 2]\n") == ok(list([num(3f), num(2f)])); | |||
| - assert from_str("[2, [4, 1]]") == | |||
| - ok(list([num(2f), list([num(4f), num(1f)])])); | |||
| - } | |||
| - | |||
| - #[test] | |||
| - fn test_read_dict() { | |||
| - assert from_str("{") == | |||
| - err({line: 1u, col: 2u, msg: "EOF while parsing object"}); | |||
| - assert from_str("{ ") == | |||
| - err({line: 1u, col: 3u, msg: "EOF while parsing object"}); | |||
| - assert from_str("{1") == | |||
| - err({line: 1u, col: 2u, msg: "key must be a string"}); | |||
| - assert from_str("{ \"a\"") == | |||
| - err({line: 1u, col: 6u, msg: "EOF while parsing object"}); | |||
| - assert from_str("{\"a\"") == | |||
| - err({line: 1u, col: 5u, msg: "EOF while parsing object"}); | |||
| - assert from_str("{\"a\" ") == | |||
| - err({line: 1u, col: 6u, msg: "EOF while parsing object"}); | |||
| - | |||
| - assert from_str("{\"a\" 1") == | |||
| - err({line: 1u, col: 6u, msg: "expecting ':'"}); | |||
| - assert from_str("{\"a\":") == | |||
| - err({line: 1u, col: 6u, msg: "EOF while parsing value"}); | |||
| - assert from_str("{\"a\":1") == | |||
| - err({line: 1u, col: 7u, msg: "EOF while parsing object"}); | |||
| - assert from_str("{\"a\":1 1") == | |||
| - err({line: 1u, col: 8u, msg: "expecting ',' or '}'"}); | |||
| - assert from_str("{\"a\":1,") == | |||
| - err({line: 1u, col: 8u, msg: "EOF while parsing object"}); | |||
| - | |||
| - assert eq(result::get(from_str("{}")), mk_dict([])); | |||
| - assert eq(result::get(from_str("{\"a\": 3}")), | |||
| - mk_dict([("a", num(3.0f))])); | |||
| - | |||
| - assert eq(result::get(from_str("{ \"a\": null, \"b\" : true }")), | |||
| - mk_dict([("a", null), ("b", boolean(true))])); | |||
| - assert eq(result::get(from_str("\n{ \"a\": null, \"b\" : true }\n")), | |||
| - mk_dict([("a", null), ("b", boolean(true))])); | |||
| - assert eq(result::get(from_str("{\"a\" : 1.0 ,\"b\": [ true ]}")), | |||
| - mk_dict([ | |||
| - ("a", num(1.0)), | |||
| - ("b", list([boolean(true)])) | |||
| - ])); | |||
| - assert eq(result::get(from_str( | |||
| - "{" + | |||
| - "\"a\": 1.0, " + | |||
| - "\"b\": [" + | |||
| - "true," + | |||
| - "\"foo\\nbar\", " + | |||
| - "{ \"c\": {\"d\": null} } " + | |||
| - "]" + | |||
| - "}")), | |||
| - mk_dict([ | |||
| - ("a", num(1.0f)), | |||
| - ("b", list([ | |||
| - boolean(true), | |||
| - string("foo\nbar"), | |||
| - mk_dict([ | |||
| - ("c", mk_dict([("d", null)])) | |||
| - ]) | |||
| - ])) | |||
| - ])); | |||
| - } | |||
| - | |||
| - #[test] | |||
| - fn test_multiline_errors() { | |||
| - assert from_str("{\n \"foo\":\n \"bar\"") == | |||
| - err({line: 3u, col: 8u, msg: "EOF while parsing object"}); | |||
| - } | |||
| } | } | ||
9
vendor/pygments/tests/examplefiles/session.dylan-console
| @@ -0,0 +1,9 @@ | |||
| +? 7 * 52; | |||
| +=> 364 | |||
| +? define variable *your-variable* = $foo; | |||
| +? begin | |||
| + let yours = "apple"; | |||
| + let mine = yours; | |||
| + mine == yours; | |||
| + end; | |||
| +=> #t | |||
10
vendor/pygments/tests/examplefiles/test.opa
| @@ -0,0 +1,10 @@ | |||
| +function sample_page() { | |||
| + <header> | |||
| + <h3>HTML in Opa</h3> | |||
| + </header> | |||
| + <article> | |||
| + <div class=container> | |||
| + <p>Learning by examples.</p> | |||
| + </div> | |||
| + </article> | |||
| +} | |||
120
vendor/pygments/tests/examplefiles/test2.pypylog
| @@ -0,0 +1,120 @@ | |||
| +[2f1dd6c3b8b7] {jit-log-opt-loop | |||
| +# Loop 0 (<Function object at 0xb720e550> ds1dr4 dsdr3 ds1dr4) : loop with 115 ops | |||
| +[p0, p1] | |||
| ++33: label(p0, p1, descr=TargetToken(-1223434224)) | |||
| +debug_merge_point(0, 0, '<Function object at 0xb710b120> ds1dr4 dsdr3 ds1dr4') | |||
| ++33: guard_nonnull_class(p1, 138371488, descr=<Guard2>) [p1, p0] | |||
| ++54: p3 = getfield_gc_pure(p1, descr=<FieldP pyhaskell.interpreter.haskell.Substitution.inst_rhs 8>) | |||
| ++57: guard_value(p3, ConstPtr(ptr4), descr=<Guard3>) [p1, p0, p3] | |||
| ++69: p5 = getfield_gc_pure(p1, descr=<FieldP pyhaskell.interpreter.haskell.Substitution.inst_subst 12>) | |||
| ++72: p7 = getarrayitem_gc(p5, 0, descr=<ArrayP 4>) | |||
| ++75: guard_class(p7, 138371552, descr=<Guard4>) [p0, p5, p7] | |||
| ++88: p9 = getfield_gc(p7, descr=<FieldP pyhaskell.interpreter.haskell.Thunk.inst_application 8>) | |||
| ++91: guard_nonnull_class(p9, 138373024, descr=<Guard5>) [p0, p5, p7, p9] | |||
| ++109: p12 = getarrayitem_gc(p5, 1, descr=<ArrayP 4>) | |||
| ++112: guard_class(p12, 138371552, descr=<Guard6>) [p0, p5, p12, p7] | |||
| ++125: p14 = getfield_gc(p12, descr=<FieldP pyhaskell.interpreter.haskell.Thunk.inst_application 8>) | |||
| ++128: guard_nonnull_class(p14, 138373024, descr=<Guard7>) [p0, p5, p12, p14, p7] | |||
| +debug_merge_point(0, 0, 'None') | |||
| +debug_merge_point(0, 0, 'None') | |||
| ++146: p16 = getfield_gc_pure(p9, descr=<FieldP pyhaskell.interpreter.haskell.Application.inst_function 8>) | |||
| ++149: guard_value(p16, ConstPtr(ptr17), descr=<Guard8>) [p16, p9, p0, p12, p7] | |||
| ++161: p18 = getfield_gc_pure(p9, descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg0 12>) | |||
| ++164: guard_class(p18, 138371648, descr=<Guard9>) [p18, p9, p0, p12, p7] | |||
| ++177: p20 = getfield_gc_pure(p9, descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg1 16>) | |||
| ++180: guard_class(p20, 138371648, descr=<Guard10>) [p20, p9, p18, p0, p12, p7] | |||
| ++193: p22 = getfield_gc_pure(p9, descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg2 20>) | |||
| ++196: guard_class(p22, 138371936, descr=<Guard11>) [p22, p9, p20, p18, p0, p12, p7] | |||
| +debug_merge_point(0, 0, 'None') | |||
| ++209: p24 = getfield_gc_pure(p22, descr=<FieldP pyhaskell.interpreter.haskell.Application.inst_function 8>) | |||
| ++215: guard_value(p24, ConstPtr(ptr25), descr=<Guard12>) [p24, p22, p9, None, None, p0, p12, p7] | |||
| ++227: p27 = getfield_gc_pure(p22, descr=<FieldP pyhaskell.interpreter.haskell.Application1.inst_arg0 12>) | |||
| ++230: guard_class(p27, 138371648, descr=<Guard13>) [p22, p27, p9, None, None, p0, p12, p7] | |||
| +debug_merge_point(0, 0, '_') | |||
| +debug_merge_point(0, 0, 'None') | |||
| ++243: p30 = getfield_gc(ConstPtr(ptr29), descr=<FieldP pyhaskell.interpreter.module.CoreMod.inst_qvars 24>) | |||
| ++249: i34 = call(ConstClass(ll_dict_lookup_trampoline__v64___simple_call__function_ll), p30, ConstPtr(ptr32), 360200661, descr=<Calli 4 rri EF=4>) | |||
| ++281: guard_no_exception(, descr=<Guard14>) [p27, p20, p18, i34, p30, None, None, None, p0, p12, p7] | |||
| ++294: i36 = int_and(i34, -2147483648) | |||
| ++302: i37 = int_is_true(i36) | |||
| +guard_false(i37, descr=<Guard15>) [p27, p20, p18, i34, p30, None, None, None, p0, p12, p7] | |||
| ++311: p38 = getfield_gc(p30, descr=<FieldP dicttable.entries 12>) | |||
| ++314: p39 = getinteriorfield_gc(p38, i34, descr=<InteriorFieldDescr <FieldP dictentry.value 4>>) | |||
| ++318: i40 = instance_ptr_eq(p18, p39) | |||
| +guard_true(i40, descr=<Guard16>) [p27, p20, None, None, None, p0, p12, p7] | |||
| +debug_merge_point(0, 0, 'None') | |||
| ++327: i41 = getfield_gc_pure(p20, descr=<FieldS pyhaskell.interpreter.primtype.Int.inst_value 8>) | |||
| ++330: i42 = getfield_gc_pure(p27, descr=<FieldS pyhaskell.interpreter.primtype.Int.inst_value 8>) | |||
| ++333: i43 = int_sub(i41, i42) | |||
| +debug_merge_point(0, 0, 'None') | |||
| +debug_merge_point(0, 0, 'None') | |||
| +debug_merge_point(0, 0, 'None') | |||
| ++335: i45 = int_eq(0, i43) | |||
| +guard_false(i45, descr=<Guard17>) [p0, i43, None, None, None, None, p12, p7] | |||
| +p47 = new_with_vtable(138371648) | |||
| ++393: setfield_gc(p47, i43, descr=<FieldS pyhaskell.interpreter.primtype.Int.inst_value 8>) | |||
| +setfield_gc(p7, p47, descr=<FieldP pyhaskell.interpreter.haskell.Thunk.inst_application 8>) | |||
| ++414: p48 = getfield_gc(p12, descr=<FieldP pyhaskell.interpreter.haskell.Thunk.inst_application 8>) | |||
| ++420: guard_nonnull_class(p48, 138371648, descr=<Guard18>) [p0, p48, p12, p47, p7] | |||
| +debug_merge_point(0, 0, '<PrimFunction object at 0x83f3f6c> 1 <Function object at 0xb710b3b0> 1 <Function object at 0xb710b3c0> <PrimFunction object at 0x83f3f3c> 1 dsdr3 <Function object at 0xb710b210> 1') | |||
| +debug_merge_point(0, 0, 'None') | |||
| +debug_merge_point(0, 0, '_') | |||
| +debug_merge_point(0, 0, 'None') | |||
| +debug_merge_point(0, 0, 'None') | |||
| +debug_merge_point(0, 0, '<Function object at 0xb710b3d0> dsdr3 dsdr3') | |||
| +debug_merge_point(0, 0, '<Function object at 0xb710b120> ds1dr4 dsdr3 ds1dr4') | |||
| ++438: label(p0, p48, p30, p38, descr=TargetToken(-1223434176)) | |||
| +debug_merge_point(0, 0, '<Function object at 0xb710b120> ds1dr4 dsdr3 ds1dr4') | |||
| +debug_merge_point(0, 0, 'None') | |||
| +debug_merge_point(0, 0, 'None') | |||
| +debug_merge_point(0, 0, 'None') | |||
| +debug_merge_point(0, 0, '_') | |||
| +debug_merge_point(0, 0, 'None') | |||
| ++438: i50 = call(ConstClass(ll_dict_lookup_trampoline__v64___simple_call__function_ll), p30, ConstPtr(ptr32), 360200661, descr=<Calli 4 rri EF=4>) | |||
| ++464: guard_no_exception(, descr=<Guard19>) [p48, i50, p30, p0] | |||
| ++477: i51 = int_and(i50, -2147483648) | |||
| ++485: i52 = int_is_true(i51) | |||
| +guard_false(i52, descr=<Guard20>) [p48, i50, p30, p0] | |||
| ++494: p53 = getinteriorfield_gc(p38, i50, descr=<InteriorFieldDescr <FieldP dictentry.value 4>>) | |||
| ++501: i55 = instance_ptr_eq(ConstPtr(ptr54), p53) | |||
| +guard_true(i55, descr=<Guard21>) [p48, p0] | |||
| +debug_merge_point(0, 0, 'None') | |||
| ++513: i56 = getfield_gc_pure(p48, descr=<FieldS pyhaskell.interpreter.primtype.Int.inst_value 8>) | |||
| ++516: i58 = int_sub(i56, 1) | |||
| +debug_merge_point(0, 0, 'None') | |||
| +debug_merge_point(0, 0, 'None') | |||
| +debug_merge_point(0, 0, 'None') | |||
| ++519: i59 = int_eq(0, i58) | |||
| +guard_false(i59, descr=<Guard22>) [i58, p48, p0] | |||
| +debug_merge_point(0, 0, '<PrimFunction object at 0x83f3f6c> 1 <Function object at 0xb710b3b0> 1 <Function object at 0xb710b3c0> <PrimFunction object at 0x83f3f3c> 1 dsdr3 <Function object at 0xb710b210> 1') | |||
| +debug_merge_point(0, 0, 'None') | |||
| +debug_merge_point(0, 0, '_') | |||
| +debug_merge_point(0, 0, 'None') | |||
| +debug_merge_point(0, 0, 'None') | |||
| +debug_merge_point(0, 0, '<Function object at 0xb710b3d0> dsdr3 dsdr3') | |||
| +debug_merge_point(0, 0, '<Function object at 0xb710b120> ds1dr4 dsdr3 ds1dr4') | |||
| +p61 = new_with_vtable(138371700) | |||
| +p63 = new_with_vtable(138373024) | |||
| +p65 = new_with_vtable(138371936) | |||
| ++606: setfield_gc(p63, ConstPtr(ptr66), descr=<FieldP pyhaskell.interpreter.haskell.Application.inst_function 8>) | |||
| +p68 = new_with_vtable(138373024) | |||
| ++632: setfield_gc(p65, ConstPtr(ptr69), descr=<FieldP pyhaskell.interpreter.haskell.Application.inst_function 8>) | |||
| +p71 = new_with_vtable(138371936) | |||
| ++658: setfield_gc(p68, ConstPtr(ptr17), descr=<FieldP pyhaskell.interpreter.haskell.Application.inst_function 8>) | |||
| ++665: setfield_gc(p71, ConstPtr(ptr72), descr=<FieldP pyhaskell.interpreter.haskell.Application1.inst_arg0 12>) | |||
| ++672: setfield_gc(p68, p71, descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg2 20>) | |||
| ++675: setfield_gc(p68, p48, descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg1 16>) | |||
| ++678: setfield_gc(p68, ConstPtr(ptr54), descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg0 12>) | |||
| +p73 = new_with_vtable(138371648) | |||
| ++701: setfield_gc(p61, p0, descr=<FieldP pyhaskell.interpreter.haskell.StackElement.inst_next 8>) | |||
| ++716: setfield_gc(p61, 2, descr=<FieldS pyhaskell.interpreter.haskell.CopyStackElement.inst_index 16>) | |||
| ++723: setfield_gc(p71, ConstPtr(ptr25), descr=<FieldP pyhaskell.interpreter.haskell.Application.inst_function 8>) | |||
| ++730: setfield_gc(p65, p68, descr=<FieldP pyhaskell.interpreter.haskell.Application1.inst_arg0 12>) | |||
| ++733: setfield_gc(p63, p65, descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg2 20>) | |||
| ++736: setfield_gc(p63, ConstPtr(ptr75), descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg1 16>) | |||
| ++743: setfield_gc(p63, ConstPtr(ptr54), descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg0 12>) | |||
| ++750: setfield_gc(p61, p63, descr=<FieldP pyhaskell.interpreter.haskell.CopyStackElement.inst_application 12>) | |||
| ++753: setfield_gc(p73, i58, descr=<FieldS pyhaskell.interpreter.primtype.Int.inst_value 8>) | |||
| ++762: jump(p61, p73, p30, p38, descr=TargetToken(-1223434176)) | |||
| ++775: --end of the loop-- | |||
| +[2f1dd6da3b99] jit-log-opt-loop} | |||
37
vendor/pygments/tests/examplefiles/unix-io.lid
| @@ -0,0 +1,37 @@ | |||
| +Library: io | |||
| +Synopsis: A portable IO library | |||
| +Author: Gail Zacharias | |||
| +Files: library | |||
| + streams/defs | |||
| + streams/stream | |||
| + streams/sequence-stream | |||
| + streams/native-buffer | |||
| + streams/buffer | |||
| + streams/typed-stream | |||
| + streams/external-stream | |||
| + streams/buffered-stream | |||
| + streams/convenience | |||
| + streams/wrapper-stream | |||
| + streams/cleanup-streams | |||
| + streams/native-speed | |||
| + streams/async-writes | |||
| + streams/file-stream | |||
| + streams/multi-buffered-streams | |||
| + pprint | |||
| + print-double-integer-kludge | |||
| + format | |||
| + buffered-format | |||
| + format-condition | |||
| + unix-file-accessor | |||
| + unix-standard-io | |||
| + unix-interface | |||
| + format-out | |||
| +C-Source-Files: unix-portability.c | |||
| +Major-Version: 2 | |||
| +Minor-Version: 1 | |||
| +Target-Type: dll | |||
| +Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. | |||
| + All rights reserved. | |||
| +License: See License.txt in this distribution for details. | |||
| +Warranty: Distributed WITHOUT WARRANTY OF ANY KIND | |||
2
vendor/pygments/tests/old_run.py
5
vendor/pygments/tests/run.py
36
vendor/pygments/tests/support/tags
| @@ -0,0 +1,36 @@ | |||
| +!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ | |||
| +!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ | |||
| +!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ | |||
| +!_TAG_PROGRAM_NAME Exuberant Ctags // | |||
| +!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ | |||
| +!_TAG_PROGRAM_VERSION 5.8 // | |||
| +HtmlFormatter test_html_formatter.py 19;" i | |||
| +HtmlFormatterTest test_html_formatter.py 34;" c | |||
| +NullFormatter test_html_formatter.py 19;" i | |||
| +PythonLexer test_html_formatter.py 18;" i | |||
| +StringIO test_html_formatter.py 13;" i | |||
| +dirname test_html_formatter.py 16;" i | |||
| +escape_html test_html_formatter.py 20;" i | |||
| +fp test_html_formatter.py 27;" v | |||
| +inspect test_html_formatter.py 15;" i | |||
| +isfile test_html_formatter.py 16;" i | |||
| +join test_html_formatter.py 16;" i | |||
| +os test_html_formatter.py 10;" i | |||
| +re test_html_formatter.py 11;" i | |||
| +subprocess test_html_formatter.py 125;" i | |||
| +support test_html_formatter.py 23;" i | |||
| +tempfile test_html_formatter.py 14;" i | |||
| +test_all_options test_html_formatter.py 72;" m class:HtmlFormatterTest | |||
| +test_correct_output test_html_formatter.py 35;" m class:HtmlFormatterTest | |||
| +test_ctags test_html_formatter.py 165;" m class:HtmlFormatterTest | |||
| +test_external_css test_html_formatter.py 48;" m class:HtmlFormatterTest | |||
| +test_get_style_defs test_html_formatter.py 141;" m class:HtmlFormatterTest | |||
| +test_lineanchors test_html_formatter.py 98;" m class:HtmlFormatterTest | |||
| +test_lineanchors_with_startnum test_html_formatter.py 106;" m class:HtmlFormatterTest | |||
| +test_linenos test_html_formatter.py 82;" m class:HtmlFormatterTest | |||
| +test_linenos_with_startnum test_html_formatter.py 90;" m class:HtmlFormatterTest | |||
| +test_unicode_options test_html_formatter.py 155;" m class:HtmlFormatterTest | |||
| +test_valid_output test_html_formatter.py 114;" m class:HtmlFormatterTest | |||
| +tokensource test_html_formatter.py 29;" v | |||
| +uni_open test_html_formatter.py 21;" i | |||
| +unittest test_html_formatter.py 12;" i | |||
5
vendor/pygments/tests/test_basic_api.py
2
vendor/pygments/tests/test_clexer.py
2
vendor/pygments/tests/test_cmdline.py
4
vendor/pygments/tests/test_examplefiles.py
18
vendor/pygments/tests/test_html_formatter.py
2
vendor/pygments/tests/test_latex_formatter.py
2
vendor/pygments/tests/test_perllexer.py
2
vendor/pygments/tests/test_regexlexer.py
2
vendor/pygments/tests/test_token.py
2
vendor/pygments/tests/test_using_api.py
9
vendor/pygments/tests/test_util.py
0 comments on commit
70305b9