www.mooseframework.org
Classes | Public Member Functions | Protected Attributes | List of all members
Syntax Class Reference

Holding syntax for parsing input files. More...

#include <Syntax.h>

Classes

struct  ActionInfo
 

Public Member Functions

 Syntax ()
 
void registerTaskName (const std::string &task, bool should_auto_build=false)
 Method to register a new task. More...
 
void registerTaskName (const std::string &task, const std::string &moose_object_type, bool should_auto_build=false)
 Method to register a new task (see overload method with same name). More...
 
void appendTaskName (const std::string &task, const std::string &moose_object_type)
 Method to associate another "allowed" pluggable MOOSE system to an existing registered task. More...
 
void addDependency (const std::string &task, const std::string &pre_req)
 Method to insert a new task in the list of existing tasks at the specified location. More...
 
void addDependencySets (const std::string &action_sets)
 Adds all dependencies in a single call. More...
 
void deleteTaskDependencies (const std::string &task)
 Deletes or removes the dependencies that this task depends on. More...
 
void clearTaskDependencies ()
 Clears all tasks from the system object. More...
 
const std::vector< std::string > & getSortedTask ()
 Get a list of serialized tasks in a correct dependency order. More...
 
const std::vector< std::vector< std::string > > & getSortedTaskSet ()
 Get a list of serialized tasks in a correct dependency order. More...
 
bool hasTask (const std::string &task) const
 Returns a Boolean indicating whether or not a task is registered with the syntax object. More...
 
bool isActionRequired (const std::string &task) const
 Returns a Boolean indicating whether the specified task is required. More...
 
bool shouldAutoBuild (const std::string &task) const
 Returns a Boolean indicating whether MOOSE should attempt to automatically create an Action to satisfy a task if an Action doesn't already exist to service that task. More...
 
void registerActionSyntax (const std::string &action, const std::string &syntax, const std::string &task="", const std::string &file="", int line=-1)
 Registration function for associating Moose Actions with syntax. More...
 
void replaceActionSyntax (const std::string &action, const std::string &syntax, const std::string &task, const std::string &file="", int line=-1)
 Registration function that replaces existing Moose Actions with a completely new action Note: This function will remove all actions associated with this piece of syntax NOT just a single match of some kind. More...
 
void registerSyntaxType (const std::string &syntax, const std::string &type)
 Register a type with a block. More...
 
const std::multimap< std::string, std::string > & getAssociatedTypes () const
 Get a multimap of registered associations of syntax with type. More...
 
void deprecateActionSyntax (const std::string &syntax)
 This method deprecates previously registered syntax. More...
 
void deprecateActionSyntax (const std::string &syntax, const std::string &message)
 
std::string deprecatedActionSyntaxMessage (const std::string syntax)
 Returns the deprecation message for a given syntax that has been deprecated by deprecateActionSyntax. More...
 
bool isDeprecatedSyntax (const std::string &syntax) const
 Returns a Boolean indicating whether the syntax has been deprecated through a call to deprecateActionSyntax. More...
 
std::vector< std::string > getSyntaxByAction (const std::string &action, const std::string &task="")
 Retrieve the syntax associated with the passed in action type string. More...
 
std::string isAssociated (const std::string &real_id, bool *is_parent) const
 Method for determining whether a piece of syntax is associated with an Action TODO: I need a better name. More...
 
std::pair< std::multimap< std::string, ActionInfo >::const_iterator, std::multimap< std::string, ActionInfo >::const_iterator > getActions (const std::string &syntax) const
 Returns a pair of multimap iterators to all the ActionInfo objects associated with a given piece of syntax. More...
 
const std::multimap< std::string, ActionInfo > & getAssociatedActions () const
 Return all Syntax to Action associations. More...
 
bool verifyMooseObjectTask (const std::string &base, const std::string &task) const
 Returns a Boolean indicating whether a task is associated with on of the MOOSE pluggable systems (BASE CLASSES). More...
 
FileLineInfo getLineInfo (const std::string &syntax, const std::string &action, const std::string &task) const
 Gets the file and line where the syntax/action/task combo was registered. More...
 

Protected Attributes

std::map< std::string, bool > _registered_tasks
 The list of registered tasks and a flag indicating whether or not they should be auto-built. More...
 
std::multimap< std::string, std::string > _moose_systems_to_tasks
 The list of Moose system objects to tasks. This map indicates which tasks are allowed to build certain MooseObjects. More...
 
