summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
authorMatth?us G. Chajdas <dev@anteru.net>2018-11-24 15:34:31 +0100
committerMatth?us G. Chajdas <dev@anteru.net>2018-11-24 15:34:31 +0100
commit058fcfb0ff9bfeea8b9c29196a952e58ccf3e188 (patch)
tree5a969bdc210a6bacde9bca22fac2ee40524d0cf2 /pygments
parentbd2cb3c85d549bee2bcc6e4fa882470b4acbda5d (diff)
parent4f5f39dcfe35c329aa2d1be65724782092dd783e (diff)
downloadpygments-058fcfb0ff9bfeea8b9c29196a952e58ccf3e188.tar.gz
Merge with stable.
Diffstat (limited to 'pygments')
-rw-r--r--pygments/lexers/_lua_builtins.py2
-rw-r--r--pygments/lexers/_mapping.py2
-rw-r--r--pygments/lexers/ampl.py4
-rw-r--r--pygments/lexers/css.py23
-rw-r--r--pygments/lexers/jvm.py2
-rw-r--r--pygments/lexers/rust.py2
-rw-r--r--pygments/plugin.py4
7 files changed, 22 insertions, 17 deletions
diff --git a/pygments/lexers/_lua_builtins.py b/pygments/lexers/_lua_builtins.py
index c60bf5a2..0561725d 100644
--- a/pygments/lexers/_lua_builtins.py
+++ b/pygments/lexers/_lua_builtins.py
@@ -288,7 +288,7 @@ if __name__ == '__main__': # pragma: no cover
print('>> %s' % full_function_name)
m = get_function_module(full_function_name)
modules.setdefault(m, []).append(full_function_name)
- modules = {k: tuple(v) for k, v in modules.iteritems()}
+ modules = dict((k, tuple(v)) for k, v in modules.iteritems())
regenerate(__file__, modules)
diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py
index b48ee1d1..050373aa 100644
--- a/pygments/lexers/_mapping.py
+++ b/pygments/lexers/_mapping.py
@@ -367,7 +367,7 @@ LEXERS = {
'RtsLexer': ('pygments.lexers.trafficscript', 'TrafficScript', ('rts', 'trafficscript'), ('*.rts',), ()),
'RubyConsoleLexer': ('pygments.lexers.ruby', 'Ruby irb session', ('rbcon', 'irb'), (), ('text/x-ruby-shellsession',)),
'RubyLexer': ('pygments.lexers.ruby', 'Ruby', ('rb', 'ruby', 'duby'), ('*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec', '*.rbx', '*.duby', 'Gemfile'), ('text/x-ruby', 'application/x-ruby')),
- 'RustLexer': ('pygments.lexers.rust', 'Rust', ('rust',), ('*.rs', '*.rs.in'), ('text/rust',)),
+ 'RustLexer': ('pygments.lexers.rust', 'Rust', ('rust', 'rs'), ('*.rs', '*.rs.in'), ('text/rust',)),
'SASLexer': ('pygments.lexers.sas', 'SAS', ('sas',), ('*.SAS', '*.sas'), ('text/x-sas', 'text/sas', 'application/x-sas')),
'SLexer': ('pygments.lexers.r', 'S', ('splus', 's', 'r'), ('*.S', '*.R', '.Rhistory', '.Rprofile', '.Renviron'), ('text/S-plus', 'text/S', 'text/x-r-source', 'text/x-r', 'text/x-R', 'text/x-r-history', 'text/x-r-profile')),
'SMLLexer': ('pygments.lexers.ml', 'Standard ML', ('sml',), ('*.sml', '*.sig', '*.fun'), ('text/x-standardml', 'application/x-standardml')),
diff --git a/pygments/lexers/ampl.py b/pygments/lexers/ampl.py
index d439cb19..638d025d 100644
--- a/pygments/lexers/ampl.py
+++ b/pygments/lexers/ampl.py
@@ -3,7 +3,7 @@
pygments.lexers.ampl
~~~~~~~~~~~~~~~~~~~~
- Lexers for the ampl language. <http://ampl.com/>
+ Lexers for the AMPL language.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
@@ -18,7 +18,7 @@ __all__ = ['AmplLexer']
class AmplLexer(RegexLexer):
"""
- For AMPL source code.
+ For `AMPL <http://ampl.com/>`_ source code.
.. versionadded:: 2.2
"""
diff --git a/pygments/lexers/css.py b/pygments/lexers/css.py
index 29d83707..ce97730e 100644
--- a/pygments/lexers/css.py
+++ b/pygments/lexers/css.py
@@ -125,7 +125,7 @@ _css_properties = (
'wrap-flow', 'wrap-inside', 'wrap-through', 'writing-mode', 'z-index',
)
-# List of keyword values obtained from:
+# List of keyword values obtained from:
# http://cssvalues.com/
_keyword_values = (
'absolute', 'alias', 'all', 'all-petite-caps', 'all-scroll',
@@ -263,7 +263,7 @@ _time_units = (
's', 'ms',
)
_all_units = _angle_units + _frequency_units + _length_units + \
- _resolution_units + _time_units
+ _resolution_units + _time_units
class CssLexer(RegexLexer):
@@ -322,16 +322,18 @@ class CssLexer(RegexLexer):
include('urls'),
(r'('+r'|'.join(_functional_notation_keyword_values)+r')(\()',
bygroups(Name.Builtin, Punctuation), 'function-start'),
- (r'([a-zA-Z_][\w-]+)(\()', bygroups(Name.Function, Punctuation), 'function-start'),
+ (r'([a-zA-Z_][\w-]+)(\()',
+ bygroups(Name.Function, Punctuation), 'function-start'),
(words(_keyword_values, suffix=r'\b'), Keyword.Constant),
(words(_other_keyword_values, suffix=r'\b'), Keyword.Constant),
(words(_color_keywords, suffix=r'\b'), Keyword.Constant),
- (words(_css_properties, suffix=r'\b'), Keyword), # for transition-property etc.
+ # for transition-property etc.
+ (words(_css_properties, suffix=r'\b'), Keyword),
(r'\!important', Comment.Preproc),
(r'/\*(?:.|\n)*?\*/', Comment),
include('numeric-values'),
-
+
(r'[~^*!%&<>|+=@:./?-]+', Operator),
(r'[\[\](),]+', Punctuation),
(r'"(\\\\|\\"|[^"])*"', String.Double),
@@ -351,7 +353,8 @@ class CssLexer(RegexLexer):
# function-start may be entered recursively
(r'(' + r'|'.join(_functional_notation_keyword_values) + r')(\()',
bygroups(Name.Builtin, Punctuation), 'function-start'),
- (r'([a-zA-Z_][\w-]+)(\()', bygroups(Name.Function, Punctuation), 'function-start'),
+ (r'([a-zA-Z_][\w-]+)(\()',
+ bygroups(Name.Function, Punctuation), 'function-start'),
(r'/\*(?:.|\n)*?\*/', Comment),
include('numeric-values'),
@@ -373,8 +376,8 @@ class CssLexer(RegexLexer):
'numeric-values': [
(r'\#[a-zA-Z0-9]{1,6}', Number.Hex),
(r'[+\-]?[0-9]*[.][0-9]+', Number.Float, 'numeric-end'),
- (r'[+\-]?[0-9]+', Number.Integer, 'numeric-end'),
- ],
+ (r'[+\-]?[0-9]+', Number.Integer, 'numeric-end'),
+ ],
'numeric-end': [
(words(_all_units, suffix=r'\b'), Keyword.Type),
(r'%', Keyword.Type),
@@ -466,9 +469,9 @@ common_sass_tokens = {
],
'string-single': [
- (r"(\\.|#(?=[^\n{])|[^\n'#])+", String.Double),
+ (r"(\\.|#(?=[^\n{])|[^\n'#])+", String.Single),
(r'#\{', String.Interpol, 'interpolation'),
- (r"'", String.Double, '#pop'),
+ (r"'", String.Single, '#pop'),
],
'string-url': [
diff --git a/pygments/lexers/jvm.py b/pygments/lexers/jvm.py
index f4392839..ccff41c1 100644
--- a/pygments/lexers/jvm.py
+++ b/pygments/lexers/jvm.py
@@ -801,7 +801,7 @@ class ClojureLexer(RegexLexer):
# TODO / should divide keywords/symbols into namespace/rest
# but that's hard, so just pretend / is part of the name
- valid_name = r'(?!#)[\w!$%*+<=>?/.#-]+'
+ valid_name = r'(?!#)[\w!$%*+<=>?/.#|-]+'
tokens = {
'root': [
diff --git a/pygments/lexers/rust.py b/pygments/lexers/rust.py
index 6914f54d..10097fba 100644
--- a/pygments/lexers/rust.py
+++ b/pygments/lexers/rust.py
@@ -24,7 +24,7 @@ class RustLexer(RegexLexer):
"""
name = 'Rust'
filenames = ['*.rs', '*.rs.in']
- aliases = ['rust']
+ aliases = ['rust', 'rs']
mimetypes = ['text/rust']
keyword_types = (
diff --git a/pygments/plugin.py b/pygments/plugin.py
index 7987d646..08d9b5b4 100644
--- a/pygments/plugin.py
+++ b/pygments/plugin.py
@@ -40,14 +40,16 @@ FORMATTER_ENTRY_POINT = 'pygments.formatters'
STYLE_ENTRY_POINT = 'pygments.styles'
FILTER_ENTRY_POINT = 'pygments.filters'
+
def iter_entry_points(group_name):
try:
import pkg_resources
- except ImportError:
+ except (ImportError, IOError):
return []
return pkg_resources.iter_entry_points(group_name)
+
def find_plugin_lexers():
for entrypoint in iter_entry_points(LEXER_ENTRY_POINT):
yield entrypoint.load()