summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2017-01-27 06:24:04 +0000
committerGeorg Brandl <georg@python.org>2017-01-27 06:24:04 +0000
commit558fa0cb19910c918fd56bf8fe75fdd6c7a50a69 (patch)
tree776dfa4e30e34052d1aae5928811f1ecf1e90f3d
parent7dae1fd860eaa8af26a67f99a2adb031ce86490f (diff)
parenta5618f48f1fad96adbae0bfe36f172f6eaebf197 (diff)
downloadpygments-558fa0cb19910c918fd56bf8fe75fdd6c7a50a69.tar.gz
Merged in xuhdev/pygments-main/terminal256 (pull request #666)
When no output file is specified, use the "terminal256" formatter by default if TERM contains "256".
-rw-r--r--AUTHORS2
-rw-r--r--CHANGES31
-rw-r--r--LICENSE2
-rw-r--r--MANIFEST.in2
-rw-r--r--Makefile2
-rw-r--r--doc/_themes/pygments14/layout.html2
-rw-r--r--doc/_themes/pygments14/static/pygments14.css_t2
-rw-r--r--doc/docs/api.rst23
-rw-r--r--doc/docs/cmdline.rst17
-rw-r--r--doc/docs/lexerdevelopment.rst45
-rwxr-xr-xexternal/autopygmentize39
-rw-r--r--external/markdown-processor.py2
-rw-r--r--external/moin-parser.py2
-rw-r--r--external/rst-directive.py2
-rw-r--r--pygments/__init__.py4
-rw-r--r--pygments/cmdline.py71
-rw-r--r--pygments/console.py2
-rw-r--r--pygments/filter.py2
-rw-r--r--pygments/filters/__init__.py2
-rw-r--r--pygments/formatter.py2
-rw-r--r--pygments/formatters/__init__.py39
-rwxr-xr-xpygments/formatters/_mapping.py2
-rw-r--r--pygments/formatters/bbcode.py2
-rw-r--r--pygments/formatters/html.py2
-rw-r--r--pygments/formatters/img.py39
-rw-r--r--pygments/formatters/irc.py2
-rw-r--r--pygments/formatters/latex.py2
-rw-r--r--pygments/formatters/other.py2
-rw-r--r--pygments/formatters/rtf.py2
-rw-r--r--pygments/formatters/svg.py2
-rw-r--r--pygments/formatters/terminal.py2
-rw-r--r--pygments/formatters/terminal256.py2
-rw-r--r--pygments/lexer.py2
-rw-r--r--pygments/lexers/__init__.py44
-rw-r--r--pygments/lexers/_asy_builtins.py2
-rw-r--r--pygments/lexers/_cl_builtins.py2
-rw-r--r--pygments/lexers/_cocoa_builtins.py2
-rw-r--r--pygments/lexers/_csound_builtins.py2
-rw-r--r--pygments/lexers/_lasso_builtins.py9
-rw-r--r--pygments/lexers/_lua_builtins.py2
-rw-r--r--pygments/lexers/_mapping.py8
-rw-r--r--pygments/lexers/_mql_builtins.py2
-rw-r--r--pygments/lexers/_openedge_builtins.py2
-rw-r--r--pygments/lexers/_php_builtins.py2
-rw-r--r--pygments/lexers/_postgres_builtins.py2
-rw-r--r--pygments/lexers/_scilab_builtins.py2
-rw-r--r--pygments/lexers/_sourcemod_builtins.py2
-rw-r--r--pygments/lexers/_stan_builtins.py2
-rw-r--r--pygments/lexers/_stata_builtins.py2
-rw-r--r--pygments/lexers/_tsql_builtins.py2
-rw-r--r--pygments/lexers/_vim_builtins.py2
-rw-r--r--pygments/lexers/actionscript.py2
-rw-r--r--pygments/lexers/agile.py2
-rw-r--r--pygments/lexers/algebra.py2
-rw-r--r--pygments/lexers/ambient.py2
-rw-r--r--pygments/lexers/ampl.py2
-rw-r--r--pygments/lexers/apl.py2
-rw-r--r--pygments/lexers/archetype.py2
-rw-r--r--pygments/lexers/asm.py29
-rw-r--r--pygments/lexers/automation.py2
-rw-r--r--pygments/lexers/basic.py2
-rw-r--r--pygments/lexers/bibtex.py14
-rw-r--r--pygments/lexers/business.py88
-rw-r--r--pygments/lexers/c_cpp.py2
-rw-r--r--pygments/lexers/c_like.py2
-rw-r--r--pygments/lexers/capnproto.py29
-rw-r--r--pygments/lexers/chapel.py7
-rw-r--r--pygments/lexers/clean.py22
-rw-r--r--pygments/lexers/compiled.py2
-rw-r--r--pygments/lexers/configs.py4
-rw-r--r--pygments/lexers/console.py2
-rw-r--r--pygments/lexers/crystal.py49
-rw-r--r--pygments/lexers/csound.py2
-rw-r--r--pygments/lexers/css.py2
-rw-r--r--pygments/lexers/d.py2
-rw-r--r--pygments/lexers/dalvik.py2
-rw-r--r--pygments/lexers/data.py2
-rw-r--r--pygments/lexers/diff.py2
-rw-r--r--pygments/lexers/dotnet.py2
-rw-r--r--pygments/lexers/dsls.py8
-rw-r--r--pygments/lexers/dylan.py2
-rw-r--r--pygments/lexers/ecl.py2
-rw-r--r--pygments/lexers/eiffel.py2
-rw-r--r--pygments/lexers/elm.py2
-rw-r--r--pygments/lexers/erlang.py2
-rw-r--r--pygments/lexers/esoteric.py16
-rw-r--r--pygments/lexers/ezhil.py7
-rw-r--r--pygments/lexers/factor.py2
-rw-r--r--pygments/lexers/fantom.py2
-rw-r--r--pygments/lexers/felix.py2
-rw-r--r--pygments/lexers/forth.py2
-rw-r--r--pygments/lexers/fortran.py2
-rw-r--r--pygments/lexers/foxpro.py2
-rw-r--r--pygments/lexers/functional.py2
-rw-r--r--pygments/lexers/go.py2
-rw-r--r--pygments/lexers/grammar_notation.py4
-rw-r--r--pygments/lexers/graph.py2
-rw-r--r--pygments/lexers/graphics.py2
-rw-r--r--pygments/lexers/haskell.py7
-rw-r--r--pygments/lexers/haxe.py2
-rw-r--r--pygments/lexers/hdl.py2
-rw-r--r--pygments/lexers/hexdump.py30
-rw-r--r--pygments/lexers/html.py2
-rw-r--r--pygments/lexers/idl.py2
-rw-r--r--pygments/lexers/igor.py2
-rw-r--r--pygments/lexers/inferno.py2
-rw-r--r--pygments/lexers/installers.py2
-rw-r--r--pygments/lexers/int_fiction.py2
-rw-r--r--pygments/lexers/iolang.py2
-rw-r--r--pygments/lexers/j.py2
-rw-r--r--pygments/lexers/javascript.py93
-rw-r--r--pygments/lexers/julia.py6
-rw-r--r--pygments/lexers/jvm.py2
-rw-r--r--pygments/lexers/lisp.py2
-rw-r--r--pygments/lexers/make.py2
-rw-r--r--pygments/lexers/markup.py2
-rw-r--r--pygments/lexers/math.py2
-rw-r--r--pygments/lexers/matlab.py2
-rw-r--r--pygments/lexers/ml.py2
-rw-r--r--pygments/lexers/modeling.py2
-rw-r--r--pygments/lexers/modula2.py2
-rw-r--r--pygments/lexers/monte.py7
-rw-r--r--pygments/lexers/ncl.py329
-rw-r--r--pygments/lexers/nimrod.py2
-rw-r--r--pygments/lexers/nit.py2
-rw-r--r--pygments/lexers/nix.py2
-rw-r--r--pygments/lexers/oberon.py2
-rw-r--r--pygments/lexers/objective.py2
-rw-r--r--pygments/lexers/ooc.py2
-rw-r--r--pygments/lexers/other.py2
-rw-r--r--pygments/lexers/parasail.py2
-rw-r--r--pygments/lexers/parsers.py2
-rw-r--r--pygments/lexers/pascal.py4
-rw-r--r--pygments/lexers/pawn.py2
-rw-r--r--pygments/lexers/perl.py26
-rw-r--r--pygments/lexers/php.py2
-rw-r--r--pygments/lexers/praat.py2
-rw-r--r--pygments/lexers/prolog.py2
-rw-r--r--pygments/lexers/python.py3
-rw-r--r--pygments/lexers/qvt.py2
-rw-r--r--pygments/lexers/r.py2
-rw-r--r--pygments/lexers/rdf.py2
-rw-r--r--pygments/lexers/rebol.py2
-rw-r--r--pygments/lexers/resource.py2
-rw-r--r--pygments/lexers/rnc.py2
-rw-r--r--pygments/lexers/roboconf.py2
-rw-r--r--pygments/lexers/robotframework.py2
-rw-r--r--pygments/lexers/ruby.py2
-rw-r--r--pygments/lexers/rust.py71
-rw-r--r--pygments/lexers/sas.py14
-rw-r--r--pygments/lexers/scripting.py2
-rw-r--r--pygments/lexers/shell.py24
-rw-r--r--pygments/lexers/smalltalk.py2
-rw-r--r--pygments/lexers/smv.py52
-rw-r--r--pygments/lexers/snobol.py2
-rw-r--r--pygments/lexers/special.py2
-rw-r--r--pygments/lexers/sql.py2
-rw-r--r--pygments/lexers/stata.py16
-rw-r--r--pygments/lexers/supercollider.py2
-rw-r--r--pygments/lexers/tcl.py2
-rw-r--r--pygments/lexers/templates.py65
-rw-r--r--pygments/lexers/testing.py2
-rw-r--r--pygments/lexers/text.py2
-rw-r--r--pygments/lexers/textedit.py2
-rw-r--r--pygments/lexers/textfmts.py2
-rw-r--r--pygments/lexers/theorem.py2
-rw-r--r--pygments/lexers/trafficscript.py2
-rw-r--r--pygments/lexers/typoscript.py15
-rw-r--r--pygments/lexers/urbi.py2
-rw-r--r--pygments/lexers/varnish.py6
-rw-r--r--pygments/lexers/verification.py6
-rw-r--r--pygments/lexers/web.py2
-rw-r--r--pygments/lexers/webmisc.py31
-rw-r--r--pygments/lexers/whiley.py15
-rw-r--r--pygments/lexers/x10.py2
-rw-r--r--pygments/modeline.py11
-rw-r--r--pygments/plugin.py30
-rw-r--r--pygments/regexopt.py2
-rw-r--r--pygments/scanner.py2
-rw-r--r--pygments/sphinxext.py2
-rw-r--r--pygments/style.py2
-rw-r--r--pygments/styles/__init__.py6
-rw-r--r--pygments/styles/abap.py29
-rw-r--r--pygments/styles/algol.py2
-rw-r--r--pygments/styles/algol_nu.py2
-rw-r--r--pygments/styles/arduino.py2
-rw-r--r--pygments/styles/autumn.py2
-rw-r--r--pygments/styles/borland.py2
-rw-r--r--pygments/styles/bw.py2
-rw-r--r--pygments/styles/colorful.py2
-rw-r--r--pygments/styles/default.py2
-rw-r--r--pygments/styles/emacs.py2
-rw-r--r--pygments/styles/friendly.py2
-rw-r--r--pygments/styles/fruity.py2
-rw-r--r--pygments/styles/igor.py2
-rw-r--r--pygments/styles/lovelace.py2
-rw-r--r--pygments/styles/manni.py2
-rw-r--r--pygments/styles/monokai.py2
-rw-r--r--pygments/styles/murphy.py2
-rw-r--r--pygments/styles/native.py2
-rw-r--r--pygments/styles/paraiso_dark.py2
-rw-r--r--pygments/styles/paraiso_light.py2
-rw-r--r--pygments/styles/pastie.py2
-rw-r--r--pygments/styles/perldoc.py2
-rw-r--r--pygments/styles/rainbow_dash.py89
-rw-r--r--pygments/styles/rrt.py2
-rw-r--r--pygments/styles/sas.py3
-rw-r--r--pygments/styles/stata.py3
-rw-r--r--pygments/styles/tango.py2
-rw-r--r--pygments/styles/trac.py2
-rw-r--r--pygments/styles/vim.py2
-rw-r--r--pygments/styles/vs.py2
-rw-r--r--pygments/styles/xcode.py2
-rw-r--r--pygments/token.py2
-rw-r--r--pygments/unistring.py2
-rw-r--r--pygments/util.py9
-rwxr-xr-xscripts/check_sources.py4
-rwxr-xr-xscripts/debug_lexer.py2
-rw-r--r--scripts/get_vimkw.py2
-rw-r--r--setup.cfg4
-rwxr-xr-xsetup.py6
-rw-r--r--tests/examplefiles/demo.hbs22
-rw-r--r--tests/examplefiles/example.hs10
-rw-r--r--tests/run.py2
-rw-r--r--tests/string_asserts.py2
-rw-r--r--tests/support/empty.py1
-rw-r--r--tests/support/html_formatter.py6
-rw-r--r--tests/support/python_lexer.py12
-rw-r--r--tests/test_basic_api.py10
-rw-r--r--tests/test_bibtex.py2
-rw-r--r--tests/test_cfm.py2
-rw-r--r--tests/test_clexer.py2
-rw-r--r--tests/test_cmdline.py56
-rw-r--r--tests/test_examplefiles.py4
-rw-r--r--tests/test_html_formatter.py2
-rw-r--r--tests/test_inherit.py2
-rw-r--r--tests/test_irc_formatter.py2
-rw-r--r--tests/test_java.py2
-rw-r--r--tests/test_javascript.py2
-rw-r--r--tests/test_julia.py2
-rw-r--r--tests/test_latex_formatter.py6
-rw-r--r--tests/test_lexers_other.py2
-rw-r--r--tests/test_modeline.py26
-rw-r--r--tests/test_objectiveclexer.py2
-rw-r--r--tests/test_perllexer.py24
-rw-r--r--tests/test_php.py2
-rw-r--r--tests/test_praat.py2
-rw-r--r--tests/test_properties.py2
-rw-r--r--tests/test_python.py2
-rw-r--r--tests/test_qbasiclexer.py2
-rw-r--r--tests/test_regexlexer.py2
-rw-r--r--tests/test_regexopt.py2
-rw-r--r--tests/test_rtf_formatter.py2
-rw-r--r--tests/test_ruby.py2
-rw-r--r--tests/test_shell.py2
-rw-r--r--tests/test_smarty.py2
-rw-r--r--tests/test_string_asserts.py2
-rw-r--r--tests/test_terminal_formatter.py2
-rw-r--r--tests/test_textfmts.py2
-rw-r--r--tests/test_token.py2
-rw-r--r--tests/test_unistring.py2
-rw-r--r--tests/test_using_api.py2
-rw-r--r--tests/test_util.py2
263 files changed, 1379 insertions, 852 deletions
diff --git a/AUTHORS b/AUTHORS
index 66377ead..f9ba2675 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -155,6 +155,7 @@ Other contributors, listed alphabetically, are:
* Dominik Picheta -- Nimrod lexer
* Andrew Pinkham -- RTF Formatter Refactoring
* Clément Prévost -- UrbiScript lexer
+* Tanner Prynn -- cmdline -x option and loading lexers from files
* Oleh Prypin -- Crystal lexer (based on Ruby lexer)
* Elias Rabel -- Fortran fixed form lexer
* raichoo -- Idris lexer
@@ -173,6 +174,7 @@ Other contributors, listed alphabetically, are:
* Matteo Sasso -- Common Lisp lexer
* Joe Schafer -- Ada lexer
* Ken Schutte -- Matlab lexers
+* René Schwaiger -- Rainbow Dash style
* Sebastian Schweizer -- Whiley lexer
* Tassilo Schweyer -- Io, MOOCode lexers
* Ted Shaw -- AutoIt lexer
diff --git a/CHANGES b/CHANGES
index e833afcd..0bab9118 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,9 +6,9 @@ Issue numbers refer to the tracker at
pull request numbers to the requests at
<https://bitbucket.org/birkenfeld/pygments-main/pull-requests/merged>.
-Version 2.2
------------
-(in development)
+Version 2.2.0
+-------------
+(release Jan 22, 2017)
- Added lexers:
@@ -24,6 +24,17 @@ Version 2.2
* NCAR command language (PR#536)
* Extempore (PR#530)
* Cap'n Proto (PR#595)
+ * Whiley (PR#573)
+ * Monte (PR#592)
+ * Crystal (PR#576)
+ * Snowball (PR#589)
+ * CapDL (PR#579)
+ * NuSMV (PR#564)
+ * SAS, Stata (PR#593)
+
+- Added the ability to load lexer and formatter classes directly from files
+ with the `-x` command line option and the `lexers.load_lexer_from_file()`
+ and `formatters.load_formatter_from_file()` functions. (PR#559)
- Added `lexers.find_lexer_class_by_name()`. (#1203)
@@ -41,12 +52,24 @@ Version 2.2
- Improved the CSS lexer. (#1083, #1130)
+- Added "Rainbow Dash" style. (PR#623)
+
+- Delay loading `pkg_resources`, which takes a long while to import. (PR#690)
+
+
+Version 2.1.3
+-------------
+(released Mar 2, 2016)
+
+- Fixed regression in Bash lexer (PR#563)
+
Version 2.1.2
-------------
-(in development)
+(released Feb 29, 2016)
- Fixed Python 3 regression in image formatter (#1215)
+- Fixed regression in Bash lexer (PR#562)
Version 2.1.1
diff --git a/LICENSE b/LICENSE
index 10b8e916..21815527 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2006-2015 by the respective authors (see AUTHORS file).
+Copyright (c) 2006-2017 by the respective authors (see AUTHORS file).
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/MANIFEST.in b/MANIFEST.in
index cfec4e94..7e1d320d 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,6 +1,6 @@
include pygmentize
include external/*
-include Makefile CHANGES LICENSE AUTHORS TODO ez_setup.py
+include Makefile CHANGES LICENSE AUTHORS TODO
recursive-include tests *
recursive-include doc *
recursive-include scripts *
diff --git a/Makefile b/Makefile
index d56384b3..82c4a124 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
#
# Combines scripts for common tasks.
#
-# :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+# :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
# :license: BSD, see LICENSE for details.
#
diff --git a/doc/_themes/pygments14/layout.html b/doc/_themes/pygments14/layout.html
index 2cc03e03..e8860827 100644
--- a/doc/_themes/pygments14/layout.html
+++ b/doc/_themes/pygments14/layout.html
@@ -82,7 +82,7 @@
{% block footer %}
<div class="footer" role="contentinfo">
- &copy; Copyright 2006-2015, Georg Brandl and Pygments contributors.
+ &copy; Copyright 2006-2017, Georg Brandl and Pygments contributors.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> {{
sphinx_version }}. <br/>
Pygments logo created by <a href="http://joelunger.com">Joel Unger</a>.
diff --git a/doc/_themes/pygments14/static/pygments14.css_t b/doc/_themes/pygments14/static/pygments14.css_t
index 5c37aaf9..7f09f623 100644
--- a/doc/_themes/pygments14/static/pygments14.css_t
+++ b/doc/_themes/pygments14/static/pygments14.css_t
@@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- pygments14 theme. Heavily copied from sphinx13.
*
- * :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ * :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
diff --git a/doc/docs/api.rst b/doc/docs/api.rst
index dd831bd1..a6b242dd 100644
--- a/doc/docs/api.rst
+++ b/doc/docs/api.rst
@@ -62,6 +62,18 @@ Functions from :mod:`pygments.lexers`:
Will raise :exc:`pygments.util.ClassNotFound` if not lexer for that mimetype
is found.
+.. function:: load_lexer_from_file(filename, lexername="CustomLexer", **options)
+
+ Return a `Lexer` subclass instance loaded from the provided file, relative
+ to the current directory. The file is expected to contain a Lexer class
+ named `lexername` (by default, CustomLexer). Users should be very careful with
+ the input, because this method is equivalent to running eval on the input file.
+ The lexer is given the `options` at its instantiation.
+
+ :exc:`ClassNotFound` is raised if there are any errors loading the Lexer
+
+ .. versionadded:: 2.2
+
.. function:: guess_lexer(text, **options)
Return a `Lexer` subclass instance that's guessed from the text in
@@ -125,6 +137,17 @@ Functions from :mod:`pygments.formatters`:
Will raise :exc:`pygments.util.ClassNotFound` if no formatter for that filename
is found.
+.. function:: load_formatter_from_file(filename, formattername="CustomFormatter", **options)
+
+ Return a `Formatter` subclass instance loaded from the provided file, relative
+ to the current directory. The file is expected to contain a Formatter class
+ named ``formattername`` (by default, CustomFormatter). Users should be very
+ careful with the input, because this method is equivalent to running eval
+ on the input file. The formatter is given the `options` at its instantiation.
+
+ :exc:`ClassNotFound` is raised if there are any errors loading the Formatter
+
+ .. versionadded:: 2.2
.. module:: pygments.styles
diff --git a/doc/docs/cmdline.rst b/doc/docs/cmdline.rst
index 165af969..e4f94ea5 100644
--- a/doc/docs/cmdline.rst
+++ b/doc/docs/cmdline.rst
@@ -99,6 +99,23 @@ The ``-N`` option guesses a lexer name for a given filename, so that ::
will print out ``python``. It won't highlight anything yet. If no specific
lexer is known for that filename, ``text`` is printed.
+Custom Lexers and Formatters
+----------------------------
+
+.. versionadded:: 2.2
+
+The ``-x`` flag enables custom lexers and formatters to be loaded
+from files relative to the current directory. Create a file with a class named
+CustomLexer or CustomFormatter, then specify it on the command line::
+
+ $ pygmentize -l your_lexer.py -f your_formatter.py -x
+
+You can also specify the name of your class with a colon::
+
+ $ pygmentize -l your_lexer.py:SomeLexer -x
+
+For more information, see :doc:`the Pygments documentation on Lexer development
+<lexerdevelopment>`.
Getting help
------------
diff --git a/doc/docs/lexerdevelopment.rst b/doc/docs/lexerdevelopment.rst
index fd6e76b9..63bd01a3 100644
--- a/doc/docs/lexerdevelopment.rst
+++ b/doc/docs/lexerdevelopment.rst
@@ -88,8 +88,47 @@ one.
Adding and testing a new lexer
==============================
-Using a lexer that is not part of Pygments can be done via the Python API. You
-can import and instantiate the lexer, and pass it to :func:`pygments.highlight`.
+The easiest way to use a new lexer is to use Pygments' support for loading
+the lexer from a file relative to your current directory.
+
+First, change the name of your lexer class to CustomLexer:
+
+.. code-block:: python
+
+ from pygments.lexer import RegexLexer
+ from pygments.token import *
+
+ class CustomLexer(RegexLexer):
+ """All your lexer code goes here!"""
+
+Then you can load the lexer from the command line with the additional
+flag ``-x``:
+
+.. code-block:: console
+
+ $ pygmentize -l your_lexer_file.py -x
+
+To specify a class name other than CustomLexer, append it with a colon:
+
+.. code-block:: console
+
+ $ pygmentize -l your_lexer.py:SomeLexer -x
+
+Or, using the Python API:
+
+.. code-block:: python
+
+ # For a lexer named CustomLexer
+ your_lexer = load_lexer_from_file(filename, **options)
+
+ # For a lexer named MyNewLexer
+ your_named_lexer = load_lexer_from_file(filename, "MyNewLexer", **options)
+
+When loading custom lexers and formatters, be extremely careful to use only
+trusted files; Pygments will perform the equivalent of ``eval`` on them.
+
+If you only want to use your lexer with the Pygments API, you can import and
+instantiate the lexer yourself, then pass it to :func:`pygments.highlight`.
To prepare your new lexer for inclusion in the Pygments distribution, so that it
will be found when passing filenames or lexer aliases from the command line, you
@@ -361,7 +400,7 @@ There are a few more things you can do with states:
tokens = {...}
def get_tokens_unprocessed(self, text, stack=('root', 'otherstate')):
- for item in RegexLexer.get_tokens_unprocessed(text, stack):
+ for item in RegexLexer.get_tokens_unprocessed(self, text, stack):
yield item
Some lexers like the `PhpLexer` use this to make the leading ``<?php``
diff --git a/external/autopygmentize b/external/autopygmentize
index f18cac09..d2d05970 100755
--- a/external/autopygmentize
+++ b/external/autopygmentize
@@ -1,6 +1,6 @@
#!/bin/bash
# Best effort auto-pygmentization with transparent decompression
-# by Reuben Thomas 2008-2015
+# by Reuben Thomas 2008-2016
# This program is in the public domain.
# Strategy: first see if pygmentize can find a lexer; if not, ask file; if that finds nothing, fail
@@ -25,6 +25,7 @@ if [[ "$lexer" == text ]]; then
text/x-awk) lexer=awk;;
text/x-c) lexer=c;;
text/x-c++) lexer=cpp;;
+ text/x-crystal) lexer=crystal;;
text/x-diff) lexer=diff;;
text/x-fortran) lexer=fortran;;
text/x-gawk) lexer=gawk;;
@@ -40,7 +41,6 @@ if [[ "$lexer" == text ]]; then
text/x-po) lexer=po;;
text/x-python) lexer=python;;
text/x-ruby) lexer=ruby;;
- text/x-crystal) lexer=crystal;;
text/x-shellscript) lexer=sh;;
text/x-tcl) lexer=tcl;;
text/x-tex|text/x-texinfo) lexer=latex;; # FIXME: texinfo really needs its own lexer
@@ -66,19 +66,36 @@ if [[ "$lexer" == text ]]; then
esac
fi
+# Find a preprocessor for compressed files
+concat=cat
+case $(file $file_common_opts --mime-type "$file") in
+ application/x-gzip) concat=zcat;;
+ application/x-bzip2) concat=bzcat;;
+ application/x-xz) concat=xzcat;;
+esac
+
+# Find a suitable lexer, preceded by a hex dump for binary files
+prereader=""
encoding=$(file --mime-encoding --uncompress $file_common_opts "$file")
if [[ $encoding == "binary" ]]; then
- encoding="latin1"
+ prereader="od -x" # POSIX fallback
+ if [[ -n $(which hd) ]]; then
+ prereader="hd" # preferred
+ fi
+ lexer=hexdump
+ encoding=latin1
fi
-
if [[ -n "$lexer" ]]; then
- concat=cat
- case $(file $file_common_opts --mime-type "$file") in
- application/x-gzip) concat=zcat;;
- application/x-bzip2) concat=bzcat;;
- application/x-xz) concat=xzcat;;
- esac
- exec $concat "$file" | pygmentize -O inencoding=$encoding $PYGMENTIZE_OPTS $options -l $lexer
+ reader="pygmentize -O inencoding=$encoding $PYGMENTIZE_OPTS $options -l $lexer"
+fi
+
+# If we found a reader, run it
+if [[ -n "$reader" ]]; then
+ if [[ -n "$prereader" ]]; then
+ exec $concat "$file" | $prereader | $reader
+ else
+ exec $concat "$file" | $reader
+ fi
fi
exit 1
diff --git a/external/markdown-processor.py b/external/markdown-processor.py
index a3e178ec..cb8d793d 100644
--- a/external/markdown-processor.py
+++ b/external/markdown-processor.py
@@ -22,7 +22,7 @@
.. _Markdown: https://pypi.python.org/pypi/Markdown
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/external/moin-parser.py b/external/moin-parser.py
index 9cb082a2..03a7c3c3 100644
--- a/external/moin-parser.py
+++ b/external/moin-parser.py
@@ -31,7 +31,7 @@
If you do not want to do that and are willing to accept larger HTML
output, you can set the INLINESTYLES option below to True.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/external/rst-directive.py b/external/rst-directive.py
index f81677b6..de26dd03 100644
--- a/external/rst-directive.py
+++ b/external/rst-directive.py
@@ -31,7 +31,7 @@
.. _directive documentation:
http://docutils.sourceforge.net/docs/howto/rst-directives.html
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/__init__.py b/pygments/__init__.py
index ffac59ef..394a85f2 100644
--- a/pygments/__init__.py
+++ b/pygments/__init__.py
@@ -22,14 +22,14 @@
.. _Pygments tip:
http://bitbucket.org/birkenfeld/pygments-main/get/tip.zip#egg=Pygments-dev
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import sys
from pygments.util import StringIO, BytesIO
-__version__ = '2.2a0'
+__version__ = '2.2.0'
__docformat__ = 'restructuredtext'
__all__ = ['lex', 'format', 'highlight']
diff --git a/pygments/cmdline.py b/pygments/cmdline.py
index 11de70a9..2f6c1401 100644
--- a/pygments/cmdline.py
+++ b/pygments/cmdline.py
@@ -5,7 +5,7 @@
Command line interface.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -20,11 +20,11 @@ from pygments import __version__, highlight
from pygments.util import ClassNotFound, OptionError, docstring_headline, \
guess_decode, guess_decode_from_terminal, terminal_encoding
from pygments.lexers import get_all_lexers, get_lexer_by_name, guess_lexer, \
- get_lexer_for_filename, find_lexer_class_for_filename
+ load_lexer_from_file, get_lexer_for_filename, find_lexer_class_for_filename
from pygments.lexers.special import TextLexer
from pygments.formatters.latex import LatexEmbeddedLexer, LatexFormatter
from pygments.formatters import get_all_formatters, get_formatter_by_name, \
- get_formatter_for_filename, find_formatter_class
+ load_formatter_from_file, get_formatter_for_filename, find_formatter_class
from pygments.formatters.terminal import TerminalFormatter
from pygments.formatters.terminal256 import Terminal256Formatter
from pygments.filters import get_all_filters, find_filter_class
@@ -33,7 +33,7 @@ from pygments.styles import get_all_styles, get_style_by_name
USAGE = """\
Usage: %s [-l <lexer> | -g] [-F <filter>[:<options>]] [-f <formatter>]
- [-O <options>] [-P <option=value>] [-s] [-v] [-o <outfile>] [<infile>]
+ [-O <options>] [-P <option=value>] [-s] [-v] [-x] [-o <outfile>] [<infile>]
%s -S <style> -f <formatter> [-a <arg>] [-O <options>] [-P <option=value>]
%s -L [<which> ...]
@@ -59,6 +59,14 @@ Likewise, <formatter> is a formatter name, and will be guessed from
the extension of the output file name. If no output file is given,
the terminal formatter will be used by default.
+The additional option -x allows custom lexers and formatters to be
+loaded from a .py file relative to the current working directory. For
+example, ``-l ./customlexer.py -x``. By default, this option expects a
+file with a class named CustomLexer or CustomFormatter; you can also
+specify your own class name with a colon (``-l ./lexer.py:MyLexer``).
+Users should be very careful not to use this option with untrusted files,
+because it will import and run them.
+
With the -O option, you can give the lexer and formatter a comma-
separated list of options, e.g. ``-O bg=light,python=cool``.
@@ -225,7 +233,7 @@ def main_inner(popts, args, usage):
return 0
if opts.pop('-V', None) is not None:
- print('Pygments version %s, (c) 2006-2015 by Georg Brandl.' % __version__)
+ print('Pygments version %s, (c) 2006-2017 by Georg Brandl.' % __version__)
return 0
# handle ``pygmentize -L``
@@ -316,17 +324,35 @@ def main_inner(popts, args, usage):
F_opts = _parse_filters(F_opts)
opts.pop('-F', None)
+ allow_custom_lexer_formatter = False
+ # -x: allow custom (eXternal) lexers and formatters
+ if opts.pop('-x', None) is not None:
+ allow_custom_lexer_formatter = True
+
# select lexer
lexer = None
# given by name?
lexername = opts.pop('-l', None)
if lexername:
- try:
- lexer = get_lexer_by_name(lexername, **parsed_opts)
- except (OptionError, ClassNotFound) as err:
- print('Error:', err, file=sys.stderr)
- return 1
+ # custom lexer, located relative to user's cwd
+ if allow_custom_lexer_formatter and '.py' in lexername:
+ try:
+ if ':' in lexername:
+ filename, name = lexername.rsplit(':', 1)
+ lexer = load_lexer_from_file(filename, name,
+ **parsed_opts)
+ else:
+ lexer = load_lexer_from_file(lexername, **parsed_opts)
+ except ClassNotFound as err:
+ print('Error:', err, file=sys.stderr)
+ return 1
+ else:
+ try:
+ lexer = get_lexer_by_name(lexername, **parsed_opts)
+ except (OptionError, ClassNotFound) as err:
+ print('Error:', err, file=sys.stderr)
+ return 1
# read input code
code = None
@@ -403,11 +429,24 @@ def main_inner(popts, args, usage):
outfn = opts.pop('-o', None)
fmter = opts.pop('-f', None)
if fmter:
- try:
- fmter = get_formatter_by_name(fmter, **parsed_opts)
- except (OptionError, ClassNotFound) as err:
- print('Error:', err, file=sys.stderr)
- return 1
+ # custom formatter, located relative to user's cwd
+ if allow_custom_lexer_formatter and '.py' in fmter:
+ try:
+ if ':' in fmter:
+ file, fmtername = fmter.rsplit(':', 1)
+ fmter = load_formatter_from_file(file, fmtername,
+ **parsed_opts)
+ else:
+ fmter = load_formatter_from_file(fmter, **parsed_opts)
+ except ClassNotFound as err:
+ print('Error:', err, file=sys.stderr)
+ return 1
+ else:
+ try:
+ fmter = get_formatter_by_name(fmter, **parsed_opts)
+ except (OptionError, ClassNotFound) as err:
+ print('Error:', err, file=sys.stderr)
+ return 1
if outfn:
if not fmter:
@@ -500,7 +539,7 @@ def main(args=sys.argv):
usage = USAGE % ((args[0],) * 6)
try:
- popts, args = getopt.getopt(args[1:], "l:f:F:o:O:P:LS:a:N:vhVHgs")
+ popts, args = getopt.getopt(args[1:], "l:f:F:o:O:P:LS:a:N:vhVHgsx")
except getopt.GetoptError:
print(usage, file=sys.stderr)
return 2
diff --git a/pygments/console.py b/pygments/console.py
index 4aaf5fcb..31b6839d 100644
--- a/pygments/console.py
+++ b/pygments/console.py
@@ -5,7 +5,7 @@
Format colored console output.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/filter.py b/pygments/filter.py
index f3082037..68be7ad7 100644
--- a/pygments/filter.py
+++ b/pygments/filter.py
@@ -5,7 +5,7 @@
Module that implements the default filter.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/filters/__init__.py b/pygments/filters/__init__.py
index 45bd49d5..45f9608c 100644
--- a/pygments/filters/__init__.py
+++ b/pygments/filters/__init__.py
@@ -6,7 +6,7 @@
Module containing filter lookup functions and default
filters.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/formatter.py b/pygments/formatter.py
index 9f22b3bc..c0780f62 100644
--- a/pygments/formatter.py
+++ b/pygments/formatter.py
@@ -5,7 +5,7 @@
Base formatter class.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/formatters/__init__.py b/pygments/formatters/__init__.py
index 8ddf0ee3..965c5f1a 100644
--- a/pygments/formatters/__init__.py
+++ b/pygments/formatters/__init__.py
@@ -5,7 +5,7 @@
Pygments formatters.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -20,7 +20,7 @@ from pygments.plugin import find_plugin_formatters
from pygments.util import ClassNotFound, itervalues
__all__ = ['get_formatter_by_name', 'get_formatter_for_filename',
- 'get_all_formatters'] + list(FORMATTERS)
+ 'get_all_formatters', 'load_formatter_from_file'] + list(FORMATTERS)
_formatter_cache = {} # classes by name
_pattern_cache = {}
@@ -79,6 +79,41 @@ def get_formatter_by_name(_alias, **options):
return cls(**options)
+def load_formatter_from_file(filename, formattername="CustomFormatter",
+ **options):
+ """Load a formatter from a file.
+
+ This method expects a file located relative to the current working
+ directory, which contains a class named CustomFormatter. By default,
+ it expects the Formatter to be named CustomFormatter; you can specify
+ your own class name as the second argument to this function.
+
+ Users should be very careful with the input, because this method
+ is equivalent to running eval on the input file.
+
+ Raises ClassNotFound if there are any problems importing the Formatter.
+
+ .. versionadded:: 2.2
+ """
+ try:
+ # This empty dict will contain the namespace for the exec'd file
+ custom_namespace = {}
+ exec(open(filename, 'rb').read(), custom_namespace)
+ # Retrieve the class `formattername` from that namespace
+ if formattername not in custom_namespace:
+ raise ClassNotFound('no valid %s class found in %s' %
+ (formattername, filename))
+ formatter_class = custom_namespace[formattername]
+ # And finally instantiate it with the options
+ return formatter_class(**options)
+ except IOError as err:
+ raise ClassNotFound('cannot read %s' % filename)
+ except ClassNotFound as err:
+ raise
+ except Exception as err:
+ raise ClassNotFound('error when loading custom formatter: %s' % err)
+
+
def get_formatter_for_filename(fn, **options):
"""Lookup and instantiate a formatter by filename pattern.
diff --git a/pygments/formatters/_mapping.py b/pygments/formatters/_mapping.py
index 01d053dd..7bb3e71c 100755
--- a/pygments/formatters/_mapping.py
+++ b/pygments/formatters/_mapping.py
@@ -9,7 +9,7 @@
Do not alter the FORMATTERS dictionary by hand.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/formatters/bbcode.py b/pygments/formatters/bbcode.py
index 580989f0..9fc9476d 100644
--- a/pygments/formatters/bbcode.py
+++ b/pygments/formatters/bbcode.py
@@ -5,7 +5,7 @@
BBcode formatter.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py
index 2c6bb19e..2969d502 100644
--- a/pygments/formatters/html.py
+++ b/pygments/formatters/html.py
@@ -5,7 +5,7 @@
Formatter for HTML output.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/formatters/img.py b/pygments/formatters/img.py
index cc95ce24..2fb0dea5 100644
--- a/pygments/formatters/img.py
+++ b/pygments/formatters/img.py
@@ -5,10 +5,11 @@
Formatter for Pixmap output.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
+import os
import sys
from pygments.formatter import Formatter
@@ -47,6 +48,7 @@ STYLES = {
# A sane default for modern systems
DEFAULT_FONT_NAME_NIX = 'Bitstream Vera Sans Mono'
DEFAULT_FONT_NAME_WIN = 'Courier New'
+DEFAULT_FONT_NAME_MAC = 'Courier New'
class PilNotAvailable(ImportError):
@@ -71,6 +73,10 @@ class FontManager(object):
if not font_name:
self.font_name = DEFAULT_FONT_NAME_WIN
self._create_win()
+ elif sys.platform.startswith('darwin'):
+ if not font_name:
+ self.font_name = DEFAULT_FONT_NAME_MAC
+ self._create_mac()
else:
if not font_name:
self.font_name = DEFAULT_FONT_NAME_NIX
@@ -111,6 +117,37 @@ class FontManager(object):
else:
self.fonts[style] = self.fonts['NORMAL']
+ def _get_mac_font_path(self, font_map, name, style):
+ return font_map.get((name + ' ' + style).strip().lower())
+
+ def _create_mac(self):
+ font_map = {}
+ for font_dir in (os.path.join(os.getenv("HOME"), 'Library/Fonts/'),
+ '/Library/Fonts/', '/System/Library/Fonts/'):
+ font_map.update(
+ ((os.path.splitext(f)[0].lower(), os.path.join(font_dir, f))
+ for f in os.listdir(font_dir) if f.lower().endswith('ttf')))
+
+ for name in STYLES['NORMAL']:
+ path = self._get_mac_font_path(font_map, self.font_name, name)
+ if path is not None:
+ self.fonts['NORMAL'] = ImageFont.truetype(path, self.font_size)
+ break
+ else:
+ raise FontNotFound('No usable fonts named: "%s"' %
+ self.font_name)
+ for style in ('ITALIC', 'BOLD', 'BOLDITALIC'):
+ for stylename in STYLES[style]:
+ path = self._get_mac_font_path(font_map, self.font_name, stylename)
+ if path is not None:
+ self.fonts[style] = ImageFont.truetype(path, self.font_size)
+ break
+ else:
+ if style == 'BOLDITALIC':
+ self.fonts[style] = self.fonts['BOLD']
+ else:
+ self.fonts[style] = self.fonts['NORMAL']
+
def _lookup_win(self, key, basename, styles, fail=False):
for suffix in ('', ' (TrueType)'):
for style in styles:
diff --git a/pygments/formatters/irc.py b/pygments/formatters/irc.py
index d1eed0ac..eb744d74 100644
--- a/pygments/formatters/irc.py
+++ b/pygments/formatters/irc.py
@@ -5,7 +5,7 @@
Formatter for IRC output
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/formatters/latex.py b/pygments/formatters/latex.py
index 66d521f5..336b59de 100644
--- a/pygments/formatters/latex.py
+++ b/pygments/formatters/latex.py
@@ -5,7 +5,7 @@
Formatter for LaTeX fancyvrb output.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/formatters/other.py b/pygments/formatters/other.py
index 4945d763..d6bfcacf 100644
--- a/pygments/formatters/other.py
+++ b/pygments/formatters/other.py
@@ -5,7 +5,7 @@
Other formatters: NullFormatter, RawTokenFormatter.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/formatters/rtf.py b/pygments/formatters/rtf.py
index 27be225a..c6353c12 100644
--- a/pygments/formatters/rtf.py
+++ b/pygments/formatters/rtf.py
@@ -5,7 +5,7 @@
A formatter that generates RTF files.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/formatters/svg.py b/pygments/formatters/svg.py
index 0efe9eea..944b25e0 100644
--- a/pygments/formatters/svg.py
+++ b/pygments/formatters/svg.py
@@ -5,7 +5,7 @@
Formatter for SVG output.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/formatters/terminal.py b/pygments/formatters/terminal.py
index 2dbfde7f..b8fec52e 100644
--- a/pygments/formatters/terminal.py
+++ b/pygments/formatters/terminal.py
@@ -5,7 +5,7 @@
Formatter for terminal output with ANSI sequences.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/formatters/terminal256.py b/pygments/formatters/terminal256.py
index 5110bc9e..b80dc7dd 100644
--- a/pygments/formatters/terminal256.py
+++ b/pygments/formatters/terminal256.py
@@ -11,7 +11,7 @@
Formatter version 1.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexer.py b/pygments/lexer.py
index f16d8106..90905ba5 100644
--- a/pygments/lexer.py
+++ b/pygments/lexer.py
@@ -5,7 +5,7 @@
Base lexer classes.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/__init__.py b/pygments/lexers/__init__.py
index d64f163f..328e072c 100644
--- a/pygments/lexers/__init__.py
+++ b/pygments/lexers/__init__.py
@@ -5,7 +5,7 @@
Pygments lexers.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -22,7 +22,7 @@ from pygments.util import ClassNotFound, itervalues, guess_decode
__all__ = ['get_lexer_by_name', 'get_lexer_for_filename', 'find_lexer_class',
- 'guess_lexer'] + list(LEXERS)
+ 'guess_lexer', 'load_lexer_from_file'] + list(LEXERS)
_lexer_cache = {}
_pattern_cache = {}
@@ -72,7 +72,7 @@ def find_lexer_class(name):
return cls
-def find_lexer_class_by_name(alias):
+def find_lexer_class_by_name(_alias):
"""Lookup a lexer class by alias.
Like `get_lexer_by_name`, but does not instantiate the class.
@@ -115,6 +115,40 @@ def get_lexer_by_name(_alias, **options):
raise ClassNotFound('no lexer for alias %r found' % _alias)
+def load_lexer_from_file(filename, lexername="CustomLexer", **options):
+ """Load a lexer from a file.
+
+ This method expects a file located relative to the current working
+ directory, which contains a Lexer class. By default, it expects the
+ Lexer to be name CustomLexer; you can specify your own class name
+ as the second argument to this function.
+
+ Users should be very careful with the input, because this method
+ is equivalent to running eval on the input file.
+
+ Raises ClassNotFound if there are any problems importing the Lexer.
+
+ .. versionadded:: 2.2
+ """
+ try:
+ # This empty dict will contain the namespace for the exec'd file
+ custom_namespace = {}
+ exec(open(filename, 'rb').read(), custom_namespace)
+ # Retrieve the class `lexername` from that namespace
+ if lexername not in custom_namespace:
+ raise ClassNotFound('no valid %s class found in %s' %
+ (lexername, filename))
+ lexer_class = custom_namespace[lexername]
+ # And finally instantiate it with the options
+ return lexer_class(**options)
+ except IOError as err:
+ raise ClassNotFound('cannot read %s' % filename)
+ except ClassNotFound as err:
+ raise
+ except Exception as err:
+ raise ClassNotFound('error when loading custom lexer: %s' % err)
+
+
def find_lexer_class_for_filename(_fn, code=None):
"""Get a lexer for a filename.
@@ -149,8 +183,8 @@ def find_lexer_class_for_filename(_fn, code=None):
# gets turned into 0.0. Run scripts/detect_missing_analyse_text.py
# to find lexers which need it overridden.
if code:
- return cls.analyse_text(code) + bonus
- return cls.priority + bonus
+ return cls.analyse_text(code) + bonus, cls.__name__
+ return cls.priority + bonus, cls.__name__
if matches:
matches.sort(key=get_rating)
diff --git a/pygments/lexers/_asy_builtins.py b/pygments/lexers/_asy_builtins.py
index 51716866..1f831cdb 100644
--- a/pygments/lexers/_asy_builtins.py
+++ b/pygments/lexers/_asy_builtins.py
@@ -10,7 +10,7 @@
TODO: perl/python script in Asymptote SVN similar to asy-list.pl but only
for function and variable names.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/_cl_builtins.py b/pygments/lexers/_cl_builtins.py
index a2243647..ce5ad48e 100644
--- a/pygments/lexers/_cl_builtins.py
+++ b/pygments/lexers/_cl_builtins.py
@@ -5,7 +5,7 @@
ANSI Common Lisp builtins.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/_cocoa_builtins.py b/pygments/lexers/_cocoa_builtins.py
index a4f00d9d..064167ff 100644
--- a/pygments/lexers/_cocoa_builtins.py
+++ b/pygments/lexers/_cocoa_builtins.py
@@ -8,7 +8,7 @@
File may be also used as standalone generator for aboves.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/_csound_builtins.py b/pygments/lexers/_csound_builtins.py
index a88e0a83..e5a9aaf7 100644
--- a/pygments/lexers/_csound_builtins.py
+++ b/pygments/lexers/_csound_builtins.py
@@ -3,7 +3,7 @@
pygments.lexers._csound_builtins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/_lasso_builtins.py b/pygments/lexers/_lasso_builtins.py
index 7c6fd6d4..d950cbe8 100644
--- a/pygments/lexers/_lasso_builtins.py
+++ b/pygments/lexers/_lasso_builtins.py
@@ -5,7 +5,7 @@
Built-in Lasso types, traits, methods, and members.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -471,6 +471,10 @@ BUILTINS = {
'curl_netrc_ignored',
'curl_netrc_optional',
'curl_netrc_required',
+ 'curl_sslversion_default',
+ 'curl_sslversion_sslv2',
+ 'curl_sslversion_sslv3',
+ 'curl_sslversion_tlsv1',
'curl_version_asynchdns',
'curl_version_debug',
'curl_version_gssnegotiate',
@@ -1102,6 +1106,7 @@ BUILTINS = {
'json_open_array',
'json_open_object',
'json_period',
+ 'json_positive',
'json_quote_double',
'json_rpccall',
'json_serialize',
@@ -1229,6 +1234,7 @@ BUILTINS = {
'lcapi_loadmodules',
'lcapi_updatedatasourceslist',
'ldap_scope_base',
+ 'ldap_scope_children',
'ldap_scope_onelevel',
'ldap_scope_subtree',
'library_once',
@@ -4044,6 +4050,7 @@ MEMBERS = {
'iscntrl',
'isdigit',
'isdir',
+ 'isdirectory',
'isempty',
'isemptyelement',
'isfirststep',
diff --git a/pygments/lexers/_lua_builtins.py b/pygments/lexers/_lua_builtins.py
index 7472b9e6..c60bf5a2 100644
--- a/pygments/lexers/_lua_builtins.py
+++ b/pygments/lexers/_lua_builtins.py
@@ -9,7 +9,7 @@
Do not edit the MODULES dict by hand.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py
index a6097b1c..ea54241c 100644
--- a/pygments/lexers/_mapping.py
+++ b/pygments/lexers/_mapping.py
@@ -51,7 +51,7 @@ LEXERS = {
'BCLexer': ('pygments.lexers.algebra', 'BC', ('bc',), ('*.bc',), ()),
'BSTLexer': ('pygments.lexers.bibtex', 'BST', ('bst', 'bst-pybtex'), ('*.bst',), ()),
'BaseMakefileLexer': ('pygments.lexers.make', 'Base Makefile', ('basemake',), (), ()),
- 'BashLexer': ('pygments.lexers.shell', 'Bash', ('bash', 'sh', 'ksh', 'shell'), ('*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass', '*.exheres-0', '*.exlib', '.bashrc', 'bashrc', '.bash_*', 'bash_*', 'PKGBUILD'), ('application/x-sh', 'application/x-shellscript')),
+ 'BashLexer': ('pygments.lexers.shell', 'Bash', ('bash', 'sh', 'ksh', 'zsh', 'shell'), ('*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass', '*.exheres-0', '*.exlib', '*.zsh', '.bashrc', 'bashrc', '.bash_*', 'bash_*', 'zshrc', '.zshrc', 'PKGBUILD'), ('application/x-sh', 'application/x-shellscript')),
'BashSessionLexer': ('pygments.lexers.shell', 'Bash Session', ('console', 'shell-session'), ('*.sh-session', '*.shell-session'), ('application/x-shell-session', 'application/x-sh-session')),
'BatchLexer': ('pygments.lexers.shell', 'Batchfile', ('bat', 'batch', 'dosbatch', 'winbatch'), ('*.bat', '*.cmd'), ('application/x-dos-batch',)),
'BefungeLexer': ('pygments.lexers.esoteric', 'Befunge', ('befunge',), ('*.befunge',), ('application/x-befunge',)),
@@ -121,7 +121,7 @@ LEXERS = {
'DarcsPatchLexer': ('pygments.lexers.diff', 'Darcs Patch', ('dpatch',), ('*.dpatch', '*.darcspatch'), ()),
'DartLexer': ('pygments.lexers.javascript', 'Dart', ('dart',), ('*.dart',), ('text/x-dart',)),
'DebianControlLexer': ('pygments.lexers.installers', 'Debian Control file', ('control', 'debcontrol'), ('control',), ()),
- 'DelphiLexer': ('pygments.lexers.pascal', 'Delphi', ('delphi', 'pas', 'pascal', 'objectpascal'), ('*.pas',), ('text/x-pascal',)),
+ 'DelphiLexer': ('pygments.lexers.pascal', 'Delphi', ('delphi', 'pas', 'pascal', 'objectpascal'), ('*.pas', '*.dpr'), ('text/x-pascal',)),
'DgLexer': ('pygments.lexers.python', 'dg', ('dg',), ('*.dg',), ('text/x-dg',)),
'DiffLexer': ('pygments.lexers.diff', 'Diff', ('diff', 'udiff'), ('*.diff', '*.patch'), ('text/x-diff', 'text/x-patch')),
'DjangoLexer': ('pygments.lexers.templates', 'Django/Jinja', ('django', 'jinja'), (), ('application/x-django-templating', 'application/x-jinja')),
@@ -289,7 +289,7 @@ LEXERS = {
'NesCLexer': ('pygments.lexers.c_like', 'nesC', ('nesc',), ('*.nc',), ('text/x-nescsrc',)),
'NewLispLexer': ('pygments.lexers.lisp', 'NewLisp', ('newlisp',), ('*.lsp', '*.nl', '*.kif'), ('text/x-newlisp', 'application/x-newlisp')),
'NewspeakLexer': ('pygments.lexers.smalltalk', 'Newspeak', ('newspeak',), ('*.ns2',), ('text/x-newspeak',)),
- 'NginxConfLexer': ('pygments.lexers.configs', 'Nginx configuration file', ('nginx',), (), ('text/x-nginx-conf',)),
+ 'NginxConfLexer': ('pygments.lexers.configs', 'Nginx configuration file', ('nginx',), ('nginx.conf',), ('text/x-nginx-conf',)),
'NimrodLexer': ('pygments.lexers.nimrod', 'Nimrod', ('nim', 'nimrod'), ('*.nim', '*.nimrod'), ('text/x-nim',)),
'NitLexer': ('pygments.lexers.nit', 'Nit', ('nit',), ('*.nit',), ()),
'NixLexer': ('pygments.lexers.nix', 'Nix', ('nixos', 'nix'), ('*.nix',), ('text/x-nix',)),
@@ -378,7 +378,7 @@ LEXERS = {
'ScilabLexer': ('pygments.lexers.matlab', 'Scilab', ('scilab',), ('*.sci', '*.sce', '*.tst'), ('text/scilab',)),
'ScssLexer': ('pygments.lexers.css', 'SCSS', ('scss',), ('*.scss',), ('text/x-scss',)),
'ShenLexer': ('pygments.lexers.lisp', 'Shen', ('shen',), ('*.shen',), ('text/x-shen', 'application/x-shen')),
- 'SilverLexer': ('pygments.lexers.verification', 'Silver', ('silver',), ('*.sil',), ()),
+ 'SilverLexer': ('pygments.lexers.verification', 'Silver', ('silver',), ('*.sil', '*.vpr'), ()),
'SlimLexer': ('pygments.lexers.webmisc', 'Slim', ('slim',), ('*.slim',), ('text/x-slim',)),
'SmaliLexer': ('pygments.lexers.dalvik', 'Smali', ('smali',), ('*.smali',), ('text/smali',)),
'SmalltalkLexer': ('pygments.lexers.smalltalk', 'Smalltalk', ('smalltalk', 'squeak', 'st'), ('*.st',), ('text/x-smalltalk',)),
diff --git a/pygments/lexers/_mql_builtins.py b/pygments/lexers/_mql_builtins.py
index 524a2ea2..6eb600c4 100644
--- a/pygments/lexers/_mql_builtins.py
+++ b/pygments/lexers/_mql_builtins.py
@@ -5,7 +5,7 @@
Builtins for the MqlLexer.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
types = (
diff --git a/pygments/lexers/_openedge_builtins.py b/pygments/lexers/_openedge_builtins.py
index 46b6cc42..0fa7d1b2 100644
--- a/pygments/lexers/_openedge_builtins.py
+++ b/pygments/lexers/_openedge_builtins.py
@@ -5,7 +5,7 @@
Builtin list for the OpenEdgeLexer.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/_php_builtins.py b/pygments/lexers/_php_builtins.py
index f1b64ced..fec3286a 100644
--- a/pygments/lexers/_php_builtins.py
+++ b/pygments/lexers/_php_builtins.py
@@ -12,7 +12,7 @@
internet connection. don't run that at home, use
a server ;-)
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/_postgres_builtins.py b/pygments/lexers/_postgres_builtins.py
index 671fa677..a71360f0 100644
--- a/pygments/lexers/_postgres_builtins.py
+++ b/pygments/lexers/_postgres_builtins.py
@@ -5,7 +5,7 @@
Self-updating data files for PostgreSQL lexer.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/_scilab_builtins.py b/pygments/lexers/_scilab_builtins.py
index 85c99966..ce0ac67d 100644
--- a/pygments/lexers/_scilab_builtins.py
+++ b/pygments/lexers/_scilab_builtins.py
@@ -5,7 +5,7 @@
Builtin list for the ScilabLexer.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/_sourcemod_builtins.py b/pygments/lexers/_sourcemod_builtins.py
index 9ebb1595..f08ea481 100644
--- a/pygments/lexers/_sourcemod_builtins.py
+++ b/pygments/lexers/_sourcemod_builtins.py
@@ -8,7 +8,7 @@
Do not edit the FUNCTIONS list by hand.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/_stan_builtins.py b/pygments/lexers/_stan_builtins.py
index 6585ad71..a189647a 100644
--- a/pygments/lexers/_stan_builtins.py
+++ b/pygments/lexers/_stan_builtins.py
@@ -6,7 +6,7 @@
This file contains the names of functions for Stan used by
``pygments.lexers.math.StanLexer. This is for Stan language version 2.8.0.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/_stata_builtins.py b/pygments/lexers/_stata_builtins.py
index 424a739f..5f5f72a9 100644
--- a/pygments/lexers/_stata_builtins.py
+++ b/pygments/lexers/_stata_builtins.py
@@ -5,7 +5,7 @@
Builtins for Stata
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/_tsql_builtins.py b/pygments/lexers/_tsql_builtins.py
index 44ad8244..e29ed34b 100644
--- a/pygments/lexers/_tsql_builtins.py
+++ b/pygments/lexers/_tsql_builtins.py
@@ -5,7 +5,7 @@
These are manually translated lists from https://msdn.microsoft.com.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/_vim_builtins.py b/pygments/lexers/_vim_builtins.py
index e9b5fa1e..82586289 100644
--- a/pygments/lexers/_vim_builtins.py
+++ b/pygments/lexers/_vim_builtins.py
@@ -5,7 +5,7 @@
This file is autogenerated by scripts/get_vimkw.py
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/actionscript.py b/pygments/lexers/actionscript.py
index 9c687a57..84607e68 100644
--- a/pygments/lexers/actionscript.py
+++ b/pygments/lexers/actionscript.py
@@ -5,7 +5,7 @@
Lexers for ActionScript and MXML.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py
index defa7b6e..cb200b9e 100644
--- a/pygments/lexers/agile.py
+++ b/pygments/lexers/agile.py
@@ -5,7 +5,7 @@
Just export lexer classes previously contained in this module.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/algebra.py b/pygments/lexers/algebra.py
index 79460ad4..15d68842 100644
--- a/pygments/lexers/algebra.py
+++ b/pygments/lexers/algebra.py
@@ -5,7 +5,7 @@
Lexers for computer algebra systems.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/ambient.py b/pygments/lexers/ambient.py
index 7f622fbc..53f3a5e1 100644
--- a/pygments/lexers/ambient.py
+++ b/pygments/lexers/ambient.py
@@ -5,7 +5,7 @@
Lexers for AmbientTalk language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/ampl.py b/pygments/lexers/ampl.py
index c3ca80d4..d439cb19 100644
--- a/pygments/lexers/ampl.py
+++ b/pygments/lexers/ampl.py
@@ -5,7 +5,7 @@
Lexers for the ampl language. <http://ampl.com/>
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/apl.py b/pygments/lexers/apl.py
index 61ea4c4b..b3414cc0 100644
--- a/pygments/lexers/apl.py
+++ b/pygments/lexers/apl.py
@@ -5,7 +5,7 @@
Lexers for APL.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/archetype.py b/pygments/lexers/archetype.py
index e596b7be..5d4eb9aa 100644
--- a/pygments/lexers/archetype.py
+++ b/pygments/lexers/archetype.py
@@ -14,7 +14,7 @@
Contributed by Thomas Beale <https://github.com/wolandscat>,
<https://bitbucket.org/thomas_beale>.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/asm.py b/pygments/lexers/asm.py
index 2bb3eac9..9c58478e 100644
--- a/pygments/lexers/asm.py
+++ b/pygments/lexers/asm.py
@@ -5,7 +5,7 @@
Lexers for assembly languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -54,8 +54,6 @@ class GasLexer(RegexLexer):
(number, Number.Integer),
(r'[\r\n]+', Text, '#pop'),
- (r'#.*?$', Comment, '#pop'),
-
include('punctuation'),
include('whitespace')
],
@@ -78,14 +76,14 @@ class GasLexer(RegexLexer):
('$'+number, Number.Integer),
(r"$'(.|\\')'", String.Char),
(r'[\r\n]+', Text, '#pop'),
- (r'#.*?$', Comment, '#pop'),
+
include('punctuation'),
include('whitespace')
],
'whitespace': [
(r'\n', Text),
(r'\s+', Text),
- (r'#.*?\n', Comment)
+ (r'[;#].*?\n', Comment)
],
'punctuation': [
(r'[-*,.()\[\]!:]+', Punctuation)
@@ -281,7 +279,7 @@ class HsailLexer(RegexLexer):
'enabledetectexceptions', 'maxdynamicgroupsize', 'maxflatgridsize',
'maxflatworkgroupsize', 'requireddim', 'requiredgridsize',
'requiredworkgroupsize', 'requirenopartialworkgroups'),
- suffix=r'\b'), Keyword),
+ suffix=r'\b'), Keyword),
# instructions
(roundingMod, Keyword),
@@ -412,18 +410,31 @@ class LlvmLexer(RegexLexer):
'unwind', 'unreachable', 'indirectbr', 'landingpad', 'resume',
'malloc', 'alloca', 'free', 'load', 'store', 'getelementptr',
'extractelement', 'insertelement', 'shufflevector', 'getresult',
- 'extractvalue', 'insertvalue', 'atomicrmw', 'cmpxchg', 'fence'),
- suffix=r'\b'), Keyword),
+ 'extractvalue', 'insertvalue', 'atomicrmw', 'cmpxchg', 'fence',
+ 'allocsize', 'amdgpu_cs', 'amdgpu_gs', 'amdgpu_kernel', 'amdgpu_ps',
+ 'amdgpu_vs', 'any', 'anyregcc', 'argmemonly', 'avr_intrcc',
+ 'avr_signalcc', 'caller', 'catchpad', 'catchret', 'catchswitch',
+ 'cleanuppad', 'cleanupret', 'comdat', 'convergent', 'cxx_fast_tlscc',
+ 'deplibs', 'dereferenceable', 'dereferenceable_or_null', 'distinct',
+ 'exactmatch', 'externally_initialized', 'from', 'ghccc', 'hhvm_ccc',
+ 'hhvmcc', 'ifunc', 'inaccessiblemem_or_argmemonly', 'inaccessiblememonly',
+ 'inalloca', 'jumptable', 'largest', 'local_unnamed_addr', 'minsize',
+ 'musttail', 'noduplicates', 'none', 'nonnull', 'norecurse', 'notail',
+ 'preserve_allcc', 'preserve_mostcc', 'prologue', 'safestack', 'samesize',
+ 'source_filename', 'swiftcc', 'swifterror', 'swiftself', 'webkit_jscc',
+ 'within', 'writeonly', 'x86_intrcc', 'x86_vectorcallcc'),
+ suffix=r'\b'), Keyword),
# Types
(words(('void', 'half', 'float', 'double', 'x86_fp80', 'fp128',
- 'ppc_fp128', 'label', 'metadata')), Keyword.Type),
+ 'ppc_fp128', 'label', 'metadata', 'token')), Keyword.Type),
# Integer types
(r'i[1-9]\d*', Keyword)
]
}
+
class NasmLexer(RegexLexer):
"""
For Nasm (Intel) assembly code.
diff --git a/pygments/lexers/automation.py b/pygments/lexers/automation.py
index 2ebc4d24..be1ec129 100644
--- a/pygments/lexers/automation.py
+++ b/pygments/lexers/automation.py
@@ -5,7 +5,7 @@
Lexers for automation scripting languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/basic.py b/pygments/lexers/basic.py
index a73ad8b4..e6545ee6 100644
--- a/pygments/lexers/basic.py
+++ b/pygments/lexers/basic.py
@@ -5,7 +5,7 @@
Lexers for BASIC like languages (other than VB.net).
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/bibtex.py b/pygments/lexers/bibtex.py
index cbaedca2..a6159f81 100644
--- a/pygments/lexers/bibtex.py
+++ b/pygments/lexers/bibtex.py
@@ -5,14 +5,16 @@
Lexers for BibTeX bibliography data and styles
- :copyright: Copyright 2005-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
-from pygments.lexer import RegexLexer, ExtendedRegexLexer, include, default, words
-from pygments.token import Name, Comment, String, Error, Number, Text, Keyword, Punctuation
+from pygments.lexer import RegexLexer, ExtendedRegexLexer, include, default, \
+ words
+from pygments.token import Name, Comment, String, Error, Number, Text, \
+ Keyword, Punctuation
__all__ = ['BibTeXLexer', 'BSTLexer']
@@ -57,7 +59,8 @@ class BibTeXLexer(ExtendedRegexLexer):
('@comment', Comment),
('@preamble', Name.Class, ('closing-brace', 'value', 'opening-brace')),
('@string', Name.Class, ('closing-brace', 'field', 'opening-brace')),
- ('@' + IDENTIFIER, Name.Class, ('closing-brace', 'command-body', 'opening-brace')),
+ ('@' + IDENTIFIER, Name.Class,
+ ('closing-brace', 'command-body', 'opening-brace')),
('.+', Comment),
],
'opening-brace': [
@@ -127,7 +130,8 @@ class BSTLexer(RegexLexer):
'root': [
include('whitespace'),
(words(['read', 'sort']), Keyword),
- (words(['execute', 'integers', 'iterate', 'reverse', 'strings']), Keyword, ('group')),
+ (words(['execute', 'integers', 'iterate', 'reverse', 'strings']),
+ Keyword, ('group')),
(words(['function', 'macro']), Keyword, ('group', 'group')),
(words(['entry']), Keyword, ('group', 'group', 'group')),
],
diff --git a/pygments/lexers/business.py b/pygments/lexers/business.py
index 43978690..552f3d9c 100644
--- a/pygments/lexers/business.py
+++ b/pygments/lexers/business.py
@@ -5,7 +5,7 @@
Lexers for "business-oriented" languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -256,6 +256,7 @@ class ABAPLexer(RegexLexer):
(r'\s+', Text),
(r'^\*.*$', Comment.Single),
(r'\".*?\n', Comment.Single),
+ (r'##\w+', Comment.Special),
],
'variable-names': [
(r'<\S+>', Name.Variable),
@@ -264,8 +265,8 @@ class ABAPLexer(RegexLexer):
'root': [
include('common'),
# function calls
- (r'(CALL\s+(?:BADI|CUSTOMER-FUNCTION|FUNCTION))(\s+)(\'?\S+\'?)',
- bygroups(Keyword, Text, Name.Function)),
+ (r'CALL\s+(?:BADI|CUSTOMER-FUNCTION|FUNCTION)',
+ Keyword),
(r'(CALL\s+(?:DIALOG|SCREEN|SUBSCREEN|SELECTION-SCREEN|'
r'TRANSACTION|TRANSFORMATION))\b',
Keyword),
@@ -285,6 +286,12 @@ class ABAPLexer(RegexLexer):
# call methodnames returning style
(r'(?<=(=|-)>)([\w\-~]+)(?=\()', Name.Function),
+ # text elements
+ (r'(TEXT)(-)(\d{3})',
+ bygroups(Keyword, Punctuation, Number.Integer)),
+ (r'(TEXT)(-)(\w{3})',
+ bygroups(Keyword, Punctuation, Name.Variable)),
+
# keywords with dashes in them.
# these need to be first, because for instance the -ID part
# of MESSAGE-ID wouldn't get highlighted if MESSAGE was
@@ -301,13 +308,13 @@ class ABAPLexer(RegexLexer):
r'OUTPUT-LENGTH|PRINT-CONTROL|'
r'SELECT-OPTIONS|START-OF-SELECTION|SUBTRACT-CORRESPONDING|'
r'SYNTAX-CHECK|SYSTEM-EXCEPTIONS|'
- r'TYPE-POOL|TYPE-POOLS'
+ r'TYPE-POOL|TYPE-POOLS|NO-DISPLAY'
r')\b', Keyword),
# keyword kombinations
- (r'CREATE\s+(PUBLIC|PRIVATE|DATA|OBJECT)|'
- r'((PUBLIC|PRIVATE|PROTECTED)\s+SECTION|'
- r'(TYPE|LIKE)(\s+(LINE\s+OF|REF\s+TO|'
+ (r'(?<![-\>])(CREATE\s+(PUBLIC|PRIVATE|DATA|OBJECT)|'
+ r'(PUBLIC|PRIVATE|PROTECTED)\s+SECTION|'
+ r'(TYPE|LIKE)\s+((LINE\s+OF|REF\s+TO|'
r'(SORTED|STANDARD|HASHED)\s+TABLE\s+OF))?|'
r'FROM\s+(DATABASE|MEMORY)|CALL\s+METHOD|'
r'(GROUP|ORDER) BY|HAVING|SEPARATED BY|'
@@ -343,10 +350,16 @@ class ABAPLexer(RegexLexer):
r'(BEGIN|END)\s+OF|'
r'DELETE(\s+ADJACENT\s+DUPLICATES\sFROM)?|'
r'COMPARING(\s+ALL\s+FIELDS)?|'
- r'INSERT(\s+INITIAL\s+LINE\s+INTO|\s+LINES\s+OF)?|'
+ r'(INSERT|APPEND)(\s+INITIAL\s+LINE\s+(IN)?TO|\s+LINES\s+OF)?|'
r'IN\s+((BYTE|CHARACTER)\s+MODE|PROGRAM)|'
r'END-OF-(DEFINITION|PAGE|SELECTION)|'
r'WITH\s+FRAME(\s+TITLE)|'
+ r'(REPLACE|FIND)\s+((FIRST|ALL)\s+OCCURRENCES?\s+OF\s+)?(SUBSTRING|REGEX)?|'
+ r'MATCH\s+(LENGTH|COUNT|LINE|OFFSET)|'
+ r'(RESPECTING|IGNORING)\s+CASE|'
+ r'IN\s+UPDATE\s+TASK|'
+ r'(SOURCE|RESULT)\s+(XML)?|'
+ r'REFERENCE\s+INTO|'
# simple kombinations
r'AND\s+(MARK|RETURN)|CLIENT\s+SPECIFIED|CORRESPONDING\s+FIELDS\s+OF|'
@@ -355,39 +368,41 @@ class ABAPLexer(RegexLexer):
r'MODIFY\s+SCREEN|NESTING\s+LEVEL|NO\s+INTERVALS|OF\s+STRUCTURE|'
r'RADIOBUTTON\s+GROUP|RANGE\s+OF|REF\s+TO|SUPPRESS DIALOG|'
r'TABLE\s+OF|UPPER\s+CASE|TRANSPORTING\s+NO\s+FIELDS|'
- r'VALUE\s+CHECK|VISIBLE\s+LENGTH|HEADER\s+LINE)\b', Keyword),
+ r'VALUE\s+CHECK|VISIBLE\s+LENGTH|HEADER\s+LINE|COMMON\s+PART)\b', Keyword),
# single word keywords.
- (r'(^|(?<=(\s|\.)))(ABBREVIATED|ADD|ALIASES|APPEND|ASSERT|'
- r'ASSIGN(ING)?|AT(\s+FIRST)?|'
+ (r'(^|(?<=(\s|\.)))(ABBREVIATED|ABSTRACT|ADD|ALIASES|ALIGN|ALPHA|'
+ r'ASSERT|AS|ASSIGN(ING)?|AT(\s+FIRST)?|'
r'BACK|BLOCK|BREAK-POINT|'
r'CASE|CATCH|CHANGING|CHECK|CLASS|CLEAR|COLLECT|COLOR|COMMIT|'
r'CREATE|COMMUNICATION|COMPONENTS?|COMPUTE|CONCATENATE|CONDENSE|'
- r'CONSTANTS|CONTEXTS|CONTINUE|CONTROLS|'
- r'DATA|DECIMALS|DEFAULT|DEFINE|DEFINITION|DEFERRED|DEMAND|'
- r'DETAIL|DIRECTORY|DIVIDE|DO|'
- r'ELSE(IF)?|ENDAT|ENDCASE|ENDCLASS|ENDDO|ENDFORM|ENDFUNCTION|'
- r'ENDIF|ENDLOOP|ENDMETHOD|ENDMODULE|ENDSELECT|ENDTRY|'
- r'ENHANCEMENT|EVENTS|EXCEPTIONS|EXIT|EXPORT|EXPORTING|EXTRACT|'
- r'FETCH|FIELDS?|FIND|FOR|FORM|FORMAT|FREE|FROM|'
+ r'CONSTANTS|CONTEXTS|CONTINUE|CONTROLS|COUNTRY|CURRENCY|'
+ r'DATA|DATE|DECIMALS|DEFAULT|DEFINE|DEFINITION|DEFERRED|DEMAND|'
+ r'DETAIL|DIRECTORY|DIVIDE|DO|DUMMY|'
+ r'ELSE(IF)?|ENDAT|ENDCASE|ENDCATCH|ENDCLASS|ENDDO|ENDFORM|ENDFUNCTION|'
+ r'ENDIF|ENDINTERFACE|ENDLOOP|ENDMETHOD|ENDMODULE|ENDSELECT|ENDTRY|ENDWHILE|'
+ r'ENHANCEMENT|EVENTS|EXACT|EXCEPTIONS?|EXIT|EXPONENT|EXPORT|EXPORTING|EXTRACT|'
+ r'FETCH|FIELDS?|FOR|FORM|FORMAT|FREE|FROM|FUNCTION|'
r'HIDE|'
r'ID|IF|IMPORT|IMPLEMENTATION|IMPORTING|IN|INCLUDE|INCLUDING|'
r'INDEX|INFOTYPES|INITIALIZATION|INTERFACE|INTERFACES|INTO|'
- r'LENGTH|LINES|LOAD|LOCAL|'
+ r'LANGUAGE|LEAVE|LENGTH|LINES|LOAD|LOCAL|'
r'JOIN|'
r'KEY|'
- r'MAXIMUM|MESSAGE|METHOD[S]?|MINIMUM|MODULE|MODIFY|MOVE|MULTIPLY|'
- r'NODES|'
- r'OBLIGATORY|OF|OFF|ON|OVERLAY|'
- r'PACK|PARAMETERS|PERCENTAGE|POSITION|PROGRAM|PROVIDE|PUBLIC|PUT|'
- r'RAISE|RAISING|RANGES|READ|RECEIVE|REFRESH|REJECT|REPORT|RESERVE|'
- r'RESUME|RETRY|RETURN|RETURNING|RIGHT|ROLLBACK|'
- r'SCROLL|SEARCH|SELECT|SHIFT|SINGLE|SKIP|SORT|SPLIT|STATICS|STOP|'
- r'SUBMIT|SUBTRACT|SUM|SUMMARY|SUMMING|SUPPLY|'
- r'TABLE|TABLES|TIMES|TITLE|TO|TOP-OF-PAGE|TRANSFER|TRANSLATE|TRY|TYPES|'
+ r'NEXT|'
+ r'MAXIMUM|MESSAGE|METHOD[S]?|MINIMUM|MODULE|MODIFIER|MODIFY|MOVE|MULTIPLY|'
+ r'NODES|NUMBER|'
+ r'OBLIGATORY|OBJECT|OF|OFF|ON|OTHERS|OVERLAY|'
+ r'PACK|PAD|PARAMETERS|PERCENTAGE|POSITION|PROGRAM|PROVIDE|PUBLIC|PUT|PF\d\d|'
+ r'RAISE|RAISING|RANGES?|READ|RECEIVE|REDEFINITION|REFRESH|REJECT|REPORT|RESERVE|'
+ r'RESUME|RETRY|RETURN|RETURNING|RIGHT|ROLLBACK|REPLACE|'
+ r'SCROLL|SEARCH|SELECT|SHIFT|SIGN|SINGLE|SIZE|SKIP|SORT|SPLIT|STATICS|STOP|'
+ r'STYLE|SUBMATCHES|SUBMIT|SUBTRACT|SUM(?!\()|SUMMARY|SUMMING|SUPPLY|'
+ r'TABLE|TABLES|TIMESTAMP|TIMES?|TIMEZONE|TITLE|\??TO|'
+ r'TOP-OF-PAGE|TRANSFER|TRANSLATE|TRY|TYPES|'
r'ULINE|UNDER|UNPACK|UPDATE|USING|'
- r'VALUE|VALUES|VIA|'
- r'WAIT|WHEN|WHERE|WHILE|WITH|WINDOW|WRITE)\b', Keyword),
+ r'VALUE|VALUES|VIA|VARYING|VARY|'
+ r'WAIT|WHEN|WHERE|WIDTH|WHILE|WITH|WINDOW|WRITE|XSD|ZERO)\b', Keyword),
# builtins
(r'(abs|acos|asin|atan|'
@@ -413,18 +428,21 @@ class ABAPLexer(RegexLexer):
# operators which look like variable names before
# parsing variable names.
- (r'(?<=(\s|.))(AND|EQ|NE|GT|LT|GE|LE|CO|CN|CA|NA|CS|NOT|NS|CP|NP|'
+ (r'(?<=(\s|.))(AND|OR|EQ|NE|GT|LT|GE|LE|CO|CN|CA|NA|CS|NOT|NS|CP|NP|'
r'BYTE-CO|BYTE-CN|BYTE-CA|BYTE-NA|BYTE-CS|BYTE-NS|'
- r'IS\s+(NOT\s+)?(INITIAL|ASSIGNED|REQUESTED|BOUND))\b', Operator),
+ r'IS\s+(NOT\s+)?(INITIAL|ASSIGNED|REQUESTED|BOUND))\b', Operator.Word),
include('variable-names'),
- # standard oparators after variable names,
+ # standard operators after variable names,
# because < and > are part of field symbols.
- (r'[?*<>=\-+]', Operator),
+ (r'[?*<>=\-+&]', Operator),
(r"'(''|[^'])*'", String.Single),
(r"`([^`])*`", String.Single),
- (r'[/;:()\[\],.]', Punctuation)
+ (r"([|}])([^{}|]*?)([|{])",
+ bygroups(Punctuation, String.Single, Punctuation)),
+ (r'[/;:()\[\],.]', Punctuation),
+ (r'(!)(\w+)', bygroups(Operator, Name)),
],
}
diff --git a/pygments/lexers/c_cpp.py b/pygments/lexers/c_cpp.py
index 2a2419d4..691f5ab4 100644
--- a/pygments/lexers/c_cpp.py
+++ b/pygments/lexers/c_cpp.py
@@ -5,7 +5,7 @@
Lexers for C/C++ languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/c_like.py b/pygments/lexers/c_like.py
index f4a9c299..f7ba7e8f 100644
--- a/pygments/lexers/c_like.py
+++ b/pygments/lexers/c_like.py
@@ -5,7 +5,7 @@
Lexers for other C-like languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/capnproto.py b/pygments/lexers/capnproto.py
index f9c11330..203523a1 100644
--- a/pygments/lexers/capnproto.py
+++ b/pygments/lexers/capnproto.py
@@ -5,15 +5,14 @@
Lexers for the Cap'n Proto schema language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
-from pygments.lexer import RegexLexer, bygroups, words
-from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
- Number, Punctuation, Literal
+from pygments.lexer import RegexLexer, default
+from pygments.token import Text, Comment, Keyword, Name, Literal
__all__ = ['CapnProtoLexer']
@@ -30,7 +29,6 @@ class CapnProtoLexer(RegexLexer):
flags = re.MULTILINE | re.UNICODE
-
tokens = {
'root': [
(r'#.*?$', Comment.Single),
@@ -38,42 +36,43 @@ class CapnProtoLexer(RegexLexer):
(r'=', Literal, 'expression'),
(r':', Name.Class, 'type'),
(r'\$', Name.Attribute, 'annotation'),
- (r'(struct|enum|interface|union|import|using|const|annotation|extends|in|of|on|as|with|from|fixed)\b',
- Keyword),
- (r'[a-zA-Z0-9_.]+', Name),
- (r'[^#@=:$a-zA-Z0-9_]+', Text),
+ (r'(struct|enum|interface|union|import|using|const|annotation|'
+ r'extends|in|of|on|as|with|from|fixed)\b',
+ Keyword),
+ (r'[\w.]+', Name),
+ (r'[^#@=:$\w]+', Text),
],
'type': [
(r'[^][=;,(){}$]+', Name.Class),
(r'[[(]', Name.Class, 'parentype'),
- (r'', Name.Class, '#pop')
+ default('#pop'),
],
'parentype': [
(r'[^][;()]+', Name.Class),
(r'[[(]', Name.Class, '#push'),
(r'[])]', Name.Class, '#pop'),
- (r'', Name.Class, '#pop')
+ default('#pop'),
],
'expression': [
(r'[^][;,(){}$]+', Literal),
(r'[[(]', Literal, 'parenexp'),
- (r'', Literal, '#pop')
+ default('#pop'),
],
'parenexp': [
(r'[^][;()]+', Literal),
(r'[[(]', Literal, '#push'),
(r'[])]', Literal, '#pop'),
- (r'', Literal, '#pop')
+ default('#pop'),
],
'annotation': [
(r'[^][;,(){}=:]+', Name.Attribute),
(r'[[(]', Name.Attribute, 'annexp'),
- (r'', Name.Attribute, '#pop')
+ default('#pop'),
],
'annexp': [
(r'[^][;()]+', Name.Attribute),
(r'[[(]', Name.Attribute, '#push'),
(r'[])]', Name.Attribute, '#pop'),
- (r'', Name.Attribute, '#pop')
+ default('#pop'),
],
}
diff --git a/pygments/lexers/chapel.py b/pygments/lexers/chapel.py
index e6507394..55bf0e1e 100644
--- a/pygments/lexers/chapel.py
+++ b/pygments/lexers/chapel.py
@@ -5,7 +5,7 @@
Lexer for the Chapel language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -52,7 +52,7 @@ class ChapelLexer(RegexLexer):
'then', 'use', 'when', 'where', 'while', 'with', 'yield',
'zip'), suffix=r'\b'),
Keyword),
- (r'(proc)((?:\s|\\\s)+)', bygroups(Keyword, Text), 'procname'),
+ (r'(proc)((?:\s)+)', bygroups(Keyword, Text), 'procname'),
(r'(class|module|record|union)(\s+)', bygroups(Keyword, Text),
'classname'),
@@ -96,6 +96,7 @@ class ChapelLexer(RegexLexer):
(r'[a-zA-Z_][\w$]*', Name.Class, '#pop'),
],
'procname': [
- (r'[a-zA-Z_][\w$]*', Name.Function, '#pop'),
+ (r'([a-zA-Z_][\w$]+|\~[a-zA-Z_][\w$]+|[+*/!~%<>=&^|\-]{1,2})',
+ Name.Function, '#pop'),
],
}
diff --git a/pygments/lexers/clean.py b/pygments/lexers/clean.py
index b87ff99e..ba2569f6 100644
--- a/pygments/lexers/clean.py
+++ b/pygments/lexers/clean.py
@@ -5,7 +5,7 @@
Lexer for the Clean language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -116,7 +116,7 @@ class CleanLexer(ExtendedRegexLexer):
(r'(?s)/\*.*?\*/', Comment.Multi),
# Modules, imports, etc.
- (r'\b((?:implementation|definition|system)\s+)?(module)(\s+)([\w`\.]+)',
+ (r'\b((?:implementation|definition|system)\s+)?(module)(\s+)([\w`.]+)',
bygroups(Keyword.Namespace, Keyword.Namespace, Text, Name.Class)),
(r'(?<=\n)import(?=\s)', Keyword.Namespace, 'import'),
(r'(?<=\n)from(?=\s)', Keyword.Namespace, 'fromimport'),
@@ -140,7 +140,7 @@ class CleanLexer(ExtendedRegexLexer):
# Literals
(r'\'\\?.(?<!\\)\'', String.Char),
(r'\'\\\d+\'', String.Char),
- (r'\'\\\\\'', String.Char), # (special case for '\\')
+ (r'\'\\\\\'', String.Char), # (special case for '\\')
(r'[+\-~]?\s*\d+\.\d+(E[+\-~]?\d+)?\b', Number.Float),
(r'[+\-~]?\s*0[0-7]\b', Number.Oct),
(r'[+\-~]?\s*0x[0-9a-fA-F]\b', Number.Hex),
@@ -150,11 +150,11 @@ class CleanLexer(ExtendedRegexLexer):
Literal),
# Qualified names
- (r'(\')([\w\.]+)(\'\.)',
+ (r'(\')([\w.]+)(\'\.)',
bygroups(Punctuation, Name.Namespace, Punctuation)),
# Everything else is some name
- (r'([\w`$%\/\?@]+\.?)*[\w`$%\/\?@]+', Name),
+ (r'([\w`$%/?@]+\.?)*[\w`$%/?@]+', Name),
# Punctuation
(r'[{}()\[\],:;.#]', Punctuation),
@@ -171,14 +171,14 @@ class CleanLexer(ExtendedRegexLexer):
],
'fromimport': [
include('common'),
- (r'([\w`\.]+)', check_class_not_import),
+ (r'([\w`.]+)', check_class_not_import),
(r'\n', Whitespace, '#pop'),
(r'\s', Whitespace),
],
'fromimportfunc': [
include('common'),
- (r'(::)\s+([^,\s]+)', bygroups(Punctuation, Keyword.Type)),
- (r'([\w`$()=\-<>~*\^|+&%\/]+)', check_instance_class),
+ (r'(::)(\s+)([^,\s]+)', bygroups(Punctuation, Text, Keyword.Type)),
+ (r'([\w`$()=\-<>~*\^|+&%/]+)', check_instance_class),
(r',', Punctuation),
(r'\n', Whitespace, '#pop'),
(r'\s', Whitespace),
@@ -204,7 +204,7 @@ class CleanLexer(ExtendedRegexLexer):
include('common'),
(words(('from', 'import', 'as', 'qualified'),
prefix='(?<=\s)', suffix='(?=\s)'), Keyword.Namespace),
- (r'[\w`\.]+', Name.Class),
+ (r'[\w`.]+', Name.Class),
(r'\n', Whitespace, '#pop'),
(r',', Punctuation),
(r'[^\S\n]+', Whitespace),
@@ -269,7 +269,7 @@ class CleanLexer(ExtendedRegexLexer):
(r'^(?=\S)', Whitespace, '#pop:3'),
(r'[,&]', Punctuation),
(r'\[', Punctuation, 'functiondefuniquneq'),
- (r'[\w`$()=\-<>~*\^|+&%\/{}\[\]@]', Name.Function, 'functionname'),
+ (r'[\w`$()=\-<>~*\^|+&%/{}\[\]@]', Name.Function, 'functionname'),
(r'\s+', Whitespace),
],
'functiondefuniquneq': [
@@ -281,7 +281,7 @@ class CleanLexer(ExtendedRegexLexer):
],
'functionname': [
include('common'),
- (r'[\w`$()=\-<>~*\^|+&%\/]+', Name.Function),
+ (r'[\w`$()=\-<>~*\^|+&%/]+', Name.Function),
(r'(?=\{\|)', Punctuation, 'genericfunction'),
default('#pop'),
]
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py
index b6673437..ab52a370 100644
--- a/pygments/lexers/compiled.py
+++ b/pygments/lexers/compiled.py
@@ -5,7 +5,7 @@
Just export lexer classes previously contained in this module.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/configs.py b/pygments/lexers/configs.py
index 5b9cbfa2..1717a563 100644
--- a/pygments/lexers/configs.py
+++ b/pygments/lexers/configs.py
@@ -5,7 +5,7 @@
Lexers for configuration file formats.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -462,7 +462,7 @@ class NginxConfLexer(RegexLexer):
"""
name = 'Nginx configuration file'
aliases = ['nginx']
- filenames = []
+ filenames = ['nginx.conf']
mimetypes = ['text/x-nginx-conf']
tokens = {
diff --git a/pygments/lexers/console.py b/pygments/lexers/console.py
index 1d89b770..77bb72e5 100644
--- a/pygments/lexers/console.py
+++ b/pygments/lexers/console.py
@@ -5,7 +5,7 @@
Lexers for misc console output.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/crystal.py b/pygments/lexers/crystal.py
index 78c70b61..bea4833f 100644
--- a/pygments/lexers/crystal.py
+++ b/pygments/lexers/crystal.py
@@ -5,25 +5,22 @@
Lexer for Crystal.
- :copyright: Copyright 2006-2016 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
-from pygments.lexer import Lexer, RegexLexer, ExtendedRegexLexer, include, \
- bygroups, default, LexerContext, do_insertions, words
+from pygments.lexer import ExtendedRegexLexer, include, \
+ bygroups, default, LexerContext, words
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
- Number, Punctuation, Error, Generic
-from pygments.util import shebang_matches
+ Number, Punctuation, Error
__all__ = ['CrystalLexer']
line_re = re.compile('.*?\n')
-
-
CRYSTAL_OPERATORS = [
'!=', '!~', '!', '%', '&&', '&', '**', '*', '+', '-', '/', '<=>', '<<', '<=', '<',
'===', '==', '=~', '=', '>=', '>>', '>', '[]=', '[]?', '[]', '^', '||', '|', '~'
@@ -33,6 +30,8 @@ CRYSTAL_OPERATORS = [
class CrystalLexer(ExtendedRegexLexer):
"""
For `Crystal <http://crystal-lang.org>`_ source code.
+
+ .. versionadded:: 2.2
"""
name = 'Crystal'
@@ -48,9 +47,9 @@ class CrystalLexer(ExtendedRegexLexer):
start = match.start(1)
yield start, Operator, match.group(1) # <<-?
- yield match.start(2), String.Heredoc, match.group(2) # quote ", ', `
- yield match.start(3), String.Delimiter, match.group(3) # heredoc name
- yield match.start(4), String.Heredoc, match.group(4) # quote again
+ yield match.start(2), String.Heredoc, match.group(2) # quote ", ', `
+ yield match.start(3), String.Delimiter, match.group(3) # heredoc name
+ yield match.start(4), String.Heredoc, match.group(4) # quote again
heredocstack = ctx.__dict__.setdefault('heredocstack', [])
outermost = not bool(heredocstack)
@@ -211,17 +210,21 @@ class CrystalLexer(ExtendedRegexLexer):
# macros
(words('''
debugger record pp assert_responds_to spawn parallel
- getter setter property delegate def_hash def_equals def_equals_and_hash forward_missing_to
+ getter setter property delegate def_hash def_equals def_equals_and_hash
+ forward_missing_to
'''.split(), suffix=r'\b'), Name.Builtin.Pseudo),
(r'getter[!?]|property[!?]|__(DIR|FILE|LINE)__\b', Name.Builtin.Pseudo),
# builtins
# http://crystal-lang.org/api/toplevel.html
(words('''
Object Value Struct Reference Proc Class Nil Symbol Enum Void
- Bool Number Int Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float Float32 Float64 Char String
+ Bool Number Int Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64
+ Float Float32 Float64 Char String
Pointer Slice Range Exception Regex
- Mutex StaticArray Array Hash Set Tuple Deque Box Process File Dir Time Channel Concurrent Scheduler
- abort at_exit caller delay exit fork future get_stack_top gets lazy loop main p print printf puts
+ Mutex StaticArray Array Hash Set Tuple Deque Box Process File
+ Dir Time Channel Concurrent Scheduler
+ abort at_exit caller delay exit fork future get_stack_top gets
+ lazy loop main p print printf puts
raise rand read_line sleep sprintf system with_color
'''.split(), prefix=r'(?<!\.)', suffix=r'\b'), Name.Builtin),
# normal heredocs
@@ -274,12 +277,16 @@ class CrystalLexer(ExtendedRegexLexer):
bygroups(Number.Hex, Text, Operator)),
(r'(0b[01]+(?:_[01]+)*(?:_?[iu][0-9]+)?)\b(\s*)([/?])?',
bygroups(Number.Bin, Text, Operator)),
- # 3 separate expressions for floats because any of the 3 optional parts makes it a float
- (r'((?:0(?![0-9])|[1-9][\d_]*)(?:\.\d[\d_]*)(?:e[+-]?[0-9]+)?(?:_?[f][0-9]+)?)(\s*)([/?])?',
+ # 3 separate expressions for floats because any of the 3 optional
+ # parts makes it a float
+ (r'((?:0(?![0-9])|[1-9][\d_]*)(?:\.\d[\d_]*)(?:e[+-]?[0-9]+)?'
+ r'(?:_?f[0-9]+)?)(\s*)([/?])?',
bygroups(Number.Float, Text, Operator)),
- (r'((?:0(?![0-9])|[1-9][\d_]*)(?:\.\d[\d_]*)?(?:e[+-]?[0-9]+)(?:_?[f][0-9]+)?)(\s*)([/?])?',
+ (r'((?:0(?![0-9])|[1-9][\d_]*)(?:\.\d[\d_]*)?(?:e[+-]?[0-9]+)'
+ r'(?:_?f[0-9]+)?)(\s*)([/?])?',
bygroups(Number.Float, Text, Operator)),
- (r'((?:0(?![0-9])|[1-9][\d_]*)(?:\.\d[\d_]*)?(?:e[+-]?[0-9]+)?(?:_?[f][0-9]+))(\s*)([/?])?',
+ (r'((?:0(?![0-9])|[1-9][\d_]*)(?:\.\d[\d_]*)?(?:e[+-]?[0-9]+)?'
+ r'(?:_?f[0-9]+))(\s*)([/?])?',
bygroups(Number.Float, Text, Operator)),
(r'(0\b|[1-9][\d]*(?:_\d+)*(?:_?[iu][0-9]+)?)\b(\s*)([/?])?',
bygroups(Number.Integer, Text, Operator)),
@@ -301,7 +308,8 @@ class CrystalLexer(ExtendedRegexLexer):
(r'\{%', String.Interpol, 'in-macro-control'),
(r'\{\{', String.Interpol, 'in-macro-expr'),
# attributes
- (r'(@\[)(\s*)([A-Z]\w*)', bygroups(Operator, Text, Name.Decorator), 'in-attr'),
+ (r'(@\[)(\s*)([A-Z]\w*)',
+ bygroups(Operator, Text, Name.Decorator), 'in-attr'),
# this is needed because Crystal attributes can look
# like keywords (class) or like this: ` ?!?
(words(CRYSTAL_OPERATORS, prefix=r'(\.|::)'),
@@ -325,7 +333,8 @@ class CrystalLexer(ExtendedRegexLexer):
],
'classname': [
(r'[A-Z_]\w*', Name.Class),
- (r'(\()(\s*)([A-Z_]\w*)(\s*)(\))', bygroups(Punctuation, Text, Name.Class, Text, Punctuation)),
+ (r'(\()(\s*)([A-Z_]\w*)(\s*)(\))',
+ bygroups(Punctuation, Text, Name.Class, Text, Punctuation)),
default('#pop')
],
'in-intp': [
diff --git a/pygments/lexers/csound.py b/pygments/lexers/csound.py
index 95ee73d8..858aa348 100644
--- a/pygments/lexers/csound.py
+++ b/pygments/lexers/csound.py
@@ -5,7 +5,7 @@
Lexers for CSound languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/css.py b/pygments/lexers/css.py
index e9e642f8..29d83707 100644
--- a/pygments/lexers/css.py
+++ b/pygments/lexers/css.py
@@ -5,7 +5,7 @@
Lexers for CSS and related stylesheet formats.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/d.py b/pygments/lexers/d.py
index 98e01dcf..09e6fe87 100644
--- a/pygments/lexers/d.py
+++ b/pygments/lexers/d.py
@@ -5,7 +5,7 @@
Lexers for D languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/dalvik.py b/pygments/lexers/dalvik.py
index 2f26fa04..c211f13e 100644
--- a/pygments/lexers/dalvik.py
+++ b/pygments/lexers/dalvik.py
@@ -5,7 +5,7 @@
Pygments lexers for Dalvik VM-related languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/data.py b/pygments/lexers/data.py
index 4c39db64..296366c2 100644
--- a/pygments/lexers/data.py
+++ b/pygments/lexers/data.py
@@ -5,7 +5,7 @@
Lexers for data file format.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/diff.py b/pygments/lexers/diff.py
index 726b49ad..f7019440 100644
--- a/pygments/lexers/diff.py
+++ b/pygments/lexers/diff.py
@@ -5,7 +5,7 @@
Lexers for diff/patch formats.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/dotnet.py b/pygments/lexers/dotnet.py
index 11b4573e..4e2bc8ab 100644
--- a/pygments/lexers/dotnet.py
+++ b/pygments/lexers/dotnet.py
@@ -5,7 +5,7 @@
Lexers for .net languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
diff --git a/pygments/lexers/dsls.py b/pygments/lexers/dsls.py
index 312d5f5e..a1426bd6 100644
--- a/pygments/lexers/dsls.py
+++ b/pygments/lexers/dsls.py
@@ -5,7 +5,7 @@
Lexers for various domain-specific languages.
- :copyright: Copyright 2006-2016 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -36,7 +36,7 @@ class ProtoBufLexer(RegexLexer):
tokens = {
'root': [
(r'[ \t]+', Text),
- (r'[,;{}\[\]()]', Punctuation),
+ (r'[,;{}\[\]()<>]', Punctuation),
(r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
(r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline),
(words((
@@ -581,7 +581,7 @@ class PanLexer(RegexLexer):
'if', 'for', 'with', 'else', 'type', 'bind', 'while', 'valid', 'final',
'prefix', 'unique', 'object', 'foreach', 'include', 'template',
'function', 'variable', 'structure', 'extensible', 'declaration'),
- prefix=r'\b', suffix=r'\s*\b'),
+ prefix=r'\b', suffix=r'\s*\b'),
Keyword),
(words((
'file_contents', 'format', 'index', 'length', 'match', 'matches',
@@ -593,7 +593,7 @@ class PanLexer(RegexLexer):
'is_number', 'is_property', 'is_resource', 'is_string', 'to_boolean',
'to_double', 'to_long', 'to_string', 'clone', 'delete', 'exists',
'path_exists', 'if_exists', 'return', 'value'),
- prefix=r'\b', suffix=r'\s*\b'),
+ prefix=r'\b', suffix=r'\s*\b'),
Name.Builtin),
(r'#.*', Comment),
(r'\\[\w\W]', String.Escape),
diff --git a/pygments/lexers/dylan.py b/pygments/lexers/dylan.py
index 600a78e5..f61bb60d 100644
--- a/pygments/lexers/dylan.py
+++ b/pygments/lexers/dylan.py
@@ -5,7 +5,7 @@
Lexers for the Dylan language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/ecl.py b/pygments/lexers/ecl.py
index 95572ba7..bd80ad19 100644
--- a/pygments/lexers/ecl.py
+++ b/pygments/lexers/ecl.py
@@ -5,7 +5,7 @@
Lexers for the ECL language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/eiffel.py b/pygments/lexers/eiffel.py
index 8a244613..a90ab0a5 100644
--- a/pygments/lexers/eiffel.py
+++ b/pygments/lexers/eiffel.py
@@ -5,7 +5,7 @@
Lexer for the Eiffel language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/elm.py b/pygments/lexers/elm.py
index cd1fb98e..0fa36367 100644
--- a/pygments/lexers/elm.py
+++ b/pygments/lexers/elm.py
@@ -5,7 +5,7 @@
Lexer for the Elm programming language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/erlang.py b/pygments/lexers/erlang.py
index 93ddd2c2..9e7f85c1 100644
--- a/pygments/lexers/erlang.py
+++ b/pygments/lexers/erlang.py
@@ -5,7 +5,7 @@
Lexers for Erlang.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/esoteric.py b/pygments/lexers/esoteric.py
index 150d930f..793c28be 100644
--- a/pygments/lexers/esoteric.py
+++ b/pygments/lexers/esoteric.py
@@ -5,7 +5,7 @@
Lexers for esoteric languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -14,7 +14,7 @@ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
Number, Punctuation, Error
__all__ = ['BrainfuckLexer', 'BefungeLexer', 'RedcodeLexer', 'CAmkESLexer',
- 'CapDLLexer', 'AheuiLexer']
+ 'CapDLLexer', 'AheuiLexer']
class BrainfuckLexer(RegexLexer):
@@ -155,14 +155,15 @@ class CapDLLexer(RegexLexer):
shadow type names, but these instances are currently incorrectly
highlighted as types. Supporting this would need a stateful lexer that is
considered unnecessarily complex for now.
+
+ .. versionadded:: 2.2
"""
name = 'CapDL'
aliases = ['capdl']
filenames = ['*.cdl']
tokens = {
- 'root':[
-
+ 'root': [
# C pre-processor directive
(r'^\s*#.*\n', Comment.Preproc),
@@ -171,7 +172,7 @@ class CapDLLexer(RegexLexer):
(r'/\*(.|\n)*?\*/', Comment),
(r'(//|--).*\n', Comment),
- (r'[<>\[\(\)\{\},:;=\]]', Punctuation),
+ (r'[<>\[(){},:;=\]]', Punctuation),
(r'\.\.', Punctuation),
(words(('arch', 'arm11', 'caps', 'child_of', 'ia32', 'irq', 'maps',
@@ -187,7 +188,7 @@ class CapDLLexer(RegexLexer):
'prio', 'sp', 'R', 'RG', 'RX', 'RW', 'RWG', 'RWX', 'W',
'WG', 'WX', 'level', 'masked', 'master_reply', 'paddr',
'ports', 'reply', 'uncached'), suffix=r'\b'),
- Keyword.Reserved),
+ Keyword.Reserved),
# Literals
(r'0[xX][\da-fA-F]+', Number.Hex),
@@ -197,10 +198,11 @@ class CapDLLexer(RegexLexer):
'ipc_buffer_slot'), suffix=r'\b'), Number),
# Identifiers
- (r'[a-zA-Z_][-_@\.\w]*', Name),
+ (r'[a-zA-Z_][-@\.\w]*', Name),
],
}
+
class RedcodeLexer(RegexLexer):
"""
A simple Redcode lexer based on ICWS'94.
diff --git a/pygments/lexers/ezhil.py b/pygments/lexers/ezhil.py
index eea300ad..ce1cdb2d 100644
--- a/pygments/lexers/ezhil.py
+++ b/pygments/lexers/ezhil.py
@@ -4,8 +4,8 @@
~~~~~~~~~~~~~~~~~~~~~
Pygments lexers for Ezhil language.
-
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -16,6 +16,7 @@ from pygments.token import String, Number, Punctuation, Operator
__all__ = ['EzhilLexer']
+
class EzhilLexer(RegexLexer):
"""
Lexer for `Ezhil, a Tamil script-based programming language <http://ezhillang.org>`_
@@ -62,7 +63,7 @@ class EzhilLexer(RegexLexer):
(r'(?u)\d+', Number.Integer),
]
}
-
+
def __init__(self, **options):
super(EzhilLexer, self).__init__(**options)
self.encoding = options.get('encoding', 'utf-8')
diff --git a/pygments/lexers/factor.py b/pygments/lexers/factor.py
index 6a39a1d4..09d85c27 100644
--- a/pygments/lexers/factor.py
+++ b/pygments/lexers/factor.py
@@ -5,7 +5,7 @@
Lexers for the Factor language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/fantom.py b/pygments/lexers/fantom.py
index c20a3f38..3ea2177c 100644
--- a/pygments/lexers/fantom.py
+++ b/pygments/lexers/fantom.py
@@ -5,7 +5,7 @@
Lexer for the Fantom language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/felix.py b/pygments/lexers/felix.py
index 9631bcc1..8f0695b5 100644
--- a/pygments/lexers/felix.py
+++ b/pygments/lexers/felix.py
@@ -5,7 +5,7 @@
Lexer for the Felix language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/forth.py b/pygments/lexers/forth.py
index eb806ba0..a51f1b57 100644
--- a/pygments/lexers/forth.py
+++ b/pygments/lexers/forth.py
@@ -3,7 +3,7 @@
pygments.lexers.forth
~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/fortran.py b/pygments/lexers/fortran.py
index 6cc8f2c8..1a611c9d 100644
--- a/pygments/lexers/fortran.py
+++ b/pygments/lexers/fortran.py
@@ -5,7 +5,7 @@
Lexers for Fortran languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/foxpro.py b/pygments/lexers/foxpro.py
index c7f368c7..7c0d2621 100644
--- a/pygments/lexers/foxpro.py
+++ b/pygments/lexers/foxpro.py
@@ -5,7 +5,7 @@
Simple lexer for Microsoft Visual FoxPro source code.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/functional.py b/pygments/lexers/functional.py
index 13c72b1e..254df795 100644
--- a/pygments/lexers/functional.py
+++ b/pygments/lexers/functional.py
@@ -5,7 +5,7 @@
Just export lexer classes previously contained in this module.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/go.py b/pygments/lexers/go.py
index 8bd6c7fb..cc2a6d63 100644
--- a/pygments/lexers/go.py
+++ b/pygments/lexers/go.py
@@ -5,7 +5,7 @@
Lexers for the Google Go language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/grammar_notation.py b/pygments/lexers/grammar_notation.py
index d59cc61c..076249d3 100644
--- a/pygments/lexers/grammar_notation.py
+++ b/pygments/lexers/grammar_notation.py
@@ -5,7 +5,7 @@
Lexers for grammer notations like BNF.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -13,7 +13,7 @@ import re
from pygments.lexer import RegexLexer, bygroups, include, this, using, words
from pygments.token import Comment, Keyword, Literal, Name, Number, \
- Operator, Punctuation, String, Text
+ Operator, Punctuation, String, Text
__all__ = ['BnfLexer', 'AbnfLexer', 'JsgfLexer']
diff --git a/pygments/lexers/graph.py b/pygments/lexers/graph.py
index 8315898c..1a338246 100644
--- a/pygments/lexers/graph.py
+++ b/pygments/lexers/graph.py
@@ -5,7 +5,7 @@
Lexers for graph query languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/graphics.py b/pygments/lexers/graphics.py
index b40e0286..c8af9f99 100644
--- a/pygments/lexers/graphics.py
+++ b/pygments/lexers/graphics.py
@@ -5,7 +5,7 @@
Lexers for computer graphics and plotting related languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/haskell.py b/pygments/lexers/haskell.py
index ffc3a3a2..1a2f2217 100644
--- a/pygments/lexers/haskell.py
+++ b/pygments/lexers/haskell.py
@@ -5,7 +5,7 @@
Lexers for Haskell and related languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -39,7 +39,7 @@ class HaskellLexer(RegexLexer):
flags = re.MULTILINE | re.UNICODE
reserved = ('case', 'class', 'data', 'default', 'deriving', 'do', 'else',
- 'if', 'in', 'infix[lr]?', 'instance',
+ 'family', 'if', 'in', 'infix[lr]?', 'instance',
'let', 'newtype', 'of', 'then', 'type', 'where', '_')
ascii = ('NUL', 'SOH', '[SE]TX', 'EOT', 'ENQ', 'ACK',
'BEL', 'BS', 'HT', 'LF', 'VT', 'FF', 'CR', 'S[OI]', 'DLE',
@@ -63,6 +63,9 @@ class HaskellLexer(RegexLexer):
(r'^[_' + uni.Ll + r'][\w\']*', Name.Function),
(r"'?[_" + uni.Ll + r"][\w']*", Name),
(r"('')?[" + uni.Lu + r"][\w\']*", Keyword.Type),
+ (r"(')[" + uni.Lu + r"][\w\']*", Keyword.Type),
+ (r"(')\[[^\]]*\]", Keyword.Type), # tuples and lists get special treatment in GHC
+ (r"(')\([^)]*\)", Keyword.Type), # ..
# Operators
(r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function), # lambda operator
(r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials
diff --git a/pygments/lexers/haxe.py b/pygments/lexers/haxe.py
index e0e15c11..6f5c3599 100644
--- a/pygments/lexers/haxe.py
+++ b/pygments/lexers/haxe.py
@@ -5,7 +5,7 @@
Lexers for Haxe and related stuff.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/hdl.py b/pygments/lexers/hdl.py
index 04cef14e..57fb7ac9 100644
--- a/pygments/lexers/hdl.py
+++ b/pygments/lexers/hdl.py
@@ -5,7 +5,7 @@
Lexers for hardware descriptor languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/hexdump.py b/pygments/lexers/hexdump.py
index efe16fa7..cba49be7 100644
--- a/pygments/lexers/hexdump.py
+++ b/pygments/lexers/hexdump.py
@@ -5,12 +5,10 @@
Lexers for hexadecimal dumps.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
-import re
-
from pygments.lexer import RegexLexer, bygroups, include
from pygments.token import Text, Name, Number, String, Punctuation
@@ -36,7 +34,7 @@ class HexdumpLexer(RegexLexer):
* ``od -t x1z FILE``
* ``xxd FILE``
* ``DEBUG.EXE FILE.COM`` and entering ``d`` to the prompt.
-
+
.. versionadded:: 2.1
"""
name = 'Hexdump'
@@ -48,12 +46,17 @@ class HexdumpLexer(RegexLexer):
'root': [
(r'\n', Text),
include('offset'),
- (r'('+hd+r'{2})(\-)('+hd+r'{2})', bygroups(Number.Hex, Punctuation, Number.Hex)),
+ (r'('+hd+r'{2})(\-)('+hd+r'{2})',
+ bygroups(Number.Hex, Punctuation, Number.Hex)),
(hd+r'{2}', Number.Hex),
- (r'(\s{2,3})(\>)(.{16})(\<)$', bygroups(Text, Punctuation, String, Punctuation), 'bracket-strings'),
- (r'(\s{2,3})(\|)(.{16})(\|)$', bygroups(Text, Punctuation, String, Punctuation), 'piped-strings'),
- (r'(\s{2,3})(\>)(.{1,15})(\<)$', bygroups(Text, Punctuation, String, Punctuation)),
- (r'(\s{2,3})(\|)(.{1,15})(\|)$', bygroups(Text, Punctuation, String, Punctuation)),
+ (r'(\s{2,3})(\>)(.{16})(\<)$',
+ bygroups(Text, Punctuation, String, Punctuation), 'bracket-strings'),
+ (r'(\s{2,3})(\|)(.{16})(\|)$',
+ bygroups(Text, Punctuation, String, Punctuation), 'piped-strings'),
+ (r'(\s{2,3})(\>)(.{1,15})(\<)$',
+ bygroups(Text, Punctuation, String, Punctuation)),
+ (r'(\s{2,3})(\|)(.{1,15})(\|)$',
+ bygroups(Text, Punctuation, String, Punctuation)),
(r'(\s{2,3})(.{1,15})$', bygroups(Text, String)),
(r'(\s{2,3})(.{16}|.{20})$', bygroups(Text, String), 'nonpiped-strings'),
(r'\s', Text),
@@ -72,7 +75,8 @@ class HexdumpLexer(RegexLexer):
(r'\n', Text),
include('offset'),
(hd+r'{2}', Number.Hex),
- (r'(\s{2,3})(\|)(.{1,16})(\|)$', bygroups(Text, Punctuation, String, Punctuation)),
+ (r'(\s{2,3})(\|)(.{1,16})(\|)$',
+ bygroups(Text, Punctuation, String, Punctuation)),
(r'\s', Text),
(r'^\*', Punctuation),
],
@@ -80,14 +84,16 @@ class HexdumpLexer(RegexLexer):
(r'\n', Text),
include('offset'),
(hd+r'{2}', Number.Hex),
- (r'(\s{2,3})(\>)(.{1,16})(\<)$', bygroups(Text, Punctuation, String, Punctuation)),
+ (r'(\s{2,3})(\>)(.{1,16})(\<)$',
+ bygroups(Text, Punctuation, String, Punctuation)),
(r'\s', Text),
(r'^\*', Punctuation),
],
'nonpiped-strings': [
(r'\n', Text),
include('offset'),
- (r'('+hd+r'{2})(\-)('+hd+r'{2})', bygroups(Number.Hex, Punctuation, Number.Hex)),
+ (r'('+hd+r'{2})(\-)('+hd+r'{2})',
+ bygroups(Number.Hex, Punctuation, Number.Hex)),
(hd+r'{2}', Number.Hex),
(r'(\s{19,})(.{1,20}?)$', bygroups(Text, String)),
(r'(\s{2,3})(.{1,20})$', bygroups(Text, String)),
diff --git a/pygments/lexers/html.py b/pygments/lexers/html.py
index 24733748..73f020fa 100644
--- a/pygments/lexers/html.py
+++ b/pygments/lexers/html.py
@@ -5,7 +5,7 @@
Lexers for HTML, XML and related markup.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/idl.py b/pygments/lexers/idl.py
index a0b39492..99078970 100644
--- a/pygments/lexers/idl.py
+++ b/pygments/lexers/idl.py
@@ -5,7 +5,7 @@
Lexers for IDL.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/igor.py b/pygments/lexers/igor.py
index 17fedf88..1a21fe87 100644
--- a/pygments/lexers/igor.py
+++ b/pygments/lexers/igor.py
@@ -5,7 +5,7 @@
Lexers for Igor Pro.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/inferno.py b/pygments/lexers/inferno.py
index bfbea571..5fc5a0ba 100644
--- a/pygments/lexers/inferno.py
+++ b/pygments/lexers/inferno.py
@@ -5,7 +5,7 @@
Lexers for Inferno os and all the related stuff.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/installers.py b/pygments/lexers/installers.py
index c436afed..0323d140 100644
--- a/pygments/lexers/installers.py
+++ b/pygments/lexers/installers.py
@@ -5,7 +5,7 @@
Lexers for installer/packager DSLs and formats.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/int_fiction.py b/pygments/lexers/int_fiction.py
index 724f9b27..f280a56d 100644
--- a/pygments/lexers/int_fiction.py
+++ b/pygments/lexers/int_fiction.py
@@ -5,7 +5,7 @@
Lexers for interactive fiction languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/iolang.py b/pygments/lexers/iolang.py
index e62dd434..bbc17faf 100644
--- a/pygments/lexers/iolang.py
+++ b/pygments/lexers/iolang.py
@@ -5,7 +5,7 @@
Lexers for the Io language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/j.py b/pygments/lexers/j.py
index 1231d597..434964fe 100644
--- a/pygments/lexers/j.py
+++ b/pygments/lexers/j.py
@@ -5,7 +5,7 @@
Lexer for the J programming language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/javascript.py b/pygments/lexers/javascript.py
index a23ba184..862535c9 100644
--- a/pygments/lexers/javascript.py
+++ b/pygments/lexers/javascript.py
@@ -5,7 +5,7 @@
Lexers for JavaScript and related languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -53,7 +53,7 @@ class JavascriptLexer(RegexLexer):
'slashstartsregex': [
include('commentsandwhitespace'),
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
- r'([gim]+\b|\B)', String.Regex, '#pop'),
+ r'([gimuy]+\b|\B)', String.Regex, '#pop'),
(r'(?=/)', Text, ('#pop', 'badregex')),
default('#pop')
],
@@ -64,9 +64,14 @@ class JavascriptLexer(RegexLexer):
(r'\A#! ?/.*?\n', Comment.Hashbang), # recognized by node.js
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
include('commentsandwhitespace'),
+ (r'(\.\d+|[0-9]+\.[0-9]*)([eE][-+]?[0-9]+)?', Number.Float),
+ (r'0[bB][01]+', Number.Bin),
+ (r'0[oO][0-7]+', Number.Oct),
+ (r'0[xX][0-9a-fA-F]+', Number.Hex),
+ (r'[0-9]+', Number.Integer),
+ (r'\.\.\.|=>', Punctuation),
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
- r'(<<|>>>?|=>|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
- (r'\.\.\.', Punctuation),
+ r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
(r'[})\].]', Punctuation),
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
@@ -84,11 +89,6 @@ class JavascriptLexer(RegexLexer):
r'Error|eval|isFinite|isNaN|isSafeInteger|parseFloat|parseInt|'
r'document|this|window)\b', Name.Builtin),
(JS_IDENT, Name.Other),
- (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
- (r'0b[01]+', Number.Bin),
- (r'0o[0-7]+', Number.Oct),
- (r'0x[0-9a-fA-F]+', Number.Hex),
- (r'[0-9]+', Number.Integer),
(r'"(\\\\|\\"|[^"])*"', String.Double),
(r"'(\\\\|\\'|[^'])*'", String.Single),
(r'`', String.Backtick, 'interp'),
@@ -366,9 +366,10 @@ class DartLexer(RegexLexer):
(r'\b(assert|break|case|catch|continue|default|do|else|finally|for|'
r'if|in|is|new|return|super|switch|this|throw|try|while)\b',
Keyword),
- (r'\b(abstract|const|extends|factory|final|get|implements|'
- r'native|operator|set|static|typedef|var)\b', Keyword.Declaration),
- (r'\b(bool|double|Dynamic|int|num|Object|String|void)\b', Keyword.Type),
+ (r'\b(abstract|async|await|const|extends|factory|final|get|'
+ r'implements|native|operator|set|static|sync|typedef|var|with|'
+ r'yield)\b', Keyword.Declaration),
+ (r'\b(bool|double|dynamic|int|num|Object|String|void)\b', Keyword.Type),
(r'\b(false|null|true)\b', Keyword.Constant),
(r'[~!%^&*+=|?:<>/-]|as\b', Operator),
(r'[a-zA-Z_$]\w*:', Name.Label),
@@ -447,7 +448,7 @@ class TypeScriptLexer(RegexLexer):
name = 'TypeScript'
aliases = ['ts', 'typescript']
- filenames = ['*.ts']
+ filenames = ['*.ts', '*.tsx']
mimetypes = ['text/x-typescript']
flags = re.DOTALL | re.MULTILINE
@@ -511,11 +512,34 @@ class TypeScriptLexer(RegexLexer):
(r'[0-9]+', Number.Integer),
(r'"(\\\\|\\"|[^"])*"', String.Double),
(r"'(\\\\|\\'|[^'])*'", String.Single),
+ (r'`', String.Backtick, 'interp'),
# Match stuff like: Decorators
(r'@\w+', Keyword.Declaration),
- ]
+ ],
+
+ # The 'interp*' rules match those in JavascriptLexer. Changes made
+ # there should be reflected here as well.
+ 'interp': [
+ (r'`', String.Backtick, '#pop'),
+ (r'\\\\', String.Backtick),
+ (r'\\`', String.Backtick),
+ (r'\$\{', String.Interpol, 'interp-inside'),
+ (r'\$', String.Backtick),
+ (r'[^`\\$]+', String.Backtick),
+ ],
+ 'interp-inside': [
+ # TODO: should this include single-line comments and allow nesting strings?
+ (r'\}', String.Interpol, '#pop'),
+ include('root'),
+ ],
}
+ def analyse_text(text):
+ if re.search('^(import.+(from\s+)?["\']|'
+ '(export\s*)?(interface|class|function)\s+)',
+ text, re.MULTILINE):
+ return 1.0
+
class LassoLexer(RegexLexer):
"""
@@ -545,12 +569,7 @@ class LassoLexer(RegexLexer):
tokens = {
'root': [
(r'^#![ \S]+lasso9\b', Comment.Preproc, 'lasso'),
- (r'\[no_square_brackets\]', Comment.Preproc, 'nosquarebrackets'),
- (r'\[noprocess\]', Comment.Preproc, ('delimiters', 'noprocess')),
- (r'\[', Comment.Preproc, ('delimiters', 'squarebrackets')),
- (r'<\?(LassoScript|lasso|=)', Comment.Preproc,
- ('delimiters', 'anglebrackets')),
- (r'<(!--.*?-->)?', Other, 'delimiters'),
+ (r'(?=\[|<)', Other, 'delimiters'),
(r'\s+', Other),
default(('delimiters', 'lassofile')),
],
@@ -558,14 +577,14 @@ class LassoLexer(RegexLexer):
(r'\[no_square_brackets\]', Comment.Preproc, 'nosquarebrackets'),
(r'\[noprocess\]', Comment.Preproc, 'noprocess'),
(r'\[', Comment.Preproc, 'squarebrackets'),
- (r'<\?(LassoScript|lasso|=)', Comment.Preproc, 'anglebrackets'),
+ (r'<\?(lasso(script)?|=)', Comment.Preproc, 'anglebrackets'),
(r'<(!--.*?-->)?', Other),
(r'[^[<]+', Other),
],
'nosquarebrackets': [
(r'\[noprocess\]', Comment.Preproc, 'noprocess'),
(r'\[', Other),
- (r'<\?(LassoScript|lasso|=)', Comment.Preproc, 'anglebrackets'),
+ (r'<\?(lasso(script)?|=)', Comment.Preproc, 'anglebrackets'),
(r'<(!--.*?-->)?', Other),
(r'[^[<]+', Other),
],
@@ -607,7 +626,7 @@ class LassoLexer(RegexLexer):
# names
(r'\$[a-z_][\w.]*', Name.Variable),
- (r'#([a-z_][\w.]*|\d+)', Name.Variable.Instance),
+ (r'#([a-z_][\w.]*|\d+\b)', Name.Variable.Instance),
(r"(\.\s*)('[a-z_][\w.]*')",
bygroups(Name.Builtin.Pseudo, Name.Variable.Class)),
(r"(self)(\s*->\s*)('[a-z_][\w.]*')",
@@ -658,20 +677,20 @@ class LassoLexer(RegexLexer):
r'Database_TableNames|Define_Tag|Define_Type|Email_Batch|'
r'Encode_Set|HTML_Comment|Handle|Handle_Error|Header|If|Inline|'
r'Iterate|LJAX_Target|Link|Link_CurrentAction|Link_CurrentGroup|'
- r'Link_CurrentRecord|Link_Detail|Link_FirstGroup|'
- r'Link_FirstRecord|Link_LastGroup|Link_LastRecord|Link_NextGroup|'
- r'Link_NextRecord|Link_PrevGroup|Link_PrevRecord|Log|Loop|'
- r'NoProcess|Output_None|Portal|Private|Protect|Records|Referer|'
- r'Referrer|Repeating|ResultSet|Rows|Search_Args|Search_Arguments|'
- r'Select|Sort_Args|Sort_Arguments|Thread_Atomic|Value_List|While|'
- r'Abort|Case|Else|If_Empty|If_False|If_Null|If_True|Loop_Abort|'
- r'Loop_Continue|Loop_Count|Params|Params_Up|Return|Return_Value|'
- r'Run_Children|SOAP_DefineTag|SOAP_LastRequest|SOAP_LastResponse|'
- r'Tag_Name|ascending|average|by|define|descending|do|equals|'
- r'frozen|group|handle_failure|import|in|into|join|let|match|max|'
- r'min|on|order|parent|protected|provide|public|require|returnhome|'
- r'skip|split_thread|sum|take|thread|to|trait|type|where|with|'
- r'yield|yieldhome)\b',
+ r'Link_CurrentRecord|Link_Detail|Link_FirstGroup|Link_FirstRecord|'
+ r'Link_LastGroup|Link_LastRecord|Link_NextGroup|Link_NextRecord|'
+ r'Link_PrevGroup|Link_PrevRecord|Log|Loop|Output_None|Portal|'
+ r'Private|Protect|Records|Referer|Referrer|Repeating|ResultSet|'
+ r'Rows|Search_Args|Search_Arguments|Select|Sort_Args|'
+ r'Sort_Arguments|Thread_Atomic|Value_List|While|Abort|Case|Else|'
+ r'Fail_If|Fail_IfNot|Fail|If_Empty|If_False|If_Null|If_True|'
+ r'Loop_Abort|Loop_Continue|Loop_Count|Params|Params_Up|Return|'
+ r'Return_Value|Run_Children|SOAP_DefineTag|SOAP_LastRequest|'
+ r'SOAP_LastResponse|Tag_Name|ascending|average|by|define|'
+ r'descending|do|equals|frozen|group|handle_failure|import|in|into|'
+ r'join|let|match|max|min|on|order|parent|protected|provide|public|'
+ r'require|returnhome|skip|split_thread|sum|take|thread|to|trait|'
+ r'type|where|with|yield|yieldhome)\b',
bygroups(Punctuation, Keyword)),
# other
diff --git a/pygments/lexers/julia.py b/pygments/lexers/julia.py
index 95c503a0..67453aba 100644
--- a/pygments/lexers/julia.py
+++ b/pygments/lexers/julia.py
@@ -5,7 +5,7 @@
Lexers for the Julia language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -231,7 +231,7 @@ class JuliaLexer(RegexLexer):
'string': [
(r'"', String, '#pop'),
# FIXME: This escape pattern is not perfect.
- (r'\\([\\"\'\$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)', String.Escape),
+ (r'\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)', String.Escape),
# Interpolation is defined as "$" followed by the shortest full
# expression, which is something we can't parse.
# Include the most common cases here: $word, and $(paren'd expr).
@@ -246,7 +246,7 @@ class JuliaLexer(RegexLexer):
'tqstring': [
(r'"""', String, '#pop'),
- (r'\\([\\"\'\$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)', String.Escape),
+ (r'\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)', String.Escape),
(r'\$' + allowed_variable, String.Interpol),
(r'(\$)(\()', bygroups(String.Interpol, Punctuation), 'in-intp'),
(r'.|\s', String),
diff --git a/pygments/lexers/jvm.py b/pygments/lexers/jvm.py
index 5d747561..f4392839 100644
--- a/pygments/lexers/jvm.py
+++ b/pygments/lexers/jvm.py
@@ -5,7 +5,7 @@
Pygments lexers for JVM languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/lisp.py b/pygments/lexers/lisp.py
index 67d74566..e258c347 100644
--- a/pygments/lexers/lisp.py
+++ b/pygments/lexers/lisp.py
@@ -5,7 +5,7 @@
Lexers for Lispy languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/make.py b/pygments/lexers/make.py
index 9b6273d7..b222b672 100644
--- a/pygments/lexers/make.py
+++ b/pygments/lexers/make.py
@@ -5,7 +5,7 @@
Lexers for Makefiles and similar.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/markup.py b/pygments/lexers/markup.py
index bb4ae6c5..92dc9e7a 100644
--- a/pygments/lexers/markup.py
+++ b/pygments/lexers/markup.py
@@ -5,7 +5,7 @@
Lexers for non-HTML markup languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/math.py b/pygments/lexers/math.py
index 7a92f5bb..ea0ebee2 100644
--- a/pygments/lexers/math.py
+++ b/pygments/lexers/math.py
@@ -5,7 +5,7 @@
Just export lexers that were contained in this module.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/matlab.py b/pygments/lexers/matlab.py
index ccb11a5d..56a0f6d6 100644
--- a/pygments/lexers/matlab.py
+++ b/pygments/lexers/matlab.py
@@ -5,7 +5,7 @@
Lexers for Matlab and related languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/ml.py b/pygments/lexers/ml.py
index 4f10edd0..f80d5bfa 100644
--- a/pygments/lexers/ml.py
+++ b/pygments/lexers/ml.py
@@ -5,7 +5,7 @@
Lexers for ML family languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/modeling.py b/pygments/lexers/modeling.py
index a6b0cb77..b354f1cf 100644
--- a/pygments/lexers/modeling.py
+++ b/pygments/lexers/modeling.py
@@ -5,7 +5,7 @@
Lexers for modeling languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/modula2.py b/pygments/lexers/modula2.py
index 01771f55..c0a69b40 100644
--- a/pygments/lexers/modula2.py
+++ b/pygments/lexers/modula2.py
@@ -5,7 +5,7 @@
Multi-Dialect Lexer for Modula-2.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/monte.py b/pygments/lexers/monte.py
index aa5c75f7..ed6e20f8 100644
--- a/pygments/lexers/monte.py
+++ b/pygments/lexers/monte.py
@@ -5,7 +5,7 @@
Lexer for the Monte programming language.
- :copyright: Copyright 2016 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -43,8 +43,8 @@ _operators = [
_escape_pattern = (
r'(?:\\x[0-9a-fA-F]{2}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|'
r'\\["\'\\bftnr])')
-#_char = _escape_chars + [('.', String.Char)]
-_identifier = '[_a-zA-Z][_0-9a-zA-Z]*'
+# _char = _escape_chars + [('.', String.Char)]
+_identifier = r'[_a-zA-Z]\w*'
_constants = [
# Void constants
@@ -75,6 +75,7 @@ _safeScope = [
'makeBrandPair', 'makeLazySlot', 'safeScope', 'simple__quasiParser',
]
+
class MonteLexer(RegexLexer):
"""
Lexer for the `Monte <https://monte.readthedocs.io/>`_ programming language.
diff --git a/pygments/lexers/ncl.py b/pygments/lexers/ncl.py
index 85f46f20..3ca5135c 100644
--- a/pygments/lexers/ncl.py
+++ b/pygments/lexers/ncl.py
@@ -5,7 +5,7 @@
Lexers for NCAR Command Language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -35,7 +35,7 @@ class NCLLexer(RegexLexer):
(r';.*\n', Comment),
include('strings'),
include('core'),
- (r'[a-z][\w$]*', Name),
+ (r'[a-zA-Z_]\w*', Name),
include('nums'),
(r'[\s]+', Text),
],
@@ -43,7 +43,7 @@ class NCLLexer(RegexLexer):
# Statements
(words((
'begin', 'break', 'continue', 'create', 'defaultapp', 'do',
- 'else', 'end', 'external', 'exit', 'False', 'file', 'function',
+ 'else', 'end', 'external', 'exit', 'True', 'False', 'file', 'function',
'getvalues', 'graphic', 'group', 'if', 'list', 'load', 'local',
'new', '_Missing', 'Missing', 'noparent', 'procedure',
'quit', 'QUIT', 'Quit', 'record', 'return', 'setvalues', 'stop',
@@ -59,10 +59,10 @@ class NCLLexer(RegexLexer):
Keyword.Type),
# Operators
- (r'[\^*+\-/<>]', Operator),
+ (r'[\%^*+\-/<>]', Operator),
# punctuation:
- (r'[\[\]():@$.,]', Punctuation),
+ (r'[\[\]():@$!&|.,\\{}]', Punctuation),
(r'[=:]', Punctuation),
# Intrinsics
@@ -589,149 +589,60 @@ class NCLLexer(RegexLexer):
'lgTitleFontQuality', 'lgTitleFontThicknessF', 'lgTitleFuncCode',
'lgTitleJust', 'lgTitleOffsetF', 'lgTitleOn', 'lgTitlePosition',
'lgTitleString', 'lgTopMarginF', 'mpAreaGroupCount',
- 'mpAreaGroupCount_MapPlot', 'mpAreaMaskingOn',
- 'mpAreaMaskingOn_MapPlot', 'mpAreaNames', 'mpAreaNames_MapPlot',
- 'mpAreaTypes', 'mpAreaTypes_MapPlot', 'mpBottomAngleF',
- 'mpBottomAngleF_MapTransformation', 'mpBottomMapPosF',
- 'mpBottomMapPosF_MapTransformation', 'mpBottomNDCF',
- 'mpBottomNDCF_MapTransformation', 'mpBottomNPCF',
- 'mpBottomNPCF_MapTransformation', 'mpBottomPointLatF',
- 'mpBottomPointLatF_MapTransformation', 'mpBottomPointLonF',
- 'mpBottomPointLonF_MapTransformation', 'mpBottomWindowF',
- 'mpBottomWindowF_MapTransformation', 'mpCenterLatF',
- 'mpCenterLatF_MapTransformation', 'mpCenterLonF',
- 'mpCenterLonF_MapTransformation', 'mpCenterRotF',
- 'mpCenterRotF_MapTransformation', 'mpCountyLineColor',
- 'mpCountyLineColor_MapPlot', 'mpCountyLineDashPattern',
- 'mpCountyLineDashPattern_MapPlot', 'mpCountyLineDashSegLenF',
- 'mpCountyLineDashSegLenF_MapPlot', 'mpCountyLineThicknessF',
- 'mpCountyLineThicknessF_MapPlot', 'mpDataBaseVersion',
- 'mpDataBaseVersion_MapPlot', 'mpDataResolution',
- 'mpDataResolution_MapPlot', 'mpDataSetName', 'mpDataSetName_MapPlot',
- 'mpDefaultFillColor', 'mpDefaultFillColor_MapPlot',
- 'mpDefaultFillPattern', 'mpDefaultFillPattern_MapPlot',
- 'mpDefaultFillScaleF', 'mpDefaultFillScaleF_MapPlot',
- 'mpDynamicAreaGroups', 'mpDynamicAreaGroups_MapPlot',
- 'mpEllipticalBoundary', 'mpEllipticalBoundary_MapTransformation',
- 'mpFillAreaSpecifiers', 'mpFillAreaSpecifiers_MapPlot',
- 'mpFillBoundarySets', 'mpFillBoundarySets_MapPlot', 'mpFillColor',
- 'mpFillColor_MapPlot', 'mpFillColors', 'mpFillColors_MapPlot',
- 'mpFillColors-default', 'mpFillDotSizeF', 'mpFillDotSizeF_MapPlot',
- 'mpFillDrawOrder', 'mpFillDrawOrder_MapPlot', 'mpFillOn',
- 'mpFillOn_MapPlot', 'mpFillPatternBackground',
- 'mpFillPatternBackground_MapPlot', 'mpFillPattern',
- 'mpFillPattern_MapPlot', 'mpFillPatterns', 'mpFillPatterns_MapPlot',
- 'mpFillPatterns-default', 'mpFillScaleF', 'mpFillScaleF_MapPlot',
- 'mpFillScales', 'mpFillScales_MapPlot', 'mpFillScales-default',
- 'mpFixedAreaGroups', 'mpFixedAreaGroups_MapPlot',
- 'mpGeophysicalLineColor', 'mpGeophysicalLineColor_MapPlot',
- 'mpGeophysicalLineDashPattern',
- 'mpGeophysicalLineDashPattern_MapPlot',
- 'mpGeophysicalLineDashSegLenF',
- 'mpGeophysicalLineDashSegLenF_MapPlot', 'mpGeophysicalLineThicknessF',
- 'mpGeophysicalLineThicknessF_MapPlot', 'mpGreatCircleLinesOn',
- 'mpGreatCircleLinesOn_MapTransformation', 'mpGridAndLimbDrawOrder',
- 'mpGridAndLimbDrawOrder_MapPlot', 'mpGridAndLimbOn',
- 'mpGridAndLimbOn_MapPlot', 'mpGridLatSpacingF',
- 'mpGridLatSpacingF_MapPlot', 'mpGridLineColor',
- 'mpGridLineColor_MapPlot', 'mpGridLineDashPattern',
- 'mpGridLineDashPattern_MapPlot', 'mpGridLineDashSegLenF',
- 'mpGridLineDashSegLenF_MapPlot', 'mpGridLineThicknessF',
- 'mpGridLineThicknessF_MapPlot', 'mpGridLonSpacingF',
- 'mpGridLonSpacingF_MapPlot', 'mpGridMaskMode',
- 'mpGridMaskMode_MapPlot', 'mpGridMaxLatF', 'mpGridMaxLatF_MapPlot',
- 'mpGridPolarLonSpacingF', 'mpGridPolarLonSpacingF_MapPlot',
- 'mpGridSpacingF', 'mpGridSpacingF_MapPlot', 'mpInlandWaterFillColor',
- 'mpInlandWaterFillColor_MapPlot', 'mpInlandWaterFillPattern',
- 'mpInlandWaterFillPattern_MapPlot', 'mpInlandWaterFillScaleF',
- 'mpInlandWaterFillScaleF_MapPlot', 'mpLabelDrawOrder',
- 'mpLabelDrawOrder_MapPlot', 'mpLabelFontColor',
- 'mpLabelFontColor_MapPlot', 'mpLabelFontHeightF',
- 'mpLabelFontHeightF_MapPlot', 'mpLabelsOn', 'mpLabelsOn_MapPlot',
- 'mpLambertMeridianF', 'mpLambertMeridianF_MapTransformation',
- 'mpLambertParallel1F', 'mpLambertParallel1F_MapTransformation',
- 'mpLambertParallel2F', 'mpLambertParallel2F_MapTransformation',
- 'mpLandFillColor', 'mpLandFillColor_MapPlot', 'mpLandFillPattern',
- 'mpLandFillPattern_MapPlot', 'mpLandFillScaleF',
- 'mpLandFillScaleF_MapPlot', 'mpLeftAngleF',
- 'mpLeftAngleF_MapTransformation', 'mpLeftCornerLatF',
- 'mpLeftCornerLatF_MapTransformation', 'mpLeftCornerLonF',
- 'mpLeftCornerLonF_MapTransformation', 'mpLeftMapPosF',
- 'mpLeftMapPosF_MapTransformation', 'mpLeftNDCF',
- 'mpLeftNDCF_MapTransformation', 'mpLeftNPCF',
- 'mpLeftNPCF_MapTransformation', 'mpLeftPointLatF',
- 'mpLeftPointLatF_MapTransformation', 'mpLeftPointLonF',
- 'mpLeftPointLonF_MapTransformation', 'mpLeftWindowF',
- 'mpLeftWindowF_MapTransformation', 'mpLimbLineColor',
- 'mpLimbLineColor_MapPlot', 'mpLimbLineDashPattern',
- 'mpLimbLineDashPattern_MapPlot', 'mpLimbLineDashSegLenF',
- 'mpLimbLineDashSegLenF_MapPlot', 'mpLimbLineThicknessF',
- 'mpLimbLineThicknessF_MapPlot', 'mpLimitMode',
- 'mpLimitMode_MapTransformation', 'Angle_projection_limits',
- 'mpMaskAreaSpecifiers', 'mpMaskAreaSpecifiers_MapPlot',
- 'mpMaskOutlineSpecifiers', 'mpMaskOutlineSpecifiers_MapPlot',
- 'mpMaxLatF', 'mpMaxLatF_MapTransformation', 'mpMaxLonF',
- 'mpMaxLonF_MapTransformation', 'mpMinLatF',
- 'mpMinLatF_MapTransformation', 'mpMinLonF',
- 'mpMinLonF_MapTransformation', 'mpMonoFillColor',
- 'mpMonoFillColor_MapPlot', 'mpMonoFillPattern',
- 'mpMonoFillPattern_MapPlot', 'mpMonoFillScale',
- 'mpMonoFillScale_MapPlot', 'mpNationalLineColor',
- 'mpNationalLineColor_MapPlot', 'mpNationalLineDashPattern',
- 'mpNationalLineDashPattern_MapPlot',
- 'mpNationalLineDashSegLenF_MapPlot', 'mpNationalLineThicknessF',
- 'mpNationalLineThicknessF_MapPlot', 'mpOceanFillColor',
- 'mpOceanFillColor_MapPlot', 'mpOceanFillPattern',
- 'mpOceanFillPattern_MapPlot', 'mpOceanFillScaleF',
- 'mpOceanFillScaleF_MapPlot', 'mpOutlineBoundarySets',
- 'mpOutlineBoundarySets_MapPlot', 'mpOutlineDrawOrder',
- 'mpOutlineDrawOrder_MapPlot', 'mpOutlineMaskingOn',
- 'mpOutlineMaskingOn_MapPlot', 'mpOutlineOn', 'mpOutlineOn_MapPlot',
- 'mpOutlineSpecifiers', 'mpOutlineSpecifiers_MapPlot',
- 'mpPerimDrawOrder', 'mpPerimDrawOrder_MapPlot', 'mpPerimLineColor',
- 'mpPerimLineColor_MapPlot', 'mpPerimLineDashPattern',
- 'mpPerimLineDashPattern_MapPlot', 'mpPerimLineDashSegLenF',
- 'mpPerimLineDashSegLenF_MapPlot', 'mpPerimLineThicknessF',
- 'mpPerimLineThicknessF_MapPlot', 'mpPerimOn', 'mpPerimOn_MapPlot',
- 'mpPolyMode', 'mpPolyMode_MapTransformation', 'mpProjection',
- 'mpProjection_MapTransformation', 'mpProvincialLineColor',
- 'mpProvincialLineColor_MapPlot', 'mpProvincialLineDashPattern',
- 'mpProvincialLineDashPattern_MapPlot', 'mpProvincialLineDashSegLenF',
- 'mpProvincialLineDashSegLenF_MapPlot', 'mpProvincialLineThicknessF',
- 'mpProvincialLineThicknessF_MapPlot', 'mpRelativeCenterLat',
- 'mpRelativeCenterLat_MapTransformation', 'mpRelativeCenterLon',
- 'mpRelativeCenterLon_MapTransformation', 'mpRightAngleF',
- 'mpRightAngleF_MapTransformation', 'mpRightCornerLatF',
- 'mpRightCornerLatF_MapTransformation', 'mpRightCornerLonF',
- 'mpRightCornerLonF_MapTransformation', 'mpRightMapPosF',
- 'mpRightMapPosF_MapTransformation', 'mpRightNDCF',
- 'mpRightNDCF_MapTransformation', 'mpRightNPCF',
- 'mpRightNPCF_MapTransformation', 'mpRightPointLatF',
- 'mpRightPointLatF_MapTransformation', 'mpRightPointLonF',
- 'mpRightPointLonF_MapTransformation', 'mpRightWindowF',
- 'mpRightWindowF_MapTransformation', 'mpSatelliteAngle1F',
- 'mpSatelliteAngle1F_MapTransformation', 'mpSatelliteAngle2F',
- 'mpSatelliteAngle2F_MapTransformation', 'mpSatelliteDistF',
- 'mpSatelliteDistF_MapTransformation', 'mpShapeMode',
- 'mpShapeMode_MapPlot', 'mpSpecifiedFillColors',
- 'mpSpecifiedFillColors_MapPlot', 'mpSpecifiedFillDirectIndexing',
- 'mpSpecifiedFillDirectIndexing_MapPlot', 'mpSpecifiedFillPatterns',
- 'mpSpecifiedFillPatterns_MapPlot', 'mpSpecifiedFillPriority',
- 'mpSpecifiedFillPriority_MapPlot', 'mpSpecifiedFillScales',
- 'mpSpecifiedFillScales_MapPlot', 'mpTopAngleF',
- 'mpTopAngleF_MapTransformation', 'mpTopMapPosF',
- 'mpTopMapPosF_MapTransformation', 'mpTopNDCF',
- 'mpTopNDCF_MapTransformation', 'mpTopNPCF',
- 'mpTopNPCF_MapTransformation', 'mpTopPointLatF',
- 'mpTopPointLatF_MapTransformation', 'mpTopPointLonF',
- 'mpTopPointLonF_MapTransformation', 'mpTopWindowF',
- 'mpTopWindowF_MapTransformation', 'mpUSStateLineColor',
- 'mpUSStateLineColor_MapPlot', 'mpUSStateLineDashPattern',
- 'mpUSStateLineDashPattern_MapPlot', 'mpUSStateLineDashSegLenF',
- 'mpUSStateLineDashSegLenF_MapPlot', 'mpUSStateLineThicknessF',
- 'mpUSStateLineThicknessF_MapPlot', 'pmAnnoManagers',
- 'pmAnnoViews', 'pmLabelBarDisplayMode', 'pmLabelBarHeightF',
- 'pmLabelBarKeepAspect', 'pmLabelBarOrthogonalPosF',
+ 'mpAreaMaskingOn', 'mpAreaNames', 'mpAreaTypes', 'mpBottomAngleF',
+ 'mpBottomMapPosF', 'mpBottomNDCF', 'mpBottomNPCF',
+ 'mpBottomPointLatF', 'mpBottomPointLonF', 'mpBottomWindowF',
+ 'mpCenterLatF', 'mpCenterLonF', 'mpCenterRotF', 'mpCountyLineColor',
+ 'mpCountyLineDashPattern', 'mpCountyLineDashSegLenF',
+ 'mpCountyLineThicknessF', 'mpDataBaseVersion', 'mpDataResolution',
+ 'mpDataSetName', 'mpDefaultFillColor', 'mpDefaultFillPattern',
+ 'mpDefaultFillScaleF', 'mpDynamicAreaGroups', 'mpEllipticalBoundary',
+ 'mpFillAreaSpecifiers', 'mpFillBoundarySets', 'mpFillColor',
+ 'mpFillColors', 'mpFillColors-default', 'mpFillDotSizeF',
+ 'mpFillDrawOrder', 'mpFillOn', 'mpFillPatternBackground',
+ 'mpFillPattern', 'mpFillPatterns', 'mpFillPatterns-default',
+ 'mpFillScaleF', 'mpFillScales', 'mpFillScales-default',
+ 'mpFixedAreaGroups', 'mpGeophysicalLineColor',
+ 'mpGeophysicalLineDashPattern', 'mpGeophysicalLineDashSegLenF',
+ 'mpGeophysicalLineThicknessF', 'mpGreatCircleLinesOn',
+ 'mpGridAndLimbDrawOrder', 'mpGridAndLimbOn', 'mpGridLatSpacingF',
+ 'mpGridLineColor', 'mpGridLineDashPattern', 'mpGridLineDashSegLenF',
+ 'mpGridLineThicknessF', 'mpGridLonSpacingF', 'mpGridMaskMode',
+ 'mpGridMaxLatF', 'mpGridPolarLonSpacingF', 'mpGridSpacingF',
+ 'mpInlandWaterFillColor', 'mpInlandWaterFillPattern',
+ 'mpInlandWaterFillScaleF', 'mpLabelDrawOrder', 'mpLabelFontColor',
+ 'mpLabelFontHeightF', 'mpLabelsOn', 'mpLambertMeridianF',
+ 'mpLambertParallel1F', 'mpLambertParallel2F', 'mpLandFillColor',
+ 'mpLandFillPattern', 'mpLandFillScaleF', 'mpLeftAngleF',
+ 'mpLeftCornerLatF', 'mpLeftCornerLonF', 'mpLeftMapPosF',
+ 'mpLeftNDCF', 'mpLeftNPCF', 'mpLeftPointLatF',
+ 'mpLeftPointLonF', 'mpLeftWindowF', 'mpLimbLineColor',
+ 'mpLimbLineDashPattern', 'mpLimbLineDashSegLenF',
+ 'mpLimbLineThicknessF', 'mpLimitMode', 'mpMaskAreaSpecifiers',
+ 'mpMaskOutlineSpecifiers', 'mpMaxLatF', 'mpMaxLonF',
+ 'mpMinLatF', 'mpMinLonF', 'mpMonoFillColor', 'mpMonoFillPattern',
+ 'mpMonoFillScale', 'mpNationalLineColor', 'mpNationalLineDashPattern',
+ 'mpNationalLineThicknessF', 'mpOceanFillColor', 'mpOceanFillPattern',
+ 'mpOceanFillScaleF', 'mpOutlineBoundarySets', 'mpOutlineDrawOrder',
+ 'mpOutlineMaskingOn', 'mpOutlineOn', 'mpOutlineSpecifiers',
+ 'mpPerimDrawOrder', 'mpPerimLineColor', 'mpPerimLineDashPattern',
+ 'mpPerimLineDashSegLenF', 'mpPerimLineThicknessF', 'mpPerimOn',
+ 'mpPolyMode', 'mpProjection', 'mpProvincialLineColor',
+ 'mpProvincialLineDashPattern', 'mpProvincialLineDashSegLenF',
+ 'mpProvincialLineThicknessF', 'mpRelativeCenterLat',
+ 'mpRelativeCenterLon', 'mpRightAngleF', 'mpRightCornerLatF',
+ 'mpRightCornerLonF', 'mpRightMapPosF', 'mpRightNDCF',
+ 'mpRightNPCF', 'mpRightPointLatF', 'mpRightPointLonF',
+ 'mpRightWindowF', 'mpSatelliteAngle1F', 'mpSatelliteAngle2F',
+ 'mpSatelliteDistF', 'mpShapeMode', 'mpSpecifiedFillColors',
+ 'mpSpecifiedFillDirectIndexing', 'mpSpecifiedFillPatterns',
+ 'mpSpecifiedFillPriority', 'mpSpecifiedFillScales',
+ 'mpTopAngleF', 'mpTopMapPosF', 'mpTopNDCF', 'mpTopNPCF',
+ 'mpTopPointLatF', 'mpTopPointLonF', 'mpTopWindowF',
+ 'mpUSStateLineColor', 'mpUSStateLineDashPattern',
+ 'mpUSStateLineDashSegLenF', 'mpUSStateLineThicknessF',
+ 'pmAnnoManagers', 'pmAnnoViews', 'pmLabelBarDisplayMode',
+ 'pmLabelBarHeightF', 'pmLabelBarKeepAspect', 'pmLabelBarOrthogonalPosF',
'pmLabelBarParallelPosF', 'pmLabelBarSide', 'pmLabelBarWidthF',
'pmLabelBarZone', 'pmLegendDisplayMode', 'pmLegendHeightF',
'pmLegendKeepAspect', 'pmLegendOrthogonalPosF',
@@ -739,35 +650,14 @@ class NCLLexer(RegexLexer):
'pmLegendZone', 'pmOverlaySequenceIds', 'pmTickMarkDisplayMode',
'pmTickMarkZone', 'pmTitleDisplayMode', 'pmTitleZone',
'prGraphicStyle', 'prPolyType', 'prXArray', 'prYArray',
- 'sfCopyData_MeshScalarField', 'sfCopyData', 'sfCopyData_ScalarField',
- 'sfDataArray_MeshScalarField', 'sfDataArray',
- 'sfDataArray_ScalarField', 'sfDataMaxV_MeshScalarField', 'sfDataMaxV',
- 'sfDataMaxV_ScalarField', 'sfDataMinV_MeshScalarField', 'sfDataMinV',
- 'sfDataMinV_ScalarField', 'sfElementNodes',
- 'sfElementNodes_MeshScalarField', 'sfExchangeDimensions',
- 'sfExchangeDimensions_ScalarField', 'sfFirstNodeIndex',
- 'sfFirstNodeIndex_MeshScalarField', 'sfMissingValueV_MeshScalarField',
- 'sfMissingValueV', 'sfMissingValueV_ScalarField',
- 'sfXArray_MeshScalarField', 'sfXArray', 'sfXArray_ScalarField',
- 'sfXCActualEndF_MeshScalarField', 'sfXCActualEndF',
- 'sfXCActualEndF_ScalarField', 'sfXCActualStartF_MeshScalarField',
- 'sfXCActualStartF', 'sfXCActualStartF_ScalarField', 'sfXCEndIndex',
- 'sfXCEndIndex_ScalarField', 'sfXCEndSubsetV',
- 'sfXCEndSubsetV_ScalarField', 'sfXCEndV', 'sfXCEndV_ScalarField',
- 'sfXCStartIndex', 'sfXCStartIndex_ScalarField', 'sfXCStartSubsetV',
- 'sfXCStartSubsetV_ScalarField', 'sfXCStartV',
- 'sfXCStartV_ScalarField', 'sfXCStride', 'sfXCStride_ScalarField',
- 'sfXCellBounds', 'sfXCellBounds_MeshScalarField',
- 'sfYArray_MeshScalarField', 'sfYArray', 'sfYArray_ScalarField',
- 'sfYCActualEndF_MeshScalarField', 'sfYCActualEndF',
- 'sfYCActualEndF_ScalarField', 'sfYCActualStartF_MeshScalarField',
- 'sfYCActualStartF', 'sfYCActualStartF_ScalarField', 'sfYCEndIndex',
- 'sfYCEndIndex_ScalarField', 'sfYCEndSubsetV',
- 'sfYCEndSubsetV_ScalarField', 'sfYCEndV', 'sfYCEndV_ScalarField',
- 'sfYCStartIndex', 'sfYCStartIndex_ScalarField', 'sfYCStartSubsetV',
- 'sfYCStartSubsetV_ScalarField', 'sfYCStartV',
- 'sfYCStartV_ScalarField', 'sfYCStride', 'sfYCStride_ScalarField',
- 'sfYCellBounds', 'sfYCellBounds_MeshScalarField', 'stArrowLengthF',
+ 'sfCopyData', 'sfDataArray', 'sfDataMaxV', 'sfDataMinV',
+ 'sfElementNodes', 'sfExchangeDimensions', 'sfFirstNodeIndex',
+ 'sfMissingValueV', 'sfXArray', 'sfXCActualEndF', 'sfXCActualStartF',
+ 'sfXCEndIndex', 'sfXCEndSubsetV', 'sfXCEndV', 'sfXCStartIndex',
+ 'sfXCStartSubsetV', 'sfXCStartV', 'sfXCStride', 'sfXCellBounds',
+ 'sfYArray', 'sfYCActualEndF', 'sfYCActualStartF', 'sfYCEndIndex',
+ 'sfYCEndSubsetV', 'sfYCEndV', 'sfYCStartIndex', 'sfYCStartSubsetV',
+ 'sfYCStartV', 'sfYCStride', 'sfYCellBounds', 'stArrowLengthF',
'stArrowStride', 'stCrossoverCheckCount',
'stExplicitLabelBarLabelsOn', 'stLabelBarEndLabelsOn',
'stLabelFormat', 'stLengthCheckCount', 'stLevelColors',
@@ -870,25 +760,12 @@ class NCLLexer(RegexLexer):
'tmYRMinorPerMajor', 'tmYRMinorThicknessF', 'tmYRMinorValues',
'tmYRMode', 'tmYROn', 'tmYRPrecision', 'tmYRStyle', 'tmYRTickEndF',
'tmYRTickSpacingF', 'tmYRTickStartF', 'tmYRValues', 'tmYUseLeft',
- 'trGridType', 'trGridType_Transformation', 'trLineInterpolationOn',
- 'trLineInterpolationOn_Transformation', 'trXAxisType',
- 'trXAxisType_IrregularTransformation', 'trXCoordPoints',
- 'trXCoordPoints_IrregularTransformation', 'trXInterPoints',
- 'trXInterPoints_IrregularTransformation', 'trXLog',
- 'trXLog_LogLinTransformation', 'trXMaxF', 'trXMaxF_Transformation',
- 'trXMinF', 'trXMinF_Transformation', 'trXReverse',
- 'trXReverse_Transformation', 'trXSamples',
- 'trXSamples_IrregularTransformation', 'trXTensionF',
- 'trXTensionF_IrregularTransformation', 'trYAxisType',
- 'trYAxisType_IrregularTransformation', 'trYCoordPoints',
- 'trYCoordPoints_IrregularTransformation', 'trYInterPoints',
- 'trYInterPoints_IrregularTransformation', 'trYLog',
- 'trYLog_LogLinTransformation', 'trYMaxF', 'trYMaxF_Transformation',
- 'trYMinF', 'trYMinF_Transformation', 'trYReverse',
- 'trYReverse_Transformation', 'trYSamples',
- 'trYSamples_IrregularTransformation', 'trYTensionF',
- 'trYTensionF_IrregularTransformation', 'txAngleF',
- 'txBackgroundFillColor', 'txConstantSpacingF', 'txDirection',
+ 'trGridType', 'trLineInterpolationOn',
+ 'trXAxisType', 'trXCoordPoints', 'trXInterPoints', 'trXLog',
+ 'trXMaxF', 'trXMinF', 'trXReverse', 'trXSamples', 'trXTensionF',
+ 'trYAxisType', 'trYCoordPoints', 'trYInterPoints', 'trYLog',
+ 'trYMaxF', 'trYMinF', 'trYReverse', 'trYSamples', 'trYTensionF',
+ 'txAngleF', 'txBackgroundFillColor', 'txConstantSpacingF', 'txDirection',
'txFont', 'HLU-Fonts', 'txFontAspectF', 'txFontColor',
'txFontHeightF', 'txFontOpacityF', 'txFontQuality',
'txFontThicknessF', 'txFuncCode', 'txJust', 'txPerimColor',
@@ -969,53 +846,16 @@ class NCLLexer(RegexLexer):
'vfYCEndSubsetV', 'vfYCEndV', 'vfYCStartIndex', 'vfYCStartSubsetV',
'vfYCStartV', 'vfYCStride', 'vpAnnoManagerId', 'vpClipOn',
'vpHeightF', 'vpKeepAspect', 'vpOn', 'vpUseSegments', 'vpWidthF',
- 'vpXF', 'vpYF', 'wkAntiAlias', 'wkAntiAlias_DocumentWorkstation',
- 'wkAntiAlias_ImageWorkstation', 'wkAntiAlias_XWorkstation',
- 'wkBackgroundColor', 'wkBackgroundColor_Workstation',
- 'wkBackgroundOpacityF', 'wkBackgroundOpacityF_DocumentWorkstation',
- 'wkBackgroundOpacityF_ImageWorkstation',
- 'wkBackgroundOpacityF_XWorkstation', 'wkColorMapLen',
- 'wkColorMapLen_Workstation', 'wkColorMap', 'wkColorMap_Workstation',
- 'wkColorModel', 'wkColorModel_PDFWorkstation',
- 'wkColorModel_PSWorkstation', 'wkDashTableLength',
- 'wkDashTableLength_Workstation', 'wkDefGraphicStyleId',
- 'wkDefGraphicStyleId_Workstation', 'wkDeviceLowerX',
- 'wkDeviceLowerX_DocumentWorkstation', 'wkDeviceLowerX_PDFWorkstation',
- 'wkDeviceLowerX_PSWorkstation', 'wkDeviceLowerY',
- 'wkDeviceLowerY_DocumentWorkstation', 'wkDeviceLowerY_PDFWorkstation',
- 'wkDeviceLowerY_PSWorkstation', 'wkDeviceUpperX',
- 'wkDeviceUpperX_DocumentWorkstation', 'wkDeviceUpperX_PDFWorkstation',
- 'wkDeviceUpperX_PSWorkstation', 'wkDeviceUpperY',
- 'wkDeviceUpperY_DocumentWorkstation', 'wkDeviceUpperY_PDFWorkstation',
- 'wkDeviceUpperY_PSWorkstation', 'wkFileName',
- 'wkFileName_DocumentWorkstation', 'wkFileName_ImageWorkstation',
- 'wkFillTableLength', 'wkFillTableLength_Workstation',
- 'wkForegroundColor', 'wkForegroundColor_Workstation', 'wkFormat',
- 'wkFormat_DocumentWorkstation', 'wkFormat_ImageWorkstation',
- 'wkFullBackground', 'wkFullBackground_PDFWorkstation',
- 'wkFullBackground_PSWorkstation', 'wkGksWorkId',
- 'wkGksWorkId_Workstation', 'wkHeight', 'wkHeight_ImageWorkstation',
- 'wkHeight_XWorkstation', 'wkMarkerTableLength',
- 'wkMarkerTableLength_Workstation', 'wkMetaName',
- 'wkMetaName_NcgmWorkstation', 'wkOrientation',
- 'wkOrientation_PDFWorkstation', 'wkOrientation_PSWorkstation',
- 'wkPDFFileName', 'wkPDFFileName_PDFWorkstation', 'wkPDFFormat',
- 'wkPDFFormat_PDFWorkstation', 'wkPDFResolution',
- 'wkPDFResolution_PDFWorkstation', 'wkPSFileName',
- 'wkPSFileName_PSWorkstation', 'wkPSFormat',
- 'wkPSFormat_PSWorkstation', 'wkPSResolution',
- 'wkPSResolution_PSWorkstation', 'wkPaperHeightF',
- 'wkPaperHeightF_DocumentWorkstation', 'wkPaperHeightF_PDFWorkstation',
- 'wkPaperHeightF_PSWorkstation', 'wkPaperSize',
- 'wkPaperSize_DocumentWorkstation', 'wkPaperSize_PDFWorkstation',
- 'wkPaperSize_PSWorkstation', 'wkPaperWidthF',
- 'wkPaperWidthF_DocumentWorkstation', 'wkPaperWidthF_PDFWorkstation',
- 'wkPaperWidthF_PSWorkstation', 'wkPause', 'wkPause_XWorkstation',
- 'wkTopLevelViews', 'wkTopLevelViews_Workstation', 'wkViews',
- 'wkViews_Workstation', 'wkVisualType', 'wkVisualType_PDFWorkstation',
- 'wkVisualType_PSWorkstation', 'wkWidth', 'wkWidth_ImageWorkstation',
- 'wkWidth_XWorkstation', 'wkWindowId', 'wkWindowId_XWorkstation',
- 'wkXColorMode', 'wkXColorMode_XWorkstation', 'wsCurrentSize',
+ 'vpXF', 'vpYF', 'wkAntiAlias', 'wkBackgroundColor', 'wkBackgroundOpacityF',
+ 'wkColorMapLen', 'wkColorMap', 'wkColorModel', 'wkDashTableLength',
+ 'wkDefGraphicStyleId', 'wkDeviceLowerX', 'wkDeviceLowerY',
+ 'wkDeviceUpperX', 'wkDeviceUpperY', 'wkFileName', 'wkFillTableLength',
+ 'wkForegroundColor', 'wkFormat', 'wkFullBackground', 'wkGksWorkId',
+ 'wkHeight', 'wkMarkerTableLength', 'wkMetaName', 'wkOrientation',
+ 'wkPDFFileName', 'wkPDFFormat', 'wkPDFResolution', 'wkPSFileName',
+ 'wkPSFormat', 'wkPSResolution', 'wkPaperHeightF', 'wkPaperSize',
+ 'wkPaperWidthF', 'wkPause', 'wkTopLevelViews', 'wkViews',
+ 'wkVisualType', 'wkWidth', 'wkWindowId', 'wkXColorMode', 'wsCurrentSize',
'wsMaximumSize', 'wsThresholdSize', 'xyComputeXMax',
'xyComputeXMin', 'xyComputeYMax', 'xyComputeYMin', 'xyCoordData',
'xyCoordDataSpec', 'xyCurveDrawOrder', 'xyDashPattern',
@@ -1037,7 +877,8 @@ class NCLLexer(RegexLexer):
Name.Builtin),
# Booleans
- (r'True|False', Name.Builtin), # Comparing Operators
+ (r'\.(True|False)\.', Name.Builtin),
+ # Comparing Operators
(r'\.(eq|ne|lt|le|gt|ge|not|and|or|xor)\.', Operator.Word),
],
diff --git a/pygments/lexers/nimrod.py b/pygments/lexers/nimrod.py
index e1bbcc03..d438c1bf 100644
--- a/pygments/lexers/nimrod.py
+++ b/pygments/lexers/nimrod.py
@@ -5,7 +5,7 @@
Lexer for the Nim language (formerly known as Nimrod).
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/nit.py b/pygments/lexers/nit.py
index ab59c4e5..21116499 100644
--- a/pygments/lexers/nit.py
+++ b/pygments/lexers/nit.py
@@ -5,7 +5,7 @@
Lexer for the Nit language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/nix.py b/pygments/lexers/nix.py
index 57f08623..e148c919 100644
--- a/pygments/lexers/nix.py
+++ b/pygments/lexers/nix.py
@@ -5,7 +5,7 @@
Lexers for the NixOS Nix language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/oberon.py b/pygments/lexers/oberon.py
index 51dfdab6..3b5fb3e4 100644
--- a/pygments/lexers/oberon.py
+++ b/pygments/lexers/oberon.py
@@ -5,7 +5,7 @@
Lexers for Oberon family languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/objective.py b/pygments/lexers/objective.py
index ba1e0bae..7807255e 100644
--- a/pygments/lexers/objective.py
+++ b/pygments/lexers/objective.py
@@ -5,7 +5,7 @@
Lexers for Objective-C family languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/ooc.py b/pygments/lexers/ooc.py
index b4e8c6db..957b72f1 100644
--- a/pygments/lexers/ooc.py
+++ b/pygments/lexers/ooc.py
@@ -5,7 +5,7 @@
Lexers for the Ooc language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/other.py b/pygments/lexers/other.py
index dd45083c..bfce4c3c 100644
--- a/pygments/lexers/other.py
+++ b/pygments/lexers/other.py
@@ -5,7 +5,7 @@
Just export lexer classes previously contained in this module.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/parasail.py b/pygments/lexers/parasail.py
index 812e2923..53088023 100644
--- a/pygments/lexers/parasail.py
+++ b/pygments/lexers/parasail.py
@@ -5,7 +5,7 @@
Lexer for ParaSail.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/parsers.py b/pygments/lexers/parsers.py
index e1b74dee..1f3c9b4d 100644
--- a/pygments/lexers/parsers.py
+++ b/pygments/lexers/parsers.py
@@ -5,7 +5,7 @@
Lexers for parser generators.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/pascal.py b/pygments/lexers/pascal.py
index ce991a77..9aa1ac8f 100644
--- a/pygments/lexers/pascal.py
+++ b/pygments/lexers/pascal.py
@@ -5,7 +5,7 @@
Lexers for Pascal family languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -44,7 +44,7 @@ class DelphiLexer(Lexer):
"""
name = 'Delphi'
aliases = ['delphi', 'pas', 'pascal', 'objectpascal']
- filenames = ['*.pas']
+ filenames = ['*.pas', '*.dpr']
mimetypes = ['text/x-pascal']
TURBO_PASCAL_KEYWORDS = (
diff --git a/pygments/lexers/pawn.py b/pygments/lexers/pawn.py
index f32fdbed..f462a883 100644
--- a/pygments/lexers/pawn.py
+++ b/pygments/lexers/pawn.py
@@ -5,7 +5,7 @@
Lexers for the Pawn languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/perl.py b/pygments/lexers/perl.py
index 8df3c810..4d5ab3b3 100644
--- a/pygments/lexers/perl.py
+++ b/pygments/lexers/perl.py
@@ -5,7 +5,7 @@
Lexers for Perl and related languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -52,7 +52,7 @@ class PerlLexer(RegexLexer):
(words((
'case', 'continue', 'do', 'else', 'elsif', 'for', 'foreach',
'if', 'last', 'my', 'next', 'our', 'redo', 'reset', 'then',
- 'unless', 'until', 'while', 'use', 'print', 'new', 'BEGIN',
+ 'unless', 'until', 'while', 'print', 'new', 'BEGIN',
'CHECK', 'INIT', 'END', 'return'), suffix=r'\b'),
Keyword),
(r'(format)(\s+)(\w+)(\s*)(=)(\s*\n)',
@@ -94,10 +94,10 @@ class PerlLexer(RegexLexer):
'getservbyport', 'getservent', 'getsockname', 'getsockopt', 'glob', 'gmtime',
'goto', 'grep', 'hex', 'import', 'index', 'int', 'ioctl', 'join', 'keys', 'kill', 'last',
'lc', 'lcfirst', 'length', 'link', 'listen', 'local', 'localtime', 'log', 'lstat',
- 'map', 'mkdir', 'msgctl', 'msgget', 'msgrcv', 'msgsnd', 'my', 'next', 'no', 'oct', 'open',
- 'opendir', 'ord', 'our', 'pack', 'package', 'pipe', 'pop', 'pos', 'printf',
+ 'map', 'mkdir', 'msgctl', 'msgget', 'msgrcv', 'msgsnd', 'my', 'next', 'oct', 'open',
+ 'opendir', 'ord', 'our', 'pack', 'pipe', 'pop', 'pos', 'printf',
'prototype', 'push', 'quotemeta', 'rand', 'read', 'readdir',
- 'readline', 'readlink', 'readpipe', 'recv', 'redo', 'ref', 'rename', 'require',
+ 'readline', 'readlink', 'readpipe', 'recv', 'redo', 'ref', 'rename',
'reverse', 'rewinddir', 'rindex', 'rmdir', 'scalar', 'seek', 'seekdir',
'select', 'semctl', 'semget', 'semop', 'send', 'setgrent', 'sethostent', 'setnetent',
'setpgrp', 'setpriority', 'setprotoent', 'setpwent', 'setservent',
@@ -131,8 +131,14 @@ class PerlLexer(RegexLexer):
(r'(q|qq|qw|qr|qx)\[', String.Other, 'sb-string'),
(r'(q|qq|qw|qr|qx)\<', String.Other, 'lt-string'),
(r'(q|qq|qw|qr|qx)([\W_])(.|\n)*?\2', String.Other),
- (r'package\s+', Keyword, 'modulename'),
- (r'sub\s+', Keyword, 'funcname'),
+ (r'(package)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)',
+ bygroups(Keyword, Text, Name.Namespace)),
+ (r'(use|require|no)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)',
+ bygroups(Keyword, Text, Name.Namespace)),
+ (r'(sub)(\s+)', bygroups(Keyword, Text), 'funcname'),
+ (words((
+ 'no', 'package', 'require', 'use'), suffix=r'\b'),
+ Keyword),
(r'(\[\]|\*\*|::|<<|>>|>=|<=>|<=|={3}|!=|=~|'
r'!~|&&?|\|\||\.{1,3})', Operator),
(r'[-+/*%=<>&^|!\\~]=?', Operator),
@@ -152,14 +158,12 @@ class PerlLexer(RegexLexer):
(r'[\w:]+', Name.Variable, '#pop'),
],
'name': [
- (r'\w+::', Name.Namespace),
+ (r'[a-zA-Z_]\w*(::[a-zA-Z_]\w*)*(::)?(?=\s*->)', Name.Namespace, '#pop'),
+ (r'[a-zA-Z_]\w*(::[a-zA-Z_]\w*)*::', Name.Namespace, '#pop'),
(r'[\w:]+', Name, '#pop'),
(r'[A-Z_]+(?=\W)', Name.Constant, '#pop'),
(r'(?=\W)', Text, '#pop'),
],
- 'modulename': [
- (r'[a-zA-Z_]\w*', Name.Namespace, '#pop')
- ],
'funcname': [
(r'[a-zA-Z_]\w*[!?]?', Name.Function),
(r'\s+', Text),
diff --git a/pygments/lexers/php.py b/pygments/lexers/php.py
index 1931325a..f618b5fd 100644
--- a/pygments/lexers/php.py
+++ b/pygments/lexers/php.py
@@ -5,7 +5,7 @@
Lexers for PHP and related languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/praat.py b/pygments/lexers/praat.py
index 6679d3db..1a38a9e8 100644
--- a/pygments/lexers/praat.py
+++ b/pygments/lexers/praat.py
@@ -5,7 +5,7 @@
Lexer for Praat
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/prolog.py b/pygments/lexers/prolog.py
index 7d32d7f6..90f9529c 100644
--- a/pygments/lexers/prolog.py
+++ b/pygments/lexers/prolog.py
@@ -5,7 +5,7 @@
Lexers for Prolog and Prolog-like languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/python.py b/pygments/lexers/python.py
index 35635ed1..390eafe8 100644
--- a/pygments/lexers/python.py
+++ b/pygments/lexers/python.py
@@ -5,7 +5,7 @@
Lexers for Python and related languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -362,6 +362,7 @@ class Python3Lexer(RegexLexer):
]
tokens['numbers'] = [
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
+ (r'\d+[eE][+-]?[0-9]+j?', Number.Float),
(r'0[oO][0-7]+', Number.Oct),
(r'0[bB][01]+', Number.Bin),
(r'0[xX][a-fA-F0-9]+', Number.Hex),
diff --git a/pygments/lexers/qvt.py b/pygments/lexers/qvt.py
index f30e4887..f496d600 100644
--- a/pygments/lexers/qvt.py
+++ b/pygments/lexers/qvt.py
@@ -5,7 +5,7 @@
Lexer for QVT Operational language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/r.py b/pygments/lexers/r.py
index 1a47ca26..dce61969 100644
--- a/pygments/lexers/r.py
+++ b/pygments/lexers/r.py
@@ -5,7 +5,7 @@
Lexers for the R/S languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/rdf.py b/pygments/lexers/rdf.py
index 6dd6e8b9..d0f8778a 100644
--- a/pygments/lexers/rdf.py
+++ b/pygments/lexers/rdf.py
@@ -5,7 +5,7 @@
Lexers for semantic web and RDF query languages and markup.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/rebol.py b/pygments/lexers/rebol.py
index b844ad96..f3d00200 100644
--- a/pygments/lexers/rebol.py
+++ b/pygments/lexers/rebol.py
@@ -5,7 +5,7 @@
Lexers for the REBOL and related languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/resource.py b/pygments/lexers/resource.py
index 40429a3c..f7494904 100644
--- a/pygments/lexers/resource.py
+++ b/pygments/lexers/resource.py
@@ -5,7 +5,7 @@
Lexer for resource definition files.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/rnc.py b/pygments/lexers/rnc.py
index f60141e8..2f2aacdd 100644
--- a/pygments/lexers/rnc.py
+++ b/pygments/lexers/rnc.py
@@ -5,7 +5,7 @@
Lexer for Relax-NG Compact syntax
- :copyright: Copyright 2016 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/roboconf.py b/pygments/lexers/roboconf.py
index 59755a68..8c7df83d 100644
--- a/pygments/lexers/roboconf.py
+++ b/pygments/lexers/roboconf.py
@@ -5,7 +5,7 @@
Lexers for Roboconf DSL.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/robotframework.py b/pygments/lexers/robotframework.py
index eab06efe..e868127b 100644
--- a/pygments/lexers/robotframework.py
+++ b/pygments/lexers/robotframework.py
@@ -5,7 +5,7 @@
Lexer for Robot Framework.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/ruby.py b/pygments/lexers/ruby.py
index f16416d3..fe750f1a 100644
--- a/pygments/lexers/ruby.py
+++ b/pygments/lexers/ruby.py
@@ -5,7 +5,7 @@
Lexers for Ruby and related languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/rust.py b/pygments/lexers/rust.py
index d3d98ee8..6914f54d 100644
--- a/pygments/lexers/rust.py
+++ b/pygments/lexers/rust.py
@@ -5,7 +5,7 @@
Lexers for the Rust language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -27,6 +27,35 @@ class RustLexer(RegexLexer):
aliases = ['rust']
mimetypes = ['text/rust']
+ keyword_types = (
+ words(('u8', 'u16', 'u32', 'u64', 'i8', 'i16', 'i32', 'i64',
+ 'usize', 'isize', 'f32', 'f64', 'str', 'bool'),
+ suffix=r'\b'),
+ Keyword.Type)
+
+ builtin_types = (words((
+ # Reexported core operators
+ 'Copy', 'Send', 'Sized', 'Sync',
+ 'Drop', 'Fn', 'FnMut', 'FnOnce',
+
+ # Reexported types and traits
+ 'Box',
+ 'ToOwned',
+ 'Clone',
+ 'PartialEq', 'PartialOrd', 'Eq', 'Ord',
+ 'AsRef', 'AsMut', 'Into', 'From',
+ 'Default',
+ 'Iterator', 'Extend', 'IntoIterator',
+ 'DoubleEndedIterator', 'ExactSizeIterator',
+ 'Option',
+ 'Some', 'None',
+ 'Result',
+ 'Ok', 'Err',
+ 'SliceConcatExt',
+ 'String', 'ToString',
+ 'Vec'), suffix=r'\b'),
+ Name.Builtin)
+
tokens = {
'root': [
# rust allows a file to start with a shebang, but if the first line
@@ -64,36 +93,14 @@ class RustLexer(RegexLexer):
(r'fn\b', Keyword, 'funcname'),
(r'(struct|enum|type|union)\b', Keyword, 'typename'),
(r'(default)(\s+)(type|fn)\b', bygroups(Keyword, Text, Keyword)),
- (words(('u8', 'u16', 'u32', 'u64', 'i8', 'i16', 'i32', 'i64', 'usize',
- 'isize', 'f32', 'f64', 'str', 'bool'), suffix=r'\b'),
- Keyword.Type),
+ keyword_types,
(r'self\b', Name.Builtin.Pseudo),
# Prelude (taken from Rust’s src/libstd/prelude.rs)
- (words((
- # Reexported core operators
- 'Copy', 'Send', 'Sized', 'Sync',
- 'Drop', 'Fn', 'FnMut', 'FnOnce',
-
- # Reexported functions
- 'drop',
-
- # Reexported types and traits
- 'Box',
- 'ToOwned',
- 'Clone',
- 'PartialEq', 'PartialOrd', 'Eq', 'Ord',
- 'AsRef', 'AsMut', 'Into', 'From',
- 'Default',
- 'Iterator', 'Extend', 'IntoIterator',
- 'DoubleEndedIterator', 'ExactSizeIterator',
- 'Option',
- 'Some', 'None',
- 'Result',
- 'Ok', 'Err',
- 'SliceConcatExt',
- 'String', 'ToString',
- 'Vec'), suffix=r'\b'),
- Name.Builtin),
+ builtin_types,
+ # Path seperators, so types don't catch them.
+ (r'::\b', Text),
+ # Types in positions.
+ (r'(?::|->)', Text, 'typename'),
# Labels
(r'(break|continue)(\s*)(\'[A-Za-z_]\w*)?',
bygroups(Keyword, Text.Whitespace, Name.Label)),
@@ -112,7 +119,8 @@ class RustLexer(RegexLexer):
(r'0[xX][0-9a-fA-F_]+', Number.Hex, 'number_lit'),
# Decimal Literal
(r'[0-9][0-9_]*(\.[0-9_]+[eE][+\-]?[0-9_]+|'
- r'\.[0-9_]*(?!\.)|[eE][+\-]?[0-9_]+)', Number.Float, 'number_lit'),
+ r'\.[0-9_]*(?!\.)|[eE][+\-]?[0-9_]+)', Number.Float,
+ 'number_lit'),
(r'[0-9][0-9_]*', Number.Integer, 'number_lit'),
# String Literal
(r'b"', String, 'bytestring'),
@@ -164,6 +172,9 @@ class RustLexer(RegexLexer):
],
'typename': [
(r'\s+', Text),
+ (r'&', Keyword.Pseudo),
+ builtin_types,
+ keyword_types,
(r'[a-zA-Z_]\w*', Name.Class, '#pop'),
default('#pop'),
],
diff --git a/pygments/lexers/sas.py b/pygments/lexers/sas.py
index c91ea319..3747ed9a 100644
--- a/pygments/lexers/sas.py
+++ b/pygments/lexers/sas.py
@@ -5,7 +5,7 @@
Lexer for SAS.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -16,6 +16,7 @@ from pygments.token import Comment, Keyword, Name, Number, String, Text, \
__all__ = ['SASLexer']
+
class SASLexer(RegexLexer):
"""
For `SAS <http://www.sas.com/>`_ files.
@@ -136,7 +137,7 @@ class SASLexer(RegexLexer):
],
# Special highlight for proc, data, quit, run
'proc-data': [
- (r'(^|;)\s*(proc [a-zA-Z0-9_]+|data|run|quit)[\s;\n]',
+ (r'(^|;)\s*(proc \w+|data|run|quit)[\s;]',
Keyword.Reserved),
],
# Special highlight cards and datalines
@@ -154,7 +155,6 @@ class SASLexer(RegexLexer):
(r'NOTE(:|-).*', Generic, '#pop'),
(r'WARNING(:|-).*', Generic.Emph, '#pop'),
(r'ERROR(:|-).*', Generic.Error, '#pop'),
- (r'(?!(WARNING|NOTE|ERROR))+', Text, '#pop'),
include('general'),
],
'general': [
@@ -188,8 +188,8 @@ class SASLexer(RegexLexer):
],
# Strings and user-defined variables and macros (order matters)
'vars-strings': [
- (r'&[a-zA-Z_][a-zA-Z0-9_]{0,31}\.?', Name.Variable),
- (r'%[a-zA-Z_][a-zA-Z0-9_]{0,31}', Name.Function),
+ (r'&[a-z_]\w{0,31}\.?', Name.Variable),
+ (r'%[a-z_]\w{0,31}', Name.Function),
(r'\'', String, 'string_squote'),
(r'"', String, 'string_dquote'),
],
@@ -209,11 +209,11 @@ class SASLexer(RegexLexer):
(r'[$"\\]', String),
],
'validvar': [
- (r'[a-zA-Z_][a-zA-Z0-9_]{0,31}\.?', Name.Variable, '#pop'),
+ (r'[a-z_]\w{0,31}\.?', Name.Variable, '#pop'),
],
# SAS numbers and special variables
'numbers': [
- (r'\b[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+|\.)([eE][+-]?[0-9]+)?[i]?\b',
+ (r'\b[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+|\.)(E[+-]?[0-9]+)?i?\b',
Number),
],
'special': [
diff --git a/pygments/lexers/scripting.py b/pygments/lexers/scripting.py
index 5849161b..b3af606e 100644
--- a/pygments/lexers/scripting.py
+++ b/pygments/lexers/scripting.py
@@ -5,7 +5,7 @@
Lexer for scripting and embedded languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/shell.py b/pygments/lexers/shell.py
index a5933afb..ceb6f14d 100644
--- a/pygments/lexers/shell.py
+++ b/pygments/lexers/shell.py
@@ -5,7 +5,7 @@
Lexers for various shells.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -27,16 +27,17 @@ line_re = re.compile('.*?\n')
class BashLexer(RegexLexer):
"""
- Lexer for (ba|k|)sh shell scripts.
+ Lexer for (ba|k|z|)sh shell scripts.
.. versionadded:: 0.6
"""
name = 'Bash'
- aliases = ['bash', 'sh', 'ksh', 'shell']
+ aliases = ['bash', 'sh', 'ksh', 'zsh', 'shell']
filenames = ['*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass',
- '*.exheres-0', '*.exlib',
- '.bashrc', 'bashrc', '.bash_*', 'bash_*', 'PKGBUILD']
+ '*.exheres-0', '*.exlib', '*.zsh',
+ '.bashrc', 'bashrc', '.bash_*', 'bash_*', 'zshrc', '.zshrc',
+ 'PKGBUILD']
mimetypes = ['application/x-sh', 'application/x-shellscript']
tokens = {
@@ -50,7 +51,7 @@ class BashLexer(RegexLexer):
(r'\$\(\(', Keyword, 'math'),
(r'\$\(', Keyword, 'paren'),
(r'\$\{#?', String.Interpol, 'curly'),
- (r'\$[a-zA-Z_][a-zA-Z0-9_]*', Name.Variable), # user variable
+ (r'\$[a-zA-Z_]\w*', Name.Variable), # user variable
(r'\$(?:\d+|[#$?!_*@-])', Name.Variable), # builtin
(r'\$', Text),
],
@@ -478,13 +479,16 @@ class BatchLexer(RegexLexer):
using(this, state='variable')), '#pop'),
(r'(exist%s)(%s%s)' % (_token_terminator, _space, _stoken),
bygroups(Keyword, using(this, state='text')), '#pop'),
- (r'(%s%s?)(==)(%s?%s)' % (_stoken, _space, _space, _stoken),
- bygroups(using(this, state='text'), Operator,
- using(this, state='text')), '#pop'),
(r'(%s%s)(%s)(%s%s)' % (_number, _space, _opword, _space, _number),
bygroups(using(this, state='arithmetic'), Operator.Word,
using(this, state='arithmetic')), '#pop'),
- (r'(%s%s)(%s)(%s%s)' % (_stoken, _space, _opword, _space, _stoken),
+ (_stoken, using(this, state='text'), ('#pop', 'if2')),
+ ],
+ 'if2': [
+ (r'(%s?)(==)(%s?%s)' % (_space, _space, _stoken),
+ bygroups(using(this, state='text'), Operator,
+ using(this, state='text')), '#pop'),
+ (r'(%s)(%s)(%s%s)' % (_space, _opword, _space, _stoken),
bygroups(using(this, state='text'), Operator.Word,
using(this, state='text')), '#pop')
],
diff --git a/pygments/lexers/smalltalk.py b/pygments/lexers/smalltalk.py
index ebeb6320..79078b66 100644
--- a/pygments/lexers/smalltalk.py
+++ b/pygments/lexers/smalltalk.py
@@ -5,7 +5,7 @@
Lexers for Smalltalk and related languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/smv.py b/pygments/lexers/smv.py
index 15fc9381..380a3b70 100644
--- a/pygments/lexers/smv.py
+++ b/pygments/lexers/smv.py
@@ -5,7 +5,7 @@
Lexers for the SMV languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -19,6 +19,8 @@ __all__ = ['NuSMVLexer']
class NuSMVLexer(RegexLexer):
"""
Lexer for the NuSMV language.
+
+ .. versionadded:: 2.2
"""
name = 'NuSMV'
@@ -33,43 +35,45 @@ class NuSMVLexer(RegexLexer):
(r'--.*\n', Comment),
# Reserved
- (words(('MODULE','DEFINE','MDEFINE','CONSTANTS','VAR','IVAR',
- 'FROZENVAR','INIT','TRANS','INVAR','SPEC','CTLSPEC','LTLSPEC',
- 'PSLSPEC','COMPUTE','NAME','INVARSPEC','FAIRNESS','JUSTICE',
- 'COMPASSION','ISA','ASSIGN','CONSTRAINT','SIMPWFF','CTLWFF',
- 'LTLWFF','PSLWFF','COMPWFF','IN','MIN','MAX','MIRROR','PRED',
- 'PREDICATES'), suffix=r'(?![\w$#-])'), Keyword.Declaration),
+ (words(('MODULE', 'DEFINE', 'MDEFINE', 'CONSTANTS', 'VAR', 'IVAR',
+ 'FROZENVAR', 'INIT', 'TRANS', 'INVAR', 'SPEC', 'CTLSPEC',
+ 'LTLSPEC', 'PSLSPEC', 'COMPUTE', 'NAME', 'INVARSPEC',
+ 'FAIRNESS', 'JUSTICE', 'COMPASSION', 'ISA', 'ASSIGN',
+ 'CONSTRAINT', 'SIMPWFF', 'CTLWFF', 'LTLWFF', 'PSLWFF',
+ 'COMPWFF', 'IN', 'MIN', 'MAX', 'MIRROR', 'PRED',
+ 'PREDICATES'), suffix=r'(?![\w$#-])'),
+ Keyword.Declaration),
(r'process(?![\w$#-])', Keyword),
- (words(('array','of','boolean','integer','real','word'),
- suffix=r'(?![\w$#-])'), Keyword.Type),
- (words(('case','esac'), suffix=r'(?![\w$#-])'), Keyword),
- (words(('word1','bool','signed','unsigned','extend','resize',
- 'sizeof','uwconst','swconst','init','self','count','abs','max',
- 'min'), suffix=r'(?![\w$#-])'), Name.Builtin),
- (words(('EX','AX','EF','AF','EG','AG','E','F','O','G','H','X','Y',
- 'Z','A','U','S','V','T','BU','EBF','ABF','EBG','ABG','next',
- 'mod','union','in','xor','xnor'), suffix=r'(?![\w$#-])'),
+ (words(('array', 'of', 'boolean', 'integer', 'real', 'word'),
+ suffix=r'(?![\w$#-])'), Keyword.Type),
+ (words(('case', 'esac'), suffix=r'(?![\w$#-])'), Keyword),
+ (words(('word1', 'bool', 'signed', 'unsigned', 'extend', 'resize',
+ 'sizeof', 'uwconst', 'swconst', 'init', 'self', 'count',
+ 'abs', 'max', 'min'), suffix=r'(?![\w$#-])'),
+ Name.Builtin),
+ (words(('EX', 'AX', 'EF', 'AF', 'EG', 'AG', 'E', 'F', 'O', 'G',
+ 'H', 'X', 'Y', 'Z', 'A', 'U', 'S', 'V', 'T', 'BU', 'EBF',
+ 'ABF', 'EBG', 'ABG', 'next', 'mod', 'union', 'in', 'xor',
+ 'xnor'), suffix=r'(?![\w$#-])'),
Operator.Word),
- (words(('TRUE','FALSE'), suffix=r'(?![\w$#-])'), Keyword.Constant),
+ (words(('TRUE', 'FALSE'), suffix=r'(?![\w$#-])'), Keyword.Constant),
# Names
(r'[a-zA-Z_][\w$#-]*', Name.Variable),
-
+
# Operators
(r':=', Operator),
- (r'[&\|\+\-\*/<>!=]', Operator),
+ (r'[-&|+*/<>!=]', Operator),
# Literals
(r'\-?\d+\b', Number.Integer),
(r'0[su][bB]\d*_[01_]+', Number.Bin),
- (r'0[su][oO]\d*_[01234567_]+', Number.Oct),
+ (r'0[su][oO]\d*_[0-7_]+', Number.Oct),
(r'0[su][dD]\d*_[\d_]+', Number.Dec),
(r'0[su][hH]\d*_[\da-fA-F_]+', Number.Hex),
# Whitespace, punctuation and the rest
(r'\s+', Text.Whitespace),
- (r'[\(\)\[\]\{\};\?:\.,]', Punctuation),
- (r'.', Generic.Error),
- ]
+ (r'[()\[\]{};?:.,]', Punctuation),
+ ],
}
-
diff --git a/pygments/lexers/snobol.py b/pygments/lexers/snobol.py
index e4178f9c..f6e12fd2 100644
--- a/pygments/lexers/snobol.py
+++ b/pygments/lexers/snobol.py
@@ -5,7 +5,7 @@
Lexers for the SNOBOL language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/special.py b/pygments/lexers/special.py
index e66a01cf..6e076b0c 100644
--- a/pygments/lexers/special.py
+++ b/pygments/lexers/special.py
@@ -5,7 +5,7 @@
Special lexers.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/sql.py b/pygments/lexers/sql.py
index e225a66e..7507c0fc 100644
--- a/pygments/lexers/sql.py
+++ b/pygments/lexers/sql.py
@@ -34,7 +34,7 @@
The ``tests/examplefiles`` contains a few test files with data to be
parsed by these lexers.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/stata.py b/pygments/lexers/stata.py
index b2be64d2..a015a23e 100644
--- a/pygments/lexers/stata.py
+++ b/pygments/lexers/stata.py
@@ -5,7 +5,7 @@
Lexer for Stata
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -17,6 +17,7 @@ from pygments.lexers._stata_builtins import builtins_base, builtins_functions
__all__ = ['StataLexer']
+
class StataLexer(RegexLexer):
"""
For `Stata <http://www.stata.com/>`_ do files.
@@ -43,8 +44,8 @@ class StataLexer(RegexLexer):
],
# Global and local macros; regular and special strings
'vars-strings': [
- (r'\$[a-zA-Z_0-9\{]', Name.Variable.Global, 'var_validglobal'),
- (r'`[a-zA-Z_0-9]{0,31}\'', Name.Variable),
+ (r'\$[\w{]', Name.Variable.Global, 'var_validglobal'),
+ (r'`\w{0,31}\'', Name.Variable),
(r'"', String, 'string_dquote'),
(r'`"', String, 'string_mquote'),
],
@@ -54,7 +55,7 @@ class StataLexer(RegexLexer):
(r'\\\\|\\"|\\\n', String.Escape),
(r'\$', Name.Variable.Global, 'var_validglobal'),
(r'`', Name.Variable, 'var_validlocal'),
- (r'[^$\$`"\\]+', String),
+ (r'[^$`"\\]+', String),
(r'[$"\\]', String),
],
'string_mquote': [
@@ -62,14 +63,15 @@ class StataLexer(RegexLexer):
(r'\\\\|\\"|\\\n', String.Escape),
(r'\$', Name.Variable.Global, 'var_validglobal'),
(r'`', Name.Variable, 'var_validlocal'),
- (r'[^$\$`"\\]+', String),
+ (r'[^$`"\\]+', String),
(r'[$"\\]', String),
],
'var_validglobal': [
- (r'\{?[a-zA-Z0-9_]{0,32}\}?', Name.Variable.Global, '#pop'),
+ (r'\{\w{0,32}\}', Name.Variable.Global, '#pop'),
+ (r'\w{1,32}', Name.Variable.Global, '#pop'),
],
'var_validlocal': [
- (r'[a-zA-Z0-9_]{0,31}\'', Name.Variable, '#pop'),
+ (r'\w{0,31}\'', Name.Variable, '#pop'),
],
# * only OK at line start, // OK anywhere
'comments': [
diff --git a/pygments/lexers/supercollider.py b/pygments/lexers/supercollider.py
index 137b753c..40ff0aeb 100644
--- a/pygments/lexers/supercollider.py
+++ b/pygments/lexers/supercollider.py
@@ -5,7 +5,7 @@
Lexer for SuperCollider
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/tcl.py b/pygments/lexers/tcl.py
index 96feb7a8..1d1be033 100644
--- a/pygments/lexers/tcl.py
+++ b/pygments/lexers/tcl.py
@@ -5,7 +5,7 @@
Lexers for Tcl and related languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/templates.py b/pygments/lexers/templates.py
index e6eeaa25..83c57db8 100644
--- a/pygments/lexers/templates.py
+++ b/pygments/lexers/templates.py
@@ -5,7 +5,7 @@
Lexers for various template engines' markup.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -1814,8 +1814,9 @@ class HandlebarsLexer(RegexLexer):
(r'\}\}', Comment.Preproc, '#pop'),
# Handlebars
- (r'([#/]*)(each|if|unless|else|with|log|in)', bygroups(Keyword,
+ (r'([#/]*)(each|if|unless|else|with|log|in(line)?)', bygroups(Keyword,
Keyword)),
+ (r'#\*inline', Keyword),
# General {{#block}}
(r'([#/])([\w-]+)', bygroups(Name.Function, Name.Function)),
@@ -1823,11 +1824,37 @@ class HandlebarsLexer(RegexLexer):
# {{opt=something}}
(r'([\w-]+)(=)', bygroups(Name.Attribute, Operator)),
+ # Partials {{> ...}}
+ (r'(>)(\s*)(@partial-block)', bygroups(Keyword, Text, Keyword)),
+ (r'(#?>)(\s*)([\w-]+)', bygroups(Keyword, Text, Name.Variable)),
+ (r'(>)(\s*)(\()', bygroups(Keyword, Text, Punctuation),
+ 'dynamic-partial'),
+
+ include('generic'),
+ ],
+ 'dynamic-partial': [
+ (r'\s+', Text),
+ (r'\)', Punctuation, '#pop'),
+
+ (r'(lookup)(\s+)(\.|this)(\s+)', bygroups(Keyword, Text,
+ Name.Variable, Text)),
+ (r'(lookup)(\s+)(\S+)', bygroups(Keyword, Text,
+ using(this, state='variable'))),
+ (r'[\w-]+', Name.Function),
+
+ include('generic'),
+ ],
+ 'variable': [
+ (r'[a-zA-Z][\w-]*', Name.Variable),
+ (r'\.[\w-]+', Name.Variable),
+ (r'(this\/|\.\/|(\.\.\/)+)[\w-]+', Name.Variable),
+ ],
+ 'generic': [
+ include('variable'),
+
# borrowed from DjangoLexer
(r':?"(\\\\|\\"|[^"])*"', String.Double),
(r":?'(\\\\|\\'|[^'])*'", String.Single),
- (r'[a-zA-Z][\w-]*', Name.Variable),
- (r'\.[\w-]+', Name.Variable),
(r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|"
r"0[xX][0-9a-fA-F]+[Ll]?", Number),
]
@@ -2175,16 +2202,18 @@ class TwigHtmlLexer(DelegatingLexer):
def __init__(self, **options):
super(TwigHtmlLexer, self).__init__(HtmlLexer, TwigLexer, **options)
-
+
class Angular2Lexer(RegexLexer):
"""
- Generic `angular2 <http://victorsavkin.com/post/119943127151/angular-2-template-syntax>` template lexer.
+ Generic
+ `angular2 <http://victorsavkin.com/post/119943127151/angular-2-template-syntax>`_
+ template lexer.
- Highlights only the Angular template tags (stuff between `{{` and `}}` and
+ Highlights only the Angular template tags (stuff between `{{` and `}}` and
special attributes: '(event)=', '[property]=', '[(twoWayBinding)]=').
Everything else is left for a delegating lexer.
- .. versionadded:: 2.1a0
+ .. versionadded:: 2.1
"""
name = "Angular2"
@@ -2196,37 +2225,39 @@ class Angular2Lexer(RegexLexer):
# {{meal.name}}
(r'(\{\{)(\s*)', bygroups(Comment.Preproc, Text), 'ngExpression'),
-
+
# (click)="deleteOrder()"; [value]="test"; [(twoWayTest)]="foo.bar"
(r'([([]+)([\w:.-]+)([\])]+)(\s*)(=)(\s*)',
- bygroups(Punctuation, Name.Attribute, Punctuation, Text, Operator, Text), 'attr'),
+ bygroups(Punctuation, Name.Attribute, Punctuation, Text, Operator, Text),
+ 'attr'),
(r'([([]+)([\w:.-]+)([\])]+)(\s*)',
bygroups(Punctuation, Name.Attribute, Punctuation, Text)),
-
+
# *ngIf="..."; #f="ngForm"
(r'([*#])([\w:.-]+)(\s*)(=)(\s*)',
bygroups(Punctuation, Name.Attribute, Punctuation, Operator), 'attr'),
(r'([*#])([\w:.-]+)(\s*)',
bygroups(Punctuation, Name.Attribute, Punctuation)),
],
-
+
'ngExpression': [
(r'\s+(\|\s+)?', Text),
(r'\}\}', Comment.Preproc, '#pop'),
-
+
# Literals
(r':?(true|false)', String.Boolean),
(r':?"(\\\\|\\"|[^"])*"', String.Double),
(r":?'(\\\\|\\'|[^'])*'", String.Single),
(r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|"
r"0[xX][0-9a-fA-F]+[Ll]?", Number),
-
+
# Variabletext
(r'[a-zA-Z][\w-]*(\(.*\))?', Name.Variable),
(r'\.[\w-]+(\(.*\))?', Name.Variable),
-
+
# inline If
- (r'(\?)(\s*)([^}\s]+)(\s*)(:)(\s*)([^}\s]+)(\s*)', bygroups(Operator, Text, String, Text, Operator, Text, String, Text)),
+ (r'(\?)(\s*)([^}\s]+)(\s*)(:)(\s*)([^}\s]+)(\s*)',
+ bygroups(Operator, Text, String, Text, Operator, Text, String, Text)),
],
'attr': [
('".*?"', String, '#pop'),
@@ -2249,4 +2280,4 @@ class Angular2HtmlLexer(DelegatingLexer):
filenames = ['*.ng2']
def __init__(self, **options):
- super(Angular2HtmlLexer, self).__init__(HtmlLexer, Angular2Lexer, **options) \ No newline at end of file
+ super(Angular2HtmlLexer, self).__init__(HtmlLexer, Angular2Lexer, **options)
diff --git a/pygments/lexers/testing.py b/pygments/lexers/testing.py
index be8b6f71..1e0795b1 100644
--- a/pygments/lexers/testing.py
+++ b/pygments/lexers/testing.py
@@ -5,7 +5,7 @@
Lexers for testing languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/text.py b/pygments/lexers/text.py
index 4bec5ec8..9b3b5fea 100644
--- a/pygments/lexers/text.py
+++ b/pygments/lexers/text.py
@@ -5,7 +5,7 @@
Lexers for non-source code file types.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/textedit.py b/pygments/lexers/textedit.py
index 89417216..e8856dbd 100644
--- a/pygments/lexers/textedit.py
+++ b/pygments/lexers/textedit.py
@@ -5,7 +5,7 @@
Lexers for languages related to text processing.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/textfmts.py b/pygments/lexers/textfmts.py
index cab9add5..bb8124ef 100644
--- a/pygments/lexers/textfmts.py
+++ b/pygments/lexers/textfmts.py
@@ -5,7 +5,7 @@
Lexers for various text formats.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/theorem.py b/pygments/lexers/theorem.py
index 6f16d030..e84a398b 100644
--- a/pygments/lexers/theorem.py
+++ b/pygments/lexers/theorem.py
@@ -5,7 +5,7 @@
Lexers for theorem-proving languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/trafficscript.py b/pygments/lexers/trafficscript.py
index 03ab6a06..42542280 100644
--- a/pygments/lexers/trafficscript.py
+++ b/pygments/lexers/trafficscript.py
@@ -5,7 +5,7 @@
Lexer for RiverBed's TrafficScript (RTS) language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/typoscript.py b/pygments/lexers/typoscript.py
index 407847ed..e358af07 100644
--- a/pygments/lexers/typoscript.py
+++ b/pygments/lexers/typoscript.py
@@ -14,17 +14,15 @@
`TypoScriptHtmlDataLexer`
Lexer that highlights markers, constants and registers within html tags.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, bygroups, using
-from pygments.token import Keyword, Text, Comment, Name, String, Number, \
+from pygments.token import Text, Comment, Name, String, Number, \
Operator, Punctuation
-from pygments.lexer import DelegatingLexer
-from pygments.lexers.web import HtmlLexer, CssLexer
__all__ = ['TypoScriptLexer', 'TypoScriptCssDataLexer', 'TypoScriptHtmlDataLexer']
@@ -115,6 +113,9 @@ class TypoScriptLexer(RegexLexer):
flags = re.DOTALL | re.MULTILINE
+ # Slightly higher than TypeScript (which is 0).
+ priority = 0.1
+
tokens = {
'root': [
include('comment'),
@@ -168,14 +169,14 @@ class TypoScriptLexer(RegexLexer):
'whitespace': [
(r'\s+', Text),
],
- 'html':[
+ 'html': [
(r'<\S[^\n>]*>', using(TypoScriptHtmlDataLexer)),
(r'&[^;\n]*;', String),
(r'(_CSS_DEFAULT_STYLE)(\s*)(\()(?s)(.*(?=\n\)))',
- bygroups(Name.Class, Text, String.Symbol, using(TypoScriptCssDataLexer))),
+ bygroups(Name.Class, Text, String.Symbol, using(TypoScriptCssDataLexer))),
],
'literal': [
- (r'0x[0-9A-Fa-f]+t?',Number.Hex),
+ (r'0x[0-9A-Fa-f]+t?', Number.Hex),
# (r'[0-9]*\.[0-9]+([eE][0-9]+)?[fd]?\s*(?:[^=])', Number.Float),
(r'[0-9]+', Number.Integer),
(r'(###\w+###)', Name.Constant),
diff --git a/pygments/lexers/urbi.py b/pygments/lexers/urbi.py
index 558a21fb..7aaba90c 100644
--- a/pygments/lexers/urbi.py
+++ b/pygments/lexers/urbi.py
@@ -5,7 +5,7 @@
Lexers for UrbiScript language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/varnish.py b/pygments/lexers/varnish.py
index de8e598b..44521422 100644
--- a/pygments/lexers/varnish.py
+++ b/pygments/lexers/varnish.py
@@ -5,7 +5,7 @@
Lexers for Varnish configuration
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -121,13 +121,13 @@ class VCLLexer(RegexLexer):
r'(\s*\(.*\))',
bygroups(Name.Function, Punctuation, Name.Function, using(this))),
('[a-zA-Z_]\w*', Name),
- ],
+ ],
'comment': [
(r'[^*/]+', Comment.Multiline),
(r'/\*', Comment.Multiline, '#push'),
(r'\*/', Comment.Multiline, '#pop'),
(r'[*/]', Comment.Multiline),
- ],
+ ],
'comments': [
(r'#.*$', Comment),
(r'/\*', Comment.Multiline, 'comment'),
diff --git a/pygments/lexers/verification.py b/pygments/lexers/verification.py
index 3e77e04a..5322e17f 100644
--- a/pygments/lexers/verification.py
+++ b/pygments/lexers/verification.py
@@ -5,7 +5,7 @@
Lexer for Intermediate Verification Languages (IVLs).
- :copyright: Copyright 2006-2016 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -69,7 +69,7 @@ class SilverLexer(RegexLexer):
"""
name = 'Silver'
aliases = ['silver']
- filenames = ['*.sil']
+ filenames = ['*.sil', '*.vpr']
tokens = {
'root': [
@@ -89,7 +89,7 @@ class SilverLexer(RegexLexer):
'constraining', 'Seq', 'Set', 'Multiset', 'union', 'intersection',
'setminus', 'subset', 'unfolding', 'in', 'old', 'forall', 'exists',
'acc', 'wildcard', 'write', 'none', 'epsilon', 'perm', 'unique',
- 'apply', 'package', 'folding', 'label'),
+ 'apply', 'package', 'folding', 'label', 'forperm'),
suffix=r'\b'), Keyword),
(words(('Int', 'Perm', 'Bool', 'Ref'), suffix=r'\b'), Keyword.Type),
include('numbers'),
diff --git a/pygments/lexers/web.py b/pygments/lexers/web.py
index 59fbf2fc..6e9c4f92 100644
--- a/pygments/lexers/web.py
+++ b/pygments/lexers/web.py
@@ -5,7 +5,7 @@
Just export previously exported lexers.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/lexers/webmisc.py b/pygments/lexers/webmisc.py
index 551846c2..712c8246 100644
--- a/pygments/lexers/webmisc.py
+++ b/pygments/lexers/webmisc.py
@@ -5,7 +5,7 @@
Lexers for misc. web stuff.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -358,8 +358,10 @@ class XQueryLexer(ExtendedRegexLexer):
bygroups(Keyword, Text, Keyword), 'itemtype'),
(r'(treat)(\s+)(as)\b',
bygroups(Keyword, Text, Keyword), 'itemtype'),
- (r'(case)(\s+)(' + stringdouble + ')', bygroups(Keyword, Text, String.Double), 'itemtype'),
- (r'(case)(\s+)(' + stringsingle + ')', bygroups(Keyword, Text, String.Single), 'itemtype'),
+ (r'(case)(\s+)(' + stringdouble + ')',
+ bygroups(Keyword, Text, String.Double), 'itemtype'),
+ (r'(case)(\s+)(' + stringsingle + ')',
+ bygroups(Keyword, Text, String.Single), 'itemtype'),
(r'(case|as)\b', Keyword, 'itemtype'),
(r'(\))(\s*)(as)',
bygroups(Punctuation, Text, Keyword), 'itemtype'),
@@ -367,7 +369,8 @@ class XQueryLexer(ExtendedRegexLexer):
(r'(for|let|previous|next)(\s+)(\$)',
bygroups(Keyword, Text, Name.Variable), 'varname'),
(r'(for)(\s+)(tumbling|sliding)(\s+)(window)(\s+)(\$)',
- bygroups(Keyword, Text, Keyword, Text, Keyword, Text, Name.Variable), 'varname'),
+ bygroups(Keyword, Text, Keyword, Text, Keyword, Text, Name.Variable),
+ 'varname'),
# (r'\)|\?|\]', Punctuation, '#push'),
(r'\)|\?|\]', Punctuation),
(r'(empty)(\s+)(greatest|least)', bygroups(Keyword, Text, Keyword)),
@@ -417,17 +420,21 @@ class XQueryLexer(ExtendedRegexLexer):
(r'preserve|no-preserve', Keyword),
(r',', Punctuation),
],
- 'annotationname':[
+ 'annotationname': [
(r'\(:', Comment, 'comment'),
(qname, Name.Decorator),
(r'(\()(' + stringdouble + ')', bygroups(Punctuation, String.Double)),
(r'(\()(' + stringsingle + ')', bygroups(Punctuation, String.Single)),
- (r'(\,)(\s+)(' + stringdouble + ')', bygroups(Punctuation, Text, String.Double)),
- (r'(\,)(\s+)(' + stringsingle + ')', bygroups(Punctuation, Text, String.Single)),
+ (r'(\,)(\s+)(' + stringdouble + ')',
+ bygroups(Punctuation, Text, String.Double)),
+ (r'(\,)(\s+)(' + stringsingle + ')',
+ bygroups(Punctuation, Text, String.Single)),
(r'\)', Punctuation),
(r'(\s+)(\%)', bygroups(Text, Name.Decorator), 'annotationname'),
- (r'(\s+)(variable)(\s+)(\$)', bygroups(Text, Keyword.Declaration, Text, Name.Variable), 'varname'),
- (r'(\s+)(function)(\s+)', bygroups(Text, Keyword.Declaration, Text), 'root')
+ (r'(\s+)(variable)(\s+)(\$)',
+ bygroups(Text, Keyword.Declaration, Text, Name.Variable), 'varname'),
+ (r'(\s+)(function)(\s+)',
+ bygroups(Text, Keyword.Declaration, Text), 'root')
],
'varname': [
(r'\(:', Comment, 'comment'),
@@ -473,8 +480,10 @@ class XQueryLexer(ExtendedRegexLexer):
bygroups(Keyword, Text, Keyword), 'singletype'),
(r'(treat)(\s+)(as)', bygroups(Keyword, Text, Keyword)),
(r'(instance)(\s+)(of)', bygroups(Keyword, Text, Keyword)),
- (r'(case)(\s+)(' + stringdouble + ')', bygroups(Keyword, Text, String.Double), 'itemtype'),
- (r'(case)(\s+)(' + stringsingle + ')', bygroups(Keyword, Text, String.Single), 'itemtype'),
+ (r'(case)(\s+)(' + stringdouble + ')',
+ bygroups(Keyword, Text, String.Double), 'itemtype'),
+ (r'(case)(\s+)(' + stringsingle + ')',
+ bygroups(Keyword, Text, String.Single), 'itemtype'),
(r'case|as', Keyword, 'itemtype'),
(r'(\))(\s*)(as)', bygroups(Operator, Text, Keyword), 'itemtype'),
(ncname + r':\*', Keyword.Type, 'operator'),
diff --git a/pygments/lexers/whiley.py b/pygments/lexers/whiley.py
index 0795a030..0d0e8ab8 100644
--- a/pygments/lexers/whiley.py
+++ b/pygments/lexers/whiley.py
@@ -5,7 +5,7 @@
Lexers for the Whiley language.
- :copyright: Copyright 2006-2016 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -19,6 +19,8 @@ __all__ = ['WhileyLexer']
class WhileyLexer(RegexLexer):
"""
Lexer for the Whiley programming language.
+
+ .. versionadded:: 2.2
"""
name = 'Whiley'
filenames = ['*.whiley']
@@ -47,12 +49,10 @@ class WhileyLexer(RegexLexer):
'requires', 'ensures', 'where', 'assert', 'assume',
'all', 'no', 'some', 'in', 'is', 'new',
'throw', 'try', 'catch', 'debug', 'skip', 'fail',
- 'finite', 'total',
- ), suffix=r'\b'), Keyword.Reserved),
+ 'finite', 'total'), suffix=r'\b'), Keyword.Reserved),
(words((
'function', 'method', 'public', 'private', 'protected',
- 'export', 'native',
- ), suffix=r'\b'), Keyword.Declaration),
+ 'export', 'native'), suffix=r'\b'), Keyword.Declaration),
# "constant" & "type" are not keywords unless used in declarations
(r'(constant|type)(\s+)([a-zA-Z_]\w*)(\s+)(is)\b',
bygroups(Keyword.Declaration, Text, Name, Text, Keyword.Reserved)),
@@ -73,8 +73,7 @@ class WhileyLexer(RegexLexer):
'uint', 'nat',
# whiley.lang.Any
- 'toString',
- ), suffix=r'\b'), Name.Builtin),
+ 'toString'), suffix=r'\b'), Name.Builtin),
# byte literal
(r'[01]+b', Number.Bin),
@@ -99,7 +98,7 @@ class WhileyLexer(RegexLexer):
# operators and punctuation
(r'[{}()\[\],.;]', Punctuation),
(u'[+\\-*/%&|<>^!~@=:?'
- # unicode operators
+ # unicode operators
u'\u2200\u2203\u2205\u2282\u2286\u2283\u2287'
u'\u222A\u2229\u2264\u2265\u2208\u2227\u2228'
u']', Operator),
diff --git a/pygments/lexers/x10.py b/pygments/lexers/x10.py
index ea75ab71..1c63326d 100644
--- a/pygments/lexers/x10.py
+++ b/pygments/lexers/x10.py
@@ -5,7 +5,7 @@
Lexers for the X10 programming language.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/modeline.py b/pygments/modeline.py
index 2200f1cf..9f8d5dab 100644
--- a/pygments/modeline.py
+++ b/pygments/modeline.py
@@ -5,7 +5,7 @@
A simple modeline parser (based on pymodeline).
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -35,9 +35,10 @@ def get_filetype_from_buffer(buf, max_lines=5):
ret = get_filetype_from_line(l)
if ret:
return ret
- for l in lines[max_lines:-1:-1]:
- ret = get_filetype_from_line(l)
- if ret:
- return ret
+ for i in range(max_lines, -1, -1):
+ if i < len(lines):
+ ret = get_filetype_from_line(lines[i])
+ if ret:
+ return ret
return None
diff --git a/pygments/plugin.py b/pygments/plugin.py
index f9ea0890..7987d646 100644
--- a/pygments/plugin.py
+++ b/pygments/plugin.py
@@ -32,43 +32,37 @@
yourfilter = yourfilter:YourFilter
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
-try:
- import pkg_resources
-except ImportError:
- pkg_resources = None
-
LEXER_ENTRY_POINT = 'pygments.lexers'
FORMATTER_ENTRY_POINT = 'pygments.formatters'
STYLE_ENTRY_POINT = 'pygments.styles'
FILTER_ENTRY_POINT = 'pygments.filters'
+def iter_entry_points(group_name):
+ try:
+ import pkg_resources
+ except ImportError:
+ return []
+
+ return pkg_resources.iter_entry_points(group_name)
def find_plugin_lexers():
- if pkg_resources is None:
- return
- for entrypoint in pkg_resources.iter_entry_points(LEXER_ENTRY_POINT):
+ for entrypoint in iter_entry_points(LEXER_ENTRY_POINT):
yield entrypoint.load()
def find_plugin_formatters():
- if pkg_resources is None:
- return
- for entrypoint in pkg_resources.iter_entry_points(FORMATTER_ENTRY_POINT):
+ for entrypoint in iter_entry_points(FORMATTER_ENTRY_POINT):
yield entrypoint.name, entrypoint.load()
def find_plugin_styles():
- if pkg_resources is None:
- return
- for entrypoint in pkg_resources.iter_entry_points(STYLE_ENTRY_POINT):
+ for entrypoint in iter_entry_points(STYLE_ENTRY_POINT):
yield entrypoint.name, entrypoint.load()
def find_plugin_filters():
- if pkg_resources is None:
- return
- for entrypoint in pkg_resources.iter_entry_points(FILTER_ENTRY_POINT):
+ for entrypoint in iter_entry_points(FILTER_ENTRY_POINT):
yield entrypoint.name, entrypoint.load()
diff --git a/pygments/regexopt.py b/pygments/regexopt.py
index 047c703f..dcfae2fd 100644
--- a/pygments/regexopt.py
+++ b/pygments/regexopt.py
@@ -6,7 +6,7 @@
An algorithm that generates optimized regexes for matching long lists of
literal strings.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/scanner.py b/pygments/scanner.py
index 3ff11e4a..3350ac8e 100644
--- a/pygments/scanner.py
+++ b/pygments/scanner.py
@@ -12,7 +12,7 @@
Have a look at the `DelphiLexer` to get an idea of how to use
this scanner.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
diff --git a/pygments/sphinxext.py b/pygments/sphinxext.py
index de8cd73b..f962f8c6 100644
--- a/pygments/sphinxext.py
+++ b/pygments/sphinxext.py
@@ -6,7 +6,7 @@
Sphinx extension to generate automatic documentation of lexers,
formatters and filters.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/style.py b/pygments/style.py
index 68ee3a19..879c4e05 100644
--- a/pygments/style.py
+++ b/pygments/style.py
@@ -5,7 +5,7 @@
Basic style object.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/__init__.py b/pygments/styles/__init__.py
index 4efd196e..839a9b78 100644
--- a/pygments/styles/__init__.py
+++ b/pygments/styles/__init__.py
@@ -5,7 +5,7 @@
Contains built-in styles.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -41,7 +41,9 @@ STYLE_MAP = {
'lovelace': 'lovelace::LovelaceStyle',
'algol': 'algol::AlgolStyle',
'algol_nu': 'algol_nu::Algol_NuStyle',
- 'arduino': 'arduino::ArduinoStyle'
+ 'arduino': 'arduino::ArduinoStyle',
+ 'rainbow_dash': 'rainbow_dash::RainbowDashStyle',
+ 'abap': 'abap::AbapStyle',
}
diff --git a/pygments/styles/abap.py b/pygments/styles/abap.py
new file mode 100644
index 00000000..91286a3a
--- /dev/null
+++ b/pygments/styles/abap.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.styles.abap
+ ~~~~~~~~~~~~~~~~~~~~
+
+ ABAP workbench like style.
+
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+from pygments.style import Style
+from pygments.token import Keyword, Name, Comment, String, Error, \
+ Number, Operator
+
+
+class AbapStyle(Style):
+ default_style = ""
+ styles = {
+ Comment: 'italic #888',
+ Comment.Special: '#888',
+ Keyword: '#00f',
+ Operator.Word: '#00f',
+ Name: '#000',
+ Number: '#3af',
+ String: '#5a2',
+
+ Error: '#F00',
+ }
diff --git a/pygments/styles/algol.py b/pygments/styles/algol.py
index a8726009..16461e0b 100644
--- a/pygments/styles/algol.py
+++ b/pygments/styles/algol.py
@@ -26,7 +26,7 @@
[1] `Revised Report on the Algorithmic Language Algol-60 <http://www.masswerk.at/algol60/report.htm>`
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/algol_nu.py b/pygments/styles/algol_nu.py
index 392838f2..366ae215 100644
--- a/pygments/styles/algol_nu.py
+++ b/pygments/styles/algol_nu.py
@@ -26,7 +26,7 @@
[1] `Revised Report on the Algorithmic Language Algol-60 <http://www.masswerk.at/algol60/report.htm>`
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/arduino.py b/pygments/styles/arduino.py
index 1bf2103c..57e3809e 100644
--- a/pygments/styles/arduino.py
+++ b/pygments/styles/arduino.py
@@ -5,7 +5,7 @@
Arduino® Syntax highlighting style.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/autumn.py b/pygments/styles/autumn.py
index 2040659e..71b93b1e 100644
--- a/pygments/styles/autumn.py
+++ b/pygments/styles/autumn.py
@@ -5,7 +5,7 @@
A colorful style, inspired by the terminal highlighting style.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/borland.py b/pygments/styles/borland.py
index 2b1f4ca9..0d13d1aa 100644
--- a/pygments/styles/borland.py
+++ b/pygments/styles/borland.py
@@ -5,7 +5,7 @@
Style similar to the style used in the Borland IDEs.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/bw.py b/pygments/styles/bw.py
index 56d78bd6..f0a6b148 100644
--- a/pygments/styles/bw.py
+++ b/pygments/styles/bw.py
@@ -5,7 +5,7 @@
Simple black/white only style.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/colorful.py b/pygments/styles/colorful.py
index ebedc02f..bfc0b502 100644
--- a/pygments/styles/colorful.py
+++ b/pygments/styles/colorful.py
@@ -5,7 +5,7 @@
A colorful style, inspired by CodeRay.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/default.py b/pygments/styles/default.py
index df99768c..6b9bd446 100644
--- a/pygments/styles/default.py
+++ b/pygments/styles/default.py
@@ -5,7 +5,7 @@
The default highlighting style.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/emacs.py b/pygments/styles/emacs.py
index 27ae19ad..af15f30d 100644
--- a/pygments/styles/emacs.py
+++ b/pygments/styles/emacs.py
@@ -5,7 +5,7 @@
A highlighting style for Pygments, inspired by Emacs.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/friendly.py b/pygments/styles/friendly.py
index d5256a4b..b2d1c0ce 100644
--- a/pygments/styles/friendly.py
+++ b/pygments/styles/friendly.py
@@ -5,7 +5,7 @@
A modern style based on the VIM pyte theme.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/fruity.py b/pygments/styles/fruity.py
index 99bbae6f..1bbe0316 100644
--- a/pygments/styles/fruity.py
+++ b/pygments/styles/fruity.py
@@ -5,7 +5,7 @@
pygments version of my "fruity" vim theme.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/igor.py b/pygments/styles/igor.py
index 8f552709..d4620a42 100644
--- a/pygments/styles/igor.py
+++ b/pygments/styles/igor.py
@@ -5,7 +5,7 @@
Igor Pro default style.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/lovelace.py b/pygments/styles/lovelace.py
index 236dde9b..861f778d 100644
--- a/pygments/styles/lovelace.py
+++ b/pygments/styles/lovelace.py
@@ -9,7 +9,7 @@
A desaturated, somewhat subdued style created for the Lovelace interactive
learning environment.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/manni.py b/pygments/styles/manni.py
index dd09f263..f0a325af 100644
--- a/pygments/styles/manni.py
+++ b/pygments/styles/manni.py
@@ -8,7 +8,7 @@
This is a port of the style used in the `php port`_ of pygments
by Manni. The style is called 'default' there.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/monokai.py b/pygments/styles/monokai.py
index 9c2a0a87..337e2f89 100644
--- a/pygments/styles/monokai.py
+++ b/pygments/styles/monokai.py
@@ -7,7 +7,7 @@
http://www.monokai.nl/blog/2006/07/15/textmate-color-theme/
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/murphy.py b/pygments/styles/murphy.py
index 1f83cb26..c8270065 100644
--- a/pygments/styles/murphy.py
+++ b/pygments/styles/murphy.py
@@ -5,7 +5,7 @@
Murphy's style from CodeRay.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/native.py b/pygments/styles/native.py
index 33ea3c17..921a58d9 100644
--- a/pygments/styles/native.py
+++ b/pygments/styles/native.py
@@ -5,7 +5,7 @@
pygments version of my "native" vim theme.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/paraiso_dark.py b/pygments/styles/paraiso_dark.py
index f906f87d..5f334bb9 100644
--- a/pygments/styles/paraiso_dark.py
+++ b/pygments/styles/paraiso_dark.py
@@ -9,7 +9,7 @@
Created with Base16 Builder by Chris Kempson
(https://github.com/chriskempson/base16-builder).
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/paraiso_light.py b/pygments/styles/paraiso_light.py
index 5424d122..a8112819 100644
--- a/pygments/styles/paraiso_light.py
+++ b/pygments/styles/paraiso_light.py
@@ -9,7 +9,7 @@
Created with Base16 Builder by Chris Kempson
(https://github.com/chriskempson/base16-builder).
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/pastie.py b/pygments/styles/pastie.py
index f65940be..d6142908 100644
--- a/pygments/styles/pastie.py
+++ b/pygments/styles/pastie.py
@@ -7,7 +7,7 @@
.. _pastie: http://pastie.caboo.se/
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/perldoc.py b/pygments/styles/perldoc.py
index eae6170d..24af2df6 100644
--- a/pygments/styles/perldoc.py
+++ b/pygments/styles/perldoc.py
@@ -7,7 +7,7 @@
.. _perldoc: http://perldoc.perl.org/
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/rainbow_dash.py b/pygments/styles/rainbow_dash.py
new file mode 100644
index 00000000..7cf5c9d7
--- /dev/null
+++ b/pygments/styles/rainbow_dash.py
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.styles.rainbow_dash
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ A bright and colorful syntax highlighting `theme`.
+
+ .. _theme: http://sanssecours.github.io/Rainbow-Dash.tmbundle
+
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+from pygments.style import Style
+from pygments.token import (Comment, Error, Generic, Name, Number, Operator,
+ String, Text, Whitespace, Keyword)
+
+BLUE_LIGHT = '#0080ff'
+BLUE = '#2c5dcd'
+GREEN = '#00cc66'
+GREEN_LIGHT = '#ccffcc'
+GREEN_NEON = '#00cc00'
+GREY = '#aaaaaa'
+GREY_LIGHT = '#cbcbcb'
+GREY_DARK = '#4d4d4d'
+PURPLE = '#5918bb'
+RED = '#cc0000'
+RED_DARK = '#c5060b'
+RED_LIGHT = '#ffcccc'
+RED_BRIGHT = '#ff0000'
+WHITE = '#ffffff'
+TURQUOISE = '#318495'
+ORANGE = '#ff8000'
+
+
+class RainbowDashStyle(Style):
+ """
+ A bright and colorful syntax highlighting theme.
+ """
+
+ background_color = WHITE
+
+ styles = {
+ Comment: 'italic {}'.format(BLUE_LIGHT),
+ Comment.Preproc: 'noitalic',
+ Comment.Special: 'bold',
+
+ Error: 'bg:{} {}'.format(RED, WHITE),
+
+ Generic.Deleted: 'border:{} bg:{}'.format(RED_DARK, RED_LIGHT),
+ Generic.Emph: 'italic',
+ Generic.Error: RED_BRIGHT,
+ Generic.Heading: 'bold {}'.format(BLUE),
+ Generic.Inserted: 'border:{} bg:{}'.format(GREEN_NEON, GREEN_LIGHT),
+ Generic.Output: GREY,
+ Generic.Prompt: 'bold {}'.format(BLUE),
+ Generic.Strong: 'bold',
+ Generic.Subheading: 'bold {}'.format(BLUE),
+ Generic.Traceback: RED_DARK,
+
+ Keyword: 'bold {}'.format(BLUE),
+ Keyword.Pseudo: 'nobold',
+ Keyword.Type: PURPLE,
+
+ Name.Attribute: 'italic {}'.format(BLUE),
+ Name.Builtin: 'bold {}'.format(PURPLE),
+ Name.Class: 'underline',
+ Name.Constant: TURQUOISE,
+ Name.Decorator: 'bold {}'.format(ORANGE),
+ Name.Entity: 'bold {}'.format(PURPLE),
+ Name.Exception: 'bold {}'.format(PURPLE),
+ Name.Function: 'bold {}'.format(ORANGE),
+ Name.Tag: 'bold {}'.format(BLUE),
+
+ Number: 'bold {}'.format(PURPLE),
+
+ Operator: BLUE,
+ Operator.Word: 'bold',
+
+ String: GREEN,
+ String.Doc: 'italic',
+ String.Escape: 'bold {}'.format(RED_DARK),
+ String.Other: TURQUOISE,
+ String.Symbol: 'bold {}'.format(RED_DARK),
+
+ Text: GREY_DARK,
+
+ Whitespace: GREY_LIGHT
+ }
diff --git a/pygments/styles/rrt.py b/pygments/styles/rrt.py
index 342c9fc6..96f9490c 100644
--- a/pygments/styles/rrt.py
+++ b/pygments/styles/rrt.py
@@ -5,7 +5,7 @@
pygments "rrt" theme, based on Zap and Emacs defaults.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/sas.py b/pygments/styles/sas.py
index 8b7fc56e..78686fc2 100644
--- a/pygments/styles/sas.py
+++ b/pygments/styles/sas.py
@@ -6,6 +6,9 @@
Style inspired by SAS' enhanced program editor. Note This is not
meant to be a complete style. It's merely meant to mimic SAS'
program editor syntax highlighting.
+
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
"""
from pygments.style import Style
diff --git a/pygments/styles/stata.py b/pygments/styles/stata.py
index 2d8abb7e..2b5f5edd 100644
--- a/pygments/styles/stata.py
+++ b/pygments/styles/stata.py
@@ -6,6 +6,9 @@
Style inspired by Stata's do-file editor. Note this is not meant
to be a complete style. It's merely meant to mimic Stata's do file
editor syntax highlighting.
+
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
"""
from pygments.style import Style
diff --git a/pygments/styles/tango.py b/pygments/styles/tango.py
index c65850bd..2abc8c61 100644
--- a/pygments/styles/tango.py
+++ b/pygments/styles/tango.py
@@ -33,7 +33,7 @@
have been chosen to have the same style. Similarly, keywords (Keyword.*),
and Operator.Word (and, or, in) have been assigned the same style.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/trac.py b/pygments/styles/trac.py
index bf36ce03..aff39fd4 100644
--- a/pygments/styles/trac.py
+++ b/pygments/styles/trac.py
@@ -5,7 +5,7 @@
Port of the default trac highlighter design.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/vim.py b/pygments/styles/vim.py
index 383fd8f0..888088b1 100644
--- a/pygments/styles/vim.py
+++ b/pygments/styles/vim.py
@@ -5,7 +5,7 @@
A highlighting style for Pygments, inspired by vim.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/vs.py b/pygments/styles/vs.py
index 78efc547..bc3ed2b5 100644
--- a/pygments/styles/vs.py
+++ b/pygments/styles/vs.py
@@ -5,7 +5,7 @@
Simple style with MS Visual Studio colors.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/styles/xcode.py b/pygments/styles/xcode.py
index 3dc9240d..64bfcf03 100644
--- a/pygments/styles/xcode.py
+++ b/pygments/styles/xcode.py
@@ -5,7 +5,7 @@
Style similar to the `Xcode` default theme.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/token.py b/pygments/token.py
index fbd5b805..43f73c85 100644
--- a/pygments/token.py
+++ b/pygments/token.py
@@ -5,7 +5,7 @@
Basic token types and the standard tokens.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/unistring.py b/pygments/unistring.py
index 49a2819a..6096d110 100644
--- a/pygments/unistring.py
+++ b/pygments/unistring.py
@@ -8,7 +8,7 @@
Inspired by chartypes_create.py from the MoinMoin project.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/pygments/util.py b/pygments/util.py
index 07b662d0..45070063 100644
--- a/pygments/util.py
+++ b/pygments/util.py
@@ -5,7 +5,7 @@
Utility functions.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -14,7 +14,7 @@ import sys
split_path_re = re.compile(r'[/\\ ]')
-doctype_lookup_re = re.compile(r'''(?smx)
+doctype_lookup_re = re.compile(r'''
(<\?.*?\?>)?\s*
<!DOCTYPE\s+(
[a-zA-Z_][a-zA-Z0-9]*
@@ -23,8 +23,9 @@ doctype_lookup_re = re.compile(r'''(?smx)
"[^"]*")?
)
[^>]*>
-''')
-tag_re = re.compile(r'<(.+?)(\s.*?)?>.*?</.+?>(?uism)')
+''', re.DOTALL | re.MULTILINE | re.VERBOSE)
+tag_re = re.compile(r'<(.+?)(\s.*?)?>.*?</.+?>',
+ re.UNICODE | re.IGNORECASE | re.DOTALL | re.MULTILINE)
xml_decl_re = re.compile(r'\s*<\?xml[^>]*\?>', re.I)
diff --git a/scripts/check_sources.py b/scripts/check_sources.py
index 4f5926f6..db09de42 100755
--- a/scripts/check_sources.py
+++ b/scripts/check_sources.py
@@ -7,7 +7,7 @@
Make sure each Python file has a correct file header
including copyright and license information.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -36,7 +36,7 @@ def checker(*suffixes, **kwds):
name_mail_re = r'[\w ]+(<.*?>)?'
-copyright_re = re.compile(r'^ :copyright: Copyright 2006-2015 by '
+copyright_re = re.compile(r'^ :copyright: Copyright 2006-2017 by '
r'the Pygments team, see AUTHORS\.$', re.UNICODE)
copyright_2_re = re.compile(r'^ %s(, %s)*[,.]$' %
(name_mail_re, name_mail_re), re.UNICODE)
diff --git a/scripts/debug_lexer.py b/scripts/debug_lexer.py
index 4b7db41a..02bb9fef 100755
--- a/scripts/debug_lexer.py
+++ b/scripts/debug_lexer.py
@@ -8,7 +8,7 @@
the text where Error tokens are being generated, along
with some context.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/scripts/get_vimkw.py b/scripts/get_vimkw.py
index 45652740..688a0c64 100644
--- a/scripts/get_vimkw.py
+++ b/scripts/get_vimkw.py
@@ -16,7 +16,7 @@ HEADER = '''\
This file is autogenerated by scripts/get_vimkw.py
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/setup.cfg b/setup.cfg
index 17eb2173..961eb6d4 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -3,8 +3,8 @@ tag_build = dev
tag_date = true
[aliases]
-release = egg_info -RDb ''
+release = egg_info -Db ''
upload = upload --sign --identity=36580288
[bdist_wheel]
-universal = 1 \ No newline at end of file
+universal = 1
diff --git a/setup.py b/setup.py
index 6442fd10..1705923c 100755
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@
formats that PIL supports and ANSI sequences
* it is usable as a command-line tool and as a library
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -48,7 +48,7 @@ else:
setup(
name = 'Pygments',
- version = '2.2',
+ version = '2.2.0',
url = 'http://pygments.org/',
license = 'BSD License',
author = 'Georg Brandl',
@@ -56,7 +56,7 @@ setup(
description = 'Pygments is a syntax highlighting package written in Python.',
long_description = __doc__,
keywords = 'syntax highlighting',
- packages = find_packages(exclude=['ez_setup']),
+ packages = find_packages(),
platforms = 'any',
zip_safe = False,
include_package_data = True,
diff --git a/tests/examplefiles/demo.hbs b/tests/examplefiles/demo.hbs
index 1b9ed5a7..ae80cc1b 100644
--- a/tests/examplefiles/demo.hbs
+++ b/tests/examplefiles/demo.hbs
@@ -10,3 +10,25 @@
{{else}}
<button {{action expand}}>Show More...</button>
{{/if}}
+
+{{> myPartial}}
+{{> myPartial var="value" }}
+{{> myPartial var=../value}}
+{{> (myPartial)}}
+{{> (myPartial) var="value"}}
+{{> (lookup . "myPartial")}}
+{{> ( lookup . "myPartial" ) var="value" }}
+{{> (lookup ../foo "myPartial") var="value" }}
+{{> @partial-block}}
+
+{{#>myPartial}}
+...
+{{/myPartial}}
+
+{{#*inline "myPartial"}}
+...
+{{/inline}}
+
+{{../name}}
+{{./name}}
+{{this/name}}
diff --git a/tests/examplefiles/example.hs b/tests/examplefiles/example.hs
index f5e2b555..764cab77 100644
--- a/tests/examplefiles/example.hs
+++ b/tests/examplefiles/example.hs
@@ -29,3 +29,13 @@ data ĈrazyThings =
-- some char literals:
charl = ['"', 'a', '\ESC', '\'', ' ']
+
+-- closed type families
+type family Fam (a :: Type) = r :: Type where
+ Fam Int = True
+ Fam a = False
+
+-- type literals
+type IntChar = '[Int, Char]
+type Falsy = 'False
+type Falsy = '(10, 20, 30)
diff --git a/tests/run.py b/tests/run.py
index 8167b911..07665b2a 100644
--- a/tests/run.py
+++ b/tests/run.py
@@ -8,7 +8,7 @@
python run.py [testfile ...]
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/string_asserts.py b/tests/string_asserts.py
index 11f5c7f0..05e95e6a 100644
--- a/tests/string_asserts.py
+++ b/tests/string_asserts.py
@@ -3,7 +3,7 @@
Pygments string assert utility
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/support/empty.py b/tests/support/empty.py
new file mode 100644
index 00000000..40a96afc
--- /dev/null
+++ b/tests/support/empty.py
@@ -0,0 +1 @@
+# -*- coding: utf-8 -*-
diff --git a/tests/support/html_formatter.py b/tests/support/html_formatter.py
new file mode 100644
index 00000000..169cd4af
--- /dev/null
+++ b/tests/support/html_formatter.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+from pygments.formatters import HtmlFormatter
+
+
+class HtmlFormatterWrapper(HtmlFormatter):
+ name = 'HtmlWrapper'
diff --git a/tests/support/python_lexer.py b/tests/support/python_lexer.py
new file mode 100644
index 00000000..565ee674
--- /dev/null
+++ b/tests/support/python_lexer.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# pygments.lexers.python (as CustomLexer) for test_cmdline.py
+
+from pygments.lexers import PythonLexer
+
+
+class CustomLexer(PythonLexer):
+ name = 'PythonLexerWrapper'
+
+
+class LexerWrapper(CustomLexer):
+ name = 'PythonLexerWrapperWrapper'
diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py
index 022e6c55..ac3b4a51 100644
--- a/tests/test_basic_api.py
+++ b/tests/test_basic_api.py
@@ -3,7 +3,7 @@
Pygments basic API tests
~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -161,8 +161,8 @@ def test_formatter_public_api():
try:
inst = formatter(opt1="val1")
- except (ImportError, FontNotFound):
- raise support.SkipTest
+ except (ImportError, FontNotFound) as e:
+ raise support.SkipTest(e)
try:
inst.get_style_defs()
@@ -209,9 +209,9 @@ def test_formatter_unicode_handling():
def verify(formatter):
try:
inst = formatter(encoding=None)
- except (ImportError, FontNotFound):
+ except (ImportError, FontNotFound) as e:
# some dependency or font not installed
- raise support.SkipTest
+ raise support.SkipTest(e)
if formatter.name != 'Raw tokens':
out = format(tokens, inst)
diff --git a/tests/test_bibtex.py b/tests/test_bibtex.py
index d007766d..5ad92db4 100644
--- a/tests/test_bibtex.py
+++ b/tests/test_bibtex.py
@@ -3,7 +3,7 @@
BibTeX Test
~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_cfm.py b/tests/test_cfm.py
index 2585489a..0ff1b167 100644
--- a/tests/test_cfm.py
+++ b/tests/test_cfm.py
@@ -3,7 +3,7 @@
Basic ColdfusionHtmlLexer Test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_clexer.py b/tests/test_clexer.py
index fd7f58fc..5095b797 100644
--- a/tests/test_clexer.py
+++ b/tests/test_clexer.py
@@ -3,7 +3,7 @@
Basic CLexer Test
~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py
index 5883fb5c..1500c875 100644
--- a/tests/test_cmdline.py
+++ b/tests/test_cmdline.py
@@ -3,7 +3,7 @@
Command line test
~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -110,6 +110,32 @@ class CmdLineTest(unittest.TestCase):
finally:
os.unlink(name)
+ def test_load_from_file(self):
+ lexer_file = os.path.join(TESTDIR, 'support', 'python_lexer.py')
+ formatter_file = os.path.join(TESTDIR, 'support', 'html_formatter.py')
+
+ # By default, use CustomLexer
+ o = self.check_success('-l', lexer_file, '-f', 'html',
+ '-x', stdin=TESTCODE)
+ o = re.sub('<[^>]*>', '', o)
+ # rstrip is necessary since HTML inserts a \n after the last </div>
+ self.assertEqual(o.rstrip(), TESTCODE.rstrip())
+
+ # If user specifies a name, use it
+ o = self.check_success('-f', 'html', '-x', '-l',
+ lexer_file + ':LexerWrapper', stdin=TESTCODE)
+ o = re.sub('<[^>]*>', '', o)
+ # rstrip is necessary since HTML inserts a \n after the last </div>
+ self.assertEqual(o.rstrip(), TESTCODE.rstrip())
+
+ # Should also work for formatters
+ o = self.check_success('-lpython', '-f',
+ formatter_file + ':HtmlFormatterWrapper',
+ '-x', stdin=TESTCODE)
+ o = re.sub('<[^>]*>', '', o)
+ # rstrip is necessary since HTML inserts a \n after the last </div>
+ self.assertEqual(o.rstrip(), TESTCODE.rstrip())
+
def test_stream_opt(self):
o = self.check_success('-lpython', '-s', '-fterminal', stdin=TESTCODE)
o = re.sub(r'\x1b\[.*?m', '', o)
@@ -211,6 +237,20 @@ class CmdLineTest(unittest.TestCase):
e = self.check_failure('-lfooo', TESTFILE)
self.assertTrue('Error: no lexer for alias' in e)
+ # cannot load .py file without load_from_file flag
+ e = self.check_failure('-l', 'nonexistent.py', TESTFILE)
+ self.assertTrue('Error: no lexer for alias' in e)
+
+ # lexer file is missing/unreadable
+ e = self.check_failure('-l', 'nonexistent.py',
+ '-x', TESTFILE)
+ self.assertTrue('Error: cannot read' in e)
+
+ # lexer file is malformed
+ e = self.check_failure('-l', 'support/empty.py',
+ '-x', TESTFILE)
+ self.assertTrue('Error: no valid CustomLexer class found' in e)
+
# formatter not found
e = self.check_failure('-lpython', '-ffoo', TESTFILE)
self.assertTrue('Error: no formatter found for name' in e)
@@ -219,6 +259,20 @@ class CmdLineTest(unittest.TestCase):
e = self.check_failure('-ofoo.foo', TESTFILE)
self.assertTrue('Error: no formatter found for file name' in e)
+ # cannot load .py file without load_from_file flag
+ e = self.check_failure('-f', 'nonexistent.py', TESTFILE)
+ self.assertTrue('Error: no formatter found for name' in e)
+
+ # formatter file is missing/unreadable
+ e = self.check_failure('-f', 'nonexistent.py',
+ '-x', TESTFILE)
+ self.assertTrue('Error: cannot read' in e)
+
+ # formatter file is malformed
+ e = self.check_failure('-f', 'support/empty.py',
+ '-x', TESTFILE)
+ self.assertTrue('Error: no valid CustomFormatter class found' in e)
+
# output file not writable
e = self.check_failure('-o', os.path.join('nonexistent', 'dir', 'out.html'),
'-lpython', TESTFILE)
diff --git a/tests/test_examplefiles.py b/tests/test_examplefiles.py
index f43abf9b..2fae1125 100644
--- a/tests/test_examplefiles.py
+++ b/tests/test_examplefiles.py
@@ -3,7 +3,7 @@
Pygments tests with example files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -89,7 +89,7 @@ def test_example_files():
def check_lexer(lx, fn):
if os.name == 'java' and fn in BAD_FILES_FOR_JYTHON:
- raise support.SkipTest
+ raise support.SkipTest('%s is a known bad file on Jython' % fn)
absfn = os.path.join(TESTDIR, 'examplefiles', fn)
with open(absfn, 'rb') as fp:
text = fp.read()
diff --git a/tests/test_html_formatter.py b/tests/test_html_formatter.py
index 596d9fbc..79990edd 100644
--- a/tests/test_html_formatter.py
+++ b/tests/test_html_formatter.py
@@ -3,7 +3,7 @@
Pygments HTML formatter tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_inherit.py b/tests/test_inherit.py
index 34033a08..5da57dd9 100644
--- a/tests/test_inherit.py
+++ b/tests/test_inherit.py
@@ -3,7 +3,7 @@
Tests for inheritance in RegexLexer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_irc_formatter.py b/tests/test_irc_formatter.py
index 16a8fd30..3b34f0bc 100644
--- a/tests/test_irc_formatter.py
+++ b/tests/test_irc_formatter.py
@@ -3,7 +3,7 @@
Pygments IRC formatter tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_java.py b/tests/test_java.py
index f4096647..6e5e8992 100644
--- a/tests/test_java.py
+++ b/tests/test_java.py
@@ -3,7 +3,7 @@
Basic JavaLexer Test
~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_javascript.py b/tests/test_javascript.py
index 59890659..21dff7c4 100644
--- a/tests/test_javascript.py
+++ b/tests/test_javascript.py
@@ -3,7 +3,7 @@
Javascript tests
~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_julia.py b/tests/test_julia.py
index 08c420d3..ed46f27e 100644
--- a/tests/test_julia.py
+++ b/tests/test_julia.py
@@ -3,7 +3,7 @@
Julia Tests
~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_latex_formatter.py b/tests/test_latex_formatter.py
index 05a6c3ac..ebed7964 100644
--- a/tests/test_latex_formatter.py
+++ b/tests/test_latex_formatter.py
@@ -3,7 +3,7 @@
Pygments LaTeX formatter tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -42,9 +42,9 @@ class LatexFormatterTest(unittest.TestCase):
ret = po.wait()
output = po.stdout.read()
po.stdout.close()
- except OSError:
+ except OSError as e:
# latex not available
- raise support.SkipTest
+ raise support.SkipTest(e)
else:
if ret:
print(output)
diff --git a/tests/test_lexers_other.py b/tests/test_lexers_other.py
index 90d05ef8..3716fb72 100644
--- a/tests/test_lexers_other.py
+++ b/tests/test_lexers_other.py
@@ -3,7 +3,7 @@
Tests for other lexers
~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import glob
diff --git a/tests/test_modeline.py b/tests/test_modeline.py
new file mode 100644
index 00000000..efe038df
--- /dev/null
+++ b/tests/test_modeline.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+"""
+ Tests for the vim modeline feature
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+from __future__ import print_function
+
+from pygments import modeline
+
+
+def test_lexer_classes():
+ def verify(buf):
+ assert modeline.get_filetype_from_buffer(buf) == 'python'
+
+ for buf in [
+ 'vi: ft=python' + '\n' * 8,
+ 'vi: ft=python' + '\n' * 8,
+ '\n\n\n\nvi=8: syntax=python' + '\n' * 8,
+ '\n' * 8 + 'ex: filetype=python',
+ '\n' * 8 + 'vim: some,other,syn=python\n\n\n\n'
+ ]:
+ yield verify, buf
diff --git a/tests/test_objectiveclexer.py b/tests/test_objectiveclexer.py
index 90bd680f..aee7db66 100644
--- a/tests/test_objectiveclexer.py
+++ b/tests/test_objectiveclexer.py
@@ -3,7 +3,7 @@
Basic CLexer Test
~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_perllexer.py b/tests/test_perllexer.py
index 26b2d0a7..102f0a9f 100644
--- a/tests/test_perllexer.py
+++ b/tests/test_perllexer.py
@@ -3,14 +3,14 @@
Pygments regex lexer tests
~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import time
import unittest
-from pygments.token import String
+from pygments.token import Keyword, Name, String, Text
from pygments.lexers.perl import PerlLexer
@@ -135,3 +135,23 @@ class RunawayRegexTest(unittest.TestCase):
def test_substitution_with_parenthesis(self):
self.assert_single_token(r's(aaa)', String.Regex)
self.assert_fast_tokenization('s(' + '\\'*999)
+
+ ### Namespaces/modules
+
+ def test_package_statement(self):
+ self.assert_tokens(['package', ' ', 'Foo'], [Keyword, Text, Name.Namespace])
+ self.assert_tokens(['package', ' ', 'Foo::Bar'], [Keyword, Text, Name.Namespace])
+
+ def test_use_statement(self):
+ self.assert_tokens(['use', ' ', 'Foo'], [Keyword, Text, Name.Namespace])
+ self.assert_tokens(['use', ' ', 'Foo::Bar'], [Keyword, Text, Name.Namespace])
+
+ def test_no_statement(self):
+ self.assert_tokens(['no', ' ', 'Foo'], [Keyword, Text, Name.Namespace])
+ self.assert_tokens(['no', ' ', 'Foo::Bar'], [Keyword, Text, Name.Namespace])
+
+ def test_require_statement(self):
+ self.assert_tokens(['require', ' ', 'Foo'], [Keyword, Text, Name.Namespace])
+ self.assert_tokens(['require', ' ', 'Foo::Bar'], [Keyword, Text, Name.Namespace])
+ self.assert_tokens(['require', ' ', '"Foo/Bar.pm"'], [Keyword, Text, String])
+
diff --git a/tests/test_php.py b/tests/test_php.py
index 050ca70d..b4117381 100644
--- a/tests/test_php.py
+++ b/tests/test_php.py
@@ -3,7 +3,7 @@
PHP Tests
~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_praat.py b/tests/test_praat.py
index 471d5e2c..1ca97d1e 100644
--- a/tests/test_praat.py
+++ b/tests/test_praat.py
@@ -3,7 +3,7 @@
Praat lexer tests
~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_properties.py b/tests/test_properties.py
index 333f3d7a..562778ba 100644
--- a/tests/test_properties.py
+++ b/tests/test_properties.py
@@ -3,7 +3,7 @@
Properties Tests
~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_python.py b/tests/test_python.py
index f5784cb1..e99687a6 100644
--- a/tests/test_python.py
+++ b/tests/test_python.py
@@ -3,7 +3,7 @@
Python Tests
~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_qbasiclexer.py b/tests/test_qbasiclexer.py
index 8b790cee..0ea221a1 100644
--- a/tests/test_qbasiclexer.py
+++ b/tests/test_qbasiclexer.py
@@ -3,7 +3,7 @@
Tests for QBasic
~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_regexlexer.py b/tests/test_regexlexer.py
index eb25be61..d919a950 100644
--- a/tests/test_regexlexer.py
+++ b/tests/test_regexlexer.py
@@ -3,7 +3,7 @@
Pygments regex lexer tests
~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_regexopt.py b/tests/test_regexopt.py
index 6322c735..5cfb62a3 100644
--- a/tests/test_regexopt.py
+++ b/tests/test_regexopt.py
@@ -3,7 +3,7 @@
Tests for pygments.regexopt
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_rtf_formatter.py b/tests/test_rtf_formatter.py
index 25784743..756c03a9 100644
--- a/tests/test_rtf_formatter.py
+++ b/tests/test_rtf_formatter.py
@@ -3,7 +3,7 @@
Pygments RTF formatter tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_ruby.py b/tests/test_ruby.py
index ab210bad..b7d4110a 100644
--- a/tests/test_ruby.py
+++ b/tests/test_ruby.py
@@ -3,7 +3,7 @@
Basic RubyLexer Test
~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_shell.py b/tests/test_shell.py
index 6faac9fd..e283793e 100644
--- a/tests/test_shell.py
+++ b/tests/test_shell.py
@@ -3,7 +3,7 @@
Basic Shell Tests
~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_smarty.py b/tests/test_smarty.py
index 450e4e6b..e1e079d9 100644
--- a/tests/test_smarty.py
+++ b/tests/test_smarty.py
@@ -3,7 +3,7 @@
Basic SmartyLexer Test
~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_string_asserts.py b/tests/test_string_asserts.py
index ba7b37fa..5e9e5617 100644
--- a/tests/test_string_asserts.py
+++ b/tests/test_string_asserts.py
@@ -3,7 +3,7 @@
Pygments string assert utility tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_terminal_formatter.py b/tests/test_terminal_formatter.py
index cb5c6c44..ee0ac380 100644
--- a/tests/test_terminal_formatter.py
+++ b/tests/test_terminal_formatter.py
@@ -3,7 +3,7 @@
Pygments terminal formatter tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_textfmts.py b/tests/test_textfmts.py
index d355ab68..453dd61f 100644
--- a/tests/test_textfmts.py
+++ b/tests/test_textfmts.py
@@ -3,7 +3,7 @@
Basic Tests for textfmts
~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_token.py b/tests/test_token.py
index 0c6b02bf..94522373 100644
--- a/tests/test_token.py
+++ b/tests/test_token.py
@@ -3,7 +3,7 @@
Test suite for the token module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_unistring.py b/tests/test_unistring.py
index a414347c..c56b68c7 100644
--- a/tests/test_unistring.py
+++ b/tests/test_unistring.py
@@ -3,7 +3,7 @@
Test suite for the unistring module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_using_api.py b/tests/test_using_api.py
index 16d865e6..7517ce7d 100644
--- a/tests/test_using_api.py
+++ b/tests/test_using_api.py
@@ -3,7 +3,7 @@
Pygments tests for using()
~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
diff --git a/tests/test_util.py b/tests/test_util.py
index 720b384a..cdb58b3f 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -3,7 +3,7 @@
Test suite for the util module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""