https://mooseframework.inl.gov
Public Member Functions | Public Attributes | List of all members
BadActiveWalker Class Reference

#include <Parser.h>

Inheritance diagram for BadActiveWalker:
[legend]

Public Member Functions

virtual void walk (const std::string &, const std::string &, hit::Node *section) override
 

Public Attributes

std::vector< std::string > errors
 

Detailed Description

Definition at line 61 of file Parser.h.

Member Function Documentation

◆ walk()

void BadActiveWalker::walk ( const std::string &  ,
const std::string &  ,
hit::Node *  section 
)
overridevirtual

Definition at line 216 of file Parser.C.

219 {
220  auto actives = section->find("active");
221  auto inactives = section->find("inactive");
222 
223  if (actives && inactives && actives->type() == hit::NodeType::Field &&
224  inactives->type() == hit::NodeType::Field && actives->parent() == inactives->parent())
225  {
226  errors.push_back(
227  hit::errormsg(section, "'active' and 'inactive' parameters both provided in section"));
228  return;
229  }
230 
231  // ensures we don't recheck deeper nesting levels
232  if (actives && actives->type() == hit::NodeType::Field && actives->parent() == section)
233  {
234  auto vars = section->param<std::vector<std::string>>("active");
235  std::string msg = "";
236  for (auto & var : vars)
237  {
238  if (!section->find(var))
239  msg += var + ", ";
240  }
241  if (msg.size() > 0)
242  {
243  msg = msg.substr(0, msg.size() - 2);
244  errors.push_back(hit::errormsg(section,
245  "variables listed as active (",
246  msg,
247  ") in section '",
248  section->fullpath(),
249  "' not found in input"));
250  }
251  }
252  // ensures we don't recheck deeper nesting levels
253  if (inactives && inactives->type() == hit::NodeType::Field && inactives->parent() == section)
254  {
255  auto vars = section->param<std::vector<std::string>>("inactive");
256  std::string msg = "";
257  for (auto & var : vars)
258  {
259  if (!section->find(var))
260  msg += var + ", ";
261  }
262  if (msg.size() > 0)
263  {
264  msg = msg.substr(0, msg.size() - 2);
265  errors.push_back(hit::errormsg(section,
266  "variables listed as inactive (",
267  msg,
268  ") in section '",
269  section->fullpath(),
270  "' not found in input"));
271  }
272  }
273 }
std::vector< std::string > errors
Definition: Parser.h:67
char ** vars

Member Data Documentation

◆ errors

std::vector<std::string> BadActiveWalker::errors

Definition at line 67 of file Parser.h.

Referenced by Moose::Builder::build(), Parser::parse(), and walk().


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