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::Kamelon::Debugger - That's what it is

SYNOPSIS

 use Syntax::Kamelon::Debugger;
 my $debugger = Syntax::Kamelon::Debugger->new(%options);

DESCRIPTION

This module inherets Syntax::Kamelon. It contains a debugging mechanism on top of that. The debugger can do three things, called tasks:

Step

Step through the highlighting process and check Kamelon's state along the way (not yet implemented)

Watch

Set a watchpoint. The debugger reports if a match occured or failed at the watchpoint. And gives information about which rule in which context did this.

Timing

Used for optimizing Kamelon. Sets a timer on each test method.

OPTIONS

The constructor is called with the same options as Syntax::Kamelon.

USER METHODS

The debugger overrides some methods of Syntax::Kamelon. It has the following additonal methods available.

CurRule
GetStackImage

Returns an image of the highlight stack. ie a snapshot. It is different from GetState in that it is stripped of unreadable clutter.

Line

Returns the current line number

Reset

Overwritten method.

SetTasks('step', 'timer', 'watch');

Set the things you want the debugger to do.

SetWatch($line, $column);

Set the point you want to place the watch on.

SYSTEM METHODS

The debugger overrides some methods of Syntax::Kamelon. It has the following additonal methods available.

DebugStackPull

Pulls the last item of the stack, returning it as a list.

DebugStackPush($text, $rule, $time);

Pushes some stuff onto the DebugStack.

GetStackImage

Returns an image of the highlight stack. ie a snapshot. It is different from GetState in that it is stripped of unreadable clutter.

HighlightLine($text);

Overwritten method. Called by Highlight. It is given one line (including the newline) as a parameter.

NewLine

Increments the current line number with 1.

ParseContext

Overwritten method. Besides Parsing the context it also transfers debug information to the debugger.

ParseResult

Overwritten method. Besides Parsing the result it also transfers debug information to the debugger.

ParseResultLookAhead

Overwritten method. Besides Parsing the result it also transfers debug information to the debugger.

PreTask

Takes care of everything that needs to be done before the next step in the highlighting process.

PostTask

Takes care of everything that needs to be done after a step in the highlighting process.

StepPost

Takes care of the 'step'=task after a step in the highlighting process.

StepPre

Takes care of the 'step'=task before the next step in the highlighting process.

TimerPost

Takes care of the 'timer'=task after a step in the highlighting process.

TimerPre

Takes care of the 'timer'=task before the next step in the highlighting process.

WatchPosition

Checks if the highlighting process is before, on top or after the watch point.

- before returns 0

- on top returns 1

- after returns 2

WatchPost

Takes care of the 'watch'=task after a step in the highlighting process.

WatchPre

Takes care of the 'watch'=task before the next step in the highlighting process.

WatchResult

Contains information about the state of Kamelon at the moment it passed the watch point. At this moment it returns the following structures: ('Matched', [$debuginf, $matched, $stackimage]) or ('Failed', [$debuginf, undef, $stackimage])

We aim to make this a bit more friendly.

AUTHOR AND COPYRIGHT

This module is written and maintained by:

Hans Jeuken < hanje at cpan dot org >

Copyright (c) 2017 - 2023 by Hans Jeuken, all rights reserved.

Published under the same license as Perl.

SEE ALSO

Syntax::Kamelon, Syntax::Kamelon::Builder, Syntax::Kamelon::Diagnostics, Syntax::Kamelon::Indexer, Syntax::Kamelon::XMLData, Syntax::Kamelon::Format::Base, Syntax::Kamelon::Format::ANSI, Syntax::Kamelon::Format:HTML4