KiCad PCB EDA Suite
Loading...
Searching...
No Matches
kicad_netlist_parser.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2024 KiCad Developers, see change_log.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#pragma once
25
26#include <netlist_lexer.h>
28
32class KICAD_NETLIST_PARSER : public NETLIST_LEXER
33{
34public:
35 KICAD_NETLIST_PARSER( LINE_READER* aReader, NETLIST* aNetlist );
36
41 void Parse();
42
43 // Useful for debug only:
44 const char* getTokenName( NL_T::T aTok ) { return NETLIST_LEXER::TokenName( aTok ); }
45
46private:
51 void skipCurrent();
52
63 void parseComponent();
64
74 void parseNet();
75
97 void parseLibPartList();
98
99 NL_T::T token;
102};
The parser for reading the KiCad s-expression netlist format.
void parseComponent()
Parse a component description: (comp (ref P1) (value DB25FEMELLE) (footprint DB25FC) (libsource (lib ...
void Parse()
Function Parse parse the full netlist.
void parseNet()
Parse a net section (net (code 20) (name /PC-A0) (node (ref BUS1) (pin 62)) (node (ref U3) (pin 3)) (...
NETLIST * m_netlist
The netlist to parse into. Not owned.
void parseLibPartList()
Read the section "libparts" in the netlist: (libparts (libpart (lib device) (part C) (description "Co...
LINE_READER * m_lineReader
The line reader used to parse the netlist. Not owned.
const char * getTokenName(NL_T::T aTok)
void skipCurrent()
Skip the current token level, i.e search for the RIGHT parenthesis which closes the current descripti...
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:93
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition: pcb_netlist.h:241