summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2016-02-26 10:09:18 +0100
committerGeorg Brandl <georg@python.org>2016-02-26 10:09:18 +0100
commit10fd009ddfef9f4da6c9b01d4e04bbaaf975678f (patch)
treed48e0c408eeb9599ded015a1eb4c6c0aed214194
parente48b387113e036192110c91e4e347cd21828a7cc (diff)
parent58ea0bab0bfe61741e04eaa12228525dc359269a (diff)
downloadpygments-10fd009ddfef9f4da6c9b01d4e04bbaaf975678f.tar.gz
merge with stable
-rw-r--r--AUTHORS13
-rw-r--r--CHANGES33
-rw-r--r--doc/docs/api.rst15
-rw-r--r--doc/docs/lexerdevelopment.rst18
-rw-r--r--doc/docs/styles.rst56
-rw-r--r--doc/docs/tokens.rst16
-rw-r--r--doc/languages.rst1
-rw-r--r--ez_setup.py382
-rw-r--r--pygments/__init__.py22
-rw-r--r--pygments/console.py24
-rw-r--r--pygments/filter.py8
-rw-r--r--pygments/formatter.py2
-rw-r--r--pygments/formatters/terminal256.py36
-rw-r--r--pygments/lexer.py4
-rw-r--r--pygments/lexers/__init__.py22
-rw-r--r--pygments/lexers/_mapping.py18
-rw-r--r--pygments/lexers/algebra.py6
-rw-r--r--pygments/lexers/ampl.py87
-rw-r--r--pygments/lexers/asm.py243
-rw-r--r--pygments/lexers/business.py106
-rw-r--r--pygments/lexers/c_cpp.py19
-rw-r--r--pygments/lexers/c_like.py204
-rw-r--r--pygments/lexers/chapel.py18
-rw-r--r--pygments/lexers/clean.py275
-rw-r--r--pygments/lexers/configs.py36
-rw-r--r--pygments/lexers/csound.py30
-rw-r--r--pygments/lexers/css.py6
-rw-r--r--pygments/lexers/diff.py61
-rw-r--r--pygments/lexers/dotnet.py45
-rw-r--r--pygments/lexers/dsls.py85
-rw-r--r--pygments/lexers/elm.py14
-rw-r--r--pygments/lexers/erlang.py32
-rw-r--r--pygments/lexers/esoteric.py72
-rw-r--r--pygments/lexers/felix.py2
-rw-r--r--pygments/lexers/fortran.py9
-rw-r--r--pygments/lexers/grammar_notation.py90
-rw-r--r--pygments/lexers/haskell.py2
-rw-r--r--pygments/lexers/idl.py13
-rw-r--r--pygments/lexers/igor.py402
-rw-r--r--pygments/lexers/j.py2
-rw-r--r--pygments/lexers/javascript.py80
-rw-r--r--pygments/lexers/julia.py48
-rw-r--r--pygments/lexers/jvm.py4
-rw-r--r--pygments/lexers/lisp.py290
-rw-r--r--pygments/lexers/modula2.py2
-rw-r--r--pygments/lexers/ncl.py1053
-rw-r--r--pygments/lexers/oberon.py6
-rw-r--r--pygments/lexers/parasail.py2
-rw-r--r--pygments/lexers/perl.py3
-rw-r--r--pygments/lexers/php.py34
-rw-r--r--pygments/lexers/praat.py34
-rw-r--r--pygments/lexers/python.py133
-rw-r--r--pygments/lexers/qvt.py84
-rw-r--r--pygments/lexers/rdf.py10
-rw-r--r--pygments/lexers/ruby.py8
-rw-r--r--pygments/lexers/scripting.py21
-rw-r--r--pygments/lexers/sql.py35
-rw-r--r--pygments/lexers/supercollider.py8
-rw-r--r--pygments/lexers/testing.py2
-rw-r--r--pygments/lexers/theorem.py31
-rw-r--r--pygments/lexers/typoscript.py225
-rw-r--r--pygments/lexers/varnish.py190
-rw-r--r--pygments/lexers/verification.py110
-rw-r--r--pygments/scanner.py3
-rw-r--r--pygments/sphinxext.py1
-rw-r--r--pygments/style.py41
-rw-r--r--pygments/styles/__init__.py1
-rw-r--r--pygments/styles/arduino.py10
-rw-r--r--pygments/styles/lovelace.py4
-rw-r--r--pygments/styles/perldoc.py2
-rw-r--r--pygments/token.py35
-rwxr-xr-xscripts/debug_lexer.py2
-rwxr-xr-xsetup.py28
-rw-r--r--tests/examplefiles/StdGeneric.icl92
-rw-r--r--tests/examplefiles/example.jsgf28
-rw-r--r--tests/examplefiles/example.xtm1101
-rw-r--r--tests/examplefiles/example2.cpp20
-rw-r--r--tests/examplefiles/flatline_example186
-rw-r--r--tests/examplefiles/postgresql_test.txt34
-rw-r--r--tests/examplefiles/test.erl12
-rw-r--r--tests/examplefiles/test.escript4
-rw-r--r--tests/examplefiles/test.hsail62
-rw-r--r--tests/examplefiles/test.ncl20
-rw-r--r--tests/examplefiles/test.php29
-rw-r--r--tests/examplefiles/test.sil206
-rw-r--r--tests/examplefiles/typescript_example (renamed from tests/examplefiles/example.ts)0
-rw-r--r--tests/examplefiles/typoscript_example1930
-rw-r--r--tests/examplefiles/varnish.vcl187
-rw-r--r--tests/examplefiles/wdiff_example1.wdiff731
-rw-r--r--tests/examplefiles/wdiff_example3.wdiff10
-rw-r--r--tests/test_lexers_other.py26
-rw-r--r--tests/test_terminal_formatter.py53
92 files changed, 8484 insertions, 1316 deletions
diff --git a/AUTHORS b/AUTHORS
index 9318d438..204b4efe 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -33,10 +33,11 @@ Other contributors, listed alphabetically, are:
* Adam Blinkinsop -- Haskell, Redcode lexers
* Frits van Bommel -- assembler lexers
* Pierre Bourdon -- bugfixes
+* Matthias Bussonnier -- ANSI style handling for terminal-256 formatter
* chebee7i -- Python traceback lexer improvements
* Hiram Chirino -- Scaml and Jade lexers
* Ian Cooper -- VGL lexer
-* David Corbett -- Inform, Jasmin, and TADS 3 lexers
+* David Corbett -- Inform, Jasmin, JSGF, and TADS 3 lexers
* Leaf Corcoran -- MoonScript lexer
* Christopher Creutzig -- MuPAD lexer
* Daniël W. Crompton -- Pike lexer
@@ -88,7 +89,8 @@ Other contributors, listed alphabetically, are:
* Tim Howard -- BlitzMax lexer
* Dustin Howett -- Logos lexer
* Ivan Inozemtsev -- Fantom lexer
-* Hiroaki Itoh -- Shell console rewrite, Lexers for PowerShell session, MSDOS session, BC
+* Hiroaki Itoh -- Shell console rewrite, Lexers for PowerShell session,
+ MSDOS session, BC, WDiff
* Brian R. Jackson -- Tea lexer
* Christian Jann -- ShellSession lexer
* Dennis Kaarsemaker -- sources.list lexer
@@ -110,7 +112,9 @@ Other contributors, listed alphabetically, are:
* Jon Larimer, Google Inc. -- Smali lexer
* Olov Lassus -- Dart lexer
* Matt Layman -- TAP lexer
+* Kristian Lyngstøl -- Varnish lexers
* Sylvestre Ledru -- Scilab lexer
+* Chee Sing Lee -- Flatline lexer
* Mark Lee -- Vala lexer
* Valentin Lorentz -- C++ lexer improvements
* Ben Mabey -- Gherkin lexer
@@ -156,6 +160,8 @@ Other contributors, listed alphabetically, are:
* Corey Richardson -- Rust lexer updates
* Lubomir Rintel -- GoodData MAQL and CL lexers
* Andre Roberge -- Tango style
+* Georg Rollinger -- HSAIL lexer
+* Michiel Roos -- TypoScript lexer
* Konrad Rudolph -- LaTeX formatter enhancements
* Mario Ruggier -- Evoque lexers
* Miikka Salminen -- Lovelace style, Hexdump lexer, lexer enhancements
@@ -171,9 +177,11 @@ Other contributors, listed alphabetically, are:
* Alexander Smishlajev -- Visual FoxPro lexer
* Steve Spigarelli -- XQuery lexer
* Jerome St-Louis -- eC lexer
+* Camil Staps -- Clean lexer
* James Strachan -- Kotlin lexer
* Tom Stuart -- Treetop lexer
* Colin Sullivan -- SuperCollider lexer
+* Ben Swift -- Extempore lexer
* Edoardo Tenani -- Arduino lexer
* Tiberius Teng -- default style overhaul
* Jeremy Thurgood -- Erlang, Squid config lexers
@@ -186,6 +194,7 @@ Other contributors, listed alphabetically, are:
* Abe Voelker -- OpenEdge ABL lexer
* Pepijn de Vos -- HTML formatter CTags support
* Matthias Vallentin -- Bro lexer
+* Benoît Vinot -- AMPL lexer
* Linh Vu Hong -- RSL lexer
* Nathan Weizenbaum -- Haml and Sass lexers
* Nathan Whetsell -- Csound lexers
diff --git a/CHANGES b/CHANGES
index ca921fc7..8646b157 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,39 @@ 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)
+
+- Added lexers:
+
+ * AMPL
+ * TypoScript (#1173)
+ * Varnish config (PR#554)
+ * Clean (PR#503)
+ * WDiff (PR#513)
+ * Flatline (PR#551)
+ * Silver (PR#537)
+ * HSAIL (PR#518)
+ * JSGF (PR#546)
+ * NCAR command language (PR#536)
+ * Extempore (PR#530)
+
+- Added `lexers.find_lexer_class_by_name()`. (#1203)
+
+- Added new token types and lexing for magic methods and variables in Python
+ and PHP.
+
+- Added a new token type for string affixes and lexing for them in Python, C++
+ and Postgresql lexers.
+
+- Added a new token type for heredoc (and similar) string delimiters and
+ lexing for them in C++, Perl, PHP, Postgresql and Ruby lexers.
+
+- Styles can now define colors with ANSI colors for use in the 256-color
+ terminal formatter. (PR#531)
+
+
Version 2.1.2
-------------
(in development)
diff --git a/doc/docs/api.rst b/doc/docs/api.rst
index 123a4643..dd831bd1 100644
--- a/doc/docs/api.rst
+++ b/doc/docs/api.rst
@@ -89,6 +89,21 @@ Functions from :mod:`pygments.lexers`:
.. versionadded:: 0.6
+.. function:: find_lexer_class_by_name(alias)
+
+ Return the `Lexer` subclass that has `alias` in its aliases list, without
+ instantiating it.
+
+ Will raise :exc:`pygments.util.ClassNotFound` if no lexer with that alias is
+ found.
+
+ .. versionadded:: 2.2
+
+.. function:: find_lexer_class(name)
+
+ Return the `Lexer` subclass that with the *name* attribute as given by
+ the *name* argument.
+
.. module:: pygments.formatters
diff --git a/doc/docs/lexerdevelopment.rst b/doc/docs/lexerdevelopment.rst
index 2c868440..fd6e76b9 100644
--- a/doc/docs/lexerdevelopment.rst
+++ b/doc/docs/lexerdevelopment.rst
@@ -88,10 +88,16 @@ one.
Adding and testing a new lexer
==============================
-To make Pygments aware of your new lexer, you have to perform the following
-steps:
+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`.
-First, change to the current directory containing the Pygments source code:
+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
+have to perform the following steps.
+
+First, change to the current directory containing the Pygments source code. You
+will need to have either an unpacked source tarball, or (preferably) a copy
+cloned from BitBucket.
.. code-block:: console
@@ -101,11 +107,13 @@ Select a matching module under ``pygments/lexers``, or create a new module for
your lexer class.
Next, make sure the lexer is known from outside of the module. All modules in
-the ``pygments.lexers`` specify ``__all__``. For example, ``esoteric.py`` sets::
+the ``pygments.lexers`` package specify ``__all__``. For example,
+``esoteric.py`` sets::
__all__ = ['BrainfuckLexer', 'BefungeLexer', ...]
-Simply add the name of your lexer class to this list.
+Add the name of your lexer class to this list (or create the list if your lexer
+is the only class in the module).
Finally the lexer can be made publicly known by rebuilding the lexer mapping:
diff --git a/doc/docs/styles.rst b/doc/docs/styles.rst
index d56db0db..1094a270 100644
--- a/doc/docs/styles.rst
+++ b/doc/docs/styles.rst
@@ -143,3 +143,59 @@ a way to iterate over all styles:
>>> from pygments.styles import get_all_styles
>>> styles = list(get_all_styles())
+
+
+.. _AnsiTerminalStyle:
+
+Terminal Styles
+===============
+
+.. versionadded:: 2.2
+
+Custom styles used with the 256-color terminal formatter can also map colors to
+use the 8 default ANSI colors. To do so, use ``#ansigreen``, ``#ansired`` or
+any other colors defined in :attr:`pygments.style.ansicolors`. Foreground ANSI
+colors will be mapped to the corresponding `escape codes 30 to 37
+<https://en.wikipedia.org/wiki/ANSI_escape_code#Colors>`_ thus respecting any
+custom color mapping and themes provided by many terminal emulators. Light
+variants are treated as foreground color with and an added bold flag.
+``bg:#ansi<color>`` will also be respected, except the light variant will be the
+same shade as their dark variant.
+
+See the following example where the color of the string ``"hello world"`` is
+governed by the escape sequence ``\x1b[34;01m`` (Ansi Blue, Bold, 41 being red
+background) instead of an extended foreground & background color.
+
+.. sourcecode:: pycon
+
+ >>> from pygments import highlight
+ >>> from pygments.style import Style
+ >>> from pygments.token import Token
+ >>> from pygments.lexers import Python3Lexer
+ >>> from pygments.formatters import Terminal256Formatter
+
+ >>> class MyStyle(Style):
+ styles = {
+ Token.String: '#ansiblue bg:#ansired',
+ }
+
+ >>> code = 'print("Hello World")'
+ >>> result = highlight(code, Python3Lexer(), Terminal256Formatter(style=MyStyle))
+ >>> print(result.encode())
+ b'\x1b[34;41;01m"\x1b[39;49;00m\x1b[34;41;01mHello World\x1b[39;49;00m\x1b[34;41;01m"\x1b[39;49;00m'
+
+Colors specified using ``#ansi*`` are converted to a default set of RGB colors
+when used with formatters other than the terminal-256 formatter.
+
+By definition of ANSI, the following colors are considered "light" colors, and
+will be rendered by most terminals as bold:
+
+- "darkgray", "red", "green", "yellow", "blue", "fuchsia", "turquoise", "white"
+
+The following are considered "dark" colors and will be rendered as non-bold:
+
+- "black", "darkred", "darkgreen", "brown", "darkblue", "purple", "teal",
+ "lightgray"
+
+Exact behavior might depends on the terminal emulator you are using, and its
+settings.
diff --git a/doc/docs/tokens.rst b/doc/docs/tokens.rst
index 6455a501..801fc638 100644
--- a/doc/docs/tokens.rst
+++ b/doc/docs/tokens.rst
@@ -174,6 +174,10 @@ Name Tokens
`Name.Function`
Token type for function names.
+`Name.Function.Magic`
+ same as `Name.Function` but for special function names that have an implicit use
+ in a language (e.g. ``__init__`` method in Python).
+
`Name.Label`
Token type for label names (e.g. in languages that support ``goto``).
@@ -201,6 +205,10 @@ Name Tokens
`Name.Variable.Instance`
same as `Name.Variable` but for instance variables.
+`Name.Variable.Magic`
+ same as `Name.Variable` but for special variable names that have an implicit use
+ in a language (e.g. ``__doc__`` in Python).
+
Literals
========
@@ -215,12 +223,20 @@ Literals
`String`
For any string literal.
+`String.Affix`
+ Token type for affixes that further specify the type of the string they're
+ attached to (e.g. the prefixes ``r`` and ``u8`` in ``r"foo"`` and ``u8"foo"``).
+
`String.Backtick`
Token type for strings enclosed in backticks.
`String.Char`
Token type for single characters (e.g. Java, C).
+`String.Delimiter`
+ Token type for delimiting identifiers in "heredoc", raw and other similar
+ strings (e.g. the word ``END`` in Perl code ``print <<'END';``).
+
`String.Doc`
Token type for documentation strings (for example Python).
diff --git a/doc/languages.rst b/doc/languages.rst
index a495d15c..ffe1bdb6 100644
--- a/doc/languages.rst
+++ b/doc/languages.rst
@@ -31,6 +31,7 @@ Programming languages
* Dart
* Delphi
* Dylan
+* `Elm <http://elm-lang.org/>`_
* Erlang
* `Ezhil <http://ezhillang.org>`_ Ezhil - A Tamil programming language
* Factor
diff --git a/ez_setup.py b/ez_setup.py
deleted file mode 100644
index 9dc2c872..00000000
--- a/ez_setup.py
+++ /dev/null
@@ -1,382 +0,0 @@
-#!python
-"""Bootstrap setuptools installation
-
-If you want to use setuptools in your package's setup.py, just include this
-file in the same directory with it, and add this to the top of your setup.py::
-
- from ez_setup import use_setuptools
- use_setuptools()
-
-If you want to require a specific version of setuptools, set a download
-mirror, or use an alternate download directory, you can do so by supplying
-the appropriate options to ``use_setuptools()``.
-
-This file can also be run as a script to install or upgrade setuptools.
-"""
-import os
-import shutil
-import sys
-import tempfile
-import tarfile
-import optparse
-import subprocess
-import platform
-
-from distutils import log
-
-try:
- from site import USER_SITE
-except ImportError:
- USER_SITE = None
-
-DEFAULT_VERSION = "1.4.2"
-DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
-
-def _python_cmd(*args):
- args = (sys.executable,) + args
- return subprocess.call(args) == 0
-
-def _check_call_py24(cmd, *args, **kwargs):
- res = subprocess.call(cmd, *args, **kwargs)
- class CalledProcessError(Exception):
- pass
- if not res == 0:
- msg = "Command '%s' return non-zero exit status %d" % (cmd, res)
- raise CalledProcessError(msg)
-vars(subprocess).setdefault('check_call', _check_call_py24)
-
-def _install(tarball, install_args=()):
- # extracting the tarball
- tmpdir = tempfile.mkdtemp()
- log.warn('Extracting in %s', tmpdir)
- old_wd = os.getcwd()
- try:
- os.chdir(tmpdir)
- tar = tarfile.open(tarball)
- _extractall(tar)
- tar.close()
-
- # going in the directory
- subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
- os.chdir(subdir)
- log.warn('Now working in %s', subdir)
-
- # installing
- log.warn('Installing Setuptools')
- if not _python_cmd('setup.py', 'install', *install_args):
- log.warn('Something went wrong during the installation.')
- log.warn('See the error message above.')
- # exitcode will be 2
- return 2
- finally:
- os.chdir(old_wd)
- shutil.rmtree(tmpdir)
-
-
-def _build_egg(egg, tarball, to_dir):
- # extracting the tarball
- tmpdir = tempfile.mkdtemp()
- log.warn('Extracting in %s', tmpdir)
- old_wd = os.getcwd()
- try:
- os.chdir(tmpdir)
- tar = tarfile.open(tarball)
- _extractall(tar)
- tar.close()
-
- # going in the directory
- subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
- os.chdir(subdir)
- log.warn('Now working in %s', subdir)
-
- # building an egg
- log.warn('Building a Setuptools egg in %s', to_dir)
- _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)
-
- finally:
- os.chdir(old_wd)
- shutil.rmtree(tmpdir)
- # returning the result
- log.warn(egg)
- if not os.path.exists(egg):
- raise IOError('Could not build the egg.')
-
-
-def _do_download(version, download_base, to_dir, download_delay):
- egg = os.path.join(to_dir, 'setuptools-%s-py%d.%d.egg'
- % (version, sys.version_info[0], sys.version_info[1]))
- if not os.path.exists(egg):
- tarball = download_setuptools(version, download_base,
- to_dir, download_delay)
- _build_egg(egg, tarball, to_dir)
- sys.path.insert(0, egg)
-
- # Remove previously-imported pkg_resources if present (see
- # https://bitbucket.org/pypa/setuptools/pull-request/7/ for details).
- if 'pkg_resources' in sys.modules:
- del sys.modules['pkg_resources']
-
- import setuptools
- setuptools.bootstrap_install_from = egg
-
-
-def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
- to_dir=os.curdir, download_delay=15):
- # making sure we use the absolute path
- to_dir = os.path.abspath(to_dir)
- was_imported = 'pkg_resources' in sys.modules or \
- 'setuptools' in sys.modules
- try:
- import pkg_resources
- except ImportError:
- return _do_download(version, download_base, to_dir, download_delay)
- try:
- pkg_resources.require("setuptools>=" + version)
- return
- except pkg_resources.VersionConflict:
- e = sys.exc_info()[1]
- if was_imported:
- sys.stderr.write(
- "The required version of setuptools (>=%s) is not available,\n"
- "and can't be installed while this script is running. Please\n"
- "install a more recent version first, using\n"
- "'easy_install -U setuptools'."
- "\n\n(Currently using %r)\n" % (version, e.args[0]))
- sys.exit(2)
- else:
- del pkg_resources, sys.modules['pkg_resources'] # reload ok
- return _do_download(version, download_base, to_dir,
- download_delay)
- except pkg_resources.DistributionNotFound:
- return _do_download(version, download_base, to_dir,
- download_delay)
-
-def _clean_check(cmd, target):
- """
- Run the command to download target. If the command fails, clean up before
- re-raising the error.
- """
- try:
- subprocess.check_call(cmd)
- except subprocess.CalledProcessError:
- if os.access(target, os.F_OK):
- os.unlink(target)
- raise
-
-def download_file_powershell(url, target):
- """
- Download the file at url to target using Powershell (which will validate
- trust). Raise an exception if the command cannot complete.
- """
- target = os.path.abspath(target)
- cmd = [
- 'powershell',
- '-Command',
- "(new-object System.Net.WebClient).DownloadFile(%(url)r, %(target)r)" % vars(),
- ]
- _clean_check(cmd, target)
-
-def has_powershell():
- if platform.system() != 'Windows':
- return False
- cmd = ['powershell', '-Command', 'echo test']
- devnull = open(os.path.devnull, 'wb')
- try:
- try:
- subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
- except:
- return False
- finally:
- devnull.close()
- return True
-
-download_file_powershell.viable = has_powershell
-
-def download_file_curl(url, target):
- cmd = ['curl', url, '--silent', '--output', target]
- _clean_check(cmd, target)
-
-def has_curl():
- cmd = ['curl', '--version']
- devnull = open(os.path.devnull, 'wb')
- try:
- try:
- subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
- except:
- return False
- finally:
- devnull.close()
- return True
-
-download_file_curl.viable = has_curl
-
-def download_file_wget(url, target):
- cmd = ['wget', url, '--quiet', '--output-document', target]
- _clean_check(cmd, target)
-
-def has_wget():
- cmd = ['wget', '--version']
- devnull = open(os.path.devnull, 'wb')
- try:
- try:
- subprocess.check_call(cmd, stdout=devnull, stderr=devnull)
- except:
- return False
- finally:
- devnull.close()
- return True
-
-download_file_wget.viable = has_wget
-
-def download_file_insecure(url, target):
- """
- Use Python to download the file, even though it cannot authenticate the
- connection.
- """
- try:
- from urllib.request import urlopen
- except ImportError:
- from urllib2 import urlopen
- src = dst = None
- try:
- src = urlopen(url)
- # Read/write all in one block, so we don't create a corrupt file
- # if the download is interrupted.
- data = src.read()
- dst = open(target, "wb")
- dst.write(data)
- finally:
- if src:
- src.close()
- if dst:
- dst.close()
-
-download_file_insecure.viable = lambda: True
-
-def get_best_downloader():
- downloaders = [
- download_file_powershell,
- download_file_curl,
- download_file_wget,
- download_file_insecure,
- ]
-
- for dl in downloaders:
- if dl.viable():
- return dl
-
-def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
- to_dir=os.curdir, delay=15,
- downloader_factory=get_best_downloader):
- """Download setuptools from a specified location and return its filename
-
- `version` should be a valid setuptools version number that is available
- as an egg for download under the `download_base` URL (which should end
- with a '/'). `to_dir` is the directory where the egg will be downloaded.
- `delay` is the number of seconds to pause before an actual download
- attempt.
-
- ``downloader_factory`` should be a function taking no arguments and
- returning a function for downloading a URL to a target.
- """
- # making sure we use the absolute path
- to_dir = os.path.abspath(to_dir)
- tgz_name = "setuptools-%s.tar.gz" % version
- url = download_base + tgz_name
- saveto = os.path.join(to_dir, tgz_name)
- if not os.path.exists(saveto): # Avoid repeated downloads
- log.warn("Downloading %s", url)
- downloader = downloader_factory()
- downloader(url, saveto)
- return os.path.realpath(saveto)
-
-
-def _extractall(self, path=".", members=None):
- """Extract all members from the archive to the current working
- directory and set owner, modification time and permissions on
- directories afterwards. `path' specifies a different directory
- to extract to. `members' is optional and must be a subset of the
- list returned by getmembers().
- """
- import copy
- import operator
- from tarfile import ExtractError
- directories = []
-
- if members is None:
- members = self
-
- for tarinfo in members:
- if tarinfo.isdir():
- # Extract directories with a safe mode.
- directories.append(tarinfo)
- tarinfo = copy.copy(tarinfo)
- tarinfo.mode = 448 # decimal for oct 0700
- self.extract(tarinfo, path)
-
- # Reverse sort directories.
- if sys.version_info < (2, 4):
- def sorter(dir1, dir2):
- return cmp(dir1.name, dir2.name)
- directories.sort(sorter)
- directories.reverse()
- else:
- directories.sort(key=operator.attrgetter('name'), reverse=True)
-
- # Set correct owner, mtime and filemode on directories.
- for tarinfo in directories:
- dirpath = os.path.join(path, tarinfo.name)
- try:
- self.chown(tarinfo, dirpath)
- self.utime(tarinfo, dirpath)
- self.chmod(tarinfo, dirpath)
- except ExtractError:
- e = sys.exc_info()[1]
- if self.errorlevel > 1:
- raise
- else:
- self._dbg(1, "tarfile: %s" % e)
-
-
-def _build_install_args(options):
- """
- Build the arguments to 'python setup.py install' on the setuptools package
- """
- install_args = []
- if options.user_install:
- if sys.version_info < (2, 6):
- log.warn("--user requires Python 2.6 or later")
- raise SystemExit(1)
- install_args.append('--user')
- return install_args
-
-def _parse_args():
- """
- Parse the command line for options
- """
- parser = optparse.OptionParser()
- parser.add_option(
- '--user', dest='user_install', action='store_true', default=False,
- help='install in user site package (requires Python 2.6 or later)')
- parser.add_option(
- '--download-base', dest='download_base', metavar="URL",
- default=DEFAULT_URL,
- help='alternative URL from where to download the setuptools package')
- parser.add_option(
- '--insecure', dest='downloader_factory', action='store_const',
- const=lambda: download_file_insecure, default=get_best_downloader,
- help='Use internal, non-validating downloader'
- )
- options, args = parser.parse_args()
- # positional arguments are ignored
- return options
-
-def main(version=DEFAULT_VERSION):
- """Install or upgrade setuptools and EasyInstall"""
- options = _parse_args()
- tarball = download_setuptools(download_base=options.download_base,
- downloader_factory=options.downloader_factory)
- return _install(tarball, _build_install_args(options))
-
-if __name__ == '__main__':
- sys.exit(main())
diff --git a/pygments/__init__.py b/pygments/__init__.py
index 0c17500e..ffac59ef 100644
--- a/pygments/__init__.py
+++ b/pygments/__init__.py
@@ -25,18 +25,16 @@
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
+import sys
+
+from pygments.util import StringIO, BytesIO
-__version__ = '2.1.1'
+__version__ = '2.2a0'
__docformat__ = 'restructuredtext'
__all__ = ['lex', 'format', 'highlight']
-import sys
-
-from pygments.util import StringIO, BytesIO
-
-
def lex(code, lexer):
"""
Lex ``code`` with ``lexer`` and return an iterable of tokens.
@@ -44,9 +42,9 @@ def lex(code, lexer):
try:
return lexer.get_tokens(code)
except TypeError as err:
- if isinstance(err.args[0], str) and \
- ('unbound method get_tokens' in err.args[0] or
- 'missing 1 required positional argument' in err.args[0]):
+ if (isinstance(err.args[0], str) and
+ ('unbound method get_tokens' in err.args[0] or
+ 'missing 1 required positional argument' in err.args[0])):
raise TypeError('lex() argument must be a lexer instance, '
'not a class')
raise
@@ -68,9 +66,9 @@ def format(tokens, formatter, outfile=None): # pylint: disable=redefined-builti
else:
formatter.format(tokens, outfile)
except TypeError as err:
- if isinstance(err.args[0], str) and \
- ('unbound method format' in err.args[0] or
- 'missing 1 required positional argument' in err.args[0]):
+ if (isinstance(err.args[0], str) and
+ ('unbound method format' in err.args[0] or
+ 'missing 1 required positional argument' in err.args[0])):
raise TypeError('format() argument must be a formatter instance, '
'not a class')
raise
diff --git a/pygments/console.py b/pygments/console.py
index 4a2c9acb..4aaf5fcb 100644
--- a/pygments/console.py
+++ b/pygments/console.py
@@ -12,18 +12,18 @@
esc = "\x1b["
codes = {}
-codes[""] = ""
-codes["reset"] = esc + "39;49;00m"
+codes[""] = ""
+codes["reset"] = esc + "39;49;00m"
-codes["bold"] = esc + "01m"
-codes["faint"] = esc + "02m"
-codes["standout"] = esc + "03m"
+codes["bold"] = esc + "01m"
+codes["faint"] = esc + "02m"
+codes["standout"] = esc + "03m"
codes["underline"] = esc + "04m"
-codes["blink"] = esc + "05m"
-codes["overline"] = esc + "06m"
+codes["blink"] = esc + "05m"
+codes["overline"] = esc + "06m"
-dark_colors = ["black", "darkred", "darkgreen", "brown", "darkblue",
- "purple", "teal", "lightgray"]
+dark_colors = ["black", "darkred", "darkgreen", "brown", "darkblue",
+ "purple", "teal", "lightgray"]
light_colors = ["darkgray", "red", "green", "yellow", "blue",
"fuchsia", "turquoise", "white"]
@@ -35,10 +35,10 @@ for d, l in zip(dark_colors, light_colors):
del d, l, x
-codes["darkteal"] = codes["turquoise"]
+codes["darkteal"] = codes["turquoise"]
codes["darkyellow"] = codes["brown"]
-codes["fuscia"] = codes["fuchsia"]
-codes["white"] = codes["bold"]
+codes["fuscia"] = codes["fuchsia"]
+codes["white"] = codes["bold"]
def reset_color():
diff --git a/pygments/filter.py b/pygments/filter.py
index c8176ed9..f3082037 100644
--- a/pygments/filter.py
+++ b/pygments/filter.py
@@ -34,10 +34,10 @@ def simplefilter(f):
yield ttype, value.lower()
"""
return type(f.__name__, (FunctionFilter,), {
- 'function': f,
- '__module__': getattr(f, '__module__'),
- '__doc__': f.__doc__
- })
+ '__module__': getattr(f, '__module__'),
+ '__doc__': f.__doc__,
+ 'function': f,
+ })
class Filter(object):
diff --git a/pygments/formatter.py b/pygments/formatter.py
index addd07d7..9f22b3bc 100644
--- a/pygments/formatter.py
+++ b/pygments/formatter.py
@@ -65,7 +65,7 @@ class Formatter(object):
def __init__(self, **options):
self.style = _lookup_style(options.get('style', 'default'))
- self.full = get_bool_opt(options, 'full', False)
+ self.full = get_bool_opt(options, 'full', False)
self.title = options.get('title', '')
self.encoding = options.get('encoding', None) or None
if self.encoding in ('guess', 'chardet'):
diff --git a/pygments/formatters/terminal256.py b/pygments/formatters/terminal256.py
index af311955..5110bc9e 100644
--- a/pygments/formatters/terminal256.py
+++ b/pygments/formatters/terminal256.py
@@ -27,6 +27,8 @@
import sys
from pygments.formatter import Formatter
+from pygments.console import codes
+from pygments.style import ansicolors
__all__ = ['Terminal256Formatter', 'TerminalTrueColorFormatter']
@@ -47,9 +49,21 @@ class EscapeSequence:
def color_string(self):
attrs = []
if self.fg is not None:
- attrs.extend(("38", "5", "%i" % self.fg))
+ if self.fg in ansicolors:
+ esc = codes[self.fg[5:]]
+ if ';01m' in esc:
+ self.bold = True
+ # extract fg color code.
+ attrs.append(esc[2:4])
+ else:
+ attrs.extend(("38", "5", "%i" % self.fg))
if self.bg is not None:
- attrs.extend(("48", "5", "%i" % self.bg))
+ if self.bg in ansicolors:
+ esc = codes[self.bg[5:]]
+ # extract fg color code, add 10 for bg.
+ attrs.append(str(int(esc[2:4])+10))
+ else:
+ attrs.extend(("48", "5", "%i" % self.bg))
if self.bold:
attrs.append("01")
if self.underline:
@@ -91,6 +105,11 @@ class Terminal256Formatter(Formatter):
.. versionadded:: 0.9
+ .. versionchanged:: 2.2
+ If the used style defines foreground colors in the form ``#ansi*``, then
+ `Terminal256Formatter` will map these to non extended foreground color.
+ See :ref:`AnsiTerminalStyle` for more information.
+
Options accepted:
`style`
@@ -169,6 +188,10 @@ class Terminal256Formatter(Formatter):
def _color_index(self, color):
index = self.best_match.get(color, None)
+ if color in ansicolors:
+ # strip the `#ansi` part and look up code
+ index = color
+ self.best_match[color] = index
if index is None:
try:
rgb = int(str(color), 16)
@@ -185,9 +208,14 @@ class Terminal256Formatter(Formatter):
def _setup_styles(self):
for ttype, ndef in self.style:
escape = EscapeSequence()
- if ndef['color']:
+ # get foreground from ansicolor if set
+ if ndef['ansicolor']:
+ escape.fg = self._color_index(ndef['ansicolor'])
+ elif ndef['color']:
escape.fg = self._color_index(ndef['color'])
- if ndef['bgcolor']:
+ if ndef['bgansicolor']:
+ escape.bg = self._color_index(ndef['bgansicolor'])
+ elif ndef['bgcolor']:
escape.bg = self._color_index(ndef['bgcolor'])
if self.usebold and ndef['bold']:
escape.bold = True
diff --git a/pygments/lexer.py b/pygments/lexer.py
index dd6c01e4..f16d8106 100644
--- a/pygments/lexer.py
+++ b/pygments/lexer.py
@@ -319,8 +319,8 @@ def bygroups(*args):
if data is not None:
if ctx:
ctx.pos = match.start(i + 1)
- for item in action(
- lexer, _PseudoMatch(match.start(i + 1), data), ctx):
+ for item in action(lexer,
+ _PseudoMatch(match.start(i + 1), data), ctx):
if item:
yield item
if ctx:
diff --git a/pygments/lexers/__init__.py b/pygments/lexers/__init__.py
index 7d0b89d4..d64f163f 100644
--- a/pygments/lexers/__init__.py
+++ b/pygments/lexers/__init__.py
@@ -72,6 +72,28 @@ def find_lexer_class(name):
return cls
+def find_lexer_class_by_name(alias):
+ """Lookup a lexer class by alias.
+
+ Like `get_lexer_by_name`, but does not instantiate the class.
+
+ .. versionadded:: 2.2
+ """
+ if not _alias:
+ raise ClassNotFound('no lexer for alias %r found' % _alias)
+ # lookup builtin lexers
+ for module_name, name, aliases, _, _ in itervalues(LEXERS):
+ if _alias.lower() in aliases:
+ if name not in _lexer_cache:
+ _load_lexers(module_name)
+ return _lexer_cache[name]
+ # continue with lexers from setuptools entrypoints
+ for cls in find_plugin_lexers():
+ if _alias.lower() in cls.aliases:
+ return cls
+ raise ClassNotFound('no lexer for alias %r found' % _alias)
+
+
def get_lexer_by_name(_alias, **options):
"""Get a lexer by an alias.
diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py
index 090e7a92..dba6d69a 100644
--- a/pygments/lexers/_mapping.py
+++ b/pygments/lexers/_mapping.py
@@ -9,7 +9,7 @@
Do not alter the LEXERS dictionary by hand.
- :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2014, 2016 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -26,6 +26,7 @@ LEXERS = {
'AgdaLexer': ('pygments.lexers.haskell', 'Agda', ('agda',), ('*.agda',), ('text/x-agda',)),
'AlloyLexer': ('pygments.lexers.dsls', 'Alloy', ('alloy',), ('*.als',), ('text/x-alloy',)),
'AmbientTalkLexer': ('pygments.lexers.ambient', 'AmbientTalk', ('at', 'ambienttalk', 'ambienttalk/2'), ('*.at',), ('text/x-ambienttalk',)),
+ 'AmplLexer': ('pygments.lexers.ampl', 'Ampl', ('ampl',), ('*.run',), ()),
'AntlrActionScriptLexer': ('pygments.lexers.parsers', 'ANTLR With ActionScript Target', ('antlr-as', 'antlr-actionscript'), ('*.G', '*.g'), ()),
'AntlrCSharpLexer': ('pygments.lexers.parsers', 'ANTLR With C# Target', ('antlr-csharp', 'antlr-c#'), ('*.G', '*.g'), ()),
'AntlrCppLexer': ('pygments.lexers.parsers', 'ANTLR With CPP Target', ('antlr-cpp',), ('*.G', '*.g'), ()),
@@ -54,7 +55,7 @@ LEXERS = {
'BlitzMaxLexer': ('pygments.lexers.basic', 'BlitzMax', ('blitzmax', 'bmax'), ('*.bmx',), ('text/x-bmx',)),
'BnfLexer': ('pygments.lexers.grammar_notation', 'BNF', ('bnf',), ('*.bnf',), ('text/x-bnf',)),
'BooLexer': ('pygments.lexers.dotnet', 'Boo', ('boo',), ('*.boo',), ('text/x-boo',)),
- 'BoogieLexer': ('pygments.lexers.esoteric', 'Boogie', ('boogie',), ('*.bpl',), ()),
+ 'BoogieLexer': ('pygments.lexers.verification', 'Boogie', ('boogie',), ('*.bpl',), ()),
'BrainfuckLexer': ('pygments.lexers.esoteric', 'Brainfuck', ('brainfuck', 'bf'), ('*.bf', '*.b'), ('application/x-brainfuck',)),
'BroLexer': ('pygments.lexers.dsls', 'Bro', ('bro',), ('*.bro',), ()),
'BugsLexer': ('pygments.lexers.modeling', 'BUGS', ('bugs', 'winbugs', 'openbugs'), ('*.bug',), ()),
@@ -78,6 +79,7 @@ LEXERS = {
'CheetahXmlLexer': ('pygments.lexers.templates', 'XML+Cheetah', ('xml+cheetah', 'xml+spitfire'), (), ('application/xml+cheetah', 'application/xml+spitfire')),
'CirruLexer': ('pygments.lexers.webmisc', 'Cirru', ('cirru',), ('*.cirru',), ('text/x-cirru',)),
'ClayLexer': ('pygments.lexers.c_like', 'Clay', ('clay',), ('*.clay',), ('text/x-clay',)),
+ 'CleanLexer': ('pygments.lexers.clean', 'Clean', ('clean',), ('*.icl', '*.dcl'), ()),
'ClojureLexer': ('pygments.lexers.jvm', 'Clojure', ('clojure', 'clj'), ('*.clj',), ('text/x-clojure', 'application/x-clojure')),
'ClojureScriptLexer': ('pygments.lexers.jvm', 'ClojureScript', ('clojurescript', 'cljs'), ('*.cljs',), ('text/x-clojurescript', 'application/x-clojurescript')),
'CobolFreeformatLexer': ('pygments.lexers.business', 'COBOLFree', ('cobolfree',), ('*.cbl', '*.CBL'), ()),
@@ -144,6 +146,7 @@ LEXERS = {
'FantomLexer': ('pygments.lexers.fantom', 'Fantom', ('fan',), ('*.fan',), ('application/x-fantom',)),
'FelixLexer': ('pygments.lexers.felix', 'Felix', ('felix', 'flx'), ('*.flx', '*.flxh'), ('text/x-felix',)),
'FishShellLexer': ('pygments.lexers.shell', 'Fish', ('fish', 'fishshell'), ('*.fish', '*.load'), ('application/x-fish',)),
+ 'FlatlineLexer': ('pygments.lexers.dsls', 'Flatline', ('flatline',), (), ('text/x-flatline',)),
'FortranFixedLexer': ('pygments.lexers.fortran', 'FortranFixed', ('fortranfixed',), ('*.f', '*.F'), ()),
'FortranLexer': ('pygments.lexers.fortran', 'Fortran', ('fortran',), ('*.f03', '*.f90', '*.F03', '*.F90'), ('text/x-fortran',)),
'FoxProLexer': ('pygments.lexers.foxpro', 'FoxPro', ('foxpro', 'vfp', 'clipper', 'xbase'), ('*.PRG', '*.prg'), ()),
@@ -168,6 +171,7 @@ LEXERS = {
'HaskellLexer': ('pygments.lexers.haskell', 'Haskell', ('haskell', 'hs'), ('*.hs',), ('text/x-haskell',)),
'HaxeLexer': ('pygments.lexers.haxe', 'Haxe', ('hx', 'haxe', 'hxsl'), ('*.hx', '*.hxsl'), ('text/haxe', 'text/x-haxe', 'text/x-hx')),
'HexdumpLexer': ('pygments.lexers.hexdump', 'Hexdump', ('hexdump',), (), ()),
+ 'HsailLexer': ('pygments.lexers.asm', 'HSAIL', ('hsail', 'hsa'), ('*.hsail',), ('text/x-hsail',)),
'HtmlDjangoLexer': ('pygments.lexers.templates', 'HTML+Django/Jinja', ('html+django', 'html+jinja', 'htmldjango'), (), ('text/html+django', 'text/html+jinja')),
'HtmlGenshiLexer': ('pygments.lexers.templates', 'HTML+Genshi', ('html+genshi', 'html+kid'), (), ('text/html+genshi',)),
'HtmlLexer': ('pygments.lexers.html', 'HTML', ('html',), ('*.html', '*.htm', '*.xhtml', '*.xslt'), ('text/html', 'application/xhtml+xml')),
@@ -200,6 +204,7 @@ LEXERS = {
'JavascriptPhpLexer': ('pygments.lexers.templates', 'JavaScript+PHP', ('js+php', 'javascript+php'), (), ('application/x-javascript+php', 'text/x-javascript+php', 'text/javascript+php')),
'JavascriptSmartyLexer': ('pygments.lexers.templates', 'JavaScript+Smarty', ('js+smarty', 'javascript+smarty'), (), ('application/x-javascript+smarty', 'text/x-javascript+smarty', 'text/javascript+smarty')),
'JclLexer': ('pygments.lexers.scripting', 'JCL', ('jcl',), ('*.jcl',), ('text/x-jcl',)),
+ 'JsgfLexer': ('pygments.lexers.grammar_notation', 'JSGF', ('jsgf',), ('*.jsgf',), ('application/jsgf', 'application/x-jsgf', 'text/jsgf')),
'JsonLdLexer': ('pygments.lexers.data', 'JSON-LD', ('jsonld', 'json-ld'), ('*.jsonld',), ('application/ld+json',)),
'JsonLexer': ('pygments.lexers.data', 'JSON', ('json',), ('*.json',), ('application/json',)),
'JspLexer': ('pygments.lexers.templates', 'Java Server Page', ('jsp',), ('*.jsp',), ('application/x-jsp',)),
@@ -264,6 +269,7 @@ LEXERS = {
'MyghtyJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Myghty', ('js+myghty', 'javascript+myghty'), (), ('application/x-javascript+myghty', 'text/x-javascript+myghty', 'text/javascript+mygthy')),
'MyghtyLexer': ('pygments.lexers.templates', 'Myghty', ('myghty',), ('*.myt', 'autodelegate'), ('application/x-myghty',)),
'MyghtyXmlLexer': ('pygments.lexers.templates', 'XML+Myghty', ('xml+myghty',), (), ('application/xml+myghty',)),
+ 'NCLLexer': ('pygments.lexers.ncl', 'NCL', ('ncl',), ('*.ncl',), ('text/ncl',)),
'NSISLexer': ('pygments.lexers.installers', 'NSIS', ('nsis', 'nsi', 'nsh'), ('*.nsi', '*.nsh'), ('text/x-nsis',)),
'NasmLexer': ('pygments.lexers.asm', 'NASM', ('nasm',), ('*.asm', '*.ASM'), ('text/x-nasm',)),
'NasmObjdumpLexer': ('pygments.lexers.asm', 'objdump-nasm', ('objdump-nasm',), ('*.objdump-intel',), ('text/x-nasm-objdump',)),
@@ -356,6 +362,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',), ()),
'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',)),
@@ -391,7 +398,12 @@ LEXERS = {
'TwigHtmlLexer': ('pygments.lexers.templates', 'HTML+Twig', ('html+twig',), ('*.twig',), ('text/html+twig',)),
'TwigLexer': ('pygments.lexers.templates', 'Twig', ('twig',), (), ('application/x-twig',)),
'TypeScriptLexer': ('pygments.lexers.javascript', 'TypeScript', ('ts', 'typescript'), ('*.ts',), ('text/x-typescript',)),
+ 'TypoScriptCssDataLexer': ('pygments.lexers.typoscript', 'TypoScriptCssData', ('typoscriptcssdata',), (), ()),
+ 'TypoScriptHtmlDataLexer': ('pygments.lexers.typoscript', 'TypoScriptHtmlData', ('typoscripthtmldata',), (), ()),
+ 'TypoScriptLexer': ('pygments.lexers.typoscript', 'TypoScript', ('typoscript',), ('*.ts', '*.txt'), ('text/x-typoscript',)),
'UrbiscriptLexer': ('pygments.lexers.urbi', 'UrbiScript', ('urbiscript',), ('*.u',), ('application/x-urbiscript',)),
+ 'VCLLexer': ('pygments.lexers.varnish', 'VCL', ('vcl',), ('*.vcl',), ('text/x-vclsrc',)),
+ 'VCLSnippetLexer': ('pygments.lexers.varnish', 'VCLSnippets', ('vclsnippets', 'vclsnippet'), (), ('text/x-vclsnippet',)),
'VCTreeStatusLexer': ('pygments.lexers.console', 'VCTreeStatus', ('vctreestatus',), (), ()),
'VGLLexer': ('pygments.lexers.dsls', 'VGL', ('vgl',), ('*.rpf',), ()),
'ValaLexer': ('pygments.lexers.c_like', 'Vala', ('vala', 'vapi'), ('*.vala', '*.vapi'), ('text/x-vala',)),
@@ -403,6 +415,7 @@ LEXERS = {
'VerilogLexer': ('pygments.lexers.hdl', 'verilog', ('verilog', 'v'), ('*.v',), ('text/x-verilog',)),
'VhdlLexer': ('pygments.lexers.hdl', 'vhdl', ('vhdl',), ('*.vhdl', '*.vhd'), ('text/x-vhdl',)),
'VimLexer': ('pygments.lexers.textedit', 'VimL', ('vim',), ('*.vim', '.vimrc', '.exrc', '.gvimrc', '_vimrc', '_exrc', '_gvimrc', 'vimrc', 'gvimrc'), ('text/x-vim',)),
+ 'WDiffLexer': ('pygments.lexers.diff', 'WDiff', ('wdiff',), ('*.wdiff',), ()),
'X10Lexer': ('pygments.lexers.x10', 'X10', ('x10', 'xten'), ('*.x10',), ('text/x-x10',)),
'XQueryLexer': ('pygments.lexers.webmisc', 'XQuery', ('xquery', 'xqy', 'xq', 'xql', 'xqm'), ('*.xqy', '*.xquery', '*.xq', '*.xql', '*.xqm'), ('text/xquery', 'application/xquery')),
'XmlDjangoLexer': ('pygments.lexers.templates', 'XML+Django/Jinja', ('xml+django', 'xml+jinja'), (), ('application/xml+django', 'application/xml+jinja')),
@@ -412,6 +425,7 @@ LEXERS = {
'XmlSmartyLexer': ('pygments.lexers.templates', 'XML+Smarty', ('xml+smarty',), (), ('application/xml+smarty',)),
'XsltLexer': ('pygments.lexers.html', 'XSLT', ('xslt',), ('*.xsl', '*.xslt', '*.xpl'), ('application/xsl+xml', 'application/xslt+xml')),
'XtendLexer': ('pygments.lexers.jvm', 'Xtend', ('xtend',), ('*.xtend',), ('text/x-xtend',)),
+ 'XtlangLexer': ('pygments.lexers.lisp', 'xtlang', ('extempore',), ('*.xtm',), ()),
'YamlJinjaLexer': ('pygments.lexers.templates', 'YAML+Jinja', ('yaml+jinja', 'salt', 'sls'), ('*.sls',), ('text/x-yaml+jinja', 'text/x-sls')),
'YamlLexer': ('pygments.lexers.data', 'YAML', ('yaml',), ('*.yaml', '*.yml'), ('text/x-yaml',)),
'ZephirLexer': ('pygments.lexers.php', 'Zephir', ('zephir',), ('*.zep',), ()),
diff --git a/pygments/lexers/algebra.py b/pygments/lexers/algebra.py
index fc54c3c3..79460ad4 100644
--- a/pygments/lexers/algebra.py
+++ b/pygments/lexers/algebra.py
@@ -104,9 +104,9 @@ class MathematicaLexer(RegexLexer):
(r'#\d*', Name.Variable),
(r'([a-zA-Z]+[a-zA-Z0-9]*)', Name),
- (r'-?[0-9]+\.[0-9]*', Number.Float),
- (r'-?[0-9]*\.[0-9]+', Number.Float),
- (r'-?[0-9]+', Number.Integer),
+ (r'-?\d+\.\d*', Number.Float),
+ (r'-?\d*\.\d+', Number.Float),
+ (r'-?\d+', Number.Integer),
(words(operators), Operator),
(words(punctuation), Punctuation),
diff --git a/pygments/lexers/ampl.py b/pygments/lexers/ampl.py
new file mode 100644
index 00000000..c3ca80d4
--- /dev/null
+++ b/pygments/lexers/ampl.py
@@ -0,0 +1,87 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.lexers.ampl
+ ~~~~~~~~~~~~~~~~~~~~
+
+ Lexers for the ampl language. <http://ampl.com/>
+
+ :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+from pygments.lexer import RegexLexer, bygroups, using, this, words
+from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
+ Number, Punctuation
+
+__all__ = ['AmplLexer']
+
+
+class AmplLexer(RegexLexer):
+ """
+ For AMPL source code.
+
+ .. versionadded:: 2.2
+ """
+ name = 'Ampl'
+ aliases = ['ampl']
+ filenames = ['*.run']
+
+ tokens = {
+ 'root': [
+ (r'\n', Text),
+ (r'\s+', Text.Whitespace),
+ (r'#.*?\n', Comment.Single),
+ (r'/[*](.|\n)*?[*]/', Comment.Multiline),
+ (words((
+ 'call', 'cd', 'close', 'commands', 'data', 'delete', 'display',
+ 'drop', 'end', 'environ', 'exit', 'expand', 'include', 'load',
+ 'model', 'objective', 'option', 'problem', 'purge', 'quit',
+ 'redeclare', 'reload', 'remove', 'reset', 'restore', 'shell',
+ 'show', 'solexpand', 'solution', 'solve', 'update', 'unload',
+ 'xref', 'coeff', 'coef', 'cover', 'obj', 'interval', 'default',
+ 'from', 'to', 'to_come', 'net_in', 'net_out', 'dimen',
+ 'dimension', 'check', 'complements', 'write', 'function',
+ 'pipe', 'format', 'if', 'then', 'else', 'in', 'while', 'repeat',
+ 'for'), suffix=r'\b'), Keyword.Reserved),
+ (r'(integer|binary|symbolic|ordered|circular|reversed|INOUT|IN|OUT|LOCAL)',
+ Keyword.Type),
+ (r'\".*?\"', String.Double),
+ (r'\'.*?\'', String.Single),
+ (r'[()\[\]{},;:]+', Punctuation),
+ (r'\b(\w+)(\.)(astatus|init0|init|lb0|lb1|lb2|lb|lrc|'
+ r'lslack|rc|relax|slack|sstatus|status|ub0|ub1|ub2|'
+ r'ub|urc|uslack|val)',
+ bygroups(Name.Variable, Punctuation, Keyword.Reserved)),
+ (r'(set|param|var|arc|minimize|maximize|subject to|s\.t\.|subj to|'
+ r'node|table|suffix|read table|write table)(\s+)(\w+)',
+ bygroups(Keyword.Declaration, Text, Name.Variable)),
+ (r'(param)(\s*)(:)(\s*)(\w+)(\s*)(:)(\s*)((\w|\s)+)',
+ bygroups(Keyword.Declaration, Text, Punctuation, Text,
+ Name.Variable, Text, Punctuation, Text, Name.Variable)),
+ (r'(let|fix|unfix)(\s*)((?:\{.*\})?)(\s*)(\w+)',
+ bygroups(Keyword.Declaration, Text, using(this), Text, Name.Variable)),
+ (words((
+ 'abs', 'acos', 'acosh', 'alias', 'asin', 'asinh', 'atan', 'atan2',
+ 'atanh', 'ceil', 'ctime', 'cos', 'exp', 'floor', 'log', 'log10',
+ 'max', 'min', 'precision', 'round', 'sin', 'sinh', 'sqrt', 'tan',
+ 'tanh', 'time', 'trunc', 'Beta', 'Cauchy', 'Exponential', 'Gamma',
+ 'Irand224', 'Normal', 'Normal01', 'Poisson', 'Uniform', 'Uniform01',
+ 'num', 'num0', 'ichar', 'char', 'length', 'substr', 'sprintf',
+ 'match', 'sub', 'gsub', 'print', 'printf', 'next', 'nextw', 'prev',
+ 'prevw', 'first', 'last', 'ord', 'ord0', 'card', 'arity',
+ 'indexarity'), prefix=r'\b', suffix=r'\b'), Name.Builtin),
+ (r'(\+|\-|\*|/|\*\*|=|<=|>=|==|\||\^|<|>|\!|\.\.|:=|\&|\!=|<<|>>)',
+ Operator),
+ (words((
+ 'or', 'exists', 'forall', 'and', 'in', 'not', 'within', 'union',
+ 'diff', 'difference', 'symdiff', 'inter', 'intersect',
+ 'intersection', 'cross', 'setof', 'by', 'less', 'sum', 'prod',
+ 'product', 'div', 'mod'), suffix=r'\b'),
+ Keyword.Reserved), # Operator.Name but not enough emphasized with that
+ (r'(\d+\.(?!\.)\d*|\.(?!.)\d+)([eE][+-]?\d+)?', Number.Float),
+ (r'\d+([eE][+-]?\d+)?', Number.Integer),
+ (r'[+-]?Infinity', Number.Integer),
+ (r'(\w+|(\.(?!\.)))', Text)
+ ]
+
+ }
diff --git a/pygments/lexers/asm.py b/pygments/lexers/asm.py
index bbe04f69..325cbbed 100644
--- a/pygments/lexers/asm.py
+++ b/pygments/lexers/asm.py
@@ -11,15 +11,16 @@
import re
-from pygments.lexer import RegexLexer, include, bygroups, using, DelegatingLexer
+from pygments.lexer import RegexLexer, include, bygroups, using, words, \
+ DelegatingLexer
from pygments.lexers.c_cpp import CppLexer, CLexer
from pygments.lexers.d import DLexer
from pygments.token import Text, Name, Number, String, Comment, Punctuation, \
Other, Keyword, Operator
__all__ = ['GasLexer', 'ObjdumpLexer', 'DObjdumpLexer', 'CppObjdumpLexer',
- 'CObjdumpLexer', 'LlvmLexer', 'NasmLexer', 'NasmObjdumpLexer',
- 'Ca65Lexer']
+ 'CObjdumpLexer', 'HsailLexer', 'LlvmLexer', 'NasmLexer',
+ 'NasmObjdumpLexer', 'Ca65Lexer']
class GasLexer(RegexLexer):
@@ -198,6 +199,141 @@ class CObjdumpLexer(DelegatingLexer):
super(CObjdumpLexer, self).__init__(CLexer, ObjdumpLexer, **options)
+class HsailLexer(RegexLexer):
+ """
+ For HSAIL assembly code.
+
+ .. versionadded:: 2.2
+ """
+ name = 'HSAIL'
+ aliases = ['hsail', 'hsa']
+ filenames = ['*.hsail']
+ mimetypes = ['text/x-hsail']
+
+ string = r'"[^"]*?"'
+ identifier = r'[a-zA-Z_][\w.]*'
+ # Registers
+ register_number = r'[0-9]+'
+ register = r'(\$(c|s|d|q)' + register_number + ')'
+ # Qualifiers
+ alignQual = r'(align\(\d+\))'
+ widthQual = r'(width\((\d+|all)\))'
+ allocQual = r'(alloc\(agent\))'
+ # Instruction Modifiers
+ roundingMod = (r'((_ftz)?(_up|_down|_zero|_near))')
+ datatypeMod = (r'_('
+ # packedTypes
+ r'u8x4|s8x4|u16x2|s16x2|u8x8|s8x8|u16x4|s16x4|u32x2|s32x2|'
+ r'u8x16|s8x16|u16x8|s16x8|u32x4|s32x4|u64x2|s64x2|'
+ r'f16x2|f16x4|f16x8|f32x2|f32x4|f64x2|'
+ # baseTypes
+ r'u8|s8|u16|s16|u32|s32|u64|s64|'
+ r'b128|b8|b16|b32|b64|b1|'
+ r'f16|f32|f64|'
+ # opaqueType
+ r'roimg|woimg|rwimg|samp|sig32|sig64)')
+
+ # Numeric Constant
+ float = r'((\d+\.)|(\d*\.\d+))[eE][+-]?\d+'
+ hexfloat = r'0[xX](([0-9a-fA-F]+\.[0-9a-fA-F]*)|([0-9a-fA-F]*\.[0-9a-fA-F]+))[pP][+-]?\d+'
+ ieeefloat = r'0((h|H)[0-9a-fA-F]{4}|(f|F)[0-9a-fA-F]{8}|(d|D)[0-9a-fA-F]{16})'
+
+ tokens = {
+ 'root': [
+ include('whitespace'),
+ include('comments'),
+
+ (string, String),
+
+ (r'@' + identifier + ':?', Name.Label),
+
+ (register, Name.Variable.Anonymous),
+
+ include('keyword'),
+
+ (r'&' + identifier, Name.Variable.Global),
+ (r'%' + identifier, Name.Variable),
+
+ (hexfloat, Number.Hex),
+ (r'0[xX][a-fA-F0-9]+', Number.Hex),
+ (ieeefloat, Number.Float),
+ (float, Number.Float),
+ ('\d+', Number.Integer),
+
+ (r'[=<>{}\[\]()*.,:;!]|x\b', Punctuation)
+ ],
+ 'whitespace': [
+ (r'(\n|\s)+', Text),
+ ],
+ 'comments': [
+ (r'/\*.*?\*/', Comment.Multiline),
+ (r'//.*?\n', Comment.Singleline),
+ ],
+ 'keyword': [
+ # Types
+ (r'kernarg' + datatypeMod, Keyword.Type),
+
+ # Regular keywords
+ (r'\$(full|base|small|large|default|zero|near)', Keyword),
+ (words((
+ 'module', 'extension', 'pragma', 'prog', 'indirect', 'signature',
+ 'decl', 'kernel', 'function', 'enablebreakexceptions',
+ 'enabledetectexceptions', 'maxdynamicgroupsize', 'maxflatgridsize',
+ 'maxflatworkgroupsize', 'requireddim', 'requiredgridsize',
+ 'requiredworkgroupsize', 'requirenopartialworkgroups'),
+ suffix=r'\b'), Keyword),
+
+ # instructions
+ (roundingMod, Keyword),
+ (datatypeMod, Keyword),
+ (r'_(' + alignQual + '|' + widthQual + ')', Keyword),
+ (r'_kernarg', Keyword),
+ (r'(nop|imagefence)\b', Keyword),
+ (words((
+ 'cleardetectexcept', 'clock', 'cuid', 'debugtrap', 'dim',
+ 'getdetectexcept', 'groupbaseptr', 'kernargbaseptr', 'laneid',
+ 'maxcuid', 'maxwaveid', 'packetid', 'setdetectexcept', 'waveid',
+ 'workitemflatabsid', 'workitemflatid', 'nullptr', 'abs', 'bitrev',
+ 'currentworkgroupsize', 'currentworkitemflatid', 'fract', 'ncos',
+ 'neg', 'nexp2', 'nlog2', 'nrcp', 'nrsqrt', 'nsin', 'nsqrt',
+ 'gridgroups', 'gridsize', 'not', 'sqrt', 'workgroupid',
+ 'workgroupsize', 'workitemabsid', 'workitemid', 'ceil', 'floor',
+ 'rint', 'trunc', 'add', 'bitmask', 'borrow', 'carry', 'copysign',
+ 'div', 'rem', 'sub', 'shl', 'shr', 'and', 'or', 'xor', 'unpackhi',
+ 'unpacklo', 'max', 'min', 'fma', 'mad', 'bitextract', 'bitselect',
+ 'shuffle', 'cmov', 'bitalign', 'bytealign', 'lerp', 'nfma', 'mul',
+ 'mulhi', 'mul24hi', 'mul24', 'mad24', 'mad24hi', 'bitinsert',
+ 'combine', 'expand', 'lda', 'mov', 'pack', 'unpack', 'packcvt',
+ 'unpackcvt', 'sad', 'sementp', 'ftos', 'stof', 'cmp', 'ld', 'st',
+ '_eq', '_ne', '_lt', '_le', '_gt', '_ge', '_equ', '_neu', '_ltu',
+ '_leu', '_gtu', '_geu', '_num', '_nan', '_seq', '_sne', '_slt',
+ '_sle', '_sgt', '_sge', '_snum', '_snan', '_sequ', '_sneu', '_sltu',
+ '_sleu', '_sgtu', '_sgeu', 'atomic', '_ld', '_st', '_cas', '_add',
+ '_and', '_exch', '_max', '_min', '_or', '_sub', '_wrapdec',
+ '_wrapinc', '_xor', 'ret', 'cvt', '_readonly', '_kernarg', '_global',
+ 'br', 'cbr', 'sbr', '_scacq', '_screl', '_scar', '_rlx', '_wave',
+ '_wg', '_agent', '_system', 'ldimage', 'stimage', '_v2', '_v3', '_v4',
+ '_1d', '_2d', '_3d', '_1da', '_2da', '_1db', '_2ddepth', '_2dadepth',
+ '_width', '_height', '_depth', '_array', '_channelorder',
+ '_channeltype', 'querysampler', '_coord', '_filter', '_addressing',
+ 'barrier', 'wavebarrier', 'initfbar', 'joinfbar', 'waitfbar',
+ 'arrivefbar', 'leavefbar', 'releasefbar', 'ldf', 'activelaneid',
+ 'activelanecount', 'activelanemask', 'activelanepermute', 'call',
+ 'scall', 'icall', 'alloca', 'packetcompletionsig',
+ 'addqueuewriteindex', 'casqueuewriteindex', 'ldqueuereadindex',
+ 'stqueuereadindex', 'readonly', 'global', 'private', 'group',
+ 'spill', 'arg', '_upi', '_downi', '_zeroi', '_neari', '_upi_sat',
+ '_downi_sat', '_zeroi_sat', '_neari_sat', '_supi', '_sdowni',
+ '_szeroi', '_sneari', '_supi_sat', '_sdowni_sat', '_szeroi_sat',
+ '_sneari_sat', '_pp', '_ps', '_sp', '_ss', '_s', '_p', '_pp_sat',
+ '_ps_sat', '_sp_sat', '_ss_sat', '_s_sat', '_p_sat')), Keyword),
+
+ # Integer types
+ (r'i[1-9]\d*', Keyword)
+ ]
+ }
+
+
class LlvmLexer(RegexLexer):
"""
For LLVM assembly code.
@@ -240,69 +376,48 @@ class LlvmLexer(RegexLexer):
],
'keyword': [
# Regular keywords
- (r'(begin|end'
- r'|true|false'
- r'|declare|define'
- r'|global|constant'
-
- r'|private|linker_private|internal|available_externally|linkonce'
- r'|linkonce_odr|weak|weak_odr|appending|dllimport|dllexport'
- r'|common|default|hidden|protected|extern_weak|external'
- r'|thread_local|zeroinitializer|undef|null|to|tail|target|triple'
- r'|datalayout|volatile|nuw|nsw|nnan|ninf|nsz|arcp|fast|exact|inbounds'
- r'|align|addrspace|section|alias|module|asm|sideeffect|gc|dbg'
- r'|linker_private_weak'
- r'|attributes|blockaddress|initialexec|localdynamic|localexec'
- r'|prefix|unnamed_addr'
-
- r'|ccc|fastcc|coldcc|x86_stdcallcc|x86_fastcallcc|arm_apcscc'
- r'|arm_aapcscc|arm_aapcs_vfpcc|ptx_device|ptx_kernel'
- r'|intel_ocl_bicc|msp430_intrcc|spir_func|spir_kernel'
- r'|x86_64_sysvcc|x86_64_win64cc|x86_thiscallcc'
-
- r'|cc|c'
-
- r'|signext|zeroext|inreg|sret|nounwind|noreturn|noalias|nocapture'
- r'|byval|nest|readnone|readonly'
- r'|inlinehint|noinline|alwaysinline|optsize|ssp|sspreq|noredzone'
- r'|noimplicitfloat|naked'
- r'|builtin|cold|nobuiltin|noduplicate|nonlazybind|optnone'
- r'|returns_twice|sanitize_address|sanitize_memory|sanitize_thread'
- r'|sspstrong|uwtable|returned'
-
- r'|type|opaque'
-
- r'|eq|ne|slt|sgt|sle'
- r'|sge|ult|ugt|ule|uge'
- r'|oeq|one|olt|ogt|ole'
- r'|oge|ord|uno|ueq|une'
- r'|x'
- r'|acq_rel|acquire|alignstack|atomic|catch|cleanup|filter'
- r'|inteldialect|max|min|monotonic|nand|personality|release'
- r'|seq_cst|singlethread|umax|umin|unordered|xchg'
-
- # instructions
- r'|add|fadd|sub|fsub|mul|fmul|udiv|sdiv|fdiv|urem|srem|frem|shl'
- r'|lshr|ashr|and|or|xor|icmp|fcmp'
-
- r'|phi|call|trunc|zext|sext|fptrunc|fpext|uitofp|sitofp|fptoui'
- r'|fptosi|inttoptr|ptrtoint|bitcast|addrspacecast'
- r'|select|va_arg|ret|br|switch'
- r'|invoke|unwind|unreachable'
- r'|indirectbr|landingpad|resume'
-
- r'|malloc|alloca|free|load|store|getelementptr'
-
- r'|extractelement|insertelement|shufflevector|getresult'
- r'|extractvalue|insertvalue'
-
- r'|atomicrmw|cmpxchg|fence'
-
- r')\b', Keyword),
+ (words((
+ 'begin', 'end', 'true', 'false', 'declare', 'define', 'global',
+ 'constant', 'private', 'linker_private', 'internal',
+ 'available_externally', 'linkonce', 'linkonce_odr', 'weak',
+ 'weak_odr', 'appending', 'dllimport', 'dllexport', 'common',
+ 'default', 'hidden', 'protected', 'extern_weak', 'external',
+ 'thread_local', 'zeroinitializer', 'undef', 'null', 'to', 'tail',
+ 'target', 'triple', 'datalayout', 'volatile', 'nuw', 'nsw', 'nnan',
+ 'ninf', 'nsz', 'arcp', 'fast', 'exact', 'inbounds', 'align',
+ 'addrspace', 'section', 'alias', 'module', 'asm', 'sideeffect',
+ 'gc', 'dbg', 'linker_private_weak', 'attributes', 'blockaddress',
+ 'initialexec', 'localdynamic', 'localexec', 'prefix', 'unnamed_addr',
+ 'ccc', 'fastcc', 'coldcc', 'x86_stdcallcc', 'x86_fastcallcc',
+ 'arm_apcscc', 'arm_aapcscc', 'arm_aapcs_vfpcc', 'ptx_device',
+ 'ptx_kernel', 'intel_ocl_bicc', 'msp430_intrcc', 'spir_func',
+ 'spir_kernel', 'x86_64_sysvcc', 'x86_64_win64cc', 'x86_thiscallcc',
+ 'cc', 'c', 'signext', 'zeroext', 'inreg', 'sret', 'nounwind',
+ 'noreturn', 'noalias', 'nocapture', 'byval', 'nest', 'readnone',
+ 'readonly', 'inlinehint', 'noinline', 'alwaysinline', 'optsize', 'ssp',
+ 'sspreq', 'noredzone', 'noimplicitfloat', 'naked', 'builtin', 'cold',
+ 'nobuiltin', 'noduplicate', 'nonlazybind', 'optnone', 'returns_twice',
+ 'sanitize_address', 'sanitize_memory', 'sanitize_thread', 'sspstrong',
+ 'uwtable', 'returned', 'type', 'opaque', 'eq', 'ne', 'slt', 'sgt',
+ 'sle', 'sge', 'ult', 'ugt', 'ule', 'uge', 'oeq', 'one', 'olt', 'ogt',
+ 'ole', 'oge', 'ord', 'uno', 'ueq', 'une', 'x', 'acq_rel', 'acquire',
+ 'alignstack', 'atomic', 'catch', 'cleanup', 'filter', 'inteldialect',
+ 'max', 'min', 'monotonic', 'nand', 'personality', 'release', 'seq_cst',
+ 'singlethread', 'umax', 'umin', 'unordered', 'xchg', 'add', 'fadd',
+ 'sub', 'fsub', 'mul', 'fmul', 'udiv', 'sdiv', 'fdiv', 'urem', 'srem',
+ 'frem', 'shl', 'lshr', 'ashr', 'and', 'or', 'xor', 'icmp', 'fcmp',
+ 'phi', 'call', 'trunc', 'zext', 'sext', 'fptrunc', 'fpext', 'uitofp',
+ 'sitofp', 'fptoui', 'fptosi', 'inttoptr', 'ptrtoint', 'bitcast',
+ 'addrspacecast', 'select', 'va_arg', 'ret', 'br', 'switch', 'invoke',
+ 'unwind', 'unreachable', 'indirectbr', 'landingpad', 'resume',
+ 'malloc', 'alloca', 'free', 'load', 'store', 'getelementptr',
+ 'extractelement', 'insertelement', 'shufflevector', 'getresult',
+ 'extractvalue', 'insertvalue', 'atomicrmw', 'cmpxchg', 'fence'),
+ suffix=r'\b'), Keyword),
# Types
- (r'void|half|float|double|x86_fp80|fp128|ppc_fp128|label|metadata',
- Keyword.Type),
+ (words(('void', 'half', 'float', 'double', 'x86_fp80', 'fp128',
+ 'ppc_fp128', 'label', 'metadata')), Keyword.Type),
# Integer types
(r'i[1-9]\d*', Keyword)
diff --git a/pygments/lexers/business.py b/pygments/lexers/business.py
index ea888245..43978690 100644
--- a/pygments/lexers/business.py
+++ b/pygments/lexers/business.py
@@ -57,9 +57,9 @@ class CobolLexer(RegexLexer):
],
'core': [
# Figurative constants
- (r'(^|(?<=[^0-9a-z_\-]))(ALL\s+)?'
+ (r'(^|(?<=[^\w\-]))(ALL\s+)?'
r'((ZEROES)|(HIGH-VALUE|LOW-VALUE|QUOTE|SPACE|ZERO)(S)?)'
- r'\s*($|(?=[^0-9a-z_\-]))',
+ r'\s*($|(?=[^\w\-]))',
Name.Constant),
# Reserved words STATEMENTS and other bolds
@@ -79,8 +79,8 @@ class CobolLexer(RegexLexer):
'RETURN', 'REWRITE', 'SCREEN', 'SD', 'SEARCH', 'SECTION', 'SET',
'SORT', 'START', 'STOP', 'STRING', 'SUBTRACT', 'SUPPRESS',
'TERMINATE', 'THEN', 'UNLOCK', 'UNSTRING', 'USE', 'VALIDATE',
- 'WORKING-STORAGE', 'WRITE'), prefix=r'(^|(?<=[^0-9a-z_\-]))',
- suffix=r'\s*($|(?=[^0-9a-z_\-]))'),
+ 'WORKING-STORAGE', 'WRITE'), prefix=r'(^|(?<=[^\w\-]))',
+ suffix=r'\s*($|(?=[^\w\-]))'),
Keyword.Reserved),
# Reserved words
@@ -89,33 +89,33 @@ class CobolLexer(RegexLexer):
'ALPHABET', 'ALPHABETIC', 'ALPHABETIC-LOWER', 'ALPHABETIC-UPPER',
'ALPHANUMERIC', 'ALPHANUMERIC-EDITED', 'ALSO', 'ALTER', 'ALTERNATE'
'ANY', 'ARE', 'AREA', 'AREAS', 'ARGUMENT-NUMBER', 'ARGUMENT-VALUE', 'AS',
- 'ASCENDING', 'ASSIGN', 'AT', 'AUTO', 'AUTO-SKIP', 'AUTOMATIC', 'AUTOTERMINATE',
- 'BACKGROUND-COLOR', 'BASED', 'BEEP', 'BEFORE', 'BELL',
+ 'ASCENDING', 'ASSIGN', 'AT', 'AUTO', 'AUTO-SKIP', 'AUTOMATIC',
+ 'AUTOTERMINATE', 'BACKGROUND-COLOR', 'BASED', 'BEEP', 'BEFORE', 'BELL',
'BLANK', 'BLINK', 'BLOCK', 'BOTTOM', 'BY', 'BYTE-LENGTH', 'CHAINING',
- 'CHARACTER', 'CHARACTERS', 'CLASS', 'CODE', 'CODE-SET', 'COL', 'COLLATING',
- 'COLS', 'COLUMN', 'COLUMNS', 'COMMA', 'COMMAND-LINE', 'COMMIT', 'COMMON',
- 'CONSTANT', 'CONTAINS', 'CONTENT', 'CONTROL',
+ 'CHARACTER', 'CHARACTERS', 'CLASS', 'CODE', 'CODE-SET', 'COL',
+ 'COLLATING', 'COLS', 'COLUMN', 'COLUMNS', 'COMMA', 'COMMAND-LINE',
+ 'COMMIT', 'COMMON', 'CONSTANT', 'CONTAINS', 'CONTENT', 'CONTROL',
'CONTROLS', 'CONVERTING', 'COPY', 'CORR', 'CORRESPONDING', 'COUNT', 'CRT',
- 'CURRENCY', 'CURSOR', 'CYCLE', 'DATE', 'DAY', 'DAY-OF-WEEK', 'DE', 'DEBUGGING',
- 'DECIMAL-POINT', 'DECLARATIVES', 'DEFAULT', 'DELIMITED',
+ 'CURRENCY', 'CURSOR', 'CYCLE', 'DATE', 'DAY', 'DAY-OF-WEEK', 'DE',
+ 'DEBUGGING', 'DECIMAL-POINT', 'DECLARATIVES', 'DEFAULT', 'DELIMITED',
'DELIMITER', 'DEPENDING', 'DESCENDING', 'DETAIL', 'DISK',
'DOWN', 'DUPLICATES', 'DYNAMIC', 'EBCDIC',
'ENTRY', 'ENVIRONMENT-NAME', 'ENVIRONMENT-VALUE', 'EOL', 'EOP',
'EOS', 'ERASE', 'ERROR', 'ESCAPE', 'EXCEPTION',
- 'EXCLUSIVE', 'EXTEND', 'EXTERNAL',
- 'FILE-ID', 'FILLER', 'FINAL', 'FIRST', 'FIXED', 'FLOAT-LONG', 'FLOAT-SHORT',
- 'FOOTING', 'FOR', 'FOREGROUND-COLOR', 'FORMAT', 'FROM', 'FULL', 'FUNCTION',
- 'FUNCTION-ID', 'GIVING', 'GLOBAL', 'GROUP',
+ 'EXCLUSIVE', 'EXTEND', 'EXTERNAL', 'FILE-ID', 'FILLER', 'FINAL',
+ 'FIRST', 'FIXED', 'FLOAT-LONG', 'FLOAT-SHORT',
+ 'FOOTING', 'FOR', 'FOREGROUND-COLOR', 'FORMAT', 'FROM', 'FULL',
+ 'FUNCTION', 'FUNCTION-ID', 'GIVING', 'GLOBAL', 'GROUP',
'HEADING', 'HIGHLIGHT', 'I-O', 'ID',
'IGNORE', 'IGNORING', 'IN', 'INDEX', 'INDEXED', 'INDICATE',
- 'INITIAL', 'INITIALIZED', 'INPUT',
- 'INTO', 'INTRINSIC', 'INVALID', 'IS', 'JUST', 'JUSTIFIED', 'KEY', 'LABEL',
+ 'INITIAL', 'INITIALIZED', 'INPUT', 'INTO', 'INTRINSIC', 'INVALID',
+ 'IS', 'JUST', 'JUSTIFIED', 'KEY', 'LABEL',
'LAST', 'LEADING', 'LEFT', 'LENGTH', 'LIMIT', 'LIMITS', 'LINAGE',
'LINAGE-COUNTER', 'LINE', 'LINES', 'LOCALE', 'LOCK',
- 'LOWLIGHT', 'MANUAL', 'MEMORY', 'MINUS', 'MODE',
- 'MULTIPLE', 'NATIONAL', 'NATIONAL-EDITED', 'NATIVE',
- 'NEGATIVE', 'NEXT', 'NO', 'NULL', 'NULLS', 'NUMBER', 'NUMBERS', 'NUMERIC',
- 'NUMERIC-EDITED', 'OBJECT-COMPUTER', 'OCCURS', 'OF', 'OFF', 'OMITTED', 'ON', 'ONLY',
+ 'LOWLIGHT', 'MANUAL', 'MEMORY', 'MINUS', 'MODE', 'MULTIPLE',
+ 'NATIONAL', 'NATIONAL-EDITED', 'NATIVE', 'NEGATIVE', 'NEXT', 'NO',
+ 'NULL', 'NULLS', 'NUMBER', 'NUMBERS', 'NUMERIC', 'NUMERIC-EDITED',
+ 'OBJECT-COMPUTER', 'OCCURS', 'OF', 'OFF', 'OMITTED', 'ON', 'ONLY',
'OPTIONAL', 'ORDER', 'ORGANIZATION', 'OTHER', 'OUTPUT', 'OVERFLOW',
'OVERLINE', 'PACKED-DECIMAL', 'PADDING', 'PAGE', 'PARAGRAPH',
'PLUS', 'POINTER', 'POSITION', 'POSITIVE', 'PRESENT', 'PREVIOUS',
@@ -137,40 +137,42 @@ class CobolLexer(RegexLexer):
'UNSIGNED-INT', 'UNSIGNED-LONG', 'UNSIGNED-SHORT', 'UNTIL', 'UP',
'UPDATE', 'UPON', 'USAGE', 'USING', 'VALUE', 'VALUES', 'VARYING',
'WAIT', 'WHEN', 'WITH', 'WORDS', 'YYYYDDD', 'YYYYMMDD'),
- prefix=r'(^|(?<=[^0-9a-z_\-]))', suffix=r'\s*($|(?=[^0-9a-z_\-]))'),
+ prefix=r'(^|(?<=[^\w\-]))', suffix=r'\s*($|(?=[^\w\-]))'),
Keyword.Pseudo),
# inactive reserved words
(words((
- 'ACTIVE-CLASS', 'ALIGNED', 'ANYCASE', 'ARITHMETIC', 'ATTRIBUTE', 'B-AND',
- 'B-NOT', 'B-OR', 'B-XOR', 'BIT', 'BOOLEAN', 'CD', 'CENTER', 'CF', 'CH', 'CHAIN', 'CLASS-ID',
- 'CLASSIFICATION', 'COMMUNICATION', 'CONDITION', 'DATA-POINTER',
- 'DESTINATION', 'DISABLE', 'EC', 'EGI', 'EMI', 'ENABLE', 'END-RECEIVE',
- 'ENTRY-CONVENTION', 'EO', 'ESI', 'EXCEPTION-OBJECT', 'EXPANDS', 'FACTORY',
- 'FLOAT-BINARY-16', 'FLOAT-BINARY-34', 'FLOAT-BINARY-7',
- 'FLOAT-DECIMAL-16', 'FLOAT-DECIMAL-34', 'FLOAT-EXTENDED', 'FORMAT',
- 'FUNCTION-POINTER', 'GET', 'GROUP-USAGE', 'IMPLEMENTS', 'INFINITY',
- 'INHERITS', 'INTERFACE', 'INTERFACE-ID', 'INVOKE', 'LC_ALL', 'LC_COLLATE',
+ 'ACTIVE-CLASS', 'ALIGNED', 'ANYCASE', 'ARITHMETIC', 'ATTRIBUTE',
+ 'B-AND', 'B-NOT', 'B-OR', 'B-XOR', 'BIT', 'BOOLEAN', 'CD', 'CENTER',
+ 'CF', 'CH', 'CHAIN', 'CLASS-ID', 'CLASSIFICATION', 'COMMUNICATION',
+ 'CONDITION', 'DATA-POINTER', 'DESTINATION', 'DISABLE', 'EC', 'EGI',
+ 'EMI', 'ENABLE', 'END-RECEIVE', 'ENTRY-CONVENTION', 'EO', 'ESI',
+ 'EXCEPTION-OBJECT', 'EXPANDS', 'FACTORY', 'FLOAT-BINARY-16',
+ 'FLOAT-BINARY-34', 'FLOAT-BINARY-7', 'FLOAT-DECIMAL-16',
+ 'FLOAT-DECIMAL-34', 'FLOAT-EXTENDED', 'FORMAT', 'FUNCTION-POINTER',
+ 'GET', 'GROUP-USAGE', 'IMPLEMENTS', 'INFINITY', 'INHERITS',
+ 'INTERFACE', 'INTERFACE-ID', 'INVOKE', 'LC_ALL', 'LC_COLLATE',
'LC_CTYPE', 'LC_MESSAGES', 'LC_MONETARY', 'LC_NUMERIC', 'LC_TIME',
- 'LINE-COUNTER', 'MESSAGE', 'METHOD', 'METHOD-ID', 'NESTED', 'NONE', 'NORMAL',
- 'OBJECT', 'OBJECT-REFERENCE', 'OPTIONS', 'OVERRIDE', 'PAGE-COUNTER', 'PF', 'PH',
- 'PROPERTY', 'PROTOTYPE', 'PURGE', 'QUEUE', 'RAISE', 'RAISING', 'RECEIVE',
- 'RELATION', 'REPLACE', 'REPRESENTS-NOT-A-NUMBER', 'RESET', 'RESUME', 'RETRY',
- 'RF', 'RH', 'SECONDS', 'SEGMENT', 'SELF', 'SEND', 'SOURCES', 'STATEMENT', 'STEP',
- 'STRONG', 'SUB-QUEUE-1', 'SUB-QUEUE-2', 'SUB-QUEUE-3', 'SUPER', 'SYMBOL',
- 'SYSTEM-DEFAULT', 'TABLE', 'TERMINAL', 'TEXT', 'TYPEDEF', 'UCS-4', 'UNIVERSAL',
- 'USER-DEFAULT', 'UTF-16', 'UTF-8', 'VAL-STATUS', 'VALID', 'VALIDATE',
- 'VALIDATE-STATUS'),
- prefix=r'(^|(?<=[^0-9a-z_\-]))', suffix=r'\s*($|(?=[^0-9a-z_\-]))'),
+ 'LINE-COUNTER', 'MESSAGE', 'METHOD', 'METHOD-ID', 'NESTED', 'NONE',
+ 'NORMAL', 'OBJECT', 'OBJECT-REFERENCE', 'OPTIONS', 'OVERRIDE',
+ 'PAGE-COUNTER', 'PF', 'PH', 'PROPERTY', 'PROTOTYPE', 'PURGE',
+ 'QUEUE', 'RAISE', 'RAISING', 'RECEIVE', 'RELATION', 'REPLACE',
+ 'REPRESENTS-NOT-A-NUMBER', 'RESET', 'RESUME', 'RETRY', 'RF', 'RH',
+ 'SECONDS', 'SEGMENT', 'SELF', 'SEND', 'SOURCES', 'STATEMENT',
+ 'STEP', 'STRONG', 'SUB-QUEUE-1', 'SUB-QUEUE-2', 'SUB-QUEUE-3',
+ 'SUPER', 'SYMBOL', 'SYSTEM-DEFAULT', 'TABLE', 'TERMINAL', 'TEXT',
+ 'TYPEDEF', 'UCS-4', 'UNIVERSAL', 'USER-DEFAULT', 'UTF-16', 'UTF-8',
+ 'VAL-STATUS', 'VALID', 'VALIDATE', 'VALIDATE-STATUS'),
+ prefix=r'(^|(?<=[^\w\-]))', suffix=r'\s*($|(?=[^\w\-]))'),
Error),
# Data Types
- (r'(^|(?<=[^0-9a-z_\-]))'
+ (r'(^|(?<=[^\w\-]))'
r'(PIC\s+.+?(?=(\s|\.\s))|PICTURE\s+.+?(?=(\s|\.\s))|'
r'(COMPUTATIONAL)(-[1-5X])?|(COMP)(-[1-5X])?|'
r'BINARY-C-LONG|'
r'BINARY-CHAR|BINARY-DOUBLE|BINARY-LONG|BINARY-SHORT|'
- r'BINARY)\s*($|(?=[^0-9a-z_\-]))', Keyword.Type),
+ r'BINARY)\s*($|(?=[^\w\-]))', Keyword.Type),
# Operators
(r'(\*\*|\*|\+|-|/|<=|>=|<|>|==|/=|=)', Operator),
@@ -180,7 +182,7 @@ class CobolLexer(RegexLexer):
(r'([(),;:&%.])', Punctuation),
# Intrinsics
- (r'(^|(?<=[^0-9a-z_\-]))(ABS|ACOS|ANNUITY|ASIN|ATAN|BYTE-LENGTH|'
+ (r'(^|(?<=[^\w\-]))(ABS|ACOS|ANNUITY|ASIN|ATAN|BYTE-LENGTH|'
r'CHAR|COMBINED-DATETIME|CONCATENATE|COS|CURRENT-DATE|'
r'DATE-OF-INTEGER|DATE-TO-YYYYMMDD|DAY-OF-INTEGER|DAY-TO-YYYYDDD|'
r'EXCEPTION-(?:FILE|LOCATION|STATEMENT|STATUS)|EXP10|EXP|E|'
@@ -192,13 +194,13 @@ class CobolLexer(RegexLexer):
r'STANDARD-DEVIATION|STORED-CHAR-LENGTH|SUBSTITUTE(?:-CASE)?|'
r'SUM|TAN|TEST-DATE-YYYYMMDD|TEST-DAY-YYYYDDD|TRIM|'
r'UPPER-CASE|VARIANCE|WHEN-COMPILED|YEAR-TO-YYYY)\s*'
- r'($|(?=[^0-9a-z_\-]))', Name.Function),
+ r'($|(?=[^\w\-]))', Name.Function),
# Booleans
- (r'(^|(?<=[^0-9a-z_\-]))(true|false)\s*($|(?=[^0-9a-z_\-]))', Name.Builtin),
+ (r'(^|(?<=[^\w\-]))(true|false)\s*($|(?=[^\w\-]))', Name.Builtin),
# Comparing Operators
- (r'(^|(?<=[^0-9a-z_\-]))(equal|equals|ne|lt|le|gt|ge|'
- r'greater|less|than|not|and|or)\s*($|(?=[^0-9a-z_\-]))', Operator.Word),
+ (r'(^|(?<=[^\w\-]))(equal|equals|ne|lt|le|gt|ge|'
+ r'greater|less|than|not|and|or)\s*($|(?=[^\w\-]))', Operator.Word),
],
# \"[^\"\n]*\"|\'[^\'\n]*\'
@@ -439,15 +441,15 @@ class OpenEdgeLexer(RegexLexer):
filenames = ['*.p', '*.cls']
mimetypes = ['text/x-openedge', 'application/x-openedge']
- types = (r'(?i)(^|(?<=[^0-9a-z_\-]))(CHARACTER|CHAR|CHARA|CHARAC|CHARACT|CHARACTE|'
+ types = (r'(?i)(^|(?<=[^\w\-]))(CHARACTER|CHAR|CHARA|CHARAC|CHARACT|CHARACTE|'
r'COM-HANDLE|DATE|DATETIME|DATETIME-TZ|'
r'DECIMAL|DEC|DECI|DECIM|DECIMA|HANDLE|'
r'INT64|INTEGER|INT|INTE|INTEG|INTEGE|'
- r'LOGICAL|LONGCHAR|MEMPTR|RAW|RECID|ROWID)\s*($|(?=[^0-9a-z_\-]))')
+ r'LOGICAL|LONGCHAR|MEMPTR|RAW|RECID|ROWID)\s*($|(?=[^\w\-]))')
keywords = words(OPENEDGEKEYWORDS,
- prefix=r'(?i)(^|(?<=[^0-9a-z_\-]))',
- suffix=r'\s*($|(?=[^0-9a-z_\-]))')
+ prefix=r'(?i)(^|(?<=[^\w\-]))',
+ suffix=r'\s*($|(?=[^\w\-]))')
tokens = {
'root': [
diff --git a/pygments/lexers/c_cpp.py b/pygments/lexers/c_cpp.py
index 5c724d03..632871ba 100644
--- a/pygments/lexers/c_cpp.py
+++ b/pygments/lexers/c_cpp.py
@@ -50,8 +50,9 @@ class CFamilyLexer(RegexLexer):
(r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
],
'statements': [
- (r'L?"', String, 'string'),
- (r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
+ (r'(L?)(")', bygroups(String.Affix, String), 'string'),
+ (r"(L?)(')(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])(')",
+ bygroups(String.Affix, String.Char, String.Char, String.Char)),
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float),
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
(r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
@@ -123,7 +124,8 @@ class CFamilyLexer(RegexLexer):
(r'\\', String), # stray backslash
],
'macro': [
- (r'(include)(' + _ws1 + ')([^\n]+)', bygroups(Comment.Preproc, Text, Comment.PreprocFile)),
+ (r'(include)(' + _ws1 + r')([^\n]+)',
+ bygroups(Comment.Preproc, Text, Comment.PreprocFile)),
(r'[^/\n]+', Comment.Preproc),
(r'/[*](.|\n)*?[*]/', Comment.Multiline),
(r'//.*?\n', Comment.Single, '#pop'),
@@ -217,7 +219,11 @@ class CppLexer(CFamilyLexer):
(r'char(16_t|32_t)\b', Keyword.Type),
(r'(class)(\s+)', bygroups(Keyword, Text), 'classname'),
# C++11 raw strings
- (r'R"\(', String, 'rawstring'),
+ (r'(R)(")([^\\()\s]{,16})(\()((?:.|\n)*?)(\)\3)(")',
+ bygroups(String.Affix, String, String.Delimiter, String.Delimiter,
+ String, String.Delimiter, String)),
+ # C++11 UTF-8/16/32 strings
+ (r'(u8|u|U)(")', bygroups(String.Affix, String), 'string'),
inherit,
],
'root': [
@@ -234,11 +240,6 @@ class CppLexer(CFamilyLexer):
# template specification
(r'\s*(?=>)', Text, '#pop'),
],
- 'rawstring': [
- (r'\)"', String, '#pop'),
- (r'[^)]+', String),
- (r'\)', String),
- ],
}
def analyse_text(text):
diff --git a/pygments/lexers/c_like.py b/pygments/lexers/c_like.py
index d894818d..f4a9c299 100644
--- a/pygments/lexers/c_like.py
+++ b/pygments/lexers/c_like.py
@@ -427,115 +427,115 @@ class ArduinoLexer(CppLexer):
filenames = ['*.ino']
mimetypes = ['text/x-arduino']
- # Language constants
- constants = set(('DIGITAL_MESSAGE', 'FIRMATA_STRING', 'ANALOG_MESSAGE',
- 'REPORT_DIGITAL', 'REPORT_ANALOG', 'INPUT_PULLUP',
- 'SET_PIN_MODE', 'INTERNAL2V56', 'SYSTEM_RESET', 'LED_BUILTIN',
- 'INTERNAL1V1', 'SYSEX_START', 'INTERNAL', 'EXTERNAL',
- 'DEFAULT', 'OUTPUT', 'INPUT', 'HIGH', 'LOW'))
-
# Language sketch main structure functions
structure = set(('setup', 'loop'))
- # Language variable types
- storage = set(('boolean', 'const', 'byte', 'word', 'string', 'String', 'array'))
+ # Language operators
+ operators = set(('not', 'or', 'and', 'xor'))
+
+ # Language 'variables'
+ variables = set((
+ 'DIGITAL_MESSAGE', 'FIRMATA_STRING', 'ANALOG_MESSAGE', 'REPORT_DIGITAL',
+ 'REPORT_ANALOG', 'INPUT_PULLUP', 'SET_PIN_MODE', 'INTERNAL2V56', 'SYSTEM_RESET',
+ 'LED_BUILTIN', 'INTERNAL1V1', 'SYSEX_START', 'INTERNAL', 'EXTERNAL', 'HIGH',
+ 'LOW', 'INPUT', 'OUTPUT', 'INPUT_PULLUP', 'LED_BUILTIN', 'true', 'false',
+ 'void', 'boolean', 'char', 'unsigned char', 'byte', 'int', 'unsigned int',
+ 'word', 'long', 'unsigned long', 'short', 'float', 'double', 'string', 'String',
+ 'array', 'static', 'volatile', 'const', 'boolean', 'byte', 'word', 'string',
+ 'String', 'array', 'int', 'float', 'private', 'char', 'virtual', 'operator',
+ 'sizeof', 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t', 'int8_t', 'int16_t',
+ 'int32_t', 'int64_t', 'dynamic_cast', 'typedef', 'const_cast', 'const',
+ 'struct', 'static_cast', 'union', 'unsigned', 'long', 'volatile', 'static',
+ 'protected', 'bool', 'public', 'friend', 'auto', 'void', 'enum', 'extern',
+ 'class', 'short', 'reinterpret_cast', 'double', 'register', 'explicit',
+ 'signed', 'inline', 'delete', '_Bool', 'complex', '_Complex', '_Imaginary',
+ 'atomic_bool', 'atomic_char', 'atomic_schar', 'atomic_uchar', 'atomic_short',
+ 'atomic_ushort', 'atomic_int', 'atomic_uint', 'atomic_long', 'atomic_ulong',
+ 'atomic_llong', 'atomic_ullong', 'PROGMEM'))
# Language shipped functions and class ( )
- functions = set(('KeyboardController', 'MouseController', 'SoftwareSerial',
- 'EthernetServer', 'EthernetClient', 'LiquidCrystal',
- 'RobotControl', 'GSMVoiceCall', 'EthernetUDP', 'EsploraTFT',
- 'HttpClient', 'RobotMotor', 'WiFiClient', 'GSMScanner',
- 'FileSystem', 'Scheduler', 'GSMServer', 'YunClient', 'YunServer',
- 'IPAddress', 'GSMClient', 'GSMModem', 'Keyboard', 'Ethernet',
- 'Console', 'GSMBand', 'Esplora', 'Stepper', 'Process',
- 'WiFiUDP', 'GSM_SMS', 'Mailbox', 'USBHost', 'Firmata', 'PImage',
- 'Client', 'Server', 'GSMPIN', 'FileIO', 'Bridge', 'Serial',
- 'EEPROM', 'Stream', 'Mouse', 'Audio', 'Servo', 'File', 'Task',
- 'GPRS', 'WiFi', 'Wire', 'TFT', 'GSM', 'SPI', 'SD',
- 'runShellCommandAsynchronously', 'analogWriteResolution',
- 'retrieveCallingNumber', 'printFirmwareVersion',
- 'analogReadResolution', 'sendDigitalPortPair',
- 'noListenOnLocalhost', 'readJoystickButton', 'setFirmwareVersion',
- 'readJoystickSwitch', 'scrollDisplayRight', 'getVoiceCallStatus',
- 'scrollDisplayLeft', 'writeMicroseconds', 'delayMicroseconds',
- 'beginTransmission', 'getSignalStrength', 'runAsynchronously',
- 'getAsynchronously', 'listenOnLocalhost', 'getCurrentCarrier',
- 'readAccelerometer', 'messageAvailable', 'sendDigitalPorts',
- 'lineFollowConfig', 'countryNameWrite', 'runShellCommand',
- 'readStringUntil', 'rewindDirectory', 'readTemperature',
- 'setClockDivider', 'readLightSensor', 'endTransmission',
- 'analogReference', 'detachInterrupt', 'countryNameRead',
- 'attachInterrupt', 'encryptionType', 'readBytesUntil',
- 'robotNameWrite', 'readMicrophone', 'robotNameRead', 'cityNameWrite',
- 'userNameWrite', 'readJoystickY', 'readJoystickX', 'mouseReleased',
- 'openNextFile', 'scanNetworks', 'noInterrupts', 'digitalWrite',
- 'beginSpeaker', 'mousePressed', 'isActionDone', 'mouseDragged',
- 'displayLogos', 'noAutoscroll', 'addParameter', 'remoteNumber',
- 'getModifiers', 'keyboardRead', 'userNameRead', 'waitContinue',
- 'processInput', 'parseCommand', 'printVersion', 'readNetworks',
- 'writeMessage', 'blinkVersion', 'cityNameRead', 'readMessage',
- 'setDataMode', 'parsePacket', 'isListening', 'setBitOrder',
- 'beginPacket', 'isDirectory', 'motorsWrite', 'drawCompass',
- 'digitalRead', 'clearScreen', 'serialEvent', 'rightToLeft',
- 'setTextSize', 'leftToRight', 'requestFrom', 'keyReleased',
- 'compassRead', 'analogWrite', 'interrupts', 'WiFiServer',
- 'disconnect', 'playMelody', 'parseFloat', 'autoscroll',
- 'getPINUsed', 'setPINUsed', 'setTimeout', 'sendAnalog',
- 'readSlider', 'analogRead', 'beginWrite', 'createChar',
- 'motorsStop', 'keyPressed', 'tempoWrite', 'readButton',
- 'subnetMask', 'debugPrint', 'macAddress', 'writeGreen',
- 'randomSeed', 'attachGPRS', 'readString', 'sendString',
- 'remotePort', 'releaseAll', 'mouseMoved', 'background',
- 'getXChange', 'getYChange', 'answerCall', 'getResult',
- 'voiceCall', 'endPacket', 'constrain', 'getSocket', 'writeJSON',
- 'getButton', 'available', 'connected', 'findUntil', 'readBytes',
- 'exitValue', 'readGreen', 'writeBlue', 'startLoop', 'IPAddress',
- 'isPressed', 'sendSysex', 'pauseMode', 'gatewayIP', 'setCursor',
- 'getOemKey', 'tuneWrite', 'noDisplay', 'loadImage', 'switchPIN',
- 'onRequest', 'onReceive', 'changePIN', 'playFile', 'noBuffer',
- 'parseInt', 'overflow', 'checkPIN', 'knobRead', 'beginTFT',
- 'bitClear', 'updateIR', 'bitWrite', 'position', 'writeRGB',
- 'highByte', 'writeRed', 'setSpeed', 'readBlue', 'noStroke',
- 'remoteIP', 'transfer', 'shutdown', 'hangCall', 'beginSMS',
- 'endWrite', 'attached', 'maintain', 'noCursor', 'checkReg',
- 'checkPUK', 'shiftOut', 'isValid', 'shiftIn', 'pulseIn',
- 'connect', 'println', 'localIP', 'pinMode', 'getIMEI',
- 'display', 'noBlink', 'process', 'getBand', 'running', 'beginSD',
- 'drawBMP', 'lowByte', 'setBand', 'release', 'bitRead', 'prepare',
- 'pointTo', 'readRed', 'setMode', 'noFill', 'remove', 'listen',
- 'stroke', 'detach', 'attach', 'noTone', 'exists', 'buffer',
- 'height', 'bitSet', 'circle', 'config', 'cursor', 'random',
- 'IRread', 'sizeof', 'setDNS', 'endSMS', 'getKey', 'micros',
- 'millis', 'begin', 'print', 'write', 'ready', 'flush', 'width',
- 'isPIN', 'blink', 'clear', 'press', 'mkdir', 'rmdir', 'close',
- 'point', 'yield', 'image', 'float', 'BSSID', 'click', 'delay',
- 'read', 'text', 'move', 'peek', 'beep', 'rect', 'line', 'open',
- 'seek', 'fill', 'size', 'turn', 'stop', 'home', 'find', 'char',
- 'byte', 'step', 'word', 'long', 'tone', 'sqrt', 'RSSI', 'SSID',
- 'end', 'bit', 'tan', 'cos', 'sin', 'pow', 'map', 'abs', 'max',
- 'min', 'int', 'get', 'run', 'put'))
-
+ functions = set((
+ 'KeyboardController', 'MouseController', 'SoftwareSerial', 'EthernetServer',
+ 'EthernetClient', 'LiquidCrystal', 'RobotControl', 'GSMVoiceCall',
+ 'EthernetUDP', 'EsploraTFT', 'HttpClient', 'RobotMotor', 'WiFiClient',
+ 'GSMScanner', 'FileSystem', 'Scheduler', 'GSMServer', 'YunClient', 'YunServer',
+ 'IPAddress', 'GSMClient', 'GSMModem', 'Keyboard', 'Ethernet', 'Console',
+ 'GSMBand', 'Esplora', 'Stepper', 'Process', 'WiFiUDP', 'GSM_SMS', 'Mailbox',
+ 'USBHost', 'Firmata', 'PImage', 'Client', 'Server', 'GSMPIN', 'FileIO',
+ 'Bridge', 'Serial', 'EEPROM', 'Stream', 'Mouse', 'Audio', 'Servo', 'File',
+ 'Task', 'GPRS', 'WiFi', 'Wire', 'TFT', 'GSM', 'SPI', 'SD',
+ 'runShellCommandAsynchronously', 'analogWriteResolution',
+ 'retrieveCallingNumber', 'printFirmwareVersion', 'analogReadResolution',
+ 'sendDigitalPortPair', 'noListenOnLocalhost', 'readJoystickButton',
+ 'setFirmwareVersion', 'readJoystickSwitch', 'scrollDisplayRight',
+ 'getVoiceCallStatus', 'scrollDisplayLeft', 'writeMicroseconds',
+ 'delayMicroseconds', 'beginTransmission', 'getSignalStrength',
+ 'runAsynchronously', 'getAsynchronously', 'listenOnLocalhost',
+ 'getCurrentCarrier', 'readAccelerometer', 'messageAvailable',
+ 'sendDigitalPorts', 'lineFollowConfig', 'countryNameWrite', 'runShellCommand',
+ 'readStringUntil', 'rewindDirectory', 'readTemperature', 'setClockDivider',
+ 'readLightSensor', 'endTransmission', 'analogReference', 'detachInterrupt',
+ 'countryNameRead', 'attachInterrupt', 'encryptionType', 'readBytesUntil',
+ 'robotNameWrite', 'readMicrophone', 'robotNameRead', 'cityNameWrite',
+ 'userNameWrite', 'readJoystickY', 'readJoystickX', 'mouseReleased',
+ 'openNextFile', 'scanNetworks', 'noInterrupts', 'digitalWrite', 'beginSpeaker',
+ 'mousePressed', 'isActionDone', 'mouseDragged', 'displayLogos', 'noAutoscroll',
+ 'addParameter', 'remoteNumber', 'getModifiers', 'keyboardRead', 'userNameRead',
+ 'waitContinue', 'processInput', 'parseCommand', 'printVersion', 'readNetworks',
+ 'writeMessage', 'blinkVersion', 'cityNameRead', 'readMessage', 'setDataMode',
+ 'parsePacket', 'isListening', 'setBitOrder', 'beginPacket', 'isDirectory',
+ 'motorsWrite', 'drawCompass', 'digitalRead', 'clearScreen', 'serialEvent',
+ 'rightToLeft', 'setTextSize', 'leftToRight', 'requestFrom', 'keyReleased',
+ 'compassRead', 'analogWrite', 'interrupts', 'WiFiServer', 'disconnect',
+ 'playMelody', 'parseFloat', 'autoscroll', 'getPINUsed', 'setPINUsed',
+ 'setTimeout', 'sendAnalog', 'readSlider', 'analogRead', 'beginWrite',
+ 'createChar', 'motorsStop', 'keyPressed', 'tempoWrite', 'readButton',
+ 'subnetMask', 'debugPrint', 'macAddress', 'writeGreen', 'randomSeed',
+ 'attachGPRS', 'readString', 'sendString', 'remotePort', 'releaseAll',
+ 'mouseMoved', 'background', 'getXChange', 'getYChange', 'answerCall',
+ 'getResult', 'voiceCall', 'endPacket', 'constrain', 'getSocket', 'writeJSON',
+ 'getButton', 'available', 'connected', 'findUntil', 'readBytes', 'exitValue',
+ 'readGreen', 'writeBlue', 'startLoop', 'IPAddress', 'isPressed', 'sendSysex',
+ 'pauseMode', 'gatewayIP', 'setCursor', 'getOemKey', 'tuneWrite', 'noDisplay',
+ 'loadImage', 'switchPIN', 'onRequest', 'onReceive', 'changePIN', 'playFile',
+ 'noBuffer', 'parseInt', 'overflow', 'checkPIN', 'knobRead', 'beginTFT',
+ 'bitClear', 'updateIR', 'bitWrite', 'position', 'writeRGB', 'highByte',
+ 'writeRed', 'setSpeed', 'readBlue', 'noStroke', 'remoteIP', 'transfer',
+ 'shutdown', 'hangCall', 'beginSMS', 'endWrite', 'attached', 'maintain',
+ 'noCursor', 'checkReg', 'checkPUK', 'shiftOut', 'isValid', 'shiftIn', 'pulseIn',
+ 'connect', 'println', 'localIP', 'pinMode', 'getIMEI', 'display', 'noBlink',
+ 'process', 'getBand', 'running', 'beginSD', 'drawBMP', 'lowByte', 'setBand',
+ 'release', 'bitRead', 'prepare', 'pointTo', 'readRed', 'setMode', 'noFill',
+ 'remove', 'listen', 'stroke', 'detach', 'attach', 'noTone', 'exists', 'buffer',
+ 'height', 'bitSet', 'circle', 'config', 'cursor', 'random', 'IRread', 'setDNS',
+ 'endSMS', 'getKey', 'micros', 'millis', 'begin', 'print', 'write', 'ready',
+ 'flush', 'width', 'isPIN', 'blink', 'clear', 'press', 'mkdir', 'rmdir', 'close',
+ 'point', 'yield', 'image', 'BSSID', 'click', 'delay', 'read', 'text', 'move',
+ 'peek', 'beep', 'rect', 'line', 'open', 'seek', 'fill', 'size', 'turn', 'stop',
+ 'home', 'find', 'step', 'tone', 'sqrt', 'RSSI', 'SSID', 'end', 'bit', 'tan',
+ 'cos', 'sin', 'pow', 'map', 'abs', 'max', 'min', 'get', 'run', 'put',
+ 'isAlphaNumeric', 'isAlpha', 'isAscii', 'isWhitespace', 'isControl', 'isDigit',
+ 'isGraph', 'isLowerCase', 'isPrintable', 'isPunct', 'isSpace', 'isUpperCase',
+ 'isHexadecimalDigit'))
+
+ # do not highlight
+ suppress_highlight = set((
+ 'namespace', 'template', 'mutable', 'using', 'asm', 'typeid',
+ 'typename', 'this', 'alignof', 'constexpr', 'decltype', 'noexcept',
+ 'static_assert', 'thread_local', 'restrict'))
+
def get_tokens_unprocessed(self, text):
for index, token, value in CppLexer.get_tokens_unprocessed(self, text):
- if token is Name:
- if value in self.constants:
- yield index, Keyword.Constant, value
- elif value in self.functions:
- yield index, Name.Function, value
- elif value in self.storage:
- yield index, Keyword.Type, value
- else:
- yield index, token, value
- elif token is Name.Function:
- if value in self.structure:
- yield index, Name.Other, value
- else:
- yield index, token, value
- elif token is Keyword:
- if value in self.storage:
- yield index, Keyword.Type, value
- else:
- yield index, token, value
+ if value in self.structure:
+ yield index, Name.Builtin, value
+ elif value in self.operators:
+ yield index, Operator, value
+ elif value in self.variables:
+ yield index, Keyword.Reserved, value
+ elif value in self.suppress_highlight:
+ yield index, Name, value
+ elif value in self.functions:
+ yield index, Name.Function, value
else:
yield index, token, value
diff --git a/pygments/lexers/chapel.py b/pygments/lexers/chapel.py
index 9f9894cd..e6507394 100644
--- a/pygments/lexers/chapel.py
+++ b/pygments/lexers/chapel.py
@@ -42,15 +42,15 @@ class ChapelLexer(RegexLexer):
(r'(bool|complex|imag|int|opaque|range|real|string|uint)\b',
Keyword.Type),
(words((
- 'align', 'atomic', 'begin', 'break', 'by', 'cobegin', 'coforall',
- 'continue', 'delete', 'dmapped', 'do', 'domain', 'else', 'enum',
- 'except', 'export', 'extern', 'for', 'forall', 'if', 'index',
- 'inline', 'iter', 'label', 'lambda', 'let', 'local', 'new',
- 'noinit', 'on', 'only', 'otherwise', 'pragma', 'private',
- 'public', 'reduce', 'require', 'return', 'scan', 'select',
- 'serial', 'single', 'sparse', 'subdomain', 'sync', 'then',
- 'use', 'when', 'where', 'while', 'with', 'yield', 'zip'),
- suffix=r'\b'),
+ 'align', 'as', 'atomic', 'begin', 'break', 'by', 'cobegin',
+ 'coforall', 'continue', 'delete', 'dmapped', 'do', 'domain',
+ 'else', 'enum', 'except', 'export', 'extern', 'for', 'forall',
+ 'if', 'index', 'inline', 'iter', 'label', 'lambda', 'let',
+ 'local', 'new', 'noinit', 'on', 'only', 'otherwise', 'pragma',
+ 'private', 'public', 'reduce', 'require', 'return', 'scan',
+ 'select', 'serial', 'single', 'sparse', 'subdomain', 'sync',
+ 'then', 'use', 'when', 'where', 'while', 'with', 'yield',
+ 'zip'), suffix=r'\b'),
Keyword),
(r'(proc)((?:\s|\\\s)+)', bygroups(Keyword, Text), 'procname'),
(r'(class|module|record|union)(\s+)', bygroups(Keyword, Text),
diff --git a/pygments/lexers/clean.py b/pygments/lexers/clean.py
new file mode 100644
index 00000000..a3e81534
--- /dev/null
+++ b/pygments/lexers/clean.py
@@ -0,0 +1,275 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.lexers.clean
+ ~~~~~~~~~~~~~~~~~~~~~
+
+ Lexer for the Clean language.
+
+ :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+from pygments.lexer import ExtendedRegexLexer, LexerContext, \
+ bygroups, words, include, default
+from pygments.token import Comment, Keyword, Literal, Name, Number, Operator, \
+ Punctuation, String, Text, Whitespace
+
+__all__ = ['CleanLexer']
+
+
+class CleanLexer(ExtendedRegexLexer):
+ """
+ Lexer for the general purpose, state-of-the-art, pure and lazy functional
+ programming language Clean (http://clean.cs.ru.nl/Clean).
+
+ .. versionadded: 2.2
+ """
+ name = 'Clean'
+ aliases = ['clean']
+ filenames = ['*.icl', '*.dcl']
+
+ def get_tokens_unprocessed(self, text=None, context=None):
+ ctx = LexerContext(text, 0)
+ ctx.indent = 0
+ return ExtendedRegexLexer.get_tokens_unprocessed(self, text, context=ctx)
+
+ def check_class_not_import(lexer, match, ctx):
+ if match.group(0) == 'import':
+ yield match.start(), Keyword.Namespace, match.group(0)
+ ctx.stack = ctx.stack[:-1] + ['fromimportfunc']
+ else:
+ yield match.start(), Name.Class, match.group(0)
+ ctx.pos = match.end()
+
+ def check_instance_class(lexer, match, ctx):
+ if match.group(0) == 'instance' or match.group(0) == 'class':
+ yield match.start(), Keyword, match.group(0)
+ else:
+ yield match.start(), Name.Function, match.group(0)
+ ctx.stack = ctx.stack + ['fromimportfunctype']
+ ctx.pos = match.end()
+
+ @staticmethod
+ def indent_len(text):
+ # Tabs are four spaces:
+ # https://svn.cs.ru.nl/repos/clean-platform/trunk/doc/STANDARDS.txt
+ text = text.replace('\n', '')
+ return len(text.replace('\t', ' ')), len(text)
+
+ def store_indent(lexer, match, ctx):
+ ctx.indent, _ = CleanLexer.indent_len(match.group(0))
+ ctx.pos = match.end()
+ yield match.start(), Text, match.group(0)
+
+ def check_indent1(lexer, match, ctx):
+ indent, reallen = CleanLexer.indent_len(match.group(0))
+ if indent > ctx.indent:
+ yield match.start(), Whitespace, match.group(0)
+ ctx.pos = match.start() + reallen + 1
+ else:
+ ctx.indent = 0
+ ctx.pos = match.start()
+ ctx.stack = ctx.stack[:-1]
+ yield match.start(), Whitespace, match.group(0)[1:]
+
+ def check_indent2(lexer, match, ctx):
+ indent, reallen = CleanLexer.indent_len(match.group(0))
+ if indent > ctx.indent:
+ yield match.start(), Whitespace, match.group(0)
+ ctx.pos = match.start() + reallen + 1
+ else:
+ ctx.indent = 0
+ ctx.pos = match.start()
+ ctx.stack = ctx.stack[:-2]
+
+ def check_indent3(lexer, match, ctx):
+ indent, reallen = CleanLexer.indent_len(match.group(0))
+ if indent > ctx.indent:
+ yield match.start(), Whitespace, match.group(0)
+ ctx.pos = match.start() + reallen + 1
+ else:
+ ctx.indent = 0
+ ctx.pos = match.start()
+ ctx.stack = ctx.stack[:-3]
+ yield match.start(), Whitespace, match.group(0)[1:]
+ if match.group(0) == '\n\n':
+ ctx.pos = ctx.pos + 1
+
+ def skip(lexer, match, ctx):
+ ctx.stack = ctx.stack[:-1]
+ ctx.pos = match.end()
+ yield match.start(), Comment, match.group(0)
+
+ keywords = ('class', 'instance', 'where', 'with', 'let', 'let!', 'with',
+ 'in', 'case', 'of', 'infix', 'infixr', 'infixl', 'generic',
+ 'derive', 'otherwise', 'code', 'inline')
+
+ tokens = {
+ 'common': [
+ (r';', Punctuation, '#pop'),
+ (r'//', Comment, 'singlecomment'),
+ ],
+ 'root': [
+ # Comments
+ (r'//.*\n', Comment.Single),
+ (r'(?s)/\*\*.*?\*/', Comment.Special),
+ (r'(?s)/\*.*?\*/', Comment.Multi),
+
+ # Modules, imports, etc.
+ (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'),
+
+ # Keywords
+ # We cannot use (?s)^|(?<=\s) as prefix, so need to repeat this
+ (words(keywords, prefix=r'(?<=\s)', suffix=r'(?=\s)'), Keyword),
+ (words(keywords, prefix=r'^', suffix=r'(?=\s)'), Keyword),
+
+ # Function definitions
+ (r'(?=\{\|)', Whitespace, 'genericfunction'),
+ (r'(?<=\n)([ \t]*)([\w`$()=\-<>~*\^|+&%]+)((?:\s+[\w])*)(\s*)(::)',
+ bygroups(store_indent, Name.Function, Keyword.Type, Whitespace,
+ Punctuation),
+ 'functiondefargs'),
+
+ # Type definitions
+ (r'(?<=\n)([ \t]*)(::)', bygroups(store_indent, Punctuation), 'typedef'),
+ (r'^([ \t]*)(::)', bygroups(store_indent, Punctuation), 'typedef'),
+
+ # Literals
+ (r'\'\\?.(?<!\\)\'', String.Char),
+ (r'\'\\\d+\'', String.Char),
+ (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),
+ (r'[+\-~]?\s*\d+\b', Number.Integer),
+ (r'"', String.Double, 'doubleqstring'),
+ (words(('True', 'False'), prefix=r'(?<=\s)', suffix=r'(?=\s)'),
+ Literal),
+
+ # Everything else is some name
+ (r'([\w`$%]+\.?)*[\w`$%]+', Name),
+
+ # Punctuation
+ (r'[{}()\[\],:;.#]', Punctuation),
+ (r'[+\-=!<>|&~*\^/]', Operator),
+ (r'\\\\', Operator),
+
+ # Lambda expressions
+ (r'\\.*?(->|\.|=)', Name.Function),
+
+ # Whitespace
+ (r'\s', Whitespace),
+
+ include('common'),
+ ],
+ 'fromimport': [
+ include('common'),
+ (r'([\w`]+)', check_class_not_import),
+ (r'\n', Whitespace, '#pop'),
+ (r'\s', Whitespace),
+ ],
+ 'fromimportfunc': [
+ include('common'),
+ (r'([\w`$()=\-<>~*\^|+&%]+)', check_instance_class),
+ (r',', Punctuation),
+ (r'\n', Whitespace, '#pop'),
+ (r'\s', Whitespace),
+ ],
+ 'fromimportfunctype': [
+ include('common'),
+ (r'[{(\[]', Punctuation, 'combtype'),
+ (r',', Punctuation, '#pop'),
+ (r'[:;.#]', Punctuation),
+ (r'\n', Whitespace, '#pop:2'),
+ (r'[^\S\n]+', Whitespace),
+ (r'\S+', Keyword.Type),
+ ],
+ 'combtype': [
+ include('common'),
+ (r'[})\]]', Punctuation, '#pop'),
+ (r'[{(\[]', Punctuation, '#pop'),
+ (r'[,:;.#]', Punctuation),
+ (r'\s+', Whitespace),
+ (r'\S+', Keyword.Type),
+ ],
+ 'import': [
+ include('common'),
+ (words(('from', 'import', 'as', 'qualified'),
+ prefix='(?<=\s)', suffix='(?=\s)'), Keyword.Namespace),
+ (r'[\w`]+', Name.Class),
+ (r'\n', Whitespace, '#pop'),
+ (r',', Punctuation),
+ (r'[^\S\n]+', Whitespace),
+ ],
+ 'singlecomment': [
+ (r'(.)(?=\n)', skip),
+ (r'.+(?!\n)', Comment),
+ ],
+ 'doubleqstring': [
+ (r'[^\\"]+', String.Double),
+ (r'"', String.Double, '#pop'),
+ (r'\\.', String.Double),
+ ],
+ 'typedef': [
+ include('common'),
+ (r'[\w`]+', Keyword.Type),
+ (r'[:=|(),\[\]{}!*]', Punctuation),
+ (r'->', Punctuation),
+ (r'\n(?=[^\s|])', Whitespace, '#pop'),
+ (r'\s', Whitespace),
+ (r'.', Keyword.Type),
+ ],
+ 'genericfunction': [
+ include('common'),
+ (r'\{\|', Punctuation),
+ (r'\|\}', Punctuation, '#pop'),
+ (r',', Punctuation),
+ (r'->', Punctuation),
+ (r'(\s+of\s+)(\{)', bygroups(Keyword, Punctuation), 'genericftypes'),
+ (r'\s', Whitespace),
+ (r'[\w`]+', Keyword.Type),
+ (r'[*()]', Punctuation),
+ ],
+ 'genericftypes': [
+ include('common'),
+ (r'[\w`]+', Keyword.Type),
+ (r',', Punctuation),
+ (r'\s', Whitespace),
+ (r'\}', Punctuation, '#pop'),
+ ],
+ 'functiondefargs': [
+ include('common'),
+ (r'\n(\s*)', check_indent1),
+ (r'[!{}()\[\],:;.#]', Punctuation),
+ (r'->', Punctuation, 'functiondefres'),
+ (r'^(?=\S)', Whitespace, '#pop'),
+ (r'\S', Keyword.Type),
+ (r'\s', Whitespace),
+ ],
+ 'functiondefres': [
+ include('common'),
+ (r'\n(\s*)', check_indent2),
+ (r'^(?=\S)', Whitespace, '#pop:2'),
+ (r'[!{}()\[\],:;.#]', Punctuation),
+ (r'\|', Punctuation, 'functiondefclasses'),
+ (r'\S', Keyword.Type),
+ (r'\s', Whitespace),
+ ],
+ 'functiondefclasses': [
+ include('common'),
+ (r'\n(\s*)', check_indent3),
+ (r'^(?=\S)', Whitespace, '#pop:3'),
+ (r'[,&]', Punctuation),
+ (r'[\w`$()=\-<>~*\^|+&%]', Name.Function, 'functionname'),
+ (r'\s', Whitespace),
+ ],
+ 'functionname': [
+ include('common'),
+ (r'[\w`$()=\-<>~*\^|+&%]+', Name.Function),
+ (r'(?=\{\|)', Punctuation, 'genericfunction'),
+ default('#pop'),
+ ]
+ }
diff --git a/pygments/lexers/configs.py b/pygments/lexers/configs.py
index c46d8bb8..9cc291e5 100644
--- a/pygments/lexers/configs.py
+++ b/pygments/lexers/configs.py
@@ -39,8 +39,10 @@ class IniLexer(RegexLexer):
(r'[;#].*', Comment.Single),
(r'\[.*?\]$', Keyword),
(r'(.*?)([ \t]*)(=)([ \t]*)(.*(?:\n[ \t].+)*)',
- bygroups(Name.Attribute, Text, Operator, Text, String))
- ]
+ bygroups(Name.Attribute, Text, Operator, Text, String)),
+ # standalone option, supported by some INI parsers
+ (r'(.+?)$', Name.Attribute),
+ ],
}
def analyse_text(text):
@@ -598,7 +600,7 @@ class TerraformLexer(RegexLexer):
(r'(".*")', bygroups(String.Double)),
],
'punctuation': [
- (r'[\[\]\(\),.]', Punctuation),
+ (r'[\[\](),.]', Punctuation),
],
# Keep this seperate from punctuation - we sometimes want to use different
# Tokens for { }
@@ -629,9 +631,8 @@ class TermcapLexer(RegexLexer):
.. versionadded:: 2.1
"""
name = 'Termcap'
- aliases = ['termcap',]
-
- filenames = ['termcap', 'termcap.src',]
+ aliases = ['termcap']
+ filenames = ['termcap', 'termcap.src']
mimetypes = []
# NOTE:
@@ -642,13 +643,13 @@ class TermcapLexer(RegexLexer):
tokens = {
'root': [
(r'^#.*$', Comment),
- (r'^[^\s#:\|]+', Name.Tag, 'names'),
+ (r'^[^\s#:|]+', Name.Tag, 'names'),
],
'names': [
(r'\n', Text, '#pop'),
(r':', Punctuation, 'defs'),
(r'\|', Punctuation),
- (r'[^:\|]+', Name.Attribute),
+ (r'[^:|]+', Name.Attribute),
],
'defs': [
(r'\\\n[ \t]*', Text),
@@ -676,9 +677,8 @@ class TerminfoLexer(RegexLexer):
.. versionadded:: 2.1
"""
name = 'Terminfo'
- aliases = ['terminfo',]
-
- filenames = ['terminfo', 'terminfo.src',]
+ aliases = ['terminfo']
+ filenames = ['terminfo', 'terminfo.src']
mimetypes = []
# NOTE:
@@ -689,13 +689,13 @@ class TerminfoLexer(RegexLexer):
tokens = {
'root': [
(r'^#.*$', Comment),
- (r'^[^\s#,\|]+', Name.Tag, 'names'),
+ (r'^[^\s#,|]+', Name.Tag, 'names'),
],
'names': [
(r'\n', Text, '#pop'),
(r'(,)([ \t]*)', bygroups(Punctuation, Text), 'defs'),
(r'\|', Punctuation),
- (r'[^,\|]+', Name.Attribute),
+ (r'[^,|]+', Name.Attribute),
],
'defs': [
(r'\n[ \t]+', Text),
@@ -724,8 +724,8 @@ class PkgConfigLexer(RegexLexer):
"""
name = 'PkgConfig'
- aliases = ['pkgconfig',]
- filenames = ['*.pc',]
+ aliases = ['pkgconfig']
+ filenames = ['*.pc']
mimetypes = []
tokens = {
@@ -791,8 +791,8 @@ class PacmanConfLexer(RegexLexer):
"""
name = 'PacmanConf'
- aliases = ['pacmanconf',]
- filenames = ['pacman.conf',]
+ aliases = ['pacmanconf']
+ filenames = ['pacman.conf']
mimetypes = []
tokens = {
@@ -820,7 +820,7 @@ class PacmanConfLexer(RegexLexer):
'%u', # url
), suffix=r'\b'),
Name.Variable),
-
+
# fallback
(r'.', Text),
],
diff --git a/pygments/lexers/csound.py b/pygments/lexers/csound.py
index 51414073..95ee73d8 100644
--- a/pygments/lexers/csound.py
+++ b/pygments/lexers/csound.py
@@ -9,7 +9,7 @@
:license: BSD, see LICENSE for details.
"""
-import copy, re
+import re
from pygments.lexer import RegexLexer, bygroups, default, include, using, words
from pygments.token import Comment, Keyword, Name, Number, Operator, Punctuation, \
@@ -21,7 +21,7 @@ from pygments.lexers.scripting import LuaLexer
__all__ = ['CsoundScoreLexer', 'CsoundOrchestraLexer', 'CsoundDocumentLexer']
-newline = (r'((?:;|//).*)*(\n)', bygroups(Comment.Single, Text))
+newline = (r'((?:(?:;|//).*)*)(\n)', bygroups(Comment.Single, Text))
class CsoundLexer(RegexLexer):
@@ -177,7 +177,7 @@ class CsoundOrchestraLexer(CsoundLexer):
(r'0[xX][a-fA-F0-9]+', Number.Hex),
(r'\d+', Number.Integer),
(r'"', String, 'single-line string'),
- (r'{{', String, 'multi-line string'),
+ (r'\{\{', String, 'multi-line string'),
(r'[+\-*/%^!=&|<>#~¬]', Operator),
(r'[](),?:[]', Punctuation),
(words((
@@ -273,40 +273,40 @@ class CsoundOrchestraLexer(CsoundLexer):
(r'[\\"~$%\^\n]', String)
],
'multi-line string': [
- (r'}}', String, '#pop'),
- (r'[^\}]+|\}(?!\})', String)
+ (r'\}\}', String, '#pop'),
+ (r'[^}]+|\}(?!\})', String)
],
'scoreline opcode': [
include('whitespace or macro call'),
- (r'{{', String, 'scoreline'),
+ (r'\{\{', String, 'scoreline'),
default('#pop')
],
'scoreline': [
- (r'}}', String, '#pop'),
- (r'([^\}]+)|\}(?!\})', using(CsoundScoreLexer))
+ (r'\}\}', String, '#pop'),
+ (r'([^}]+)|\}(?!\})', using(CsoundScoreLexer))
],
'python opcode': [
include('whitespace or macro call'),
- (r'{{', String, 'python'),
+ (r'\{\{', String, 'python'),
default('#pop')
],
'python': [
- (r'}}', String, '#pop'),
- (r'([^\}]+)|\}(?!\})', using(PythonLexer))
+ (r'\}\}', String, '#pop'),
+ (r'([^}]+)|\}(?!\})', using(PythonLexer))
],
'lua opcode': [
include('whitespace or macro call'),
(r'"', String, 'single-line string'),
- (r'{{', String, 'lua'),
+ (r'\{\{', String, 'lua'),
(r',', Punctuation),
default('#pop')
],
'lua': [
- (r'}}', String, '#pop'),
- (r'([^\}]+)|\}(?!\})', using(LuaLexer))
+ (r'\}\}', String, '#pop'),
+ (r'([^}]+)|\}(?!\})', using(LuaLexer))
]
}
@@ -315,7 +315,7 @@ class CsoundDocumentLexer(RegexLexer):
"""
For `Csound <http://csound.github.io>`_ documents.
-
+ .. versionadded:: 2.1
"""
name = 'Csound Document'
diff --git a/pygments/lexers/css.py b/pygments/lexers/css.py
index b40201f4..6c585dfa 100644
--- a/pygments/lexers/css.py
+++ b/pygments/lexers/css.py
@@ -476,8 +476,8 @@ class ScssLexer(RegexLexer):
(r'@[\w-]+', Keyword, 'selector'),
(r'(\$[\w-]*\w)([ \t]*:)', bygroups(Name.Variable, Operator), 'value'),
# TODO: broken, and prone to infinite loops.
- #(r'(?=[^;{}][;}])', Name.Attribute, 'attr'),
- #(r'(?=[^;{}:]+:[^a-z])', Name.Attribute, 'attr'),
+ # (r'(?=[^;{}][;}])', Name.Attribute, 'attr'),
+ # (r'(?=[^;{}:]+:[^a-z])', Name.Attribute, 'attr'),
default('selector'),
],
@@ -518,7 +518,7 @@ class LessCssLexer(CssLexer):
inherit,
],
'content': [
- (r'{', Punctuation, '#push'),
+ (r'\{', Punctuation, '#push'),
inherit,
],
}
diff --git a/pygments/lexers/diff.py b/pygments/lexers/diff.py
index d3b1589d..726b49ad 100644
--- a/pygments/lexers/diff.py
+++ b/pygments/lexers/diff.py
@@ -9,11 +9,13 @@
:license: BSD, see LICENSE for details.
"""
+import re
+
from pygments.lexer import RegexLexer, include, bygroups
from pygments.token import Text, Comment, Operator, Keyword, Name, Generic, \
Literal
-__all__ = ['DiffLexer', 'DarcsPatchLexer']
+__all__ = ['DiffLexer', 'DarcsPatchLexer', 'WDiffLexer']
class DiffLexer(RegexLexer):
@@ -104,3 +106,60 @@ class DarcsPatchLexer(RegexLexer):
(r'[^\n\[]+', Generic.Deleted),
],
}
+
+
+class WDiffLexer(RegexLexer):
+ """
+ A `wdiff <https://www.gnu.org/software/wdiff/>`_ lexer.
+
+ Note that:
+
+ * only to normal output (without option like -l).
+ * if target files of wdiff contain "[-", "-]", "{+", "+}",
+ especially they are unbalanced, this lexer will get confusing.
+
+ .. versionadded:: 2.2
+ """
+
+ name = 'WDiff'
+ aliases = ['wdiff']
+ filenames = ['*.wdiff']
+ mimetypes = []
+
+ flags = re.MULTILINE | re.DOTALL
+
+ # We can only assume "[-" after "[-" before "-]" is `nested`,
+ # for instance wdiff to wdiff outputs. We have no way to
+ # distinct these marker is of wdiff output from original text.
+
+ ins_op = r"\{\+"
+ ins_cl = r"\+\}"
+ del_op = r"\[\-"
+ del_cl = r"\-\]"
+ normal = r'[^{}[\]+-]+' # for performance
+ tokens = {
+ 'root': [
+ (ins_op, Generic.Inserted, 'inserted'),
+ (del_op, Generic.Deleted, 'deleted'),
+ (normal, Text),
+ (r'.', Text),
+ ],
+ 'inserted': [
+ (ins_op, Generic.Inserted, '#push'),
+ (del_op, Generic.Inserted, '#push'),
+ (del_cl, Generic.Inserted, '#pop'),
+
+ (ins_cl, Generic.Inserted, '#pop'),
+ (normal, Generic.Inserted),
+ (r'.', Generic.Inserted),
+ ],
+ 'deleted': [
+ (del_op, Generic.Deleted, '#push'),
+ (ins_op, Generic.Deleted, '#push'),
+ (ins_cl, Generic.Deleted, '#pop'),
+
+ (del_cl, Generic.Deleted, '#pop'),
+ (normal, Generic.Deleted),
+ (r'.', Generic.Deleted),
+ ],
+ }
diff --git a/pygments/lexers/dotnet.py b/pygments/lexers/dotnet.py
index eac4b5e5..11b4573e 100644
--- a/pygments/lexers/dotnet.py
+++ b/pygments/lexers/dotnet.py
@@ -11,7 +11,7 @@
import re
from pygments.lexer import RegexLexer, DelegatingLexer, bygroups, include, \
- using, this, default
+ using, this, default, words
from pygments.token import Punctuation, \
Text, Comment, Operator, Keyword, Name, String, Number, Literal, Other
from pygments.util import get_choice_opt, iteritems
@@ -375,8 +375,8 @@ class VbNetLexer(RegexLexer):
filenames = ['*.vb', '*.bas']
mimetypes = ['text/x-vbnet', 'text/x-vba'] # (?)
- uni_name = '[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' + \
- '[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc',
+ uni_name = '[_' + uni.combine('Ll', 'Lt', 'Lm', 'Nl') + ']' + \
+ '[' + uni.combine('Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc',
'Cf', 'Mn', 'Mc') + ']*'
flags = re.MULTILINE | re.IGNORECASE
@@ -394,25 +394,26 @@ class VbNetLexer(RegexLexer):
(r'[(){}!#,.:]', Punctuation),
(r'Option\s+(Strict|Explicit|Compare)\s+'
r'(On|Off|Binary|Text)', Keyword.Declaration),
- (r'(?<!\.)(AddHandler|Alias|'
- r'ByRef|ByVal|Call|Case|Catch|CBool|CByte|CChar|CDate|'
- r'CDec|CDbl|CInt|CLng|CObj|Continue|CSByte|CShort|'
- r'CSng|CStr|CType|CUInt|CULng|CUShort|Declare|'
- r'Default|Delegate|DirectCast|Do|Each|Else|ElseIf|'
- r'EndIf|Erase|Error|Event|Exit|False|Finally|For|'
- r'Friend|Get|Global|GoSub|GoTo|Handles|If|'
- r'Implements|Inherits|Interface|'
- r'Let|Lib|Loop|Me|MustInherit|'
- r'MustOverride|MyBase|MyClass|Narrowing|New|Next|'
- r'Not|Nothing|NotInheritable|NotOverridable|Of|On|'
- r'Operator|Option|Optional|Overloads|Overridable|'
- r'Overrides|ParamArray|Partial|Private|Protected|'
- r'Public|RaiseEvent|ReadOnly|ReDim|RemoveHandler|Resume|'
- r'Return|Select|Set|Shadows|Shared|Single|'
- r'Static|Step|Stop|SyncLock|Then|'
- r'Throw|To|True|Try|TryCast|Wend|'
- r'Using|When|While|Widening|With|WithEvents|'
- r'WriteOnly)\b', Keyword),
+ (words((
+ 'AddHandler', 'Alias', 'ByRef', 'ByVal', 'Call', 'Case',
+ 'Catch', 'CBool', 'CByte', 'CChar', 'CDate', 'CDec', 'CDbl',
+ 'CInt', 'CLng', 'CObj', 'Continue', 'CSByte', 'CShort', 'CSng',
+ 'CStr', 'CType', 'CUInt', 'CULng', 'CUShort', 'Declare',
+ 'Default', 'Delegate', 'DirectCast', 'Do', 'Each', 'Else',
+ 'ElseIf', 'EndIf', 'Erase', 'Error', 'Event', 'Exit', 'False',
+ 'Finally', 'For', 'Friend', 'Get', 'Global', 'GoSub', 'GoTo',
+ 'Handles', 'If', 'Implements', 'Inherits', 'Interface', 'Let',
+ 'Lib', 'Loop', 'Me', 'MustInherit', 'MustOverride', 'MyBase',
+ 'MyClass', 'Narrowing', 'New', 'Next', 'Not', 'Nothing',
+ 'NotInheritable', 'NotOverridable', 'Of', 'On', 'Operator',
+ 'Option', 'Optional', 'Overloads', 'Overridable', 'Overrides',
+ 'ParamArray', 'Partial', 'Private', 'Protected', 'Public',
+ 'RaiseEvent', 'ReadOnly', 'ReDim', 'RemoveHandler', 'Resume',
+ 'Return', 'Select', 'Set', 'Shadows', 'Shared', 'Single',
+ 'Static', 'Step', 'Stop', 'SyncLock', 'Then', 'Throw', 'To',
+ 'True', 'Try', 'TryCast', 'Wend', 'Using', 'When', 'While',
+ 'Widening', 'With', 'WithEvents', 'WriteOnly'),
+ prefix='(?<!\.)', suffix=r'\b'), Keyword),
(r'(?<!\.)End\b', Keyword, 'end'),
(r'(?<!\.)(Dim|Const)\b', Keyword, 'dim'),
(r'(?<!\.)(Function|Sub|Property)(\s+)',
diff --git a/pygments/lexers/dsls.py b/pygments/lexers/dsls.py
index 24fda2a2..6032017f 100644
--- a/pygments/lexers/dsls.py
+++ b/pygments/lexers/dsls.py
@@ -5,7 +5,7 @@
Lexers for various domain-specific languages.
- :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2016 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -18,7 +18,7 @@ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
__all__ = ['ProtoBufLexer', 'BroLexer', 'PuppetLexer', 'RslLexer',
'MscgenLexer', 'VGLLexer', 'AlloyLexer', 'PanLexer',
- 'CrmshLexer', 'ThriftLexer']
+ 'CrmshLexer', 'ThriftLexer', 'FlatlineLexer']
class ProtoBufLexer(RegexLexer):
@@ -111,8 +111,8 @@ class ThriftLexer(RegexLexer):
include('keywords'),
include('numbers'),
(r'[&=]', Operator),
- (r'[:;\,\{\}\(\)\<>\[\]]', Punctuation),
- (r'[a-zA-Z_](\.[a-zA-Z_0-9]|[a-zA-Z_0-9])*', Name),
+ (r'[:;,{}()<>\[\]]', Punctuation),
+ (r'[a-zA-Z_](\.\w|\w)*', Name),
],
'whitespace': [
(r'\n', Text.Whitespace),
@@ -135,7 +135,7 @@ class ThriftLexer(RegexLexer):
(r'[^\\\'\n]+', String.Single),
],
'namespace': [
- (r'[a-z\*](\.[a-zA-Z_0-9]|[a-zA-Z_0-9])*', Name.Namespace, '#pop'),
+ (r'[a-z*](\.\w|\w)*', Name.Namespace, '#pop'),
default('#pop'),
],
'class': [
@@ -692,3 +692,78 @@ class CrmshLexer(RegexLexer):
(r'\s+|\n', Whitespace),
],
}
+
+
+class FlatlineLexer(RegexLexer):
+ """
+ Lexer for `Flatline <https://github.com/bigmlcom/flatline>`_ expressions.
+
+ .. versionadded:: 2.2
+ """
+ name = 'Flatline'
+ aliases = ['flatline']
+ filenames = []
+ mimetypes = ['text/x-flatline']
+
+ special_forms = ('let',)
+
+ builtins = (
+ "!=", "*", "+", "-", "<", "<=", "=", ">", ">=", "abs", "acos", "all",
+ "all-but", "all-with-defaults", "all-with-numeric-default", "and",
+ "asin", "atan", "avg", "avg-window", "bin-center", "bin-count", "call",
+ "category-count", "ceil", "cond", "cond-window", "cons", "cos", "cosh",
+ "count", "diff-window", "div", "ensure-value", "ensure-weighted-value",
+ "epoch", "epoch-day", "epoch-fields", "epoch-hour", "epoch-millisecond",
+ "epoch-minute", "epoch-month", "epoch-second", "epoch-weekday",
+ "epoch-year", "exp", "f", "field", "field-prop", "fields", "filter",
+ "first", "floor", "head", "if", "in", "integer", "language", "length",
+ "levenshtein", "linear-regression", "list", "ln", "log", "log10", "map",
+ "matches", "matches?", "max", "maximum", "md5", "mean", "median", "min",
+ "minimum", "missing", "missing-count", "missing?", "missing_count",
+ "mod", "mode", "normalize", "not", "nth", "occurrences", "or",
+ "percentile", "percentile-label", "population", "population-fraction",
+ "pow", "preferred", "preferred?", "quantile-label", "rand", "rand-int",
+ "random-value", "re-quote", "real", "replace", "replace-first", "rest",
+ "round", "row-number", "segment-label", "sha1", "sha256", "sin", "sinh",
+ "sqrt", "square", "standard-deviation", "standard_deviation", "str",
+ "subs", "sum", "sum-squares", "sum-window", "sum_squares", "summary",
+ "summary-no", "summary-str", "tail", "tan", "tanh", "to-degrees",
+ "to-radians", "variance", "vectorize", "weighted-random-value", "window",
+ "winnow", "within-percentiles?", "z-score",
+ )
+
+ valid_name = r'(?!#)[\w!$%*+<=>?/.#-]+'
+
+ tokens = {
+ 'root': [
+ # whitespaces - usually not relevant
+ (r'[,\s]+', Text),
+
+ # numbers
+ (r'-?\d+\.\d+', Number.Float),
+ (r'-?\d+', Number.Integer),
+ (r'0x-?[a-f\d]+', Number.Hex),
+
+ # strings, symbols and characters
+ (r'"(\\\\|\\"|[^"])*"', String),
+ (r"\\(.|[a-z]+)", String.Char),
+
+ # expression template placeholder
+ (r'_', String.Symbol),
+
+ # highlight the special forms
+ (words(special_forms, suffix=' '), Keyword),
+
+ # highlight the builtins
+ (words(builtins, suffix=' '), Name.Builtin),
+
+ # the remaining functions
+ (r'(?<=\()' + valid_name, Name.Function),
+
+ # find the remaining variables
+ (valid_name, Name.Variable),
+
+ # parentheses
+ (r'(\(|\))', Punctuation),
+ ],
+ }
diff --git a/pygments/lexers/elm.py b/pygments/lexers/elm.py
index 7df6346a..cd1fb98e 100644
--- a/pygments/lexers/elm.py
+++ b/pygments/lexers/elm.py
@@ -46,7 +46,7 @@ class ElmLexer(RegexLexer):
'root': [
# Comments
- (r'{-', Comment.Multiline, 'comment'),
+ (r'\{-', Comment.Multiline, 'comment'),
(r'--.*', Comment.Single),
# Whitespace
@@ -86,20 +86,20 @@ class ElmLexer(RegexLexer):
(validName, Name.Variable),
# Parens
- (r'[,\(\)\[\]{}]', Punctuation),
+ (r'[,()\[\]{}]', Punctuation),
],
'comment': [
- (r'-(?!})', Comment.Multiline),
- (r'{-', Comment.Multiline, 'comment'),
+ (r'-(?!\})', Comment.Multiline),
+ (r'\{-', Comment.Multiline, 'comment'),
(r'[^-}]', Comment.Multiline),
- (r'-}', Comment.Multiline, '#pop'),
+ (r'-\}', Comment.Multiline, '#pop'),
],
'doublequote': [
- (r'\\u[0-9a-fA-F]\{4}', String.Escape),
- (r'\\[nrfvb\\\"]', String.Escape),
+ (r'\\u[0-9a-fA-F]{4}', String.Escape),
+ (r'\\[nrfvb\\"]', String.Escape),
(r'[^"]', String),
(r'"', String, '#pop'),
],
diff --git a/pygments/lexers/erlang.py b/pygments/lexers/erlang.py
index c353a4dc..93ddd2c2 100644
--- a/pygments/lexers/erlang.py
+++ b/pygments/lexers/erlang.py
@@ -82,7 +82,11 @@ class ErlangLexer(RegexLexer):
variable_re = r'(?:[A-Z_]\w*)'
- escape_re = r'(?:\\(?:[bdefnrstv\'"\\/]|[0-7][0-7]?[0-7]?|\^[a-zA-Z]))'
+ esc_char_re = r'[bdefnrstv\'"\\]'
+ esc_octal_re = r'[0-7][0-7]?[0-7]?'
+ esc_hex_re = r'(?:x[0-9a-fA-F]{2}|x\{[0-9a-fA-F]+\})'
+ esc_ctrl_re = r'\^[a-zA-Z]'
+ escape_re = r'(?:\\(?:'+esc_char_re+r'|'+esc_octal_re+r'|'+esc_hex_re+r'|'+esc_ctrl_re+r'))'
macro_re = r'(?:'+variable_re+r'|'+atom_re+r')'
@@ -112,11 +116,18 @@ class ErlangLexer(RegexLexer):
(r'\?'+macro_re, Name.Constant),
(r'\$(?:'+escape_re+r'|\\[ %]|[^\\])', String.Char),
(r'#'+atom_re+r'(:?\.'+atom_re+r')?', Name.Label),
+
+ # Erlang script shebang
+ (r'\A#!.+\n', Comment.Hashbang),
+
+ # EEP 43: Maps
+ # http://www.erlang.org/eeps/eep-0043.html
+ (r'#\{', Punctuation, 'map_key'),
],
'string': [
(escape_re, String.Escape),
(r'"', String, '#pop'),
- (r'~[0-9.*]*[~#+bBcdefginpPswWxX]', String.Interpol),
+ (r'~[0-9.*]*[~#+BPWXb-ginpswx]', String.Interpol),
(r'[^"\\~]+', String),
(r'~', String),
],
@@ -127,6 +138,17 @@ class ErlangLexer(RegexLexer):
bygroups(Name.Entity, Text, Punctuation, Name.Label), '#pop'),
(atom_re, Name.Entity, '#pop'),
],
+ 'map_key': [
+ include('root'),
+ (r'=>', Punctuation, 'map_val'),
+ (r':=', Punctuation, 'map_val'),
+ (r'\}', Punctuation, '#pop'),
+ ],
+ 'map_val': [
+ include('root'),
+ (r',', Punctuation, '#pop'),
+ (r'(?=\})', Punctuation, '#pop'),
+ ],
}
@@ -218,11 +240,11 @@ class ElixirLexer(RegexLexer):
KEYWORD_OPERATOR = ('not', 'and', 'or', 'when', 'in')
BUILTIN = (
'case', 'cond', 'for', 'if', 'unless', 'try', 'receive', 'raise',
- 'quote', 'unquote', 'unquote_splicing', 'throw', 'super'
+ 'quote', 'unquote', 'unquote_splicing', 'throw', 'super',
)
BUILTIN_DECLARATION = (
'def', 'defp', 'defmodule', 'defprotocol', 'defmacro', 'defmacrop',
- 'defdelegate', 'defexception', 'defstruct', 'defimpl', 'defcallback'
+ 'defdelegate', 'defexception', 'defstruct', 'defimpl', 'defcallback',
)
BUILTIN_NAMESPACE = ('import', 'require', 'use', 'alias')
@@ -241,7 +263,7 @@ class ElixirLexer(RegexLexer):
OPERATORS1 = ('<', '>', '+', '-', '*', '/', '!', '^', '&')
PUNCTUATION = (
- '\\\\', '<<', '>>', '=>', '(', ')', ':', ';', ',', '[', ']'
+ '\\\\', '<<', '>>', '=>', '(', ')', ':', ';', ',', '[', ']',
)
def get_tokens_unprocessed(self, text):
diff --git a/pygments/lexers/esoteric.py b/pygments/lexers/esoteric.py
index 73ea4a4a..c9db26b5 100644
--- a/pygments/lexers/esoteric.py
+++ b/pygments/lexers/esoteric.py
@@ -11,9 +11,9 @@
from pygments.lexer import RegexLexer, include, words
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
- Number, Punctuation, Error, Whitespace
+ Number, Punctuation, Error
-__all__ = ['BrainfuckLexer', 'BefungeLexer', 'BoogieLexer', 'RedcodeLexer', 'CAmkESLexer']
+__all__ = ['BrainfuckLexer', 'BefungeLexer', 'RedcodeLexer', 'CAmkESLexer']
class BrainfuckLexer(RegexLexer):
@@ -90,7 +90,7 @@ class CAmkESLexer(RegexLexer):
filenames = ['*.camkes', '*.idl4']
tokens = {
- 'root':[
+ 'root': [
# C pre-processor directive
(r'^\s*#.*\n', Comment.Preproc),
@@ -99,21 +99,25 @@ class CAmkESLexer(RegexLexer):
(r'/\*(.|\n)*?\*/', Comment),
(r'//.*\n', Comment),
- (r'[\[\(\){},\.;=\]]', Punctuation),
+ (r'[\[(){},.;\]]', Punctuation),
+ (r'[~!%^&*+=|?:<>/-]', Operator),
(words(('assembly', 'attribute', 'component', 'composition',
'configuration', 'connection', 'connector', 'consumes',
- 'control', 'dataport', 'Dataport', 'emits', 'event',
- 'Event', 'from', 'group', 'hardware', 'has', 'interface',
- 'Interface', 'maybe', 'procedure', 'Procedure', 'provides',
- 'template', 'to', 'uses'), suffix=r'\b'), Keyword),
+ 'control', 'dataport', 'Dataport', 'Dataports', 'emits',
+ 'event', 'Event', 'Events', 'export', 'from', 'group',
+ 'hardware', 'has', 'interface', 'Interface', 'maybe',
+ 'procedure', 'Procedure', 'Procedures', 'provides',
+ 'template', 'thread', 'threads', 'to', 'uses', 'with'),
+ suffix=r'\b'), Keyword),
(words(('bool', 'boolean', 'Buf', 'char', 'character', 'double',
'float', 'in', 'inout', 'int', 'int16_6', 'int32_t',
'int64_t', 'int8_t', 'integer', 'mutex', 'out', 'real',
- 'refin', 'semaphore', 'signed', 'string', 'uint16_t',
- 'uint32_t', 'uint64_t', 'uint8_t', 'uintptr_t', 'unsigned',
- 'void'), suffix=r'\b'), Keyword.Type),
+ 'refin', 'semaphore', 'signed', 'string', 'struct',
+ 'uint16_t', 'uint32_t', 'uint64_t', 'uint8_t', 'uintptr_t',
+ 'unsigned', 'void'),
+ suffix=r'\b'), Keyword.Type),
# Recognised attributes
(r'[a-zA-Z_]\w*_(priority|domain|buffer)', Keyword.Reserved),
@@ -131,6 +135,7 @@ class CAmkESLexer(RegexLexer):
(r'-?[\d]+', Number),
(r'-?[\d]+\.[\d]+', Number.Float),
(r'"[^"]*"', String),
+ (r'[Tt]rue|[Ff]alse', Name.Builtin),
# Identifiers
(r'[a-zA-Z_]\w*', Name),
@@ -172,48 +177,3 @@ class RedcodeLexer(RegexLexer):
(r'[-+]?\d+', Number.Integer),
],
}
-
-
-class BoogieLexer(RegexLexer):
- """
- For `Boogie <https://boogie.codeplex.com/>`_ source code.
-
- .. versionadded:: 2.1
- """
- name = 'Boogie'
- aliases = ['boogie']
- filenames = ['*.bpl']
-
- tokens = {
- 'root': [
- # Whitespace and Comments
- (r'\n', Whitespace),
- (r'\s+', Whitespace),
- (r'//[/!](.*?)\n', Comment.Doc),
- (r'//(.*?)\n', Comment.Single),
- (r'/\*', Comment.Multiline, 'comment'),
-
- (words((
- 'axiom', 'break', 'call', 'ensures', 'else', 'exists', 'function',
- 'forall', 'if', 'invariant', 'modifies', 'procedure', 'requires',
- 'then', 'var', 'while'),
- suffix=r'\b'), Keyword),
- (words(('const',), suffix=r'\b'), Keyword.Reserved),
-
- (words(('bool', 'int', 'ref'), suffix=r'\b'), Keyword.Type),
- include('numbers'),
- (r"(>=|<=|:=|!=|==>|&&|\|\||[+/\-=>*<\[\]])", Operator),
- (r"([{}():;,.])", Punctuation),
- # Identifier
- (r'[a-zA-Z_]\w*', Name),
- ],
- 'comment': [
- (r'[^*/]+', Comment.Multiline),
- (r'/\*', Comment.Multiline, '#push'),
- (r'\*/', Comment.Multiline, '#pop'),
- (r'[*/]', Comment.Multiline),
- ],
- 'numbers': [
- (r'[0-9]+', Number.Integer),
- ],
- }
diff --git a/pygments/lexers/felix.py b/pygments/lexers/felix.py
index b7659769..9631bcc1 100644
--- a/pygments/lexers/felix.py
+++ b/pygments/lexers/felix.py
@@ -237,7 +237,7 @@ class FelixLexer(RegexLexer):
],
'strings': [
(r'%(\([a-zA-Z0-9]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?'
- '[hlL]?[diouxXeEfFgGcrs%]', String.Interpol),
+ '[hlL]?[E-GXc-giorsux%]', String.Interpol),
(r'[^\\\'"%\n]+', String),
# quotes, percents and backslashes must be parsed one at a time
(r'[\'"\\]', String),
diff --git a/pygments/lexers/fortran.py b/pygments/lexers/fortran.py
index 4c22139d..e2f95b11 100644
--- a/pygments/lexers/fortran.py
+++ b/pygments/lexers/fortran.py
@@ -11,7 +11,7 @@
import re
-from pygments.lexer import RegexLexer, bygroups, include, words, using
+from pygments.lexer import RegexLexer, bygroups, include, words, using, default
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
Number, Punctuation, Generic
@@ -191,16 +191,15 @@ class FortranFixedLexer(RegexLexer):
(r'(.{5})', Name.Label, 'cont-char'),
(r'.*\n', using(FortranLexer)),
],
-
'cont-char': [
(' ', Text, 'code'),
('0', Comment, 'code'),
- ('.', Generic.Strong, 'code')
+ ('.', Generic.Strong, 'code'),
],
-
'code': [
(r'(.{66})(.*)(\n)',
bygroups(_lex_fortran, Comment, Text), 'root'),
(r'(.*)(\n)', bygroups(_lex_fortran, Text), 'root'),
- (r'', Text, 'root')]
+ default('root'),
+ ]
}
diff --git a/pygments/lexers/grammar_notation.py b/pygments/lexers/grammar_notation.py
index 460914f4..d59cc61c 100644
--- a/pygments/lexers/grammar_notation.py
+++ b/pygments/lexers/grammar_notation.py
@@ -9,11 +9,13 @@
:license: BSD, see LICENSE for details.
"""
-from pygments.lexer import RegexLexer, bygroups, words
-from pygments.token import Punctuation, Text, Comment, Operator, \
- Keyword, Name, Literal
+import re
-__all__ = ['BnfLexer', 'AbnfLexer']
+from pygments.lexer import RegexLexer, bygroups, include, this, using, words
+from pygments.token import Comment, Keyword, Literal, Name, Number, \
+ Operator, Punctuation, String, Text
+
+__all__ = ['BnfLexer', 'AbnfLexer', 'JsgfLexer']
class BnfLexer(RegexLexer):
@@ -129,3 +131,83 @@ class AbnfLexer(RegexLexer):
(r'.', Text),
],
}
+
+
+class JsgfLexer(RegexLexer):
+ """
+ For `JSpeech Grammar Format <https://www.w3.org/TR/jsgf/>`_
+ grammars.
+
+ .. versionadded:: 2.2
+ """
+ name = 'JSGF'
+ aliases = ['jsgf']
+ filenames = ['*.jsgf']
+ mimetypes = ['application/jsgf', 'application/x-jsgf', 'text/jsgf']
+
+ flags = re.MULTILINE | re.UNICODE
+
+ tokens = {
+ 'root': [
+ include('comments'),
+ include('non-comments'),
+ ],
+ 'comments': [
+ (r'/\*\*(?!/)', Comment.Multiline, 'documentation comment'),
+ (r'/\*[\w\W]*?\*/', Comment.Multiline),
+ (r'//.*', Comment.Single),
+ ],
+ 'non-comments': [
+ ('\A#JSGF[^;]*', Comment.Preproc),
+ (r'\s+', Text),
+ (r';', Punctuation),
+ (r'[=|()\[\]*+]', Operator),
+ (r'/[^/]+/', Number.Float),
+ (r'"', String.Double, 'string'),
+ (r'\{', String.Other, 'tag'),
+ (words(('import', 'public'), suffix=r'\b'), Keyword.Reserved),
+ (r'grammar\b', Keyword.Reserved, 'grammar name'),
+ (r'(<)(NULL|VOID)(>)',
+ bygroups(Punctuation, Name.Builtin, Punctuation)),
+ (r'<', Punctuation, 'rulename'),
+ (r'\w+|[^\s;=|()\[\]*+/"{<\w]+', Text),
+ ],
+ 'string': [
+ (r'"', String.Double, '#pop'),
+ (r'\\.', String.Escape),
+ (r'[^\\"]+', String.Double),
+ ],
+ 'tag': [
+ (r'\}', String.Other, '#pop'),
+ (r'\\.', String.Escape),
+ (r'[^\\}]+', String.Other),
+ ],
+ 'grammar name': [
+ (r';', Punctuation, '#pop'),
+ (r'\s+', Text),
+ (r'\.', Punctuation),
+ (r'[^;\s.]+', Name.Namespace),
+ ],
+ 'rulename': [
+ (r'>', Punctuation, '#pop'),
+ (r'\*', Punctuation),
+ (r'\s+', Text),
+ (r'([^.>]+)(\s*)(\.)', bygroups(Name.Namespace, Text, Punctuation)),
+ (r'[^.>]+', Name.Constant),
+ ],
+ 'documentation comment': [
+ (r'\*/', Comment.Multiline, '#pop'),
+ (r'(^\s*\*?\s*)(@(?:example|see)\s+)'
+ r'([\w\W]*?(?=(?:^\s*\*?\s*@|\*/)))',
+ bygroups(Comment.Multiline, Comment.Special,
+ using(this, state='example'))),
+ (r'(^\s*\*?\s*)(@\S*)',
+ bygroups(Comment.Multiline, Comment.Special)),
+ (r'[^*\n@]+|\w|\W', Comment.Multiline),
+ ],
+ 'example': [
+ (r'\n\s*\*', Comment.Multiline),
+ include('non-comments'),
+ (r'.', Comment.Multiline),
+ ],
+ }
diff --git a/pygments/lexers/haskell.py b/pygments/lexers/haskell.py
index 95e68a33..ffc3a3a2 100644
--- a/pygments/lexers/haskell.py
+++ b/pygments/lexers/haskell.py
@@ -321,7 +321,7 @@ class AgdaLexer(RegexLexer):
'module': [
(r'\{-', Comment.Multiline, 'comment'),
(r'[a-zA-Z][\w.]*', Name, '#pop'),
- (r'[^a-zA-Z]+', Text)
+ (r'[\W0-9_]+', Text)
],
'comment': HaskellLexer.tokens['comment'],
'character': HaskellLexer.tokens['character'],
diff --git a/pygments/lexers/idl.py b/pygments/lexers/idl.py
index d745bcfd..a0b39492 100644
--- a/pygments/lexers/idl.py
+++ b/pygments/lexers/idl.py
@@ -258,12 +258,13 @@ class IDLLexer(RegexLexer):
(r'\b(mod|lt|le|eq|ne|ge|gt|not|and|or|xor)\b', Operator),
(r'"[^\"]*"', String.Double),
(r"'[^\']*'", String.Single),
- (r'\b[\+\-]?([0-9]*\.[0-9]+|[0-9]+\.[0-9]*)(D|E)?([\+\-]?[0-9]+)?\b', Number.Float),
- (r'\b\'[\+\-]?[0-9A-F]+\'X(U?(S?|L{1,2})|B)\b', Number.Hex),
- (r'\b\'[\+\-]?[0-7]+\'O(U?(S?|L{1,2})|B)\b', Number.Oct),
- (r'\b[\+\-]?[0-9]+U?L{1,2}\b', Number.Integer.Long),
- (r'\b[\+\-]?[0-9]+U?S?\b', Number.Integer),
- (r'\b[\+\-]?[0-9]+B\b', Number),
+ (r'\b[+\-]?([0-9]*\.[0-9]+|[0-9]+\.[0-9]*)(D|E)?([+\-]?[0-9]+)?\b',
+ Number.Float),
+ (r'\b\'[+\-]?[0-9A-F]+\'X(U?(S?|L{1,2})|B)\b', Number.Hex),
+ (r'\b\'[+\-]?[0-7]+\'O(U?(S?|L{1,2})|B)\b', Number.Oct),
+ (r'\b[+\-]?[0-9]+U?L{1,2}\b', Number.Integer.Long),
+ (r'\b[+\-]?[0-9]+U?S?\b', Number.Integer),
+ (r'\b[+\-]?[0-9]+B\b', Number),
(r'.', Text),
]
}
diff --git a/pygments/lexers/igor.py b/pygments/lexers/igor.py
index b0eaf6aa..17fedf88 100644
--- a/pygments/lexers/igor.py
+++ b/pygments/lexers/igor.py
@@ -40,7 +40,7 @@ class IgorLexer(RegexLexer):
types = (
'variable', 'string', 'constant', 'strconstant', 'NVAR', 'SVAR', 'WAVE',
'STRUCT', 'dfref', 'funcref', 'char', 'uchar', 'int16', 'uint16', 'int32',
- 'uint32', 'float', 'double'
+ 'uint32', 'int64', 'uint64', 'float', 'double'
)
keywords = (
'override', 'ThreadSafe', 'MultiThread', 'static', 'Proc',
@@ -48,213 +48,221 @@ class IgorLexer(RegexLexer):
'Structure', 'EndStructure', 'EndMacro', 'Menu', 'SubMenu'
)
operations = (
- 'Abort', 'AddFIFOData', 'AddFIFOVectData', 'AddMovieAudio',
- 'AddMovieFrame', 'APMath', 'Append', 'AppendImage',
- 'AppendLayoutObject', 'AppendMatrixContour', 'AppendText',
- 'AppendToGraph', 'AppendToLayout', 'AppendToTable', 'AppendXYZContour',
- 'AutoPositionWindow', 'BackgroundInfo', 'Beep', 'BoundingBall',
- 'BrowseURL', 'BuildMenu', 'Button', 'cd', 'Chart', 'CheckBox',
- 'CheckDisplayed', 'ChooseColor', 'Close', 'CloseMovie', 'CloseProc',
- 'ColorScale', 'ColorTab2Wave', 'Concatenate', 'ControlBar',
- 'ControlInfo', 'ControlUpdate', 'ConvexHull', 'Convolve', 'CopyFile',
- 'CopyFolder', 'CopyScales', 'Correlate', 'CreateAliasShortcut', 'Cross',
- 'CtrlBackground', 'CtrlFIFO', 'CtrlNamedBackground', 'Cursor',
- 'CurveFit', 'CustomControl', 'CWT', 'Debugger', 'DebuggerOptions',
- 'DefaultFont', 'DefaultGuiControls', 'DefaultGuiFont', 'DefineGuide',
- 'DelayUpdate', 'DeleteFile', 'DeleteFolder', 'DeletePoints',
- 'Differentiate', 'dir', 'Display', 'DisplayHelpTopic',
- 'DisplayProcedure', 'DoAlert', 'DoIgorMenu', 'DoUpdate', 'DoWindow',
- 'DoXOPIdle', 'DrawAction', 'DrawArc', 'DrawBezier', 'DrawLine',
- 'DrawOval', 'DrawPICT', 'DrawPoly', 'DrawRect', 'DrawRRect', 'DrawText',
- 'DSPDetrend', 'DSPPeriodogram', 'Duplicate', 'DuplicateDataFolder',
- 'DWT', 'EdgeStats', 'Edit', 'ErrorBars', 'Execute', 'ExecuteScriptText',
- 'ExperimentModified', 'Extract', 'FastGaussTransform', 'FastOp',
- 'FBinRead', 'FBinWrite', 'FFT', 'FIFO2Wave', 'FIFOStatus', 'FilterFIR',
- 'FilterIIR', 'FindLevel', 'FindLevels', 'FindPeak', 'FindPointsInPoly',
- 'FindRoots', 'FindSequence', 'FindValue', 'FPClustering', 'fprintf',
- 'FReadLine', 'FSetPos', 'FStatus', 'FTPDelete', 'FTPDownload',
- 'FTPUpload', 'FuncFit', 'FuncFitMD', 'GetAxis', 'GetFileFolderInfo',
- 'GetLastUserMenuInfo', 'GetMarquee', 'GetSelection', 'GetWindow',
- 'GraphNormal', 'GraphWaveDraw', 'GraphWaveEdit', 'Grep', 'GroupBox',
- 'Hanning', 'HideIgorMenus', 'HideInfo', 'HideProcedures', 'HideTools',
- 'HilbertTransform', 'Histogram', 'IFFT', 'ImageAnalyzeParticles',
- 'ImageBlend', 'ImageBoundaryToMask', 'ImageEdgeDetection',
- 'ImageFileInfo', 'ImageFilter', 'ImageFocus', 'ImageGenerateROIMask',
- 'ImageHistModification', 'ImageHistogram', 'ImageInterpolate',
- 'ImageLineProfile', 'ImageLoad', 'ImageMorphology', 'ImageRegistration',
- 'ImageRemoveBackground', 'ImageRestore', 'ImageRotate', 'ImageSave',
- 'ImageSeedFill', 'ImageSnake', 'ImageStats', 'ImageThreshold',
- 'ImageTransform', 'ImageUnwrapPhase', 'ImageWindow', 'IndexSort',
- 'InsertPoints', 'Integrate', 'IntegrateODE', 'Interp3DPath',
- 'Interpolate3D', 'KillBackground', 'KillControl', 'KillDataFolder',
- 'KillFIFO', 'KillFreeAxis', 'KillPath', 'KillPICTs', 'KillStrings',
- 'KillVariables', 'KillWaves', 'KillWindow', 'KMeans', 'Label', 'Layout',
- 'Legend', 'LinearFeedbackShiftRegister', 'ListBox', 'LoadData',
- 'LoadPackagePreferences', 'LoadPICT', 'LoadWave', 'Loess',
- 'LombPeriodogram', 'Make', 'MakeIndex', 'MarkPerfTestTime',
- 'MatrixConvolve', 'MatrixCorr', 'MatrixEigenV', 'MatrixFilter',
- 'MatrixGaussJ', 'MatrixInverse', 'MatrixLinearSolve',
- 'MatrixLinearSolveTD', 'MatrixLLS', 'MatrixLUBkSub', 'MatrixLUD',
- 'MatrixMultiply', 'MatrixOP', 'MatrixSchur', 'MatrixSolve',
- 'MatrixSVBkSub', 'MatrixSVD', 'MatrixTranspose', 'MeasureStyledText',
- 'Modify', 'ModifyContour', 'ModifyControl', 'ModifyControlList',
- 'ModifyFreeAxis', 'ModifyGraph', 'ModifyImage', 'ModifyLayout',
- 'ModifyPanel', 'ModifyTable', 'ModifyWaterfall', 'MoveDataFolder',
- 'MoveFile', 'MoveFolder', 'MoveString', 'MoveSubwindow', 'MoveVariable',
- 'MoveWave', 'MoveWindow', 'NeuralNetworkRun', 'NeuralNetworkTrain',
- 'NewDataFolder', 'NewFIFO', 'NewFIFOChan', 'NewFreeAxis', 'NewImage',
- 'NewLayout', 'NewMovie', 'NewNotebook', 'NewPanel', 'NewPath',
- 'NewWaterfall', 'Note', 'Notebook', 'NotebookAction', 'Open',
- 'OpenNotebook', 'Optimize', 'ParseOperationTemplate', 'PathInfo',
- 'PauseForUser', 'PauseUpdate', 'PCA', 'PlayMovie', 'PlayMovieAction',
- 'PlaySnd', 'PlaySound', 'PopupContextualMenu', 'PopupMenu',
- 'Preferences', 'PrimeFactors', 'Print', 'printf', 'PrintGraphs',
- 'PrintLayout', 'PrintNotebook', 'PrintSettings', 'PrintTable',
- 'Project', 'PulseStats', 'PutScrapText', 'pwd', 'Quit',
- 'RatioFromNumber', 'Redimension', 'Remove', 'RemoveContour',
+ 'Abort', 'AddFIFOData', 'AddFIFOVectData', 'AddMovieAudio', 'AddMovieFrame',
+ 'AdoptFiles', 'APMath', 'Append', 'AppendImage', 'AppendLayoutObject',
+ 'AppendMatrixContour', 'AppendText', 'AppendToGizmo', 'AppendToGraph',
+ 'AppendToLayout', 'AppendToTable', 'AppendXYZContour', 'AutoPositionWindow',
+ 'BackgroundInfo', 'Beep', 'BoundingBall', 'BoxSmooth', 'BrowseURL', 'BuildMenu',
+ 'Button', 'cd', 'Chart', 'CheckBox', 'CheckDisplayed', 'ChooseColor', 'Close',
+ 'CloseHelp', 'CloseMovie', 'CloseProc', 'ColorScale', 'ColorTab2Wave',
+ 'Concatenate', 'ControlBar', 'ControlInfo', 'ControlUpdate',
+ 'ConvertGlobalStringTextEncoding', 'ConvexHull', 'Convolve', 'CopyFile',
+ 'CopyFolder', 'CopyScales', 'Correlate', 'CreateAliasShortcut', 'CreateBrowser',
+ 'Cross', 'CtrlBackground', 'CtrlFIFO', 'CtrlNamedBackground', 'Cursor',
+ 'CurveFit', 'CustomControl', 'CWT', 'Debugger', 'DebuggerOptions', 'DefaultFont',
+ 'DefaultGuiControls', 'DefaultGuiFont', 'DefaultTextEncoding', 'DefineGuide',
+ 'DelayUpdate', 'DeleteAnnotations', 'DeleteFile', 'DeleteFolder', 'DeletePoints',
+ 'Differentiate', 'dir', 'Display', 'DisplayHelpTopic', 'DisplayProcedure',
+ 'DoAlert', 'DoIgorMenu', 'DoUpdate', 'DoWindow', 'DoXOPIdle', 'DPSS',
+ 'DrawAction', 'DrawArc', 'DrawBezier', 'DrawLine', 'DrawOval', 'DrawPICT',
+ 'DrawPoly', 'DrawRect', 'DrawRRect', 'DrawText', 'DrawUserShape', 'DSPDetrend',
+ 'DSPPeriodogram', 'Duplicate', 'DuplicateDataFolder', 'DWT', 'EdgeStats', 'Edit',
+ 'ErrorBars', 'EstimatePeakSizes', 'Execute', 'ExecuteScriptText',
+ 'ExperimentModified', 'ExportGizmo', 'Extract', 'FastGaussTransform', 'FastOp',
+ 'FBinRead', 'FBinWrite', 'FFT', 'FIFOStatus', 'FIFO2Wave', 'FilterFIR',
+ 'FilterIIR', 'FindAPeak', 'FindContour', 'FindDuplicates', 'FindLevel',
+ 'FindLevels', 'FindPeak', 'FindPointsInPoly', 'FindRoots', 'FindSequence',
+ 'FindValue', 'FPClustering', 'fprintf', 'FReadLine', 'FSetPos', 'FStatus',
+ 'FTPCreateDirectory', 'FTPDelete', 'FTPDownload', 'FTPUpload', 'FuncFit',
+ 'FuncFitMD', 'GBLoadWave', 'GetAxis', 'GetCamera', 'GetFileFolderInfo',
+ 'GetGizmo', 'GetLastUserMenuInfo', 'GetMarquee', 'GetMouse', 'GetSelection',
+ 'GetWindow', 'GPIBReadBinaryWave2', 'GPIBReadBinary2', 'GPIBReadWave2',
+ 'GPIBRead2', 'GPIBWriteBinaryWave2', 'GPIBWriteBinary2', 'GPIBWriteWave2',
+ 'GPIBWrite2', 'GPIB2', 'GraphNormal', 'GraphWaveDraw', 'GraphWaveEdit', 'Grep',
+ 'GroupBox', 'Hanning', 'HDF5CloseFile', 'HDF5CloseGroup', 'HDF5ConvertColors',
+ 'HDF5CreateFile', 'HDF5CreateGroup', 'HDF5CreateLink', 'HDF5Dump',
+ 'HDF5DumpErrors', 'HDF5DumpState', 'HDF5ListAttributes', 'HDF5ListGroup',
+ 'HDF5LoadData', 'HDF5LoadGroup', 'HDF5LoadImage', 'HDF5OpenFile', 'HDF5OpenGroup',
+ 'HDF5SaveData', 'HDF5SaveGroup', 'HDF5SaveImage', 'HDF5TestOperation',
+ 'HDF5UnlinkObject', 'HideIgorMenus', 'HideInfo', 'HideProcedures', 'HideTools',
+ 'HilbertTransform', 'Histogram', 'ICA', 'IFFT', 'ImageAnalyzeParticles',
+ 'ImageBlend', 'ImageBoundaryToMask', 'ImageEdgeDetection', 'ImageFileInfo',
+ 'ImageFilter', 'ImageFocus', 'ImageFromXYZ', 'ImageGenerateROIMask', 'ImageGLCM',
+ 'ImageHistModification', 'ImageHistogram', 'ImageInterpolate', 'ImageLineProfile',
+ 'ImageLoad', 'ImageMorphology', 'ImageRegistration', 'ImageRemoveBackground',
+ 'ImageRestore', 'ImageRotate', 'ImageSave', 'ImageSeedFill', 'ImageSkeleton3d',
+ 'ImageSnake', 'ImageStats', 'ImageThreshold', 'ImageTransform',
+ 'ImageUnwrapPhase', 'ImageWindow', 'IndexSort', 'InsertPoints', 'Integrate',
+ 'IntegrateODE', 'Integrate2D', 'Interpolate2', 'Interpolate3D', 'Interp3DPath',
+ 'JCAMPLoadWave', 'JointHistogram', 'KillBackground', 'KillControl',
+ 'KillDataFolder', 'KillFIFO', 'KillFreeAxis', 'KillPath', 'KillPICTs',
+ 'KillStrings', 'KillVariables', 'KillWaves', 'KillWindow', 'KMeans', 'Label',
+ 'Layout', 'LayoutPageAction', 'LayoutSlideShow', 'Legend',
+ 'LinearFeedbackShiftRegister', 'ListBox', 'LoadData', 'LoadPackagePreferences',
+ 'LoadPICT', 'LoadWave', 'Loess', 'LombPeriodogram', 'Make', 'MakeIndex',
+ 'MarkPerfTestTime', 'MatrixConvolve', 'MatrixCorr', 'MatrixEigenV',
+ 'MatrixFilter', 'MatrixGaussJ', 'MatrixGLM', 'MatrixInverse', 'MatrixLinearSolve',
+ 'MatrixLinearSolveTD', 'MatrixLLS', 'MatrixLUBkSub', 'MatrixLUD', 'MatrixLUDTD',
+ 'MatrixMultiply', 'MatrixOP', 'MatrixSchur', 'MatrixSolve', 'MatrixSVBkSub',
+ 'MatrixSVD', 'MatrixTranspose', 'MeasureStyledText', 'MLLoadWave', 'Modify',
+ 'ModifyBrowser', 'ModifyCamera', 'ModifyContour', 'ModifyControl',
+ 'ModifyControlList', 'ModifyFreeAxis', 'ModifyGizmo', 'ModifyGraph',
+ 'ModifyImage', 'ModifyLayout', 'ModifyPanel', 'ModifyTable', 'ModifyWaterfall',
+ 'MoveDataFolder', 'MoveFile', 'MoveFolder', 'MoveString', 'MoveSubwindow',
+ 'MoveVariable', 'MoveWave', 'MoveWindow', 'MultiTaperPSD',
+ 'MultiThreadingControl', 'NeuralNetworkRun', 'NeuralNetworkTrain', 'NewCamera',
+ 'NewDataFolder', 'NewFIFO', 'NewFIFOChan', 'NewFreeAxis', 'NewGizmo', 'NewImage',
+ 'NewLayout', 'NewMovie', 'NewNotebook', 'NewPanel', 'NewPath', 'NewWaterfall',
+ 'NI4882', 'Note', 'Notebook', 'NotebookAction', 'Open', 'OpenHelp',
+ 'OpenNotebook', 'Optimize', 'ParseOperationTemplate', 'PathInfo', 'PauseForUser',
+ 'PauseUpdate', 'PCA', 'PlayMovie', 'PlayMovieAction', 'PlaySound',
+ 'PopupContextualMenu', 'PopupMenu', 'Preferences', 'PrimeFactors', 'Print',
+ 'printf', 'PrintGraphs', 'PrintLayout', 'PrintNotebook', 'PrintSettings',
+ 'PrintTable', 'Project', 'PulseStats', 'PutScrapText', 'pwd', 'Quit',
+ 'RatioFromNumber', 'Redimension', 'Remove', 'RemoveContour', 'RemoveFromGizmo',
'RemoveFromGraph', 'RemoveFromLayout', 'RemoveFromTable', 'RemoveImage',
- 'RemoveLayoutObjects', 'RemovePath', 'Rename', 'RenameDataFolder',
- 'RenamePath', 'RenamePICT', 'RenameWindow', 'ReorderImages',
- 'ReorderTraces', 'ReplaceText', 'ReplaceWave', 'Resample',
- 'ResumeUpdate', 'Reverse', 'Rotate', 'Save', 'SaveData',
- 'SaveExperiment', 'SaveGraphCopy', 'SaveNotebook',
- 'SavePackagePreferences', 'SavePICT', 'SaveTableCopy',
- 'SetActiveSubwindow', 'SetAxis', 'SetBackground', 'SetDashPattern',
- 'SetDataFolder', 'SetDimLabel', 'SetDrawEnv', 'SetDrawLayer',
- 'SetFileFolderInfo', 'SetFormula', 'SetIgorHook', 'SetIgorMenuMode',
- 'SetIgorOption', 'SetMarquee', 'SetProcessSleep', 'SetRandomSeed',
- 'SetScale', 'SetVariable', 'SetWaveLock', 'SetWindow', 'ShowIgorMenus',
- 'ShowInfo', 'ShowTools', 'Silent', 'Sleep', 'Slider', 'Smooth',
- 'SmoothCustom', 'Sort', 'SoundInRecord', 'SoundInSet',
- 'SoundInStartChart', 'SoundInStatus', 'SoundInStopChart',
- 'SphericalInterpolate', 'SphericalTriangulate', 'SplitString',
- 'sprintf', 'sscanf', 'Stack', 'StackWindows',
+ 'RemoveLayoutObjects', 'RemovePath', 'Rename', 'RenameDataFolder', 'RenamePath',
+ 'RenamePICT', 'RenameWindow', 'ReorderImages', 'ReorderTraces', 'ReplaceText',
+ 'ReplaceWave', 'Resample', 'ResumeUpdate', 'Reverse', 'Rotate', 'Save',
+ 'SaveData', 'SaveExperiment', 'SaveGraphCopy', 'SaveNotebook',
+ 'SavePackagePreferences', 'SavePICT', 'SaveTableCopy', 'SetActiveSubwindow',
+ 'SetAxis', 'SetBackground', 'SetDashPattern', 'SetDataFolder', 'SetDimLabel',
+ 'SetDrawEnv', 'SetDrawLayer', 'SetFileFolderInfo', 'SetFormula', 'SetIgorHook',
+ 'SetIgorMenuMode', 'SetIgorOption', 'SetMarquee', 'SetProcessSleep',
+ 'SetRandomSeed', 'SetScale', 'SetVariable', 'SetWaveLock', 'SetWaveTextEncoding',
+ 'SetWindow', 'ShowIgorMenus', 'ShowInfo', 'ShowTools', 'Silent', 'Sleep',
+ 'Slider', 'Smooth', 'SmoothCustom', 'Sort', 'SortColumns', 'SoundInRecord',
+ 'SoundInSet', 'SoundInStartChart', 'SoundInStatus', 'SoundInStopChart',
+ 'SoundLoadWave', 'SoundSaveWave', 'SphericalInterpolate', 'SphericalTriangulate',
+ 'SplitString', 'SplitWave', 'sprintf', 'sscanf', 'Stack', 'StackWindows',
'StatsAngularDistanceTest', 'StatsANOVA1Test', 'StatsANOVA2NRTest',
'StatsANOVA2RMTest', 'StatsANOVA2Test', 'StatsChiTest',
- 'StatsCircularCorrelationTest', 'StatsCircularMeans',
- 'StatsCircularMoments', 'StatsCircularTwoSampleTest',
- 'StatsCochranTest', 'StatsContingencyTable', 'StatsDIPTest',
- 'StatsDunnettTest', 'StatsFriedmanTest', 'StatsFTest',
- 'StatsHodgesAjneTest', 'StatsJBTest', 'StatsKendallTauTest',
+ 'StatsCircularCorrelationTest', 'StatsCircularMeans', 'StatsCircularMoments',
+ 'StatsCircularTwoSampleTest', 'StatsCochranTest', 'StatsContingencyTable',
+ 'StatsDIPTest', 'StatsDunnettTest', 'StatsFriedmanTest', 'StatsFTest',
+ 'StatsHodgesAjneTest', 'StatsJBTest', 'StatsKDE', 'StatsKendallTauTest',
'StatsKSTest', 'StatsKWTest', 'StatsLinearCorrelationTest',
- 'StatsLinearRegression', 'StatsMultiCorrelationTest',
- 'StatsNPMCTest', 'StatsNPNominalSRTest', 'StatsQuantiles',
- 'StatsRankCorrelationTest', 'StatsResample', 'StatsSample',
- 'StatsScheffeTest', 'StatsSignTest', 'StatsSRTest', 'StatsTTest',
- 'StatsTukeyTest', 'StatsVariancesTest', 'StatsWatsonUSquaredTest',
- 'StatsWatsonWilliamsTest', 'StatsWheelerWatsonTest',
- 'StatsWilcoxonRankTest', 'StatsWRCorrelationTest', 'String',
- 'StructGet', 'StructPut', 'TabControl', 'Tag', 'TextBox', 'Tile',
- 'TileWindows', 'TitleBox', 'ToCommandLine', 'ToolsGrid',
- 'Triangulate3d', 'Unwrap', 'ValDisplay', 'Variable', 'WaveMeanStdv',
- 'WaveStats', 'WaveTransform', 'wfprintf', 'WignerTransform',
- 'WindowFunction',
+ 'StatsLinearRegression', 'StatsMultiCorrelationTest', 'StatsNPMCTest',
+ 'StatsNPNominalSRTest', 'StatsQuantiles', 'StatsRankCorrelationTest',
+ 'StatsResample', 'StatsSample', 'StatsScheffeTest', 'StatsShapiroWilkTest',
+ 'StatsSignTest', 'StatsSRTest', 'StatsTTest', 'StatsTukeyTest',
+ 'StatsVariancesTest', 'StatsWatsonUSquaredTest', 'StatsWatsonWilliamsTest',
+ 'StatsWheelerWatsonTest', 'StatsWilcoxonRankTest', 'StatsWRCorrelationTest',
+ 'String', 'StructGet', 'StructPut', 'SumDimension', 'SumSeries', 'TabControl',
+ 'Tag', 'TextBox', 'ThreadGroupPutDF', 'ThreadStart', 'Tile', 'TileWindows',
+ 'TitleBox', 'ToCommandLine', 'ToolsGrid', 'Triangulate3d', 'Unwrap', 'URLRequest',
+ 'ValDisplay', 'Variable', 'VDTClosePort2', 'VDTGetPortList2', 'VDTGetStatus2',
+ 'VDTOpenPort2', 'VDTOperationsPort2', 'VDTReadBinaryWave2', 'VDTReadBinary2',
+ 'VDTReadHexWave2', 'VDTReadHex2', 'VDTReadWave2', 'VDTRead2', 'VDTTerminalPort2',
+ 'VDTWriteBinaryWave2', 'VDTWriteBinary2', 'VDTWriteHexWave2', 'VDTWriteHex2',
+ 'VDTWriteWave2', 'VDTWrite2', 'VDT2', 'WaveMeanStdv', 'WaveStats',
+ 'WaveTransform', 'wfprintf', 'WignerTransform', 'WindowFunction', 'XLLoadWave'
)
functions = (
- 'abs', 'acos', 'acosh', 'AiryA', 'AiryAD', 'AiryB', 'AiryBD', 'alog',
- 'area', 'areaXY', 'asin', 'asinh', 'atan', 'atan2', 'atanh',
- 'AxisValFromPixel', 'Besseli', 'Besselj', 'Besselk', 'Bessely', 'bessi',
- 'bessj', 'bessk', 'bessy', 'beta', 'betai', 'BinarySearch',
+ 'abs', 'acos', 'acosh', 'AddListItem', 'AiryA', 'AiryAD', 'AiryB', 'AiryBD',
+ 'alog', 'AnnotationInfo', 'AnnotationList', 'area', 'areaXY', 'asin', 'asinh',
+ 'atan', 'atanh', 'atan2', 'AxisInfo', 'AxisList', 'AxisValFromPixel', 'Besseli',
+ 'Besselj', 'Besselk', 'Bessely', 'beta', 'betai', 'BinarySearch',
'BinarySearchInterp', 'binomial', 'binomialln', 'binomialNoise', 'cabs',
- 'CaptureHistoryStart', 'ceil', 'cequal', 'char2num', 'chebyshev',
- 'chebyshevU', 'CheckName', 'cmplx', 'cmpstr', 'conj', 'ContourZ', 'cos',
- 'cosh', 'cot', 'CountObjects', 'CountObjectsDFR', 'cpowi',
- 'CreationDate', 'csc', 'DataFolderExists', 'DataFolderRefsEqual',
- 'DataFolderRefStatus', 'date2secs', 'datetime', 'DateToJulian',
- 'Dawson', 'DDEExecute', 'DDEInitiate', 'DDEPokeString', 'DDEPokeWave',
- 'DDERequestWave', 'DDEStatus', 'DDETerminate', 'defined', 'deltax', 'digamma',
- 'DimDelta', 'DimOffset', 'DimSize', 'ei', 'enoise', 'equalWaves', 'erf',
- 'erfc', 'exists', 'exp', 'expInt', 'expNoise', 'factorial', 'fakedata',
- 'faverage', 'faverageXY', 'FindDimLabel', 'FindListItem', 'floor',
+ 'CaptureHistory', 'CaptureHistoryStart', 'ceil', 'cequal', 'char2num',
+ 'chebyshev', 'chebyshevU', 'CheckName', 'ChildWindowList', 'CleanupName', 'cmplx',
+ 'cmpstr', 'conj', 'ContourInfo', 'ContourNameList', 'ContourNameToWaveRef',
+ 'ContourZ', 'ControlNameList', 'ConvertTextEncoding', 'cos', 'cosh',
+ 'cosIntegral', 'cot', 'coth', 'CountObjects', 'CountObjectsDFR', 'cpowi',
+ 'CreationDate', 'csc', 'csch', 'CsrInfo', 'CsrWave', 'CsrWaveRef', 'CsrXWave',
+ 'CsrXWaveRef', 'CTabList', 'DataFolderDir', 'DataFolderExists',
+ 'DataFolderRefsEqual', 'DataFolderRefStatus', 'date', 'datetime', 'DateToJulian',
+ 'date2secs', 'Dawson', 'DDERequestString', 'defined', 'deltax', 'digamma',
+ 'dilogarithm', 'DimDelta', 'DimOffset', 'DimSize', 'ei', 'enoise', 'equalWaves',
+ 'erf', 'erfc', 'erfcw', 'exists', 'exp', 'ExpConvExp', 'ExpConvExpFit',
+ 'ExpConvExpFitBL', 'ExpConvExpFit1Shape', 'ExpConvExpFit1ShapeBL', 'ExpGauss',
+ 'ExpGaussFit', 'ExpGaussFitBL', 'ExpGaussFit1Shape', 'ExpGaussFit1ShapeBL',
+ 'expInt', 'expIntegralE1', 'expNoise', 'factorial', 'fakedata', 'faverage',
+ 'faverageXY', 'FetchURL', 'FindDimLabel', 'FindListItem', 'floor', 'FontList',
'FontSizeHeight', 'FontSizeStringWidth', 'FresnelCos', 'FresnelSin',
- 'gamma', 'gammaInc', 'gammaNoise', 'gammln', 'gammp', 'gammq', 'Gauss',
- 'Gauss1D', 'Gauss2D', 'gcd', 'GetDefaultFontSize',
- 'GetDefaultFontStyle', 'GetKeyState', 'GetRTError', 'gnoise',
- 'GrepString', 'hcsr', 'hermite', 'hermiteGauss', 'HyperG0F1',
- 'HyperG1F1', 'HyperG2F1', 'HyperGNoise', 'HyperGPFQ', 'IgorVersion',
- 'ilim', 'imag', 'Inf', 'Integrate1D', 'interp', 'Interp2D', 'Interp3D',
- 'inverseERF', 'inverseERFC', 'ItemsInList', 'jlim', 'Laguerre',
- 'LaguerreA', 'LaguerreGauss', 'leftx', 'LegendreA', 'limit', 'ln',
- 'log', 'logNormalNoise', 'lorentzianNoise', 'magsqr', 'MandelbrotPoint',
- 'MarcumQ', 'MatrixDet', 'MatrixDot', 'MatrixRank', 'MatrixTrace', 'max',
- 'mean', 'min', 'mod', 'ModDate', 'NaN', 'norm', 'NumberByKey',
- 'numpnts', 'numtype', 'NumVarOrDefault', 'NVAR_Exists', 'p2rect',
- 'ParamIsDefault', 'pcsr', 'Pi', 'PixelFromAxisVal', 'pnt2x',
- 'poissonNoise', 'poly', 'poly2D', 'PolygonArea', 'qcsr', 'r2polar',
- 'real', 'rightx', 'round', 'sawtooth', 'ScreenResolution', 'sec',
- 'SelectNumber', 'sign', 'sin', 'sinc', 'sinh', 'SphericalBessJ',
- 'SphericalBessJD', 'SphericalBessY', 'SphericalBessYD',
- 'SphericalHarmonics', 'sqrt', 'StartMSTimer', 'StatsBetaCDF',
- 'StatsBetaPDF', 'StatsBinomialCDF', 'StatsBinomialPDF',
- 'StatsCauchyCDF', 'StatsCauchyPDF', 'StatsChiCDF', 'StatsChiPDF',
- 'StatsCMSSDCDF', 'StatsCorrelation', 'StatsDExpCDF', 'StatsDExpPDF',
- 'StatsErlangCDF', 'StatsErlangPDF', 'StatsErrorPDF', 'StatsEValueCDF',
- 'StatsEValuePDF', 'StatsExpCDF', 'StatsExpPDF', 'StatsFCDF',
- 'StatsFPDF', 'StatsFriedmanCDF', 'StatsGammaCDF', 'StatsGammaPDF',
- 'StatsGeometricCDF', 'StatsGeometricPDF', 'StatsHyperGCDF',
- 'StatsHyperGPDF', 'StatsInvBetaCDF', 'StatsInvBinomialCDF',
- 'StatsInvCauchyCDF', 'StatsInvChiCDF', 'StatsInvCMSSDCDF',
- 'StatsInvDExpCDF', 'StatsInvEValueCDF', 'StatsInvExpCDF',
- 'StatsInvFCDF', 'StatsInvFriedmanCDF', 'StatsInvGammaCDF',
- 'StatsInvGeometricCDF', 'StatsInvKuiperCDF', 'StatsInvLogisticCDF',
- 'StatsInvLogNormalCDF', 'StatsInvMaxwellCDF', 'StatsInvMooreCDF',
- 'StatsInvNBinomialCDF', 'StatsInvNCChiCDF', 'StatsInvNCFCDF',
- 'StatsInvNormalCDF', 'StatsInvParetoCDF', 'StatsInvPoissonCDF',
- 'StatsInvPowerCDF', 'StatsInvQCDF', 'StatsInvQpCDF',
+ 'FuncRefInfo', 'FunctionInfo', 'FunctionList', 'FunctionPath', 'gamma',
+ 'gammaEuler', 'gammaInc', 'gammaNoise', 'gammln', 'gammp', 'gammq', 'Gauss',
+ 'GaussFit', 'GaussFitBL', 'GaussFit1Width', 'GaussFit1WidthBL', 'Gauss1D',
+ 'Gauss2D', 'gcd', 'GetBrowserLine', 'GetBrowserSelection', 'GetDataFolder',
+ 'GetDataFolderDFR', 'GetDefaultFont', 'GetDefaultFontSize', 'GetDefaultFontStyle',
+ 'GetDimLabel', 'GetEnvironmentVariable', 'GetErrMessage', 'GetFormula',
+ 'GetIndependentModuleName', 'GetIndexedObjName', 'GetIndexedObjNameDFR',
+ 'GetKeyState', 'GetRTErrMessage', 'GetRTError', 'GetRTLocation', 'GetRTLocInfo',
+ 'GetRTStackInfo', 'GetScrapText', 'GetUserData', 'GetWavesDataFolder',
+ 'GetWavesDataFolderDFR', 'GizmoInfo', 'GizmoScale', 'gnoise', 'GrepList',
+ 'GrepString', 'GuideInfo', 'GuideNameList', 'Hash', 'hcsr', 'HDF5AttributeInfo',
+ 'HDF5DatasetInfo', 'HDF5LibraryInfo', 'HDF5TypeInfo', 'hermite', 'hermiteGauss',
+ 'HyperGNoise', 'HyperGPFQ', 'HyperG0F1', 'HyperG1F1', 'HyperG2F1', 'IgorInfo',
+ 'IgorVersion', 'imag', 'ImageInfo', 'ImageNameList', 'ImageNameToWaveRef',
+ 'IndependentModuleList', 'IndexedDir', 'IndexedFile', 'Inf', 'Integrate1D',
+ 'interp', 'Interp2D', 'Interp3D', 'inverseERF', 'inverseERFC', 'ItemsInList',
+ 'JacobiCn', 'JacobiSn', 'JulianToDate', 'Laguerre', 'LaguerreA', 'LaguerreGauss',
+ 'LambertW', 'LayoutInfo', 'leftx', 'LegendreA', 'limit', 'ListMatch',
+ 'ListToTextWave', 'ListToWaveRefWave', 'ln', 'log', 'logNormalNoise',
+ 'LorentzianFit', 'LorentzianFitBL', 'LorentzianFit1Width',
+ 'LorentzianFit1WidthBL', 'lorentzianNoise', 'LowerStr', 'MacroList', 'magsqr',
+ 'MandelbrotPoint', 'MarcumQ', 'MatrixCondition', 'MatrixDet', 'MatrixDot',
+ 'MatrixRank', 'MatrixTrace', 'max', 'mean', 'median', 'min', 'mod', 'ModDate',
+ 'MPFXEMGPeak', 'MPFXExpConvExpPeak', 'MPFXGaussPeak', 'MPFXLorenzianPeak',
+ 'MPFXVoigtPeak', 'NameOfWave', 'NaN', 'NewFreeDataFolder', 'NewFreeWave', 'norm',
+ 'NormalizeUnicode', 'note', 'NumberByKey', 'numpnts', 'numtype',
+ 'NumVarOrDefault', 'num2char', 'num2istr', 'num2str', 'NVAR_Exists',
+ 'OperationList', 'PadString', 'PanelResolution', 'ParamIsDefault',
+ 'ParseFilePath', 'PathList', 'pcsr', 'Pi', 'PICTInfo', 'PICTList',
+ 'PixelFromAxisVal', 'pnt2x', 'poissonNoise', 'poly', 'PolygonArea', 'poly2D',
+ 'PossiblyQuoteName', 'ProcedureText', 'p2rect', 'qcsr', 'real', 'RemoveByKey',
+ 'RemoveEnding', 'RemoveFromList', 'RemoveListItem', 'ReplaceNumberByKey',
+ 'ReplaceString', 'ReplaceStringByKey', 'rightx', 'round', 'r2polar', 'sawtooth',
+ 'scaleToIndex', 'ScreenResolution', 'sec', 'sech', 'Secs2Date', 'Secs2Time',
+ 'SelectNumber', 'SelectString', 'SetEnvironmentVariable', 'sign', 'sin', 'sinc',
+ 'sinh', 'sinIntegral', 'SortList', 'SpecialCharacterInfo', 'SpecialCharacterList',
+ 'SpecialDirPath', 'SphericalBessJ', 'SphericalBessJD', 'SphericalBessY',
+ 'SphericalBessYD', 'SphericalHarmonics', 'sqrt', 'StartMSTimer', 'StatsBetaCDF',
+ 'StatsBetaPDF', 'StatsBinomialCDF', 'StatsBinomialPDF', 'StatsCauchyCDF',
+ 'StatsCauchyPDF', 'StatsChiCDF', 'StatsChiPDF', 'StatsCMSSDCDF',
+ 'StatsCorrelation', 'StatsDExpCDF', 'StatsDExpPDF', 'StatsErlangCDF',
+ 'StatsErlangPDF', 'StatsErrorPDF', 'StatsEValueCDF', 'StatsEValuePDF',
+ 'StatsExpCDF', 'StatsExpPDF', 'StatsFCDF', 'StatsFPDF', 'StatsFriedmanCDF',
+ 'StatsGammaCDF', 'StatsGammaPDF', 'StatsGeometricCDF', 'StatsGeometricPDF',
+ 'StatsGEVCDF', 'StatsGEVPDF', 'StatsHyperGCDF', 'StatsHyperGPDF',
+ 'StatsInvBetaCDF', 'StatsInvBinomialCDF', 'StatsInvCauchyCDF', 'StatsInvChiCDF',
+ 'StatsInvCMSSDCDF', 'StatsInvDExpCDF', 'StatsInvEValueCDF', 'StatsInvExpCDF',
+ 'StatsInvFCDF', 'StatsInvFriedmanCDF', 'StatsInvGammaCDF', 'StatsInvGeometricCDF',
+ 'StatsInvKuiperCDF', 'StatsInvLogisticCDF', 'StatsInvLogNormalCDF',
+ 'StatsInvMaxwellCDF', 'StatsInvMooreCDF', 'StatsInvNBinomialCDF',
+ 'StatsInvNCChiCDF', 'StatsInvNCFCDF', 'StatsInvNormalCDF', 'StatsInvParetoCDF',
+ 'StatsInvPoissonCDF', 'StatsInvPowerCDF', 'StatsInvQCDF', 'StatsInvQpCDF',
'StatsInvRayleighCDF', 'StatsInvRectangularCDF', 'StatsInvSpearmanCDF',
'StatsInvStudentCDF', 'StatsInvTopDownCDF', 'StatsInvTriangularCDF',
'StatsInvUsquaredCDF', 'StatsInvVonMisesCDF', 'StatsInvWeibullCDF',
- 'StatsKuiperCDF', 'StatsLogisticCDF', 'StatsLogisticPDF',
- 'StatsLogNormalCDF', 'StatsLogNormalPDF', 'StatsMaxwellCDF',
- 'StatsMaxwellPDF', 'StatsMedian', 'StatsMooreCDF', 'StatsNBinomialCDF',
- 'StatsNBinomialPDF', 'StatsNCChiCDF', 'StatsNCChiPDF', 'StatsNCFCDF',
- 'StatsNCFPDF', 'StatsNCTCDF', 'StatsNCTPDF', 'StatsNormalCDF',
- 'StatsNormalPDF', 'StatsParetoCDF', 'StatsParetoPDF', 'StatsPermute',
- 'StatsPoissonCDF', 'StatsPoissonPDF', 'StatsPowerCDF',
- 'StatsPowerNoise', 'StatsPowerPDF', 'StatsQCDF', 'StatsQpCDF',
- 'StatsRayleighCDF', 'StatsRayleighPDF', 'StatsRectangularCDF',
- 'StatsRectangularPDF', 'StatsRunsCDF', 'StatsSpearmanRhoCDF',
- 'StatsStudentCDF', 'StatsStudentPDF', 'StatsTopDownCDF',
+ 'StatsKuiperCDF', 'StatsLogisticCDF', 'StatsLogisticPDF', 'StatsLogNormalCDF',
+ 'StatsLogNormalPDF', 'StatsMaxwellCDF', 'StatsMaxwellPDF', 'StatsMedian',
+ 'StatsMooreCDF', 'StatsNBinomialCDF', 'StatsNBinomialPDF', 'StatsNCChiCDF',
+ 'StatsNCChiPDF', 'StatsNCFCDF', 'StatsNCFPDF', 'StatsNCTCDF', 'StatsNCTPDF',
+ 'StatsNormalCDF', 'StatsNormalPDF', 'StatsParetoCDF', 'StatsParetoPDF',
+ 'StatsPermute', 'StatsPoissonCDF', 'StatsPoissonPDF', 'StatsPowerCDF',
+ 'StatsPowerNoise', 'StatsPowerPDF', 'StatsQCDF', 'StatsQpCDF', 'StatsRayleighCDF',
+ 'StatsRayleighPDF', 'StatsRectangularCDF', 'StatsRectangularPDF', 'StatsRunsCDF',
+ 'StatsSpearmanRhoCDF', 'StatsStudentCDF', 'StatsStudentPDF', 'StatsTopDownCDF',
'StatsTriangularCDF', 'StatsTriangularPDF', 'StatsTrimmedMean',
- 'StatsUSquaredCDF', 'StatsVonMisesCDF', 'StatsVonMisesNoise',
- 'StatsVonMisesPDF', 'StatsWaldCDF', 'StatsWaldPDF', 'StatsWeibullCDF',
- 'StatsWeibullPDF', 'StopMSTimer', 'str2num', 'stringCRC', 'stringmatch',
- 'strlen', 'strsearch', 'StudentA', 'StudentT', 'sum', 'SVAR_Exists',
- 'TagVal', 'tan', 'tanh', 'ThreadGroupCreate', 'ThreadGroupRelease',
- 'ThreadGroupWait', 'ThreadProcessorCount', 'ThreadReturnValue', 'ticks',
- 'trunc', 'Variance', 'vcsr', 'WaveCRC', 'WaveDims', 'WaveExists',
- 'WaveMax', 'WaveMin', 'WaveRefsEqual', 'WaveType', 'WhichListItem',
- 'WinType', 'WNoise', 'x2pnt', 'xcsr', 'zcsr', 'ZernikeR',
- )
- functions += (
- 'AddListItem', 'AnnotationInfo', 'AnnotationList', 'AxisInfo',
- 'AxisList', 'CaptureHistory', 'ChildWindowList', 'CleanupName',
- 'ContourInfo', 'ContourNameList', 'ControlNameList', 'CsrInfo',
- 'CsrWave', 'CsrXWave', 'CTabList', 'DataFolderDir', 'date',
- 'DDERequestString', 'FontList', 'FuncRefInfo', 'FunctionInfo',
- 'FunctionList', 'FunctionPath', 'GetDataFolder', 'GetDefaultFont',
- 'GetDimLabel', 'GetErrMessage', 'GetFormula',
- 'GetIndependentModuleName', 'GetIndexedObjName', 'GetIndexedObjNameDFR',
- 'GetRTErrMessage', 'GetRTStackInfo', 'GetScrapText', 'GetUserData',
- 'GetWavesDataFolder', 'GrepList', 'GuideInfo', 'GuideNameList', 'Hash',
- 'IgorInfo', 'ImageInfo', 'ImageNameList', 'IndexedDir', 'IndexedFile',
- 'JulianToDate', 'LayoutInfo', 'ListMatch', 'LowerStr', 'MacroList',
- 'NameOfWave', 'note', 'num2char', 'num2istr', 'num2str',
- 'OperationList', 'PadString', 'ParseFilePath', 'PathList', 'PICTInfo',
- 'PICTList', 'PossiblyQuoteName', 'ProcedureText', 'RemoveByKey',
- 'RemoveEnding', 'RemoveFromList', 'RemoveListItem',
- 'ReplaceNumberByKey', 'ReplaceString', 'ReplaceStringByKey',
- 'Secs2Date', 'Secs2Time', 'SelectString', 'SortList',
- 'SpecialCharacterInfo', 'SpecialCharacterList', 'SpecialDirPath',
- 'StringByKey', 'StringFromList', 'StringList', 'StrVarOrDefault',
- 'TableInfo', 'TextFile', 'ThreadGroupGetDF', 'time', 'TraceFromPixel',
- 'TraceInfo', 'TraceNameList', 'UniqueName', 'UnPadString', 'UpperStr',
- 'VariableList', 'WaveInfo', 'WaveList', 'WaveName', 'WaveUnits',
- 'WinList', 'WinName', 'WinRecreation', 'XWaveName',
- 'ContourNameToWaveRef', 'CsrWaveRef', 'CsrXWaveRef',
- 'ImageNameToWaveRef', 'NewFreeWave', 'TagWaveRef', 'TraceNameToWaveRef',
- 'WaveRefIndexed', 'XWaveRefFromTrace', 'GetDataFolderDFR',
- 'GetWavesDataFolderDFR', 'NewFreeDataFolder', 'ThreadGroupGetDFR',
+ 'StatsUSquaredCDF', 'StatsVonMisesCDF', 'StatsVonMisesNoise', 'StatsVonMisesPDF',
+ 'StatsWaldCDF', 'StatsWaldPDF', 'StatsWeibullCDF', 'StatsWeibullPDF',
+ 'StopMSTimer', 'StringByKey', 'stringCRC', 'StringFromList', 'StringList',
+ 'stringmatch', 'strlen', 'strsearch', 'StrVarOrDefault', 'str2num', 'StudentA',
+ 'StudentT', 'sum', 'SVAR_Exists', 'TableInfo', 'TagVal', 'TagWaveRef', 'tan',
+ 'tanh', 'TextEncodingCode', 'TextEncodingName', 'TextFile', 'ThreadGroupCreate',
+ 'ThreadGroupGetDF', 'ThreadGroupGetDFR', 'ThreadGroupRelease', 'ThreadGroupWait',
+ 'ThreadProcessorCount', 'ThreadReturnValue', 'ticks', 'time', 'TraceFromPixel',
+ 'TraceInfo', 'TraceNameList', 'TraceNameToWaveRef', 'trunc', 'UniqueName',
+ 'UnPadString', 'UnsetEnvironmentVariable', 'UpperStr', 'URLDecode', 'URLEncode',
+ 'VariableList', 'Variance', 'vcsr', 'Voigt', 'VoigtFit', 'VoigtFitBL',
+ 'VoigtFit1Shape', 'VoigtFit1ShapeBL', 'VoigtFit1Shape1Width',
+ 'VoigtFit1Shape1WidthBL', 'VoigtFunc', 'WaveCRC', 'WaveDims', 'WaveExists',
+ 'WaveInfo', 'WaveList', 'WaveMax', 'WaveMin', 'WaveName', 'WaveRefIndexed',
+ 'WaveRefIndexedDFR', 'WaveRefsEqual', 'WaveRefWaveToList', 'WaveTextEncoding',
+ 'WaveType', 'WaveUnits', 'WhichListItem', 'WinList', 'WinName', 'WinRecreation',
+ 'WinType', 'WMFindWholeWord', 'WNoise', 'xcsr', 'XWaveName', 'XWaveRefFromTrace',
+ 'x2pnt', 'zcsr', 'ZernikeR', 'zeta'
)
tokens = {
@@ -272,7 +280,7 @@ class IgorLexer(RegexLexer):
# Built-in functions.
(words(functions, prefix=r'\b', suffix=r'\b'), Name.Function),
# Compiler directives.
- (r'^#(include|pragma|define|ifdef|ifndef|endif)',
+ (r'^#(include|pragma|define|undef|ifdef|ifndef|if|elif|else|endif)',
Name.Decorator),
(r'[^a-z"/]+$', Text),
(r'.', Text),
diff --git a/pygments/lexers/j.py b/pygments/lexers/j.py
index 278374e5..f15595f8 100644
--- a/pygments/lexers/j.py
+++ b/pygments/lexers/j.py
@@ -48,7 +48,7 @@ class JLexer(RegexLexer):
# Definitions
(r'0\s+:\s*0|noun\s+define\s*$', Name.Entity, 'nounDefinition'),
- (r'\b(([1-4]|13)\s+:\s*0)|((adverb|conjunction|dyad|monad|verb)\s+define)\b',
+ (r'(([1-4]|13)\s+:\s*0|(adverb|conjunction|dyad|monad|verb)\s+define)\b',
Name.Function, 'explicitDefinition'),
# Flow Control
diff --git a/pygments/lexers/javascript.py b/pygments/lexers/javascript.py
index 2a01cd42..5dca6832 100644
--- a/pygments/lexers/javascript.py
+++ b/pygments/lexers/javascript.py
@@ -97,13 +97,13 @@ class JavascriptLexer(RegexLexer):
(r'`', String.Backtick, '#pop'),
(r'\\\\', String.Backtick),
(r'\\`', String.Backtick),
- (r'\${', String.Interpol, 'interp-inside'),
+ (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'),
+ (r'\}', String.Interpol, '#pop'),
include('root'),
],
# (\\\\|\\`|[^`])*`', String.Backtick),
@@ -1245,32 +1245,32 @@ class EarlGreyLexer(RegexLexer):
include('control'),
(r'[^\S\n]+', Text),
(r';;.*\n', Comment),
- (r'[\[\]\{\}\:\(\)\,\;]', Punctuation),
+ (r'[\[\]{}:(),;]', Punctuation),
(r'\\\n', Text),
(r'\\', Text),
include('errors'),
(words((
'with', 'where', 'when', 'and', 'not', 'or', 'in',
'as', 'of', 'is'),
- prefix=r'(?<=\s|\[)', suffix=r'(?![\w\$\-])'),
+ prefix=r'(?<=\s|\[)', suffix=r'(?![\w$\-])'),
Operator.Word),
- (r'[\*@]?->', Name.Function),
+ (r'[*@]?->', Name.Function),
(r'[+\-*/~^<>%&|?!@#.]*=', Operator.Word),
(r'\.{2,3}', Operator.Word), # Range Operator
(r'([+*/~^<>&|?!]+)|([#\-](?=\s))|@@+(?=\s)|=+', Operator),
- (r'(?<![\w\$\-])(var|let)(?:[^\w\$])', Keyword.Declaration),
+ (r'(?<![\w$\-])(var|let)(?:[^\w$])', Keyword.Declaration),
include('keywords'),
include('builtins'),
include('assignment'),
(r'''(?x)
- (?:()([a-zA-Z$_](?:[a-zA-Z$0-9_\-]*[a-zA-Z$0-9_])?)|
- (?<=[\s\{\[\(])(\.)([a-zA-Z$_](?:[a-zA-Z$0-9_\-]*[a-zA-Z$0-9_])?))
+ (?:()([a-zA-Z$_](?:[\w$\-]*[\w$])?)|
+ (?<=[\s{\[(])(\.)([a-zA-Z$_](?:[\w$\-]*[\w$])?))
(?=.*%)''',
bygroups(Punctuation, Name.Tag, Punctuation, Name.Class.Start), 'dbs'),
(r'[rR]?`', String.Backtick, 'bt'),
(r'[rR]?```', String.Backtick, 'tbt'),
- (r'(?<=[\s\[\{\(,;])\.([a-zA-Z$_](?:[a-zA-Z$0-9_-]*[a-zA-Z$0-9_])?)'
- r'(?=[\s\]\}\),;])', String.Symbol),
+ (r'(?<=[\s\[{(,;])\.([a-zA-Z$_](?:[\w$\-]*[\w$])?)'
+ r'(?=[\s\]}),;])', String.Symbol),
include('nested'),
(r'(?:[rR]|[rR]\.[gmi]{1,3})?"', String, combined('stringescape', 'dqs')),
(r'(?:[rR]|[rR]\.[gmi]{1,3})?\'', String, combined('stringescape', 'sqs')),
@@ -1281,9 +1281,9 @@ class EarlGreyLexer(RegexLexer):
include('numbers'),
],
'dbs': [
- (r'(\.)([a-zA-Z$_](?:[a-zA-Z$0-9_\-]*[a-zA-Z$0-9_])?)(?=[\[\.\s])',
+ (r'(\.)([a-zA-Z$_](?:[\w$\-]*[\w$])?)(?=[.\[\s])',
bygroups(Punctuation, Name.Class.DBS)),
- (r'(\[)([\^#][a-zA-Z$_](?:[a-zA-Z$0-9_\-]*[a-zA-Z$0-9_])?)(\])',
+ (r'(\[)([\^#][a-zA-Z$_](?:[\w$\-]*[\w$])?)(\])',
bygroups(Punctuation, Name.Entity.DBS, Punctuation)),
(r'\s+', Text),
(r'%', Operator.DBS, '#pop'),
@@ -1293,29 +1293,29 @@ class EarlGreyLexer(RegexLexer):
bygroups(Text.Whitespace, Text)),
],
'assignment': [
- (r'(\.)?([a-zA-Z$_](?:[a-zA-Z$0-9_-]*[a-zA-Z$0-9_])?)'
+ (r'(\.)?([a-zA-Z$_](?:[\w$\-]*[\w$])?)'
r'(?=\s+[+\-*/~^<>%&|?!@#.]*\=\s)',
bygroups(Punctuation, Name.Variable))
],
'errors': [
(words(('Error', 'TypeError', 'ReferenceError'),
- prefix=r'(?<![\w\$\-\.])', suffix=r'(?![\w\$\-\.])'),
+ prefix=r'(?<![\w\-$.])', suffix=r'(?![\w\-$.])'),
Name.Exception),
(r'''(?x)
- (?<![\w\$])
- E\.[\w\$](?:[\w\$\-]*[\w\$])?
- (?:\.[\w\$](?:[\w\$\-]*[\w\$])?)*
- (?=[\(\{\[\?\!\s])''',
+ (?<![\w$])
+ E\.[\w$](?:[\w$\-]*[\w$])?
+ (?:\.[\w$](?:[\w$\-]*[\w$])?)*
+ (?=[({\[?!\s])''',
Name.Exception),
],
'control': [
(r'''(?x)
- ([a-zA-Z$_](?:[a-zA-Z$0-9_-]*[a-zA-Z$0-9_])?)
+ ([a-zA-Z$_](?:[\w$-]*[\w$])?)
(?!\n)\s+
(?!and|as|each\*|each|in|is|mod|of|or|when|where|with)
- (?=(?:[+\-*/~^<>%&|?!@#.])?[a-zA-Z$_](?:[a-zA-Z$0-9_-]*[a-zA-Z$0-9_])?)''',
+ (?=(?:[+\-*/~^<>%&|?!@#.])?[a-zA-Z$_](?:[\w$-]*[\w$])?)''',
Keyword.Control),
- (r'([a-zA-Z$_](?:[a-zA-Z$0-9_-]*[a-zA-Z$0-9_])?)(?!\n)\s+(?=[\'"\d\{\[\(])',
+ (r'([a-zA-Z$_](?:[\w$-]*[\w$])?)(?!\n)\s+(?=[\'"\d{\[(])',
Keyword.Control),
(r'''(?x)
(?:
@@ -1324,28 +1324,28 @@ class EarlGreyLexer(RegexLexer):
(?<=with|each|with)|
(?<=each\*|where)
)(\s+)
- ([a-zA-Z$_](?:[a-zA-Z$0-9_\-]*[a-zA-Z$0-9_])?)(:)''',
+ ([a-zA-Z$_](?:[\w$-]*[\w$])?)(:)''',
bygroups(Text, Keyword.Control, Punctuation)),
(r'''(?x)
(?<![+\-*/~^<>%&|?!@#.])(\s+)
- ([a-zA-Z$_](?:[a-zA-Z$0-9_-]*[a-zA-Z$0-9_])?)(:)''',
+ ([a-zA-Z$_](?:[\w$-]*[\w$])?)(:)''',
bygroups(Text, Keyword.Control, Punctuation)),
],
'nested': [
(r'''(?x)
- (?<=[a-zA-Z$0-9_\]\}\)])(\.)
- ([a-zA-Z$_](?:[a-zA-Z$0-9_-]*[a-zA-Z$0-9_])?)
+ (?<=[\w$\]})])(\.)
+ ([a-zA-Z$_](?:[\w$-]*[\w$])?)
(?=\s+with(?:\s|\n))''',
bygroups(Punctuation, Name.Function)),
(r'''(?x)
(?<!\s)(\.)
- ([a-zA-Z$_](?:[a-zA-Z$0-9_-]*[a-zA-Z$0-9_])?)
- (?=[\}\]\)\.,;:\s])''',
+ ([a-zA-Z$_](?:[\w$-]*[\w$])?)
+ (?=[}\]).,;:\s])''',
bygroups(Punctuation, Name.Field)),
(r'''(?x)
- (?<=[a-zA-Z$0-9_\]\}\)])(\.)
- ([a-zA-Z$_](?:[a-zA-Z$0-9_-]*[a-zA-Z$0-9_])?)
- (?=[\[\{\(:])''',
+ (?<=[\w$\]})])(\.)
+ ([a-zA-Z$_](?:[\w$-]*[\w$])?)
+ (?=[\[{(:])''',
bygroups(Punctuation, Name.Function)),
],
'keywords': [
@@ -1354,15 +1354,15 @@ class EarlGreyLexer(RegexLexer):
'continue', 'elif', 'expr-value', 'if', 'match',
'return', 'yield', 'pass', 'else', 'require', 'var',
'let', 'async', 'method', 'gen'),
- prefix=r'(?<![\w\$\-\.])', suffix=r'(?![\w\$\-\.])'),
+ prefix=r'(?<![\w\-$.])', suffix=r'(?![\w\-$.])'),
Keyword.Pseudo),
(words(('this', 'self', '@'),
- prefix=r'(?<![\w\$\-\.])', suffix=r'(?![\w\$\-])'),
+ prefix=r'(?<![\w\-$.])', suffix=r'(?![\w\-$])'),
Keyword.Constant),
(words((
'Function', 'Object', 'Array', 'String', 'Number',
'Boolean', 'ErrorFactory', 'ENode', 'Promise'),
- prefix=r'(?<![\w\$\-\.])', suffix=r'(?![\w\$\-])'),
+ prefix=r'(?<![\w\-$.])', suffix=r'(?![\w\-$])'),
Keyword.Type),
],
'builtins': [
@@ -1373,20 +1373,20 @@ class EarlGreyLexer(RegexLexer):
'getChecker', 'get-checker', 'getProperty', 'get-property',
'getProjector', 'get-projector', 'consume', 'take',
'promisify', 'spawn', 'constructor'),
- prefix=r'(?<![\w\-#\.])', suffix=r'(?![\w\-\.])'),
+ prefix=r'(?<![\w\-#.])', suffix=r'(?![\w\-.])'),
Name.Builtin),
(words((
'true', 'false', 'null', 'undefined'),
- prefix=r'(?<![\w\$\-\.])', suffix=r'(?![\w\$\-\.])'),
+ prefix=r'(?<![\w\-$.])', suffix=r'(?![\w\-$.])'),
Name.Constant),
],
'name': [
- (r'@([a-zA-Z$_](?:[a-zA-Z$0-9_-]*[a-zA-Z$0-9_])?)', Name.Variable.Instance),
- (r'([a-zA-Z$_](?:[a-zA-Z$0-9_-]*[a-zA-Z$0-9_])?)(\+\+|\-\-)?',
+ (r'@([a-zA-Z$_](?:[\w$-]*[\w$])?)', Name.Variable.Instance),
+ (r'([a-zA-Z$_](?:[\w$-]*[\w$])?)(\+\+|\-\-)?',
bygroups(Name.Symbol, Operator.Word))
],
'tuple': [
- (r'#[a-zA-Z_][a-zA-Z_\-0-9]*(?=[\s\{\(,;\n])', Name.Namespace)
+ (r'#[a-zA-Z_][\w\-]*(?=[\s{(,;])', Name.Namespace)
],
'interpoling_string': [
(r'\}', String.Interpol, '#pop'),
@@ -1426,7 +1426,7 @@ class EarlGreyLexer(RegexLexer):
(r'```', String.Backtick, '#pop'),
(r'\n', String.Backtick),
(r'\^=?', String.Escape),
- (r'[^\`]+', String.Backtick),
+ (r'[^`]+', String.Backtick),
],
'numbers': [
(r'\d+\.(?!\.)\d*([eE][+-]?[0-9]+)?', Number.Float),
@@ -1434,7 +1434,7 @@ class EarlGreyLexer(RegexLexer):
(r'8r[0-7]+', Number.Oct),
(r'2r[01]+', Number.Bin),
(r'16r[a-fA-F0-9]+', Number.Hex),
- (r'([3-79]|[1-2][0-9]|3[0-6])r[a-zA-Z\d]+(\.[a-zA-Z\d]+)?', Number.Radix),
+ (r'([3-79]|[12][0-9]|3[0-6])r[a-zA-Z\d]+(\.[a-zA-Z\d]+)?', Number.Radix),
(r'\d+', Number.Integer)
],
}
diff --git a/pygments/lexers/julia.py b/pygments/lexers/julia.py
index d0aa6d35..9f84b8d9 100644
--- a/pygments/lexers/julia.py
+++ b/pygments/lexers/julia.py
@@ -11,13 +11,16 @@
import re
-from pygments.lexer import Lexer, RegexLexer, bygroups, combined, do_insertions
+from pygments.lexer import Lexer, RegexLexer, bygroups, combined, \
+ do_insertions, words
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
Number, Punctuation, Generic
from pygments.util import shebang_matches, unirange
__all__ = ['JuliaLexer', 'JuliaConsoleLexer']
+line_re = re.compile('.*?\n')
+
class JuliaLexer(RegexLexer):
"""
@@ -32,13 +35,26 @@ class JuliaLexer(RegexLexer):
flags = re.MULTILINE | re.UNICODE
- builtins = [
+ builtins = (
'exit', 'whos', 'edit', 'load', 'is', 'isa', 'isequal', 'typeof', 'tuple',
'ntuple', 'uid', 'hash', 'finalizer', 'convert', 'promote', 'subtype',
'typemin', 'typemax', 'realmin', 'realmax', 'sizeof', 'eps', 'promote_type',
'method_exists', 'applicable', 'invoke', 'dlopen', 'dlsym', 'system',
'error', 'throw', 'assert', 'new', 'Inf', 'Nan', 'pi', 'im',
- ]
+ )
+
+ keywords = (
+ 'begin', 'while', 'for', 'in', 'return', 'break', 'continue',
+ 'macro', 'quote', 'let', 'if', 'elseif', 'else', 'try', 'catch', 'end',
+ 'bitstype', 'ccall', 'do', 'using', 'module', 'import', 'export',
+ 'importall', 'baremodule', 'immutable',
+ )
+
+ types = (
+ 'Bool', 'Int', 'Int8', 'Int16', 'Int32', 'Int64', 'Uint', 'Uint8', 'Uint16',
+ 'Uint32', 'Uint64', 'Float32', 'Float64', 'Complex64', 'Complex128', 'Any',
+ 'Nothing', 'None',
+ )
tokens = {
'root': [
@@ -46,34 +62,29 @@ class JuliaLexer(RegexLexer):
(r'[^\S\n]+', Text),
(r'#=', Comment.Multiline, "blockcomment"),
(r'#.*$', Comment),
- (r'[]{}:(),;[@]', Punctuation),
+ (r'[\[\]{}:(),;@]', Punctuation),
(r'\\\n', Text),
(r'\\', Text),
# keywords
- (r'(begin|while|for|in|return|break|continue|'
- r'macro|quote|let|if|elseif|else|try|catch|end|'
- r'bitstype|ccall|do|using|module|import|export|'
- r'importall|baremodule|immutable)\b', Keyword),
(r'(local|global|const)\b', Keyword.Declaration),
- (r'(Bool|Int|Int8|Int16|Int32|Int64|Uint|Uint8|Uint16|Uint32|Uint64'
- r'|Float32|Float64|Complex64|Complex128|Any|Nothing|None)\b',
- Keyword.Type),
+ (words(keywords, suffix=r'\b'), Keyword),
+ (words(types, suffix=r'\b'), Keyword.Type),
# functions
(r'(function)((?:\s|\\\s)+)',
- bygroups(Keyword, Name.Function), 'funcname'),
+ bygroups(Keyword, Name.Function), 'funcname'),
# types
(r'(type|typealias|abstract|immutable)((?:\s|\\\s)+)',
- bygroups(Keyword, Name.Class), 'typename'),
+ bygroups(Keyword, Name.Class), 'typename'),
# operators
(r'==|!=|<=|>=|->|&&|\|\||::|<:|[-~+/*%=<>&^|.?!$]', Operator),
(r'\.\*|\.\^|\.\\|\.\/|\\', Operator),
# builtins
- ('(' + '|'.join(builtins) + r')\b', Name.Builtin),
+ (words(builtins, suffix=r'\b'), Name.Builtin),
# backticks
(r'`(?s).*?`', String.Backtick),
@@ -116,12 +127,12 @@ class JuliaLexer(RegexLexer):
],
'typename': [
- ('[a-zA-Z_]\w*', Name.Class, '#pop')
+ ('[a-zA-Z_]\w*', Name.Class, '#pop'),
],
'stringescape': [
(r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|'
- r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
+ r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape),
],
"blockcomment": [
(r'[^=#]', Comment.Multiline),
@@ -138,7 +149,7 @@ class JuliaLexer(RegexLexer):
(r'\$[a-zA-Z_]+', String.Interpol),
(r'\$\(', String.Interpol, 'in-intp'),
# @printf and @sprintf formats
- (r'%[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[diouxXeEfFgGcrs%]',
+ (r'%[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]',
String.Interpol),
(r'[^$%"\\]+', String),
# unhandled special signs
@@ -155,9 +166,6 @@ class JuliaLexer(RegexLexer):
return shebang_matches(text, r'julia')
-line_re = re.compile('.*?\n')
-
-
class JuliaConsoleLexer(Lexer):
"""
For Julia console sessions. Modeled after MatlabSessionLexer.
diff --git a/pygments/lexers/jvm.py b/pygments/lexers/jvm.py
index 41fc0fdb..af7f8105 100644
--- a/pygments/lexers/jvm.py
+++ b/pygments/lexers/jvm.py
@@ -564,14 +564,14 @@ class IokeLexer(RegexLexer):
],
'slashRegexp': [
- (r'(?<!\\)/[oxpniums]*', String.Regex, '#pop'),
+ (r'(?<!\\)/[im-psux]*', String.Regex, '#pop'),
include('interpolatableText'),
(r'\\/', String.Regex),
(r'[^/]', String.Regex)
],
'squareRegexp': [
- (r'(?<!\\)][oxpniums]*', String.Regex, '#pop'),
+ (r'(?<!\\)][im-psux]*', String.Regex, '#pop'),
include('interpolatableText'),
(r'\\]', String.Regex),
(r'[^\]]', String.Regex)
diff --git a/pygments/lexers/lisp.py b/pygments/lexers/lisp.py
index 84720fab..b15fd0c0 100644
--- a/pygments/lexers/lisp.py
+++ b/pygments/lexers/lisp.py
@@ -18,7 +18,8 @@ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
from pygments.lexers.python import PythonLexer
__all__ = ['SchemeLexer', 'CommonLispLexer', 'HyLexer', 'RacketLexer',
- 'NewLispLexer', 'EmacsLispLexer', 'ShenLexer', 'CPSALexer']
+ 'NewLispLexer', 'EmacsLispLexer', 'ShenLexer', 'CPSALexer',
+ 'XtlangLexer']
class SchemeLexer(RegexLexer):
@@ -2135,49 +2136,52 @@ class ShenLexer(RegexLexer):
filenames = ['*.shen']
mimetypes = ['text/x-shen', 'application/x-shen']
- DECLARATIONS = re.findall(r'\S+', """
- datatype define defmacro defprolog defcc synonyms declare package
- type function
- """)
-
- SPECIAL_FORMS = re.findall(r'\S+', """
- lambda get let if cases cond put time freeze value load $
- protect or and not do output prolog? trap-error error
- make-string /. set @p @s @v
- """)
-
- BUILTINS = re.findall(r'\S+', """
- == = * + - / < > >= <= <-address <-vector abort absvector
- absvector? address-> adjoin append arity assoc bind boolean?
- bound? call cd close cn compile concat cons cons? cut destroy
- difference element? empty? enable-type-theory error-to-string
- eval eval-kl exception explode external fail fail-if file
- findall fix fst fwhen gensym get-time hash hd hdstr hdv head
- identical implementation in include include-all-but inferences
- input input+ integer? intern intersection is kill language
- length limit lineread loaded macro macroexpand map mapcan
- maxinferences mode n->string nl nth null number? occurrences
- occurs-check open os out port porters pos pr preclude
- preclude-all-but print profile profile-results ps quit read
- read+ read-byte read-file read-file-as-bytelist
- read-file-as-string read-from-string release remove return
- reverse run save set simple-error snd specialise spy step
- stinput stoutput str string->n string->symbol string? subst
- symbol? systemf tail tc tc? thaw tl tlstr tlv track tuple?
- undefmacro unify unify! union unprofile unspecialise untrack
- variable? vector vector-> vector? verified version warn when
- write-byte write-to-file y-or-n?
- """)
-
- BUILTINS_ANYWHERE = re.findall(r'\S+', """
- where skip >> _ ! <e> <!>
- """)
+ DECLARATIONS = (
+ 'datatype', 'define', 'defmacro', 'defprolog', 'defcc',
+ 'synonyms', 'declare', 'package', 'type', 'function',
+ )
+
+ SPECIAL_FORMS = (
+ 'lambda', 'get', 'let', 'if', 'cases', 'cond', 'put', 'time', 'freeze',
+ 'value', 'load', '$', 'protect', 'or', 'and', 'not', 'do', 'output',
+ 'prolog?', 'trap-error', 'error', 'make-string', '/.', 'set', '@p',
+ '@s', '@v',
+ )
+
+ BUILTINS = (
+ '==', '=', '*', '+', '-', '/', '<', '>', '>=', '<=', '<-address',
+ '<-vector', 'abort', 'absvector', 'absvector?', 'address->', 'adjoin',
+ 'append', 'arity', 'assoc', 'bind', 'boolean?', 'bound?', 'call', 'cd',
+ 'close', 'cn', 'compile', 'concat', 'cons', 'cons?', 'cut', 'destroy',
+ 'difference', 'element?', 'empty?', 'enable-type-theory',
+ 'error-to-string', 'eval', 'eval-kl', 'exception', 'explode', 'external',
+ 'fail', 'fail-if', 'file', 'findall', 'fix', 'fst', 'fwhen', 'gensym',
+ 'get-time', 'hash', 'hd', 'hdstr', 'hdv', 'head', 'identical',
+ 'implementation', 'in', 'include', 'include-all-but', 'inferences',
+ 'input', 'input+', 'integer?', 'intern', 'intersection', 'is', 'kill',
+ 'language', 'length', 'limit', 'lineread', 'loaded', 'macro', 'macroexpand',
+ 'map', 'mapcan', 'maxinferences', 'mode', 'n->string', 'nl', 'nth', 'null',
+ 'number?', 'occurrences', 'occurs-check', 'open', 'os', 'out', 'port',
+ 'porters', 'pos', 'pr', 'preclude', 'preclude-all-but', 'print', 'profile',
+ 'profile-results', 'ps', 'quit', 'read', 'read+', 'read-byte', 'read-file',
+ 'read-file-as-bytelist', 'read-file-as-string', 'read-from-string',
+ 'release', 'remove', 'return', 'reverse', 'run', 'save', 'set',
+ 'simple-error', 'snd', 'specialise', 'spy', 'step', 'stinput', 'stoutput',
+ 'str', 'string->n', 'string->symbol', 'string?', 'subst', 'symbol?',
+ 'systemf', 'tail', 'tc', 'tc?', 'thaw', 'tl', 'tlstr', 'tlv', 'track',
+ 'tuple?', 'undefmacro', 'unify', 'unify!', 'union', 'unprofile',
+ 'unspecialise', 'untrack', 'variable?', 'vector', 'vector->', 'vector?',
+ 'verified', 'version', 'warn', 'when', 'write-byte', 'write-to-file',
+ 'y-or-n?',
+ )
+
+ BUILTINS_ANYWHERE = ('where', 'skip', '>>', '_', '!', '<e>', '<!>')
MAPPINGS = dict((s, Keyword) for s in DECLARATIONS)
MAPPINGS.update((s, Name.Builtin) for s in BUILTINS)
MAPPINGS.update((s, Keyword) for s in SPECIAL_FORMS)
- valid_symbol_chars = r'[\w!$%*+,<=>?/.\'@&#:_-]'
+ valid_symbol_chars = r'[\w!$%*+,<=>?/.\'@&#:-]'
valid_name = '%s+' % valid_symbol_chars
symbol_name = r'[a-z!$%%*+,<=>?/.\'@&#_-]%s*' % valid_symbol_chars
variable = r'[A-Z]%s*' % valid_symbol_chars
@@ -2313,7 +2317,7 @@ class CPSALexer(SchemeLexer):
# valid names for identifiers
# well, names can only not consist fully of numbers
# but this should be good enough for now
- valid_name = r'[a-zA-Z0-9!$%&*+,/:<=>?@^_~|-]+'
+ valid_name = r'[\w!$%&*+,/:<=>?@^~|-]+'
tokens = {
'root': [
@@ -2334,7 +2338,7 @@ class CPSALexer(SchemeLexer):
# strings, symbols and characters
(r'"(\\\\|\\"|[^"])*"', String),
(r"'" + valid_name, String.Symbol),
- (r"#\\([()/'\"._!§$%& ?=+-]{1}|[a-zA-Z0-9]+)", String.Char),
+ (r"#\\([()/'\"._!§$%& ?=+-]|[a-zA-Z0-9]+)", String.Char),
# constants
(r'(#t|#f)', Name.Constant),
@@ -2363,3 +2367,207 @@ class CPSALexer(SchemeLexer):
(r'(\[|\])', Punctuation),
],
}
+
+
+class XtlangLexer(RegexLexer):
+ """An xtlang lexer for the `Extempore programming environment
+ <http://extempore.moso.com.au>`_.
+
+ This is a mixture of Scheme and xtlang, really. Keyword lists are
+ taken from the Extempore Emacs mode
+ (https://github.com/extemporelang/extempore-emacs-mode)
+
+ .. versionadded:: 2.2
+ """
+ name = 'xtlang'
+ aliases = ['extempore']
+ filenames = ['*.xtm']
+ mimetypes = []
+
+ common_keywords = (
+ 'lambda', 'define', 'if', 'else', 'cond', 'and',
+ 'or', 'let', 'begin', 'set!', 'map', 'for-each',
+ )
+ scheme_keywords = (
+ 'do', 'delay', 'quasiquote', 'unquote', 'unquote-splicing', 'eval',
+ 'case', 'let*', 'letrec', 'quote',
+ )
+ xtlang_bind_keywords = (
+ 'bind-func', 'bind-val', 'bind-lib', 'bind-type', 'bind-alias',
+ 'bind-poly', 'bind-dylib', 'bind-lib-func', 'bind-lib-val',
+ )
+ xtlang_keywords = (
+ 'letz', 'memzone', 'cast', 'convert', 'dotimes', 'doloop',
+ )
+ common_functions = (
+ '*', '+', '-', '/', '<', '<=', '=', '>', '>=', '%', 'abs', 'acos',
+ 'angle', 'append', 'apply', 'asin', 'assoc', 'assq', 'assv',
+ 'atan', 'boolean?', 'caaaar', 'caaadr', 'caaar', 'caadar',
+ 'caaddr', 'caadr', 'caar', 'cadaar', 'cadadr', 'cadar',
+ 'caddar', 'cadddr', 'caddr', 'cadr', 'car', 'cdaaar',
+ 'cdaadr', 'cdaar', 'cdadar', 'cdaddr', 'cdadr', 'cdar',
+ 'cddaar', 'cddadr', 'cddar', 'cdddar', 'cddddr', 'cdddr',
+ 'cddr', 'cdr', 'ceiling', 'cons', 'cos', 'floor', 'length',
+ 'list', 'log', 'max', 'member', 'min', 'modulo', 'not',
+ 'reverse', 'round', 'sin', 'sqrt', 'substring', 'tan',
+ 'println', 'random', 'null?', 'callback', 'now',
+ )
+ scheme_functions = (
+ 'call-with-current-continuation', 'call-with-input-file',
+ 'call-with-output-file', 'call-with-values', 'call/cc',
+ 'char->integer', 'char-alphabetic?', 'char-ci<=?', 'char-ci<?',
+ 'char-ci=?', 'char-ci>=?', 'char-ci>?', 'char-downcase',
+ 'char-lower-case?', 'char-numeric?', 'char-ready?',
+ 'char-upcase', 'char-upper-case?', 'char-whitespace?',
+ 'char<=?', 'char<?', 'char=?', 'char>=?', 'char>?', 'char?',
+ 'close-input-port', 'close-output-port', 'complex?',
+ 'current-input-port', 'current-output-port', 'denominator',
+ 'display', 'dynamic-wind', 'eof-object?', 'eq?', 'equal?',
+ 'eqv?', 'even?', 'exact->inexact', 'exact?', 'exp', 'expt',
+ 'force', 'gcd', 'imag-part', 'inexact->exact', 'inexact?',
+ 'input-port?', 'integer->char', 'integer?',
+ 'interaction-environment', 'lcm', 'list->string',
+ 'list->vector', 'list-ref', 'list-tail', 'list?', 'load',
+ 'magnitude', 'make-polar', 'make-rectangular', 'make-string',
+ 'make-vector', 'memq', 'memv', 'negative?', 'newline',
+ 'null-environment', 'number->string', 'number?',
+ 'numerator', 'odd?', 'open-input-file', 'open-output-file',
+ 'output-port?', 'pair?', 'peek-char', 'port?', 'positive?',
+ 'procedure?', 'quotient', 'rational?', 'rationalize', 'read',
+ 'read-char', 'real-part', 'real?',
+ 'remainder', 'scheme-report-environment', 'set-car!', 'set-cdr!',
+ 'string', 'string->list', 'string->number', 'string->symbol',
+ 'string-append', 'string-ci<=?', 'string-ci<?', 'string-ci=?',
+ 'string-ci>=?', 'string-ci>?', 'string-copy', 'string-fill!',
+ 'string-length', 'string-ref', 'string-set!', 'string<=?',
+ 'string<?', 'string=?', 'string>=?', 'string>?', 'string?',
+ 'symbol->string', 'symbol?', 'transcript-off', 'transcript-on',
+ 'truncate', 'values', 'vector', 'vector->list', 'vector-fill!',
+ 'vector-length', 'vector?',
+ 'with-input-from-file', 'with-output-to-file', 'write',
+ 'write-char', 'zero?',
+ )
+ xtlang_functions = (
+ 'printf', 'toString', 'afill!', 'pfill!', 'tfill!', 'tbind', 'vfill!',
+ 'array-fill!', 'pointer-fill!', 'tuple-fill!', 'vector-fill!', 'free',
+ 'array', 'tuple', 'list', '~', 'cset!', 'cref', '&', 'bor',
+ 'ang-names', '<<', '>>', 'nil', 'printf', 'sprintf', 'null', 'now',
+ 'pset!', 'pref-ptr', 'vset!', 'vref', 'aset!', 'aref', 'aref-ptr',
+ 'tset!', 'tref', 'tref-ptr', 'salloc', 'halloc', 'zalloc', 'alloc',
+ 'schedule', 'exp', 'log', 'sin', 'cos', 'tan', 'asin', 'acos', 'atan',
+ 'sqrt', 'expt', 'floor', 'ceiling', 'truncate', 'round',
+ 'llvm_printf', 'push_zone', 'pop_zone', 'memzone', 'callback',
+ 'llvm_sprintf', 'make-array', 'array-set!', 'array-ref',
+ 'array-ref-ptr', 'pointer-set!', 'pointer-ref', 'pointer-ref-ptr',
+ 'stack-alloc', 'heap-alloc', 'zone-alloc', 'make-tuple', 'tuple-set!',
+ 'tuple-ref', 'tuple-ref-ptr', 'closure-set!', 'closure-ref', 'pref',
+ 'pdref', 'impc_null', 'bitcast', 'void', 'ifret', 'ret->', 'clrun->',
+ 'make-env-zone', 'make-env', '<>', 'dtof', 'ftod', 'i1tof',
+ 'i1tod', 'i1toi8', 'i1toi32', 'i1toi64', 'i8tof', 'i8tod',
+ 'i8toi1', 'i8toi32', 'i8toi64', 'i32tof', 'i32tod', 'i32toi1',
+ 'i32toi8', 'i32toi64', 'i64tof', 'i64tod', 'i64toi1',
+ 'i64toi8', 'i64toi32',
+ )
+
+ # valid names for Scheme identifiers (names cannot consist fully
+ # of numbers, but this should be good enough for now)
+ valid_scheme_name = r'[\w!$%&*+,/:<=>?@^~|-]+'
+
+ # valid characters in xtlang names & types
+ valid_xtlang_name = r'[\w.!-]+'
+ valid_xtlang_type = r'[]{}[\w<>,*/|!-]+'
+
+ tokens = {
+ # keep track of when we're exiting the xtlang form
+ 'xtlang': [
+ (r'\(', Punctuation, '#push'),
+ (r'\)', Punctuation, '#pop'),
+
+ (r'(?<=bind-func\s)' + valid_xtlang_name, Name.Function),
+ (r'(?<=bind-val\s)' + valid_xtlang_name, Name.Function),
+ (r'(?<=bind-type\s)' + valid_xtlang_name, Name.Function),
+ (r'(?<=bind-alias\s)' + valid_xtlang_name, Name.Function),
+ (r'(?<=bind-poly\s)' + valid_xtlang_name, Name.Function),
+ (r'(?<=bind-lib\s)' + valid_xtlang_name, Name.Function),
+ (r'(?<=bind-dylib\s)' + valid_xtlang_name, Name.Function),
+ (r'(?<=bind-lib-func\s)' + valid_xtlang_name, Name.Function),
+ (r'(?<=bind-lib-val\s)' + valid_xtlang_name, Name.Function),
+
+ # type annotations
+ (r':' + valid_xtlang_type, Keyword.Type),
+
+ # types
+ (r'(<' + valid_xtlang_type + r'>|\|' + valid_xtlang_type + r'\||/' +
+ valid_xtlang_type + r'/|' + valid_xtlang_type + r'\*)\**',
+ Keyword.Type),
+
+ # keywords
+ (words(xtlang_keywords, prefix=r'(?<=\()'), Keyword),
+
+ # builtins
+ (words(xtlang_functions, prefix=r'(?<=\()'), Name.Function),
+
+ include('common'),
+
+ # variables
+ (valid_xtlang_name, Name.Variable),
+ ],
+ 'scheme': [
+ # quoted symbols
+ (r"'" + valid_scheme_name, String.Symbol),
+
+ # char literals
+ (r"#\\([()/'\"._!§$%& ?=+-]|[a-zA-Z0-9]+)", String.Char),
+
+ # special operators
+ (r"('|#|`|,@|,|\.)", Operator),
+
+ # keywords
+ (words(scheme_keywords, prefix=r'(?<=\()'), Keyword),
+
+ # builtins
+ (words(scheme_functions, prefix=r'(?<=\()'), Name.Function),
+
+ include('common'),
+
+ # variables
+ (valid_scheme_name, Name.Variable),
+ ],
+ # common to both xtlang and Scheme
+ 'common': [
+ # comments
+ (r';.*$', Comment.Single),
+
+ # whitespaces - usually not relevant
+ (r'\s+', Text),
+
+ # numbers
+ (r'-?\d+\.\d+', Number.Float),
+ (r'-?\d+', Number.Integer),
+
+ # binary/oct/hex literals
+ (r'(#b|#o|#x)[\d.]+', Number),
+
+ # strings
+ (r'"(\\\\|\\"|[^"])*"', String),
+
+ # true/false constants
+ (r'(#t|#f)', Name.Constant),
+
+ # keywords
+ (words(common_keywords, prefix=r'(?<=\()'), Keyword),
+
+ # builtins
+ (words(common_functions, prefix=r'(?<=\()'), Name.Function),
+
+ # the famous parentheses!
+ (r'(\(|\))', Punctuation),
+ ],
+ 'root': [
+ # go into xtlang mode
+ (words(xtlang_bind_keywords, prefix=r'(?<=\()', suffix=r'\b'),
+ Keyword, 'xtlang'),
+
+ include('scheme')
+ ],
+ }
diff --git a/pygments/lexers/modula2.py b/pygments/lexers/modula2.py
index a5fcbf78..01771f55 100644
--- a/pygments/lexers/modula2.py
+++ b/pygments/lexers/modula2.py
@@ -290,7 +290,7 @@ class Modula2Lexer(RegexLexer):
],
'unigraph_punctuation': [
# Common Punctuation
- (r'[\(\)\[\]{},.:;\|]', Punctuation),
+ (r'[()\[\]{},.:;|]', Punctuation),
# Case Label Separator Synonym
(r'!', Punctuation), # ISO
# Blueprint Punctuation
diff --git a/pygments/lexers/ncl.py b/pygments/lexers/ncl.py
new file mode 100644
index 00000000..23eba786
--- /dev/null
+++ b/pygments/lexers/ncl.py
@@ -0,0 +1,1053 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.lexers.ncl
+ ~~~~~~~~~~~~~~~~~~~
+
+ Lexers for NCAR Command Language.
+
+ :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+import re
+
+from pygments.lexer import RegexLexer, include, words
+from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
+ Number, Punctuation
+
+__all__ = ['NCLLexer']
+
+
+class NCLLexer(RegexLexer):
+ """
+ Lexer for NCL code.
+
+ .. versionadded:: 2.2
+ """
+ name = 'NCL'
+ aliases = ['ncl']
+ filenames = ['*.ncl']
+ mimetypes = ['text/ncl']
+ flags = re.MULTILINE
+
+ tokens = {
+ 'root': [
+ (r';.*\n', Comment),
+ include('strings'),
+ include('core'),
+ (r'[a-z][\w$]*', Name),
+ include('nums'),
+ (r'[\s]+', Text),
+ ],
+ 'core': [
+ # Statements
+ (words((
+ 'begin', 'break', 'continue', 'create', 'defaultapp', 'do',
+ 'else', 'end', 'external', 'exit', 'False', 'file', 'function',
+ 'getvalues', 'graphic', 'group', 'if', 'list', 'load', 'local',
+ 'new', '_Missing', 'Missing', 'new', 'noparent', 'procedure',
+ 'quit', 'QUIT', 'Quit', 'record', 'return', 'setvalues', 'stop',
+ 'then', 'while'), prefix=r'\b', suffix=r'\s*\b'),
+ Keyword),
+
+ # Data Types
+ (words((
+ 'ubyte', 'uint', 'uint64', 'ulong', 'string', 'byte',
+ 'character', 'double', 'float', 'integer', 'int64', 'logical',
+ 'long', 'short', 'ushort', 'enumeric', 'numeric', 'snumeric'),
+ prefix=r'\b', suffix=r'\s*\b'),
+ Keyword.Type),
+
+ # Operators
+ (r'[\^*+\-/<>]', Operator),
+
+ # punctuation:
+ (r'[\[\]():@$.,]', Punctuation),
+ (r'[=:]', Punctuation),
+
+ # Intrinsics
+ (words((
+ 'abs', 'acos', 'addfile', 'addfiles', 'all', 'angmom_atm', 'any',
+ 'area_conserve_remap', 'area_hi2lores', 'area_poly_sphere',
+ 'asciiread', 'asciiwrite', 'asin', 'atan', 'atan2', 'attsetvalues',
+ 'avg', 'betainc', 'bin_avg', 'bin_sum', 'bw_bandpass_filter',
+ 'cancor', 'cbinread', 'cbinwrite', 'cd_calendar', 'cd_inv_calendar',
+ 'cdfbin_p', 'cdfbin_pr', 'cdfbin_s', 'cdfbin_xn', 'cdfchi_p',
+ 'cdfchi_x', 'cdfgam_p', 'cdfgam_x', 'cdfnor_p', 'cdfnor_x',
+ 'cdft_p', 'cdft_t', 'ceil', 'center_finite_diff',
+ 'center_finite_diff_n', 'cfftb', 'cfftf', 'cfftf_frq_reorder',
+ 'charactertodouble', 'charactertofloat', 'charactertointeger',
+ 'charactertolong', 'charactertoshort', 'charactertostring',
+ 'chartodouble', 'chartofloat', 'chartoint', 'chartointeger',
+ 'chartolong', 'chartoshort', 'chartostring', 'chiinv', 'clear',
+ 'color_index_to_rgba', 'conform', 'conform_dims', 'cos', 'cosh',
+ 'count_unique_values', 'covcorm', 'covcorm_xy', 'craybinnumrec',
+ 'craybinrecread', 'create_graphic', 'csa1', 'csa1d', 'csa1s',
+ 'csa1x', 'csa1xd', 'csa1xs', 'csa2', 'csa2d', 'csa2l', 'csa2ld',
+ 'csa2ls', 'csa2lx', 'csa2lxd', 'csa2lxs', 'csa2s', 'csa2x',
+ 'csa2xd', 'csa2xs', 'csa3', 'csa3d', 'csa3l', 'csa3ld', 'csa3ls',
+ 'csa3lx', 'csa3lxd', 'csa3lxs', 'csa3s', 'csa3x', 'csa3xd',
+ 'csa3xs', 'csc2s', 'csgetp', 'css2c', 'cssetp', 'cssgrid', 'csstri',
+ 'csvoro', 'cumsum', 'cz2ccm', 'datatondc', 'day_of_week',
+ 'day_of_year', 'days_in_month', 'default_fillvalue', 'delete',
+ 'depth_to_pres', 'destroy', 'determinant', 'dewtemp_trh',
+ 'dgeevx_lapack', 'dim_acumrun_n', 'dim_avg', 'dim_avg_n',
+ 'dim_avg_wgt', 'dim_avg_wgt_n', 'dim_cumsum', 'dim_cumsum_n',
+ 'dim_gamfit_n', 'dim_gbits', 'dim_max', 'dim_max_n', 'dim_median',
+ 'dim_median_n', 'dim_min', 'dim_min_n', 'dim_num', 'dim_num_n',
+ 'dim_numrun_n', 'dim_pqsort', 'dim_pqsort_n', 'dim_product',
+ 'dim_product_n', 'dim_rmsd', 'dim_rmsd_n', 'dim_rmvmean',
+ 'dim_rmvmean_n', 'dim_rmvmed', 'dim_rmvmed_n', 'dim_spi_n',
+ 'dim_standardize', 'dim_standardize_n', 'dim_stat4', 'dim_stat4_n',
+ 'dim_stddev', 'dim_stddev_n', 'dim_sum', 'dim_sum_n', 'dim_sum_wgt',
+ 'dim_sum_wgt_n', 'dim_variance', 'dim_variance_n', 'dimsizes',
+ 'doubletobyte', 'doubletochar', 'doubletocharacter',
+ 'doubletofloat', 'doubletoint', 'doubletointeger', 'doubletolong',
+ 'doubletoshort', 'dpres_hybrid_ccm', 'dpres_plevel', 'draw',
+ 'draw_color_palette', 'dsgetp', 'dsgrid2', 'dsgrid2d', 'dsgrid2s',
+ 'dsgrid3', 'dsgrid3d', 'dsgrid3s', 'dspnt2', 'dspnt2d', 'dspnt2s',
+ 'dspnt3', 'dspnt3d', 'dspnt3s', 'dssetp', 'dtrend', 'dtrend_msg',
+ 'dtrend_msg_n', 'dtrend_n', 'dtrend_quadratic',
+ 'dtrend_quadratic_msg_n', 'dv2uvf', 'dv2uvg', 'dz_height',
+ 'echo_off', 'echo_on', 'eof2data', 'eof_varimax', 'eofcor',
+ 'eofcor_pcmsg', 'eofcor_ts', 'eofcov', 'eofcov_pcmsg', 'eofcov_ts',
+ 'eofunc', 'eofunc_ts', 'eofunc_varimax', 'equiv_sample_size', 'erf',
+ 'erfc', 'esacr', 'esacv', 'esccr', 'esccv', 'escorc', 'escorc_n',
+ 'escovc', 'exit', 'exp', 'exp_tapersh', 'exp_tapersh_wgts',
+ 'exp_tapershC', 'ezfftb', 'ezfftb_n', 'ezfftf', 'ezfftf_n',
+ 'f2fosh', 'f2foshv', 'f2fsh', 'f2fshv', 'f2gsh', 'f2gshv', 'fabs',
+ 'fbindirread', 'fbindirwrite', 'fbinnumrec', 'fbinread',
+ 'fbinrecread', 'fbinrecwrite', 'fbinwrite', 'fft2db', 'fft2df',
+ 'fftshift', 'fileattdef', 'filechunkdimdef', 'filedimdef',
+ 'fileexists', 'filegrpdef', 'filevarattdef', 'filevarchunkdef',
+ 'filevarcompressleveldef', 'filevardef', 'filevardimsizes',
+ 'filwgts_lancos', 'filwgts_lanczos', 'filwgts_normal',
+ 'floattobyte', 'floattochar', 'floattocharacter', 'floattoint',
+ 'floattointeger', 'floattolong', 'floattoshort', 'floor',
+ 'fluxEddy', 'fo2fsh', 'fo2fshv', 'fourier_info', 'frame', 'fspan',
+ 'ftcurv', 'ftcurvd', 'ftcurvi', 'ftcurvp', 'ftcurvpi', 'ftcurvps',
+ 'ftcurvs', 'ftest', 'ftgetp', 'ftkurv', 'ftkurvd', 'ftkurvp',
+ 'ftkurvpd', 'ftsetp', 'ftsurf', 'g2fsh', 'g2fshv', 'g2gsh',
+ 'g2gshv', 'gamma', 'gammainc', 'gaus', 'gaus_lobat',
+ 'gaus_lobat_wgt', 'gc_aangle', 'gc_clkwise', 'gc_dangle',
+ 'gc_inout', 'gc_latlon', 'gc_onarc', 'gc_pnt2gc', 'gc_qarea',
+ 'gc_tarea', 'generate_2d_array', 'get_color_index',
+ 'get_color_rgba', 'get_cpu_time', 'get_isolines', 'get_ncl_version',
+ 'get_script_name', 'get_script_prefix_name', 'get_sphere_radius',
+ 'get_unique_values', 'getbitsone', 'getenv', 'getfiledimsizes',
+ 'getfilegrpnames', 'getfilepath', 'getfilevaratts',
+ 'getfilevarchunkdimsizes', 'getfilevardims', 'getfilevardimsizes',
+ 'getfilevarnames', 'getfilevartypes', 'getvaratts', 'getvardims',
+ 'gradsf', 'gradsg', 'greg2jul', 'grid2triple', 'hlsrgb', 'hsvrgb',
+ 'hydro', 'hyi2hyo', 'idsfft', 'igradsf', 'igradsg', 'ilapsf',
+ 'ilapsg', 'ilapvf', 'ilapvg', 'ind', 'ind_resolve', 'int2p',
+ 'int2p_n', 'integertobyte', 'integertochar', 'integertocharacter',
+ 'integertoshort', 'inttobyte', 'inttochar', 'inttoshort',
+ 'inverse_matrix', 'isatt', 'isbigendian', 'isbyte', 'ischar',
+ 'iscoord', 'isdefined', 'isdim', 'isdimnamed', 'isdouble',
+ 'isenumeric', 'isfile', 'isfilepresent', 'isfilevar',
+ 'isfilevaratt', 'isfilevarcoord', 'isfilevardim', 'isfloat',
+ 'isfunc', 'isgraphic', 'isint', 'isint64', 'isinteger',
+ 'isleapyear', 'islogical', 'islong', 'ismissing', 'isnan_ieee',
+ 'isnumeric', 'ispan', 'isproc', 'isshort', 'issnumeric', 'isstring',
+ 'isubyte', 'isuint', 'isuint64', 'isulong', 'isunlimited',
+ 'isunsigned', 'isushort', 'isvar', 'jul2greg', 'kmeans_as136',
+ 'kolsm2_n', 'kron_product', 'lapsf', 'lapsg', 'lapvf', 'lapvg',
+ 'latlon2utm', 'lclvl', 'lderuvf', 'lderuvg', 'linint1', 'linint1_n',
+ 'linint2', 'linint2_points', 'linmsg', 'linmsg_n', 'linrood_latwgt',
+ 'linrood_wgt', 'list_files', 'list_filevars', 'list_hlus',
+ 'list_procfuncs', 'list_vars', 'ListAppend', 'ListCount',
+ 'ListGetType', 'ListIndex', 'ListIndexFromName', 'ListPop',
+ 'ListPush', 'ListSetType', 'loadscript', 'local_max', 'local_min',
+ 'log', 'log10', 'longtobyte', 'longtochar', 'longtocharacter',
+ 'longtoint', 'longtointeger', 'longtoshort', 'lspoly', 'lspoly_n',
+ 'mask', 'max', 'maxind', 'min', 'minind', 'mixed_layer_depth',
+ 'mixhum_ptd', 'mixhum_ptrh', 'mjo_cross_coh2pha',
+ 'mjo_cross_segment', 'moc_globe_atl', 'monthday', 'natgrid',
+ 'natgridd', 'natgrids', 'ncargpath', 'ncargversion', 'ndctodata',
+ 'ndtooned', 'new', 'NewList', 'ngezlogo', 'nggcog', 'nggetp',
+ 'nglogo', 'ngsetp', 'NhlAddAnnotation', 'NhlAddData',
+ 'NhlAddOverlay', 'NhlAddPrimitive', 'NhlAppGetDefaultParentId',
+ 'NhlChangeWorkstation', 'NhlClassName', 'NhlClearWorkstation',
+ 'NhlDataPolygon', 'NhlDataPolyline', 'NhlDataPolymarker',
+ 'NhlDataToNDC', 'NhlDestroy', 'NhlDraw', 'NhlFrame', 'NhlFreeColor',
+ 'NhlGetBB', 'NhlGetClassResources', 'NhlGetErrorObjectId',
+ 'NhlGetNamedColorIndex', 'NhlGetParentId',
+ 'NhlGetParentWorkstation', 'NhlGetWorkspaceObjectId',
+ 'NhlIsAllocatedColor', 'NhlIsApp', 'NhlIsDataComm', 'NhlIsDataItem',
+ 'NhlIsDataSpec', 'NhlIsTransform', 'NhlIsView', 'NhlIsWorkstation',
+ 'NhlName', 'NhlNDCPolygon', 'NhlNDCPolyline', 'NhlNDCPolymarker',
+ 'NhlNDCToData', 'NhlNewColor', 'NhlNewDashPattern', 'NhlNewMarker',
+ 'NhlPalGetDefined', 'NhlRemoveAnnotation', 'NhlRemoveData',
+ 'NhlRemoveOverlay', 'NhlRemovePrimitive', 'NhlSetColor',
+ 'NhlSetDashPattern', 'NhlSetMarker', 'NhlUpdateData',
+ 'NhlUpdateWorkstation', 'nice_mnmxintvl', 'nngetaspectd',
+ 'nngetaspects', 'nngetp', 'nngetsloped', 'nngetslopes', 'nngetwts',
+ 'nngetwtsd', 'nnpnt', 'nnpntd', 'nnpntend', 'nnpntendd',
+ 'nnpntinit', 'nnpntinitd', 'nnpntinits', 'nnpnts', 'nnsetp', 'num',
+ 'obj_anal_ic', 'omega_ccm', 'onedtond', 'overlay', 'paleo_outline',
+ 'pdfxy_bin', 'poisson_grid_fill', 'pop_remap', 'potmp_insitu_ocn',
+ 'prcwater_dp', 'pres2hybrid', 'pres_hybrid_ccm', 'pres_sigma',
+ 'print', 'print_table', 'printFileVarSummary', 'printVarSummary',
+ 'product', 'pslec', 'pslhor', 'pslhyp', 'qsort', 'rand',
+ 'random_chi', 'random_gamma', 'random_normal', 'random_setallseed',
+ 'random_uniform', 'rcm2points', 'rcm2rgrid', 'rdsstoi',
+ 'read_colormap_file', 'reg_multlin', 'regcoef', 'regCoef_n',
+ 'regline', 'relhum', 'replace_ieeenan', 'reshape', 'reshape_ind',
+ 'rgba_to_color_index', 'rgbhls', 'rgbhsv', 'rgbyiq', 'rgrid2rcm',
+ 'rhomb_trunc', 'rip_cape_2d', 'rip_cape_3d', 'round', 'rtest',
+ 'runave', 'runave_n', 'set_default_fillvalue', 'set_sphere_radius',
+ 'setfileoption', 'sfvp2uvf', 'sfvp2uvg', 'shaec', 'shagc',
+ 'shgetnp', 'shgetp', 'shgrid', 'shorttobyte', 'shorttochar',
+ 'shorttocharacter', 'show_ascii', 'shsec', 'shsetp', 'shsgc',
+ 'shsgc_R42', 'sigma2hybrid', 'simpeq', 'simpne', 'sin',
+ 'sindex_yrmo', 'sinh', 'sizeof', 'sleep', 'smth9', 'snindex_yrmo',
+ 'solve_linsys', 'span_color_indexes', 'span_color_rgba',
+ 'sparse_matrix_mult', 'spcorr', 'spcorr_n', 'specx_anal',
+ 'specxy_anal', 'spei', 'sprintf', 'sprinti', 'sqrt', 'sqsort',
+ 'srand', 'stat2', 'stat4', 'stat_medrng', 'stat_trim',
+ 'status_exit', 'stdatmus_p2tdz', 'stdatmus_z2tdp', 'stddev',
+ 'str_capital', 'str_concat', 'str_fields_count', 'str_get_cols',
+ 'str_get_dq', 'str_get_field', 'str_get_nl', 'str_get_sq',
+ 'str_get_tab', 'str_index_of_substr', 'str_insert', 'str_is_blank',
+ 'str_join', 'str_left_strip', 'str_lower', 'str_match',
+ 'str_match_ic', 'str_match_ic_regex', 'str_match_ind',
+ 'str_match_ind_ic', 'str_match_ind_ic_regex', 'str_match_ind_regex',
+ 'str_match_regex', 'str_right_strip', 'str_split',
+ 'str_split_by_length', 'str_split_csv', 'str_squeeze', 'str_strip',
+ 'str_sub_str', 'str_switch', 'str_upper', 'stringtochar',
+ 'stringtocharacter', 'stringtodouble', 'stringtofloat',
+ 'stringtoint', 'stringtointeger', 'stringtolong', 'stringtoshort',
+ 'strlen', 'student_t', 'sum', 'svd_lapack', 'svdcov', 'svdcov_sv',
+ 'svdstd', 'svdstd_sv', 'system', 'systemfunc', 'tan', 'tanh',
+ 'taper', 'taper_n', 'tdclrs', 'tdctri', 'tdcudp', 'tdcurv',
+ 'tddtri', 'tdez2d', 'tdez3d', 'tdgetp', 'tdgrds', 'tdgrid',
+ 'tdgtrs', 'tdinit', 'tditri', 'tdlbla', 'tdlblp', 'tdlbls',
+ 'tdline', 'tdlndp', 'tdlnpa', 'tdlpdp', 'tdmtri', 'tdotri',
+ 'tdpara', 'tdplch', 'tdprpa', 'tdprpi', 'tdprpt', 'tdsetp',
+ 'tdsort', 'tdstri', 'tdstrs', 'tdttri', 'thornthwaite', 'tobyte',
+ 'tochar', 'todouble', 'tofloat', 'toint', 'toint64', 'tointeger',
+ 'tolong', 'toshort', 'tosigned', 'tostring', 'tostring_with_format',
+ 'totype', 'toubyte', 'touint', 'touint64', 'toulong', 'tounsigned',
+ 'toushort', 'trend_manken', 'tri_trunc', 'triple2grid',
+ 'triple2grid2d', 'trop_wmo', 'ttest', 'typeof', 'undef',
+ 'unique_string', 'update', 'ushorttoint', 'ut_calendar',
+ 'ut_inv_calendar', 'utm2latlon', 'uv2dv_cfd', 'uv2dvf', 'uv2dvg',
+ 'uv2sfvpf', 'uv2sfvpg', 'uv2vr_cfd', 'uv2vrdvf', 'uv2vrdvg',
+ 'uv2vrf', 'uv2vrg', 'v5d_close', 'v5d_create', 'v5d_setLowLev',
+ 'v5d_setUnits', 'v5d_write', 'v5d_write_var', 'variance', 'vhaec',
+ 'vhagc', 'vhsec', 'vhsgc', 'vibeta', 'vinth2p', 'vinth2p_ecmwf',
+ 'vinth2p_ecmwf_nodes', 'vinth2p_nodes', 'vintp2p_ecmwf', 'vr2uvf',
+ 'vr2uvg', 'vrdv2uvf', 'vrdv2uvg', 'wavelet', 'wavelet_default',
+ 'weibull', 'wgt_area_smooth', 'wgt_areaave', 'wgt_areaave2',
+ 'wgt_arearmse', 'wgt_arearmse2', 'wgt_areasum2', 'wgt_runave',
+ 'wgt_runave_n', 'wgt_vert_avg_beta', 'wgt_volave', 'wgt_volave_ccm',
+ 'wgt_volrmse', 'wgt_volrmse_ccm', 'where', 'wk_smooth121', 'wmbarb',
+ 'wmbarbmap', 'wmdrft', 'wmgetp', 'wmlabs', 'wmsetp', 'wmstnm',
+ 'wmvect', 'wmvectmap', 'wmvlbl', 'wrf_avo', 'wrf_cape_2d',
+ 'wrf_cape_3d', 'wrf_dbz', 'wrf_eth', 'wrf_helicity', 'wrf_ij_to_ll',
+ 'wrf_interp_1d', 'wrf_interp_2d_xy', 'wrf_interp_3d_z',
+ 'wrf_latlon_to_ij', 'wrf_ll_to_ij', 'wrf_omega', 'wrf_pvo',
+ 'wrf_rh', 'wrf_slp', 'wrf_smooth_2d', 'wrf_td', 'wrf_tk',
+ 'wrf_updraft_helicity', 'wrf_uvmet', 'wrf_virtual_temp',
+ 'wrf_wetbulb', 'wrf_wps_close_int', 'wrf_wps_open_int',
+ 'wrf_wps_rddata_int', 'wrf_wps_rdhead_int', 'wrf_wps_read_int',
+ 'wrf_wps_write_int', 'write_matrix', 'write_table', 'yiqrgb',
+ 'z2geouv', 'zonal_mpsi', 'addfiles_GetVar', 'advect_variable',
+ 'area_conserve_remap_Wrap', 'area_hi2lores_Wrap',
+ 'array_append_record', 'assignFillValue', 'byte2flt',
+ 'byte2flt_hdf', 'calcDayAnomTLL', 'calcMonAnomLLLT',
+ 'calcMonAnomLLT', 'calcMonAnomTLL', 'calcMonAnomTLLL',
+ 'calculate_monthly_values', 'cd_convert', 'changeCase',
+ 'changeCaseChar', 'clmDayTLL', 'clmDayTLLL', 'clmMon2clmDay',
+ 'clmMonLLLT', 'clmMonLLT', 'clmMonTLL', 'clmMonTLLL', 'closest_val',
+ 'copy_VarAtts', 'copy_VarCoords', 'copy_VarCoords_1',
+ 'copy_VarCoords_2', 'copy_VarMeta', 'copyatt', 'crossp3',
+ 'cshstringtolist', 'cssgrid_Wrap', 'dble2flt', 'decimalPlaces',
+ 'delete_VarAtts', 'dim_avg_n_Wrap', 'dim_avg_wgt_n_Wrap',
+ 'dim_avg_wgt_Wrap', 'dim_avg_Wrap', 'dim_cumsum_n_Wrap',
+ 'dim_cumsum_Wrap', 'dim_max_n_Wrap', 'dim_min_n_Wrap',
+ 'dim_rmsd_n_Wrap', 'dim_rmsd_Wrap', 'dim_rmvmean_n_Wrap',
+ 'dim_rmvmean_Wrap', 'dim_rmvmed_n_Wrap', 'dim_rmvmed_Wrap',
+ 'dim_standardize_n_Wrap', 'dim_standardize_Wrap',
+ 'dim_stddev_n_Wrap', 'dim_stddev_Wrap', 'dim_sum_n_Wrap',
+ 'dim_sum_wgt_n_Wrap', 'dim_sum_wgt_Wrap', 'dim_sum_Wrap',
+ 'dim_variance_n_Wrap', 'dim_variance_Wrap', 'dpres_plevel_Wrap',
+ 'dtrend_leftdim', 'dv2uvF_Wrap', 'dv2uvG_Wrap', 'eof_north',
+ 'eofcor_Wrap', 'eofcov_Wrap', 'eofunc_north', 'eofunc_ts_Wrap',
+ 'eofunc_varimax_reorder', 'eofunc_varimax_Wrap', 'eofunc_Wrap',
+ 'epsZero', 'f2fosh_Wrap', 'f2foshv_Wrap', 'f2fsh_Wrap',
+ 'f2fshv_Wrap', 'f2gsh_Wrap', 'f2gshv_Wrap', 'fbindirSwap',
+ 'fbinseqSwap1', 'fbinseqSwap2', 'flt2dble', 'flt2string',
+ 'fo2fsh_Wrap', 'fo2fshv_Wrap', 'g2fsh_Wrap', 'g2fshv_Wrap',
+ 'g2gsh_Wrap', 'g2gshv_Wrap', 'generate_resample_indices',
+ 'generate_sample_indices', 'generate_unique_indices',
+ 'genNormalDist', 'get1Dindex', 'get1Dindex_Collapse',
+ 'get1Dindex_Exclude', 'get_file_suffix', 'GetFillColor',
+ 'GetFillColorIndex', 'getFillValue', 'getind_latlon2d',
+ 'getVarDimNames', 'getVarFillValue', 'grib_stime2itime',
+ 'hyi2hyo_Wrap', 'ilapsF_Wrap', 'ilapsG_Wrap', 'ind_nearest_coord',
+ 'indStrSubset', 'int2dble', 'int2flt', 'int2p_n_Wrap', 'int2p_Wrap',
+ 'isMonotonic', 'isStrSubset', 'latGau', 'latGauWgt', 'latGlobeF',
+ 'latGlobeFo', 'latRegWgt', 'linint1_n_Wrap', 'linint1_Wrap',
+ 'linint2_points_Wrap', 'linint2_Wrap', 'local_max_1d',
+ 'local_min_1d', 'lonFlip', 'lonGlobeF', 'lonGlobeFo', 'lonPivot',
+ 'merge_levels_sfc', 'mod', 'month_to_annual',
+ 'month_to_annual_weighted', 'month_to_season', 'month_to_season12',
+ 'month_to_seasonN', 'monthly_total_to_daily_mean', 'nameDim',
+ 'natgrid_Wrap', 'NewCosWeight', 'niceLatLon2D', 'NormCosWgtGlobe',
+ 'numAsciiCol', 'numAsciiRow', 'numeric2int',
+ 'obj_anal_ic_deprecated', 'obj_anal_ic_Wrap', 'omega_ccm_driver',
+ 'omega_to_w', 'oneDtostring', 'pack_values', 'pattern_cor', 'pdfx',
+ 'pdfxy', 'pdfxy_conform', 'pot_temp', 'pot_vort_hybrid',
+ 'pot_vort_isobaric', 'pres2hybrid_Wrap', 'print_clock',
+ 'printMinMax', 'quadroots', 'rcm2points_Wrap', 'rcm2rgrid_Wrap',
+ 'readAsciiHead', 'readAsciiTable', 'reg_multlin_stats',
+ 'region_ind', 'regline_stats', 'relhum_ttd', 'replaceSingleChar',
+ 'RGBtoCmap', 'rgrid2rcm_Wrap', 'rho_mwjf', 'rm_single_dims',
+ 'rmAnnCycle1D', 'rmInsufData', 'rmMonAnnCycLLLT', 'rmMonAnnCycLLT',
+ 'rmMonAnnCycTLL', 'runave_n_Wrap', 'runave_Wrap', 'short2flt',
+ 'short2flt_hdf', 'shsgc_R42_Wrap', 'sign_f90', 'sign_matlab',
+ 'smth9_Wrap', 'smthClmDayTLL', 'smthClmDayTLLL', 'SqrtCosWeight',
+ 'stat_dispersion', 'static_stability', 'stdMonLLLT', 'stdMonLLT',
+ 'stdMonTLL', 'stdMonTLLL', 'symMinMaxPlt', 'table_attach_columns',
+ 'table_attach_rows', 'time_to_newtime', 'transpose',
+ 'triple2grid_Wrap', 'ut_convert', 'uv2dvF_Wrap', 'uv2dvG_Wrap',
+ 'uv2vrF_Wrap', 'uv2vrG_Wrap', 'vr2uvF_Wrap', 'vr2uvG_Wrap',
+ 'w_to_omega', 'wallClockElapseTime', 'wave_number_spc',
+ 'wgt_areaave_Wrap', 'wgt_runave_leftdim', 'wgt_runave_n_Wrap',
+ 'wgt_runave_Wrap', 'wgt_vertical_n', 'wind_component',
+ 'wind_direction', 'yyyyddd_to_yyyymmdd', 'yyyymm_time',
+ 'yyyymm_to_yyyyfrac', 'yyyymmdd_time', 'yyyymmdd_to_yyyyddd',
+ 'yyyymmdd_to_yyyyfrac', 'yyyymmddhh_time', 'yyyymmddhh_to_yyyyfrac',
+ 'zonal_mpsi_Wrap', 'zonalAve', 'calendar_decode2', 'cd_string',
+ 'kf_filter', 'run_cor', 'time_axis_labels', 'ut_string',
+ 'wrf_contour', 'wrf_map', 'wrf_map_overlay', 'wrf_map_overlays',
+ 'wrf_map_resources', 'wrf_map_zoom', 'wrf_overlay', 'wrf_overlays',
+ 'wrf_user_getvar', 'wrf_user_ij_to_ll', 'wrf_user_intrp2d',
+ 'wrf_user_intrp3d', 'wrf_user_latlon_to_ij', 'wrf_user_list_times',
+ 'wrf_user_ll_to_ij', 'wrf_user_unstagger', 'wrf_user_vert_interp',
+ 'wrf_vector', 'gsn_add_annotation', 'gsn_add_polygon',
+ 'gsn_add_polyline', 'gsn_add_polymarker',
+ 'gsn_add_shapefile_polygons', 'gsn_add_shapefile_polylines',
+ 'gsn_add_shapefile_polymarkers', 'gsn_add_text', 'gsn_attach_plots',
+ 'gsn_blank_plot', 'gsn_contour', 'gsn_contour_map',
+ 'gsn_contour_shade', 'gsn_coordinates', 'gsn_create_labelbar',
+ 'gsn_create_legend', 'gsn_create_text',
+ 'gsn_csm_attach_zonal_means', 'gsn_csm_blank_plot',
+ 'gsn_csm_contour', 'gsn_csm_contour_map', 'gsn_csm_contour_map_ce',
+ 'gsn_csm_contour_map_overlay', 'gsn_csm_contour_map_polar',
+ 'gsn_csm_hov', 'gsn_csm_lat_time', 'gsn_csm_map', 'gsn_csm_map_ce',
+ 'gsn_csm_map_polar', 'gsn_csm_pres_hgt',
+ 'gsn_csm_pres_hgt_streamline', 'gsn_csm_pres_hgt_vector',
+ 'gsn_csm_streamline', 'gsn_csm_streamline_contour_map',
+ 'gsn_csm_streamline_contour_map_ce',
+ 'gsn_csm_streamline_contour_map_polar', 'gsn_csm_streamline_map',
+ 'gsn_csm_streamline_map_ce', 'gsn_csm_streamline_map_polar',
+ 'gsn_csm_streamline_scalar', 'gsn_csm_streamline_scalar_map',
+ 'gsn_csm_streamline_scalar_map_ce',
+ 'gsn_csm_streamline_scalar_map_polar', 'gsn_csm_time_lat',
+ 'gsn_csm_vector', 'gsn_csm_vector_map', 'gsn_csm_vector_map_ce',
+ 'gsn_csm_vector_map_polar', 'gsn_csm_vector_scalar',
+ 'gsn_csm_vector_scalar_map', 'gsn_csm_vector_scalar_map_ce',
+ 'gsn_csm_vector_scalar_map_polar', 'gsn_csm_x2y', 'gsn_csm_x2y2',
+ 'gsn_csm_xy', 'gsn_csm_xy2', 'gsn_csm_xy3', 'gsn_csm_y',
+ 'gsn_define_colormap', 'gsn_draw_colormap', 'gsn_draw_named_colors',
+ 'gsn_histogram', 'gsn_labelbar_ndc', 'gsn_legend_ndc', 'gsn_map',
+ 'gsn_merge_colormaps', 'gsn_open_wks', 'gsn_panel', 'gsn_polygon',
+ 'gsn_polygon_ndc', 'gsn_polyline', 'gsn_polyline_ndc',
+ 'gsn_polymarker', 'gsn_polymarker_ndc', 'gsn_retrieve_colormap',
+ 'gsn_reverse_colormap', 'gsn_streamline', 'gsn_streamline_map',
+ 'gsn_streamline_scalar', 'gsn_streamline_scalar_map', 'gsn_table',
+ 'gsn_text', 'gsn_text_ndc', 'gsn_vector', 'gsn_vector_map',
+ 'gsn_vector_scalar', 'gsn_vector_scalar_map', 'gsn_xy', 'gsn_y',
+ 'hsv2rgb', 'maximize_output', 'namedcolor2rgb', 'namedcolor2rgba',
+ 'reset_device_coordinates', 'span_named_colors'), prefix=r'\b'),
+ Name.Builtin),
+
+ # Resources
+ (words((
+ 'amDataXF', 'amDataYF', 'amJust', 'amOn', 'amOrthogonalPosF',
+ 'amParallelPosF', 'amResizeNotify', 'amSide', 'amTrackData',
+ 'amViewId', 'amZone', 'appDefaultParent', 'appFileSuffix',
+ 'appResources', 'appSysDir', 'appUsrDir', 'caCopyArrays',
+ 'caXArray', 'caXCast', 'caXMaxV', 'caXMinV', 'caXMissingV',
+ 'caYArray', 'caYCast', 'caYMaxV', 'caYMinV', 'caYMissingV',
+ 'cnCellFillEdgeColor', 'cnCellFillMissingValEdgeColor',
+ 'cnConpackParams', 'cnConstFEnableFill', 'cnConstFLabelAngleF',
+ 'cnConstFLabelBackgroundColor', 'cnConstFLabelConstantSpacingF',
+ 'cnConstFLabelFont', 'cnConstFLabelFontAspectF',
+ 'cnConstFLabelFontColor', 'cnConstFLabelFontHeightF',
+ 'cnConstFLabelFontQuality', 'cnConstFLabelFontThicknessF',
+ 'cnConstFLabelFormat', 'cnConstFLabelFuncCode', 'cnConstFLabelJust',
+ 'cnConstFLabelOn', 'cnConstFLabelOrthogonalPosF',
+ 'cnConstFLabelParallelPosF', 'cnConstFLabelPerimColor',
+ 'cnConstFLabelPerimOn', 'cnConstFLabelPerimSpaceF',
+ 'cnConstFLabelPerimThicknessF', 'cnConstFLabelSide',
+ 'cnConstFLabelString', 'cnConstFLabelTextDirection',
+ 'cnConstFLabelZone', 'cnConstFUseInfoLabelRes',
+ 'cnExplicitLabelBarLabelsOn', 'cnExplicitLegendLabelsOn',
+ 'cnExplicitLineLabelsOn', 'cnFillBackgroundColor', 'cnFillColor',
+ 'cnFillColors', 'cnFillDotSizeF', 'cnFillDrawOrder', 'cnFillMode',
+ 'cnFillOn', 'cnFillOpacityF', 'cnFillPalette', 'cnFillPattern',
+ 'cnFillPatterns', 'cnFillScaleF', 'cnFillScales', 'cnFixFillBleed',
+ 'cnGridBoundFillColor', 'cnGridBoundFillPattern',
+ 'cnGridBoundFillScaleF', 'cnGridBoundPerimColor',
+ 'cnGridBoundPerimDashPattern', 'cnGridBoundPerimOn',
+ 'cnGridBoundPerimThicknessF', 'cnHighLabelAngleF',
+ 'cnHighLabelBackgroundColor', 'cnHighLabelConstantSpacingF',
+ 'cnHighLabelCount', 'cnHighLabelFont', 'cnHighLabelFontAspectF',
+ 'cnHighLabelFontColor', 'cnHighLabelFontHeightF',
+ 'cnHighLabelFontQuality', 'cnHighLabelFontThicknessF',
+ 'cnHighLabelFormat', 'cnHighLabelFuncCode', 'cnHighLabelPerimColor',
+ 'cnHighLabelPerimOn', 'cnHighLabelPerimSpaceF',
+ 'cnHighLabelPerimThicknessF', 'cnHighLabelString', 'cnHighLabelsOn',
+ 'cnHighLowLabelOverlapMode', 'cnHighUseLineLabelRes',
+ 'cnInfoLabelAngleF', 'cnInfoLabelBackgroundColor',
+ 'cnInfoLabelConstantSpacingF', 'cnInfoLabelFont',
+ 'cnInfoLabelFontAspectF', 'cnInfoLabelFontColor',
+ 'cnInfoLabelFontHeightF', 'cnInfoLabelFontQuality',
+ 'cnInfoLabelFontThicknessF', 'cnInfoLabelFormat',
+ 'cnInfoLabelFuncCode', 'cnInfoLabelJust', 'cnInfoLabelOn',
+ 'cnInfoLabelOrthogonalPosF', 'cnInfoLabelParallelPosF',
+ 'cnInfoLabelPerimColor', 'cnInfoLabelPerimOn',
+ 'cnInfoLabelPerimSpaceF', 'cnInfoLabelPerimThicknessF',
+ 'cnInfoLabelSide', 'cnInfoLabelString', 'cnInfoLabelTextDirection',
+ 'cnInfoLabelZone', 'cnLabelBarEndLabelsOn', 'cnLabelBarEndStyle',
+ 'cnLabelDrawOrder', 'cnLabelMasking', 'cnLabelScaleFactorF',
+ 'cnLabelScaleValueF', 'cnLabelScalingMode', 'cnLegendLevelFlags',
+ 'cnLevelCount', 'cnLevelFlag', 'cnLevelFlags', 'cnLevelSelectionMode',
+ 'cnLevelSpacingF', 'cnLevels', 'cnLineColor', 'cnLineColors',
+ 'cnLineDashPattern', 'cnLineDashPatterns', 'cnLineDashSegLenF',
+ 'cnLineDrawOrder', 'cnLineLabelAngleF', 'cnLineLabelBackgroundColor',
+ 'cnLineLabelConstantSpacingF', 'cnLineLabelCount',
+ 'cnLineLabelDensityF', 'cnLineLabelFont', 'cnLineLabelFontAspectF',
+ 'cnLineLabelFontColor', 'cnLineLabelFontColors',
+ 'cnLineLabelFontHeightF', 'cnLineLabelFontQuality',
+ 'cnLineLabelFontThicknessF', 'cnLineLabelFormat',
+ 'cnLineLabelFuncCode', 'cnLineLabelInterval', 'cnLineLabelPerimColor',
+ 'cnLineLabelPerimOn', 'cnLineLabelPerimSpaceF',
+ 'cnLineLabelPerimThicknessF', 'cnLineLabelPlacementMode',
+ 'cnLineLabelStrings', 'cnLineLabelsOn', 'cnLinePalette',
+ 'cnLineThicknessF', 'cnLineThicknesses', 'cnLinesOn',
+ 'cnLowLabelAngleF', 'cnLowLabelBackgroundColor',
+ 'cnLowLabelConstantSpacingF', 'cnLowLabelCount', 'cnLowLabelFont',
+ 'cnLowLabelFontAspectF', 'cnLowLabelFontColor',
+ 'cnLowLabelFontHeightF', 'cnLowLabelFontQuality',
+ 'cnLowLabelFontThicknessF', 'cnLowLabelFormat', 'cnLowLabelFuncCode',
+ 'cnLowLabelPerimColor', 'cnLowLabelPerimOn', 'cnLowLabelPerimSpaceF',
+ 'cnLowLabelPerimThicknessF', 'cnLowLabelString', 'cnLowLabelsOn',
+ 'cnLowUseHighLabelRes', 'cnMaxDataValueFormat', 'cnMaxLevelCount',
+ 'cnMaxLevelValF', 'cnMaxPointDistanceF', 'cnMinLevelValF',
+ 'cnMissingValFillColor', 'cnMissingValFillPattern',
+ 'cnMissingValFillScaleF', 'cnMissingValPerimColor',
+ 'cnMissingValPerimDashPattern', 'cnMissingValPerimGridBoundOn',
+ 'cnMissingValPerimOn', 'cnMissingValPerimThicknessF',
+ 'cnMonoFillColor', 'cnMonoFillPattern', 'cnMonoFillScale',
+ 'cnMonoLevelFlag', 'cnMonoLineColor', 'cnMonoLineDashPattern',
+ 'cnMonoLineLabelFontColor', 'cnMonoLineThickness', 'cnNoDataLabelOn',
+ 'cnNoDataLabelString', 'cnOutOfRangeFillColor',
+ 'cnOutOfRangeFillPattern', 'cnOutOfRangeFillScaleF',
+ 'cnOutOfRangePerimColor', 'cnOutOfRangePerimDashPattern',
+ 'cnOutOfRangePerimOn', 'cnOutOfRangePerimThicknessF',
+ 'cnRasterCellSizeF', 'cnRasterMinCellSizeF', 'cnRasterModeOn',
+ 'cnRasterSampleFactorF', 'cnRasterSmoothingOn', 'cnScalarFieldData',
+ 'cnSmoothingDistanceF', 'cnSmoothingOn', 'cnSmoothingTensionF',
+ 'cnSpanFillPalette', 'cnSpanLinePalette', 'ctCopyTables',
+ 'ctXElementSize', 'ctXMaxV', 'ctXMinV', 'ctXMissingV', 'ctXTable',
+ 'ctXTableLengths', 'ctXTableType', 'ctYElementSize', 'ctYMaxV',
+ 'ctYMinV', 'ctYMissingV', 'ctYTable', 'ctYTableLengths',
+ 'ctYTableType', 'dcDelayCompute', 'errBuffer',
+ 'errFileName', 'errFilePtr', 'errLevel', 'errPrint', 'errUnitNumber',
+ 'gsClipOn', 'gsColors', 'gsEdgeColor', 'gsEdgeDashPattern',
+ 'gsEdgeDashSegLenF', 'gsEdgeThicknessF', 'gsEdgesOn',
+ 'gsFillBackgroundColor', 'gsFillColor', 'gsFillDotSizeF',
+ 'gsFillIndex', 'gsFillLineThicknessF', 'gsFillOpacityF',
+ 'gsFillScaleF', 'gsFont', 'gsFontAspectF', 'gsFontColor',
+ 'gsFontHeightF', 'gsFontOpacityF', 'gsFontQuality',
+ 'gsFontThicknessF', 'gsLineColor', 'gsLineDashPattern',
+ 'gsLineDashSegLenF', 'gsLineLabelConstantSpacingF', 'gsLineLabelFont',
+ 'gsLineLabelFontAspectF', 'gsLineLabelFontColor',
+ 'gsLineLabelFontHeightF', 'gsLineLabelFontQuality',
+ 'gsLineLabelFontThicknessF', 'gsLineLabelFuncCode',
+ 'gsLineLabelString', 'gsLineOpacityF', 'gsLineThicknessF',
+ 'gsMarkerColor', 'gsMarkerIndex', 'gsMarkerOpacityF', 'gsMarkerSizeF',
+ 'gsMarkerThicknessF', 'gsSegments', 'gsTextAngleF',
+ 'gsTextConstantSpacingF', 'gsTextDirection', 'gsTextFuncCode',
+ 'gsTextJustification', 'gsnAboveYRefLineBarColors',
+ 'gsnAboveYRefLineBarFillScales', 'gsnAboveYRefLineBarPatterns',
+ 'gsnAboveYRefLineColor', 'gsnAddCyclic', 'gsnAttachBorderOn',
+ 'gsnAttachPlotsXAxis', 'gsnBelowYRefLineBarColors',
+ 'gsnBelowYRefLineBarFillScales', 'gsnBelowYRefLineBarPatterns',
+ 'gsnBelowYRefLineColor', 'gsnBoxMargin', 'gsnCenterString',
+ 'gsnCenterStringFontColor', 'gsnCenterStringFontHeightF',
+ 'gsnCenterStringFuncCode', 'gsnCenterStringOrthogonalPosF',
+ 'gsnCenterStringParallelPosF', 'gsnContourLineThicknessesScale',
+ 'gsnContourNegLineDashPattern', 'gsnContourPosLineDashPattern',
+ 'gsnContourZeroLineThicknessF', 'gsnDebugWriteFileName', 'gsnDraw',
+ 'gsnFrame', 'gsnHistogramBarWidthPercent', 'gsnHistogramBinIntervals',
+ 'gsnHistogramBinMissing', 'gsnHistogramBinWidth',
+ 'gsnHistogramClassIntervals', 'gsnHistogramCompare',
+ 'gsnHistogramComputePercentages',
+ 'gsnHistogramComputePercentagesNoMissing',
+ 'gsnHistogramDiscreteBinValues', 'gsnHistogramDiscreteClassValues',
+ 'gsnHistogramHorizontal', 'gsnHistogramMinMaxBinsOn',
+ 'gsnHistogramNumberOfBins', 'gsnHistogramPercentSign',
+ 'gsnHistogramSelectNiceIntervals', 'gsnLeftString',
+ 'gsnLeftStringFontColor', 'gsnLeftStringFontHeightF',
+ 'gsnLeftStringFuncCode', 'gsnLeftStringOrthogonalPosF',
+ 'gsnLeftStringParallelPosF', 'gsnMajorLatSpacing',
+ 'gsnMajorLonSpacing', 'gsnMaskLambertConformal',
+ 'gsnMaskLambertConformalOutlineOn', 'gsnMaximize',
+ 'gsnMinorLatSpacing', 'gsnMinorLonSpacing', 'gsnPanelBottom',
+ 'gsnPanelCenter', 'gsnPanelDebug', 'gsnPanelFigureStrings',
+ 'gsnPanelFigureStringsBackgroundFillColor',
+ 'gsnPanelFigureStringsFontHeightF', 'gsnPanelFigureStringsJust',
+ 'gsnPanelFigureStringsPerimOn', 'gsnPanelLabelBar', 'gsnPanelLeft',
+ 'gsnPanelMainFont', 'gsnPanelMainFontColor',
+ 'gsnPanelMainFontHeightF', 'gsnPanelMainString', 'gsnPanelRight',
+ 'gsnPanelRowSpec', 'gsnPanelScalePlotIndex', 'gsnPanelTop',
+ 'gsnPanelXF', 'gsnPanelXWhiteSpacePercent', 'gsnPanelYF',
+ 'gsnPanelYWhiteSpacePercent', 'gsnPaperHeight', 'gsnPaperMargin',
+ 'gsnPaperOrientation', 'gsnPaperWidth', 'gsnPolar',
+ 'gsnPolarLabelDistance', 'gsnPolarLabelFont',
+ 'gsnPolarLabelFontHeightF', 'gsnPolarLabelSpacing', 'gsnPolarTime',
+ 'gsnPolarUT', 'gsnRightString', 'gsnRightStringFontColor',
+ 'gsnRightStringFontHeightF', 'gsnRightStringFuncCode',
+ 'gsnRightStringOrthogonalPosF', 'gsnRightStringParallelPosF',
+ 'gsnScalarContour', 'gsnScale', 'gsnShape', 'gsnSpreadColorEnd',
+ 'gsnSpreadColorStart', 'gsnSpreadColors', 'gsnStringFont',
+ 'gsnStringFontColor', 'gsnStringFontHeightF', 'gsnStringFuncCode',
+ 'gsnTickMarksOn', 'gsnXAxisIrregular2Linear', 'gsnXAxisIrregular2Log',
+ 'gsnXRefLine', 'gsnXRefLineColor', 'gsnXRefLineDashPattern',
+ 'gsnXRefLineThicknessF', 'gsnXYAboveFillColors', 'gsnXYBarChart',
+ 'gsnXYBarChartBarWidth', 'gsnXYBarChartColors',
+ 'gsnXYBarChartColors2', 'gsnXYBarChartFillDotSizeF',
+ 'gsnXYBarChartFillLineThicknessF', 'gsnXYBarChartFillOpacityF',
+ 'gsnXYBarChartFillScaleF', 'gsnXYBarChartOutlineOnly',
+ 'gsnXYBarChartOutlineThicknessF', 'gsnXYBarChartPatterns',
+ 'gsnXYBarChartPatterns2', 'gsnXYBelowFillColors', 'gsnXYFillColors',
+ 'gsnXYFillOpacities', 'gsnXYLeftFillColors', 'gsnXYRightFillColors',
+ 'gsnYAxisIrregular2Linear', 'gsnYAxisIrregular2Log', 'gsnYRefLine',
+ 'gsnYRefLineColor', 'gsnYRefLineColors', 'gsnYRefLineDashPattern',
+ 'gsnYRefLineDashPatterns', 'gsnYRefLineThicknessF',
+ 'gsnYRefLineThicknesses', 'gsnZonalMean', 'gsnZonalMeanXMaxF',
+ 'gsnZonalMeanXMinF', 'gsnZonalMeanYRefLine', 'lbAutoManage',
+ 'lbBottomMarginF', 'lbBoxCount', 'lbBoxEndCapStyle', 'lbBoxFractions',
+ 'lbBoxLineColor', 'lbBoxLineDashPattern', 'lbBoxLineDashSegLenF',
+ 'lbBoxLineThicknessF', 'lbBoxLinesOn', 'lbBoxMajorExtentF',
+ 'lbBoxMinorExtentF', 'lbBoxSeparatorLinesOn', 'lbBoxSizing',
+ 'lbFillBackground', 'lbFillColor', 'lbFillColors', 'lbFillDotSizeF',
+ 'lbFillLineThicknessF', 'lbFillPattern', 'lbFillPatterns',
+ 'lbFillScaleF', 'lbFillScales', 'lbJustification', 'lbLabelAlignment',
+ 'lbLabelAngleF', 'lbLabelAutoStride', 'lbLabelBarOn',
+ 'lbLabelConstantSpacingF', 'lbLabelDirection', 'lbLabelFont',
+ 'lbLabelFontAspectF', 'lbLabelFontColor', 'lbLabelFontHeightF',
+ 'lbLabelFontQuality', 'lbLabelFontThicknessF', 'lbLabelFuncCode',
+ 'lbLabelJust', 'lbLabelOffsetF', 'lbLabelPosition', 'lbLabelStride',
+ 'lbLabelStrings', 'lbLabelsOn', 'lbLeftMarginF', 'lbMaxLabelLenF',
+ 'lbMinLabelSpacingF', 'lbMonoFillColor', 'lbMonoFillPattern',
+ 'lbMonoFillScale', 'lbOrientation', 'lbPerimColor',
+ 'lbPerimDashPattern', 'lbPerimDashSegLenF', 'lbPerimFill',
+ 'lbPerimFillColor', 'lbPerimOn', 'lbPerimThicknessF',
+ 'lbRasterFillOn', 'lbRightMarginF', 'lbTitleAngleF',
+ 'lbTitleConstantSpacingF', 'lbTitleDirection', 'lbTitleExtentF',
+ 'lbTitleFont', 'lbTitleFontAspectF', 'lbTitleFontColor',
+ 'lbTitleFontHeightF', 'lbTitleFontQuality', 'lbTitleFontThicknessF',
+ 'lbTitleFuncCode', 'lbTitleJust', 'lbTitleOffsetF', 'lbTitleOn',
+ 'lbTitlePosition', 'lbTitleString', 'lbTopMarginF', 'lgAutoManage',
+ 'lgBottomMarginF', 'lgBoxBackground', 'lgBoxLineColor',
+ 'lgBoxLineDashPattern', 'lgBoxLineDashSegLenF', 'lgBoxLineThicknessF',
+ 'lgBoxLinesOn', 'lgBoxMajorExtentF', 'lgBoxMinorExtentF',
+ 'lgDashIndex', 'lgDashIndexes', 'lgItemCount', 'lgItemOrder',
+ 'lgItemPlacement', 'lgItemPositions', 'lgItemType', 'lgItemTypes',
+ 'lgJustification', 'lgLabelAlignment', 'lgLabelAngleF',
+ 'lgLabelAutoStride', 'lgLabelConstantSpacingF', 'lgLabelDirection',
+ 'lgLabelFont', 'lgLabelFontAspectF', 'lgLabelFontColor',
+ 'lgLabelFontHeightF', 'lgLabelFontQuality', 'lgLabelFontThicknessF',
+ 'lgLabelFuncCode', 'lgLabelJust', 'lgLabelOffsetF', 'lgLabelPosition',
+ 'lgLabelStride', 'lgLabelStrings', 'lgLabelsOn', 'lgLeftMarginF',
+ 'lgLegendOn', 'lgLineColor', 'lgLineColors', 'lgLineDashSegLenF',
+ 'lgLineDashSegLens', 'lgLineLabelConstantSpacingF', 'lgLineLabelFont',
+ 'lgLineLabelFontAspectF', 'lgLineLabelFontColor',
+ 'lgLineLabelFontColors', 'lgLineLabelFontHeightF',
+ 'lgLineLabelFontHeights', 'lgLineLabelFontQuality',
+ 'lgLineLabelFontThicknessF', 'lgLineLabelFuncCode',
+ 'lgLineLabelStrings', 'lgLineLabelsOn', 'lgLineThicknessF',
+ 'lgLineThicknesses', 'lgMarkerColor', 'lgMarkerColors',
+ 'lgMarkerIndex', 'lgMarkerIndexes', 'lgMarkerSizeF', 'lgMarkerSizes',
+ 'lgMarkerThicknessF', 'lgMarkerThicknesses', 'lgMonoDashIndex',
+ 'lgMonoItemType', 'lgMonoLineColor', 'lgMonoLineDashSegLen',
+ 'lgMonoLineLabelFontColor', 'lgMonoLineLabelFontHeight',
+ 'lgMonoLineThickness', 'lgMonoMarkerColor', 'lgMonoMarkerIndex',
+ 'lgMonoMarkerSize', 'lgMonoMarkerThickness', 'lgOrientation',
+ 'lgPerimColor', 'lgPerimDashPattern', 'lgPerimDashSegLenF',
+ 'lgPerimFill', 'lgPerimFillColor', 'lgPerimOn', 'lgPerimThicknessF',
+ 'lgRightMarginF', 'lgTitleAngleF', 'lgTitleConstantSpacingF',
+ 'lgTitleDirection', 'lgTitleExtentF', 'lgTitleFont',
+ 'lgTitleFontAspectF', 'lgTitleFontColor', 'lgTitleFontHeightF',
+ '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',
+ 'pmLabelBarParallelPosF', 'pmLabelBarSide', 'pmLabelBarWidthF',
+ 'pmLabelBarZone', 'pmLegendDisplayMode', 'pmLegendHeightF',
+ 'pmLegendKeepAspect', 'pmLegendOrthogonalPosF',
+ 'pmLegendParallelPosF', 'pmLegendSide', 'pmLegendWidthF',
+ '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',
+ 'stArrowStride', 'stCrossoverCheckCount',
+ 'stExplicitLabelBarLabelsOn', 'stLabelBarEndLabelsOn',
+ 'stLabelFormat', 'stLengthCheckCount', 'stLevelColors',
+ 'stLevelCount', 'stLevelPalette', 'stLevelSelectionMode',
+ 'stLevelSpacingF', 'stLevels', 'stLineColor', 'stLineOpacityF',
+ 'stLineStartStride', 'stLineThicknessF', 'stMapDirection',
+ 'stMaxLevelCount', 'stMaxLevelValF', 'stMinArrowSpacingF',
+ 'stMinDistanceF', 'stMinLevelValF', 'stMinLineSpacingF',
+ 'stMinStepFactorF', 'stMonoLineColor', 'stNoDataLabelOn',
+ 'stNoDataLabelString', 'stScalarFieldData', 'stScalarMissingValColor',
+ 'stSpanLevelPalette', 'stStepSizeF', 'stStreamlineDrawOrder',
+ 'stUseScalarArray', 'stVectorFieldData', 'stZeroFLabelAngleF',
+ 'stZeroFLabelBackgroundColor', 'stZeroFLabelConstantSpacingF',
+ 'stZeroFLabelFont', 'stZeroFLabelFontAspectF',
+ 'stZeroFLabelFontColor', 'stZeroFLabelFontHeightF',
+ 'stZeroFLabelFontQuality', 'stZeroFLabelFontThicknessF',
+ 'stZeroFLabelFuncCode', 'stZeroFLabelJust', 'stZeroFLabelOn',
+ 'stZeroFLabelOrthogonalPosF', 'stZeroFLabelParallelPosF',
+ 'stZeroFLabelPerimColor', 'stZeroFLabelPerimOn',
+ 'stZeroFLabelPerimSpaceF', 'stZeroFLabelPerimThicknessF',
+ 'stZeroFLabelSide', 'stZeroFLabelString', 'stZeroFLabelTextDirection',
+ 'stZeroFLabelZone', 'tfDoNDCOverlay', 'tfPlotManagerOn',
+ 'tfPolyDrawList', 'tfPolyDrawOrder', 'tiDeltaF', 'tiMainAngleF',
+ 'tiMainConstantSpacingF', 'tiMainDirection', 'tiMainFont',
+ 'tiMainFontAspectF', 'tiMainFontColor', 'tiMainFontHeightF',
+ 'tiMainFontQuality', 'tiMainFontThicknessF', 'tiMainFuncCode',
+ 'tiMainJust', 'tiMainOffsetXF', 'tiMainOffsetYF', 'tiMainOn',
+ 'tiMainPosition', 'tiMainSide', 'tiMainString', 'tiUseMainAttributes',
+ 'tiXAxisAngleF', 'tiXAxisConstantSpacingF', 'tiXAxisDirection',
+ 'tiXAxisFont', 'tiXAxisFontAspectF', 'tiXAxisFontColor',
+ 'tiXAxisFontHeightF', 'tiXAxisFontQuality', 'tiXAxisFontThicknessF',
+ 'tiXAxisFuncCode', 'tiXAxisJust', 'tiXAxisOffsetXF',
+ 'tiXAxisOffsetYF', 'tiXAxisOn', 'tiXAxisPosition', 'tiXAxisSide',
+ 'tiXAxisString', 'tiYAxisAngleF', 'tiYAxisConstantSpacingF',
+ 'tiYAxisDirection', 'tiYAxisFont', 'tiYAxisFontAspectF',
+ 'tiYAxisFontColor', 'tiYAxisFontHeightF', 'tiYAxisFontQuality',
+ 'tiYAxisFontThicknessF', 'tiYAxisFuncCode', 'tiYAxisJust',
+ 'tiYAxisOffsetXF', 'tiYAxisOffsetYF', 'tiYAxisOn', 'tiYAxisPosition',
+ 'tiYAxisSide', 'tiYAxisString', 'tmBorderLineColor',
+ 'tmBorderThicknessF', 'tmEqualizeXYSizes', 'tmLabelAutoStride',
+ 'tmSciNoteCutoff', 'tmXBAutoPrecision', 'tmXBBorderOn',
+ 'tmXBDataLeftF', 'tmXBDataRightF', 'tmXBFormat', 'tmXBIrrTensionF',
+ 'tmXBIrregularPoints', 'tmXBLabelAngleF', 'tmXBLabelConstantSpacingF',
+ 'tmXBLabelDeltaF', 'tmXBLabelDirection', 'tmXBLabelFont',
+ 'tmXBLabelFontAspectF', 'tmXBLabelFontColor', 'tmXBLabelFontHeightF',
+ 'tmXBLabelFontQuality', 'tmXBLabelFontThicknessF',
+ 'tmXBLabelFuncCode', 'tmXBLabelJust', 'tmXBLabelStride', 'tmXBLabels',
+ 'tmXBLabelsOn', 'tmXBMajorLengthF', 'tmXBMajorLineColor',
+ 'tmXBMajorOutwardLengthF', 'tmXBMajorThicknessF', 'tmXBMaxLabelLenF',
+ 'tmXBMaxTicks', 'tmXBMinLabelSpacingF', 'tmXBMinorLengthF',
+ 'tmXBMinorLineColor', 'tmXBMinorOn', 'tmXBMinorOutwardLengthF',
+ 'tmXBMinorPerMajor', 'tmXBMinorThicknessF', 'tmXBMinorValues',
+ 'tmXBMode', 'tmXBOn', 'tmXBPrecision', 'tmXBStyle', 'tmXBTickEndF',
+ 'tmXBTickSpacingF', 'tmXBTickStartF', 'tmXBValues', 'tmXMajorGrid',
+ 'tmXMajorGridLineColor', 'tmXMajorGridLineDashPattern',
+ 'tmXMajorGridThicknessF', 'tmXMinorGrid', 'tmXMinorGridLineColor',
+ 'tmXMinorGridLineDashPattern', 'tmXMinorGridThicknessF',
+ 'tmXTAutoPrecision', 'tmXTBorderOn', 'tmXTDataLeftF',
+ 'tmXTDataRightF', 'tmXTFormat', 'tmXTIrrTensionF',
+ 'tmXTIrregularPoints', 'tmXTLabelAngleF', 'tmXTLabelConstantSpacingF',
+ 'tmXTLabelDeltaF', 'tmXTLabelDirection', 'tmXTLabelFont',
+ 'tmXTLabelFontAspectF', 'tmXTLabelFontColor', 'tmXTLabelFontHeightF',
+ 'tmXTLabelFontQuality', 'tmXTLabelFontThicknessF',
+ 'tmXTLabelFuncCode', 'tmXTLabelJust', 'tmXTLabelStride', 'tmXTLabels',
+ 'tmXTLabelsOn', 'tmXTMajorLengthF', 'tmXTMajorLineColor',
+ 'tmXTMajorOutwardLengthF', 'tmXTMajorThicknessF', 'tmXTMaxLabelLenF',
+ 'tmXTMaxTicks', 'tmXTMinLabelSpacingF', 'tmXTMinorLengthF',
+ 'tmXTMinorLineColor', 'tmXTMinorOn', 'tmXTMinorOutwardLengthF',
+ 'tmXTMinorPerMajor', 'tmXTMinorThicknessF', 'tmXTMinorValues',
+ 'tmXTMode', 'tmXTOn', 'tmXTPrecision', 'tmXTStyle', 'tmXTTickEndF',
+ 'tmXTTickSpacingF', 'tmXTTickStartF', 'tmXTValues', 'tmXUseBottom',
+ 'tmYLAutoPrecision', 'tmYLBorderOn', 'tmYLDataBottomF',
+ 'tmYLDataTopF', 'tmYLFormat', 'tmYLIrrTensionF',
+ 'tmYLIrregularPoints', 'tmYLLabelAngleF', 'tmYLLabelConstantSpacingF',
+ 'tmYLLabelDeltaF', 'tmYLLabelDirection', 'tmYLLabelFont',
+ 'tmYLLabelFontAspectF', 'tmYLLabelFontColor', 'tmYLLabelFontHeightF',
+ 'tmYLLabelFontQuality', 'tmYLLabelFontThicknessF',
+ 'tmYLLabelFuncCode', 'tmYLLabelJust', 'tmYLLabelStride', 'tmYLLabels',
+ 'tmYLLabelsOn', 'tmYLMajorLengthF', 'tmYLMajorLineColor',
+ 'tmYLMajorOutwardLengthF', 'tmYLMajorThicknessF', 'tmYLMaxLabelLenF',
+ 'tmYLMaxTicks', 'tmYLMinLabelSpacingF', 'tmYLMinorLengthF',
+ 'tmYLMinorLineColor', 'tmYLMinorOn', 'tmYLMinorOutwardLengthF',
+ 'tmYLMinorPerMajor', 'tmYLMinorThicknessF', 'tmYLMinorValues',
+ 'tmYLMode', 'tmYLOn', 'tmYLPrecision', 'tmYLStyle', 'tmYLTickEndF',
+ 'tmYLTickSpacingF', 'tmYLTickStartF', 'tmYLValues', 'tmYMajorGrid',
+ 'tmYMajorGridLineColor', 'tmYMajorGridLineDashPattern',
+ 'tmYMajorGridThicknessF', 'tmYMinorGrid', 'tmYMinorGridLineColor',
+ 'tmYMinorGridLineDashPattern', 'tmYMinorGridThicknessF',
+ 'tmYRAutoPrecision', 'tmYRBorderOn', 'tmYRDataBottomF',
+ 'tmYRDataTopF', 'tmYRFormat', 'tmYRIrrTensionF',
+ 'tmYRIrregularPoints', 'tmYRLabelAngleF', 'tmYRLabelConstantSpacingF',
+ 'tmYRLabelDeltaF', 'tmYRLabelDirection', 'tmYRLabelFont',
+ 'tmYRLabelFontAspectF', 'tmYRLabelFontColor', 'tmYRLabelFontHeightF',
+ 'tmYRLabelFontQuality', 'tmYRLabelFontThicknessF',
+ 'tmYRLabelFuncCode', 'tmYRLabelJust', 'tmYRLabelStride', 'tmYRLabels',
+ 'tmYRLabelsOn', 'tmYRMajorLengthF', 'tmYRMajorLineColor',
+ 'tmYRMajorOutwardLengthF', 'tmYRMajorThicknessF', 'tmYRMaxLabelLenF',
+ 'tmYRMaxTicks', 'tmYRMinLabelSpacingF', 'tmYRMinorLengthF',
+ 'tmYRMinorLineColor', 'tmYRMinorOn', 'tmYRMinorOutwardLengthF',
+ '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',
+ 'txFont', 'HLU-Fonts', 'txFontAspectF', 'txFontColor',
+ 'txFontHeightF', 'txFontOpacityF', 'txFontQuality',
+ 'txFontThicknessF', 'txFuncCode', 'txJust', 'txPerimColor',
+ 'txPerimDashLengthF', 'txPerimDashPattern', 'txPerimOn',
+ 'txPerimSpaceF', 'txPerimThicknessF', 'txPosXF', 'txPosYF',
+ 'txString', 'vcExplicitLabelBarLabelsOn', 'vcFillArrowEdgeColor',
+ 'vcFillArrowEdgeThicknessF', 'vcFillArrowFillColor',
+ 'vcFillArrowHeadInteriorXF', 'vcFillArrowHeadMinFracXF',
+ 'vcFillArrowHeadMinFracYF', 'vcFillArrowHeadXF', 'vcFillArrowHeadYF',
+ 'vcFillArrowMinFracWidthF', 'vcFillArrowWidthF', 'vcFillArrowsOn',
+ 'vcFillOverEdge', 'vcGlyphOpacityF', 'vcGlyphStyle',
+ 'vcLabelBarEndLabelsOn', 'vcLabelFontColor', 'vcLabelFontHeightF',
+ 'vcLabelsOn', 'vcLabelsUseVectorColor', 'vcLevelColors',
+ 'vcLevelCount', 'vcLevelPalette', 'vcLevelSelectionMode',
+ 'vcLevelSpacingF', 'vcLevels', 'vcLineArrowColor',
+ 'vcLineArrowHeadMaxSizeF', 'vcLineArrowHeadMinSizeF',
+ 'vcLineArrowThicknessF', 'vcMagnitudeFormat',
+ 'vcMagnitudeScaleFactorF', 'vcMagnitudeScaleValueF',
+ 'vcMagnitudeScalingMode', 'vcMapDirection', 'vcMaxLevelCount',
+ 'vcMaxLevelValF', 'vcMaxMagnitudeF', 'vcMinAnnoAngleF',
+ 'vcMinAnnoArrowAngleF', 'vcMinAnnoArrowEdgeColor',
+ 'vcMinAnnoArrowFillColor', 'vcMinAnnoArrowLineColor',
+ 'vcMinAnnoArrowMinOffsetF', 'vcMinAnnoArrowSpaceF',
+ 'vcMinAnnoArrowUseVecColor', 'vcMinAnnoBackgroundColor',
+ 'vcMinAnnoConstantSpacingF', 'vcMinAnnoExplicitMagnitudeF',
+ 'vcMinAnnoFont', 'vcMinAnnoFontAspectF', 'vcMinAnnoFontColor',
+ 'vcMinAnnoFontHeightF', 'vcMinAnnoFontQuality',
+ 'vcMinAnnoFontThicknessF', 'vcMinAnnoFuncCode', 'vcMinAnnoJust',
+ 'vcMinAnnoOn', 'vcMinAnnoOrientation', 'vcMinAnnoOrthogonalPosF',
+ 'vcMinAnnoParallelPosF', 'vcMinAnnoPerimColor', 'vcMinAnnoPerimOn',
+ 'vcMinAnnoPerimSpaceF', 'vcMinAnnoPerimThicknessF', 'vcMinAnnoSide',
+ 'vcMinAnnoString1', 'vcMinAnnoString1On', 'vcMinAnnoString2',
+ 'vcMinAnnoString2On', 'vcMinAnnoTextDirection', 'vcMinAnnoZone',
+ 'vcMinDistanceF', 'vcMinFracLengthF', 'vcMinLevelValF',
+ 'vcMinMagnitudeF', 'vcMonoFillArrowEdgeColor',
+ 'vcMonoFillArrowFillColor', 'vcMonoLineArrowColor',
+ 'vcMonoWindBarbColor', 'vcNoDataLabelOn', 'vcNoDataLabelString',
+ 'vcPositionMode', 'vcRefAnnoAngleF', 'vcRefAnnoArrowAngleF',
+ 'vcRefAnnoArrowEdgeColor', 'vcRefAnnoArrowFillColor',
+ 'vcRefAnnoArrowLineColor', 'vcRefAnnoArrowMinOffsetF',
+ 'vcRefAnnoArrowSpaceF', 'vcRefAnnoArrowUseVecColor',
+ 'vcRefAnnoBackgroundColor', 'vcRefAnnoConstantSpacingF',
+ 'vcRefAnnoExplicitMagnitudeF', 'vcRefAnnoFont',
+ 'vcRefAnnoFontAspectF', 'vcRefAnnoFontColor', 'vcRefAnnoFontHeightF',
+ 'vcRefAnnoFontQuality', 'vcRefAnnoFontThicknessF',
+ 'vcRefAnnoFuncCode', 'vcRefAnnoJust', 'vcRefAnnoOn',
+ 'vcRefAnnoOrientation', 'vcRefAnnoOrthogonalPosF',
+ 'vcRefAnnoParallelPosF', 'vcRefAnnoPerimColor', 'vcRefAnnoPerimOn',
+ 'vcRefAnnoPerimSpaceF', 'vcRefAnnoPerimThicknessF', 'vcRefAnnoSide',
+ 'vcRefAnnoString1', 'vcRefAnnoString1On', 'vcRefAnnoString2',
+ 'vcRefAnnoString2On', 'vcRefAnnoTextDirection', 'vcRefAnnoZone',
+ 'vcRefLengthF', 'vcRefMagnitudeF', 'vcScalarFieldData',
+ 'vcScalarMissingValColor', 'vcScalarValueFormat',
+ 'vcScalarValueScaleFactorF', 'vcScalarValueScaleValueF',
+ 'vcScalarValueScalingMode', 'vcSpanLevelPalette', 'vcUseRefAnnoRes',
+ 'vcUseScalarArray', 'vcVectorDrawOrder', 'vcVectorFieldData',
+ 'vcWindBarbCalmCircleSizeF', 'vcWindBarbColor',
+ 'vcWindBarbLineThicknessF', 'vcWindBarbScaleFactorF',
+ 'vcWindBarbTickAngleF', 'vcWindBarbTickLengthF',
+ 'vcWindBarbTickSpacingF', 'vcZeroFLabelAngleF',
+ 'vcZeroFLabelBackgroundColor', 'vcZeroFLabelConstantSpacingF',
+ 'vcZeroFLabelFont', 'vcZeroFLabelFontAspectF',
+ 'vcZeroFLabelFontColor', 'vcZeroFLabelFontHeightF',
+ 'vcZeroFLabelFontQuality', 'vcZeroFLabelFontThicknessF',
+ 'vcZeroFLabelFuncCode', 'vcZeroFLabelJust', 'vcZeroFLabelOn',
+ 'vcZeroFLabelOrthogonalPosF', 'vcZeroFLabelParallelPosF',
+ 'vcZeroFLabelPerimColor', 'vcZeroFLabelPerimOn',
+ 'vcZeroFLabelPerimSpaceF', 'vcZeroFLabelPerimThicknessF',
+ 'vcZeroFLabelSide', 'vcZeroFLabelString', 'vcZeroFLabelTextDirection',
+ 'vcZeroFLabelZone', 'vfCopyData', 'vfDataArray',
+ 'vfExchangeDimensions', 'vfExchangeUVData', 'vfMagMaxV', 'vfMagMinV',
+ 'vfMissingUValueV', 'vfMissingVValueV', 'vfPolarData',
+ 'vfSingleMissingValue', 'vfUDataArray', 'vfUMaxV', 'vfUMinV',
+ 'vfVDataArray', 'vfVMaxV', 'vfVMinV', 'vfXArray', 'vfXCActualEndF',
+ 'vfXCActualStartF', 'vfXCEndIndex', 'vfXCEndSubsetV', 'vfXCEndV',
+ 'vfXCStartIndex', 'vfXCStartSubsetV', 'vfXCStartV', 'vfXCStride',
+ 'vfYArray', 'vfYCActualEndF', 'vfYCActualStartF', 'vfYCEndIndex',
+ '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',
+ 'wsMaximumSize', 'wsThresholdSize', 'xyComputeXMax',
+ 'xyComputeXMin', 'xyComputeYMax', 'xyComputeYMin', 'xyCoordData',
+ 'xyCoordDataSpec', 'xyCurveDrawOrder', 'xyDashPattern',
+ 'xyDashPatterns', 'xyExplicitLabels', 'xyExplicitLegendLabels',
+ 'xyLabelMode', 'xyLineColor', 'xyLineColors', 'xyLineDashSegLenF',
+ 'xyLineLabelConstantSpacingF', 'xyLineLabelFont',
+ 'xyLineLabelFontAspectF', 'xyLineLabelFontColor',
+ 'xyLineLabelFontColors', 'xyLineLabelFontHeightF',
+ 'xyLineLabelFontQuality', 'xyLineLabelFontThicknessF',
+ 'xyLineLabelFuncCode', 'xyLineThicknessF', 'xyLineThicknesses',
+ 'xyMarkLineMode', 'xyMarkLineModes', 'xyMarker', 'xyMarkerColor',
+ 'xyMarkerColors', 'xyMarkerSizeF', 'xyMarkerSizes',
+ 'xyMarkerThicknessF', 'xyMarkerThicknesses', 'xyMarkers',
+ 'xyMonoDashPattern', 'xyMonoLineColor', 'xyMonoLineLabelFontColor',
+ 'xyMonoLineThickness', 'xyMonoMarkLineMode', 'xyMonoMarker',
+ 'xyMonoMarkerColor', 'xyMonoMarkerSize', 'xyMonoMarkerThickness',
+ 'xyXIrrTensionF', 'xyXIrregularPoints', 'xyXStyle', 'xyYIrrTensionF',
+ 'xyYIrregularPoints', 'xyYStyle'), prefix=r'\b'),
+ Name.Builtin),
+
+ # Booleans
+ (r'True|False', Name.Builtin), # Comparing Operators
+ (r'\.(eq|ne|lt|le|gt|ge|not|and|or|xor)\.', Operator.Word),
+ ],
+
+ 'strings': [
+ (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
+ ],
+
+ 'nums': [
+ (r'\d+(?![.e])(_[a-z]\w+)?', Number.Integer),
+ (r'[+-]?\d*\.\d+(e[-+]?\d+)?(_[a-z]\w+)?', Number.Float),
+ (r'[+-]?\d+\.\d*(e[-+]?\d+)?(_[a-z]\w+)?', Number.Float),
+ ],
+ }
diff --git a/pygments/lexers/oberon.py b/pygments/lexers/oberon.py
index db18259d..51dfdab6 100644
--- a/pygments/lexers/oberon.py
+++ b/pygments/lexers/oberon.py
@@ -47,11 +47,11 @@ class ComponentPascalLexer(RegexLexer):
(r'\s+', Text), # whitespace
],
'comments': [
- (r'\(\*([^\$].*?)\*\)', Comment.Multiline),
+ (r'\(\*([^$].*?)\*\)', Comment.Multiline),
# TODO: nested comments (* (* ... *) ... (* ... *) *) not supported!
],
'punctuation': [
- (r'[\(\)\[\]\{\},.:;\|]', Punctuation),
+ (r'[()\[\]{},.:;|]', Punctuation),
],
'numliterals': [
(r'[0-9A-F]+X\b', Number.Hex), # char code
@@ -83,7 +83,7 @@ class ComponentPascalLexer(RegexLexer):
(r'\$', Operator),
],
'identifiers': [
- (r'([a-zA-Z_\$][\w\$]*)', Name),
+ (r'([a-zA-Z_$][\w$]*)', Name),
],
'builtins': [
(words((
diff --git a/pygments/lexers/parasail.py b/pygments/lexers/parasail.py
index 878f7d26..812e2923 100644
--- a/pygments/lexers/parasail.py
+++ b/pygments/lexers/parasail.py
@@ -60,7 +60,7 @@ class ParaSailLexer(RegexLexer):
(r'[a-zA-Z]\w*', Name),
# Operators and Punctuation
(r'(<==|==>|<=>|\*\*=|<\|=|<<=|>>=|==|!=|=\?|<=|>=|'
- r'\*\*|<<|>>|=>|:=|\+=|-=|\*=|\||\|=|/=|\+|-|\*|/|'
+ r'\*\*|<<|>>|=>|:=|\+=|-=|\*=|\|=|\||/=|\+|-|\*|/|'
r'\.\.|<\.\.|\.\.<|<\.\.<)',
Operator),
(r'(<|>|\[|\]|\(|\)|\||:|;|,|.|\{|\}|->)',
diff --git a/pygments/lexers/perl.py b/pygments/lexers/perl.py
index b78963d0..8df3c810 100644
--- a/pygments/lexers/perl.py
+++ b/pygments/lexers/perl.py
@@ -109,7 +109,8 @@ class PerlLexer(RegexLexer):
'utime', 'values', 'vec', 'wait', 'waitpid', 'wantarray', 'warn', 'write'), suffix=r'\b'),
Name.Builtin),
(r'((__(DATA|DIE|WARN)__)|(STD(IN|OUT|ERR)))\b', Name.Builtin.Pseudo),
- (r'<<([\'"]?)([a-zA-Z_]\w*)\1;?\n.*?\n\2\n', String),
+ (r'(<<)([\'"]?)([a-zA-Z_]\w*)(\2;?\n.*?\n)(\3)(\n)',
+ bygroups(String, String, String.Delimiter, String, String.Delimiter, Text)),
(r'__END__', Comment.Preproc, 'end-part'),
(r'\$\^[ADEFHILMOPSTWX]', Name.Variable.Global),
(r"\$[\\\"\[\]'&`+*.,;=%~?@$!<>(^|/-](?!\w)", Name.Variable.Global),
diff --git a/pygments/lexers/php.py b/pygments/lexers/php.py
index 75b662cb..2421738f 100644
--- a/pygments/lexers/php.py
+++ b/pygments/lexers/php.py
@@ -11,7 +11,8 @@
import re
-from pygments.lexer import RegexLexer, include, bygroups, default, using, this
+from pygments.lexer import RegexLexer, include, bygroups, default, using, \
+ this, words
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
Number, Punctuation, Other
from pygments.util import get_bool_opt, get_list_opt, iteritems
@@ -137,7 +138,9 @@ class PhpLexer(RegexLexer):
],
'php': [
(r'\?>', Comment.Preproc, '#pop'),
- (r'<<<([\'"]?)(' + _ident_inner + r')\1\n.*?\n\s*\2;?\n', String),
+ (r'(<<<)([\'"]?)(' + _ident_inner + r')(\2\n.*?\n\s*)(\3)(;?)(\n)',
+ bygroups(String, String, String.Delimiter, String, String.Delimiter,
+ Punctuation, Text)),
(r'\s+', Text),
(r'#.*?\n', Comment.Single),
(r'//.*?\n', Comment.Single),
@@ -162,13 +165,14 @@ class PhpLexer(RegexLexer):
r'FALSE|print|for|require|continue|foreach|require_once|'
r'declare|return|default|static|do|switch|die|stdClass|'
r'echo|else|TRUE|elseif|var|empty|if|xor|enddeclare|include|'
- r'virtual|endfor|include_once|while|endforeach|global|__FILE__|'
- r'endif|list|__LINE__|endswitch|new|__sleep|endwhile|not|'
- r'array|__wakeup|E_ALL|NULL|final|php_user_filter|interface|'
+ r'virtual|endfor|include_once|while|endforeach|global|'
+ r'endif|list|endswitch|new|endwhile|not|'
+ r'array|E_ALL|NULL|final|php_user_filter|interface|'
r'implements|public|private|protected|abstract|clone|try|'
r'catch|throw|this|use|namespace|trait|yield|'
r'finally)\b', Keyword),
(r'(true|false|null)\b', Keyword.Constant),
+ include('magicconstants'),
(r'\$\{\$+' + _ident_inner + '\}', Name.Variable),
(r'\$+' + _ident_inner, Name.Variable),
(_ident_inner, Name.Other),
@@ -182,11 +186,29 @@ class PhpLexer(RegexLexer):
(r'`([^`\\]*(?:\\.[^`\\]*)*)`', String.Backtick),
(r'"', String.Double, 'string'),
],
+ 'magicfuncs': [
+ # source: http://php.net/manual/en/language.oop5.magic.php
+ (words((
+ '__construct', '__destruct', '__call', '__callStatic', '__get', '__set',
+ '__isset', '__unset', '__sleep', '__wakeup', '__toString', '__invoke',
+ '__set_state', '__clone', '__debugInfo',), suffix=r'\b'),
+ Name.Function.Magic),
+ ],
+ 'magicconstants': [
+ # source: http://php.net/manual/en/language.constants.predefined.php
+ (words((
+ '__LINE__', '__FILE__', '__DIR__', '__FUNCTION__', '__CLASS__',
+ '__TRAIT__', '__METHOD__', '__NAMESPACE__',),
+ suffix=r'\b'),
+ Name.Constant),
+ ],
'classname': [
(_ident_inner, Name.Class, '#pop')
],
'functionname': [
- (_ident_inner, Name.Function, '#pop')
+ include('magicfuncs'),
+ (_ident_inner, Name.Function, '#pop'),
+ default('#pop')
],
'string': [
(r'"', String.Double, '#pop'),
diff --git a/pygments/lexers/praat.py b/pygments/lexers/praat.py
index 776c38b8..9255216d 100644
--- a/pygments/lexers/praat.py
+++ b/pygments/lexers/praat.py
@@ -27,21 +27,21 @@ class PraatLexer(RegexLexer):
aliases = ['praat']
filenames = ['*.praat', '*.proc', '*.psc']
- keywords = [
+ keywords = (
'if', 'then', 'else', 'elsif', 'elif', 'endif', 'fi', 'for', 'from', 'to',
'endfor', 'endproc', 'while', 'endwhile', 'repeat', 'until', 'select', 'plus',
'minus', 'demo', 'assert', 'stopwatch', 'nocheck', 'nowarn', 'noprogress',
'editor', 'endeditor', 'clearinfo',
- ]
+ )
- functions_string = [
+ functions_string = (
'backslashTrigraphsToUnicode', 'chooseDirectory', 'chooseReadFile',
'chooseWriteFile', 'date', 'demoKey', 'do', 'environment', 'extractLine',
'extractWord', 'fixed', 'info', 'left', 'mid', 'percent', 'readFile', 'replace',
'replace_regex', 'right', 'selected', 'string', 'unicodeToBackslashTrigraphs',
- ]
+ )
- functions_numeric = [
+ functions_numeric = (
'abs', 'appendFile', 'appendFileLine', 'appendInfo', 'appendInfoLine', 'arccos',
'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctan2', 'arctanh', 'barkToHertz',
'beginPause', 'beginSendPraat', 'besselI', 'besselK', 'beta', 'beta2',
@@ -67,13 +67,13 @@ class PraatLexer(RegexLexer):
'sincpi', 'sinh', 'soundPressureToPhon', 'sqrt', 'startsWith', 'studentP',
'studentQ', 'tan', 'tanh', 'variableExists', 'word', 'writeFile', 'writeFileLine',
'writeInfo', 'writeInfoLine',
- ]
+ )
- functions_array = [
+ functions_array = (
'linear', 'randomGauss', 'randomInteger', 'randomUniform', 'zero',
- ]
+ )
- objects = [
+ objects = (
'Activation', 'AffineTransform', 'AmplitudeTier', 'Art', 'Artword',
'Autosegment', 'BarkFilter', 'BarkSpectrogram', 'CCA', 'Categories',
'Cepstrogram', 'Cepstrum', 'Cepstrumc', 'ChebyshevSeries', 'ClassificationTable',
@@ -100,17 +100,17 @@ class PraatLexer(RegexLexer):
'Strings', 'StringsIndex', 'Table', 'TableOfReal', 'TextGrid', 'TextInterval',
'TextPoint', 'TextTier', 'Tier', 'Transition', 'VocalTract', 'VocalTractTier',
'Weight', 'WordList',
- ]
+ )
- variables_numeric = [
+ variables_numeric = (
'macintosh', 'windows', 'unix', 'praatVersion', 'pi', 'e', 'undefined',
- ]
+ )
- variables_string = [
+ variables_string = (
'praatVersion', 'tab', 'shellDirectory', 'homeDirectory',
'preferencesDirectory', 'newline', 'temporaryDirectory',
'defaultDirectory',
- ]
+ )
tokens = {
'root': [
@@ -151,7 +151,7 @@ class PraatLexer(RegexLexer):
(r"'(?=.*')", String.Interpol, 'string_interpolated'),
(r'\.{3}', Keyword, ('#pop', 'old_arguments')),
(r':', Keyword, ('#pop', 'comma_list')),
- (r'[\s\n]', Text, '#pop'),
+ (r'\s', Text, '#pop'),
],
'procedure_call': [
(r'\s+', Text),
@@ -230,7 +230,7 @@ class PraatLexer(RegexLexer):
bygroups(Name.Builtin, Name.Builtin, String.Interpol),
('object_attributes', 'string_interpolated')),
- (r'\.?_?[a-z][a-zA-Z0-9_.]*(\$|#)?', Text),
+ (r'\.?_?[a-z][\w.]*(\$|#)?', Text),
(r'[\[\]]', Punctuation, 'comma_list'),
(r"'(?=.*')", String.Interpol, 'string_interpolated'),
],
@@ -239,7 +239,7 @@ class PraatLexer(RegexLexer):
(r'\b(and|or|not|div|mod)\b', Operator.Word),
],
'string_interpolated': [
- (r'\.?[_a-z][a-zA-Z0-9_.]*[\$#]?(?:\[[a-zA-Z0-9,]+\])?(:[0-9]+)?',
+ (r'\.?[_a-z][\w.]*[$#]?(?:\[[a-zA-Z0-9,]+\])?(:[0-9]+)?',
String.Interpol),
(r"'", String.Interpol, '#pop'),
],
diff --git a/pygments/lexers/python.py b/pygments/lexers/python.py
index 9433f7fd..7601afa8 100644
--- a/pygments/lexers/python.py
+++ b/pygments/lexers/python.py
@@ -39,7 +39,7 @@ class PythonLexer(RegexLexer):
return [
# the old style '%s' % (...) string formatting
(r'%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?'
- '[hlL]?[diouxXeEfFgGcrs%]', String.Interpol),
+ '[hlL]?[E-GXc-giorsux%]', String.Interpol),
# backslashes, quotes and formatting signs must be parsed one at a time
(r'[^\\\'"%\n]+', ttype),
(r'[\'"\\]', ttype),
@@ -51,8 +51,10 @@ class PythonLexer(RegexLexer):
tokens = {
'root': [
(r'\n', Text),
- (r'^(\s*)([rRuU]{,2}"""(?:.|\n)*?""")', bygroups(Text, String.Doc)),
- (r"^(\s*)([rRuU]{,2}'''(?:.|\n)*?''')", bygroups(Text, String.Doc)),
+ (r'^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")',
+ bygroups(Text, String.Affix, String.Doc)),
+ (r"^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')",
+ bygroups(Text, String.Affix, String.Doc)),
(r'[^\S\n]+', Text),
(r'\A#!.+$', Comment.Hashbang),
(r'#.*$', Comment.Single),
@@ -69,15 +71,25 @@ class PythonLexer(RegexLexer):
(r'(import)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Text),
'import'),
include('builtins'),
+ include('magicfuncs'),
+ include('magicvars'),
include('backtick'),
- ('(?:[rR]|[uU][rR]|[rR][uU])"""', String.Double, 'tdqs'),
- ("(?:[rR]|[uU][rR]|[rR][uU])'''", String.Single, 'tsqs'),
- ('(?:[rR]|[uU][rR]|[rR][uU])"', String.Double, 'dqs'),
- ("(?:[rR]|[uU][rR]|[rR][uU])'", String.Single, 'sqs'),
- ('[uU]?"""', String.Double, combined('stringescape', 'tdqs')),
- ("[uU]?'''", String.Single, combined('stringescape', 'tsqs')),
- ('[uU]?"', String.Double, combined('stringescape', 'dqs')),
- ("[uU]?'", String.Single, combined('stringescape', 'sqs')),
+ ('([rR]|[uUbB][rR]|[rR][uUbB])(""")',
+ bygroups(String.Affix, String.Double), 'tdqs'),
+ ("([rR]|[uUbB][rR]|[rR][uUbB])(''')",
+ bygroups(String.Affix, String.Single), 'tsqs'),
+ ('([rR]|[uUbB][rR]|[rR][uUbB])(")',
+ bygroups(String.Affix, String.Double), 'dqs'),
+ ("([rR]|[uUbB][rR]|[rR][uUbB])(')",
+ bygroups(String.Affix, String.Single), 'sqs'),
+ ('([uUbB]?)(""")', bygroups(String.Affix, String.Double),
+ combined('stringescape', 'tdqs')),
+ ("([uUbB]?)(''')", bygroups(String.Affix, String.Single),
+ combined('stringescape', 'tsqs')),
+ ('([uUbB]?)(")', bygroups(String.Affix, String.Double),
+ combined('stringescape', 'dqs')),
+ ("([uUbB]?)(')", bygroups(String.Affix, String.Single),
+ combined('stringescape', 'sqs')),
include('name'),
include('numbers'),
],
@@ -123,6 +135,37 @@ class PythonLexer(RegexLexer):
'ZeroDivisionError'), prefix=r'(?<!\.)', suffix=r'\b'),
Name.Exception),
],
+ 'magicfuncs': [
+ (words((
+ '__abs__', '__add__', '__and__', '__call__', '__cmp__', '__coerce__',
+ '__complex__', '__contains__', '__del__', '__delattr__', '__delete__',
+ '__delitem__', '__delslice__', '__div__', '__divmod__', '__enter__',
+ '__eq__', '__exit__', '__float__', '__floordiv__', '__ge__', '__get__',
+ '__getattr__', '__getattribute__', '__getitem__', '__getslice__', '__gt__',
+ '__hash__', '__hex__', '__iadd__', '__iand__', '__idiv__', '__ifloordiv__',
+ '__ilshift__', '__imod__', '__imul__', '__index__', '__init__',
+ '__instancecheck__', '__int__', '__invert__', '__iop__', '__ior__',
+ '__ipow__', '__irshift__', '__isub__', '__iter__', '__itruediv__',
+ '__ixor__', '__le__', '__len__', '__long__', '__lshift__', '__lt__',
+ '__missing__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__',
+ '__nonzero__', '__oct__', '__op__', '__or__', '__pos__', '__pow__',
+ '__radd__', '__rand__', '__rcmp__', '__rdiv__', '__rdivmod__', '__repr__',
+ '__reversed__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__',
+ '__rop__', '__ror__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__',
+ '__rtruediv__', '__rxor__', '__set__', '__setattr__', '__setitem__',
+ '__setslice__', '__str__', '__sub__', '__subclasscheck__', '__truediv__',
+ '__unicode__', '__xor__'), suffix=r'\b'),
+ Name.Function.Magic),
+ ],
+ 'magicvars': [
+ (words((
+ '__bases__', '__class__', '__closure__', '__code__', '__defaults__',
+ '__dict__', '__doc__', '__file__', '__func__', '__globals__',
+ '__metaclass__', '__module__', '__mro__', '__name__', '__self__',
+ '__slots__', '__weakref__'),
+ suffix=r'\b'),
+ Name.Variable.Magic),
+ ],
'numbers': [
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float),
(r'\d+[eE][+-]?[0-9]+j?', Number.Float),
@@ -140,7 +183,9 @@ class PythonLexer(RegexLexer):
('[a-zA-Z_]\w*', Name),
],
'funcname': [
- ('[a-zA-Z_]\w*', Name.Function, '#pop')
+ include('magicfuncs'),
+ ('[a-zA-Z_]\w*', Name.Function, '#pop'),
+ default('#pop'),
],
'classname': [
('[a-zA-Z_]\w*', Name.Class, '#pop')
@@ -217,16 +262,16 @@ class Python3Lexer(RegexLexer):
return [
# the old style '%s' % (...) string formatting (still valid in Py3)
(r'%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?'
- '[hlL]?[diouxXeEfFgGcrs%]', String.Interpol),
+ '[hlL]?[E-GXc-giorsux%]', String.Interpol),
# the new style '{}'.format(...) string formatting
(r'\{'
- '((\w+)((\.\w+)|(\[[^\]]+\]))*)?' # field name
- '(\![sra])?' # conversion
- '(\:(.?[<>=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[bcdeEfFgGnosxX%]?)?'
+ '((\w+)((\.\w+)|(\[[^\]]+\]))*)?' # field name
+ '(\![sra])?' # conversion
+ '(\:(.?[<>=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?'
'\}', String.Interpol),
# backslashes, quotes and formatting signs must be parsed one at a time
- (r'[^\\\'"%\{\n]+', ttype),
+ (r'[^\\\'"%{\n]+', ttype),
(r'[\'"\\]', ttype),
# unhandled string formatting sign
(r'%|(\{{1,2})', ttype)
@@ -283,6 +328,38 @@ class Python3Lexer(RegexLexer):
prefix=r'(?<!\.)', suffix=r'\b'),
Name.Exception),
]
+ tokens['magicfuncs'] = [
+ (words((
+ '__abs__', '__add__', '__aenter__', '__aexit__', '__aiter__', '__and__',
+ '__anext__', '__await__', '__bool__', '__bytes__', '__call__',
+ '__complex__', '__contains__', '__del__', '__delattr__', '__delete__',
+ '__delitem__', '__dir__', '__divmod__', '__enter__', '__eq__', '__exit__',
+ '__float__', '__floordiv__', '__format__', '__ge__', '__get__',
+ '__getattr__', '__getattribute__', '__getitem__', '__gt__', '__hash__',
+ '__iadd__', '__iand__', '__ifloordiv__', '__ilshift__', '__imatmul__',
+ '__imod__', '__import__', '__imul__', '__index__', '__init__',
+ '__instancecheck__', '__int__', '__invert__', '__ior__', '__ipow__',
+ '__irshift__', '__isub__', '__iter__', '__itruediv__', '__ixor__',
+ '__le__', '__len__', '__length_hint__', '__lshift__', '__lt__',
+ '__matmul__', '__missing__', '__mod__', '__mul__', '__ne__', '__neg__',
+ '__new__', '__next__', '__or__', '__pos__', '__pow__', '__prepare__',
+ '__radd__', '__rand__', '__rdivmod__', '__repr__', '__reversed__',
+ '__rfloordiv__', '__rlshift__', '__rmatmul__', '__rmod__', '__rmul__',
+ '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__',
+ '__rsub__', '__rtruediv__', '__rxor__', '__set__', '__setattr__',
+ '__setitem__', '__str__', '__sub__', '__subclasscheck__', '__truediv__',
+ '__xor__'), suffix=r'\b'),
+ Name.Function.Magic),
+ ]
+ tokens['magicvars'] = [
+ (words((
+ '__annotations__', '__bases__', '__class__', '__closure__', '__code__',
+ '__defaults__', '__dict__', '__doc__', '__file__', '__func__',
+ '__globals__', '__kwdefaults__', '__module__', '__mro__', '__name__',
+ '__objclass__', '__qualname__', '__self__', '__slots__', '__weakref__'),
+ suffix=r'\b'),
+ Name.Variable.Magic),
+ ]
tokens['numbers'] = [
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
(r'0[oO][0-7]+', Number.Oct),
@@ -633,7 +710,7 @@ class CythonLexer(RegexLexer):
],
'strings': [
(r'%(\([a-zA-Z0-9]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?'
- '[hlL]?[diouxXeEfFgGcrs%]', String.Interpol),
+ '[hlL]?[E-GXc-giorsux%]', String.Interpol),
(r'[^\\\'"%\n]+', String),
# quotes, percents and backslashes must be parsed one at a time
(r'[\'"\\]', String),
@@ -704,18 +781,20 @@ class DgLexer(RegexLexer):
(words((
'bool', 'bytearray', 'bytes', 'classmethod', 'complex', 'dict', 'dict\'',
'float', 'frozenset', 'int', 'list', 'list\'', 'memoryview', 'object',
- 'property', 'range', 'set', 'set\'', 'slice', 'staticmethod', 'str', 'super',
- 'tuple', 'tuple\'', 'type'), prefix=r'(?<!\.)', suffix=r'(?![\'\w])'),
+ 'property', 'range', 'set', 'set\'', 'slice', 'staticmethod', 'str',
+ 'super', 'tuple', 'tuple\'', 'type'),
+ prefix=r'(?<!\.)', suffix=r'(?![\'\w])'),
Name.Builtin),
(words((
'__import__', 'abs', 'all', 'any', 'bin', 'bind', 'chr', 'cmp', 'compile',
'complex', 'delattr', 'dir', 'divmod', 'drop', 'dropwhile', 'enumerate',
- 'eval', 'exhaust', 'filter', 'flip', 'foldl1?', 'format', 'fst', 'getattr',
- 'globals', 'hasattr', 'hash', 'head', 'hex', 'id', 'init', 'input',
- 'isinstance', 'issubclass', 'iter', 'iterate', 'last', 'len', 'locals',
- 'map', 'max', 'min', 'next', 'oct', 'open', 'ord', 'pow', 'print', 'repr',
- 'reversed', 'round', 'setattr', 'scanl1?', 'snd', 'sorted', 'sum', 'tail',
- 'take', 'takewhile', 'vars', 'zip'), prefix=r'(?<!\.)', suffix=r'(?![\'\w])'),
+ 'eval', 'exhaust', 'filter', 'flip', 'foldl1?', 'format', 'fst',
+ 'getattr', 'globals', 'hasattr', 'hash', 'head', 'hex', 'id', 'init',
+ 'input', 'isinstance', 'issubclass', 'iter', 'iterate', 'last', 'len',
+ 'locals', 'map', 'max', 'min', 'next', 'oct', 'open', 'ord', 'pow',
+ 'print', 'repr', 'reversed', 'round', 'setattr', 'scanl1?', 'snd',
+ 'sorted', 'sum', 'tail', 'take', 'takewhile', 'vars', 'zip'),
+ prefix=r'(?<!\.)', suffix=r'(?![\'\w])'),
Name.Builtin),
(r"(?<!\.)(self|Ellipsis|NotImplemented|None|True|False)(?!['\w])",
Name.Builtin.Pseudo),
@@ -741,7 +820,7 @@ class DgLexer(RegexLexer):
],
'string': [
(r'%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?'
- '[hlL]?[diouxXeEfFgGcrs%]', String.Interpol),
+ '[hlL]?[E-GXc-giorsux%]', String.Interpol),
(r'[^\\\'"%\n]+', String),
# quotes, percents and backslashes must be parsed one at a time
(r'[\'"\\]', String),
diff --git a/pygments/lexers/qvt.py b/pygments/lexers/qvt.py
index 5bc61310..f30e4887 100644
--- a/pygments/lexers/qvt.py
+++ b/pygments/lexers/qvt.py
@@ -9,7 +9,8 @@
:license: BSD, see LICENSE for details.
"""
-from pygments.lexer import RegexLexer, bygroups, include, combined
+from pygments.lexer import RegexLexer, bygroups, include, combined, default, \
+ words
from pygments.token import Text, Comment, Operator, Keyword, Punctuation, \
Name, String, Number
@@ -50,23 +51,26 @@ class QVToLexer(RegexLexer):
bygroups(Comment, Comment, Comment.Preproc, Comment)),
# Uncomment the following if you want to distinguish between
# '/*' and '/**', à la javadoc
- #(r'/[*]{2}(.|\n)*?[*]/', Comment.Multiline),
+ # (r'/[*]{2}(.|\n)*?[*]/', Comment.Multiline),
(r'/[*](.|\n)*?[*]/', Comment.Multiline),
(r'\\\n', Text),
(r'(and|not|or|xor|##?)\b', Operator.Word),
- (r'([:]{1-2}=|[-+]=)\b', Operator.Word),
- (r'(@|<<|>>)\b', Keyword), # stereotypes
- (r'!=|<>|=|==|!->|->|>=|<=|[.]{3}|[+/*%=<>&|.~]', Operator),
+ (r'(:{1,2}=|[-+]=)\b', Operator.Word),
+ (r'(@|<<|>>)\b', Keyword), # stereotypes
+ (r'!=|<>|==|=|!->|->|>=|<=|[.]{3}|[+/*%=<>&|.~]', Operator),
(r'[]{}:(),;[]', Punctuation),
(r'(true|false|unlimited|null)\b', Keyword.Constant),
(r'(this|self|result)\b', Name.Builtin.Pseudo),
(r'(var)\b', Keyword.Declaration),
(r'(from|import)\b', Keyword.Namespace, 'fromimport'),
- (r'(metamodel|class|exception|primitive|enum|transformation|library)(\s+)([a-zA-Z0-9_]+)',
+ (r'(metamodel|class|exception|primitive|enum|transformation|'
+ r'library)(\s+)(\w+)',
bygroups(Keyword.Word, Text, Name.Class)),
- (r'(exception)(\s+)([a-zA-Z0-9_]+)', bygroups(Keyword.Word, Text, Name.Exception)),
+ (r'(exception)(\s+)(\w+)',
+ bygroups(Keyword.Word, Text, Name.Exception)),
(r'(main)\b', Name.Function),
- (r'(mapping|helper|query)(\s+)', bygroups(Keyword.Declaration, Text), 'operation'),
+ (r'(mapping|helper|query)(\s+)',
+ bygroups(Keyword.Declaration, Text), 'operation'),
(r'(assert)(\s+)\b', bygroups(Keyword, Text), 'assert'),
(r'(Bag|Collection|Dict|OrderedSet|Sequence|Set|Tuple|List)\b',
Keyword.Type),
@@ -75,46 +79,45 @@ class QVToLexer(RegexLexer):
("'", String, combined('stringescape', 'sqs')),
include('name'),
include('numbers'),
- # (r'([a-zA-Z_][a-zA-Z0-9_]*)(::)([a-zA-Z_][a-zA-Z0-9_]*)',
+ # (r'([a-zA-Z_]\w*)(::)([a-zA-Z_]\w*)',
# bygroups(Text, Text, Text)),
- ],
+ ],
'fromimport': [
(r'(?:[ \t]|\\\n)+', Text),
- (r'[a-zA-Z_][a-zA-Z0-9_.]*', Name.Namespace),
- (r'', Text, '#pop'),
- ],
+ (r'[a-zA-Z_][\w.]*', Name.Namespace),
+ default('#pop'),
+ ],
'operation': [
(r'::', Text),
- (r'(.*::)([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*(\()', bygroups(Text,Name.Function, Text), '#pop')
- ],
+ (r'(.*::)([a-zA-Z_]\w*)([ \t]*)(\()',
+ bygroups(Text, Name.Function, Text, Punctuation), '#pop')
+ ],
'assert': [
(r'(warning|error|fatal)\b', Keyword, '#pop'),
- (r'', Text, '#pop') # all else: go back
- ],
+ default('#pop'), # all else: go back
+ ],
'keywords': [
- (r'(abstract|access|any|assert|'
- r'blackbox|break|case|collect|collectNested|'
- r'collectOne|collectselect|collectselectOne|composes|'
- r'compute|configuration|constructor|continue|datatype|'
- r'default|derived|disjuncts|do|elif|else|end|'
- r'endif|except|exists|extends|'
- r'forAll|forEach|forOne|from|if|'
- r'implies|in|inherits|init|inout|'
- r'intermediate|invresolve|invresolveIn|invresolveone|'
- r'invresolveoneIn|isUnique|iterate|late|let|'
- r'literal|log|map|merges|'
- r'modeltype|new|object|one|'
- r'ordered|out|package|population|'
- r'property|raise|readonly|references|refines|'
- r'reject|resolve|resolveIn|resolveone|resolveoneIn|'
- r'return|select|selectOne|sortedBy|static|switch|'
- r'tag|then|try|typedef|'
- r'unlimited|uses|when|where|while|with|'
- r'xcollect|xmap|xselect)\b', Keyword),
+ (words((
+ 'abstract', 'access', 'any', 'assert', 'blackbox', 'break',
+ 'case', 'collect', 'collectNested', 'collectOne', 'collectselect',
+ 'collectselectOne', 'composes', 'compute', 'configuration',
+ 'constructor', 'continue', 'datatype', 'default', 'derived',
+ 'disjuncts', 'do', 'elif', 'else', 'end', 'endif', 'except',
+ 'exists', 'extends', 'forAll', 'forEach', 'forOne', 'from', 'if',
+ 'implies', 'in', 'inherits', 'init', 'inout', 'intermediate',
+ 'invresolve', 'invresolveIn', 'invresolveone', 'invresolveoneIn',
+ 'isUnique', 'iterate', 'late', 'let', 'literal', 'log', 'map',
+ 'merges', 'modeltype', 'new', 'object', 'one', 'ordered', 'out',
+ 'package', 'population', 'property', 'raise', 'readonly',
+ 'references', 'refines', 'reject', 'resolve', 'resolveIn',
+ 'resolveone', 'resolveoneIn', 'return', 'select', 'selectOne',
+ 'sortedBy', 'static', 'switch', 'tag', 'then', 'try', 'typedef',
+ 'unlimited', 'uses', 'when', 'where', 'while', 'with', 'xcollect',
+ 'xmap', 'xselect'), suffix=r'\b'), Keyword),
],
# There is no need to distinguish between String.Single and
@@ -127,18 +130,18 @@ class QVToLexer(RegexLexer):
'stringescape': [
(r'\\([\\btnfr"\']|u[0-3][0-7]{2}|u[0-7]{1,2})', String.Escape)
],
- 'dqs': [ # double-quoted string
+ 'dqs': [ # double-quoted string
(r'"', String, '#pop'),
(r'\\\\|\\"', String.Escape),
include('strings')
],
- 'sqs': [ # single-quoted string
+ 'sqs': [ # single-quoted string
(r"'", String, '#pop'),
(r"\\\\|\\'", String.Escape),
include('strings')
],
'name': [
- ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
+ ('[a-zA-Z_]\w*', Name),
],
# numbers: excerpt taken from the python lexer
'numbers': [
@@ -146,5 +149,4 @@ class QVToLexer(RegexLexer):
(r'\d+[eE][+-]?[0-9]+', Number.Float),
(r'\d+', Number.Integer)
],
- }
-
+ }
diff --git a/pygments/lexers/rdf.py b/pygments/lexers/rdf.py
index 103b4ad0..6dd6e8b9 100644
--- a/pygments/lexers/rdf.py
+++ b/pygments/lexers/rdf.py
@@ -42,8 +42,7 @@ class SparqlLexer(RegexLexer):
u'\u2c00-\u2fef'
u'\u3001-\ud7ff'
u'\uf900-\ufdcf'
- u'\ufdf0-\ufffd'
- u'\U00010000-\U000effff')
+ u'\ufdf0-\ufffd')
PN_CHARS_U_GRP = (PN_CHARS_BASE_GRP + '_')
@@ -56,7 +55,7 @@ class SparqlLexer(RegexLexer):
HEX_GRP = '0-9A-Fa-f'
- PN_LOCAL_ESC_CHARS_GRP = r' _~.\-!$&""()*+,;=/?#@%'
+ PN_LOCAL_ESC_CHARS_GRP = r' _~.\-!$&"()*+,;=/?#@%'
# terminal productions ::
@@ -191,7 +190,7 @@ class TurtleLexer(RegexLexer):
flags = re.IGNORECASE
patterns = {
- 'PNAME_NS': r'((?:[a-zA-Z][\w-]*)?\:)', # Simplified character range
+ 'PNAME_NS': r'((?:[a-z][\w-]*)?\:)', # Simplified character range
'IRIREF': r'(<[^<>"{}|^`\\\x00-\x20]*>)'
}
@@ -258,8 +257,7 @@ class TurtleLexer(RegexLexer):
(r'.', String, '#pop'),
],
'end-of-string': [
-
- (r'(@)([a-zA-Z]+(:?-[a-zA-Z0-9]+)*)',
+ (r'(@)([a-z]+(:?-[a-z0-9]+)*)',
bygroups(Operator, Generic.Emph), '#pop:2'),
(r'(\^\^)%(IRIREF)s' % patterns, bygroups(Operator, Generic.Emph), '#pop:2'),
diff --git a/pygments/lexers/ruby.py b/pygments/lexers/ruby.py
index e81d6ecf..f16416d3 100644
--- a/pygments/lexers/ruby.py
+++ b/pygments/lexers/ruby.py
@@ -47,9 +47,9 @@ class RubyLexer(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), Name.Constant, 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)
@@ -74,7 +74,7 @@ class RubyLexer(ExtendedRegexLexer):
if check == hdname:
for amatch in lines:
yield amatch.start(), String.Heredoc, amatch.group()
- yield match.start(), Name.Constant, match.group()
+ yield match.start(), String.Delimiter, match.group()
ctx.pos = match.end()
break
else:
diff --git a/pygments/lexers/scripting.py b/pygments/lexers/scripting.py
index 4dd9594b..ac0f7533 100644
--- a/pygments/lexers/scripting.py
+++ b/pygments/lexers/scripting.py
@@ -1020,11 +1020,11 @@ class EasytrieveLexer(RegexLexer):
(r"'(''|[^'])*'", String),
(r'\s+', Whitespace),
# Everything else just belongs to a name
- (_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name)
+ (_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name),
],
'after_declaration': [
(_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name.Function),
- ('', Whitespace, '#pop')
+ default('#pop'),
],
'after_macro_argument': [
(r'\*.*\n', Comment.Single, '#pop'),
@@ -1032,7 +1032,7 @@ class EasytrieveLexer(RegexLexer):
(_OPERATORS_PATTERN, Operator, '#pop'),
(r"'(''|[^'])*'", String, '#pop'),
# Everything else just belongs to a name
- (_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name)
+ (_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name),
],
}
_COMMENT_LINE_REGEX = re.compile(r'^\s*\*')
@@ -1122,7 +1122,8 @@ class EasytrieveLexer(RegexLexer):
class JclLexer(RegexLexer):
"""
- `Job Control Language (JCL) <http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IEA2B570/CCONTENTS>`_
+ `Job Control Language (JCL)
+ <http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IEA2B570/CCONTENTS>`_
is a scripting language used on mainframe platforms to instruct the system
on how to run a batch job or start a subsystem. It is somewhat
comparable to MS DOS batch and Unix shell scripts.
@@ -1145,10 +1146,10 @@ class JclLexer(RegexLexer):
],
'statement': [
(r'\s*\n', Whitespace, '#pop'),
- (r'([a-z][a-z_0-9]*)(\s+)(exec|job)(\s*)',
+ (r'([a-z]\w*)(\s+)(exec|job)(\s*)',
bygroups(Name.Label, Whitespace, Keyword.Reserved, Whitespace),
'option'),
- (r'[a-z][a-z_0-9]*', Name.Variable, 'statement_command'),
+ (r'[a-z]\w*', Name.Variable, 'statement_command'),
(r'\s+', Whitespace, 'statement_command'),
],
'statement_command': [
@@ -1167,10 +1168,10 @@ class JclLexer(RegexLexer):
(r'\*', Name.Builtin),
(r'[\[\](){}<>;,]', Punctuation),
(r'[-+*/=&%]', Operator),
- (r'[a-z_][a-z_0-9]*', Name),
- (r'[0-9]+\.[0-9]*', Number.Float),
- (r'\.[0-9]+', Number.Float),
- (r'[0-9]+', Number.Integer),
+ (r'[a-z_]\w*', Name),
+ (r'\d+\.\d*', Number.Float),
+ (r'\.\d+', Number.Float),
+ (r'\d+', Number.Integer),
(r"'", String, 'option_string'),
(r'[ \t]+', Whitespace, 'option_comment'),
(r'\.', Punctuation),
diff --git a/pygments/lexers/sql.py b/pygments/lexers/sql.py
index a7736f75..7c06226b 100644
--- a/pygments/lexers/sql.py
+++ b/pygments/lexers/sql.py
@@ -57,11 +57,14 @@ line_re = re.compile('.*?\n')
language_re = re.compile(r"\s+LANGUAGE\s+'?(\w+)'?", re.IGNORECASE)
+do_re = re.compile(r'\bDO\b', re.IGNORECASE)
+
def language_callback(lexer, match):
"""Parse the content of a $-string using a lexer
- The lexer is chosen looking for a nearby LANGUAGE.
+ The lexer is chosen looking for a nearby LANGUAGE or assumed as
+ plpgsql if inside a DO statement and no LANGUAGE has been found.
"""
l = None
m = language_re.match(lexer.text[match.end():match.end()+100])
@@ -72,15 +75,26 @@ def language_callback(lexer, match):
lexer.text[max(0, match.start()-100):match.start()]))
if m:
l = lexer._get_lexer(m[-1].group(1))
-
+ else:
+ m = list(do_re.finditer(
+ lexer.text[max(0, match.start()-25):match.start()]))
+ if m:
+ l = lexer._get_lexer('plpgsql')
+
+ # 1 = $, 2 = delimiter, 3 = $
+ yield (match.start(1), String, match.group(1))
+ yield (match.start(2), String.Delimiter, match.group(2))
+ yield (match.start(3), String, match.group(3))
+ # 4 = string contents
if l:
- yield (match.start(1), String, match.group(1))
- for x in l.get_tokens_unprocessed(match.group(2)):
+ for x in l.get_tokens_unprocessed(match.group(4)):
yield x
- yield (match.start(3), String, match.group(3))
-
else:
- yield (match.start(), String, match.group())
+ yield (match.start(4), String, match.group(4))
+ # 5 = $, 6 = delimiter, 7 = $
+ yield (match.start(5), String, match.group(5))
+ yield (match.start(6), String.Delimiter, match.group(6))
+ yield (match.start(7), String, match.group(7))
class PostgresBase(object):
@@ -148,9 +162,10 @@ class PostgresLexer(PostgresBase, RegexLexer):
(r'\$\d+', Name.Variable),
(r'([0-9]*\.[0-9]*|[0-9]+)(e[+-]?[0-9]+)?', Number.Float),
(r'[0-9]+', Number.Integer),
- (r"(E|U&)?'", String.Single, 'string'),
- (r'(U&)?"', String.Name, 'quoted-ident'), # quoted identifier
- (r'(?s)(\$[^$]*\$)(.*?)(\1)', language_callback),
+ (r"((?:E|U&)?)(')", bygroups(String.Affix, String.Single), 'string'),
+ # quoted identifier
+ (r'((?:U&)?)(")', bygroups(String.Affix, String.Name), 'quoted-ident'),
+ (r'(?s)(\$)([^$]*)(\$)(.*?)(\$)(\2)(\$)', language_callback),
(r'[a-z_]\w*', Name),
# psql variable in SQL
diff --git a/pygments/lexers/supercollider.py b/pygments/lexers/supercollider.py
index d3e4c460..cef147b8 100644
--- a/pygments/lexers/supercollider.py
+++ b/pygments/lexers/supercollider.py
@@ -11,7 +11,7 @@
import re
-from pygments.lexer import RegexLexer, include, words
+from pygments.lexer import RegexLexer, include, words, default
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
Number, Punctuation
@@ -43,7 +43,7 @@ class SuperColliderLexer(RegexLexer):
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
r'([gim]+\b|\B)', String.Regex, '#pop'),
(r'(?=/)', Text, ('#pop', 'badregex')),
- (r'', Text, '#pop')
+ default('#pop'),
],
'badregex': [
(r'\n', Text, '#pop')
@@ -79,8 +79,8 @@ class SuperColliderLexer(RegexLexer):
'thisFunctionDef', 'thisFunction', 'thisMethod', 'thisProcess',
'thisThread', 'this'), suffix=r'\b'),
Name.Builtin),
- (r'[$a-zA-Z_][a-zA-Z0-9_]*', Name.Other),
- (r'\\?[$a-zA-Z_][a-zA-Z0-9_]*', String.Symbol),
+ (r'[$a-zA-Z_]\w*', Name.Other),
+ (r'\\?[$a-zA-Z_]\w*', String.Symbol),
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
(r'0x[0-9a-fA-F]+', Number.Hex),
(r'[0-9]+', Number.Integer),
diff --git a/pygments/lexers/testing.py b/pygments/lexers/testing.py
index 0bdebe74..be8b6f71 100644
--- a/pygments/lexers/testing.py
+++ b/pygments/lexers/testing.py
@@ -147,7 +147,7 @@ class TAPLexer(RegexLexer):
(r'^TAP version \d+\n', Name.Namespace),
# Specify a plan with a plan line.
- (r'^1..\d+', Keyword.Declaration, 'plan'),
+ (r'^1\.\.\d+', Keyword.Declaration, 'plan'),
# A test failure
(r'^(not ok)([^\S\n]*)(\d*)',
diff --git a/pygments/lexers/theorem.py b/pygments/lexers/theorem.py
index 60a101cc..f8c7d0a9 100644
--- a/pygments/lexers/theorem.py
+++ b/pygments/lexers/theorem.py
@@ -390,20 +390,23 @@ class LeanLexer(RegexLexer):
flags = re.MULTILINE | re.UNICODE
- keywords1 = ('import', 'abbreviation', 'opaque_hint', 'tactic_hint', 'definition', 'renaming',
- 'inline', 'hiding', 'exposing', 'parameter', 'parameters', 'conjecture',
- 'hypothesis', 'lemma', 'corollary', 'variable', 'variables', 'print', 'theorem',
- 'axiom', 'inductive', 'structure', 'universe', 'alias', 'help',
- 'options', 'precedence', 'postfix', 'prefix', 'calc_trans', 'calc_subst', 'calc_refl',
- 'infix', 'infixl', 'infixr', 'notation', 'eval', 'check', 'exit', 'coercion', 'end',
- 'private', 'using', 'namespace', 'including', 'instance', 'section', 'context',
- 'protected', 'expose', 'export', 'set_option', 'add_rewrite', 'extends',
- 'open', 'example', 'constant', 'constants', 'print', 'opaque', 'reducible', 'irreducible'
+ keywords1 = (
+ 'import', 'abbreviation', 'opaque_hint', 'tactic_hint', 'definition',
+ 'renaming', 'inline', 'hiding', 'exposing', 'parameter', 'parameters',
+ 'conjecture', 'hypothesis', 'lemma', 'corollary', 'variable', 'variables',
+ 'print', 'theorem', 'axiom', 'inductive', 'structure', 'universe', 'alias',
+ 'help', 'options', 'precedence', 'postfix', 'prefix', 'calc_trans',
+ 'calc_subst', 'calc_refl', 'infix', 'infixl', 'infixr', 'notation', 'eval',
+ 'check', 'exit', 'coercion', 'end', 'private', 'using', 'namespace',
+ 'including', 'instance', 'section', 'context', 'protected', 'expose',
+ 'export', 'set_option', 'add_rewrite', 'extends', 'open', 'example',
+ 'constant', 'constants', 'print', 'opaque', 'reducible', 'irreducible',
)
keywords2 = (
- 'forall', 'fun', 'Pi', 'obtain', 'from', 'have', 'show', 'assume', 'take',
- 'let', 'if', 'else', 'then', 'by', 'in', 'with', 'begin', 'proof', 'qed', 'calc', 'match'
+ 'forall', 'fun', 'Pi', 'obtain', 'from', 'have', 'show', 'assume',
+ 'take', 'let', 'if', 'else', 'then', 'by', 'in', 'with', 'begin',
+ 'proof', 'qed', 'calc', 'match',
)
keywords3 = (
@@ -414,10 +417,10 @@ class LeanLexer(RegexLexer):
operators = (
'!=', '#', '&', '&&', '*', '+', '-', '/', '@', '!', '`',
'-.', '->', '.', '..', '...', '::', ':>', ';', ';;', '<',
- '<-', '=', '==', '>', '_', '`', '|', '||', '~', '=>', '<=', '>=',
+ '<-', '=', '==', '>', '_', '|', '||', '~', '=>', '<=', '>=',
'/\\', '\\/', u'∀', u'Π', u'λ', u'↔', u'∧', u'∨', u'≠', u'≤', u'≥',
- u'¬', u'⁻¹', u'⬝', u'▸', u'→', u'∃', u'ℕ', u'ℤ', u'≈', u'×', u'⌞', u'⌟', u'≡',
- u'⟨', u'⟩'
+ u'¬', u'⁻¹', u'⬝', u'▸', u'→', u'∃', u'ℕ', u'ℤ', u'≈', u'×', u'⌞',
+ u'⌟', u'≡', u'⟨', u'⟩',
)
punctuation = ('(', ')', ':', '{', '}', '[', ']', u'⦃', u'⦄', ':=', ',')
diff --git a/pygments/lexers/typoscript.py b/pygments/lexers/typoscript.py
new file mode 100644
index 00000000..407847ed
--- /dev/null
+++ b/pygments/lexers/typoscript.py
@@ -0,0 +1,225 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.lexers.typoscript
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ Lexers for TypoScript
+
+ `TypoScriptLexer`
+ A TypoScript lexer.
+
+ `TypoScriptCssDataLexer`
+ Lexer that highlights markers, constants and registers within css.
+
+ `TypoScriptHtmlDataLexer`
+ Lexer that highlights markers, constants and registers within html tags.
+
+ :copyright: Copyright 2006-2015 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, \
+ Operator, Punctuation
+from pygments.lexer import DelegatingLexer
+from pygments.lexers.web import HtmlLexer, CssLexer
+
+__all__ = ['TypoScriptLexer', 'TypoScriptCssDataLexer', 'TypoScriptHtmlDataLexer']
+
+
+class TypoScriptCssDataLexer(RegexLexer):
+ """
+ Lexer that highlights markers, constants and registers within css blocks.
+
+ .. versionadded:: 2.2
+ """
+
+ name = 'TypoScriptCssData'
+ aliases = ['typoscriptcssdata']
+
+ tokens = {
+ 'root': [
+ # marker: ###MARK###
+ (r'(.*)(###\w+###)(.*)', bygroups(String, Name.Constant, String)),
+ # constant: {$some.constant}
+ (r'(\{)(\$)((?:[\w\-]+\.)*)([\w\-]+)(\})',
+ bygroups(String.Symbol, Operator, Name.Constant,
+ Name.Constant, String.Symbol)), # constant
+ # constant: {register:somevalue}
+ (r'(.*)(\{)([\w\-]+)(\s*:\s*)([\w\-]+)(\})(.*)',
+ bygroups(String, String.Symbol, Name.Constant, Operator,
+ Name.Constant, String.Symbol, String)), # constant
+ # whitespace
+ (r'\s+', Text),
+ # comments
+ (r'/\*(?:(?!\*/).)*\*/', Comment),
+ (r'(?<!(#|\'|"))(?:#(?!(?:[a-fA-F0-9]{6}|[a-fA-F0-9]{3}))[^\n#]+|//[^\n]*)',
+ Comment),
+ # other
+ (r'[<>,:=.*%+|]', String),
+ (r'[\w"\-!/&;(){}]+', String),
+ ]
+ }
+
+
+class TypoScriptHtmlDataLexer(RegexLexer):
+ """
+ Lexer that highlights markers, constants and registers within html tags.
+
+ .. versionadded:: 2.2
+ """
+
+ name = 'TypoScriptHtmlData'
+ aliases = ['typoscripthtmldata']
+
+ tokens = {
+ 'root': [
+ # INCLUDE_TYPOSCRIPT
+ (r'(INCLUDE_TYPOSCRIPT)', Name.Class),
+ # Language label or extension resource FILE:... or LLL:... or EXT:...
+ (r'(EXT|FILE|LLL):[^}\n"]*', String),
+ # marker: ###MARK###
+ (r'(.*)(###\w+###)(.*)', bygroups(String, Name.Constant, String)),
+ # constant: {$some.constant}
+ (r'(\{)(\$)((?:[\w\-]+\.)*)([\w\-]+)(\})',
+ bygroups(String.Symbol, Operator, Name.Constant,
+ Name.Constant, String.Symbol)), # constant
+ # constant: {register:somevalue}
+ (r'(.*)(\{)([\w\-]+)(\s*:\s*)([\w\-]+)(\})(.*)',
+ bygroups(String, String.Symbol, Name.Constant, Operator,
+ Name.Constant, String.Symbol, String)), # constant
+ # whitespace
+ (r'\s+', Text),
+ # other
+ (r'[<>,:=.*%+|]', String),
+ (r'[\w"\-!/&;(){}#]+', String),
+ ]
+ }
+
+
+class TypoScriptLexer(RegexLexer):
+ """
+ Lexer for TypoScript code.
+
+ http://docs.typo3.org/typo3cms/TyposcriptReference/
+
+ .. versionadded:: 2.2
+ """
+
+ name = 'TypoScript'
+ aliases = ['typoscript']
+ filenames = ['*.ts', '*.txt']
+ mimetypes = ['text/x-typoscript']
+
+ flags = re.DOTALL | re.MULTILINE
+
+ tokens = {
+ 'root': [
+ include('comment'),
+ include('constant'),
+ include('html'),
+ include('label'),
+ include('whitespace'),
+ include('keywords'),
+ include('punctuation'),
+ include('operator'),
+ include('structure'),
+ include('literal'),
+ include('other'),
+ ],
+ 'keywords': [
+ # Conditions
+ (r'(\[)(?i)(browser|compatVersion|dayofmonth|dayofweek|dayofyear|'
+ r'device|ELSE|END|GLOBAL|globalString|globalVar|hostname|hour|IP|'
+ r'language|loginUser|loginuser|minute|month|page|PIDinRootline|'
+ r'PIDupinRootline|system|treeLevel|useragent|userFunc|usergroup|'
+ r'version)([^\]]*)(\])',
+ bygroups(String.Symbol, Name.Constant, Text, String.Symbol)),
+ # Functions
+ (r'(?=[\w\-])(HTMLparser|HTMLparser_tags|addParams|cache|encapsLines|'
+ r'filelink|if|imageLinkWrap|imgResource|makelinks|numRows|numberFormat|'
+ r'parseFunc|replacement|round|select|split|stdWrap|strPad|tableStyle|'
+ r'tags|textStyle|typolink)(?![\w\-])', Name.Function),
+ # Toplevel objects and _*
+ (r'(?:(=?\s*<?\s+|^\s*))(cObj|field|config|content|constants|FEData|'
+ r'file|frameset|includeLibs|lib|page|plugin|register|resources|sitemap|'
+ r'sitetitle|styles|temp|tt_[^:.\s]*|types|xmlnews|INCLUDE_TYPOSCRIPT|'
+ r'_CSS_DEFAULT_STYLE|_DEFAULT_PI_VARS|_LOCAL_LANG)(?![\w\-])',
+ bygroups(Operator, Name.Builtin)),
+ # Content objects
+ (r'(?=[\w\-])(CASE|CLEARGIF|COA|COA_INT|COBJ_ARRAY|COLUMNS|CONTENT|'
+ r'CTABLE|EDITPANEL|FILE|FILES|FLUIDTEMPLATE|FORM|HMENU|HRULER|HTML|'
+ r'IMAGE|IMGTEXT|IMG_RESOURCE|LOAD_REGISTER|MEDIA|MULTIMEDIA|OTABLE|'
+ r'PAGE|QTOBJECT|RECORDS|RESTORE_REGISTER|SEARCHRESULT|SVG|SWFOBJECT|'
+ r'TEMPLATE|TEXT|USER|USER_INT)(?![\w\-])', Name.Class),
+ # Menu states
+ (r'(?=[\w\-])(ACTIFSUBRO|ACTIFSUB|ACTRO|ACT|CURIFSUBRO|CURIFSUB|CURRO|'
+ r'CUR|IFSUBRO|IFSUB|NO|SPC|USERDEF1RO|USERDEF1|USERDEF2RO|USERDEF2|'
+ r'USRRO|USR)', Name.Class),
+ # Menu objects
+ (r'(?=[\w\-])(GMENU_FOLDOUT|GMENU_LAYERS|GMENU|IMGMENUITEM|IMGMENU|'
+ r'JSMENUITEM|JSMENU|TMENUITEM|TMENU_LAYERS|TMENU)', Name.Class),
+ # PHP objects
+ (r'(?=[\w\-])(PHP_SCRIPT(_EXT|_INT)?)', Name.Class),
+ (r'(?=[\w\-])(userFunc)(?![\w\-])', Name.Function),
+ ],
+ 'whitespace': [
+ (r'\s+', Text),
+ ],
+ 'html':[
+ (r'<\S[^\n>]*>', using(TypoScriptHtmlDataLexer)),
+ (r'&[^;\n]*;', String),
+ (r'(_CSS_DEFAULT_STYLE)(\s*)(\()(?s)(.*(?=\n\)))',
+ bygroups(Name.Class, Text, String.Symbol, using(TypoScriptCssDataLexer))),
+ ],
+ 'literal': [
+ (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),
+ ],
+ 'label': [
+ # Language label or extension resource FILE:... or LLL:... or EXT:...
+ (r'(EXT|FILE|LLL):[^}\n"]*', String),
+ # Path to a resource
+ (r'(?![^\w\-])([\w\-]+(?:/[\w\-]+)+/?)(\S*\n)',
+ bygroups(String, String)),
+ ],
+ 'punctuation': [
+ (r'[,.]', Punctuation),
+ ],
+ 'operator': [
+ (r'[<>,:=.*%+|]', Operator),
+ ],
+ 'structure': [
+ # Brackets and braces
+ (r'[{}()\[\]\\]', String.Symbol),
+ ],
+ 'constant': [
+ # Constant: {$some.constant}
+ (r'(\{)(\$)((?:[\w\-]+\.)*)([\w\-]+)(\})',
+ bygroups(String.Symbol, Operator, Name.Constant,
+ Name.Constant, String.Symbol)), # constant
+ # Constant: {register:somevalue}
+ (r'(\{)([\w\-]+)(\s*:\s*)([\w\-]+)(\})',
+ bygroups(String.Symbol, Name.Constant, Operator,
+ Name.Constant, String.Symbol)), # constant
+ # Hex color: #ff0077
+ (r'(#[a-fA-F0-9]{6}\b|#[a-fA-F0-9]{3}\b)', String.Char)
+ ],
+ 'comment': [
+ (r'(?<!(#|\'|"))(?:#(?!(?:[a-fA-F0-9]{6}|[a-fA-F0-9]{3}))[^\n#]+|//[^\n]*)',
+ Comment),
+ (r'/\*(?:(?!\*/).)*\*/', Comment),
+ (r'(\s*#\s*\n)', Comment),
+ ],
+ 'other': [
+ (r'[\w"\-!/&;]+', Text),
+ ],
+ }
+
+ def analyse_text(text):
+ if '<INCLUDE_TYPOSCRIPT:' in text:
+ return 1.0
diff --git a/pygments/lexers/varnish.py b/pygments/lexers/varnish.py
new file mode 100644
index 00000000..e64a601b
--- /dev/null
+++ b/pygments/lexers/varnish.py
@@ -0,0 +1,190 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.lexers.varnish
+ ~~~~~~~~~~~~~~~~~~~~~~~
+
+ Lexers for Varnish configuration
+
+ :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+from pygments.lexer import RegexLexer, include, bygroups, using, this, \
+ inherit, words
+from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
+ Number, Punctuation, Literal
+
+__all__ = ['VCLLexer', 'VCLSnippetLexer']
+
+
+class VCLLexer(RegexLexer):
+ """
+ For Varnish Configuration Language (VCL).
+
+ .. versionadded:: 2.2
+ """
+ name = 'VCL'
+ aliases = ['vcl']
+ filenames = ['*.vcl']
+ mimetypes = ['text/x-vclsrc']
+
+ def analyse_text(text):
+ # If the very first line is 'vcl 4.0;' it's pretty much guaranteed
+ # that this is VCL
+ if text.startswith('vcl 4.0;'):
+ return 1.0
+ # Skip over comments and blank lines
+ # This is accurate enough that returning 0.9 is reasonable.
+ # Almost no VCL files start without some comments.
+ elif '\nvcl 4\.0;' in text[:1000]:
+ return 0.9
+
+ tokens = {
+ 'probe': [
+ include('whitespace'),
+ include('comments'),
+ (r'(\.\w+)(\s*=\s*)([^;]*)(;)',
+ bygroups(Name.Attribute, Operator, using(this), Punctuation)),
+ (r'\}', Punctuation, '#pop'),
+ ],
+ 'acl': [
+ include('whitespace'),
+ include('comments'),
+ (r'[!/]+', Operator),
+ (r';', Punctuation),
+ (r'\d+', Number),
+ (r'\}', Punctuation, '#pop'),
+ ],
+ 'backend': [
+ include('whitespace'),
+ (r'(\.probe)(\s*=\s*)(\w+)(;)',
+ bygroups(Name.Attribute, Operator, Name.Variable.Global, Punctuation)),
+ (r'(\.probe)(\s*=\s*)(\{)',
+ bygroups(Name.Attribute, Operator, Punctuation), 'probe'),
+ (r'(\.\w+\b)(\s*=\s*)([^;]*)(\s*;)',
+ bygroups(Name.Attribute, Operator, using(this), Punctuation)),
+ (r'\{', Punctuation, '#push'),
+ (r'\}', Punctuation, '#pop'),
+ ],
+ 'statements': [
+ (r'(\d\.)?\d+[sdwhmy]', Literal.Date),
+ (r'(\d\.)?\d+ms', Literal.Date),
+ (r'(vcl_pass|vcl_hash|vcl_hit|vcl_init|vcl_backend_fetch|vcl_pipe|'
+ r'vcl_backend_response|vcl_synth|vcl_deliver|vcl_backend_error|'
+ r'vcl_fini|vcl_recv|vcl_purge|vcl_miss)\b', Name.Function),
+ (r'(pipe|retry|hash|synth|deliver|purge|abandon|lookup|pass|fail|ok|'
+ r'miss|fetch|restart)\b', Name.Constant),
+ (r'(beresp|obj|resp|req|req_top|bereq)\.http\.[a-zA-Z_-]+\b', Name.Variable),
+ (words((
+ 'obj.status', 'req.hash_always_miss', 'beresp.backend', 'req.esi_level',
+ 'req.can_gzip', 'beresp.ttl', 'obj.uncacheable', 'req.ttl', 'obj.hits',
+ 'client.identity', 'req.hash_ignore_busy', 'obj.reason', 'req.xid',
+ 'req_top.proto', 'beresp.age', 'obj.proto', 'obj.age', 'local.ip',
+ 'beresp.uncacheable', 'req.method', 'beresp.backend.ip', 'now',
+ 'obj.grace', 'req.restarts', 'beresp.keep', 'req.proto', 'resp.proto',
+ 'bereq.xid', 'bereq.between_bytes_timeout', 'req.esi',
+ 'bereq.first_byte_timeout', 'bereq.method', 'bereq.connect_timeout',
+ 'beresp.do_gzip', 'resp.status', 'beresp.do_gunzip',
+ 'beresp.storage_hint', 'resp.is_streaming', 'beresp.do_stream',
+ 'req_top.method', 'bereq.backend', 'beresp.backend.name', 'beresp.status',
+ 'req.url', 'obj.keep', 'obj.ttl', 'beresp.reason', 'bereq.retries',
+ 'resp.reason', 'bereq.url', 'beresp.do_esi', 'beresp.proto', 'client.ip',
+ 'bereq.proto', 'server.hostname', 'remote.ip', 'req.backend_hint',
+ 'server.identity', 'req_top.url', 'beresp.grace', 'beresp.was_304',
+ 'server.ip', 'bereq.uncacheable', 'now'), suffix=r'\b'),
+ Name.Variable),
+ (r'[!%&+*\-,/<.}{>=|~]+', Operator),
+ (r'[();]', Punctuation),
+
+ (r'[,]+', Punctuation),
+ (words(('include', 'hash_data', 'regsub', 'regsuball', 'if', 'else',
+ 'elsif', 'elif', 'synth', 'synthetic', 'ban', 'synth',
+ 'return', 'set', 'unset', 'import', 'include', 'new',
+ 'rollback', 'call'), suffix=r'\b'),
+ Keyword),
+ (r'storage\.\w+\.\w+\b', Name.Variable),
+ (words(('true', 'false')), Name.Builtin),
+ (r'\d+\b', Number),
+ (r'(backend)(\s+\w+)(\s*\{)',
+ bygroups(Keyword, Name.Variable.Global, Punctuation), 'backend'),
+ (r'(probe\s)(\s*\w+\s)(\{)',
+ bygroups(Keyword, Name.Variable.Global, Punctuation), 'probe'),
+ (r'(acl\s)(\s*\w+\s)(\{)',
+ bygroups(Keyword, Name.Variable.Global, Punctuation), 'acl'),
+ (r'(vcl )(4.0)(;)$',
+ bygroups(Keyword.Reserved, Name.Constant, Punctuation)),
+ (r'(sub\s+)([a-zA-Z]\w*)(\s*\{)',
+ bygroups(Keyword, Name.Function, Punctuation)),
+ (r'([a-zA-Z_]\w*)'
+ r'(\.)'
+ r'([a-zA-Z_]\w*)'
+ 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'),
+ (r'//.*$', Comment),
+ ],
+ 'string': [
+ (r'"', String, '#pop'),
+ (r'[^"\n]+', String), # all other characters
+ ],
+ 'multistring': [
+ (r'[^"}]', String),
+ (r'"\}', String, '#pop'),
+ (r'["}]', String),
+ ],
+ 'whitespace': [
+ (r'L?"', String, 'string'),
+ (r'\{"', String, 'multistring'),
+ (r'\n', Text),
+ (r'\s+', Text),
+ (r'\\\n', Text), # line continuation
+ ],
+ 'root': [
+ include('whitespace'),
+ include('comments'),
+ include('statements'),
+ (r'\s+', Text),
+ ],
+ }
+
+
+class VCLSnippetLexer(VCLLexer):
+ """
+ For Varnish Configuration Language snippets.
+
+ .. versionadded:: 2.2
+ """
+ name = 'VCLSnippets'
+ aliases = ['vclsnippets', 'vclsnippet']
+ mimetypes = ['text/x-vclsnippet']
+ filenames = []
+
+ def analyse_text(text):
+ # override method inherited from VCLLexer
+ return 0
+
+ tokens = {
+ 'snippetspre': [
+ (r'\.\.\.+', Comment),
+ (r'(bereq|req|req_top|resp|beresp|obj|client|server|local|remote|'
+ r'storage)($|\.\*)', Name.Variable),
+ ],
+ 'snippetspost': [
+ (r'(backend)\b', Keyword.Reserved),
+ ],
+ 'root': [
+ include('snippetspre'),
+ inherit,
+ include('snippetspost'),
+ ],
+ }
diff --git a/pygments/lexers/verification.py b/pygments/lexers/verification.py
new file mode 100644
index 00000000..4042d44e
--- /dev/null
+++ b/pygments/lexers/verification.py
@@ -0,0 +1,110 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.lexers.verification
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ Lexer for Intermediate Verification Languages (IVLs).
+
+ :copyright: Copyright 2006-2016 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+from pygments.lexer import RegexLexer, include, words
+from pygments.token import Comment, Operator, Keyword, Name, Number, \
+ Punctuation, Whitespace
+
+__all__ = ['BoogieLexer', 'SilverLexer']
+
+
+class BoogieLexer(RegexLexer):
+ """
+ For `Boogie <https://boogie.codeplex.com/>`_ source code.
+
+ .. versionadded:: 2.1
+ """
+ name = 'Boogie'
+ aliases = ['boogie']
+ filenames = ['*.bpl']
+
+ tokens = {
+ 'root': [
+ # Whitespace and Comments
+ (r'\n', Whitespace),
+ (r'\s+', Whitespace),
+ (r'//[/!](.*?)\n', Comment.Doc),
+ (r'//(.*?)\n', Comment.Single),
+ (r'/\*', Comment.Multiline, 'comment'),
+
+ (words((
+ 'axiom', 'break', 'call', 'ensures', 'else', 'exists', 'function',
+ 'forall', 'if', 'invariant', 'modifies', 'procedure', 'requires',
+ 'then', 'var', 'while'),
+ suffix=r'\b'), Keyword),
+ (words(('const',), suffix=r'\b'), Keyword.Reserved),
+
+ (words(('bool', 'int', 'ref'), suffix=r'\b'), Keyword.Type),
+ include('numbers'),
+ (r"(>=|<=|:=|!=|==>|&&|\|\||[+/\-=>*<\[\]])", Operator),
+ (r"([{}():;,.])", Punctuation),
+ # Identifier
+ (r'[a-zA-Z_]\w*', Name),
+ ],
+ 'comment': [
+ (r'[^*/]+', Comment.Multiline),
+ (r'/\*', Comment.Multiline, '#push'),
+ (r'\*/', Comment.Multiline, '#pop'),
+ (r'[*/]', Comment.Multiline),
+ ],
+ 'numbers': [
+ (r'[0-9]+', Number.Integer),
+ ],
+ }
+
+
+class SilverLexer(RegexLexer):
+ """
+ For `Silver <https://bitbucket.org/viperproject/silver>`_ source code.
+
+ .. versionadded:: 2.2
+ """
+ name = 'Silver'
+ aliases = ['silver']
+ filenames = ['*.sil']
+
+ tokens = {
+ 'root': [
+ # Whitespace and Comments
+ (r'\n', Whitespace),
+ (r'\s+', Whitespace),
+ (r'//[/!](.*?)\n', Comment.Doc),
+ (r'//(.*?)\n', Comment.Single),
+ (r'/\*', Comment.Multiline, 'comment'),
+
+ (words((
+ 'result', 'true', 'false', 'null', 'method', 'function',
+ 'predicate', 'program', 'domain', 'axiom', 'var', 'returns',
+ 'field', 'define', 'requires', 'ensures', 'invariant',
+ 'fold', 'unfold', 'inhale', 'exhale', 'new', 'assert',
+ 'assume', 'goto', 'while', 'if', 'elseif', 'else', 'fresh',
+ 'constraining', 'Seq', 'Set', 'Multiset', 'union', 'intersection',
+ 'setminus', 'subset', 'unfolding', 'in', 'old', 'forall', 'exists',
+ 'acc', 'wildcard', 'write', 'none', 'epsilon', 'perm', 'unique'),
+ suffix=r'\b'), Keyword),
+ (words(('Int', 'Perm', 'Bool', 'Ref'), suffix=r'\b'), Keyword.Type),
+ include('numbers'),
+
+ (r'[!%&*+=|?:<>/-]', Operator),
+ (r"([{}():;,.])", Punctuation),
+ # Identifier
+ (r'[\w$]\w*', Name),
+ ],
+ 'comment': [
+ (r'[^*/]+', Comment.Multiline),
+ (r'/\*', Comment.Multiline, '#push'),
+ (r'\*/', Comment.Multiline, '#pop'),
+ (r'[*/]', Comment.Multiline),
+ ],
+ 'numbers': [
+ (r'[0-9]+', Number.Integer),
+ ],
+ }
diff --git a/pygments/scanner.py b/pygments/scanner.py
index 35dbbadd..3ff11e4a 100644
--- a/pygments/scanner.py
+++ b/pygments/scanner.py
@@ -66,7 +66,8 @@ class Scanner(object):
def test(self, pattern):
"""Apply a pattern on the current position and check
- if it patches. Doesn't touch pos."""
+ if it patches. Doesn't touch pos.
+ """
return self.check(pattern) is not None
def scan(self, pattern):
diff --git a/pygments/sphinxext.py b/pygments/sphinxext.py
index 2dc9810f..de8cd73b 100644
--- a/pygments/sphinxext.py
+++ b/pygments/sphinxext.py
@@ -57,6 +57,7 @@ FILTERDOC = '''
'''
+
class PygmentsDoc(Directive):
"""
A directive to collect all lexers/formatters/filters and generate
diff --git a/pygments/style.py b/pygments/style.py
index b2b990ea..68ee3a19 100644
--- a/pygments/style.py
+++ b/pygments/style.py
@@ -12,6 +12,29 @@
from pygments.token import Token, STANDARD_TYPES
from pygments.util import add_metaclass
+# Default mapping of #ansixxx to RGB colors.
+_ansimap = {
+ # dark
+ '#ansiblack': '000000',
+ '#ansidarkred': '7f0000',
+ '#ansidarkgreen': '007f00',
+ '#ansibrown': '7f7fe0',
+ '#ansidarkblue': '00007f',
+ '#ansipurple': '7f007f',
+ '#ansiteal': '007f7f',
+ '#ansilightgray': 'e5e5e5',
+ # normal
+ '#ansidarkgray': '555555',
+ '#ansired': 'ff0000',
+ '#ansigreen': '00ff00',
+ '#ansiyellow': 'ffff00',
+ '#ansiblue': '0000ff',
+ '#ansifuchsia': 'ff00ff',
+ '#ansiturquoise': '00ffff',
+ '#ansiwhite': 'ffffff',
+}
+ansicolors = set(_ansimap)
+
class StyleMeta(type):
@@ -22,6 +45,8 @@ class StyleMeta(type):
obj.styles[token] = ''
def colorformat(text):
+ if text in ansicolors:
+ return text
if text[0:1] == '#':
col = text[1:]
if len(col) == 6:
@@ -79,16 +104,28 @@ class StyleMeta(type):
def style_for_token(cls, token):
t = cls._styles[token]
+ ansicolor = bgansicolor = None
+ color = t[0]
+ if color.startswith('#ansi'):
+ ansicolor = color
+ color = _ansimap[color]
+ bgcolor = t[4]
+ if bgcolor.startswith('#ansi'):
+ bgansicolor = bgcolor
+ bgcolor = _ansimap[bgcolor]
+
return {
- 'color': t[0] or None,
+ 'color': color or None,
'bold': bool(t[1]),
'italic': bool(t[2]),
'underline': bool(t[3]),
- 'bgcolor': t[4] or None,
+ 'bgcolor': bgcolor or None,
'border': t[5] or None,
'roman': bool(t[6]) or None,
'sans': bool(t[7]) or None,
'mono': bool(t[8]) or None,
+ 'ansicolor': ansicolor,
+ 'bgansicolor': bgansicolor,
}
def list_styles(cls):
diff --git a/pygments/styles/__init__.py b/pygments/styles/__init__.py
index d7a0564a..4efd196e 100644
--- a/pygments/styles/__init__.py
+++ b/pygments/styles/__init__.py
@@ -41,6 +41,7 @@ STYLE_MAP = {
'lovelace': 'lovelace::LovelaceStyle',
'algol': 'algol::AlgolStyle',
'algol_nu': 'algol_nu::Algol_NuStyle',
+ 'arduino': 'arduino::ArduinoStyle'
}
diff --git a/pygments/styles/arduino.py b/pygments/styles/arduino.py
index cb4d17b0..1bf2103c 100644
--- a/pygments/styles/arduino.py
+++ b/pygments/styles/arduino.py
@@ -29,7 +29,7 @@ class ArduinoStyle(Style):
Comment: "#95a5a6", # class: 'c'
Comment.Multiline: "", # class: 'cm'
- Comment.Preproc: "#434f54", # class: 'cp'
+ Comment.Preproc: "#728E00", # class: 'cp'
Comment.Single: "", # class: 'c1'
Comment.Special: "", # class: 'cs'
@@ -38,15 +38,15 @@ class ArduinoStyle(Style):
Keyword.Declaration: "", # class: 'kd'
Keyword.Namespace: "", # class: 'kn'
Keyword.Pseudo: "#00979D", # class: 'kp'
- Keyword.Reserved: "", # class: 'kr'
+ Keyword.Reserved: "#00979D", # class: 'kr'
Keyword.Type: "#00979D", # class: 'kt'
- Operator: "#434f54", # class: 'o'
+ Operator: "#728E00", # class: 'o'
Operator.Word: "", # class: 'ow'
Name: "#434f54", # class: 'n'
Name.Attribute: "", # class: 'na'
- Name.Builtin: "", # class: 'nb'
+ Name.Builtin: "#728E00", # class: 'nb'
Name.Builtin.Pseudo: "", # class: 'bp'
Name.Class: "", # class: 'nc'
Name.Constant: "", # class: 'no'
@@ -64,7 +64,7 @@ class ArduinoStyle(Style):
Name.Variable.Global: "", # class: 'vg'
Name.Variable.Instance: "", # class: 'vi'
- Number: "#434f54", # class: 'm'
+ Number: "#8A7B52", # class: 'm'
Number.Float: "", # class: 'mf'
Number.Hex: "", # class: 'mh'
Number.Integer: "", # class: 'mi'
diff --git a/pygments/styles/lovelace.py b/pygments/styles/lovelace.py
index 4009274c..236dde9b 100644
--- a/pygments/styles/lovelace.py
+++ b/pygments/styles/lovelace.py
@@ -62,14 +62,18 @@ class LovelaceStyle(Style):
Name.Entity: _ESCAPE_LIME,
Name.Exception: _EXCEPT_YELLOW,
Name.Function: _FUN_BROWN,
+ Name.Function.Magic: _DOC_ORANGE,
Name.Label: _LABEL_CYAN,
Name.Namespace: _LABEL_CYAN,
Name.Tag: _KW_BLUE,
Name.Variable: '#b04040',
Name.Variable.Global:_EXCEPT_YELLOW,
+ Name.Variable.Magic: _DOC_ORANGE,
String: _STR_RED,
+ String.Affix: '#444444',
String.Char: _OW_PURPLE,
+ String.Delimiter: _DOC_ORANGE,
String.Doc: 'italic '+_DOC_ORANGE,
String.Escape: _ESCAPE_LIME,
String.Interpol: 'underline',
diff --git a/pygments/styles/perldoc.py b/pygments/styles/perldoc.py
index 47a097ca..eae6170d 100644
--- a/pygments/styles/perldoc.py
+++ b/pygments/styles/perldoc.py
@@ -41,7 +41,7 @@ class PerldocStyle(Style):
Operator.Word: '#8B008B',
Keyword: '#8B008B bold',
- Keyword.Type: '#a7a7a7',
+ Keyword.Type: '#00688B',
Name.Class: '#008b45 bold',
Name.Exception: '#008b45 bold',
diff --git a/pygments/token.py b/pygments/token.py
index fa3b1e11..fbd5b805 100644
--- a/pygments/token.py
+++ b/pygments/token.py
@@ -9,6 +9,7 @@
:license: BSD, see LICENSE for details.
"""
+
class _TokenType(tuple):
parent = None
@@ -52,30 +53,30 @@ class _TokenType(tuple):
return self
-Token = _TokenType()
+Token = _TokenType()
# Special token types
-Text = Token.Text
-Whitespace = Text.Whitespace
-Escape = Token.Escape
-Error = Token.Error
+Text = Token.Text
+Whitespace = Text.Whitespace
+Escape = Token.Escape
+Error = Token.Error
# Text that doesn't belong to this lexer (e.g. HTML in PHP)
-Other = Token.Other
+Other = Token.Other
# Common token types for source code
-Keyword = Token.Keyword
-Name = Token.Name
-Literal = Token.Literal
-String = Literal.String
-Number = Literal.Number
+Keyword = Token.Keyword
+Name = Token.Name
+Literal = Token.Literal
+String = Literal.String
+Number = Literal.Number
Punctuation = Token.Punctuation
-Operator = Token.Operator
-Comment = Token.Comment
+Operator = Token.Operator
+Comment = Token.Comment
# Generic types for non-source code
-Generic = Token.Generic
+Generic = Token.Generic
-# String and some others are not direct childs of Token.
+# String and some others are not direct children of Token.
# alias them:
Token.Token = Token
Token.String = String
@@ -147,6 +148,7 @@ STANDARD_TYPES = {
Name.Entity: 'ni',
Name.Exception: 'ne',
Name.Function: 'nf',
+ Name.Function.Magic: 'fm',
Name.Property: 'py',
Name.Label: 'nl',
Name.Namespace: 'nn',
@@ -156,13 +158,16 @@ STANDARD_TYPES = {
Name.Variable.Class: 'vc',
Name.Variable.Global: 'vg',
Name.Variable.Instance: 'vi',
+ Name.Variable.Magic: 'vm',
Literal: 'l',
Literal.Date: 'ld',
String: 's',
+ String.Affix: 'sa',
String.Backtick: 'sb',
String.Char: 'sc',
+ String.Delimiter: 'dl',
String.Doc: 'sd',
String.Double: 's2',
String.Escape: 'se',
diff --git a/scripts/debug_lexer.py b/scripts/debug_lexer.py
index cedd0988..4b7db41a 100755
--- a/scripts/debug_lexer.py
+++ b/scripts/debug_lexer.py
@@ -109,6 +109,8 @@ def main(fn, lexer=None, options={}):
lxcls = find_lexer_class(name)
if lxcls is None:
raise AssertionError('no lexer found for file %r' % fn)
+ print('Using lexer: %s (%s.%s)' % (lxcls.name, lxcls.__module__,
+ lxcls.__name__))
debug_lexer = False
# if profile:
# # does not work for e.g. ExtendedRegexLexers
diff --git a/setup.py b/setup.py
index b15e0bc9..6442fd10 100755
--- a/setup.py
+++ b/setup.py
@@ -24,22 +24,16 @@ try:
from setuptools import setup, find_packages
have_setuptools = True
except ImportError:
- try:
- import ez_setup
- ez_setup.use_setuptools()
- from setuptools import setup, find_packages
- have_setuptools = True
- except ImportError:
- from distutils.core import setup
- def find_packages(*args, **kwargs):
- return [
- 'pygments',
- 'pygments.lexers',
- 'pygments.formatters',
- 'pygments.styles',
- 'pygments.filters',
- ]
- have_setuptools = False
+ from distutils.core import setup
+ def find_packages(*args, **kwargs):
+ return [
+ 'pygments',
+ 'pygments.lexers',
+ 'pygments.formatters',
+ 'pygments.styles',
+ 'pygments.filters',
+ ]
+ have_setuptools = False
if have_setuptools:
add_keywords = dict(
@@ -54,7 +48,7 @@ else:
setup(
name = 'Pygments',
- version = '2.1.1',
+ version = '2.2',
url = 'http://pygments.org/',
license = 'BSD License',
author = 'Georg Brandl',
diff --git a/tests/examplefiles/StdGeneric.icl b/tests/examplefiles/StdGeneric.icl
new file mode 100644
index 00000000..2e6c3931
--- /dev/null
+++ b/tests/examplefiles/StdGeneric.icl
@@ -0,0 +1,92 @@
+implementation module StdGeneric
+
+import StdInt, StdMisc, StdClass, StdFunc
+
+generic bimap a b :: Bimap .a .b
+
+bimapId :: Bimap .a .a
+bimapId = { map_to = id, map_from = id }
+
+bimap{|c|} = { map_to = id, map_from = id }
+
+bimap{|PAIR|} bx by = { map_to= map_to, map_from=map_from }
+where
+ map_to (PAIR x y) = PAIR (bx.map_to x) (by.map_to y)
+ map_from (PAIR x y) = PAIR (bx.map_from x) (by.map_from y)
+bimap{|EITHER|} bl br = { map_to= map_to, map_from=map_from }
+where
+ map_to (LEFT x) = LEFT (bl.map_to x)
+ map_to (RIGHT x) = RIGHT (br.map_to x)
+ map_from (LEFT x) = LEFT (bl.map_from x)
+ map_from (RIGHT x) = RIGHT (br.map_from x)
+
+bimap{|(->)|} barg bres = { map_to = map_to, map_from = map_from }
+where
+ map_to f = comp3 bres.map_to f barg.map_from
+ map_from f = comp3 bres.map_from f barg.map_to
+
+bimap{|CONS|} barg = { map_to= map_to, map_from=map_from }
+where
+ map_to (CONS x) = CONS (barg.map_to x)
+ map_from (CONS x) = CONS (barg.map_from x)
+
+bimap{|FIELD|} barg = { map_to= map_to, map_from=map_from }
+where
+ map_to (FIELD x) = FIELD (barg.map_to x)
+ map_from (FIELD x) = FIELD (barg.map_from x)
+
+bimap{|OBJECT|} barg = { map_to= map_to, map_from=map_from }
+where
+ map_to (OBJECT x) = OBJECT (barg.map_to x)
+ map_from (OBJECT x) = OBJECT (barg.map_from x)
+
+bimap{|Bimap|} x y = {map_to = map_to, map_from = map_from}
+where
+ map_to {map_to, map_from} =
+ { map_to = comp3 y.map_to map_to x.map_from
+ , map_from = comp3 x.map_to map_from y.map_from
+ }
+ map_from {map_to, map_from} =
+ { map_to = comp3 y.map_from map_to x.map_to
+ , map_from = comp3 x.map_from map_from y.map_to
+ }
+
+comp3 :: !(.a -> .b) u:(.c -> .a) !(.d -> .c) -> u:(.d -> .b)
+comp3 f g h
+ | is_id f
+ | is_id h
+ = cast g
+ = cast (\x -> g (h x))
+ | is_id h
+ = cast (\x -> f (g x))
+ = \x -> f (g (h x))
+where
+ is_id :: !.(.a -> .b) -> Bool
+ is_id f = code inline
+ {
+ eq_desc e_StdFunc_did 0 0
+ pop_a 1
+ }
+
+ cast :: !u:a -> u:b
+ cast f = code inline
+ {
+ pop_a 0
+ }
+
+getConsPath :: !GenericConsDescriptor -> [ConsPos]
+getConsPath {gcd_index, gcd_type_def={gtd_num_conses}}
+ = doit gcd_index gtd_num_conses
+where
+ doit i n
+ | n == 0
+ = abort "getConsPath: zero conses\n"
+ | i >= n
+ = abort "getConsPath: cons index >= number of conses"
+ | n == 1
+ = []
+ | i < (n/2)
+ = [ ConsLeft : doit i (n/2) ]
+ | otherwise
+ = [ ConsRight : doit (i - (n/2)) (n - (n/2)) ]
+ \ No newline at end of file
diff --git a/tests/examplefiles/example.jsgf b/tests/examplefiles/example.jsgf
new file mode 100644
index 00000000..cd79dbed
--- /dev/null
+++ b/tests/examplefiles/example.jsgf
@@ -0,0 +1,28 @@
+#JSGF V1.0 UTF-8 en;
+
+grammar org.pygments.example;
+
+// comment /*
+/*
+ multi-line
+ comment
+ /* without nesting
+ @example doesn't mean anything here.
+*/
+/**/
+
+/**
+ * A silly @example grammar.
+ *
+ * @author David Corbett
+ * @version 1
+* @see <org.pygments.example.en>
+ * @example hello world
+ @example hello ","
+ *
+ **@blah
+ **world
+ */
+public <sentence> = (/1/<en> | / 0.8f /<fr> |/0/<VOID>""""{}{})*<NULL>;
+<org.pygments.example.fr> = bonjour {hello} [,] "le monde" {world};
+<en> = (/56/hello|/3.14e3/"\"hello\"") {hello} {{ {\\//\} } world {world} !+ ;
diff --git a/tests/examplefiles/example.xtm b/tests/examplefiles/example.xtm
new file mode 100644
index 00000000..927117da
--- /dev/null
+++ b/tests/examplefiles/example.xtm
@@ -0,0 +1,1101 @@
+;;; example.xtm -- Extempore code examples
+
+;; Author: Ben Swift, Andrew Sorensen
+;; Keywords: extempore
+
+;;; Commentary:
+
+
+
+;;; Code:
+
+;; bit twiddling
+
+(xtmtest '(bind-func test_bit_twiddle_1
+ (lambda ()
+ (bitwise-and 65535 255 15 1)))
+
+ (test_bit_twiddle_1) 1)
+
+(xtmtest '(bind-func test_bit_twiddle_2
+ (lambda ()
+ (bitwise-not -1)))
+
+ (test_bit_twiddle_2) 0)
+
+(xtmtest '(bind-func test_bit_twiddle_3
+ (lambda ()
+ (bitwise-not 0)))
+
+ (test_bit_twiddle_3) -1)
+
+(xtmtest '(bind-func test_bit_twiddle_4
+ (lambda ()
+ (bitwise-shift-right 65535 8)
+ (bitwise-shift-right 65535 4 4)))
+
+ (test_bit_twiddle_4) 255)
+
+(xtmtest '(bind-func test_bit_twiddle_5
+ (lambda ()
+ (bitwise-shift-left (bitwise-shift-right 65535 8) 4 4)))
+
+ (test_bit_twiddle_5) 65280)
+
+(xtmtest '(bind-func test_bit_twiddle_6
+ (lambda ()
+ (bitwise-and (bitwise-or (bitwise-eor 21844 65534) (bitwise-eor 43690 65534)) 1)))
+
+ (test_bit_twiddle_6) 0)
+
+;; integer literals default to 64 bit integers
+(xtmtest '(bind-func int-literal-test
+ (lambda (a)
+ (* a 5)))
+
+ (int-literal-test 6) 30)
+
+;; float literals default to doubles
+(xtmtest '(bind-func float-literal-test
+ (lambda (a)
+ (* a 5.0)))
+
+ (float-literal-test 6.0) 30.0)
+
+;; you are free to recompile an existing closure
+(xtmtest '(bind-func int-literal-test
+ (lambda (a)
+ (/ a 5)))
+
+ (int-literal-test 30))
+
+(xtmtest '(bind-func closure-test1
+ (let ((power 0))
+ (lambda (x)
+ (set! power (+ power 1)) ;; set! for closure mutation as per scheme
+ (* x power))))
+
+ (closure-test1 2))
+
+(xtmtest '(bind-func closure-returns-closure-test
+ (lambda ()
+ (lambda (x)
+ (* x 3))))
+
+ (closure-returns-closure-test))
+
+(xtmtest '(bind-func incrementer-test1
+ (lambda (i:i64)
+ (lambda (incr)
+ (set! i (+ i incr))
+ i)))
+
+ (incrementer-test1 0))
+
+(define myf (incrementer-test1 0))
+
+;; so we need to type f properly
+(xtmtest '(bind-func incrementer-test2
+ (lambda (f:[i64,i64]* x)
+ (f x)))
+ (incrementer-test2 myf 1) 1)
+
+;; and we can call my-in-maker-wrapper
+;; to appy myf
+(xtmtest-result (incrementer-test2 myf 1) 2)
+(xtmtest-result (incrementer-test2 myf 1) 3)
+(xtmtest-result (incrementer-test2 myf 1) 4)
+
+;; of course the wrapper is only required if you
+;; need interaction with the scheme world.
+;; otherwise you just call my-inc-maker directly
+
+;; this avoids the wrapper completely
+(xtmtest '(bind-func incrementer-test3
+ (let ((f (incrementer-test1 0)))
+ (lambda ()
+ (f 1))))
+
+ (incrementer-test3) 1)
+
+(xtmtest-result (incrementer-test3) 2)
+(xtmtest-result (incrementer-test3) 3)
+
+;; hopefully you're getting the idea.
+;; note that once we've compiled something
+;; we can then use it any of our new
+;; function definitions.
+
+;; do a little 16bit test
+(xtmtest '(bind-func bitsize-sixteen
+ (lambda (a:i16)
+ (dtoi16 (* (i16tod a) 5.0))))
+
+ (bitsize-sixteen 5) 25)
+
+;; while loop test
+
+(xtmtest '(bind-func test_while_loop_1
+ (lambda ()
+ (let ((count 0))
+ (while (< count 5)
+ (printf "count = %lld\n" count)
+ (set! count (+ count 1)))
+ count)))
+
+ (test_while_loop_1) 5)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Closures can be recursive
+;;
+
+(xtmtest '(bind-func recursive-closure-test
+ (lambda (a)
+ (if (< a 1)
+ (printf "done\n")
+ (begin (printf "a: %lld\n" a)
+ (recursive-closure-test (- a 1))))))
+
+ (recursive-closure-test 3))
+
+;; check TAIL OPTIMIZATION
+;; if there is no tail call optimiation
+;; in place then this should blow the
+;; stack and crash the test
+
+;; CANNOT RUN THIS TEST ON WINDOWS (i.e. no salloc)!
+(if (not (equal? (sys:platform) "Windows"))
+ (xtmtest '(bind-func tail_opt_test
+ (lambda (n:i64)
+ (let ((a:float* (salloc 8000)))
+ (if (= n 0)
+ (printf "tail opt test passed!\n")
+ (tail_opt_test (- n 1))))))
+
+ (tail_opt_test 200)))
+
+(println 'A 'segfault 'here 'incidates 'that 'tail-call-optimizations 'are 'not 'working!)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; some anon lambda tests
+;;
+
+(xtmtest '(bind-func infer_lambdas_test
+ (lambda ()
+ (let ((a 5)
+ (b (lambda (x) (* x x)))
+ (c (lambda (y) (* y y))))
+ (c (b a)))))
+
+ (infer_lambdas_test))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; a simple tuple example
+;;
+;; tuple types are represented as <type,type,type>*
+;;
+
+;; make and return a simple tuple
+(xtmtest '(bind-func tuple-test1
+ (lambda ()
+ (let ((t:<i64,double,i32>* (alloc)))
+ t)))
+
+ (tuple-test1))
+
+;; logview shows [<i64,double,i32>*]*
+;; i.e. a closure that takes no arguments
+;; and returns the tuple <i64,double,i32>*
+
+
+;; here's another tuple example
+;; note that my-test-7's return type is inferred
+;; by the tuple-reference index
+;; (i.e. i64 being tuple index 0)
+(xtmtest '(bind-func tuple-test2
+ (lambda ()
+ (let ((a:<i64,double>* (alloc)) ; returns pointer to type <i64,double>
+ (b 37)
+ (c 6.4))
+ (tuple-set! a 0 b) ;; set i64 to 64
+ (tset! a 1 c) ;; set double to 6.4 - tset! is an alias for tuple-set!
+ (printf "tuple:1 %lld::%f\n" (tuple-ref a 0) (tref a 1))
+ ;; we can fill a tuple in a single call by using tfill!
+ (tfill! a 77 77.7)
+ (printf "tuple:2 %lld::%f\n" (tuple-ref a 0) (tuple-ref a 1))
+ (tuple-ref a 0))))
+
+ (tuple-test2) 77)
+
+;; return first element which is i64
+;; should be 64 as we return the
+;; first element of the tuple
+;; (println (my-test-7)) ; 77
+
+
+;; tbind binds variables to values
+;; based on tuple structure
+;; _ (underscore) means don't attempt
+;; to match against this position in
+;; the tuple (i.e. skip)
+(xtmtest '(bind-func tuple-bind-test
+ (lambda ()
+ (let ((t1:<i32,float,<i32,float>*,double>* (alloc))
+ (t2:<i32,float>* (alloc))
+ (a 0) (b:float 0.0) (c 0.0))
+ (tfill! t2 3 3.3)
+ (tfill! t1 1 2.0 t2 4.0)
+ (tbind t1 a b _ c)
+ c)))
+
+ (tuple-bind-test) 4.0)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; some array code with *casting*
+;; this function returns void
+(xtmtest '(bind-func array-test1
+ (lambda ()
+ (let ((v1:|5,float|* (alloc))
+ (v2:|5,float|* (alloc))
+ (i 0)
+ (k 0))
+ (dotimes (i 5)
+ ;; random returns double so "truncate" to float
+ ;; which is what v expects
+ (array-set! v1 i (dtof (random))))
+ ;; we can use the afill! function to fill an array
+ (afill! v2 1.1 2.2 3.3 4.4 5.5)
+ (dotimes (k 5)
+ ;; unfortunately printf doesn't like floats
+ ;; so back to double for us :(
+ (printf "val: %lld::%f::%f\n" k
+ (ftod (array-ref v1 k))
+ (ftod (aref v2 k)))))))
+
+ (array-test1))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; some crazy array code with
+;; closures and arrays
+;; try to figure out what this all does
+;;
+;; this example uses the array type
+;; the pretty print for this type is
+;; |num,type| num elements of type
+;; |5,i64| is an array of 5 x i64
+;;
+;; An array is not a pointer type
+;; i.e. |5,i64| cannot be bitcast to i64*
+;;
+;; However an array can be a pointer
+;; i.e. |5,i64|* can be bitcast to i64*
+;; i.e. |5,i64|** to i64** etc..
+;;
+;; make-array returns a pointer to an array
+;; i.e. (make-array 5 i64) returns type |5,i64|*
+;;
+;; aref (array-ref) and aset! (array-set!)
+;; can operate with either pointers to arrays or
+;; standard pointers.
+;;
+;; in other words aref and aset! are happy
+;; to work with either i64* or |5,i64|*
+
+(bind-func array-test2
+ (lambda (v:|5,i64|*)
+ (let ((f (lambda (x)
+ (* (array-ref v 2) x))))
+ f)))
+
+(bind-func array-test3
+ (lambda (v:|5,[i64,i64]*|*)
+ (let ((ff (aref v 0))) ; aref alias for array-ref
+ (ff 5))))
+
+(xtmtest '(bind-func array-test4
+ (lambda ()
+ (let ((v:|5,[i64,i64]*|* (alloc)) ;; make an array of closures!
+ (vv:|5,i64|* (alloc)))
+ (array-set! vv 2 3)
+ (aset! v 0 (array-test2 vv)) ;; aset! alias for array-set!
+ (array-test3 v))))
+
+ ;; try to guess the answer before you call this!!
+ (array-test4))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; some conditionals
+
+(xtmtest '(bind-func cond-test1
+ (lambda (x:i64 y)
+ (if (> x y)
+ x
+ y)))
+
+ (cond-test1 12 13))
+
+;; returns boolean true
+(xtmtest '(bind-func cond-test2
+ (lambda (x:i64)
+ (cond ((= x 1) (printf "A\n"))
+ ((= x 2) (printf "B\n"))
+ ((= x 3) (printf "C\n"))
+ ((= x 4) (printf "D\n"))
+ (else (printf "E\n")))
+ #t))
+
+ (cond-test2 1))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; making a linear envelop generator
+;; for signal processing and alike
+
+(bind-func envelope-segments
+ (lambda (points:double* num-of-points:i64)
+ (let ((lines:[double,double]** (zone-alloc num-of-points))
+ (k 0))
+ (dotimes (k num-of-points)
+ (let* ((idx (* k 2))
+ (x1 (pointer-ref points (+ idx 0)))
+ (y1 (pointer-ref points (+ idx 1)))
+ (x2 (pointer-ref points (+ idx 2)))
+ (y2 (pointer-ref points (+ idx 3)))
+ (m (if (= 0.0 (- x2 x1)) 0.0 (/ (- y2 y1) (- x2 x1))))
+ (c (- y2 (* m x2)))
+ (l (lambda (time) (+ (* m time) c))))
+ (pointer-set! lines k l)))
+ lines)))
+
+(bind-func make-envelope
+ (lambda (points:double* num-of-points)
+ (let ((klines:[double,double]** (envelope-segments points num-of-points))
+ (line-length num-of-points))
+ (lambda (time)
+ (let ((res -1.0)
+ (k:i64 0))
+ (dotimes (k num-of-points)
+ (let ((line (pointer-ref klines k))
+ (time-point (pointer-ref points (* k 2))))
+ (if (or (= time time-point)
+ (< time-point time))
+ (set! res (line time)))))
+ res)))))
+
+;; make a convenience wrapper
+(xtmtest '(bind-func env-wrap
+ (let* ((points 3)
+ (data:double* (zone-alloc (* points 2))))
+ (pointer-set! data 0 0.0) ;; point data
+ (pset! data 1 0.0)
+ (pset! data 2 2.0)
+ (pset! data 3 1.0)
+ (pset! data 4 4.0)
+ (pset! data 5 0.0)
+ (let ((f (make-envelope data points)))
+ (lambda (time:double)
+ (f time)))))
+ (env-wrap 0.0) 0.0)
+
+(xtmtest-result (env-wrap 1.0) 0.5)
+(xtmtest-result (env-wrap 2.0) 1.0)
+(xtmtest-result (env-wrap 2.5) 0.75)
+(xtmtest-result (env-wrap 4.0) 0.0)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; direct access to a closures environment
+;;
+;; it is possible to directly access a closures
+;; environment in order to read or modify data
+;; at runtime.
+;;
+;; You do this using a dot operator
+;; To access an environment slot you use
+;; closure.slot:type
+;; So for example
+;; (f.a:i32)
+;; would return the 32bit integer symbol 'a'
+;; from the closure 'f'
+;;
+;; To set an environment slot you just
+;; add a value of the correct type
+;; for example
+;; (f.a:i32 565)
+;; would set 'a' in 'f' to 565
+;;
+;; let's create a closure that capture's 'a'
+
+
+(xtmtest '(bind-func dot-access-test1
+ (let ((a:i32 6))
+ (lambda ()
+ (printf "a:%d\n" a)
+ a)))
+ (dot-access-test1))
+
+;; now let's create a new function
+;; that calls my-test14 twice
+;; once normally
+;; then we directly set the closures 'a' binding
+;; then call again
+;;
+(xtmtest '(bind-func dot-access-test2
+ (lambda (x:i32)
+ (dot-access-test1)
+ (dot-access-test1.a:i32 x)
+ (dot-access-test1)))
+
+ (dot-access-test2 9))
+
+;; of course this works just as well for
+;; non-global closures
+(xtmtest '(bind-func dot-access-test3
+ (lambda (a:i32)
+ (let ((f (lambda ()
+ (* 3 a))))
+ f)))
+ (dot-access-test3 1))
+
+(xtmtest '(bind-func dot-access-test4
+ (lambda ()
+ (let ((f (dot-access-test3 5)))
+ (f.a:i32 7)
+ (f))))
+
+ (dot-access-test4)
+ 21)
+
+;; and you can get and set closures also!
+(xtmtest '(bind-func dot-access-test5
+ (lambda ()
+ (let ((f (lambda (x:i64) x)))
+ (lambda (z)
+ (f z)))))
+
+ (dot-access-test5))
+
+(xtmtest '(bind-func dot-access-test6
+ (lambda ()
+ (let ((t1 (dot-access-test5))
+ (t2 (dot-access-test5)))
+ ;; identity of 5
+ (printf "%lld:%lld\n" (t1 5) (t2 5))
+ (t1.f:[i64,i64]* (lambda (x:i64) (* x x)))
+ ;; square of 5
+ (printf "%lld:%lld\n" (t1 5) (t2 5))
+ ;; cube of 5
+ (t2.f:[i64,i64]* (lambda (y:i64) (* y y y)))
+ (printf "%lld:%lld\n" (t1 5) (t2 5))
+ void)))
+
+ (dot-access-test6)) ;; 5:5 > 25:5 > 25:125
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; named types
+
+;; it can sometimes be helpful to allocate
+;; a predefined tuple type on the stack
+;; you can do this using allocate
+(bind-type vec3 <double,double,double>)
+
+;; String printing!
+(bind-func vec3_print:[void,vec3*]*
+ (lambda (x)
+ (printf "<%d,%d,%d>" (tref x 0) (tref x 1) (tref x 2))
+ void))
+
+(bind-poly print vec3_print)
+
+;; note that point is deallocated at the
+;; end of the function call. You can
+;; stack allocate (stack-alloc)
+;; any valid type (i64 for example)
+(xtmtest '(bind-func salloc-test
+ (lambda ()
+ (let ((point:vec3* (stack-alloc)))
+ (tset! point 0 0.0)
+ (tset! point 1 -1.0)
+ (tset! point 2 1.0)
+ 1)))
+
+ (salloc-test)) ;; 1
+
+;; all named types have 2 default constructors
+;; name (zone alloation) + name_h (heap allocation)
+;; and a default print poly
+(xtmtest '(bind-func data-constructor-test
+ (lambda ()
+ (let ((v1 (vec3 1.0 2.0 3.0))
+ (v2 (vec3_h 4.0 5.0 6.0)))
+ (println v1 v2)
+ ;; halloced vec3 needs freeing
+ (free v2)
+ void)))
+
+ (data-constructor-test))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; aref-ptr and tref-ptr
+;;
+
+;; aref-ptr and tref-ptr return a pointer to an element
+;; just as aref and tref return elements aref-ptr and
+;; tref-ptr return a pointer to those elements.
+
+;; This allows you to do things like create an array
+;; with an offset
+(xtmtest '(bind-func aref-ptr-test
+ (lambda ()
+ (let ((arr:|32,i64|* (alloc))
+ (arroff (aref-ptr arr 16))
+ (i 0)
+ (k 0))
+ ;; load arr
+ (dotimes (i 32) (aset! arr i i))
+ (dotimes (k 16)
+ (printf "index: %lld\tarr: %lld\tarroff: %lld\n"
+ k (aref arr k) (pref arroff k))))))
+
+ (aref-ptr-test))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; arrays
+;; Extempore lang supports arrays as for first class
+;; aggregate types (in other words as distinct from
+;; a pointer).
+;;
+;; an array is made up of a size and a type
+;; |32,i64| is an array of 32 elements of type i64
+;;
+
+(bind-type tuple-with-array <double,|32,|4,i32||,float>)
+
+(xtmtest '(bind-func array-test5
+ (lambda ()
+ (let ((tup:tuple-with-array* (stack-alloc))
+ (t2:|32,i64|* (stack-alloc)))
+ (aset! t2 0 9)
+ (tset! tup 2 5.5)
+ (aset! (aref-ptr (tref-ptr tup 1) 0) 0 0)
+ (aset! (aref-ptr (tref-ptr tup 1) 0) 1 1)
+ (aset! (aref-ptr (tref-ptr tup 1) 0) 2 2)
+ (printf "val: %lld %lld %f\n"
+ (aref (aref-ptr (tref-ptr tup 1) 0) 1)
+ (aref t2 0) (ftod (tref tup 2)))
+ (aref (aref-ptr (tref-ptr tup 1) 0) 1))))
+
+ (array-test5) 1) ;; val: 1 9 5.5
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Global Variables
+;;
+;; You can allocate global variables using bind-val
+;;
+
+(bind-val g_var_a i32 5)
+
+;; increment g_var_a by inc
+;; and return new value of g_var_a
+(xtmtest '(bind-func global_var_test1
+ (lambda (incr)
+ (set! g_var_a (+ g_var_a incr))
+ g_var_a))
+
+ (global_var_test1 3) 8) ;; 8
+
+;; you can bind any primitive type
+(bind-val g_var_b double 5.5)
+(bind-val g_var_c i1 0)
+
+(xtmtest '(bind-func global_var_test1b
+ (lambda ()
+ (* g_var_b (if g_var_c 1.0 4.0))))
+
+ (global_var_test1b) 22.0)
+
+;; global strings
+
+(bind-val g_cstring i8* "Jiblet.")
+
+(xtmtest '(bind-func test_g_cstring
+ (lambda ()
+ (let ((i 0))
+ (dotimes (i 7)
+ (printf "g_cstring[%lld] = %c\n" i (pref g_cstring i)))
+ (printf "\nSpells... %s\n" g_cstring))))
+
+ (test_g_cstring))
+
+(xtmtest '(bind-func test_g_cstring1
+ (lambda ()
+ (let ((test_cstring "Niblot.")
+ (i 0)
+ (total 0))
+ (dotimes (i 7)
+ (let ((c1 (pref g_cstring i))
+ (c2 (pref test_cstring i)))
+ (printf "checking %c against %c\n" c1 c2)
+ (if (= c1 c2)
+ (set! total (+ total 1)))))
+ total)))
+
+ (test_g_cstring1) 5)
+
+
+
+
+
+;; for tuples, arrays and vectors, bind-val only takes *two*
+;; arguments. The tuple/array/vector will be initialised to zero.
+
+(bind-val g_tuple1 <i64,i64>)
+(bind-val g_tuple2 <double,double>)
+
+(xtmtest '(bind-func test_g_tuple
+ (lambda ()
+ (tfill! g_tuple1 1 4)
+ (tfill! g_tuple2 4.0 1.0)
+ (and (= (tref g_tuple1 0) (dtoi64 (tref g_tuple2 1)))
+ (= (dtoi64 (tref g_tuple2 0)) (tref g_tuple1 1)))))
+
+ (test_g_tuple) 1)
+
+;; same thing with arrays
+
+(bind-val g_array1 |10,double|)
+(bind-val g_array2 |10,i64|)
+
+;; if we just loop over and print the values in each array
+
+(xtmtest '(bind-func test_g_array11
+ (lambda ()
+ (let ((i 0))
+ (dotimes (i 10)
+ (printf "garray_1[%lld] = %f garray_2[%lld] = %lld\n"
+ i (aref g_array1 i) i (aref g_array2 i))))))
+
+ (test_g_array11) 1)
+
+;; but if we loop over and set some values into the arrays
+
+(xtmtest '(bind-func test_g_array2
+ (lambda ()
+ (let ((i 0))
+ (dotimes (i 10)
+ (aset! g_array1 i (i64tod i))
+ (aset! g_array2 i i)
+ (printf "garray_1[%lld] = %f garray_2[%lld] = %lld\n"
+ i (aref g_array1 i) i (aref g_array2 i)))
+ (= (dtoi64 (aref g_array1 5))
+ (aref g_array2 5)))))
+
+ (test_g_array2) 1)
+
+;; just to test, let's try a large array
+
+(bind-val g_array3 |100000000,i64|)
+
+(xtmtest '(bind-func test_g_array3
+ (lambda ()
+ (let ((i 0))
+ (dotimes (i 100000000)
+ (aset! g_array3 i i))
+ (= (pref g_array3 87654321)
+ 87654321))))
+
+ (test_g_array3) 1)
+
+;; if you want to bind a global pointer, then the third 'value'
+;; argument is the size of the memory to allocate (in elements, not in bytes)
+
+(bind-val g_ptr0 double* 10)
+
+(xtmtest '(bind-func test_g_ptr0
+ (lambda ()
+ (let ((total 0.0)
+ (i 0))
+ (dotimes (i 10)
+ (pset! g_ptr0 i (i64tod i))
+ (set! total (+ total (pref g_ptr0 i))))
+ total)))
+
+ (test_g_ptr0) 45.0)
+
+(bind-val g_ptr1 |4,i32|* 2)
+(bind-val g_ptr2 <i64,double>* 4)
+
+(xtmtest '(bind-func test_g_ptr1
+ (lambda ()
+ (afill! g_ptr1 11 66 35 81)
+ (tset! g_ptr2 1 35.0)
+ (printf "%f :: %d\n" (tref g_ptr2 1) (aref g_ptr1 2))
+ (aref g_ptr1 3)))
+
+ (test_g_ptr1) 81) ;; should also print 35.000000 :: 35
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Callbacks
+
+(xtmtest '(bind-func callback-test
+ (lambda (time:i64 count:i64)
+ (printf "time: %lld:%lld\n" time count)
+ (callback (+ time 1000) callback-test (+ time 22050) (+ count 1))))
+
+ (callback-test (now) 0))
+
+;; compiling this will stop the callbacks
+;;
+;; of course we need to keep the type
+;; signature the same [void,i64,i64]*
+;;
+(xtmtest '(bind-func callback-test
+ (lambda (time:i64 count:i64)
+ #t))
+
+ (callback-test))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; some memzone tests
+
+(xtmtest '(bind-func memzone-test1
+ (lambda ()
+ (let ((b:|5,double|* (zalloc)))
+ (aset! b 0
+ (memzone 1024
+ (let ((a:|10,double|* (zalloc)))
+ (aset! a 0 3.5)
+ (aref a 0))))
+ (let ((c:|9,i32|* (zalloc)))
+ (aset! c 0 99)
+ (aref b 0)))))
+
+ (memzone-test1) 3.5)
+
+(xtmtest '(bind-func memzone-test2
+ (lambda ()
+ (memzone 1024
+ (let ((k:|15,double|* (zalloc))
+ (f (lambda (fa:|15,double|*)
+ (memzone 1024
+ (let ((a:|10,double|* (zalloc))
+ (i 0))
+ (dotimes (i 10)
+ (aset! a i (* (aref fa i) (random))))
+ a)))))
+ (f k)))))
+
+ (memzone-test2))
+
+(xtmtest '(bind-func memzone-test3
+ (lambda ()
+ (let ((v (memzone-test2))
+ (i 0))
+ (dotimes (i 10) (printf "%lld:%f\n" i (aref v i))))))
+
+ (memzone-test3)) ;; should print all 0.0's
+
+(xtmtest '(bind-func memzone-test4
+ (lambda ()
+ (memzone 1024 (* 44100 10)
+ (let ((a:|5,double|* (alloc)))
+ (aset! a 0 5.5)
+ (aref a 0)))))
+
+ (memzone-test4) 5.50000)
+
+;;
+;; Large allocation of memory on BUILD (i.e. when the closure is created)
+;; requires an optional argument (i.e. an amount of memory to allocate
+;; specifically for closure creation)
+;;
+;; This memory is automatically free'd whenever you recompile the closure
+;; (it will be destroyed and replaced by a new allocation of the
+;; same amount or whatever new amount you have allocated for closure
+;; compilation)
+;;
+(xtmtest '(bind-func closure-zalloc-test 1000000
+ (let ((k:|100000,double|* (zalloc)))
+ (lambda ()
+ (aset! k 0 1.0)
+ (aref k 0))))
+
+ (closure-zalloc-test 1000000))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Ad-Hoc Polymorphism
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; extempore supports ad-hoc polymorphism
+;; at some stage in the future this will
+;; be implicit - but for the moment
+;; it is explicitly defined using bind-poly
+
+;; ad-hoc polymorphism allows you to provide
+;; different specialisations depending on
+;; type. In other words, a single 'name'
+;; can be bound to multiple function
+;; implementations each with a uniqute
+;; type.
+
+
+;; poly variables can be for functions of
+;; mixed argument lengths
+;;
+;; so for example:
+(bind-func poly-test4
+ (lambda (a:i8*)
+ (printf "%s\n" a)))
+
+(bind-func poly-test5
+ (lambda (a:i8* b:i8*)
+ (printf "%s %s\n" a b)))
+
+(bind-func poly-test6
+ (lambda (a:i8* b:i8* c:i8*)
+ (printf "%s %s %s\n" a b c)))
+
+;; bind these three functions to poly 'print'
+(bind-poly testprint poly-test4)
+(bind-poly testprint poly-test5)
+(bind-poly testprint poly-test6)
+
+(xtmtest '(bind-func poly-test7
+ (lambda ()
+ (testprint "extempore's")
+ (testprint "extempore's" "polymorphism")
+ (testprint "extempore's" "polymorphism" "rocks")))
+
+ (poly-test7))
+
+;; polys can Also specialize
+;; on the return type
+(bind-func poly-test8
+ (lambda (a:double)
+ (* a a)))
+
+(bind-func poly-test9
+ (lambda (a:double)
+ (dtoi64 (* a a))))
+
+(bind-poly sqrd poly-test8)
+(bind-poly sqrd poly-test9)
+
+;; specialize on [i64,double]*
+;;
+(xtmtest '(bind-func poly-test10:[i64,double]*
+ (lambda (a)
+ (+ 1 (sqrd a))))
+ (poly-test10 5.0))
+
+;; specialize on [double,doube]*
+(xtmtest '(bind-func poly-test11:[double,double]*
+ (lambda (a)
+ (+ 1.0 (sqrd a))))
+
+ (poly-test11 5.0))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; a little test for zone cleanup
+;;
+(bind-func MyLittleCleanupTest
+ (lambda ()
+ (let ((tmp2:i8* (alloc 8)))
+ (cleanup (println "Clean up before leaving zone!"))
+ tmp2)))
+
+(xtmtest '(bind-func cleanup-test
+ (lambda ()
+ (letz ((tmp:i8* (alloc 8))
+ (t2 (MyLittleCleanupTest)))
+ (begin
+ (println "In Zone ...")
+ 1))
+ (println "Out of zone ...")
+ void))
+
+ (cleanup-test))
+
+;;;;;;;;;;;;;;;;;;
+;; vector types
+
+;; (bind-func vector-test1
+;; (lambda ()
+;; (let ((v1:/4,float/* (alloc))
+;; (v2:/4,float/* (alloc))
+;; (v3:/4,float/* (alloc)))
+;; (vfill! v1 4.0 3.0 2.0 1.0)
+;; (vfill! v2 1.0 2.0 3.0 4.0)
+;; (vfill! v3 5.0 5.0 5.0 5.0)
+;; (let ((v4 (* v1 v2))
+;; (v5 (> v3 v4))) ;; unforunately vector conditionals don't work!
+;; (printf "mul:%f:%f:%f:%f\n" (ftod (vref v4 0)) (ftod (vref v4 1)) (ftod (vref v4 2)) (ftod (vref v4 3)))
+;; (printf "cmp:%d:%d:%d:%d\n" (i1toi32 (vref v5 0)) (i1toi32 (vref v5 1)) (i1toi32 (vref v5 2)) (i1toi32 (vref v5 3)))
+;; void))))
+
+;; (test-xtfunc (vector-test1))
+
+(bind-func vector-test2
+ (lambda ()
+ (let ((v1:/4,float/* (alloc))
+ (v2:/4,float/* (alloc)))
+ (vfill! v1 1.0 2.0 4.0 8.0)
+ (vfill! v2 2.0 2.5 2.25 2.125)
+ (* v1 v2))))
+
+(xtmtest '(bind-func vector-test3
+ (lambda ()
+ (let ((a (vector-test2)))
+ (printf "%f:%f:%f:%f\n"
+ (ftod (vref a 0))
+ (ftod (vref a 1))
+ (ftod (vref a 2))
+ (ftod (vref a 3)))
+ void)))
+
+ (vector-test3))
+
+;; vectorised sine func
+(bind-func vsinf4
+ (let ((p:/4,float/* (alloc))
+ (b:/4,float/* (alloc))
+ (c:/4,float/* (alloc))
+ (f1:/4,float/* (alloc))
+ (f2:/4,float/* (alloc))
+ (i:i32 0)
+ (p_ 0.225)
+ (b_ (dtof (/ 4.0 3.1415)))
+ (c_ (dtof (/ -4.0 (* 3.1415 3.1415)))))
+ (dotimes (i 4) (vset! p i p_) (vset! b i b_) (vset! c i c_))
+ (lambda (x:/4,float/)
+ ;; no SIMD for abs yet!
+ (dotimes (i 4) (vset! f1 i (fabs (vref x i))))
+ (let ((y (+ (* b x) (* c x f1))))
+ ;; no SIMD for abs yet!
+ (dotimes (i 4) (vset! f2 i (fabs (vref y i))))
+ (+ (* p (- (* y f2) y)) y)))))
+
+(bind-func vcosf4
+ (let ((p:/4,float/* (alloc))
+ (b:/4,float/* (alloc))
+ (c:/4,float/* (alloc))
+ (d:/4,float/* (alloc))
+ (f1:/4,float/* (alloc))
+ (f2:/4,float/* (alloc))
+ (i:i32 0)
+ (p_ 0.225)
+ (d_ (dtof (/ 3.1415 2.0)))
+ (b_ (dtof (/ 4.0 3.1415)))
+ (c_ (dtof (/ -4.0 (* 3.1415 3.1415)))))
+ (dotimes (i 4)
+ (vset! p i p_) (vset! b i b_) (vset! c i c_) (vset! d i d_))
+ (lambda (x:/4,float/)
+ ;; offset x for cos
+ (set! x (+ x d))
+ ;; no SIMD for abs yet!
+ (dotimes (i 4) (vset! f1 i (fabs (vref x i))))
+ (let ((y (+ (* b x) (* c x f1))))
+ ;; no SIMD for abs yet!
+ (dotimes (i 4) (vset! f2 i (fabs (vref y i))))
+ (+ (* p (- (* y f2) y)) y)))))
+
+
+(xtmtest '(bind-func vector-test4
+ (lambda ()
+ (let ((a:/4,float/* (alloc)))
+ (vfill! a 0.1 0.2 0.3 0.4)
+ (let ((b (vsinf4 (pref a 0)))
+ (c (vcosf4 (pref a 0))))
+ (printf "precision inaccuracy is expected:\n")
+ (printf " sinf:\t%f,%f,%f,%f\n"
+ (ftod (sin 0.1:f))
+ (ftod (sin 0.2:f))
+ (ftod (sin 0.3:f))
+ (ftod (sin 0.4:f)))
+ (printf "vsinf:\t%f,%f,%f,%f\n"
+ (ftod (vref b 0))
+ (ftod (vref b 1))
+ (ftod (vref b 2))
+ (ftod (vref b 3)))
+ (printf " cosf:\t%f,%f,%f,%f\n"
+ (ftod (cos 0.1:f))
+ (ftod (cos 0.2:f))
+ (ftod (cos 0.3:f))
+ (ftod (cos 0.4:f)))
+ (printf "vcosf:\t%f,%f,%f,%f\n"
+ (ftod (vref c 0))
+ (ftod (vref c 1))
+ (ftod (vref c 2))
+ (ftod (vref c 3)))
+ void))))
+
+ (vector-test4))
+
+;; test the call-as-xtlang macro
+
+;; make sure it'll handle multiple body forms
+(xtmtest-result (call-as-xtlang (println 1) (println 2) 5)
+ 5)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; test globalvar as closure
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(bind-func testinc
+ (lambda (incr:i64)
+ (lambda (x:i64)
+ (+ x incr))))
+
+(bind-val GlobalInc [i64,i64]* (testinc 2))
+
+(xtmtest '(bind-func ginc
+ (lambda ()
+ (GlobalInc 5)))
+ (ginc) 7)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; syntax highlighting tests ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; these don't return any values, they're visual tests---do they look
+;; right?
+
+(bind-func hl_test1a:[i32,double,|4,i32|**]* 4000
+ "docstring"
+ (lambda (a b)
+ (printf "done\n")))
+
+(bind-func hl_test1b:[i32]*
+ (lambda ()
+ (let ((i:i32 6))
+ (printf "done\n"))))
+
+(bind-val hl_test2 <i32,i32>)
+(bind-val hl_test3 |4,i8|)
+(bind-val hl_test4 double* 10)
+(bind-val hl_test5 i8* "teststr")
+
+(bind-type hl_test_type <i64>)
+
+(println '(bind-lib testlib testfn [i32,i32]*))
+
+;; (and 4 5)
+;; (bind-val hl_test4 double* 10)
+;; (bind-type hl_test_type <i64> "docstring")
+;; (bind-lib testlib testfn [i32,i32]*)
diff --git a/tests/examplefiles/example2.cpp b/tests/examplefiles/example2.cpp
new file mode 100644
index 00000000..ccd99383
--- /dev/null
+++ b/tests/examplefiles/example2.cpp
@@ -0,0 +1,20 @@
+/*
+ * A Test file for the different string literals.
+ */
+
+#include <iostream>
+
+int main() {
+ char *_str = "a normal string";
+ wchar_t *L_str = L"a wide string";
+ char *u8_str = u8"utf-8 string";
+ char16_t *u_str = u"utf-16 string";
+ char32_t *U_str = U"utf-32 string";
+ char *R_str = R""""(raw string with
+"""
+as a delimiter)"""";
+
+ std::cout << R_str << std::endl;
+
+ return 0;
+}
diff --git a/tests/examplefiles/flatline_example b/tests/examplefiles/flatline_example
new file mode 100644
index 00000000..5ea73408
--- /dev/null
+++ b/tests/examplefiles/flatline_example
@@ -0,0 +1,186 @@
+(field "another field" 2)
+(f "000001" -2)
+
+(missing? "a field" 23)
+
+(random-value "age")
+(weighted-random-value "000001")
+
+(if (missing? "00000") (random-value "000000") (f "000000"))
+
+(ensure-value "000000")
+(ensure-weighted-value "000000")
+
+(normalize "000001")
+(normalize "length" 8 23)
+
+(z-score "a numeric field")
+(z-score 23)
+
+(field-prop string "00023" name)
+(field-prop numeric "00023" summary missing_count)
+
+(category-count "species" "Iris-versicolor")
+(category-count "species" (f "000004"))
+(bin-count "age" (f "bin-selector"))
+(bin-center "000003" 3)
+(bin-center (field "field-selector") 4)
+
+(let (v (f "age"))
+ (cond (< v 2) "baby"
+ (< v 10) "child"
+ (< v 20) "teenager"
+ "adult"))
+
+(segment-label "000000" "baby" 2 "child" 10 "teenager" 20 "adult")
+(segment-label 0 "1st fourth" "2nd fourth" "3rd fourth" "4th fourth")
+
+(let (max (maximum 0)
+ min (minimum 0)
+ step (/ (- max min) 4))
+ (segment-label 0 "1st fourth" (+ min step)
+ "2nd fourth" (+ min step step)
+ "3rd fourth" (+ min step step step)
+ "4th fourth"))
+
+(contains-items? "000000" "blue" "green" "darkblue")
+
+(<= (percentile "age" 0.5) (f "age") (percentile "age" 0.95))
+
+(within-percentiles? "age" 0.5 0.95)
+
+(percentile-label "000023" "1st" "2nd" "3rd" "4th")
+
+(cond (within-percentiles? "000023" 0 0.25) "1st"
+ (within-percentiles? "000023" 0.25 0.5) "2nd"
+ (within-percentiles? "000023" 0.5 0.75) "3rd"
+ "4th")
+
+(str 1 "hello " (field "a"))
+(str "value_" (+ 3 4) "/" (name "000001"))
+
+(length "abc")
+(length "")
+
+(levenshtein (f 0) "a random string")
+(if (< (levenshtein (f 0) "bluething") 5) "bluething" (f 0))
+
+(occurrences "howdy woman, howdy" "howdy")
+(occurrences "howdy woman" "Man" true)
+(occurrences "howdy man" "Man" true)
+(occurrences "hola, Holas" "hola" true "es")
+
+(md5 "a text")
+(sha1 "a text")
+(sha256 "")
+
+(matches? (field "name") ".*\\sHal\\s.*")
+(matches? (field "name") "(?i).*\\shal\\s.*")
+
+(if (matches? (f "result") (re-quote (f "target"))) "GOOD" "MISS")
+(matches? (f "name") (str "^" (re-quote (f "salutation")) "\\s *$"))
+
+(replace "Almost Pig Latin" "\\b(\\w)(\\w+)\\b" "$2$1ay")
+(replace-first "swap first two words" "(\\w+)(\\s+)(\\w+)" "$3$2$1")
+
+(language "this is an English phrase")
+
+(< (field 0) (field 1))
+(<= (field 0 -1) (field 0) (field 0 1))
+(> (field "date") "07-14-1969")
+(>= 23 (f "000004" -2))
+
+(= "Dante" (field "Author"))
+(= 1300 (field "Year"))
+(= (field "Year" -2) (field "Year" -1) (field "Year"))
+(!= (field "00033" -1) (field "00033" 1))
+
+(and (= 3 (field 1)) (= "meh" (f "a")) (< (f "pregnancies") 5))
+(not true)
+
+(linear-regression 1 1 2 2 3 3 4 4)
+(linear-regression 2.0 3.1 2.3 3.3 24.3 45.2)
+
+(epoch-fields (f "milliseconds"))
+(epoch-year (* 1000 (f "seconds")))
+
+(/ (f "a-datetime-string") 1000)
+(/ (epoch (f "a-datetime-string")) 1000)
+
+(epoch-fields (epoch "1969-14-07T06:00:12"))
+(epoch-hour (epoch "11~22~30" "hh~mm~ss"))
+
+(let (x (+ (window "a" -10 10))
+ a (/ (* x 3) 4.34)
+ y (if (< a 10) "Good" "Bad"))
+ (list x (str (f 10) "-" y) a y))
+
+(list (let (z (f 0)) (* 2 (* z z) (log z)))
+ (let (pi 3.141592653589793 r (f "radius")) (* 4 pi r r)))
+
+(if (< (field "age") 18) "non-adult" "adult")
+
+(if (= "oh" (field "000000")) "OH")
+
+(if (> (field "000001") (mean "000001"))
+ "above average"
+ (if (< (field "000001") (mean "000001"))
+ "below average"
+ "mediocre"))
+
+(cond (> (f "000001") (mean "000001")) "above average"
+ (= (f "000001") (mean "000001")) "below average"
+ "mediocre")
+
+(cond (or (= "a" (f 0)) (= "a+" (f 0))) 1
+ (or (= "b" (f 0)) (= "b+" (f 0))) 0
+ (or (= "c" (f 0)) (= "c+" (f 0))) -1)
+
+(cond (< (f "age") 2) "baby"
+ (and (<= 2 (f "age") 10) (= "F" (f "sex"))) "girl"
+ (and (<= 2 (f "age") 10) (= "M" (f "sex"))) "boy"
+ (< 10 (f "age") 20) "teenager"
+ "adult")
+
+(list (field "age")
+ (field "weight" -1)
+ (population "age"))
+
+(list 1.23
+ (if (< (field "age") 10) "child" "adult")
+ (field 3))
+
+(head (cons x lst))
+(tail (cons x lst))
+
+(count (list (f 1) (f 2)))
+(mode (list a b b c b a c c c))
+(max (list -1 2 -2 0.38))
+(min (list -1.3 2 1))
+(avg (list -1 -2 1 2 0.8 -0.8))
+
+(in 3 (1 2 3 2))
+(in "abc" (1 2 3))
+(in (f "size") ("X" "XXL"))
+
+(< _ 3)
+(+ (f "000001" _) 3)
+(< -18 _ (f 3))
+
+(map (* 2 _) (list (f 0 -1) (f 0) (f 0 1)))
+
+(all-but "id" "000023")
+(fields "000003" 3 "a field" "another" "0002a3b-3")
+
+(all-with-defaults "species" "Iris-versicolor"
+ "petal-width" 2.8
+ "000002" 0)
+
+(all-with-numeric-default "median")
+(all-with-numeric-default 0)
+
+(window "000001" -1 2)
+(filter (< _ 99.9) (map (+ 32 (* 1.8 _)) (window "Temp" -2 0)))
+
+(let (now (f "epoch"))
+ (avg (cond-window "temperature" (< (- (f "epoch") now) 240))))
diff --git a/tests/examplefiles/postgresql_test.txt b/tests/examplefiles/postgresql_test.txt
index 190d184f..28db5ee3 100644
--- a/tests/examplefiles/postgresql_test.txt
+++ b/tests/examplefiles/postgresql_test.txt
@@ -45,3 +45,37 @@ $$;
SELECT U&'\0441\043B\043E\043D'
FROM U&"\0441\043B\043E\043D";
+-- Escapes
+SELECT E'1\n2\n3';
+
+-- DO example from postgresql documentation
+/*
+ * PostgreSQL is Copyright © 1996-2016 by the PostgreSQL Global Development Group.
+ *
+ * Postgres95 is Copyright © 1994-5 by the Regents of the University of California.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose, without fee, and without a written agreement
+ * is hereby granted, provided that the above copyright notice and this paragraph
+ * and the following two paragraphs appear in all copies.
+ *
+ * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
+ * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
+ * EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS-IS" BASIS,
+ * AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE,
+ * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ */
+DO $$DECLARE r record;
+BEGIN
+ FOR r IN SELECT table_schema, table_name FROM information_schema.tables
+ WHERE table_type = 'VIEW' AND table_schema = 'public'
+ LOOP
+ EXECUTE 'GRANT ALL ON ' || quote_ident(r.table_schema) || '.' || quote_ident(r.table_name) || ' TO webuser';
+ END LOOP;
+END$$;
diff --git a/tests/examplefiles/test.erl b/tests/examplefiles/test.erl
index 5b983e75..d4ab4825 100644
--- a/tests/examplefiles/test.erl
+++ b/tests/examplefiles/test.erl
@@ -152,6 +152,18 @@ a_binary() ->
a_list_comprehension() ->
[X*2 || X <- [1,2,3]].
+a_map() ->
+ M0 = #{ a => 1, b => 2 },
+ M1 = M0#{ b := 200 }.
+
+escape_sequences() ->
+ [ "\b\d\e\f\n\r\s\t\v\'\"\\"
+ , "\1\12\123" % octal
+ , "\x01" % short hex
+ , "\x{fff}" % long hex
+ , "\^a\^A" % control characters
+ ].
+
map(Fun, [H|T]) ->
[Fun(H) | map(Fun, T)];
diff --git a/tests/examplefiles/test.escript b/tests/examplefiles/test.escript
new file mode 100644
index 00000000..3fafb803
--- /dev/null
+++ b/tests/examplefiles/test.escript
@@ -0,0 +1,4 @@
+#!/usr/bin/env escript
+
+main(_Args) ->
+ ok.
diff --git a/tests/examplefiles/test.hsail b/tests/examplefiles/test.hsail
new file mode 100644
index 00000000..f9c25091
--- /dev/null
+++ b/tests/examplefiles/test.hsail
@@ -0,0 +1,62 @@
+module &__llvm_hsail_module:1:0:$full:$large:$near;
+
+prog kernel &mmul2d(
+ kernarg_u64 %__arg_p0,
+ kernarg_u64 %__arg_p1,
+ kernarg_u64 %__arg_p2,
+ kernarg_u64 %__arg_p3)
+{
+ pragma "AMD RTI", "ARGSTART:mmul2d";
+ pragma "AMD RTI", "version:3:1:104";
+ pragma "AMD RTI", "device:generic";
+ pragma "AMD RTI", "uniqueid:1025";
+ pragma "AMD RTI", "function:1:0";
+ pragma "AMD RTI", "memory:64bitABI";
+ pragma "AMD RTI", "privateid:1";
+ pragma "AMD RTI", "ARGEND:mmul2d";
+ // BB#0: // %top
+ mov_f64 $d1, 0.0E+0;
+ gridsize_u32 $s0, 0;
+ workitemabsid_u32 $s1, 1;
+ workitemabsid_u32 $s2, 0;
+ cvt_u64_u32 $d0, $s2;
+ cvt_u64_u32 $d3, $s1;
+ cvt_u64_u32 $d4, $s0;
+ ld_kernarg_align(8)_width(all)_u64 $d2, [%__arg_p2];
+ ld_kernarg_align(8)_width(all)_u64 $d6, [%__arg_p1];
+ ld_kernarg_align(8)_width(all)_u64 $d5, [%__arg_p3];
+ ld_kernarg_align(8)_width(all)_u64 $d7, [%__arg_p0];
+ cmp_lt_b1_s64 $c0, $d5, 1;
+ cbr_b1 $c0, @BB0_3;
+ // BB#1: // %L.preheader
+ mul_u64 $d1, $d5, $d3;
+ shl_u64 $d1, $d1, 3;
+ shl_u64 $d8, $d0, 3;
+ add_u64 $d8, $d7, $d8;
+ add_u64 $d6, $d6, $d1;
+ shl_u64 $d7, $d4, 3;
+ mov_f64 $d1, 0D0000000000000000;
+
+@BB0_2:
+ // %L
+ add_u64 $d9, $d8, $d7;
+ ld_global_f64 $d8, [$d8];
+ ld_global_f64 $d10, [$d6];
+ mul_f64 $d8, $d8, $d10;
+ add_f64 $d1, $d1, $d8;
+ add_u64 $d6, $d6, 8;
+ add_u64 $d5, $d5, 18446744073709551615;
+ cmp_ne_b1_s64 $c0, $d5, 0;
+ mov_b64 $d8, $d9;
+ cbr_b1 $c0, @BB0_2;
+
+@BB0_3:
+ // %L.7
+ mul_u64 $d3, $d3, $d4;
+ add_u64 $d0, $d3, $d0;
+ shl_u64 $d0, $d0, 3;
+ add_u64 $d0, $d2, $d0;
+ st_global_f64 $d1, [$d0];
+ ret;
+};
+
diff --git a/tests/examplefiles/test.ncl b/tests/examplefiles/test.ncl
new file mode 100644
index 00000000..f20f8159
--- /dev/null
+++ b/tests/examplefiles/test.ncl
@@ -0,0 +1,20 @@
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
+begin
+ int_num = 1
+ float_num = 0.1
+ str = "A void map"
+ array = (/1, 2, 3, 4, 5/)
+
+
+ wks = gsn_open_wks("X11", "test_for_pygments")
+
+ res = True
+ res@mpMinLonF = 90.
+ res@mpMaxLonF = 180.
+ res@mpMinLatF = 0.
+ res@mpMaxLatF = 90.
+
+ plot = gsn_csm_map_ce(wks, res)
+end \ No newline at end of file
diff --git a/tests/examplefiles/test.php b/tests/examplefiles/test.php
index 2ce4023e..e8efdc6a 100644
--- a/tests/examplefiles/test.php
+++ b/tests/examplefiles/test.php
@@ -505,11 +505,40 @@ function &byref() {
return $x;
}
+// Test highlighting of magic methods and variables
+class MagicClass {
+ public $magic_str;
+ public $ordinary_str;
+
+ public function __construct($some_var) {
+ $this->magic_str = __FILE__;
+ $this->ordinary_str = $some_var;
+ }
+
+ public function __toString() {
+ return $this->magic_str;
+ }
+
+ public function nonMagic() {
+ return $this->ordinary_str;
+ }
+}
+
+$magic = new MagicClass(__DIR__);
+__toString();
+$magic->nonMagic();
+$magic->__toString();
+
echo <<<EOF
Test the heredocs...
EOF;
+echo <<<"some_delimiter"
+more heredoc testing
+continues on this line
+some_delimiter;
+
?>
diff --git a/tests/examplefiles/test.sil b/tests/examplefiles/test.sil
new file mode 100644
index 00000000..3bcee835
--- /dev/null
+++ b/tests/examplefiles/test.sil
@@ -0,0 +1,206 @@
+domain Option__Node {
+ unique function Option__Node__Some(): Option__Node
+ unique function Option__Node__None(): Option__Node
+
+ function variantOfOptionNode(self: Ref): Option__Node
+
+ function isOptionNode(self: Ref): Bool
+
+ axiom ax_variantOfOptionNodeChoices {
+ forall x: Ref :: { variantOfOptionNode(x) }
+ (variantOfOptionNode(x) == Option__Node__Some() || variantOfOptionNode(x) == Option__Node__None())
+ }
+
+ axiom ax_isCounterState {
+ forall x: Ref :: { variantOfOptionNode(x) }
+ isOptionNode(x) == (variantOfOptionNode(x) == Option__Node__Some() ||
+ variantOfOptionNode(x) == Option__Node__None())
+ }
+}
+
+predicate validOption(this: Ref) {
+ isOptionNode(this) &&
+ variantOfOptionNode(this) == Option__Node__Some() ==> (
+ acc(this.Option__Node__Some__1, write) &&
+ acc(validNode(this.Option__Node__Some__1))
+ )
+}
+
+field Option__Node__Some__1: Ref
+
+field Node__v: Int
+field Node__next: Ref
+
+predicate validNode(this: Ref) {
+ acc(this.Node__v) &&
+ acc(this.Node__next) &&
+ acc(validOption(this.Node__next))
+}
+
+
+function length(this: Ref): Int
+ requires acc(validNode(this), write)
+ ensures result >= 1
+{
+ (unfolding acc(validNode(this), write) in
+ unfolding acc(validOption(this.Node__next)) in
+ (variantOfOptionNode(this.Node__next) == Option__Node__None()) ?
+ 1 : 1 + length(this.Node__next.Option__Node__Some__1)
+ )
+}
+
+function itemAt(this: Ref, i: Int): Int
+ requires acc(validNode(this), write)
+ requires 0 <= i && i < length(this)
+{
+ unfolding acc(validNode(this), write) in unfolding acc(validOption(this.Node__next)) in (
+ (i == 0) ?
+ this.Node__v:
+ (variantOfOptionNode(this.Node__next) == Option__Node__Some()) ?
+ itemAt(this.Node__next.Option__Node__Some__1, i-1) : this.Node__v
+ )
+}
+
+function sum(this$1: Ref): Int
+ requires acc(validNode(this$1), write)
+{
+ (unfolding acc(validNode(this$1), write) in unfolding acc(validOption(this$1.Node__next)) in
+ (variantOfOptionNode(this$1.Node__next) == Option__Node__None()) ? this$1.Node__v : this$1.Node__v + sum(this$1.Node__next.Option__Node__Some__1))
+}
+
+method append(this: Ref, val: Int)
+ requires acc(validNode(this), write)
+ ensures acc(validNode(this), write) /* POST1 */
+ ensures length(this) == (old(length(this)) + 1) /* POST2 */
+ ensures (forall i: Int :: (0 <= i && i < old(length(this))) ==> (itemAt(this, i) == old(itemAt(this, i)))) /* POST3 */
+ ensures itemAt(this, length(this) - 1) == val /* POST4 */
+ ensures true ==> true
+{
+ var tmp_node: Ref
+ var tmp_option: Ref
+
+ unfold acc(validNode(this), write)
+ unfold acc(validOption(this.Node__next), write)
+
+ if (variantOfOptionNode(this.Node__next) == Option__Node__None()) {
+ tmp_node := new(Node__next, Node__v)
+ tmp_node.Node__next := null
+ tmp_node.Node__v := val
+
+ assume variantOfOptionNode(tmp_node.Node__next) == Option__Node__None()
+ fold acc(validOption(tmp_node.Node__next))
+ fold acc(validNode(tmp_node), write)
+
+ tmp_option := new(Option__Node__Some__1)
+ tmp_option.Option__Node__Some__1 := tmp_node
+ assume variantOfOptionNode(tmp_option) == Option__Node__Some()
+ fold acc(validOption(tmp_option))
+
+ this.Node__next := tmp_option
+
+
+ unfold validOption(tmp_option)
+ assert length(tmp_node) == 1 /* TODO: Required by Silicon, POST2 fails otherwise */
+ assert itemAt(tmp_node, 0) == val /* TODO: Required by Silicon, POST4 fails otherwise */
+ fold validOption(tmp_option)
+ } else {
+ append(this.Node__next.Option__Node__Some__1, val)
+ fold acc(validOption(this.Node__next), write)
+ }
+
+ fold acc(validNode(this), write)
+}
+
+method prepend(tail: Ref, val: Int) returns (res: Ref)
+ requires acc(validNode(tail))
+ ensures acc(validNode(res))
+ //ensures acc(validNode(tail))
+ ensures length(res) == old(length(tail)) + 1
+
+ ensures (forall i: Int :: (1 <= i && i < length(res)) ==> (itemAt(res, i) == old(itemAt(tail, i-1)))) /* POST3 */
+ ensures itemAt(res, 0) == val
+{
+ var tmp_option: Ref
+
+ res := new(Node__v, Node__next)
+ res.Node__v := val
+
+ tmp_option := new(Option__Node__Some__1)
+ tmp_option.Option__Node__Some__1 := tail
+ assume variantOfOptionNode(tmp_option) == Option__Node__Some()
+
+ res.Node__next := tmp_option
+
+ assert acc(validNode(tail))
+ fold acc(validOption(res.Node__next))
+ fold acc(validNode(res))
+}
+
+method length_iter(list: Ref) returns (len: Int)
+ requires acc(validNode(list), write)
+ ensures old(length(list)) == len
+ // TODO we have to preserve this property
+ // ensures acc(validNode(list))
+{
+ var curr: Ref := list
+ var tmp: Ref := list
+
+ len := 1
+
+ unfold acc(validNode(curr))
+ unfold acc(validOption(curr.Node__next))
+ while(variantOfOptionNode(curr.Node__next) == Option__Node__Some())
+ invariant acc(curr.Node__v)
+ invariant acc(curr.Node__next)
+ invariant (variantOfOptionNode(curr.Node__next) == Option__Node__Some() ==> (
+ acc(curr.Node__next.Option__Node__Some__1, write) &&
+ acc(validNode(curr.Node__next.Option__Node__Some__1))
+ ))
+ invariant (variantOfOptionNode(curr.Node__next) == Option__Node__Some() ==> len + length(curr.Node__next.Option__Node__Some__1) == old(length(list)))
+ invariant (variantOfOptionNode(curr.Node__next) == Option__Node__None() ==> len == old(length(list)))
+ {
+ assert acc(validNode(curr.Node__next.Option__Node__Some__1))
+ len := len + 1
+ tmp := curr
+ curr := curr.Node__next.Option__Node__Some__1
+ unfold acc(validNode(curr))
+ unfold acc(validOption(curr.Node__next))
+ }
+}
+
+method t1()
+{
+ var l: Ref
+
+ l := new(Node__v, Node__next)
+ l.Node__next := null
+ l.Node__v := 1
+ assume variantOfOptionNode(l.Node__next) == Option__Node__None()
+
+ fold validOption(l.Node__next)
+ fold validNode(l)
+
+ assert length(l) == 1
+ assert itemAt(l, 0) == 1
+
+ append(l, 7)
+ assert itemAt(l, 1) == 7
+ assert itemAt(l, 0) == 1
+ assert length(l) == 2
+
+ l := prepend(l, 10)
+ assert itemAt(l, 2) == 7
+ assert itemAt(l, 1) == 1
+ assert itemAt(l, 0) == 10
+ assert length(l) == 3
+
+ //assert sum(l) == 18
+}
+
+method t2(l: Ref) returns (res: Ref)
+ requires acc(validNode(l), write)
+ ensures acc(validNode(res), write)
+ ensures length(res) > old(length(l))
+{
+ res := prepend(l, 10)
+}
diff --git a/tests/examplefiles/example.ts b/tests/examplefiles/typescript_example
index 760e2543..760e2543 100644
--- a/tests/examplefiles/example.ts
+++ b/tests/examplefiles/typescript_example
diff --git a/tests/examplefiles/typoscript_example b/tests/examplefiles/typoscript_example
new file mode 100644
index 00000000..e2fccf5d
--- /dev/null
+++ b/tests/examplefiles/typoscript_example
@@ -0,0 +1,1930 @@
+# ***************************************************************************
+# Notice: "styles." (and "temp.") objects are UNSET after template parsing!
+# Use "lib." for persisting storage of objects.
+# ***************************************************************************
+
+<INCLUDE_TYPOSCRIPT: source="FILE: EXT:www_tue_nl/Configuration/TypoScript/Setup/Root.ts">
+
+page.80 = RECORDS
+page.80 {
+ source = 1
+ tables = tt_address
+ conf.tt_address = COA
+ conf.tt_address {
+ 20 = TEXT
+ 20.field = email
+ 20.typolink.parameter.field = email
+ }
+}
+
+ /*
+page.200 = PHP_SCRIPT_EXT
+page.200 {
+ 1 = TMENU
+ 1.wrap = <div style="width:200px; border: 1px solid;">|</div>
+ 1.expAll = 1
+ 1.submenuObjSuffixes = a |*| |*| b
+ 1.NO.allWrap = <b>|</b><br/>
+
+ 2 = TMENU
+ 2.NO.allWrap = <div style="background:red;">|</div>
+
+ 2a = TMENU
+ 2a.NO.allWrap = <div style="background:yellow;">|</div>
+*
+ 2b = TMENU
+ 2b.NO.allWrap = <div style="background:green;">|</div>
+}
+*/
+
+ # Add the CSS and JS files
+page {
+ includeCSS { # comment at the end of a line
+ file99 = fileadmin/your-fancybox.css
+ }
+ includeJSFooter {
+ fancybox = fileadmin/your-fancybox.js
+ }
+}
+
+ # Change the default rendering of images to match lightbox requirements
+tt_content.image.20.1.imageLinkWrap {
+ JSwindow = 0
+ test = MyExtension\Path\To\Class
+
+ directImageLink = 1
+ linkParams.ATagParams {
+ dataWrap = class= "lightbox" rel="fancybox{field:uid}"
+ }
+}
+
+tt_content.image.20.1.imageLinkWrap >
+tt_content.image.20.1.imageLinkWrap = 1
+tt_content.image.20.1.imageLinkWrap {
+ enable = 1
+ typolink {
+ # directly link to the recent image
+ parameter.cObject = IMG_RESOURCE
+ parameter.cObject.file.import.data = TSFE:lastImageInfo|origFile
+ parameter.cObject.file.maxW = {$styles.content.imgtext.maxW}
+ parameter.override.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT
+ title.field = imagecaption // title
+ title.split.token.char = 10
+ title.if.isTrue.field = imagecaption // header
+ title.split.token.char = 10
+ title.split.returnKey.data = register : IMAGE_NUM_CURRENT
+ parameter.cObject = IMG_RESOURCE
+ parameter.cObject.file.import.data = TSFE:lastImageInfo|origFile
+ ATagParams = target="_blank"
+ }
+}
+
+10 = IMAGE
+10 {
+ # point to the image
+ file = fileadmin/demo/lorem_ipsum/images/a4.jpg
+ # make it rather small
+ file.width = 80
+ # add a link to tx_cms_showpic.php that shows the original image
+ imageLinkWrap = 1
+ imageLinkWrap {
+ enable = 1
+ # JSwindow = 1
+ }
+}
+
+# Clear out any constants in this reserved room!
+styles.content >
+
+# get content
+styles.content.get = CONTENT
+styles.content.get {
+ table = tt_content
+ select.orderBy = sorting
+ select.where = colPos=0
+ select.languageField = sys_language_uid
+}
+
+# get content, left
+styles.content.getLeft < styles.content.get
+styles.content.getLeft.select.where = colPos=1
+
+# get content, right
+styles.content.getRight < styles.content.get
+styles.content.getRight.select.where = colPos=2
+
+# get content, margin
+styles.content.getBorder < styles.content.get
+styles.content.getBorder.select.where = colPos=3
+
+# get news
+styles.content.getNews < styles.content.get
+styles.content.getNews.select.pidInList = {$styles.content.getNews.newsPid}
+
+# Edit page object:
+styles.content.editPanelPage = COA
+styles.content.editPanelPage {
+ 10 = EDITPANEL
+ 10 {
+ allow = toolbar,move,hide
+ label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.page
+ label.wrap = |&nbsp;<b>%s</b>
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+# *********************************************************************
+# "lib." objects are preserved from unsetting after template parsing
+# *********************************************************************
+
+# Creates persistent ParseFunc setup for non-HTML content. This is recommended to use (as a reference!)
+lib.parseFunc {
+ makelinks = 1
+ makelinks.http.keep = {$styles.content.links.keep}
+ makelinks.http.extTarget = {$styles.content.links.extTarget}
+ makelinks.mailto.keep = path
+ tags {
+ link = TEXT
+ link {
+ current = 1
+ typolink.parameter.data = parameters : allParams
+ typolink.extTarget = {$styles.content.links.extTarget}
+ typolink.target = {$styles.content.links.target}
+ parseFunc.constants =1
+ }
+ }
+ allowTags = {$styles.content.links.allowTags}
+ denyTags = *
+ sword = <span class="csc-sword">|</span>
+ constants = 1
+
+ nonTypoTagStdWrap.HTMLparser = 1
+ nonTypoTagStdWrap.HTMLparser {
+ keepNonMatchedTags = 1
+ htmlSpecialChars = 2
+ }
+}
+
+# good old parsefunc in "styles.content.parseFunc" is created for backwards compatibility. Don't use it, just ignore.
+styles.content.parseFunc < lib.parseFunc
+
+# Creates persistent ParseFunc setup for RTE content (which is mainly HTML) based on the "ts_css" transformation.
+lib.parseFunc_RTE < lib.parseFunc
+lib.parseFunc_RTE {
+ // makelinks >
+ # Processing <table> and <blockquote> blocks separately
+ externalBlocks = table, blockquote, dd, dl, ol, ul, div
+ externalBlocks {
+ # The blockquote content is passed into parseFunc again...
+ blockquote.stripNL=1
+ blockquote.callRecursive=1
+ blockquote.callRecursive.tagStdWrap.HTMLparser = 1
+ blockquote.callRecursive.tagStdWrap.HTMLparser.tags.blockquote.overrideAttribs = style="margin-bottom:0;margin-top:0;"
+
+ ol.stripNL=1
+ ol.stdWrap.parseFunc = < lib.parseFunc
+
+ ul.stripNL=1
+ ul.stdWrap.parseFunc = < lib.parseFunc
+
+ table.stripNL=1
+ table.stdWrap.HTMLparser = 1
+ table.stdWrap.HTMLparser.tags.table.fixAttrib.class {
+ default = contenttable
+ always = 1
+ list = contenttable
+ }
+ table.stdWrap.HTMLparser.keepNonMatchedTags = 1
+ table.HTMLtableCells=1
+ table.HTMLtableCells {
+ default.callRecursive=1
+ addChr10BetweenParagraphs=1
+ }
+ div.stripNL = 1
+ div.callRecursive = 1
+
+ # Definition list processing
+ dl < .div
+ dd < .div
+ }
+ nonTypoTagStdWrap.encapsLines {
+ encapsTagList = p,pre,h1,h2,h3,h4,h5,h6,hr,dt
+ remapTag.DIV = P
+ nonWrappedTag = P
+ innerStdWrap_all.ifBlank = &nbsp;
+ addAttributes.P.class = bodytext
+ addAttributes.P.class.setOnly=blank
+ }
+ nonTypoTagStdWrap.HTMLparser = 1
+ nonTypoTagStdWrap.HTMLparser {
+ keepNonMatchedTags = 1
+ htmlSpecialChars = 2
+ }
+}
+
+
+# Content header:
+lib.stdheader = COA
+lib.stdheader {
+
+ # Create align style-attribute for <Hx> tags
+ 2 = LOAD_REGISTER
+ 2.headerStyle.field = header_position
+ 2.headerStyle.required = 1
+ 2.headerStyle.noTrimWrap = | style="text-align:|;"|
+
+ # Create class="csc-firstHeader" attribute for <Hx> tags
+ 3 = LOAD_REGISTER
+ 3.headerClass = csc-firstHeader
+ 3.headerClass.if.value=1
+ 3.headerClass.if.equals.data = cObj:parentRecordNumber
+ 3.headerClass.noTrimWrap = | class="|"|
+
+ # Date format:
+ 5 = TEXT
+ 5.field = date
+ 5.if.isTrue.field = date
+ 5.strftime = %x
+ 5.wrap = <p class="csc-header-date">|</p>
+ 5.prefixComment = 2 | Header date:
+
+ # This CASE cObject renders the header content:
+ # currentValue is set to the header data, possibly wrapped in link-tags.
+ 10 = CASE
+ 10.setCurrent {
+ field = header
+ htmlSpecialChars = 1
+ typolink.parameter.field = header_link
+ }
+ 10.key.field = header_layout
+ 10.key.ifEmpty = {$content.defaultHeaderType}
+ 10.key.ifEmpty.override.data = register: defaultHeaderType
+
+ 10.1 = TEXT
+ 10.1.current = 1
+ 10.1.dataWrap = <h1{register:headerStyle}{register:headerClass}>|</h1>
+
+ 10.2 < .10.1
+ 10.2.dataWrap = <h2{register:headerStyle}{register:headerClass}>|</h2>
+
+ 10.3 < .10.1
+ 10.3.dataWrap = <h3{register:headerStyle}{register:headerClass}>|</h3>
+
+ 10.4 < .10.1
+ 10.4.dataWrap = <h4{register:headerStyle}{register:headerClass}>|</h4>
+
+ 10.5 < .10.1
+ 10.5.dataWrap = <h5{register:headerStyle}{register:headerClass}>|</h5>
+
+ # Pops the used registers off the stack:
+ 98 = RESTORE_REGISTER
+ 99 = RESTORE_REGISTER
+
+ # Post-processing:
+ stdWrap.fieldRequired = header
+ stdWrap.if {
+ equals.field = header_layout
+ value = 100
+ negate = 1
+ }
+
+ stdWrap.editIcons = tt_content : header, [header_layout | header_position], [header_link|date]
+ stdWrap.editIcons.beforeLastTag = 1
+ stdWrap.editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.header
+
+ stdWrap.dataWrap = <div class="csc-header csc-header-n{cObj:parentRecordNumber}">|</div>
+ stdWrap.prefixComment = 2 | Header:
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#******************************************************
+# Including library for processing of some elements:
+#******************************************************
+includeLibs.tx_cssstyledcontent_pi1 = EXT:css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php
+
+
+#**********************************
+# tt_content is started
+#**********************************
+tt_content >
+tt_content = CASE
+tt_content.key.field = CType
+tt_content.stdWrap {
+ innerWrap.cObject = CASE
+ innerWrap.cObject {
+ key.field = section_frame
+
+ default = COA
+ default {
+ 10 = TEXT
+ 10 {
+ value = <div id="c{field:uid}"
+ override.cObject = TEXT
+ override.cObject {
+ value = <div
+ if.value = div
+ if.equals.field = CType
+ }
+ insertData = 1
+ }
+
+ 15 = TEXT
+ 15 {
+ value = csc-default
+ noTrimWrap = | class="|" |
+ required = 1
+ }
+
+ 20 = COA
+ 20 {
+ 10 = COA
+ 10 {
+ 10 = TEXT
+ 10 {
+ value = {$content.spaceBefore}
+ wrap = |+
+ if.isTrue = {$content.spaceBefore}
+ }
+
+ 20 = TEXT
+ 20 {
+ field = spaceBefore
+ }
+
+ stdWrap {
+ prioriCalc = intval
+ wrap = margin-top:|px;
+ required = 1
+ ifEmpty.value =
+ }
+ }
+
+ 20 = COA
+ 20 {
+ 10 = TEXT
+ 10 {
+ value = {$content.spaceAfter}
+ wrap = |+
+ if.isTrue = {$content.spaceAfter}
+ }
+
+ 20 = TEXT
+ 20 {
+ field = spaceAfter
+ }
+
+ stdWrap {
+ prioriCalc = intval
+ wrap = margin-bottom:|px;
+ required = 1
+ ifEmpty.value =
+ }
+ }
+
+ stdWrap.noTrimWrap = | style="|" |
+ stdWrap.required = 1
+ }
+ 30 = TEXT
+ 30.value = >|</div>
+ }
+
+ 1 =< tt_content.stdWrap.innerWrap.cObject.default
+ 1.15.value = csc-frame csc-frame-invisible
+
+ 5 =< tt_content.stdWrap.innerWrap.cObject.default
+ 5.15.value = csc-frame csc-frame-rulerBefore
+
+ 6 =< tt_content.stdWrap.innerWrap.cObject.default
+ 6.15.value = csc-frame csc-frame-rulerAfter
+
+ 10 =< tt_content.stdWrap.innerWrap.cObject.default
+ 10.15.value = csc-frame csc-frame-indent
+
+ 11 =< tt_content.stdWrap.innerWrap.cObject.default
+ 11.15.value = csc-frame csc-frame-indent3366
+
+ 12 =< tt_content.stdWrap.innerWrap.cObject.default
+ 12.15.value = csc-frame csc-frame-indent6633
+
+ 20 =< tt_content.stdWrap.innerWrap.cObject.default
+ 20.15.value = csc-frame csc-frame-frame1
+
+ 21 =< tt_content.stdWrap.innerWrap.cObject.default
+ 21.15.value = csc-frame csc-frame-frame2
+
+ 66 = COA
+ 66 {
+ 10 = TEXT
+ 10 {
+ value = <a id="c{field:uid}"></a>
+ insertData = 1
+ }
+
+ 20 = COA
+ 20 {
+ 10 = TEXT
+ 10 {
+ value = {$content.spaceBefore}
+ wrap = |+
+ if.isTrue = {$content.spaceBefore}
+ }
+
+ 20 = TEXT
+ 20 {
+ field = spaceBefore
+ }
+
+ stdWrap {
+ prioriCalc = intval
+ wrap = margin-top:|px;
+ required = 1
+ ifEmpty.value =
+ wrap2 = <div style="|"></div>
+ }
+ }
+
+ 30 = TEXT
+ 30 {
+ value = |
+ }
+
+ 40 < .20
+ 40 {
+ 10 {
+ value = {$content.spaceAfter}
+ if.isTrue = {$content.spaceAfter}
+ }
+ 20.field = spaceAfter
+ stdWrap.wrap = margin-bottom:|px;
+ }
+ }
+
+ }
+
+ innerWrap2 = | <p class="csc-linkToTop"><a href="#">{LLL:EXT:css_styled_content/pi1/locallang.xml:label.toTop}</a></p>
+ innerWrap2.insertData = 1
+ innerWrap2.fieldRequired = linkToTop
+
+ prepend = TEXT
+ prepend.dataWrap = <a id="c{field:_LOCALIZED_UID}"></a>
+ prepend.if.isTrue.field = _LOCALIZED_UID
+
+ editPanel = 1
+ editPanel {
+ allow = move,new,edit,hide,delete
+ line = 5
+ label = %s
+ onlyCurrentPid = 1
+ previewBorder = 4
+ edit.displayRecord = 1
+ }
+
+ prefixComment = 1 | CONTENT ELEMENT, uid:{field:uid}/{field:CType}
+}
+
+
+
+# *****************
+# CType: header
+# *****************
+# See Object path "lib.stdheader"
+tt_content.header = COA
+tt_content.header {
+ 10 = < lib.stdheader
+
+ 20 = TEXT
+ 20 {
+ field = subheader
+ required = 1
+
+ dataWrap = <p class="csc-subheader csc-subheader-{field:layout}">|</p>
+ htmlSpecialChars = 1
+
+ editIcons = tt_content:subheader,layout
+ editIcons.beforeLastTag = 1
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.subheader
+
+ prefixComment = 2 | Subheader:
+ }
+}
+
+
+
+# *****************
+# CType: text
+# *****************
+tt_content.text = COA
+tt_content.text {
+ 10 = < lib.stdheader
+
+ 20 = TEXT
+ 20 {
+ field = bodytext
+ required = 1
+
+ parseFunc = < lib.parseFunc_RTE
+
+ editIcons = tt_content:bodytext, rte_enabled
+ editIcons.beforeLastTag = 1
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.bodytext
+
+ prefixComment = 2 | Text:
+ }
+}
+
+
+
+# *****************
+# CType: image
+# *****************
+# (also used for rendering 'textpic' type):
+tt_content.image = COA
+tt_content.image.10 = < lib.stdheader
+tt_content.image.20 = USER
+tt_content.image.20 {
+ userFunc = tx_cssstyledcontent_pi1->render_textpic
+
+ # Image source
+ imgList.field = image
+ imgPath = uploads/pics/
+
+ # Single image rendering
+ imgObjNum = 1
+ 1 {
+ file.import.current = 1
+ file.width.field = imagewidth
+ imageLinkWrap = 1
+ imageLinkWrap {
+ bodyTag = <body style="margin:0; background:#fff;">
+ wrap = <a href="javascript:close();"> | </a>
+ width = {$styles.content.imgtext.linkWrap.width}
+ height = {$styles.content.imgtext.linkWrap.height}
+ effects = {$styles.content.imgtext.linkWrap.effects}
+
+ JSwindow = 1
+ JSwindow.newWindow = {$styles.content.imgtext.linkWrap.newWindow}
+ JSwindow.if.isFalse = {$styles.content.imgtext.linkWrap.lightboxEnabled}
+
+ directImageLink = {$styles.content.imgtext.linkWrap.lightboxEnabled}
+
+ enable.field = image_zoom
+ enable.ifEmpty.typolink.parameter.field = image_link
+ enable.ifEmpty.typolink.parameter.listNum.splitChar = 10
+ enable.ifEmpty.typolink.parameter.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT
+ enable.ifEmpty.typolink.returnLast = url
+
+ typolink.parameter.field = image_link
+ typolink.parameter.listNum.splitChar = 10
+ typolink.parameter.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT
+ typolink.target = {$styles.content.links.target}
+ typolink.extTarget = {$styles.content.links.extTarget}
+
+ linkParams.ATagParams.dataWrap = class="{$styles.content.imgtext.linkWrap.lightboxCssClass}" rel="{$styles.content.imgtext.linkWrap.lightboxRelAttribute}"
+ }
+
+ altText = TEXT
+ altText {
+ field = altText
+ stripHtml = 1
+ split.token.char = 10
+ split.token.if.isTrue = {$styles.content.imgtext.imageTextSplit}
+ split.returnKey.data = register : IMAGE_NUM_CURRENT
+ }
+
+ titleText < .altText
+ titleText.field = titleText
+
+ longdescURL < .altText
+ longdescURL.field = longdescURL
+
+ emptyTitleHandling = {$styles.content.imgtext.emptyTitleHandling}
+ titleInLink = {$styles.content.imgtext.titleInLink}
+ titleInLinkAndImg = {$styles.content.imgtext.titleInLinkAndImg}
+ }
+
+ textPos.field = imageorient
+ maxW = {$styles.content.imgtext.maxW}
+ maxW.override.data = register:maxImageWidth
+ maxWInText = {$styles.content.imgtext.maxWInText}
+ maxWInText.override.data = register:maxImageWidthInText
+
+ equalH.field = imageheight
+
+ image_compression.field = image_compression
+ image_effects.field = image_effects
+
+ noRows.field = image_noRows
+
+ cols.field = imagecols
+ border.field = imageborder
+
+ caption {
+ 1 = TEXT
+ 1 {
+ field = imagecaption
+ required = 1
+ parseFunc =< lib.parseFunc
+ br = 1
+ split.token.char = 10
+ split.token.if.isPositive = {$styles.content.imgtext.imageTextSplit} + {$styles.content.imgtext.captionSplit}
+ split.returnKey.data = register : IMAGE_NUM_CURRENT
+ }
+ }
+ # captionSplit is deprecated, use imageTextSplit instead
+ captionSplit = {$styles.content.imgtext.captionSplit}
+ captionAlign.field = imagecaption_position
+ # caption/alttext/title/longdescURL splitting
+ imageTextSplit = {$styles.content.imgtext.imageTextSplit}
+
+ borderCol = {$styles.content.imgtext.borderColor}
+ borderThick = {$styles.content.imgtext.borderThick}
+ borderClass = {$styles.content.imgtext.borderClass}
+ colSpace = {$styles.content.imgtext.colSpace}
+ rowSpace = {$styles.content.imgtext.rowSpace}
+ textMargin = {$styles.content.imgtext.textMargin}
+
+ borderSpace = {$styles.content.imgtext.borderSpace}
+ separateRows = {$styles.content.imgtext.separateRows}
+ addClasses =
+ addClassesImage =
+ addClassesImage.ifEmpty = csc-textpic-firstcol csc-textpic-lastcol
+ addClassesImage.override = csc-textpic-firstcol |*| |*| csc-textpic-lastcol
+ addClassesImage.override.if {
+ isGreaterThan.field = imagecols
+ value = 1
+ }
+
+ #
+ imageStdWrap.dataWrap = <div class="csc-textpic-imagewrap" style="width:{register:totalwidth}px;"> | </div>
+ imageStdWrapNoWidth.wrap = <div class="csc-textpic-imagewrap"> | </div>
+
+ # if noRows is set, wrap around each column:
+ imageColumnStdWrap.dataWrap = <div class="csc-textpic-imagecolumn" style="width:{register:columnwidth}px;"> | </div>
+
+ layout = CASE
+ layout {
+ key.field = imageorient
+ # above-center
+ default = TEXT
+ default.value = <div class="csc-textpic csc-textpic-center csc-textpic-above###CLASSES###">###IMAGES######TEXT###</div><div class="csc-textpic-clear"><!-- --></div>
+ # above-right
+ 1 = TEXT
+ 1.value = <div class="csc-textpic csc-textpic-right csc-textpic-above###CLASSES###">###IMAGES######TEXT###</div><div class="csc-textpic-clear"><!-- --></div>
+ # above-left
+ 2 = TEXT
+ 2.value = <div class="csc-textpic csc-textpic-left csc-textpic-above###CLASSES###">###IMAGES######TEXT###</div><div class="csc-textpic-clear"><!-- --></div>
+ # below-center
+ 8 = TEXT
+ 8.value = <div class="csc-textpic csc-textpic-center csc-textpic-below###CLASSES###">###TEXT######IMAGES###</div><div class="csc-textpic-clear"><!-- --></div>
+ # below-right
+ 9 = TEXT
+ 9.value = <div class="csc-textpic csc-textpic-right csc-textpic-below###CLASSES###">###TEXT######IMAGES###</div><div class="csc-textpic-clear"><!-- --></div>
+ # below-left
+ 10 = TEXT
+ 10.value = <div class="csc-textpic csc-textpic-left csc-textpic-below###CLASSES###">###TEXT######IMAGES###</div><div class="csc-textpic-clear"><!-- --></div>
+ # intext-right
+ 17 = TEXT
+ 17.value = <div class="csc-textpic csc-textpic-intext-right###CLASSES###">###IMAGES######TEXT###</div>
+ 17.override = <div class="csc-textpic csc-textpic-intext-right###CLASSES###">###IMAGES######TEXT###</div><div class="csc-textpic-clear"><!-- --></div>
+ 17.override.if.isTrue = {$styles.content.imgtext.addIntextClearer}
+ # intext-left
+ 18 = TEXT
+ 18.value = <div class="csc-textpic csc-textpic-intext-left###CLASSES###">###IMAGES######TEXT###</div>
+ 18.override = <div class="csc-textpic csc-textpic-intext-left###CLASSES###">###IMAGES######TEXT###</div><div class="csc-textpic-clear"><!-- --></div>
+ 18.override.if.isTrue = {$styles.content.imgtext.addIntextClearer}
+ # intext-right-nowrap
+ 25 = TEXT
+ 25.value = <div class="csc-textpic csc-textpic-intext-right-nowrap###CLASSES###">###IMAGES###<div style="margin-right:{register:rowWidthPlusTextMargin}px;">###TEXT###</div></div><div class="csc-textpic-clear"><!-- --></div>
+ 25.insertData = 1
+ # intext-left-nowrap
+ 26 = TEXT
+ 26.value = <div class="csc-textpic csc-textpic-intext-left-nowrap###CLASSES###">###IMAGES###<div style="margin-left:{register:rowWidthPlusTextMargin}px;">###TEXT###</div></div><div class="csc-textpic-clear"><!-- --></div>
+ 26.insertData = 1
+ }
+
+ rendering {
+ dl {
+ # Choose another rendering for special edge cases
+ fallbackRendering = COA
+ fallbackRendering {
+ # Just one image without a caption => don't need the dl-overhead, use the "simple" rendering
+ 10 = TEXT
+ 10 {
+ if {
+ isFalse.field = imagecaption
+ value = 1
+ equals.data = register:imageCount
+ }
+ value = simple
+ }
+
+ # Multiple images and one global caption => "ul"
+ 20 = TEXT
+ 20 {
+ if {
+ value = 1
+ isGreaterThan.data = register:imageCount
+ isTrue.if.isTrue.data = register:renderGlobalCaption
+ isTrue.field = imagecaption
+ }
+ value = ul
+ }
+
+ # Multiple images and no caption at all => "ul"
+ 30 = TEXT
+ 30 {
+ if {
+ value = 1
+ isGreaterThan.data = register:imageCount
+ isFalse.field = imagecaption
+ }
+ value = ul
+ }
+ }
+ imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow" style="width:{register:rowwidth}px;"> | </div>
+ imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last" style="width:{register:rowwidth}px;"> | </div>
+ noRowsStdWrap.wrap =
+ oneImageStdWrap.dataWrap = <dl class="csc-textpic-image###CLASSES###" style="width:{register:imagespace}px;"> | </dl>
+ imgTagStdWrap.wrap = <dt> | </dt>
+ editIconsStdWrap.wrap = <dd> | </dd>
+ caption {
+ required = 1
+ wrap = <dd class="csc-textpic-caption"> | </dd>
+ }
+ }
+ ul {
+ # Just one image without a caption => don't need the ul-overhead, use the "simple" rendering
+ fallbackRendering < tt_content.image.20.rendering.dl.fallbackRendering.10
+ imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow" style="width:{register:rowwidth}px;"><ul> | </ul></div>
+ imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last" style="width:{register:rowwidth}px;"><ul> | </ul></div>
+ noRowsStdWrap.wrap = <ul> | </ul>
+ oneImageStdWrap.dataWrap = <li class="csc-textpic-image###CLASSES###" style="width:{register:imagespace}px;"> | </li>
+ imgTagStdWrap.wrap =
+ editIconsStdWrap.wrap = <div> | </div>
+ caption.wrap = <div class="csc-textpic-caption"> | </div>
+ }
+ div {
+ # Just one image without a caption => don't need the div-overhead, use the "simple" rendering
+ fallbackRendering < tt_content.image.20.rendering.dl.fallbackRendering.10
+ imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow" style="width:{register:rowwidth}px;"> | </div>
+ imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last" style="width:{register:rowwidth}px;"> | </div>
+ noRowsStdWrap.wrap =
+ oneImageStdWrap.dataWrap = <div class="csc-textpic-image###CLASSES###" style="width:{register:imagespace}px;"> | </div>
+ imgTagStdWrap.wrap = <div> | </div>
+ editIconsStdWrap.wrap = <div> | </div>
+ caption.wrap = <div class="csc-textpic-caption"> | </div>
+ }
+ simple {
+ imageRowStdWrap.dataWrap = |
+ imageLastRowStdWrap.dataWrap = |
+ noRowsStdWrap.wrap =
+ oneImageStdWrap.dataWrap = |
+ imgTagStdWrap.wrap = |
+ editIconsStdWrap.wrap = |
+ caption.wrap = <div class="csc-textpic-caption"> | </div>
+ imageStdWrap.dataWrap = <div class="csc-textpic-imagewrap csc-textpic-single-image" style="width:{register:totalwidth}px;"> | </div>
+ imageStdWrapNoWidth.wrap = <div class="csc-textpic-imagewrap csc-textpic-single-image"> | </div>
+ }
+ }
+ renderMethod = dl
+
+ editIcons = tt_content : image [imageorient|imagewidth|imageheight], [imagecols|image_noRows|imageborder],[image_link|image_zoom],[image_compression|image_effects|image_frames],imagecaption[imagecaption_position]
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.images
+
+ caption.editIcons = tt_content : imagecaption[imagecaption_position]
+ caption.editIcons.beforeLastTag=1
+ caption.editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.caption
+
+ stdWrap.prefixComment = 2 | Image block:
+}
+
+# *****************
+# CType: textpic
+# *****************
+tt_content.textpic = COA
+tt_content.textpic {
+ 10 = COA
+ 10.if.value = 25
+ 10.if.isLessThan.field = imageorient
+ 10.10 = < lib.stdheader
+
+ 20 = < tt_content.image.20
+ 20 {
+ text.10 = COA
+ text.10 {
+ if.value = 24
+ if.isGreaterThan.field = imageorient
+ 10 = < lib.stdheader
+ 10.stdWrap.dataWrap = <div class="csc-textpicHeader csc-textpicHeader-{field:imageorient}">|</div>
+ }
+ text.20 = < tt_content.text.20
+ text.wrap = <div class="csc-textpic-text"> | </div>
+ }
+}
+
+
+
+# *****************
+# CType: bullet
+# *****************
+tt_content.bullets = COA
+tt_content.bullets {
+ 10 = < lib.stdheader
+
+ 20 = TEXT
+ 20 {
+ field = bodytext
+ trim = 1
+ split{
+ token.char = 10
+ cObjNum = |*|1|| 2|*|
+ 1.current = 1
+ 1.parseFunc =< lib.parseFunc
+ 1.wrap = <li class="odd">|</li>
+
+ 2.current = 1
+ 2.parseFunc =< lib.parseFunc
+ 2.wrap = <li class="even">|</li>
+ }
+ dataWrap = <ul class="csc-bulletlist csc-bulletlist-{field:layout}">|</ul>
+ editIcons = tt_content: bodytext, [layout]
+ editIcons.beforeLastTag = 1
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.php:eIcon.bullets
+
+ prefixComment = 2 | Bullet list:
+ }
+}
+
+
+
+# *****************
+# CType: table
+# *****************
+# Rendered by a PHP function specifically written to handle CE tables. See css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php
+tt_content.table = COA
+tt_content.table {
+ 10 = < lib.stdheader
+
+ 20 = USER
+ 20.userFunc = tx_cssstyledcontent_pi1->render_table
+ 20.field = bodytext
+
+ 20.color {
+ default =
+ 1 = #EDEBF1
+ 2 = #F5FFAA
+ }
+ 20.tableParams_0 {
+ border =
+ cellpadding =
+ cellspacing =
+ }
+ 20.tableParams_1 {
+ border =
+ cellpadding =
+ cellspacing =
+ }
+ 20.tableParams_2 {
+ border =
+ cellpadding =
+ cellspacing =
+ }
+ 20.tableParams_3 {
+ border =
+ cellpadding =
+ cellspacing =
+ }
+ 20.innerStdWrap.wrap = |
+ 20.innerStdWrap.parseFunc = < lib.parseFunc
+
+ 20.stdWrap {
+ editIcons = tt_content: cols, bodytext, [layout], [table_bgColor|table_border|table_cellspacing|table_cellpadding]
+ editIcons.beforeLastTag = 1
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.table
+
+ prefixComment = 2 | Table:
+ }
+}
+
+
+# *****************
+# CType: uploads
+# *****************
+# Rendered by a PHP function specifically written to handle CE filelists. See css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php
+tt_content.uploads = COA
+tt_content.uploads {
+ 10 = < lib.stdheader
+
+ 20 = USER
+ 20.userFunc = tx_cssstyledcontent_pi1->render_uploads
+ 20.field = media
+ 20.filePath.field = select_key
+
+ 20 {
+ # Rendering for each file (e.g. rows of the table) as a cObject
+ itemRendering = COA
+ itemRendering {
+ wrap = <tr class="tr-odd tr-first">|</tr> |*| <tr class="tr-even">|</tr> || <tr class="tr-odd">|</tr> |*|
+
+ 10 = TEXT
+ 10.data = register:linkedIcon
+ 10.wrap = <td class="csc-uploads-icon">|</td>
+ 10.if.isPositive.field = layout
+
+ 20 = COA
+ 20.wrap = <td class="csc-uploads-fileName">|</td>
+ 20.1 = TEXT
+ 20.1 {
+ data = register:linkedLabel
+ wrap = <p>|</p>
+ }
+ 20.2 = TEXT
+ 20.2 {
+ data = register:description
+ wrap = <p class="csc-uploads-description">|</p>
+ required = 1
+ htmlSpecialChars = 1
+ }
+
+ 30 = TEXT
+ 30.if.isTrue.field = filelink_size
+ 30.data = register:fileSize
+ 30.wrap = <td class="csc-uploads-fileSize">|</td>
+ 30.bytes = 1
+ 30.bytes.labels = {$styles.content.uploads.filesizeBytesLabels}
+ }
+ useSpacesInLinkText = 0
+ stripFileExtensionFromLinkText = 0
+ }
+
+ 20.color {
+ default =
+ 1 = #EDEBF1
+ 2 = #F5FFAA
+ }
+ 20.tableParams_0 {
+ border =
+ cellpadding =
+ cellspacing =
+ }
+ 20.tableParams_1 {
+ border =
+ cellpadding =
+ cellspacing =
+ }
+ 20.tableParams_2 {
+ border =
+ cellpadding =
+ cellspacing =
+ }
+ 20.tableParams_3 {
+ border =
+ cellpadding =
+ cellspacing =
+ }
+
+ 20.linkProc {
+ target = _blank
+ jumpurl = {$styles.content.uploads.jumpurl}
+ jumpurl.secure = {$styles.content.uploads.jumpurl_secure}
+ jumpurl.secure.mimeTypes = {$styles.content.uploads.jumpurl_secure_mimeTypes}
+ removePrependedNumbers = 1
+
+ iconCObject = IMAGE
+ iconCObject.file.import.data = register : ICON_REL_PATH
+ iconCObject.file.width = 150
+ }
+
+ 20.filesize {
+ bytes = 1
+ bytes.labels = {$styles.content.uploads.filesizeBytesLabels}
+ }
+
+ 20.stdWrap {
+ editIcons = tt_content: media, layout [table_bgColor|table_border|table_cellspacing|table_cellpadding], filelink_size, imagecaption
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.filelist
+
+ prefixComment = 2 | File list:
+ }
+}
+
+
+# ******************
+# CType: multimedia
+# ******************
+tt_content.multimedia = COA
+tt_content.multimedia {
+ 10 = < lib.stdheader
+
+ 20 = MULTIMEDIA
+ 20.file.field = multimedia
+ 20.file.wrap = uploads/media/
+ 20.file.listNum = 0
+ 20.params.field = bodytext
+
+ 20.stdWrap {
+ editIcons = tt_content: multimedia, bodytext
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia
+
+ prefixComment = 2 | Multimedia element:
+ }
+}
+
+# *****************
+# CType: swfobject
+# *****************
+tt_content.swfobject = COA
+tt_content.swfobject {
+ 10 = < lib.stdheader
+
+ 20 = SWFOBJECT
+ 20 {
+ file =
+ width =
+ height =
+
+ flexParams.field = pi_flexform
+
+ alternativeContent.field = bodytext
+
+ layout = ###SWFOBJECT###
+
+ video {
+ player = {$styles.content.media.videoPlayer}
+
+ defaultWidth = {$styles.content.media.defaultVideoWidth}
+ defaultHeight = {$styles.content.media.defaultVideoHeight}
+
+ default {
+ params.quality = high
+ params.menu = false
+ params.allowScriptAccess = sameDomain
+ params.allowFullScreen = true
+ }
+ mapping {
+
+ }
+ }
+
+ audio {
+ player = {$styles.content.media.audioPlayer}
+
+ defaultWidth = {$styles.content.media.defaultAudioWidth}
+ defaultHeight = {$styles.content.media.defaultAudioHeight}
+
+ default {
+ params.quality = high
+ params.allowScriptAccess = sameDomain
+ params.menu = false
+ }
+ mapping {
+ flashvars.file = soundFile
+ }
+ }
+
+ }
+ 20.stdWrap {
+ editIcons = tt_content: multimedia, imagewidth, imageheight, pi_flexform, bodytext
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia
+
+ prefixComment = 2 | SWFobject element:
+ }
+}
+
+# *****************
+# CType: qtobject
+# *****************
+tt_content.qtobject = COA
+tt_content.qtobject {
+ 10 = < lib.stdheader
+
+ 20 = QTOBJECT
+ 20 {
+ file =
+ width =
+ height =
+
+ flexParams.field = pi_flexform
+
+ alternativeContent.field = bodytext
+
+ layout = ###QTOBJECT###
+
+ video {
+ player = {$styles.content.media.videoPlayer}
+
+ defaultWidth = {$styles.content.media.defaultVideoWidth}
+ defaultHeight = {$styles.content.media.defaultVideoHeight}
+
+ default {
+ params.quality = high
+ params.menu = false
+ params.allowScriptAccess = sameDomain
+ params.allowFullScreen = true
+ }
+ mapping {
+
+ }
+ }
+
+ audio {
+ player = {$styles.content.media.audioPlayer}
+
+ defaultWidth = {$styles.content.media.defaultAudioWidth}
+ defaultHeight = {$styles.content.media.defaultAudioHeight}
+
+ default {
+ params.quality = high
+ params.allowScriptAccess = sameDomain
+ params.menu = false
+ }
+ mapping {
+ flashvars.file = soundFile
+ }
+ }
+ }
+ 20.stdWrap {
+ editIcons = tt_content: multimedia, imagewidth, imageheight, pi_flexform, bodytext
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia
+
+ prefixComment = 2 | QTobject element:
+ }
+}
+
+# *****************
+# CType: media
+# *****************
+tt_content.media = COA
+tt_content.media {
+ 10 = < lib.stdheader
+
+ 20 = MEDIA
+ 20 {
+
+ flexParams.field = pi_flexform
+ alternativeContent < tt_content.text.20
+ alternativeContent.field = bodytext
+
+ type = video
+ renderType = auto
+ allowEmptyUrl = 0
+ forcePlayer = 1
+
+ fileExtHandler {
+ default = MEDIA
+ avi = MEDIA
+ asf = MEDIA
+ class = MEDIA
+ wmv = MEDIA
+ mp3 = SWF
+ mp4 = SWF
+ m4v = SWF
+ swa = SWF
+ flv = SWF
+ swf = SWF
+ mov = QT
+ m4v = QT
+ m4a = QT
+ }
+
+ mimeConf.swfobject < tt_content.swfobject.20
+ mimeConf.qtobject < tt_content.qtobject.20
+
+ }
+ 20.stdWrap {
+ editIcons = tt_content: pi_flexform, bodytext
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia
+
+ prefixComment = 2 | Media element:
+ }
+}
+
+# ******************
+# CType: mailform
+# ******************
+tt_content.mailform = COA
+tt_content.mailform.10 = < lib.stdheader
+tt_content.mailform.20 = FORM
+tt_content.mailform.20 {
+ accessibility = 1
+ noWrapAttr=1
+ formName = mailform
+ dontMd5FieldNames = 1
+ layout = <div class="csc-mailform-field">###LABEL### ###FIELD###</div>
+ labelWrap.wrap = |
+ commentWrap.wrap = |
+ radioWrap.wrap = |<br />
+ radioWrap.accessibilityWrap = <fieldset###RADIO_FIELD_ID###><legend>###RADIO_GROUP_LABEL###</legend>|</fieldset>
+ REQ = 1
+ REQ.labelWrap.wrap = |
+ COMMENT.layout = <div class="csc-mailform-label">###LABEL###</div>
+ RADIO.layout = <div class="csc-mailform-field">###LABEL### <span class="csc-mailform-radio">###FIELD###</span></div>
+ LABEL.layout = <div class="csc-mailform-field">###LABEL### <span class="csc-mailform-label">###FIELD###</span></div>
+ target = {$styles.content.mailform.target}
+ goodMess = {$styles.content.mailform.goodMess}
+ badMess = {$styles.content.mailform.badMess}
+ redirect.field = pages
+ redirect.listNum = 0
+ recipient.field = subheader
+ data.field = bodytext
+ locationData = 1
+ hiddenFields.stdWrap.wrap = <div style="display:none;">|</div>
+
+ params.radio = class="csc-mailform-radio"
+ params.check = class="csc-mailform-check"
+ params.submit = class="csc-mailform-submit"
+
+ stdWrap.wrap = <fieldset class="csc-mailform"> | </fieldset>
+ stdWrap {
+ editIcons = tt_content: bodytext, pages, subheader
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.form
+
+ prefixComment = 2 | Mail form inserted:
+ }
+}
+
+
+# ******************
+# CType: search
+# ******************
+tt_content.search = COA
+tt_content.search.10 = < lib.stdheader
+# Result:
+tt_content.search.20 = SEARCHRESULT
+tt_content.search.20 {
+ allowedCols = pages.title-subtitle-keywords-description : tt_content.header-bodytext-imagecaption : tt_address.name-title-address-email-company-city-country : tt_links.title-note-note2-url : tt_board.subject-message-author-email : tt_calender.title-note : tt_products.title-note-itemnumber
+ languageField.tt_content = sys_language_uid
+ renderObj = COA
+ renderObj {
+
+ 10 = TEXT
+ 10.field = pages_title
+ 10.htmlSpecialChars = 1
+ 10.typolink {
+ parameter.field = uid
+ target = {$styles.content.searchresult.resultTarget}
+ additionalParams.data = register:SWORD_PARAMS
+ additionalParams.required = 1
+ additionalParams.wrap = &no_cache=1
+ }
+ 10.htmlSpecialChars = 1
+ 10.wrap = <h3 class="csc-searchResultHeader">|</h3>
+
+ 20 = COA
+ 20 {
+ 10 = TEXT
+ 10.field = tt_content_bodytext
+ 10.stripHtml = 1
+ 10.htmlSpecialChars = 1
+ }
+ 20.stdWrap.crop = 200 | ...
+ 20.stdWrap.wrap = <p class="csc-searchResult">|</p>
+ }
+
+ layout = COA
+ layout {
+ wrap = <table border="0" cellspacing="0" cellpadding="2" class="csc-searchResultInfo"><tr> | </tr></table> ###RESULT###
+
+ 10 = TEXT
+ 10.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.resultRange
+ 10.wrap = <td class="csc-searchResultRange"><p>|</p></td>
+
+ 20 = TEXT
+ 20.value = ###PREV###&nbsp;&nbsp;&nbsp;###NEXT###
+ 20.wrap = <td class="csc-searchResultPrevNext"><p>|</p></td>
+ }
+
+ noResultObj = COA
+ noResultObj {
+ 10 = TEXT
+ 10.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.emptySearch
+ 10.wrap = <h3 class="csc-noSearchResultMsg">|</h3>
+ }
+
+ next = TEXT
+ next.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.searchResultNext
+
+ prev = TEXT
+ prev.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.searchResultPrev
+
+ target = {$styles.content.searchresult.target}
+ range = 20
+
+ stdWrap.prefixComment = 2 | Search result:
+}
+
+# Form:
+tt_content.search.30 < tt_content.mailform.20
+tt_content.search.30 {
+ goodMess = {$styles.content.searchform.goodMess}
+ redirect >
+ recipient >
+ data >
+ dataArray {
+ 10.label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.searchWord
+ 10.type = sword=input
+ 20.label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.searchIn
+ 20.type = scols=select
+ 20.valueArray {
+ 10.label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.headersKeywords
+ 10.value = pages.title-subtitle-keywords-description:tt_content.header
+ 20.label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.pageContent
+ 20.value = tt_content.header-bodytext-imagecaption
+ }
+ 30.type = stype=hidden
+ 30.value = L0
+ 40.type = submit=submit
+ 40.value.data = LLL:EXT:css_styled_content/pi1/locallang.xml:search.searchButton
+ }
+ type.field = pages
+ type.listNum = 0
+ locationData = HTTP_POST_VARS
+ no_cache = 1
+
+ stdWrap.wrap = <table border="0" cellspacing="1" cellpadding="1" class="csc-searchform"> | </table>
+ stdWrap {
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.search
+
+ prefixComment = 2 | Search form inserted:
+ }
+}
+
+
+# ******************
+# CType: login
+# ******************
+tt_content.login < tt_content.mailform
+tt_content.login.10 = < lib.stdheader
+tt_content.login.20 {
+ goodMess = {$styles.content.loginform.goodMess}
+ redirect >
+ recipient >
+ data >
+ dataArray {
+ 10.label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:login.username
+ 10.type = *user=input
+ 20.label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:login.password
+ 20.type = *pass=password
+ 30.type = logintype=hidden
+ 30.value = login
+ 40.type = submit=submit
+ 40.value.data = LLL:EXT:css_styled_content/pi1/locallang.xml:login.login
+ }
+ type.field = pages
+ type.listNum = 0
+ target = {$styles.content.loginform.target}
+ locationData = 0
+ hiddenFields.pid = TEXT
+ hiddenFields.pid {
+ value = {$styles.content.loginform.pid}
+ override.field = pages
+ override.listNum = 1
+ }
+
+ stdWrap.wrap = <div class="csc-loginform"> | </div>
+ stdWrap {
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.login
+
+ prefixComment = 2 | Login/Logout form:
+ }
+}
+[loginUser = *]
+tt_content.login.20 {
+ dataArray >
+ dataArray {
+ 10.label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:login.username
+ 10.label.wrap = |&nbsp;<!--###USERNAME###-->
+ 30.type = logintype=hidden
+ 30.value = logout
+ 40.type = submit=submit
+ 40.value.data = LLL:EXT:css_styled_content/pi1/locallang.xml:login.logout
+ }
+}
+[global]
+
+
+# ******************
+# CType: splash
+# ******************
+# Deprecated element.
+# Still here for backwards compliance with plugins using the "text box" type.
+tt_content.splash = CASE
+tt_content.splash.key.field = splash_layout
+tt_content.splash.stdWrap {
+ prefixComment = 2 | Textbox inserted (Deprecated)
+}
+tt_content.splash.default = COA
+tt_content.splash.default {
+ 20 = CTABLE
+ 20 {
+ c.1 = < tt_content.text
+ lm.1 = IMAGE
+ lm.1.file {
+ import = uploads/pics/
+ import.field = image
+ import.listNum = 0
+ maxW.field = imagewidth
+ maxW.ifEmpty = 200
+ }
+ cMargins = 30,0,0,0
+ }
+}
+tt_content.splash.1 < tt_content.splash.default
+tt_content.splash.1.20.lm.1.file >
+tt_content.splash.1.20.lm.1.file = GIFBUILDER
+tt_content.splash.1.20.lm.1.file {
+ XY = [10.w]+10,[10.h]+10
+ backColor = {$content.splash.bgCol}
+ backColor.override.data = register:pageColor
+ format = jpg
+ 5 = BOX
+ 5.dimensions = 3,3,[10.w],[10.h]
+ 5.color = #333333
+ 7 = EFFECT
+ 7.value = blur=99|blur=99|blur=99|blur=99|blur=99|blur=99|blur=99
+ 10 = IMAGE
+ 10.file {
+ import = uploads/pics/
+ import.field = image
+ import.listNum = 0
+ maxW.field = imagewidth
+ maxW.ifEmpty = 200
+ }
+}
+// The image frames are not available unless TypoScript code from styles.content.imgFrames.x is provided manually:
+tt_content.splash.2 < tt_content.splash.default
+#tt_content.splash.2.20.lm.1.file.m < styles.content.imgFrames.1
+tt_content.splash.3 < tt_content.splash.default
+#tt_content.splash.3.20.lm.1.file.m < styles.content.imgFrames.2
+
+// From plugin.postit1, if included:
+tt_content.splash.20 = < plugin.postit1
+
+
+
+# ****************
+# CType: menu
+# ****************
+tt_content.menu = COA
+tt_content.menu {
+ 10 = < lib.stdheader
+
+ 20 = CASE
+ 20 {
+ key.field = menu_type
+
+ # "Menu of these pages"
+ default = HMENU
+ default {
+ special = list
+ special.value.field = pages
+ wrap = <ul class="csc-menu csc-menu-def">|</ul>
+ 1 = TMENU
+ 1 {
+ target = {$PAGE_TARGET}
+ NO {
+ stdWrap.htmlSpecialChars = 1
+ wrapItemAndSub = <li>|</li>
+ ATagTitle.field = description // title
+ }
+ noBlur = 1
+ }
+ }
+
+ # "Menu of subpages to these pages"
+ 1 < .default
+ 1 {
+ special = directory
+ wrap = <ul class="csc-menu csc-menu-1">|</ul>
+ }
+
+ # "Sitemap - liststyle"
+ 2 = HMENU
+ 2 {
+ wrap = <div class="csc-sitemap">|</div>
+ 1 = TMENU
+ 1 {
+ target = {$PAGE_TARGET}
+ noBlur = 1
+ expAll = 1
+ wrap = <ul>|</ul>
+ NO {
+ stdWrap.htmlSpecialChars = 1
+ wrapItemAndSub = <li>|</li>
+ ATagTitle.field = description // title
+ }
+ }
+ 2 < .1
+ 3 < .1
+ 4 < .1
+ 5 < .1
+ 6 < .1
+ 7 < .1
+ }
+
+ # "Section index (pagecontent w/Index checked - liststyle)"
+ 3 < styles.content.get
+ 3 {
+ wrap = <ul class="csc-menu csc-menu-3">|</ul>
+ select.andWhere = sectionIndex!=0
+ select.pidInList.override.field = pages
+ renderObj = TEXT
+ renderObj {
+ fieldRequired = header
+ trim = 1
+ field = header
+ htmlSpecialChars = 1
+ noBlur = 1
+ wrap = <li class="csc-section">|</li>
+ typolink.parameter.field = pid
+ typolink.section.field = uid
+ }
+ }
+
+ # "Menu of subpages to these pages (with abstract)"
+ 4 < .1
+ 4 {
+ wrap = <dl class="csc-menu csc-menu-4">|</dl>
+ 1.NO {
+ wrapItemAndSub >
+ linkWrap = <dt>|</dt>
+ after {
+ data = field : abstract // field : description // field : subtitle
+ required = 1
+ htmlSpecialChars = 1
+ wrap = <dd>|</dd>
+ }
+ ATagTitle.field = description // title
+ }
+ }
+
+ # "Recently updated pages"
+ 5 < .default
+ 5 {
+ wrap = <ul class="csc-menu csc-menu-5">|</ul>
+ special = updated
+ special {
+ maxAge = 3600*24*7
+ excludeNoSearchPages = 1
+ }
+ }
+
+ # "Related pages (based on keywords)"
+ 6 < .default
+ 6 {
+ wrap = <ul class="csc-menu csc-menu-6">|</ul>
+ special = keywords
+ special {
+ excludeNoSearchPages = 1
+ }
+ }
+
+ # "Menu of subpages to these pages + sections - liststyle"
+ 7 < .1
+ 7 {
+ wrap = <ul class="csc-menu csc-menu-7">|</ul>
+ 1.expAll = 1
+ 2 < .1
+ 2 {
+ sectionIndex = 1
+ sectionIndex.type = header
+ wrap = <ul>|</ul>
+ NO.wrapItemAndSub = <li class="csc-section">|</li>
+ }
+ }
+ }
+
+ 20.stdWrap {
+ editIcons = tt_content: menu_type, pages
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.menuSitemap
+
+ prefixComment = 2 | Menu/Sitemap element:
+ }
+}
+
+
+
+# ****************
+# CType: shortcut
+# ****************
+# Should be a complete copy from the old static template "content (default)"
+tt_content.shortcut = COA
+tt_content.shortcut {
+ 20 = CASE
+ 20.key.field = layout
+ 20.0= RECORDS
+ 20.0 {
+ source.field = records
+ tables = {$content.shortcut.tables}
+ # THESE are OLD plugins. Modern plugins registers themselves automatically!
+ conf.tt_content = < tt_content
+ conf.tt_address = < tt_address
+ conf.tt_links = < tt_links
+ conf.tt_guest = < tt_guest
+ conf.tt_board = < tt_board
+ conf.tt_calender = < tt_calender
+ conf.tt_rating < tt_rating
+ conf.tt_products = < tt_products
+ conf.tt_news = < tt_news
+ conf.tt_poll = < plugin.tt_poll
+ }
+ 20.1= RECORDS
+ 20.1 {
+ source.field = records
+ tables = {$content.shortcut.tables}
+ conf.tt_poll = < plugin.tt_poll
+ conf.tt_poll.code = RESULT,SUBMITTEDVOTE
+ }
+
+ 20.stdWrap {
+ editIcons = tt_content: records
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.recordList
+
+ prefixComment = 2 | Inclusion of other records (by reference):
+ }
+}
+
+
+# ****************
+# CType: list
+# ****************
+# Should be a complete copy from the old static template "content (default)" (except "lib.stdheader")
+tt_content.list = COA
+tt_content.list {
+ 10 = < lib.stdheader
+
+ 20 = CASE
+ 20.key.field = list_type
+ 20 {
+ # LIST element references (NOT copy of objects!)
+ # THESE are OLD plugins. Modern plugins registers themselves automatically!
+ 3 = CASE
+ 3.key.field = layout
+ 3.0 = < plugin.tt_guest
+
+ 4 = CASE
+ 4.key.field = layout
+ 4.0 = < plugin.tt_board_list
+ 4.1 = < plugin.tt_board_tree
+
+ 2 = CASE
+ 2.key.field = layout
+ 2.0 = < plugin.tt_board_tree
+
+ 5 = CASE
+ 5.key.field = layout
+ 5.0 = < plugin.tt_products
+
+ 7 = CASE
+ 7.key.field = layout
+ 7.0 = < plugin.tt_calender
+
+ 8 = CASE
+ 8.key.field = layout
+ 8.0 = < plugin.tt_rating
+
+ 9 = CASE
+ 9.key.field = layout
+ 9.0 = < plugin.tt_news
+
+ 11 = CASE
+ 11.key.field = layout
+ 11.0 = < plugin.tipafriend
+
+ 20 = CASE
+ 20.key.field = layout
+ 20.0 = < plugin.feadmin.fe_users
+
+ 21 = CASE
+ 21.key.field = layout
+ 21.0 = < plugin.feadmin.dmailsubscription
+ }
+
+ 20.stdWrap {
+ editIcons = tt_content: list_type, layout, select_key, pages [recursive]
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.plugin
+
+ prefixComment = 2 | Plugin inserted:
+ }
+}
+
+
+# ****************
+# CType: script
+# ****************
+# OBSOLETE! Please make extensions instead. The "script" content element was meant for these custom purposes in the past. Today extensions will do the job better.
+tt_content.script = TEXT
+tt_content.script {
+ value =
+
+ prefixComment = 2 | Script element (Deprecated)
+}
+
+
+# ****************
+# CType: div
+# ****************
+tt_content.div = TEXT
+tt_content.div {
+ value = <hr />
+ wrap = <div class="divider">|</div>
+ prefixComment = 2 | Div element
+}
+
+
+# ****************
+# CType: html
+# ****************
+# This truely IS a content object, launched from inside the PHP class of course.
+# Should be a complete copy from the old static template "content (default)"
+tt_content.html = TEXT
+tt_content.html {
+ field = bodytext
+
+ editIcons = tt_content: pages
+ editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.html
+
+ prefixComment = 2 | Raw HTML content:
+}
+
+
+# ****************
+# Default error msg:
+# ****************
+tt_content.default = TEXT
+tt_content.default {
+ field = CType
+ wrap = <p style="background-color: yellow;"><b>ERROR:</b> Content Element type "|" has no rendering definition!</p>
+
+ prefixComment = 2 | Unknown element message:
+}
+
+# *********************************************************************
+# ACCESSIBILTY MODE
+# *********************************************************************
+
+
+
+
+
+
+
+plugin.tx_cssstyledcontent._CSS_DEFAULT_STYLE (
+ /* Captions */
+ DIV.csc-textpic-caption-c .csc-textpic-caption { text-align: center; }
+ DIV.csc-textpic-caption-r .csc-textpic-caption { text-align: right; }
+ DIV.csc-textpic-caption-l .csc-textpic-caption { text-align: left; }
+
+ /* Needed for noRows setting */
+ DIV.csc-textpic DIV.csc-textpic-imagecolumn { float: left; display: inline; }
+
+ /* Border just around the image */
+ {$styles.content.imgtext.borderSelector} {
+ border: {$styles.content.imgtext.borderThick}px solid {$styles.content.imgtext.borderColor};
+ padding: {$styles.content.imgtext.borderSpace}px {$styles.content.imgtext.borderSpace}px;
+ }
+
+ DIV.csc-textpic-imagewrap { padding: 0; }
+
+ DIV.csc-textpic IMG { border: none; }
+
+ /* DIV: This will place the images side by side */
+ DIV.csc-textpic DIV.csc-textpic-imagewrap DIV.csc-textpic-image { float: left; }
+
+ /* UL: This will place the images side by side */
+ DIV.csc-textpic DIV.csc-textpic-imagewrap UL { list-style: none; margin: 0; padding: 0; }
+ DIV.csc-textpic DIV.csc-textpic-imagewrap UL LI { float: left; margin: 0; padding: 0; }
+
+ /* DL: This will place the images side by side */
+ DIV.csc-textpic DIV.csc-textpic-imagewrap DL.csc-textpic-image { float: left; }
+ DIV.csc-textpic DIV.csc-textpic-imagewrap DL.csc-textpic-image DT { float: none; }
+ DIV.csc-textpic DIV.csc-textpic-imagewrap DL.csc-textpic-image DD { float: none; }
+ DIV.csc-textpic DIV.csc-textpic-imagewrap DL.csc-textpic-image DD IMG { border: none; } /* FE-Editing Icons */
+ DL.csc-textpic-image { margin: 0; }
+ DL.csc-textpic-image DT { margin: 0; display: inline; }
+ DL.csc-textpic-image DD { margin: 0; }
+
+ /* Clearer */
+ DIV.csc-textpic-clear { clear: both; }
+
+ /* Margins around images: */
+
+ /* Pictures on left, add margin on right */
+ DIV.csc-textpic-left DIV.csc-textpic-imagewrap .csc-textpic-image,
+ DIV.csc-textpic-intext-left-nowrap DIV.csc-textpic-imagewrap .csc-textpic-image,
+ DIV.csc-textpic-intext-left DIV.csc-textpic-imagewrap .csc-textpic-image {
+ display: inline; /* IE fix for double-margin bug */
+ margin-right: {$styles.content.imgtext.colSpace}px;
+ }
+
+ /* Pictures on right, add margin on left */
+ DIV.csc-textpic-right DIV.csc-textpic-imagewrap .csc-textpic-image,
+ DIV.csc-textpic-intext-right-nowrap DIV.csc-textpic-imagewrap .csc-textpic-image,
+ DIV.csc-textpic-intext-right DIV.csc-textpic-imagewrap .csc-textpic-image {
+ display: inline; /* IE fix for double-margin bug */
+ margin-left: {$styles.content.imgtext.colSpace}px;
+ }
+
+ /* Pictures centered, add margin on left */
+ DIV.csc-textpic-center DIV.csc-textpic-imagewrap .csc-textpic-image {
+ display: inline; /* IE fix for double-margin bug */
+ margin-left: {$styles.content.imgtext.colSpace}px;
+ }
+ DIV.csc-textpic DIV.csc-textpic-imagewrap .csc-textpic-image .csc-textpic-caption { margin: 0; }
+ DIV.csc-textpic DIV.csc-textpic-imagewrap .csc-textpic-image IMG { margin: 0; vertical-align:bottom; }
+
+ /* Space below each image (also in-between rows) */
+ DIV.csc-textpic DIV.csc-textpic-imagewrap .csc-textpic-image { margin-bottom: {$styles.content.imgtext.rowSpace}px; }
+ DIV.csc-textpic-equalheight DIV.csc-textpic-imagerow { margin-bottom: {$styles.content.imgtext.rowSpace}px; display: block; }
+ DIV.csc-textpic DIV.csc-textpic-imagerow { clear: both; }
+ DIV.csc-textpic DIV.csc-textpic-single-image IMG { margin-bottom: {$styles.content.imgtext.rowSpace}px; }
+
+ /* IE7 hack for margin between image rows */
+ *+html DIV.csc-textpic DIV.csc-textpic-imagerow .csc-textpic-image { margin-bottom: 0; }
+ *+html DIV.csc-textpic DIV.csc-textpic-imagerow { margin-bottom: {$styles.content.imgtext.rowSpace}px; }
+
+ /* No margins around the whole image-block */
+ DIV.csc-textpic DIV.csc-textpic-imagewrap .csc-textpic-firstcol { margin-left: 0px !important; }
+ DIV.csc-textpic DIV.csc-textpic-imagewrap .csc-textpic-lastcol { margin-right: 0px !important; }
+
+ /* Add margin from image-block to text (in case of "Text w/ images") */
+ DIV.csc-textpic-intext-left DIV.csc-textpic-imagewrap,
+ DIV.csc-textpic-intext-left-nowrap DIV.csc-textpic-imagewrap {
+ margin-right: {$styles.content.imgtext.textMargin}px !important;
+ }
+ DIV.csc-textpic-intext-right DIV.csc-textpic-imagewrap,
+ DIV.csc-textpic-intext-right-nowrap DIV.csc-textpic-imagewrap {
+ margin-left: {$styles.content.imgtext.textMargin}px !important;
+ }
+
+ /* Positioning of images: */
+
+ /* Above */
+ DIV.csc-textpic-above DIV.csc-textpic-text { clear: both; }
+
+ /* Center (above or below) */
+ DIV.csc-textpic-center { text-align: center; /* IE-hack */ }
+ DIV.csc-textpic-center DIV.csc-textpic-imagewrap { margin: 0 auto; }
+ DIV.csc-textpic-center DIV.csc-textpic-imagewrap .csc-textpic-image { text-align: left; /* Remove IE-hack */ }
+ DIV.csc-textpic-center DIV.csc-textpic-text { text-align: left; /* Remove IE-hack */ }
+
+ /* Right (above or below) */
+ DIV.csc-textpic-right DIV.csc-textpic-imagewrap { float: right; }
+ DIV.csc-textpic-right DIV.csc-textpic-text { clear: right; }
+
+ /* Left (above or below) */
+ DIV.csc-textpic-left DIV.csc-textpic-imagewrap { float: left; }
+ DIV.csc-textpic-left DIV.csc-textpic-text { clear: left; }
+
+ /* Left (in text) */
+ DIV.csc-textpic-intext-left DIV.csc-textpic-imagewrap { float: left; }
+
+ /* Right (in text) */
+ DIV.csc-textpic-intext-right DIV.csc-textpic-imagewrap { float: right; }
+
+ /* Right (in text, no wrap around) */
+ DIV.csc-textpic-intext-right-nowrap DIV.csc-textpic-imagewrap { float: right; clear: both; }
+ /* Hide from IE5-mac. Only IE-win sees this. \*/
+ * html DIV.csc-textpic-intext-right-nowrap .csc-textpic-text { height: 1%; }
+ /* End hide from IE5/mac */
+
+ /* Left (in text, no wrap around) */
+ DIV.csc-textpic-intext-left-nowrap DIV.csc-textpic-imagewrap { float: left; clear: both; }
+ /* Hide from IE5-mac. Only IE-win sees this. \*/
+ * html DIV.csc-textpic-intext-left-nowrap .csc-textpic-text,
+ * html .csc-textpic-intext-left ol,
+ * html .csc-textpic-intext-left ul { height: 1%; }
+ /* End hide from IE5/mac */
+
+ DIV.csc-textpic DIV.csc-textpic-imagerow-last { margin-bottom: 0; }
+
+ /* Browser fixes: */
+
+ /* Fix for unordered and ordered list with image "In text, left" */
+ .csc-textpic-intext-left ol, .csc-textpic-intext-left ul {padding-left: 40px; overflow: auto; }
+)
+
+# TYPO3 SVN ID: $Id$
+
diff --git a/tests/examplefiles/varnish.vcl b/tests/examplefiles/varnish.vcl
new file mode 100644
index 00000000..6258c313
--- /dev/null
+++ b/tests/examplefiles/varnish.vcl
@@ -0,0 +1,187 @@
+# This is the VCL configuration Varnish will automatically append to your VCL
+# file during compilation/loading. See the vcl(7) man page for details on syntax
+# and semantics.
+# New users is recommended to use the example.vcl file as a starting point.
+
+vcl 4.0;
+
+backend foo { .host = "192.168.1.1"; }
+
+probe blatti { .url = "foo"; }
+probe fooy {
+ .url = "beh";
+
+}
+
+acl foo {
+ "192.168.1.1";
+ "192.168.0.0"/24;
+ ! "192.168.0.1";
+}
+
+include "foo.vcl";
+
+import std;
+
+sub vcl_init {
+ new b = director.foo();
+}
+
+sub vcl_recv {
+ ban(req.url ~ "foo");
+ rollback();
+}
+sub vcl_recv {
+ if (req.method == "PRI") {
+ /* We do not support SPDY or HTTP/2.0 */
+ return (synth(405));
+ }
+ if (req.method != "GET" &&
+ req.method != "HEAD" &&
+ req.method != "PUT" &&
+ req.method != "POST" &&
+ req.method != "TRACE" &&
+ req.method != "OPTIONS" &&
+ req.method != "DELETE") {
+ /* Non-RFC2616 or CONNECT which is weird. */
+ return (pipe);
+ }
+
+ if (req.method != "GET" && req.method != "HEAD") {
+ /* We only deal with GET and HEAD by default */
+ return (pass);
+ }
+ if (req.http.Authorization || req.http.Cookie) {
+ /* Not cacheable by default */
+ return (pass);
+ }
+ return (hash);
+}
+
+sub vcl_pipe {
+ # By default Connection: close is set on all piped requests, to stop
+ # connection reuse from sending future requests directly to the
+ # (potentially) wrong backend. If you do want this to happen, you can undo
+ # it here.
+ # unset bereq.http.connection;
+ return (pipe);
+}
+
+sub vcl_pass {
+ return (fetch);
+}
+
+sub vcl_hash {
+ hash_data(req.url);
+ if (req.http.host) {
+ hash_data(req.http.host);
+ } else {
+ hash_data(server.ip);
+ }
+ return (lookup);
+}
+
+sub vcl_purge {
+ return (synth(200, "Purged"));
+}
+
+sub vcl_hit {
+ if (obj.ttl >= 0s) {
+ // A pure unadultered hit, deliver it
+ return (deliver);
+ }
+ if (obj.ttl + obj.grace > 0s) {
+ // Object is in grace, deliver it
+ // Automatically triggers a background fetch
+ return (deliver);
+ }
+ // fetch & deliver once we get the result
+ return (miss);
+}
+
+sub vcl_miss {
+ return (fetch);
+}
+
+sub vcl_deliver {
+ set resp.http.x-storage = storage.s0.free;
+ return (deliver);
+}
+
+/*
+ * We can come here "invisibly" with the following errors: 413, 417 & 503
+ */
+sub vcl_synth {
+ set resp.http.Content-Type = "text/html; charset=utf-8";
+ set resp.http.Retry-After = "5";
+ synthetic( {"<!DOCTYPE html>
+<html>
+ <head>
+ <title>"} + resp.status + " " + resp.reason + {"</title>
+ </head>
+ <body>
+ <h1>Error "} + resp.status + " " + resp.reason + {"</h1>
+ <p>"} + resp.reason + {"</p>
+ <h3>Guru Meditation:</h3>
+ <p>XID: "} + req.xid + {"</p>
+ <hr>
+ <p>Varnish cache server</p>
+ </body>
+</html>
+"} );
+ return (deliver);
+}
+
+#######################################################################
+# Backend Fetch
+
+sub vcl_backend_fetch {
+ return (fetch);
+}
+
+sub vcl_backend_response {
+ if (beresp.ttl <= 0s ||
+ beresp.http.Set-Cookie ||
+ beresp.http.Surrogate-control ~ "no-store" ||
+ (!beresp.http.Surrogate-Control &&
+ beresp.http.Cache-Control ~ "no-cache|no-store|private") ||
+ beresp.http.Vary == "*") {
+ /*
+ * Mark as "Hit-For-Pass" for the next 2 minutes
+ */
+ set beresp.ttl = 120s;
+ set beresp.uncacheable = true;
+ }
+ return (deliver);
+}
+
+sub vcl_backend_error {
+ set beresp.http.Content-Type = "text/html; charset=utf-8";
+ set beresp.http.Retry-After = "5";
+ synthetic( {"<!DOCTYPE html>
+<html>
+ <head>
+ <title>"} + beresp.status + " " + beresp.reason + {"</title>
+ </head>
+ <body>
+ <h1>Error "} + beresp.status + " " + beresp.reason + {"</h1>
+ <p>"} + beresp.reason + {"</p>
+ <h3>Guru Meditation:</h3>
+ <p>XID: "} + bereq.xid + {"</p>
+ <hr>
+ <p>Varnish cache server</p>
+ </body>
+</html>
+"} );
+ return (deliver);
+}
+
+#######################################################################
+# Housekeeping
+
+sub vcl_init {
+}
+
+sub vcl_fini {
+ return (ok);
+}
diff --git a/tests/examplefiles/wdiff_example1.wdiff b/tests/examplefiles/wdiff_example1.wdiff
new file mode 100644
index 00000000..ca760812
--- /dev/null
+++ b/tests/examplefiles/wdiff_example1.wdiff
@@ -0,0 +1,731 @@
+.. -*- mode: rst -*-
+
+{+.. highlight:: python+}
+
+====================
+Write your own lexer
+====================
+
+If a lexer for your favorite language is missing in the Pygments package, you
+can easily write your own and extend Pygments.
+
+All you need can be found inside the :mod:`pygments.lexer` module. As you can
+read in the :doc:`API documentation <api>`, a lexer is a class that is
+initialized with some keyword arguments (the lexer options) and that provides a
+:meth:`.get_tokens_unprocessed()` method which is given a string or unicode
+object with the data to [-parse.-] {+lex.+}
+
+The :meth:`.get_tokens_unprocessed()` method must return an iterator or iterable
+containing tuples in the form ``(index, token, value)``. Normally you don't
+need to do this since there are [-numerous-] base lexers {+that do most of the work and that+}
+you can subclass.
+
+
+RegexLexer
+==========
+
+[-A very powerful (but quite easy to use)-]
+
+{+The+} lexer {+base class used by almost all of Pygments' lexers+} is the
+:class:`RegexLexer`. This
+[-lexer base-] class allows you to define lexing rules in terms of
+*regular expressions* for different *states*.
+
+States are groups of regular expressions that are matched against the input
+string at the *current position*. If one of these expressions matches, a
+corresponding action is performed [-(normally-] {+(such as+} yielding a token with a specific
+[-type),-]
+{+type, or changing state),+} the current position is set to where the last match
+ended and the matching process continues with the first regex of the current
+state.
+
+Lexer states are kept [-in-] {+on+} a [-state-] stack: each time a new state is entered, the new
+state is pushed onto the stack. The most basic lexers (like the `DiffLexer`)
+just need one state.
+
+Each state is defined as a list of tuples in the form (`regex`, `action`,
+`new_state`) where the last item is optional. In the most basic form, `action`
+is a token type (like `Name.Builtin`). That means: When `regex` matches, emit a
+token with the match text and type `tokentype` and push `new_state` on the state
+stack. If the new state is ``'#pop'``, the topmost state is popped from the
+stack instead. [-(To-] {+To+} pop more than one state, use ``'#pop:2'`` and so [-on.)-] {+on.+}
+``'#push'`` is a synonym for pushing the current state on the stack.
+
+The following example shows the `DiffLexer` from the builtin lexers. Note that
+it contains some additional attributes `name`, `aliases` and `filenames` which
+aren't required for a lexer. They are used by the builtin lexer lookup
+functions.
+
+[-.. sourcecode:: python-] {+::+}
+
+ from pygments.lexer import RegexLexer
+ from pygments.token import *
+
+ class DiffLexer(RegexLexer):
+ name = 'Diff'
+ aliases = ['diff']
+ filenames = ['*.diff']
+
+ tokens = {
+ 'root': [
+ (r' .*\n', Text),
+ (r'\+.*\n', Generic.Inserted),
+ (r'-.*\n', Generic.Deleted),
+ (r'@.*\n', Generic.Subheading),
+ (r'Index.*\n', Generic.Heading),
+ (r'=.*\n', Generic.Heading),
+ (r'.*\n', Text),
+ ]
+ }
+
+As you can see this lexer only uses one state. When the lexer starts scanning
+the text, it first checks if the current character is a space. If this is true
+it scans everything until newline and returns the [-parsed-] data as {+a+} `Text` [-token.-] {+token (which
+is the "no special highlighting" token).+}
+
+If this rule doesn't match, it checks if the current char is a plus sign. And
+so on.
+
+If no rule matches at the current position, the current char is emitted as an
+`Error` token that indicates a [-parsing-] {+lexing+} error, and the position is increased by
+[-1.-]
+{+one.+}
+
+
+Adding and testing a new lexer
+==============================
+
+To make [-pygments-] {+Pygments+} aware of your new lexer, you have to perform the following
+steps:
+
+First, change to the current directory containing the [-pygments-] {+Pygments+} source code:
+
+.. [-sourcecode::-] {+code-block::+} console
+
+ $ cd .../pygments-main
+
+{+Select a matching module under ``pygments/lexers``, or create a new module for
+your lexer class.+}
+
+Next, make sure the lexer is known from outside of the module. All modules in
+the ``pygments.lexers`` specify ``__all__``. For example, [-``other.py`` sets:
+
+.. sourcecode:: python-] {+``esoteric.py`` sets::+}
+
+ __all__ = ['BrainfuckLexer', 'BefungeLexer', ...]
+
+Simply add the name of your lexer class to this list.
+
+Finally the lexer can be made [-publically-] {+publicly+} known by rebuilding the lexer mapping:
+
+.. [-sourcecode::-] {+code-block::+} console
+
+ $ make mapfiles
+
+To test the new lexer, store an example file with the proper extension in
+``tests/examplefiles``. For example, to test your ``DiffLexer``, add a
+``tests/examplefiles/example.diff`` containing a sample diff output.
+
+Now you can use pygmentize to render your example to HTML:
+
+.. [-sourcecode::-] {+code-block::+} console
+
+ $ ./pygmentize -O full -f html -o /tmp/example.html tests/examplefiles/example.diff
+
+Note that this [-explicitely-] {+explicitly+} calls the ``pygmentize`` in the current directory
+by preceding it with ``./``. This ensures your modifications are used.
+Otherwise a possibly already installed, unmodified version without your new
+lexer would have been called from the system search path (``$PATH``).
+
+To view the result, open ``/tmp/example.html`` in your browser.
+
+Once the example renders as expected, you should run the complete test suite:
+
+.. [-sourcecode::-] {+code-block::+} console
+
+ $ make test
+
+{+It also tests that your lexer fulfills the lexer API and certain invariants,
+such as that the concatenation of all token text is the same as the input text.+}
+
+
+Regex Flags
+===========
+
+You can either define regex flags {+locally+} in the regex (``r'(?x)foo bar'``) or
+{+globally+} by adding a `flags` attribute to your lexer class. If no attribute is
+defined, it defaults to `re.MULTILINE`. For more [-informations-] {+information+} about regular
+expression flags see the {+page about+} `regular expressions`_ [-help page-] in the [-python-] {+Python+}
+documentation.
+
+.. _regular expressions: [-http://docs.python.org/lib/re-syntax.html-] {+http://docs.python.org/library/re.html#regular-expression-syntax+}
+
+
+Scanning multiple tokens at once
+================================
+
+{+So far, the `action` element in the rule tuple of regex, action and state has
+been a single token type. Now we look at the first of several other possible
+values.+}
+
+Here is a more complex lexer that highlights INI files. INI files consist of
+sections, comments and [-key-] {+``key+} = [-value pairs:
+
+.. sourcecode:: python-] {+value`` pairs::+}
+
+ from pygments.lexer import RegexLexer, bygroups
+ from pygments.token import *
+
+ class IniLexer(RegexLexer):
+ name = 'INI'
+ aliases = ['ini', 'cfg']
+ filenames = ['*.ini', '*.cfg']
+
+ tokens = {
+ 'root': [
+ (r'\s+', Text),
+ (r';.*?$', Comment),
+ (r'\[.*?\]$', Keyword),
+ (r'(.*?)(\s*)(=)(\s*)(.*?)$',
+ bygroups(Name.Attribute, Text, Operator, Text, String))
+ ]
+ }
+
+The lexer first looks for whitespace, comments and section names. [-And later-] {+Later+} it
+looks for a line that looks like a key, value pair, separated by an ``'='``
+sign, and optional whitespace.
+
+The `bygroups` helper [-makes sure that-] {+yields+} each {+capturing+} group [-is yielded-] {+in the regex+} with a different
+token type. First the `Name.Attribute` token, then a `Text` token for the
+optional whitespace, after that a `Operator` token for the equals sign. Then a
+`Text` token for the whitespace again. The rest of the line is returned as
+`String`.
+
+Note that for this to work, every part of the match must be inside a capturing
+group (a ``(...)``), and there must not be any nested capturing groups. If you
+nevertheless need a group, use a non-capturing group defined using this syntax:
+[-``r'(?:some|words|here)'``-]
+{+``(?:some|words|here)``+} (note the ``?:`` after the beginning parenthesis).
+
+If you find yourself needing a capturing group inside the regex which shouldn't
+be part of the output but is used in the regular expressions for backreferencing
+(eg: ``r'(<(foo|bar)>)(.*?)(</\2>)'``), you can pass `None` to the bygroups
+function and [-it will skip-] that group will be skipped in the output.
+
+
+Changing states
+===============
+
+Many lexers need multiple states to work as expected. For example, some
+languages allow multiline comments to be nested. Since this is a recursive
+pattern it's impossible to lex just using regular expressions.
+
+Here is [-the solution:
+
+.. sourcecode:: python-] {+a lexer that recognizes C++ style comments (multi-line with ``/* */``
+and single-line with ``//`` until end of line)::+}
+
+ from pygments.lexer import RegexLexer
+ from pygments.token import *
+
+ class [-ExampleLexer(RegexLexer):-] {+CppCommentLexer(RegexLexer):+}
+ name = 'Example Lexer with states'
+
+ tokens = {
+ 'root': [
+ (r'[^/]+', Text),
+ (r'/\*', Comment.Multiline, 'comment'),
+ (r'//.*?$', Comment.Singleline),
+ (r'/', Text)
+ ],
+ 'comment': [
+ (r'[^*/]', Comment.Multiline),
+ (r'/\*', Comment.Multiline, '#push'),
+ (r'\*/', Comment.Multiline, '#pop'),
+ (r'[*/]', Comment.Multiline)
+ ]
+ }
+
+This lexer starts lexing in the ``'root'`` state. It tries to match as much as
+possible until it finds a slash (``'/'``). If the next character after the slash
+is [-a star-] {+an asterisk+} (``'*'``) the `RegexLexer` sends those two characters to the
+output stream marked as `Comment.Multiline` and continues [-parsing-] {+lexing+} with the rules
+defined in the ``'comment'`` state.
+
+If there wasn't [-a star-] {+an asterisk+} after the slash, the `RegexLexer` checks if it's a
+[-singleline-]
+{+Singleline+} comment [-(eg:-] {+(i.e.+} followed by a second slash). If this also wasn't the
+case it must be a single [-slash-] {+slash, which is not a comment starter+} (the separate
+regex for a single slash must also be given, else the slash would be marked as
+an error token).
+
+Inside the ``'comment'`` state, we do the same thing again. Scan until the
+lexer finds a star or slash. If it's the opening of a multiline comment, push
+the ``'comment'`` state on the stack and continue scanning, again in the
+``'comment'`` state. Else, check if it's the end of the multiline comment. If
+yes, pop one state from the stack.
+
+Note: If you pop from an empty stack you'll get an `IndexError`. (There is an
+easy way to prevent this from happening: don't ``'#pop'`` in the root state).
+
+If the `RegexLexer` encounters a newline that is flagged as an error token, the
+stack is emptied and the lexer continues scanning in the ``'root'`` state. This
+[-helps-]
+{+can help+} producing error-tolerant highlighting for erroneous input, e.g. when a
+single-line string is not closed.
+
+
+Advanced state tricks
+=====================
+
+There are a few more things you can do with states:
+
+- You can push multiple states onto the stack if you give a tuple instead of a
+ simple string as the third item in a rule tuple. For example, if you want to
+ match a comment containing a directive, something [-like::-] {+like:
+
+ .. code-block:: text+}
+
+ /* <processing directive> rest of comment */
+
+ you can use this [-rule:
+
+ .. sourcecode:: python-] {+rule::+}
+
+ tokens = {
+ 'root': [
+ (r'/\* <', Comment, ('comment', 'directive')),
+ ...
+ ],
+ 'directive': [
+ (r'[^>]*', Comment.Directive),
+ (r'>', Comment, '#pop'),
+ ],
+ 'comment': [
+ (r'[^*]+', Comment),
+ (r'\*/', Comment, '#pop'),
+ (r'\*', Comment),
+ ]
+ }
+
+ When this encounters the above sample, first ``'comment'`` and ``'directive'``
+ are pushed onto the stack, then the lexer continues in the directive state
+ until it finds the closing ``>``, then it continues in the comment state until
+ the closing ``*/``. Then, both states are popped from the stack again and
+ lexing continues in the root state.
+
+ .. versionadded:: 0.9
+ The tuple can contain the special ``'#push'`` and ``'#pop'`` (but not
+ ``'#pop:n'``) directives.
+
+
+- You can include the rules of a state in the definition of another. This is
+ done by using `include` from [-`pygments.lexer`:
+
+ .. sourcecode:: python-] {+`pygments.lexer`::+}
+
+ from pygments.lexer import RegexLexer, bygroups, include
+ from pygments.token import *
+
+ class ExampleLexer(RegexLexer):
+ tokens = {
+ 'comments': [
+ (r'/\*.*?\*/', Comment),
+ (r'//.*?\n', Comment),
+ ],
+ 'root': [
+ include('comments'),
+ (r'(function )(\w+)( {)',
+ bygroups(Keyword, Name, Keyword), 'function'),
+ (r'.', Text),
+ ],
+ 'function': [
+ (r'[^}/]+', Text),
+ include('comments'),
+ (r'/', Text),
+ [-(r'}',-]
+ {+(r'\}',+} Keyword, '#pop'),
+ ]
+ }
+
+ This is a hypothetical lexer for a language that consist of functions and
+ comments. Because comments can occur at toplevel and in functions, we need
+ rules for comments in both states. As you can see, the `include` helper saves
+ repeating rules that occur more than once (in this example, the state
+ ``'comment'`` will never be entered by the lexer, as it's only there to be
+ included in ``'root'`` and ``'function'``).
+
+- Sometimes, you may want to "combine" a state from existing ones. This is
+ possible with the [-`combine`-] {+`combined`+} helper from `pygments.lexer`.
+
+ If you, instead of a new state, write ``combined('state1', 'state2')`` as the
+ third item of a rule tuple, a new anonymous state will be formed from state1
+ and state2 and if the rule matches, the lexer will enter this state.
+
+ This is not used very often, but can be helpful in some cases, such as the
+ `PythonLexer`'s string literal processing.
+
+- If you want your lexer to start lexing in a different state you can modify the
+ stack by [-overloading-] {+overriding+} the `get_tokens_unprocessed()` [-method:
+
+ .. sourcecode:: python-] {+method::+}
+
+ from pygments.lexer import RegexLexer
+
+ class [-MyLexer(RegexLexer):-] {+ExampleLexer(RegexLexer):+}
+ tokens = {...}
+
+ def get_tokens_unprocessed(self, [-text):
+ stack = ['root', 'otherstate']-] {+text, stack=('root', 'otherstate')):+}
+ for item in RegexLexer.get_tokens_unprocessed(text, stack):
+ yield item
+
+ Some lexers like the `PhpLexer` use this to make the leading ``<?php``
+ preprocessor comments optional. Note that you can crash the lexer easily by
+ putting values into the stack that don't exist in the token map. Also
+ removing ``'root'`` from the stack can result in strange errors!
+
+- [-An-] {+In some lexers, a state should be popped if anything is encountered that isn't
+ matched by a rule in the state. You could use an+} empty regex at the end of [-a-]
+ {+the+} state list, [-combined with ``'#pop'``, can
+ act as-] {+but Pygments provides+} a [-return point-] {+more obvious way of spelling that:
+ ``default('#pop')`` is equivalent to ``('', Text, '#pop')``.
+
+ .. versionadded:: 2.0
+
+
+Subclassing lexers derived+} from {+RegexLexer
+==========================================
+
+.. versionadded:: 1.6
+
+Sometimes multiple languages are very similar, but should still be lexed by
+different lexer classes.
+
+When subclassing+} a {+lexer derived from RegexLexer, the ``tokens`` dictionaries
+defined in the parent and child class are merged. For example::
+
+ from pygments.lexer import RegexLexer, inherit
+ from pygments.token import *
+
+ class BaseLexer(RegexLexer):
+ tokens = {
+ 'root': [
+ ('[a-z]+', Name),
+ (r'/\*', Comment, 'comment'),
+ ('"', String, 'string'),
+ ('\s+', Text),
+ ],
+ 'string': [
+ ('[^"]+', String),
+ ('"', String, '#pop'),
+ ],
+ 'comment': [
+ ...
+ ],
+ }
+
+ class DerivedLexer(BaseLexer):
+ tokens = {
+ 'root': [
+ ('[0-9]+', Number),
+ inherit,
+ ],
+ 'string': [
+ (r'[^"\\]+', String),
+ (r'\\.', String.Escape),
+ ('"', String, '#pop'),
+ ],
+ }
+
+The `BaseLexer` defines two states, lexing names and strings. The
+`DerivedLexer` defines its own tokens dictionary, which extends the definitions
+of the base lexer:
+
+* The "root"+} state {+has an additional rule and then the special object `inherit`,
+ which tells Pygments to insert the token definitions of the parent class at+}
+ that [-doesn't have a clear end marker.-] {+point.
+
+* The "string" state is replaced entirely, since there is not `inherit` rule.
+
+* The "comment" state is inherited entirely.+}
+
+
+Using multiple lexers
+=====================
+
+Using multiple lexers for the same input can be tricky. One of the easiest
+combination techniques is shown here: You can replace the [-token type-] {+action+} entry in a rule
+tuple [-(the second item)-] with a lexer class. The matched text will then be lexed with that lexer,
+and the resulting tokens will be yielded.
+
+For example, look at this stripped-down HTML [-lexer:
+
+.. sourcecode:: python-] {+lexer::+}
+
+ from pygments.lexer import RegexLexer, bygroups, using
+ from pygments.token import *
+ from [-pygments.lexers.web-] {+pygments.lexers.javascript+} import JavascriptLexer
+
+ class HtmlLexer(RegexLexer):
+ name = 'HTML'
+ aliases = ['html']
+ filenames = ['*.html', '*.htm']
+
+ flags = re.IGNORECASE | re.DOTALL
+ tokens = {
+ 'root': [
+ ('[^<&]+', Text),
+ ('&.*?;', Name.Entity),
+ (r'<\s*script\s*', Name.Tag, ('script-content', 'tag')),
+ (r'<\s*[a-zA-Z0-9:]+', Name.Tag, 'tag'),
+ (r'<\s*/\s*[a-zA-Z0-9:]+\s*>', Name.Tag),
+ ],
+ 'script-content': [
+ (r'(.+?)(<\s*/\s*script\s*>)',
+ bygroups(using(JavascriptLexer), Name.Tag),
+ '#pop'),
+ ]
+ }
+
+Here the content of a ``<script>`` tag is passed to a newly created instance of
+a `JavascriptLexer` and not processed by the `HtmlLexer`. This is done using
+the `using` helper that takes the other lexer class as its parameter.
+
+Note the combination of `bygroups` and `using`. This makes sure that the
+content up to the ``</script>`` end tag is processed by the `JavascriptLexer`,
+while the end tag is yielded as a normal token with the `Name.Tag` type.
+
+[-As an additional goodie, if the lexer class is replaced by `this` (imported from
+`pygments.lexer`), the "other" lexer will be the current one (because you cannot
+refer to the current class within the code that runs at class definition time).-]
+
+Also note the ``(r'<\s*script\s*', Name.Tag, ('script-content', 'tag'))`` rule.
+Here, two states are pushed onto the state stack, ``'script-content'`` and
+``'tag'``. That means that first ``'tag'`` is processed, which will [-parse-] {+lex+}
+attributes and the closing ``>``, then the ``'tag'`` state is popped and the
+next state on top of the stack will be ``'script-content'``.
+
+{+Since you cannot refer to the class currently being defined, use `this`
+(imported from `pygments.lexer`) to refer to the current lexer class, i.e.
+``using(this)``. This construct may seem unnecessary, but this is often the
+most obvious way of lexing arbitrary syntax between fixed delimiters without
+introducing deeply nested states.+}
+
+The `using()` helper has a special keyword argument, `state`, which works as
+follows: if given, the lexer to use initially is not in the ``"root"`` state,
+but in the state given by this argument. This [-*only* works-] {+does not work+} with [-a `RegexLexer`.-] {+advanced
+`RegexLexer` subclasses such as `ExtendedRegexLexer` (see below).+}
+
+Any other keywords arguments passed to `using()` are added to the keyword
+arguments used to create the lexer.
+
+
+Delegating Lexer
+================
+
+Another approach for nested lexers is the `DelegatingLexer` which is for example
+used for the template engine lexers. It takes two lexers as arguments on
+initialisation: a `root_lexer` and a `language_lexer`.
+
+The input is processed as follows: First, the whole text is lexed with the
+`language_lexer`. All tokens yielded with [-a-] {+the special+} type of ``Other`` are
+then concatenated and given to the `root_lexer`. The language tokens of the
+`language_lexer` are then inserted into the `root_lexer`'s token stream at the
+appropriate positions.
+
+[-.. sourcecode:: python-] {+::+}
+
+ from pygments.lexer import DelegatingLexer
+ from pygments.lexers.web import HtmlLexer, PhpLexer
+
+ class HtmlPhpLexer(DelegatingLexer):
+ def __init__(self, **options):
+ super(HtmlPhpLexer, self).__init__(HtmlLexer, PhpLexer, **options)
+
+This procedure ensures that e.g. HTML with template tags in it is highlighted
+correctly even if the template tags are put into HTML tags or attributes.
+
+If you want to change the needle token ``Other`` to something else, you can give
+the lexer another token type as the third [-parameter:
+
+.. sourcecode:: python-] {+parameter::+}
+
+ DelegatingLexer.__init__(MyLexer, OtherLexer, Text, **options)
+
+
+Callbacks
+=========
+
+Sometimes the grammar of a language is so complex that a lexer would be unable
+to [-parse-] {+process+} it just by using regular expressions and stacks.
+
+For this, the `RegexLexer` allows callbacks to be given in rule tuples, instead
+of token types (`bygroups` and `using` are nothing else but preimplemented
+callbacks). The callback must be a function taking two arguments:
+
+* the lexer itself
+* the match object for the last matched rule
+
+The callback must then return an iterable of (or simply yield) ``(index,
+tokentype, value)`` tuples, which are then just passed through by
+`get_tokens_unprocessed()`. The ``index`` here is the position of the token in
+the input string, ``tokentype`` is the normal token type (like `Name.Builtin`),
+and ``value`` the associated part of the input string.
+
+You can see an example [-here:
+
+.. sourcecode:: python-] {+here::+}
+
+ from pygments.lexer import RegexLexer
+ from pygments.token import Generic
+
+ class HypotheticLexer(RegexLexer):
+
+ def headline_callback(lexer, match):
+ equal_signs = match.group(1)
+ text = match.group(2)
+ yield match.start(), Generic.Headline, equal_signs + text + equal_signs
+
+ tokens = {
+ 'root': [
+ (r'(=+)(.*?)(\1)', headline_callback)
+ ]
+ }
+
+If the regex for the `headline_callback` matches, the function is called with
+the match object. Note that after the callback is done, processing continues
+normally, that is, after the end of the previous match. The callback has no
+possibility to influence the position.
+
+There are not really any simple examples for lexer callbacks, but you can see
+them in action e.g. in the [-`compiled.py`_ source code-] {+`SMLLexer` class+} in [-the `CLexer` and
+`JavaLexer` classes.-] {+`ml.py`_.+}
+
+.. [-_compiled.py: http://bitbucket.org/birkenfeld/pygments-main/src/tip/pygments/lexers/compiled.py-] {+_ml.py: http://bitbucket.org/birkenfeld/pygments-main/src/tip/pygments/lexers/ml.py+}
+
+
+The ExtendedRegexLexer class
+============================
+
+The `RegexLexer`, even with callbacks, unfortunately isn't powerful enough for
+the funky syntax rules of [-some-] languages [-that will go unnamed,-] such as Ruby.
+
+But fear not; even then you don't have to abandon the regular expression
+[-approach. For-]
+{+approach:+} Pygments has a subclass of `RegexLexer`, the `ExtendedRegexLexer`.
+All features known from RegexLexers are available here too, and the tokens are
+specified in exactly the same way, *except* for one detail:
+
+The `get_tokens_unprocessed()` method holds its internal state data not as local
+variables, but in an instance of the `pygments.lexer.LexerContext` class, and
+that instance is passed to callbacks as a third argument. This means that you
+can modify the lexer state in callbacks.
+
+The `LexerContext` class has the following members:
+
+* `text` -- the input text
+* `pos` -- the current starting position that is used for matching regexes
+* `stack` -- a list containing the state stack
+* `end` -- the maximum position to which regexes are matched, this defaults to
+ the length of `text`
+
+Additionally, the `get_tokens_unprocessed()` method can be given a
+`LexerContext` instead of a string and will then process this context instead of
+creating a new one for the string argument.
+
+Note that because you can set the current position to anything in the callback,
+it won't be automatically be set by the caller after the callback is finished.
+For example, this is how the hypothetical lexer above would be written with the
+[-`ExtendedRegexLexer`:
+
+.. sourcecode:: python-]
+{+`ExtendedRegexLexer`::+}
+
+ from pygments.lexer import ExtendedRegexLexer
+ from pygments.token import Generic
+
+ class ExHypotheticLexer(ExtendedRegexLexer):
+
+ def headline_callback(lexer, match, ctx):
+ equal_signs = match.group(1)
+ text = match.group(2)
+ yield match.start(), Generic.Headline, equal_signs + text + equal_signs
+ ctx.pos = match.end()
+
+ tokens = {
+ 'root': [
+ (r'(=+)(.*?)(\1)', headline_callback)
+ ]
+ }
+
+This might sound confusing (and it can really be). But it is needed, and for an
+example look at the Ruby lexer in [-`agile.py`_.-] {+`ruby.py`_.+}
+
+.. [-_agile.py: https://bitbucket.org/birkenfeld/pygments-main/src/tip/pygments/lexers/agile.py
+
+
+Filtering-] {+_ruby.py: https://bitbucket.org/birkenfeld/pygments-main/src/tip/pygments/lexers/ruby.py
+
+
+Handling Lists of Keywords
+==========================
+
+For a relatively short list (hundreds) you can construct an optimized regular
+expression directly using ``words()`` (longer lists, see next section). This
+function handles a few things for you automatically, including escaping
+metacharacters and Python's first-match rather than longest-match in
+alternations. Feel free to put the lists themselves in
+``pygments/lexers/_$lang_builtins.py`` (see examples there), and generated by
+code if possible.
+
+An example of using ``words()`` is something like::
+
+ from pygments.lexer import RegexLexer, words, Name
+
+ class MyLexer(RegexLexer):
+
+ tokens = {
+ 'root': [
+ (words(('else', 'elseif'), suffix=r'\b'), Name.Builtin),
+ (r'\w+', Name),
+ ],
+ }
+
+As you can see, you can add ``prefix`` and ``suffix`` parts to the constructed
+regex.
+
+
+Modifying+} Token Streams
+=======================
+
+Some languages ship a lot of builtin functions (for example PHP). The total
+amount of those functions differs from system to system because not everybody
+has every extension installed. In the case of PHP there are over 3000 builtin
+functions. That's an [-incredible-] {+incredibly+} huge amount of functions, much more than you
+[-can-]
+{+want to+} put into a regular expression.
+
+But because only `Name` tokens can be function names [-it's-] {+this is+} solvable by
+overriding the ``get_tokens_unprocessed()`` method. The following lexer
+subclasses the `PythonLexer` so that it highlights some additional names as
+pseudo [-keywords:
+
+.. sourcecode:: python-] {+keywords::+}
+
+ from [-pygments.lexers.agile-] {+pygments.lexers.python+} import PythonLexer
+ from pygments.token import Name, Keyword
+
+ class MyPythonLexer(PythonLexer):
+ EXTRA_KEYWORDS = [-['foo',-] {+set(('foo',+} 'bar', 'foobar', 'barfoo', 'spam', [-'eggs']-] {+'eggs'))+}
+
+ def get_tokens_unprocessed(self, text):
+ for index, token, value in PythonLexer.get_tokens_unprocessed(self, text):
+ if token is Name and value in self.EXTRA_KEYWORDS:
+ yield index, Keyword.Pseudo, value
+ else:
+ yield index, token, value
+
+The `PhpLexer` and `LuaLexer` use this method to resolve builtin functions.
+
+[-.. note:: Do not confuse this with the :doc:`filter <filters>` system.-]
diff --git a/tests/examplefiles/wdiff_example3.wdiff b/tests/examplefiles/wdiff_example3.wdiff
new file mode 100644
index 00000000..0bbd6d65
--- /dev/null
+++ b/tests/examplefiles/wdiff_example3.wdiff
@@ -0,0 +1,10 @@
+This example is unbalanced open-close.
+We can't treat these easily.
+
+{+ added? -]
+[- deleted? +}
+
+suddenly closed -]
+suddenly closed +}
+
+{+ added? [- deleted?
diff --git a/tests/test_lexers_other.py b/tests/test_lexers_other.py
index bb667c05..90d05ef8 100644
--- a/tests/test_lexers_other.py
+++ b/tests/test_lexers_other.py
@@ -13,6 +13,7 @@ import unittest
from pygments.lexers import guess_lexer
from pygments.lexers.scripting import EasytrieveLexer, JclLexer, RexxLexer
+
def _exampleFilePath(filename):
return os.path.join(os.path.dirname(__file__), 'examplefiles', filename)
@@ -28,8 +29,8 @@ class AnalyseTextTest(unittest.TestCase):
text = fp.read().decode('utf-8')
probability = lexer.analyse_text(text)
self.assertTrue(probability > 0,
- '%s must recognize %r' % (
- lexer.name, exampleFilePath))
+ '%s must recognize %r' % (
+ lexer.name, exampleFilePath))
guessedLexer = guess_lexer(text)
self.assertEqual(guessedLexer.name, lexer.name)
@@ -45,25 +46,24 @@ class AnalyseTextTest(unittest.TestCase):
class EasyTrieveLexerTest(unittest.TestCase):
def testCanGuessFromText(self):
- self.assertLess(0, EasytrieveLexer.analyse_text('MACRO'))
- self.assertLess(0, EasytrieveLexer.analyse_text('\nMACRO'))
- self.assertLess(0, EasytrieveLexer.analyse_text(' \nMACRO'))
- self.assertLess(0, EasytrieveLexer.analyse_text(' \n MACRO'))
- self.assertLess(0, EasytrieveLexer.analyse_text('*\nMACRO'))
- self.assertLess(0, EasytrieveLexer.analyse_text(
+ self.assertTrue(EasytrieveLexer.analyse_text('MACRO'))
+ self.assertTrue(EasytrieveLexer.analyse_text('\nMACRO'))
+ self.assertTrue(EasytrieveLexer.analyse_text(' \nMACRO'))
+ self.assertTrue(EasytrieveLexer.analyse_text(' \n MACRO'))
+ self.assertTrue(EasytrieveLexer.analyse_text('*\nMACRO'))
+ self.assertTrue(EasytrieveLexer.analyse_text(
'*\n *\n\n \n*\n MACRO'))
class RexxLexerTest(unittest.TestCase):
def testCanGuessFromText(self):
- self.assertAlmostEqual(0.01,
- RexxLexer.analyse_text('/* */'))
+ self.assertAlmostEqual(0.01, RexxLexer.analyse_text('/* */'))
self.assertAlmostEqual(1.0,
- RexxLexer.analyse_text('''/* Rexx */
+ RexxLexer.analyse_text('''/* Rexx */
say "hello world"'''))
val = RexxLexer.analyse_text('/* */\n'
- 'hello:pRoceduRe\n'
- ' say "hello world"')
+ 'hello:pRoceduRe\n'
+ ' say "hello world"')
self.assertTrue(val > 0.5, val)
val = RexxLexer.analyse_text('''/* */
if 1 > 0 then do
diff --git a/tests/test_terminal_formatter.py b/tests/test_terminal_formatter.py
index 07337cd5..cb5c6c44 100644
--- a/tests/test_terminal_formatter.py
+++ b/tests/test_terminal_formatter.py
@@ -14,7 +14,13 @@ import re
from pygments.util import StringIO
from pygments.lexers.sql import PlPgsqlLexer
-from pygments.formatters import TerminalFormatter
+from pygments.formatters import TerminalFormatter, Terminal256Formatter, \
+ HtmlFormatter, LatexFormatter
+
+from pygments.style import Style
+from pygments.token import Token
+from pygments.lexers import Python3Lexer
+from pygments import highlight
DEMO_TEXT = '''\
-- comment
@@ -26,9 +32,11 @@ DEMO_TOKENS = list(DEMO_LEXER().get_tokens(DEMO_TEXT))
ANSI_RE = re.compile(r'\x1b[\w\W]*?m')
+
def strip_ansi(x):
return ANSI_RE.sub('', x)
+
class TerminalFormatterTest(unittest.TestCase):
def test_reasonable_output(self):
out = StringIO()
@@ -49,3 +57,46 @@ class TerminalFormatterTest(unittest.TestCase):
for a, b in zip(DEMO_TEXT.splitlines(), plain.splitlines()):
self.assertTrue(a in b)
+
+
+class MyStyle(Style):
+ styles = {
+ Token.Comment: '#ansidarkgray',
+ Token.String: '#ansiblue bg:#ansidarkred',
+ Token.Number: '#ansigreen bg:#ansidarkgreen',
+ Token.Number.Hex: '#ansidarkgreen bg:#ansired',
+ }
+
+
+class Terminal256FormatterTest(unittest.TestCase):
+ code = '''
+# this should be a comment
+print("Hello World")
+async def function(a,b,c, *d, **kwarg:Bool)->Bool:
+ pass
+ return 123, 0xb3e3
+
+'''
+
+ def test_style_html(self):
+ style = HtmlFormatter(style=MyStyle).get_style_defs()
+ self.assertTrue('#555555' in style,
+ "ansigray for comment not html css style")
+
+ def test_others_work(self):
+ """check other formatters don't crash"""
+ highlight(self.code, Python3Lexer(), LatexFormatter(style=MyStyle))
+ highlight(self.code, Python3Lexer(), HtmlFormatter(style=MyStyle))
+
+ def test_256esc_seq(self):
+ """
+ test that a few escape sequences are actualy used when using #ansi<> color codes
+ """
+ def termtest(x):
+ return highlight(x, Python3Lexer(),
+ Terminal256Formatter(style=MyStyle))
+
+ self.assertTrue('32;41' in termtest('0x123'))
+ self.assertTrue('32;42' in termtest('123'))
+ self.assertTrue('30;01' in termtest('#comment'))
+ self.assertTrue('34;41' in termtest('"String"'))