The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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 class.

The following public attributes are exported:

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.