Skip to main content

Crate perl_dap_breakpoint

Crate perl_dap_breakpoint 

Source
Expand description

Breakpoint Validation for Perl DAP

This crate provides AST-based breakpoint validation for the Perl Debug Adapter Protocol. It validates breakpoint locations against parsed source code to ensure breakpoints are set on executable lines, not on comments, blank lines, or inside heredoc content.

§Features

  • AST-Based Validation: Uses the Perl parser AST to validate breakpoint locations
  • Line Suggestion: Suggests the nearest valid line when a breakpoint is on an invalid location
  • Validation Reasons: Provides detailed reasons for why a breakpoint was rejected or adjusted

§Example

use perl_dap_breakpoint::{BreakpointValidator, AstBreakpointValidator};

let source = "# comment\nmy $x = 1;\n";
let validator = AstBreakpointValidator::new(source)?;

let result = validator.validate(1); // Line 1 is a comment
assert!(!result.verified);
assert_eq!(result.reason, Some(ValidationReason::CommentLine));

Structs§

AstBreakpointValidator
AST-based breakpoint validator
BreakpointValidation
Result of breakpoint validation

Enums§

BreakpointError
Error type for breakpoint validation operations
SearchDirection
Direction to search for a valid line
ValidationReason
Reason why a breakpoint was rejected or adjusted

Traits§

BreakpointValidator
Trait for breakpoint validation

Functions§

find_nearest_valid_line
Find the nearest valid line to the given line number