Syntax::SourceHighlight::HighlightToken(3)

NAME
Syntax::SourceHighlight::HighlightToken - Perl class for libsource-highlight's "srchilite::HighlightToken"

SYNOPSIS
    use Syntax::SourceHighlight;
    my $hl = Syntax::SourceHighlight->new();
    $hl->setHighlightEventListener(
        sub {
            my $highlight_event = shift;
            my $highlight_token = $highlight_event->{token};
            print( "Prefix: '$highlight_token->{prefix}'; tokens" );
            foreach ( @{ $highlight_token->{matched} } ) {
                m/^(.*?):(.*)$/s;
                print(" '$2' ($1)");
            }
            print("\n");
        }
    );
    $hl->highlightString( 'my $test = 42;', 'perl.lang' );

DESCRIPTION
This is the counterpart to the libsource-highlight's "srchilite::HighlightEvent <https://www.gnu.org/software/src-highlite/api/structsrchilite_1_1HighlightToken.html>" class.

The following public attributes are exported:

•   prefix

•   prefixOnlySpaces

•   suffix

•   matched (exported as an array of strings where the pair is concatenated and separated with colon)

•   matchedSize

These are not implemented:

•   matchedSubExps

•   rule

There is no Perl constructor for this package. None of its public methods are implemented:

•   copyFrom()

•   clearMatched()

•   addMatched()

SEE ALSO
The main documentation with examples is in the Syntax::SourceHighlight POD.