Skip Menu |

This queue is for tickets about the Syntax-Highlight-Engine-Kate CPAN distribution.

Report information
The Basics
Id: 76168
Status: new
Priority: 0/
Queue: Syntax-Highlight-Engine-Kate

People
Owner: Nobody in particular
Requestors: ovid [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Heredocs break syntax highlight if bogus token detected
This delightful example I ganked from Test::More. die <<WHOA; WHOA! I tried to call ->isa on your $whatami and got some weird error. Here's the error. $error WHOA Notice that the terminating token is embedded in the heredoc text, but it's not treated as the terminating token because it's not on a line by itself. Syntax::Highlight::Engine::Kate::Perl breaks on this case because it thinks the first "WHOA" is the terminating token. A test case is below. Cheers, Ovid #!/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'; if ($foo) { die <<WHOA; WHOA! I tried to call ->isa on your $whatami and got some weird error. Here's the error. $error WHOA } else { $obj_name = "The $whatami" unless defined $obj_name; if ( !$rslt ) { my $ref = ref $object; $diag = "$obj_name isn't a '$class' it's a '$ref'"; } } CODE print $highlighter->highlightText($code);