diff options
| -rw-r--r-- | CHANGES | 1 | ||||
| -rw-r--r-- | pygments/lexers/_mapping.py | 1 | ||||
| -rw-r--r-- | pygments/lexers/agile.py | 2 | ||||
| -rw-r--r-- | pygments/lexers/text.py | 46 |
4 files changed, 47 insertions, 3 deletions
@@ -9,6 +9,7 @@ Version 1.0 * Io * Smalltalk + * Darcs patches - Handle format specifications in the Perl lexer. diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py index 1db8e3a8..dc4d9a52 100644 --- a/pygments/lexers/_mapping.py +++ b/pygments/lexers/_mapping.py @@ -36,6 +36,7 @@ LEXERS = { 'CssSmartyLexer': ('pygments.lexers.templates', 'CSS+Smarty', ('css+smarty',), (), ('text/css+smarty',)), 'DLexer': ('pygments.lexers.compiled', 'D', ('d',), ('*.d', '*.di'), ('text/x-dsrc',)), 'DObjdumpLexer': ('pygments.lexers.asm', 'd-objdump', ('d-objdump',), ('*.d-objdump',), ('text/x-d-objdump',)), + 'DarcsPatchLexer': ('pygments.lexers.text', 'Darcs Patch', ('dpatch',), ('*.dpatch', '*.darcspatch'), ()), 'DebianControlLexer': ('pygments.lexers.text', 'Debian Control file', ('control',), ('control',), ()), 'DelphiLexer': ('pygments.lexers.compiled', 'Delphi', ('delphi', 'pas', 'pascal', 'objectpascal'), ('*.pas',), ('text/x-pascal',)), 'DiffLexer': ('pygments.lexers.text', 'Diff', ('diff',), ('*.diff', '*.patch'), ('text/x-diff', 'text/x-patch')), diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py index 9055c6b1..f7f7ee4d 100644 --- a/pygments/lexers/agile.py +++ b/pygments/lexers/agile.py @@ -973,6 +973,8 @@ class IoLexer(RegexLexer): """ For `Io <http://iolanguage.com/>`_ (a small, prototype-based programming language) source. + + *New in Pygments 1.0.* """ name = 'Io' filenames = ['*.io'] diff --git a/pygments/lexers/text.py b/pygments/lexers/text.py index 73e6a28a..f4c5a1ba 100644 --- a/pygments/lexers/text.py +++ b/pygments/lexers/text.py @@ -11,7 +11,8 @@ Dennis Kaarsemaker, Kumar Appaiah <akumar@ee.iitm.ac.in>, Varun Hiremath <varunhiremath@gmail.com>, - Jeremy Thurgood. + Jeremy Thurgood, + Max Battcher. :license: BSD, see LICENSE for more details. """ @@ -26,14 +27,15 @@ from pygments.lexer import RegexLexer, bygroups, include, using, this, \ do_insertions from pygments.token import Punctuation, \ Text, Comment, Keyword, Name, String, Generic, Operator, Number, \ - Whitespace + Whitespace, Literal from pygments.util import get_bool_opt __all__ = ['IniLexer', 'SourcesListLexer', 'MakefileLexer', 'DiffLexer', 'IrcLogsLexer', 'TexLexer', 'GroffLexer', 'ApacheConfLexer', 'BBCodeLexer', 'MoinWikiLexer', 'RstLexer', 'VimLexer', - 'GettextLexer', 'SquidConfLexer', 'DebianControlLexer'] + 'GettextLexer', 'SquidConfLexer', 'DebianControlLexer', + 'DarcsPatchLexer'] class IniLexer(RegexLexer): @@ -198,6 +200,44 @@ class DiffLexer(RegexLexer): return 0.9 +class DarcsPatchLexer(RegexLexer): + """ + 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``. + + *New in Pygments 1.0.* + """ + name = 'Darcs Patch' + aliases = ['dpatch'] + filenames = ['*.dpatch', '*.darcspatch'] + + tokens = { + 'root': [ + (r'<', Operator), + (r'>', Operator), + (r'{', Operator, 'patch'), + (r'(\[)((?:TAG )?)(.*)(\n)(.*)(\*\*)(\d+)(\s?)', bygroups(Operator, Keyword, Name, Text, + Name, Operator, Literal.Date, Text), 'comment'), + (r'New patches:', Generic.Heading), + (r'Context:', Generic.Heading), + (r'Patch bundle hash:', Generic.Heading), + (r'\s+|\w+', Text), + ], + 'comment': [ + (r' .*\n', Comment), + (r'\]', Operator, "#pop"), + ], + 'patch': [ + (r'}', Operator, "#pop"), + (r'(\w+)(.*\n)', bygroups(Keyword, Text)), + (r'\+.*\n', Generic.Inserted), + (r'-.*\n', Generic.Deleted), + (r'.*\n', Text), + ], + } + + class IrcLogsLexer(RegexLexer): """ Lexer for IRC logs in *irssi*, *xchat* or *weechat* style. |
