Subject: | Syntax highlighting breaks with underscores in numbers (10_000) |
Here's another example:
#!/usr/bin/env perl
use strict;
use warnings;
use Term::ANSIColor ':constants';
use Syntax::Highlight::Engine::Kate::Perl;
my $highlighter = Syntax::Highlight::Engine::Kate::Perl->new(
format_table => {
'Keyword' => [ GREEN, RESET ],
'Comment' => [ BLUE, RESET ],
'Decimal' => [ YELLOW, RESET ],
'Float' => [ YELLOW, RESET ],
'Function' => [ CYAN, RESET ],
'Identifier' => [ RED, RESET ],
'Normal' => [ MAGENTA, RESET ],
'Operator' => [ CYAN, RESET ],
'Preprocessor' => [ RED, RESET ],
'String' => [ RED, RESET ],
'String Char' => [ RED, RESET ],
'Symbol' => [ CYAN, RESET ],
'DataType' => [ YELLOW, RESET ],
}
);
my $code = <<'CODE';
my $num = 10_000;
CODE
print $highlighter->highlightText($code);
The first 10 is rendered in yellow, but the trailing _000 is rendered as magenta.
Cheers,
Ovid