summaryrefslogtreecommitdiff
path: root/pygments/lexers/perl.py
diff options
context:
space:
mode:
Diffstat (limited to 'pygments/lexers/perl.py')
-rw-r--r--pygments/lexers/perl.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/pygments/lexers/perl.py b/pygments/lexers/perl.py
index 3689fc7a..d7337942 100644
--- a/pygments/lexers/perl.py
+++ b/pygments/lexers/perl.py
@@ -13,7 +13,7 @@ import re
from pygments.lexer import RegexLexer, ExtendedRegexLexer, include, bygroups, \
using, this, default, words
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
- Number, Punctuation
+ Number, Punctuation, Whitespace
from pygments.util import shebang_matches
__all__ = ['PerlLexer', 'Perl6Lexer']
@@ -56,7 +56,7 @@ class PerlLexer(RegexLexer):
'CHECK', 'INIT', 'END', 'return'), suffix=r'\b'),
Keyword),
(r'(format)(\s+)(\w+)(\s*)(=)(\s*\n)',
- bygroups(Keyword, Text, Name, Text, Punctuation, Text), 'format'),
+ bygroups(Keyword, Whitespace, Name, Whitespace, Punctuation, Whitespace), 'format'),
(r'(eq|lt|gt|le|ge|ne|not|and|or|cmp)\b', Operator.Word),
# common delimiters
(r's/(\\\\|\\[^\\]|[^\\/])*/(\\\\|\\[^\\]|[^\\/])*/[egimosx]*',
@@ -79,7 +79,7 @@ class PerlLexer(RegexLexer):
(r'm(?=[/!\\{<\[(@%$])', String.Regex, 'balanced-regex'),
(r'((?<==~)|(?<=\())\s*/(\\\\|\\[^\\]|[^\\/])*/[gcimosx]*',
String.Regex),
- (r'\s+', Text),
+ (r'\s+', Whitespace),
(words((
'abs', 'accept', 'alarm', 'atan2', 'bind', 'binmode', 'bless', 'caller', 'chdir',
'chmod', 'chomp', 'chop', 'chown', 'chr', 'chroot', 'close', 'closedir', 'connect',
@@ -110,7 +110,7 @@ class PerlLexer(RegexLexer):
Name.Builtin),
(r'((__(DATA|DIE|WARN)__)|(STD(IN|OUT|ERR)))\b', Name.Builtin.Pseudo),
(r'(<<)([\'"]?)([a-zA-Z_]\w*)(\2;?\n.*?\n)(\3)(\n)',
- bygroups(String, String, String.Delimiter, String, String.Delimiter, Text)),
+ bygroups(String, String, String.Delimiter, String, String.Delimiter, Whitespace)),
(r'__END__', Comment.Preproc, 'end-part'),
(r'\$\^[ADEFHILMOPSTWX]', Name.Variable.Global),
(r"\$[\\\"\[\]'&`+*.,;=%~?@$!<>(^|/-](?!\w)", Name.Variable.Global),
@@ -132,10 +132,10 @@ class PerlLexer(RegexLexer):
(r'(q|qq|qw|qr|qx)\<', String.Other, 'lt-string'),
(r'(q|qq|qw|qr|qx)([\W_])(.|\n)*?\2', String.Other),
(r'(package)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)',
- bygroups(Keyword, Text, Name.Namespace)),
+ bygroups(Keyword, Whitespace, Name.Namespace)),
(r'(use|require|no)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)',
- bygroups(Keyword, Text, Name.Namespace)),
- (r'(sub)(\s+)', bygroups(Keyword, Text), 'funcname'),
+ bygroups(Keyword, Whitespace, Name.Namespace)),
+ (r'(sub)(\s+)', bygroups(Keyword, Whitespace), 'funcname'),
(words((
'no', 'package', 'require', 'use'), suffix=r'\b'),
Keyword),
@@ -151,7 +151,7 @@ class PerlLexer(RegexLexer):
(r'[^\n]*\n', String.Interpol),
],
'varname': [
- (r'\s+', Text),
+ (r'\s+', Whitespace),
(r'\{', Punctuation, '#pop'), # hash syntax?
(r'\)|,', Punctuation, '#pop'), # argument specifier
(r'\w+::', Name.Namespace),
@@ -166,9 +166,9 @@ class PerlLexer(RegexLexer):
],
'funcname': [
(r'[a-zA-Z_]\w*[!?]?', Name.Function),
- (r'\s+', Text),
+ (r'\s+', Whitespace),
# argument declaration
- (r'(\([$@%]*\))(\s*)', bygroups(Punctuation, Text)),
+ (r'(\([$@%]*\))(\s*)', bygroups(Punctuation, Whitespace)),
(r';', Punctuation, '#pop'),
(r'.*?\{', Punctuation, '#pop'),
],
@@ -607,7 +607,7 @@ class Perl6Lexer(ExtendedRegexLexer):
(r'(regex|token|rule)(?!' + PERL6_IDENTIFIER_RANGE + r')(\s*' + PERL6_IDENTIFIER_RANGE + '+)?',
bygroups(Keyword, Name), 'pre-token'),
# deal with a special case in the Perl 6 grammar (role q { ... })
- (r'(role)(\s+)(q)(\s*)', bygroups(Keyword, Text, Name, Text)),
+ (r'(role)(\s+)(q)(\s*)', bygroups(Keyword, Whitespace, Name, Whitespace)),
(_build_word_match(PERL6_KEYWORDS, PERL6_IDENTIFIER_RANGE), Keyword),
(_build_word_match(PERL6_BUILTIN_CLASSES, PERL6_IDENTIFIER_RANGE, suffix='(?::[UD])?'),
Name.Builtin),