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< hit::ErrorMessage > errors
 

Detailed Description

Definition at line 48 of file Parser.h.

Member Function Documentation

◆ walk()

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

Definition at line 210 of file Parser.C.

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

Member Data Documentation

◆ errors

std::vector<hit::ErrorMessage> BadActiveWalker::errors

Definition at line 54 of file Parser.h.

Referenced by Parser::parse(), and walk().


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