Skip to main content

Module error_classifier

Module error_classifier 

Source
Expand description

Error classification and recovery strategies for parse failures. Error classification and diagnostic generation for parsed Perl code. Error classification and diagnostic generation for Perl parsing workflows

This module provides intelligent error classification for parsing failures in Perl scripts, offering specific error types and recovery suggestions for LSP workflow operations.

§LSP Workflow Integration

Error classification supports robust Perl parsing across LSP workflow stages:

  • Parse: Classify syntax errors during parser construction
  • Index: Provide error context for symbol extraction and indexing
  • Navigate: Surface recovery hints for definition and reference resolution
  • Complete: Enable error-tolerant completion and quick fixes
  • Analyze: Drive diagnostics and remediation guidance

§Usage Examples

use perl_parser::error_classifier::{ErrorClassifier, ParseErrorKind};
use perl_parser::{Parser, ast::Node};

let classifier = ErrorClassifier::new();
let source = "my $value = \"unclosed string...";
let mut parser = Parser::new(source);
let _result = parser.parse(); // This will fail due to unclosed string

// Classify parsing errors for better user feedback
// let error_kind = classifier.classify(&error_node, source);
// let message = classifier.get_diagnostic_message(&error_kind);
// let suggestion = classifier.get_suggestion(&error_kind);

Structs§

ErrorClassifier
Perl script error classification engine for LSP workflow operations

Enums§

ParseErrorKind
Specific types of parse errors found in Perl script content