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_PLUGIN_ARRAY *aPlugins, const char *aData, const wxString &aSource)
 
void Parse ()
 

Private Member Functions

void parsePlugin ()
 

Private Attributes

BOM_PLUGIN_ARRAYm_pluginsList
 

Detailed Description

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

Definition at line 66 of file dialog_bom.cpp.

Constructor & Destructor Documentation

BOM_CFG_PARSER::BOM_CFG_PARSER ( BOM_PLUGIN_ARRAY aPlugins,
const char *  aData,
const wxString &  aSource 
)

Definition at line 79 of file dialog_bom.cpp.

References m_pluginsList.

80  :
81  DIALOG_BOM_CFG_LEXER( aLine, aSource )
82 {
83  m_pluginsList = aPlugins;
84 }
BOM_PLUGIN_ARRAY * m_pluginsList
Definition: dialog_bom.cpp:68

Member Function Documentation

void BOM_CFG_PARSER::Parse ( )

Definition at line 87 of file dialog_bom.cpp.

References parsePlugin().

Referenced by DIALOG_BOM::installPluginsList().

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

Definition at line 116 of file dialog_bom.cpp.

References m_pluginsList, and name.

Referenced by Parse().

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

Member Data Documentation

BOM_PLUGIN_ARRAY* BOM_CFG_PARSER::m_pluginsList
private

Definition at line 68 of file dialog_bom.cpp.

Referenced by BOM_CFG_PARSER(), and parsePlugin().


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