tfel
Loading...
Searching...
No Matches
mtest::SchemeParserBase Struct Reference
Inheritance diagram for mtest::SchemeParserBase:
tfel::utilities::CxxTokenizer tfel::utilities::CxxTokenizerOptions mtest::SingleStructureSchemeParser mtest::MTestParser mtest::PipeTestParser

Public Types

using tokens_iterator = TokensContainer::const_iterator
 a simple alias

Public Member Functions

 SchemeParserBase ()
 constructor
 ~SchemeParserBase () override
 destructor

Protected Types

using ExternalFunctionManager = tfel::math::parser::ExternalFunctionManager
 a simple alias
Protected Types inherited from tfel::utilities::CxxTokenizer
using TokensContainer = std::vector<Token>
 a simple alias
using const_iterator = TokensContainer::const_iterator
 a simple alias
using size_type = TokensContainer::size_type
 a simple alias

Protected Member Functions

void openFile (const std::string &)
virtual void handleLonelySeparator (SchemeBase &, tokens_iterator &)
 allow an lonely ';'
virtual void handleAuthor (SchemeBase &, tokens_iterator &)
 handle the @Author keyword
virtual void handleDate (SchemeBase &, tokens_iterator &)
 handle the @Date keyword
virtual void handleMessage (SchemeBase &, tokens_iterator &)
 handle the @Import`` keyword \param[in,out] p : position in the input file */ virtual void handleImport(SchemeBase&, tokens_iterator&); /*! \brief handle the @Message` keyword
virtual void handleOutputFrequency (SchemeBase &, tokens_iterator &)
 handle the @OutputFrequency keyword
virtual void handleDescription (SchemeBase &, tokens_iterator &)
 handle the @Description keyword
virtual void handlePredictionPolicy (SchemeBase &, tokens_iterator &)
 handle the @PredictionPolicy keyword
virtual void handleTimes (SchemeBase &, tokens_iterator &)
 handle the @Times keyword
virtual void handleReal (SchemeBase &, tokens_iterator &)
 handle the @Real keyword
virtual void handleStiffnessMatrixType (SchemeBase &, tokens_iterator &)
 handle the @StiffnessMatrixType keyword
virtual void handleStiffnessUpdatePolicy (SchemeBase &, tokens_iterator &)
 handle the @StiffnessUpdatePolicy keyword
virtual void handleUseCastemAccelerationAlgorithm (SchemeBase &, tokens_iterator &)
 handle the @UseCastemAccelerationAlgorithm keyword
virtual void handleCastemAccelerationTrigger (SchemeBase &, tokens_iterator &)
 handle the @CastemAccelerationTrigger keyword
virtual void handleCastemAccelerationPeriod (SchemeBase &, tokens_iterator &)
 handle the @CastemAccelerationAlgorithm keyword
virtual void handleAccelerationAlgorithm (SchemeBase &, tokens_iterator &)
 handle the @AccelerationAlgorithm keyword
virtual void handleAccelerationAlgorithmParameter (SchemeBase &, tokens_iterator &)
 handle the @AccelerationAlgorithmParameter keyword
virtual void handleDynamicTimeStepScaling (SchemeBase &, tokens_iterator &)
 handle the @DynamicTimeStepScaling keyword
virtual void handleMaximalTimeStep (SchemeBase &, tokens_iterator &)
 handle the @MaximalTimeStep keyword
virtual void handleMinimalTimeStep (SchemeBase &, tokens_iterator &)
 handle the @MinimalTimeStep keyword
virtual void handleMaximalTimeStepScalingFactor (SchemeBase &, tokens_iterator &)
 handle the @MaximalTimeStepScalingFactor keyword
virtual void handleMinimalTimeStepScalingFactor (SchemeBase &, tokens_iterator &)
 handle the @MinimalTimeStepScalingFactor keyword
virtual void handleMaximumNumberOfIterations (SchemeBase &, tokens_iterator &)
 handle the @MaximumNumberOfIterations keyword
virtual void handleMaximumNumberOfSubSteps (SchemeBase &, tokens_iterator &)
 handle the @MaximumNumberOfSubSteps keyword
virtual void handleEvolution (SchemeBase &, tokens_iterator &)
 handle the @Evolution keyword
virtual void handleOutputFile (SchemeBase &, tokens_iterator &)
 handle the @OutputFile keyword
virtual void handleXMLOutputFile (SchemeBase &, tokens_iterator &)
 handle the @XMLOutputFile keyword
virtual void handleOutputFilePrecision (SchemeBase &, tokens_iterator &)
 handle the @OutputFilePrecision keyword
virtual void handleResidualFile (SchemeBase &, tokens_iterator &)
 handle the @ResidualFile keyword
virtual void handleResidualFilePrecision (SchemeBase &, tokens_iterator &)
 handle the @ResidualFilePrecision keyword
virtual void registerCallBacks ()
 register call backs
virtual std::string getDocumentationFilePath (const std::string &, const std::string &) const
virtual std::string readUntilEndOfInstruction (tokens_iterator &)
virtual real readDouble (SchemeBase &, tokens_iterator &)
virtual real readTime (SchemeBase &, tokens_iterator &)
virtual std::shared_ptr< Evolution > parseEvolution (SchemeBase &, const std::string &, tokens_iterator &)
 parse an evolution
virtual std::string readEvolutionType (tokens_iterator &)
 try to read the type of an evolution
virtual void readArrayOfSpecifiedSize (std::vector< real > &, SchemeBase &, tokens_iterator &)
virtual std::vector< real > readTimesArray (const std::string &m, SchemeBase &t, tokens_iterator &p)
bool treatKeyword (SchemeBase &, tokens_iterator &)
 treat the current keyword
std::vector< std::string > getKeyWordsList () const
Protected Member Functions inherited from tfel::utilities::CxxTokenizer
virtual void parseStream (std::istream &, Token::size_type &, const std::string &)
 tokenize the lines of a stream
virtual void splitLine (const std::string &, const Token::size_type)
virtual void parseChar (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type)
virtual void parseString (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type, const char)
virtual void parseCComment (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type)
virtual void parseCxxComment (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type)
virtual void try_join (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type, const char)
virtual void try_join (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type, const char, const char)
virtual void parseNumber (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type)
 read a number
virtual void parsePreprocessorDirective (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const std::string::const_iterator, const Token::size_type)
virtual void parseStandardLine (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const std::string::const_iterator, const Token::size_type)
virtual void parseRawString (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type, const Token::size_type)
 read the contents of a raw string literal, which starts at the current iterator, past the opening R"delim( prefix
 CxxTokenizer ()
 default constructor
 CxxTokenizer (const CxxTokenizerOptions &)
 constructor with options
 CxxTokenizer (const std::string &)
 constructor from a file
 CxxTokenizer (const std::string &, const CxxTokenizerOptions &)
 constructor from a file
template<typename InputIterator>
void import (const InputIterator, const InputIterator)
 import the specified tokens
void parseString (const std::string &)
 analyse the string given all previous tokens are erased
void openFile (const std::string &)
 import the specified file
void printFileTokens (std::ostream &) const
 print the stored tokens to the specified stream
void setCStyleCommentOpened (const bool)
 assume that a C-style comment was opened at the beginning of the processing. This is usefull when parsing a file line by line
bool isCStyleCommentOpened () const
void setRawStringOpened (const bool)
 assume that a raw string was opened at the beginning of the processing.
void setRawStringDelimiter (std::string_view)
 set the raw string deliminter. This assume that a raw string was opened at the beginning of the processing, i.e. sets the rawStringOpened boolean to true.
bool isRawStringOpened () const
std::string getCurrentRawStringDelimiter () const noexcept
void stripComments ()
 remove all comment tokens
void clear ()
 clear the object
void treatCharAsString (const bool)
 set if char tokens shall be treated as string tokens
void keepCommentBoundaries (const bool)
 set if the comment boundaries must be left in the resulting tokens.
void treatDotAsSeparator (const bool)
 set if '.' shall be treated as as sperator
void treatPlusAsSeparator (const bool)
 set if '+' shall be treated as as sperator
void treatMinusAsSeparator (const bool)
 set if '-' shall be treated as as sperator
void mergeStrings (const bool)
 set if successive strings shall be merged
void extractNumbers (const bool)
 set if tokens shall be split to extract numbers
void addSeparator (const std::string &)
 add a new separator
void substitute (const std::map< std::string, std::string > &)
 apply the given substitutions by calling replace_all on the values hold by the standard and string tokens.
bool empty () const
const_iterator begin () const
const_iterator end () const
const_iterator cbegin () const
const_iterator cend () const
const Token & operator[] (const size_type) const
size_type size () const
virtual ~CxxTokenizer ()
 destructor
Protected Member Functions inherited from tfel::utilities::CxxTokenizerOptions
 CxxTokenizerOptions ()
 default constructor
 CxxTokenizerOptions (const CxxTokenizerOptions &)
 copy constructor
 CxxTokenizerOptions (CxxTokenizerOptions &&) noexcept
 move constructor
CxxTokenizerOptions & operator= (const CxxTokenizerOptions &)
 standard assignement
CxxTokenizerOptions & operator= (CxxTokenizerOptions &&) noexcept
 move assignement
 ~CxxTokenizerOptions ()
 destructor

Protected Attributes

std::shared_ptr< ExternalFunctionManager > externalFunctions
 external function imported through the @Import keyword
std::string file
 input file
Protected Attributes inherited from tfel::utilities::CxxTokenizer
std::vector< std::string > additional_separators
TokensContainer tokens
 list of tokens read
std::map< Token::size_type, std::string > comments
 store the comments which have been removed by the stripComments method. The key of the map is the line a comment starts on and the value is the values of the comments of this line, in the order they appear in the line, separated by a space character.
bool cStyleCommentOpened = false
 if true, a cStyle comment what opened when the last line treatment was finised
bool rawStringOpened = false
std::string currentRawStringDelimiter
 name of the current delimiter for a raw string
Protected Attributes inherited from tfel::utilities::CxxTokenizerOptions
bool bKeepCommentBoundaries = false
 if true, keep the comment boundaries
bool shallMergeStrings = false
 if true, successive strings are merged
bool allowStrayHashCharacter = false
 allow stray hash character
bool treatHashCharacterAsCommentDelimiter = false
 the hash character can start a comment, as in python, shell, etc..
bool allowStrayBackSlash = false
 allow stray backslash
bool treatPreprocessorDirectives = true
 treat preprocessor directives
bool treatStrings = true
 treat strings and characters If false, the ' and '"' are treated as indivdual tokens
bool treatNumbers = true
 extract number
bool treatCComments = true
 treat comments
bool treatCxxComments = true
 treat comments
bool joinCxxTwoCharactersSeparators = true
bool graveAccentAsSeparator = true
 strings and characters
bool charAsString = false
bool dotAsSeparator = true
 treat . as a separator
bool plusAsSeparator = true
 treat + as a separator
bool minusAsSeparator = true
 treat - as a separator
bool addCurlyBraces = false
 add curly braces at the beginning and at the end of the file

Additional Inherited Members

Static Protected Member Functions inherited from tfel::utilities::CxxTokenizer
static bool isValidFunctionIdentifier (const std::string &, const bool=true)
static bool isValidIdentifier (std::string_view, const IsValidIdentifierOptions &)
static bool isValidIdentifier (std::string_view, const bool=true)
static void checkNotEndOfLine (const std::string &, const_iterator &, const const_iterator)
 an helper method throwing an exception if the given iterator is egal to the third argument (which shall point after the last token of the line)
static void checkNotEndOfLine (const std::string &, const std::string &, const_iterator &, const const_iterator)
 an helper method throwing an exception if the given iterator is egal to the fourth argument (which shall point after the last token of the line)
static void readSpecifiedToken (const std::string &, const std::string &, const_iterator &, const const_iterator)
 an helper method throwing an exception if the given iterator is egal to the fourth argument (which shall point after the last token of the line) or if the given token is not equal to the expected value
static unsigned int readUnsignedInt (const_iterator &, const const_iterator)
 an helper method to extract an unsigned int from the given token
static std::string readString (const_iterator &, const const_iterator)
 an helper method to extract a string from the given token
static std::vector< std::string > readArray (const std::string &, const_iterator &, const const_iterator)
 an helper method to extract a set of values from the given as an array
static void readArray (const std::string &, std::vector< std::string > &, const_iterator &, const const_iterator)
 an helper method to extract a set of values from the given as an array
static std::vector< Token > readList (const std::string &, const std::string &, const std::string &, const_iterator &, const const_iterator)
 extract a list of token
static void readList (std::vector< Token > &, const std::string &, const std::string &, const std::string &, const_iterator &, const const_iterator)
 extract a list of token
static std::vector< std::string > readStringArray (const_iterator &, const const_iterator)
 an helper method to extract a set of values from the given as an array
static double readDouble (const_iterator &, const const_iterator)
 an helper method to extract a double from the given token
static int readInt (const_iterator &, const const_iterator)
 an helper method to extract a int from the given token

Member Function Documentation

◆ getDocumentationFilePath()

virtual std::string mtest::SchemeParserBase::getDocumentationFilePath ( const std::string & ,
const std::string &  ) const
nodiscardprotectedvirtual
Returns
the file path associated with the keyword documentation
Parameters
[in]sscheme
[in]kkeyword

◆ getKeyWordsList()

std::vector< std::string > mtest::SchemeParserBase::getKeyWordsList ( ) const
nodiscardprotected
Returns
the list of keywords

◆ handleAccelerationAlgorithm()

virtual void mtest::SchemeParserBase::handleAccelerationAlgorithm ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @AccelerationAlgorithm keyword

Parameters
[in,out]p: position in the input file

◆ handleAccelerationAlgorithmParameter()

virtual void mtest::SchemeParserBase::handleAccelerationAlgorithmParameter ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @AccelerationAlgorithmParameter keyword

Parameters
[in,out]p: position in the input file

◆ handleAuthor()

virtual void mtest::SchemeParserBase::handleAuthor ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @Author keyword

Parameters
[in,out]p: position in the input file

◆ handleCastemAccelerationPeriod()

virtual void mtest::SchemeParserBase::handleCastemAccelerationPeriod ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @CastemAccelerationAlgorithm keyword

Parameters
[in,out]p: position in the input file

◆ handleCastemAccelerationTrigger()

virtual void mtest::SchemeParserBase::handleCastemAccelerationTrigger ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @CastemAccelerationTrigger keyword

Parameters
[in,out]p: position in the input file

◆ handleDate()

virtual void mtest::SchemeParserBase::handleDate ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @Date keyword

Parameters
[in,out]p: position in the input file

◆ handleDescription()

virtual void mtest::SchemeParserBase::handleDescription ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @Description keyword

Parameters
[in,out]p: position in the input file

◆ handleDynamicTimeStepScaling()

virtual void mtest::SchemeParserBase::handleDynamicTimeStepScaling ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @DynamicTimeStepScaling keyword

Parameters
[in,out]p: position in the input file

◆ handleEvolution()

virtual void mtest::SchemeParserBase::handleEvolution ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @Evolution keyword

Parameters
[in,out]p: position in the input file

◆ handleLonelySeparator()

virtual void mtest::SchemeParserBase::handleLonelySeparator ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

allow an lonely ';'

Parameters
[in,out]p: position in the input file

◆ handleMaximalTimeStep()

virtual void mtest::SchemeParserBase::handleMaximalTimeStep ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @MaximalTimeStep keyword

Parameters
[in,out]p: position in the input file

◆ handleMaximalTimeStepScalingFactor()

virtual void mtest::SchemeParserBase::handleMaximalTimeStepScalingFactor ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @MaximalTimeStepScalingFactor keyword

Parameters
[in,out]p: position in the input file

◆ handleMaximumNumberOfIterations()

virtual void mtest::SchemeParserBase::handleMaximumNumberOfIterations ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @MaximumNumberOfIterations keyword

Parameters
[in,out]p: position in the input file

◆ handleMaximumNumberOfSubSteps()

virtual void mtest::SchemeParserBase::handleMaximumNumberOfSubSteps ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @MaximumNumberOfSubSteps keyword

Parameters
[in,out]p: position in the input file

◆ handleMessage()

virtual void mtest::SchemeParserBase::handleMessage ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @Import`` keyword \param[in,out] p : position in the input file */ virtual void handleImport(SchemeBase&, tokens_iterator&); /*! \brief handle the @Message` keyword

Parameters
[in,out]p: position in the input file

◆ handleMinimalTimeStep()

virtual void mtest::SchemeParserBase::handleMinimalTimeStep ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @MinimalTimeStep keyword

Parameters
[in,out]p: position in the input file

◆ handleMinimalTimeStepScalingFactor()

virtual void mtest::SchemeParserBase::handleMinimalTimeStepScalingFactor ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @MinimalTimeStepScalingFactor keyword

Parameters
[in,out]p: position in the input file

◆ handleOutputFile()

virtual void mtest::SchemeParserBase::handleOutputFile ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @OutputFile keyword

Parameters
[in,out]p: position in the input file

◆ handleOutputFilePrecision()

virtual void mtest::SchemeParserBase::handleOutputFilePrecision ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @OutputFilePrecision keyword

Parameters
[in,out]p: position in the input file

◆ handleOutputFrequency()

virtual void mtest::SchemeParserBase::handleOutputFrequency ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @OutputFrequency keyword

Parameters
[in,out]p: position in the input file

◆ handlePredictionPolicy()

virtual void mtest::SchemeParserBase::handlePredictionPolicy ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @PredictionPolicy keyword

Parameters
[in,out]p: position in the input file

◆ handleReal()

virtual void mtest::SchemeParserBase::handleReal ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @Real keyword

Parameters
[in,out]p: position in the input file

◆ handleResidualFile()

virtual void mtest::SchemeParserBase::handleResidualFile ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @ResidualFile keyword

Parameters
[in,out]p: position in the input file

◆ handleResidualFilePrecision()

virtual void mtest::SchemeParserBase::handleResidualFilePrecision ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @ResidualFilePrecision keyword

Parameters
[in,out]p: position in the input file

◆ handleStiffnessMatrixType()

virtual void mtest::SchemeParserBase::handleStiffnessMatrixType ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @StiffnessMatrixType keyword

Parameters
[in,out]p: position in the input file

◆ handleStiffnessUpdatePolicy()

virtual void mtest::SchemeParserBase::handleStiffnessUpdatePolicy ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @StiffnessUpdatePolicy keyword

Parameters
[in,out]p: position in the input file

◆ handleTimes()

virtual void mtest::SchemeParserBase::handleTimes ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @Times keyword

Parameters
[in,out]p: position in the input file

◆ handleUseCastemAccelerationAlgorithm()

virtual void mtest::SchemeParserBase::handleUseCastemAccelerationAlgorithm ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @UseCastemAccelerationAlgorithm keyword

Parameters
[in,out]p: position in the input file

◆ handleXMLOutputFile()

virtual void mtest::SchemeParserBase::handleXMLOutputFile ( SchemeBase & ,
tokens_iterator &  )
protectedvirtual

handle the @XMLOutputFile keyword

Parameters
[in,out]p: position in the input file

◆ parseEvolution()

virtual std::shared_ptr< Evolution > mtest::SchemeParserBase::parseEvolution ( SchemeBase & ,
const std::string & ,
tokens_iterator &  )
nodiscardprotectedvirtual

parse an evolution

Parameters
[in,out]t: structure to be filled
[in]type: evolution type
[in,out]p: position in the input file

◆ readArrayOfSpecifiedSize()

virtual void mtest::SchemeParserBase::readArrayOfSpecifiedSize ( std::vector< real > & ,
SchemeBase & ,
tokens_iterator &  )
protectedvirtual

read an array The expected size of the array is given by the output vector

Parameters
[out]v: array to be read
[in,out]t: structure to be filled
[in,out]p: position in the input file

◆ readDouble()

virtual real mtest::SchemeParserBase::readDouble ( SchemeBase & ,
tokens_iterator &  )
nodiscardprotectedvirtual
Returns
a real value
Parameters
[in]t: structure to be filled
[in,out]p: position in the input file

◆ readEvolutionType()

virtual std::string mtest::SchemeParserBase::readEvolutionType ( tokens_iterator & )
nodiscardprotectedvirtual

try to read the type of an evolution

Parameters
[in,out]p: position in the input file

◆ readTime()

virtual real mtest::SchemeParserBase::readTime ( SchemeBase & ,
tokens_iterator &  )
nodiscardprotectedvirtual

read a time

Parameters
[in,out]t: structure to be filled
[in,out]p: position in the input file

◆ readTimesArray()

virtual std::vector< real > mtest::SchemeParserBase::readTimesArray ( const std::string & m,
SchemeBase & t,
tokens_iterator & p )
nodiscardprotectedvirtual

read an array The expected size of the array is given by the output vector

Parameters
[out]v: array to be read
[in,out]t: structure to be filled
[in,out]p: position in the input file

◆ readUntilEndOfInstruction()

virtual std::string mtest::SchemeParserBase::readUntilEndOfInstruction ( tokens_iterator & )
nodiscardprotectedvirtual
Returns
everything from the given starting point up to the next semi-colon.
Parameters
[in,out]p: position in the input file

◆ registerCallBacks()

virtual void mtest::SchemeParserBase::registerCallBacks ( )
protectedvirtual

◆ treatKeyword()

bool mtest::SchemeParserBase::treatKeyword ( SchemeBase & ,
tokens_iterator &  )
nodiscardprotected

treat the current keyword

Parameters
[in,out]p: position in the input file

The documentation for this struct was generated from the following file: