https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Attributes | List of all members
DupParamWalker Class Reference

#include <Parser.h>

Inheritance diagram for DupParamWalker:
[legend]

Public Member Functions

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

Public Attributes

std::vector< hit::ErrorMessage > errors
 

Private Attributes

std::map< std::string, hit::Node * > _have
 

Detailed Description

Definition at line 50 of file Parser.h.

Member Function Documentation

◆ walk()

void DupParamWalker::walk ( const std::string &  fullpath,
const std::string &  ,
hit::Node *  n 
)
overridevirtual

Definition at line 236 of file Parser.C.

237{
238 const auto it = _have.try_emplace(fullpath, n);
239 if (!it.second)
240 {
241 const std::string type = n->type() == hit::NodeType::Field ? "parameter" : "section";
242 const std::string error = type + " '" + fullpath + "' supplied multiple times";
243
244 // Don't warn multiple times (will happen if we find it three+ times)
245 const auto existing = it.first->second;
246 if (std::find_if(errors.begin(),
247 errors.end(),
248 [&existing](const auto & err)
249 { return err.node == existing; }) == errors.end())
250 errors.emplace_back(error, existing);
251
252 errors.emplace_back(error, n);
253 }
254}
std::map< std::string, hit::Node * > _have
Definition Parser.h:59
std::vector< hit::ErrorMessage > errors
Definition Parser.h:56

Referenced by Parser::parse().

Member Data Documentation

◆ _have

std::map<std::string, hit::Node *> DupParamWalker::_have
private

Definition at line 59 of file Parser.h.

Referenced by walk().

◆ errors

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

Definition at line 56 of file Parser.h.

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


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