www.mooseframework.org
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 215 of file Parser.C.

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

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: