Commits

Eric Knibbe committed 0f902c6 Draft Merge

merge

Comments (0)

Files changed (34)

 Other contributors, listed alphabetically, are:
 
 * Sam Aaron -- Ioke lexer
+* Ali Afshar -- image formatter
+* Thomas Aglassinger -- Rexx lexer
 * Kumar Appaiah -- Debian control lexer
-* Ali Afshar -- image formatter
 * Andreas Amann -- AppleScript lexer
 * Timothy Armstrong -- Dart lexer fixes
 * Jeffrey Arnold -- R/S, Rd, BUGS, Jags, and Stan lexers
 * Stefan Matthias Aust -- Smalltalk lexer
 * Ben Bangert -- Mako lexers
 * Max Battcher -- Darcs patch lexer
+* Tim Baumann -- (Literate) Agda lexer
 * Paul Baumgart, 280 North, Inc. -- Objective-J lexer
 * Michael Bayer -- Myghty lexers
 * John Benediktsson -- Factor lexer
 * Christian Jann -- ShellSession lexer
 * Christopher Creutzig -- MuPAD lexer
 * Pete Curry -- bugfixes
-* Owen Durni -- haXe lexer
+* Bryan Davis -- EBNF lexer
+* Owen Durni -- Haxe lexer
 * Nick Efford -- Python 3 lexer
 * Sven Efftinge -- Xtend lexer
 * Artem Egorkine -- terminal256 formatter
 * James H. Fisher -- PostScript lexer
+* William S. Fulton -- SWIG lexer
 * Carlos Galdino -- Elixir and Elixir Console lexers
 * Michael Galloy -- IDL lexer
 * Naveen Garg -- Autohotkey lexer
 * Laurent Gautier -- R/S lexer
 * Alex Gaynor -- PyPy log lexer
+* Richard Gerkin -- Igor Pro lexer
 * Alain Gilbert -- TypeScript lexer
+* Alex Gilding -- BlitzBasic lexer
 * Bertrand Goetzmann -- Groovy lexer
 * Krzysiek Goj -- Scala lexer
 * Matt Good -- Genshi, Cheetah lexers
+* Michał Górny -- vim modeline support
 * Patrick Gotthardt -- PHP namespaces support
 * Olivier Guibe -- Asymptote lexer
 * Jordi Gutiérrez Hermoso -- Octave lexer
 * Greg Hendershott -- Racket lexer
 * David Hess, Fish Software, Inc. -- Objective-J lexer
 * Varun Hiremath -- Debian control lexer
+* Rob Hoelz -- Perl 6 lexer
 * Doug Hogan -- Mscgen lexer
 * Ben Hollis -- Mason lexer
 * Dustin Howett -- Logos lexer
 * Mike Nolta -- Julia lexer
 * Jonas Obrist -- BBCode lexer
 * David Oliva -- Rebol lexer
