diff options
author | Rob Hoelz <rob@hoelz.ro> | 2014-01-04 14:04:17 +0100 |
---|---|---|
committer | Rob Hoelz <rob@hoelz.ro> | 2014-01-04 14:04:17 +0100 |
commit | 86bc9b83ad4cf141937e10a3a9abf61fdc8311d5 (patch) | |
tree | 7fe668570f8aead270aa82529bd00071acbc2405 /pygments/lexers/agile.py | |
parent | 69197daeee96a72fbab2391c8eb2f5c24b51f45f (diff) | |
download | pygments-86bc9b83ad4cf141937e10a3a9abf61fdc8311d5.tar.gz |
Include slurpy parameters in the Perl 6 detection heuristic
Slurpy parameters (http://perlcabal.org/syn/S06.html#List_parameters)
are signified with a leading '*' character. *@array, *%hash, and *&sub
are not valid Perl 5, so this is a good test for Perl 6.
Diffstat (limited to 'pygments/lexers/agile.py')
-rw-r--r-- | pygments/lexers/agile.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py index c9447635..e4fd3a54 100644 --- a/pygments/lexers/agile.py +++ b/pygments/lexers/agile.py @@ -2275,6 +2275,11 @@ class Perl6Lexer(ExtendedRegexLexer): return 0.91 if re.search(r'[$@%][!.][A-Za-z0-9_-]+', text): # Perl 6 member variables return 0.91 + if re.search(r'[*][@%&]', text): # Slurpy parameters + # Scalar slurpies (*$slurp) are not included because they're more rare + # in Perl 6, and also (more importantly) they are a glob deference in + # Perl 5. + return 0.91 for line in text.splitlines(): if re.match(r'\s*(?:my|our)?\s*(?:module|role|class)\b', line): # module, role, class declarations |