From: JinWang An Date: Tue, 5 Jan 2021 03:13:32 +0000 (+0900) Subject: Imported Upstream version 1.2 X-Git-Tag: upstream/1.2^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=facc16addb9d15926342113a9cf23c27a114e3c3;p=platform%2Fupstream%2Fpython3-pygments.git Imported Upstream version 1.2 --- diff --git a/AUTHORS b/AUTHORS index fd4983b..34cc6be 100644 --- a/AUTHORS +++ b/AUTHORS @@ -23,18 +23,22 @@ Other contributors, listed alphabetically, are: * Laurent Gautier -- R/S lexer * Krzysiek Goj -- Scala lexer * Matt Good -- Genshi, Cheetah lexers +* Olivier Guibe -- Asymptote lexer * Matthew Harrison -- SVG formatter * Steven Hazel -- Tcl lexer +* Aslak Hellesøy -- Gherkin lexer * Varun Hiremath -- Debian control lexer * Dennis Kaarsemaker -- sources.list lexer * Marek Kubica -- Scheme lexer * Jochen Kupperschmidt -- Markdown processor * Gerd Kurzbach -- Modelica lexer * Mark Lee -- Vala lexer +* Ben Mabey -- Gherkin lexer * Kirk McDonald -- D lexer * Lukas Meuser -- BBCode formatter, Lua lexer * Paulo Moura -- Logtalk lexer * Ana Nelson -- Ragel, ANTLR lexers +* Nam T. Nguyen -- Monokai style * Jesper Noehr -- HTML formatter "anchorlinenos" * Jonas Obrist -- BBCode lexer * David Oliva -- Rebol lexer @@ -42,6 +46,7 @@ Other contributors, listed alphabetically, are: * Benjamin Peterson -- Test suite refactoring * Justin Reidy -- MXML lexer * Andre Roberge -- Tango style +* Konrad Rudolph -- LaTeX formatter enhancements * Mario Ruggier -- Evoque lexers * Stou Sandalski -- NumPy, FORTRAN, tcsh and XSLT lexers * Matteo Sasso -- Common Lisp lexer diff --git a/CHANGES b/CHANGES index 9985ab3..9daf05a 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,46 @@ Pygments changelog Issue numbers refer to the tracker at http://dev.pocoo.org/projects/pygments/. +Version 1.2 +----------- +(codename Neujahr, released Jan 01, 2010) + +- Dropped Python 2.3 compatibility. + +- Lexers added: + + * Asymptote + * Go + * Gherkin (Cucumber) + * CMake + * OOC + +- Added options for rendering LaTeX in source code comments in the + LaTeX formatter (#461). + +- Updated the Logtalk lexer. + +- Added `line_number_start` option to image formatter (#456). + +- Added `hl_lines` and `hl_color` options to image formatter (#457). + +- Fixed the HtmlFormatter's handling of noclasses=True to not output any + classes (#427). + +- Added the Monokai style (#453). + +- Fixed LLVM lexer identifier syntax and added new keywords (#442). + +- Fixed the PythonTracebackLexer to handle non-traceback data in header or + trailer, and support more partial tracebacks that start on line 2 (#437). + +- Fixed the CLexer to not highlight ternary statements as labels. + +- Fixed lexing of some Ruby quoting peculiarities (#460). + +- A few ASM lexer fixes (#450). + + Version 1.1.1 ------------- (bugfix release, released Sep 15, 2009) diff --git a/LICENSE b/LICENSE index 05652fc..0ad59ec 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2006-2009 by the respective authors (see AUTHORS file). +Copyright (c) 2006-2010 by the respective authors (see AUTHORS file). All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/Makefile b/Makefile index 3d27e39..6e81f2e 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ # # Combines scripts for common tasks. # -# :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. +# :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. # :license: BSD, see LICENSE for details. # @@ -19,13 +19,13 @@ all: clean-pyc check test check: @$(PYTHON) scripts/detect_missing_analyse_text.py || true - @$(PYTHON) scripts/check_sources.py -i pygments/lexers/_mapping.py \ + @$(PYTHON) scripts/check_sources.py -i build -i dist -i pygments/lexers/_mapping.py \ -i docs/build -i pygments/formatters/_mapping.py -i pygments/unistring.py \ -i pygments/lexers/_vimbuiltins.py clean: clean-pyc - rm -r build - rm -f codetags.html + -rm -rf build + -rm -f codetags.html clean-pyc: find . -name '*.pyc' -exec rm -f {} + diff --git a/PKG-INFO b/PKG-INFO index d786c48..fb8dabf 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: Pygments -Version: 1.1.1 +Version: 1.2 Summary: Pygments is a syntax highlighting package written in Python. Home-page: http://pygments.org/ Author: Georg Brandl @@ -28,7 +28,7 @@ Description: .. _Pygments tip: http://dev.pocoo.org/hg/pygments-main/archive/tip.tar.gz#egg=Pygments-dev - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. Keywords: syntax highlighting diff --git a/Pygments.egg-info/PKG-INFO b/Pygments.egg-info/PKG-INFO index d786c48..fb8dabf 100644 --- a/Pygments.egg-info/PKG-INFO +++ b/Pygments.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: Pygments -Version: 1.1.1 +Version: 1.2 Summary: Pygments is a syntax highlighting package written in Python. Home-page: http://pygments.org/ Author: Georg Brandl @@ -28,7 +28,7 @@ Description: .. _Pygments tip: http://dev.pocoo.org/hg/pygments-main/archive/tip.tar.gz#egg=Pygments-dev - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. Keywords: syntax highlighting diff --git a/Pygments.egg-info/SOURCES.txt b/Pygments.egg-info/SOURCES.txt index d14d7b5..c6669e5 100644 --- a/Pygments.egg-info/SOURCES.txt +++ b/Pygments.egg-info/SOURCES.txt @@ -84,6 +84,7 @@ 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/_luabuiltins.py pygments/lexers/_mapping.py @@ -111,6 +112,7 @@ 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 @@ -194,6 +196,7 @@ tests/examplefiles/example.yaml tests/examplefiles/example2.aspx tests/examplefiles/firefox.mak tests/examplefiles/format.ml +tests/examplefiles/fucked_up.rb tests/examplefiles/functional.rst tests/examplefiles/genclass.clj tests/examplefiles/genshi_example.xml+genshi @@ -206,6 +209,7 @@ tests/examplefiles/jinjadesignerdoc.rst tests/examplefiles/lighttpd_config.conf tests/examplefiles/linecontinuation.py tests/examplefiles/ltmain.sh +tests/examplefiles/main.cmake tests/examplefiles/matlab_noreturn tests/examplefiles/matlab_sample tests/examplefiles/matlabsession_sample.txt @@ -243,6 +247,7 @@ tests/examplefiles/sqlite3.sqlite3-console tests/examplefiles/squid.conf tests/examplefiles/string_delimiters.d tests/examplefiles/test.R +tests/examplefiles/test.asy tests/examplefiles/test.bas tests/examplefiles/test.boo tests/examplefiles/test.cs @@ -263,8 +268,8 @@ tests/examplefiles/test.rb tests/examplefiles/test.rhtml tests/examplefiles/test.tcsh tests/examplefiles/test.xsl +tests/examplefiles/truncated.pytb tests/examplefiles/type.lisp tests/examplefiles/unicode.applescript tests/examplefiles/while.pov -tests/examplefiles/zmlrpc.f90 -tests/examplefiles/broken/fucked_up.rb \ No newline at end of file +tests/examplefiles/zmlrpc.f90 \ No newline at end of file diff --git a/TODO b/TODO index 5873d87..6482700 100644 --- a/TODO +++ b/TODO @@ -1,15 +1,10 @@ Todo ==== -suggested new lexers --------------------- - -* IPython sessions -* Nemerle -* PostgreSQL/SQLite - -for 1.0 -------- +- suggested new lexers + * IPython sessions + * PostgreSQL/SQLite + * Nemerle - lexers that need work: * review perl lexer (numerous bugs, but so far no one had complaints ;) diff --git a/docs/build/api.html b/docs/build/api.html index ec31e52..39152b5 100644 --- a/docs/build/api.html +++ b/docs/build/api.html @@ -237,7 +237,7 @@ and return an iterable of tokens. Currently, this only calls
def format(tokens, formatter, outfile=None):
Format a token stream (iterable of tokens) tokens with the formatter (must be a Formatter instance). The result is -written to outfile, or if that is None, returned as a +written to outfile, or if that is None, returned as a string.
def highlight(code, lexer, formatter, outfile=None):
This is the most high-level highlighting function. @@ -339,23 +339,23 @@ available to help with that, see This method is the basic interface of a lexer. It is called by the highlight() function. It must process the text and return an -iterable of (tokentype, value) pairs from text.

+iterable of (tokentype, value) pairs from text.

Normally, you don't need to override this method. The default implementation processes the stripnl, stripall and tabsize options and then yields all tokens from get_tokens_unprocessed(), -with the index dropped.

+with the index dropped.

def get_tokens_unprocessed(self, text):

This method should process the text and return an iterable of -(index, tokentype, value) tuples where index is the starting +(index, tokentype, value) tuples where index is the starting position of the token within the input text.

This method must be overridden by subclasses.

def analyse_text(text):
A static method which is called for lexer guessing. It should analyse -the text and return a float in the range from 0.0 to 1.0. -If it returns 0.0, the lexer will not be selected as the most -probable one, if it returns 1.0, it will be selected immediately.
+the text and return a float in the range from 0.0 to 1.0. +If it returns 0.0, the lexer will not be selected as the most +probable one, if it returns 1.0, it will be selected immediately.

For a list of known tokens have a look at the Tokens page.

