WSF
wizard::ParseResults Class Reference

Provides access to the results of parsing the WSF inputs. More...

#include <ParseResults.hpp>

Inheritance diagram for wizard::ParseResults:
Collaboration diagram for wizard::ParseResults:

Classes

struct  FileNotification
struct  TypeInformation

Public Types

enum  FileNotificationType {
  cERROR_BIT = 1 << 29 , cWARNING_BIT = 1 << 28 , cINFORMATION_BIT = 1 << 27 , cKIND_MASK = 0xffff ,
  cTYPE_KIND = 1 , cINCLUDE_KIND = 2 , cREFERENCE_KIND = 3 , cSYNTAX_ERROR_KIND = 4
}
using FileNotificationList = std::vector<FileNotification>

Public Member Functions

 ParseResults (Project *aProjectPtr)
 ~ParseResults () override
void Clear ()
void AssignResults (Project *aProjectPtr, WsfParser *aParserPtr, const WsfParseSourceInclude *aRootInclude, WsfParseNode *aParseTreePtr, WsfParseNode *aLastNodePtr, std::map< UtTextDocument *, WsfParseSourceInclude * > &aFirstIncludes)
WsfParseSourceIncludeFindSourceData (UtTextDocument *aSourcePtr)
bool GetRangeNodes (const UtTextDocumentRange &aRange, std::vector< WsfParseNode * > &aNodes)
bool FindIncludeAtPoint (UtTextDocument *aSourcePtr, const UtTextRange &aLocation, WsfParseSourceInclude *&aSourceIncludePtr, int &aEntryIndex, TextSource *&aIncludeSourcePtr)
WsfParseNodeFindLastParseNode (const UtTextDocumentRange &aPosition)
WsfParseNodeFindBlock (WsfParseNode *aNodePtr)
void FindSubcommands (WsfParseNode *aNodePtr, std::vector< std::string > &aCommands)
void FindDefinitions (const std::string &aName, const std::string &aDefinitionKind, std::vector< WsfParseNode * > &aNodes)
void FindReferences (const std::string &aName, const std::string &aDefinitionKind, std::vector< WsfParseNode * > &aNodes)
void FindDefinitionsOfType (const WsfParseTypePath &aPath, std::vector< WsfParseNode * > &aNodes, bool aAllowNested=false)
void FindDefinitionsOfType (const std::string &aDefinitionType, std::vector< WsfParseNode * > &aNodes, bool aAllowNested=false)
void FindNamedNodes (const std::string &aCategory, const std::string &aName, std::vector< WsfParseNode * > &aNodes)
void GetBaseTypes (const WsfParseTypePath &aKind, std::vector< std::string > &aBaseTypeNames, bool aIncludeUserTypes=true)
void FindNames (const std::string &aNameType, std::vector< std::string > &aNameList)
void FindIncludes (TextSource *aSourcePtr, std::vector< UtTextDocumentRange > &aIncludes)
void FindReferencedFiles (std::vector< WsfParseNode * > &aFileReferenceNodes)
WsfPProxyPath FindProxyPathFromLocation (const UtTextDocumentRange &aLocation, int &aEntryTypeRef)
WsfParseTypeFindCurrentType (WsfParseNode *aNodePtr)
 Return the type lookup for the type located at aNodePtr.
WsfParseIndexGetParseIndex ()
FileNotificationListGetFileNotifications (TextSource *aSourcePtr)
FileNotification GetNotification (const UtTextDocumentLocation &aLocation)
bool FindTypeInfo (TypeInformation &aInformation)
 Fills aInformation given the type key. Returns 'true' if the type information was found successfully.
bool FindUserTypeDocumentation (TypeInformation &aType, std::string &aDocumentation)
bool TypeInformationFromPosition (const UtTextDocumentLocation &aLocation, TypeInformation &aInformation)
bool TypeInformationFromNode (WsfParseNode *aNodePtr, TypeInformation &aInformation)
bool FindBaseType (const TypeInformation &aType, TypeInformation &aBaseType)
 Searches for the type information of aType's base type.
WsfParseNodeFindCreateTypeNode (const TypeInformation &aType)
 Searches for the parse node that created the specified type.
WsfParseNodeFindTypeDefinitionNode (const TypeInformation &aType)
 Searches for the parse node which defined aType.
std::vector< WsfParseNode * > FindTypeReferenceNodes (const TypeInformation &aType)
bool TypeKeyMatches (const WsfParseTypePath &aQuery, const WsfParseTypePath &aTest)
WsfParserparser () const
const std::vector< WsfParseError * > & errors () const
WsfParseNodeparseTree () const
WsfParseNodelastNode () const
const WsfParseSourceIncluderootInclude () const
Public Member Functions inherited from wizard::ParseResultsTiny
 ParseResultsTiny (Project *aProjectPtr)
 ~ParseResultsTiny () override
void FreeScriptTypes ()
void TakeResults (ParseResults &aResults)
 Copies a minimal subset of results from aResults.
bool IncludesFile (TextSource *aSourcePtr) const
bool FindBestRelativePath (UtPath aFullPath, std::string &aRelativeIncludePath)
Public Member Functions inherited from wizard::ParseResultsProxyData
 ParseResultsProxyData ()
 ParseResultsProxyData (const ParseResultsProxyData &)=delete
 ParseResultsProxyData (ParseResultsProxyData &&)=default
ParseResultsProxyDataoperator= (const ParseResultsProxyData &)=delete
ParseResultsProxyDataoperator= (ParseResultsProxyData &&)=default
virtual ~ParseResultsProxyData ()=default
void SwapProxy (ParseResultsProxyData &aOtherParseResults, bool aSwapProxyPointer)
void GiveProxy (std::unique_ptr< WsfPProxy > aProxy, std::unique_ptr< ProxyHash > aProxyHashPtr)
void FindProxySourcePaths (const WsfPProxyPath &aPath, std::vector< WsfPProxyPath > &aSources)
UtTextDocumentRange FindDefinitionLocation (const WsfPProxyPath &aPath)
void FindModificationLocations (const WsfPProxyPath &aPath, std::vector< UtTextDocumentRange > &aLocations)
void FindDefinitionStartLocations (const WsfPProxyPath &aPath, std::vector< UtTextDocumentRange > &aLocations)
void FindModificationLocationsExtended (const WsfPProxyPath &aPath, std::vector< UtTextDocumentRange > &aLocations)
void FindDefinitionStartLocationsExtended (const WsfPProxyPath &aPath, std::vector< UtTextDocumentRange > &aLocations)
void FindDerivedTypes (const WsfPProxyPath &aTypePath, std::vector< WsfPProxyPath > &aDerivedTypePaths)
WsfPProxyProxy () const
WsfPProxyNode ProxyRootNode () const
WsfPProxyStructValue ProxyRoot () const
const std::shared_ptr< WsfPProxyRegistry > & ProxyRegistry ()
ProxyHashGetProxyHash ()
WsfPProxyIndexProxyIndex ()
WsfPProxyPathMapProxyPathMap ()
bool isProxyDataOld () const

Static Public Member Functions

static WsfPProxyNode FindProxyReference (WsfPProxyNode aContext, WsfParseTypePath aPath)

Public Attributes

std::vector< WsfParseNode * > mFileTransitionNodes
Public Attributes inherited from wizard::ParseResultsTiny
long long mSequenceNumber
ProjectmProjectPtr
ParseIncludes mFirstIncludes
ParseIncludePaths mIncludePaths
WsfScriptDatamScriptDataPtr
WsfScriptTypesmScriptTypesPtr

Protected Types

typedef std::map< UtTextDocument *, FileNotificationListFileNotificationMap

Protected Member Functions

void IndexNames ()
void FindSubcommandsP (WsfParseRule *aReaderPtr, std::vector< std::string > &aCommands)

Protected Attributes

WsfParsermParserPtr
std::vector< WsfParseError * > mErrors
WsfParseNodemParseTreePtr
WsfParseNodemLastNodePtr
const WsfParseSourceIncludemRootInclude
std::vector< UtStringRef > mPlatformPartKinds
FileNotificationMap mFileNotifications
std::set< WsfParseTypePathmTypeNames
bool mTypeNamesIndexed
Protected Attributes inherited from wizard::ParseResultsProxyData
std::unique_ptr< ProxyHashmProxyHashPtr
std::unique_ptr< WsfPProxymProxy

Friends

class ParseWorker

Detailed Description

Provides access to the results of parsing the WSF inputs.

Member Typedef Documentation

◆ FileNotificationList

◆ FileNotificationMap

typedef std::map<UtTextDocument*, FileNotificationList> wizard::ParseResults::FileNotificationMap
protected

Member Enumeration Documentation

◆ FileNotificationType

Enumerator
cERROR_BIT 
cWARNING_BIT 
cINFORMATION_BIT 
cKIND_MASK 
cTYPE_KIND 
cINCLUDE_KIND 
cREFERENCE_KIND 
cSYNTAX_ERROR_KIND 

Constructor & Destructor Documentation

◆ ParseResults()

wizard::ParseResults::ParseResults ( Project * aProjectPtr)
explicit

◆ ~ParseResults()

wizard::ParseResults::~ParseResults ( )
override

