|
WSF
|
#include <AutoComplete.hpp>

Classes | |
| struct | Results |
| struct | SyntaxResults |
| struct | Entry |
| struct | Query |
Public Types | |
| using | Syntax = std::vector<std::string> |
| using | SyntaxList = std::vector<Syntax> |
Public Member Functions | |
| AutoComplete () | |
| void | GetSuggestions (ParseResults &aParseData, TextSource &aSource, WsfParseNode *aNodePtr, const std::string &aText, size_t aInsertPosition, Results &aResults) |
| void | GetSyntax (ParseResults &aParseData, TextSource &aSource, WsfParseNode *aNodePtr, const std::string &aText, size_t aInsertPosition, SyntaxResults &aResults) |
Protected Types | |
| enum | Operation { cAUTOCOMPLETE , cSYNTAX } |
Protected Member Functions | |
| SyntaxList | CollectSyntax (Entry *aEntryTreePtr, bool aFirstWord=true) |
| SyntaxList | JoinSyntax (const SyntaxList &aLhs, const SyntaxList &aRhs) |
| void | GetIncludeSuggestions (const std::string &aText, TextSource &aSource, ParseResults &aParseData, Results &aResults) |
| bool | FullyExpandWord (size_t aWordIndex) const |
| void | DigestInput (const std::string &aText, size_t aInputPosition, size_t &aReplaceCharacters, size_t &aInsertPosition) |
| int | ExpandTree (Entry &aEntry, const WsfParseType *aCurrentTypePtr, int aWordIndex, int aMaxWordIndex) |
| bool | TextMatches (const std::string &aText, size_t aWordIndex) |
| bool | TextMatches (const std::string &aText, const std::string &aQuery) |
| WsfParseNode * | FindBlock (WsfParseNode *aNodePtr, int aInsertPosition) |
| bool | ExpandRule (int aWordIndex, WsfParseRule *aReaderPtr, const WsfParseType *aCurrentTypePtr, Entry &aEntry, bool aExpandBlock=false) |
| void | ExpandRefType (Entry &aEntry, const WsfParseType *aCurrentTypePtr, int aWordIndex) |
| void | Prune (int aQueryWordIndex, Entry *&aEntry) |
| void | CollectSuggestions (Entry *aRootEntry, size_t aWordIndex, std::vector< std::string > &aSuggestions, bool &aLastToken) |
| bool | FindSuggestionTerminator (Entry *aEntryWord, std::string &aTerminatorToken) |
| WsfParseNode * | FindNextBlock (WsfParseNode *aBlockPtr) |
| int | CountSuggestions (Entry *aRootEntry) |
| const WsfParseType * | FindCurrentType (WsfParseNode *aNodePtr) |
Protected Attributes | |
| bool | mExpanded |
| ParseResults * | mParseResultsPtr |
| const WsfParseType * | mCurrentTypeRef |
| bool | mExpandTypeCommand |
| Query | mCurrentQuery |
Computes suggestions for the auto-complete popup The algorithm is as follows: Given a starting containing block node B (may be null) and given a starting insert position P:
This words in most cases, but there are a few problems:
Extending valid commands:
processor <internal-link> (implicit mover command)
processor <name> <type> ... end_processor (platform command)
matches:
processor myproc WSF_| ('processor myproc' matches the first rule, leaving us to autocomplete only on WSF_)
end_time 1 m| ('end_time 1 m' matches a rule, leaving no way to autocomplete for 'minutes')
| using wizard::AutoComplete::Syntax = std::vector<std::string> |
| using wizard::AutoComplete::SyntaxList = std::vector<Syntax> |
|
protected |
| wizard::AutoComplete::AutoComplete | ( | ) |
References mCurrentQuery, mCurrentTypeRef, mExpanded, mExpandTypeCommand, and mParseResultsPtr.
|
protected |
References wizard::AutoComplete::Entry::cALTERNATE, wizard::AutoComplete::Entry::cBLOCK_PLACEHOLDER, CollectSuggestions(), wizard::AutoComplete::Entry::cSEQUENCE, wizard::AutoComplete::Entry::cUNEXPANDED, wizard::AutoComplete::Entry::cWORD, FindSuggestionTerminator(), wizard::AutoComplete::Entry::mChildren, wizard::AutoComplete::Entry::mEntryType, wizard::AutoComplete::Entry::mFlags, wizard::AutoComplete::Entry::mWordIsPattern, and wizard::AutoComplete::Entry::mWordText.
Referenced by CollectSuggestions(), and GetSuggestions().
|
protected |
References wizard::AutoComplete::Entry::cALTERNATE, WsfParseRule::cIS_SINGLE_TOKEN, CollectSyntax(), wizard::AutoComplete::Entry::cSEQUENCE, wizard::AutoComplete::Entry::cWORD, WsfParseRule::GetReaderFlags(), JoinSyntax(), wizard::AutoComplete::Entry::mChildren, wizard::AutoComplete::Entry::mEntryType, wizard::AutoComplete::Entry::mReaderPtr, wizard::AutoComplete::Entry::mRuleName, wizard::AutoComplete::Entry::mWordText, and std::swap().
Referenced by CollectSyntax(), and GetSyntax().
|
protected |
|
protected |
References cAUTOCOMPLETE, and mCurrentQuery.
Referenced by GetSuggestions(), and GetSyntax().
|
protected |
References wizard::AutoComplete::Entry::cALTERNATE, wizard::AutoComplete::Entry::cNAMED_WORD, wizard::AutoComplete::Entry::cTYPE_REF_WORD, WsfParseType::GetAncestry(), wizard::AutoComplete::Entry::mChildren, wizard::AutoComplete::Entry::mEntryType, mExpanded, wizard::AutoComplete::Entry::mFlags, wizard::AutoComplete::Entry::mNestedLookup, mParseResultsPtr, wizard::AutoComplete::Entry::mRefType, wizard::AutoComplete::Entry::mWordText, wizard::AutoComplete::Entry::Set(), std::swap(), and wizSignals.
Referenced by ExpandTree().
|
protected |
References wizard::AutoComplete::Entry::cALTERNATE, WsfParseRule::cALTERNATE, wizard::AutoComplete::Entry::cBLOCK_PLACEHOLDER, WsfParseRule::cDELIMITED, WsfParseNode::cERROR_INCOMPLETE, WsfParseRule::cINT, WsfParseRule::cIS_SINGLE_TOKEN, WsfParseNode::cLAZY_TYPE_REFERENCE_NODE, WsfParseNode::cLAZY_TYPENAME_NODE, WsfParseRule::cLINE_STRING, WsfParseRule::cLITERAL, WsfParseTypeInfoData::cLOAD_TYPE, WsfParseNode::cNAMED_NODE, WsfParseRule::cNAMED_RULE, wizard::AutoComplete::Entry::cNAMED_WORD, WsfParseRule::cQUOTED_STRING, WsfParseRule::cREAL, WsfParseRule::cRECURRENCE, WsfParseRule::cRULE_REFERENCE, wizard::AutoComplete::Entry::cSEQUENCE, WsfParseRule::cSEQUENCE, WsfParseRule::cSTRING, WsfParseRule::cSTRUCT, wizard::AutoComplete::Entry::cTYPE_CHANGE, WsfParseRule::cTYPE_COMMAND, WsfParseRule::cTYPE_LOAD, wizard::AutoComplete::Entry::cTYPE_REF_WORD, wizard::AutoComplete::Entry::cUNEXPANDED, WsfParseRule::cVALUE, ExpandRule(), WsfParseType::FindNestedSymbol(), WsfParseNamedRule::GetDefinition(), WsfParseTypeLoadRule::GetLoadType(), WsfParseTypeLoadRule::GetOperation(), WsfParseRule::GetReaderFlags(), WsfParseAlternate::GetReaders(), WsfParseType::GetRule(), WsfParseRuleReference::GetRulePtr(), WsfParseRule::GetSubordinateRule(), wizard::AutoComplete::Entry::mChildren, wizard::AutoComplete::Entry::mCommandWordIndex, wizard::AutoComplete::Entry::mComplete, wizard::AutoComplete::Entry::mCurrentTypeChangePtr, wizard::AutoComplete::Entry::mEntryType, mExpandTypeCommand, wizard::AutoComplete::Entry::mFlags, WsfParseStringRule::mFlags, WsfParseTypeLoadRule::mLoadType, WsfParseTypeName::mNestedLookup, WsfParseSequence::mNodeFlags, WsfParseStringRule::mNodeType, WsfParseTypeName::mOrdinal, wizard::AutoComplete::Entry::mParentCommandPtr, WsfParseTypeName::mPath, wizard::AutoComplete::Entry::mReaderPtr, wizard::AutoComplete::Entry::mRefType, wizard::AutoComplete::Entry::mRuleName, WsfParseLiteral::mText, wizard::AutoComplete::Entry::mWordCount, wizard::AutoComplete::Entry::mWordIsPattern, wizard::AutoComplete::Entry::mWordText, ok, WsfParseSequence::Sequence(), wizard::AutoComplete::Entry::Set(), wizard::AutoComplete::Entry::SetNameRef(), wizard::AutoComplete::Entry::SetTypeRef(), and WsfParseRule::Type().
Referenced by ExpandRule(), ExpandTree(), GetSuggestions(), and GetSyntax().
|
protected |
References wizard::AutoComplete::Entry::cALTERNATE, wizard::AutoComplete::Entry::cSEQUENCE, wizard::AutoComplete::Entry::cTYPE_CHANGE, wizard::AutoComplete::Entry::cUNEXPANDED, wizard::AutoComplete::Entry::cWORD, ExpandRefType(), ExpandRule(), ExpandTree(), FullyExpandWord(), wizard::AutoComplete::Entry::GetWordCount(), wizard::AutoComplete::Entry::mChildren, wizard::AutoComplete::Entry::mComplete, wizard::AutoComplete::Entry::mCurrentTypeChangePtr, wizard::AutoComplete::Entry::mEntryType, mExpanded, wizard::AutoComplete::Entry::mReaderPtr, wizard::AutoComplete::Entry::mRefType, wizard::AutoComplete::Entry::mWordCount, and std::swap().
Referenced by ExpandTree(), GetSuggestions(), and GetSyntax().
|
protected |
|
protected |
References WsfParseNode::cLOAD_TYPE_NODE, WsfParseTypeInfoData::cNESTED_LOAD, WsfParseTypeInfoData::cNESTED_SAVE, WsfParseType::FindType(), WsfParseNode::GetAuxiliaryValue(), WsfParseNode::GetParent(), WsfParseNode::Left(), WsfParseNode::mFlags, WsfParseTypeInfoData::mFlags, WsfParseTypeInfoData::mLoadKey, mParseResultsPtr, and WsfParseTypeInfoData::mSaveKey.
Referenced by GetSuggestions(), and GetSyntax().
|
protected |
References WsfParseNode::cBLOCK_NODE, WsfParseNode::GetParent(), and WsfParseNode::mFlags.
Referenced by GetSuggestions(), and GetSyntax().
|
protected |
Attempt to find a terminator for a command. For example, given the rule: platform <name> <type> <BLOCK> end_platform
Input: plat| Suggestion-> platform...end_platform
References WsfParseRule::cRECURRENCE, wizard::AutoComplete::Entry::mCommandWordIndex, WsfParseRecurrence::mEndKeyword, wizard::AutoComplete::Entry::mParentCommandPtr, WsfParseSequence::Sequence(), and WsfParseRule::Type().
Referenced by CollectSuggestions().
|
protected |
References cAUTOCOMPLETE, and mCurrentQuery.
Referenced by ExpandTree().
|
protected |
| void wizard::AutoComplete::GetSuggestions | ( | ParseResults & | aParseData, |
| TextSource & | aSource, | ||
| WsfParseNode * | aNodePtr, | ||
| const std::string & | aText, | ||
| size_t | aInsertPosition, | ||
| Results & | aResults ) |
References wizard::AutoComplete::Entry::cALTERNATE, cAUTOCOMPLETE, CollectSuggestions(), WsfParseRule::cRECURRENCE, DigestInput(), ExpandRule(), ExpandTree(), FindCurrentType(), FindNextBlock(), WsfParser::GetDefinitions(), GetIncludeSuggestions(), WsfParseDefinitions::GetRoot(), wizard::AutoComplete::Entry::mChildren, mCurrentQuery, mCurrentTypeRef, wizard::AutoComplete::Entry::mEntryType, mExpanded, wizard::AutoComplete::Results::mInsertPosition, wizard::AutoComplete::Results::mLastToken, mParseResultsPtr, wizard::AutoComplete::Results::mPartialToken, wizard::AutoComplete::Results::mReplaceCharacters, WsfParseNode::mRulePtr, wizard::AutoComplete::Results::mSuggestionList, wizard::ParseResults::parser(), Prune(), and WsfParseRule::Type().
| void wizard::AutoComplete::GetSyntax | ( | ParseResults & | aParseData, |
| TextSource & | aSource, | ||
| WsfParseNode * | aNodePtr, | ||
| const std::string & | aText, | ||
| size_t | aInsertPosition, | ||
| SyntaxResults & | aResults ) |
References wizard::AutoComplete::Entry::cALTERNATE, CollectSyntax(), WsfParseRule::cRECURRENCE, cSYNTAX, DigestInput(), ExpandRule(), ExpandTree(), FindCurrentType(), FindNextBlock(), WsfParser::GetDefinitions(), WsfParseDefinitions::GetRoot(), wizard::AutoComplete::Entry::mChildren, wizard::AutoComplete::SyntaxResults::mConcreteWordCount, mCurrentQuery, mCurrentTypeRef, wizard::AutoComplete::Entry::mEntryType, mExpanded, mParseResultsPtr, WsfParseNode::mRulePtr, wizard::AutoComplete::SyntaxResults::mSequences, wizard::AutoComplete::SyntaxResults::mWordIndex, wizard::ParseResults::parser(), Prune(), and WsfParseRule::Type().
Referenced by wizard::SyntaxTips::UpdateSuggestions().
|
protected |
Referenced by CollectSyntax().
|
protected |
References wizard::AutoComplete::Entry::cALTERNATE, wizard::AutoComplete::Entry::cNONE, wizard::AutoComplete::Entry::cSEQUENCE, wizard::AutoComplete::Entry::cUNEXPANDED, wizard::AutoComplete::Entry::cWORD, wizard::AutoComplete::Entry::mChildren, mCurrentQuery, wizard::AutoComplete::Entry::mEntryType, wizard::AutoComplete::Entry::mWordIsPattern, wizard::AutoComplete::Entry::mWordText, Prune(), and TextMatches().
Referenced by GetSuggestions(), GetSyntax(), and Prune().
|
protected |
|
protected |
References mCurrentQuery, and TextMatches().
Referenced by Prune(), and TextMatches().
|
protected |
Referenced by AutoComplete(), DigestInput(), FullyExpandWord(), GetSuggestions(), GetSyntax(), Prune(), and TextMatches().
|
protected |
Referenced by AutoComplete(), GetSuggestions(), and GetSyntax().
|
protected |
Referenced by AutoComplete(), ExpandRefType(), ExpandTree(), GetSuggestions(), and GetSyntax().
|
protected |
Referenced by AutoComplete(), and ExpandRule().
|
protected |
Referenced by AutoComplete(), ExpandRefType(), FindCurrentType(), GetIncludeSuggestions(), GetSuggestions(), and GetSyntax().