KiCad PCB EDA Suite
BOM_CFG_PARSER Class Reference

Holds data and functions pertinent to parsing a S-expression file. More...

Inheritance diagram for BOM_CFG_PARSER:

Public Member Functions

 BOM_CFG_PARSER (BOM_GENERATOR_ARRAY *aGenerators, const char *aData, const wxString &aSource)
 
void Parse ()
 

Private Member Functions

void parseGenerator ()
 

Private Attributes

BOM_GENERATOR_ARRAYm_generatorsList
 

Detailed Description

Holds data and functions pertinent to parsing a S-expression file.

Definition at line 68 of file dialog_bom.cpp.

Constructor & Destructor Documentation

◆ BOM_CFG_PARSER()

BOM_CFG_PARSER::BOM_CFG_PARSER ( BOM_GENERATOR_ARRAY aGenerators,
const char *  aData,
const wxString &  aSource 
)

Definition at line 81 of file dialog_bom.cpp.

82  :
83  DIALOG_BOM_CFG_LEXER( aLine, aSource )
84 {
85  m_generatorsList = aGenerators;
86 }
BOM_GENERATOR_ARRAY * m_generatorsList
Definition: dialog_bom.cpp:70

References m_generatorsList.

Member Function Documentation

◆ Parse()

void BOM_CFG_PARSER::Parse ( )

Definition at line 89 of file dialog_bom.cpp.

90 {
91  T token;
92 
93  while( ( token = NextTok() ) != T_RIGHT )
94  {
95  if( token == T_EOF)
96  break;
97 
98  if( token == T_LEFT )
99  token = NextTok();
100 
101  if( token == T_plugins )
102  continue;
103 
104  switch( token )
105  {
106  case T_plugin: // Defines a new plugin
107  parseGenerator();
108  break;
109 
110  default:
111 // Unexpected( CurText() );
112  break;
113  }
114  }
115 }
void parseGenerator()
Definition: dialog_bom.cpp:118

References parseGenerator().

Referenced by DIALOG_BOM::installGeneratorsList().

◆ parseGenerator()

void BOM_CFG_PARSER::parseGenerator ( )
private

Definition at line 118 of file dialog_bom.cpp.

119 {
120  NeedSYMBOLorNUMBER();
121  wxString name = FromUTF8();
122  auto plugin = std::make_unique<BOM_GENERATOR_HANDLER>( name );
123 
124  T token;
125 
126  while( ( token = NextTok() ) != T_RIGHT )
127  {
128  if( token == T_EOF)
129  break;
130 
131  switch( token )
132  {
133  case T_LEFT:
134  break;
135 
136  case T_cmd:
137  NeedSYMBOLorNUMBER();
138 
139  if( plugin )
140  plugin->SetCommand( FromUTF8() );
141 
142  NeedRIGHT();
143  break;
144 
145  case T_opts:
146  NeedSYMBOLorNUMBER();
147 
148  if( plugin )
149  {
150  wxString option = FromUTF8();
151 
152  if( option.StartsWith( "nickname=", &name ) )
153  plugin->SetName( name );
154  else
155  plugin->Options().Add( option );
156  }
157 
158  NeedRIGHT();
159  break;
160 
161  default:
162  Unexpected( CurText() );
163  break;
164  }
165  }
166 
167  if( plugin )
168  m_generatorsList->push_back( std::move( plugin ) );
169 }
BOM_GENERATOR_ARRAY * m_generatorsList
Definition: dialog_bom.cpp:70
const char * name
Definition: DXF_plotter.cpp:60

References m_generatorsList, and name.

Referenced by Parse().

Member Data Documentation

◆ m_generatorsList

BOM_GENERATOR_ARRAY* BOM_CFG_PARSER::m_generatorsList
private

Definition at line 70 of file dialog_bom.cpp.

Referenced by BOM_CFG_PARSER(), and parseGenerator().


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