diff options
author | Jon Jensen <jon@endpoint.com> | 2010-07-23 18:16:36 -0600 |
---|---|---|
committer | Jon Jensen <jon@endpoint.com> | 2010-07-23 18:16:36 -0600 |
commit | eb116405a7d23456589371322e52f8430a8cde0d (patch) | |
tree | 3543aa6f9f41313fe880ed438072dce35e386729 /pygments/lexers | |
parent | 072d0c3194c652c88f6b2857c61eadf53d5ab167 (diff) | |
download | pygments-eb116405a7d23456589371322e52f8430a8cde0d.tar.gz |
Improve lexing of Perl numbers
Add support for floating point numbers (adapted from Lua lexer).
Support comma-like _ in numbers.
Add test file to exercise this.
Diffstat (limited to 'pygments/lexers')
-rw-r--r-- | pygments/lexers/agile.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py index 264983f8..4b2a3792 100644 --- a/pygments/lexers/agile.py +++ b/pygments/lexers/agile.py @@ -893,7 +893,9 @@ class PerlLexer(RegexLexer): (r'0_?[0-7]+(_[0-7]+)*', Number.Oct), (r'0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*', Number.Hex), (r'0b[01]+(_[01]+)*', Number.Bin), - (r'\d+', Number.Integer), + (r'(?i)(\d*(_\d*)*\.\d+(_\d*)*|\d+(_\d*)*\.\d+(_\d*)*)(e[+-]?\d+)?', Number.Float), + (r'(?i)\d+(_\d*)*e[+-]?\d+(_\d*)*', Number.Float), + (r'\d+(_\d+)*', Number.Integer), (r"'(\\\\|\\'|[^'])*'", String), (r'"(\\\\|\\"|[^"])*"', String), (r'`(\\\\|\\`|[^`])*`', String.Backtick), |