DependencyResolver< std::string > _tasks
 The dependency resolver. More...
 
std::multimap< std::string, ActionInfo_syntax_to_actions
 The syntax object to ActionInfo (Action+task) associations. More...
 
std::multimap< std::string, std::pair< std::string, std::string > > _actions_to_syntax
 The ActionInfo (Action+task) to syntax associations (built only when needed) Action -> (Syntax, Task) More...
 
std::multimap< std::string, std::string > _associated_types
 Syntax/Type association. More...
 
bool _actions_to_syntax_valid
 Boolean indicating whether the _actions_to_syntax map is built and valid and synced. More...
 
std::map< std::string, std::string > _deprecated_syntax
 The list of deprecated syntax items and the associated deprecated message. More...
 
FileLineInfoMap _syntax_to_line
 

Detailed Description

Holding syntax for parsing input files.

Definition at line 21 of file Syntax.h.

Constructor & Destructor Documentation

◆ Syntax()

Syntax::Syntax ( )

Definition at line 17 of file Syntax.C.

17 : _actions_to_syntax_valid(false) {}
bool _actions_to_syntax_valid
Boolean indicating whether the _actions_to_syntax map is built and valid and synced.
Definition: Syntax.h:224

Member Function Documentation

◆ addDependency()

void Syntax::addDependency ( const std::string &  task,
const std::string &  pre_req 
)

Method to insert a new task in the list of existing tasks at the specified location.

Definition at line 55 of file Syntax.C.

Referenced by addDependencySets(), and MooseApp::setupOptions().

56 {
57  if (_registered_tasks.find(task) == _registered_tasks.end())
58  mooseError("A ", task, " is not a registered task name.");
59 
60  _tasks.insertDependency(task, pre_req);
61 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
DependencyResolver< std::string > _tasks
The dependency resolver.
Definition: Syntax.h:211
std::map< std::string, bool > _registered_tasks
The list of registered tasks and a flag indicating whether or not they should be auto-built.
Definition: Syntax.h:205
void insertDependency(const T &key, const T &value)
Insert a dependency pair - the first value or the "key" depends on the second value or the "value"...

◆ addDependencySets()

void Syntax::addDependencySets ( const std::string &  action_sets)

Adds all dependencies in a single call.

The string is split on parenthesis and each task listed within the parenthesis is given equal precedence.

Definition at line 64 of file Syntax.C.

Referenced by Moose::addActionTypes().

65 {
66  std::vector<std::string> sets, prev_names, tasks;
67  MooseUtils::tokenize(action_sets, sets, 1, "()");
68 
69  for (unsigned int i = 0; i < sets.size(); ++i)
70  {
71  tasks.clear();
72  MooseUtils::tokenize(sets[i], tasks, 0, ", ");
73  for (unsigned int j = 0; j < tasks.size(); ++j)
74  {
75  // Each line should depend on each item in the previous line
76  for (unsigned int k = 0; k < prev_names.size(); ++k)
77  addDependency(tasks[j], prev_names[k]);
78  }
79  // Copy the the current items to the previous items for the next iteration
80  std::swap(tasks, prev_names);
81  }
82 }
void tokenize(const std::string &str, std::vector< T > &elements, unsigned int min_len=1, const std::string &delims="/")
This function will split the passed in string on a set of delimiters appending the substrings to the ...
Definition: MooseUtils.h:429
void addDependency(const std::string &task, const std::string &pre_req)
Method to insert a new task in the list of existing tasks at the specified location.
Definition: Syntax.C:55
X_global swap(X_sys)

◆ appendTaskName()

void Syntax::appendTaskName ( const std::string &  task,
const std::string &  moose_object_type 
)

Method to associate another "allowed" pluggable MOOSE system to an existing registered task.

Each object created during a task is checked against associated systems.

Definition at line 46 of file Syntax.C.

47 {
48  if (_registered_tasks.find(task) == _registered_tasks.end())
49  mooseError("A ", task, " is not a registered task name.");
50 
51  _moose_systems_to_tasks.insert(std::make_pair(moose_object_type, task));
52 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
std::map< std::string, bool > _registered_tasks
The list of registered tasks and a flag indicating whether or not they should be auto-built.
Definition: Syntax.h:205
std::multimap< std::string, std::string > _moose_systems_to_tasks
The list of Moose system objects to tasks. This map indicates which tasks are allowed to build certai...
Definition: Syntax.h:208

◆ clearTaskDependencies()

void Syntax::clearTaskDependencies ( )

Clears all tasks from the system object.

Definition at line 94 of file Syntax.C.

95 {
96  _tasks.clear();
97 }
DependencyResolver< std::string > _tasks
The dependency resolver.
Definition: Syntax.h:211
void clear()
Clear Items from the resolver.

◆ deleteTaskDependencies()

void Syntax::deleteTaskDependencies ( const std::string &  task)

Deletes or removes the dependencies that this task depends on.

This method does not fixup or change the graph in any other way.

Definition at line 85 of file Syntax.C.

86 {
87  if (_registered_tasks.find(task) == _registered_tasks.end())
88  mooseError("A ", task, " is not a registered task name.");
89 
91 }
void deleteDependenciesOfKey(const T &key)
Removes dependencies of the given key.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
DependencyResolver< std::string > _tasks
The dependency resolver.
Definition: Syntax.h:211
std::map< std::string, bool > _registered_tasks
The list of registered tasks and a flag indicating whether or not they should be auto-built.
Definition: Syntax.h:205

◆ deprecateActionSyntax() [1/2]

void Syntax::deprecateActionSyntax ( const std::string &  syntax)

This method deprecates previously registered syntax.

You should use the exact form that you want deprecated in the passed in parameter.

Definition at line 162 of file Syntax.C.

163 {
164  const std::string message = "\"[" + syntax + "]\" is deprecated.";
165  deprecateActionSyntax(syntax, message);
166 }
void deprecateActionSyntax(const std::string &syntax)
This method deprecates previously registered syntax.
Definition: Syntax.C:162

◆ deprecateActionSyntax() [2/2]

void Syntax::deprecateActionSyntax ( const std::string &  syntax,
const std::string &  message 
)

Definition at line 169 of file Syntax.C.

170 {
171  _deprecated_syntax.insert(std::make_pair(syntax, message));
172 }
std::map< std::string, std::string > _deprecated_syntax
The list of deprecated syntax items and the associated deprecated message.
Definition: Syntax.h:227

◆ deprecatedActionSyntaxMessage()

std::string Syntax::deprecatedActionSyntaxMessage ( const std::string  syntax)

Returns the deprecation message for a given syntax that has been deprecated by deprecateActionSyntax.

Definition at line 175 of file Syntax.C.

Referenced by Parser::walkRaw().

176 {
177  auto it = _deprecated_syntax.find(syntax);
178 
179  if (it != _deprecated_syntax.end())
180  return it->second;
181  else
182  mooseError("The action syntax ", syntax, " is not deprecated");
183 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
std::map< std::string, std::string > _deprecated_syntax
The list of deprecated syntax items and the associated deprecated message.
Definition: Syntax.h:227

◆ getActions()

std::pair< std::multimap< std::string, Syntax::ActionInfo >::const_iterator, std::multimap< std::string, Syntax::ActionInfo >::const_iterator > Syntax::getActions ( const std::string &  syntax) const

Returns a pair of multimap iterators to all the ActionInfo objects associated with a given piece of syntax.

Definition at line 280 of file Syntax.C.

Referenced by Parser::listValidParams(), and Parser::walkRaw().

281 {
282  return _syntax_to_actions.equal_range(syntax);
283 }
std::multimap< std::string, ActionInfo > _syntax_to_actions
The syntax object to ActionInfo (Action+task) associations.
Definition: Syntax.h:214

◆ getAssociatedActions()

const std::multimap< std::string, Syntax::ActionInfo > & Syntax::getAssociatedActions ( ) const

Return all Syntax to Action associations.

Definition at line 310 of file Syntax.C.

Referenced by Parser::buildFullTree(), Parser::buildJsonSyntaxTree(), and MooseApp::setupOptions().

311 {
312  return _syntax_to_actions;
313 }
std::multimap< std::string, ActionInfo > _syntax_to_actions
The syntax object to ActionInfo (Action+task) associations.
Definition: Syntax.h:214

◆ getAssociatedTypes()

const std::multimap< std::string, std::string > & Syntax::getAssociatedTypes ( ) const

Get a multimap of registered associations of syntax with type.

Definition at line 304 of file Syntax.C.

Referenced by Parser::buildJsonSyntaxTree().

305 {
306  return _associated_types;
307 }
std::multimap< std::string, std::string > _associated_types
Syntax/Type association.
Definition: Syntax.h:221

◆ getLineInfo()

FileLineInfo Syntax::getLineInfo ( const std::string &  syntax,
const std::string &  action,
const std::string &  task 
) const

Gets the file and line where the syntax/action/task combo was registered.

Parameters
syntaxSyntax name
actionAction name
taskTask name
Returns
A FileLineInfo associated with the syntax/action/task triplet

Definition at line 316 of file Syntax.C.

Referenced by Parser::buildJsonSyntaxTree().

319 {
320  return _syntax_to_line.getInfo(syntax, action, task);
321 }
FileLineInfoMap _syntax_to_line
Definition: Syntax.h:229
FileLineInfo getInfo(const std::string &key0) const
Get file/line info for a key.
Definition: FileLineInfo.C:76

◆ getSortedTask()

const std::vector< std::string > & Syntax::getSortedTask ( )

Get a list of serialized tasks in a correct dependency order.

The order my be more ordered than specified.

Definition at line 100 of file Syntax.C.

Referenced by ActionWarehouse::build().

101 {
102  return _tasks.getSortedValues();
103 }
DependencyResolver< std::string > _tasks
The dependency resolver.
Definition: Syntax.h:211
const std::vector< T > & getSortedValues()
This function also returns dependency resolved values but with a simpler single vector interface...

◆ getSortedTaskSet()

const std::vector< std::vector< std::string > > & Syntax::getSortedTaskSet ( )

Get a list of serialized tasks in a correct dependency order.

The vector of sets return type assures that tasks with equal precedence appear in a single set.

Definition at line 106 of file Syntax.C.

Referenced by ActionWarehouse::printActionDependencySets().

107 {
108  return _tasks.getSortedValuesSets();
109 }
const std::vector< std::vector< T > > & getSortedValuesSets()
Returns a vector of sets that represent dependency resolved values.
DependencyResolver< std::string > _tasks
The dependency resolver.
Definition: Syntax.h:211

◆ getSyntaxByAction()

std::vector< std::string > Syntax::getSyntaxByAction ( const std::string &  action,
const std::string &  task = "" 
)

Retrieve the syntax associated with the passed in action type string.

If a task string is also passed in, only syntax associated with that action+task combo will be returned.

Definition at line 192 of file Syntax.C.

Referenced by ActionWarehouse::addActionBlock(), Parser::extractParams(), and Parser::parse().

193 {
194  // See if the reverse multimap has been built yet, if not build it now
196  {
197  std::transform(_syntax_to_actions.begin(),
198  _syntax_to_actions.end(),
199  std::inserter(_actions_to_syntax, _actions_to_syntax.begin()),
200  [](const std::pair<std::string, ActionInfo> pair) {
201  return std::make_pair(pair.second._action,
202  std::make_pair(pair.first, pair.second._task));
203  });
205  }
206 
207  std::vector<std::string> syntax;
208  auto it_pair = _actions_to_syntax.equal_range(action);
209  for (const auto & syntax_pair : as_range(it_pair))
210  // If task is blank, return all syntax, otherwise filter by task
211  if (task == "" || syntax_pair.second.second == task)
212  syntax.emplace_back(syntax_pair.second.first);
213 
214  return syntax;
215 }
bool _actions_to_syntax_valid
Boolean indicating whether the _actions_to_syntax map is built and valid and synced.
Definition: Syntax.h:224
std::multimap< std::string, std::pair< std::string, std::string > > _actions_to_syntax
The ActionInfo (Action+task) to syntax associations (built only when needed) Action -> (Syntax...
Definition: Syntax.h:218
std::multimap< std::string, ActionInfo > _syntax_to_actions
The syntax object to ActionInfo (Action+task) associations.
Definition: Syntax.h:214

◆ hasTask()

bool Syntax::hasTask ( const std::string &  task) const

Returns a Boolean indicating whether or not a task is registered with the syntax object.

Definition at line 112 of file Syntax.C.

Referenced by ActionWarehouse::addActionBlock(), and ActionWarehouse::setFinalTask().

113 {
114  return (_registered_tasks.find(task) != _registered_tasks.end());
115 }
std::map< std::string, bool > _registered_tasks
The list of registered tasks and a flag indicating whether or not they should be auto-built.
Definition: Syntax.h:205

◆ isActionRequired()

bool Syntax::isActionRequired ( const std::string &  task) const

Returns a Boolean indicating whether the specified task is required.

DEPRECATED (use shouldAutoBuild).

Definition at line 118 of file Syntax.C.

119 {
120  mooseDeprecated("Syntax::isActionRequired is deprecated, use shouldAutoBuild() instead");
121  return shouldAutoBuild(task);
122 }
bool shouldAutoBuild(const std::string &task) const
Returns a Boolean indicating whether MOOSE should attempt to automatically create an Action to satisf...
Definition: Syntax.C:125
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:237

◆ isAssociated()

std::string Syntax::isAssociated ( const std::string &  real_id,
bool *  is_parent 
) const

Method for determining whether a piece of syntax is associated with an Action TODO: I need a better name.

This implementation assumes that wildcards can occur in the place of an entire token but not as part of a token (i.e. 'Variables/ * /InitialConditions' is valid but not 'Variables/Partial* /InitialConditions'. Since maps are ordered, a reverse traversal through the registered list will always select a more specific match before a wildcard match ('*' == char(42)).

Definition at line 218 of file Syntax.C.

Referenced by Parser::listValidParams(), ActionWarehouse::printInputFile(), and Parser::walkRaw().

219 {
226  bool local_is_parent;
227  if (is_parent == nullptr)
228  is_parent = &local_is_parent; // Just so we don't have to keep checking below when we want to
229  // set the value
230  std::vector<std::string> real_elements, reg_elements;
231  std::string return_value;
232 
233  MooseUtils::tokenize(real_id, real_elements);
234 
235  *is_parent = false;
236  for (auto it = _syntax_to_actions.rbegin(); it != _syntax_to_actions.rend(); ++it)
237  {
238  std::string reg_id = it->first;
239  if (reg_id == real_id)
240  {
241  *is_parent = false;
242  return reg_id;
243  }
244  reg_elements.clear();
245  MooseUtils::tokenize(reg_id, reg_elements);
246  if (real_elements.size() <= reg_elements.size())
247  {
248  bool keep_going = true;
249  for (unsigned int j = 0; keep_going && j < real_elements.size(); ++j)
250  {
251  if (real_elements[j] != reg_elements[j] && reg_elements[j] != std::string("*"))
252  keep_going = false;
253  }
254  if (keep_going)
255  {
256  if (real_elements.size() < reg_elements.size() && !*is_parent)
257  {
258  // We found a parent, the longest parent in fact but we need to keep
259  // looking to make sure that the real thing isn't registered
260  *is_parent = true;
261  return_value = reg_id;
262  }
263  else if (real_elements.size() == reg_elements.size())
264  {
265  *is_parent = false;
266  return reg_id;
267  }
268  }
269  }
270  }
271 
272  if (*is_parent)
273  return return_value;
274  else
275  return "";
276 }
void tokenize(const std::string &str, std::vector< T > &elements, unsigned int min_len=1, const std::string &delims="/")
This function will split the passed in string on a set of delimiters appending the substrings to the ...
Definition: MooseUtils.h:429
std::multimap< std::string, ActionInfo > _syntax_to_actions
The syntax object to ActionInfo (Action+task) associations.
Definition: Syntax.h:214

◆ isDeprecatedSyntax()

bool Syntax::isDeprecatedSyntax ( const std::string &  syntax) const

Returns a Boolean indicating whether the syntax has been deprecated through a call to deprecateActionSyntax.

Definition at line 186 of file Syntax.C.

Referenced by Parser::walkRaw().

187 {
188  return _deprecated_syntax.find(syntax) != _deprecated_syntax.end();
189 }
std::map< std::string, std::string > _deprecated_syntax
The list of deprecated syntax items and the associated deprecated message.
Definition: Syntax.h:227

◆ registerActionSyntax()

void Syntax::registerActionSyntax ( const std::string &  action,
const std::string &  syntax,
const std::string &  task = "",
const std::string &  file = "",
int  line = -1 
)

Registration function for associating Moose Actions with syntax.

Definition at line 134 of file Syntax.C.

Referenced by replaceActionSyntax().

139 {
140  auto range = _syntax_to_actions.equal_range(syntax);
141  for (auto it = range.first; it != range.second; ++it)
142  if (it->second._action == action && it->second._task == task)
143  return;
144 
145  _syntax_to_actions.insert(std::make_pair(syntax, ActionInfo{action, task}));
146  _syntax_to_line.addInfo(syntax, action, task, file, line);
147  _actions_to_syntax_valid = false;
148 }
bool _actions_to_syntax_valid
Boolean indicating whether the _actions_to_syntax map is built and valid and synced.
Definition: Syntax.h:224
FileLineInfoMap _syntax_to_line
Definition: Syntax.h:229
void addInfo(const std::string &key0, const std::string &file, int line)
Associate a key with file/line info.
Definition: FileLineInfo.C:35
std::multimap< std::string, ActionInfo > _syntax_to_actions
The syntax object to ActionInfo (Action+task) associations.
Definition: Syntax.h:214

◆ registerSyntaxType()

void Syntax::registerSyntaxType ( const std::string &  syntax,
const std::string &  type 
)

Register a type with a block.

For example, associate FunctionName with the Functions block.

Parameters
syntaxThe target syntax to associate the type with
typeThe name of the type to associate with the syntax

Definition at line 298 of file Syntax.C.

Referenced by Moose::associateSyntaxInner().

299 {
300  _associated_types.insert(std::make_pair(syntax, type));
301 }
MatType type
std::multimap< std::string, std::string > _associated_types
Syntax/Type association.
Definition: Syntax.h:221

◆ registerTaskName() [1/2]

void Syntax::registerTaskName ( const std::string &  task,
bool  should_auto_build = false 
)

Method to register a new task.

Tasks are short verbs (strings) that describe a particular point in the simulation setup phase.

Parameters
taskThe task (verb) to be registered with MOOSE.
should_autobuildindicates whether the task should be autobuilt if not supplied elsewhere.

Definition at line 20 of file Syntax.C.

Referenced by registerTaskName(), and MooseApp::setupOptions().

21 {
22  if (_registered_tasks.count(task) > 0)
23  return;
24  _tasks.addItem(task);
25  _registered_tasks[task] = should_auto_build;
26 }
DependencyResolver< std::string > _tasks
The dependency resolver.
Definition: Syntax.h:211
std::map< std::string, bool > _registered_tasks
The list of registered tasks and a flag indicating whether or not they should be auto-built.
Definition: Syntax.h:205
void addItem(const T &value)
Add an independent item to the set.

◆ registerTaskName() [2/2]

void Syntax::registerTaskName ( const std::string &  task,
const std::string &  moose_object_type,
bool  should_auto_build = false 
)

Method to register a new task (see overload method with same name).

This version also accepts a string representing a pluggable MOOSE system. When objects are created through a task, the MOOSE system is checked if it exists to make sure it's "allowed" to create those types of objects.

Definition at line 29 of file Syntax.C.

32 {
33  auto range = _moose_systems_to_tasks.equal_range(moose_object_type);
34  for (auto it = range.first; it != range.second; ++it)
35  if (it->second == task)
36  return;
37 
38  if (_registered_tasks.find(task) != _registered_tasks.end())
39  mooseError("A ", task, " is already registered. Do you need to use appendTaskName instead?");
40 
41  registerTaskName(task, should_auto_build);
42  _moose_systems_to_tasks.insert(std::make_pair(moose_object_type, task));
43 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
void registerTaskName(const std::string &task, bool should_auto_build=false)
Method to register a new task.
Definition: Syntax.C:20
std::map< std::string, bool > _registered_tasks
The list of registered tasks and a flag indicating whether or not they should be auto-built.
Definition: Syntax.h:205
std::multimap< std::string, std::string > _moose_systems_to_tasks
The list of Moose system objects to tasks. This map indicates which tasks are allowed to build certai...
Definition: Syntax.h:208

◆ replaceActionSyntax()

void Syntax::replaceActionSyntax ( const std::string &  action,
const std::string &  syntax,
const std::string &  task,
const std::string &  file = "",
int  line = -1 
)

Registration function that replaces existing Moose Actions with a completely new action Note: This function will remove all actions associated with this piece of syntax NOT just a single match of some kind.

Definition at line 151 of file Syntax.C.

156 {
157  _syntax_to_actions.erase(syntax);
158  registerActionSyntax(action, syntax, task, file, line);
159 }
void registerActionSyntax(const std::string &action, const std::string &syntax, const std::string &task="", const std::string &file="", int line=-1)
Registration function for associating Moose Actions with syntax.
Definition: Syntax.C:134
std::multimap< std::string, ActionInfo > _syntax_to_actions
The syntax object to ActionInfo (Action+task) associations.
Definition: Syntax.h:214

◆ shouldAutoBuild()

bool Syntax::shouldAutoBuild ( const std::string &  task) const

Returns a Boolean indicating whether MOOSE should attempt to automatically create an Action to satisfy a task if an Action doesn't already exist to service that task.

Definition at line 125 of file Syntax.C.

Referenced by ActionWarehouse::buildBuildableActions(), and isActionRequired().

126 {
127  auto map_pair = _registered_tasks.find(task);
128  mooseAssert(map_pair != _registered_tasks.end(), std::string("Unregistered task: ") + task);
129 
130  return map_pair->second;
131 }
std::map< std::string, bool > _registered_tasks
The list of registered tasks and a flag indicating whether or not they should be auto-built.
Definition: Syntax.h:205

◆ verifyMooseObjectTask()

bool Syntax::verifyMooseObjectTask ( const std::string &  base,
const std::string &  task 
) const

Returns a Boolean indicating whether a task is associated with on of the MOOSE pluggable systems (BASE CLASSES).

See "registerMooseObjectTask" macro in Moose.C. This information can be used to determine whether certain objects may be safely built during the specified task.

Definition at line 286 of file Syntax.C.

Referenced by ActionWarehouse::addActionBlock(), Parser::buildFullTree(), and Parser::buildJsonSyntaxTree().

287 {
288  auto iters = _moose_systems_to_tasks.equal_range(base);
289 
290  for (const auto & task_it : as_range(iters))
291  if (task == task_it.second)
292  return true;
293 
294  return false;
295 }
std::multimap< std::string, std::string > _moose_systems_to_tasks
The list of Moose system objects to tasks. This map indicates which tasks are allowed to build certai...
Definition: Syntax.h:208

Member Data Documentation

◆ _actions_to_syntax

std::multimap<std::string, std::pair<std::string, std::string> > Syntax::_actions_to_syntax
protected

The ActionInfo (Action+task) to syntax associations (built only when needed) Action -> (Syntax, Task)

Definition at line 218 of file Syntax.h.

Referenced by getSyntaxByAction().

◆ _actions_to_syntax_valid

bool Syntax::_actions_to_syntax_valid
protected

Boolean indicating whether the _actions_to_syntax map is built and valid and synced.

Definition at line 224 of file Syntax.h.

Referenced by getSyntaxByAction(), and registerActionSyntax().

◆ _associated_types

std::multimap<std::string, std::string> Syntax::_associated_types
protected

Syntax/Type association.

Definition at line 221 of file Syntax.h.

Referenced by getAssociatedTypes(), and registerSyntaxType().

◆ _deprecated_syntax

std::map<std::string, std::string> Syntax::_deprecated_syntax
protected

The list of deprecated syntax items and the associated deprecated message.

Definition at line 227 of file Syntax.h.

Referenced by deprecateActionSyntax(), deprecatedActionSyntaxMessage(), and isDeprecatedSyntax().

◆ _moose_systems_to_tasks

std::multimap<std::string, std::string> Syntax::_moose_systems_to_tasks
protected

The list of Moose system objects to tasks. This map indicates which tasks are allowed to build certain MooseObjects.

Definition at line 208 of file Syntax.h.

Referenced by appendTaskName(), registerTaskName(), and verifyMooseObjectTask().

◆ _registered_tasks

std::map<std::string, bool> Syntax::_registered_tasks
protected

The list of registered tasks and a flag indicating whether or not they should be auto-built.

Definition at line 205 of file Syntax.h.

Referenced by addDependency(), appendTaskName(), deleteTaskDependencies(), hasTask(), registerTaskName(), and shouldAutoBuild().

◆ _syntax_to_actions

std::multimap<std::string, ActionInfo> Syntax::_syntax_to_actions
protected

The syntax object to ActionInfo (Action+task) associations.

Definition at line 214 of file Syntax.h.

Referenced by getActions(), getAssociatedActions(), getSyntaxByAction(), isAssociated(), registerActionSyntax(), and replaceActionSyntax().

◆ _syntax_to_line

FileLineInfoMap Syntax::_syntax_to_line
protected

Definition at line 229 of file Syntax.h.

Referenced by getLineInfo(), and registerActionSyntax().

◆ _tasks

DependencyResolver<std::string> Syntax::_tasks
protected

The dependency resolver.

Definition at line 211 of file Syntax.h.

Referenced by addDependency(), clearTaskDependencies(), deleteTaskDependencies(), getSortedTask(), getSortedTaskSet(), and registerTaskName().


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