www.mooseframework.org
Public Member Functions | Public Attributes | Private Attributes | List of all members
UnusedWalker Class Reference
Inheritance diagram for UnusedWalker:
[legend]

Public Member Functions

 UnusedWalker (std::string fname, std::set< std::string > used, Parser &p)
 
void walk (const std::string &fullpath, const std::string &nodename, hit::Node *n) override
 

Public Attributes

std::vector< std::string > errors
 

Private Attributes

std::string _fname
 
std::set< std::string > _used
 
Parser_parser
 

Detailed Description

Definition at line 181 of file Parser.C.

Constructor & Destructor Documentation

UnusedWalker::UnusedWalker ( std::string  fname,
std::set< std::string >  used,
Parser p 
)
inline

Definition at line 184 of file Parser.C.

185  : _fname(fname), _used(used), _parser(p)
186  {
187  }
std::set< std::string > _used
Definition: Parser.C:218
Parser & _parser
Definition: Parser.C:219
std::string _fname
Definition: Parser.C:217

Member Function Documentation

void UnusedWalker::walk ( const std::string &  fullpath,
const std::string &  nodename,
hit::Node *  n 
)
inlineoverride

Definition at line 189 of file Parser.C.

190  {
191  // the line() > 0 check allows us to skip nodes that were merged into this tree (i.e. CLI
192  // args) because their unused params are checked+reported independently of the ones in the
193  // main tree.
194  if (!_used.count(fullpath) && nodename != "active" && nodename != "inactive" &&
195  isSectionActive(fullpath, n->root()) && n->line() > 0)
196  {
197  auto section_name = fullpath.substr(0, fullpath.rfind("/"));
198  auto paramlist = _parser.listValidParams(section_name);
199  auto candidates = findSimilar(nodename, paramlist);
200  if (candidates.size() > 0)
201  errors.push_back(errormsg(_fname,
202  n,
203  "unused parameter '",
204  fullpath,
205  "'\n",
206  " Did you mean '",
207  candidates[0],
208  "'?"));
209  else
210  errors.push_back(errormsg(_fname, n, "unused parameter '", fullpath, "'"));
211  }
212  }
std::set< std::string > _used
Definition: Parser.C:218
Parser & _parser
Definition: Parser.C:219
bool isSectionActive(std::string path, hit::Node *root)
Definition: Parser.C:72
std::vector< std::string > listValidParams(std::string &section_name)
Definition: Parser.C:165
std::vector< std::string > errors
Definition: Parser.C:214
PetscInt n
std::string errormsg(std::string, hit::Node *)
Definition: Parser.h:39
std::vector< std::string > findSimilar(std::string param, std::vector< std::string > options)
Definition: Parser.C:139
std::string _fname
Definition: Parser.C:217

Member Data Documentation

std::string UnusedWalker::_fname
private

Definition at line 217 of file Parser.C.

Parser& UnusedWalker::_parser
private

Definition at line 219 of file Parser.C.

std::set<std::string> UnusedWalker::_used
private

Definition at line 218 of file Parser.C.

std::vector<std::string> UnusedWalker::errors

Definition at line 214 of file Parser.C.

Referenced by Parser::errorCheck().


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