A lexer also can have the following attributes (in fact, they are mandatory @@ -435,9 +435,9 @@ the type or value of the argument is not correct.

Interpret the key optname from the dictionary options as a boolean and return it. Return default if optname is not in options.

-

The valid string values for True are 1, yes, -true and on, the ones for False are 0, -no, false and off (matched case-insensitively).

+

The valid string values for True are 1, yes, +true and on, the ones for False are 0, +no, false and off (matched case-insensitively).

def get_int_opt(options, optname, default=None):
As get_bool_opt, but interpret the value as an integer.
@@ -453,6 +453,6 @@ or a tuple, it is returned as a list. - \ No newline at end of file diff --git a/docs/build/authors.html b/docs/build/authors.html index d6f796d..161aa11 100644 --- a/docs/build/authors.html +++ b/docs/build/authors.html @@ -232,18 +232,22 @@ div.toc h2 {
  • Laurent Gautier -- R/S lexer
  • Krzysiek Goj -- Scala lexer
  • Matt Good -- Genshi, Cheetah lexers
  • +
  • Olivier Guibe -- Asymptote lexer
  • Matthew Harrison -- SVG formatter
  • Steven Hazel -- Tcl lexer
  • +
  • Aslak Hellesøy -- Gherkin lexer
  • Varun Hiremath -- Debian control lexer
  • Dennis Kaarsemaker -- sources.list lexer
  • Marek Kubica -- Scheme lexer
  • Jochen Kupperschmidt -- Markdown processor
  • Gerd Kurzbach -- Modelica lexer
  • Mark Lee -- Vala lexer
  • +
  • Ben Mabey -- Gherkin lexer
  • Kirk McDonald -- D lexer
  • Lukas Meuser -- BBCode formatter, Lua lexer
  • Paulo Moura -- Logtalk lexer
  • Ana Nelson -- Ragel, ANTLR lexers
  • +
  • Nam T. Nguyen -- Monokai style
  • Jesper Noehr -- HTML formatter "anchorlinenos"
  • Jonas Obrist -- BBCode lexer
  • David Oliva -- Rebol lexer
  • @@ -251,6 +255,7 @@ div.toc h2 {
  • Benjamin Peterson -- Test suite refactoring
  • Justin Reidy -- MXML lexer
  • Andre Roberge -- Tango style
  • +
  • Konrad Rudolph -- LaTeX formatter enhancements
  • Mario Ruggier -- Evoque lexers
  • Stou Sandalski -- NumPy, FORTRAN, tcsh and XSLT lexers
  • Matteo Sasso -- Common Lisp lexer
  • @@ -269,6 +274,6 @@ div.toc h2 { - \ No newline at end of file diff --git a/docs/build/changelog.html b/docs/build/changelog.html index aeffcb3..80fcd71 100644 --- a/docs/build/changelog.html +++ b/docs/build/changelog.html @@ -213,6 +213,8 @@ div.toc h2 {

    Contents

    @@ -437,7 +468,7 @@ accurate analyse_text()In the LatexFormatter, the commandprefix 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 arg -argument to get_style_defs() was removed. +argument to get_style_defs() was removed.
  • Added ImageFormatter, to format code as PNG, JPG, GIF or BMP. (Needs the Python Imaging Library.)
  • Support doc comments in the PHP lexer.
  • @@ -489,7 +520,7 @@ don't give an encoding option. give options whose values contain commas or equals signs.
  • Added 256-color terminal formatter.
  • Added an experimental SVG formatter.
  • -
  • Added the lineanchors option to the HTML formatter, thanks to +
  • Added the lineanchors option to the HTML formatter, thanks to Ian Charnas for the idea.
  • Gave the line numbers table a CSS class in the HTML formatter.
  • Added a Vim 7-like style.
  • @@ -520,7 +551,7 @@ Ian Charnas for the idea.
  • The HTML formatter now has a second line-numbers mode in which it -will just integrate the numbers in the same <pre> tag as the +will just integrate the numbers in the same <pre> tag as the code.
  • The CSharpLexer now is Unicode-aware, which means that it has an option that can be set so that it correctly lexes Unicode @@ -628,7 +659,7 @@ argument to generate CSS with multiple prefixes.
  • Support for guessing input encoding added.
  • Encoding support added: all processing is now done with Unicode strings, input and output are converted from and optionally to byte -strings (see the encoding option of lexers and formatters).
  • +strings (see the encoding option of lexers and formatters).
  • Some improvements in the C(++) lexers handling comments and line continuations.
  • @@ -637,7 +668,7 @@ continuations.

    Version 0.5.1

    (released Oct 30, 2006)

      -
    • Fixed traceback in pygmentize -L (thanks to Piotr Ozarowski).
    • +
    • Fixed traceback in pygmentize -L (thanks to Piotr Ozarowski).
    @@ -650,6 +681,6 @@ continuations.
    - \ No newline at end of file diff --git a/docs/build/cmdline.html b/docs/build/cmdline.html index 676749b..c673c3f 100644 --- a/docs/build/cmdline.html +++ b/docs/build/cmdline.html @@ -221,8 +221,6 @@ div.toc h2 {
  • Getting help
  • -
  • Examples
  • -
  • A note on encodings
  • @@ -255,6 +253,11 @@ If no output file name is given and $ pygmentize -o test.html test.py +

    To create a full HTML document, including line numbers and stylesheet (using the +"emacs" style), highlighting the Python file test.py to test.html:

    +
    +$ pygmentize -O full,style=emacs -o test.html test.py
    +

    Options and filters

    Lexer and formatter options can be given using the -O option:

    @@ -262,11 +265,11 @@ $ pygmentize -o test.html test.py $ pygmentize -f html -O style=colorful,linenos=1 -l python test.py

    Be sure to enclose the option string in quotes if it contains any special shell -characters, such as spaces or expansion wildcards like *. If an option +characters, such as spaces or expansion wildcards like *. 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).

    Since the -O option argument is split at commas and expects the split values -to be of the form name=value, you can't give an option value that contains +to be of the form name=value, you can't give an option value that contains commas or equals signs. Therefore, an option -P is provided (as of Pygments 0.9) that works like -O but can only pass one option per -P. Its value can then contain all characters:

    @@ -284,7 +287,7 @@ around the colon.

    Generating styles

    Formatters normally don't output full style information. For example, the HTML -formatter by default only outputs <span> tags with class attributes. +formatter by default only outputs <span> tags with class attributes. Therefore, there's a special -S option for generating style definitions. Usage is as follows:

    @@ -302,8 +305,8 @@ the arg argument for the formatter's get_style_defs()
     
     $ pygmentize -N setup.py
     
    -

    will print out python. It won't highlight anything yet. If no specific -lexer is known for that filename, text is printed.

    +

    will print out python. It won't highlight anything yet. If no specific +lexer is known for that filename, text is printed.

    Getting help

    @@ -325,25 +328,17 @@ $ pygmentize -H lexer python

    will print the help for the Python lexer, etc.

    -
    -

    Examples

    -

    Create a full HTML document, including line numbers and stylesheet (using the -"emacs" style), highlighting the Python file setup.py to setup.html:

    -
    -$ pygmentize -O full,style=emacs -o setup.html setup.py
    -
    -

    A note on encodings

    New in Pygments 0.9.

    Pygments tries to be smart regarding encodings in the formatting process:

      -
    • If you give an encoding option, it will be used as the input and +
    • If you give an encoding option, it will be used as the input and output encoding.
    • -
    • If you give an outencoding option, it will override encoding +
    • If you give an outencoding option, it will override encoding as the output encoding.
    • If you don't give an encoding and have given an output file, the default -encoding for lexer and formatter is latin1 (which will pass through +encoding for lexer and formatter is latin1 (which will pass through all non-ASCII characters).
    • 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 @@ -353,6 +348,6 @@ formatter is the terminal encoding (sys.stdout.encoding).
    - \ No newline at end of file diff --git a/docs/build/filterdevelopment.html b/docs/build/filterdevelopment.html index edc07a0..75ff028 100644 --- a/docs/build/filterdevelopment.html +++ b/docs/build/filterdevelopment.html @@ -277,6 +277,6 @@ decorated function for filtering.

    - \ No newline at end of file diff --git a/docs/build/filters.html b/docs/build/filters.html index 4413aec..8be21dc 100644 --- a/docs/build/filters.html +++ b/docs/build/filters.html @@ -242,6 +242,97 @@ iterable for all known filters.

    If you want to write your own filter, have a look at Write your own filter.

    Builtin Filters

    +

    RaiseOnErrorTokenFilter

    +
    +

    Raise an exception when the lexer generates an error token.

    +

    Options accepted:

    +
    +
    excclass : Exception class
    +
    The exception class to raise. +The default is pygments.filters.ErrorToken.
    +
    +

    New in Pygments 0.8.

    + +++ + + + +
    Name:raiseonerror
    +
    +

    VisibleWhitespaceFilter

    +
    +

    Convert tabs, newlines and/or spaces to visible characters.

    +

    Options accepted:

    +
    +
    spaces : string or bool
    +
    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 · (unicode +MIDDLE DOT). If it is a false value, spaces will not be replaced. The +default is False.
    +
    tabs : string or bool
    +
    The same as for spaces, but the default replacement character is » +(unicode RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK). The default value +is False. Note: this will not work if the tabsize option for the +lexer is nonzero, as tabs will already have been expanded then.
    +
    tabsize : int
    +
    If tabs are to be replaced by this filter (see the tabs option), this +is the total number of characters that a tab should be expanded to. +The default is 8.
    +
    newlines : string or bool
    +
    The same as for spaces, but the default replacement character is ¶ +(unicode PILCROW SIGN). The default value is False.
    +
    wstokentype : bool
    +
    If true, give whitespace the special Whitespace token type. This allows +styling the visible whitespace differently (e.g. greyed out), but it can +disrupt background colors. The default is True.
    +
    +

    New in Pygments 0.8.

    + +++ + + + +
    Name:whitespace
    +
    +

    TokenMergeFilter

    +
    +

    Merges consecutive tokens with the same token type in the output stream of a +lexer.

    +

    New in Pygments 1.2.

    + +++ + + + +
    Name:tokenmerge
    +
    +

    GobbleFilter

    +
    +

    Gobbles source code lines (eats initial characters).

    +

    This filter drops the first n 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.

    +

    Options accepted:

    +
    +
    n : int
    +
    The number of characters to gobble.
    +
    +

    New in Pygments 1.2.

    + +++ + + + +
    Name:gobble
    +

    NameHighlightFilter

    Highlight a normal Name token with a different token type.

    @@ -280,7 +371,7 @@ used for highlighting the strings in names. The default is
    codetags : list of strings
    A list of strings that are flagged as code tags. The default is to -highlight XXX, TODO, BUG and NOTE.
    +highlight XXX, TODO, BUG and NOTE.
    @@ -291,25 +382,6 @@ highlight XXX,
    -

    RaiseOnErrorTokenFilter

    -
    -

    Raise an exception when the lexer generates an error token.

    -

    Options accepted:

    -
    -
    excclass : Exception class
    -
    The exception class to raise. -The default is pygments.filters.ErrorToken.
    -
    -

    New in Pygments 0.8.

    - --- - - - -
    Name:raiseonerror
    -

    KeywordCaseFilter

    Convert keywords to lowercase or uppercase or capitalize them, which @@ -319,8 +391,8 @@ code to your styleguide.

    Options accepted:

    case : string
    -
    The casing to convert keywords to. Must be one of 'lower', -'upper' or 'capitalize'. The default is 'lower'.
    +
    The casing to convert keywords to. Must be one of 'lower', +'upper' or 'capitalize'. The default is 'lower'.
    @@ -331,47 +403,10 @@ code to your styleguide.

    -

    VisibleWhitespaceFilter

    -
    -

    Convert tabs, newlines and/or spaces to visible characters.

    -

    Options accepted:

    -
    -
    spaces : string or bool
    -
    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 · (unicode -MIDDLE DOT). If it is a false value, spaces will not be replaced. The -default is False.
    -
    tabs : string or bool
    -
    The same as for spaces, but the default replacement character is » -(unicode RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK). The default value -is False. Note: this will not work if the tabsize option for the -lexer is nonzero, as tabs will already have been expanded then.
    -
    tabsize : int
    -
    If tabs are to be replaced by this filter (see the tabs option), this -is the total number of characters that a tab should be expanded to. -The default is 8.
    -
    newlines : string or bool
    -
    The same as for spaces, but the default replacement character is ¶ -(unicode PILCROW SIGN). The default value is False.
    -
    wstokentype : bool
    -
    If true, give whitespace the special Whitespace token type. This allows -styling the visible whitespace differently (e.g. greyed out), but it can -disrupt background colors. The default is True.
    -
    -

    New in Pygments 0.8.

    - --- - - - -
    Name:whitespace
    -
    - \ No newline at end of file diff --git a/docs/build/formatterdevelopment.html b/docs/build/formatterdevelopment.html index d0a0002..f50ae04 100644 --- a/docs/build/formatterdevelopment.html +++ b/docs/build/formatterdevelopment.html @@ -244,7 +244,7 @@ sends the value of a token to the output stream:

    outfile.write(value)

    As you can see, the format() method is passed two parameters: tokensource -and outfile. The first is an iterable of (token_type, value) tuples, +and outfile. The first is an iterable of (token_type, value) tuples, the latter a file like object with a write() method.

    Because the formatter is that basic it doesn't overwrite the get_style_defs() method.

    @@ -253,23 +253,23 @@ method.

    Styles

    Styles aren't instantiated but their metaclass provides some class functions so that you can access the style definitions easily.

    -

    Styles are iterable and yield tuples in the form (ttype, d) where ttype +

    Styles are iterable and yield tuples in the form (ttype, d) where ttype is a token and d is a dict with the following keys:

    -
    'color'
    -
    Hexadecimal color value (eg: 'ff0000' for red) or None if not +
    'color'
    +
    Hexadecimal color value (eg: 'ff0000' for red) or None if not defined.
    -
    'bold'
    +
    'bold'
    True if the value should be bold
    -
    'italic'
    +
    'italic'
    True if the value should be italic
    -
    'underline'
    +
    'underline'
    True if the value should be underlined
    -
    'bgcolor'
    -
    Hexadecimal color value for the background (eg: 'eeeeeee' for light +
    'bgcolor'
    +
    Hexadecimal color value for the background (eg: 'eeeeeee' for light gray) or None if not defined.
    -
    'border'
    -
    Hexadecimal color value for the border (eg: '0000aa' for a dark +
    'border'
    +
    Hexadecimal color value for the border (eg: '0000aa' for a dark blue) or None for no border.

    Additional keys might appear in the future, formatters should ignore all keys @@ -278,7 +278,7 @@ they don't support.

    HTML 3.2 Formatter

    For an more complex example, let's implement a HTML 3.2 Formatter. We don't -use CSS but inline markup (<u>, <font>, etc). Because this isn't good +use CSS but inline markup (<u>, <font>, etc). Because this isn't good style this formatter isn't in the standard library ;-)

    from pygments.formatter import Formatter
     
    @@ -364,11 +364,11 @@ purpose the get_style_defs() method exists:

    output inline markup but reference either macros or css classes. Because the definitions of those are not part of the output, the get_style_defs() 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 None.

    +is up to the formatter) and has to return a string or None.

    - \ No newline at end of file diff --git a/docs/build/formatters.html b/docs/build/formatters.html index 6a64f2d..028685a 100644 --- a/docs/build/formatters.html +++ b/docs/build/formatters.html @@ -230,16 +230,16 @@ div.toc h2 {

    New in Pygments 0.6.

    If given, must be an encoding name (such as "utf-8"). This will be used to convert the token strings (which are Unicode strings) -to byte strings in the output (default: None). +to byte strings in the output (default: None). It will also be written in an encoding declaration suitable for the -document format if the full option is given (e.g. a meta +document format if the full option is given (e.g. a meta content-type directive in HTML or an invocation of the inputenc package in LaTeX).

    -

    If this is "" or None, Unicode strings will be written +

    If this is "" or None, Unicode strings will be written to the output file, which most file-like objects do not support. For example, pygments.highlight() will return a Unicode string if called with no outfile argument and a formatter that has encoding -set to None because it uses a StringIO.StringIO object that +set to None because it uses a StringIO.StringIO object that supports Unicode arguments to write(). Using a regular file object wouldn't work.

    @@ -247,7 +247,7 @@ wouldn't work.

    New in Pygments 0.7.

    When using Pygments from the command line, any encoding 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 "guess". +for example if you want to set the input encoding to "guess". Therefore, outencoding has been introduced which overrides encoding for the formatter if given.

    @@ -267,19 +267,19 @@ are no common BBcode tags for that.

    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 monofont option) and no spaces (which you +formatter can do with the monofont option) and no spaces (which you need for indentation) are removed.

    Additional options accepted:

    style
    The style to use, can be a string or a Style subclass (default: -'default').
    +'default').
    codetag
    -
    If set to true, put the output into [code] tags (default: -false)
    +
    If set to true, put the output into [code] tags (default: +false)
    monofont
    If set to true, add a tag to show the code with a monospace font -(default: false).
    +(default: false).
    @@ -334,11 +334,11 @@ suitable image_format option to the ImageFormatter.)

    HtmlFormatter

    -

    Format tokens as HTML 4 <span> tags within a <pre> tag, wrapped -in a <div> tag. The <div>'s CSS class can be set by the cssclass +

    Format tokens as HTML 4 <span> tags within a <pre> tag, wrapped +in a <div> tag. The <div>'s CSS class can be set by the cssclass option.

    -

    If the linenos option is set to "table", the <pre> is -additionally wrapped inside a <table> which has one row and two +

    If the linenos option is set to "table", the <pre> is +additionally wrapped inside a <table> which has one row and two cells: one containing the line numbers and one containing the code. Example:

    <div class="highlight" >
    @@ -361,7 +361,7 @@ Example:

    A list of lines can be specified using the hl_lines option to make these lines highlighted (as of Pygments 0.11).

    With the full option, a complete HTML 4 document is output, including -the style definitions inside a <style> tag, or in a separate file if +the style definitions inside a <style> tag, or in a separate file if the cssfile option is given.

    The get_style_defs(arg='') method of a HtmlFormatter returns a string containing CSS rules for the CSS classes used by the formatter. The @@ -386,23 +386,23 @@ would result in the following CSS classes:

    Additional options accepted:

    nowrap
    -
    If set to True, don't wrap the tokens at all, not even inside a <pre> -tag. This disables most other options (default: False).
    +
    If set to True, don't wrap the tokens at all, not even inside a <pre> +tag. This disables most other options (default: False).
    full
    Tells the formatter to output a "full" document, i.e. a complete -self-contained document (default: False).
    +self-contained document (default: False).
    title
    If full is true, the title that should be used to caption the -document (default: '').
    +document (default: '').
    style
    The style to use, can be a string or a Style subclass (default: -'default'). This option has no effect if the cssfile +'default'). This option has no effect if the cssfile and noclobber_cssfile option are given and the file specified in cssfile exists.
    noclasses
    -
    If set to true, token <span> tags will not use CSS classes, but +
    If set to true, token <span> 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: False).
    +it increases output size by quite a bit (default: False).
    classprefix
    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 @@ -410,17 +410,17 @@ with some of your own class names. In this case you can use the CSS class names for token types. Note that this option also affects the output of get_style_defs().
    cssclass
    -

    CSS class for the wrapping <div> tag (default: 'highlight'). +

    CSS class for the wrapping <div> tag (default: 'highlight'). If you set this option, the default selector for get_style_defs() will be this class.

    -

    New in Pygments 0.9: If you select the 'table' line numbers, the -wrapping table will have a CSS class of this string plus 'table', -the default is accordingly 'highlighttable'.

    +

    New in Pygments 0.9: If you select the 'table' line numbers, the +wrapping table will have a CSS class of this string plus 'table', +the default is accordingly 'highlighttable'.

    cssstyles
    -
    Inline CSS styles for the wrapping <div> tag (default: '').
    +
    Inline CSS styles for the wrapping <div> tag (default: '').
    prestyles
    -
    Inline CSS styles for the <pre> tag (default: ''). New in +
    Inline CSS styles for the <pre> tag (default: ''). New in Pygments 0.11.
    cssfile
    If the full option is true and this option is given, it must be the @@ -431,48 +431,48 @@ to this file instead of the HTML file. New in Pygments 0.6.
    noclobber_cssfile
    If cssfile is given and the specified file exists, the css file will not be overwritten. This allows the use of the full option in -combination with a user specified css file. Default is False. +combination with a user specified css file. Default is False. New in Pygments 1.1.
    linenos
    -

    If set to 'table', output line numbers as a table with two cells, +

    If set to 'table', 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 'inline', the line numbers will be -integrated in the <pre> tag that contains the code (that setting +browsers or fonts. If set to 'inline', the line numbers will be +integrated in the <pre> tag that contains the code (that setting is new in Pygments 0.8).

    For compatibility with Pygments 0.7 and earlier, every true value -except 'inline' means the same as 'table' (in particular, that -means also True).

    -

    The default value is False, which means no line numbers at all.

    +except 'inline' means the same as 'table' (in particular, that +means also True).

    +

    The default value is False, which means no line numbers at all.

    Note: with the default ("table") line number mechanism, the line numbers and code can have different line heights in Internet Explorer -unless you give the enclosing <pre> tags an explicit line-height +unless you give the enclosing <pre> tags an explicit line-height CSS property (you get the default line spacing with line-height: -125%).

    +125%).

    hl_lines
    Specify a list of lines to be highlighted. New in Pygments 0.11.
    linenostart
    -
    The line number for the first line (default: 1).
    +
    The line number for the first line (default: 1).
    linenostep
    If set to a number n > 1, only every nth line number is printed.
    linenospecial
    If set to a number n > 0, every nth line number is given the CSS -class "special" (default: 0).
    +class "special" (default: 0).
    nobackground
    -
    If set to True, the formatter won't output the background color -for the wrapping element (this automatically defaults to False +
    If set to True, the formatter won't output the background color +for the wrapping element (this automatically defaults to False when there is no wrapping element [eg: no argument for the -get_syntax_defs method given]) (default: False). New in +get_syntax_defs method given]) (default: False). New in Pygments 0.6.
    lineseparator
    -
    This string is output between lines of code. It defaults to "\n", -which is enough to break a line inside <pre> tags, but you can -e.g. set it to "<br>" to get HTML line breaks. New in Pygments +
    This string is output between lines of code. It defaults to "\n", +which is enough to break a line inside <pre> tags, but you can +e.g. set it to "<br>" to get HTML line breaks. New in Pygments 0.7.
    lineanchors
    -
    If set to a nonempty string, e.g. foo, the formatter will wrap each -output line in an anchor tag with a name of foo-linenumber. +
    If set to a nonempty string, e.g. foo, the formatter will wrap each +output line in an anchor tag with a name of foo-linenumber. This allows easy linking to certain lines. New in Pygments 0.9.
    anchorlinenos
    If set to True, will wrap line numbers in <a> tags. Used in @@ -482,19 +482,19 @@ combination with linenos and lineanchors.

    New in Pygments 0.7.

    The HTML formatter is now built in a way that allows easy subclassing, thus customizing the output HTML code. The format() method calls -self._format_lines() which returns a generator that yields tuples of (1, -line), where the 1 indicates that the line is a line of the +self._format_lines() which returns a generator that yields tuples of (1, +line), where the 1 indicates that the line is a line of the formatted source code.

    If the nowrap option is set, the generator is the iterated over and the resulting HTML is output.

    Otherwise, format() calls self.wrap(), which wraps the generator with other generators. These may add some HTML code to the one generated by _format_lines(), either by modifying the lines generated by the latter, -then yielding them again with (1, line), and/or by yielding other HTML -code before or after the lines, with (0, html). The distinction between +then yielding them again with (1, line), and/or by yielding other HTML +code before or after the lines, with (0, html). The distinction between source lines and other code makes it possible to wrap the generator multiple times.

    -

    The default wrap() implementation adds a <div> and a <pre> tag.

    +

    The default wrap() implementation adds a <div> and a <pre> tag.

    A custom HtmlFormatter subclass could look like this:

    class CodeHtmlFormatter(HtmlFormatter):
     
    @@ -510,8 +510,8 @@ times.

    yield i, t yield 0, '</code>'
    -

    This results in wrapping the formatted lines with a <code> tag, where the -source lines are broken using <br> tags.

    +

    This results in wrapping the formatted lines with a <code> tag, where the +source lines are broken using <br> tags.

    After calling wrap(), the format() method also adds the "line numbers" and/or "full document" wrappers if the respective options are set. Then, all HTML yielded by the wrapped generator is output.

    @@ -566,6 +566,10 @@ monospace font to look sane.

    Whether line numbers should be shown: True/False

    Default: True

    +
    line_number_start
    +

    The line number of the first line.

    +

    Default: 1

    +
    line_number_step

    The step used when printing line numbers.

    Default: 1

    @@ -602,6 +606,14 @@ source code area: True/False

    the source code area.

    Default: 6

    +
    hl_lines
    +

    Specify a list of lines to be highlighted. New in Pygments 1.2.

    +

    Default: empty list

    +
    +
    hl_color
    +

    Specify the color for highlighting lines. New in Pygments 1.2.

    +

    Default: highlight color of the selected style

    +
    @@ -639,52 +651,60 @@ suitable image_format option to the ImageFormatter.)

    Format tokens as LaTeX code. This needs the fancyvrb and color standard packages.

    -

    Without the full option, code is formatted as one Verbatim +

    Without the full option, code is formatted as one Verbatim environment, like this:

    \begin{Verbatim}[commandchars=@\[\]]
     @PY[k][def ]@PY[n+nf][foo](@PY[n][bar]):
         @PY[k][pass]
     \end{Verbatim}
     
    -

    The special command used here (@PY) and all the other macros it needs +

    The special command used here (@PY) and all the other macros it needs are output by the get_style_defs method.

    With the full option, a complete LaTeX document is output, including the command definitions in the preamble.

    The get_style_defs() method of a LatexFormatter returns a string -containing \def commands defining the macros needed inside the -Verbatim environments.

    +containing \def commands defining the macros needed inside the +Verbatim environments.

    Additional options accepted:

    style
    The style to use, can be a string or a Style subclass (default: -'default').
    +'default').
    full
    Tells the formatter to output a "full" document, i.e. a complete -self-contained document (default: False).
    +self-contained document (default: False).
    title
    If full is true, the title that should be used to caption the -document (default: '').
    +document (default: '').
    docclass
    If the full option is enabled, this is the document class to use -(default: 'article').
    +(default: 'article').
    preamble
    If the full option is enabled, this can be further preamble commands, -e.g. \usepackage (default: '').
    +e.g. \usepackage (default: '').
    linenos
    -
    If set to True, output line numbers (default: False).
    +
    If set to True, output line numbers (default: False).
    linenostart
    -
    The line number for the first line (default: 1).
    +
    The line number for the first line (default: 1).
    linenostep
    If set to a number n > 1, only every nth line number is printed.
    verboptions
    Additional options given to the Verbatim environment (see the fancyvrb -docs for possible values) (default: '').
    +docs for possible values) (default: '').
    commandprefix

    The LaTeX commands used to produce colored output are constructed -using this prefix and some letters (default: 'PY'). +using this prefix and some letters (default: 'PY'). New in Pygments 0.7.

    -

    New in Pygments 0.10: the default is now 'PY' instead of 'C'.

    +

    New in Pygments 0.10: the default is now 'PY' instead of 'C'.

    +
    texcomments
    +
    If set to True, enables LaTeX comment lines. That is, LaTex markup +in comment tokens is not escaped so that LaTeX can render it (default: +False). New in Pygments 1.2.
    +
    mathescape
    +
    If set to True, enables LaTeX math mode escape in comments. That +is, '$...$' inside a comment will trigger math mode (default: +False). New in Pygments 1.2.
    @@ -724,11 +744,11 @@ be converted to a token stream with the RawTokenLexer, described in

    Only two options are accepted:

    compress
    -
    If set to 'gz' or 'bz2', compress the output with the given -compression algorithm after encoding (default: '').
    +
    If set to 'gz' or 'bz2', compress the output with the given +compression algorithm after encoding (default: '').
    error_color
    If set to a color name, highlight error tokens using that color. If -set but with no value, defaults to 'red'. +set but with no value, defaults to 'red'. New in Pygments 0.11.
    @@ -754,9 +774,9 @@ Paste into Microsoft® Word® documents.

    style
    The style to use, can be a string or a Style subclass (default: -'default').
    +'default').
    fontface
    -
    The used font famliy, for example Bitstream Vera Sans. Defaults to +
    The used font famliy, for example Bitstream Vera Sans. Defaults to some generic font which is supposed to have fixed width.
    @@ -775,40 +795,40 @@ some generic font which is supposed to have fixed width.

    SvgFormatter

    Format tokens as an SVG graphics file. This formatter is still experimental. -Each line of code is a <text> element with explicit x and y -coordinates containing <tspan> elements with the individual token styles.

    +Each line of code is a <text> element with explicit x and y +coordinates containing <tspan> elements with the individual token styles.

    By default, this formatter outputs a full SVG document including doctype -declaration and the <svg> root element.

    +declaration and the <svg> root element.

    New in Pygments 0.9.

    Additional options accepted:

    nowrap
    -
    Don't wrap the SVG <text> elements in <svg><g> elements and +
    Don't wrap the SVG <text> elements in <svg><g> elements and don't add a XML declaration and a doctype. If true, the fontfamily -and fontsize options are ignored. Defaults to False.
    +and fontsize options are ignored. Defaults to False.
    fontfamily
    -
    The value to give the wrapping <g> element's font-family -attribute, defaults to "monospace".
    +
    The value to give the wrapping <g> element's font-family +attribute, defaults to "monospace".
    fontsize
    -
    The value to give the wrapping <g> element's font-size -attribute, defaults to "14px".
    +
    The value to give the wrapping <g> element's font-size +attribute, defaults to "14px".
    xoffset
    -
    Starting offset in X direction, defaults to 0.
    +
    Starting offset in X direction, defaults to 0.
    yoffset
    Starting offset in Y direction, defaults to the font size if it is given -in pixels, or 20 else. (This is necessary since text coordinates +in pixels, or 20 else. (This is necessary since text coordinates refer to the text baseline, not the top edge.)
    ystep
    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 25 else.
    +size is given in pixels, or 25 else.
    spacehack
    -
    Convert spaces in the source to &#160;, which are non-breaking -spaces. SVG provides the xml:space attribute to control how -whitespace inside tags is handled, in theory, the preserve value +
    Convert spaces in the source to &#160;, which are non-breaking +spaces. SVG provides the xml:space attribute to control how +whitespace inside tags is handled, in theory, the preserve 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 True.
    +and defaults to True.
    @@ -836,7 +856,7 @@ underline attributes from the style are preserved (and displayed).

    style
    The style to use, can be a string or a Style subclass (default: -'default').
    +'default').
    @@ -861,11 +881,11 @@ no support for common styles.

    Options accepted:

    bg
    -
    Set to "light" or "dark" depending on the terminal's background -(default: "light").
    +
    Set to "light" or "dark" depending on the terminal's background +(default: "light").
    colorscheme
    A dictionary mapping token types to (lightbg, darkbg) color names or -None (default: None = use builtin colorscheme).
    +None (default: None = use builtin colorscheme).
    @@ -883,6 +903,6 @@ no support for common styles.

    - \ No newline at end of file diff --git a/docs/build/index.html b/docs/build/index.html index 4e5a647..c62ff35 100644 --- a/docs/build/index.html +++ b/docs/build/index.html @@ -256,6 +256,6 @@ look here - \ No newline at end of file diff --git a/docs/build/installation.html b/docs/build/installation.html index 2320d5c..c9e1b88 100644 --- a/docs/build/installation.html +++ b/docs/build/installation.html @@ -221,8 +221,8 @@ div.toc h2 { -

    Pygments requires at least Python 2.3 to work correctly. Just to clarify: -there won't ever be support for Python versions below 2.3. However, there +

    Pygments requires at least Python 2.4 to work correctly. Just to clarify: +there won't ever be support for Python versions below 2.4. However, there are no other dependencies.

    Installing a released version

    @@ -240,7 +240,7 @@ directory.

    1. Download the most recent tarball from the download page
    2. Unpack the tarball
    3. -
    4. sudo python setup.py install
    5. +
    6. sudo python setup.py install

    Note that the last command will automatically download and install setuptools if you don't already have it installed. This requires a working @@ -254,12 +254,12 @@ internet connection.

    If you want to play around with the code

    1. Install Mercurial
    2. -
    3. hg clone http://dev.pocoo.org/hg/pygments-main pygments
    4. -
    5. cd pygments
    6. -
    7. ln -s pygments /usr/lib/python2.X/site-packages
    8. -
    9. ln -s pygmentize /usr/local/bin
    10. +
    11. hg clone http://dev.pocoo.org/hg/pygments-main pygments
    12. +
    13. cd pygments
    14. +
    15. ln -s pygments /usr/lib/python2.X/site-packages
    16. +
    17. ln -s pygmentize /usr/local/bin
    -

    As an alternative to steps 4 and 5 you can also do python setup.py develop +

    As an alternative to steps 4 and 5 you can also do python setup.py develop which will install the package via setuptools in development mode.

    - \ No newline at end of file diff --git a/docs/build/integrate.html b/docs/build/integrate.html index 5ae2a3d..254fb65 100644 --- a/docs/build/integrate.html +++ b/docs/build/integrate.html @@ -250,6 +250,6 @@ colorize code via a simple menu option. It can be found (index, token, value). Normally you don't need +containing tuples in the form (index, token, value). Normally you don't need to do this since there are numerous base lexers you can subclass.

    RegexLexer

    @@ -264,9 +264,9 @@ new state is pushed onto the stack. The most basic lexers (like the new_state) where the last item is optional. In the most basic form, action is a token type (like Name.Builtin). That means: When regex matches, emit a token with the match text and type tokentype and push new_state on the state -stack. If the new state is '#pop', the topmost state is popped from the -stack instead. (To pop more than one state, use '#pop:2' and so on.) -'#push' is a synonym for pushing the current state on the +stack. If the new state is '#pop', the topmost state is popped from the +stack instead. (To pop more than one state, use '#pop:2' and so on.) +'#push' is a synonym for pushing the current state on the stack.

    The following example shows the DiffLexer from the builtin lexers. Note that it contains some additional attributes name, aliases and filenames which @@ -303,7 +303,7 @@ so on.

    The lexer first looks for whitespace, comments and section names. And later it -looks for a line that looks like a key, value pair, seperated by an '=' +looks for a line that looks like a key, value pair, seperated by an '=' sign, and optional whitespace.

    The bygroups helper makes sure that each group is yielded with a different token type. First the Name.Attribute token, then a Text token for the @@ -375,24 +375,24 @@ pattern it's impossible to lex just using regular expressions.

    ] } -

    This lexer starts lexing in the 'root' state. It tries to match as much as -possible until it finds a slash ('/'). If the next character after the slash -is a star ('*') the RegexLexer sends those two characters to the output +

    This lexer starts lexing in the 'root' state. It tries to match as much as +possible until it finds a slash ('/'). If the next character after the slash +is a star ('*') the RegexLexer sends those two characters to the output stream marked as Comment.Multiline and continues parsing with the rules -defined in the 'comment' state.

    +defined in the 'comment' state.

    If there wasn't a star after the slash, the RegexLexer 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).

    -

    Inside the 'comment' state, we do the same thing again. Scan until the lexer +

    Inside the 'comment' 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 -'comment' state on the stack and continue scanning, again in the -'comment' state. Else, check if it's the end of the multiline comment. If +'comment' state on the stack and continue scanning, again in the +'comment' state. Else, check if it's the end of the multiline comment. If yes, pop one state from the stack.

    Note: If you pop from an empty stack you'll get an IndexError. (There is an -easy way to prevent this from happening: don't '#pop' in the root state).

    +easy way to prevent this from happening: don't '#pop' in the root state).

    If the RegexLexer encounters a newline that is flagged as an error token, the -stack is emptied and the lexer continues scanning in the 'root' state. This +stack is emptied and the lexer continues scanning in the 'root' state. This helps producing error-tolerant highlighting for erroneous input, e.g. when a single-line string is not closed.

    @@ -423,13 +423,13 @@ match a comment containing a directive, something like:

    ] } -

    When this encounters the above sample, first 'comment' and 'directive' +

    When this encounters the above sample, first 'comment' and 'directive' are pushed onto the stack, then the lexer continues in the directive state -until it finds the closing >, then it continues in the comment state until -the closing */. Then, both states are popped from the stack again and +until it finds the closing >, then it continues in the comment state until +the closing */. Then, both states are popped from the stack again and lexing continues in the root state.

    -

    New in Pygments 0.9: The tuple can contain the special '#push' and -'#pop' (but not '#pop:n') directives.

    +

    New in Pygments 0.9: The tuple can contain the special '#push' and +'#pop' (but not '#pop:n') directives.

  • You can include the rules of a state in the definition of another. This is done by using include from pygments.lexer:

    @@ -460,12 +460,12 @@ done by using include from pygments.lexer:

    comments. Because comments can occur at toplevel and in functions, we need rules for comments in both states. As you can see, the include helper saves repeating rules that occur more than once (in this example, the state -'comment' will never be entered by the lexer, as it's only there to be -included in 'root' and 'function').

    +'comment' will never be entered by the lexer, as it's only there to be +included in 'root' and 'function').

  • Sometimes, you may want to "combine" a state from existing ones. This is possible with the combine helper from pygments.lexer.

    -

    If you, instead of a new state, write combined('state1', 'state2') as the +

    If you, instead of a new state, write combined('state1', 'state2') 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.

    This is not used very often, but can be helpful in some cases, such as the @@ -486,9 +486,9 @@ the stack by overloading the get_tokens_unprocessed() method:

    Some lexers like the PhpLexer use this to make the leading <?php 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 'root' from the stack can result in strange errors!

    +removing 'root' from the stack can result in strange errors!

  • -
  • An empty regex at the end of a state list, combined with '#pop', can +

  • An empty regex at the end of a state list, combined with '#pop', can act as a return point from a state that doesn't have a clear end marker.

  • @@ -525,22 +525,22 @@ lexed with that lexer, and the resulting tokens will be yielded.

    ] } -

    Here the content of a <script> tag is passed to a newly created instance of +

    Here the content of a <script> tag is passed to a newly created instance of a JavascriptLexer and not processed by the HtmlLexer. This is done using the using helper that takes the other lexer class as its parameter.

    Note the combination of bygroups and using. This makes sure that the content -up to the </script> end tag is processed by the JavascriptLexer, while the +up to the </script> end tag is processed by the JavascriptLexer, while the end tag is yielded as a normal token with the Name.Tag type.

    As an additional goodie, if the lexer class is replaced by this (imported from pygments.lexer), the "other" lexer will be the current one (because you cannot refer to the current class within the code that runs at class definition time).

    -

    Also note the (r'<\s*script\s*', Name.Tag, ('script-content', 'tag')) rule. +

    Also note the (r'<\s*script\s*', Name.Tag, ('script-content', 'tag')) rule. Here, two states are pushed onto the state stack, 'script-content' and -'tag'. That means that first 'tag' is processed, which will parse -attributes and the closing >, then the 'tag' state is popped and the +'tag'. That means that first 'tag' is processed, which will parse +attributes and the closing >, then the 'tag' state is popped and the next state on top of the stack will be 'script-content'.

    The using() helper has a special keyword argument, state, which works as -follows: if given, the lexer to use initially is not in the "root" state, +follows: if given, the lexer to use initially is not in the "root" state, but in the state given by this argument. This only works with a RegexLexer.

    Any other keywords arguments passed to using() are added to the keyword arguments used to create the lexer.

    @@ -551,7 +551,7 @@ arguments used to create the lexer.

    example used for the template engine lexers. It takes two lexers as arguments on initialisation: a root_lexer and a language_lexer.

    The input is processed as follows: First, the whole text is lexed with the -language_lexer. All tokens yielded with a type of Other are then +language_lexer. All tokens yielded with a type of Other are then concatenated and given to the root_lexer. The language tokens of the language_lexer are then inserted into the root_lexer's token stream at the appropriate positions.

    @@ -564,7 +564,7 @@ at the appropriate positions.

    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.

    -

    If you want to change the needle token Other to something else, you can +

    If you want to change the needle token Other to something else, you can give the lexer another token type as the third parameter:

    DelegatingLexer.__init__(MyLexer, OtherLexer, Text, **options)
     
    @@ -580,11 +580,11 @@ callbacks). The callback must be a function taking two arguments:

  • the lexer itself
  • the match object for the last matched rule
  • -

    The callback must then return an iterable of (or simply yield) (index, -tokentype, value) tuples, which are then just passed through by -get_tokens_unprocessed(). The index here is the position of the token in -the input string, tokentype is the normal token type (like Name.Builtin), -and value the associated part of the input string.

    +

    The callback must then return an iterable of (or simply yield) (index, +tokentype, value) tuples, which are then just passed through by +get_tokens_unprocessed(). The index here is the position of the token in +the input string, tokentype is the normal token type (like Name.Builtin), +and value the associated part of the input string.

    You can see an example here:

    from pygments.lexer import RegexLexer
     from pygments.token import Generic
    @@ -665,7 +665,7 @@ 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.

    But because only Name tokens can be function names it's solvable by overriding -the get_tokens_unprocessed() method. The following lexer subclasses the +the get_tokens_unprocessed() method. The following lexer subclasses the PythonLexer so that it highlights some additional names as pseudo keywords:

    from pygments.lexers.agile import PythonLexer
     from pygments.token import Name, Keyword
    @@ -686,6 +686,6 @@ the get_tokens_unprocessed()
     
    -
     
    \ No newline at end of file
    diff --git a/docs/build/lexers.html b/docs/build/lexers.html
    index 893cfac..1ffb4ec 100644
    --- a/docs/build/lexers.html
    +++ b/docs/build/lexers.html
    @@ -247,19 +247,19 @@ div.toc h2 {
     

    Currently, all lexers support these options:

    stripnl
    -
    Strip leading and trailing newlines from the input (default: True)
    +
    Strip leading and trailing newlines from the input (default: True)
    stripall
    Strip all leading and trailing whitespace from the input (default: -False).
    +False).
    tabsize
    -
    If given and greater than 0, expand tabs in the input (default: 0).
    +
    If given and greater than 0, expand tabs in the input (default: 0).
    encoding

    New in Pygments 0.6.

    If given, must be an encoding name (such as "utf-8"). This encoding will be used to convert the input string to Unicode (if it is not already -a Unicode string). The default is "latin1".

    -

    If this option is set to "guess", a simple UTF-8 vs. Latin-1 -detection is used, if it is set to "chardet", the +a Unicode string). The default is "latin1".

    +

    If this option is set to "guess", a simple UTF-8 vs. Latin-1 +detection is used, if it is set to "chardet", the chardet library is used to guess the encoding of the input.

    @@ -310,8 +310,8 @@ programming language) source.

    Additional options accepted:

    func_name_highlighting
    -
    If given and True, highlight builtin function names -(default: True).
    +
    If given and True, highlight builtin function names +(default: True).
    disabled_modules

    If given, must be a list of module names whose function names should not be highlighted. By default all modules are highlighted.

    @@ -417,7 +417,7 @@ language) source.

    Additional options:

    python3
    -
    Use Python 3 lexer for code. Default is False. +
    Use Python 3 lexer for code. Default is False. New in Pygments 1.0.
    @@ -691,6 +691,7 @@ language) source.

    DLexer

    For D source.

    +

    New in Pygments 1.2.

    @@ -711,14 +712,14 @@ Turbo Pascal and Free Pascal source code.

    Additional options accepted:

    turbopascal
    -
    Highlight Turbo Pascal specific keywords (default: True).
    +
    Highlight Turbo Pascal specific keywords (default: True).
    delphi
    -
    Highlight Borland Delphi specific keywords (default: True).
    +
    Highlight Borland Delphi specific keywords (default: True).
    freepascal
    -
    Highlight Free Pascal specific keywords (default: True).
    +
    Highlight Free Pascal specific keywords (default: True).
    units
    A list of units that should be considered builtin, supported are -System, SysUtils, Classes and Math. +System, SysUtils, Classes and Math. Default is to consider all of them builtin.
    @@ -785,6 +786,22 @@ Default is to consider all of them builtin.
    +

    GoLexer

    +
    +

    For Go source.

    + +++ + + + + + + + +
    Short names:go
    Filename patterns:*.go
    Mimetypes:text/x-gosrc
    +

    JavaLexer

    For Java source code.

    @@ -817,6 +834,23 @@ Default is to consider all of them builtin.
    +

    OocLexer

    +
    +

    For Ooc source code

    +

    New in Pygments 1.2.

    + +++ + + + + + + + +
    Short names:ooc
    Filename patterns:*.ooc
    Mimetypes:text/x-ooc
    +

    PrologLexer

    Lexer for Prolog files.

    @@ -911,15 +945,15 @@ source code.

    Determines which Unicode characters this lexer allows for identifiers. The possible values are:

      -
    • none -- only the ASCII letters and numbers are allowed. This +
    • none -- only the ASCII letters and numbers are allowed. This is the fastest selection.
    • -
    • basic -- all Unicode characters from the specification except -category Lo are allowed.
    • -
    • full -- all Unicode characters as specified in the C# specs +
    • basic -- all Unicode characters from the specification except +category Lo are allowed.
    • +
    • full -- all Unicode characters as specified in the C# specs are allowed. Note that this means a considerable slowdown since the -Lo category has more than 40,000 characters in it!
    • +Lo category has more than 40,000 characters in it!
    -

    The default value is basic.

    +

    The default value is basic.

    New in Pygments 0.8.

    @@ -1048,7 +1082,7 @@ source code.

    Additional options accepted:

    litstyle
    -
    If given, must be "bird" or "latex". If not given, the style +
    If given, must be "bird" or "latex". If not given, the style is autodetected: if the first non-whitespace character in the source is a backslash or percent character, LaTeX is assumed, else Bird.
    @@ -1235,6 +1269,23 @@ Contributed by Andreas Amann <Asymptote source code.

    +

    New in Pygments 1.2.

    + +++ + + + + + + + +
    Short names:asy
    Filename patterns:*.asy
    Mimetypes:text/x-asymptote
    +

    BashLexer

    Lexer for (ba)sh shell scripts.

    @@ -1321,6 +1372,23 @@ language.

    +

    GherkinLexer

    +
    +

    For Gherkin <http://cukes.info/> syntax.

    +

    New in Pygments 1.2.

    + +++ + + + + + + + +
    Short names:Cucumber, cucumber, Gherkin, gherkin
    Filename patterns:*.feature
    Mimetypes:text/x-gherkin
    +

    GnuplotLexer

    For Gnuplot plotting scripts.

    @@ -1792,7 +1860,7 @@ highlighting then call the language-specific Ragel lexer.

    RagelLexer

    A pure Ragel lexer. Use this for -fragments of Ragel. For .rl files, use RagelEmbeddedLexer instead +fragments of Ragel. For .rl files, use RagelEmbeddedLexer instead (or one of the language-specific subclasses).

    New in Pygments 1.1.

    @@ -1853,8 +1921,8 @@ file is malformed.

    Additional options accepted:

    compress
    -
    If set to "gz" or "bz2", decompress the token stream with -the given compression algorithm before lexing (default: "").
    +
    If set to "gz" or "bz2", decompress the token stream with +the given compression algorithm before lexing (default: "").
    @@ -2674,11 +2742,28 @@ format.

    +

    CMakeLexer

    +
    +

    Lexer for CMake files.

    +

    New in Pygments 1.2.

    + +++ + + + + + + + +
    Short names:cmake
    Filename patterns:*.cmake
    Mimetypes:text/x-cmake
    +

    DarcsPatchLexer

    DarcsPatchLexer is a lexer for the various versions of the darcs patch format. Examples of this format are derived by commands such as -darcs annotate --patch and darcs send.

    +darcs annotate --patch and darcs send.

    New in Pygments 0.10.

    @@ -2695,7 +2780,7 @@ format. Examples of this format are derived by commands such as

    DebianControlLexer

    -

    Lexer for Debian control files and apt-cache show <pkg> outputs.

    +

    Lexer for Debian control files and apt-cache show <pkg> outputs.

    New in Pygments 0.9.

    @@ -2869,9 +2954,9 @@ the same file even).

    Additional options accepted:

    handlecodeblocks
    -
    Highlight the contents of .. sourcecode:: langauge and -.. code:: language directives with a lexer for the given -language (default: True). New in Pygments 0.8.
    +
    Highlight the contents of .. sourcecode:: langauge and +.. code:: language directives with a lexer for the given +language (default: True). New in Pygments 0.8.
    @@ -3081,16 +3166,16 @@ For PHP embedded in HTML, use the HtmlPhpLexer.

    Additional options accepted:

    startinline
    -
    If given and True the lexer starts highlighting with +
    If given and True the lexer starts highlighting with php code (i.e.: no starting <?php required). The default -is False.
    +is False.
    funcnamehighlighting
    -
    If given and True, highlight builtin function names -(default: True).
    +
    If given and True, highlight builtin function names +(default: True).
    disabledmodules

    If given, must be a list of module names whose function names should not be highlighted. By default all modules are highlighted -except the special 'unknown' module that includes functions +except the special 'unknown' module that includes functions that are known to php but are undocumented.

    To get a list of allowed modules have a look into the _phpbuiltins module:

    @@ -3165,11 +3250,11 @@ module:

    ('XML+Ruby', ('xml+erb', 'xml+ruby'), (), ())

    As you can see, the return value is an iterator which yields tuples -in the form (name, aliases, filetypes, mimetypes).

    +in the form (name, aliases, filetypes, mimetypes).

    - \ No newline at end of file diff --git a/docs/build/moinmoin.html b/docs/build/moinmoin.html index 5d4aa9b..cd89701 100644 --- a/docs/build/moinmoin.html +++ b/docs/build/moinmoin.html @@ -214,9 +214,9 @@ div.toc h2 { can be used to get Pygments highlighting in Moin wiki pages.

    To use it, copy the file external/moin-parser.py from the Pygments distribution to the data/plugin/parser subdirectory of your Moin instance. -Edit the options at the top of the file (currently ATTACHMENTS and -INLINESTYLES) and rename the file to the name that the parser directive -should have. For example, if you name the file code.py, you can get a +Edit the options at the top of the file (currently ATTACHMENTS and +INLINESTYLES) and rename the file to the name that the parser directive +should have. For example, if you name the file code.py, you can get a highlighted Python code sample with this Wiki markup:

     {{{
    @@ -224,8 +224,8 @@ highlighted Python code sample with this Wiki markup:

    [...] }}}
    -

    where python is the Pygments name of the lexer to use.

    -

    Additionally, if you set the ATTACHMENTS option to True, Pygments will also +

    where python is the Pygments name of the lexer to use.

    +

    Additionally, if you set the ATTACHMENTS option to True, Pygments will also be called for all attachments for whose filenames there is no other parser registered.

    You are responsible for including CSS rules that will map the Pygments CSS @@ -236,10 +236,10 @@ into the htdocs directory of your Moin instance and then include it stylesheets = [('screen', '/htdocs/pygments.css')]

    If you do not want to do that and are willing to accept larger HTML output, you -can set the INLINESTYLES option to True.

    +can set the INLINESTYLES option to True.

    - \ No newline at end of file diff --git a/docs/build/plugins.html b/docs/build/plugins.html index 6ebf441..dfe8804 100644 --- a/docs/build/plugins.html +++ b/docs/build/plugins.html @@ -239,7 +239,7 @@ required metadata from the class definition:

    [pygments.lexers]
     yourlexer = yourmodule:YourLexer
     
    -

    Note that you have to define name, aliases and filename +

    Note that you have to define name, aliases and filename attributes so that you can use the highlighter from the command line:

    class YourLexer(...):
         name = 'Name Of Your Lexer'
    @@ -289,6 +289,6 @@ distribution.

    - \ No newline at end of file diff --git a/docs/build/quickstart.html b/docs/build/quickstart.html index c7c018d..14368a3 100644 --- a/docs/build/quickstart.html +++ b/docs/build/quickstart.html @@ -293,8 +293,8 @@ arguments either to the class or to the lookup method:

    This makes the lexer strip all leading and trailing whitespace from the input (stripall option), lets the formatter output line numbers (linenos option), -and sets the wrapping <div>'s class to source (instead of -highlight).

    +and sets the wrapping <div>'s class to source (instead of +highlight).

    Important options include:

    encoding : for lexers and formatters
    @@ -332,7 +332,7 @@ for this purpose.

    Guessing lexers

    If you don't know the content of the file, or you want to highlight a file -whose extension is ambiguous, such as .html (which could contain plain HTML +whose extension is ambiguous, such as .html (which could contain plain HTML or some template tags), use these functions:

    >>> from pygments.lexers import guess_lexer, guess_lexer_for_filename
     
    @@ -379,12 +379,12 @@ it can be created with:

     $ pygmentize -S default -f html > style.css
     
    -

    where default is the style name.

    +

    where default is the style name.

    More options and tricks and be found in the command line reference.

    - \ No newline at end of file diff --git a/docs/build/rstdirective.html b/docs/build/rstdirective.html index 5468512..feaef62 100644 --- a/docs/build/rstdirective.html +++ b/docs/build/rstdirective.html @@ -224,6 +224,6 @@ if the `handlecodeblocks` option is true. --> - \ No newline at end of file diff --git a/docs/build/styles.html b/docs/build/styles.html index 913c33b..27d2114 100644 --- a/docs/build/styles.html +++ b/docs/build/styles.html @@ -265,7 +265,7 @@ define some styles:

    That's it. There are just a few rules. When you define a style for Name the style automatically also affects Name.Function and so on. If you -defined 'bold' and you don't want boldface for a subtoken use 'nobold'.

    +defined 'bold' and you don't want boldface for a subtoken use 'nobold'.

    (Philosophy: the styles aren't written in CSS syntax since this way they can be used for a variety of formatters.)

    default_style is the style inherited by all token types.

    @@ -275,8 +275,8 @@ they can be used for a variety of formatters.)

  • or drop it into the styles subpackage of your Pygments distribution one style class per style, where the file name is the style name and the class name is StylenameClass. For example, if your style should be called -"mondrian", name the class MondrianStyle, put it into the file -mondrian.py and this file into the pygments.styles subpackage +"mondrian", name the class MondrianStyle, put it into the file +mondrian.py and this file into the pygments.styles subpackage directory.
  • @@ -284,32 +284,32 @@ directory.

    Style Rules

    Here a small overview of all allowed styles:

    -
    bold
    +
    bold
    render text as bold
    -
    nobold
    +
    nobold
    don't render text as bold (to prevent subtokens behing highlighted bold)
    -
    italic
    +
    italic
    render text italic
    -
    noitalic
    +
    noitalic
    don't render text as italic
    -
    underline
    +
    underline
    render text underlined
    -
    nounderline
    +
    nounderline
    don't render text underlined
    -
    bg:
    +
    bg:
    transparent background
    bg:#000000
    background color (black)
    -
    border:
    +
    border:
    no border
    border:#ffffff
    border color (white)
    -
    #ff0000
    +
    #ff0000
    text color (red)
    -
    noinherit
    +
    noinherit
    don't inherit styles from supertoken
    -

    Note that there may not be a space between bg: and the color value +

    Note that there may not be a space between bg: 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.

    @@ -336,6 +336,6 @@ a way to iterate over all styles:

    - \ No newline at end of file diff --git a/docs/build/tokens.html b/docs/build/tokens.html index b80aa1b..68247a2 100644 --- a/docs/build/tokens.html +++ b/docs/build/tokens.html @@ -240,9 +240,9 @@ that is used to create token types.

    >>> Token.String is Token.String True -

    Note that tokens are singletons so you can use the is operator for comparing +

    Note that tokens are singletons so you can use the is operator for comparing token types.

    -

    As of Pygments 0.7 you can also use the in operator to perform set tests:

    +

    As of Pygments 0.7 you can also use the in operator to perform set tests:

    >>> from pygments.token import Comment
     >>> Comment.Single in Comment
     True
    @@ -314,11 +314,11 @@ markup in PHP code)
     
     
    - + - + @@ -338,7 +338,7 @@ of those token aliases, a number of subtypes exists (excluding the special token Token.Text, Token.Error and Token.Other)

    The is_token_subtype() function in the pygments.token module can be used to test if a token type is a subtype of another (such as Name.Tag and Name). -(This is the same as Name.Tag in Name. The overloaded in operator was newly +(This is the same as Name.Tag in Name. The overloaded in operator was newly introduced in Pygments 0.7, the function still exists for backwards compatiblity.)

    With Pygments 0.7, it's also possible to convert strings to token types (for example @@ -358,21 +358,21 @@ if you want to supply a token from the command line):

    For any kind of keyword (especially if it doesn't match any of the subtypes of course).
    Keyword.Constant
    -
    For keywords that are constants (e.g. None in future Python versions).
    +
    For keywords that are constants (e.g. None in future Python versions).
    Keyword.Declaration
    -
    For keywords used for variable declaration (e.g. var in some programming +
    For keywords used for variable declaration (e.g. var in some programming languages like JavaScript).
    Keyword.Namespace
    -
    For keywords used for namespace declarations (e.g. import in Python and -Java and package in Java).
    +
    For keywords used for namespace declarations (e.g. import in Python and +Java and package in Java).
    Keyword.Pseudo
    -
    For keywords that aren't really keywords (e.g. None in old Python +
    For keywords that aren't really keywords (e.g. None in old Python versions).
    Keyword.Reserved
    For reserved keywords.
    Keyword.Type
    -
    For builtin types that can't be used as identifiers (e.g. int, -char etc. in C).
    +
    For builtin types that can't be used as identifiers (e.g. int, +char etc. in C).
    @@ -385,30 +385,30 @@ versions).
    Name.Builtin
    Builtin names; names that are available in the global namespace.
    Name.Builtin.Pseudo
    -
    Builtin names that are implicit (e.g. self in Ruby, this in Java).
    +
    Builtin names that are implicit (e.g. self in Ruby, this in Java).
    Name.Class
    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.
    Name.Constant
    Token type for constants. In some languages you can recognise a token by the -way it's defined (the value after a const keyword for example). In +way it's defined (the value after a const keyword for example). In other languages constants are uppercase by definition (Ruby).
    Name.Decorator
    Token type for decorators. Decorators are synatic elements in the Python language. Similar syntax elements exist in C# and Java.
    Name.Entity
    -
    Token type for special entities. (e.g. &nbsp; in HTML).
    +
    Token type for special entities. (e.g. &nbsp; in HTML).
    Name.Exception
    -
    Token type for exception names (e.g. RuntimeError in Python). Some languages +
    Token type for exception names (e.g. RuntimeError in Python). Some languages define exceptions in the function signature (Java). You can highlight the name of that exception using this token then.
    Name.Function
    Token type for function names.
    Name.Label
    -
    Token type for label names (e.g. in languages that support goto).
    +
    Token type for label names (e.g. in languages that support goto).
    Name.Namespace
    Token type for namespaces. (e.g. import paths in Java/Python), names following -the module/namespace keyword in other languages.
    +the module/namespace keyword in other languages.
    Name.Other
    Other names. Normally unused.
    Name.Tag
    @@ -431,7 +431,7 @@ example).
    Literal
    For any literal (if not further defined).
    Literal.Date
    -
    for date literals (e.g. 42d in Boo).
    +
    for date literals (e.g. 42d in Boo).
    String
    For any string literal.
    String.Backtick
    @@ -447,26 +447,26 @@ example).
    String.Heredoc
    Token type for "heredoc" strings (e.g. in Ruby or Perl).
    String.Interpol
    -
    Token type for interpolated parts in strings (e.g. #{foo} in Ruby).
    +
    Token type for interpolated parts in strings (e.g. #{foo} in Ruby).
    String.Other
    -
    Token type for any other strings (for example %q{foo} string constructs +
    Token type for any other strings (for example %q{foo} string constructs in Ruby).
    String.Regex
    -
    Token type for regular expression literals (e.g. /foo/ in JavaScript).
    +
    Token type for regular expression literals (e.g. /foo/ in JavaScript).
    String.Single
    Token type for single quoted strings.
    String.Symbol
    -
    Token type for symbols (e.g. :foo in LISP or Ruby).
    +
    Token type for symbols (e.g. :foo in LISP or Ruby).
    Number
    Token type for any number literal.
    Number.Float
    -
    Token type for float literals (e.g. 42.0).
    +
    Token type for float literals (e.g. 42.0).
    Number.Hex
    -
    Token type for hexadecimal number literals (e.g. 0xdeadbeef).
    +
    Token type for hexadecimal number literals (e.g. 0xdeadbeef).
    Number.Integer
    -
    Token type for integer literals (e.g. 42).
    +
    Token type for integer literals (e.g. 42).
    Number.Integer.Long
    -
    Token type for long integer literals (e.g. 42L in Python).
    +
    Token type for long integer literals (e.g. 42L in Python).
    Number.Oct
    Token type for octal literals.
    @@ -475,9 +475,9 @@ in Ruby).

    Operators

    Operator
    -
    For any punctuation operator (e.g. +, -).
    +
    For any punctuation operator (e.g. +, -).
    Operator.Word
    -
    For any operator that is a word (e.g. not).
    +
    For any operator that is a word (e.g. not).
    @@ -485,7 +485,7 @@ in Ruby).

    New in Pygments 0.7.

    Punctuation
    -
    For any punctuation which is not an operator (e.g. [, (...)
    +
    For any punctuation which is not an operator (e.g. [, (...)
    @@ -496,9 +496,9 @@ in Ruby).
    Comment.Multiline
    Token type for multiline comments.
    Comment.Preproc
    -
    Token type for preprocessor comments (also <?php/<% constructs).
    +
    Token type for preprocessor comments (also <?php/<% constructs).
    Comment.Single
    -
    Token type for comments that end at the end of a line (e.g. # foo).
    +
    Token type for comments that end at the end of a line (e.g. # foo).
    Comment.Special
    Special data in comments. For example code tags, author and license informations etc.
    @@ -536,6 +536,6 @@ highlight a programming language but a patch file.

    - \ No newline at end of file diff --git a/docs/build/unicode.html b/docs/build/unicode.html index 768495e..d6851ca 100644 --- a/docs/build/unicode.html +++ b/docs/build/unicode.html @@ -216,7 +216,7 @@ wrong encoding.

    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 encoding lexer option. If you have the -chardet library installed and set the encoding to chardet if will ananlyse +chardet library installed and set the encoding to chardet if will ananlyse the text and use the encoding it thinks is the right one automatically:

    from pygments.lexers import PythonLexer
     lexer = PythonLexer(encoding='chardet')
    @@ -244,6 +244,6 @@ input and output encodings.

    - \ No newline at end of file diff --git a/docs/generate.py b/docs/generate.py index 436b79e..e5e7eaa 100644 --- a/docs/generate.py +++ b/docs/generate.py @@ -6,7 +6,7 @@ Generates a bunch of html files containing the documentation. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -119,7 +119,7 @@ def generate_authors(): fn = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'AUTHORS')) f = file(fn) - r = f.read().rstrip() + r = f.read().rstrip().decode('utf-8') f.close() return r diff --git a/docs/src/cmdline.txt b/docs/src/cmdline.txt index ce14a3f..a48a5c2 100644 --- a/docs/src/cmdline.txt +++ b/docs/src/cmdline.txt @@ -34,6 +34,11 @@ The above command could therefore also be given as:: $ pygmentize -o test.html test.py +To create a full HTML document, including line numbers and stylesheet (using the +"emacs" style), highlighting the Python file ``test.py`` to ``test.html``:: + + $ pygmentize -O full,style=emacs -o test.html test.py + Options and filters ------------------- @@ -117,15 +122,6 @@ will print the help for the HTML formatter, while :: will print the help for the Python lexer, etc. -Examples --------- - -Create a full HTML document, including line numbers and stylesheet (using the -"emacs" style), highlighting the Python file ``setup.py`` to ``setup.html``:: - - $ pygmentize -O full,style=emacs -o setup.html setup.py - - A note on encodings ------------------- diff --git a/docs/src/installation.txt b/docs/src/installation.txt index c611fc5..2253916 100644 --- a/docs/src/installation.txt +++ b/docs/src/installation.txt @@ -4,8 +4,8 @@ Installation ============ -Pygments requires at least Python 2.3 to work correctly. Just to clarify: -there *won't* ever be support for Python versions below 2.3. However, there +Pygments requires at least Python 2.4 to work correctly. Just to clarify: +there *won't* ever be support for Python versions below 2.4. However, there are no other dependencies. diff --git a/external/markdown-processor.py b/external/markdown-processor.py index 9351ce8..0371af2 100644 --- a/external/markdown-processor.py +++ b/external/markdown-processor.py @@ -27,7 +27,7 @@ .. _Markdown: http://www.freewisdom.org/projects/python-markdown/ - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/external/moin-parser.py b/external/moin-parser.py index 3117723..6d55004 100644 --- a/external/moin-parser.py +++ b/external/moin-parser.py @@ -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-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/external/rst-directive-old.py b/external/rst-directive-old.py index 4cd0d50..b7877ae 100644 --- a/external/rst-directive-old.py +++ b/external/rst-directive-old.py @@ -31,7 +31,7 @@ .. _directive documentation: http://docutils.sourceforge.net/docs/howto/rst-directives.html - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/external/rst-directive.py b/external/rst-directive.py index 998e8d6..934adb5 100644 --- a/external/rst-directive.py +++ b/external/rst-directive.py @@ -31,7 +31,7 @@ .. _directive documentation: http://docutils.sourceforge.net/docs/howto/rst-directives.html - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/__init__.py b/pygments/__init__.py index e97dd6b..9a0a273 100644 --- a/pygments/__init__.py +++ b/pygments/__init__.py @@ -21,11 +21,11 @@ .. _Pygments tip: http://dev.pocoo.org/hg/pygments-main/archive/tip.tar.gz#egg=Pygments-dev - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ -__version__ = '1.1.1' +__version__ = '1.2' __docformat__ = 'restructuredtext' __all__ = ['lex', 'format', 'highlight'] diff --git a/pygments/cmdline.py b/pygments/cmdline.py index c9a945d..cfce216 100644 --- a/pygments/cmdline.py +++ b/pygments/cmdline.py @@ -5,7 +5,7 @@ Command line interface. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import sys diff --git a/pygments/console.py b/pygments/console.py index 41284e5..92a8c6d 100644 --- a/pygments/console.py +++ b/pygments/console.py @@ -5,7 +5,7 @@ Format colored console output. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/filter.py b/pygments/filter.py index b7312e9..acb0d0a 100644 --- a/pygments/filter.py +++ b/pygments/filter.py @@ -5,7 +5,7 @@ Module that implements the default filter. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/filters/__init__.py b/pygments/filters/__init__.py index 08c2f3a..382933b 100644 --- a/pygments/filters/__init__.py +++ b/pygments/filters/__init__.py @@ -6,7 +6,7 @@ Module containing filter lookup functions and default filters. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ try: @@ -283,10 +283,78 @@ class VisibleWhitespaceFilter(Filter): yield ttype, value +class GobbleFilter(Filter): + """ + Gobbles source code lines (eats initial characters). + + This filter drops the first ``n`` 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. + + Options accepted: + + `n` : int + The number of characters to gobble. + + *New in Pygments 1.2.* + """ + def __init__(self, **options): + Filter.__init__(self, **options) + self.n = get_int_opt(options, 'n', 0) + + def gobble(self, value, left): + if left < len(value): + return value[left:], 0 + else: + return '', left - len(value) + + def filter(self, lexer, stream): + n = self.n + left = n # How many characters left to gobble. + for ttype, value in stream: + # Remove ``left`` tokens from first line, ``n`` from all others. + parts = value.split('\n') + (parts[0], left) = self.gobble(parts[0], left) + for i in range(1, len(parts)): + (parts[i], left) = self.gobble(parts[i], n) + value = '\n'.join(parts) + + if value != '': + yield ttype, value + + +class TokenMergeFilter(Filter): + """ + Merges consecutive tokens with the same token type in the output stream of a + lexer. + + *New in Pygments 1.2.* + """ + def __init__(self, **options): + Filter.__init__(self, **options) + + def filter(self, lexer, stream): + output = [] + current_type = None + current_value = None + for ttype, value in stream: + if ttype is current_type: + current_value += value + else: + if current_type is not None: + yield current_type, current_value + current_type = ttype + current_value = value + if current_type is not None: + yield current_type, current_value + + FILTERS = { 'codetagify': CodeTagFilter, 'keywordcase': KeywordCaseFilter, 'highlight': NameHighlightFilter, 'raiseonerror': RaiseOnErrorTokenFilter, 'whitespace': VisibleWhitespaceFilter, + 'gobble': GobbleFilter, + 'tokenmerge': TokenMergeFilter, } diff --git a/pygments/formatter.py b/pygments/formatter.py index d6c75a0..6eea3d7 100644 --- a/pygments/formatter.py +++ b/pygments/formatter.py @@ -5,7 +5,7 @@ Base formatter class. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/formatters/__init__.py b/pygments/formatters/__init__.py index 0dc3592..e5802b9 100644 --- a/pygments/formatters/__init__.py +++ b/pygments/formatters/__init__.py @@ -5,7 +5,7 @@ Pygments formatters. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os.path diff --git a/pygments/formatters/_mapping.py b/pygments/formatters/_mapping.py index 8155627..0c344a7 100755 --- a/pygments/formatters/_mapping.py +++ b/pygments/formatters/_mapping.py @@ -9,7 +9,7 @@ Do not alter the FORMATTERS dictionary by hand. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/formatters/bbcode.py b/pygments/formatters/bbcode.py index 0bdae2d..03852b3 100644 --- a/pygments/formatters/bbcode.py +++ b/pygments/formatters/bbcode.py @@ -5,7 +5,7 @@ BBcode formatter. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py index 674856f..96cde3f 100644 --- a/pygments/formatters/html.py +++ b/pygments/formatters/html.py @@ -5,7 +5,7 @@ Formatter for HTML output. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import sys, os @@ -582,15 +582,29 @@ class HtmlFormatter(Formatter): yield 0, line def _wrap_div(self, inner): + style = [] + if (self.noclasses and not self.nobackground and + self.style.background_color is not None): + style.append('background: %s' % (self.style.background_color,)) + if self.cssstyles: + style.append(self.cssstyles) + style = '; '.join(style) + yield 0, ('') + + (style and (' style="%s"' % style)) + '>') for tup in inner: yield tup yield 0, '\n' def _wrap_pre(self, inner): - yield 0, ('') + style = [] + if self.prestyles: + style.append(self.prestyles) + if self.noclasses: + style.append('line-height: 125%') + style = '; '.join(style) + + yield 0, ('') for tup in inner: yield tup yield 0, '' @@ -661,7 +675,14 @@ class HtmlFormatter(Formatter): if t != 1: yield t, value if i + 1 in hls: # i + 1 because Python indexes start at 0 - yield 1, '%s' % value + if self.noclasses: + style = '' + if self.style.highlight_color is not None: + style = (' style="background-color: %s"' % + (self.style.highlight_color,)) + yield 1, '%s' % (style, value) + else: + yield 1, '%s' % value else: yield 1, value diff --git a/pygments/formatters/img.py b/pygments/formatters/img.py index 91bf517..69ac484 100644 --- a/pygments/formatters/img.py +++ b/pygments/formatters/img.py @@ -5,7 +5,7 @@ Formatter for Pixmap output. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -13,7 +13,8 @@ import sys from commands import getstatusoutput from pygments.formatter import Formatter -from pygments.util import get_bool_opt, get_int_opt, get_choice_opt +from pygments.util import get_bool_opt, get_int_opt, \ + get_list_opt, get_choice_opt # Import this carefully try: @@ -207,6 +208,11 @@ class ImageFormatter(Formatter): Default: True + `line_number_start` + The line number of the first line. + + Default: 1 + `line_number_step` The step used when printing line numbers. @@ -250,6 +256,16 @@ class ImageFormatter(Formatter): the source code area. Default: 6 + + `hl_lines` + Specify a list of lines to be highlighted. *New in Pygments 1.2.* + + Default: empty list + + `hl_color` + Specify the color for highlighting lines. *New in Pygments 1.2.* + + Default: highlight color of the selected style """ # Required by the pygments mapper @@ -299,11 +315,21 @@ class ImageFormatter(Formatter): self.line_number_separator = get_bool_opt(options, 'line_number_separator', True) self.line_number_step = get_int_opt(options, 'line_number_step', 1) + self.line_number_start = get_int_opt(options, 'line_number_start', 1) if self.line_numbers: self.line_number_width = (self.fontw * self.line_number_chars + self.line_number_pad * 2) else: self.line_number_width = 0 + self.hl_lines = [] + hl_lines_str = get_list_opt(options, 'hl_lines', []) + for line in hl_lines_str: + try: + self.hl_lines.append(int(line)) + except ValueError: + pass + self.hl_color = options.get('hl_color', + self.style.highlight_color) or '#f90' self.drawables = [] def get_style_defs(self, arg=''): @@ -369,13 +395,13 @@ class ImageFormatter(Formatter): return (self._get_char_x(maxcharno) + self.image_pad, self._get_line_y(maxlineno + 0) + self.image_pad) - def _draw_linenumber(self, lineno): + def _draw_linenumber(self, posno, lineno): """ Remember a line number drawable to paint later. """ self._draw_text( - self._get_linenumber_pos(lineno), - str(lineno + 1).rjust(self.line_number_chars), + self._get_linenumber_pos(posno), + str(lineno).rjust(self.line_number_chars), font=self.fonts.get_font(self.line_number_bold, self.line_number_italic), fill=self.line_number_fg, @@ -426,9 +452,10 @@ class ImageFormatter(Formatter): """ if not self.line_numbers: return - for i in xrange(self.maxlineno): - if ((i + 1) % self.line_number_step) == 0: - self._draw_linenumber(i) + for p in xrange(self.maxlineno): + n = p + self.line_number_start + if (n % self.line_number_step) == 0: + self._draw_linenumber(p, n) def _paint_line_number_bg(self, im): """ @@ -464,6 +491,15 @@ class ImageFormatter(Formatter): ) self._paint_line_number_bg(im) draw = ImageDraw.Draw(im) + # Highlight + if self.hl_lines: + x = self.image_pad + self.line_number_width - self.line_number_pad + 1 + recth = self._get_line_height() + rectw = im.size[0] - x + for linenumber in self.hl_lines: + y = self._get_line_y(linenumber - 1) + draw.rectangle([(x, y), (x + rectw, y + recth)], + fill=self.hl_color) for pos, value, font, kw in self.drawables: draw.text(pos, value, font=font, **kw) im.save(outfile, self.image_format.upper()) diff --git a/pygments/formatters/latex.py b/pygments/formatters/latex.py index a5911a3..a9059b1 100644 --- a/pygments/formatters/latex.py +++ b/pygments/formatters/latex.py @@ -5,7 +5,7 @@ Formatter for LaTeX fancyvrb output. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -18,12 +18,16 @@ __all__ = ['LatexFormatter'] def escape_tex(text, commandprefix): - return text.replace('@', '\x00'). \ - replace('[', '\x01'). \ - replace(']', '\x02'). \ - replace('\x00', '@%sZat[]' % commandprefix).\ - replace('\x01', '@%sZlb[]' % commandprefix).\ - replace('\x02', '@%sZrb[]' % commandprefix) + return text.replace('\\', '\x00'). \ + replace('{', '\x01'). \ + replace('}', '\x02'). \ + replace('^', '\x03'). \ + replace('_', '\x04'). \ + replace('\x00', r'\%sZbs{}' % commandprefix). \ + replace('\x01', r'\%sZob{}' % commandprefix). \ + replace('\x02', r'\%sZcb{}' % commandprefix). \ + replace('\x03', r'\%sZca{}' % commandprefix). \ + replace('\x04', r'\%sZus{}' % commandprefix) DOC_TEMPLATE = r''' @@ -92,9 +96,11 @@ STYLE_TEMPLATE = r''' %(styles)s -\def\%(cp)sZat{@} -\def\%(cp)sZlb{[} -\def\%(cp)sZrb{]} +\def\%(cp)sZbs{\char`\\} +\def\%(cp)sZus{\char`\_} +\def\%(cp)sZob{\char`\{} +\def\%(cp)sZcb{\char`\}} +\def\%(cp)sZca{\char`\^} \makeatother ''' @@ -177,6 +183,16 @@ class LatexFormatter(Formatter): *New in Pygments 0.7.* *New in Pygments 0.10:* the default is now ``'PY'`` instead of ``'C'``. + + `texcomments` + If set to ``True``, enables LaTeX comment lines. That is, LaTex markup + in comment tokens is not escaped so that LaTeX can render it (default: + ``False``). *New in Pygments 1.2.* + + `mathescape` + If set to ``True``, enables LaTeX math mode escape in comments. That + is, ``'$...$'`` inside a comment will trigger math mode (default: + ``False``). *New in Pygments 1.2.* """ name = 'LaTeX' aliases = ['latex', 'tex'] @@ -192,6 +208,8 @@ class LatexFormatter(Formatter): self.verboptions = options.get('verboptions', '') self.nobackground = get_bool_opt(options, 'nobackground', False) self.commandprefix = options.get('commandprefix', 'PY') + self.texcomments = get_bool_opt(options, 'texcomments', False) + self.mathescape = get_bool_opt(options, 'mathescape', False) self._create_stylesheet() @@ -260,18 +278,46 @@ class LatexFormatter(Formatter): realoutfile = outfile outfile = StringIO() - outfile.write(r'\begin{Verbatim}[commandchars=@\[\]') + outfile.write(r'\begin{Verbatim}[commandchars=\\\{\}') if self.linenos: start, step = self.linenostart, self.linenostep outfile.write(',numbers=left' + (start and ',firstnumber=%d' % start or '') + (step and ',stepnumber=%d' % step or '')) + if self.mathescape or self.texcomments: + outfile.write(r',codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}') if self.verboptions: outfile.write(',' + self.verboptions) outfile.write(']\n') for ttype, value in tokensource: - value = escape_tex(value, self.commandprefix) + if ttype in Token.Comment: + if self.texcomments: + # Try to guess comment starting lexeme and escape it ... + start = value[0:1] + for i in xrange(1, len(value)): + if start[0] != value[i]: + break + start += value[i] + + value = value[len(start):] + start = escape_tex(start, self.commandprefix) + + # ... but do not escape inside comment. + value = start + value + elif self.mathescape: + # Only escape parts not inside a math environment. + parts = value.split('$') + in_math = False + for i, part in enumerate(parts): + if not in_math: + parts[i] = escape_tex(part, self.commandprefix) + in_math = not in_math + value = '$'.join(parts) + else: + value = escape_tex(value, self.commandprefix) + else: + value = escape_tex(value, self.commandprefix) styles = [] while ttype is not Token: try: @@ -285,10 +331,10 @@ class LatexFormatter(Formatter): spl = value.split('\n') for line in spl[:-1]: if line: - outfile.write("@%s[%s][%s]" % (cp, styleval, line)) + outfile.write("\\%s{%s}{%s}" % (cp, styleval, line)) outfile.write('\n') if spl[-1]: - outfile.write("@%s[%s][%s]" % (cp, styleval, spl[-1])) + outfile.write("\\%s{%s}{%s}" % (cp, styleval, spl[-1])) else: outfile.write(value) diff --git a/pygments/formatters/other.py b/pygments/formatters/other.py index 4b19524..249291a 100644 --- a/pygments/formatters/other.py +++ b/pygments/formatters/other.py @@ -5,7 +5,7 @@ Other formatters: NullFormatter, RawTokenFormatter. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/formatters/rtf.py b/pygments/formatters/rtf.py index 501ef42..83414c5 100644 --- a/pygments/formatters/rtf.py +++ b/pygments/formatters/rtf.py @@ -5,7 +5,7 @@ A formatter that generates RTF files. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/formatters/svg.py b/pygments/formatters/svg.py index ade8662..9928345 100644 --- a/pygments/formatters/svg.py +++ b/pygments/formatters/svg.py @@ -5,7 +5,7 @@ Formatter for SVG output. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/formatters/terminal.py b/pygments/formatters/terminal.py index fdcc8dc..fc05cad 100644 --- a/pygments/formatters/terminal.py +++ b/pygments/formatters/terminal.py @@ -5,7 +5,7 @@ Formatter for terminal output with ANSI sequences. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/formatters/terminal256.py b/pygments/formatters/terminal256.py index f1f7dc7..d72a939 100644 --- a/pygments/formatters/terminal256.py +++ b/pygments/formatters/terminal256.py @@ -11,7 +11,7 @@ Formatter version 1. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/lexer.py b/pygments/lexer.py index cf5115f..f28627b 100644 --- a/pygments/lexer.py +++ b/pygments/lexer.py @@ -5,7 +5,7 @@ Base lexer classes. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re diff --git a/pygments/lexers/__init__.py b/pygments/lexers/__init__.py index d9d475f..c1890a9 100644 --- a/pygments/lexers/__init__.py +++ b/pygments/lexers/__init__.py @@ -5,7 +5,7 @@ Pygments lexers. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import sys diff --git a/pygments/lexers/_asybuiltins.py b/pygments/lexers/_asybuiltins.py new file mode 100644 index 0000000..fbfd937 --- /dev/null +++ b/pygments/lexers/_asybuiltins.py @@ -0,0 +1,1645 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers._asybuiltins + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + This file contains the asy-function names and asy-variable names of + Asymptote. + + Do not edit the ASYFUNCNAME and ASYVARNAME sets by hand. + TODO: perl/python script in Asymptote SVN similar to asy-list.pl but only + for function and variable names. + + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +ASYFUNCNAME = set([ + 'AND', + 'Arc', + 'ArcArrow', + 'ArcArrows', + 'Arrow', + 'Arrows', + 'Automatic', + 'AvantGarde', + 'BBox', + 'BWRainbow', + 'BWRainbow2', + 'Bar', + 'Bars', + 'BeginArcArrow', + 'BeginArrow', + 'BeginBar', + 'BeginDotMargin', + 'BeginMargin', + 'BeginPenMargin', + 'Blank', + 'Bookman', + 'Bottom', + 'BottomTop', + 'Bounds', + 'Break', + 'Broken', + 'BrokenLog', + 'Ceil', + 'Circle', + 'CircleBarIntervalMarker', + 'Cos', + 'Courier', + 'CrossIntervalMarker', + 'DefaultFormat', + 'DefaultLogFormat', + 'Degrees', + 'Dir', + 'DotMargin', + 'DotMargins', + 'Dotted', + 'Draw', + 'Drawline', + 'Embed', + 'EndArcArrow', + 'EndArrow', + 'EndBar', + 'EndDotMargin', + 'EndMargin', + 'EndPenMargin', + 'Fill', + 'FillDraw', + 'Floor', + 'Format', + 'Full', + 'Gaussian', + 'Gaussrand', + 'Gaussrandpair', + 'Gradient', + 'Grayscale', + 'Helvetica', + 'Hermite', + 'HookHead', + 'InOutTicks', + 'InTicks', + 'J', + 'Label', + 'Landscape', + 'Left', + 'LeftRight', + 'LeftTicks', + 'Legend', + 'Linear', + 'Link', + 'Log', + 'LogFormat', + 'Margin', + 'Margins', + 'Mark', + 'MidArcArrow', + 'MidArrow', + 'NOT', + 'NewCenturySchoolBook', + 'NoBox', + 'NoMargin', + 'NoModifier', + 'NoTicks', + 'NoTicks3', + 'NoZero', + 'NoZeroFormat', + 'None', + 'OR', + 'OmitFormat', + 'OmitTick', + 'OutTicks', + 'Ox', + 'Oy', + 'Palatino', + 'PaletteTicks', + 'Pen', + 'PenMargin', + 'PenMargins', + 'Pentype', + 'Portrait', + 'RadialShade', + 'Rainbow', + 'Range', + 'Relative', + 'Right', + 'RightTicks', + 'Rotate', + 'Round', + 'SQR', + 'Scale', + 'ScaleX', + 'ScaleY', + 'ScaleZ', + 'Seascape', + 'Shift', + 'Sin', + 'Slant', + 'Spline', + 'StickIntervalMarker', + 'Straight', + 'Symbol', + 'Tan', + 'TeXify', + 'Ticks', + 'Ticks3', + 'TildeIntervalMarker', + 'TimesRoman', + 'Top', + 'TrueMargin', + 'UnFill', + 'UpsideDown', + 'Wheel', + 'X', + 'XEquals', + 'XOR', + 'XY', + 'XYEquals', + 'XYZero', + 'XYgrid', + 'XZEquals', + 'XZZero', + 'XZero', + 'XZgrid', + 'Y', + 'YEquals', + 'YXgrid', + 'YZ', + 'YZEquals', + 'YZZero', + 'YZero', + 'YZgrid', + 'Z', + 'ZX', + 'ZXgrid', + 'ZYgrid', + 'ZapfChancery', + 'ZapfDingbats', + '_cputime', + '_draw', + '_eval', + '_image', + '_labelpath', + '_projection', + '_strokepath', + '_texpath', + 'aCos', + 'aSin', + 'aTan', + 'abort', + 'abs', + 'accel', + 'acos', + 'acosh', + 'acot', + 'acsc', + 'add', + 'addArrow', + 'addMargins', + 'addSaveFunction', + 'addnode', + 'addnodes', + 'addpenarc', + 'addpenline', + 'addseg', + 'adjust', + 'alias', + 'align', + 'all', + 'altitude', + 'angabscissa', + 'angle', + 'angpoint', + 'animate', + 'annotate', + 'anticomplementary', + 'antipedal', + 'apply', + 'approximate', + 'arc', + 'arcarrowsize', + 'arccircle', + 'arcdir', + 'arcfromcenter', + 'arcfromfocus', + 'arclength', + 'arcnodesnumber', + 'arcpoint', + 'arcsubtended', + 'arcsubtendedcenter', + 'arctime', + 'arctopath', + 'array', + 'arrow', + 'arrow2', + 'arrowbase', + 'arrowbasepoints', + 'arrowsize', + 'asec', + 'asin', + 'asinh', + 'ask', + 'assert', + 'asy', + 'asycode', + 'asydir', + 'asyfigure', + 'asyfilecode', + 'asyinclude', + 'asywrite', + 'atan', + 'atan2', + 'atanh', + 'atbreakpoint', + 'atexit', + 'atime', + 'attach', + 'attract', + 'atupdate', + 'autoformat', + 'autoscale', + 'autoscale3', + 'axes', + 'axes3', + 'axialshade', + 'axis', + 'axiscoverage', + 'azimuth', + 'babel', + 'background', + 'bangles', + 'bar', + 'barmarksize', + 'barsize', + 'basealign', + 'baseline', + 'bbox', + 'beep', + 'begin', + 'beginclip', + 'begingroup', + 'beginpoint', + 'between', + 'bevel', + 'bezier', + 'bezierP', + 'bezierPP', + 'bezierPPP', + 'bezulate', + 'bibliography', + 'bibliographystyle', + 'binarytree', + 'binarytreeNode', + 'binomial', + 'binput', + 'bins', + 'bisector', + 'bisectorpoint', + 'blend', + 'boutput', + 'box', + 'bqe', + 'breakpoint', + 'breakpoints', + 'brick', + 'buildRestoreDefaults', + 'buildRestoreThunk', + 'buildcycle', + 'bulletcolor', + 'canonical', + 'canonicalcartesiansystem', + 'cartesiansystem', + 'case1', + 'case2', + 'case3', + 'cbrt', + 'cd', + 'ceil', + 'center', + 'centerToFocus', + 'centroid', + 'cevian', + 'change2', + 'changecoordsys', + 'checkSegment', + 'checkconditionlength', + 'checker', + 'checklengths', + 'checkposition', + 'checktriangle', + 'choose', + 'circle', + 'circlebarframe', + 'circlemarkradius', + 'circlenodesnumber', + 'circumcenter', + 'circumcircle', + 'clamped', + 'clear', + 'clip', + 'clipdraw', + 'close', + 'cmyk', + 'code', + 'colatitude', + 'collect', + 'collinear', + 'color', + 'colorless', + 'colors', + 'colorspace', + 'comma', + 'compassmark', + 'complement', + 'complementary', + 'concat', + 'concurrent', + 'cone', + 'conic', + 'conicnodesnumber', + 'conictype', + 'conj', + 'connect', + 'containmentTree', + 'contains', + 'contour', + 'contour3', + 'controlSpecifier', + 'convert', + 'coordinates', + 'coordsys', + 'copy', + 'cos', + 'cosh', + 'cot', + 'countIntersections', + 'cputime', + 'crop', + 'cropcode', + 'cross', + 'crossframe', + 'crosshatch', + 'crossmarksize', + 'csc', + 'cubicroots', + 'curabscissa', + 'curlSpecifier', + 'curpoint', + 'currentarrow', + 'currentexitfunction', + 'currentmomarrow', + 'currentpolarconicroutine', + 'curve', + 'cut', + 'cutafter', + 'cutbefore', + 'cyclic', + 'cylinder', + 'debugger', + 'deconstruct', + 'defaultdir', + 'defaultformat', + 'defaultpen', + 'defined', + 'degenerate', + 'degrees', + 'delete', + 'deletepreamble', + 'determinant', + 'diagonal', + 'diamond', + 'diffdiv', + 'dir', + 'dirSpecifier', + 'dirtime', + 'display', + 'distance', + 'divisors', + 'do_overpaint', + 'dot', + 'dotframe', + 'dotsize', + 'downcase', + 'draw', + 'drawAll', + 'drawDoubleLine', + 'drawFermion', + 'drawGhost', + 'drawGluon', + 'drawMomArrow', + 'drawPhoton', + 'drawScalar', + 'drawVertex', + 'drawVertexBox', + 'drawVertexBoxO', + 'drawVertexBoxX', + 'drawVertexO', + 'drawVertexOX', + 'drawVertexTriangle', + 'drawVertexTriangleO', + 'drawVertexX', + 'drawarrow', + 'drawarrow2', + 'drawline', + 'drawtick', + 'duplicate', + 'elle', + 'ellipse', + 'ellipsenodesnumber', + 'embed', + 'embed3', + 'empty', + 'enclose', + 'end', + 'endScript', + 'endclip', + 'endgroup', + 'endl', + 'endpoint', + 'endpoints', + 'eof', + 'eol', + 'equation', + 'equations', + 'erase', + 'erasestep', + 'erf', + 'erfc', + 'error', + 'errorbar', + 'errorbars', + 'eval', + 'excenter', + 'excircle', + 'exit', + 'exitXasyMode', + 'exitfunction', + 'exp', + 'expfactors', + 'expi', + 'expm1', + 'exradius', + 'extend', + 'extension', + 'extouch', + 'fabs', + 'factorial', + 'fermat', + 'fft', + 'fhorner', + 'figure', + 'file', + 'filecode', + 'fill', + 'filldraw', + 'filloutside', + 'fillrule', + 'filltype', + 'find', + 'finite', + 'finiteDifferenceJacobian', + 'firstcut', + 'firstframe', + 'fit', + 'fit2', + 'fixedscaling', + 'floor', + 'flush', + 'fmdefaults', + 'fmod', + 'focusToCenter', + 'font', + 'fontcommand', + 'fontsize', + 'foot', + 'format', + 'frac', + 'frequency', + 'fromCenter', + 'fromFocus', + 'fspline', + 'functionshade', + 'gamma', + 'generate_random_backtrace', + 'generateticks', + 'gergonne', + 'getc', + 'getint', + 'getpair', + 'getreal', + 'getstring', + 'gettriple', + 'gluon', + 'gouraudshade', + 'graph', + 'graphic', + 'gray', + 'grestore', + 'grid', + 'grid3', + 'gsave', + 'halfbox', + 'hatch', + 'hdiffdiv', + 'hermite', + 'hex', + 'histogram', + 'history', + 'hline', + 'hprojection', + 'hsv', + 'hyperbola', + 'hyperbolanodesnumber', + 'hyperlink', + 'hypot', + 'identity', + 'image', + 'incenter', + 'incentral', + 'incircle', + 'increasing', + 'incrementposition', + 'indexedTransform', + 'indexedfigure', + 'initXasyMode', + 'initdefaults', + 'input', + 'inradius', + 'insert', + 'inside', + 'integrate', + 'interactive', + 'interior', + 'interp', + 'interpolate', + 'intersect', + 'intersection', + 'intersectionpoint', + 'intersectionpoints', + 'intersections', + 'intouch', + 'inverse', + 'inversion', + 'invisible', + 'is3D', + 'isDuplicate', + 'isogonal', + 'isogonalconjugate', + 'isotomic', + 'isotomicconjugate', + 'isparabola', + 'italic', + 'item', + 'key', + 'kurtosis', + 'kurtosisexcess', + 'label', + 'labelaxis', + 'labelmargin', + 'labelpath', + 'labels', + 'labeltick', + 'labelx', + 'labelx3', + 'labely', + 'labely3', + 'labelz', + 'labelz3', + 'lastcut', + 'latex', + 'latitude', + 'latticeshade', + 'layer', + 'layout', + 'ldexp', + 'leastsquares', + 'legend', + 'legenditem', + 'length', + 'lift', + 'light', + 'limits', + 'line', + 'linear', + 'linecap', + 'lineinversion', + 'linejoin', + 'linemargin', + 'lineskip', + 'linetype', + 'linewidth', + 'link', + 'list', + 'lm_enorm', + 'lm_evaluate_default', + 'lm_lmdif', + 'lm_lmpar', + 'lm_minimize', + 'lm_print_default', + 'lm_print_quiet', + 'lm_qrfac', + 'lm_qrsolv', + 'locale', + 'locate', + 'locatefile', + 'location', + 'log', + 'log10', + 'log1p', + 'logaxiscoverage', + 'longitude', + 'lookup', + 'magnetize', + 'makeNode', + 'makedraw', + 'makepen', + 'map', + 'margin', + 'markangle', + 'markangleradius', + 'markanglespace', + 'markarc', + 'marker', + 'markinterval', + 'marknodes', + 'markrightangle', + 'markuniform', + 'mass', + 'masscenter', + 'massformat', + 'math', + 'max', + 'max3', + 'maxbezier', + 'maxbound', + 'maxcoords', + 'maxlength', + 'maxratio', + 'maxtimes', + 'mean', + 'medial', + 'median', + 'midpoint', + 'min', + 'min3', + 'minbezier', + 'minbound', + 'minipage', + 'minratio', + 'mintimes', + 'miterlimit', + 'momArrowPath', + 'momarrowsize', + 'monotonic', + 'multifigure', + 'nativeformat', + 'natural', + 'needshipout', + 'newl', + 'newpage', + 'newslide', + 'newton', + 'newtree', + 'nextframe', + 'nextnormal', + 'nextpage', + 'nib', + 'nodabscissa', + 'none', + 'norm', + 'normalvideo', + 'notaknot', + 'nowarn', + 'numberpage', + 'nurb', + 'object', + 'offset', + 'onpath', + 'opacity', + 'opposite', + 'orientation', + 'orig_circlenodesnumber', + 'orig_circlenodesnumber1', + 'orig_draw', + 'orig_ellipsenodesnumber', + 'orig_ellipsenodesnumber1', + 'orig_hyperbolanodesnumber', + 'orig_parabolanodesnumber', + 'origin', + 'orthic', + 'orthocentercenter', + 'outformat', + 'outline', + 'outprefix', + 'output', + 'overloadedMessage', + 'overwrite', + 'pack', + 'pad', + 'pairs', + 'palette', + 'parabola', + 'parabolanodesnumber', + 'parallel', + 'partialsum', + 'path', + 'path3', + 'pattern', + 'pause', + 'pdf', + 'pedal', + 'periodic', + 'perp', + 'perpendicular', + 'perpendicularmark', + 'phantom', + 'phi1', + 'phi2', + 'phi3', + 'photon', + 'piecewisestraight', + 'point', + 'polar', + 'polarconicroutine', + 'polargraph', + 'polygon', + 'postcontrol', + 'postscript', + 'pow10', + 'ppoint', + 'prc', + 'prc0', + 'precision', + 'precontrol', + 'prepend', + 'print_random_addresses', + 'project', + 'projection', + 'purge', + 'pwhermite', + 'quadrant', + 'quadraticroots', + 'quantize', + 'quarticroots', + 'quotient', + 'radialshade', + 'radians', + 'radicalcenter', + 'radicalline', + 'radius', + 'rand', + 'randompath', + 'rd', + 'readline', + 'realmult', + 'realquarticroots', + 'rectangle', + 'rectangular', + 'rectify', + 'reflect', + 'relabscissa', + 'relative', + 'relativedistance', + 'reldir', + 'relpoint', + 'reltime', + 'remainder', + 'remark', + 'removeDuplicates', + 'rename', + 'replace', + 'report', + 'resetdefaultpen', + 'restore', + 'restoredefaults', + 'reverse', + 'reversevideo', + 'rf', + 'rfind', + 'rgb', + 'rgba', + 'rgbint', + 'rms', + 'rotate', + 'rotateO', + 'rotation', + 'round', + 'roundbox', + 'roundedpath', + 'roundrectangle', + 'samecoordsys', + 'sameside', + 'sample', + 'save', + 'savedefaults', + 'saveline', + 'scale', + 'scale3', + 'scaleO', + 'scaleT', + 'scaleless', + 'scientific', + 'search', + 'searchtree', + 'sec', + 'secondaryX', + 'secondaryY', + 'seconds', + 'section', + 'sector', + 'seek', + 'seekeof', + 'segment', + 'sequence', + 'setpens', + 'sgn', + 'sgnd', + 'sharpangle', + 'sharpdegrees', + 'shift', + 'shiftless', + 'shipout', + 'shipout3', + 'show', + 'side', + 'simeq', + 'simpson', + 'sin', + 'single', + 'sinh', + 'size', + 'size3', + 'skewness', + 'skip', + 'slant', + 'sleep', + 'slope', + 'slopefield', + 'solve', + 'solveBVP', + 'sort', + 'sourceline', + 'sphere', + 'split', + 'sqrt', + 'square', + 'srand', + 'standardizecoordsys', + 'startScript', + 'startTrembling', + 'stdev', + 'step', + 'stickframe', + 'stickmarksize', + 'stickmarkspace', + 'stop', + 'straight', + 'straightness', + 'string', + 'stripdirectory', + 'stripextension', + 'stripfile', + 'strokepath', + 'subdivide', + 'subitem', + 'subpath', + 'substr', + 'sum', + 'surface', + 'symmedial', + 'symmedian', + 'system', + 'tab', + 'tableau', + 'tan', + 'tangent', + 'tangential', + 'tangents', + 'tanh', + 'tell', + 'tensionSpecifier', + 'tensorshade', + 'tex', + 'texcolor', + 'texify', + 'texpath', + 'texpreamble', + 'texreset', + 'texshipout', + 'texsize', + 'textpath', + 'thick', + 'thin', + 'tick', + 'tickMax', + 'tickMax3', + 'tickMin', + 'tickMin3', + 'ticklabelshift', + 'ticklocate', + 'tildeframe', + 'tildemarksize', + 'tile', + 'tiling', + 'time', + 'times', + 'title', + 'titlepage', + 'topbox', + 'transform', + 'transformation', + 'transpose', + 'tremble', + 'trembleFuzz', + 'tremble_circlenodesnumber', + 'tremble_circlenodesnumber1', + 'tremble_draw', + 'tremble_ellipsenodesnumber', + 'tremble_ellipsenodesnumber1', + 'tremble_hyperbolanodesnumber', + 'tremble_marknodes', + 'tremble_markuniform', + 'tremble_parabolanodesnumber', + 'triangle', + 'triangleAbc', + 'triangleabc', + 'triangulate', + 'tricoef', + 'tridiagonal', + 'trilinear', + 'trim', + 'trueMagnetize', + 'truepoint', + 'tube', + 'uncycle', + 'unfill', + 'uniform', + 'unit', + 'unitrand', + 'unitsize', + 'unityroot', + 'unstraighten', + 'upcase', + 'updatefunction', + 'uperiodic', + 'upscale', + 'uptodate', + 'usepackage', + 'usersetting', + 'usetypescript', + 'usleep', + 'value', + 'variance', + 'variancebiased', + 'vbox', + 'vector', + 'vectorfield', + 'verbatim', + 'view', + 'vline', + 'vperiodic', + 'vprojection', + 'warn', + 'warning', + 'windingnumber', + 'write', + 'xaxis', + 'xaxis3', + 'xaxis3At', + 'xaxisAt', + 'xequals', + 'xinput', + 'xlimits', + 'xoutput', + 'xpart', + 'xscale', + 'xscaleO', + 'xtick', + 'xtick3', + 'xtrans', + 'yaxis', + 'yaxis3', + 'yaxis3At', + 'yaxisAt', + 'yequals', + 'ylimits', + 'ypart', + 'yscale', + 'yscaleO', + 'ytick', + 'ytick3', + 'ytrans', + 'zaxis3', + 'zaxis3At', + 'zero', + 'zero3', + 'zlimits', + 'zpart', + 'ztick', + 'ztick3', + 'ztrans' +]) + +ASYVARNAME = set([ + 'AliceBlue', + 'Align', + 'Allow', + 'AntiqueWhite', + 'Apricot', + 'Aqua', + 'Aquamarine', + 'Aspect', + 'Azure', + 'BeginPoint', + 'Beige', + 'Bisque', + 'Bittersweet', + 'Black', + 'BlanchedAlmond', + 'Blue', + 'BlueGreen', + 'BlueViolet', + 'Both', + 'Break', + 'BrickRed', + 'Brown', + 'BurlyWood', + 'BurntOrange', + 'CCW', + 'CW', + 'CadetBlue', + 'CarnationPink', + 'Center', + 'Centered', + 'Cerulean', + 'Chartreuse', + 'Chocolate', + 'Coeff', + 'Coral', + 'CornflowerBlue', + 'Cornsilk', + 'Crimson', + 'Crop', + 'Cyan', + 'Dandelion', + 'DarkBlue', + 'DarkCyan', + 'DarkGoldenrod', + 'DarkGray', + 'DarkGreen', + 'DarkKhaki', + 'DarkMagenta', + 'DarkOliveGreen', + 'DarkOrange', + 'DarkOrchid', + 'DarkRed', + 'DarkSalmon', + 'DarkSeaGreen', + 'DarkSlateBlue', + 'DarkSlateGray', + 'DarkTurquoise', + 'DarkViolet', + 'DeepPink', + 'DeepSkyBlue', + 'DefaultHead', + 'DimGray', + 'DodgerBlue', + 'Dotted', + 'Draw', + 'E', + 'ENE', + 'EPS', + 'ESE', + 'E_Euler', + 'E_PC', + 'E_RK2', + 'E_RK3BS', + 'Emerald', + 'EndPoint', + 'Euler', + 'Fill', + 'FillDraw', + 'FireBrick', + 'FloralWhite', + 'ForestGreen', + 'Fuchsia', + 'Gainsboro', + 'GhostWhite', + 'Gold', + 'Goldenrod', + 'Gray', + 'Green', + 'GreenYellow', + 'Honeydew', + 'HookHead', + 'Horizontal', + 'HotPink', + 'I', + 'IgnoreAspect', + 'IndianRed', + 'Indigo', + 'Ivory', + 'JOIN_IN', + 'JOIN_OUT', + 'JungleGreen', + 'Khaki', + 'LM_DWARF', + 'LM_MACHEP', + 'LM_SQRT_DWARF', + 'LM_SQRT_GIANT', + 'LM_USERTOL', + 'Label', + 'Lavender', + 'LavenderBlush', + 'LawnGreen', + 'LeftJustified', + 'LeftSide', + 'LemonChiffon', + 'LightBlue', + 'LightCoral', + 'LightCyan', + 'LightGoldenrodYellow', + 'LightGreen', + 'LightGrey', + 'LightPink', + 'LightSalmon', + 'LightSeaGreen', + 'LightSkyBlue', + 'LightSlateGray', + 'LightSteelBlue', + 'LightYellow', + 'Lime', + 'LimeGreen', + 'Linear', + 'Linen', + 'Log', + 'Logarithmic', + 'Magenta', + 'Mahogany', + 'Mark', + 'MarkFill', + 'Maroon', + 'Max', + 'MediumAquamarine', + 'MediumBlue', + 'MediumOrchid', + 'MediumPurple', + 'MediumSeaGreen', + 'MediumSlateBlue', + 'MediumSpringGreen', + 'MediumTurquoise', + 'MediumVioletRed', + 'Melon', + 'MidPoint', + 'MidnightBlue', + 'Min', + 'MintCream', + 'MistyRose', + 'Moccasin', + 'Move', + 'MoveQuiet', + 'Mulberry', + 'N', + 'NE', + 'NNE', + 'NNW', + 'NW', + 'NavajoWhite', + 'Navy', + 'NavyBlue', + 'NoAlign', + 'NoCrop', + 'NoFill', + 'NoSide', + 'OldLace', + 'Olive', + 'OliveDrab', + 'OliveGreen', + 'Orange', + 'OrangeRed', + 'Orchid', + 'Ox', + 'Oy', + 'PC', + 'PaleGoldenrod', + 'PaleGreen', + 'PaleTurquoise', + 'PaleVioletRed', + 'PapayaWhip', + 'Peach', + 'PeachPuff', + 'Periwinkle', + 'Peru', + 'PineGreen', + 'Pink', + 'Plum', + 'PowderBlue', + 'ProcessBlue', + 'Purple', + 'RK2', + 'RK3', + 'RK3BS', + 'RK4', + 'RK5', + 'RK5DP', + 'RK5F', + 'RawSienna', + 'Red', + 'RedOrange', + 'RedViolet', + 'Rhodamine', + 'RightJustified', + 'RightSide', + 'RosyBrown', + 'RoyalBlue', + 'RoyalPurple', + 'RubineRed', + 'S', + 'SE', + 'SSE', + 'SSW', + 'SW', + 'SaddleBrown', + 'Salmon', + 'SandyBrown', + 'SeaGreen', + 'Seashell', + 'Sepia', + 'Sienna', + 'Silver', + 'SimpleHead', + 'SkyBlue', + 'SlateBlue', + 'SlateGray', + 'Snow', + 'SpringGreen', + 'SteelBlue', + 'Suppress', + 'SuppressQuiet', + 'Tan', + 'TeXHead', + 'Teal', + 'TealBlue', + 'Thistle', + 'Ticksize', + 'Tomato', + 'Turquoise', + 'UnFill', + 'VERSION', + 'Value', + 'Vertical', + 'Violet', + 'VioletRed', + 'W', + 'WNW', + 'WSW', + 'Wheat', + 'White', + 'WhiteSmoke', + 'WildStrawberry', + 'XYAlign', + 'YAlign', + 'Yellow', + 'YellowGreen', + 'YellowOrange', + 'addpenarc', + 'addpenline', + 'align', + 'allowstepping', + 'angularsystem', + 'animationdelay', + 'appendsuffix', + 'arcarrowangle', + 'arcarrowfactor', + 'arrow2sizelimit', + 'arrowangle', + 'arrowbarb', + 'arrowdir', + 'arrowfactor', + 'arrowhookfactor', + 'arrowlength', + 'arrowsizelimit', + 'arrowtexfactor', + 'authorpen', + 'axis', + 'axiscoverage', + 'axislabelfactor', + 'background', + 'backgroundcolor', + 'backgroundpen', + 'barfactor', + 'barmarksizefactor', + 'basealign', + 'baselinetemplate', + 'beveljoin', + 'bigvertexpen', + 'bigvertexsize', + 'black', + 'blue', + 'bm', + 'bottom', + 'bp', + 'brown', + 'bullet', + 'byfoci', + 'byvertices', + 'camerafactor', + 'chartreuse', + 'circlemarkradiusfactor', + 'circlenodesnumberfactor', + 'circleprecision', + 'circlescale', + 'cm', + 'codefile', + 'codepen', + 'codeskip', + 'colorPen', + 'coloredNodes', + 'coloredSegments', + 'conditionlength', + 'conicnodesfactor', + 'count', + 'cputimeformat', + 'crossmarksizefactor', + 'currentcoordsys', + 'currentlight', + 'currentpatterns', + 'currentpen', + 'currentpicture', + 'currentposition', + 'currentprojection', + 'curvilinearsystem', + 'cuttings', + 'cyan', + 'darkblue', + 'darkbrown', + 'darkcyan', + 'darkgray', + 'darkgreen', + 'darkgrey', + 'darkmagenta', + 'darkolive', + 'darkred', + 'dashdotted', + 'dashed', + 'datepen', + 'dateskip', + 'debuggerlines', + 'debugging', + 'deepblue', + 'deepcyan', + 'deepgray', + 'deepgreen', + 'deepgrey', + 'deepmagenta', + 'deepred', + 'default', + 'defaultControl', + 'defaultS', + 'defaultbackpen', + 'defaultcoordsys', + 'defaultfilename', + 'defaultformat', + 'defaultmassformat', + 'defaultpen', + 'diagnostics', + 'differentlengths', + 'dot', + 'dotfactor', + 'dotframe', + 'dotted', + 'doublelinepen', + 'doublelinespacing', + 'down', + 'duplicateFuzz', + 'ellipsenodesnumberfactor', + 'eps', + 'epsgeo', + 'epsilon', + 'evenodd', + 'extendcap', + 'fermionpen', + 'figureborder', + 'figuremattpen', + 'firstnode', + 'firststep', + 'foregroundcolor', + 'fuchsia', + 'fuzz', + 'gapfactor', + 'ghostpen', + 'gluonamplitude', + 'gluonpen', + 'gluonratio', + 'gray', + 'green', + 'grey', + 'hatchepsilon', + 'havepagenumber', + 'heavyblue', + 'heavycyan', + 'heavygray', + 'heavygreen', + 'heavygrey', + 'heavymagenta', + 'heavyred', + 'hline', + 'hwratio', + 'hyperbolanodesnumberfactor', + 'identity4', + 'ignore', + 'inXasyMode', + 'inch', + 'inches', + 'includegraphicscommand', + 'inf', + 'infinity', + 'institutionpen', + 'intMax', + 'intMin', + 'invert', + 'invisible', + 'itempen', + 'itemskip', + 'itemstep', + 'labelmargin', + 'landscape', + 'lastnode', + 'left', + 'legendhskip', + 'legendlinelength', + 'legendmargin', + 'legendmarkersize', + 'legendmaxrelativewidth', + 'legendvskip', + 'lightblue', + 'lightcyan', + 'lightgray', + 'lightgreen', + 'lightgrey', + 'lightmagenta', + 'lightolive', + 'lightred', + 'lightyellow', + 'linemargin', + 'lm_infmsg', + 'lm_shortmsg', + 'longdashdotted', + 'longdashed', + 'magenta', + 'magneticPoints', + 'magneticRadius', + 'mantissaBits', + 'markangleradius', + 'markangleradiusfactor', + 'markanglespace', + 'markanglespacefactor', + 'mediumblue', + 'mediumcyan', + 'mediumgray', + 'mediumgreen', + 'mediumgrey', + 'mediummagenta', + 'mediumred', + 'mediumyellow', + 'middle', + 'minDistDefault', + 'minblockheight', + 'minblockwidth', + 'mincirclediameter', + 'minipagemargin', + 'minipagewidth', + 'minvertexangle', + 'miterjoin', + 'mm', + 'momarrowfactor', + 'momarrowlength', + 'momarrowmargin', + 'momarrowoffset', + 'momarrowpen', + 'monoPen', + 'morepoints', + 'nCircle', + 'newbulletcolor', + 'ngraph', + 'nil', + 'nmesh', + 'nobasealign', + 'nodeMarginDefault', + 'nodesystem', + 'nomarker', + 'nopoint', + 'noprimary', + 'nullpath', + 'nullpen', + 'numarray', + 'ocgindex', + 'oldbulletcolor', + 'olive', + 'orange', + 'origin', + 'overpaint', + 'page', + 'pageheight', + 'pagemargin', + 'pagenumberalign', + 'pagenumberpen', + 'pagenumberposition', + 'pagewidth', + 'paleblue', + 'palecyan', + 'palegray', + 'palegreen', + 'palegrey', + 'palemagenta', + 'palered', + 'paleyellow', + 'parabolanodesnumberfactor', + 'perpfactor', + 'phi', + 'photonamplitude', + 'photonpen', + 'photonratio', + 'pi', + 'pink', + 'plain', + 'plus', + 'preamblenodes', + 'pt', + 'purple', + 'r3', + 'r4a', + 'r4b', + 'randMax', + 'realDigits', + 'realEpsilon', + 'realMax', + 'realMin', + 'red', + 'relativesystem', + 'reverse', + 'right', + 'roundcap', + 'roundjoin', + 'royalblue', + 'salmon', + 'saveFunctions', + 'scalarpen', + 'sequencereal', + 'settings', + 'shipped', + 'signedtrailingzero', + 'solid', + 'springgreen', + 'sqrtEpsilon', + 'squarecap', + 'squarepen', + 'startposition', + 'stdin', + 'stdout', + 'stepfactor', + 'stepfraction', + 'steppagenumberpen', + 'stepping', + 'stickframe', + 'stickmarksizefactor', + 'stickmarkspacefactor', + 'textpen', + 'ticksize', + 'tildeframe', + 'tildemarksizefactor', + 'tinv', + 'titlealign', + 'titlepagepen', + 'titlepageposition', + 'titlepen', + 'titleskip', + 'top', + 'trailingzero', + 'treeLevelStep', + 'treeMinNodeWidth', + 'treeNodeStep', + 'trembleAngle', + 'trembleFrequency', + 'trembleRandom', + 'tremblingMode', + 'undefined', + 'unitcircle', + 'unitsquare', + 'up', + 'urlpen', + 'urlskip', + 'version', + 'vertexpen', + 'vertexsize', + 'viewportmargin', + 'viewportsize', + 'vline', + 'white', + 'wye', + 'xformStack', + 'yellow', + 'ylabelwidth', + 'zerotickfuzz', + 'zerowinding' +]) diff --git a/pygments/lexers/_clbuiltins.py b/pygments/lexers/_clbuiltins.py index 4f4f886..03e5cad 100644 --- a/pygments/lexers/_clbuiltins.py +++ b/pygments/lexers/_clbuiltins.py @@ -5,7 +5,7 @@ ANSI Common Lisp builtins. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/lexers/_luabuiltins.py b/pygments/lexers/_luabuiltins.py index 31cbb5b..c475c9c 100644 --- a/pygments/lexers/_luabuiltins.py +++ b/pygments/lexers/_luabuiltins.py @@ -9,7 +9,7 @@ Do not edit the MODULES dict by hand. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py index 86c59a5..7e06831 100644 --- a/pygments/lexers/_mapping.py +++ b/pygments/lexers/_mapping.py @@ -9,7 +9,7 @@ Do not alter the LEXERS dictionary by hand. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -28,6 +28,7 @@ LEXERS = { 'AntlrRubyLexer': ('pygments.lexers.parsers', 'ANTLR With Ruby Target', ('antlr-ruby', 'antlr-rb'), ('*.G', '*.g'), ()), 'ApacheConfLexer': ('pygments.lexers.text', 'ApacheConf', ('apacheconf', 'aconf', 'apache'), ('.htaccess', 'apache.conf', 'apache2.conf'), ('text/x-apacheconf',)), 'AppleScriptLexer': ('pygments.lexers.other', 'AppleScript', ('applescript',), ('*.applescript',), ()), + 'AsymptoteLexer': ('pygments.lexers.other', 'Asymptote', ('asy',), ('*.asy',), ('text/x-asymptote',)), 'BBCodeLexer': ('pygments.lexers.text', 'BBCode', ('bbcode',), (), ('text/x-bbcode',)), 'BaseMakefileLexer': ('pygments.lexers.text', 'Makefile', ('basemake',), (), ()), 'BashLexer': ('pygments.lexers.other', 'Bash', ('bash', 'sh'), ('*.sh', '*.ebuild', '*.eclass'), ('application/x-sh', 'application/x-shellscript')), @@ -37,6 +38,7 @@ LEXERS = { 'BooLexer': ('pygments.lexers.dotnet', 'Boo', ('boo',), ('*.boo',), ('text/x-boo',)), 'BrainfuckLexer': ('pygments.lexers.other', 'Brainfuck', ('brainfuck', 'bf'), ('*.bf', '*.b'), ('application/x-brainfuck',)), 'CLexer': ('pygments.lexers.compiled', 'C', ('c',), ('*.c', '*.h'), ('text/x-chdr', 'text/x-csrc')), + 'CMakeLexer': ('pygments.lexers.text', 'CMake', ('cmake',), ('*.cmake',), ('text/x-cmake',)), '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',)), @@ -75,7 +77,9 @@ LEXERS = { 'GenshiLexer': ('pygments.lexers.templates', 'Genshi', ('genshi', 'kid', 'xml+genshi', 'xml+kid'), ('*.kid',), ('application/x-genshi', 'application/x-kid')), 'GenshiTextLexer': ('pygments.lexers.templates', 'Genshi Text', ('genshitext',), (), ('application/x-genshi-text', 'text/x-genshi')), 'GettextLexer': ('pygments.lexers.text', 'Gettext Catalog', ('pot', 'po'), ('*.pot', '*.po'), ('application/x-gettext', 'text/x-gettext', 'text/gettext')), + 'GherkinLexer': ('pygments.lexers.other', 'Gherkin', ('Cucumber', 'cucumber', 'Gherkin', 'gherkin'), ('*.feature',), ('text/x-gherkin',)), 'GnuplotLexer': ('pygments.lexers.other', 'Gnuplot', ('gnuplot',), ('*.plot', '*.plt'), ('text/x-gnuplot',)), + 'GoLexer': ('pygments.lexers.compiled', 'Go', ('go',), ('*.go',), ('text/x-gosrc',)), 'GroffLexer': ('pygments.lexers.text', 'Groff', ('groff', 'nroff', 'man'), ('*.[1234567]', '*.man'), ('application/x-troff', 'text/troff')), 'HaskellLexer': ('pygments.lexers.functional', 'Haskell', ('haskell', 'hs'), ('*.hs',), ('text/x-haskell',)), 'HtmlDjangoLexer': ('pygments.lexers.templates', 'HTML+Django/Jinja', ('html+django', 'html+jinja'), (), ('text/html+django', 'text/html+jinja')), @@ -127,6 +131,7 @@ LEXERS = { 'ObjectiveCLexer': ('pygments.lexers.compiled', 'Objective-C', ('objective-c', 'objectivec', 'obj-c', 'objc'), ('*.m',), ('text/x-objective-c',)), 'OcamlLexer': ('pygments.lexers.compiled', 'OCaml', ('ocaml',), ('*.ml', '*.mli', '*.mll', '*.mly'), ('text/x-ocaml',)), 'OcamlLexer': ('pygments.lexers.functional', 'OCaml', ('ocaml',), ('*.ml', '*.mli', '*.mll', '*.mly'), ('text/x-ocaml',)), + 'OocLexer': ('pygments.lexers.compiled', 'Ooc', ('ooc',), ('*.ooc',), ('text/x-ooc',)), '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',)), 'PovrayLexer': ('pygments.lexers.other', 'POVRay', ('pov',), ('*.pov', '*.inc'), ('text/x-povray',)), diff --git a/pygments/lexers/_phpbuiltins.py b/pygments/lexers/_phpbuiltins.py index 4ab11eb..0c0accc 100644 --- a/pygments/lexers/_phpbuiltins.py +++ b/pygments/lexers/_phpbuiltins.py @@ -12,7 +12,7 @@ internet connection. don't run that at home, use a server ;-) - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py index 1a57c73..40f29c5 100644 --- a/pygments/lexers/agile.py +++ b/pygments/lexers/agile.py @@ -5,7 +5,7 @@ Lexers for agile languages. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -17,7 +17,7 @@ except NameError: from pygments.lexer import Lexer, RegexLexer, ExtendedRegexLexer, \ LexerContext, include, combined, do_insertions, bygroups, using -from pygments.token import Error, Text, \ +from pygments.token import Error, Text, Other, \ Comment, Operator, Keyword, Name, String, Number, Generic, Punctuation from pygments.util import get_bool_opt, get_list_opt, shebang_matches from pygments import unistring as uni @@ -368,7 +368,8 @@ class PythonTracebackLexer(RegexLexer): 'root': [ (r'^Traceback \(most recent call last\):\n', Generic.Traceback, 'intb'), # SyntaxError starts with this. - (r'^(?= File "[^"]+", line \d+\n)', Generic.Traceback, 'intb'), + (r'^(?= File "[^"]+", line \d+)', Generic.Traceback, 'intb'), + (r'^.*\n', Other), ], 'intb': [ (r'^( File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)', @@ -559,22 +560,22 @@ class RubyLexer(ExtendedRegexLexer): # these must come after %! states['strings'] += [ # %r regex - (r'(%r([^a-zA-Z0-9]))([^\2\\]*(?:\\.[^\2\\]*)*)(\2[mixounse]*)', + (r'(%r([^a-zA-Z0-9]))((?:\\\2|(?!\2).)*)(\2[mixounse]*)', intp_regex_callback), # regular fancy strings with qsw - (r'%[qsw]([^a-zA-Z0-9])([^\1\\]*(?:\\.[^\1\\]*)*)\1', String.Other), - (r'(%[QWx]([^a-zA-Z0-9]))([^\2\\]*(?:\\.[^\2\\]*)*)(\2)', + (r'%[qsw]([^a-zA-Z0-9])((?:\\\1|(?!\1).)*)\1', String.Other), + (r'(%[QWx]([^a-zA-Z0-9]))((?:\\\2|(?!\2).)*)(\2)', intp_string_callback), # special forms of fancy strings after operators or # in method calls with braces - (r'(?<=[-+/*%=<>&!^|~,(])(\s*)(%([\t ])(?:[^\3\\]*(?:\\.[^\3\\]*)*)\3)', + (r'(?<=[-+/*%=<>&!^|~,(])(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)', bygroups(Text, String.Other, None)), # and because of fixed width lookbehinds the whole thing a # second time for line startings... - (r'^(\s*)(%([\t ])(?:[^\3\\]*(?:\\.[^\3\\]*)*)\3)', + (r'^(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)', bygroups(Text, String.Other, None)), # all regular fancy strings without qsw - (r'(%([^a-zA-Z0-9\s]))([^\2\\]*(?:\\.[^\2\\]*)*)(\2)', + (r'(%([^a-zA-Z0-9\s]))((?:\\\2|(?!\2).)*)(\2)', intp_string_callback), ] diff --git a/pygments/lexers/asm.py b/pygments/lexers/asm.py index 655b746..e574a59 100644 --- a/pygments/lexers/asm.py +++ b/pygments/lexers/asm.py @@ -5,7 +5,7 @@ Lexers for assembly languages. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -199,7 +199,7 @@ class LlvmLexer(RegexLexer): #: optional Comment or Whitespace string = r'"[^"]*?"' - identifier = r'([a-zA-Z$._][a-zA-Z$._0-9]*|' + string + ')' + identifier = r'([-a-zA-Z$._][-a-zA-Z$._0-9]*|' + string + ')' tokens = { 'root': [ @@ -211,14 +211,17 @@ class LlvmLexer(RegexLexer): include('keyword'), (r'%' + identifier, Name.Variable),#Name.Identifier.Local), - (r'@' + identifier, Name.Constant),#Name.Identifier.Global), + (r'@' + identifier, Name.Variable.Global),#Name.Identifier.Global), (r'%\d+', Name.Variable.Anonymous),#Name.Identifier.Anonymous), + (r'@\d+', Name.Variable.Global),#Name.Identifier.Anonymous), + (r'!' + identifier, Name.Variable), + (r'!\d+', Name.Variable.Anonymous), (r'c?' + string, String), (r'0[xX][a-fA-F0-9]+', Number), (r'-?\d+(?:[.]\d+)?(?:[eE][-+]?\d+(?:[.]\d+)?)?', Number), - (r'[=<>{}\[\]()*.,]|x\b', Punctuation) + (r'[=<>{}\[\]()*.,!]|x\b', Punctuation) ], 'whitespace': [ (r'(\n|\s)+', Text), @@ -226,36 +229,56 @@ class LlvmLexer(RegexLexer): ], 'keyword': [ # Regular keywords - (r'(void|label|float|double|opaque' - r'|to' - r'|alias|type' - r'|zeroext|signext|inreg|sret|noalias|noreturn|nounwind|nest' - r'|module|asm|target|datalayout|triple' - r'|true|false|null|zeroinitializer|undef' - r'|global|internal|external|linkonce|weak|appending|extern_weak' - r'|dllimport|dllexport' - r'|ccc|fastcc|coldcc|cc|tail' - r'|default|hidden|protected' - r'|thread_local|constant|align|section' - r'|define|declare' - - # Statements & expressions - r'|trunc|zext|sext|fptrunc|fpext|fptoui|fptosi|uitofp|sitofp' - r'|ptrtoint|inttoptr|bitcast|getelementptr|select|icmp|fcmp' - r'|extractelement|insertelement|shufflevector' - r'|sideeffect|volatile' - r'|ret|br|switch|invoke|unwind|unreachable' - r'|add|sub|mul|udiv|sdiv|fdiv|urem|srem|frem' - r'|shl|lshr|ashr|and|or|xor' - r'|malloc|free|alloca|load|store' - r'|phi|call|va_arg|va_list' - - # Comparison condition codes for icmp - r'|eq|ne|ugt|uge|ult|ule|sgt|sge|slt|sle' - # Ditto for fcmp: (minus keywords mentioned in other contexts) - r'|oeq|ogt|oge|olt|ole|one|ord|ueq|ugt|uge|une|uno' + (r'(begin|end' + r'|true|false' + r'|declare|define' + r'|global|constant' + + r'|private|linker_private|internal|available_externally|linkonce' + 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'|ccc|fastcc|coldcc|x86_stdcallcc|x86_fastcallcc|arm_apcscc' + r'|arm_aapcscc|arm_aapcs_vfpcc' + + r'|cc|c' + + r'|signext|zeroext|inreg|sret|nounwind|noreturn|noalias|nocapture' + r'|byval|nest|readnone|readonly' + + r'|inlinehint|noinline|alwaysinline|optsize|ssp|sspreq|noredzone' + r'|noimplicitfloat|naked' + + r'|type|opaque' + + r'|eq|ne|slt|sgt|sle' + r'|sge|ult|ugt|ule|uge' + r'|oeq|one|olt|ogt|ole' + r'|oge|ord|uno|ueq|une' + r'|x' + + # instructions + r'|add|fadd|sub|fsub|mul|fmul|udiv|sdiv|fdiv|urem|srem|frem|shl' + r'|lshr|ashr|and|or|xor|icmp|fcmp' + + r'|phi|call|trunc|zext|sext|fptrunc|fpext|uitofp|sitofp|fptoui' + r'fptosi|inttoptr|ptrtoint|bitcast|select|va_arg|ret|br|switch' + r'|invoke|unwind|unreachable' + + r'|malloc|alloca|free|load|store|getelementptr' + + r'|extractelement|insertelement|shufflevector|getresult' + r'|extractvalue|insertvalue' r')\b', Keyword), + + # Types + (r'void|float|double|x86_fp80|fp128|ppc_fp128|label|metadata', + Keyword.Type), + # Integer types (r'i[1-9]\d*', Keyword) ] @@ -272,7 +295,7 @@ class NasmLexer(RegexLexer): mimetypes = ['text/x-nasm'] identifier = r'[a-zA-Z$._?][a-zA-Z0-9$._?#@~]*' - hexn = r'(?:0[xX][0-9a-fA-F]+|$0[0-9a-fA-F]*|[0-9a-fA-F]+h)' + hexn = r'(?:0[xX][0-9a-fA-F]+|$0[0-9a-fA-F]*|[0-9]+[0-9a-fA-F]*h)' octn = r'[0-7]+q' binn = r'[01]+b' decn = r'[0-9]+' @@ -284,7 +307,8 @@ class NasmLexer(RegexLexer): wordop = r'seg|wrt|strict' type = r'byte|[dq]?word' directives = (r'BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|' - r'COMMON|CPU|GROUP|UPPERCASE|IMPORT|EXPORT|LIBRARY|MODULE') + r'ORG|ALIGN|STRUC|ENDSTRUC|COMMON|CPU|GROUP|UPPERCASE|IMPORT|' + r'EXPORT|LIBRARY|MODULE') flags = re.IGNORECASE | re.MULTILINE tokens = { @@ -292,10 +316,10 @@ class NasmLexer(RegexLexer): include('whitespace'), (r'^\s*%', Comment.Preproc, 'preproc'), (identifier + ':', Name.Label), - (directives, Keyword, 'instruction-args'), - (r'(%s)\s+(equ)' % identifier, - bygroups(Name.Constant, Keyword.Declaration), + (r'(%s)(\s+)(equ)' % identifier, + bygroups(Name.Constant, Keyword.Declaration, Keyword.Declaration), 'instruction-args'), + (directives, Keyword, 'instruction-args'), (declkw, Keyword.Declaration, 'instruction-args'), (identifier, Name.Function, 'instruction-args'), (r'[\r\n]+', Text) diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py index a6780fc..84ffd2b 100644 --- a/pygments/lexers/compiled.py +++ b/pygments/lexers/compiled.py @@ -5,7 +5,7 @@ Lexers for compiled languages. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -29,7 +29,7 @@ from pygments.lexers.functional import OcamlLexer __all__ = ['CLexer', 'CppLexer', 'DLexer', 'DelphiLexer', 'JavaLexer', 'ScalaLexer', 'DylanLexer', 'OcamlLexer', 'ObjectiveCLexer', 'FortranLexer', 'GLShaderLexer', 'PrologLexer', 'CythonLexer', - 'ValaLexer'] + 'ValaLexer', 'OocLexer', 'GoLexer'] class CLexer(RegexLexer): @@ -48,6 +48,7 @@ class CLexer(RegexLexer): 'whitespace': [ (r'^\s*#if\s+0', Comment.Preproc, 'if0'), (r'^\s*#', Comment.Preproc, 'macro'), + (r'^(\s*)([a-zA-Z_][a-zA-Z0-9_]*:(?!:))', bygroups(Text, Name.Label)), (r'\n', Text), (r'\s+', Text), (r'\\\n', Text), # line continuation @@ -74,7 +75,6 @@ class CLexer(RegexLexer): (r'__(asm|int8|based|except|int16|stdcall|cdecl|fastcall|int32|' r'declspec|finally|int64|try|leave)\b', Keyword.Reserved), (r'(true|false|NULL)\b', Name.Builtin), - ('[a-zA-Z_][a-zA-Z0-9_]*:(?!:)', Name.Label), ('[a-zA-Z_][a-zA-Z0-9_]*', Name), ], 'root': [ @@ -241,6 +241,8 @@ class CppLexer(RegexLexer): class DLexer(RegexLexer): """ For D source. + + *New in Pygments 1.2.* """ name = 'D' filenames = ['*.d', '*.di'] @@ -304,8 +306,8 @@ class DLexer(RegexLexer): # -- DoubleQuotedString (r'"(\\\\|\\"|[^"])*"[cwd]?', String), # -- EscapeSequence - (r"""\\(['"?\\abfnrtv]|x[0-9a-fA-F]{2}|[0-7]{1,3}""" - r"""|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|&\w+;)""", + (r"\\(['\"?\\abfnrtv]|x[0-9a-fA-F]{2}|[0-7]{1,3}" + r"|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|&\w+;)", String ), # -- HexString @@ -1661,3 +1663,130 @@ class ValaLexer(RegexLexer): (r'[a-zA-Z_][a-zA-Z0-9_.]*', Name.Namespace, '#pop') ], } + + +class OocLexer(RegexLexer): + """ + For `Ooc `_ source code + + *New in Pygments 1.2.* + """ + name = 'Ooc' + aliases = ['ooc'] + filenames = ['*.ooc'] + mimetypes = ['text/x-ooc'] + + tokens = { + 'root': [ + (r'\b(class|interface|implement|abstract|extends|from|' + r'this|super|new|const|final|static|import|use|extern|' + r'inline|proto|break|continue|fallthrough|operator|if|else|for|' + r'while|do|switch|case|as|in|version|return|true|false|null)\b', + Keyword), + (r'include\b', Keyword, 'include'), + (r'(cover)([ \t]+)(from)([ \t]+)([a-zA-Z0-9_]+[*@]?)', + bygroups(Keyword, Text, Keyword, Text, Name.Class)), + (r'(func)((?:[ \t]|\\\n)+)(~[a-z_][a-zA-Z0-9_]*)', + bygroups(Keyword, Text, Name.Function)), + (r'\bfunc\b', Keyword), + # Note: %= and ^= not listed on http://ooc-lang.org/syntax + (r'//.*', Comment), + (r'(?s)/\*.*?\*/', Comment.Multiline), + (r'(==?|\+=?|-[=>]?|\*=?|/=?|:=|!=?|%=?|\?|>{1,3}=?|<{1,3}=?|\.\.|' + r'&&?|\|\|?|\^=?)', Operator), + (r'(\.)([ \t]*)([a-z]\w*)', bygroups(Operator, Text, + Name.Function)), + (r'[A-Z][A-Z0-9_]+', Name.Constant), + (r'[A-Z][a-zA-Z0-9_]*([@*]|\[[ \t]*\])?', Name.Class), + + (r'([a-z][a-zA-Z0-9_]*(?:~[a-z][a-zA-Z0-9_]*)?)((?:[ \t]|\\\n)*)(?=\()', + bygroups(Name.Function, Text)), + (r'[a-z][a-zA-Z0-9_]*', Name.Variable), + + # : introduces types + (r'[:(){}\[\];,]', Punctuation), + + (r'0x[0-9a-fA-F]+', Number.Hex), + (r'0c[0-9]+', Number.Octal), + (r'0b[01]+', Number.Binary), + (r'[0-9_]\.[0-9_]*(?!\.)', Number.Float), + (r'[0-9_]+', Number.Decimal), + + (r'"(?:\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\"])*"', + String.Double), + (r"'(?:\\.|\\[0-9]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", + String.Char), + (r'@', Punctuation), # pointer dereference + (r'\.', Punctuation), # imports or chain operator + + (r'\\[ \t\n]', Text), + (r'[ \t]+', Text), + ], + 'include': [ + (r'[\w/]+', Name), + (r',', Punctuation), + (r'[ \t]', Text), + (r'[;\n]', Text, '#pop'), + ], + } + + +class GoLexer(RegexLexer): + """ + For `Go `_ source. + """ + name = 'Go' + filenames = ['*.go'] + aliases = ['go'] + mimetypes = ['text/x-gosrc'] + + tokens = { + 'root': [ + (r'\n', Text), + (r'\s+', Text), + (r'\\\n', Text), # line continuations + (r'//(.*?)\n', Comment.Single), + (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), + (r'(break|default|func|interface|select' + r'|case|defer|go|map|struct' + r'|chan|else|goto|package|switch' + r'|const|fallthrough|if|range|type' + r'|continue|for|import|return|var)\b', Keyword + ), + # It seems the builtin types aren't actually keywords. + (r'(uint8|uint16|uint32|uint64' + r'|int8|int16|int32|int64' + r'|float32|float64|byte' + r'|uint|int|float|uintptr' + r'|string|close|closed|len|cap|new|make)\b', Name.Builtin + ), + # float_lit + (r'\d+(\.\d+[eE][+\-]?\d+|' + r'\.\d*|[eE][+\-]?\d+)', Number.Float), + (r'\.\d+([eE][+\-]?\d+)?', Number.Float), + # int_lit + # -- octal_lit + (r'0[0-7]+', Number.Oct), + # -- hex_lit + (r'0[xX][0-9a-fA-F]+', Number.Hex), + # -- decimal_lit + (r'(0|[1-9][0-9]*)', Number.Integer), + # char_lit + (r"""'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}""" + r"""|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'""", + String.Char + ), + # StringLiteral + # -- raw_string_lit + (r'`[^`]*`', String), + # -- interpreted_string_lit + (r'"(\\\\|\\"|[^"])*"', String), + # Tokens + (r'(<<=|>>=|<<|>>|<=|>=|&\^=|&\^|\+=|-=|\*=|/=|%=|&=|\|=|&&|\|\|' + r'|<-|\+\+|--|==|!=|:=|\.\.\.)|[+\-*/%&|^<>=!()\[\]{}.,;:]', + Punctuation + ), + # identifier + (r'[a-zA-Z_]\w*', Name), + ] + } diff --git a/pygments/lexers/dotnet.py b/pygments/lexers/dotnet.py index 4b03bea..0867cdb 100644 --- a/pygments/lexers/dotnet.py +++ b/pygments/lexers/dotnet.py @@ -5,7 +5,7 @@ Lexers for .net languages. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re diff --git a/pygments/lexers/functional.py b/pygments/lexers/functional.py index 50974d1..5c035bb 100644 --- a/pygments/lexers/functional.py +++ b/pygments/lexers/functional.py @@ -5,7 +5,7 @@ Lexers for functional languages. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -443,7 +443,7 @@ class HaskellLexer(RegexLexer): (r'o[0-7]+', String.Escape, '#pop'), (r'x[\da-fA-F]+', String.Escape, '#pop'), (r'\d+', String.Escape, '#pop'), - (r'\n\s+\\', String.Escape, '#pop'), + (r'\s+\\', String.Escape, '#pop'), ], } diff --git a/pygments/lexers/math.py b/pygments/lexers/math.py index 75da52f..79097f2 100644 --- a/pygments/lexers/math.py +++ b/pygments/lexers/math.py @@ -5,7 +5,7 @@ Lexers for math languages. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/lexers/other.py b/pygments/lexers/other.py index 735caa6..d3eac45 100644 --- a/pygments/lexers/other.py +++ b/pygments/lexers/other.py @@ -5,7 +5,7 @@ Lexers for other languages. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -24,7 +24,7 @@ __all__ = ['SqlLexer', 'MySqlLexer', 'SqliteConsoleLexer', 'BrainfuckLexer', 'MOOCodeLexer', 'SmalltalkLexer', 'TcshLexer', 'LogtalkLexer', 'GnuplotLexer', 'PovrayLexer', 'AppleScriptLexer', 'BashSessionLexer', 'ModelicaLexer', 'RebolLexer', 'ABAPLexer', - 'NewspeakLexer'] + 'NewspeakLexer', 'GherkinLexer', 'AsymptoteLexer'] line_re = re.compile('.*?\n') @@ -808,7 +808,8 @@ class LogtalkLexer(RegexLexer): # Reflection (r'(current_predicate|predicate_property)(?=[(])', Keyword), # DCGs and term expansion - (r'(expand_term|(goal|term)_expansion|phrase)(?=[(])', Keyword), + (r'(expand_(goal|term)|(goal|term)_expansion|phrase)(?=[(])', + Keyword), # Entity (r'(abolish|c(reate|urrent))_(object|protocol|category)(?=[(])', Keyword), @@ -921,19 +922,22 @@ class LogtalkLexer(RegexLexer): ], 'directive': [ + # Conditional compilation directives + (r'(el)?if(?=[(])', Keyword, 'root'), + (r'(e(lse|ndif))[.]', Keyword, 'root'), # Entity directives (r'(category|object|protocol)(?=[(])', Keyword, 'entityrelations'), (r'(end_(category|object|protocol))[.]',Keyword, 'root'), # Predicate scope directives (r'(public|protected|private)(?=[(])', Keyword, 'root'), # Other directives - (r'e(ncoding|xport)(?=[(])', Keyword, 'root'), + (r'e(n(coding|sure_loaded)|xport)(?=[(])', Keyword, 'root'), (r'in(fo|itialization)(?=[(])', Keyword, 'root'), (r'(dynamic|synchronized|threaded)[.]', Keyword, 'root'), - (r'(alias|d(ynamic|iscontiguous)|m(eta_predicate|ode|ultifile)' - r'|synchronized)(?=[(])', Keyword, 'root'), + (r'(alias|d(ynamic|iscontiguous)|m(eta_predicate|ode|ultifile)|' + r's(et_(logtalk|prolog)_flag|ynchronized))(?=[(])', Keyword, 'root'), (r'op(?=[(])', Keyword, 'root'), - (r'(calls|use(s|_module))(?=[(])', Keyword, 'root'), + (r'(calls|reexport|use(s|_module))(?=[(])', Keyword, 'root'), (r'[a-z][a-zA-Z0-9_]*(?=[(])', Text, 'root'), (r'[a-z][a-zA-Z0-9_]*[.]', Text, 'root'), ], @@ -969,6 +973,15 @@ class LogtalkLexer(RegexLexer): ] } + def analyse_text(text): + if ':- object(' in text: + return True + if ':- protocol(' in text: + return True + if ':- category(' in text: + return True + return False + def _shortened(word): dpos = word.find('$') @@ -2080,3 +2093,210 @@ class NewspeakLexer(RegexLexer): ] } +class GherkinLexer(RegexLexer): + """ + For `Gherkin ` syntax. + + *New in Pygments 1.2.* + """ + name = 'Gherkin' + aliases = ['Cucumber', 'cucumber', 'Gherkin', 'gherkin'] + filenames = ['*.feature'] + mimetypes = ['text/x-gherkin'] + + feature_keywords_regexp = ur'^(기능|機能|功能|フィーチャ|خاصية|תכונה|Функционалност|Функционал|Особина|Могућност|Özellik|Właściwość|Tính năng|Savybė|Požiadavka|Požadavek|Osobina|Ominaisuus|Omadus|OH HAI|Mogućnost|Mogucnost|Jellemző|Fīča|Funzionalità|Funktionalität|Funkcionalnost|Funkcionalitāte|Funcționalitate|Functionaliteit|Functionalitate|Funcionalidade|Fonctionnalité|Fitur|Feature|Egenskap|Egenskab|Crikey|Característica|Arwedd)(:)(.*)$' + scenario_keywords_regexp = ur'^(\s*)(시나리오 개요|시나리오|배경|背景|場景大綱|場景|场景大纲|场景|劇本大綱|劇本|テンプレ|シナリオテンプレート|シナリオテンプレ|シナリオアウトライン|シナリオ|سيناريو مخطط|سيناريو|الخلفية|תרחיש|תבנית תרחיש|רקע|Тарих|Сценарио|Сценарий структураси|Сценарий|Структура сценарија|Структура сценария|Скица|Рамка на сценарий|Пример|Предыстория|Предистория|Позадина|Основа|Концепт|Контекст|Założenia|Tình huống|Tausta|Taust|Tapausaihio|Tapaus|Szenariogrundriss|Szenario|Szablon scenariusza|Stsenaarium|Struktura scenarija|Skica|Skenario konsep|Skenario|Situācija|Senaryo taslağı|Senaryo|Scénář|Scénario|Schema dello scenario|Scenārijs pēc parauga|Scenārijs|Scenár|Scenariusz|Scenariul de şablon|Scenariul de sablon|Scenariu|Scenario Outline|Scenario Amlinellol|Scenario|Scenarijus|Scenarijaus šablonas|Scenarij|Scenarie|Rerefons|Raamstsenaarium|Primer|Pozadí|Pozadina|Pozadie|Plan du scénario|Plan du Scénario|Osnova scénáře|Osnova|Náčrt Scénáře|Náčrt Scenáru|Mate|MISHUN SRSLY|MISHUN|Kịch bản|Kontext|Konteksts|Kontekstas|Kontekst|Koncept|Khung tình huống|Khung kịch bản|Háttér|Grundlage|Geçmiş|Forgatókönyv vázlat|Forgatókönyv|Esquema do Cenário|Esquema do Cenario|Esquema del escenario|Esquema de l\'escenari|Escenario|Escenari|Dasar|Contexto|Contexte|Contesto|Condiţii|Conditii|Cenário|Cenario|Cefndir|Bối cảnh|Blokes|Bakgrunn|Bakgrund|Baggrund|Background|B4|Antecedents|Antecedentes|All y\'all|Achtergrond|Abstrakt Scenario|Abstract Scenario)(:)(.*)$' + examples_regexp = ur'^(\s*)(예|例子|例|サンプル|امثلة|דוגמאות|Сценарији|Примери|Мисоллар|Значения|Örnekler|Voorbeelden|Variantai|Tapaukset|Scenarios|Scenariji|Scenarijai|Příklady|Példák|Príklady|Przykłady|Primjeri|Primeri|Piemēri|Pavyzdžiai|Paraugs|Juhtumid|Exemplos|Exemples|Exemplele|Exempel|Examples|Esempi|Enghreifftiau|Eksempler|Ejemplos|EXAMPLZ|Dữ liệu|Contoh|Cobber|Beispiele)(:)(.*)$' + step_keywords_regexp = ur'^(\s*)(하지만|조건|만일|그리고|그러면|那麼|那么|而且|當|当|前提|假設|假如|但是|但し|並且|もし|ならば|ただし|しかし|かつ|و |متى |لكن |عندما |ثم |بفرض |اذاً |כאשר |וגם |בהינתן |אזי |אז |אבל |Унда |То |Онда |Но |Лекин |Когато |Када |Кад |К тому же |И |Задато |Задати |Задате |Если |Допустим |Дадено |Ва |Бирок |Аммо |Али |Агар |А |Și |És |anrhegedig a |Zatati |Zakładając |Zadato |Zadate |Zadano |Zadani |Zadan |Yna |Ya know how |Ya gotta |Y |Wtedy |When y\'all |When |Wenn |WEN |Và |Ve |Und |Un |Thì |Then y\'all |Then |Tapi |Tak |Tada |Tad |Så |Soit |Siis |Si |Quando |Quand |Quan |Pryd |Pokud |Pokiaľ |Però |Pero |Pak |Oraz |Onda |Ond |Oletetaan |Og |Och |O zaman |Når |När |Niin |Nhưng |N |Mutta |Men |Mas |Maka |Majd |Mais |Maar |Ma |Lorsque |Lorsqu\'|Kun |Kuid |Kui |Khi |Keď |Ketika |Když |Kai |Kada |Kad |Jeżeli |Ja |Ir |I CAN HAZ |I |Ha |Givet |Given y\'all |Given |Gitt |Gegeven |Gegeben sei |Fakat |Eğer ki |Etant donné |Et |Então |Entonces |Entao |En |Eeldades |E |Duota |Donat |Donada |Diyelim ki |Dengan |De |Dato |Dar |Dann |Dan |Dado |Dacă |Daca |DEN |Când |Cuando |Cho |Cept |Cand |But y\'all |But |Biết |Bet |BUT |Atunci |And y\'all |And |Ama |Als |Alors |Allora |Ali |Aleshores |Ale |Akkor |Aber |AN |A také |A )' + + tokens = { + 'comments': [ + (r'#.*$', Comment), + ], + 'multiline_descriptions' : [ + (step_keywords_regexp, Keyword, "#pop"), + include('comments'), + (r"(\s|.)", Name.Constant), + ], + 'multiline_descriptions_on_stack' : [ + (step_keywords_regexp, Keyword, "#pop:2"), + include('comments'), + (r"(\s|.)", Name.Constant), + ], + 'scenario_table_description': [ + (r"\s+\|", Text, 'scenario_table_header'), + include('comments'), + (r"(\s|.)", Name.Constant), + ], + 'scenario_table_header': [ + (r"\s+\|\s*$", Text, "#pop:2"), + (r"(\s+\|\s*)(#.*)$", bygroups(Text, Comment), "#pop:2"), + include('comments'), + (r"\s+\|", Text), + (r"[^\|]", Name.Variable), + ], + 'scenario_sections_on_stack': [ + (scenario_keywords_regexp, + bygroups(Text, Name.Class, Name.Class, Name.Constant), + "multiline_descriptions_on_stack"), + ], + 'narrative': [ + include('scenario_sections_on_stack'), + (r"(\s|.)", Name.Builtin), + ], + 'table_vars': [ + (r'(<[^>]*>)', bygroups(Name.Variable)), + ], + 'string': [ + include('table_vars'), + (r'(\s|.)', String), + ], + 'py_string': [ + (r'"""', String, "#pop"), + include('string'), + ], + 'double_string': [ + (r'"', String, "#pop"), + include('string'), + ], + 'single_string': [ + (r"'", String, "#pop"), + include('string'), + ], + 'root': [ + (r'\n', Text), + include('comments'), + (r'"""', String, "py_string"), + (r'"', String, "double_string"), + (r"'", String, "single_string"), + include('table_vars'), + (r'@[^@\s]+', Name.Namespace), + (step_keywords_regexp, bygroups(Text, Keyword)), + (feature_keywords_regexp, + bygroups(Name.Class, Name.Class, Name.Constant), 'narrative'), + (scenario_keywords_regexp, + bygroups(Text, Name.Class, Name.Class, Name.Constant), + "multiline_descriptions"), + (examples_regexp, + bygroups(Text, Name.Class, Name.Class, Name.Constant), + "scenario_table_description"), + (r'(\s|.)', Text), + ] + } + + +class AsymptoteLexer(RegexLexer): + """ + For `Asymptote `_ source code. + + *New in Pygments 1.2.* + """ + name = 'Asymptote' + aliases = ['asy', 'asymptote'] + filenames = ['*.asy'] + mimetypes = ['text/x-asymptote'] + + #: optional Comment or Whitespace + _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+' + + tokens = { + 'whitespace': [ + (r'\n', Text), + (r'\s+', Text), + (r'\\\n', Text), # line continuation + (r'//(\n|(.|\n)*?[^\\]\n)', Comment), + (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment), + ], + 'statements': [ + # simple string (TeX friendly) + (r'"(\\\\|\\"|[^"])*"', String), + # C style string (with character escapes) + (r"'", String, 'string'), + (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float), + (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float), + (r'0x[0-9a-fA-F]+[Ll]?', Number.Hex), + (r'0[0-7]+[Ll]?', Number.Oct), + (r'\d+[Ll]?', Number.Integer), + (r'[~!%^&*+=|?:<>/-]', Operator), + (r'[()\[\],.]', Punctuation), + (r'\b(case)(.+?)(:)', bygroups(Keyword, using(this), Text)), + (r'(and|controls|tension|atleast|curl|if|else|while|for|do|' + r'return|break|continue|struct|typedef|new|access|import|' + r'unravel|from|include|quote|static|public|private|restricted|' + r'this|explicit|true|false|null|cycle|newframe|operator)\b', Keyword), + # Since an asy-type-name can be also an asy-function-name, + # in the following we test if the string " [a-zA-Z]" follows + # the Keyword.Type. + # Of course it is not perfect ! + (r'(Braid|FitResult|Label|Legend|TreeNode|abscissa|arc|arrowhead|' + r'binarytree|binarytreeNode|block|bool|bool3|bounds|bqe|circle|' + r'conic|coord|coordsys|cputime|ellipse|file|filltype|frame|grid3|' + r'guide|horner|hsv|hyperbola|indexedTransform|int|inversion|key|' + r'light|line|linefit|marginT|marker|mass|object|pair|parabola|path|' + r'path3|pen|picture|point|position|projection|real|revolution|' + r'scaleT|scientific|segment|side|slice|splitface|string|surface|' + r'tensionSpecifier|ticklocate|ticksgridT|tickvalues|transform|' + r'transformation|tree|triangle|trilinear|triple|vector|' + r'vertex|void)(?=([ ]{1,}[a-zA-Z]))', Keyword.Type), + # Now the asy-type-name which are not asy-function-name + # except yours ! + # Perhaps useless + (r'(Braid|FitResult|TreeNode|abscissa|arrowhead|block|bool|bool3|' + r'bounds|coord|frame|guide|horner|int|linefit|marginT|pair|pen|' + r'picture|position|real|revolution|slice|splitface|ticksgridT|' + r'tickvalues|tree|triple|vertex|void)\b', Keyword.Type), + ('[a-zA-Z_][a-zA-Z0-9_]*:(?!:)', Name.Label), + ('[a-zA-Z_][a-zA-Z0-9_]*', Name), + ], + 'root': [ + include('whitespace'), + # functions + (r'((?:[a-zA-Z0-9_*\s])+?(?:\s|[*]))' # return arguments + r'([a-zA-Z_][a-zA-Z0-9_]*)' # method name + r'(\s*\([^;]*?\))' # signature + r'(' + _ws + r')({)', + bygroups(using(this), Name.Function, using(this), using(this), + Punctuation), + 'function'), + # function declarations + (r'((?:[a-zA-Z0-9_*\s])+?(?:\s|[*]))' # return arguments + r'([a-zA-Z_][a-zA-Z0-9_]*)' # method name + r'(\s*\([^;]*?\))' # signature + r'(' + _ws + r')(;)', + bygroups(using(this), Name.Function, using(this), using(this), + Punctuation)), + ('', Text, 'statement'), + ], + 'statement' : [ + include('whitespace'), + include('statements'), + ('[{}]', Punctuation), + (';', Punctuation, '#pop'), + ], + 'function': [ + include('whitespace'), + include('statements'), + (';', Punctuation), + ('{', Punctuation, '#push'), + ('}', Punctuation, '#pop'), + ], + 'string': [ + (r"'", String, '#pop'), + (r'\\([\\abfnrtv"\'?]|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape), + (r'\n', String), + (r"[^\\'\n]+", String), # all other characters + (r'\\\n', String), + (r'\\n', String), # line continuation + (r'\\', String), # stray backslash + ] + } + + def get_tokens_unprocessed(self, text): + from pygments.lexers._asybuiltins import ASYFUNCNAME, ASYVARNAME + for index, token, value in \ + RegexLexer.get_tokens_unprocessed(self, text): + if token is Name and value in ASYFUNCNAME: + token = Name.Function + elif token is Name and value in ASYVARNAME: + token = Name.Variable + yield index, token, value diff --git a/pygments/lexers/parsers.py b/pygments/lexers/parsers.py index 07f2eca..15d58eb 100644 --- a/pygments/lexers/parsers.py +++ b/pygments/lexers/parsers.py @@ -5,7 +5,7 @@ Lexers for parser generators. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/lexers/special.py b/pygments/lexers/special.py index 31d01c9..bd200a7 100644 --- a/pygments/lexers/special.py +++ b/pygments/lexers/special.py @@ -5,7 +5,7 @@ Special lexers. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/lexers/templates.py b/pygments/lexers/templates.py index 9ae0c3a..49b843d 100644 --- a/pygments/lexers/templates.py +++ b/pygments/lexers/templates.py @@ -5,7 +5,7 @@ Lexers for various template engines' markup. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/lexers/text.py b/pygments/lexers/text.py index efc346d..8a35b31 100644 --- a/pygments/lexers/text.py +++ b/pygments/lexers/text.py @@ -5,7 +5,7 @@ Lexers for non-source code file types. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -28,7 +28,7 @@ __all__ = ['IniLexer', 'SourcesListLexer', 'BaseMakefileLexer', 'GroffLexer', 'ApacheConfLexer', 'BBCodeLexer', 'MoinWikiLexer', 'RstLexer', 'VimLexer', 'GettextLexer', 'SquidConfLexer', 'DebianControlLexer', 'DarcsPatchLexer', 'YamlLexer', - 'LighttpdConfLexer', 'NginxConfLexer'] + 'LighttpdConfLexer', 'NginxConfLexer', 'CMakeLexer'] class IniLexer(RegexLexer): @@ -1505,3 +1505,73 @@ class NginxConfLexer(RegexLexer): (r'\s+', Text), ], } + + +class CMakeLexer(RegexLexer): + """ + Lexer for `CMake `_ files. + + *New in Pygments 1.2.* + """ + name = 'CMake' + aliases = ['cmake'] + filenames = ['*.cmake'] + mimetypes = ['text/x-cmake'] + + tokens = { + 'root': [ + #(r'(ADD_CUSTOM_COMMAND|ADD_CUSTOM_TARGET|ADD_DEFINITIONS|' + # r'ADD_DEPENDENCIES|ADD_EXECUTABLE|ADD_LIBRARY|ADD_SUBDIRECTORY|' + # r'ADD_TEST|AUX_SOURCE_DIRECTORY|BUILD_COMMAND|BUILD_NAME|' + # r'CMAKE_MINIMUM_REQUIRED|CONFIGURE_FILE|CREATE_TEST_SOURCELIST|' + # r'ELSE|ELSEIF|ENABLE_LANGUAGE|ENABLE_TESTING|ENDFOREACH|' + # r'ENDFUNCTION|ENDIF|ENDMACRO|ENDWHILE|EXEC_PROGRAM|' + # r'EXECUTE_PROCESS|EXPORT_LIBRARY_DEPENDENCIES|FILE|FIND_FILE|' + # r'FIND_LIBRARY|FIND_PACKAGE|FIND_PATH|FIND_PROGRAM|FLTK_WRAP_UI|' + # r'FOREACH|FUNCTION|GET_CMAKE_PROPERTY|GET_DIRECTORY_PROPERTY|' + # r'GET_FILENAME_COMPONENT|GET_SOURCE_FILE_PROPERTY|' + # r'GET_TARGET_PROPERTY|GET_TEST_PROPERTY|IF|INCLUDE|' + # r'INCLUDE_DIRECTORIES|INCLUDE_EXTERNAL_MSPROJECT|' + # r'INCLUDE_REGULAR_EXPRESSION|INSTALL|INSTALL_FILES|' + # r'INSTALL_PROGRAMS|INSTALL_TARGETS|LINK_DIRECTORIES|' + # r'LINK_LIBRARIES|LIST|LOAD_CACHE|LOAD_COMMAND|MACRO|' + # r'MAKE_DIRECTORY|MARK_AS_ADVANCED|MATH|MESSAGE|OPTION|' + # r'OUTPUT_REQUIRED_FILES|PROJECT|QT_WRAP_CPP|QT_WRAP_UI|REMOVE|' + # r'REMOVE_DEFINITIONS|SEPARATE_ARGUMENTS|SET|' + # r'SET_DIRECTORY_PROPERTIES|SET_SOURCE_FILES_PROPERTIES|' + # r'SET_TARGET_PROPERTIES|SET_TESTS_PROPERTIES|SITE_NAME|' + # r'SOURCE_GROUP|STRING|SUBDIR_DEPENDS|SUBDIRS|' + # r'TARGET_LINK_LIBRARIES|TRY_COMPILE|TRY_RUN|UNSET|' + # r'USE_MANGLED_MESA|UTILITY_SOURCE|VARIABLE_REQUIRES|' + # r'VTK_MAKE_INSTANTIATOR|VTK_WRAP_JAVA|VTK_WRAP_PYTHON|' + # r'VTK_WRAP_TCL|WHILE|WRITE_FILE|' + # r'COUNTARGS)\b', Name.Builtin, 'args'), + (r'\b([A-Za-z_]+)([ \t]*)(\()', bygroups(Name.Builtin, Text, + Punctuation), 'args'), + include('keywords'), + include('ws') + ], + 'args': [ + (r'\(', Punctuation, '#push'), + (r'\)', Punctuation, '#pop'), + (r'(\${)(.+?)(})', bygroups(Operator, Name.Variable, Operator)), + (r'(?s)".*?"', String.Double), + (r'\\\S+', String), + (r'[^\)$"# \t\n]+', String), + (r'\n', Text), # explicitly legal + include('keywords'), + include('ws') + ], + 'string': [ + + ], + 'keywords': [ + (r'\b(WIN32|UNIX|APPLE|CYGWIN|BORLAND|MINGW|MSVC|MSVC_IDE|MSVC60|' + r'MSVC70|MSVC71|MSVC80|MSVC90)\b', Keyword), + ], + 'ws': [ + (r'[ \t]+', Text), + (r'#.+\n', Comment), + ] + } + diff --git a/pygments/lexers/web.py b/pygments/lexers/web.py index c522961..598611d 100644 --- a/pygments/lexers/web.py +++ b/pygments/lexers/web.py @@ -5,7 +5,7 @@ Lexers for web-related languages and markup. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/plugin.py b/pygments/plugin.py index 60edf39..cb59c9e 100644 --- a/pygments/plugin.py +++ b/pygments/plugin.py @@ -32,7 +32,7 @@ yourfilter = yourfilter:YourFilter - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ try: diff --git a/pygments/scanner.py b/pygments/scanner.py index 8d633f7..a486f05 100644 --- a/pygments/scanner.py +++ b/pygments/scanner.py @@ -12,7 +12,7 @@ Have a look at the `DelphiLexer` to get an idea of how to use this scanner. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re diff --git a/pygments/style.py b/pygments/style.py index 8a04dcb..7bb1f3f 100644 --- a/pygments/style.py +++ b/pygments/style.py @@ -5,7 +5,7 @@ Basic style object. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/__init__.py b/pygments/styles/__init__.py index f7dc699..429028e 100644 --- a/pygments/styles/__init__.py +++ b/pygments/styles/__init__.py @@ -5,7 +5,7 @@ Contains built-in styles. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -22,6 +22,7 @@ STYLE_MAP = { 'autumn': 'autumn::AutumnStyle', 'murphy': 'murphy::MurphyStyle', 'manni': 'manni::ManniStyle', + 'monokai': 'monokai::MonokaiStyle', 'perldoc': 'perldoc::PerldocStyle', 'pastie': 'pastie::PastieStyle', 'borland': 'borland::BorlandStyle', diff --git a/pygments/styles/autumn.py b/pygments/styles/autumn.py index 8a32bb3..c494ec4 100644 --- a/pygments/styles/autumn.py +++ b/pygments/styles/autumn.py @@ -5,7 +5,7 @@ A colorful style, inspired by the terminal highlighting style. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/borland.py b/pygments/styles/borland.py index 4d1e14f..8d4ca08 100644 --- a/pygments/styles/borland.py +++ b/pygments/styles/borland.py @@ -5,7 +5,7 @@ Style similar to the style used in the Borland IDEs. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/bw.py b/pygments/styles/bw.py index e7886a9..805bcf8 100644 --- a/pygments/styles/bw.py +++ b/pygments/styles/bw.py @@ -5,7 +5,7 @@ Simple black/white only style. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/colorful.py b/pygments/styles/colorful.py index 3c50e26..e9fb60b 100644 --- a/pygments/styles/colorful.py +++ b/pygments/styles/colorful.py @@ -5,7 +5,7 @@ A colorful style, inspired by CodeRay. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/default.py b/pygments/styles/default.py index 21a088c..a494dba 100644 --- a/pygments/styles/default.py +++ b/pygments/styles/default.py @@ -5,7 +5,7 @@ The default highlighting style. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/emacs.py b/pygments/styles/emacs.py index 6f1e28c..6283fed 100644 --- a/pygments/styles/emacs.py +++ b/pygments/styles/emacs.py @@ -5,7 +5,7 @@ A highlighting style for Pygments, inspired by Emacs. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/friendly.py b/pygments/styles/friendly.py index 2807515..d5393d2 100644 --- a/pygments/styles/friendly.py +++ b/pygments/styles/friendly.py @@ -5,7 +5,7 @@ A modern style based on the VIM pyte theme. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/fruity.py b/pygments/styles/fruity.py index 8057f99..5eb4dec 100644 --- a/pygments/styles/fruity.py +++ b/pygments/styles/fruity.py @@ -5,7 +5,7 @@ pygments version of my "fruity" vim theme. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/manni.py b/pygments/styles/manni.py index d004a70..0537c9e 100644 --- a/pygments/styles/manni.py +++ b/pygments/styles/manni.py @@ -8,7 +8,7 @@ This is a port of the style used in the `php port`_ of pygments by Manni. The style is called 'default' there. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/monokai.py b/pygments/styles/monokai.py new file mode 100644 index 0000000..90c3664 --- /dev/null +++ b/pygments/styles/monokai.py @@ -0,0 +1,106 @@ +# -*- coding: utf-8 -*- +""" + pygments.styles.monokai + ~~~~~~~~~~~~~~~~~~~~~~~ + + Mimic the Monokai color scheme. Based on tango.py. + + http://www.monokai.nl/blog/2006/07/15/textmate-color-theme/ + + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.style import Style +from pygments.token import Keyword, Name, Comment, String, Error, Text, \ + Number, Operator, Generic, Whitespace, Punctuation, Other, Literal + +class MonokaiStyle(Style): + """ + This style mimics the Monokai color scheme. + """ + + background_color = "#272822" + highlight_color = "#49483e" + + styles = { + # No corresponding class for the following: + Text: "#f8f8f2", # class: '' + Whitespace: "", # class: 'w' + Error: "#960050 bg:#1e0010", # class: 'err' + Other: "", # class 'x' + + Comment: "#75715e", # class: 'c' + Comment.Multiline: "", # class: 'cm' + Comment.Preproc: "", # class: 'cp' + Comment.Single: "", # class: 'c1' + Comment.Special: "", # class: 'cs' + + Keyword: "#66d9ef", # class: 'k' + Keyword.Constant: "", # class: 'kc' + Keyword.Declaration: "", # class: 'kd' + Keyword.Namespace: "#f92672", # class: 'kn' + Keyword.Pseudo: "", # class: 'kp' + Keyword.Reserved: "", # class: 'kr' + Keyword.Type: "", # class: 'kt' + + Operator: "#f92672", # class: 'o' + Operator.Word: "", # class: 'ow' - like keywords + + Punctuation: "#f8f8f2", # class: 'p' + + Name: "#f8f8f2", # class: 'n' + Name.Attribute: "#a6e22e", # class: 'na' - to be revised + Name.Builtin: "", # class: 'nb' + Name.Builtin.Pseudo: "", # class: 'bp' + Name.Class: "#a6e22e", # class: 'nc' - to be revised + Name.Constant: "#66d9ef", # class: 'no' - to be revised + Name.Decorator: "#a6e22e", # class: 'nd' - to be revised + Name.Entity: "", # class: 'ni' + Name.Exception: "#a6e22e", # class: 'ne' + Name.Function: "#a6e22e", # class: 'nf' + Name.Property: "", # class: 'py' + Name.Label: "", # class: 'nl' + Name.Namespace: "", # class: 'nn' - to be revised + Name.Other: "#a6e22e", # class: 'nx' + Name.Tag: "#f92672", # class: 'nt' - like a keyword + Name.Variable: "", # class: 'nv' - to be revised + Name.Variable.Class: "", # class: 'vc' - to be revised + Name.Variable.Global: "", # class: 'vg' - to be revised + Name.Variable.Instance: "", # class: 'vi' - to be revised + + Number: "#ae81ff", # class: 'm' + Number.Float: "", # class: 'mf' + Number.Hex: "", # class: 'mh' + Number.Integer: "", # class: 'mi' + Number.Integer.Long: "", # class: 'il' + Number.Oct: "", # class: 'mo' + + Literal: "#ae81ff", # class: 'l' + Literal.Date: "#e6db74", # class: 'ld' + + String: "#e6db74", # class: 's' + String.Backtick: "", # class: 'sb' + String.Char: "", # class: 'sc' + String.Doc: "", # class: 'sd' - like a comment + String.Double: "", # class: 's2' + String.Escape: "#ae81ff", # class: 'se' + String.Heredoc: "", # class: 'sh' + String.Interpol: "", # class: 'si' + String.Other: "", # class: 'sx' + String.Regex: "", # class: 'sr' + String.Single: "", # class: 's1' + String.Symbol: "", # class: 'ss' + + Generic: "", # class: 'g' + Generic.Deleted: "", # class: 'gd', + Generic.Emph: "italic", # class: 'ge' + Generic.Error: "", # class: 'gr' + Generic.Heading: "", # class: 'gh' + Generic.Inserted: "", # class: 'gi' + Generic.Output: "", # class: 'go' + Generic.Prompt: "", # class: 'gp' + Generic.Strong: "bold", # class: 'gs' + Generic.Subheading: "", # class: 'gu' + Generic.Traceback: "", # class: 'gt' + } diff --git a/pygments/styles/murphy.py b/pygments/styles/murphy.py index 5a3b7fc..01eeff3 100644 --- a/pygments/styles/murphy.py +++ b/pygments/styles/murphy.py @@ -5,7 +5,7 @@ Murphy's style from CodeRay. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/native.py b/pygments/styles/native.py index c216c83..7c552ec 100644 --- a/pygments/styles/native.py +++ b/pygments/styles/native.py @@ -5,7 +5,7 @@ pygments version of my "native" vim theme. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/pastie.py b/pygments/styles/pastie.py index 13bf8b7..2ca5423 100644 --- a/pygments/styles/pastie.py +++ b/pygments/styles/pastie.py @@ -7,7 +7,7 @@ .. _pastie: http://pastie.caboo.se/ - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/perldoc.py b/pygments/styles/perldoc.py index 0a2503f..89388ad 100644 --- a/pygments/styles/perldoc.py +++ b/pygments/styles/perldoc.py @@ -7,7 +7,7 @@ .. _perldoc: http://perldoc.perl.org/ - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/tango.py b/pygments/styles/tango.py index b1b8caf..933cdad 100644 --- a/pygments/styles/tango.py +++ b/pygments/styles/tango.py @@ -33,7 +33,7 @@ have been chosen to have the same style. Similarly, keywords (Keyword.*), and Operator.Word (and, or, in) have been assigned the same style. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -55,87 +55,87 @@ class TangoStyle(Style): styles = { # No corresponding class for the following: - #Text: "", # class: '', - Whitespace: "underline #f8f8f8", # class: 'w', - Error: "#a40000 border:#ef2929", # class: 'err', - Other: "#000000", # class 'x', - - Comment: "italic #8f5902", # class: 'c', - Comment.Multiline: "italic #8f5902", # class: 'cm', - Comment.Preproc: "italic #8f5902", # class: 'cp', - Comment.Single: "italic #8f5902", # class: 'c1', - Comment.Special: "italic #8f5902", # class: 'cs', - - Keyword: "bold #204a87", # class: 'k', - Keyword.Constant: "bold #204a87", # class: 'kc', - Keyword.Declaration: "bold #204a87", # class: 'kd', - Keyword.Namespace: "bold #204a87", # class: 'kn', - Keyword.Pseudo: "bold #204a87", # class: 'kp', - Keyword.Reserved: "bold #204a87", # class: 'kr', - Keyword.Type: "bold #204a87", # class: 'kt', - - Operator: "bold #ce5c00", # class: 'o' - Operator.Word: "bold #204a87", # class: 'ow' - like keywords - - Punctuation: "bold #000000", # class: 'p' + #Text: "", # class: '' + Whitespace: "underline #f8f8f8", # class: 'w' + Error: "#a40000 border:#ef2929", # class: 'err' + Other: "#000000", # class 'x' + + Comment: "italic #8f5902", # class: 'c' + Comment.Multiline: "italic #8f5902", # class: 'cm' + Comment.Preproc: "italic #8f5902", # class: 'cp' + Comment.Single: "italic #8f5902", # class: 'c1' + Comment.Special: "italic #8f5902", # class: 'cs' + + Keyword: "bold #204a87", # class: 'k' + Keyword.Constant: "bold #204a87", # class: 'kc' + Keyword.Declaration: "bold #204a87", # class: 'kd' + Keyword.Namespace: "bold #204a87", # class: 'kn' + Keyword.Pseudo: "bold #204a87", # class: 'kp' + Keyword.Reserved: "bold #204a87", # class: 'kr' + Keyword.Type: "bold #204a87", # class: 'kt' + + Operator: "bold #ce5c00", # class: 'o' + Operator.Word: "bold #204a87", # class: 'ow' - like keywords + + Punctuation: "bold #000000", # class: 'p' # because special names such as Name.Class, Name.Function, etc. # are not recognized as such later in the parsing, we choose them # to look the same as ordinary variables. - Name: "#000000", # class: 'n' - Name.Attribute: "#c4a000", # class: 'na', - to be revised - Name.Builtin: "#204a87", # class: 'nb' - Name.Builtin.Pseudo: "#3465a4", # class: 'bp' - Name.Class: "#000000", # class: 'nc' - to be revised - Name.Constant: "#000000", # class: 'no', - to be revised - Name.Decorator: "bold #5c35cc", # class: 'nd', - to be revised - Name.Entity: "#ce5c00", # class: 'ni', - Name.Exception: "bold #cc0000", # class: 'ne', - Name.Function: "#000000", # class: 'nf' - Name.Property: "#000000", # class: 'py', - Name.Label: "#f57900", # class: 'nl', - Name.Namespace: "#000000", # class: 'nn' - to be revised - Name.Other: "#000000", # class: 'nx', - Name.Tag: "bold #204a87", # class'nt' -- like a keyword - Name.Variable: "#000000", # class: 'nv', - to be revised - Name.Variable.Class: "#000000", # class: 'vc', - to be revised - Name.Variable.Global: "#000000", # class: 'vg', - to be revised - Name.Variable.Instance: "#000000", # class: 'vi', - to be revised + Name: "#000000", # class: 'n' + Name.Attribute: "#c4a000", # class: 'na' - to be revised + Name.Builtin: "#204a87", # class: 'nb' + Name.Builtin.Pseudo: "#3465a4", # class: 'bp' + Name.Class: "#000000", # class: 'nc' - to be revised + Name.Constant: "#000000", # class: 'no' - to be revised + Name.Decorator: "bold #5c35cc", # class: 'nd' - to be revised + Name.Entity: "#ce5c00", # class: 'ni' + Name.Exception: "bold #cc0000", # class: 'ne' + Name.Function: "#000000", # class: 'nf' + Name.Property: "#000000", # class: 'py' + Name.Label: "#f57900", # class: 'nl' + Name.Namespace: "#000000", # class: 'nn' - to be revised + Name.Other: "#000000", # class: 'nx' + Name.Tag: "bold #204a87", # class: 'nt' - like a keyword + Name.Variable: "#000000", # class: 'nv' - to be revised + Name.Variable.Class: "#000000", # class: 'vc' - to be revised + Name.Variable.Global: "#000000", # class: 'vg' - to be revised + Name.Variable.Instance: "#000000", # class: 'vi' - to be revised # since the tango light blue does not show up well in text, we choose # a pure blue instead. - Number: "bold #0000cf", # class: 'm' - Number.Float: "bold #0000cf", # class: ''mf', - Number.Hex: "bold #0000cf", # class: ''mh', - Number.Integer: "bold #0000cf", # class: ''mi', - Number.Integer.Long: "bold #0000cf", # class: ''il', - Number.Oct: "bold #0000cf", # class: ''mo', - - Literal: "#000000", # class: 'l', - Literal.Date: "#000000", # class: 'ld', - - String: "#4e9a06", # class: 's', - String.Backtick: "#4e9a06", # class: 'sb', - String.Char: "#4e9a06", # class: 'sc', - String.Doc: "italic #8f5902", # class: 'sd' - like a comment - String.Double: "#4e9a06", # class: 's2', - String.Escape: "#4e9a06", # class: 'se', - String.Heredoc: "#4e9a06", # class: 'sh', - String.Interpol: "#4e9a06", # class: 'si', - String.Other: "#4e9a06", # class: 'sx', - String.Regex: "#4e9a06", # class: 'sr', - String.Single: "#4e9a06", # class: 's1', - String.Symbol: "#4e9a06", # class: 'ss', - - Generic: "#000000", # class: 'g', - Generic.Deleted: "#a40000", # class: 'gd', - Generic.Emph: "italic #000000", # class: 'ge', - Generic.Error: "#ef2929", # class: 'gr', - Generic.Heading: "bold #000080", # class: 'gh', - Generic.Inserted: "#00A000", # class: 'gi', - Generic.Output: "italic #000000", # class: 'go', - Generic.Prompt: "#8f5902", # class: 'gp', - Generic.Strong: "bold #000000", # class: 'gs', - Generic.Subheading: "bold #800080", # class: 'gu', - Generic.Traceback: "bold #a40000", # class: 'gt', + Number: "bold #0000cf", # class: 'm' + Number.Float: "bold #0000cf", # class: 'mf' + Number.Hex: "bold #0000cf", # class: 'mh' + Number.Integer: "bold #0000cf", # class: 'mi' + Number.Integer.Long: "bold #0000cf", # class: 'il' + Number.Oct: "bold #0000cf", # class: 'mo' + + Literal: "#000000", # class: 'l' + Literal.Date: "#000000", # class: 'ld' + + String: "#4e9a06", # class: 's' + String.Backtick: "#4e9a06", # class: 'sb' + String.Char: "#4e9a06", # class: 'sc' + String.Doc: "italic #8f5902", # class: 'sd' - like a comment + String.Double: "#4e9a06", # class: 's2' + String.Escape: "#4e9a06", # class: 'se' + String.Heredoc: "#4e9a06", # class: 'sh' + String.Interpol: "#4e9a06", # class: 'si' + String.Other: "#4e9a06", # class: 'sx' + String.Regex: "#4e9a06", # class: 'sr' + String.Single: "#4e9a06", # class: 's1' + String.Symbol: "#4e9a06", # class: 'ss' + + Generic: "#000000", # class: 'g' + Generic.Deleted: "#a40000", # class: 'gd' + Generic.Emph: "italic #000000", # class: 'ge' + Generic.Error: "#ef2929", # class: 'gr' + Generic.Heading: "bold #000080", # class: 'gh' + Generic.Inserted: "#00A000", # class: 'gi' + Generic.Output: "italic #000000", # class: 'go' + Generic.Prompt: "#8f5902", # class: 'gp' + Generic.Strong: "bold #000000", # class: 'gs' + Generic.Subheading: "bold #800080", # class: 'gu' + Generic.Traceback: "bold #a40000", # class: 'gt' } diff --git a/pygments/styles/trac.py b/pygments/styles/trac.py index 3e40715..f825713 100644 --- a/pygments/styles/trac.py +++ b/pygments/styles/trac.py @@ -5,7 +5,7 @@ Port of the default trac highlighter design. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/vim.py b/pygments/styles/vim.py index b7db5f8..0456287 100644 --- a/pygments/styles/vim.py +++ b/pygments/styles/vim.py @@ -5,7 +5,7 @@ A highlighting style for Pygments, inspired by vim. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/styles/vs.py b/pygments/styles/vs.py index 55deac1..7fbca3e 100644 --- a/pygments/styles/vs.py +++ b/pygments/styles/vs.py @@ -5,7 +5,7 @@ Simple style with MS Visual Studio colors. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/token.py b/pygments/token.py index c524bb6..f0a6541 100644 --- a/pygments/token.py +++ b/pygments/token.py @@ -5,7 +5,7 @@ Basic token types and the standard tokens. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ try: diff --git a/pygments/unistring.py b/pygments/unistring.py index 41b333e..8144a27 100644 --- a/pygments/unistring.py +++ b/pygments/unistring.py @@ -8,7 +8,7 @@ Inspired by chartypes_create.py from the MoinMoin project. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.util import u_prefix diff --git a/pygments/util.py b/pygments/util.py index ac9babc..fc65b67 100644 --- a/pygments/util.py +++ b/pygments/util.py @@ -5,7 +5,7 @@ Utility functions. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re diff --git a/scripts/check_sources.py b/scripts/check_sources.py index 35adc37..c98a4a5 100755 --- a/scripts/check_sources.py +++ b/scripts/check_sources.py @@ -7,7 +7,7 @@ Make sure each Python file has a correct file header including copyright and license information. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -30,7 +30,7 @@ def checker(*suffixes, **kwds): name_mail_re = r'[\w ]+(<.*?>)?' -copyright_re = re.compile(r'^ :copyright: Copyright 2006-2009 by the Pygments team, ' +copyright_re = re.compile(r'^ :copyright: Copyright 2006-2010 by the Pygments team, ' r'see AUTHORS\.$', re.UNICODE) copyright_2_re = re.compile(r'^ %s(, %s)*[,.]$' % (name_mail_re, name_mail_re), re.UNICODE) diff --git a/scripts/find_codetags.py b/scripts/find_codetags.py index e680d1b..d78e4a7 100755 --- a/scripts/find_codetags.py +++ b/scripts/find_codetags.py @@ -7,7 +7,7 @@ Find code tags in specified files and/or directories and create a report in HTML format. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/scripts/find_error.py b/scripts/find_error.py index 44dd053..a3cdad4 100644 --- a/scripts/find_error.py +++ b/scripts/find_error.py @@ -8,7 +8,7 @@ the text where Error tokens are being generated, along with some context. - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/setup.py b/setup.py index b54823e..45537a4 100755 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ .. _Pygments tip: http://dev.pocoo.org/hg/pygments-main/archive/tip.tar.gz#egg=Pygments-dev - :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -46,7 +46,7 @@ except ImportError: setup( name = 'Pygments', - version = '1.1.1', + version = '1.2', url = 'http://pygments.org/', license = 'BSD License', author = 'Georg Brandl', diff --git a/tests/examplefiles/broken/fucked_up.rb b/tests/examplefiles/broken/fucked_up.rb deleted file mode 100644 index b1d0ee3..0000000 --- a/tests/examplefiles/broken/fucked_up.rb +++ /dev/null @@ -1,77 +0,0 @@ -# vim:ft=ruby - -events = Hash.new { |h, k| h[k] = [] } -DATA.read.split(/\n\n\n\s*/).each do |event| - name = event[/^.*/].sub(/http:.*/, '') - event[/\n.*/m].scan(/^([A-Z]{2}\S*)\s*(\S*)\s*(\S*)(\s*\S*)/) do |kind, day, daytime, comment| - events[ [day, daytime] ] << [kind, name + comment] - end -end - -conflicts = 0 -events.to_a.sort_by do |(day, daytime),| - [%w(Mo Di Mi Do Fr).index(day) || 0, daytime] -end.each do |(day, daytime), names| - if names.size > 1 - conflicts += 1 - print '!!! ' - end - print "#{day} #{daytime}: " - names.each { |kind, name| puts " #{kind} #{name}" } - puts -end - -puts '%d conflicts' % conflicts -puts '%d SWS' % (events.inject(0) { |sum, ((day, daytime),)| sum + (daytime[/\d+$/].to_i - daytime[/^\d+/].to_i) }) - -string = % foo # strange. huh? -print "Escape here: \n" -print 'Dont escape here: \n' - -__END__ -Informatik und Informationsgesellschaft I: Digitale Medien (32 214) -Computer lassen ihre eigentliche Bestimmung durch Multimedia und Vernetzung erkennen: Es sind digitale Medien, die alle bisherigen Massen- und Kommunikationsmedien simulieren, kopieren oder ersetzen können. Die kurze Geschichte elektronischer Medien vom Telegramm bis zum Fernsehen wird so zur Vorgeschichte des Computers als Medium. Der Prozess der Mediatisierung der Rechnernetze soll in Technik, Theorie und Praxis untersucht werden. Das PR soll die Techniken der ortsverteilten und zeitversetzten Lehre an Hand praktischer Übungen vorführen und untersuchen. -VL Di 15-17 wöch. RUD 25, 3.101 J. Koubek -VL Do 15-17 wöch. RUD 25, 3.101 -UE/PR Do 17-19 wöch. RUD 25, 3.101 J.-M. Loebel - - -Methoden und Modelle des Systementwurfs (32 223) -Gute Methoden zum Entwurf und zur Verifikation von Systemen sind ein Schlüssel für gute Software. Dieses Seminar betrachtet moderne Entwurfsmethoden. - VL Di 09-11 wöch. RUD 26, 0’313 W. Reisig - VL Do 09-11 wöch. RUD 26, 0’313 - UE Di 11-13 wöch. RUD 26, 0’313 - PR Di 13-15 wöch. RUD 26, 0’313 D. Weinberg - - -Komplexitätstheorie (32 229) -In dieser Vorlesung untersuchen wir eine Reihe von wichtigen algorithmischen Problemstellungen aus verschiedenen Bereichen der Informatik. Unser besonderes Interesse gilt dabei der Abschätzung der Rechenressourcen, die zu ihrer Lösung aufzubringen sind. Die Vorlesung bildet eine wichtige Grundlage für weiterführende Veranstaltungen in den Bereichen Algorithmen, Kryptologie, Algorithmisches Lernen und Algorithmisches Beweisen. - VL Di 09-11 wöch. RUD 26, 1’303 J. Köbler - VL Do 09-11 wöch. RUD 26, 1’305 - UE Do 11-13 wöch. RUD 26, 1’305 - - -Zuverlässige Systeme (32 234) -Mit zunehmender Verbreitung der Computertechnologie in immer mehr Bereichen des menschlichen Lebens wird die Zuverlässigkeit solcher Systeme zu einer immer zentraleren Frage. -Der Halbkurs "Zuverlässige Systeme" konzentriert sich auf folgende Schwerpunkte: Zuverlässigkeit, Fehlertoleranz, Responsivität, Messungen, Anwendungen, Systemmodelle und Techniken, Ausfallverhalten, Fehlermodelle, Schedulingtechniken, Software/Hardware - responsives Systemdesign, Analyse und Synthese, Bewertung, Fallstudien in Forschung und Industrie. -Der Halbkurs kann mit dem Halbkurs "Eigenschaften mobiler und eingebetteter Systeme" zu einem Projektkurs kombiniert werden. Ein gemeinsames Projekt begleitet beide Halbkurse. -VL Di 09-11 wöch. RUD 26, 1’308 M. Malek -VL Do 09-11 wöch. RUD 26, 1’308 -PR n.V. - - -Stochastik für InformatikerInnen (32 239) -Grundlagen der Wahrscheinlichkeitsrechnung, Diskrete und stetige Wahrscheinlichkeitsmodelle in der Informatik, Grenzwertsätze, Simulationsverfahren, Zufallszahlen, Statistische Schätz- und Testverfahren, Markoffsche Ketten, Simulated Annealing, Probabilistische Analyse von Algorithmen. -VL Mo 09-11 wöch. RUD 25, 3.101 W. Kössler -VL Mi 09-11 wöch. RUD 25, 3.101 -UE Mo 11-13 wöch. RUD 25, 3.101 - UE Mi 11-13 wöch. RUD 25. 3.101 - - -Geschichte der Informatik – Ausgewählte Kapitel (32 243) -VL Mi 13-15 wöch. RUD 25, 3.113 W. Coy - - -Aktuelle Themen der Theoretischen Informatik (32 260) -In diesem Seminar sollen wichtige aktuelle Veröffentlichungen aus der theoretischen Informatik gemeinsam erarbeitet werden. Genaueres wird erst kurz vor dem Seminar entschieden. Bei Interesse wenden Sie sich bitte möglichst frühzeitig an den Veranstalter. - SE Fr 09-11 wöch. RUD 26, 1’307 M. Grohe  diff --git a/tests/examplefiles/database.pytb b/tests/examplefiles/database.pytb index a3f9911..9138e01 100644 --- a/tests/examplefiles/database.pytb +++ b/tests/examplefiles/database.pytb @@ -1,3 +1,5 @@ +Text before + Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 314, in dispatch_request dispatcher.dispatch(req) @@ -14,3 +16,5 @@ Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/trac/db/sqlite_backend.py", line 36, in _rollback_on_error return function(self, *args, **kwargs) OperationalError: database is locked + +Text after diff --git a/tests/examplefiles/fucked_up.rb b/tests/examplefiles/fucked_up.rb new file mode 100644 index 0000000..b1d0ee3 --- /dev/null +++ b/tests/examplefiles/fucked_up.rb @@ -0,0 +1,77 @@ +# vim:ft=ruby + +events = Hash.new { |h, k| h[k] = [] } +DATA.read.split(/\n\n\n\s*/).each do |event| + name = event[/^.*/].sub(/http:.*/, '') + event[/\n.*/m].scan(/^([A-Z]{2}\S*)\s*(\S*)\s*(\S*)(\s*\S*)/) do |kind, day, daytime, comment| + events[ [day, daytime] ] << [kind, name + comment] + end +end + +conflicts = 0 +events.to_a.sort_by do |(day, daytime),| + [%w(Mo Di Mi Do Fr).index(day) || 0, daytime] +end.each do |(day, daytime), names| + if names.size > 1 + conflicts += 1 + print '!!! ' + end + print "#{day} #{daytime}: " + names.each { |kind, name| puts " #{kind} #{name}" } + puts +end + +puts '%d conflicts' % conflicts +puts '%d SWS' % (events.inject(0) { |sum, ((day, daytime),)| sum + (daytime[/\d+$/].to_i - daytime[/^\d+/].to_i) }) + +string = % foo # strange. huh? +print "Escape here: \n" +print 'Dont escape here: \n' + +__END__ +Informatik und Informationsgesellschaft I: Digitale Medien (32 214) +Computer lassen ihre eigentliche Bestimmung durch Multimedia und Vernetzung erkennen: Es sind digitale Medien, die alle bisherigen Massen- und Kommunikationsmedien simulieren, kopieren oder ersetzen können. Die kurze Geschichte elektronischer Medien vom Telegramm bis zum Fernsehen wird so zur Vorgeschichte des Computers als Medium. Der Prozess der Mediatisierung der Rechnernetze soll in Technik, Theorie und Praxis untersucht werden. Das PR soll die Techniken der ortsverteilten und zeitversetzten Lehre an Hand praktischer Übungen vorführen und untersuchen. +VL Di 15-17 wöch. RUD 25, 3.101 J. Koubek +VL Do 15-17 wöch. RUD 25, 3.101 +UE/PR Do 17-19 wöch. RUD 25, 3.101 J.-M. Loebel + + +Methoden und Modelle des Systementwurfs (32 223) +Gute Methoden zum Entwurf und zur Verifikation von Systemen sind ein Schlüssel für gute Software. Dieses Seminar betrachtet moderne Entwurfsmethoden. + VL Di 09-11 wöch. RUD 26, 0’313 W. Reisig + VL Do 09-11 wöch. RUD 26, 0’313 + UE Di 11-13 wöch. RUD 26, 0’313 + PR Di 13-15 wöch. RUD 26, 0’313 D. Weinberg + + +Komplexitätstheorie (32 229) +In dieser Vorlesung untersuchen wir eine Reihe von wichtigen algorithmischen Problemstellungen aus verschiedenen Bereichen der Informatik. Unser besonderes Interesse gilt dabei der Abschätzung der Rechenressourcen, die zu ihrer Lösung aufzubringen sind. Die Vorlesung bildet eine wichtige Grundlage für weiterführende Veranstaltungen in den Bereichen Algorithmen, Kryptologie, Algorithmisches Lernen und Algorithmisches Beweisen. + VL Di 09-11 wöch. RUD 26, 1’303 J. Köbler + VL Do 09-11 wöch. RUD 26, 1’305 + UE Do 11-13 wöch. RUD 26, 1’305 + + +Zuverlässige Systeme (32 234) +Mit zunehmender Verbreitung der Computertechnologie in immer mehr Bereichen des menschlichen Lebens wird die Zuverlässigkeit solcher Systeme zu einer immer zentraleren Frage. +Der Halbkurs "Zuverlässige Systeme" konzentriert sich auf folgende Schwerpunkte: Zuverlässigkeit, Fehlertoleranz, Responsivität, Messungen, Anwendungen, Systemmodelle und Techniken, Ausfallverhalten, Fehlermodelle, Schedulingtechniken, Software/Hardware - responsives Systemdesign, Analyse und Synthese, Bewertung, Fallstudien in Forschung und Industrie. +Der Halbkurs kann mit dem Halbkurs "Eigenschaften mobiler und eingebetteter Systeme" zu einem Projektkurs kombiniert werden. Ein gemeinsames Projekt begleitet beide Halbkurse. +VL Di 09-11 wöch. RUD 26, 1’308 M. Malek +VL Do 09-11 wöch. RUD 26, 1’308 +PR n.V. + + +Stochastik für InformatikerInnen (32 239) +Grundlagen der Wahrscheinlichkeitsrechnung, Diskrete und stetige Wahrscheinlichkeitsmodelle in der Informatik, Grenzwertsätze, Simulationsverfahren, Zufallszahlen, Statistische Schätz- und Testverfahren, Markoffsche Ketten, Simulated Annealing, Probabilistische Analyse von Algorithmen. +VL Mo 09-11 wöch. RUD 25, 3.101 W. Kössler +VL Mi 09-11 wöch. RUD 25, 3.101 +UE Mo 11-13 wöch. RUD 25, 3.101 + UE Mi 11-13 wöch. RUD 25. 3.101 + + +Geschichte der Informatik – Ausgewählte Kapitel (32 243) +VL Mi 13-15 wöch. RUD 25, 3.113 W. Coy + + +Aktuelle Themen der Theoretischen Informatik (32 260) +In diesem Seminar sollen wichtige aktuelle Veröffentlichungen aus der theoretischen Informatik gemeinsam erarbeitet werden. Genaueres wird erst kurz vor dem Seminar entschieden. Bei Interesse wenden Sie sich bitte möglichst frühzeitig an den Veranstalter. + SE Fr 09-11 wöch. RUD 26, 1’307 M. Grohe  diff --git a/tests/examplefiles/main.cmake b/tests/examplefiles/main.cmake new file mode 100644 index 0000000..dac3da4 --- /dev/null +++ b/tests/examplefiles/main.cmake @@ -0,0 +1,42 @@ +SET( SOURCES back.c io.c main.c ) +MESSAGE( ${SOURCES} ) # three arguments, prints "back.cio.cmain.c" +MESSAGE( "${SOURCES}" ) # one argument, prints "back.c;io.c;main.c" +MESSAGE( "" ) # one argument, prints "" an empty line +MESSAGE( "${EMPTY_STRING}" ) # one argument, prints "" an empty line +MESSAGE( ${EMPTY_STRING} ) # zero arguments, causes CMake Error + # "MESSAGE called with incorrect number of arguments" +MESSAGE( \\\"\ \(\)\#\$\^ ) # this message contains literal characters + +MESSAGE( "This is practice." ) # prints "This is practice." +MESSAGE( "This;is;practice." ) # prints "This;is;practice." +MESSAGE( "Hi. ) MESSAGE( x )" ) # prints "Hi. ) MESSAGE( x )" + +MESSAGE( "Welc"ome ) # rule 1 +MESSAGE( Welc"ome" ) # rule 3 +MESSAGE( Welc"ome)" ) # rule 2 +MESSAGE( ""Thanks ) # rule 1 +MESSAGE( Thanks"" ) # rule 3 + +SET( x y A B C ) # stores "y;A;B;C" in x (without quote) +SET( ${x} ) # => SET( y;A;B;C ) => SET( y A B C) +MESSAGE( ${y} ) # prints "ABC" to stdout (without quotes) +SET( y x ) # stores "x" in y (without quotes) +SET( ${y} y = x ) # => SET( x y ) +MESSAGE( "\${x} = '${x}'" ) # prints "${x} = 'y;=;x'" to stdout (without quotes) +SET( y ${x} ) # => SET( y y = x ) => stores "y;=;x" in y (without quotes) +MESSAGE( ${y} ) # prints "y=x" to stdout (without quotes) + +SET( x a b c ) # stores "a;b;c" in x (without quotes) +SET( y "a b c" ) # stores "a b c" in y (without quotes) +MESSAGE( a b c ) # prints "abc" to stdout (without quotes) +MESSAGE( ${x} ) # prints "abc" to stdout (without quotes) +MESSAGE("${x}") # prints "a;b;c" to stdout (without quotes) +MESSAGE( ${y} ) # prints "a b c" to stdout (without quotes) +MESSAGE("${y}") # prints "a b c" to stdout (without quotes) + +# This is a comment. +COMMAND( arguments go here ) +ANOTHER_COMMAND() # this command has no arguments +YET_ANOTHER_COMMAND( these + arguments are spread # another comment + over several lines ) diff --git a/tests/examplefiles/test.asy b/tests/examplefiles/test.asy new file mode 100644 index 0000000..cfcc3d0 --- /dev/null +++ b/tests/examplefiles/test.asy @@ -0,0 +1,131 @@ +// example file for roundedpath() in roundedpath.asy +// written by stefan knorr + + +// import needed packages +import roundedpath; + +// function definition +picture CreateKOOS(real Scale, string legend) // draw labeled coordinate system as picture +{ + picture ReturnPic; + real S = 1.2*Scale; + draw(ReturnPic, ((-S,0)--(S,0)), bar = EndArrow); // x axis + draw(ReturnPic, ((0,-S)--(0,S)), bar = EndArrow); // y axis + label(ReturnPic, "$\varepsilon$", (S,0), SW); // x axis label + label(ReturnPic, "$\sigma$", (0,S), SW); // y axis label + label(ReturnPic, legend, (0.7S, -S), NW); // add label 'legend' + return ReturnPic; // return picture +} + + +// some global definitions +real S = 13mm; // universal scale factor for the whole file +real grad = 0.25; // gradient for lines +real radius = 0.04; // radius for the rounded path' +real lw = 2; // linewidth +pair A = (-1, -1); // start point for graphs +pair E = ( 1, 1); // end point for graphs +path graph; // local graph +pen ActPen; // actual pen for each drawing +picture T[]; // vector of all four diagrams +real inc = 2.8; // increment-offset for combining pictures + +//////////////////////////////////////// 1st diagram +T[1] = CreateKOOS(S, "$T_1$"); // initialise T[1] as empty diagram with label $T_1$ +graph = A; // # pointwise definition of current path 'graph' +graph = graph -- (A.x + grad*1.6, A.y + 1.6); // # +graph = graph -- (E.x - grad*0.4, E.y - 0.4); // # +graph = graph -- E; // # + +graph = roundedpath(graph, radius, S); // round edges of 'graph' using roundedpath() in roundedpath.asy +ActPen = rgb(0,0,0.6) + linewidth(lw); // define pen for drawing in 1st diagram +draw(T[1], graph, ActPen); // draw 'graph' with 'ActPen' into 'T[1]' (1st hysteresis branch) +draw(T[1], rotate(180,(0,0))*graph, ActPen); // draw rotated 'graph' (2nd hysteresis branch) + +graph = (0,0) -- (grad*0.6, 0.6) -- ( (grad*0.6, 0.6) + (0.1, 0) ); // define branch from origin to hysteresis +graph = roundedpath(graph, radius, S); // round this path +draw(T[1], graph, ActPen); // draw this path into 'T[1]' + + +//////////////////////////////////////// 2nd diagram +T[2] = CreateKOOS(S, "$T_2$"); // initialise T[2] as empty diagram with label $T_2$ +graph = A; // # pointwise definition of current path 'graph' +graph = graph -- (A.x + grad*1.3, A.y + 1.3); // # +graph = graph -- (E.x - grad*0.7 , E.y - 0.7); // # +graph = graph -- E; // # + +graph = roundedpath(graph, radius, S); // round edges of 'graph' using roundedpath() in roundedpath.asy +ActPen = rgb(0.2,0,0.4) + linewidth(lw); // define pen for drawing in 2nd diagram +draw(T[2], graph, ActPen); // draw 'graph' with 'ActPen' into 'T[2]' (1st hysteresis branch) +draw(T[2], rotate(180,(0,0))*graph, ActPen); // draw rotated 'graph' (2nd hysteresis branch) + +graph = (0,0) -- (grad*0.3, 0.3) -- ( (grad*0.3, 0.3) + (0.1, 0) ); // define branch from origin to hysteresis +graph = roundedpath(graph, radius, S); // round this path +draw(T[2], graph, ActPen); // draw this path into 'T[2]' + + +//////////////////////////////////////// 3rd diagram +T[3] = CreateKOOS(S, "$T_3$"); // initialise T[3] as empty diagram with label $T_3$ +graph = A; // # pointwise definition of current path 'graph' +graph = graph -- (A.x + grad*0.7, A.y + 0.7); // # +graph = graph -- ( - grad*0.3 , - 0.3); // # +graph = graph -- (0,0); // # +graph = graph -- (grad*0.6, 0.6); // # +graph = graph -- (E.x - grad*0.4, E.y - 0.4); // # +graph = graph -- E; // # + +graph = roundedpath(graph, radius, S); // round edges of 'graph' using roundedpath() in roundedpath.asy +ActPen = rgb(0.6,0,0.2) + linewidth(lw); // define pen for drawing in 3rd diagram +draw(T[3], graph, ActPen); // draw 'graph' with 'ActPen' into 'T[3]' (1st hysteresis branch) +draw(T[3], rotate(180,(0,0))*graph, ActPen); // draw rotated 'graph' (2nd hysteresis branch) + + +//////////////////////////////////////// 4th diagram +T[4] = CreateKOOS(S, "$T_4$"); // initialise T[4] as empty diagram with label $T_4$ +graph = A; // # pointwise definition of current path 'graph' +graph = graph -- (A.x + grad*0.4, A.y + 0.4); // # +graph = graph -- ( - grad*0.6 , - 0.6); // # +graph = graph -- (0,0); // # +graph = graph -- (grad*0.9, 0.9); // # +graph = graph -- (E.x - grad*0.1, E.y - 0.1); // # +graph = graph -- E; // # + +graph = roundedpath(graph, radius, S); // round edges of 'graph' using roundedpath() in roundedpath.asy +ActPen = rgb(0.6,0,0) + linewidth(lw); // define pen for drawing in 4th diagram +draw(T[4], graph, ActPen); // draw 'graph' with 'ActPen' into 'T[4]' (1st hysteresis branch) +draw(T[4], rotate(180,(0,0))*graph, ActPen); // draw rotated 'graph' (3nd hysteresis branch) + + +// add some labels and black dots to the first two pictures +pair SWW = (-0.8, -0.6); +label(T[1], "$\sigma_f$", (0, 0.6S), NE); // sigma_f +draw(T[1], (0, 0.6S), linewidth(3) + black); +label(T[2], "$\sigma_f$", (0, 0.3S), NE); // sigma_f +draw(T[2], (0, 0.3S), linewidth(3) + black); +label(T[1], "$\varepsilon_p$", (0.7S, 0), SWW); // epsilon_p +draw(T[1], (0.75S, 0), linewidth(3) + black); +label(T[2], "$\varepsilon_p$", (0.7S, 0), SWW); // epsilon_p +draw(T[2], (0.75S, 0), linewidth(3) + black); + + +// add all pictures T[1...4] to the current one +add(T[1],(0,0)); +add(T[2],(1*inc*S,0)); +add(T[3],(2*inc*S,0)); +add(T[4],(3*inc*S,0)); + + +// draw line of constant \sigma and all intersection points with the graphs in T[1...4] +ActPen = linewidth(1) + dashed + gray(0.5); // pen definition +draw((-S, 0.45*S)--((3*inc+1)*S, 0.45*S), ActPen); // draw backgoundline +label("$\sigma_s$", (-S, 0.45S), W); // label 'sigma_s' + +path mark = scale(2)*unitcircle; // define mark-symbol to be used for intersections +ActPen = linewidth(1) + gray(0.5); // define pen for intersection mark +draw(shift(( 1 - grad*0.55 + 0*inc)*S, 0.45*S)*mark, ActPen); // # draw all intersections +draw(shift((-1 + grad*1.45 + 0*inc)*S, 0.45*S)*mark, ActPen); // # +draw(shift(( 1 - grad*0.55 + 1*inc)*S, 0.45*S)*mark, ActPen); // # +draw(shift(( 1 - grad*0.55 + 2*inc)*S, 0.45*S)*mark, ActPen); // # +draw(shift(( grad*0.45 + 2*inc)*S, 0.45*S)*mark, ActPen); // # +draw(shift(( grad*0.45 + 3*inc)*S, 0.45*S)*mark, ActPen); // # diff --git a/tests/examplefiles/test.html b/tests/examplefiles/test.html index 39365c0..b22f0c6 100644 --- a/tests/examplefiles/test.html +++ b/tests/examplefiles/test.html @@ -6,16 +6,6 @@ }
    Operator Token.Operatoroperators (+, not...)operators (+, not...)
    Punctuation Token.Punctuationpunctuation ([, (...)punctuation ([, (...)
    Comment Token.Comment