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, bool deprecated) |
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) |
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::vector< std::string > | getNonDeprecatedSyntaxByAction (const std::string &action, const std::string &task="") |
Retrieve the non-deprecated syntax associated with the passed in action type string. More... | |
std::string | isAssociated (const std::string &real_id, bool *is_parent, const std::map< std::string, std::set< std::string >> &alt_map={}) const |
Method for determining whether a piece of syntax is associated with an Action an optional syntax map may be given to traverse instead of _syntax_to_actions 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... | |
std::multimap< std::string, std::string > | _deprecated_list_moose_systems_to_tasks |
A list of Moose system objects to tasks that are deprecated for these systems. 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 |
Syntax::Syntax | ( | ) |
Definition at line 17 of file Syntax.C.
void Syntax::addDependency | ( | const std::string & | task, |
const std::string & | pre_req | ||
) |
Definition at line 60 of file Syntax.C.
Referenced by addDependencySets(), and MooseApp::setupOptions().
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 69 of file Syntax.C.
Referenced by Moose::addActionTypes().
void Syntax::appendTaskName | ( | const std::string & | task, |
const std::string & | moose_object_type, | ||
bool | deprecated | ||
) |
Method to associate another "allowed" pluggable MOOSE system to an existing registered task.
Each object created during a task is checked against associated systems.
task | the task to allow a new type of moose objects for |
moose_object_type | the type of objects to allow with this task |
deprecated | whether constructing this moose object with this task is deprecated |
Definition at line 46 of file Syntax.C.
void Syntax::clearTaskDependencies | ( | ) |
Clears all tasks from the system object.
Definition at line 99 of file Syntax.C.
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 90 of file Syntax.C.
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 175 of file Syntax.C.
void Syntax::deprecateActionSyntax | ( | const std::string & | syntax, |
const std::string & | message | ||
) |
Definition at line 182 of file Syntax.C.
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 188 of file Syntax.C.
Referenced by Moose::Builder::walkRaw().
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 322 of file Syntax.C.
Referenced by MooseServer::getActionParameters(), Moose::Builder::listValidParams(), and Moose::Builder::walkRaw().
const std::multimap< std::string, Syntax::ActionInfo > & Syntax::getAssociatedActions | ( | ) | const |
Return all Syntax to Action associations.
Definition at line 368 of file Syntax.C.
Referenced by MooseServer::addSubblocksToList(), Moose::Builder::buildFullTree(), Moose::Builder::buildJsonSyntaxTree(), and MooseApp::setupOptions().
const std::multimap< std::string, std::string > & Syntax::getAssociatedTypes | ( | ) | const |
Get a multimap of registered associations of syntax with type.
Definition at line 362 of file Syntax.C.
Referenced by MooseServer::addValuesToList(), Moose::Builder::buildJsonSyntaxTree(), and MooseServer::getInputLookupDefinitionNodes().
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.
Definition at line 374 of file Syntax.C.
Referenced by Moose::Builder::buildJsonSyntaxTree().
std::vector< std::string > Syntax::getNonDeprecatedSyntaxByAction | ( | const std::string & | action, |
const std::string & | task = "" |
||
) |
Retrieve the non-deprecated 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 231 of file Syntax.C.
Referenced by ActionWarehouse::addActionBlock().
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 105 of file Syntax.C.
Referenced by ActionWarehouse::build().
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 119 of file Syntax.C.
Referenced by ActionWarehouse::printActionDependencySets().
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 205 of file Syntax.C.
Referenced by Moose::Builder::build(), Moose::Builder::extractParams(), and getNonDeprecatedSyntaxByAction().
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 125 of file Syntax.C.
Referenced by ActionWarehouse::addActionBlock(), and ActionWarehouse::setFinalTask().
bool Syntax::isActionRequired | ( | const std::string & | task | ) | const |
Returns a Boolean indicating whether the specified task is required.
DEPRECATED (use shouldAutoBuild).
Definition at line 131 of file Syntax.C.
std::string Syntax::isAssociated | ( | const std::string & | real_id, |
bool * | is_parent, | ||
const std::map< std::string, std::set< std::string >> & | alt_map = {} |
||
) | const |
Method for determining whether a piece of syntax is associated with an Action an optional syntax map may be given to traverse instead of _syntax_to_actions 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 245 of file Syntax.C.
Referenced by MooseServer::addSubblocksToList(), MooseServer::getActionParameters(), Moose::Builder::listValidParams(), ActionWarehouse::printInputFile(), and Moose::Builder::walkRaw().
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 199 of file Syntax.C.
Referenced by getNonDeprecatedSyntaxByAction(), and Moose::Builder::walkRaw().
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 147 of file Syntax.C.
Referenced by replaceActionSyntax().
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.
syntax | The target syntax to associate the type with |
type | The name of the type to associate with the syntax |
Definition at line 356 of file Syntax.C.
Referenced by Moose::associateSyntaxInner().
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.
task | The task (verb) to be registered with MOOSE. |
should_autobuild | indicates whether the task should be autobuilt if not supplied elsewhere. |
Definition at line 20 of file Syntax.C.
Referenced by registerTaskName(), and MooseApp::setupOptions().
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.
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 164 of file Syntax.C.
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 138 of file Syntax.C.
Referenced by ActionWarehouse::buildBuildableActions(), and isActionRequired().
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 328 of file Syntax.C.
Referenced by ActionWarehouse::addActionBlock(), MooseServer::addValuesToList(), Moose::Builder::buildFullTree(), Moose::Builder::buildJsonSyntaxTree(), MooseServer::getHoverDisplayText(), and MooseServer::getObjectParameters().
|
protected |
The ActionInfo (Action+task) to syntax associations (built only when needed) Action -> (Syntax, Task)
Definition at line 234 of file Syntax.h.
Referenced by getSyntaxByAction().
|
protected |
Boolean indicating whether the _actions_to_syntax map is built and valid and synced.
Definition at line 240 of file Syntax.h.
Referenced by getSyntaxByAction(), and registerActionSyntax().
|
protected |
Syntax/Type association.
Definition at line 237 of file Syntax.h.
Referenced by getAssociatedTypes(), and registerSyntaxType().
|
protected |
A list of Moose system objects to tasks that are deprecated for these systems.
If an item is in this map, the task is still allowed to build the object from the MOOSE system, but it is deprecated to do so.
Definition at line 224 of file Syntax.h.
Referenced by appendTaskName(), and verifyMooseObjectTask().
|
protected |
The list of deprecated syntax items and the associated deprecated message.
Definition at line 243 of file Syntax.h.
Referenced by deprecateActionSyntax(), deprecatedActionSyntaxMessage(), and isDeprecatedSyntax().
|
protected |
The list of Moose system objects to tasks. This map indicates which tasks are allowed to build certain MooseObjects.
Definition at line 219 of file Syntax.h.
Referenced by appendTaskName(), registerTaskName(), and verifyMooseObjectTask().
|
protected |
The list of registered tasks and a flag indicating whether or not they should be auto-built.
Definition at line 216 of file Syntax.h.
Referenced by addDependency(), appendTaskName(), deleteTaskDependencies(), hasTask(), registerTaskName(), and shouldAutoBuild().
|
protected |
The syntax object to ActionInfo (Action+task) associations.
Definition at line 230 of file Syntax.h.
Referenced by getActions(), getAssociatedActions(), getSyntaxByAction(), isAssociated(), registerActionSyntax(), and replaceActionSyntax().
|
protected |
Definition at line 245 of file Syntax.h.
Referenced by getLineInfo(), and registerActionSyntax().
|
protected |
The dependency resolver.
Definition at line 227 of file Syntax.h.
Referenced by addDependency(), clearTaskDependencies(), deleteTaskDependencies(), getSortedTask(), getSortedTaskSet(), and registerTaskName().