+* Pat Pannuto -- nesC lexer
 * Jon Parise -- Protocol buffers lexer
 * Ronny Pfannschmidt -- BBCode lexer
 * Benjamin Peterson -- Test suite refactoring
 - Lexers added:
 
   * Clay (PR#184)
+  * Perl 6 (PR#181)
+  * Swig (PR#168)
+  * nesC (PR#166)
+  * BlitzBasic (PR#197)
+  * EBNF (PR#193)
+  * Igor Pro (PR#172)
+  * Rexx (PR#199)
+  * Agda and Literate Agda (PR#203)
+
+- Pygments will now recognize "vim" modelines when guessing the lexer for
+  a file based on content (PR#118).
+
+- The NameHighlightFilter now works with any Name.* token type (#790).
 
 - Python 3 lexer: add new exceptions from PEP 3151.
 
 - Lasso lexer: fix method highlighting, update builtins. Fix
   guessing so that plain XML isn't always taken as Lasso (PR#163).
 
+- Objective C/C++ lexers: allow "@" prefixing any expression (#871).
+
+- Ruby lexer: fix lexing of Name::Space tokens (#860).
+
+- Stan lexer: update for version 1.3.0 of the language (PR#162).
+
+- JavaScript lexer: add the "yield" keyword (PR#196).
+
+- HTTP lexer: support for PATCH method (PR#190).
+
+- Koka lexer: update to newest language spec (PR#201).
+
+- Haxe lexer: rewrite and support for Haxe 3 (PR#174).
+
+- Prolog lexer: add different kinds of numeric literals (#864).
+
+- F# lexer: rewrite with newest spec for F# 3.0 (#842).
+
 
 Version 1.6
 -----------
   * Ada
   * Coldfusion
   * Modula-2
-  * haXe
+  * Haxe
   * R console
   * Objective-J
   * Haml and Sass
   * CMake
   * Ooc
   * Coldfusion
-  * haXe
+  * Haxe
   * R console
 
 - Added options for rendering LaTeX in source code comments in the
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 import sys, pygments.cmdline
 try:

pygments/filters/__init__.py

 
 class NameHighlightFilter(Filter):
     """
-    Highlight a normal Name token with a different token type.
+    Highlight a normal Name (and Name.*) token with a different token type.
 
     Example::
 
 
     def filter(self, lexer, stream):
         for ttype, value in stream:
-            if ttype is Name and value in self.names:
+            if ttype in Name and value in self.names:
                 yield self.tokentype, value
             else:
                 yield ttype, value

pygments/formatter.py

         self.full  = get_bool_opt(options, 'full', False)
         self.title = options.get('title', '')
         self.encoding = options.get('encoding', None) or None
+        if self.encoding == 'guess':
+            # can happen for pygmentize -O encoding=guess
+            self.encoding = 'utf-8'
         self.encoding = options.get('outencoding', None) or self.encoding
         self.options = options
 

pygments/lexers/__init__.py

 from os.path import basename
 
 from pygments.lexers._mapping import LEXERS
+from pygments.modeline import get_filetype_from_buffer
 from pygments.plugin import find_plugin_lexers
 from pygments.util import ClassNotFound, bytes
 
     """
     Guess a lexer by strong distinctions in the text (eg, shebang).
     """
+
+    # try to get a vim modeline first
+    ft = get_filetype_from_buffer(_text)
+
+    if ft is not None:
+        try:
+            return get_lexer_by_name(ft, **options)
+        except ClassNotFound:
+            pass
+
     best_lexer = [0.0, None]
     for lexer in _iter_lexerclasses():
         rv = lexer.analyse_text(_text)

pygments/lexers/_mapping.py

     'ActionScript3Lexer': ('pygments.lexers.web', 'ActionScript 3', ('as3', 'actionscript3'), ('*.as',), ('application/x-actionscript', 'text/x-actionscript', 'text/actionscript')),
     'ActionScriptLexer': ('pygments.lexers.web', 'ActionScript', ('as', 'actionscript'), ('*.as',), ('application/x-actionscript3', 'text/x-actionscript3', 'text/actionscript3')),
     'AdaLexer': ('pygments.lexers.compiled', 'Ada', ('ada', 'ada95ada2005'), ('*.adb', '*.ads', '*.ada'), ('text/x-ada',)),
+    'AgdaLexer': ('pygments.lexers.functional', 'Agda', ('agda',), ('*.agda',), ('text/x-agda',)),
     'AntlrActionScriptLexer': ('pygments.lexers.parsers', 'ANTLR With ActionScript Target', ('antlr-as', 'antlr-actionscript'), ('*.G', '*.g'), ()),
     'AntlrCSharpLexer': ('pygments.lexers.parsers', 'ANTLR With C# Target', ('antlr-csharp', 'antlr-c#'), ('*.G', '*.g'), ()),
     'AntlrCppLexer': ('pygments.lexers.parsers', 'ANTLR With CPP Target', ('antlr-cpp',), ('*.G', '*.g'), ()),
     'AspectJLexer': ('pygments.lexers.jvm', 'AspectJ', ('aspectj',), ('*.aj',), ('text/x-aspectj',)),
     'AsymptoteLexer': ('pygments.lexers.other', 'Asymptote', ('asy', 'asymptote'), ('*.asy',), ('text/x-asymptote',)),
     'AutoItLexer': ('pygments.lexers.other', 'AutoIt', ('autoit', 'Autoit'), ('*.au3',), ('text/x-autoit',)),
-    'AutohotkeyLexer': ('pygments.lexers.other', 'autohotkey', ('ahk',), ('*.ahk', '*.ahkl'), ('text/x-autohotkey',)),
+    'AutohotkeyLexer': ('pygments.lexers.other', 'autohotkey', ('ahk', 'autohotkey'), ('*.ahk', '*.ahkl'), ('text/x-autohotkey',)),
     'AwkLexer': ('pygments.lexers.other', 'Awk', ('awk', 'gawk', 'mawk', 'nawk'), ('*.awk',), ('application/x-awk',)),
     'BBCodeLexer': ('pygments.lexers.text', 'BBCode', ('bbcode',), (), ('text/x-bbcode',)),
     'BaseMakefileLexer': ('pygments.lexers.text', 'Base Makefile', ('basemake',), (), ()),
     'BashLexer': ('pygments.lexers.shell', 'Bash', ('bash', 'sh', 'ksh'), ('*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass', '.bashrc', 'bashrc', '.bash_*', 'bash_*'), ('application/x-sh', 'application/x-shellscript')),
     'BashSessionLexer': ('pygments.lexers.shell', 'Bash Session', ('console',), ('*.sh-session',), ('application/x-shell-session',)),
-    'BatchLexer': ('pygments.lexers.shell', 'Batchfile', ('bat',), ('*.bat', '*.cmd'), ('application/x-dos-batch',)),
+    'BatchLexer': ('pygments.lexers.shell', 'Batchfile', ('bat', 'dosbatch', 'winbatch'), ('*.bat', '*.cmd'), ('application/x-dos-batch',)),
     'BefungeLexer': ('pygments.lexers.other', 'Befunge', ('befunge',), ('*.befunge',), ('application/x-befunge',)),
     'BlitzBasicLexer': ('pygments.lexers.compiled', 'BlitzBasic', ('blitzbasic', 'b3d', 'bplus'), ('*.bb', '*.decls'), ('text/x-bb',)),
     'BlitzMaxLexer': ('pygments.lexers.compiled', 'BlitzMax', ('blitzmax', 'bmax'), ('*.bmx',), ('text/x-bmx',)),
     'CbmBasicV2Lexer': ('pygments.lexers.other', 'CBM BASIC V2', ('cbmbas',), ('*.bas',), ()),
     'CeylonLexer': ('pygments.lexers.jvm', 'Ceylon', ('ceylon',), ('*.ceylon',), ('text/x-ceylon',)),
     'Cfengine3Lexer': ('pygments.lexers.other', 'CFEngine3', ('cfengine3', 'cf3'), ('*.cf',), ()),
-    'CheetahHtmlLexer': ('pygments.lexers.templates', 'HTML+Cheetah', ('html+cheetah', 'html+spitfire'), (), ('text/html+cheetah', 'text/html+spitfire')),
+    'CheetahHtmlLexer': ('pygments.lexers.templates', 'HTML+Cheetah', ('html+cheetah', 'html+spitfire', 'htmlcheetah'), (), ('text/html+cheetah', 'text/html+spitfire')),
     'CheetahJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Cheetah', ('js+cheetah', 'javascript+cheetah', 'js+spitfire', 'javascript+spitfire'), (), ('application/x-javascript+cheetah', 'text/x-javascript+cheetah', 'text/javascript+cheetah', 'application/x-javascript+spitfire', 'text/x-javascript+spitfire', 'text/javascript+spitfire')),
     'CheetahLexer': ('pygments.lexers.templates', 'Cheetah', ('cheetah', 'spitfire'), ('*.tmpl', '*.spt'), ('application/x-cheetah', 'application/x-spitfire')),
     'CheetahXmlLexer': ('pygments.lexers.templates', 'XML+Cheetah', ('xml+cheetah', 'xml+spitfire'), (), ('application/xml+cheetah', 'application/xml+spitfire')),
     'ClojureLexer': ('pygments.lexers.jvm', 'Clojure', ('clojure', 'clj'), ('*.clj',), ('text/x-clojure', 'application/x-clojure')),
     'CobolFreeformatLexer': ('pygments.lexers.compiled', 'COBOLFree', ('cobolfree',), ('*.cbl', '*.CBL'), ()),
     'CobolLexer': ('pygments.lexers.compiled', 'COBOL', ('cobol',), ('*.cob', '*.COB', '*.cpy', '*.CPY'), ('text/x-cobol',)),
-    'CoffeeScriptLexer': ('pygments.lexers.web', 'CoffeeScript', ('coffee-script', 'coffeescript'), ('*.coffee',), ('text/coffeescript',)),
+    'CoffeeScriptLexer': ('pygments.lexers.web', 'CoffeeScript', ('coffee-script', 'coffeescript', 'coffee'), ('*.coffee',), ('text/coffeescript',)),
     'ColdfusionHtmlLexer': ('pygments.lexers.templates', 'Coldfusion HTML', ('cfm',), ('*.cfm', '*.cfml', '*.cfc'), ('application/x-coldfusion',)),
     'ColdfusionLexer': ('pygments.lexers.templates', 'cfstatement', ('cfs',), (), ()),
-    'CommonLispLexer': ('pygments.lexers.functional', 'Common Lisp', ('common-lisp', 'cl'), ('*.cl', '*.lisp', '*.el'), ('text/x-common-lisp',)),
+    'CommonLispLexer': ('pygments.lexers.functional', 'Common Lisp', ('common-lisp', 'cl', 'lisp'), ('*.cl', '*.lisp', '*.el'), ('text/x-common-lisp',)),
     'CoqLexer': ('pygments.lexers.functional', 'Coq', ('coq',), ('*.v',), ('text/x-coq',)),
     'CppLexer': ('pygments.lexers.compiled', 'C++', ('cpp', 'c++'), ('*.cpp', '*.hpp', '*.c++', '*.h++', '*.cc', '*.hh', '*.cxx', '*.hxx', '*.C', '*.H', '*.cp', '*.CPP'), ('text/x-c++hdr', 'text/x-c++src')),
     'CppObjdumpLexer': ('pygments.lexers.asm', 'cpp-objdump', ('cpp-objdump', 'c++-objdumb', 'cxx-objdump'), ('*.cpp-objdump', '*.c++-objdump', '*.cxx-objdump'), ('text/x-cpp-objdump',)),
     'CssPhpLexer': ('pygments.lexers.templates', 'CSS+PHP', ('css+php',), (), ('text/css+php',)),
     'CssSmartyLexer': ('pygments.lexers.templates', 'CSS+Smarty', ('css+smarty',), (), ('text/css+smarty',)),
     'CudaLexer': ('pygments.lexers.compiled', 'CUDA', ('cuda', 'cu'), ('*.cu', '*.cuh'), ('text/x-cuda',)),
-    'CythonLexer': ('pygments.lexers.compiled', 'Cython', ('cython', 'pyx'), ('*.pyx', '*.pxd', '*.pxi'), ('text/x-cython', 'application/x-cython')),
+    'CythonLexer': ('pygments.lexers.compiled', 'Cython', ('cython', 'pyx', 'pyrex'), ('*.pyx', '*.pxd', '*.pxi'), ('text/x-cython', 'application/x-cython')),
     'DLexer': ('pygments.lexers.compiled', 'D', ('d',), ('*.d', '*.di'), ('text/x-dsrc',)),
     'DObjdumpLexer': ('pygments.lexers.asm', 'd-objdump', ('d-objdump',), ('*.d-objdump',), ('text/x-d-objdump',)),
     'DarcsPatchLexer': ('pygments.lexers.text', 'Darcs Patch', ('dpatch',), ('*.dpatch', '*.darcspatch'), ()),
     'DartLexer': ('pygments.lexers.web', 'Dart', ('dart',), ('*.dart',), ('text/x-dart',)),
-    'DebianControlLexer': ('pygments.lexers.text', 'Debian Control file', ('control',), ('control',), ()),
+    'DebianControlLexer': ('pygments.lexers.text', 'Debian Control file', ('control', 'debcontrol'), ('control',), ()),
     'DelphiLexer': ('pygments.lexers.compiled', 'Delphi', ('delphi', 'pas', 'pascal', 'objectpascal'), ('*.pas',), ('text/x-pascal',)),
     'DgLexer': ('pygments.lexers.agile', 'dg', ('dg',), ('*.dg',), ('text/x-dg',)),
     'DiffLexer': ('pygments.lexers.text', 'Diff', ('diff', 'udiff'), ('*.diff', '*.patch'), ('text/x-diff', 'text/x-patch')),
     'DylanLidLexer': ('pygments.lexers.compiled', 'DylanLID', ('dylan-lid', 'lid'), ('*.lid', '*.hdp'), ('text/x-dylan-lid',)),
     'ECLLexer': ('pygments.lexers.other', 'ECL', ('ecl',), ('*.ecl',), ('application/x-ecl',)),
     'ECLexer': ('pygments.lexers.compiled', 'eC', ('ec',), ('*.ec', '*.eh'), ('text/x-echdr', 'text/x-ecsrc')),
+    'EbnfLexer': ('pygments.lexers.text', 'EBNF', ('ebnf',), ('*.ebnf',), ('text/x-ebnf',)),
     'ElixirConsoleLexer': ('pygments.lexers.functional', 'Elixir iex session', ('iex',), (), ('text/x-elixir-shellsession',)),
     'ElixirLexer': ('pygments.lexers.functional', 'Elixir', ('elixir', 'ex', 'exs'), ('*.ex', '*.exs'), ('text/x-elixir',)),
     'ErbLexer': ('pygments.lexers.templates', 'ERB', ('erb',), (), ('application/x-ruby-templating',)),
     'FortranLexer': ('pygments.lexers.compiled', 'Fortran', ('fortran',), ('*.f', '*.f90', '*.F', '*.F90'), ('text/x-fortran',)),
     'FoxProLexer': ('pygments.lexers.foxpro', 'FoxPro', ('Clipper', 'XBase'), ('*.PRG', '*.prg'), ()),
     'GLShaderLexer': ('pygments.lexers.compiled', 'GLSL', ('glsl',), ('*.vert', '*.frag', '*.geo'), ('text/x-glslsrc',)),
-    'GasLexer': ('pygments.lexers.asm', 'GAS', ('gas',), ('*.s', '*.S'), ('text/x-gas',)),
+    'GasLexer': ('pygments.lexers.asm', 'GAS', ('gas', 'asm'), ('*.s', '*.S'), ('text/x-gas',)),
     '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')),
     'GroovyLexer': ('pygments.lexers.jvm', 'Groovy', ('groovy',), ('*.groovy',), ('text/x-groovy',)),
     'HamlLexer': ('pygments.lexers.web', 'Haml', ('haml', 'HAML'), ('*.haml',), ('text/x-haml',)),
     'HaskellLexer': ('pygments.lexers.functional', 'Haskell', ('haskell', 'hs'), ('*.hs',), ('text/x-haskell',)),
-    'HaxeLexer': ('pygments.lexers.web', 'haXe', ('hx', 'haXe'), ('*.hx',), ('text/haxe',)),
-    'HtmlDjangoLexer': ('pygments.lexers.templates', 'HTML+Django/Jinja', ('html+django', 'html+jinja'), (), ('text/html+django', 'text/html+jinja')),
+    'HaxeLexer': ('pygments.lexers.web', 'Haxe', ('hx', 'Haxe', 'haxe', 'haXe', 'hxsl'), ('*.hx', '*.hxsl'), ('text/haxe', 'text/x-haxe', 'text/x-hx')),
+    'HtmlDjangoLexer': ('pygments.lexers.templates', 'HTML+Django/Jinja', ('html+django', 'html+jinja', 'htmldjango'), (), ('text/html+django', 'text/html+jinja')),
     'HtmlGenshiLexer': ('pygments.lexers.templates', 'HTML+Genshi', ('html+genshi', 'html+kid'), (), ('text/html+genshi',)),
     'HtmlLexer': ('pygments.lexers.web', 'HTML', ('html',), ('*.html', '*.htm', '*.xhtml', '*.xslt'), ('text/html', 'application/xhtml+xml')),
     'HtmlPhpLexer': ('pygments.lexers.templates', 'HTML+PHP', ('html+php',), ('*.phtml',), ('application/x-php', 'application/x-httpd-php', 'application/x-httpd-php3', 'application/x-httpd-php4', 'application/x-httpd-php5')),
     'HxmlLexer': ('pygments.lexers.text', 'Hxml', ('haxeml', 'hxml'), ('*.hxml',), ()),
     'HybrisLexer': ('pygments.lexers.other', 'Hybris', ('hybris', 'hy'), ('*.hy', '*.hyb'), ('text/x-hybris', 'application/x-hybris')),
     'IDLLexer': ('pygments.lexers.math', 'IDL', ('idl',), ('*.pro',), ('text/idl',)),
-    'IniLexer': ('pygments.lexers.text', 'INI', ('ini', 'cfg'), ('*.ini', '*.cfg'), ('text/x-ini',)),
+    'IgorLexer': ('pygments.lexers.math', 'Igor', ('igor', 'igorpro'), ('*.ipf',), ('text/ipf',)),
+    'IniLexer': ('pygments.lexers.text', 'INI', ('ini', 'cfg', 'dosini'), ('*.ini', '*.cfg'), ('text/x-ini',)),
     'IoLexer': ('pygments.lexers.agile', 'Io', ('io',), ('*.io',), ('text/x-iosrc',)),
     'IokeLexer': ('pygments.lexers.jvm', 'Ioke', ('ioke', 'ik'), ('*.ik',), ('text/x-iokesrc',)),
     'IrcLogsLexer': ('pygments.lexers.text', 'IRC logs', ('irc',), ('*.weechatlog',), ('text/x-irclog',)),
     'LassoLexer': ('pygments.lexers.web', 'Lasso', ('lasso', 'lassoscript'), ('*.lasso', '*.lasso[89]'), ('text/x-lasso',)),
     'LassoXmlLexer': ('pygments.lexers.templates', 'XML+Lasso', ('xml+lasso',), (), ('application/xml+lasso',)),
     'LighttpdConfLexer': ('pygments.lexers.text', 'Lighttpd configuration file', ('lighty', 'lighttpd'), (), ('text/x-lighttpd-conf',)),
-    'LiterateHaskellLexer': ('pygments.lexers.functional', 'Literate Haskell', ('lhs', 'literate-haskell'), ('*.lhs',), ('text/x-literate-haskell',)),
+    'LiterateAgdaLexer': ('pygments.lexers.functional', 'Literate Agda', ('lagda', 'literate-agda'), ('*.lagda',), ('text/x-literate-agda',)),
+    'LiterateHaskellLexer': ('pygments.lexers.functional', 'Literate Haskell', ('lhs', 'literate-haskell', 'lhaskell'), ('*.lhs',), ('text/x-literate-haskell',)),
     'LiveScriptLexer': ('pygments.lexers.web', 'LiveScript', ('live-script', 'livescript'), ('*.ls',), ('text/livescript',)),
     'LlvmLexer': ('pygments.lexers.asm', 'LLVM', ('llvm',), ('*.ll',), ('text/x-llvm',)),
     'LogosLexer': ('pygments.lexers.compiled', 'Logos', ('logos',), ('*.x', '*.xi', '*.xm', '*.xmi'), ('text/x-logos',)),
     'LogtalkLexer': ('pygments.lexers.other', 'Logtalk', ('logtalk',), ('*.lgt',), ('text/x-logtalk',)),
     'LuaLexer': ('pygments.lexers.agile', 'Lua', ('lua',), ('*.lua', '*.wlua'), ('text/x-lua', 'application/x-lua')),
-    'MOOCodeLexer': ('pygments.lexers.other', 'MOOCode', ('moocode',), ('*.moo',), ('text/x-moocode',)),
+    'MOOCodeLexer': ('pygments.lexers.other', 'MOOCode', ('moocode', 'moo'), ('*.moo',), ('text/x-moocode',)),
     'MakefileLexer': ('pygments.lexers.text', 'Makefile', ('make', 'makefile', 'mf', 'bsdmake'), ('*.mak', 'Makefile', 'makefile', 'Makefile.*', 'GNUmakefile'), ('text/x-makefile',)),
     'MakoCssLexer': ('pygments.lexers.templates', 'CSS+Mako', ('css+mako',), (), ('text/css+mako',)),
     'MakoHtmlLexer': ('pygments.lexers.templates', 'HTML+Mako', ('html+mako',), (), ('text/html+mako',)),
     '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]', '*.inc'), ('text/x-php',)),
     'PlPgsqlLexer': ('pygments.lexers.sql', 'PL/pgSQL', ('plpgsql',), (), ('text/x-plpgsql',)),
-    'PostScriptLexer': ('pygments.lexers.other', 'PostScript', ('postscript',), ('*.ps', '*.eps'), ('application/postscript',)),
+    'PostScriptLexer': ('pygments.lexers.other', 'PostScript', ('postscript', 'postscr'), ('*.ps', '*.eps'), ('application/postscript',)),
     'PostgresConsoleLexer': ('pygments.lexers.sql', 'PostgreSQL console (psql)', ('psql', 'postgresql-console', 'postgres-console'), (), ('text/x-postgresql-psql',)),
     'PostgresLexer': ('pygments.lexers.sql', 'PostgreSQL SQL dialect', ('postgresql', 'postgres'), (), ('text/x-postgresql',)),
     'PovrayLexer': ('pygments.lexers.other', 'POVRay', ('pov',), ('*.pov', '*.inc'), ('text/x-povray',)),
     'PowerShellLexer': ('pygments.lexers.shell', 'PowerShell', ('powershell', 'posh', 'ps1', 'psm1'), ('*.ps1', '*.psm1'), ('text/x-powershell',)),
     'PrologLexer': ('pygments.lexers.compiled', 'Prolog', ('prolog',), ('*.prolog', '*.pro', '*.pl'), ('text/x-prolog',)),
-    'PropertiesLexer': ('pygments.lexers.text', 'Properties', ('properties',), ('*.properties',), ('text/x-java-properties',)),
-    'ProtoBufLexer': ('pygments.lexers.other', 'Protocol Buffer', ('protobuf',), ('*.proto',), ()),
+    'PropertiesLexer': ('pygments.lexers.text', 'Properties', ('properties', 'jproperties'), ('*.properties',), ('text/x-java-properties',)),
+    'ProtoBufLexer': ('pygments.lexers.other', 'Protocol Buffer', ('protobuf', 'proto'), ('*.proto',), ()),
     'PuppetLexer': ('pygments.lexers.other', 'Puppet', ('puppet',), ('*.pp',), ()),
     'PyPyLogLexer': ('pygments.lexers.text', 'PyPy Log', ('pypylog', 'pypy'), ('*.pypylog',), ('application/x-pypylog',)),
     'Python3Lexer': ('pygments.lexers.agile', 'Python 3', ('python3', 'py3'), (), ('text/x-python3', 'application/x-python3')),
     'RebolLexer': ('pygments.lexers.other', 'REBOL', ('rebol',), ('*.r', '*.r3'), ('text/x-rebol',)),
     'RedcodeLexer': ('pygments.lexers.other', 'Redcode', ('redcode',), ('*.cw',), ()),
     'RegeditLexer': ('pygments.lexers.text', 'reg', ('registry',), ('*.reg',), ('text/x-windows-registry',)),
+    'RexxLexer': ('pygments.lexers.other', 'Rexx', ('rexx', 'ARexx', 'arexx'), ('*.rexx', '*.rex', '*.rx', '*.arexx'), ('text/x-rexx',)),
     'RhtmlLexer': ('pygments.lexers.templates', 'RHTML', ('rhtml', 'html+erb', 'html+ruby'), ('*.rhtml',), ('text/html+ruby',)),
     'RobotFrameworkLexer': ('pygments.lexers.other', 'RobotFramework', ('RobotFramework', 'robotframework'), ('*.txt', '*.robot'), ('text/x-robotframework',)),
     'RstLexer': ('pygments.lexers.text', 'reStructuredText', ('rst', 'rest', 'restructuredtext'), ('*.rst', '*.rest'), ('text/x-rst', 'text/prs.fallenstein.rst')),
     'ScssLexer': ('pygments.lexers.web', 'SCSS', ('scss',), ('*.scss',), ('text/x-scss',)),
     'ShellSessionLexer': ('pygments.lexers.shell', 'Shell Session', ('shell-session',), ('*.shell-session',), ('application/x-sh-session',)),
     'SmaliLexer': ('pygments.lexers.dalvik', 'Smali', ('smali',), ('*.smali',), ('text/smali',)),
-    'SmalltalkLexer': ('pygments.lexers.other', 'Smalltalk', ('smalltalk', 'squeak'), ('*.st',), ('text/x-smalltalk',)),
+    'SmalltalkLexer': ('pygments.lexers.other', 'Smalltalk', ('smalltalk', 'squeak', 'st'), ('*.st',), ('text/x-smalltalk',)),
     'SmartyLexer': ('pygments.lexers.templates', 'Smarty', ('smarty',), ('*.tpl',), ('application/x-smarty',)),
     'SnobolLexer': ('pygments.lexers.other', 'Snobol', ('snobol',), ('*.snobol',), ('text/x-snobol',)),
     'SourcePawnLexer': ('pygments.lexers.other', 'SourcePawn', ('sp',), ('*.sp',), ('text/x-sourcepawn',)),
-    'SourcesListLexer': ('pygments.lexers.text', 'Debian Sourcelist', ('sourceslist', 'sources.list'), ('sources.list',), ()),
+    'SourcesListLexer': ('pygments.lexers.text', 'Debian Sourcelist', ('sourceslist', 'sources.list', 'debsources'), ('sources.list',), ()),
     'SqlLexer': ('pygments.lexers.sql', 'SQL', ('sql',), ('*.sql',), ('text/x-sql',)),
     'SqliteConsoleLexer': ('pygments.lexers.sql', 'sqlite3con', ('sqlite3',), ('*.sqlite3-console',), ('text/x-sqlite3-console',)),
     'SquidConfLexer': ('pygments.lexers.text', 'SquidConf', ('squidconf', 'squid.conf', 'squid'), ('squid.conf',), ('text/x-squidconf',)),
     'SspLexer': ('pygments.lexers.templates', 'Scalate Server Page', ('ssp',), ('*.ssp',), ('application/x-ssp',)),
     'StanLexer': ('pygments.lexers.math', 'Stan', ('stan',), ('*.stan',), ()),
+    'SwigLexer': ('pygments.lexers.compiled', 'SWIG', ('Swig', 'swig'), ('*.swg', '*.i'), ('text/swig',)),
     'SystemVerilogLexer': ('pygments.lexers.hdl', 'systemverilog', ('systemverilog', 'sv'), ('*.sv', '*.svh'), ('text/x-systemverilog',)),
     'TclLexer': ('pygments.lexers.agile', 'Tcl', ('tcl',), ('*.tcl',), ('text/x-tcl', 'text/x-script.tcl', 'application/x-tcl')),
     'TcshLexer': ('pygments.lexers.shell', 'Tcsh', ('tcsh', 'csh'), ('*.tcsh', '*.csh'), ('application/x-csh',)),
     'XQueryLexer': ('pygments.lexers.web', 'XQuery', ('xquery', 'xqy', 'xq', 'xql', 'xqm'), ('*.xqy', '*.xquery', '*.xq', '*.xql', '*.xqm'), ('text/xquery', 'application/xquery')),
     'XmlDjangoLexer': ('pygments.lexers.templates', 'XML+Django/Jinja', ('xml+django', 'xml+jinja'), (), ('application/xml+django', 'application/xml+jinja')),
     'XmlErbLexer': ('pygments.lexers.templates', 'XML+Ruby', ('xml+erb', 'xml+ruby'), (), ('application/xml+ruby',)),
-    'XmlLexer': ('pygments.lexers.web', 'XML', ('xml',), ('*.xml', '*.xsl', '*.rss', '*.xslt', '*.xsd', '*.wsdl'), ('text/xml', 'application/xml', 'image/svg+xml', 'application/rss+xml', 'application/atom+xml')),
+    'XmlLexer': ('pygments.lexers.web', 'XML', ('xml',), ('*.xml', '*.xsl', '*.rss', '*.xslt', '*.xsd', '*.wsdl', '*.wsf'), ('text/xml', 'application/xml', 'image/svg+xml', 'application/rss+xml', 'application/atom+xml')),
     'XmlPhpLexer': ('pygments.lexers.templates', 'XML+PHP', ('xml+php',), (), ('application/xml+php',)),
     'XmlSmartyLexer': ('pygments.lexers.templates', 'XML+Smarty', ('xml+smarty',), (), ('application/xml+smarty',)),
     'XsltLexer': ('pygments.lexers.web', 'XSLT', ('xslt',), ('*.xsl', '*.xslt', '*.xpl'), ('application/xsl+xml', 'application/xslt+xml')),

pygments/lexers/agile.py

     }
 
     def analyse_text(text):
-        return shebang_matches(text, r'pythonw?(2(\.\d)?)?')
+        return shebang_matches(text, r'pythonw?(2(\.\d)?)?') or \
+            'import ' in text[:1000]
 
 
 class Python3Lexer(RegexLexer):
              r'exception occurred:\n\n', Generic.Traceback),
             (r'^The above exception was the direct cause of the '
              r'following exception:\n\n', Generic.Traceback),
+            (r'^(?=  File "[^"]+", line \d+)', Generic.Traceback, 'intb'),
         ],
         'intb': [
             (r'^(  File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)',
              bygroups(Text, Name.Builtin, Text, Number, Text, Name, Text)),
+            (r'^(  File )("[^"]+")(, line )(\d+)(\n)',
+             bygroups(Text, Name.Builtin, Text, Number, Text)),
             (r'^(    )(.+)(\n)',
              bygroups(Text, using(Python3Lexer), Text)),
             (r'^([ \t]*)(\.\.\.)(\n)',
             (r":'(\\\\|\\'|[^'])*'", String.Symbol),
             (r"'(\\\\|\\'|[^'])*'", String.Single),
             (r':"', String.Symbol, 'simple-sym'),
-            (r'([a-zA-Z_][a-zA-Z0-9]*)(:)',
+            (r'([a-zA-Z_][a-zA-Z0-9]*)(:)(?!:)',
              bygroups(String.Symbol, Punctuation)),  # Since Ruby 1.9
             (r'"', String.Double, 'simple-string'),
             (r'(?<!\.)`', String.Backtick, 'simple-backtick'),
 class Perl6Lexer(ExtendedRegexLexer):
     """
     For `Perl 6 <http://www.perl6.org>`_ source code.
+
+    *New in Pygments 1.7.*
     """
 
     name      = 'Perl6'

pygments/lexers/asm.py

     For Gas (AT&T) assembly code.
     """
     name = 'GAS'
-    aliases = ['gas']
+    aliases = ['gas', 'asm']
     filenames = ['*.s', '*.S']
     mimetypes = ['text/x-gas']
 

pygments/lexers/compiled.py

            'FortranLexer', 'GLShaderLexer', 'PrologLexer', 'CythonLexer',
            'ValaLexer', 'OocLexer', 'GoLexer', 'FelixLexer', 'AdaLexer',
            'Modula2Lexer', 'BlitzMaxLexer', 'BlitzBasicLexer', 'NimrodLexer',
-           'FantomLexer', 'RustLexer', 'CudaLexer', 'MonkeyLexer',
+           'FantomLexer', 'RustLexer', 'CudaLexer', 'MonkeyLexer', 'SwigLexer',
            'DylanLidLexer', 'DylanConsoleLexer', 'CobolLexer',
            'CobolFreeformatLexer', 'LogosLexer', 'ClayLexer']
 
         return 0.1
 
 
+class SwigLexer(CppLexer):
+    """
+    For `SWIG <http://www.swig.org/>`_ source code.
+
+    *New in Pygments 1.7.*
+    """
+    name = 'SWIG'
+    aliases = ['Swig', 'swig']
+    filenames = ['*.swg', '*.i']
+    mimetypes = ['text/swig']
+    priority = 0.04 # Lower than C/C++ and Objective C/C++
+
+    tokens = {
+        'statements': [
+            (r'(%[a-z_][a-z0-9_]*)', Name.Function), # SWIG directives
+            ('\$\**\&?[a-zA-Z0-9_]+', Name), # Special variables
+            (r'##*[a-zA-Z_][a-zA-Z0-9_]*', Comment.Preproc), # Stringification / additional preprocessor directives
+            inherit,
+         ],
+    }
+
+    # This is a far from complete set of SWIG directives
+    swig_directives = (
+        # Most common directives
+        '%apply', '%define', '%director', '%enddef', '%exception', '%extend',
+        '%feature', '%fragment', '%ignore', '%immutable', '%import', '%include',
+        '%inline', '%insert', '%module', '%newobject', '%nspace', '%pragma',
+        '%rename', '%shared_ptr', '%template', '%typecheck', '%typemap',
+        # Less common directives
+        '%arg', '%attribute', '%bang', '%begin', '%callback', '%catches', '%clear',
+        '%constant', '%copyctor', '%csconst', '%csconstvalue', '%csenum',
+        '%csmethodmodifiers', '%csnothrowexception', '%default', '%defaultctor',
+        '%defaultdtor', '%defined', '%delete', '%delobject', '%descriptor',
+        '%exceptionclass', '%exceptionvar', '%extend_smart_pointer', '%fragments',
+        '%header', '%ifcplusplus', '%ignorewarn', '%implicit', '%implicitconv',
+        '%init', '%javaconst', '%javaconstvalue', '%javaenum', '%javaexception',
+        '%javamethodmodifiers', '%kwargs', '%luacode', '%mutable', '%naturalvar',
+        '%nestedworkaround', '%perlcode', '%pythonabc', '%pythonappend',
+        '%pythoncallback', '%pythoncode', '%pythondynamic', '%pythonmaybecall',
+        '%pythonnondynamic', '%pythonprepend', '%refobject', '%shadow', '%sizeof',
+        '%trackobjects', '%types', '%unrefobject', '%varargs', '%warn', '%warnfilter')
+
+    def analyse_text(text):
+        rv = 0.1 # Same as C/C++
+        # Search for SWIG directives, which are conventionally at the beginning of
+        # a line. The probability of them being within a line is low, so let another
+        # lexer win in this case.
+        matches = re.findall(r'^\s*(%[a-z_][a-z0-9_]*)', text, re.M)
+        for m in matches:
+            if m in SwigLexer.swig_directives:
+                rv = 0.98
+                break
+            else:
+                rv = 0.91 # Fraction higher than MatlabLexer
+        return rv
+
+
 class ECLexer(CLexer):
     """
     For eC source code with preprocessor directives.
     """
     For `nesC <https://github.com/tinyos/nesc>`_ source code with preprocessor
     directives.
+
+    *New in Pygments 1.7.*
     """
     name = 'nesC'
     aliases = ['nesc']
                  ('#pop', 'oc_classname')),
                 (r'(@class|@protocol)(\s+)', bygroups(Keyword, Text),
                  ('#pop', 'oc_forward_classname')),
+                # @ can also prefix other expressions like @{...} or @(...)
+                (r'@', Punctuation),
                 inherit,
             ],
             'oc_classname' : [
             (r'^#.*', Comment.Single),
             (r'/\*', Comment.Multiline, 'nested-comment'),
             (r'%.*', Comment.Single),
-            (r'[0-9]+', Number),
+            # character literal
+            (r'0\'.', String.Char),
+            (r'0b[01]+', Number.Bin),
+            (r'0o[0-7]+', Number.Oct),
+            (r'0x[0-9a-fA-F]+', Number.Hex),
+            # literal with prepended base
+            (r'\d\d?\'[a-zA-Z0-9]+', Number.Integer),
+            (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
+            (r'\d+', Number.Integer),
             (r'[\[\](){}|.,;!]', Punctuation),
             (r':-|-->', Punctuation),
             (r'"(?:\\x[0-9a-fA-F]+\\|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|'
     """
 
     name = 'Cython'
-    aliases = ['cython', 'pyx']
+    aliases = ['cython', 'pyx', 'pyrex']
     filenames = ['*.pyx', '*.pxd', '*.pxi']
     mimetypes = ['text/x-cython', 'application/x-cython']
 
 class BlitzBasicLexer(RegexLexer):
     """
     For `BlitzBasic <http://blitzbasic.com>`_ source code.
+
+    *New in Pygments 1.7.*
     """
 
     name = 'BlitzBasic'

pygments/lexers/dotnet.py

 # Very close to functional.OcamlLexer
 class FSharpLexer(RegexLexer):
     """
-    For the F# language.
+    For the F# language (version 3.0).
 
     *New in Pygments 1.5.*
     """
     mimetypes = ['text/x-fsharp']
 
     keywords = [
-      'abstract', 'and', 'as', 'assert', 'base', 'begin', 'class',
-      'default', 'delegate', 'do', 'do!', 'done', 'downcast',
-      'downto', 'elif', 'else', 'end', 'exception', 'extern',
-      'false', 'finally', 'for', 'fun', 'function', 'global', 'if',
-      'in', 'inherit', 'inline', 'interface', 'internal', 'lazy',
-      'let', 'let!', 'match', 'member', 'module', 'mutable',
-      'namespace', 'new', 'null', 'of', 'open', 'or', 'override',
-      'private', 'public', 'rec', 'return', 'return!', 'sig',
-      'static', 'struct', 'then', 'to', 'true', 'try', 'type',
-      'upcast', 'use', 'use!', 'val', 'void', 'when', 'while',
-      'with', 'yield', 'yield!'
+      'abstract', 'as', 'assert', 'base', 'begin', 'class', 'default',
+      'delegate', 'do!', 'do', 'done', 'downcast', 'downto', 'elif', 'else',
+      'end', 'exception', 'extern', 'false', 'finally', 'for', 'function',
+      'fun', 'global', 'if', 'inherit', 'inline', 'interface', 'internal',
+      'in', 'lazy', 'let!', 'let', 'match', 'member', 'module', 'mutable',
+      'namespace', 'new', 'null', 'of', 'open', 'override', 'private', 'public',
+      'rec', 'return!', 'return', 'select', 'static', 'struct', 'then', 'to',
+      'true', 'try', 'type', 'upcast', 'use!', 'use', 'val', 'void', 'when',
+      'while', 'with', 'yield!', 'yield',
+    ]
+    # Reserved words; cannot hurt to color them as keywords too.
+    keywords += [
+        'atomic', 'break', 'checked', 'component', 'const', 'constraint',
+        'constructor', 'continue', 'eager', 'event', 'external', 'fixed',
+        'functor', 'include', 'method', 'mixin', 'object', 'parallel',
+        'process', 'protected', 'pure', 'sealed', 'tailcall', 'trait',
+        'virtual', 'volatile',
     ]
     keyopts = [
-      '!=','#','&&','&','\(','\)','\*','\+',',','-\.',
-      '->','-','\.\.','\.','::',':=',':>',':',';;',';','<-',
-      '<','>]','>','\?\?','\?','\[<','\[>','\[\|','\[',
-      ']','_','`','{','\|\]','\|','}','~','<@','=','@>'
+      '!=', '#', '&&', '&', '\(', '\)', '\*', '\+', ',', '-\.',
+      '->', '-', '\.\.', '\.', '::', ':=', ':>', ':', ';;', ';', '<-',
+      '<\]', '<', '>\]', '>', '\?\?', '\?', '\[<', '\[\|', '\[', '\]',
+      '_', '`', '{', '\|\]', '\|', '}', '~', '<@@', '<@', '=', '@>', '@@>',
     ]
 
     operators = r'[!$%&*+\./:<=>?@^|~-]'
-    word_operators = ['and', 'asr', 'land', 'lor', 'lsl', 'lxor', 'mod', 'not', 'or']
+    word_operators = ['and', 'or', 'not']
     prefix_syms = r'[!?~]'
     infix_syms = r'[=<>@^|&+\*/$%-]'
-    primitives = ['unit', 'int', 'float', 'bool', 'string', 'char', 'list', 'array',
-                  'byte', 'sbyte', 'int16', 'uint16', 'uint32', 'int64', 'uint64'
-                  'nativeint', 'unativeint', 'decimal', 'void', 'float32', 'single',
-                  'double']
+    primitives = [
+        'sbyte', 'byte', 'char', 'nativeint', 'unativeint', 'float32', 'single',
+        'float', 'double', 'int8', 'uint8', 'int16', 'uint16', 'int32',
+        'uint32', 'int64', 'uint64', 'decimal', 'unit', 'bool', 'string',
+        'list', 'exn', 'obj', 'enum',
+    ]
+
+    # See http://msdn.microsoft.com/en-us/library/dd233181.aspx and/or
+    # http://fsharp.org/about/files/spec.pdf for reference.  Good luck.
 
     tokens = {
         'escape-sequence': [
-            (r'\\[\\\"\'ntbr]', String.Escape),
+            (r'\\[\\\"\'ntbrafv]', String.Escape),
             (r'\\[0-9]{3}', String.Escape),
-            (r'\\x[0-9a-fA-F]{2}', String.Escape),
+            (r'\\u[0-9a-fA-F]{4}', String.Escape),
+            (r'\\U[0-9a-fA-F]{8}', String.Escape),
         ],
         'root': [
             (r'\s+', Text),
-            (r'false|true|\(\)|\[\]', Name.Builtin.Pseudo),
-            (r'\b([A-Z][A-Za-z0-9_\']*)(?=\s*\.)',
+            (r'\(\)|\[\]', Name.Builtin.Pseudo),
+            (r'\b(?<!\.)([A-Z][A-Za-z0-9_\']*)(?=\s*\.)',
              Name.Namespace, 'dotted'),
-            (r'\b([A-Z][A-Za-z0-9_\']*)', Name.Class),
+            (r'\b([A-Z][A-Za-z0-9_\']*)', Name),
+            (r'///.*?\n', String.Doc),
             (r'//.*?\n', Comment.Single),
             (r'\(\*(?!\))', Comment, 'comment'),
+
+            (r'@"', String, 'lstring'),
+            (r'"""', String, 'tqs'),
+            (r'"', String, 'string'),
+
+            (r'\b(open|module)(\s+)([a-zA-Z0-9_.]+)',
+             bygroups(Keyword, Text, Name.Namespace)),
+            (r'\b(let!?)(\s+)([a-zA-Z0-9_]+)',
+             bygroups(Keyword, Text, Name.Variable)),
+            (r'\b(type)(\s+)([a-zA-Z0-9_]+)',
+             bygroups(Keyword, Text, Name.Class)),
+            (r'\b(member|override)(\s+)([a-zA-Z0-9_]+)(\.)([a-zA-Z0-9_]+)',
+             bygroups(Keyword, Text, Name, Punctuation, Name.Function)),
             (r'\b(%s)\b' % '|'.join(keywords), Keyword),
             (r'(%s)' % '|'.join(keyopts), Operator),
             (r'(%s|%s)?%s' % (infix_syms, prefix_syms, operators), Operator),
             (r'\b(%s)\b' % '|'.join(word_operators), Operator.Word),
             (r'\b(%s)\b' % '|'.join(primitives), Keyword.Type),
-
-            (r'#[ \t]*(if|endif|else|line|nowarn|light)\b.*?\n',
+            (r'#[ \t]*(if|endif|else|line|nowarn|light|\d+)\b.*?\n',
              Comment.Preproc),
 
             (r"[^\W\d][\w']*", Name),
 
-            (r'\d[\d_]*', Number.Integer),
-            (r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex),
-            (r'0[oO][0-7][0-7_]*', Number.Oct),
-            (r'0[bB][01][01_]*', Number.Binary),
-            (r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)', Number.Float),
+            (r'\d[\d_]*[uU]?[yslLnQRZINGmM]?', Number.Integer),
+            (r'0[xX][\da-fA-F][\da-fA-F_]*[uU]?[yslLn]?[fF]?', Number.Hex),
+            (r'0[oO][0-7][0-7_]*[uU]?[yslLn]?', Number.Oct),
+            (r'0[bB][01][01_]*[uU]?[yslLn]?', Number.Binary),
+            (r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)[fFmM]?',
+             Number.Float),
 
-            (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'",
+            (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'B?",
              String.Char),
             (r"'.'", String.Char),
             (r"'", Keyword), # a stray quote is another syntax element
 
-            (r'"', String.Double, 'string'),
-
             (r'[~?][a-z][\w\']*:', Name.Variable),
         ],
-        'comment': [
-            (r'[^(*)]+', Comment),
-            (r'\(\*', Comment, '#push'),
-            (r'\*\)', Comment, '#pop'),
-            (r'[(*)]', Comment),
-        ],
-        'string': [
-            (r'[^\\"]+', String.Double),
-            include('escape-sequence'),
-            (r'\\\n', String.Double),
-            (r'"', String.Double, '#pop'),
-        ],
         'dotted': [
             (r'\s+', Text),
             (r'\.', Punctuation),
             (r'[A-Z][A-Za-z0-9_\']*(?=\s*\.)', Name.Namespace),
-            (r'[A-Z][A-Za-z0-9_\']*', Name.Class, '#pop'),
+            (r'[A-Z][A-Za-z0-9_\']*', Name, '#pop'),
             (r'[a-z_][A-Za-z0-9_\']*', Name, '#pop'),
         ],
+        'comment': [
+            (r'[^(*)@"]+', Comment),
+            (r'\(\*', Comment, '#push'),
+            (r'\*\)', Comment, '#pop'),
+            # comments cannot be closed within strings in comments
+            (r'@"', String, 'lstring'),
+            (r'"""', String, 'tqs'),
+            (r'"', String, 'string'),
+            (r'[(*)@]', Comment),
+        ],
+        'string': [
+            (r'[^\\"]+', String),
+            include('escape-sequence'),
+            (r'\\\n', String),
+            (r'\n', String),  # newlines are allowed in any string
+            (r'"B?', String, '#pop'),
+        ],
+        'lstring': [
+            (r'[^"]+', String),
+            (r'\n', String),
+            (r'""', String),
+            (r'"B?', String, '#pop'),
+        ],
+        'tqs': [
+            (r'[^"]+', String),
+            (r'\n', String),
+            (r'"""B?', String, '#pop'),
+            (r'"', String),
+        ],
     }

pygments/lexers/functional.py

      String, Number, Punctuation, Literal, Generic, Error
 
 __all__ = ['RacketLexer', 'SchemeLexer', 'CommonLispLexer', 'HaskellLexer',
-           'LiterateHaskellLexer', 'SMLLexer', 'OcamlLexer', 'ErlangLexer',
-           'ErlangShellLexer', 'OpaLexer', 'CoqLexer', 'NewLispLexer',
-           'ElixirLexer', 'ElixirConsoleLexer', 'KokaLexer']
+           'AgdaLexer', 'LiterateHaskellLexer', 'LiterateAgdaLexer',
+           'SMLLexer', 'OcamlLexer', 'ErlangLexer', 'ErlangShellLexer',
+           'OpaLexer', 'CoqLexer', 'NewLispLexer', 'ElixirLexer',
+           'ElixirConsoleLexer', 'KokaLexer']
+
+
+line_re = re.compile('.*?\n')
 
 
 class RacketLexer(RegexLexer):
     *New in Pygments 0.9.*
     """
     name = 'Common Lisp'
-    aliases = ['common-lisp', 'cl']
+    aliases = ['common-lisp', 'cl', 'lisp']
     filenames = ['*.cl', '*.lisp', '*.el']  # use for Elisp too
     mimetypes = ['text/x-common-lisp']
 
             (r'\(', Punctuation, ('funclist', 'funclist')),
             (r'\)', Punctuation, '#pop:2'),
         ],
+        # NOTE: the next four states are shared in the AgdaLexer; make sure
+        # any change is compatible with Agda as well or copy over and change
         'comment': [
             # Multiline Comments
             (r'[^-{}]+', Comment.Multiline),
     }
 
 
-line_re = re.compile('.*?\n')
-bird_re = re.compile(r'(>[ \t]*)(.*\n)')
+class AgdaLexer(RegexLexer):
+    """
+    For the `Agda <http://wiki.portal.chalmers.se/agda/pmwiki.php>`_
+    dependently typed functional programming language and proof assistant.
 
-class LiterateHaskellLexer(Lexer):
+    *New in Pygments 1.7.*
     """
-    For Literate Haskell (Bird-style or LaTeX) source.
+
+    name = 'Agda'
+    aliases = ['agda']
+    filenames = ['*.agda']
+    mimetypes = ['text/x-agda']
+
+    reserved = ['abstract', 'codata', 'coinductive', 'constructor', 'data',
+                'field', 'forall', 'hiding', 'in', 'inductive', 'infix',
+                'infixl', 'infixr', 'let', 'open', 'pattern', 'primitive',
+                'private', 'mutual', 'quote', 'quoteGoal', 'quoteTerm',
+                'record', 'syntax', 'rewrite', 'unquote', 'using', 'where',
+                'with']
+
+    tokens = {
+        'root': [
+            # Declaration
+            (r'^(\s*)([^\s\(\)\{\}]+)(\s*)(:)(\s*)',
+             bygroups(Text, Name.Function, Text, Operator.Word, Text)),
+            # Comments
+            (r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single),
+            (r'{-', Comment.Multiline, 'comment'),
+            # Holes
+            (r'{!', Comment.Directive, 'hole'),
+            # Lexemes:
+            #  Identifiers
+            (ur'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
+            (r'(import|module)(\s+)', bygroups(Keyword.Reserved, Text), 'module'),
+            (r'\b(Set|Prop)\b', Keyword.Type),
+            #  Special Symbols
+            (r'(\(|\)|\{|\})', Operator),
+            (ur'(\.{1,3}|\||[\u039B]|[\u2200]|[\u2192]|:|=|->)', Operator.Word),
+            #  Numbers
+            (r'\d+[eE][+-]?\d+', Number.Float),
+            (r'\d+\.\d+([eE][+-]?\d+)?', Number.Float),
+            (r'0[xX][\da-fA-F]+', Number.Hex),
+            (r'\d+', Number.Integer),
+            # Strings
+            (r"'", String.Char, 'character'),
+            (r'"', String, 'string'),
+            (r'[^\s\(\)\{\}]+', Text),
+            (r'\s+?', Text),  # Whitespace
+        ],
+        'hole': [
+            # Holes
+            (r'[^!{}]+', Comment.Directive),
+            (r'{!', Comment.Directive, '#push'),
+            (r'!}', Comment.Directive, '#pop'),
+            (r'[!{}]', Comment.Directive),
+        ],
+        'module': [
+            (r'{-', Comment.Multiline, 'comment'),
+            (r'[a-zA-Z][a-zA-Z0-9_.]*', Name, '#pop'),
+            (r'[^a-zA-Z]*', Text)
+        ],
+        'comment': HaskellLexer.tokens['comment'],
+        'character': HaskellLexer.tokens['character'],
+        'string': HaskellLexer.tokens['string'],
+        'escape': HaskellLexer.tokens['escape']
+    }
+
+
+class LiterateLexer(Lexer):
+    """
+    Base class for lexers of literate file formats based on LaTeX or Bird-style
+    (prefixing each code line with ">").
 
     Additional options accepted:
 
         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.
+    """
 
-    *New in Pygments 0.9.*
-    """
-    name = 'Literate Haskell'
-    aliases = ['lhs', 'literate-haskell']
-    filenames = ['*.lhs']
-    mimetypes = ['text/x-literate-haskell']
+    bird_re = re.compile(r'(>[ \t]*)(.*\n)')
+
+    def __init__(self, baselexer, **options):
+        self.baselexer = baselexer
+        Lexer.__init__(self, **options)
 
     def get_tokens_unprocessed(self, text):
-        hslexer = HaskellLexer(**self.options)
-
         style = self.options.get('litstyle')
         if style is None:
             style = (text.lstrip()[0:1] in '%\\') and 'latex' or 'bird'
             # bird-style
             for match in line_re.finditer(text):
                 line = match.group()
-                m = bird_re.match(line)
+                m = self.bird_re.match(line)
                 if m:
                     insertions.append((len(code),
                                        [(0, Comment.Special, m.group(1))]))
             # latex-style
             from pygments.lexers.text import TexLexer
             lxlexer = TexLexer(**self.options)
-
             codelines = 0
             latex = ''
             for match in line_re.finditer(text):
                     latex += line
             insertions.append((len(code),
                                list(lxlexer.get_tokens_unprocessed(latex))))
-        for item in do_insertions(insertions, hslexer.get_tokens_unprocessed(code)):
+        for item in do_insertions(insertions, self.baselexer.get_tokens_unprocessed(code)):
             yield item
 
 
+class LiterateHaskellLexer(LiterateLexer):
+    """
+    For Literate Haskell (Bird-style or LaTeX) source.
+
+    Additional options accepted:
+
+    `litstyle`
+        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.
+
+    *New in Pygments 0.9.*
+    """
+    name = 'Literate Haskell'
+    aliases = ['lhs', 'literate-haskell', 'lhaskell']
+    filenames = ['*.lhs']
+    mimetypes = ['text/x-literate-haskell']
+
+    def __init__(self, **options):
+        hslexer = HaskellLexer(**options)
+        LiterateLexer.__init__(self, hslexer, **options)
+
+
+class LiterateAgdaLexer(LiterateLexer):
+    """
+    For Literate Agda source.
+
+    Additional options accepted:
+
+    `litstyle`
+        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.
+
+    *New in Pygments 1.7.*
+    """
+    name = 'Literate Agda'
+    aliases = ['lagda', 'literate-agda']
+    filenames = ['*.lagda']
+    mimetypes = ['text/x-literate-agda']
+
+    def __init__(self, **options):
+        agdalexer = AgdaLexer(**options)
+        LiterateLexer.__init__(self, agdalexer, litstyle='latex', **options)
+
+
 class SMLLexer(RegexLexer):
     """
     For the Standard ML language.
 
 class KokaLexer(RegexLexer):
     """
-    Lexer for the `Koka <http://research.microsoft.com/en-us/projects/koka/>`_
+    Lexer for the `Koka <http://koka.codeplex.com>`_
     language.
 
     *New in Pygments 1.6.*
     mimetypes = ['text/x-koka']
 
     keywords = [
-        'infix', 'infixr', 'infixl', 'prefix', 'postfix',
+        'infix', 'infixr', 'infixl',
         'type', 'cotype', 'rectype', 'alias',
         'struct', 'con',
         'fun', 'function', 'val', 'var',
     sboundary = '(?!'+symbols+')'
 
     # name boundary: a keyword should not be followed by any of these
-    boundary = '(?![a-zA-Z0-9_\\-])'
+    boundary = '(?![\w/])'
+
+    # koka token abstractions
+    tokenType = Name.Attribute
+    tokenTypeDef = Name.Class
+    tokenConstructor = Generic.Emph
 
     # main lexer
     tokens = {
             include('whitespace'),
 
             # go into type mode
-            (r'::?' + sboundary, Keyword.Type, 'type'),
-            (r'alias' + boundary, Keyword, 'alias-type'),
-            (r'struct' + boundary, Keyword, 'struct-type'),
-            (r'(%s)' % '|'.join(typeStartKeywords) + boundary, Keyword, 'type'),
+            (r'::?' + sboundary, tokenType, 'type'),
+            (r'(alias)(\s+)([a-z]\w*)?', bygroups(Keyword, Text, tokenTypeDef),
+             'alias-type'),
+            (r'(struct)(\s+)([a-z]\w*)?', bygroups(Keyword, Text, tokenTypeDef),
+             'struct-type'),
+            ((r'(%s)' % '|'.join(typeStartKeywords)) +
+             r'(\s+)([a-z]\w*)?', bygroups(Keyword, Text, tokenTypeDef),
+             'type'),
 
             # special sequences of tokens (we use ?: for non-capturing group as
             # required by 'bygroups')
-            (r'(module)(\s*)((?:interface)?)(\s*)'
-             r'((?:[a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*\.)*'
-             r'[a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*)',
-             bygroups(Keyword, Text, Keyword, Text, Name.Namespace)),
-            (r'(import)(\s+)((?:[a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*\.)*[a-z]'
-             r'(?:[a-zA-Z0-9_]|\-[a-zA-Z])*)(\s*)((?:as)?)'
-             r'((?:[A-Z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*)?)',
-             bygroups(Keyword, Text, Name.Namespace, Text, Keyword,
-                      Name.Namespace)),
+            (r'(module)(\s+)(interface\s+)?((?:[a-z]\w*/)*[a-z]\w*)',
+             bygroups(Keyword, Text, Keyword, Name.Namespace)),
+            (r'(import)(\s+)((?:[a-z]\w*/)*[a-z]\w*)'
+             r'(?:(\s*)(=)(\s*)((?:qualified\s*)?)'
+             r'((?:[a-z]\w*/)*[a-z]\w*))?',
+             bygroups(Keyword, Text, Name.Namespace, Text, Keyword, Text,
+                      Keyword, Name.Namespace)),
+
+            (r'(^(?:(?:public|private)\s*)?(?:function|fun|val))'
+             r'(\s+)([a-z]\w*|\((?:' + symbols + r'|/)\))',
+             bygroups(Keyword, Text, Name.Function)),
+            (r'(^(?:(?:public|private)\s*)?external)(\s+)(inline\s+)?'
+             r'([a-z]\w*|\((?:' + symbols + r'|/)\))',
+             bygroups(Keyword, Text, Keyword, Name.Function)),
 
             # keywords
             (r'(%s)' % '|'.join(typekeywords) + boundary, Keyword.Type),
             (r'(%s)' % '|'.join(keywords) + boundary, Keyword),
             (r'(%s)' % '|'.join(builtin) + boundary, Keyword.Pseudo),
-            (r'::|:=|\->|[=\.:]' + sboundary, Keyword),
-            (r'\-' + sboundary, Generic.Strong),
+            (r'::?|:=|\->|[=\.]' + sboundary, Keyword),
 
             # names
-            (r'[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?=\.)', Name.Namespace),
-            (r'[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?!\.)', Name.Class),
-            (r'[a-z]([a-zA-Z0-9_]|\-[a-zA-Z])*', Name),
-            (r'_([a-zA-Z0-9_]|\-[a-zA-Z])*', Name.Variable),
+            (r'((?:[a-z]\w*/)*)([A-Z]\w*)',
+             bygroups(Name.Namespace, tokenConstructor)),
+            (r'((?:[a-z]\w*/)*)([a-z]\w*)', bygroups(Name.Namespace, Name)),
+            (r'((?:[a-z]\w*/)*)(\((?:' + symbols + r'|/)\))',
+             bygroups(Name.Namespace, Name)),
+            (r'_\w*', Name.Variable),
 
             # literal string
             (r'@"', String.Double, 'litstring'),
 
             # operators
-            (symbols, Operator),
+            (symbols + "|/(?![\*/])", Operator),
             (r'`', Operator),
             (r'[\{\}\(\)\[\];,]', Punctuation),
 
 
         # type started by colon
         'type': [
-            (r'[\(\[<]', Keyword.Type, 'type-nested'),
+            (r'[\(\[<]', tokenType, 'type-nested'),
             include('type-content')
         ],
 
         # type nested in brackets: can contain parameters, comma etc.
         'type-nested': [
-            (r'[\)\]>]', Keyword.Type, '#pop'),
-            (r'[\(\[<]', Keyword.Type, 'type-nested'),
-            (r',', Keyword.Type),
-            (r'([a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*)(\s*)(:)(?!:)',
-             bygroups(Name.Variable,Text,Keyword.Type)),  # parameter name
+            (r'[\)\]>]', tokenType, '#pop'),
+            (r'[\(\[<]', tokenType, 'type-nested'),
+            (r',', tokenType),
+            (r'([a-z]\w*)(\s*)(:)(?!:)',
+             bygroups(Name, Text, tokenType)),  # parameter name
             include('type-content')
         ],
 
             include('whitespace'),
 
             # keywords
-            (r'(%s)' % '|'.join(typekeywords) + boundary, Keyword.Type),
+            (r'(%s)' % '|'.join(typekeywords) + boundary, Keyword),
             (r'(?=((%s)' % '|'.join(keywords) + boundary + '))',
              Keyword, '#pop'),  # need to match because names overlap...
 
             # kinds
-            (r'[EPH]' + boundary, Keyword.Type),
-            (r'[*!]', Keyword.Type),
+            (r'[EPHVX]' + boundary, tokenType),
 
             # type names
-            (r'[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?=\.)', Name.Namespace),
-            (r'[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?!\.)', Name.Class),
-            (r'[a-z][0-9]*(?![a-zA-Z_\-])', Keyword.Type),   # Generic.Emph
-            (r'_([a-zA-Z0-9_]|\-[a-zA-Z])*', Keyword.Type),  # Generic.Emph
-            (r'[a-z]([a-zA-Z0-9_]|\-[a-zA-Z])*', Keyword.Type),
+            (r'[a-z][0-9]*(?![\w/])', tokenType ),
+            (r'_\w*', tokenType.Variable),  # Generic.Emph
+            (r'((?:[a-z]\w*/)*)([A-Z]\w*)',
+             bygroups(Name.Namespace, tokenType)),
+            (r'((?:[a-z]\w*/)*)([a-z]\w+)',
+             bygroups(Name.Namespace, tokenType)),
 
             # type keyword operators
-            (r'::|\->|[\.:|]', Keyword.Type),
+            (r'::|\->|[\.:|]', tokenType),
 
             #catchall
             (r'', Text, '#pop')
 
         # comments and literals
         'whitespace': [
+            (r'\n\s*#.*$', Comment.Preproc),
             (r'\s+', Text),
             (r'/\*', Comment.Multiline, 'comment'),
             (r'//.*$', Comment.Single)
             (r'[\'\n]', String.Char, '#pop'),
         ],
         'escape-sequence': [
-            (r'\\[abfnrtv0\\\"\'\?]', String.Escape),
+            (r'\\[nrt\\\"\']', String.Escape),
             (r'\\x[0-9a-fA-F]{2}', String.Escape),
             (r'\\u[0-9a-fA-F]{4}', String.Escape),
             # Yes, \U literals are 6 hex digits.
             (r'\\U[0-9a-fA-F]{6}', String.Escape)
         ]
     }
-

File contents unchanged.

pygments/lexers/math.py

 __all__ = ['JuliaLexer', 'JuliaConsoleLexer', 'MuPADLexer', 'MatlabLexer',
            'MatlabSessionLexer', 'OctaveLexer', 'ScilabLexer', 'NumPyLexer',
            'RConsoleLexer', 'SLexer', 'JagsLexer', 'BugsLexer', 'StanLexer',
-           'IDLLexer', 'RdLexer']
+           'IDLLexer', 'RdLexer', 'IgorLexer']
 
 
 class JuliaLexer(RegexLexer):
             else:
                 yield index, token, value
 
+    def analyse_text(text):
+        return (shebang_matches(text, r'pythonw?(2(\.\d)?)?') or
+                'import ' in text[:1000]) \
+            and ('import numpy' in text or 'from numpy import' in text)
+
 
 class RConsoleLexer(Lexer):
     """
     }
 
     def analyse_text(text):
-        return '<-' in text
+        if re.search(r'[a-z0-9_\])\s]<-(?!-)', text):
+            return 0.11
 
 
 class BugsLexer(RegexLexer):
             return 0
 
 class StanLexer(RegexLexer):
-    """Pygments Lexer for Stan models. 
+    """Pygments Lexer for Stan models.
 
     The Stan modeling language is specified in the *Stan 1.3.0
     Modeling Language Manual* `pdf
             (r'.', Text),
             ]
         }
+
+
+class IgorLexer(RegexLexer):
+    """
+    Pygments Lexer for Igor Pro procedure files (.ipf).
+    See http://www.wavemetrics.com/ and http://www.igorexchange.com/.
+
+    *New in Pygments 1.7.*
+    """
+
+    name = 'Igor'
+    aliases = ['igor', 'igorpro']
+    filenames = ['*.ipf']
+    mimetypes = ['text/ipf']
+
+    flags = re.IGNORECASE
+
+    flowControl = [
+        'if', 'else', 'elseif', 'endif', 'for', 'endfor', 'strswitch', 'switch',
+        'case', 'endswitch', 'do', 'while', 'try', 'catch', 'endtry', 'break',
+        'continue', 'return',
+    ]
+    types = [
+        'variable', 'string', 'constant', 'strconstant', 'NVAR', 'SVAR', 'WAVE',
+        'STRUCT', 'ThreadSafe', 'function', 'end', 'static', 'macro', 'window',
+        'graph', 'Structure', 'EndStructure', 'EndMacro', 'FuncFit', 'Proc',
+        'Picture', 'Menu', 'SubMenu', 'Prompt', 'DoPrompt',
+    ]
+    operations = [
+        'Abort', 'AddFIFOData', 'AddFIFOVectData', 'AddMovieAudio',
+        'AddMovieFrame', 'APMath', 'Append', 'AppendImage',
+        'AppendLayoutObject', 'AppendMatrixContour', 'AppendText',
+        'AppendToGraph', 'AppendToLayout', 'AppendToTable', 'AppendXYZContour',
+        'AutoPositionWindow', 'BackgroundInfo', 'Beep', 'BoundingBall',
+        'BrowseURL', 'BuildMenu', 'Button', 'cd', 'Chart', 'CheckBox',
+        'CheckDisplayed', 'ChooseColor', 'Close', 'CloseMovie', 'CloseProc',
+        'ColorScale', 'ColorTab2Wave', 'Concatenate', 'ControlBar',
+        'ControlInfo', 'ControlUpdate', 'ConvexHull', 'Convolve', 'CopyFile',
+        'CopyFolder', 'CopyScales', 'Correlate', 'CreateAliasShortcut', 'Cross',
+        'CtrlBackground', 'CtrlFIFO', 'CtrlNamedBackground', 'Cursor',
+        'CurveFit', 'CustomControl', 'CWT', 'Debugger', 'DebuggerOptions',
+        'DefaultFont', 'DefaultGuiControls', 'DefaultGuiFont', 'DefineGuide',
+        'DelayUpdate', 'DeleteFile', 'DeleteFolder', 'DeletePoints',
+        'Differentiate', 'dir', 'Display', 'DisplayHelpTopic',
+        'DisplayProcedure', 'DoAlert', 'DoIgorMenu', 'DoUpdate', 'DoWindow',
+        'DoXOPIdle', 'DrawAction', 'DrawArc', 'DrawBezier', 'DrawLine',
+        'DrawOval', 'DrawPICT', 'DrawPoly', 'DrawRect', 'DrawRRect', 'DrawText',
+        'DSPDetrend', 'DSPPeriodogram', 'Duplicate', 'DuplicateDataFolder',
+        'DWT', 'EdgeStats', 'Edit', 'ErrorBars', 'Execute', 'ExecuteScriptText',
+        'ExperimentModified', 'Extract', 'FastGaussTransform', 'FastOp',
+        'FBinRead', 'FBinWrite', 'FFT', 'FIFO2Wave', 'FIFOStatus', 'FilterFIR',
+        'FilterIIR', 'FindLevel', 'FindLevels', 'FindPeak', 'FindPointsInPoly',
+        'FindRoots', 'FindSequence', 'FindValue', 'FPClustering', 'fprintf',
+        'FReadLine', 'FSetPos', 'FStatus', 'FTPDelete', 'FTPDownload',
+        'FTPUpload', 'FuncFit', 'FuncFitMD', 'GetAxis', 'GetFileFolderInfo',
+        'GetLastUserMenuInfo', 'GetMarquee', 'GetSelection', 'GetWindow',
+        'GraphNormal', 'GraphWaveDraw', 'GraphWaveEdit', 'Grep', 'GroupBox',
+        'Hanning', 'HideIgorMenus', 'HideInfo', 'HideProcedures', 'HideTools',
+        'HilbertTransform', 'Histogram', 'IFFT', 'ImageAnalyzeParticles',
+        'ImageBlend', 'ImageBoundaryToMask', 'ImageEdgeDetection',
+        'ImageFileInfo', 'ImageFilter', 'ImageFocus', 'ImageGenerateROIMask',
+        'ImageHistModification', 'ImageHistogram', 'ImageInterpolate',
+        'ImageLineProfile', 'ImageLoad', 'ImageMorphology', 'ImageRegistration',
+        'ImageRemoveBackground', 'ImageRestore', 'ImageRotate', 'ImageSave',
+        'ImageSeedFill', 'ImageSnake', 'ImageStats', 'ImageThreshold',
+        'ImageTransform', 'ImageUnwrapPhase', 'ImageWindow', 'IndexSort',
+        'InsertPoints', 'Integrate', 'IntegrateODE', 'Interp3DPath',
+        'Interpolate3D', 'KillBackground', 'KillControl', 'KillDataFolder',
+        'KillFIFO', 'KillFreeAxis', 'KillPath', 'KillPICTs', 'KillStrings',
+        'KillVariables', 'KillWaves', 'KillWindow', 'KMeans', 'Label', 'Layout',
+        'Legend', 'LinearFeedbackShiftRegister', 'ListBox', 'LoadData',
+        'LoadPackagePreferences', 'LoadPICT', 'LoadWave', 'Loess',
+        'LombPeriodogram', 'Make', 'MakeIndex', 'MarkPerfTestTime',
+        'MatrixConvolve', 'MatrixCorr', 'MatrixEigenV', 'MatrixFilter',
+        'MatrixGaussJ', 'MatrixInverse', 'MatrixLinearSolve',
+        'MatrixLinearSolveTD', 'MatrixLLS', 'MatrixLUBkSub', 'MatrixLUD',
+        'MatrixMultiply', 'MatrixOP', 'MatrixSchur', 'MatrixSolve',
+        'MatrixSVBkSub', 'MatrixSVD', 'MatrixTranspose', 'MeasureStyledText',
+        'Modify', 'ModifyContour', 'ModifyControl', 'ModifyControlList',
+        'ModifyFreeAxis', 'ModifyGraph', 'ModifyImage', 'ModifyLayout',
+        'ModifyPanel', 'ModifyTable', 'ModifyWaterfall', 'MoveDataFolder',
+        'MoveFile', 'MoveFolder', 'MoveString', 'MoveSubwindow', 'MoveVariable',
+        'MoveWave', 'MoveWindow', 'NeuralNetworkRun', 'NeuralNetworkTrain',
+        'NewDataFolder', 'NewFIFO', 'NewFIFOChan', 'NewFreeAxis', 'NewImage',
+        'NewLayout', 'NewMovie', 'NewNotebook', 'NewPanel', 'NewPath',
+        'NewWaterfall', 'Note', 'Notebook', 'NotebookAction', 'Open',
+        'OpenNotebook', 'Optimize', 'ParseOperationTemplate', 'PathInfo',
+        'PauseForUser', 'PauseUpdate', 'PCA', 'PlayMovie', 'PlayMovieAction',
+        'PlaySnd', 'PlaySound', 'PopupContextualMenu', 'PopupMenu',
+        'Preferences', 'PrimeFactors', 'Print', 'printf', 'PrintGraphs',
+        'PrintLayout', 'PrintNotebook', 'PrintSettings', 'PrintTable',
+        'Project', 'PulseStats', 'PutScrapText', 'pwd', 'Quit',
+        'RatioFromNumber', 'Redimension', 'Remove', 'RemoveContour',
+        'RemoveFromGraph', 'RemoveFromLayout', 'RemoveFromTable', 'RemoveImage',
+        'RemoveLayoutObjects', 'RemovePath', 'Rename', 'RenameDataFolder',
+        'RenamePath', 'RenamePICT', 'RenameWindow', 'ReorderImages',
+        'ReorderTraces', 'ReplaceText', 'ReplaceWave', 'Resample',
+        'ResumeUpdate', 'Reverse', 'Rotate', 'Save', 'SaveData',
+        'SaveExperiment', 'SaveGraphCopy', 'SaveNotebook',
+        'SavePackagePreferences', 'SavePICT', 'SaveTableCopy',
+        'SetActiveSubwindow', 'SetAxis', 'SetBackground', 'SetDashPattern',
+        'SetDataFolder', 'SetDimLabel', 'SetDrawEnv', 'SetDrawLayer',
+        'SetFileFolderInfo', 'SetFormula', 'SetIgorHook', 'SetIgorMenuMode',
+        'SetIgorOption', 'SetMarquee', 'SetProcessSleep', 'SetRandomSeed',
+        'SetScale', 'SetVariable', 'SetWaveLock', 'SetWindow', 'ShowIgorMenus',
+        'ShowInfo', 'ShowTools', 'Silent', 'Sleep', 'Slider', 'Smooth',
+        'SmoothCustom', 'Sort', 'SoundInRecord', 'SoundInSet',
+        'SoundInStartChart', 'SoundInStatus', 'SoundInStopChart',
+        'SphericalInterpolate', 'SphericalTriangulate', 'SplitString',
+        'sprintf', 'sscanf', 'Stack', 'StackWindows',
+        'StatsAngularDistanceTest', 'StatsANOVA1Test', 'StatsANOVA2NRTest',
+        'StatsANOVA2RMTest', 'StatsANOVA2Test', 'StatsChiTest',
+        'StatsCircularCorrelationTest', 'StatsCircularMeans',
+        'StatsCircularMoments', 'StatsCircularTwoSampleTest',
+        'StatsCochranTest', 'StatsContingencyTable', 'StatsDIPTest',
+        'StatsDunnettTest', 'StatsFriedmanTest', 'StatsFTest',
+        'StatsHodgesAjneTest', 'StatsJBTest', 'StatsKendallTauTest',
+        'StatsKSTest', 'StatsKWTest', 'StatsLinearCorrelationTest',
+        'StatsLinearRegression', 'StatsMultiCorrelationTest',
+        'StatsNPMCTest', 'StatsNPNominalSRTest', 'StatsQuantiles',
+        'StatsRankCorrelationTest', 'StatsResample', 'StatsSample',
+        'StatsScheffeTest', 'StatsSignTest', 'StatsSRTest', 'StatsTTest',
+        'StatsTukeyTest', 'StatsVariancesTest', 'StatsWatsonUSquaredTest',
+        'StatsWatsonWilliamsTest', 'StatsWheelerWatsonTest',
+        'StatsWilcoxonRankTest', 'StatsWRCorrelationTest', 'String',
+        'StructGet', 'StructPut', 'TabControl', 'Tag', 'TextBox', 'Tile',
+        'TileWindows', 'TitleBox', 'ToCommandLine', 'ToolsGrid',
+        'Triangulate3d', 'Unwrap', 'ValDisplay', 'Variable', 'WaveMeanStdv',
+        'WaveStats', 'WaveTransform', 'wfprintf', 'WignerTransform',
+        'WindowFunction',
+    ]
+    functions = [
+        'abs', 'acos', 'acosh', 'AiryA', 'AiryAD', 'AiryB', 'AiryBD', 'alog',
+        'area', 'areaXY', 'asin', 'asinh', 'atan', 'atan2', 'atanh',
+        'AxisValFromPixel', 'Besseli', 'Besselj', 'Besselk', 'Bessely', 'bessi',
+        'bessj', 'bessk', 'bessy', 'beta', 'betai', 'BinarySearch',
+        'BinarySearchInterp', 'binomial', 'binomialln', 'binomialNoise', 'cabs',
+        'CaptureHistoryStart', 'ceil', 'cequal', 'char2num', 'chebyshev',
+        'chebyshevU', 'CheckName', 'cmplx', 'cmpstr', 'conj', 'ContourZ', 'cos',
+        'cosh', 'cot', 'CountObjects', 'CountObjectsDFR', 'cpowi',
+        'CreationDate', 'csc', 'DataFolderExists', 'DataFolderRefsEqual',
+        'DataFolderRefStatus', 'date2secs', 'datetime', 'DateToJulian',
+        'Dawson', 'DDEExecute', 'DDEInitiate', 'DDEPokeString', 'DDEPokeWave',
+        'DDERequestWave', 'DDEStatus', 'DDETerminate', 'deltax', 'digamma',
+        'DimDelta', 'DimOffset', 'DimSize', 'ei', 'enoise', 'equalWaves', 'erf',
+        'erfc', 'exists', 'exp', 'expInt', 'expNoise', 'factorial', 'fakedata',
+        'faverage', 'faverageXY', 'FindDimLabel', 'FindListItem', 'floor',
+        'FontSizeHeight', 'FontSizeStringWidth', 'FresnelCos', 'FresnelSin',
+        'gamma', 'gammaInc', 'gammaNoise', 'gammln', 'gammp', 'gammq', 'Gauss',
+        'Gauss1D', 'Gauss2D', 'gcd', 'GetDefaultFontSize',
+        'GetDefaultFontStyle', 'GetKeyState', 'GetRTError', 'gnoise',
+        'GrepString', 'hcsr', 'hermite', 'hermiteGauss', 'HyperG0F1',
+        'HyperG1F1', 'HyperG2F1', 'HyperGNoise', 'HyperGPFQ', 'IgorVersion',
+        'ilim', 'imag', 'Inf', 'Integrate1D', 'interp', 'Interp2D', 'Interp3D',
+        'inverseERF', 'inverseERFC', 'ItemsInList', 'jlim', 'Laguerre',
+        'LaguerreA', 'LaguerreGauss', 'leftx', 'LegendreA', 'limit', 'ln',
+        'log', 'logNormalNoise', 'lorentzianNoise', 'magsqr', 'MandelbrotPoint',
+        'MarcumQ', 'MatrixDet', 'MatrixDot', 'MatrixRank', 'MatrixTrace', 'max',
+        'mean', 'min', 'mod', 'ModDate', 'NaN', 'norm', 'NumberByKey',
+        'numpnts', 'numtype', 'NumVarOrDefault', 'NVAR_Exists', 'p2rect',
+        'ParamIsDefault', 'pcsr', 'Pi', 'PixelFromAxisVal', 'pnt2x',
+        'poissonNoise', 'poly', 'poly2D', 'PolygonArea', 'qcsr', 'r2polar',
+        'real', 'rightx', 'round', 'sawtooth', 'ScreenResolution', 'sec',
+        'SelectNumber', 'sign', 'sin', 'sinc', 'sinh', 'SphericalBessJ',
+        'SphericalBessJD', 'SphericalBessY', 'SphericalBessYD',
+        'SphericalHarmonics', 'sqrt', 'StartMSTimer', 'StatsBetaCDF',
+        'StatsBetaPDF', 'StatsBinomialCDF', 'StatsBinomialPDF',
+        'StatsCauchyCDF', 'StatsCauchyPDF', 'StatsChiCDF', 'StatsChiPDF',
+        'StatsCMSSDCDF', 'StatsCorrelation', 'StatsDExpCDF', 'StatsDExpPDF',
+        'StatsErlangCDF', 'StatsErlangPDF', 'StatsErrorPDF', 'StatsEValueCDF',
+        'StatsEValuePDF', 'StatsExpCDF', 'StatsExpPDF', 'StatsFCDF',
+        'StatsFPDF', 'StatsFriedmanCDF', 'StatsGammaCDF', 'StatsGammaPDF',
+        'StatsGeometricCDF', 'StatsGeometricPDF', 'StatsHyperGCDF',
+        'StatsHyperGPDF', 'StatsInvBetaCDF', 'StatsInvBinomialCDF',
+        'StatsInvCauchyCDF', 'StatsInvChiCDF', 'StatsInvCMSSDCDF',
+        'StatsInvDExpCDF', 'StatsInvEValueCDF', 'StatsInvExpCDF',
+        'StatsInvFCDF', 'StatsInvFriedmanCDF', 'StatsInvGammaCDF',
+        'StatsInvGeometricCDF', 'StatsInvKuiperCDF', 'StatsInvLogisticCDF',
+        'StatsInvLogNormalCDF', 'StatsInvMaxwellCDF', 'StatsInvMooreCDF',
+        'StatsInvNBinomialCDF', 'StatsInvNCChiCDF', 'StatsInvNCFCDF',
+        'StatsInvNormalCDF', 'StatsInvParetoCDF', 'StatsInvPoissonCDF',
+        'StatsInvPowerCDF', 'StatsInvQCDF', 'StatsInvQpCDF',
+        'StatsInvRayleighCDF', 'StatsInvRectangularCDF', 'StatsInvSpearmanCDF',
+        'StatsInvStudentCDF', 'StatsInvTopDownCDF', 'StatsInvTriangularCDF',
+        'StatsInvUsquaredCDF', 'StatsInvVonMisesCDF', 'StatsInvWeibullCDF',
+        'StatsKuiperCDF', 'StatsLogisticCDF', 'StatsLogisticPDF',
+        'StatsLogNormalCDF', 'StatsLogNormalPDF', 'StatsMaxwellCDF',
+        'StatsMaxwellPDF', 'StatsMedian', 'StatsMooreCDF', 'StatsNBinomialCDF',
+        'StatsNBinomialPDF', 'StatsNCChiCDF', 'StatsNCChiPDF', 'StatsNCFCDF',
+        'StatsNCFPDF', 'StatsNCTCDF', 'StatsNCTPDF', 'StatsNormalCDF',
+        'StatsNormalPDF', 'StatsParetoCDF', 'StatsParetoPDF', 'StatsPermute',
+        'StatsPoissonCDF', 'StatsPoissonPDF', 'StatsPowerCDF',
+        'StatsPowerNoise', 'StatsPowerPDF', 'StatsQCDF', 'StatsQpCDF',
+        'StatsRayleighCDF', 'StatsRayleighPDF', 'StatsRectangularCDF',
+        'StatsRectangularPDF', 'StatsRunsCDF', 'StatsSpearmanRhoCDF',
+        'StatsStudentCDF', 'StatsStudentPDF', 'StatsTopDownCDF',
+        'StatsTriangularCDF', 'StatsTriangularPDF', 'StatsTrimmedMean',
+        'StatsUSquaredCDF', 'StatsVonMisesCDF', 'StatsVonMisesNoise',
+        'StatsVonMisesPDF', 'StatsWaldCDF', 'StatsWaldPDF', 'StatsWeibullCDF',
+        'StatsWeibullPDF', 'StopMSTimer', 'str2num', 'stringCRC', 'stringmatch',
+        'strlen', 'strsearch', 'StudentA', 'StudentT', 'sum', 'SVAR_Exists',
+        'TagVal', 'tan', 'tanh', 'ThreadGroupCreate', 'ThreadGroupRelease',
+        'ThreadGroupWait', 'ThreadProcessorCount', 'ThreadReturnValue', 'ticks',
+        'trunc', 'Variance', 'vcsr', 'WaveCRC', 'WaveDims', 'WaveExists',
+        'WaveMax', 'WaveMin', 'WaveRefsEqual', 'WaveType', 'WhichListItem',
+        'WinType', 'WNoise', 'x', 'x2pnt', 'xcsr', 'y', 'z', 'zcsr', 'ZernikeR',
+    ]
+    functions += [
+        'AddListItem', 'AnnotationInfo', 'AnnotationList', 'AxisInfo',
+        'AxisList', 'CaptureHistory', 'ChildWindowList', 'CleanupName',
+        'ContourInfo', 'ContourNameList', 'ControlNameList', 'CsrInfo',
+        'CsrWave', 'CsrXWave', 'CTabList', 'DataFolderDir', 'date',
+        'DDERequestString', 'FontList', 'FuncRefInfo', 'FunctionInfo',
+        'FunctionList', 'FunctionPath', 'GetDataFolder', 'GetDefaultFont',
+        'GetDimLabel', 'GetErrMessage', 'GetFormula',
+        'GetIndependentModuleName', 'GetIndexedObjName', 'GetIndexedObjNameDFR',
+        'GetRTErrMessage', 'GetRTStackInfo', 'GetScrapText', 'GetUserData',
+        'GetWavesDataFolder', 'GrepList', 'GuideInfo', 'GuideNameList', 'Hash',
+        'IgorInfo', 'ImageInfo', 'ImageNameList', 'IndexedDir', 'IndexedFile',
+        'JulianToDate', 'LayoutInfo', 'ListMatch', 'LowerStr', 'MacroList',
+        'NameOfWave', 'note', 'num2char', 'num2istr', 'num2str',
+        'OperationList', 'PadString', 'ParseFilePath', 'PathList', 'PICTInfo',
+        'PICTList', 'PossiblyQuoteName', 'ProcedureText', 'RemoveByKey',
+        'RemoveEnding', 'RemoveFromList', 'RemoveListItem',
+        'ReplaceNumberByKey', 'ReplaceString', 'ReplaceStringByKey',
+        'Secs2Date', 'Secs2Time', 'SelectString', 'SortList',
+        'SpecialCharacterInfo', 'SpecialCharacterList', 'SpecialDirPath',
+        'StringByKey', 'StringFromList', 'StringList', 'StrVarOrDefault',
+        'TableInfo', 'TextFile', 'ThreadGroupGetDF', 'time', 'TraceFromPixel',
+        'TraceInfo', 'TraceNameList', 'UniqueName', 'UnPadString', 'UpperStr',
+        'VariableList', 'WaveInfo', 'WaveList', 'WaveName', 'WaveUnits',
+        'WinList', 'WinName', 'WinRecreation', 'XWaveName',
+        'ContourNameToWaveRef', 'CsrWaveRef', 'CsrXWaveRef',
+        'ImageNameToWaveRef', 'NewFreeWave', 'TagWaveRef', 'TraceNameToWaveRef',
+        'WaveRefIndexed', 'XWaveRefFromTrace', 'GetDataFolderDFR',
+        'GetWavesDataFolderDFR', 'NewFreeDataFolder', 'ThreadGroupGetDFR',
+    ]
+
+    tokens = {
+        'root': [
+            (r'//.*$', Comment.Single),
+            (r'"([^"\\]|\\.)*"', String),
+            # Flow Control.
+            (r'\b(%s)\b' % '|'.join(flowControl), Keyword),
+            # Types.
+            (r'\b(%s)\b' % '|'.join(types), Keyword.Type),
+            # Built-in operations.
+            (r'\b(%s)\b' % '|'.join(operations), Name.Class),
+            # Built-in functions.
+            (r'\b(%s)\b' % '|'.join(functions), Name.Function),
+            # Compiler directives.
+            (r'^#(include|pragma|define|ifdef|ifndef|endif)',
+             Name.Decorator),
+            (r'[^a-zA-Z"/]+', Text),
+            (r'.', Text),
+        ],
+    }

pygments/lexers/other.py

 from pygments.lexer import RegexLexer, include, bygroups, using, \
      this, combined, ExtendedRegexLexer
 from pygments.token import Error, Punctuation, Literal, Token, \
-     Text, Comment, Operator, Keyword, Name, String, Number, Generic
+     Text, Comment, Operator, Keyword, Name, String, Number, Generic, \
+     Whitespace
 from pygments.util import get_bool_opt
 from pygments.lexers.web import HtmlLexer
 
            'ECLLexer', 'UrbiscriptLexer', 'OpenEdgeLexer', 'BroLexer',
            'MscgenLexer', 'KconfigLexer', 'VGLLexer', 'SourcePawnLexer',
            'RobotFrameworkLexer', 'PuppetLexer', 'NSISLexer', 'RPMSpecLexer',
-           'CbmBasicV2Lexer', 'AutoItLexer']
+           'CbmBasicV2Lexer', 'AutoItLexer', 'RexxLexer']
 
 
 class ECLLexer(RegexLexer):
     """
     name = 'MOOCode'
     filenames = ['*.moo']
-    aliases = ['moocode']
+    aliases = ['moocode', 'moo']
     mimetypes = ['text/x-moocode']
 
     tokens = {
     """
     name = 'Smalltalk'
     filenames = ['*.st']
-    aliases = ['smalltalk', 'squeak']
+    aliases = ['smalltalk', 'squeak', 'st']
     mimetypes = ['text/x-smalltalk']
 
     tokens = {
             include('literals'),
         ],
         'afterobject' : [
-            (r'! !$', Keyword , '#pop'), # squeak chunk delimeter
+            (r'! !$', Keyword , '#pop'), # squeak chunk delimiter
             include('whitespaces'),
             (r'\b(ifTrue:|ifFalse:|whileTrue:|whileFalse:|timesRepeat:)',
              Name.Builtin, '#pop'),
         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
+            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
 
 
 class PostScriptLexer(RegexLexer):
     *New in Pygments 1.4.*
     """
     name = 'PostScript'
-    aliases = ['postscript']
+    aliases = ['postscript', 'postscr']
     filenames = ['*.ps', '*.eps']
     mimetypes = ['application/postscript']
 
     *New in Pygments 1.4.*
     """
     name = 'autohotkey'
-    aliases = ['ahk']
+    aliases = ['ahk', 'autohotkey']
     filenames = ['*.ahk', '*.ahkl']
     mimetypes = ['text/x-autohotkey']
 
     """
 
     name = 'Protocol Buffer'
-    aliases = ['protobuf']
+    aliases = ['protobuf', 'proto']
     filenames = ['*.proto']
 
     tokens = {
             (r'[a-zA-Z_#@$][a-zA-Z0-9_#@$]*', Name),
             (r'\\|\'', Text),
             (r'\`([\,\%\`abfnrtv\-\+;])', String.Escape),
-            (r'_\n', Text), # Line continuation
+            (r'_\n', Text),  # Line continuation
             include('garbage'),
         ],
         'commands': [
             (r'[^\S\n]', Text),
         ],
     }
+
+
+class RexxLexer(RegexLexer):
+    """
+    `Rexx <http://www.rexxinfo.org/>`_ is a scripting language available for
+    a wide range of different platforms with its roots found on mainframe
+    systems. It is popular for I/O- and data based tasks and can act as glue
+    language to bind different applications together.
+
+    *New in Pygments 1.7.*
+    """
+    name = 'Rexx'
+    aliases = ['rexx', 'ARexx', 'arexx']
+    filenames = ['*.rexx', '*.rex', '*.rx', '*.arexx']
+    mimetypes = ['text/x-rexx']
+    flags = re.IGNORECASE
+
+    tokens = {
+        'root': [
+            (r'\s', Whitespace),
+            (r'/\*', Comment.Multiline, 'comment'),
+            (r'"', String, 'string_double'),
+            (r"'", String, 'string_single'),
+            (r'[0-9]+(\.[0-9]+)?(e[+-]?[0-9])?', Number),
+            (r'([a-z_][a-z0-9_]*)(\s*)(:)(\s*)(procedure)\b',
+             bygroups(Name.Function, Whitespace, Operator, Whitespace,
+                      Keyword.Declaration)),
+            (r'([a-z_][a-z0-9_]*)(\s*)(:)',
+             bygroups(Name.Label, Whitespace, Operator)),
+            include('function'),
+            include('keyword'),
+            include('operator'),
+            (r'[a-z_][a-z0-9_]*', Text),
+        ],
+        'function': [
+            (r'(abbrev|abs|address|arg|b2x|bitand|bitor|bitxor|c2d|c2x|'
+             r'center|charin|charout|chars|compare|condition|copies|d2c|'
+             r'd2x|datatype|date|delstr|delword|digits|errortext|form|'
+             r'format|fuzz|insert|lastpos|left|length|linein|lineout|lines|'
+             r'max|min|overlay|pos|queued|random|reverse|right|sign|'
+             r'sourceline|space|stream|strip|substr|subword|symbol|time|'
+             r'trace|translate|trunc|value|verify|word|wordindex|'
+             r'wordlength|wordpos|words|x2b|x2c|x2d|xrange)(\s*)(\()',
+             bygroups(Name.Builtin, Whitespace, Operator)),
+        ],
+        'keyword': [
+            (r'(address|arg|by|call|do|drop|else|end|exit|for|forever|if|'
+             r'interpret|iterate|leave|nop|numeric|off|on|options|parse|'
+             r'pull|push|queue|return|say|select|signal|to|then|trace|until|'
+             r'while)\b', Keyword.Reserved),
+        ],
+        'operator': [
+            (ur'(-|//|/|\(|\)|\*\*|\*|\\<<|\\<|\\==|\\=|\\>>|\\>|\\|\|\||\||'
+             ur'&&|&|%|\+|<<=|<<|<=|<>|<|==|=|><|>=|>>=|>>|>|¬<<|¬<|¬==|¬=|'
+             ur'¬>>|¬>|¬|\.|,)', Operator),
+        ],
+        'string_double': [
+            (r'[^"\n]+', String),
+            (r'""', String),
+            (r'"', String, '#pop'),
+            (r'\n', Text, '#pop'),  # Stray linefeed also terminates strings.
+        ],
+        'string_single': [
+            (r'[^\'\n]', String),
+            (r'\'\'', String),
+            (r'\'', String, '#pop'),
+            (r'\n', Text, '#pop'),  # Stray linefeed also terminates strings.
+        ],
+        'comment': [
+            (r'[^*]+', Comment.Multiline),
+            (r'\*/', Comment.Multiline, '#pop'),
+            (r'\*', Comment.Multiline),
+        ]
+    }
+
+    _c = lambda s: re.compile(s, re.MULTILINE)
+    _ADDRESS_COMMAND_PATTERN = _c(r'^\s*address\s+command\b')
+    _ADDRESS_PATTERN = _c(r'^\s*address\s+')
+    _DO_WHILE_PATTERN = _c(r'^\s*do\s+while\b')
+    _IF_THEN_DO_PATTERN = _c(r'^\s*if\b.+\bthen\s+do\s*$')
+    _PROCEDURE_PATTERN = _c(r'^\s*([a-z_][a-z0-9_]*)(\s*)(:)(\s*)(procedure)\b')
+    _ELSE_DO_PATTERN = _c(r'\belse\s+do\s*$')
+    _PARSE_ARG_PATTERN = _c(r'^\s*parse\s+(upper\s+)?(arg|value)\b')
+    PATTERNS_AND_WEIGHTS = (
+        (_ADDRESS_COMMAND_PATTERN, 0.2),
+        (_ADDRESS_PATTERN, 0.05),
+        (_DO_WHILE_PATTERN, 0.1),
+        (_ELSE_DO_PATTERN, 0.1),
+        (_IF_THEN_DO_PATTERN, 0.1),
+        (_PROCEDURE_PATTERN, 0.5),
+        (_PARSE_ARG_PATTERN, 0.2),
+    )
+
+    def analyse_text(text):
+        """
+        Check for inital comment and patterns that distinguish Rexx from other
+        C-like languages.
+        """
+        if re.search(r'/\*\**\s*rexx', text, re.IGNORECASE):
+            # Header matches MVS Rexx requirements, this is certainly a Rexx
+            # script.
+            return 1.0
+        elif text.startswith('/*'):
+            # Header matches general Rexx requirements; the source code might
+            # still be any language using C comments such as C++, C# or Java.
+            lowerText = text.lower()
+            result = sum(weight
+                         for (pattern, weight) in RexxLexer.PATTERNS_AND_WEIGHTS
+                         if pattern.search(lowerText)) + 0.01
+            return min(result, 1.0)

pygments/lexers/shell.py

         'data': [
             (r'(?s)\$?"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
             (r"(?s)\$?'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
-            (r';', Text),
+            (r';', Punctuation),
+            (r'&', Punctuation),
+            (r'\|', Punctuation),
             (r'\s+', Text),
-            (r'[^=\s\[\]{}()$"\'`\\<]+', Text),
+            (r'[^=\s\[\]{}()$"\'`\\<&|;]+', Text),
             (r'\d+(?= |\Z)', Number),
             (r'\$#?(\w+|.)', Name.Variable),
             (r'<', Text),
     }
 
     def analyse_text(text):
-        return shebang_matches(text, r'(ba|z|)sh')
+        if shebang_matches(text, r'(ba|z|)sh'):
+            return 1
+        if text.startswith('$ '):
+            return 0.2
 
 
 class BashSessionLexer(Lexer):
     *New in Pygments 0.7.*
     """
     name = 'Batchfile'
-    aliases = ['bat']
+    aliases = ['bat', 'dosbatch', 'winbatch']
     filenames = ['*.bat', '*.cmd']
     mimetypes = ['application/x-dos-batch']
 
         'root': [
             # we need to count pairs of parentheses for correct highlight
             # of '$(...)' blocks in strings
-            (r'\(', Punctuation, '#push'),
-            (r'\)', Punctuation, '#pop'),
+            (r'\(', Punctuation, 'child'),
             (r'\s+', Text),
             (r'^(\s*#[#\s]*)(\.(?:%s))([^\n]*$)' % '|'.join(commenthelp),
              bygroups(Comment, String.Doc, Comment)),
             (r'\w+', Name),
             (r'[.,;@{}\[\]$()=+*/\\&%!~?^`|<>-]|::', Punctuation),
         ],
+        'child': [
+            (r'\)', Punctuation, '#pop'),
+            include('root'),
+        ],
         'multline': [
             (r'[^#&.]+', Comment.Multiline),
             (r'#(>|&gt;)', Comment.Multiline, '#pop'),
         'string': [
             (r"`[0abfnrtv'\"\$]", String.Escape),
             (r'[^$`"]+', String.Double),
-            (r'\$\(', Punctuation, 'root'),
+            (r'\$\(', Punctuation, 'child'),
             (r'""', String.Double),
             (r'[`$]', String.Double),
             (r'"', String.Double, '#pop'),
         ],
         'heredoc-double': [
             (r'\n"@', String.Heredoc, '#pop'),
-            (r'\$\(', Punctuation, 'root'),
+            (r'\$\(', Punctuation, 'child'),
             (r'[^@\n]+"]', String.Heredoc),
             (r".", String.Heredoc),
         ]

pygments/lexers/sql.py

              r'DIAGNOSTICS|DICTIONARY|DISCONNECT|DISPATCH|DISTINCT|DO|'
              r'DOMAIN|DROP|DYNAMIC|DYNAMIC_FUNCTION|DYNAMIC_FUNCTION_CODE|'
              r'EACH|ELSE|ENCODING|ENCRYPTED|END|END-EXEC|EQUALS|ESCAPE|EVERY|'
-             r'EXCEPT|ESCEPTION|EXCLUDING|EXCLUSIVE|EXEC|EXECUTE|EXISTING|'
+             r'EXCEPTION|EXCEPT|EXCLUDING|EXCLUSIVE|EXEC|EXECUTE|EXISTING|'
              r'EXISTS|EXPLAIN|EXTERNAL|EXTRACT|FALSE|FETCH|FINAL|FIRST|FOR|'
              r'FORCE|FOREIGN|FORTRAN|FORWARD|FOUND|FREE|FREEZE|FROM|FULL|'
              r'FUNCTION|G|GENERAL|GENERATED|GET|GLOBAL|GO|GOTO|GRANT|GRANTED|'

pygments/lexers/templates.py

     """
 
     name = 'HTML+Cheetah'
-    aliases = ['html+cheetah', 'html+spitfire']
+    aliases = ['html+cheetah', 'html+spitfire', 'htmlcheetah']
     mimetypes = ['text/html+cheetah', 'text/html+spitfire']
 
     def __init__(self, **options):
     """
 
     name = 'HTML+Django/Jinja'
-    aliases = ['html+django', 'html+jinja']
+    aliases = ['html+django', 'html+jinja', 'htmldjango']
     alias_filenames = ['*.html', '*.htm', '*.xhtml']
     mimetypes = ['text/html+django', 'text/html+jinja']
 

pygments/lexers/text.py

            'RstLexer', 'VimLexer', 'GettextLexer', 'SquidConfLexer',
            'DebianControlLexer', 'DarcsPatchLexer', 'YamlLexer',
            'LighttpdConfLexer', 'NginxConfLexer', 'CMakeLexer', 'HttpLexer',
-           'PyPyLogLexer', 'RegeditLexer', 'HxmlLexer']
+           'PyPyLogLexer', 'RegeditLexer', 'HxmlLexer', 'EbnfLexer']
 
 
 class IniLexer(RegexLexer):
     """
 
     name = 'INI'
-    aliases = ['ini', 'cfg']
+    aliases = ['ini', 'cfg', 'dosini']
     filenames = ['*.ini', '*.cfg']
     mimetypes = ['text/x-ini']
 
     """
 
     name = 'Properties'
-    aliases = ['properties']
+    aliases = ['properties', 'jproperties']
     filenames = ['*.properties']
     mimetypes = ['text/x-java-properties']
 
     """
 
     name = 'Debian Sourcelist'
-    aliases = ['sourceslist', 'sources.list']
+    aliases = ['sourceslist', 'sources.list', 'debsources']
     filenames = ['sources.list']
     mimetype = ['application/x-debian-sourceslist']
 
     *New in Pygments 0.9.*
     """
     name = 'Debian Control file'
-    aliases = ['control']
+    aliases = ['control', 'debcontrol']
     filenames = ['control']
 
     tokens = {
             # 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,
+            (r'\b(\w+)([ \t]*)(\()', bygroups(Name.Builtin, Text,
                                                      Punctuation), 'args'),
             include('keywords'),
             include('ws')
             (r'#.*', Comment.Single)
         ]
     }
+
+
+class EbnfLexer(RegexLexer):
+    """
+    Lexer for `ISO/IEC 14977 EBNF
+    <http://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form>`_
+    grammars.
+
+    *New in Pygments 1.7.*
+    """
+
+    name = 'EBNF'
+    aliases = ['ebnf']
+    filenames = ['*.ebnf']
+    mimetypes = ['text/x-ebnf']
+
+    tokens = {
+        'root': [
+            include('whitespace'),
+            include('comment_start'),
+            include('identifier'),
+            (r'=', Operator, 'production'),
+        ],
+        'production': [
+            include('whitespace'),
+            include('comment_start'),
+            include('identifier'),
+            (r'"[^"]*"', String.Double),
+            (r"'[^']*'", String.Single),
+            (r'(\?[^?]*\?)', Name.Entity),
+            (r'[\[\]{}(),|]', Punctuation),
+            (r'-', Operator),
+            (r';', Punctuation, '#pop'),
+        ],
+        'whitespace': [
+            (r'\s+', Text),
+          ],
+        'comment_start': [
+            (r'\(\*', Comment.Multiline, 'comment'),
+          ],
+        'comment': [
+            (r'[^*)]', Comment.Multiline),
+            include('comment_start'),
+            (r'\*\)', Comment.Multiline, '#pop'),
+            (r'[*)]', Comment.Multiline),
+          ],
+        'identifier': [
+            (r'([a-zA-Z][a-zA-Z0-9 \-]*)', Keyword),
+          ],
+    }

pygments/lexers/web.py

             ('<![^>]*>', Comment.Preproc),
             (r'<\s*script\s*', Name.Tag, ('script-content', 'tag')),
             (r'<\s*style\s*', Name.Tag, ('style-content', 'tag')),
-            (r'<\s*[a-zA-Z0-9:]+', Name.Tag, 'tag'),
-            (r'<\s*/\s*[a-zA-Z0-9:]+\s*>', Name.Tag),
+            # note: this allows tag names not used in HTML like <x:with-dash>,
+            # this is to support yet-unknown template engines and the like
+            (r'<\s*[\w:.-]+', Name.Tag, 'tag'),
+            (r'<\s*/\s*[\w:.-]+\s*>', Name.Tag),
         ],
         'comment': [
             ('[^-]+', Comment),
 
     name = 'XML'
     aliases = ['xml']
-    filenames = ['*.xml', '*.xsl', '*.rss', '*.xslt', '*.xsd', '*.wsdl']
+    filenames = ['*.xml', '*.xsl', '*.rss', '*.xslt', '*.xsd',
+                 '*.wsdl', '*.wsf']
     mimetypes = ['text/xml', 'application/xml', 'image/svg+xml',
                  'application/rss+xml', 'application/atom+xml']
 
         }
 
 
-class HaxeLexer(RegexLexer):
+class HaxeLexer(ExtendedRegexLexer):
     """
-    For haXe source code (http://haxe.org/).
+    For Haxe source code (http://haxe.org/).
 
     *New in Pygments 1.3.*
     """
 
-    name = 'haXe'
-    aliases = ['hx', 'haXe']
-    filenames = ['*.hx']
-    mimetypes = ['text/haxe']
-
-    ident = r'(?:[a-zA-Z_][a-zA-Z0-9_]*)'
-    typeid = r'(?:(?:[a-z0-9_\.])*[A-Z_][A-Za-z0-9_]*)'
-    key_prop = r'(?:default|null|never)'
-    key_decl_mod = r'(?:public|private|override|static|inline|extern|dynamic)'
+    name = 'Haxe'
+    aliases = ['hx', 'Haxe', 'haxe', 'haXe', 'hxsl']
+    filenames = ['*.hx', '*.hxsl']
+    mimetypes = ['text/haxe', 'text/x-haxe', 'text/x-hx']
+
+    # keywords extracted from lexer.mll in the haxe compiler source
+    keyword = (r'(?:function|class|static|var|if|else|while|do|for|'
+               r'break|return|continue|extends|implements|import|'
+               r'switch|case|default|public|private|try|untyped|'
+               r'catch|new|this|throw|extern|enum|in|interface|'
+               r'cast|override|dynamic|typedef|package|'
+               r'inline|using|null|true|false|abstract)\b')
+
+    # idtype in lexer.mll
+    typeid = r'_*[A-Z][_a-zA-Z0-9]*'
+
+    # combined ident and dollar and idtype
+    ident = r'(?:_*[a-z][_a-zA-Z0-9]*|_+[0-9][_a-zA-Z0-9]*|' + typeid + \
+        '|_+|\$[_a-zA-Z0-9]+)'
+
+    binop = (r'(?:%=|&=|\|=|\^=|\+=|\-=|\*=|/=|<<=|>\s*>\s*=|>\s*>\s*>\s*=|==|'
+             r'!=|<=|>\s*=|&&|\|\||<<|>>>|>\s*>|\.\.\.|<|>|%|&|\||\^|\+|\*|'
+             r'/|\-|=>|=)')
+
+    # ident except keywords
+    ident_no_keyword = r'(?!' + keyword + ')' + ident
 
     flags = re.DOTALL | re.MULTILINE
 
+    preproc_stack = []
+
+    def preproc_callback(self, match, ctx):
+        proc = match.group(2)
+
+        if proc == 'if':
+            # store the current stack
+            self.preproc_stack.append(ctx.stack[:])
+        elif proc in ['else', 'elseif']:
+            # restore the stack back to right before #if
+            if self.preproc_stack: ctx.stack = self.preproc_stack[-1][:]
+        elif proc == 'end':
+            # remove the saved stack of previous #if
+            if self.preproc_stack: self.preproc_stack.pop()
+
+        # #if and #elseif should follow by an expr
+        if proc in ['if', 'elseif']:
+            ctx.stack.append('preproc-expr')
+
+        # #error can be optionally follow by the error msg
+        if proc in ['error']:
+            ctx.stack.append('preproc-error')
+
+        yield match.start(), Comment.Preproc, '#' + proc
+        ctx.pos = match.end()
+
+
     tokens = {
         'root': [
-            include('whitespace'),
-            include('comments'),
-            (key_decl_mod, Keyword.Declaration),
-            include('enumdef'),
-            include('typedef'),
-            include('classdef'),
-            include('imports'),
-        ],
-
-        # General constructs
-        'comments': [
-            (r'//.*?\n', Comment.Single),
+            include('spaces'),