WSF
WsfParser Class Reference

#include <WsfParser.hpp>

Public Member Functions

 WsfParser (WsfParseSourceProvider *aSourceProviderPtr, const UtPath &aWorkingDirectory, WsfParseDefinitions *aDefinitionsPtr=nullptr)
 WsfParser (const WsfParser &aRhs)
WsfParseroperator= (const WsfParser &)=delete
 ~WsfParser ()
WsfParseNodeParseFiles (const std::vector< UtPath > &aFileList, int aMaxErrors)
void PushDeferredSource (const UtPath &aFilePath)
UtTextDocument * PushSource (const std::string &aFilePath, bool aForceInclude, UtTextDocumentRange *aIncludeLocation=nullptr, bool aSearchIncludePaths=true)
UtTextDocument * FindSource (const std::string &aFilePath, bool aSearchIncludePaths=true, bool aReadFile=true)
size_t GetWordsRead () const
 Returns the number of words that have been read since the last call to Reset().
UtTextDocumentRange ReadWord ()
UtTextDocumentRange ReadTerminator (const std::string &aTerminator)
void UndoRead (size_t aWordCount=1)
UtTextDocumentRange UndoReadAndGetRange (size_t aWordCount)
void PushToUndoStack (const UtTextDocumentRange &aRange)
 Store a parsed word for later retrieval after UndoRead().
void PartialMatch (UtTextDocumentRange aRange)
void AddError (WsfParseError *aErrorPtr)
void AddError (WsfParseRule *aReader, UtTextDocumentRange &aRange)
void ClearPartialMatches ()
WsfParseSourceIncludeGetCurrentInclude ()
WsfParseSourceIncludeGetInclude (UtTextDocument *aParseSourcePtr)
WsfParseIndex *& GetParseIndex ()
WsfParseDefinitionsGetDefinitions ()
void SetDefinitions (WsfParseDefinitions *aDefinitionsPtr)
void SwapDefinitions (WsfParseDefinitions *&aDefinitionsPtr)
void PopSource ()
void ProcessSpecialNode (WsfParseNode *aNodePtr)
void Reset ()
 Reset the parser back to its original state.
void PushTerminator (const char *aTerminatorString)
void PopTerminator ()
void SetWorkingDirectory (const UtPath &aWorkingDirectory)
const UtPath & GetWorkingDirectory () const
const std::vector< WsfParseError * > & GetErrors () const
WsfParseSourceProviderGetSourceProvider ()
WsfParseNodeGetCurrentSequence ()
void PushSequence (WsfParseNode *aNodePtr)
void PopSequence ()
void DelayLoad (const std::string &aKind, const std::string &aName, WsfParseNode *aNodePtr, ptrdiff_t aTextOffset, WsfParseRule *aSequencePtr)
bool Requires (const std::string &aKind, const std::string &aName)
void ResolveDelayLoad ()
bool IsDelayLoading ()
void DeleteAllNodes ()
 Node pool functions.
void SwapPool (WsfParser &aRhs)
void SwapPool (WsfParseNodePool &aPool)
WsfParseNodeNewNode (WsfParseRule *aRule, const char *aType, UtTextDocumentRange aValue=UtTextDocumentRange())
WsfParseNodeNewNode ()
void FreeNode (WsfParseNode *aNodePtr)
void AddAuxiliaryValue (WsfParseAuxData *aDataPtr)
void FinalizeParseTree (WsfParseNode *aRootNodePtr, std::vector< WsfParseNode * > &aFileTransitionNodes)
 Numbers parse nodes and creates the list of file transition nodes.
bool FullyExpandNodes () const
void SetFullyExpandNodes (bool aValue)
void SetIgnoreIncludes (bool aIngoreIncludes)

Detailed Description

WsfParser acts as a lexer for wsf core files. Tokens are produced delimited by whitespace. Limited backtracking is allowed using UndoRead().

Constructor & Destructor Documentation

◆ WsfParser() [1/2]

WsfParser::WsfParser ( WsfParseSourceProvider * aSourceProviderPtr,
const UtPath & aWorkingDirectory,
WsfParseDefinitions * aDefinitionsPtr = nullptr )

◆ WsfParser() [2/2]

WsfParser::WsfParser ( const WsfParser & aRhs)

References WsfParser().

◆ ~WsfParser()

WsfParser::~WsfParser ( )

Member Function Documentation

◆ AddAuxiliaryValue()

void WsfParser::AddAuxiliaryValue ( WsfParseAuxData * aDataPtr)
inline

◆ AddError() [1/2]

void WsfParser::AddError ( WsfParseError * aErrorPtr)
inline

◆ AddError() [2/2]

void WsfParser::AddError ( WsfParseRule * aReader,
UtTextDocumentRange & aRange )

◆ ClearPartialMatches()

void WsfParser::ClearPartialMatches ( )
inline

Referenced by WsfParseAlternate::Read().

◆ DelayLoad()

void WsfParser::DelayLoad ( const std::string & aKind,
const std::string & aName,
WsfParseNode * aNodePtr,
ptrdiff_t aTextOffset,
WsfParseRule * aSequencePtr )

◆ DeleteAllNodes()

void WsfParser::DeleteAllNodes ( )
inline

Node pool functions.

Referenced by Reset().

◆ FinalizeParseTree()

void WsfParser::FinalizeParseTree ( WsfParseNode * aRootNodePtr,
std::vector< WsfParseNode * > & aFileTransitionNodes )

Numbers parse nodes and creates the list of file transition nodes.

References WsfParseNode::mValue, WsfParseNode::Next(), and WsfParseNode::SetLexicalIndex().

◆ FindSource()

UtTextDocument * WsfParser::FindSource ( const std::string & aFilePath,
bool aSearchIncludePaths = true,
bool aReadFile = true )

◆ FreeNode()

void WsfParser::FreeNode ( WsfParseNode * aNodePtr)
inline

◆ FullyExpandNodes()

bool WsfParser::FullyExpandNodes ( ) const
inline

◆ GetCurrentInclude()

WsfParseSourceInclude * WsfParser::GetCurrentInclude ( )
inline

Referenced by ParseFiles().

◆ GetCurrentSequence()

WsfParseNode * WsfParser::GetCurrentSequence ( )
inline

◆ GetDefinitions()

◆ GetErrors()

const std::vector< WsfParseError * > & WsfParser::GetErrors ( ) const
inline

Referenced by ParseFiles().

◆ GetInclude()

WsfParseSourceInclude * WsfParser::GetInclude ( UtTextDocument * aParseSourcePtr)

◆ GetParseIndex()

◆ GetSourceProvider()

WsfParseSourceProvider * WsfParser::GetSourceProvider ( )
inline

◆ GetWordsRead()

size_t WsfParser::GetWordsRead ( ) const
inline

Returns the number of words that have been read since the last call to Reset().

Referenced by WsfParseSequence::Read().

◆ GetWorkingDirectory()

const UtPath & WsfParser::GetWorkingDirectory ( ) const
inline

◆ IsDelayLoading()

bool WsfParser::IsDelayLoading ( )
inline

◆ NewNode() [1/2]

WsfParseNode * WsfParser::NewNode ( )
inline

◆ NewNode() [2/2]

◆ operator=()

WsfParser & WsfParser::operator= ( const WsfParser & )
delete

◆ ParseFiles()

◆ PartialMatch()

void WsfParser::PartialMatch ( UtTextDocumentRange aRange)
inline

Referenced by WsfParseSequence::Read().

◆ PopSequence()

void WsfParser::PopSequence ( )
inline

Referenced by WsfParseSequence::Read().

◆ PopSource()

void WsfParser::PopSource ( )

◆ PopTerminator()

void WsfParser::PopTerminator ( )
inline

◆ ProcessSpecialNode()