References Clear().

Member Function Documentation

◆ AssignResults()

void wizard::ParseResults::AssignResults ( Project * aProjectPtr,
WsfParser * aParserPtr,
const WsfParseSourceInclude * aRootInclude,
WsfParseNode * aParseTreePtr,
WsfParseNode * aLastNodePtr,
std::map< UtTextDocument *, WsfParseSourceInclude * > & aFirstIncludes )

◆ Clear()

◆ errors()

const std::vector< WsfParseError * > & wizard::ParseResults::errors ( ) const
inline

References mErrors.

Referenced by AssignResults().

◆ FindBaseType()

◆ FindBlock()

WsfParseNode * wizard::ParseResults::FindBlock ( WsfParseNode * aNodePtr)

◆ FindCreateTypeNode()

◆ FindCurrentType()

◆ FindDefinitions()

void wizard::ParseResults::FindDefinitions ( const std::string & aName,
const std::string & aDefinitionKind,
std::vector< WsfParseNode * > & aNodes )

◆ FindDefinitionsOfType() [1/2]

void wizard::ParseResults::FindDefinitionsOfType ( const std::string & aDefinitionType,
std::vector< WsfParseNode * > & aNodes,
bool aAllowNested = false )

◆ FindDefinitionsOfType() [2/2]

void wizard::ParseResults::FindDefinitionsOfType ( const WsfParseTypePath & aPath,
std::vector< WsfParseNode * > & aNodes,
bool aAllowNested = false )

◆ FindIncludeAtPoint()

bool wizard::ParseResults::FindIncludeAtPoint ( UtTextDocument * aSourcePtr,
const UtTextRange & aLocation,
WsfParseSourceInclude *& aSourceIncludePtr,
int & aEntryIndex,
TextSource *& aIncludeSourcePtr )

◆ FindIncludes()

◆ FindLastParseNode()

WsfParseNode * wizard::ParseResults::FindLastParseNode ( const UtTextDocumentRange & aPosition)

Finds the last WsfParseNode intersecting the specified range. WIZARD_TODO: Need way to efficiently find nodes. Includes allow nodes to be segmented preventing an efficient approach. Possible solution is to store ranges of nodes valid for a given source file in the UtTextDocumentData class – allowing binary search.

References GetRangeNodes().

Referenced by wizard::DocumentationInterpretter::FindDocumentation(), FindProxyPathFromLocation(), wizard::InputContext::GetContext(), wizard::EditAssist::MakeAssistant(), ParseWorker, and TypeInformationFromPosition().

◆ FindNamedNodes()

void wizard::ParseResults::FindNamedNodes ( const std::string & aCategory,
const std::string & aName,
std::vector< WsfParseNode * > & aNodes )

◆ FindNames()

void wizard::ParseResults::FindNames ( const std::string & aNameType,
std::vector< std::string > & aNameList )

Finds the names of all definitions of a given type.

Parameters
aNameTypeThe definition type to find the names of.
aNameListAn out-parameter containing the names of the discovered names. Found names are added to this parameter.

References WsfParseNode::cNAMED_NODE, WsfParseNode::mFlags, mParseTreePtr, WsfParseNode::mType, WsfParseNode::mValue, and WsfParseNode::Next().

Referenced by FindSubcommands().

◆ FindProxyPathFromLocation()

◆ FindProxyReference()

◆ FindReferencedFiles()

void wizard::ParseResults::FindReferencedFiles ( std::vector< WsfParseNode * > & aFileReferenceNodes)

◆ FindReferences()

void wizard::ParseResults::FindReferences ( const std::string & aName,
const std::string & aDefinitionKind,
std::vector< WsfParseNode * > & aNodes )

◆ FindSourceData()

WsfParseSourceInclude * wizard::ParseResults::FindSourceData ( UtTextDocument * aSourcePtr)

◆ FindSubcommands()

void wizard::ParseResults::FindSubcommands ( WsfParseNode * aNodePtr,
std::vector< std::string > & aCommands )

◆ FindSubcommandsP()

void wizard::ParseResults::FindSubcommandsP ( WsfParseRule * aReaderPtr,
std::vector< std::string > & aCommands )
protected

◆ FindTypeDefinitionNode()

◆ FindTypeInfo()

◆ FindTypeReferenceNodes()

◆ FindUserTypeDocumentation()

bool wizard::ParseResults::FindUserTypeDocumentation ( TypeInformation & aType,
std::string & aDocumentation )

Fills aDocumentation with the string containing the user's documentation in comments above the given type. Returns 'true' if the documentation is found.

References FindTypeDefinitionNode(), and WsfParseNode::mValue.

