l0_cli_diagnostics.py

l0_cli_diagnostics.py

Module: l0_cli_diagnostics

Source: compiler/stage1_py/l0_cli_diagnostics.py Language: Python

Symbols

Namespace l0_cli_diagnostics

Function l0_cli_diagnostics._load_file_lines

1
list[str] l0_cli_diagnostics._load_file_lines(str path, dict[str, list[str]] cache)

Load lines of a source file, using a cache to avoid redundant reads.

Parameters:

  • path: Path to the source file.
  • cache: Cache of file lines keyed by path.

Returns: A list of strings representing the lines of the file.

Function l0_cli_diagnostics._emit_diagnostic

1
None l0_cli_diagnostics._emit_diagnostic(str message)

Write one normative compiler diagnostic line to standard error.

Parameters:

  • message: Diagnostic text without a trailing newline.

    Function l0_cli_diagnostics.print_diagnostics

1
None l0_cli_diagnostics.print_diagnostics(AnalysisResult result)

Print diagnostics from the analysis result.

Parameters:

  • result: The analysis result containing diagnostics.

    Function l0_cli_diagnostics.print_diagnostic_list

1
None l0_cli_diagnostics.print_diagnostic_list(list[Diagnostic] diagnostics)

Print a list of diagnostics, using a file cache for source snippets.

Parameters:

  • diagnostics: List of diagnostics to print.

    Function l0_cli_diagnostics.print_diagnostic_with_snippet

1
None l0_cli_diagnostics.print_diagnostic_with_snippet(Diagnostic diag, dict[str, list[str]] file_cache)

Print a single diagnostic, including the source line and a caret.

Parameters:

  • diag: The diagnostic to print.
  • file_cache: Cache of file lines keyed by path.