void WsfParser::ProcessSpecialNode ( WsfParseNode * aNodePtr)

◆ PushDeferredSource()

void WsfParser::PushDeferredSource ( const UtPath & aFilePath)

Referenced by operator=(), and ParseFiles().

◆ PushSequence()

void WsfParser::PushSequence ( WsfParseNode * aNodePtr)
inline

Referenced by WsfParseSequence::Read().

◆ PushSource()

UtTextDocument * WsfParser::PushSource ( const std::string & aFilePath,
bool aForceInclude,
UtTextDocumentRange * aIncludeLocation = nullptr,
bool aSearchIncludePaths = true )

Add a source text to be parsed next. This has the same effect of an 'include'.

Parameters
aFilePathThe path to the file, may be relative to any path variables
aForceInclude'false' if the file should only be added once (like 'include_once')
aIncludeLocationLocation input is being included from
aSearchIncludePaths'true' if include paths should be searched for source

References FindSource().

Referenced by operator=(), ParseFiles(), and ReadWord().

◆ PushTerminator()

void WsfParser::PushTerminator ( const char * aTerminatorString)
inline

◆ PushToUndoStack()

void WsfParser::PushToUndoStack ( const UtTextDocumentRange & aRange)

Store a parsed word for later retrieval after UndoRead().

◆ ReadTerminator()

UtTextDocumentRange WsfParser::ReadTerminator ( const std::string & aTerminator)

Reads the next white-space-delimited terminal token from the input

Returns
the white-space-delimited terminal token read from the input if the read succeeded
Return values
an empty or invalid rangeif the read failed
Note
This function is a specialized form of ReadWord for terminal tokens

References ReadWord().

Referenced by WsfParseLiteral::Read().

◆ ReadWord()

UtTextDocumentRange WsfParser::ReadWord ( )

Reads the next white-space-delimited token from the input

Returns
the white-space-delimited token read from the input if the read succeeded
Return values
an empty or invalid rangeif the read failed

References PushSource(), and WsfParseUtil::TrimIter().

Referenced by WsfParseSequence::CompleteDelayLoad(), ParseFiles(), WsfParseAlternate::Read(), WsfParseDelimited::Read(), WsfParseIntRule::Read(), WsfParseLineStringRule::Read(), WsfParseLiteral::Read(), WsfParseQuotedStringRule::Read(), WsfParseRealRule::Read(), WsfParseRecurrence::Read(), WsfParseScriptRule::Read(), WsfParseStringRule::Read(), and ReadTerminator().

◆ Requires()

◆ Reset()

void WsfParser::Reset ( )

Reset the parser back to its original state.

References DeleteAllNodes().

Referenced by ParseFiles().

◆ ResolveDelayLoad()

void WsfParser::ResolveDelayLoad ( )

References Requires().

Referenced by ParseFiles().

◆ SetDefinitions()

void WsfParser::SetDefinitions ( WsfParseDefinitions * aDefinitionsPtr)

◆ SetFullyExpandNodes()

void WsfParser::SetFullyExpandNodes ( bool aValue)
inline

◆ SetIgnoreIncludes()

void WsfParser::SetIgnoreIncludes ( bool aIngoreIncludes)
inline

◆ SetWorkingDirectory()

void WsfParser::SetWorkingDirectory ( const UtPath & aWorkingDirectory)
inline

◆ SwapDefinitions()

void WsfParser::SwapDefinitions ( WsfParseDefinitions *& aDefinitionsPtr)

References std::swap().

◆ SwapPool() [1/2]

void WsfParser::SwapPool ( WsfParseNodePool & aPool)
inline

◆ SwapPool() [2/2]

void WsfParser::SwapPool ( WsfParser & aRhs)
inline

References WsfParser().

◆ UndoRead()

◆ UndoReadAndGetRange()

UtTextDocumentRange WsfParser::UndoReadAndGetRange ( size_t aWordCount)

References UndoRead().

Referenced by WsfParseSequence::Read().


The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved