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 67 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 80 of file dialog_bom.cpp.

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

References m_generatorsList.

Member Function Documentation

◆ Parse()

void BOM_CFG_PARSER::Parse ( )

Definition at line 88 of file dialog_bom.cpp.

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

References parseGenerator().

Referenced by DIALOG_BOM::installGeneratorsList().

◆ parseGenerator()

void BOM_CFG_PARSER::parseGenerator ( )
private

Definition at line 117 of file dialog_bom.cpp.

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

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 69 of file dialog_bom.cpp.

Referenced by BOM_CFG_PARSER(), and parseGenerator().


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