KiCad PCB EDA Suite
|
The parser for reading the KiCad s-expression netlist format. More...
#include <kicad_netlist_parser.h>
Public Member Functions | |
KICAD_NETLIST_PARSER (LINE_READER *aReader, NETLIST *aNetlist) | |
void | Parse () |
Function Parse parse the full netlist. | |
const char * | getTokenName (NL_T::T aTok) |
Private Member Functions | |
void | skipCurrent () |
Skip the current token level, i.e search for the RIGHT parenthesis which closes the current description. | |
void | parseComponent () |
Parse a component description: (comp (ref P1) (value DB25FEMELLE) (footprint DB25FC) (libsource (lib conn) (part DB25)) (property (name PINCOUNT) (value 25)) (sheetpath (names /) (tstamps /)) (tstamp 3256759C)) | |
void | parseNet () |
Parse a net section (net (code 20) (name /PC-A0) (node (ref BUS1) (pin 62)) (node (ref U3) (pin 3)) (node (ref U9) (pin M6))) | |
void | parseLibPartList () |
Read the section "libparts" in the netlist: (libparts (libpart (lib device) (part C) (description "Condensateur non polarise") (footprints (fp SM*) (fp C?) (fp C1-1)) (fields (field (name Reference) C) (field (name Value) C)) (pins (pin (num 1) (name ~) (type passive)) (pin (num 2) (name ~) (type passive)))) | |
Private Attributes | |
NL_T::T | token |
LINE_READER * | m_lineReader |
The line reader used to parse the netlist. Not owned. | |
NETLIST * | m_netlist |
The netlist to parse into. Not owned. | |
The parser for reading the KiCad s-expression netlist format.
Definition at line 32 of file kicad_netlist_parser.h.
KICAD_NETLIST_PARSER::KICAD_NETLIST_PARSER | ( | LINE_READER * | aReader, |
NETLIST * | aNetlist | ||
) |
Definition at line 55 of file kicad_netlist_reader.cpp.
References m_lineReader, m_netlist, and token.
|
inline |
Definition at line 44 of file kicad_netlist_parser.h.
void KICAD_NETLIST_PARSER::Parse | ( | ) |
Function Parse parse the full netlist.
Definition at line 84 of file kicad_netlist_reader.cpp.
References parseComponent(), parseLibPartList(), parseNet(), skipCurrent(), and token.
Referenced by KICAD_NETLIST_READER::LoadNetlist().
|
private |
Parse a component description: (comp (ref P1) (value DB25FEMELLE) (footprint DB25FC) (libsource (lib conn) (part DB25)) (property (name PINCOUNT) (value 25)) (sheetpath (names /) (tstamps /)) (tstamp 3256759C))
Definition at line 282 of file kicad_netlist_reader.cpp.
References _, NETLIST::AddComponent(), From_UTF8(), library, m_netlist, name, LIB_ID::Parse(), path, COMPONENT::SetComponentClassNames(), COMPONENT::SetFields(), COMPONENT::SetHumanReadablePath(), COMPONENT::SetLibrary(), COMPONENT::SetName(), COMPONENT::SetProperties(), skipCurrent(), THROW_IO_ERROR, and token.
Referenced by Parse().
|
private |
Read the section "libparts" in the netlist: (libparts (libpart (lib device) (part C) (description "Condensateur non polarise") (footprints (fp SM*) (fp C?) (fp C1-1)) (fields (field (name Reference) C) (field (name Value) C)) (pins (pin (num 1) (name ~) (type passive)) (pin (num 2) (name ~) (type passive))))
And add the strings giving the footprint filter (subsection footprints) of the corresponding footprint info
This section is used by CvPcb, and is not useful in Pcbnew, therefore it it not always read
Definition at line 520 of file kicad_netlist_reader.cpp.
References From_UTF8(), NETLIST::GetComponent(), NETLIST::GetCount(), COMPONENT::IsLibSource(), m_netlist, COMPONENT::SetFootprintFilters(), COMPONENT::SetPinCount(), skipCurrent(), and token.
Referenced by Parse().
|
private |
Parse a net section (net (code 20) (name /PC-A0) (node (ref BUS1) (pin 62)) (node (ref U3) (pin 3)) (node (ref U9) (pin M6)))
and set the corresponding pads netnames
Definition at line 178 of file kicad_netlist_reader.cpp.
References From_UTF8(), NETLIST::GetComponentByReference(), m_netlist, name, skipCurrent(), and token.
Referenced by Parse().
|
private |
Skip the current token level, i.e search for the RIGHT parenthesis which closes the current description.
Definition at line 64 of file kicad_netlist_reader.cpp.
References token.
Referenced by Parse(), parseComponent(), parseLibPartList(), and parseNet().
|
private |
The line reader used to parse the netlist. Not owned.
Definition at line 100 of file kicad_netlist_parser.h.
Referenced by KICAD_NETLIST_PARSER().
|
private |
The netlist to parse into. Not owned.
Definition at line 101 of file kicad_netlist_parser.h.
Referenced by KICAD_NETLIST_PARSER(), parseComponent(), parseLibPartList(), and parseNet().
|
private |
Definition at line 99 of file kicad_netlist_parser.h.
Referenced by KICAD_NETLIST_PARSER(), Parse(), parseComponent(), parseLibPartList(), parseNet(), and skipCurrent().