Class for parsing input files. More...
#include <Parser.h>
Public Member Functions | |
Parser (const std::vector< std::string > &input_filenames) | |
Constructor given a list of input files, given in input_filenames . More... | |
Parser (const std::string &input_filename, const std::optional< std::string > &input_text={}) | |
Constructor for a single input file, given in input_filename . More... | |
void | parse () |
Parses the inputs. More... | |
void | extractParams (const std::string &prefix, InputParameters &p) |
This function attempts to extract values from the input file based on the contents of the passed parameters objects. More... | |
hit::Node * | root () |
const std::vector< std::string > & | getInputFileNames () const |
const std::string & | getAppType () const |
void | setAppType (const std::string &app_type) |
const std::string & | getLastInputFileName () const |
std::filesystem::path | getLastInputFilePath () const |
Private Attributes | |
std::unique_ptr< hit::Node > | _root |
The root node, which owns the whole tree. More... | |
const std::vector< std::string > | _input_filenames |
The input file names. More... | |
const std::optional< std::string > | _input_text |
The optional input text (to augment reading a single input with the MooseServer) More... | |
std::string | _app_type |
The application types extracted from [Application] block. More... | |
Class for parsing input files.
This class utilizes the GetPot library for actually tokenizing and parsing files. It is not currently designed for extensibility. If you wish to build your own parser, please contact the MOOSE team for guidance.
Parser::Parser | ( | const std::vector< std::string > & | input_filenames | ) |
Constructor given a list of input files, given in input_filenames
.
Definition at line 154 of file Parser.C.
Parser::Parser | ( | const std::string & | input_filename, |
const std::optional< std::string > & | input_text = {} |
||
) |
Constructor for a single input file, given in input_filename
.
Optionally, input_text
can be provided if you wish to parse contents from this text instead of reading input_filename
. This is currently used within the language server for parsing contents of a file that have not necessary been saved to disk yet.
Definition at line 159 of file Parser.C.
void Parser::extractParams | ( | const std::string & | prefix, |
InputParameters & | p | ||
) |
This function attempts to extract values from the input file based on the contents of the passed parameters objects.
It handles a number of various types with dynamic casting including vector types
|
inline |
Definition at line 156 of file Parser.h.
|
inline |
Definition at line 151 of file Parser.h.
Referenced by parse().
const std::string & Parser::getLastInputFileName | ( | ) | const |
Definition at line 281 of file Parser.C.
Referenced by getLastInputFilePath().
|
inline |
Definition at line 171 of file Parser.h.
void Parser::parse | ( | ) |
Parses the inputs.
Definition at line 289 of file Parser.C.
|
inline |
If this is null, it means that we haven't parsed yet
Definition at line 146 of file Parser.h.
Referenced by parse().
|
inline |
Definition at line 161 of file Parser.h.
|
private |
The application types extracted from [Application] block.
Definition at line 184 of file Parser.h.
Referenced by getAppType(), parse(), and setAppType().
|
private |
The input file names.
Definition at line 178 of file Parser.h.
Referenced by getInputFileNames(), and getLastInputFileName().
|
private |
The optional input text (to augment reading a single input with the MooseServer)
Definition at line 181 of file Parser.h.
Referenced by parse().
|
private |