Skip to content

Rewrite KiCadSchematicParser using sexpdata (proper S-expr tree walker) #119

Description

@RFingAdam

Problem

parsers/schematic_parser.py::KiCadSchematicParser is regex-based today. It misses hierarchical sheets, pin-net mapping via (wire)/(label)/(junction), the in_bom/on_board DNP flags, and Datasheet/MPN properties. Downstream schematic analyzers (power_topology, protection_circuits, decoupling_per_ic) only operate in their degraded "no pin-net mapping" mode against KiCad inputs.

Acceptance criteria

  • Use sexpdata (already in the dependency tree or add it) for proper S-expression tree traversal.
  • Hierarchical sheets recursed; sheet path recorded per component.
  • Net resolution from (wire) + (label) + (junction) produces ParsedComponent.pins with {pin_number, net} entries.
  • in_bom / on_board properties drive a dnp flag on ParsedComponent.
  • Datasheet, MPN, Manufacturer properties exposed via ParsedComponent.part_number / manufacturer.
  • Round-trip test using the synthetic sample_2sheet.kicad_sch fixture asserts component count, net count, pin-net mapping, DNP flag, and hierarchical sheet path.
  • All existing tests still pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestparserODB++/file parser issuespriority-highImportant for usable review

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions