summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-11-06 14:00:28 +0100
committerGeorg Brandl <georg@python.org>2014-11-06 14:00:28 +0100
commitc863ac19ce4d591b93be8b36cb69b04422c8dc9f (patch)
tree98bd701a6fb0da18d92897960eabdd9a139ad7d4
parent90fe03b0f663810f4b6718d89b5e830ec2c67960 (diff)
downloadpygments-c863ac19ce4d591b93be8b36cb69b04422c8dc9f.tar.gz
Simplify charclasses in the remaining modules
-rw-r--r--pygments/lexers/ambient.py4
-rw-r--r--pygments/lexers/automation.py12
-rw-r--r--pygments/lexers/basic.py12
-rw-r--r--pygments/lexers/business.py14
-rw-r--r--pygments/lexers/chapel.py2
-rw-r--r--pygments/lexers/configs.py12
-rw-r--r--pygments/lexers/data.py30
-rw-r--r--pygments/lexers/dotnet.py8
-rw-r--r--pygments/lexers/ecl.py4
-rw-r--r--pygments/lexers/eiffel.py2
-rw-r--r--pygments/lexers/erlang.py6
-rw-r--r--pygments/lexers/esoteric.py4
-rw-r--r--pygments/lexers/factor.py4
-rw-r--r--pygments/lexers/fortran.py6
-rw-r--r--pygments/lexers/graph.py2
-rw-r--r--pygments/lexers/haxe.py16
-rw-r--r--pygments/lexers/modeling.py8
-rw-r--r--pygments/lexers/nit.py8
-rw-r--r--pygments/lexers/nix.py8
-rw-r--r--pygments/lexers/ooc.py2
-rw-r--r--pygments/lexers/scripting.py3
21 files changed, 82 insertions, 85 deletions
diff --git a/pygments/lexers/ambient.py b/pygments/lexers/ambient.py
index 22ee0f9c..ff8a1f65 100644
--- a/pygments/lexers/ambient.py
+++ b/pygments/lexers/ambient.py
@@ -46,10 +46,10 @@ class AmbientTalkLexer(RegexLexer):
(r'(~|lobby|jlobby|/)\.', Keyword.Constant, 'namespace'),
(r'"(\\\\|\\"|[^"])*"', String),
(r'\|', Punctuation, 'arglist'),
- (r'<:|[\^\*!%&<>+=,./?-]|:=', Operator),
+ (r'<:|[*^!%&<>+=,./?-]|:=', Operator),
(r"`[a-zA-Z_]\w*", String.Symbol),
(r"[a-zA-Z_]\w*:", Name.Function),
- (r"[\{\}()\[\];`]", Punctuation),
+ (r"[{}()\[\];`]", Punctuation),
(r'(self|super)\b', Name.Variable.Instance),
(r"[a-zA-Z_]\w*", Name.Variable),
(r"@[a-zA-Z_]\w*", Name.Class),
diff --git a/pygments/lexers/automation.py b/pygments/lexers/automation.py
index 7be1b9a4..a66ceffa 100644
--- a/pygments/lexers/automation.py
+++ b/pygments/lexers/automation.py
@@ -45,7 +45,7 @@ class AutohotkeyLexer(RegexLexer):
include('numbers'),
(r'[a-zA-Z_#@$][\w#@$]*', Name),
(r'\\|\'', Text),
- (r'\`([\,\%\`abfnrtv\-\+;])', String.Escape),
+ (r'\`([,%`abfnrtv\-+;])', String.Escape),
include('garbage'),
],
'incomment': [
@@ -165,7 +165,7 @@ class AutohotkeyLexer(RegexLexer):
'labels': [
# hotkeys and labels
# technically, hotkey names are limited to named keys and buttons
- (r'(^\s*)([^:\s\(\"]+?:{1,2})', bygroups(Text, Name.Label)),
+ (r'(^\s*)([^:\s("]+?:{1,2})', bygroups(Text, Name.Label)),
(r'(^\s*)(::[^:\s]+?::)', bygroups(Text, Name.Label)),
],
'numbers': [
@@ -177,7 +177,7 @@ class AutohotkeyLexer(RegexLexer):
(r'\d+', Number.Integer)
],
'stringescape': [
- (r'\"\"|\`([\,\%\`abfnrtv])', String.Escape),
+ (r'\"\"|\`([,%`abfnrtv])', String.Escape),
],
'strings': [
(r'[^"\n]+', String),
@@ -319,7 +319,7 @@ class AutoItLexer(RegexLexer):
(r'(#comments-start|#cs).*?(#comments-end|#ce)', Comment.Multiline),
(r'[\[\]{}(),;]', Punctuation),
(r'(and|or|not)\b', Operator.Word),
- (r'[\$|@][a-zA-Z_]\w*', Name.Variable),
+ (r'[$|@][a-zA-Z_]\w*', Name.Variable),
(r'!=|==|:=|\.=|<<|>>|[-~+/*%=<>&^|?:!.]', Operator),
include('commands'),
include('labels'),
@@ -329,7 +329,7 @@ class AutoItLexer(RegexLexer):
include('numbers'),
(r'[a-zA-Z_#@$][\w#@$]*', Name),
(r'\\|\'', Text),
- (r'\`([\,\%\`abfnrtv\-\+;])', String.Escape),
+ (r'\`([,%`abfnrtv\-+;])', String.Escape),
(r'_\n', Text), # Line continuation
include('garbage'),
],
@@ -358,7 +358,7 @@ class AutoItLexer(RegexLexer):
(r'\d+', Number.Integer)
],
'stringescape': [
- (r'\"\"|\`([\,\%\`abfnrtv])', String.Escape),
+ (r'\"\"|\`([,%`abfnrtv])', String.Escape),
],
'strings': [
(r'[^"\n]+', String),
diff --git a/pygments/lexers/basic.py b/pygments/lexers/basic.py
index a5e79e5e..0ec459ef 100644
--- a/pygments/lexers/basic.py
+++ b/pygments/lexers/basic.py
@@ -269,7 +269,7 @@ class MonkeyLexer(RegexLexer):
# Other
(r'<=|>=|<>|\*=|/=|\+=|-=|&=|~=|\|=|[-&*/^+=<>|~]', Operator),
(r'(?i)(?:Not|Mod|Shl|Shr|And|Or)', Operator.Word),
- (r'[\(\){}!#,.:]', Punctuation),
+ (r'[(){}!#,.:]', Punctuation),
# catch the rest
(r'%s\b' % name_constant, Name.Constant),
(r'%s\b' % name_function, Name.Function),
@@ -345,7 +345,7 @@ class CbmBasicV2Lexer(RegexLexer):
(r'not|and|or', Operator.Word),
(r'"[^"\n]*.', String),
(r'\d+|[-+]?\d*\.\d*(e[-+]?\d+)?', Number.Float),
- (r'[\(\),:;]', Punctuation),
+ (r'[(),:;]', Punctuation),
(r'\w+[$%]?', Name),
]
}
@@ -435,16 +435,16 @@ class QBasicLexer(RegexLexer):
bygroups(Text.Whitespace, Name.Label, Text.Whitespace)),
(r'(?=[\s]*)(\w+)(?=[\s]*=)', Name.Variable.Global),
(r'(?=[^"]*)\'.*$', Comment.Single),
- (r'"[^\n\"]*"', String.Double),
+ (r'"[^\n"]*"', String.Double),
(r'(END)(\s+)(FUNCTION|IF|SELECT|SUB)',
bygroups(Keyword.Reserved, Text.Whitespace, Keyword.Reserved)),
(r'(DECLARE)(\s+)([A-Z]+)(\s+)(\S+)',
bygroups(Keyword.Declaration, Text.Whitespace, Name.Variable,
Text.Whitespace, Name)),
- (r'(DIM)(\s+)(SHARED)(\s+)([^\s\(]+)',
+ (r'(DIM)(\s+)(SHARED)(\s+)([^\s(]+)',
bygroups(Keyword.Declaration, Text.Whitespace, Name.Variable,
Text.Whitespace, Name.Variable.Global)),
- (r'(DIM)(\s+)([^\s\(]+)',
+ (r'(DIM)(\s+)([^\s(]+)',
bygroups(Keyword.Declaration, Text.Whitespace, Name.Variable.Global)),
(r'^(\s*)([a-zA-Z_]+)(\s*)(\=)',
bygroups(Text.Whitespace, Name.Variable.Global, Text.Whitespace,
@@ -459,7 +459,7 @@ class QBasicLexer(RegexLexer):
include('operators'),
include('statements'),
include('keywords'),
- (r'[a-zA-Z_]\w*[\$@#&!]', Name.Variable.Global),
+ (r'[a-zA-Z_]\w*[$@#&!]', Name.Variable.Global),
(r'[a-zA-Z_]\w*\:', Name.Label),
(r'\-?\d*\.\d+[@|#]?', Number.Float),
(r'\-?\d+[@|#]', Number.Float),
diff --git a/pygments/lexers/business.py b/pygments/lexers/business.py
index 4be1fd4a..59d02023 100644
--- a/pygments/lexers/business.py
+++ b/pygments/lexers/business.py
@@ -48,7 +48,7 @@ class CobolLexer(RegexLexer):
include('strings'),
include('core'),
include('nums'),
- (r'[a-z0-9]([_a-z0-9\-]*[a-z0-9]+)?', Name.Variable),
+ (r'[a-z0-9]([\w\-]*[a-z0-9]+)?', Name.Variable),
# (r'[\s]+', Text),
(r'[ \t]+', Text),
],
@@ -211,8 +211,8 @@ class CobolLexer(RegexLexer):
'nums': [
(r'\d+(\s*|\.$|$)', Number.Integer),
- (r'[+-]?\d*\.\d+([eE][-+]?\d+)?', Number.Float),
- (r'[+-]?\d+\.\d*([eE][-+]?\d+)?', Number.Float),
+ (r'[+-]?\d*\.\d+(E[-+]?\d+)?', Number.Float),
+ (r'[+-]?\d+\.\d*(E[-+]?\d+)?', Number.Float),
],
}
@@ -422,7 +422,7 @@ class ABAPLexer(RegexLexer):
(r'[?*<>=\-+]', Operator),
(r"'(''|[^'])*'", String.Single),
(r"`([^`])*`", String.Single),
- (r'[/;:()\[\],\.]', Punctuation)
+ (r'[/;:()\[\],.]', Punctuation)
],
}
@@ -516,7 +516,7 @@ com/gooddata/processor/COMMANDS.txt>`_
(r'[a-z]\w*', Name.Variable),
(r'=', Operator),
(r'"', String, 'string-literal'),
- (r'[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]{1,3})?', Number),
+ (r'[0-9]+(?:\.[0-9]+)?(?:e[+-]?[0-9]{1,3})?', Number),
# Space is not significant
(r'\s', Text)
],
@@ -550,7 +550,7 @@ class MaqlLexer(RegexLexer):
# IDENTIFIER
(r'\{[^}]+\}', Name.Variable),
# NUMBER
- (r'[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]{1,3})?', Number),
+ (r'[0-9]+(?:\.[0-9]+)?(?:e[+-]?[0-9]{1,3})?', Number),
# STRING
(r'"', String, 'string-literal'),
# RELATION
@@ -580,7 +580,7 @@ class MaqlLexer(RegexLexer):
# Comments
(r'#.*', Comment.Single),
# Punctuation
- (r'[,;\(\)]', Punctuation),
+ (r'[,;()]', Punctuation),
# Space is not significant
(r'\s+', Text)
],
diff --git a/pygments/lexers/chapel.py b/pygments/lexers/chapel.py
index 0a12dd95..417301d9 100644
--- a/pygments/lexers/chapel.py
+++ b/pygments/lexers/chapel.py
@@ -67,7 +67,7 @@ class ChapelLexer(RegexLexer):
# integer literals
# -- binary
- (r'0[bB][0-1]+', Number.Bin),
+ (r'0[bB][01]+', Number.Bin),
# -- hex
(r'0[xX][0-9a-fA-F]+', Number.Hex),
# -- octal
diff --git a/pygments/lexers/configs.py b/pygments/lexers/configs.py
index 1a9aec68..f7a1cd15 100644
--- a/pygments/lexers/configs.py
+++ b/pygments/lexers/configs.py
@@ -240,9 +240,9 @@ class Cfengine3Lexer(RegexLexer):
bygroups(Keyword.Reserved, Text, Operator, Text)),
(r'"', String, 'string'),
(r'(\w+)(\()', bygroups(Name.Function, Punctuation)),
- (r'([\w.!&|\(\)]+)(::)', bygroups(Name.Class, Punctuation)),
+ (r'([\w.!&|()]+)(::)', bygroups(Name.Class, Punctuation)),
(r'(\w+)(:)', bygroups(Keyword.Declaration, Punctuation)),
- (r'@[\{\(][^\)\}]+[\}\)]', Name.Variable),
+ (r'@[{(][^)}]+[})]', Name.Variable),
(r'[(){},;]', Punctuation),
(r'=>', Operator),
(r'->', Operator),
@@ -252,16 +252,16 @@ class Cfengine3Lexer(RegexLexer):
(r'\s+', Text),
],
'string': [
- (r'\$[\{\(]', String.Interpol, 'interpol'),
+ (r'\$[{(]', String.Interpol, 'interpol'),
(r'\\.', String.Escape),
(r'"', String, '#pop'),
(r'\n', String),
(r'.', String),
],
'interpol': [
- (r'\$[\{\(]', String.Interpol, '#push'),
- (r'[\}\)]', String.Interpol, '#pop'),
- (r'[^\$\{\(\)\}]+', String.Interpol),
+ (r'\$[{(]', String.Interpol, '#push'),
+ (r'[})]', String.Interpol, '#pop'),
+ (r'[^${()}]+', String.Interpol),
],
'arglist': [
(r'\)', Punctuation, '#pop'),
diff --git a/pygments/lexers/data.py b/pygments/lexers/data.py
index 22821c15..f41a51e5 100644
--- a/pygments/lexers/data.py
+++ b/pygments/lexers/data.py
@@ -184,7 +184,7 @@ class YamlLexer(ExtendedRegexLexer):
(r'^(?:---|\.\.\.)(?=[ ]|$)', reset_indent(Name.Namespace),
'block-line'),
# indentation spaces
- (r'[ ]*(?![ \t\n\r\f\v]|$)', save_indent(Text, start=True),
+ (r'[ ]*(?!\s|$)', save_indent(Text, start=True),
('block-line', 'indentation')),
],
@@ -208,8 +208,8 @@ class YamlLexer(ExtendedRegexLexer):
# the %YAG directive
'tag-directive': [
# a tag handle and the corresponding prefix
- (r'([ ]+)(!|![0-9A-Za-z_-]*!)'
- r'([ ]+)(!|!?[0-9A-Za-z;/?:@&=+$,_.!~*\'()\[\]%-]+)',
+ (r'([ ]+)(!|![\w-]*!)'
+ r'([ ]+)(!|!?[\w;/?:@&=+$,.!~*\'()\[\]%-]+)',
bygroups(Text, Keyword.Type, Text, Keyword.Type),
'ignored-line'),
],
@@ -239,7 +239,7 @@ class YamlLexer(ExtendedRegexLexer):
# flow collections and quoted scalars
include('flow-nodes'),
# a plain scalar
- (r'(?=[^ \t\n\r\f\v?:,\[\]{}#&*!|>\'"%@`-]|[?:-][^ \t\n\r\f\v])',
+ (r'(?=[^\s?:,\[\]{}#&*!|>\'"%@`-]|[?:-]\S)',
something(Name.Variable),
'plain-scalar-in-block-context'),
],
@@ -247,14 +247,14 @@ class YamlLexer(ExtendedRegexLexer):
# tags, anchors, aliases
'descriptors': [
# a full-form tag
- (r'!<[0-9A-Za-z;/?:@&=+$,_.!~*\'()\[\]%-]+>', Keyword.Type),
+ (r'!<[\w;/?:@&=+$,.!~*\'()\[\]%-]+>', Keyword.Type),
# a tag in the form '!', '!suffix' or '!handle!suffix'
- (r'!(?:[0-9A-Za-z_-]+)?'
- r'(?:![0-9A-Za-z;/?:@&=+$,_.!~*\'()\[\]%-]+)?', Keyword.Type),
+ (r'!(?:[\w-]+)?'
+ r'(?:![\w;/?:@&=+$,.!~*\'()\[\]%-]+)?', Keyword.Type),
# an anchor
- (r'&[0-9A-Za-z_-]+', Name.Label),
+ (r'&[\w-]+', Name.Label),
# an alias
- (r'\*[0-9A-Za-z_-]+', Name.Variable),
+ (r'\*[\w-]+', Name.Variable),
],
# block collections and scalars
@@ -293,7 +293,7 @@ class YamlLexer(ExtendedRegexLexer):
# nested collections and quoted scalars
include('flow-nodes'),
# a plain scalar
- (r'(?=[^ \t\n\r\f\v?:,\[\]{}#&*!|>\'"%@`])',
+ (r'(?=[^\s?:,\[\]{}#&*!|>\'"%@`])',
something(Name.Variable),
'plain-scalar-in-flow-context'),
],
@@ -324,7 +324,7 @@ class YamlLexer(ExtendedRegexLexer):
# indentation spaces (we may leave the state here)
(r'^[ ]*', parse_block_scalar_indent(Text)),
# line content
- (r'[^\n\r\f\v]+', Name.Constant),
+ (r'[\S\t ]+', Name.Constant),
],
# the content of a literal or folded scalar
@@ -357,7 +357,7 @@ class YamlLexer(ExtendedRegexLexer):
# escaping of the quote character
(r'\'\'', String.Escape),
# regular non-whitespace characters
- (r'[^ \t\n\r\f\v\']+', String),
+ (r'[^\s\']+', String),
# the closing quote
(r'\'', String, '#pop'),
],
@@ -372,7 +372,7 @@ class YamlLexer(ExtendedRegexLexer):
(r'\\(?:x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})',
String.Escape),
# regular non-whitespace characters
- (r'[^ \t\n\r\f\v\"\\]+', String),
+ (r'[^\s"\\]+', String),
# the closing quote
(r'"', String, '#pop'),
],
@@ -402,7 +402,7 @@ class YamlLexer(ExtendedRegexLexer):
# other whitespaces are a part of the value
(r'[ ]+', Literal.Scalar.Plain),
# regular non-whitespace characters
- (r'(?::(?![ \t\n\r\f\v])|[^ \t\n\r\f\v:])+', Literal.Scalar.Plain),
+ (r'(?::(?!\s)|[^\s:])+', Literal.Scalar.Plain),
],
# a plain scalar is the flow context
@@ -419,7 +419,7 @@ class YamlLexer(ExtendedRegexLexer):
# other whitespaces are a part of the value
(r'[ ]+', Name.Variable),
# regular non-whitespace characters
- (r'[^ \t\n\r\f\v,:?\[\]{}]+', Name.Variable),
+ (r'[^\s,:?\[\]{}]+', Name.Variable),
],
}
diff --git a/pygments/lexers/dotnet.py b/pygments/lexers/dotnet.py
index 931d0c86..7c72d8f3 100644
--- a/pygments/lexers/dotnet.py
+++ b/pygments/lexers/dotnet.py
@@ -339,7 +339,7 @@ class BooLexer(RegexLexer):
(r"'(\\\\|\\'|[^']*?)'", String.Single),
(r'[a-zA-Z_]\w*', Name),
(r'(\d+\.\d*|\d*\.\d+)([fF][+-]?[0-9]+)?', Number.Float),
- (r'[0-9][0-9\.]*(ms?|d|h|s)', Number),
+ (r'[0-9][0-9.]*(ms?|d|h|s)', Number),
(r'0\d+', Number.Oct),
(r'0x[a-fA-F0-9]+', Number.Hex),
(r'\d+L', Number.Integer.Long),
@@ -391,7 +391,7 @@ class VbNetLexer(RegexLexer):
r'#ExternalSource.*?\n|#End\s+ExternalSource|'
r'#Region.*?\n|#End\s+Region|#ExternalChecksum',
Comment.Preproc),
- (r'[\(\){}!#,.:]', Punctuation),
+ (r'[(){}!#,.:]', Punctuation),
(r'Option\s+(Strict|Explicit|Compare)\s+'
r'(On|Off|Binary|Text)', Keyword.Declaration),
(r'(?<!\.)(AddHandler|Alias|'
@@ -433,7 +433,7 @@ class VbNetLexer(RegexLexer):
(r'_\n', Text), # Line continuation (must be before Name)
(uni_name + '[%&@!#$]?', Name),
('#.*?#', Literal.Date),
- (r'(\d+\.\d*|\d*\.\d+)([fF][+-]?[0-9]+)?', Number.Float),
+ (r'(\d+\.\d*|\d*\.\d+)(F[+-]?[0-9]+)?', Number.Float),
(r'\d+([SILDFR]|US|UI|UL)?', Number.Integer),
(r'&H[0-9a-f]+([SILDFR]|US|UI|UL)?', Number.Integer),
(r'&O[0-7]+([SILDFR]|US|UI|UL)?', Number.Integer),
@@ -596,7 +596,7 @@ class FSharpLexer(RegexLexer):
tokens = {
'escape-sequence': [
- (r'\\[\\\"\'ntbrafv]', String.Escape),
+ (r'\\[\\"\'ntbrafv]', String.Escape),
(r'\\[0-9]{3}', String.Escape),
(r'\\u[0-9a-fA-F]{4}', String.Escape),
(r'\\U[0-9a-fA-F]{8}', String.Escape),
diff --git a/pygments/lexers/ecl.py b/pygments/lexers/ecl.py
index a0138e32..5c9b3bd1 100644
--- a/pygments/lexers/ecl.py
+++ b/pygments/lexers/ecl.py
@@ -52,10 +52,10 @@ class ECLLexer(RegexLexer):
(r'"', String, 'string'),
(r'\'', String, 'string'),
(r'(\d+\.\d*|\.\d+|\d+)e[+-]?\d+[lu]*', Number.Float),
- (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
+ (r'(\d+\.\d*|\.\d+|\d+f)f?', Number.Float),
(r'0x[0-9a-f]+[lu]*', Number.Hex),
(r'0[0-7]+[lu]*', Number.Oct),
- (r'\d+[LlUu]*', Number.Integer),
+ (r'\d+[lu]*', Number.Integer),
(r'\*/', Error),
(r'[~!%^&*+=|?:<>/-]+', Operator),
(r'[{}()\[\],.;]', Punctuation),
diff --git a/pygments/lexers/eiffel.py b/pygments/lexers/eiffel.py
index 7d6757df..e3bf81f5 100644
--- a/pygments/lexers/eiffel.py
+++ b/pygments/lexers/eiffel.py
@@ -57,7 +57,7 @@ class EiffelLexer(RegexLexer):
],
'numbers': [
(r'0[xX][a-fA-F0-9]+', Number.Hex),
- (r'0[bB][0-1]+', Number.Bin),
+ (r'0[bB][01]+', Number.Bin),
(r'0[cC][0-7]+', Number.Oct),
(r'([0-9]+\.[0-9]*)|([0-9]*\.[0-9]+)', Number.Float),
(r'[0-9]+', Number.Integer),
diff --git a/pygments/lexers/erlang.py b/pygments/lexers/erlang.py
index 6aa336db..563f7744 100644
--- a/pygments/lexers/erlang.py
+++ b/pygments/lexers/erlang.py
@@ -272,7 +272,7 @@ class ElixirLexer(RegexLexer):
(r'\{', r'\}', 'cb'),
(r'\[', r'\]', 'sb'),
(r'\(', r'\)', 'pa'),
- (r'\<', r'\>', 'ab'),
+ (r'<', r'>', 'ab'),
(r'/', r'/', 'slas'),
(r'\|', r'\|', 'pipe'),
('"', '"', 'quot'),
@@ -322,8 +322,8 @@ class ElixirLexer(RegexLexer):
op1_re = "|".join(re.escape(s) for s in OPERATORS1)
ops_re = r'(?:%s|%s|%s)' % (op3_re, op2_re, op1_re)
punctuation_re = "|".join(re.escape(s) for s in PUNCTUATION)
- alnum = '[A-Za-z_0-9]'
- name_re = r'(?:\.\.\.|[a-z_]%s*[!\?]?)' % alnum
+ alnum = '\w'
+ name_re = r'(?:\.\.\.|[a-z_]%s*[!?]?)' % alnum
modname_re = r'[A-Z]%(alnum)s*(?:\.[A-Z]%(alnum)s*)*' % {'alnum': alnum}
complex_name_re = r'(?:%s|%s|%s)' % (name_re, modname_re, ops_re)
special_atom_re = r'(?:\.\.\.|<<>>|%\{\}|%|\{\})'
diff --git a/pygments/lexers/esoteric.py b/pygments/lexers/esoteric.py
index 2efc057b..7a026aed 100644
--- a/pygments/lexers/esoteric.py
+++ b/pygments/lexers/esoteric.py
@@ -63,7 +63,7 @@ class BefungeLexer(RegexLexer):
tokens = {
'root': [
(r'[0-9a-f]', Number),
- (r'[\+\*/%!`-]', Operator), # Traditional math
+ (r'[+*/%!`-]', Operator), # Traditional math
(r'[<>^v?\[\]rxjk]', Name.Variable), # Move, imperatives
(r'[:\\$.,n]', Name.Builtin), # Stack ops, imperatives
(r'[|_mw]', Keyword),
@@ -103,7 +103,7 @@ class RedcodeLexer(RegexLexer):
# Identifiers
(r'\b(%s)\b' % '|'.join(opcodes), Name.Function),
(r'\b(%s)\b' % '|'.join(modifiers), Name.Decorator),
- (r'[A-Za-z_][A-Za-z_0-9]+', Name),
+ (r'[A-Za-z_]\w+', Name),
# Operators
(r'[-+*/%]', Operator),
(r'[#$@<>]', Operator), # mode
diff --git a/pygments/lexers/factor.py b/pygments/lexers/factor.py
index 079ff764..402fc129 100644
--- a/pygments/lexers/factor.py
+++ b/pygments/lexers/factor.py
@@ -256,9 +256,9 @@ class FactorLexer(RegexLexer):
(r'SYNTAX:\s', Keyword),
(r'ALIEN:\s', Keyword),
(r'(STRUCT:)(\s+)(\S+)', bygroups(Keyword, Text, Name.Class)),
- (r'(FUNCTION:)(\s+\S+\s+)(\S+)(\s+\(\s+[^\)]+\)\s)',
+ (r'(FUNCTION:)(\s+\S+\s+)(\S+)(\s+\(\s+[^)]+\)\s)',
bygroups(Keyword.Namespace, Text, Name.Function, Text)),
- (r'(FUNCTION-ALIAS:)(\s+)(\S+)(\s+\S+\s+)(\S+)(\s+\(\s+[^\)]+\)\s)',
+ (r'(FUNCTION-ALIAS:)(\s+)(\S+)(\s+\S+\s+)(\S+)(\s+\(\s+[^)]+\)\s)',
bygroups(Keyword.Namespace, Text, Name.Function, Text, Name.Function, Text)),
# vocab.private
diff --git a/pygments/lexers/fortran.py b/pygments/lexers/fortran.py
index a2ca5cb3..3dd855bc 100644
--- a/pygments/lexers/fortran.py
+++ b/pygments/lexers/fortran.py
@@ -39,7 +39,7 @@ class FortranLexer(RegexLexer):
tokens = {
'root': [
- ('^#.*\n', Comment.Preproc),
+ (r'^#.*\n', Comment.Preproc),
(r'!.*\n', Comment),
include('strings'),
include('core'),
@@ -99,10 +99,10 @@ class FortranLexer(RegexLexer):
'BLT', 'Bit_Size', 'BTest', 'CAbs', 'CCos', 'Ceiling', 'CExp',
'Char', 'ChDir', 'ChMod', 'CLog', 'Cmplx', 'Command_Argument_Count',
'Complex', 'Conjg', 'Cos', 'CosH', 'Count', 'CPU_Time', 'CShift',
- 'CSin', 'CSqRt', 'CTime', 'C_Funloc', 'C_Loc', 'C_Associated',
+ 'CSin', 'CSqRt', 'CTime', 'C_Loc', 'C_Associated',
'C_Null_Ptr', 'C_Null_Funptr', 'C_F_Pointer', 'C_F_ProcPointer',
'C_Null_Char', 'C_Alert', 'C_Backspace', 'C_Form_Feed', 'C_FunLoc',
- 'C_Loc', 'C_Sizeof', 'C_New_Line', 'C_Carriage_Return',
+ 'C_Sizeof', 'C_New_Line', 'C_Carriage_Return',
'C_Horizontal_Tab', 'C_Vertical_Tab', 'DAbs', 'DACos', 'DASin',
'DATan', 'Date_and_Time', 'DbesJ', 'DbesJN', 'DbesY',
'DbesYN', 'Dble', 'DCos', 'DCosH', 'DDiM', 'DErF',
diff --git a/pygments/lexers/graph.py b/pygments/lexers/graph.py
index 04ec3262..61373631 100644
--- a/pygments/lexers/graph.py
+++ b/pygments/lexers/graph.py
@@ -66,7 +66,7 @@ class CypherLexer(RegexLexer):
(r'[.*{}]', Punctuation),
],
'strings': [
- (r'"(?:\\[tbnrf\'\"\\]|[^\\"])*"', String),
+ (r'"(?:\\[tbnrf\'"\\]|[^\\"])*"', String),
(r'`(?:``|[^`])+`', Name.Variable),
],
'whitespace': [
diff --git a/pygments/lexers/haxe.py b/pygments/lexers/haxe.py
index 7d953eb5..69c0adda 100644
--- a/pygments/lexers/haxe.py
+++ b/pygments/lexers/haxe.py
@@ -179,8 +179,8 @@ class HaxeLexer(ExtendedRegexLexer):
# Float
(r'\.[0-9]+', Number.Float),
- (r'[0-9]+[eE][\+\-]?[0-9]+', Number.Float),
- (r'[0-9]+\.[0-9]*[eE][\+\-]?[0-9]+', Number.Float),
+ (r'[0-9]+[eE][+\-]?[0-9]+', Number.Float),
+ (r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float),
(r'[0-9]+\.[0-9]+', Number.Float),
(r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float),
@@ -216,8 +216,8 @@ class HaxeLexer(ExtendedRegexLexer):
# Float
(r'\.[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
- (r'[0-9]+[eE][\+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
- (r'[0-9]+\.[0-9]*[eE][\+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
+ (r'[0-9]+[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
+ (r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
(r'[0-9]+\.[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
(r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float, ('#pop', 'preproc-expr-chain')),
@@ -453,8 +453,8 @@ class HaxeLexer(ExtendedRegexLexer):
# Float
(r'\.[0-9]+', Number.Float, ('#pop', 'expr-chain')),
- (r'[0-9]+[eE][\+\-]?[0-9]+', Number.Float, ('#pop', 'expr-chain')),
- (r'[0-9]+\.[0-9]*[eE][\+\-]?[0-9]+', Number.Float, ('#pop', 'expr-chain')),
+ (r'[0-9]+[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'expr-chain')),
+ (r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'expr-chain')),
(r'[0-9]+\.[0-9]+', Number.Float, ('#pop', 'expr-chain')),
(r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float, ('#pop', 'expr-chain')),
@@ -708,8 +708,8 @@ class HaxeLexer(ExtendedRegexLexer):
'type-param-type': [
# Float
(r'\.[0-9]+', Number.Float, '#pop'),
- (r'[0-9]+[eE][\+\-]?[0-9]+', Number.Float, '#pop'),
- (r'[0-9]+\.[0-9]*[eE][\+\-]?[0-9]+', Number.Float, '#pop'),
+ (r'[0-9]+[eE][+\-]?[0-9]+', Number.Float, '#pop'),
+ (r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float, '#pop'),
(r'[0-9]+\.[0-9]+', Number.Float, '#pop'),
(r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float, '#pop'),
diff --git a/pygments/lexers/modeling.py b/pygments/lexers/modeling.py
index 9e7c172d..1552fbf8 100644
--- a/pygments/lexers/modeling.py
+++ b/pygments/lexers/modeling.py
@@ -46,7 +46,7 @@ class ModelicaLexer(RegexLexer):
include('whitespace'),
(r'"', String.Double, 'string'),
(r'[()\[\]{},;]+', Punctuation),
- (r'\.?[\^*/+\-]|\.|<>|[<>:=]=?', Operator),
+ (r'\.?[*^/+-]|\.|<>|[<>:=]=?', Operator),
(r'\d+(\.?\d*[eE][-+]?\d+|\.\d*)', Number.Float),
(r'\d+', Number.Integer),
(r'(abs|acos|actualStream|array|asin|assert|AssertionLevel|atan|'
@@ -164,7 +164,7 @@ class BugsLexer(RegexLexer):
(r'(model)(\s+)(\{)',
bygroups(Keyword.Namespace, Text, Punctuation)),
# Reserved Words
- (r'(for|in)(?![0-9a-zA-Z\._])', Keyword.Reserved),
+ (r'(for|in)(?![\w.])', Keyword.Reserved),
# Built-in Functions
(r'(%s)(?=\s*\()'
% r'|'.join(_FUNCTIONS + _DISTRIBUTIONS),
@@ -246,9 +246,9 @@ class JagsLexer(RegexLexer):
# Block start
(r'(model|data)(\s+)(\{)',
bygroups(Keyword.Namespace, Text, Punctuation)),
- (r'var(?![0-9a-zA-Z\._])', Keyword.Declaration),
+ (r'var(?![\w.])', Keyword.Declaration),
# Reserved Words
- (r'(for|in)(?![0-9a-zA-Z\._])', Keyword.Reserved),
+ (r'(for|in)(?![\w.])', Keyword.Reserved),
# Builtins
# Need to use lookahead because . is a valid char
(r'(%s)(?=\s*\()' % r'|'.join(_FUNCTIONS
diff --git a/pygments/lexers/nit.py b/pygments/lexers/nit.py
index e0947447..5d4864db 100644
--- a/pygments/lexers/nit.py
+++ b/pygments/lexers/nit.py
@@ -37,9 +37,9 @@ class NitLexer(RegexLexer):
'else', 'while', 'loop', 'for', 'in', 'and', 'or', 'not',
'implies', 'return', 'continue', 'break', 'abort', 'assert',
'new', 'is', 'once', 'super', 'self', 'true', 'false', 'nullable',
- 'null', 'as', 'isset', 'label', '__debug__'), suffix=r'(?=[\r\n\t\( ])'),
+ 'null', 'as', 'isset', 'label', '__debug__'), suffix=r'(?=[\r\n\t( ])'),
Keyword),
- (r'[A-Z][A-Za-z0-9_]*', Name.Class),
+ (r'[A-Z]\w*', Name.Class),
(r'"""(([^\'\\]|\\.)|\\r|\\n)*((\{\{?)?(""?\{\{?)*""""*)', String), # Simple long string
(r'\'\'\'(((\\.|[^\'\\])|\\r|\\n)|\'((\\.|[^\'\\])|\\r|\\n)|'
r'\'\'((\\.|[^\'\\])|\\r|\\n))*\'\'\'', String), # Simple long string alt
@@ -54,8 +54,8 @@ class NitLexer(RegexLexer):
(r'[0-9]+', Number.Integer),
(r'[0-9]*.[0-9]+', Number.Float),
(r'0(x|X)[0-9A-Fa-f]+', Number.Hex),
- (r'[a-z][A-Za-z0-9_]*', Name),
- (r'_[A-Za-z0-9_]+', Name.Variable.Instance),
+ (r'[a-z]\w*', Name),
+ (r'_\w+', Name.Variable.Instance),
(r'==|!=|<==>|>=|>>|>|<=|<<|<|\+|-|=|/|\*|%|\+=|-=|!|@', Operator),
(r'\(|\)|\[|\]|,|\.\.\.|\.\.|\.|::|:', Punctuation),
(r'`\{[^`]*`\}', Text), # Extern blocks won't be Lexed by Nit
diff --git a/pygments/lexers/nix.py b/pygments/lexers/nix.py
index 6d9f0e7d..1bf533dd 100644
--- a/pygments/lexers/nix.py
+++ b/pygments/lexers/nix.py
@@ -91,10 +91,10 @@ class NixLexer(RegexLexer):
],
'comment': [
- (r'[^/\*]+', Comment.Multiline),
+ (r'[^/*]+', Comment.Multiline),
(r'/\*', Comment.Multiline, '#push'),
(r'\*/', Comment.Multiline, '#pop'),
- (r'[\*/]', Comment.Multiline),
+ (r'[*/]', Comment.Multiline),
],
'singlequote': [
(r"'''", String.Escape),
@@ -129,10 +129,6 @@ class NixLexer(RegexLexer):
rv += 0.4
if re.search(r'mkDerivation\s+(\(|\{|rec)', text):
rv += 0.4
- if re.search(r'with\s+[a-zA-Z\.]+;', text):
- rv += 0.2
- if re.search(r'inherit\s+[a-zA-Z()\.];', text):
- rv += 0.2
if re.search(r'=\s+mkIf\s+', text):
rv += 0.4
if re.search(r'\{[a-zA-Z,\s]+\}:', text):
diff --git a/pygments/lexers/ooc.py b/pygments/lexers/ooc.py
index 7d55b2a6..b58d3472 100644
--- a/pygments/lexers/ooc.py
+++ b/pygments/lexers/ooc.py
@@ -66,7 +66,7 @@ class OocLexer(RegexLexer):
(r'[0-9_]\.[0-9_]*(?!\.)', Number.Float),
(r'[0-9_]+', Number.Decimal),
- (r'"(?:\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\"])*"',
+ (r'"(?:\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\"])*"',
String.Double),
(r"'(?:\\.|\\[0-9]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'",
String.Char),
diff --git a/pygments/lexers/scripting.py b/pygments/lexers/scripting.py
index 359736b6..678cab21 100644
--- a/pygments/lexers/scripting.py
+++ b/pygments/lexers/scripting.py
@@ -224,7 +224,8 @@ class ChaiscriptLexer(RegexLexer):
filenames = ['*.chai']
mimetypes = ['text/x-chaiscript', 'application/x-chaiscript']
- flags = re.DOTALL
+ flags = re.DOTALL | re.MULTILINE
+
tokens = {
'commentsandwhitespace': [
(r'\s+', Text),