https://mooseframework.inl.gov
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 36 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 164 of file Parser.C.

Referenced by Parser::parse().

165 {
166  const auto it = _have.try_emplace(fullpath, n);
167  if (!it.second)
168  {
169  const std::string type = n->type() == hit::NodeType::Field ? "parameter" : "section";
170  const std::string error = type + " '" + fullpath + "' supplied multiple times";
171 
172  // Don't warn multiple times (will happen if we find it three+ times)
173  const auto existing = it.first->second;
174  if (std::find_if(errors.begin(),
175  errors.end(),
176  [&existing](const auto & err)
177  { return err.node == existing; }) == errors.end())
178  errors.emplace_back(error, existing);
179 
180  errors.emplace_back(error, n);
181  }
182 }
OStreamProxy err
std::vector< hit::ErrorMessage > errors
Definition: Parser.h:42
std::map< std::string, hit::Node * > _have
Definition: Parser.h:45

Member Data Documentation

◆ _have

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

Definition at line 45 of file Parser.h.

Referenced by walk().

◆ errors

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

Definition at line 42 of file Parser.h.

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


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