Referenced by wizard::EditAssist_Type::SetTypeData().

◆ GetBaseTypes()

void wizard::ParseResults::GetBaseTypes ( const WsfParseTypePath & aKind,
std::vector< std::string > & aBaseTypeNames,
bool aIncludeUserTypes = true )

◆ GetFileNotifications()

◆ GetNotification()

wizard::ParseResults::FileNotification wizard::ParseResults::GetNotification ( const UtTextDocumentLocation & aLocation)

◆ GetParseIndex()

WsfParseIndex * wizard::ParseResults::GetParseIndex ( )

◆ GetRangeNodes()

bool wizard::ParseResults::GetRangeNodes ( const UtTextDocumentRange & aRange,
std::vector< WsfParseNode * > & aNodes )

Returns the ranges of nodes containing the values in the given range.

Parameters
aRangeThe range of text to find nodes in.
aNodesA vector containing a pair of nodes for each range marking the begin and end.
Note
Run time is O([Tokens In File] - [Tokens in range] + [Files in scenario]) When requesting the entire file range, O([Files in scenario])

References WsfParseNode::Down(), WsfParseNode::GetParent(), WsfParseNode::Left(), mFileTransitionNodes, mLastNodePtr, WsfParseNode::mValue, WsfParseNode::NextLeaf(), and WsfParseNode::PreviousLeaf().

Referenced by FindLastParseNode(), wizard::WsfEditor::FormatSelection(), GetFileNotifications(), and ParseWorker.

◆ IndexNames()

void wizard::ParseResults::IndexNames ( )
protected

Build an index of 'names' defined in the input file. These are types that do not produce an entry in the parser's type dictionary

References WsfParseNode::cLAZY_TYPENAME_NODE, WsfParseNode::mFlags, mParseTreePtr, WsfParseNode::mType, mTypeNames, mTypeNamesIndexed, WsfParseNode::mValue, and WsfParseNode::Next().

Referenced by GetFileNotifications().

◆ lastNode()

WsfParseNode * wizard::ParseResults::lastNode ( ) const
inline

References mLastNodePtr.

◆ parser()

WsfParser * wizard::ParseResults::parser ( ) const
inline

◆ parseTree()

WsfParseNode * wizard::ParseResults::parseTree ( ) const
inline

References mParseTreePtr.

◆ rootInclude()

const WsfParseSourceInclude * wizard::ParseResults::rootInclude ( ) const
inline

References mRootInclude.

◆ TypeInformationFromNode()

◆ TypeInformationFromPosition()

bool wizard::ParseResults::TypeInformationFromPosition ( const UtTextDocumentLocation & aLocation,
TypeInformation & aInformation )

Attempts to find type information given a location. The location should point to the text referring to the type.

References FindLastParseNode(), and TypeInformationFromNode().

Referenced by wizard::EditAssist::MakeAssistant().

◆ TypeKeyMatches()

bool wizard::ParseResults::TypeKeyMatches ( const WsfParseTypePath & aQuery,
const WsfParseTypePath & aTest )
inline

References mPlatformPartKinds.

Referenced by FindTypeReferenceNodes().

◆ ParseWorker

Member Data Documentation

◆ mErrors

std::vector<WsfParseError*> wizard::ParseResults::mErrors
protected

◆ mFileNotifications

FileNotificationMap wizard::ParseResults::mFileNotifications
protected

Referenced by Clear(), and GetFileNotifications().

◆ mFileTransitionNodes

std::vector<WsfParseNode*> wizard::ParseResults::mFileTransitionNodes

List of leaf nodes which mark the switching of files, in the order of parse tree traversal. Used to quickly search the nodes in a file.

Referenced by Clear(), wizard::WsfStyler::FoldDocument(), GetRangeNodes(), and wizard::WsfStyler::UpdateStyle().

◆ mLastNodePtr

WsfParseNode* wizard::ParseResults::mLastNodePtr
protected

Due to the linked-list nature of the tree, finding the last node is O(Root Commands in all files) Store the last node for quick access.

Referenced by AssignResults(), GetRangeNodes(), lastNode(), and ParseResults().

◆ mParserPtr

WsfParser* wizard::ParseResults::mParserPtr
protected

◆ mParseTreePtr

◆ mPlatformPartKinds

std::vector<UtStringRef> wizard::ParseResults::mPlatformPartKinds
protected

◆ mRootInclude

const WsfParseSourceInclude* wizard::ParseResults::mRootInclude
protected

◆ mTypeNames

std::set<WsfParseTypePath> wizard::ParseResults::mTypeNames
protected

◆ mTypeNamesIndexed

bool wizard::ParseResults::mTypeNamesIndexed
protected

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