update pygments to support python3

This commit is contained in:
everyx 2014-05-06 01:25:08 +08:00
parent ecc0c66006
commit 70305b971a
164 changed files with 24351 additions and 1445 deletions

View File

@ -9,7 +9,8 @@ Other contributors, listed alphabetically, are:
* Kumar Appaiah -- Debian control lexer
* Ali Afshar -- image formatter
* Andreas Amann -- AppleScript lexer
* Jeffrey Arnold -- R/S, Rd and BUGS lexers
* Timothy Armstrong -- Dart lexer fixes
* Jeffrey Arnold -- R/S, Rd, BUGS, Jags, and Stan lexers
* Jeremy Ashkenas -- CoffeeScript lexer
* Stefan Matthias Aust -- Smalltalk lexer
* Ben Bangert -- Mako lexers
@ -25,6 +26,7 @@ Other contributors, listed alphabetically, are:
* Hiram Chirino -- Scaml and Jade lexers
* Ian Cooper -- VGL lexer
* Leaf Corcoran -- MoonScript lexer
* Christian Jann -- ShellSession lexer
* Christopher Creutzig -- MuPAD lexer
* Pete Curry -- bugfixes
* Owen Durni -- haXe lexer
@ -33,29 +35,34 @@ Other contributors, listed alphabetically, are:
* Artem Egorkine -- terminal256 formatter
* James H. Fisher -- PostScript lexer
* Carlos Galdino -- Elixir and Elixir Console lexers
* Michael Galloy -- IDL lexer
* Naveen Garg -- Autohotkey lexer
* Laurent Gautier -- R/S lexer
* Alex Gaynor -- PyPy log lexer
* Alain Gilbert -- TypeScript lexer
* Bertrand Goetzmann -- Groovy lexer
* Krzysiek Goj -- Scala lexer
* Matt Good -- Genshi, Cheetah lexers
* Patrick Gotthardt -- PHP namespaces support
* Olivier Guibe -- Asymptote lexer
* Jordi Gutiérrez Hermoso -- Octave lexer
* Martin Harriman -- SNOBOL lexer
* Matthew Harrison -- SVG formatter
* Steven Hazel -- Tcl lexer
* Aslak Hellesøy -- Gherkin lexer
* Greg Hendershott -- Racket lexer
* Jordi Gutiérrez Hermoso -- Octave lexer
* David Hess, Fish Software, Inc. -- Objective-J lexer
* Varun Hiremath -- Debian control lexer
* Doug Hogan -- Mscgen lexer
* Ben Hollis -- Mason lexer
* Dustin Howett -- Logos lexer
* Alastair Houghton -- Lexer inheritance facility
* Tim Howard -- BlitzMax lexer
* Ivan Inozemtsev -- Fantom lexer
* Brian R. Jackson -- Tea lexer
* Dennis Kaarsemaker -- sources.list lexer
* Igor Kalnitsky -- vhdl lexer
* Pekka Klärck -- Robot Framework lexer
* Eric Knibbe -- Lasso lexer
* Adam Koprowski -- Opa lexer
* Benjamin Kowarsch -- Modula-2 lexer
@ -63,19 +70,23 @@ Other contributors, listed alphabetically, are:
* Marek Kubica -- Scheme lexer
* Jochen Kupperschmidt -- Markdown processor
* Gerd Kurzbach -- Modelica lexer
* Jon Larimer, Google Inc. -- Smali lexer
* Olov Lassus -- Dart lexer
* Sylvestre Ledru -- Scilab lexer
* Mark Lee -- Vala lexer
* Ben Mabey -- Gherkin lexer
* Angus MacArthur -- QML lexer
* Simone Margaritelli -- Hybris lexer
* Kirk McDonald -- D lexer
* Gordon McGregor -- SystemVerilog lexer
* Stephen McKamey -- Duel/JBST lexer
* Brian McKenna -- F# lexer
* Charles McLaughlin -- Puppet lexer
* Lukas Meuser -- BBCode formatter, Lua lexer
* Paul Miller -- LiveScript lexer
* Hong Minhee -- HTTP lexer
* Michael Mior -- Awk lexer
* Bruce Mitchener -- Dylan lexer rewrite
* Reuben Morais -- SourcePawn lexer
* Jon Morton -- Rust lexer
* Paulo Moura -- Logtalk lexer
@ -103,17 +114,22 @@ Other contributors, listed alphabetically, are:
* Joe Schafer -- Ada lexer
* Ken Schutte -- Matlab lexers
* Tassilo Schweyer -- Io, MOOCode lexers
* Ted Shaw -- AutoIt lexer
* Joerg Sieker -- ABAP lexer
* Robert Simmons -- Standard ML lexer
* Kirill Simonov -- YAML lexer
* Alexander Smishlajev -- Visual FoxPro lexer
* Steve Spigarelli -- XQuery lexer
* Jerome St-Louis -- eC lexer
* James Strachan -- Kotlin lexer
* Tom Stuart -- Treetop lexer
* Tiberius Teng -- default style overhaul
* Jeremy Thurgood -- Erlang, Squid config lexers
* Brian Tiffin -- OpenCOBOL lexer
* Erick Tryzelaar -- Felix lexer
* Daniele Varrazzo -- PostgreSQL lexers
* Abe Voelker -- OpenEdge ABL lexer
* Pepijn de Vos -- HTML formatter CTags support
* Whitney Young -- ObjectiveC lexer
* Matthias Vallentin -- Bro lexer
* Nathan Weizenbaum -- Haml and Sass lexers

View File

@ -2,34 +2,94 @@ Pygments changelog
==================
Issue numbers refer to the tracker at
http://bitbucket.org/birkenfeld/pygments-main/issues.
<http://bitbucket.org/birkenfeld/pygments-main/issues>,
pull request numbers to the requests at
<http://bitbucket.org/birkenfeld/pygments-main/pull-requests/merged>.
Version 1.6
-----------
(in development)
(released Feb 3, 2013)
- Lexers added:
* Dylan console (PR#149)
* Logos (PR#150)
* Shell sessions (PR#158)
- Fix guessed lexers not receiving lexer options (#838).
- Fix unquoted HTML attribute lexing in Opa (#841).
- Fixes to the Dart lexer (PR#160).
Version 1.6rc1
--------------
(released Jan 9, 2013)
- Lexers added:
* Julia (PR#61)
* Croc (new name for MiniD)
* LiveScript (PR#84)
* Lasso (PR#95)
* BUGS-like languages (PR#89)
* Rust (PR#67)
* CUDA (PR#75)
* Xtend (PR#68)
* Mscgen (PR#80)
* Kconfig (#711)
* AspectJ (PR#90)
* AutoIt (PR#122)
* BUGS-like languages (PR#89)
* Ceylon (PR#86)
* Croc (new name for MiniD)
* CUDA (PR#75)
* Dg (PR#116)
* IDL (PR#115)
* Jags (PR#89)
* Julia (PR#61)
* Kconfig (#711)
* Lasso (PR#95, PR#113)
* LiveScript (PR#84)
* Monkey (PR#117)
* Mscgen (PR#80)
* NSIS scripts (PR#136)
* OpenCOBOL (PR#72)
* QML (PR#123)
* Puppet (PR#133)
* Racket (PR#94)
* Rdoc (PR#99)
* VGL (PR#12)
* Robot Framework (PR#137)
* RPM spec files (PR#124)
* Rust (PR#67)
* Smali (Dalvik assembly)
* SourcePawn (PR#39)
* Ceylon (PR#86)
* Stan (PR#89)
* Treetop (PR#125)
* TypeScript (PR#114)
* VGL (PR#12)
* Visual FoxPro (#762)
* Windows Registry (#819)
* Xtend (PR#68)
- Fix Template Haskell highlighting (PR#63)
- The HTML formatter now supports linking to tags using CTags files, when the
python-ctags package is installed (PR#87).
- Fix some S/R lexer errors (PR#91)
- The HTML formatter now has a "linespans" option that wraps every line in a
<span> tag with a specific id (PR#82).
- 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).
- The C family lexers now inherit token definitions from a common base class,
removing code duplication (PR#141).
- Use "colorama" on Windows for console color output (PR#142).
- Fix Template Haskell highlighting (PR#63).
- Fix some S/R lexer errors (PR#91).
- Fix a bug in the Prolog lexer with names that start with 'is' (#810).
- Rewrite Dylan lexer, add Dylan LID lexer (PR#147).
- Add a Java quickstart document (PR#146).
- Add a "external/autopygmentize" file that can be used as .lessfilter (#802).
Version 1.5

View File

@ -1,4 +1,4 @@
Copyright (c) 2006-2012 by the respective authors (see AUTHORS file).
Copyright (c) 2006-2013 by the respective authors (see AUTHORS file).
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -4,7 +4,7 @@
#
# Combines scripts for common tasks.
#
# :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
# :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
# :license: BSD, see LICENSE for details.
#

46
vendor/pygments/PKG-INFO vendored Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,3 @@
[console_scripts]
pygmentize = pygments.cmdline:main

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
pygments

458
vendor/pygments/docs/build/api.html vendored Normal file
View File

@ -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 &mdash; 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">&laquo; 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">&#39;compress&#39;</span><span class="p">,</span> <span class="s">&#39;&#39;</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 vendored Normal file
View File

@ -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 &mdash; 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">&laquo; Back To Index</a>
<p>Pygments is written and maintained by Georg Brandl &lt;<a class="reference external" href="mailto:georg&#64;python.org">georg&#64;python.org</a>&gt;.</p>
<p>Major developers are Tim Hatch &lt;<a class="reference external" href="mailto:tim&#64;timhatch.com">tim&#64;timhatch.com</a>&gt; and Armin Ronacher
&lt;<a class="reference external" href="mailto:armin.ronacher&#64;active-4.com">armin.ronacher&#64;active-4.com</a>&gt;.</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 &quot;anchorlinenos&quot;</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>

View File

@ -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 &mdash; 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">&laquo; 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
&lt;<a class="reference external" href="http://bitbucket.org/birkenfeld/pygments-main/issues">http://bitbucket.org/birkenfeld/pygments-main/issues</a>&gt;,
pull request numbers to the requests at
&lt;<a class="reference external" href="http://bitbucket.org/birkenfeld/pygments-main/pull-requests/merged">http://bitbucket.org/birkenfeld/pygments-main/pull-requests/merged</a>&gt;.</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 &quot;linespans&quot; option that wraps every line in a
&lt;span&gt; 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 &quot;inherit&quot; 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 &quot;colorama&quot; 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 &quot;external/autopygmentize&quot; 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 &amp;, &lt; and &gt; 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 &quot;class&quot; 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 &quot;rrt&quot; 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 &quot;anchorlinenos&quot; and &quot;noclobber_cssfile&quot; (#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 &quot;udiff&quot; 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">&gt;</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 &quot;Visual Studio&quot; 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">&lt;pre&gt;</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
&quot;.. sourcecode:: language&quot; and &quot;.. code:: language&quot; directive
blocks.</li>
<li>Improved the default style (thanks to Tiberius Teng). The old
default is still available as the &quot;emacs&quot; 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 &quot;state&quot; 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 &quot;fruity&quot; 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 &quot;full document&quot; 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>&#64;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 vendored Normal file
View File

@ -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 &mdash; 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">&laquo; 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 &quot;Hello World&quot;
</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
&quot;emacs&quot; 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 &quot;heading=Pygments, the Python highlighter&quot; ...
</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">&lt;span&gt;</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 &quot;colorful&quot; style prepending a &quot;.syntax&quot; 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>

View File

@ -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 &mdash; 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">&laquo; 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">&#39;classtoo&#39;</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">&#39;classtoo&#39;</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 vendored Normal file
View File

@ -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 &mdash; 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">&laquo; 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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span><span class="n">l</span> <span class="o">=</span> <span class="n">PythonLexer</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c"># add a filter given by a string and options</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">l</span><span class="o">.</span><span class="n">add_filter</span><span class="p">(</span><span class="s">&#39;codetagify&#39;</span><span class="p">,</span> <span class="n">case</span><span class="o">=</span><span class="s">&#39;lower&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">l</span><span class="o">.</span><span class="n">filters</span>
<span class="go">[&lt;pygments.filters.CodeTagFilter object at 0xb785decc&gt;]</span>
<span class="gp">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span><span class="c"># or give an instance</span>
<span class="gp">&gt;&gt;&gt; </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">&#39;lower&#39;</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 &quot;foo&quot;, &quot;bar&quot; and &quot;baz&quot;
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>

View File

@ -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 &mdash; 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">&laquo; 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">&lt;u&gt;</tt>, <tt class="docutils literal">&lt;font&gt;</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">&#39;&#39;</span>
<span class="c"># a style item is a tuple in the following form:</span>
<span class="c"># colors are readily specified in hex: &#39;RRGGBB&#39;</span>
<span class="k">if</span> <span class="n">style</span><span class="p">[</span><span class="s">&#39;color&#39;</span><span class="p">]:</span>
<span class="n">start</span> <span class="o">+=</span> <span class="s">&#39;&lt;font color=&quot;#</span><span class="si">%s</span><span class="s">&quot;&gt;&#39;</span> <span class="o">%</span> <span class="n">style</span><span class="p">[</span><span class="s">&#39;color&#39;</span><span class="p">]</span>
<span class="n">end</span> <span class="o">=</span> <span class="s">&#39;&lt;/font&gt;&#39;</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">&#39;bold&#39;</span><span class="p">]:</span>
<span class="n">start</span> <span class="o">+=</span> <span class="s">&#39;&lt;b&gt;&#39;</span>
<span class="n">end</span> <span class="o">=</span> <span class="s">&#39;&lt;/b&gt;&#39;</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">&#39;italic&#39;</span><span class="p">]:</span>
<span class="n">start</span> <span class="o">+=</span> <span class="s">&#39;&lt;i&gt;&#39;</span>
<span class="n">end</span> <span class="o">=</span> <span class="s">&#39;&lt;/i&gt;&#39;</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">&#39;underline&#39;</span><span class="p">]:</span>
<span class="n">start</span> <span class="o">+=</span> <span class="s">&#39;&lt;u&gt;&#39;</span>
<span class="n">end</span> <span class="o">=</span> <span class="s">&#39;&lt;/u&gt;&#39;</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&#39;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">&#39;&#39;</span>
<span class="n">lasttype</span> <span class="o">=</span> <span class="bp">None</span>
<span class="c"># wrap the whole output with &lt;pre&gt;</span>
<span class="n">outfile</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">&#39;&lt;pre&gt;&#39;</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&#39;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 &lt;pre&gt; 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">&#39;&lt;/pre&gt;</span><span class="se">\n</span><span class="s">&#39;</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>

View File

@ -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 &mdash; 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">&laquo; 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">&quot;utf-8&quot;</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">&quot;&quot;</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">&quot;guess&quot;</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">&lt;span&gt;</tt> tags within a <tt class="docutils literal">&lt;pre&gt;</tt> tag, wrapped
in a <tt class="docutils literal">&lt;div&gt;</tt> tag. The <tt class="docutils literal">&lt;div&gt;</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">&quot;table&quot;</tt>, the <tt class="docutils literal">&lt;pre&gt;</tt> is
additionally wrapped inside a <tt class="docutils literal">&lt;table&gt;</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">&lt;div</span> <span class="na">class=</span><span class="s">&quot;highlight&quot;</span> <span class="nt">&gt;</span>
<span class="nt">&lt;table&gt;&lt;tr&gt;</span>
<span class="nt">&lt;td</span> <span class="na">class=</span><span class="s">&quot;linenos&quot;</span> <span class="na">title=</span><span class="s">&quot;click to toggle&quot;</span>
<span class="na">onclick=</span><span class="s">&quot;with (this.firstChild.style)</span>
<span class="s"> { display = (display == &#39;&#39;) ? &#39;none&#39; : &#39;&#39; }&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;pre&gt;</span>1
2<span class="nt">&lt;/pre&gt;</span>
<span class="nt">&lt;/td&gt;</span>
<span class="nt">&lt;td</span> <span class="na">class=</span><span class="s">&quot;code&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;pre&gt;&lt;span</span> <span class="na">class=</span><span class="s">&quot;Ke&quot;</span><span class="nt">&gt;</span>def <span class="nt">&lt;/span&gt;&lt;span</span> <span class="na">class=</span><span class="s">&quot;NaFu&quot;</span><span class="nt">&gt;</span>foo<span class="nt">&lt;/span&gt;</span>(bar):
<span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">&quot;Ke&quot;</span><span class="nt">&gt;</span>pass<span class="nt">&lt;/span&gt;</span>
<span class="nt">&lt;/pre&gt;</span>
<span class="nt">&lt;/td&gt;</span>
<span class="nt">&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</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">&lt;style&gt;</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">&#39;div.syntax pre&#39;</span><span class="p">,</span> <span class="s">&#39;pre.syntax&#39;</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">&lt;pre&gt;</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 &quot;full&quot; 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">&lt;span&gt;</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">&lt;div&gt;</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">&lt;div&gt;</tt> tag (default: <tt class="docutils literal">''</tt>).</dd>
<dt><cite>prestyles</cite></dt>
<dd>Inline CSS styles for the <tt class="docutils literal">&lt;pre&gt;</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">&lt;pre&gt;</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 (&quot;table&quot;) 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">&lt;pre&gt;</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 &gt; 1, only every nth line number is printed.</dd>
<dt><cite>linenospecial</cite></dt>
<dd>If set to a number n &gt; 0, every nth line number is given the CSS
class <tt class="docutils literal">&quot;special&quot;</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">&quot;\n&quot;</tt>,
which is enough to break a line inside <tt class="docutils literal">&lt;pre&gt;</tt> tags, but you can
e.g. set it to <tt class="docutils literal">&quot;&lt;br&gt;&quot;</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 &lt;a&gt; 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">&lt;div&gt;</tt> and a <tt class="docutils literal">&lt;pre&gt;</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">&#39;&lt;code&gt;&#39;</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&#39;s a line of formatted code</span>
<span class="n">t</span> <span class="o">+=</span> <span class="s">&#39;&lt;br&gt;&#39;</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">&#39;&lt;/code&gt;&#39;</span>
</pre></div>
<p>This results in wrapping the formatted lines with a <tt class="docutils literal">&lt;code&gt;</tt> tag, where the
source lines are broken using <tt class="docutils literal">&lt;br&gt;</tt> tags.</p>
<p>After calling <cite>wrap()</cite>, the <cite>format()</cite> method also adds the &quot;line numbers&quot;
and/or &quot;full document&quot; 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>&quot;PNG&quot; (default)</li>
<li>&quot;JPEG&quot;</li>
<li>&quot;BMP&quot;</li>
<li>&quot;GIF&quot;</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: &quot;Bitstream Vera Sans Mono&quot;</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 &quot;#123456&quot; format) of the line number bar, or
None to use the style background color.</p>
<p class="last">Default: &quot;#eed&quot;</p>
</dd>
<dt><cite>line_number_fg</cite></dt>
<dd><p class="first">The text color of the line numbers (in &quot;#123456&quot;-like format).</p>
<p class="last">Default: &quot;#886&quot;</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 &quot;full&quot; 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 &gt; 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&lt;TAB&gt;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">&lt;text&gt;</tt> element with explicit <tt class="docutils literal">x</tt> and <tt class="docutils literal">y</tt>
coordinates containing <tt class="docutils literal">&lt;tspan&gt;</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">&lt;svg&gt;</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">&lt;text&gt;</tt> elements in <tt class="docutils literal"><span class="pre">&lt;svg&gt;&lt;g&gt;</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">&lt;g&gt;</tt> element's <tt class="docutils literal"><span class="pre">font-family</span></tt>
attribute, defaults to <tt class="docutils literal">&quot;monospace&quot;</tt>.</dd>
<dt><cite>fontsize</cite></dt>
<dd>The value to give the wrapping <tt class="docutils literal">&lt;g&gt;</tt> element's <tt class="docutils literal"><span class="pre">font-size</span></tt>
attribute, defaults to <tt class="docutils literal">&quot;14px&quot;</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">&amp;#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">&quot;light&quot;</tt> or <tt class="docutils literal">&quot;dark&quot;</tt> depending on the terminal's background
(default: <tt class="docutils literal">&quot;light&quot;</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 vendored Normal file
View File

@ -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 &mdash; 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>

View File

@ -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 &mdash; 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">&laquo; 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>

View File

@ -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 &mdash; 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">&laquo; 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 vendored Normal file
View File

@ -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 &mdash; 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">&laquo; 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">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
<span class="nt">&lt;project</span> <span class="na">xmlns=</span><span class="s">&quot;http://maven.apache.org/POM/4.0.0&quot;</span>
<span class="na">xmlns:xsi=</span><span class="s">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span>
<span class="na">xsi:schemaLocation=</span><span class="s">&quot;http://maven.apache.org/POM/4.0.0</span>
<span class="s"> http://maven.apache.org/maven-v4_0_0.xsd&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;modelVersion&gt;</span>4.0.0<span class="nt">&lt;/modelVersion&gt;</span>
<span class="nt">&lt;groupId&gt;</span>example<span class="nt">&lt;/groupId&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>example<span class="nt">&lt;/artifactId&gt;</span>
<span class="nt">&lt;version&gt;</span>1.0-SNAPSHOT<span class="nt">&lt;/version&gt;</span>
<span class="nt">&lt;dependencies&gt;</span>
<span class="nt">&lt;dependency&gt;</span>
<span class="nt">&lt;groupId&gt;</span>org.python<span class="nt">&lt;/groupId&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>jython-standalone<span class="nt">&lt;/artifactId&gt;</span>
<span class="nt">&lt;version&gt;</span>2.5.3<span class="nt">&lt;/version&gt;</span>
<span class="nt">&lt;/dependency&gt;</span>
<span class="nt">&lt;dependency&gt;</span>
<span class="nt">&lt;groupId&gt;</span>org.pygments<span class="nt">&lt;/groupId&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>pygments<span class="nt">&lt;/artifactId&gt;</span>
<span class="nt">&lt;version&gt;</span>1.5<span class="nt">&lt;/version&gt;</span>
<span class="nt">&lt;scope&gt;</span>runtime<span class="nt">&lt;/scope&gt;</span>
<span class="nt">&lt;/dependency&gt;</span>
<span class="nt">&lt;/dependencies&gt;</span>
<span class="nt">&lt;/project&gt;</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">&quot;code&quot;</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">&quot;from pygments import highlight\n&quot;</span>
<span class="o">+</span> <span class="s">&quot;from pygments.lexers import PythonLexer\n&quot;</span>
<span class="o">+</span> <span class="s">&quot;from pygments.formatters import HtmlFormatter\n&quot;</span>
<span class="o">+</span> <span class="s">&quot;\nresult = highlight(code, PythonLexer(), HtmlFormatter())&quot;</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">&quot;result&quot;</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">&lt;div</span> <span class="na">class=</span><span class="s">&quot;highlight&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;pre&gt;&lt;span</span> <span class="na">class=</span><span class="s">&quot;k&quot;</span><span class="nt">&gt;</span>print<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">&quot;s&quot;</span><span class="nt">&gt;</span><span class="ni">&amp;quot;</span>Hello World<span class="ni">&amp;quot;</span><span class="nt">&lt;/span&gt;&lt;/pre&gt;</span>
<span class="nt">&lt;/div&gt;</span>
</pre></div>
</div>
</body>
<!-- generated on: 2013-02-03 10:39:02.521367
file id: java -->
</html>

View File

@ -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 &mdash; 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">&laquo; 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">&#39;Diff&#39;</span>
<span class="n">aliases</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;diff&#39;</span><span class="p">]</span>
<span class="n">filenames</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;*.diff&#39;</span><span class="p">]</span>
<span class="n">tokens</span> <span class="o">=</span> <span class="p">{</span>
<span class="s">&#39;root&#39;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">(</span><span class="s">r&#39; .*\n&#39;</span><span class="p">,</span> <span class="n">Text</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;\+.*\n&#39;</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&#39;-.*\n&#39;</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&#39;@.*\n&#39;</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&#39;Index.*\n&#39;</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&#39;=.*\n&#39;</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&#39;.*\n&#39;</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">&#39;INI&#39;</span>
<span class="n">aliases</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;ini&#39;</span><span class="p">,</span> <span class="s">&#39;cfg&#39;</span><span class="p">]</span>
<span class="n">filenames</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;*.ini&#39;</span><span class="p">,</span> <span class="s">&#39;*.cfg&#39;</span><span class="p">]</span>
<span class="n">tokens</span> <span class="o">=</span> <span class="p">{</span>
<span class="s">&#39;root&#39;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">(</span><span class="s">r&#39;\s+&#39;</span><span class="p">,</span> <span class="n">Text</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;;.*?$&#39;</span><span class="p">,</span> <span class="n">Comment</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;\[.*?\]$&#39;</span><span class="p">,</span> <span class="n">Keyword</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;(.*?)(\s*)(=)(\s*)(.*?)$&#39;</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'(&lt;(foo|bar)&gt;)(.*?)(&lt;/\2&gt;)'</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">&#39;Example Lexer with states&#39;</span>
<span class="n">tokens</span> <span class="o">=</span> <span class="p">{</span>
<span class="s">&#39;root&#39;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">(</span><span class="s">r&#39;[^/]+&#39;</span><span class="p">,</span> <span class="n">Text</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;/\*&#39;</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">&#39;comment&#39;</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;//.*?$&#39;</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&#39;/&#39;</span><span class="p">,</span> <span class="n">Text</span><span class="p">)</span>
<span class="p">],</span>
<span class="s">&#39;comment&#39;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">(</span><span class="s">r&#39;[^*/]&#39;</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&#39;/\*&#39;</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">&#39;#push&#39;</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;\*/&#39;</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">&#39;#pop&#39;</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;[*/]&#39;</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">
/* &lt;processing directive&gt; 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">&#39;root&#39;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">(</span><span class="s">r&#39;/\* &lt;&#39;</span><span class="p">,</span> <span class="n">Comment</span><span class="p">,</span> <span class="p">(</span><span class="s">&#39;comment&#39;</span><span class="p">,</span> <span class="s">&#39;directive&#39;</span><span class="p">)),</span>
<span class="o">...</span>
<span class="p">],</span>
<span class="s">&#39;directive&#39;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">(</span><span class="s">r&#39;[^&gt;]*&#39;</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&#39;&gt;&#39;</span><span class="p">,</span> <span class="n">Comment</span><span class="p">,</span> <span class="s">&#39;#pop&#39;</span><span class="p">),</span>
<span class="p">],</span>
<span class="s">&#39;comment&#39;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">(</span><span class="s">r&#39;[^*]+&#39;</span><span class="p">,</span> <span class="n">Comment</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;\*/&#39;</span><span class="p">,</span> <span class="n">Comment</span><span class="p">,</span> <span class="s">&#39;#pop&#39;</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;\*&#39;</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">&gt;</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">&#39;comments&#39;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">(</span><span class="s">r&#39;/\*.*?\*/&#39;</span><span class="p">,</span> <span class="n">Comment</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;//.*?\n&#39;</span><span class="p">,</span> <span class="n">Comment</span><span class="p">),</span>
<span class="p">],</span>
<span class="s">&#39;root&#39;</span><span class="p">:</span> <span class="p">[</span>
<span class="n">include</span><span class="p">(</span><span class="s">&#39;comments&#39;</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;(function )(\w+)( {)&#39;</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">&#39;function&#39;</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;.&#39;</span><span class="p">,</span> <span class="n">Text</span><span class="p">),</span>
<span class="p">],</span>
<span class="s">&#39;function&#39;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">(</span><span class="s">r&#39;[^}/]+&#39;</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">&#39;comments&#39;</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;/&#39;</span><span class="p">,</span> <span class="n">Text</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;}&#39;</span><span class="p">,</span> <span class="n">Keyword</span><span class="p">,</span> <span class="s">&#39;#pop&#39;</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 &quot;combine&quot; 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">&#39;root&#39;</span><span class="p">,</span> <span class="s">&#39;otherstate&#39;</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">&lt;?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">&#39;HTML&#39;</span>
<span class="n">aliases</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;html&#39;</span><span class="p">]</span>
<span class="n">filenames</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;*.html&#39;</span><span class="p">,</span> <span class="s">&#39;*.htm&#39;</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">&#39;root&#39;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">(</span><span class="s">&#39;[^&lt;&amp;]+&#39;</span><span class="p">,</span> <span class="n">Text</span><span class="p">),</span>
<span class="p">(</span><span class="s">&#39;&amp;.*?;&#39;</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&#39;&lt;\s*script\s*&#39;</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">&#39;script-content&#39;</span><span class="p">,</span> <span class="s">&#39;tag&#39;</span><span class="p">)),</span>
<span class="p">(</span><span class="s">r&#39;&lt;\s*[a-zA-Z0-9:]+&#39;</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">&#39;tag&#39;</span><span class="p">),</span>
<span class="p">(</span><span class="s">r&#39;&lt;\s*/\s*[a-zA-Z0-9:]+\s*&gt;&#39;</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">&#39;script-content&#39;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">(</span><span class="s">r&#39;(.+?)(&lt;\s*/\s*script\s*&gt;)&#39;</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">&#39;#pop&#39;</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">&lt;script&gt;</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">&lt;/script&gt;</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 &quot;other&quot; 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'&lt;\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">&gt;</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">&quot;root&quot;</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">&#39;root&#39;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">(</span><span class="s">r&#39;(=+)(.*?)(\1)&#39;</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">&#39;root&#39;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">(</span><span class="s">r&#39;(=+)(.*?)(\1)&#39;</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">&#39;foo&#39;</span><span class="p">,</span> <span class="s">&#39;bar&#39;</span><span class="p">,</span> <span class="s">&#39;foobar&#39;</span><span class="p">,</span> <span class="s">&#39;barfoo&#39;</span><span class="p">,</span> <span class="s">&#39;spam&#39;</span><span class="p">,</span> <span class="s">&#39;eggs&#39;</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>

5359
vendor/pygments/docs/build/lexers.html vendored Normal file

File diff suppressed because it is too large Load Diff

245
vendor/pygments/docs/build/moinmoin.html vendored Normal file
View File

@ -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 &mdash; 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">&laquo; 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 vendored Normal file
View File

@ -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 &mdash; 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">&laquo; 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">&#39;Name Of Your Lexer&#39;</span>
<span class="n">aliases</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;alias&#39;</span><span class="p">]</span>
<span class="n">filenames</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;*.ext&#39;</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>

View File

@ -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 &mdash; 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">&laquo; 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 &quot;red and bold&quot;.</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">&#39;print &quot;Hello World&quot;&#39;</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">&lt;div</span> <span class="na">class=</span><span class="s">&quot;highlight&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;pre&gt;&lt;span</span> <span class="na">class=</span><span class="s">&quot;k&quot;</span><span class="nt">&gt;</span>print<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">&quot;s&quot;</span><span class="nt">&gt;</span><span class="ni">&amp;quot;</span>Hello World<span class="ni">&amp;quot;</span><span class="nt">&lt;/span&gt;&lt;/pre&gt;</span>
<span class="nt">&lt;/div&gt;</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">&#39;.highlight&#39;</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">&quot;python&quot;</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">&quot;source&quot;</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">&lt;div&gt;</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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span><span class="n">get_lexer_by_name</span><span class="p">(</span><span class="s">&#39;python&#39;</span><span class="p">)</span>
<span class="go">&lt;pygments.lexers.PythonLexer&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">get_lexer_for_filename</span><span class="p">(</span><span class="s">&#39;spam.rb&#39;</span><span class="p">)</span>
<span class="go">&lt;pygments.lexers.RubyLexer&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">get_lexer_for_mimetype</span><span class="p">(</span><span class="s">&#39;text/x-perl&#39;</span><span class="p">)</span>
<span class="go">&lt;pygments.lexers.PerlLexer&gt;</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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span><span class="n">guess_lexer</span><span class="p">(</span><span class="s">&#39;#!/usr/bin/python</span><span class="se">\n</span><span class="s">print &quot;Hello World!&quot;&#39;</span><span class="p">)</span>
<span class="go">&lt;pygments.lexers.PythonLexer&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">guess_lexer_for_filename</span><span class="p">(</span><span class="s">&#39;test.py&#39;</span><span class="p">,</span> <span class="s">&#39;print &quot;Hello World!&quot;&#39;</span><span class="p">)</span>
<span class="go">&lt;pygments.lexers.PythonLexer&gt;</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 &quot;full&quot; 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=&lt;name&gt;</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 &gt; 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>

View File

@ -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 &mdash; 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">&laquo; 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 vendored Normal file
View File

@ -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 &mdash; 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">&laquo; 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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span><span class="n">get_style_by_name</span><span class="p">(</span><span class="s">&#39;colorful&#39;</span><span class="p">)</span>
<span class="go">&lt;class &#39;pygments.styles.colorful.ColorfulStyle&#39;&gt;</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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span><span class="n">HtmlFormatter</span><span class="p">(</span><span class="n">style</span><span class="o">=</span><span class="s">&#39;colorful&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">style</span>
<span class="go">&lt;class &#39;pygments.styles.colorful.ColorfulStyle&#39;&gt;</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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </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">&lt;class &#39;yourapp.yourmodule.YourStyle&#39;&gt;</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">&quot;&quot;</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">&#39;italic #888&#39;</span><span class="p">,</span>
<span class="n">Keyword</span><span class="p">:</span> <span class="s">&#39;bold #005&#39;</span><span class="p">,</span>
<span class="n">Name</span><span class="p">:</span> <span class="s">&#39;#f00&#39;</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">&#39;#0f0&#39;</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">&#39;bold #0f0&#39;</span><span class="p">,</span>
<span class="n">String</span><span class="p">:</span> <span class="s">&#39;bg:#eee #111&#39;</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">&quot;mondrian&quot;</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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span><span class="n">STYLE_MAP</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
<span class="go">[&#39;default&#39;, &#39;emacs&#39;, &#39;friendly&#39;, &#39;colorful&#39;]</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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </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 vendored Normal file
View File

@ -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 &mdash; 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">&laquo; 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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span><span class="n">Token</span><span class="o">.</span><span class="n">String</span>
<span class="go">Token.String</span>
<span class="gp">&gt;&gt;&gt; </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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span><span class="n">string_to_tokentype</span><span class="p">(</span><span class="s">&quot;String&quot;</span><span class="p">)</span>
<span class="go">Token.Literal.String</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">string_to_tokentype</span><span class="p">(</span><span class="s">&quot;Token.Literal.String&quot;</span><span class="p">)</span>
<span class="go">Token.Literal.String</span>
<span class="gp">&gt;&gt;&gt; </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">&amp;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 &quot;heredoc&quot; 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">&lt;?php</span></tt>/<tt class="docutils literal">&lt;%</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 vendored Normal file
View File

@ -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 &mdash; 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">&laquo; 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">&#39;chardet&#39;</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">&#39;utf-8&#39;</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>

View File

@ -6,7 +6,7 @@
Generates a bunch of html files containing the documentation.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -64,7 +64,7 @@ def `guess_lexer(text, **options):`
def `guess_lexer_for_filename(filename, text, **options):`
As `guess_lexer()`, but only lexers which have a pattern in `filenames`
or `alias_filenames` that matches `filename` are taken into consideration.
`pygments.util.ClassNotFound` is raised if no lexer thinks it can handle the
content.

View File

@ -37,7 +37,7 @@ Welcome to the Pygments documentation.
- `Write your own lexer <lexerdevelopment.txt>`_
- `Write your own formatter <formatterdevelopment.txt>`_
- `Write your own filter <filterdevelopment.txt>`_
- `Register plugins <plugins.txt>`_

View File

@ -41,3 +41,8 @@ Bash completion
The source distribution contains a file ``external/pygments.bashcomp`` that
sets up completion for the ``pygmentize`` command in bash.
Java
----
See the `Java quickstart <java.txt>`_ document.

70
vendor/pygments/docs/src/java.txt vendored Normal file
View File

@ -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">&quot;Hello World&quot;</span></pre>
</div>

64
vendor/pygments/external/autopygmentize vendored Executable file
View File

@ -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

View File

@ -27,7 +27,7 @@
.. _Markdown: http://www.freewisdom.org/projects/python-markdown/
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -64,4 +64,4 @@ class CodeBlockPreprocessor(TextPreprocessor):
code = code.replace('\n\n', '\n&nbsp;\n').replace('\n', '<br />')
return '\n\n<div class="code">%s</div>\n\n' % code
return self.pattern.sub(
repl, lines)
repl, lines)

View File

@ -31,7 +31,7 @@
If you do not want to do that and are willing to accept larger HTML
output, you can set the INLINESTYLES option below to True.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -31,7 +31,7 @@
.. _directive documentation:
http://docutils.sourceforge.net/docs/howto/rst-directives.html
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -31,7 +31,7 @@
.. _directive documentation:
http://docutils.sourceforge.net/docs/howto/rst-directives.html
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -22,11 +22,11 @@
.. _Pygments tip:
http://bitbucket.org/birkenfeld/pygments-main/get/tip.zip#egg=Pygments-dev
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
__version__ = '1.5'
__version__ = '1.6'
__docformat__ = 'restructuredtext'
__all__ = ['lex', 'format', 'highlight']

View File

@ -5,7 +5,7 @@
Command line interface.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import sys
@ -192,6 +192,14 @@ def main(args=sys.argv):
usage = USAGE % ((args[0],) * 6)
if sys.platform in ['win32', 'cygwin']:
try:
# Provide coloring under Windows, if possible
import colorama
colorama.init()
except ImportError:
pass
try:
popts, args = getopt.getopt(args[1:], "l:f:F:o:O:P:LS:a:N:hVHg")
except getopt.GetoptError, err:
@ -219,7 +227,7 @@ def main(args=sys.argv):
return 0
if opts.pop('-V', None) is not None:
print 'Pygments version %s, (c) 2006-2012 by Georg Brandl.' % __version__
print 'Pygments version %s, (c) 2006-2013 by Georg Brandl.' % __version__
return 0
# handle ``pygmentize -L``
@ -370,9 +378,9 @@ def main(args=sys.argv):
except ClassNotFound, err:
if '-g' in opts:
try:
lexer = guess_lexer(code)
lexer = guess_lexer(code, **parsed_opts)
except ClassNotFound:
lexer = TextLexer()
lexer = TextLexer(**parsed_opts)
else:
print >>sys.stderr, 'Error:', err
return 1
@ -384,9 +392,9 @@ def main(args=sys.argv):
if '-g' in opts:
code = sys.stdin.read()
try:
lexer = guess_lexer(code)
lexer = guess_lexer(code, **parsed_opts)
except ClassNotFound:
lexer = TextLexer()
lexer = TextLexer(**parsed_opts)
elif not lexer:
print >>sys.stderr, 'Error: no lexer name given and reading ' + \
'from stdin (try using -g or -l <lexer>)'

View File

@ -5,7 +5,7 @@
Format colored console output.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,7 +5,7 @@
Module that implements the default filter.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -6,7 +6,7 @@
Module containing filter lookup functions and default
filters.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -331,7 +331,6 @@ class TokenMergeFilter(Filter):
Filter.__init__(self, **options)
def filter(self, lexer, stream):
output = []
current_type = None
current_value = None
for ttype, value in stream:

View File

@ -5,7 +5,7 @@
Base formatter class.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,7 +5,7 @@
Pygments formatters.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os.path

View File

@ -9,7 +9,7 @@
Do not alter the FORMATTERS dictionary by hand.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,7 +5,7 @@
BBcode formatter.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,18 +5,23 @@
Formatter for HTML output.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import sys
import os.path
import StringIO
from pygments.formatter import Formatter
from pygments.token import Token, Text, STANDARD_TYPES
from pygments.util import get_bool_opt, get_int_opt, get_list_opt, bytes
try:
import ctags
except ImportError:
ctags = None
__all__ = ['HtmlFormatter']
@ -141,6 +146,12 @@ class HtmlFormatter(Formatter):
the style definitions inside a ``<style>`` tag, or in a separate file if
the `cssfile` option is given.
When `tagsfile` is set to the path of a ctags index file, it is used to
generate hyperlinks from names to their definition. You must enable
`anchorlines` and run ctags with the `-n` option for this to work. The
`python-ctags` module from PyPI must be installed to use this feature;
otherwise a `RuntimeError` will be raised.
The `get_style_defs(arg='')` method of a `HtmlFormatter` returns a string
containing CSS rules for the CSS classes used by the formatter. The
argument `arg` can be used to specify additional CSS selectors that
@ -282,10 +293,27 @@ class HtmlFormatter(Formatter):
output line in an anchor tag with a ``name`` of ``foo-linenumber``.
This allows easy linking to certain lines. *New in Pygments 0.9.*
`linespans`
If set to a nonempty string, e.g. ``foo``, the formatter will wrap each
output line in a span tag with an ``id`` of ``foo-linenumber``.
This allows easy access to lines via javascript. *New in Pygments 1.6.*
`anchorlinenos`
If set to `True`, will wrap line numbers in <a> tags. Used in
combination with `linenos` and `lineanchors`.
`tagsfile`
If set to the path of a ctags file, wrap names in anchor tags that
link to their definitions. `lineanchors` should be used, and the
tags file should specify line numbers (see the `-n` option to ctags).
*New in Pygments 1.6.*
`tagurlformat`
A string formatting pattern used to generate links to ctags definitions.
Available variables are `%(path)s`, `%(fname)s` and `%(fext)s`.
Defaults to an empty string, resulting in just `#prefix-number` links.
*New in Pygments 1.6.*
**Subclassing the HTML formatter**
@ -351,6 +379,14 @@ class HtmlFormatter(Formatter):
self.prestyles = self._decodeifneeded(options.get('prestyles', ''))
self.cssfile = self._decodeifneeded(options.get('cssfile', ''))
self.noclobber_cssfile = get_bool_opt(options, 'noclobber_cssfile', False)
self.tagsfile = self._decodeifneeded(options.get('tagsfile', ''))
self.tagurlformat = self._decodeifneeded(options.get('tagurlformat', ''))
if self.tagsfile:
if not ctags:
raise RuntimeError('The "ctags" package must to be installed '
'to be able to use the "tagsfile" feature.')
self._ctags = ctags.CTags(self.tagsfile)
linenos = options.get('linenos', False)
if linenos == 'inline':
@ -366,6 +402,7 @@ class HtmlFormatter(Formatter):
self.nobackground = get_bool_opt(options, 'nobackground', False)
self.lineseparator = options.get('lineseparator', '\n')
self.lineanchors = options.get('lineanchors', '')
self.linespans = options.get('linespans', '')
self.anchorlinenos = options.get('anchorlinenos', False)
self.hl_lines = set()
for lineno in get_list_opt(options, 'hl_lines', []):
@ -596,7 +633,8 @@ class HtmlFormatter(Formatter):
def _wrap_lineanchors(self, inner):
s = self.lineanchors
i = self.linenostart - 1 # subtract 1 since we have to increment i *before* yielding
i = self.linenostart - 1 # subtract 1 since we have to increment i
# *before* yielding
for t, line in inner:
if t:
i += 1
@ -604,6 +642,16 @@ class HtmlFormatter(Formatter):
else:
yield 0, line
def _wrap_linespans(self, inner):
s = self.linespans
i = self.linenostart - 1
for t, line in inner:
if t:
i += 1
yield 1, '<span id="%s-%d">%s</span>' % (s, i, line)
else:
yield 0, line
def _wrap_div(self, inner):
style = []
if (self.noclasses and not self.nobackground and
@ -643,6 +691,7 @@ class HtmlFormatter(Formatter):
getcls = self.ttype2class.get
c2s = self.class2style
escape_table = _escape_html_table
tagsfile = self.tagsfile
lspan = ''
line = ''
@ -659,6 +708,19 @@ class HtmlFormatter(Formatter):
parts = value.translate(escape_table).split('\n')
if tagsfile and ttype in Token.Name:
filename, linenumber = self._lookup_ctag(value)
if linenumber:
base, filename = os.path.split(filename)
if base:
base += '/'
filename, extension = os.path.splitext(filename)
url = self.tagurlformat % {'path': base, 'fname': filename,
'fext': extension}
parts[0] = "<a href=\"%s#%s-%d\">%s" % \
(url, self.lineanchors, linenumber, parts[0])
parts[-1] = parts[-1] + "</a>"
# for all but the last line
for part in parts[:-1]:
if line:
@ -688,6 +750,13 @@ class HtmlFormatter(Formatter):
if line:
yield 1, line + (lspan and '</span>') + lsep
def _lookup_ctag(self, token):
entry = ctags.TagEntry()
if self._ctags.find(entry, token, 0):
return entry['file'], entry['lineNumber']
else:
return None, None
def _highlight_lines(self, tokensource):
"""
Highlighted the lines specified in the `hl_lines` option by
@ -740,6 +809,8 @@ class HtmlFormatter(Formatter):
source = self._wrap_inlinelinenos(source)
if self.lineanchors:
source = self._wrap_lineanchors(source)
if self.linespans:
source = self._wrap_linespans(source)
source = self.wrap(source, outfile)
if self.linenos == 1:
source = self._wrap_tablelinenos(source)

View File

@ -5,7 +5,7 @@
Formatter for Pixmap output.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,7 +5,7 @@
Formatter for LaTeX fancyvrb output.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,7 +5,7 @@
Other formatters: NullFormatter, RawTokenFormatter.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -102,8 +102,6 @@ class RawTokenFormatter(Formatter):
outfile.write(text.encode())
flush = outfile.flush
lasttype = None
lastval = u''
if self.error_color:
for ttype, value in tokensource:
line = "%s\t%r\n" % (ttype, value)

View File

@ -5,7 +5,7 @@
A formatter that generates RTF files.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,7 +5,7 @@
Formatter for SVG output.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,7 +5,7 @@
Formatter for terminal output with ANSI sequences.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -11,7 +11,7 @@
Formatter version 1.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,10 +5,10 @@
Base lexer classes.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import re, itertools
from pygments.filter import apply_filters, Filter
from pygments.filters import get_filter_by_name
@ -18,7 +18,7 @@ from pygments.util import get_bool_opt, get_int_opt, get_list_opt, \
__all__ = ['Lexer', 'RegexLexer', 'ExtendedRegexLexer', 'DelegatingLexer',
'LexerContext', 'include', 'bygroups', 'using', 'this']
'LexerContext', 'include', 'inherit', 'bygroups', 'using', 'this']
_encoding_map = [('\xef\xbb\xbf', 'utf-8'),
@ -72,15 +72,18 @@ class Lexer(object):
#: Shortcuts for the lexer
aliases = []
#: fn match rules
#: File name globs
filenames = []
#: fn alias filenames
#: Secondary file name globs
alias_filenames = []
#: mime types
#: MIME types
mimetypes = []
#: Priority, should multiple lexers match and no content is provided
priority = 0
__metaclass__ = LexerMeta
def __init__(self, **options):
@ -163,6 +166,10 @@ class Lexer(object):
text = decoded
else:
text = text.decode(self.encoding)
else:
if text.startswith(u'\ufeff'):
text = text[len(u'\ufeff'):]
# text now *is* a unicode string
text = text.replace('\r\n', '\n')
text = text.replace('\r', '\n')
@ -238,6 +245,16 @@ class include(str):
pass
class _inherit(object):
"""
Indicates the a state should inherit from its superclass.
"""
def __repr__(self):
return 'inherit'
inherit = _inherit()
class combined(tuple):
"""
Indicates a state combined from multiple states.
@ -428,6 +445,9 @@ class RegexLexerMeta(LexerMeta):
tokens.extend(cls._process_state(unprocessed, processed,
str(tdef)))
continue
if isinstance(tdef, _inherit):
# processed already
continue
assert type(tdef) is tuple, "wrong rule def %r" % tdef
@ -456,6 +476,49 @@ class RegexLexerMeta(LexerMeta):
cls._process_state(tokendefs, processed, state)
return processed
def get_tokendefs(cls):
"""
Merge tokens from superclasses in MRO order, returning a single tokendef
dictionary.
Any state that is not defined by a subclass will be inherited
automatically. States that *are* defined by subclasses will, by
default, override that state in the superclass. If a subclass wishes to
inherit definitions from a superclass, it can use the special value
"inherit", which will cause the superclass' state definition to be
included at that point in the state.
"""
tokens = {}
inheritable = {}
for c in itertools.chain((cls,), cls.__mro__):
toks = c.__dict__.get('tokens', {})
for state, items in toks.iteritems():
curitems = tokens.get(state)
if curitems is None:
tokens[state] = items
try:
inherit_ndx = items.index(inherit)
except ValueError:
continue
inheritable[state] = inherit_ndx
continue
inherit_ndx = inheritable.pop(state, None)
if inherit_ndx is None:
continue
# Replace the "inherit" value with the items
curitems[inherit_ndx:inherit_ndx+1] = items
try:
new_inh_ndx = items.index(inherit)
except ValueError:
pass
else:
inheritable[state] = inherit_ndx + new_inh_ndx
return tokens
def __call__(cls, *args, **kwds):
"""Instantiate cls after preprocessing its token definitions."""
if '_tokens' not in cls.__dict__:
@ -465,7 +528,7 @@ class RegexLexerMeta(LexerMeta):
# don't process yet
pass
else:
cls._tokens = cls.process_tokendef('', cls.tokens)
cls._tokens = cls.process_tokendef('', cls.get_tokendefs())
return type.__call__(cls, *args, **kwds)
@ -606,7 +669,13 @@ class ExtendedRegexLexer(RegexLexer):
if new_state is not None:
# state transition
if isinstance(new_state, tuple):
ctx.stack.extend(new_state)
for state in new_state:
if state == '#pop':
ctx.stack.pop()
elif state == '#push':
ctx.stack.append(statestack[-1])
else:
ctx.stack.append(state)
elif isinstance(new_state, int):
# pop
del ctx.stack[new_state:]
@ -622,10 +691,10 @@ class ExtendedRegexLexer(RegexLexer):
break
if text[ctx.pos] == '\n':
# at EOL, reset state to "root"
ctx.pos += 1
ctx.stack = ['root']
statetokens = tokendefs['root']
yield ctx.pos, Text, u'\n'
ctx.pos += 1
continue
yield ctx.pos, Error, text[ctx.pos]
ctx.pos += 1
@ -694,4 +763,3 @@ def do_insertions(insertions, tokens):
except StopIteration:
insleft = False
break # not strictly necessary

View File

@ -5,7 +5,7 @@
Pygments lexers.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -113,7 +113,7 @@ def get_lexer_for_filename(_fn, code=None, **options):
# to find lexers which need it overridden.
if code:
return cls.analyse_text(code) + bonus
return bonus
return cls.priority + bonus
if matches:
matches.sort(key=get_rating)

View File

@ -10,7 +10,7 @@
TODO: perl/python script in Asymptote SVN similar to asy-list.pl but only
for function and variable names.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,7 +5,7 @@
ANSI Common Lisp builtins.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -1,9 +1,12 @@
# -*- coding: utf-8 -*-
"""
pygments.lexers._lassobuiltins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Built-in Lasso types, traits, and methods.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
BUILTINS = {

View File

@ -9,7 +9,7 @@
Do not edit the MODULES dict by hand.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -9,7 +9,7 @@
Do not alter the LEXERS dictionary by hand.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -31,6 +31,7 @@ LEXERS = {
'AppleScriptLexer': ('pygments.lexers.other', 'AppleScript', ('applescript',), ('*.applescript',), ()),
'AspectJLexer': ('pygments.lexers.jvm', 'AspectJ', ('aspectj',), ('*.aj',), ('text/x-aspectj',)),
'AsymptoteLexer': ('pygments.lexers.other', 'Asymptote', ('asy', 'asymptote'), ('*.asy',), ('text/x-asymptote',)),
'AutoItLexer': ('pygments.lexers.other', 'AutoIt', ('autoit', 'Autoit'), ('*.au3',), ('text/x-autoit',)),
'AutohotkeyLexer': ('pygments.lexers.other', 'autohotkey', ('ahk',), ('*.ahk', '*.ahkl'), ('text/x-autohotkey',)),
'AwkLexer': ('pygments.lexers.other', 'Awk', ('awk', 'gawk', 'mawk', 'nawk'), ('*.awk',), ('application/x-awk',)),
'BBCodeLexer': ('pygments.lexers.text', 'BBCode', ('bbcode',), (), ('text/x-bbcode',)),
@ -49,7 +50,8 @@ LEXERS = {
'CObjdumpLexer': ('pygments.lexers.asm', 'c-objdump', ('c-objdump',), ('*.c-objdump',), ('text/x-c-objdump',)),
'CSharpAspxLexer': ('pygments.lexers.dotnet', 'aspx-cs', ('aspx-cs',), ('*.aspx', '*.asax', '*.ascx', '*.ashx', '*.asmx', '*.axd'), ()),
'CSharpLexer': ('pygments.lexers.dotnet', 'C#', ('csharp', 'c#'), ('*.cs',), ('text/x-csharp',)),
'CUDALexer': ('pygments.lexers.compiled', 'CUDA', ('cuda', 'cu'), ('*.cu', '*.cuh'), ('text/x-cuda',)),
'Ca65Lexer': ('pygments.lexers.asm', 'ca65', ('ca65',), ('*.s',), ()),
'CbmBasicV2Lexer': ('pygments.lexers.other', 'CBM BASIC V2', ('cbmbas',), ('*.bas',), ()),
'CeylonLexer': ('pygments.lexers.jvm', 'Ceylon', ('ceylon',), ('*.ceylon',), ('text/x-ceylon',)),
'Cfengine3Lexer': ('pygments.lexers.other', 'CFEngine3', ('cfengine3', 'cf3'), ('*.cf',), ()),
'CheetahHtmlLexer': ('pygments.lexers.templates', 'HTML+Cheetah', ('html+cheetah', 'html+spitfire'), (), ('text/html+cheetah', 'text/html+spitfire')),
@ -57,12 +59,14 @@ LEXERS = {
'CheetahLexer': ('pygments.lexers.templates', 'Cheetah', ('cheetah', 'spitfire'), ('*.tmpl', '*.spt'), ('application/x-cheetah', 'application/x-spitfire')),
'CheetahXmlLexer': ('pygments.lexers.templates', 'XML+Cheetah', ('xml+cheetah', 'xml+spitfire'), (), ('application/xml+cheetah', 'application/xml+spitfire')),
'ClojureLexer': ('pygments.lexers.jvm', 'Clojure', ('clojure', 'clj'), ('*.clj',), ('text/x-clojure', 'application/x-clojure')),
'CobolFreeformatLexer': ('pygments.lexers.compiled', 'COBOLFree', ('cobolfree',), ('*.cbl', '*.CBL'), ()),
'CobolLexer': ('pygments.lexers.compiled', 'COBOL', ('cobol',), ('*.cob', '*.COB', '*.cpy', '*.CPY'), ('text/x-cobol',)),
'CoffeeScriptLexer': ('pygments.lexers.web', 'CoffeeScript', ('coffee-script', 'coffeescript'), ('*.coffee',), ('text/coffeescript',)),
'ColdfusionHtmlLexer': ('pygments.lexers.templates', 'Coldfusion HTML', ('cfm',), ('*.cfm', '*.cfml', '*.cfc'), ('application/x-coldfusion',)),
'ColdfusionLexer': ('pygments.lexers.templates', 'cfstatement', ('cfs',), (), ()),
'CommonLispLexer': ('pygments.lexers.functional', 'Common Lisp', ('common-lisp', 'cl'), ('*.cl', '*.lisp', '*.el'), ('text/x-common-lisp',)),
'CoqLexer': ('pygments.lexers.functional', 'Coq', ('coq',), ('*.v',), ('text/x-coq',)),
'CppLexer': ('pygments.lexers.compiled', 'C++', ('cpp', 'c++'), ('*.cpp', '*.hpp', '*.c++', '*.h++', '*.cc', '*.hh', '*.cxx', '*.hxx'), ('text/x-c++hdr', 'text/x-c++src')),
'CppLexer': ('pygments.lexers.compiled', 'C++', ('cpp', 'c++'), ('*.cpp', '*.hpp', '*.c++', '*.h++', '*.cc', '*.hh', '*.cxx', '*.hxx', '*.C', '*.H', '*.cp', '*.CPP'), ('text/x-c++hdr', 'text/x-c++src')),
'CppObjdumpLexer': ('pygments.lexers.asm', 'cpp-objdump', ('cpp-objdump', 'c++-objdumb', 'cxx-objdump'), ('*.cpp-objdump', '*.c++-objdump', '*.cxx-objdump'), ('text/x-cpp-objdump',)),
'CrocLexer': ('pygments.lexers.agile', 'Croc', ('croc',), ('*.croc',), ('text/x-crocsrc',)),
'CssDjangoLexer': ('pygments.lexers.templates', 'CSS+Django/Jinja', ('css+django', 'css+jinja'), (), ('text/css+django', 'text/css+jinja')),
@ -71,6 +75,7 @@ LEXERS = {
'CssLexer': ('pygments.lexers.web', 'CSS', ('css',), ('*.css',), ('text/css',)),
'CssPhpLexer': ('pygments.lexers.templates', 'CSS+PHP', ('css+php',), (), ('text/css+php',)),
'CssSmartyLexer': ('pygments.lexers.templates', 'CSS+Smarty', ('css+smarty',), (), ('text/css+smarty',)),
'CudaLexer': ('pygments.lexers.compiled', 'CUDA', ('cuda', 'cu'), ('*.cu', '*.cuh'), ('text/x-cuda',)),
'CythonLexer': ('pygments.lexers.compiled', 'Cython', ('cython', 'pyx'), ('*.pyx', '*.pxd', '*.pxi'), ('text/x-cython', 'application/x-cython')),
'DLexer': ('pygments.lexers.compiled', 'D', ('d',), ('*.d', '*.di'), ('text/x-dsrc',)),
'DObjdumpLexer': ('pygments.lexers.asm', 'd-objdump', ('d-objdump',), ('*.d-objdump',), ('text/x-d-objdump',)),
@ -78,11 +83,14 @@ LEXERS = {
'DartLexer': ('pygments.lexers.web', 'Dart', ('dart',), ('*.dart',), ('text/x-dart',)),
'DebianControlLexer': ('pygments.lexers.text', 'Debian Control file', ('control',), ('control',), ()),
'DelphiLexer': ('pygments.lexers.compiled', 'Delphi', ('delphi', 'pas', 'pascal', 'objectpascal'), ('*.pas',), ('text/x-pascal',)),
'DgLexer': ('pygments.lexers.agile', 'dg', ('dg',), ('*.dg',), ('text/x-dg',)),
'DiffLexer': ('pygments.lexers.text', 'Diff', ('diff', 'udiff'), ('*.diff', '*.patch'), ('text/x-diff', 'text/x-patch')),
'DjangoLexer': ('pygments.lexers.templates', 'Django/Jinja', ('django', 'jinja'), (), ('application/x-django-templating', 'application/x-jinja')),
'DtdLexer': ('pygments.lexers.web', 'DTD', ('dtd',), ('*.dtd',), ('application/xml-dtd',)),
'DuelLexer': ('pygments.lexers.web', 'Duel', ('duel', 'Duel Engine', 'Duel View', 'JBST', 'jbst', 'JsonML+BST'), ('*.duel', '*.jbst'), ('text/x-duel', 'text/x-jbst')),
'DylanLexer': ('pygments.lexers.compiled', 'Dylan', ('dylan',), ('*.dylan', '*.dyl'), ('text/x-dylan',)),
'DylanConsoleLexer': ('pygments.lexers.compiled', 'Dylan session', ('dylan-console', 'dylan-repl'), ('*.dylan-console',), ('text/x-dylan-console',)),
'DylanLexer': ('pygments.lexers.compiled', 'Dylan', ('dylan',), ('*.dylan', '*.dyl', '*.intr'), ('text/x-dylan',)),
'DylanLidLexer': ('pygments.lexers.compiled', 'DylanLID', ('dylan-lid', 'lid'), ('*.lid', '*.hdp'), ('text/x-dylan-lid',)),
'ECLLexer': ('pygments.lexers.other', 'ECL', ('ecl',), ('*.ecl',), ('application/x-ecl',)),
'ECLexer': ('pygments.lexers.compiled', 'eC', ('ec',), ('*.ec', '*.eh'), ('text/x-echdr', 'text/x-ecsrc')),
'ElixirConsoleLexer': ('pygments.lexers.functional', 'Elixir iex session', ('iex',), (), ('text/x-elixir-shellsession',)),
@ -99,6 +107,7 @@ LEXERS = {
'FantomLexer': ('pygments.lexers.compiled', 'Fantom', ('fan',), ('*.fan',), ('application/x-fantom',)),
'FelixLexer': ('pygments.lexers.compiled', 'Felix', ('felix', 'flx'), ('*.flx', '*.flxh'), ('text/x-felix',)),
'FortranLexer': ('pygments.lexers.compiled', 'Fortran', ('fortran',), ('*.f', '*.f90', '*.F', '*.F90'), ('text/x-fortran',)),
'FoxProLexer': ('pygments.lexers.foxpro', 'FoxPro', ('Clipper', 'XBase'), ('*.PRG', '*.prg'), ()),
'GLShaderLexer': ('pygments.lexers.compiled', 'GLSL', ('glsl',), ('*.vert', '*.frag', '*.geo'), ('text/x-glslsrc',)),
'GasLexer': ('pygments.lexers.asm', 'GAS', ('gas',), ('*.s', '*.S'), ('text/x-gas',)),
'GenshiLexer': ('pygments.lexers.templates', 'Genshi', ('genshi', 'kid', 'xml+genshi', 'xml+kid'), ('*.kid',), ('application/x-genshi', 'application/x-kid')),
@ -121,7 +130,9 @@ LEXERS = {
'HtmlPhpLexer': ('pygments.lexers.templates', 'HTML+PHP', ('html+php',), ('*.phtml',), ('application/x-php', 'application/x-httpd-php', 'application/x-httpd-php3', 'application/x-httpd-php4', 'application/x-httpd-php5')),
'HtmlSmartyLexer': ('pygments.lexers.templates', 'HTML+Smarty', ('html+smarty',), (), ('text/html+smarty',)),
'HttpLexer': ('pygments.lexers.text', 'HTTP', ('http',), (), ()),
'HxmlLexer': ('pygments.lexers.text', 'Hxml', ('haxeml', 'hxml'), ('*.hxml',), ()),
'HybrisLexer': ('pygments.lexers.other', 'Hybris', ('hybris', 'hy'), ('*.hy', '*.hyb'), ('text/x-hybris', 'application/x-hybris')),
'IDLLexer': ('pygments.lexers.math', 'IDL', ('idl',), ('*.pro',), ('text/idl',)),
'IniLexer': ('pygments.lexers.text', 'INI', ('ini', 'cfg'), ('*.ini', '*.cfg'), ('text/x-ini',)),
'IoLexer': ('pygments.lexers.agile', 'Io', ('io',), ('*.io',), ('text/x-iosrc',)),
'IokeLexer': ('pygments.lexers.jvm', 'Ioke', ('ioke', 'ik'), ('*.ik',), ('text/x-iokesrc',)),
@ -151,6 +162,7 @@ LEXERS = {
'LiterateHaskellLexer': ('pygments.lexers.functional', 'Literate Haskell', ('lhs', 'literate-haskell'), ('*.lhs',), ('text/x-literate-haskell',)),
'LiveScriptLexer': ('pygments.lexers.web', 'LiveScript', ('live-script', 'livescript'), ('*.ls',), ('text/livescript',)),
'LlvmLexer': ('pygments.lexers.asm', 'LLVM', ('llvm',), ('*.ll',), ('text/x-llvm',)),
'LogosLexer': ('pygments.lexers.compiled', 'Logos', ('logos',), ('*.x', '*.xi', '*.xm', '*.xmi'), ('text/x-logos',)),
'LogtalkLexer': ('pygments.lexers.other', 'Logtalk', ('logtalk',), ('*.lgt',), ('text/x-logtalk',)),
'LuaLexer': ('pygments.lexers.agile', 'Lua', ('lua',), ('*.lua', '*.wlua'), ('text/x-lua', 'application/x-lua')),
'MOOCodeLexer': ('pygments.lexers.other', 'MOOCode', ('moocode',), ('*.moo',), ('text/x-moocode',)),
@ -168,6 +180,7 @@ LEXERS = {
'ModelicaLexer': ('pygments.lexers.other', 'Modelica', ('modelica',), ('*.mo',), ('text/x-modelica',)),
'Modula2Lexer': ('pygments.lexers.compiled', 'Modula-2', ('modula2', 'm2'), ('*.def', '*.mod'), ('text/x-modula2',)),
'MoinWikiLexer': ('pygments.lexers.text', 'MoinMoin/Trac Wiki markup', ('trac-wiki', 'moin'), (), ('text/x-trac-wiki',)),
'MonkeyLexer': ('pygments.lexers.compiled', 'Monkey', ('monkey',), ('*.monkey',), ('text/x-monkey',)),
'MoonScriptLexer': ('pygments.lexers.agile', 'MoonScript', ('moon', 'moonscript'), ('*.moon',), ('text/x-moonscript', 'application/x-moonscript')),
'MscgenLexer': ('pygments.lexers.other', 'Mscgen', ('mscgen', 'msc'), ('*.msc',), ()),
'MuPADLexer': ('pygments.lexers.math', 'MuPAD', ('mupad',), ('*.mu',), ()),
@ -178,6 +191,7 @@ LEXERS = {
'MyghtyJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Myghty', ('js+myghty', 'javascript+myghty'), (), ('application/x-javascript+myghty', 'text/x-javascript+myghty', 'text/javascript+mygthy')),
'MyghtyLexer': ('pygments.lexers.templates', 'Myghty', ('myghty',), ('*.myt', 'autodelegate'), ('application/x-myghty',)),
'MyghtyXmlLexer': ('pygments.lexers.templates', 'XML+Myghty', ('xml+myghty',), (), ('application/xml+myghty',)),
'NSISLexer': ('pygments.lexers.other', 'NSIS', ('nsis', 'nsi', 'nsh'), ('*.nsi', '*.nsh'), ('text/x-nsis',)),
'NasmLexer': ('pygments.lexers.asm', 'NASM', ('nasm',), ('*.asm', '*.ASM'), ('text/x-nasm',)),
'NemerleLexer': ('pygments.lexers.dotnet', 'Nemerle', ('nemerle',), ('*.n',), ('text/x-nemerle',)),
'NewLispLexer': ('pygments.lexers.functional', 'NewLisp', ('newlisp',), ('*.lsp', '*.nl'), ('text/x-newlisp', 'application/x-newlisp')),
@ -186,7 +200,8 @@ LEXERS = {
'NimrodLexer': ('pygments.lexers.compiled', 'Nimrod', ('nimrod', 'nim'), ('*.nim', '*.nimrod'), ('text/x-nimrod',)),
'NumPyLexer': ('pygments.lexers.math', 'NumPy', ('numpy',), (), ()),
'ObjdumpLexer': ('pygments.lexers.asm', 'objdump', ('objdump',), ('*.objdump',), ('text/x-objdump',)),
'ObjectiveCLexer': ('pygments.lexers.compiled', 'Objective-C', ('objective-c', 'objectivec', 'obj-c', 'objc'), ('*.m',), ('text/x-objective-c',)),
'ObjectiveCLexer': ('pygments.lexers.compiled', 'Objective-C', ('objective-c', 'objectivec', 'obj-c', 'objc'), ('*.m', '*.h'), ('text/x-objective-c',)),
'ObjectiveCppLexer': ('pygments.lexers.compiled', 'Objective-C++', ('objective-c++', 'objectivec++', 'obj-c++', 'objc++'), ('*.mm', '*.hh'), ('text/x-objective-c++',)),
'ObjectiveJLexer': ('pygments.lexers.web', 'Objective-J', ('objective-j', 'objectivej', 'obj-j', 'objj'), ('*.j',), ('text/x-objective-j',)),
'OcamlLexer': ('pygments.lexers.functional', 'OCaml', ('ocaml',), ('*.ml', '*.mli', '*.mll', '*.mly'), ('text/x-ocaml',)),
'OctaveLexer': ('pygments.lexers.math', 'Octave', ('octave',), ('*.m',), ('text/octave',)),
@ -194,7 +209,7 @@ LEXERS = {
'OpaLexer': ('pygments.lexers.functional', 'Opa', ('opa',), ('*.opa',), ('text/x-opa',)),
'OpenEdgeLexer': ('pygments.lexers.other', 'OpenEdge ABL', ('openedge', 'abl', 'progress'), ('*.p', '*.cls'), ('text/x-openedge', 'application/x-openedge')),
'PerlLexer': ('pygments.lexers.agile', 'Perl', ('perl', 'pl'), ('*.pl', '*.pm'), ('text/x-perl', 'application/x-perl')),
'PhpLexer': ('pygments.lexers.web', 'PHP', ('php', 'php3', 'php4', 'php5'), ('*.php', '*.php[345]'), ('text/x-php',)),
'PhpLexer': ('pygments.lexers.web', 'PHP', ('php', 'php3', 'php4', 'php5'), ('*.php', '*.php[345]', '*.inc'), ('text/x-php',)),
'PlPgsqlLexer': ('pygments.lexers.sql', 'PL/pgSQL', ('plpgsql',), (), ('text/x-plpgsql',)),
'PostScriptLexer': ('pygments.lexers.other', 'PostScript', ('postscript',), ('*.ps', '*.eps'), ('application/postscript',)),
'PostgresConsoleLexer': ('pygments.lexers.sql', 'PostgreSQL console (psql)', ('psql', 'postgresql-console', 'postgres-console'), (), ('text/x-postgresql-psql',)),
@ -204,13 +219,16 @@ LEXERS = {
'PrologLexer': ('pygments.lexers.compiled', 'Prolog', ('prolog',), ('*.prolog', '*.pro', '*.pl'), ('text/x-prolog',)),
'PropertiesLexer': ('pygments.lexers.text', 'Properties', ('properties',), ('*.properties',), ('text/x-java-properties',)),
'ProtoBufLexer': ('pygments.lexers.other', 'Protocol Buffer', ('protobuf',), ('*.proto',), ()),
'PuppetLexer': ('pygments.lexers.other', 'Puppet', ('puppet',), ('*.pp',), ()),
'PyPyLogLexer': ('pygments.lexers.text', 'PyPy Log', ('pypylog', 'pypy'), ('*.pypylog',), ('application/x-pypylog',)),
'Python3Lexer': ('pygments.lexers.agile', 'Python 3', ('python3', 'py3'), (), ('text/x-python3', 'application/x-python3')),
'Python3TracebackLexer': ('pygments.lexers.agile', 'Python 3.0 Traceback', ('py3tb',), ('*.py3tb',), ('text/x-python3-traceback',)),
'PythonConsoleLexer': ('pygments.lexers.agile', 'Python console session', ('pycon',), (), ('text/x-python-doctest',)),
'PythonLexer': ('pygments.lexers.agile', 'Python', ('python', 'py', 'sage'), ('*.py', '*.pyw', '*.sc', 'SConstruct', 'SConscript', '*.tac', '*.sage'), ('text/x-python', 'application/x-python')),
'PythonTracebackLexer': ('pygments.lexers.agile', 'Python Traceback', ('pytb',), ('*.pytb',), ('text/x-python-traceback',)),
'QmlLexer': ('pygments.lexers.web', 'QML', ('qml', 'Qt Meta Language', 'Qt modeling Language'), ('*.qml',), ('application/x-qml',)),
'RConsoleLexer': ('pygments.lexers.math', 'RConsole', ('rconsole', 'rout'), ('*.Rout',), ()),
'RPMSpecLexer': ('pygments.lexers.other', 'RPMSpec', ('spec',), ('*.spec',), ('text/x-rpm-spec',)),
'RacketLexer': ('pygments.lexers.functional', 'Racket', ('racket', 'rkt'), ('*.rkt', '*.rktl'), ('text/x-racket', 'application/x-racket')),
'RagelCLexer': ('pygments.lexers.parsers', 'Ragel in C Host', ('ragel-c',), ('*.rl',), ()),
'RagelCppLexer': ('pygments.lexers.parsers', 'Ragel in CPP Host', ('ragel-cpp',), ('*.rl',), ()),
@ -224,7 +242,9 @@ LEXERS = {
'RdLexer': ('pygments.lexers.math', 'Rd', ('rd',), ('*.Rd',), ('text/x-r-doc',)),
'RebolLexer': ('pygments.lexers.other', 'REBOL', ('rebol',), ('*.r', '*.r3'), ('text/x-rebol',)),
'RedcodeLexer': ('pygments.lexers.other', 'Redcode', ('redcode',), ('*.cw',), ()),
'RegeditLexer': ('pygments.lexers.text', 'reg', ('registry',), ('*.reg',), ('text/x-windows-registry',)),
'RhtmlLexer': ('pygments.lexers.templates', 'RHTML', ('rhtml', 'html+erb', 'html+ruby'), ('*.rhtml',), ('text/html+ruby',)),
'RobotFrameworkLexer': ('pygments.lexers.other', 'RobotFramework', ('RobotFramework', 'robotframework'), ('*.txt', '*.robot'), ('text/x-robotframework',)),
'RstLexer': ('pygments.lexers.text', 'reStructuredText', ('rst', 'rest', 'restructuredtext'), ('*.rst', '*.rest'), ('text/x-rst', 'text/prs.fallenstein.rst')),
'RubyConsoleLexer': ('pygments.lexers.agile', 'Ruby irb session', ('rbcon', 'irb'), (), ('text/x-ruby-shellsession',)),
'RubyLexer': ('pygments.lexers.agile', 'Ruby', ('rb', 'ruby', 'duby'), ('*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec', '*.rbx', '*.duby'), ('text/x-ruby', 'application/x-ruby')),
@ -237,6 +257,8 @@ LEXERS = {
'SchemeLexer': ('pygments.lexers.functional', 'Scheme', ('scheme', 'scm'), ('*.scm', '*.ss'), ('text/x-scheme', 'application/x-scheme')),
'ScilabLexer': ('pygments.lexers.math', 'Scilab', ('scilab',), ('*.sci', '*.sce', '*.tst'), ('text/scilab',)),
'ScssLexer': ('pygments.lexers.web', 'SCSS', ('scss',), ('*.scss',), ('text/x-scss',)),
'ShellSessionLexer': ('pygments.lexers.shell', 'Shell Session', ('shell-session',), ('*.shell-session',), ('application/x-sh-session',)),
'SmaliLexer': ('pygments.lexers.dalvik', 'Smali', ('smali',), ('*.smali',), ('text/smali',)),
'SmalltalkLexer': ('pygments.lexers.other', 'Smalltalk', ('smalltalk', 'squeak'), ('*.st',), ('text/x-smalltalk',)),
'SmartyLexer': ('pygments.lexers.templates', 'Smarty', ('smarty',), ('*.tpl',), ('application/x-smarty',)),
'SnobolLexer': ('pygments.lexers.other', 'Snobol', ('snobol',), ('*.snobol',), ('text/x-snobol',)),
@ -247,12 +269,14 @@ LEXERS = {
'SquidConfLexer': ('pygments.lexers.text', 'SquidConf', ('squidconf', 'squid.conf', 'squid'), ('squid.conf',), ('text/x-squidconf',)),
'SspLexer': ('pygments.lexers.templates', 'Scalate Server Page', ('ssp',), ('*.ssp',), ('application/x-ssp',)),
'StanLexer': ('pygments.lexers.math', 'Stan', ('stan',), ('*.stan',), ()),
'SystemVerilogLexer': ('pygments.lexers.hdl', 'systemverilog', ('sv',), ('*.sv', '*.svh'), ('text/x-systemverilog',)),
'SystemVerilogLexer': ('pygments.lexers.hdl', 'systemverilog', ('systemverilog', 'sv'), ('*.sv', '*.svh'), ('text/x-systemverilog',)),
'TclLexer': ('pygments.lexers.agile', 'Tcl', ('tcl',), ('*.tcl',), ('text/x-tcl', 'text/x-script.tcl', 'application/x-tcl')),
'TcshLexer': ('pygments.lexers.shell', 'Tcsh', ('tcsh', 'csh'), ('*.tcsh', '*.csh'), ('application/x-csh',)),
'TeaTemplateLexer': ('pygments.lexers.templates', 'Tea', ('tea',), ('*.tea',), ('text/x-tea',)),
'TexLexer': ('pygments.lexers.text', 'TeX', ('tex', 'latex'), ('*.tex', '*.aux', '*.toc'), ('text/x-tex', 'text/x-latex')),
'TextLexer': ('pygments.lexers.special', 'Text only', ('text',), ('*.txt',), ('text/plain',)),
'TreetopLexer': ('pygments.lexers.parsers', 'Treetop', ('treetop',), ('*.treetop', '*.tt'), ()),
'TypeScriptLexer': ('pygments.lexers.web', 'TypeScript', ('ts',), ('*.ts',), ('text/x-typescript',)),
'UrbiscriptLexer': ('pygments.lexers.other', 'UrbiScript', ('urbiscript',), ('*.u',), ('application/x-urbiscript',)),
'VGLLexer': ('pygments.lexers.other', 'VGL', ('vgl',), ('*.rpf',), ()),
'ValaLexer': ('pygments.lexers.compiled', 'Vala', ('vala', 'vapi'), ('*.vala', '*.vapi'), ('text/x-vala',)),
@ -261,7 +285,7 @@ LEXERS = {
'VelocityHtmlLexer': ('pygments.lexers.templates', 'HTML+Velocity', ('html+velocity',), (), ('text/html+velocity',)),
'VelocityLexer': ('pygments.lexers.templates', 'Velocity', ('velocity',), ('*.vm', '*.fhtml'), ()),
'VelocityXmlLexer': ('pygments.lexers.templates', 'XML+Velocity', ('xml+velocity',), (), ('application/xml+velocity',)),
'VerilogLexer': ('pygments.lexers.hdl', 'verilog', ('v',), ('*.v',), ('text/x-verilog',)),
'VerilogLexer': ('pygments.lexers.hdl', 'verilog', ('verilog', 'v'), ('*.v',), ('text/x-verilog',)),
'VhdlLexer': ('pygments.lexers.hdl', 'vhdl', ('vhdl',), ('*.vhdl', '*.vhd'), ('text/x-vhdl',)),
'VimLexer': ('pygments.lexers.text', 'VimL', ('vim',), ('*.vim', '.vimrc', '.exrc', '.gvimrc', '_vimrc', '_exrc', '_gvimrc', 'vimrc', 'gvimrc'), ('text/x-vim',)),
'XQueryLexer': ('pygments.lexers.web', 'XQuery', ('xquery', 'xqy', 'xq', 'xql', 'xqm'), ('*.xqy', '*.xquery', '*.xq', '*.xql', '*.xqm'), ('text/xquery', 'application/xquery')),
@ -309,9 +333,8 @@ if __name__ == '__main__':
footer = content[content.find("if __name__ == '__main__':"):]
# write new file
f = open(__file__, 'w')
f = open(__file__, 'wb')
f.write(header)
f.write('LEXERS = {\n %s,\n}\n\n' % ',\n '.join(found_lexers))
f.write(footer)
f.close()

View File

@ -1,3 +1,14 @@
# -*- coding: utf-8 -*-
"""
pygments.lexers._openedgebuiltins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Builtin list for the OpenEdgeLexer.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
OPENEDGEKEYWORDS = [
'ABSOLUTE', 'ABS', 'ABSO', 'ABSOL', 'ABSOLU', 'ABSOLUT', 'ACCELERATOR',
'ACCUM', 'ACCUMULATE', 'ACCUM', 'ACCUMU', 'ACCUMUL', 'ACCUMULA',

View File

@ -12,7 +12,7 @@
internet connection. don't run that at home, use
a server ;-)
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -3784,4 +3784,4 @@ if __name__ == '__main__':
regenerate(__file__, modules)
shutil.rmtree(PHP_MANUAL_DIR)
run()
run()

View File

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
"""
pygments.lexers._postgres_builtins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Self-updating data files for PostgreSQL lexer.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -41,7 +42,6 @@ def parse_keywords(f):
def parse_datatypes(f):
dt = set()
re_entry = re.compile('\s*<entry><type>([^<]+)</type></entry>')
for line in f:
if '<sect1' in line:
break
@ -57,7 +57,8 @@ def parse_datatypes(f):
line = re.sub("<[^>]+>", "", line)
# Drop the parts containing braces
for tmp in [ t for tmp in line.split('[') for t in tmp.split(']') if "(" not in t ]:
for tmp in [t for tmp in line.split('[')
for t in tmp.split(']') if "(" not in t]:
for t in tmp.split(','):
t = t.strip()
if not t: continue

View File

@ -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

View File

@ -1,3 +1,14 @@
# -*- coding: utf-8 -*-
"""
pygments.lexers._scilab_builtins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Builtin list for the ScilabLexer.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
# These lists are generated automatically.
# Run the following in a Scilab script:
#

View File

@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
"""
pygments.lexers._sourcemodbuiltins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This file contains the names of SourceMod functions.
It is able to re-generate itself.
Do not edit the FUNCTIONS list by hand.
:copyright: Copyright 2006-2011 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
"""
pygments.lexers._stan_builtins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pygments.lexers._stan_builtins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This file contains the names of functions for Stan used by
``pygments.lexers.math.StanLexer.
This file contains the names of functions for Stan used by
``pygments.lexers.math.StanLexer.
:copyright: Copyright 2012 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
CONSTANTS=[ 'e',

View File

@ -5,7 +5,7 @@
Lexers for agile languages.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -22,7 +22,8 @@ from pygments import unistring as uni
__all__ = ['PythonLexer', 'PythonConsoleLexer', 'PythonTracebackLexer',
'Python3Lexer', 'Python3TracebackLexer', 'RubyLexer',
'RubyConsoleLexer', 'PerlLexer', 'LuaLexer', 'MoonScriptLexer',
'CrocLexer', 'MiniDLexer', 'IoLexer', 'TclLexer', 'FactorLexer', 'FancyLexer']
'CrocLexer', 'MiniDLexer', 'IoLexer', 'TclLexer', 'FactorLexer',
'FancyLexer', 'DgLexer']
# b/w compatibility
from pygments.lexers.functional import SchemeLexer
@ -392,7 +393,7 @@ class PythonTracebackLexer(RegexLexer):
bygroups(Text, using(PythonLexer), Text)),
(r'^([ \t]*)(\.\.\.)(\n)',
bygroups(Text, Comment, Text)), # for doctests...
(r'^(.+)(: )(.+)(\n)',
(r'^([^:]+)(: )(.+)(\n)',
bygroups(Generic.Error, Text, Name, Text), '#pop'),
(r'^([a-zA-Z_][a-zA-Z0-9_]*)(:?\n)',
bygroups(Generic.Error, Text), '#pop')
@ -428,7 +429,7 @@ class Python3TracebackLexer(RegexLexer):
bygroups(Text, using(Python3Lexer), Text)),
(r'^([ \t]*)(\.\.\.)(\n)',
bygroups(Text, Comment, Text)), # for doctests...
(r'^(.+)(: )(.+)(\n)',
(r'^([^:]+)(: )(.+)(\n)',
bygroups(Generic.Error, Text, Name, Text), '#pop'),
(r'^([a-zA-Z_][a-zA-Z0-9_]*)(:?\n)',
bygroups(Generic.Error, Text), '#pop')
@ -520,6 +521,8 @@ class RubyLexer(ExtendedRegexLexer):
(r":'(\\\\|\\'|[^'])*'", String.Symbol),
(r"'(\\\\|\\'|[^'])*'", String.Single),
(r':"', String.Symbol, 'simple-sym'),
(r'([a-zA-Z_][a-zA-Z0-9]*)(:)',
bygroups(String.Symbol, Punctuation)), # Since Ruby 1.9
(r'"', String.Double, 'simple-string'),
(r'(?<!\.)`', String.Backtick, 'simple-backtick'),
]
@ -604,7 +607,8 @@ class RubyLexer(ExtendedRegexLexer):
r'rescue|raise|retry|return|super|then|undef|unless|until|when|'
r'while|yield)\b', Keyword),
# start of function, class and module names
(r'(module)(\s+)([a-zA-Z_][a-zA-Z0-9_]*(::[a-zA-Z_][a-zA-Z0-9_]*)*)',
(r'(module)(\s+)([a-zA-Z_][a-zA-Z0-9_]*'
r'(?:::[a-zA-Z_][a-zA-Z0-9_]*)*)',
bygroups(Keyword, Text, Name.Namespace)),
(r'(def)(\s+)', bygroups(Keyword, Text), 'funcname'),
(r'def(?=[*%&^`~+-/\[<>=])', Keyword, 'funcname'),
@ -649,7 +653,7 @@ class RubyLexer(ExtendedRegexLexer):
(r'(<<-?)("|\')()(\2)(.*?\n)', heredoc_callback),
(r'__END__', Comment.Preproc, 'end-part'),
# multiline regex (after keywords or assignments)
(r'(?:^|(?<=[=<>~!])|'
(r'(?:^|(?<=[=<>~!:])|'
r'(?<=(?:\s|;)when\s)|'
r'(?<=(?:\s|;)or\s)|'
r'(?<=(?:\s|;)and\s)|'
@ -1221,7 +1225,8 @@ class CrocLexer(RegexLexer):
r'|this|throw|try|vararg|while|with|yield)\b', Keyword),
(r'(false|true|null)\b', Keyword.Constant),
# FloatLiteral
(r'([0-9][0-9_]*)(?=[.eE])(\.[0-9][0-9_]*)?([eE][+\-]?[0-9_]+)?', Number.Float),
(r'([0-9][0-9_]*)(?=[.eE])(\.[0-9][0-9_]*)?([eE][+\-]?[0-9_]+)?',
Number.Float),
# IntegerLiteral
# -- Binary
(r'0[bB][01][01_]*', Number),
@ -1815,3 +1820,98 @@ class FancyLexer(RegexLexer):
(r'\d+', Number.Integer)
]
}
class DgLexer(RegexLexer):
"""
Lexer for `dg <http://pyos.github.com/dg>`_,
a functional and object-oriented programming language
running on the CPython 3 VM.
*New in Pygments 1.6.*
"""
name = 'dg'
aliases = ['dg']
filenames = ['*.dg']
mimetypes = ['text/x-dg']
tokens = {
'root': [
# Whitespace:
(r'\s+', Text),
(r'#.*?$', Comment.Single),
# Lexemes:
# Numbers
(r'0[bB][01]+', Number.Bin),
(r'0[oO][0-7]+', Number.Oct),
(r'0[xX][\da-fA-F]+', Number.Hex),
(r'[+-]?\d+\.\d+([eE][+-]?\d+)?[jJ]?', Number.Float),
(r'[+-]?\d+[eE][+-]?\d+[jJ]?', Number.Float),
(r'[+-]?\d+[jJ]?', Number.Integer),
# Character/String Literals
(r"[br]*'''", String, combined('stringescape', 'tsqs', 'string')),
(r'[br]*"""', String, combined('stringescape', 'tdqs', 'string')),
(r"[br]*'", String, combined('stringescape', 'sqs', 'string')),
(r'[br]*"', String, combined('stringescape', 'dqs', 'string')),
# Operators
(r"`\w+'*`", Operator), # Infix links
# Reserved infix links
(r'\b(or|and|if|else|where|is|in)\b', Operator.Word),
(r'[!$%&*+\-./:<-@\\^|~;,]+', Operator),
# Identifiers
# Python 3 types
(r"(?<!\.)(bool|bytearray|bytes|classmethod|complex|dict'?|"
r"float|frozenset|int|list'?|memoryview|object|property|range|"
r"set'?|slice|staticmethod|str|super|tuple'?|type)"
r"(?!['\w])", Name.Builtin),
# Python 3 builtins + some more
(r'(?<!\.)(__import__|abs|all|any|bin|bind|chr|cmp|compile|complex|'
r'delattr|dir|divmod|drop|dropwhile|enumerate|eval|filter|flip|'
r'foldl1?|format|fst|getattr|globals|hasattr|hash|head|hex|id|'
r'init|input|isinstance|issubclass|iter|iterate|last|len|locals|'
r'map|max|min|next|oct|open|ord|pow|print|repr|reversed|round|'
r'setattr|scanl1?|snd|sorted|sum|tail|take|takewhile|vars|zip)'
r"(?!['\w])", Name.Builtin),
(r"(?<!\.)(self|Ellipsis|NotImplemented|None|True|False)(?!['\w])",
Name.Builtin.Pseudo),
(r"(?<!\.)[A-Z]\w*(Error|Exception|Warning)'*(?!['\w])",
Name.Exception),
(r"(?<!\.)(KeyboardInterrupt|SystemExit|StopIteration|"
r"GeneratorExit)(?!['\w])", Name.Exception),
# Compiler-defined identifiers
(r"(?<![\.\w])(import|inherit|for|while|switch|not|raise|unsafe|"
r"yield|with)(?!['\w])", Keyword.Reserved),
# Other links
(r"[A-Z_']+\b", Name),
(r"[A-Z][\w']*\b", Keyword.Type),
(r"\w+'*", Name),
# Blocks
(r'[()]', Punctuation),
],
'stringescape': [
(r'\\([\\abfnrtv"\']|\n|N{.*?}|u[a-fA-F0-9]{4}|'
r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
],
'string': [
(r'%(\([a-zA-Z0-9_]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?'
'[hlL]?[diouxXeEfFgGcrs%]', String.Interpol),
(r'[^\\\'"%\n]+', String),
# quotes, percents and backslashes must be parsed one at a time
(r'[\'"\\]', String),
# unhandled string formatting sign
(r'%', String),
(r'\n', String)
],
'dqs': [
(r'"', String, '#pop')
],
'sqs': [
(r"'", String, '#pop')
],
'tdqs': [
(r'"""', String, '#pop')
],
'tsqs': [
(r"'''", String, '#pop')
],
}

View File

@ -5,7 +5,7 @@
Lexers for assembly languages.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -17,7 +17,7 @@ from pygments.token import Text, Name, Number, String, Comment, Punctuation, \
Other, Keyword, Operator
__all__ = ['GasLexer', 'ObjdumpLexer','DObjdumpLexer', 'CppObjdumpLexer',
'CObjdumpLexer', 'LlvmLexer', 'NasmLexer']
'CObjdumpLexer', 'LlvmLexer', 'NasmLexer', 'Ca65Lexer']
class GasLexer(RegexLexer):
@ -240,8 +240,8 @@ class LlvmLexer(RegexLexer):
r'|linkonce_odr|weak|weak_odr|appending|dllimport|dllexport'
r'|common|default|hidden|protected|extern_weak|external'
r'|thread_local|zeroinitializer|undef|null|to|tail|target|triple'
r'|deplibs|datalayout|volatile|nuw|nsw|exact|inbounds|align'
r'|addrspace|section|alias|module|asm|sideeffect|gc|dbg'
r'|datalayout|volatile|nuw|nsw|nnan|ninf|nsz|arcp|fast|exact|inbounds'
r'|align|addrspace|section|alias|module|asm|sideeffect|gc|dbg'
r'|ccc|fastcc|coldcc|x86_stdcallcc|x86_fastcallcc|arm_apcscc'
r'|arm_aapcscc|arm_aapcs_vfpcc'
@ -358,3 +358,41 @@ class NasmLexer(RegexLexer):
(type, Keyword.Type)
],
}
class Ca65Lexer(RegexLexer):
"""
For ca65 assembler sources.
*New in Pygments 1.6.*
"""
name = 'ca65'
aliases = ['ca65']
filenames = ['*.s']
flags = re.IGNORECASE
tokens = {
'root': [
(r';.*', Comment.Single),
(r'\s+', Text),
(r'[a-z_.@$][\w.@$]*:', Name.Label),
(r'((ld|st)[axy]|(in|de)[cxy]|asl|lsr|ro[lr]|adc|sbc|cmp|cp[xy]'
r'|cl[cvdi]|se[cdi]|jmp|jsr|bne|beq|bpl|bmi|bvc|bvs|bcc|bcs'
r'|p[lh][ap]|rt[is]|brk|nop|ta[xy]|t[xy]a|txs|tsx|and|ora|eor'
r'|bit)\b', Keyword),
(r'\.[a-z0-9_]+', Keyword.Pseudo),
(r'[-+~*/^&|!<>=]', Operator),
(r'"[^"\n]*.', String),
(r"'[^'\n]*.", String.Char),
(r'\$[0-9a-f]+|[0-9a-f]+h\b', Number.Hex),
(r'\d+|%[01]+', Number.Integer),
(r'[#,.:()=]', Punctuation),
(r'[a-z_.@$][\w.@$]*', Name),
]
}
def analyse_text(self, text):
# comments in GAS start with "#"
if re.match(r'^\s*;', text, re.MULTILINE):
return 0.9

File diff suppressed because it is too large Load Diff

View File

@ -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),
],
}

View File

@ -5,7 +5,7 @@
Lexers for .net languages.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re

View File

@ -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*\*|&&|&amp;&amp;).*?\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'),
],
}

View File

@ -5,7 +5,7 @@
Lexers for functional languages.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -23,7 +23,8 @@ __all__ = ['RacketLexer', 'SchemeLexer', 'CommonLispLexer', 'HaskellLexer',
class RacketLexer(RegexLexer):
"""
Lexer for Racket source code.
Lexer for `Racket <http://racket-lang.org/>`_ source code (formerly known as
PLT Scheme).
*New in Pygments 1.6.*
"""
@ -1664,7 +1665,7 @@ class OpaLexer(RegexLexer):
keywords = [
'and', 'as', 'begin', 'css', 'database', 'db', 'do', 'else', 'end',
'external', 'forall', 'if', 'import', 'match', 'package', 'parser',
'rec', 'server', 'then', 'type', 'val', 'with', 'xml_parser'
'rec', 'server', 'then', 'type', 'val', 'with', 'xml_parser',
]
# matches both stuff and `stuff`
@ -1901,7 +1902,7 @@ class OpaLexer(RegexLexer):
(r'[/*]', Comment),
],
# the coy pasting between string and single-string
# the copy pasting between string and single-string
# is kinda sad. Is there a way to avoid that??
'string': [
(r'[^\\"{]+', String.Double),
@ -1948,6 +1949,7 @@ class OpaLexer(RegexLexer):
(r'"', String.Single, ('#pop', 'string')),
(r'#'+ident_re, String.Single, '#pop'),
(r'#(?={)', String.Single, ('#pop', 'root')),
(r'[^"\'{`=<>]+', String.Single, '#pop'),
(r'{', Operator, ('#pop', 'root')), # this is a tail call!
],
@ -1957,7 +1959,7 @@ class OpaLexer(RegexLexer):
(r'</', String.Single, ('#pop', 'html-end-tag')),
(r'<', String.Single, 'html-open-tag'),
(r'{', Operator, 'root'),
(r'.|\s+', String.Single),
(r'[^<{]+', String.Single),
],
'html-comment': [
@ -2436,7 +2438,7 @@ class KokaLexer(RegexLexer):
# builtin names and special names
builtin = [
'for', 'while', 'repeat',
'foreach', 'foreach-indexed',
'foreach', 'foreach-indexed',
'error', 'catch', 'finally',
'cs', 'js', 'file', 'ref', 'assigned',
]

View File

@ -5,7 +5,7 @@
Lexers for hardware descriptor languages.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -25,7 +25,7 @@ class VerilogLexer(RegexLexer):
*New in Pygments 1.4.*
"""
name = 'verilog'
aliases = ['v']
aliases = ['verilog', 'v']
filenames = ['*.v']
mimetypes = ['text/x-verilog']
@ -137,7 +137,7 @@ class SystemVerilogLexer(RegexLexer):
*New in Pygments 1.5.*
"""
name = 'systemverilog'
aliases = ['sv']
aliases = ['systemverilog', 'sv']
filenames = ['*.sv', '*.svh']
mimetypes = ['text/x-systemverilog']

View File

@ -5,7 +5,7 @@
Pygments lexers for JVM languages.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -60,13 +60,13 @@ class JavaLexer(RegexLexer):
(r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text), 'class'),
(r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
(r'"(\\\\|\\"|[^"])*"', String),
(r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char),
(r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
(r'(\.)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Operator, Name.Attribute)),
(r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
(r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
(r'[~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]', Operator),
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
(r'0x[0-9a-f]+', Number.Hex),
(r'0x[0-9a-fA-F]+', Number.Hex),
(r'[0-9]+L?', Number.Integer),
(r'\n', Text)
],
@ -131,11 +131,117 @@ class ScalaLexer(RegexLexer):
flags = re.MULTILINE | re.DOTALL
# don't use raw unicode strings!
op = u'[-~\\^\\*!%&\\\\<>\\|+=:/?@\u00a6-\u00a7\u00a9\u00ac\u00ae\u00b0-\u00b1\u00b6\u00d7\u00f7\u03f6\u0482\u0606-\u0608\u060e-\u060f\u06e9\u06fd-\u06fe\u07f6\u09fa\u0b70\u0bf3-\u0bf8\u0bfa\u0c7f\u0cf1-\u0cf2\u0d79\u0f01-\u0f03\u0f13-\u0f17\u0f1a-\u0f1f\u0f34\u0f36\u0f38\u0fbe-\u0fc5\u0fc7-\u0fcf\u109e-\u109f\u1360\u1390-\u1399\u1940\u19e0-\u19ff\u1b61-\u1b6a\u1b74-\u1b7c\u2044\u2052\u207a-\u207c\u208a-\u208c\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118\u211e-\u2123\u2125\u2127\u2129\u212e\u213a-\u213b\u2140-\u2144\u214a-\u214d\u214f\u2190-\u2328\u232b-\u244a\u249c-\u24e9\u2500-\u2767\u2794-\u27c4\u27c7-\u27e5\u27f0-\u2982\u2999-\u29d7\u29dc-\u29fb\u29fe-\u2b54\u2ce5-\u2cea\u2e80-\u2ffb\u3004\u3012-\u3013\u3020\u3036-\u3037\u303e-\u303f\u3190-\u3191\u3196-\u319f\u31c0-\u31e3\u3200-\u321e\u322a-\u3250\u3260-\u327f\u328a-\u32b0\u32c0-\u33ff\u4dc0-\u4dff\ua490-\ua4c6\ua828-\ua82b\ufb29\ufdfd\ufe62\ufe64-\ufe66\uff0b\uff1c-\uff1e\uff5c\uff5e\uffe2\uffe4\uffe8-\uffee\ufffc-\ufffd]+'
op = (u'[-~\\^\\*!%&\\\\<>\\|+=:/?@\u00a6-\u00a7\u00a9\u00ac\u00ae\u00b0-\u00b1'
u'\u00b6\u00d7\u00f7\u03f6\u0482\u0606-\u0608\u060e-\u060f\u06e9'
u'\u06fd-\u06fe\u07f6\u09fa\u0b70\u0bf3-\u0bf8\u0bfa\u0c7f\u0cf1-\u0cf2'
u'\u0d79\u0f01-\u0f03\u0f13-\u0f17\u0f1a-\u0f1f\u0f34\u0f36\u0f38'
u'\u0fbe-\u0fc5\u0fc7-\u0fcf\u109e-\u109f\u1360\u1390-\u1399\u1940'
u'\u19e0-\u19ff\u1b61-\u1b6a\u1b74-\u1b7c\u2044\u2052\u207a-\u207c'
u'\u208a-\u208c\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118'
u'\u211e-\u2123\u2125\u2127\u2129\u212e\u213a-\u213b\u2140-\u2144'
u'\u214a-\u214d\u214f\u2190-\u2328\u232b-\u244a\u249c-\u24e9\u2500-\u2767'
u'\u2794-\u27c4\u27c7-\u27e5\u27f0-\u2982\u2999-\u29d7\u29dc-\u29fb'
u'\u29fe-\u2b54\u2ce5-\u2cea\u2e80-\u2ffb\u3004\u3012-\u3013\u3020'
u'\u3036-\u3037\u303e-\u303f\u3190-\u3191\u3196-\u319f\u31c0-\u31e3'
u'\u3200-\u321e\u322a-\u3250\u3260-\u327f\u328a-\u32b0\u32c0-\u33ff'
u'\u4dc0-\u4dff\ua490-\ua4c6\ua828-\ua82b\ufb29\ufdfd\ufe62\ufe64-\ufe66'
u'\uff0b\uff1c-\uff1e\uff5c\uff5e\uffe2\uffe4\uffe8-\uffee\ufffc-\ufffd]+')
letter = u'[a-zA-Z\\$_\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02af\u0370-\u0373\u0376-\u0377\u037b-\u037d\u0386\u0388-\u03f5\u03f7-\u0481\u048a-\u0556\u0561-\u0587\u05d0-\u05f2\u0621-\u063f\u0641-\u064a\u066e-\u066f\u0671-\u06d3\u06d5\u06ee-\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u0904-\u0939\u093d\u0950\u0958-\u0961\u0972-\u097f\u0985-\u09b9\u09bd\u09ce\u09dc-\u09e1\u09f0-\u09f1\u0a05-\u0a39\u0a59-\u0a5e\u0a72-\u0a74\u0a85-\u0ab9\u0abd\u0ad0-\u0ae1\u0b05-\u0b39\u0b3d\u0b5c-\u0b61\u0b71\u0b83-\u0bb9\u0bd0\u0c05-\u0c3d\u0c58-\u0c61\u0c85-\u0cb9\u0cbd\u0cde-\u0ce1\u0d05-\u0d3d\u0d60-\u0d61\u0d7a-\u0d7f\u0d85-\u0dc6\u0e01-\u0e30\u0e32-\u0e33\u0e40-\u0e45\u0e81-\u0eb0\u0eb2-\u0eb3\u0ebd-\u0ec4\u0edc-\u0f00\u0f40-\u0f6c\u0f88-\u0f8b\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065-\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10fa\u1100-\u135a\u1380-\u138f\u13a0-\u166c\u166f-\u1676\u1681-\u169a\u16a0-\u16ea\u16ee-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u1770\u1780-\u17b3\u17dc\u1820-\u1842\u1844-\u18a8\u18aa-\u191c\u1950-\u19a9\u19c1-\u19c7\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae-\u1baf\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c77\u1d00-\u1d2b\u1d62-\u1d77\u1d79-\u1d9a\u1e00-\u1fbc\u1fbe\u1fc2-\u1fcc\u1fd0-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ffc\u2071\u207f\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c7c\u2c80-\u2ce4\u2d00-\u2d65\u2d80-\u2dde\u3006-\u3007\u3021-\u3029\u3038-\u303a\u303c\u3041-\u3096\u309f\u30a1-\u30fa\u30ff-\u318e\u31a0-\u31b7\u31f0-\u31ff\u3400-\u4db5\u4e00-\ua014\ua016-\ua48c\ua500-\ua60b\ua610-\ua61f\ua62a-\ua66e\ua680-\ua697\ua722-\ua76f\ua771-\ua787\ua78b-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua90a-\ua925\ua930-\ua946\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uac00-\ud7a3\uf900-\ufb1d\ufb1f-\ufb28\ufb2a-\ufd3d\ufd50-\ufdfb\ufe70-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uff6f\uff71-\uff9d\uffa0-\uffdc]'
letter = (u'[a-zA-Z\\$_\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6'
u'\u00f8-\u02af\u0370-\u0373\u0376-\u0377\u037b-\u037d\u0386'
u'\u0388-\u03f5\u03f7-\u0481\u048a-\u0556\u0561-\u0587\u05d0-\u05f2'
u'\u0621-\u063f\u0641-\u064a\u066e-\u066f\u0671-\u06d3\u06d5'
u'\u06ee-\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5'
u'\u07b1\u07ca-\u07ea\u0904-\u0939\u093d\u0950\u0958-\u0961'
u'\u0972-\u097f\u0985-\u09b9\u09bd\u09ce\u09dc-\u09e1\u09f0-\u09f1'
u'\u0a05-\u0a39\u0a59-\u0a5e\u0a72-\u0a74\u0a85-\u0ab9\u0abd'
u'\u0ad0-\u0ae1\u0b05-\u0b39\u0b3d\u0b5c-\u0b61\u0b71\u0b83-\u0bb9'
u'\u0bd0\u0c05-\u0c3d\u0c58-\u0c61\u0c85-\u0cb9\u0cbd\u0cde-\u0ce1'
u'\u0d05-\u0d3d\u0d60-\u0d61\u0d7a-\u0d7f\u0d85-\u0dc6\u0e01-\u0e30'
u'\u0e32-\u0e33\u0e40-\u0e45\u0e81-\u0eb0\u0eb2-\u0eb3\u0ebd-\u0ec4'
u'\u0edc-\u0f00\u0f40-\u0f6c\u0f88-\u0f8b\u1000-\u102a\u103f'
u'\u1050-\u1055\u105a-\u105d\u1061\u1065-\u1066\u106e-\u1070'
u'\u1075-\u1081\u108e\u10a0-\u10fa\u1100-\u135a\u1380-\u138f'
u'\u13a0-\u166c\u166f-\u1676\u1681-\u169a\u16a0-\u16ea\u16ee-\u1711'
u'\u1720-\u1731\u1740-\u1751\u1760-\u1770\u1780-\u17b3\u17dc'
u'\u1820-\u1842\u1844-\u18a8\u18aa-\u191c\u1950-\u19a9\u19c1-\u19c7'
u'\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae-\u1baf'
u'\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c77\u1d00-\u1d2b\u1d62-\u1d77'
u'\u1d79-\u1d9a\u1e00-\u1fbc\u1fbe\u1fc2-\u1fcc\u1fd0-\u1fdb'
u'\u1fe0-\u1fec\u1ff2-\u1ffc\u2071\u207f\u2102\u2107\u210a-\u2113'
u'\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139'
u'\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c7c'
u'\u2c80-\u2ce4\u2d00-\u2d65\u2d80-\u2dde\u3006-\u3007\u3021-\u3029'
u'\u3038-\u303a\u303c\u3041-\u3096\u309f\u30a1-\u30fa\u30ff-\u318e'
u'\u31a0-\u31b7\u31f0-\u31ff\u3400-\u4db5\u4e00-\ua014\ua016-\ua48c'
u'\ua500-\ua60b\ua610-\ua61f\ua62a-\ua66e\ua680-\ua697\ua722-\ua76f'
u'\ua771-\ua787\ua78b-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822'
u'\ua840-\ua873\ua882-\ua8b3\ua90a-\ua925\ua930-\ua946\uaa00-\uaa28'
u'\uaa40-\uaa42\uaa44-\uaa4b\uac00-\ud7a3\uf900-\ufb1d\ufb1f-\ufb28'
u'\ufb2a-\ufd3d\ufd50-\ufdfb\ufe70-\ufefc\uff21-\uff3a\uff41-\uff5a'
u'\uff66-\uff6f\uff71-\uff9d\uffa0-\uffdc]')
upper = u'[A-Z\\$_\u00c0-\u00d6\u00d8-\u00de\u0100\u0102\u0104\u0106\u0108\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u0386\u0388-\u038f\u0391-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0531-\u0556\u10a0-\u10c5\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59-\u1f5f\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67\u2c69\u2c6b\u2c6d-\u2c6f\u2c72\u2c75\u2c80\u2c82\u2c84\u2c86\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\ua640\ua642\ua644\ua646\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a\ua65c\ua65e\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\uff21-\uff3a]'
upper = (u'[A-Z\\$_\u00c0-\u00d6\u00d8-\u00de\u0100\u0102\u0104\u0106\u0108'
u'\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c'
u'\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130'
u'\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145'
u'\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a'
u'\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e'
u'\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182'
u'\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194'
u'\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7'
u'\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc'
u'\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9'
u'\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee'
u'\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204'
u'\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218'
u'\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c'
u'\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246'
u'\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u0386\u0388-\u038f'
u'\u0391-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0'
u'\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7'
u'\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a'
u'\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e'
u'\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a'
u'\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae'
u'\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1'
u'\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6'
u'\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea'
u'\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe'
u'\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512'
u'\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0531-\u0556'
u'\u10a0-\u10c5\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e'
u'\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22'
u'\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36'
u'\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a'
u'\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e'
u'\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72'
u'\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86'
u'\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2'
u'\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6'
u'\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca'
u'\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede'
u'\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2'
u'\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d'
u'\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59-\u1f5f'
u'\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb'
u'\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112'
u'\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133'
u'\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67'
u'\u2c69\u2c6b\u2c6d-\u2c6f\u2c72\u2c75\u2c80\u2c82\u2c84\u2c86'
u'\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a'
u'\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae'
u'\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2'
u'\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6'
u'\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\ua640\ua642\ua644\ua646'
u'\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a'
u'\ua65c\ua65e\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682'
u'\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696'
u'\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736'
u'\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a'
u'\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e'
u'\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b'
u'\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\uff21-\uff3a]')
idrest = ur'%s(?:%s|[0-9])*(?:(?<=_)%s)?' % (letter, letter, op)
@ -161,7 +267,7 @@ class ScalaLexer(RegexLexer):
(r'(type)(\s+)', bygroups(Keyword, Text), 'type'),
(r'""".*?"""(?!")', String),
(r'"(\\\\|\\"|[^"])*"', String),
(r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char),
(r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
# (ur'(\.)(%s|%s|`[^`]+`)' % (idrest, op), bygroups(Operator,
# Name.Attribute)),
(idrest, Name),
@ -171,7 +277,7 @@ class ScalaLexer(RegexLexer):
(op, Operator),
(r'([0-9][0-9]*\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?',
Number.Float),
(r'0x[0-9a-f]+', Number.Hex),
(r'0x[0-9a-fA-F]+', Number.Hex),
(r'[0-9]+L?', Number.Integer),
(r'\n', Text)
],
@ -249,7 +355,7 @@ class GosuLexer(RegexLexer):
(r'(var|delegate|construct|function|private|internal|protected|'
r'public|abstract|override|final|static|extends|transient|'
r'implements|represents|readonly)\b', Keyword.Declaration),
(r'(property\s+)(get|set|)', Keyword.Declaration),
(r'(property\s+)(get|set)?', Keyword.Declaration),
(r'(boolean|byte|char|double|float|int|long|short|void|block)\b',
Keyword.Type),
(r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
@ -357,13 +463,13 @@ class GroovyLexer(RegexLexer):
(r"'(\\\\|\\'|[^'])*'", String.Single),
(r'\$/((?!/\$).)*/\$', String),
(r'/(\\\\|\\"|[^/])*/', String),
(r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char),
(r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
(r'(\.)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Operator, Name.Attribute)),
(r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
(r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
(r'[~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]', Operator),
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
(r'0x[0-9a-f]+', Number.Hex),
(r'0x[0-9a-fA-F]+', Number.Hex),
(r'[0-9]+L?', Number.Integer),
(r'\n', Text)
],
@ -675,7 +781,7 @@ class ClojureLexer(RegexLexer):
(r'::?' + valid_name, String.Symbol),
# special operators
(r'~@|[`\'#^~&]', Operator),
(r'~@|[`\'#^~&@]', Operator),
# highlight the special forms
(_multi_escape(special_forms), Keyword),
@ -742,7 +848,7 @@ class TeaLangLexer(RegexLexer):
(r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
(r'(isa|[.]{3}|[.]{2}|[=#!<>+-/%&;,.\*\\\(\)\[\]\{\}])', Operator),
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
(r'0x[0-9a-f]+', Number.Hex),
(r'0x[0-9a-fA-F]+', Number.Hex),
(r'[0-9]+L?', Number.Integer),
(r'\n', Text)
],
@ -754,6 +860,7 @@ class TeaLangLexer(RegexLexer):
],
}
class CeylonLexer(RegexLexer):
"""
For `Ceylon <http://ceylon-lang.org/>`_ source code.
@ -781,10 +888,11 @@ class CeylonLexer(RegexLexer):
(r'[^\S\n]+', Text),
(r'//.*?\n', Comment.Single),
(r'/\*.*?\*/', Comment.Multiline),
(r'(variable|shared|abstract|doc|by|formal|actual)', Name.Decorator),
(r'(break|case|catch|continue|default|else|finally|for|in|variable|'
r'if|return|switch|this|throw|try|while|is|exists|nonempty|then|outer)\b',
Keyword),
(r'(variable|shared|abstract|doc|by|formal|actual)',
Name.Decorator),
(r'(break|case|catch|continue|default|else|finally|for|in|'
r'variable|if|return|switch|this|throw|try|while|is|exists|'
r'nonempty|then|outer)\b', Keyword),
(r'(abstracts|extends|satisfies|adapts|'
r'super|given|of|out|assign|'
r'transient|volatile)\b', Keyword.Declaration),
@ -792,20 +900,24 @@ class CeylonLexer(RegexLexer):
Keyword.Type),
(r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
(r'(true|false|null)\b', Keyword.Constant),
(r'(class|interface|object)(\s+)', bygroups(Keyword.Declaration, Text), 'class'),
(r'(class|interface|object)(\s+)',
bygroups(Keyword.Declaration, Text), 'class'),
(r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
(r'"(\\\\|\\"|[^"])*"', String),
(r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Quoted),
(r"`\\.`|`[^\\]`|`\\u[0-9a-f]{4}`", String.Char),
(r'(\.)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(Operator, Name.Attribute)),
(r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Quoted),
(r"`\\.`|`[^\\]`|`\\u[0-9a-fA-F]{4}`", String.Char),
(r'(\.)([a-zA-Z_][a-zA-Z0-9_]*)',
bygroups(Operator, Name.Attribute)),
(r'[a-zA-Z_][a-zA-Z0-9_]*:', Name.Label),
(r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
(r'[~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]', Operator),
(r'\d{1,3}(_\d{3})+\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float),
(r'\d{1,3}(_\d{3})+\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?', Number.Float),
(r'\d{1,3}(_\d{3})+\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?',
Number.Float),
(r'[0-9][0-9]*\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float),
(r'[0-9][0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?', Number.Float),
(r'0x[0-9a-f]+', Number.Hex),
(r'[0-9][0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?',
Number.Float),
(r'0x[0-9a-fA-F]+', Number.Hex),
(r'\d{1,3}(_\d{3})+[kMGTP]?', Number.Integer),
(r'[0-9]+[kMGTP]?', Number.Integer),
(r'\n', Text)
@ -814,10 +926,12 @@ class CeylonLexer(RegexLexer):
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop')
],
'import': [
(r'[a-zA-Z0-9_.]+\w+ \{([a-zA-Z,]+|\.\.\.)\}', Name.Namespace, '#pop')
(r'[a-zA-Z0-9_.]+\w+ \{([a-zA-Z,]+|\.\.\.)\}',
Name.Namespace, '#pop')
],
}
class KotlinLexer(RegexLexer):
"""
For `Kotlin <http://confluence.jetbrains.net/display/Kotlin/>`_
@ -977,7 +1091,7 @@ class XtendLexer(RegexLexer):
(r'[a-zA-Z_\$][a-zA-Z0-9_]*', Name),
(r'[~\^\*!%&\[\]\(\)\{\}<>\|+=:;,./?-]', Operator),
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
(r'0x[0-9a-f]+', Number.Hex),
(r'0x[0-9a-fA-F]+', Number.Hex),
(r'[0-9]+L?', Number.Integer),
(r'\n', Text)
],

View File

@ -5,12 +5,13 @@
Lexers for math languages.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.util import shebang_matches
from pygments.lexer import Lexer, RegexLexer, bygroups, include, \
combined, do_insertions
from pygments.token import Comment, String, Punctuation, Keyword, Name, \
@ -23,10 +24,15 @@ from pygments.lexers import _stan_builtins
__all__ = ['JuliaLexer', 'JuliaConsoleLexer', 'MuPADLexer', 'MatlabLexer',
'MatlabSessionLexer', 'OctaveLexer', 'ScilabLexer', 'NumPyLexer',
'RConsoleLexer', 'SLexer', 'JagsLexer', 'BugsLexer', 'StanLexer',
'RdLexer']
'IDLLexer', 'RdLexer']
class JuliaLexer(RegexLexer):
"""
For `Julia <http://julialang.org/>`_ source code.
*New in Pygments 1.6.*
"""
name = 'Julia'
aliases = ['julia','jl']
filenames = ['*.jl']
@ -52,9 +58,9 @@ class JuliaLexer(RegexLexer):
# keywords
(r'(begin|while|for|in|return|break|continue|'
r'macro|quote|let|if|elseif|else|try|catch|end|'
r'bitstype|ccall|do)\b', Keyword),
r'bitstype|ccall|do|using|module|import|export|'
r'importall|baremodule)\b', Keyword),
(r'(local|global|const)\b', Keyword.Declaration),
(r'(module|import|export)\b', Keyword.Reserved),
(r'(Bool|Int|Int8|Int16|Int32|Int64|Uint|Uint8|Uint16|Uint32|Uint64'
r'|Float32|Float64|Complex64|Complex128|Any|Nothing|None)\b',
Keyword.Type),
@ -78,7 +84,8 @@ class JuliaLexer(RegexLexer):
(r'`(?s).*?`', String.Backtick),
# chars
(r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,3}|\\u[a-fA-F0-9]{1,4}|\\U[a-fA-F0-9]{1,6}|[^\\\'\n])'", String.Char),
(r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,3}|\\u[a-fA-F0-9]{1,4}|"
r"\\U[a-fA-F0-9]{1,6}|[^\\\'\n])'", String.Char),
# try to match trailing transpose
(r'(?<=[.\w\)\]])\'+', Operator),
@ -92,9 +99,10 @@ class JuliaLexer(RegexLexer):
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
# numbers
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
(r'\d+[eE][+-]?[0-9]+', Number.Float),
(r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
(r'\d+[eEf][+-]?[0-9]+', Number.Float),
(r'0b[01]+', Number.Binary),
(r'0o[0-7]+', Number.Oct),
(r'0x[a-fA-F0-9]+', Number.Hex),
(r'\d+', Number.Integer)
],
@ -136,6 +144,8 @@ line_re = re.compile('.*?\n')
class JuliaConsoleLexer(Lexer):
"""
For Julia console sessions. Modeled after MatlabSessionLexer.
*New in Pygments 1.6.*
"""
name = 'Julia console'
aliases = ['jlcon']
@ -334,6 +344,10 @@ class MatlabLexer(RegexLexer):
# (not great, but handles common cases...)
(r'(?<=[\w\)\]])\'', Operator),
(r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
(r'\d+[eEf][+-]?[0-9]+', Number.Float),
(r'\d+', Number.Integer),
(r'(?<![\w\)\]])\'', String, 'string'),
('[a-zA-Z_][a-zA-Z0-9_]*', Name),
(r'.', Text),
@ -780,6 +794,10 @@ class OctaveLexer(RegexLexer):
(r'"[^"]*"', String),
(r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
(r'\d+[eEf][+-]?[0-9]+', Number.Float),
(r'\d+', Number.Integer),
# quote can be transpose, instead of string:
# (not great, but handles common cases...)
(r'(?<=[\w\)\]])\'', Operator),
@ -801,8 +819,7 @@ class OctaveLexer(RegexLexer):
def analyse_text(text):
if re.match('^\s*[%#]', text, re.M): #Comment
return 0.9
return 0.1
return 0.1
class ScilabLexer(RegexLexer):
@ -851,6 +868,10 @@ class ScilabLexer(RegexLexer):
(r'(?<=[\w\)\]])\'', Operator),
(r'(?<![\w\)\]])\'', String, 'string'),
(r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float),
(r'\d+[eEf][+-]?[0-9]+', Number.Float),
(r'\d+', Number.Integer),
('[a-zA-Z_][a-zA-Z0-9_]*', Name),
(r'.', Text),
],
@ -1091,7 +1112,8 @@ class SLexer(RegexLexer):
class BugsLexer(RegexLexer):
"""
Pygments Lexer for OpenBugs and WinBugs models.
Pygments Lexer for `OpenBugs <http://www.openbugs.info/w/>`_ and WinBugs
models.
*New in Pygments 1.6.*
"""
@ -1154,7 +1176,7 @@ class BugsLexer(RegexLexer):
include('comments'),
include('whitespace'),
# Block start
(r'(?s)(model)(\s+)({)',
(r'(model)(\s+)({)',
bygroups(Keyword.Namespace, Text, Punctuation)),
# Reserved Words
(r'(for|in)(?![0-9a-zA-Z\._])', Keyword.Reserved),
@ -1236,7 +1258,7 @@ class JagsLexer(RegexLexer):
include('comments'),
include('whitespace'),
# Block start
(r'(?s)(model|data)(\s+)({)',
(r'(model|data)(\s+)({)',
bygroups(Keyword.Namespace, Text, Punctuation)),
(r'var(?![0-9a-zA-Z\._])', Keyword.Declaration),
# Reserved Words
@ -1283,7 +1305,7 @@ class StanLexer(RegexLexer):
filenames = ['*.stan']
_RESERVED = ('for', 'in', 'while', 'repeat', 'until', 'if',
'then', 'else', 'true', 'false', 'T',
'then', 'else', 'true', 'false', 'T',
'lower', 'upper', 'print')
_TYPES = ('int', 'real', 'vector', 'simplex', 'ordered', 'row_vector',
@ -1306,7 +1328,7 @@ class StanLexer(RegexLexer):
# block start
include('whitespace'),
# Block start
(r'(?s)(%s)(\s*)({)' %
(r'(%s)(\s*)({)' %
r'|'.join(('data', r'transformed\s+?data',
'parameters', r'transformed\s+parameters',
'model', r'generated\s+quantities')),
@ -1334,7 +1356,7 @@ class StanLexer(RegexLexer):
# Integer Literals
(r'-?[0-9]+', Number.Integer),
# Assignment operators
# SLexer makes these tokens Operators.
# SLexer makes these tokens Operators.
(r'<-|~', Operator),
# Infix and prefix operators (and = )
(r"\+|-|\.?\*|\.?/|\\|'|=", Operator),
@ -1350,6 +1372,247 @@ class StanLexer(RegexLexer):
return 0.0
class IDLLexer(RegexLexer):
"""
Pygments Lexer for IDL (Interactive Data Language).
*New in Pygments 1.6.*
"""
name = 'IDL'
aliases = ['idl']
filenames = ['*.pro']
mimetypes = ['text/idl']
_RESERVED = ['and', 'begin', 'break', 'case', 'common', 'compile_opt',
'continue', 'do', 'else', 'end', 'endcase', 'elseelse',
'endfor', 'endforeach', 'endif', 'endrep', 'endswitch',
'endwhile', 'eq', 'for', 'foreach', 'forward_function',
'function', 'ge', 'goto', 'gt', 'if', 'inherits', 'le',
'lt', 'mod', 'ne', 'not', 'of', 'on_ioerror', 'or', 'pro',
'repeat', 'switch', 'then', 'until', 'while', 'xor']
"""Reserved words from: http://www.exelisvis.com/docs/reswords.html"""
_BUILTIN_LIB = ['abs', 'acos', 'adapt_hist_equal', 'alog', 'alog10',
'amoeba', 'annotate', 'app_user_dir', 'app_user_dir_query',
'arg_present', 'array_equal', 'array_indices', 'arrow',
'ascii_template', 'asin', 'assoc', 'atan', 'axis',
'a_correlate', 'bandpass_filter', 'bandreject_filter',
'barplot', 'bar_plot', 'beseli', 'beselj', 'beselk',
'besely', 'beta', 'bilinear', 'binary_template', 'bindgen',
'binomial', 'bin_date', 'bit_ffs', 'bit_population',
'blas_axpy', 'blk_con', 'box_cursor', 'breakpoint',
'broyden', 'butterworth', 'bytarr', 'byte', 'byteorder',
'bytscl', 'caldat', 'calendar', 'call_external',
'call_function', 'call_method', 'call_procedure', 'canny',
'catch', 'cd', 'cdf_[0-9a-za-z_]*', 'ceil', 'chebyshev',
'check_math',
'chisqr_cvf', 'chisqr_pdf', 'choldc', 'cholsol', 'cindgen',
'cir_3pnt', 'close', 'cluster', 'cluster_tree', 'clust_wts',
'cmyk_convert', 'colorbar', 'colorize_sample',
'colormap_applicable', 'colormap_gradient',
'colormap_rotation', 'colortable', 'color_convert',
'color_exchange', 'color_quan', 'color_range_map', 'comfit',
'command_line_args', 'complex', 'complexarr', 'complexround',
'compute_mesh_normals', 'cond', 'congrid', 'conj',
'constrained_min', 'contour', 'convert_coord', 'convol',
'convol_fft', 'coord2to3', 'copy_lun', 'correlate', 'cos',
'cosh', 'cpu', 'cramer', 'create_cursor', 'create_struct',
'create_view', 'crossp', 'crvlength', 'cti_test',
'ct_luminance', 'cursor', 'curvefit', 'cvttobm', 'cv_coord',
'cw_animate', 'cw_animate_getp', 'cw_animate_load',
'cw_animate_run', 'cw_arcball', 'cw_bgroup', 'cw_clr_index',
'cw_colorsel', 'cw_defroi', 'cw_field', 'cw_filesel',
'cw_form', 'cw_fslider', 'cw_light_editor',
'cw_light_editor_get', 'cw_light_editor_set', 'cw_orient',
'cw_palette_editor', 'cw_palette_editor_get',
'cw_palette_editor_set', 'cw_pdmenu', 'cw_rgbslider',
'cw_tmpl', 'cw_zoom', 'c_correlate', 'dblarr', 'db_exists',
'dcindgen', 'dcomplex', 'dcomplexarr', 'define_key',
'define_msgblk', 'define_msgblk_from_file', 'defroi',
'defsysv', 'delvar', 'dendrogram', 'dendro_plot', 'deriv',
'derivsig', 'determ', 'device', 'dfpmin', 'diag_matrix',
'dialog_dbconnect', 'dialog_message', 'dialog_pickfile',
'dialog_printersetup', 'dialog_printjob',
'dialog_read_image', 'dialog_write_image', 'digital_filter',
'dilate', 'dindgen', 'dissolve', 'dist', 'distance_measure',
'dlm_load', 'dlm_register', 'doc_library', 'double',
'draw_roi', 'edge_dog', 'efont', 'eigenql', 'eigenvec',
'ellipse', 'elmhes', 'emboss', 'empty', 'enable_sysrtn',
'eof', 'eos_[0-9a-za-z_]*', 'erase', 'erf', 'erfc', 'erfcx',
'erode', 'errorplot', 'errplot', 'estimator_filter',
'execute', 'exit', 'exp', 'expand', 'expand_path', 'expint',
'extrac', 'extract_slice', 'factorial', 'fft', 'filepath',
'file_basename', 'file_chmod', 'file_copy', 'file_delete',
'file_dirname', 'file_expand_path', 'file_info',
'file_lines', 'file_link', 'file_mkdir', 'file_move',
'file_poll_input', 'file_readlink', 'file_same',
'file_search', 'file_test', 'file_which', 'findgen',
'finite', 'fix', 'flick', 'float', 'floor', 'flow3',
'fltarr', 'flush', 'format_axis_values', 'free_lun',
'fstat', 'fulstr', 'funct', 'fv_test', 'fx_root',
'fz_roots', 'f_cvf', 'f_pdf', 'gamma', 'gamma_ct',
'gauss2dfit', 'gaussfit', 'gaussian_function', 'gaussint',
'gauss_cvf', 'gauss_pdf', 'gauss_smooth', 'getenv',
'getwindows', 'get_drive_list', 'get_dxf_objects',
'get_kbrd', 'get_login_info', 'get_lun', 'get_screen_size',
'greg2jul', 'grib_[0-9a-za-z_]*', 'grid3', 'griddata',
'grid_input', 'grid_tps', 'gs_iter',
'h5[adfgirst]_[0-9a-za-z_]*', 'h5_browser', 'h5_close',
'h5_create', 'h5_get_libversion', 'h5_open', 'h5_parse',
'hanning', 'hash', 'hdf_[0-9a-za-z_]*', 'heap_free',
'heap_gc', 'heap_nosave', 'heap_refcount', 'heap_save',
'help', 'hilbert', 'histogram', 'hist_2d', 'hist_equal',
'hls', 'hough', 'hqr', 'hsv', 'h_eq_ct', 'h_eq_int',
'i18n_multibytetoutf8', 'i18n_multibytetowidechar',
'i18n_utf8tomultibyte', 'i18n_widechartomultibyte',
'ibeta', 'icontour', 'iconvertcoord', 'idelete', 'identity',
'idlexbr_assistant', 'idlitsys_createtool', 'idl_base64',
'idl_validname', 'iellipse', 'igamma', 'igetcurrent',
'igetdata', 'igetid', 'igetproperty', 'iimage', 'image',
'image_cont', 'image_statistics', 'imaginary', 'imap',
'indgen', 'intarr', 'interpol', 'interpolate',
'interval_volume', 'int_2d', 'int_3d', 'int_tabulated',
'invert', 'ioctl', 'iopen', 'iplot', 'ipolygon',
'ipolyline', 'iputdata', 'iregister', 'ireset', 'iresolve',
'irotate', 'ir_filter', 'isa', 'isave', 'iscale',
'isetcurrent', 'isetproperty', 'ishft', 'isocontour',
'isosurface', 'isurface', 'itext', 'itranslate', 'ivector',
'ivolume', 'izoom', 'i_beta', 'journal', 'json_parse',
'json_serialize', 'jul2greg', 'julday', 'keyword_set',
'krig2d', 'kurtosis', 'kw_test', 'l64indgen', 'label_date',
'label_region', 'ladfit', 'laguerre', 'laplacian',
'la_choldc', 'la_cholmprove', 'la_cholsol', 'la_determ',
'la_eigenproblem', 'la_eigenql', 'la_eigenvec', 'la_elmhes',
'la_gm_linear_model', 'la_hqr', 'la_invert',
'la_least_squares', 'la_least_square_equality',
'la_linear_equation', 'la_ludc', 'la_lumprove', 'la_lusol',
'la_svd', 'la_tridc', 'la_trimprove', 'la_triql',
'la_trired', 'la_trisol', 'least_squares_filter', 'leefilt',
'legend', 'legendre', 'linbcg', 'lindgen', 'linfit',
'linkimage', 'list', 'll_arc_distance', 'lmfit', 'lmgr',
'lngamma', 'lnp_test', 'loadct', 'locale_get',
'logical_and', 'logical_or', 'logical_true', 'lon64arr',
'lonarr', 'long', 'long64', 'lsode', 'ludc', 'lumprove',
'lusol', 'lu_complex', 'machar', 'make_array', 'make_dll',
'make_rt', 'map', 'mapcontinents', 'mapgrid', 'map_2points',
'map_continents', 'map_grid', 'map_image', 'map_patch',
'map_proj_forward', 'map_proj_image', 'map_proj_info',
'map_proj_init', 'map_proj_inverse', 'map_set',
'matrix_multiply', 'matrix_power', 'max', 'md_test',
'mean', 'meanabsdev', 'mean_filter', 'median', 'memory',
'mesh_clip', 'mesh_decimate', 'mesh_issolid', 'mesh_merge',
'mesh_numtriangles', 'mesh_obj', 'mesh_smooth',
'mesh_surfacearea', 'mesh_validate', 'mesh_volume',
'message', 'min', 'min_curve_surf', 'mk_html_help',
'modifyct', 'moment', 'morph_close', 'morph_distance',
'morph_gradient', 'morph_hitormiss', 'morph_open',
'morph_thin', 'morph_tophat', 'multi', 'm_correlate',
'ncdf_[0-9a-za-z_]*', 'newton', 'noise_hurl', 'noise_pick',
'noise_scatter', 'noise_slur', 'norm', 'n_elements',
'n_params', 'n_tags', 'objarr', 'obj_class', 'obj_destroy',
'obj_hasmethod', 'obj_isa', 'obj_new', 'obj_valid',
'online_help', 'on_error', 'open', 'oplot', 'oploterr',
'parse_url', 'particle_trace', 'path_cache', 'path_sep',
'pcomp', 'plot', 'plot3d', 'ploterr', 'plots', 'plot_3dbox',
'plot_field', 'pnt_line', 'point_lun', 'polarplot',
'polar_contour', 'polar_surface', 'poly', 'polyfill',
'polyfillv', 'polygon', 'polyline', 'polyshade', 'polywarp',
'poly_2d', 'poly_area', 'poly_fit', 'popd', 'powell',
'pref_commit', 'pref_get', 'pref_set', 'prewitt', 'primes',
'print', 'printd', 'product', 'profile', 'profiler',
'profiles', 'project_vol', 'psafm', 'pseudo',
'ps_show_fonts', 'ptrarr', 'ptr_free', 'ptr_new',
'ptr_valid', 'pushd', 'p_correlate', 'qgrid3', 'qhull',
'qromb', 'qromo', 'qsimp', 'query_ascii', 'query_bmp',
'query_csv', 'query_dicom', 'query_gif', 'query_image',
'query_jpeg', 'query_jpeg2000', 'query_mrsid', 'query_pict',
'query_png', 'query_ppm', 'query_srf', 'query_tiff',
'query_wav', 'radon', 'randomn', 'randomu', 'ranks',
'rdpix', 'read', 'reads', 'readu', 'read_ascii',
'read_binary', 'read_bmp', 'read_csv', 'read_dicom',
'read_gif', 'read_image', 'read_interfile', 'read_jpeg',
'read_jpeg2000', 'read_mrsid', 'read_pict', 'read_png',
'read_ppm', 'read_spr', 'read_srf', 'read_sylk',
'read_tiff', 'read_wav', 'read_wave', 'read_x11_bitmap',
'read_xwd', 'real_part', 'rebin', 'recall_commands',
'recon3', 'reduce_colors', 'reform', 'region_grow',
'register_cursor', 'regress', 'replicate',
'replicate_inplace', 'resolve_all', 'resolve_routine',
'restore', 'retall', 'return', 'reverse', 'rk4', 'roberts',
'rot', 'rotate', 'round', 'routine_filepath',
'routine_info', 'rs_test', 'r_correlate', 'r_test',
'save', 'savgol', 'scale3', 'scale3d', 'scope_level',
'scope_traceback', 'scope_varfetch', 'scope_varname',
'search2d', 'search3d', 'sem_create', 'sem_delete',
'sem_lock', 'sem_release', 'setenv', 'set_plot',
'set_shading', 'sfit', 'shade_surf', 'shade_surf_irr',
'shade_volume', 'shift', 'shift_diff', 'shmdebug', 'shmmap',
'shmunmap', 'shmvar', 'show3', 'showfont', 'simplex', 'sin',
'sindgen', 'sinh', 'size', 'skewness', 'skip_lun',
'slicer3', 'slide_image', 'smooth', 'sobel', 'socket',
'sort', 'spawn', 'spher_harm', 'sph_4pnt', 'sph_scat',
'spline', 'spline_p', 'spl_init', 'spl_interp', 'sprsab',
'sprsax', 'sprsin', 'sprstp', 'sqrt', 'standardize',
'stddev', 'stop', 'strarr', 'strcmp', 'strcompress',
'streamline', 'stregex', 'stretch', 'string', 'strjoin',
'strlen', 'strlowcase', 'strmatch', 'strmessage', 'strmid',
'strpos', 'strput', 'strsplit', 'strtrim', 'struct_assign',
'struct_hide', 'strupcase', 'surface', 'surfr', 'svdc',
'svdfit', 'svsol', 'swap_endian', 'swap_endian_inplace',
'symbol', 'systime', 's_test', 't3d', 'tag_names', 'tan',
'tanh', 'tek_color', 'temporary', 'tetra_clip',
'tetra_surface', 'tetra_volume', 'text', 'thin', 'threed',
'timegen', 'time_test2', 'tm_test', 'total', 'trace',
'transpose', 'triangulate', 'trigrid', 'triql', 'trired',
'trisol', 'tri_surf', 'truncate_lun', 'ts_coef', 'ts_diff',
'ts_fcast', 'ts_smooth', 'tv', 'tvcrs', 'tvlct', 'tvrd',
'tvscl', 'typename', 't_cvt', 't_pdf', 'uindgen', 'uint',
'uintarr', 'ul64indgen', 'ulindgen', 'ulon64arr', 'ulonarr',
'ulong', 'ulong64', 'uniq', 'unsharp_mask', 'usersym',
'value_locate', 'variance', 'vector', 'vector_field', 'vel',
'velovect', 'vert_t3d', 'voigt', 'voronoi', 'voxel_proj',
'wait', 'warp_tri', 'watershed', 'wdelete', 'wf_draw',
'where', 'widget_base', 'widget_button', 'widget_combobox',
'widget_control', 'widget_displaycontextmen', 'widget_draw',
'widget_droplist', 'widget_event', 'widget_info',
'widget_label', 'widget_list', 'widget_propertysheet',
'widget_slider', 'widget_tab', 'widget_table',
'widget_text', 'widget_tree', 'widget_tree_move',
'widget_window', 'wiener_filter', 'window', 'writeu',
'write_bmp', 'write_csv', 'write_gif', 'write_image',
'write_jpeg', 'write_jpeg2000', 'write_nrif', 'write_pict',
'write_png', 'write_ppm', 'write_spr', 'write_srf',
'write_sylk', 'write_tiff', 'write_wav', 'write_wave',
'wset', 'wshow', 'wtn', 'wv_applet', 'wv_cwt',
'wv_cw_wavelet', 'wv_denoise', 'wv_dwt', 'wv_fn_coiflet',
'wv_fn_daubechies', 'wv_fn_gaussian', 'wv_fn_haar',
'wv_fn_morlet', 'wv_fn_paul', 'wv_fn_symlet',
'wv_import_data', 'wv_import_wavelet', 'wv_plot3d_wps',
'wv_plot_multires', 'wv_pwt', 'wv_tool_denoise',
'xbm_edit', 'xdisplayfile', 'xdxf', 'xfont',
'xinteranimate', 'xloadct', 'xmanager', 'xmng_tmpl',
'xmtool', 'xobjview', 'xobjview_rotate',
'xobjview_write_image', 'xpalette', 'xpcolor', 'xplot3d',
'xregistered', 'xroi', 'xsq_test', 'xsurface', 'xvaredit',
'xvolume', 'xvolume_rotate', 'xvolume_write_image',
'xyouts', 'zoom', 'zoom_24']
"""Functions from: http://www.exelisvis.com/docs/routines-1.html"""
tokens = {
'root': [
(r'^\s*;.*?\n', Comment.Singleline),
(r'\b(' + '|'.join(_RESERVED) + r')\b', Keyword),
(r'\b(' + '|'.join(_BUILTIN_LIB) + r')\b', Name.Builtin),
(r'\+=|-=|\^=|\*=|/=|#=|##=|<=|>=|=', Operator),
(r'\+\+|--|->|\+|-|##|#|\*|/|<|>|&&|\^|~|\|\|\?|:', Operator),
(r'\b(mod=|lt=|le=|eq=|ne=|ge=|gt=|not=|and=|or=|xor=)', Operator),
(r'\b(mod|lt|le|eq|ne|ge|gt|not|and|or|xor)\b', Operator),
(r'\b[0-9](L|B|S|UL|ULL|LL)?\b', Number),
(r'.', Text),
]
}
class RdLexer(RegexLexer):
"""
Pygments Lexer for R documentation (Rd) files

View File

@ -5,7 +5,7 @@
Lexers for other languages.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -19,6 +19,7 @@ from pygments.util import get_bool_opt
from pygments.lexers.web import HtmlLexer
from pygments.lexers._openedgebuiltins import OPENEDGEKEYWORDS
from pygments.lexers._robotframeworklexer import RobotFrameworkLexer
# backwards compatibility
from pygments.lexers.sql import SqlLexer, MySqlLexer, SqliteConsoleLexer
@ -32,7 +33,9 @@ __all__ = ['BrainfuckLexer', 'BefungeLexer', 'RedcodeLexer', 'MOOCodeLexer',
'AutohotkeyLexer', 'GoodDataCLLexer', 'MaqlLexer', 'ProtoBufLexer',
'HybrisLexer', 'AwkLexer', 'Cfengine3Lexer', 'SnobolLexer',
'ECLLexer', 'UrbiscriptLexer', 'OpenEdgeLexer', 'BroLexer',
'MscgenLexer', 'KconfigLexer', 'VGLLexer', 'SourcePawnLexer']
'MscgenLexer', 'KconfigLexer', 'VGLLexer', 'SourcePawnLexer',
'RobotFrameworkLexer', 'PuppetLexer', 'NSISLexer', 'RPMSpecLexer',
'CbmBasicV2Lexer', 'AutoItLexer']
class ECLLexer(RegexLexer):
@ -1255,7 +1258,8 @@ class ModelicaLexer(RegexLexer):
],
'classes': [
(r'(block|class|connector|function|model|package|'
r'record|type)\b', Name.Class),
r'record|type)(\s+)([A-Za-z_]+)',
bygroups(Keyword, Text, Name.Class))
],
'string': [
(r'"', String, '#pop'),
@ -1483,9 +1487,9 @@ class RebolLexer(RegexLexer):
(r'}', Comment, '#pop'),
],
'commentBlock': [
(r'\[',Comment, '#push'),
(r'\]',Comment, '#pop'),
(r'[^(\[\])]*', Comment),
(r'\[', Comment, '#push'),
(r'\]', Comment, '#pop'),
(r'[^(\[\])]+', Comment),
],
}
@ -1736,6 +1740,7 @@ class NewspeakLexer(RegexLexer):
]
}
class GherkinLexer(RegexLexer):
"""
For `Gherkin <http://github.com/aslakhellesoy/gherkin/>` syntax.
@ -1832,10 +1837,16 @@ class GherkinLexer(RegexLexer):
include('table_vars'),
include('numbers'),
(r'(\s*)(@[^@\r\n\t ]+)', bygroups(Name.Function, Name.Tag)),
(step_keywords, bygroups(Name.Function, Keyword), "step_content_root"),
(feature_keywords, bygroups(Keyword, Keyword, Name.Function), 'narrative'),
(feature_element_keywords, bygroups(Name.Function, Keyword, Keyword, Name.Function), "feature_elements"),
(examples_keywords, bygroups(Name.Function, Keyword, Keyword, Name.Function), "examples_table"),
(step_keywords, bygroups(Name.Function, Keyword),
'step_content_root'),
(feature_keywords, bygroups(Keyword, Keyword, Name.Function),
'narrative'),
(feature_element_keywords,
bygroups(Name.Function, Keyword, Keyword, Name.Function),
'feature_elements'),
(examples_keywords,
bygroups(Name.Function, Keyword, Keyword, Name.Function),
'examples_table'),
(r'(\s|.)', Name.Function),
]
}
@ -2771,7 +2782,7 @@ class OpenEdgeLexer(RegexLexer):
keywords = (r'(?i)(^|(?<=[^0-9a-z_\-]))(' +
r'|'.join(OPENEDGEKEYWORDS) +
r')\s*($|(?=[^0-9a-z_\-]))')
r')\s*($|(?=[^0-9a-z_\-]))')
tokens = {
'root': [
(r'/\*', Comment.Multiline, 'comment'),
@ -2834,7 +2845,7 @@ class BroLexer(RegexLexer):
r'|pattern|port|record|set|string|subnet|table|time|timer'
r'|vector)\b', Keyword.Type),
(r'(T|F)\b', Keyword.Constant),
(r'(&)((?:add|delete|expire)_func|attr|(create|read|write)_expire'
(r'(&)((?:add|delete|expire)_func|attr|(?:create|read|write)_expire'
r'|default|disable_print_hook|raw_output|encrypt|group|log'
r'|mergeable|optional|persistent|priority|redef'
r'|rotate_(?:interval|size)|synchronized)\b', bygroups(Punctuation,
@ -2882,6 +2893,44 @@ class BroLexer(RegexLexer):
}
class CbmBasicV2Lexer(RegexLexer):
"""
For CBM BASIC V2 sources.
*New in Pygments 1.6.*
"""
name = 'CBM BASIC V2'
aliases = ['cbmbas']
filenames = ['*.bas']
flags = re.IGNORECASE
tokens = {
'root': [
(r'rem.*\n', Comment.Single),
(r'\s+', Text),
(r'new|run|end|for|to|next|step|go(to|sub)?|on|return|stop|cont'
r'|if|then|input#?|read|wait|load|save|verify|poke|sys|print#?'
r'|list|clr|cmd|open|close|get#?', Keyword.Reserved),
(r'data|restore|dim|let|def|fn', Keyword.Declaration),
(r'tab|spc|sgn|int|abs|usr|fre|pos|sqr|rnd|log|exp|cos|sin|tan|atn'
r'|peek|len|val|asc|(str|chr|left|right|mid)\$', Name.Builtin),
(r'[-+*/^<>=]', Operator),
(r'not|and|or', Operator.Word),
(r'"[^"\n]*.', String),
(r'\d+|[-+]?\d*\.\d*(e[-+]?\d+)?', Number.Float),
(r'[\(\),:;]', Punctuation),
(r'\w+[$%]?', Name),
]
}
def analyse_text(self, text):
# if it starts with a line number, it shouldn't be a "modern" Basic
# like VB.net
if re.match(r'\d+', text):
return True
class MscgenLexer(RegexLexer):
"""
For `Mscgen <http://www.mcternan.me.uk/mscgen/>`_ files.
@ -3156,5 +3205,463 @@ class SourcePawnLexer(RegexLexer):
if value in self.SM_TYPES:
token = Keyword.Type
elif value in self._functions:
tokens = Name.Builtin
token = Name.Builtin
yield index, token, value
class PuppetLexer(RegexLexer):
"""
For `Puppet <http://puppetlabs.com/>`__ configuration DSL.
*New in Pygments 1.6.*
"""
name = 'Puppet'
aliases = ['puppet']
filenames = ['*.pp']
tokens = {
'root': [
include('comments'),
include('keywords'),
include('names'),
include('numbers'),
include('operators'),
include('strings'),
(r'[]{}:(),;[]', Punctuation),
(r'[^\S\n]+', Text),
],
'comments': [
(r'\s*#.*$', Comment),
(r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
],
'operators': [
(r'(=>|\?|<|>|=|\+|-|/|\*|~|!|\|)', Operator),
(r'(in|and|or|not)\b', Operator.Word),
],
'names': [
('[a-zA-Z_][a-zA-Z0-9_]*', Name.Attribute),
(r'(\$\S+)(\[)(\S+)(\])', bygroups(Name.Variable, Punctuation,
String, Punctuation)),
(r'\$\S+', Name.Variable),
],
'numbers': [
# Copypasta from the Python lexer
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float),
(r'\d+[eE][+-]?[0-9]+j?', Number.Float),
(r'0[0-7]+j?', Number.Oct),
(r'0[xX][a-fA-F0-9]+', Number.Hex),
(r'\d+L', Number.Integer.Long),
(r'\d+j?', Number.Integer)
],
'keywords': [
# Left out 'group' and 'require'
# Since they're often used as attributes
(r'(?i)(absent|alert|alias|audit|augeas|before|case|check|class|'
r'computer|configured|contained|create_resources|crit|cron|debug|'
r'default|define|defined|directory|else|elsif|emerg|err|exec|'
r'extlookup|fail|false|file|filebucket|fqdn_rand|generate|host|if|'
r'import|include|info|inherits|inline_template|installed|'
r'interface|k5login|latest|link|loglevel|macauthorization|'
r'mailalias|maillist|mcx|md5|mount|mounted|nagios_command|'
r'nagios_contact|nagios_contactgroup|nagios_host|'
r'nagios_hostdependency|nagios_hostescalation|nagios_hostextinfo|'
r'nagios_hostgroup|nagios_service|nagios_servicedependency|'
r'nagios_serviceescalation|nagios_serviceextinfo|'
r'nagios_servicegroup|nagios_timeperiod|node|noop|notice|notify|'
r'package|present|purged|realize|regsubst|resources|role|router|'
r'running|schedule|scheduled_task|search|selboolean|selmodule|'
r'service|sha1|shellquote|split|sprintf|ssh_authorized_key|sshkey|'
r'stage|stopped|subscribe|tag|tagged|template|tidy|true|undef|'
r'unmounted|user|versioncmp|vlan|warning|yumrepo|zfs|zone|'
r'zpool)\b', Keyword),
],
'strings': [
(r'"([^"])*"', String),
(r'\'([^\'])*\'', String),
],
}
class NSISLexer(RegexLexer):
"""
For `NSIS <http://nsis.sourceforge.net/>`_ scripts.
*New in Pygments 1.6.*
"""
name = 'NSIS'
aliases = ['nsis', 'nsi', 'nsh']
filenames = ['*.nsi', '*.nsh']
mimetypes = ['text/x-nsis']
flags = re.IGNORECASE
tokens = {
'root': [
(r'[;\#].*\n', Comment),
(r"'.*'", String.Single),
(r'"', String.Double, 'str_double'),
(r'`', String.Backtick, 'str_backtick'),
include('macro'),
include('interpol'),
include('basic'),
(r'\$\{[a-z_|][\w|]*\}', Keyword.Pseudo),
(r'/[a-z_]\w*', Name.Attribute),
('.', Text),
],
'basic': [
(r'(\n)(Function)(\s+)([._a-z][.\w]*)\b',
bygroups(Text, Keyword, Text, Name.Function)),
(r'\b([_a-z]\w*)(::)([a-z][a-z0-9]*)\b',
bygroups(Keyword.Namespace, Punctuation, Name.Function)),
(r'\b([_a-z]\w*)(:)', bygroups(Name.Label, Punctuation)),
(r'(\b[ULS]|\B)([\!\<\>=]?=|\<\>?|\>)\B', Operator),
(r'[|+-]', Operator),
(r'\\', Punctuation),
(r'\b(Abort|Add(?:BrandingImage|Size)|'
r'Allow(?:RootDirInstall|SkipFiles)|AutoCloseWindow|'
r'BG(?:Font|Gradient)|BrandingText|BringToFront|Call(?:InstDLL)?|'
r'(?:Sub)?Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|'
r'ComponentText|CopyFiles|CRCCheck|'
r'Create(?:Directory|Font|Shortcut)|Delete(?:INI(?:Sec|Str)|'
r'Reg(?:Key|Value))?|DetailPrint|DetailsButtonText|'
r'Dir(?:Show|Text|Var|Verify)|(?:Disabled|Enabled)Bitmap|'
r'EnableWindow|EnumReg(?:Key|Value)|Exch|Exec(?:Shell|Wait)?|'
r'ExpandEnvStrings|File(?:BufSize|Close|ErrorText|Open|'
r'Read(?:Byte)?|Seek|Write(?:Byte)?)?|'
r'Find(?:Close|First|Next|Window)|FlushINI|Function(?:End)?|'
r'Get(?:CurInstType|CurrentAddress|DlgItem|DLLVersion(?:Local)?|'
r'ErrorLevel|FileTime(?:Local)?|FullPathName|FunctionAddress|'
r'InstDirError|LabelAddress|TempFileName)|'
r'Goto|HideWindow|Icon|'
r'If(?:Abort|Errors|FileExists|RebootFlag|Silent)|'
r'InitPluginsDir|Install(?:ButtonText|Colors|Dir(?:RegKey)?)|'
r'Inst(?:ProgressFlags|Type(?:[GS]etText)?)|Int(?:CmpU?|Fmt|Op)|'
r'IsWindow|LangString(?:UP)?|'
r'License(?:BkColor|Data|ForceSelection|LangString|Text)|'
r'LoadLanguageFile|LockWindow|Log(?:Set|Text)|MessageBox|'
r'MiscButtonText|Name|Nop|OutFile|(?:Uninst)?Page(?:Ex(?:End)?)?|'
r'PluginDir|Pop|Push|Quit|Read(?:(?:Env|INI|Reg)Str|RegDWORD)|'
r'Reboot|(?:Un)?RegDLL|Rename|RequestExecutionLevel|ReserveFile|'
r'Return|RMDir|SearchPath|Section(?:Divider|End|'
r'(?:(?:Get|Set)(?:Flags|InstTypes|Size|Text))|Group(?:End)?|In)?|'
r'SendMessage|Set(?:AutoClose|BrandingImage|Compress(?:ionLevel|'
r'or(?:DictSize)?)?|CtlColors|CurInstType|DatablockOptimize|'
r'DateSave|Details(?:Print|View)|Error(?:s|Level)|FileAttributes|'
r'Font|OutPath|Overwrite|PluginUnload|RebootFlag|ShellVarContext|'
r'Silent|StaticBkColor)|'
r'Show(?:(?:I|Uni)nstDetails|Window)|Silent(?:Un)?Install|Sleep|'
r'SpaceTexts|Str(?:CmpS?|Cpy|Len)|SubSection(?:End)?|'
r'Uninstall(?:ButtonText|(?:Sub)?Caption|EXEName|Icon|Text)|'
r'UninstPage|Var|VI(?:AddVersionKey|ProductVersion)|WindowIcon|'
r'Write(?:INIStr|Reg(:?Bin|DWORD|(?:Expand)?Str)|Uninstaller)|'
r'XPStyle)\b', Keyword),
(r'\b(CUR|END|(?:FILE_ATTRIBUTE_)?'
r'(?:ARCHIVE|HIDDEN|NORMAL|OFFLINE|READONLY|SYSTEM|TEMPORARY)|'
r'HK(CC|CR|CU|DD|LM|PD|U)|'
r'HKEY_(?:CLASSES_ROOT|CURRENT_(?:CONFIG|USER)|DYN_DATA|'
r'LOCAL_MACHINE|PERFORMANCE_DATA|USERS)|'
r'ID(?:ABORT|CANCEL|IGNORE|NO|OK|RETRY|YES)|'
r'MB_(?:ABORTRETRYIGNORE|DEFBUTTON[1-4]|'
r'ICON(?:EXCLAMATION|INFORMATION|QUESTION|STOP)|'
r'OK(?:CANCEL)?|RETRYCANCEL|RIGHT|SETFOREGROUND|TOPMOST|USERICON|'
r'YESNO(?:CANCEL)?)|SET|SHCTX|'
r'SW_(?:HIDE|SHOW(?:MAXIMIZED|MINIMIZED|NORMAL))|'
r'admin|all|auto|both|bottom|bzip2|checkbox|colored|current|false|'
r'force|hide|highest|if(?:diff|newer)|lastused|leave|left|'
r'listonly|lzma|nevershow|none|normal|off|on|pop|push|'
r'radiobuttons|right|show|silent|silentlog|smooth|textonly|top|'
r'true|try|user|zlib)\b', Name.Constant),
],
'macro': [
(r'\!(addincludedir(?:dir)?|addplugindir|appendfile|cd|define|'
r'delfilefile|echo(?:message)?|else|endif|error|execute|'
r'if(?:macro)?n?(?:def)?|include|insertmacro|macro(?:end)?|packhdr|'
r'search(?:parse|replace)|system|tempfilesymbol|undef|verbose|'
r'warning)\b', Comment.Preproc),
],
'interpol': [
(r'\$(R?[0-9])', Name.Builtin.Pseudo), # registers
(r'\$(ADMINTOOLS|APPDATA|CDBURN_AREA|COOKIES|COMMONFILES(?:32|64)|'
r'DESKTOP|DOCUMENTS|EXE(?:DIR|FILE|PATH)|FAVORITES|FONTS|HISTORY|'
r'HWNDPARENT|INTERNET_CACHE|LOCALAPPDATA|MUSIC|NETHOOD|PICTURES|'
r'PLUGINSDIR|PRINTHOOD|PROFILE|PROGRAMFILES(?:32|64)|QUICKLAUNCH|'
r'RECENT|RESOURCES(?:_LOCALIZED)?|SENDTO|SM(?:PROGRAMS|STARTUP)|'
r'STARTMENU|SYSDIR|TEMP(?:LATES)?|VIDEOS|WINDIR|\{NSISDIR\})',
Name.Builtin),
(r'\$(CMDLINE|INSTDIR|OUTDIR|LANGUAGE)', Name.Variable.Global),
(r'\$[a-z_]\w*', Name.Variable),
],
'str_double': [
(r'"', String, '#pop'),
(r'\$(\\[nrt"]|\$)', String.Escape),
include('interpol'),
(r'.', String.Double),
],
'str_backtick': [
(r'`', String, '#pop'),
(r'\$(\\[nrt"]|\$)', String.Escape),
include('interpol'),
(r'.', String.Double),
],
}
class RPMSpecLexer(RegexLexer):
"""
For RPM *.spec files
*New in Pygments 1.6.*
"""
name = 'RPMSpec'
aliases = ['spec']
filenames = ['*.spec']
mimetypes = ['text/x-rpm-spec']
_directives = ('(?:package|prep|build|install|clean|check|pre[a-z]*|'
'post[a-z]*|trigger[a-z]*|files)')
tokens = {
'root': [
(r'#.*\n', Comment),
include('basic'),
],
'description': [
(r'^(%' + _directives + ')(.*)$',
bygroups(Name.Decorator, Text), '#pop'),
(r'\n', Text),
(r'.', Text),
],
'changelog': [
(r'\*.*\n', Generic.Subheading),
(r'^(%' + _directives + ')(.*)$',
bygroups(Name.Decorator, Text), '#pop'),
(r'\n', Text),
(r'.', Text),
],
'string': [
(r'"', String.Double, '#pop'),
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
include('interpol'),
(r'.', String.Double),
],
'basic': [
include('macro'),
(r'(?i)^(Name|Version|Release|Epoch|Summary|Group|License|Packager|'
r'Vendor|Icon|URL|Distribution|Prefix|Patch[0-9]*|Source[0-9]*|'
r'Requires\(?[a-z]*\)?|[a-z]+Req|Obsoletes|Provides|Conflicts|'
r'Build[a-z]+|[a-z]+Arch|Auto[a-z]+)(:)(.*)$',
bygroups(Generic.Heading, Punctuation, using(this))),
(r'^%description', Name.Decorator, 'description'),
(r'^%changelog', Name.Decorator, 'changelog'),
(r'^(%' + _directives + ')(.*)$', bygroups(Name.Decorator, Text)),
(r'%(attr|defattr|dir|doc(?:dir)?|setup|config(?:ure)?|'
r'make(?:install)|ghost|patch[0-9]+|find_lang|exclude|verify)',
Keyword),
include('interpol'),
(r"'.*'", String.Single),
(r'"', String.Double, 'string'),
(r'.', Text),
],
'macro': [
(r'%define.*\n', Comment.Preproc),
(r'%\{\!\?.*%define.*\}', Comment.Preproc),
(r'(%(?:if(?:n?arch)?|else(?:if)?|endif))(.*)$',
bygroups(Comment.Preproc, Text)),
],
'interpol': [
(r'%\{?__[a-z_]+\}?', Name.Function),
(r'%\{?_([a-z_]+dir|[a-z_]+path|prefix)\}?', Keyword.Pseudo),
(r'%\{\?[A-Za-z0-9_]+\}', Name.Variable),
(r'\$\{?RPM_[A-Z0-9_]+\}?', Name.Variable.Global),
(r'%\{[a-zA-Z][a-zA-Z0-9_]+\}', Keyword.Constant),
]
}
class AutoItLexer(RegexLexer):
"""
For `AutoIt <http://www.autoitscript.com/site/autoit/>`_ files.
AutoIt is a freeware BASIC-like scripting language
designed for automating the Windows GUI and general scripting
*New in Pygments 1.6.*
"""
name = 'AutoIt'
aliases = ['autoit', 'Autoit']
filenames = ['*.au3']
mimetypes = ['text/x-autoit']
# Keywords, functions, macros from au3.keywords.properties
# which can be found in AutoIt installed directory, e.g.
# c:\Program Files (x86)\AutoIt3\SciTE\au3.keywords.properties
keywords = """\
#include-once #include #endregion #forcedef #forceref #region
and byref case continueloop dim do else elseif endfunc endif
endselect exit exitloop for func global
if local next not or return select step
then to until wend while exit""".split()
functions = """\
abs acos adlibregister adlibunregister asc ascw asin assign atan
autoitsetoption autoitwingettitle autoitwinsettitle beep binary binarylen
binarymid binarytostring bitand bitnot bitor bitrotate bitshift bitxor
blockinput break call cdtray ceiling chr chrw clipget clipput consoleread
consolewrite consolewriteerror controlclick controlcommand controldisable
controlenable controlfocus controlgetfocus controlgethandle controlgetpos
controlgettext controlhide controllistview controlmove controlsend
controlsettext controlshow controltreeview cos dec dircopy dircreate
dirgetsize dirmove dirremove dllcall dllcalladdress dllcallbackfree
dllcallbackgetptr dllcallbackregister dllclose dllopen dllstructcreate
dllstructgetdata dllstructgetptr dllstructgetsize dllstructsetdata
drivegetdrive drivegetfilesystem drivegetlabel drivegetserial drivegettype
drivemapadd drivemapdel drivemapget drivesetlabel drivespacefree
drivespacetotal drivestatus envget envset envupdate eval execute exp
filechangedir fileclose filecopy filecreatentfslink filecreateshortcut
filedelete fileexists filefindfirstfile filefindnextfile fileflush
filegetattrib filegetencoding filegetlongname filegetpos filegetshortcut
filegetshortname filegetsize filegettime filegetversion fileinstall filemove
fileopen fileopendialog fileread filereadline filerecycle filerecycleempty
filesavedialog fileselectfolder filesetattrib filesetpos filesettime
filewrite filewriteline floor ftpsetproxy guicreate guictrlcreateavi
guictrlcreatebutton guictrlcreatecheckbox guictrlcreatecombo
guictrlcreatecontextmenu guictrlcreatedate guictrlcreatedummy
guictrlcreateedit guictrlcreategraphic guictrlcreategroup guictrlcreateicon
guictrlcreateinput guictrlcreatelabel guictrlcreatelist
guictrlcreatelistview guictrlcreatelistviewitem guictrlcreatemenu
guictrlcreatemenuitem guictrlcreatemonthcal guictrlcreateobj
guictrlcreatepic guictrlcreateprogress guictrlcreateradio
guictrlcreateslider guictrlcreatetab guictrlcreatetabitem
guictrlcreatetreeview guictrlcreatetreeviewitem guictrlcreateupdown
guictrldelete guictrlgethandle guictrlgetstate guictrlread guictrlrecvmsg
guictrlregisterlistviewsort guictrlsendmsg guictrlsendtodummy
guictrlsetbkcolor guictrlsetcolor guictrlsetcursor guictrlsetdata
guictrlsetdefbkcolor guictrlsetdefcolor guictrlsetfont guictrlsetgraphic
guictrlsetimage guictrlsetlimit guictrlsetonevent guictrlsetpos
guictrlsetresizing guictrlsetstate guictrlsetstyle guictrlsettip guidelete
guigetcursorinfo guigetmsg guigetstyle guiregistermsg guisetaccelerators
guisetbkcolor guisetcoord guisetcursor guisetfont guisethelp guiseticon
guisetonevent guisetstate guisetstyle guistartgroup guiswitch hex hotkeyset
httpsetproxy httpsetuseragent hwnd inetclose inetget inetgetinfo inetgetsize
inetread inidelete iniread inireadsection inireadsectionnames
inirenamesection iniwrite iniwritesection inputbox int isadmin isarray
isbinary isbool isdeclared isdllstruct isfloat ishwnd isint iskeyword
isnumber isobj isptr isstring log memgetstats mod mouseclick mouseclickdrag
mousedown mousegetcursor mousegetpos mousemove mouseup mousewheel msgbox
number objcreate objcreateinterface objevent objevent objget objname
onautoitexitregister onautoitexitunregister opt ping pixelchecksum
pixelgetcolor pixelsearch pluginclose pluginopen processclose processexists
processgetstats processlist processsetpriority processwait processwaitclose
progressoff progresson progressset ptr random regdelete regenumkey
regenumval regread regwrite round run runas runaswait runwait send
sendkeepactive seterror setextended shellexecute shellexecutewait shutdown
sin sleep soundplay soundsetwavevolume splashimageon splashoff splashtexton
sqrt srandom statusbargettext stderrread stdinwrite stdioclose stdoutread
string stringaddcr stringcompare stringformat stringfromasciiarray
stringinstr stringisalnum stringisalpha stringisascii stringisdigit
stringisfloat stringisint stringislower stringisspace stringisupper
stringisxdigit stringleft stringlen stringlower stringmid stringregexp
stringregexpreplace stringreplace stringright stringsplit stringstripcr
stringstripws stringtoasciiarray stringtobinary stringtrimleft
stringtrimright stringupper tan tcpaccept tcpclosesocket tcpconnect
tcplisten tcpnametoip tcprecv tcpsend tcpshutdown tcpstartup timerdiff
timerinit tooltip traycreateitem traycreatemenu traygetmsg trayitemdelete
trayitemgethandle trayitemgetstate trayitemgettext trayitemsetonevent
trayitemsetstate trayitemsettext traysetclick trayseticon traysetonevent
traysetpauseicon traysetstate traysettooltip traytip ubound udpbind
udpclosesocket udpopen udprecv udpsend udpshutdown udpstartup vargettype
winactivate winactive winclose winexists winflash wingetcaretpos
wingetclasslist wingetclientsize wingethandle wingetpos wingetprocess
wingetstate wingettext wingettitle winkill winlist winmenuselectitem
winminimizeall winminimizeallundo winmove winsetontop winsetstate
winsettitle winsettrans winwait winwaitactive winwaitclose
winwaitnotactive""".split()
macros = """\
@appdatacommondir @appdatadir @autoitexe @autoitpid @autoitversion
@autoitx64 @com_eventobj @commonfilesdir @compiled @computername @comspec
@cpuarch @cr @crlf @desktopcommondir @desktopdepth @desktopdir
@desktopheight @desktoprefresh @desktopwidth @documentscommondir @error
@exitcode @exitmethod @extended @favoritescommondir @favoritesdir
@gui_ctrlhandle @gui_ctrlid @gui_dragfile @gui_dragid @gui_dropid
@gui_winhandle @homedrive @homepath @homeshare @hotkeypressed @hour
@ipaddress1 @ipaddress2 @ipaddress3 @ipaddress4 @kblayout @lf
@logondnsdomain @logondomain @logonserver @mday @min @mon @msec @muilang
@mydocumentsdir @numparams @osarch @osbuild @oslang @osservicepack @ostype
@osversion @programfilesdir @programscommondir @programsdir @scriptdir
@scriptfullpath @scriptlinenumber @scriptname @sec @startmenucommondir
@startmenudir @startupcommondir @startupdir @sw_disable @sw_enable @sw_hide
@sw_lock @sw_maximize @sw_minimize @sw_restore @sw_show @sw_showdefault
@sw_showmaximized @sw_showminimized @sw_showminnoactive @sw_showna
@sw_shownoactivate @sw_shownormal @sw_unlock @systemdir @tab @tempdir
@tray_id @trayiconflashing @trayiconvisible @username @userprofiledir @wday
@windowsdir @workingdir @yday @year""".split()
tokens = {
'root': [
(r';.*\n', Comment.Single),
(r'(#comments-start|#cs).*?(#comments-end|#ce)', Comment.Multiline),
(r'[\[\]{}(),;]', Punctuation),
(r'(and|or|not)\b', Operator.Word),
(r'[\$|@][a-zA-Z_][a-zA-Z0-9_]*', Name.Variable),
(r'!=|==|:=|\.=|<<|>>|[-~+/*%=<>&^|?:!.]', Operator),
include('commands'),
include('labels'),
include('builtInFunctions'),
include('builtInMarcros'),
(r'"', String, combined('stringescape', 'dqs')),
include('numbers'),
(r'[a-zA-Z_#@$][a-zA-Z0-9_#@$]*', Name),
(r'\\|\'', Text),
(r'\`([\,\%\`abfnrtv\-\+;])', String.Escape),
(r'_\n', Text), # Line continuation
include('garbage'),
],
'commands': [
(r'(?i)(\s*)(%s)\b' % '|'.join(keywords),
bygroups(Text, Name.Builtin)),
],
'builtInFunctions': [
(r'(?i)(%s)\b' % '|'.join(functions),
Name.Function),
],
'builtInMarcros': [
(r'(?i)(%s)\b' % '|'.join(macros),
Name.Variable.Global),
],
'labels': [
# sendkeys
(r'(^\s*)({\S+?})', bygroups(Text, Name.Label)),
],
'numbers': [
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
(r'\d+[eE][+-]?[0-9]+', Number.Float),
(r'0\d+', Number.Oct),
(r'0[xX][a-fA-F0-9]+', Number.Hex),
(r'\d+L', Number.Integer.Long),
(r'\d+', Number.Integer)
],
'stringescape': [
(r'\"\"|\`([\,\%\`abfnrtv])', String.Escape),
],
'strings': [
(r'[^"\n]+', String),
],
'dqs': [
(r'"', String, '#pop'),
include('strings')
],
'garbage': [
(r'[^\S\n]', Text),
],
}

View File

@ -5,7 +5,7 @@
Lexers for parser generators.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -28,7 +28,8 @@ __all__ = ['RagelLexer', 'RagelEmbeddedLexer', 'RagelCLexer', 'RagelDLexer',
'AntlrPerlLexer', 'AntlrRubyLexer', 'AntlrCppLexer',
#'AntlrCLexer',
'AntlrCSharpLexer', 'AntlrObjectiveCLexer',
'AntlrJavaLexer', "AntlrActionScriptLexer"]
'AntlrJavaLexer', "AntlrActionScriptLexer",
'TreetopLexer']
class RagelLexer(RegexLexer):
@ -693,3 +694,85 @@ class AntlrActionScriptLexer(DelegatingLexer):
def analyse_text(text):
return AntlrLexer.analyse_text(text) and \
re.search(r'^\s*language\s*=\s*ActionScript\s*;', text, re.M)
class TreetopBaseLexer(RegexLexer):
"""
A base lexer for `Treetop <http://treetop.rubyforge.org/>`_ grammars.
Not for direct use; use TreetopLexer instead.
*New in Pygments 1.6.*
"""
tokens = {
'root': [
include('space'),
(r'require[ \t]+[^\n\r]+[\n\r]', Other),
(r'module\b', Keyword.Namespace, 'module'),
(r'grammar\b', Keyword, 'grammar'),
],
'module': [
include('space'),
include('end'),
(r'module\b', Keyword, '#push'),
(r'grammar\b', Keyword, 'grammar'),
(r'[A-Z][A-Za-z_0-9]*(?:::[A-Z][A-Za-z_0-9]*)*', Name.Namespace),
],
'grammar': [
include('space'),
include('end'),
(r'rule\b', Keyword, 'rule'),
(r'include\b', Keyword, 'include'),
(r'[A-Z][A-Za-z_0-9]*', Name),
],
'include': [
include('space'),
(r'[A-Z][A-Za-z_0-9]*(?:::[A-Z][A-Za-z_0-9]*)*', Name.Class, '#pop'),
],
'rule': [
include('space'),
include('end'),
(r'"(\\\\|\\"|[^"])*"', String.Double),
(r"'(\\\\|\\'|[^'])*'", String.Single),
(r'([A-Za-z_][A-Za-z_0-9]*)(:)', bygroups(Name.Label, Punctuation)),
(r'[A-Za-z_][A-Za-z_0-9]*', Name),
(r'[()]', Punctuation),
(r'[?+*/&!~]', Operator),
(r'\[(?:\\.|\[:\^?[a-z]+:\]|[^\\\]])+\]', String.Regex),
(r'([0-9]*)(\.\.)([0-9]*)',
bygroups(Number.Integer, Operator, Number.Integer)),
(r'(<)([^>]+)(>)', bygroups(Punctuation, Name.Class, Punctuation)),
(r'{', Punctuation, 'inline_module'),
(r'\.', String.Regex),
],
'inline_module': [
(r'{', Other, 'ruby'),
(r'}', Punctuation, '#pop'),
(r'[^{}]+', Other),
],
'ruby': [
(r'{', Other, '#push'),
(r'}', Other, '#pop'),
(r'[^{}]+', Other),
],
'space': [
(r'[ \t\n\r]+', Whitespace),
(r'#[^\n]*', Comment.Single),
],
'end': [
(r'end\b', Keyword, '#pop'),
],
}
class TreetopLexer(DelegatingLexer):
"""
A lexer for `Treetop <http://treetop.rubyforge.org/>`_ grammars.
*New in Pygments 1.6.*
"""
name = 'Treetop'
aliases = ['treetop']
filenames = ['*.treetop', '*.tt']
def __init__(self, **options):
super(TreetopLexer, self).__init__(RubyLexer, TreetopBaseLexer, **options)

View File

@ -5,7 +5,7 @@
Lexers for various shells.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -18,7 +18,7 @@ from pygments.util import shebang_matches
__all__ = ['BashLexer', 'BashSessionLexer', 'TcshLexer', 'BatchLexer',
'PowerShellLexer']
'PowerShellLexer', 'ShellSessionLexer']
line_re = re.compile('.*?\n')
@ -153,6 +153,52 @@ class BashSessionLexer(Lexer):
yield pos+i, t, v
class ShellSessionLexer(Lexer):
"""
Lexer for shell sessions that works with different command prompts
*New in Pygments 1.6.*
"""
name = 'Shell Session'
aliases = ['shell-session']
filenames = ['*.shell-session']
mimetypes = ['application/x-sh-session']
def get_tokens_unprocessed(self, text):
bashlexer = BashLexer(**self.options)
pos = 0
curcode = ''
insertions = []
for match in line_re.finditer(text):
line = match.group()
m = re.match(r'^((?:\[?\S+@[^$#%]+)[$#%])(.*\n?)', line)
if m:
# To support output lexers (say diff output), the output
# needs to be broken by prompts whenever the output lexer
# changes.
if not insertions:
pos = match.start()
insertions.append((len(curcode),
[(0, Generic.Prompt, m.group(1))]))
curcode += m.group(2)
else:
if insertions:
toks = bashlexer.get_tokens_unprocessed(curcode)
for i, t, v in do_insertions(insertions, toks):
yield pos+i, t, v
yield match.start(), Generic.Output, line
insertions = []
curcode = ''
if insertions:
for i, t, v in do_insertions(insertions,
bashlexer.get_tokens_unprocessed(curcode)):
yield pos+i, t, v
class BatchLexer(RegexLexer):
"""
Lexer for the DOS/Windows Batch file format.

View File

@ -5,7 +5,7 @@
Special lexers.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -34,7 +34,7 @@
The ``tests/examplefiles`` contains a few test files with data to be
parsed by these lexers.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,7 +5,7 @@
Lexers for various template engines' markup.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -224,12 +224,14 @@ class VelocityLexer(RegexLexer):
'variable': [
(identifier, Name.Variable),
(r'\(', Punctuation, 'funcparams'),
(r'(\.)(' + identifier + r')', bygroups(Punctuation, Name.Variable), '#push'),
(r'(\.)(' + identifier + r')',
bygroups(Punctuation, Name.Variable), '#push'),
(r'\}', Punctuation, '#pop'),
(r'', Other, '#pop')
],
'directiveparams': [
(r'(&&|\|\||==?|!=?|[-<>+*%&\|\^/])|\b(eq|ne|gt|lt|ge|le|not|in)\b', Operator),
(r'(&&|\|\||==?|!=?|[-<>+*%&\|\^/])|\b(eq|ne|gt|lt|ge|le|not|in)\b',
Operator),
(r'\[', Operator, 'rangeoperator'),
(r'\b' + identifier + r'\b', Name.Function),
include('funcparams')
@ -261,7 +263,8 @@ class VelocityLexer(RegexLexer):
rv += 0.15
if re.search(r'#\{?foreach\}?\(.+?\).*?#\{?end\}?', text):
rv += 0.15
if re.search(r'\$\{?[a-zA-Z_][a-zA-Z0-9_]*(\([^)]*\))?(\.[a-zA-Z0-9_]+(\([^)]*\))?)*\}?', text):
if re.search(r'\$\{?[a-zA-Z_][a-zA-Z0-9_]*(\([^)]*\))?'
r'(\.[a-zA-Z0-9_]+(\([^)]*\))?)*\}?', text):
rv += 0.01
return rv
@ -1638,6 +1641,8 @@ class LassoHtmlLexer(DelegatingLexer):
`HtmlLexer`.
Nested JavaScript and CSS is also highlighted.
*New in Pygments 1.6.*
"""
name = 'HTML+Lasso'
@ -1649,7 +1654,6 @@ class LassoHtmlLexer(DelegatingLexer):
'application/x-httpd-lasso[89]']
def __init__(self, **options):
options['requiredelimiters'] = True
super(LassoHtmlLexer, self).__init__(HtmlLexer, LassoLexer, **options)
def analyse_text(text):
@ -1665,6 +1669,8 @@ class LassoXmlLexer(DelegatingLexer):
"""
Subclass of the `LassoLexer` which highlights unhandled data with the
`XmlLexer`.
*New in Pygments 1.6.*
"""
name = 'XML+Lasso'
@ -1674,7 +1680,6 @@ class LassoXmlLexer(DelegatingLexer):
mimetypes = ['application/xml+lasso']
def __init__(self, **options):
options['requiredelimiters'] = True
super(LassoXmlLexer, self).__init__(XmlLexer, LassoLexer, **options)
def analyse_text(text):
@ -1688,6 +1693,8 @@ class LassoCssLexer(DelegatingLexer):
"""
Subclass of the `LassoLexer` which highlights unhandled data with the
`CssLexer`.
*New in Pygments 1.6.*
"""
name = 'CSS+Lasso'
@ -1712,6 +1719,8 @@ class LassoJavascriptLexer(DelegatingLexer):
"""
Subclass of the `LassoLexer` which highlights unhandled data with the
`JavascriptLexer`.
*New in Pygments 1.6.*
"""
name = 'JavaScript+Lasso'

View File

@ -5,7 +5,7 @@
Lexers for non-source code file types.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -25,7 +25,7 @@ __all__ = ['IniLexer', 'PropertiesLexer', 'SourcesListLexer', 'BaseMakefileLexer
'RstLexer', 'VimLexer', 'GettextLexer', 'SquidConfLexer',
'DebianControlLexer', 'DarcsPatchLexer', 'YamlLexer',
'LighttpdConfLexer', 'NginxConfLexer', 'CMakeLexer', 'HttpLexer',
'PyPyLogLexer']
'PyPyLogLexer', 'RegeditLexer', 'HxmlLexer']
class IniLexer(RegexLexer):
@ -41,7 +41,7 @@ class IniLexer(RegexLexer):
tokens = {
'root': [
(r'\s+', Text),
(r'[;#].*?$', Comment),
(r'[;#].*', Comment.Single),
(r'\[.*?\]$', Keyword),
(r'(.*?)([ \t]*)(=)([ \t]*)(.*(?:\n[ \t].+)*)',
bygroups(Name.Attribute, Text, Operator, Text, String))
@ -55,6 +55,49 @@ class IniLexer(RegexLexer):
return text[0] == '[' and text[npos-1] == ']'
class RegeditLexer(RegexLexer):
"""
Lexer for `Windows Registry
<http://en.wikipedia.org/wiki/Windows_Registry#.REG_files>`_ files produced
by regedit.
*New in Pygments 1.6.*
"""
name = 'reg'
aliases = ['registry']
filenames = ['*.reg']
mimetypes = ['text/x-windows-registry']
tokens = {
'root': [
(r'Windows Registry Editor.*', Text),
(r'\s+', Text),
(r'[;#].*', Comment.Single),
(r'(\[)(-?)(HKEY_[A-Z_]+)(.*?\])$',
bygroups(Keyword, Operator, Name.Builtin, Keyword)),
# String keys, which obey somewhat normal escaping
(r'("(?:\\"|\\\\|[^"])+")([ \t]*)(=)([ \t]*)',
bygroups(Name.Attribute, Text, Operator, Text),
'value'),
# Bare keys (includes @)
(r'(.*?)([ \t]*)(=)([ \t]*)',
bygroups(Name.Attribute, Text, Operator, Text),
'value'),
],
'value': [
(r'-', Operator, '#pop'), # delete value
(r'(dword|hex(?:\([0-9a-fA-F]\))?)(:)([0-9a-fA-F,]+)',
bygroups(Name.Variable, Punctuation, Number), '#pop'),
# As far as I know, .reg files do not support line continuation.
(r'.*', String, '#pop'),
]
}
def analyse_text(text):
return text.startswith('Windows Registry Editor')
class PropertiesLexer(RegexLexer):
"""
Lexer for configuration files in Java's properties format.
@ -573,7 +616,7 @@ class MoinWikiLexer(RegexLexer):
(r'(\'\'\'?|\|\||`|__|~~|\^|,,|::)', Comment), # Formatting
# Lists
(r'^( +)([.*-])( )', bygroups(Text, Name.Builtin, Text)),
(r'^( +)([a-zivx]{1,5}\.)( )', bygroups(Text, Name.Builtin, Text)),
(r'^( +)([a-z]{1,5}\.)( )', bygroups(Text, Name.Builtin, Text)),
# Other Formatting
(r'\[\[\w+.*?\]\]', Keyword), # Macro
(r'(\[[^\s\]]+)(\s+[^\]]+?)?(\])',
@ -1706,8 +1749,8 @@ class PyPyLogLexer(RegexLexer):
],
"jit-log": [
(r"\[\w+\] jit-log-.*?}$", Keyword, "#pop"),
(r"^\+\d+: ", Comment),
(r"--end of the loop--", Comment),
(r"[ifp]\d+", Name),
(r"ptr\d+", Name),
(r"(\()(\w+(?:\.\w+)?)(\))",
@ -1717,7 +1760,7 @@ class PyPyLogLexer(RegexLexer):
(r"-?\d+", Number.Integer),
(r"'.*'", String),
(r"(None|descr|ConstClass|ConstPtr|TargetToken)", Name),
(r"<.*?>", Name.Builtin),
(r"<.*?>+", Name.Builtin),
(r"(label|debug_merge_point|jump|finish)", Name.Class),
(r"(int_add_ovf|int_add|int_sub_ovf|int_sub|int_mul_ovf|int_mul|"
r"int_floordiv|int_mod|int_lshift|int_rshift|int_and|int_or|"
@ -1757,3 +1800,44 @@ class PyPyLogLexer(RegexLexer):
(r"#.*?$", Comment),
],
}
class HxmlLexer(RegexLexer):
"""
Lexer for `haXe build <http://haxe.org/doc/compiler>`_ files.
*New in Pygments 1.6.*
"""
name = 'Hxml'
aliases = ['haxeml', 'hxml']
filenames = ['*.hxml']
tokens = {
'root': [
# Seperator
(r'(--)(next)', bygroups(Punctuation, Generic.Heading)),
# Compiler switches with one dash
(r'(-)(prompt|debug|v)', bygroups(Punctuation, Keyword.Keyword)),
# Compilerswitches with two dashes
(r'(--)(neko-source|flash-strict|flash-use-stage|no-opt|no-traces|'
r'no-inline|times|no-output)', bygroups(Punctuation, Keyword)),
# Targets and other options that take an argument
(r'(-)(cpp|js|neko|x|as3|swf9?|swf-lib|php|xml|main|lib|D|resource|'
r'cp|cmd)( +)(.+)',
bygroups(Punctuation, Keyword, Whitespace, String)),
# Options that take only numerical arguments
(r'(-)(swf-version)( +)(\d+)',
bygroups(Punctuation, Keyword, Number.Integer)),
# An Option that defines the size, the fps and the background
# color of an flash movie
(r'(-)(swf-header)( +)(\d+)(:)(\d+)(:)(\d+)(:)([A-Fa-f0-9]{6})',
bygroups(Punctuation, Keyword, Whitespace, Number.Integer,
Punctuation, Number.Integer, Punctuation, Number.Integer,
Punctuation, Number.Hex)),
# options with two dashes that takes arguments
(r'(--)(js-namespace|php-front|php-lib|remap|gen-hx-classes)( +)'
r'(.+)', bygroups(Punctuation, Keyword, Whitespace, String)),
# Single line comment, multiline ones are not allowed.
(r'#.*', Comment.Single)
]
}

View File

@ -5,7 +5,7 @@
Lexers for web-related languages and markup.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@ -27,7 +27,7 @@ __all__ = ['HtmlLexer', 'XmlLexer', 'JavascriptLexer', 'JsonLexer', 'CssLexer',
'MxmlLexer', 'HaxeLexer', 'HamlLexer', 'SassLexer', 'ScssLexer',
'ObjectiveJLexer', 'CoffeeScriptLexer', 'LiveScriptLexer',
'DuelLexer', 'ScamlLexer', 'JadeLexer', 'XQueryLexer',
'DtdLexer', 'DartLexer', 'LassoLexer']
'DtdLexer', 'DartLexer', 'LassoLexer', 'QmlLexer', 'TypeScriptLexer']
class JavascriptLexer(RegexLexer):
@ -791,7 +791,7 @@ class PhpLexer(RegexLexer):
name = 'PHP'
aliases = ['php', 'php3', 'php4', 'php5']
filenames = ['*.php', '*.php[345]']
filenames = ['*.php', '*.php[345]', '*.inc']
mimetypes = ['text/x-php']
flags = re.IGNORECASE | re.DOTALL | re.MULTILINE
@ -969,7 +969,8 @@ class DtdLexer(RegexLexer):
'attlist': [
include('common'),
(r'CDATA|IDREFS|IDREF|ID|NMTOKENS|NMTOKEN|ENTITIES|ENTITY|NOTATION', Keyword.Constant),
(r'CDATA|IDREFS|IDREF|ID|NMTOKENS|NMTOKEN|ENTITIES|ENTITY|NOTATION',
Keyword.Constant),
(r'#REQUIRED|#IMPLIED|#FIXED', Keyword.Constant),
(r'xml:space|xml:lang', Keyword.Reserved),
(r'[^>\s\|()?+*,]+', Name.Attribute),
@ -1762,7 +1763,7 @@ class ScssLexer(RegexLexer):
(r'(@include)( [\w-]+)', bygroups(Keyword, Name.Decorator), 'value'),
(r'@extend', Keyword, 'selector'),
(r'@[a-z0-9_-]+', Keyword, 'selector'),
(r'(\$[\w-]\w*)([ \t]*:)', bygroups(Name.Variable, Operator), 'value'),
(r'(\$[\w-]*\w)([ \t]*:)', bygroups(Name.Variable, Operator), 'value'),
(r'(?=[^;{}][;}])', Name.Attribute, 'attr'),
(r'(?=[^;{}:]+:[^a-z])', Name.Attribute, 'attr'),
(r'', Text, 'selector'),
@ -2936,27 +2937,25 @@ class DartLexer(RegexLexer):
tokens = {
'root': [
include('string_literal'),
(r'#!(.*?)$', Comment.Preproc),
(r'(#)(import|library|source)', bygroups(Text, Keyword)),
(r'\b(import|export)\b', Keyword, 'import_decl'),
(r'\b(library|source|part of|part)\b', Keyword),
(r'[^\S\n]+', Text),
(r'//.*?\n', Comment.Single),
(r'/\*.*?\*/', Comment.Multiline),
(r'(class|interface)(\s+)',
(r'\b(class)\b(\s+)',
bygroups(Keyword.Declaration, Text), 'class'),
(r'(assert|break|case|catch|continue|default|do|else|finally|for|'
(r'\b(assert|break|case|catch|continue|default|do|else|finally|for|'
r'if|in|is|new|return|super|switch|this|throw|try|while)\b',
Keyword),
(r'(abstract|const|extends|factory|final|get|implements|'
(r'\b(abstract|const|extends|factory|final|get|implements|'
r'native|operator|set|static|typedef|var)\b', Keyword.Declaration),
(r'(bool|double|Dynamic|int|num|Object|String|void)', Keyword.Type),
(r'(false|null|true)', Keyword.Constant),
(r'@"(\\\\|\\"|[^"])*"', String.Double), # raw string
(r"@'(\\\\|\\'|[^'])*'", String.Single), # raw string
(r'"', String.Double, 'string_double'),
(r"'", String.Single, 'string_single'),
(r'\b(bool|double|Dynamic|int|num|Object|String|void)\b', Keyword.Type),
(r'\b(false|null|true)\b', Keyword.Constant),
(r'[~!%^&*+=|?:<>/-]|as', Operator),
(r'[a-zA-Z_$][a-zA-Z0-9_]*:', Name.Label),
(r'[a-zA-Z_$][a-zA-Z0-9_]*', Name),
(r'[~!%^&*+=|?:<>/-]', Operator),
(r'[(){}\[\],.;]', Punctuation),
(r'0[xX][0-9a-fA-F]+', Number.Hex),
# DIGIT+ (. DIGIT*)? EXPONENT?
@ -2968,21 +2967,132 @@ class DartLexer(RegexLexer):
'class': [
(r'[a-zA-Z_$][a-zA-Z0-9_]*', Name.Class, '#pop')
],
'string_double': [
(r'"', String.Double, '#pop'),
(r'[^"$]+', String.Double),
'import_decl': [
include('string_literal'),
(r'\s+', Text),
(r'\b(as|show|hide)\b', Keyword),
(r'[a-zA-Z_$][a-zA-Z0-9_]*', Name),
(r'\,', Punctuation),
(r'\;', Punctuation, '#pop')
],
'string_literal': [
# Raw strings.
(r'r"""([\s|\S]*?)"""', String.Double),
(r"r'''([\s|\S]*?)'''", String.Single),
(r'r"(.*?)"', String.Double),
(r"r'(.*?)'", String.Single),
# Normal Strings.
(r'"""', String.Double, 'string_double_multiline'),
(r"'''", String.Single, 'string_single_multiline'),
(r'"', String.Double, 'string_double'),
(r"'", String.Single, 'string_single')
],
'string_common': [
(r"\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\{[0-9A-Fa-f]*\}|[a-z\'\"$\\])",
String.Escape),
(r'(\$)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(String.Interpol, Name)),
(r'(\$\{)(.*?)(\})',
bygroups(String.Interpol, using(this), String.Interpol)),
bygroups(String.Interpol, using(this), String.Interpol))
],
'string_double': [
(r'"', String.Double, '#pop'),
(r'[^\"$\\\n]+', String.Double),
include('string_common'),
(r'\$+', String.Double)
],
'string_double_multiline': [
(r'"""', String.Double, '#pop'),
(r'[^\"$\\]+', String.Double),
include('string_common'),
(r'(\$|\")+', String.Double)
],
'string_single': [
(r"'", String.Single, '#pop'),
(r"[^'$]+", String.Single),
(r'(\$)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(String.Interpol, Name)),
(r'(\$\{)(.*?)(\})',
bygroups(String.Interpol, using(this), String.Interpol)),
(r"[^\'$\\\n]+", String.Single),
include('string_common'),
(r'\$+', String.Single)
],
'string_single_multiline': [
(r"'''", String.Single, '#pop'),
(r'[^\'$\\]+', String.Single),
include('string_common'),
(r'(\$|\')+', String.Single)
]
}
class TypeScriptLexer(RegexLexer):
"""
For `TypeScript <http://www.python.org>`_ source code.
*New in Pygments 1.6.*
"""
name = 'TypeScript'
aliases = ['ts']
filenames = ['*.ts']
mimetypes = ['text/x-typescript']
flags = re.DOTALL
tokens = {
'commentsandwhitespace': [
(r'\s+', Text),
(r'<!--', Comment),
(r'//.*?\n', Comment.Single),
(r'/\*.*?\*/', Comment.Multiline)
],
'slashstartsregex': [
include('commentsandwhitespace'),
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
r'([gim]+\b|\B)', String.Regex, '#pop'),
(r'(?=/)', Text, ('#pop', 'badregex')),
(r'', Text, '#pop')
],
'badregex': [
(r'\n', Text, '#pop')
],
'root': [
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
include('commentsandwhitespace'),
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
r'(<<|>>>?|==?|!=?|[-<>+*%&\|\^/])=?', Operator, 'slashstartsregex'),
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
(r'[})\].]', Punctuation),
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
r'throw|try|catch|finally|new|delete|typeof|instanceof|void|'
r'this)\b', Keyword, 'slashstartsregex'),
(r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
(r'(abstract|boolean|byte|char|class|const|debugger|double|enum|export|'
r'extends|final|float|goto|implements|import|int|interface|long|native|'
r'package|private|protected|public|short|static|super|synchronized|throws|'
r'transient|volatile)\b', Keyword.Reserved),
(r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant),
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
r'decodeURIComponent|encodeURI|encodeURIComponent|'
r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
r'window)\b', Name.Builtin),
# Match stuff like: module name {...}
(r'\b(module)(\s*)(\s*[a-zA-Z0-9_?.$][\w?.$]*)(\s*)',
bygroups(Keyword.Reserved, Text, Name.Other, Text), 'slashstartsregex'),
# Match variable type keywords
(r'\b(string|bool|number)\b', Keyword.Type),
# Match stuff like: constructor
(r'\b(constructor|declare|interface|as|AS)\b', Keyword.Reserved),
# Match stuff like: super(argument, list)
(r'(super)(\s*)(\([a-zA-Z0-9,_?.$\s]+\s*\))',
bygroups(Keyword.Reserved, Text), 'slashstartsregex'),
# Match stuff like: function() {...}
(r'([a-zA-Z_?.$][\w?.$]*)\(\) \{', Name.Other, 'slashstartsregex'),
# Match stuff like: (function: return type)
(r'([a-zA-Z0-9_?.$][\w?.$]*)(\s*:\s*)([a-zA-Z0-9_?.$][\w?.$]*)',
bygroups(Name.Other, Text, Keyword.Type)),
(r'[$a-zA-Z_][a-zA-Z0-9_]*', Name.Other),
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
(r'0x[0-9a-fA-F]+', Number.Hex),
(r'[0-9]+', Number.Integer),
(r'"(\\\\|\\"|[^"])*"', String.Double),
(r"'(\\\\|\\'|[^'])*'", String.Single),
]
}
@ -3015,19 +3125,14 @@ class LassoLexer(RegexLexer):
tokens = {
'root': [
(r'^#!.+lasso9\b', Comment.Preproc, 'lasso'),
(r'\s+', Other),
(r'\[no_square_brackets\]', Comment.Preproc, 'nosquarebrackets'),
(r'\[noprocess\]', Comment.Preproc, ('delimiters', 'noprocess')),
(r'\[', Comment.Preproc, ('delimiters', 'squarebrackets')),
(r'<\?(LassoScript|lasso|=)', Comment.Preproc,
('delimiters', 'anglebrackets')),
(r'<', Other, 'delimiters'),
include('lasso'),
],
'nosquarebrackets': [
(r'<\?(LassoScript|lasso|=)', Comment.Preproc, 'anglebrackets'),
(r'<', Other),
(r'[^<]+', Other),
(r'\s+', Other),
(r'', Other, ('delimiters', 'lassofile')),
],
'delimiters': [
(r'\[no_square_brackets\]', Comment.Preproc, 'nosquarebrackets'),
@ -3037,6 +3142,11 @@ class LassoLexer(RegexLexer):
(r'<', Other),
(r'[^[<]+', Other),
],
'nosquarebrackets': [
(r'<\?(LassoScript|lasso|=)', Comment.Preproc, 'anglebrackets'),
(r'<', Other),
(r'[^<]+', Other),
],
'noprocess': [
(r'\[/noprocess\]', Comment.Preproc, '#pop'),
(r'\[', Other),
@ -3050,12 +3160,20 @@ class LassoLexer(RegexLexer):
(r'\?>', Comment.Preproc, '#pop'),
include('lasso'),
],
'lasso': [
# whitespace/comments
'lassofile': [
(r'\]', Comment.Preproc, '#pop'),
(r'\?>', Comment.Preproc, '#pop'),
include('lasso'),
],
'whitespacecomments': [
(r'\s+', Text),
(r'//.*?\n', Comment.Single),
(r'/\*\*!.*?\*/', String.Doc),
(r'/\*.*?\*/', Comment.Multiline),
],
'lasso': [
# whitespace/comments
include('whitespacecomments'),
# literals
(r'\d*\.\d+(e[+-]?\d+)?', Number.Float),
@ -3098,10 +3216,9 @@ class LassoLexer(RegexLexer):
(r'(define)(\s+)([a-z_][\w.]*)',
bygroups(Keyword.Declaration, Text, Name.Function),
'signature'),
(r'(public|protected|private|provide)(\s+)([a-z_][\w.]*=?|'
r'[-+*/%<>]|==)(\s*)(\()',
bygroups(Keyword, Text, Name.Function, Text, Punctuation),
('signature', 'parameter')),
(r'(public|protected|private|provide)(\s+)(([a-z_][\w.]*=?|'
r'[-+*/%<>]|==)(?=\s*\())', bygroups(Keyword, Text, Name.Function),
'signature'),
(r'(public|protected|private)(\s+)([a-z_][\w.]*)',
bygroups(Keyword, Text, Name.Function)),
@ -3112,6 +3229,9 @@ class LassoLexer(RegexLexer):
r'null)\b', Keyword.Type),
(r'([a-z_][\w.]*)(\s+)(in)\b', bygroups(Name, Text, Keyword)),
(r'(let|into)(\s+)([a-z_][\w.]*)', bygroups(Keyword, Text, Name)),
(r'require\b', Keyword, 'requiresection'),
(r'(/?)(Namespace_Using)\b',
bygroups(Punctuation, Keyword.Namespace)),
(r'(/?)(Cache|Database_Names|Database_SchemaNames|'
r'Database_TableNames|Define_Tag|Define_Type|Email_Batch|'
r'Encode_Set|HTML_Comment|Handle|Handle_Error|Header|If|Inline|'
@ -3119,19 +3239,21 @@ class LassoLexer(RegexLexer):
r'Link_CurrentRecord|Link_Detail|Link_FirstGroup|'
r'Link_FirstRecord|Link_LastGroup|Link_LastRecord|Link_NextGroup|'
r'Link_NextRecord|Link_PrevGroup|Link_PrevRecord|Log|Loop|'
r'Namespace_Using|NoProcess|Output_None|Portal|Private|Protect|'
r'Records|Referer|Referrer|Repeating|ResultSet|Rows|Search_Args|'
r'Search_Arguments|Select|Sort_Args|Sort_Arguments|Thread_Atomic|'
r'Value_List|While|Abort|Case|Else|If_Empty|If_False|If_Null|'
r'If_True|Loop_Abort|Loop_Continue|Loop_Count|Params|Params_Up|'
r'Return|Return_Value|Run_Children|SOAP_DefineTag|'
r'SOAP_LastRequest|SOAP_LastResponse|Tag_Name|ascending|average|'
r'by|define|descending|do|equals|frozen|group|handle_failure|'
r'import|in|into|join|let|match|max|min|on|order|parent|protected|'
r'provide|public|require|skip|split_thread|sum|take|thread|to|'
r'trait|type|where|with|yield)\b', bygroups(Punctuation, Keyword)),
r'NoProcess|Output_None|Portal|Private|Protect|Records|Referer|'
r'Referrer|Repeating|ResultSet|Rows|Search_Args|Search_Arguments|'
r'Select|Sort_Args|Sort_Arguments|Thread_Atomic|Value_List|While|'
r'Abort|Case|Else|If_Empty|If_False|If_Null|If_True|Loop_Abort|'
r'Loop_Continue|Loop_Count|Params|Params_Up|Return|Return_Value|'
r'Run_Children|SOAP_DefineTag|SOAP_LastRequest|SOAP_LastResponse|'
r'Tag_Name|ascending|average|by|define|descending|do|equals|'
r'frozen|group|handle_failure|import|in|into|join|let|match|max|'
r'min|on|order|parent|protected|provide|public|require|skip|'
r'split_thread|sum|take|thread|to|trait|type|where|with|yield)\b',
bygroups(Punctuation, Keyword)),
# other
(r'(([a-z_][\w.]*=?|[-+*/%<>]|==)(?=\s*\([^)]*\)\s*=>))',
Name.Function, 'signature'),
(r'(and|or|not)\b', Operator.Word),
(r'([a-z_][\w.]*)(\s*)(::\s*)([a-z_][\w.]*)(\s*)(=)',
bygroups(Name, Text, Punctuation, Name.Label, Text, Operator)),
@ -3160,16 +3282,34 @@ class LassoLexer(RegexLexer):
r'[abefnrtv?\"\'\\]|$)', String.Escape),
],
'signature': [
(r'[(,]', Punctuation, 'parameter'),
(r'=>', Operator, '#pop'),
(r'\)', Punctuation, '#pop'),
(r'[(,]', Punctuation, 'parameter'),
include('lasso'),
],
'parameter': [
(r'\.\.\.', Name.Builtin.Pseudo),
(r'-?[a-z_][\w.]*', Name.Attribute, '#pop'),
(r'\)', Punctuation, '#pop'),
(r'-?[a-z_][\w.]*', Name.Attribute, '#pop'),
(r'\.\.\.', Name.Builtin.Pseudo),
include('lasso'),
],
'requiresection': [
(r'(([a-z_][\w.]*=?|[-+*/%<>]|==)(?=\s*\())', Name, 'requiresignature'),
(r'(([a-z_][\w.]*=?|[-+*/%<>]|==)(?=(\s*::\s*[\w.]+)?\s*,))', Name),
(r'[a-z_][\w.]*=?|[-+*/%<>]|==', Name, '#pop'),
(r'(::\s*)([a-z_][\w.]*)', bygroups(Punctuation, Name.Label)),
(r',', Punctuation),
include('whitespacecomments'),
],
'requiresignature': [
(r'(\)(?=(\s*::\s*[\w.]+)?\s*,))', Punctuation, '#pop'),
(r'\)', Punctuation, '#pop:2'),
(r'-?[a-z_][\w.]*', Name.Attribute),
(r'(::\s*)([a-z_][\w.]*)', bygroups(Punctuation, Name.Label)),
(r'\.\.\.', Name.Builtin.Pseudo),
(r'[(,]', Punctuation),
include('whitespacecomments'),
],
}
def __init__(self, **options):
@ -3208,3 +3348,76 @@ class LassoLexer(RegexLexer):
if re.search(r'\[\n|\?>', text):
rv += 0.4
return rv
class QmlLexer(RegexLexer):
"""
For QML files. See http://doc.qt.digia.com/4.7/qdeclarativeintroduction.html.
*New in Pygments 1.6.*
"""
# QML is based on javascript, so much of this is taken from the
# JavascriptLexer above.
name = 'QML'
aliases = ['qml', 'Qt Meta Language', 'Qt modeling Language']
filenames = ['*.qml',]
mimetypes = [ 'application/x-qml',]
# pasted from JavascriptLexer, with some additions
flags = re.DOTALL
tokens = {
'commentsandwhitespace': [
(r'\s+', Text),
(r'<!--', Comment),
(r'//.*?\n', Comment.Single),
(r'/\*.*?\*/', Comment.Multiline)
],
'slashstartsregex': [
include('commentsandwhitespace'),
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
r'([gim]+\b|\B)', String.Regex, '#pop'),
(r'(?=/)', Text, ('#pop', 'badregex')),
(r'', Text, '#pop')
],
'badregex': [
(r'\n', Text, '#pop')
],
'root' : [
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
include('commentsandwhitespace'),
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
r'(<<|>>>?|==?|!=?|[-<>+*%&\|\^/])=?', Operator, 'slashstartsregex'),
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
(r'[})\].]', Punctuation),
# QML insertions
(r'\bid\s*:\s*[A-Za-z][_A-Za-z.0-9]*',Keyword.Declaration,
'slashstartsregex'),
(r'\b[A-Za-z][_A-Za-z.0-9]*\s*:',Keyword, 'slashstartsregex'),
# the rest from JavascriptLexer
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
r'throw|try|catch|finally|new|delete|typeof|instanceof|void|'
r'this)\b', Keyword, 'slashstartsregex'),
(r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
(r'(abstract|boolean|byte|char|class|const|debugger|double|enum|export|'
r'extends|final|float|goto|implements|import|int|interface|long|native|'
r'package|private|protected|public|short|static|super|synchronized|throws|'
r'transient|volatile)\b', Keyword.Reserved),
(r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant),
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
r'decodeURIComponent|encodeURI|encodeURIComponent|'
r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
r'window)\b', Name.Builtin),
(r'[$a-zA-Z_][a-zA-Z0-9_]*', Name.Other),
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
(r'0x[0-9a-fA-F]+', Number.Hex),
(r'[0-9]+', Number.Integer),
(r'"(\\\\|\\"|[^"])*"', String.Double),
(r"'(\\\\|\\'|[^'])*'", String.Single),
]
}

View File

@ -32,7 +32,7 @@
yourfilter = yourfilter:YourFilter
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
try:

View File

@ -12,7 +12,7 @@
Have a look at the `DelphiLexer` to get an idea of how to use
this scanner.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re

View File

@ -5,7 +5,7 @@
Basic style object.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,7 +5,7 @@
Contains built-in styles.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,7 +5,7 @@
A colorful style, inspired by the terminal highlighting style.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,7 +5,7 @@
Style similar to the style used in the Borland IDEs.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,7 +5,7 @@
Simple black/white only style.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,7 +5,7 @@
A colorful style, inspired by CodeRay.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

View File

@ -5,7 +5,7 @@
The default highlighting style.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""

Some files were not shown because too many files have changed in this diff Show More