KiCad PCB EDA Suite
Loading...
Searching...
No Matches
STREAM_PARSER Class Referenceabstract

In order to support fuzz testing, we need to be able to parse from stdin. More...

Inheritance diagram for STREAM_PARSER:
BOARD_PARSER ALLEGRO_BRD_STREAM_PARSER SEXPR_STREAM_PARSER

Public Member Functions

virtual void PrepareStream (std::istream &aStream)=0
 Take some input stream and prepare it for parsing.
 
virtual std::unique_ptr< BOARD_ITEMParse ()=0
 Actually perform the parsing and return a BOARD_ITEM if successful, or nullptr if not.
 

Detailed Description

In order to support fuzz testing, we need to be able to parse from stdin.

The PCB_IO interface is designed to parse from a file, so this class is a simple wrapper that needs to be implemented to wrap a plugin's core parser function.

Definition at line 96 of file pcb_parser_tool.cpp.

Member Function Documentation

◆ Parse()

virtual std::unique_ptr< BOARD_ITEM > BOARD_PARSER::Parse ( )
pure virtualinherited

Actually perform the parsing and return a BOARD_ITEM if successful, or nullptr if not.

Exceptions
IO_ERRORif there is a parse failure

Implemented in ALLEGRO_BRD_STREAM_PARSER, FILE_PARSER, and SEXPR_STREAM_PARSER.

Referenced by PCB_PARSE_RUNNER::doParse().

◆ PrepareStream()

virtual void STREAM_PARSER::PrepareStream ( std::istream & aStream)
pure virtual

Take some input stream and prepare it for parsing.

This may involve reading the whole stream into memory, or it may involve setting up some kind of streaming reader.

Exceptions
IO_ERRORif there is a problem setting up from the stream

Implemented in ALLEGRO_BRD_STREAM_PARSER, and SEXPR_STREAM_PARSER.


The documentation for this class was generated from the following file: